authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-03-13 04:07:26+01:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-03-13 04:07:26+01:00
log26f2749c1e843176c821bd9d5f527585ba43843f
treeb21fe830a40f2c8cccf509a873598fd1f67fac63
parent627f03af9d90e0ac33834b4dd04a3a0adc9bbcef
parent3e9ab94d290a52ae6119e92cb8a1e9d0ff4a7423

Merge pull request 'FreeBSD libc: guard ssp headers and definitions introduced in FreeBSD 15' (#31457) from kid/zig:fbsd-libc-guard into master

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31457 Reviewed-by: Alex Rønne Petersen <alex@alexrp.com>

26 files changed, 114 insertions(+), 0 deletions(-)

lib/libc/include/generic-freebsd/poll.h+3
......@@ -109,9 +109,12 @@ typedef __sigset_t sigset_t;
109109
110110#endif
111111
112// zig patch: ssp/poll.h header was added in FreeBSD 15
113#if __FreeBSD_version >= 1500500
112114#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0
113115#include <ssp/poll.h>
114116#endif
117#endif
115118
116119__BEGIN_DECLS
117120int poll(struct pollfd _pfd[], nfds_t _nfds, int _timeout);
lib/libc/include/generic-freebsd/signal.h+3
......@@ -72,9 +72,12 @@ typedef __pthread_t pthread_t;
7272#endif
7373#endif /* __POSIX_VISIBLE || __XSI_VISIBLE */
7474
75// zig patch: ssp/signal.h header was added in FreeBSD 15
76#if __FreeBSD_version >= 1500500
7577#if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0
7678#include <ssp/signal.h>
7779#endif
80#endif
7881
7982__BEGIN_DECLS
8083int raise(int);
lib/libc/include/generic-freebsd/ssp/poll.h+6
......@@ -24,6 +24,12 @@
2424 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2525 * POSSIBILITY OF SUCH DAMAGE.
2626 */
27
28// zig patch: ssp/poll.h header was added in FreeBSD 15
29#if __FreeBSD_version < 1500500
30 #error "ssp/poll.h did not exist before FreeBSD 15"
31#endif /* error for FreeBSD before 15 */
32
2733#ifndef _SSP_POLL_H_
2834#define _SSP_POLL_H_
2935
lib/libc/include/generic-freebsd/ssp/random.h+6
......@@ -24,6 +24,12 @@
2424 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2525 * POSSIBILITY OF SUCH DAMAGE.
2626 */
27
28// zig patch: ssp/random.h header was added in FreeBSD 15
29#if __FreeBSD_version < 1500500
30 #error "ssp/random.h did not exist before FreeBSD 15"
31#endif /* error for FreeBSD before 15 */
32
2733#ifndef _SSP_RANDOM_H_
2834#define _SSP_RANDOM_H_
2935
lib/libc/include/generic-freebsd/ssp/signal.h+6
......@@ -24,6 +24,12 @@
2424 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2525 * POSSIBILITY OF SUCH DAMAGE.
2626 */
27
28// zig patch: ssp/signal.h header was added in FreeBSD 15
29#if __FreeBSD_version < 1500500
30 #error "ssp/signal.h did not exist before FreeBSD 15"
31#endif /* error for FreeBSD before 15 */
32
2733#ifndef _SSP_SIGNAL_H_
2834#define _SSP_SIGNAL_H_
2935
lib/libc/include/generic-freebsd/ssp/socket.h+6
......@@ -24,6 +24,12 @@
2424 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2525 * POSSIBILITY OF SUCH DAMAGE.
2626 */
27
28// zig patch: ssp/socket.h header was added in FreeBSD 15
29#if __FreeBSD_version < 1500500
30 #error "ssp/socket.h did not exist before FreeBSD 15"
31#endif /* error for FreeBSD before 15 */
32
2733#ifndef _SSP_SOCKET_H_
2834#define _SSP_SOCKET_H_
2935
lib/libc/include/generic-freebsd/ssp/ssp.h+6
......@@ -31,6 +31,12 @@
3131 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3232 * POSSIBILITY OF SUCH DAMAGE.
3333 */
34
35// zig patch: ssp/ssp.h header was added in FreeBSD 15
36#if __FreeBSD_version < 1500500
37 #error "ssp/ssp.h did not exist before FreeBSD 15"
38#endif /* error for FreeBSD before 15 */
39
3440#ifndef _SSP_SSP_H_
3541#define _SSP_SSP_H_
3642
lib/libc/include/generic-freebsd/ssp/stdio.h+6
......@@ -31,6 +31,12 @@
3131 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3232 * POSSIBILITY OF SUCH DAMAGE.
3333 */
34
35// zig patch: ssp/stdio.h header was added in FreeBSD 15
36#if __FreeBSD_version < 1500500
37 #error "ssp/stdio.h did not exist before FreeBSD 15"
38#endif /* error for FreeBSD before 15 */
39
3440#ifndef _SSP_STDIO_H_
3541#define _SSP_STDIO_H_
3642
lib/libc/include/generic-freebsd/ssp/stdlib.h+6
......@@ -24,6 +24,12 @@
2424 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2525 * POSSIBILITY OF SUCH DAMAGE.
2626 */
27
28// zig patch: ssp/stdlib.h header was added in FreeBSD 15
29#if __FreeBSD_version < 1500500
30 #error "ssp/stdlib.h did not exist before FreeBSD 15"
31#endif /* error for FreeBSD before 15 */
32
2733#ifndef _SSP_STDLIB_H_
2834#define _SSP_STDLIB_H_
2935
lib/libc/include/generic-freebsd/ssp/string.h+6
......@@ -31,6 +31,12 @@
3131 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3232 * POSSIBILITY OF SUCH DAMAGE.
3333 */
34
35// zig patch: ssp/string.h header was added in FreeBSD 15
36#if __FreeBSD_version < 1500500
37 #error "ssp/string.h did not exist before FreeBSD 15"
38#endif /* error for FreeBSD before 15 */
39
3440#ifndef _SSP_STRING_H_
3541#define _SSP_STRING_H_
3642
lib/libc/include/generic-freebsd/ssp/strings.h+6
......@@ -31,6 +31,12 @@
3131 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3232 * POSSIBILITY OF SUCH DAMAGE.
3333 */
34
35// zig patch: ssp/strings.h header was added in FreeBSD 15
36#if __FreeBSD_version < 1500500
37 #error "ssp/strings.h did not exist before FreeBSD 15"
38#endif /* error for FreeBSD before 15 */
39
3440#ifndef _SSP_STRINGS_H_
3541#define _SSP_STRINGS_H_
3642
lib/libc/include/generic-freebsd/ssp/uio.h+6
......@@ -24,6 +24,12 @@
2424 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2525 * POSSIBILITY OF SUCH DAMAGE.
2626 */
27
28// zig patch: ssp/uio.h header was added in FreeBSD 15
29#if __FreeBSD_version < 1500500
30 #error "ssp/uio.h did not exist before FreeBSD 15"
31#endif /* error for FreeBSD before 15 */
32
2733#ifndef _SSP_UIO_H_
2834#define _SSP_UIO_H_
2935
lib/libc/include/generic-freebsd/ssp/unistd.h+6
......@@ -31,6 +31,12 @@
3131 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3232 * POSSIBILITY OF SUCH DAMAGE.
3333 */
34
35// zig patch: ssp/unistd.h header was added in FreeBSD 15
36#if __FreeBSD_version < 1500500
37 #error "ssp/unistd.h did not exist before FreeBSD 15"
38#endif /* error for FreeBSD before 15 */
39
3440#ifndef _SSP_UNISTD_H_
3541#define _SSP_UNISTD_H_
3642
lib/libc/include/generic-freebsd/ssp/wchar.h+6
......@@ -24,6 +24,12 @@
2424 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2525 * POSSIBILITY OF SUCH DAMAGE.
2626 */
27
28// zig patch: ssp/wchar.h header was added in FreeBSD 15
29#if __FreeBSD_version < 1500500
30 #error "ssp/wchar.h did not exist before FreeBSD 15"
31#endif /* error for FreeBSD before 15 */
32
2733#ifndef _SSP_WCHAR_H_
2834#define _SSP_WCHAR_H_
2935
lib/libc/include/generic-freebsd/stdio.h+3
......@@ -252,9 +252,12 @@ __END_DECLS
252252#define L_ctermid 1024 /* size for ctermid(3); PATH_MAX */
253253#endif /* __POSIX_VISIBLE */
254254
255// zig patch: ssp/stdio.h header was added in FreeBSD 15
256#if __FreeBSD_version >= 1500500
255257#if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0
256258#include <ssp/stdio.h>
257259#endif
260#endif
258261
259262__BEGIN_DECLS
260263#ifdef _XLOCALE_H_
lib/libc/include/generic-freebsd/stdlib.h+3
......@@ -69,9 +69,12 @@ typedef struct {
6969 */
7070#define RAND_MAX 0x7fffffff
7171
72// zig patch: ssp/stdlib.h header was added in FreeBSD 15
73#if __FreeBSD_version >= 1500500
7274#if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0
7375#include <ssp/stdlib.h>
7476#endif
77#endif
7578
7679__BEGIN_DECLS
7780#ifdef _XLOCALE_H_
lib/libc/include/generic-freebsd/string.h+3
......@@ -49,9 +49,12 @@ typedef __size_t size_t;
4949#define _SIZE_T_DECLARED
5050#endif
5151
52// zig patch: ssp/string.h header was added in FreeBSD 15
53#if __FreeBSD_version >= 1500500
5254#if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0
5355#include <ssp/string.h>
5456#endif
57#endif
5558
5659__BEGIN_DECLS
5760#if __XSI_VISIBLE >= 600 || __ISO_C_VISIBLE >= 2023
lib/libc/include/generic-freebsd/strings.h+3
......@@ -37,9 +37,12 @@ typedef __size_t size_t;
3737#define _SIZE_T_DECLARED
3838#endif
3939
40// zig patch: ssp/strings.h header was added in FreeBSD 15
41#if __FreeBSD_version >= 1500500
4042#if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0
4143#include <ssp/strings.h>
4244#endif
45#endif
4346
4447__BEGIN_DECLS
4548#if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112
lib/libc/include/generic-freebsd/sys/libkern.h+3
......@@ -334,10 +334,13 @@ signed_extend32(uint32_t bitmap, int lsb, int width)
334334#define FNM_IGNORECASE FNM_CASEFOLD
335335#define FNM_FILE_NAME FNM_PATHNAME
336336
337// zig patch: ssp/ssp.h header and __ssp_real were added in FreeBSD 15
338#if __FreeBSD_version >= 1500500
337339#if !defined(_KERNEL) && __has_include(<ssp/ssp.h>)
338340#include <ssp/ssp.h> /* __ssp_real */
339341#else
340342#define __ssp_real(fun) fun
341343#endif
344#endif
342345
343346#endif /* !_SYS_LIBKERN_H_ */
\ No newline at end of file
lib/libc/include/generic-freebsd/sys/poll.h+3
......@@ -109,9 +109,12 @@ typedef __sigset_t sigset_t;
109109
110110#endif
111111
112// zig patch: ssp/poll.h header was added in FreeBSD 15
113#if __FreeBSD_version >= 1500500
112114#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0
113115#include <ssp/poll.h>
114116#endif
117#endif
115118
116119__BEGIN_DECLS
117120int poll(struct pollfd _pfd[], nfds_t _nfds, int _timeout);
lib/libc/include/generic-freebsd/sys/random.h+3
......@@ -156,9 +156,12 @@ random_harvest_direct(const void *entropy, u_int size, enum random_entropy_sourc
156156
157157#else /* !_KERNEL */
158158
159// zig patch: ssp/random.h header was added in FreeBSD 15
160#if __FreeBSD_version >= 1500500
159161#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0
160162#include <ssp/random.h>
161163#endif
164#endif
162165
163166#endif /* _KERNEL */
164167
lib/libc/include/generic-freebsd/sys/select.h+3
......@@ -49,11 +49,14 @@ typedef __fd_mask fd_mask;
4949typedef __sigset_t sigset_t;
5050#endif
5151
52// zig patch: ssp/ssp.h header and __SSP_FORTIFY_LEVEL were added in FreeBSD 15
53#if __FreeBSD_version >= 1500500
5254#if !defined(_KERNEL) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0
5355#include <ssp/ssp.h>
5456#else
5557#define __SSP_FORTIFY_LEVEL 0
5658#endif
59#endif
5760
5861/*
5962 * Select uses bit masks of file descriptors in longs. These macros
lib/libc/include/generic-freebsd/sys/socket.h+3
......@@ -691,9 +691,12 @@ struct splice {
691691
692692#ifndef _KERNEL
693693
694// zig patch: ssp/socket.h header was added in FreeBSD 15
695#if __FreeBSD_version >= 1500500
694696#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0
695697#include <ssp/socket.h>
696698#endif
699#endif
697700
698701#include <sys/cdefs.h>
699702
lib/libc/include/generic-freebsd/sys/uio.h+3
......@@ -101,9 +101,12 @@ int uiomove_object(struct vm_object *obj, off_t obj_size, struct uio *uio);
101101
102102#else /* !_KERNEL */
103103
104// zig patch: ssp/uio.h header was added in FreeBSD 15
105#if __FreeBSD_version >= 1500500
104106#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0
105107#include <ssp/uio.h>
106108#endif
109#endif
107110
108111__BEGIN_DECLS
109112ssize_t readv(int, const struct iovec *, int);
lib/libc/include/generic-freebsd/unistd.h+3
......@@ -37,9 +37,12 @@
3737#include <sys/_null.h>
3838#include <sys/_types.h>
3939
40// zig patch: ssp/unistd.h header was added in FreeBSD 15
41#if __FreeBSD_version >= 1500500
4042#if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0
4143#include <ssp/unistd.h>
4244#endif
45#endif
4346
4447#ifndef _GID_T_DECLARED
4548typedef __gid_t gid_t;
lib/libc/include/generic-freebsd/wchar.h+3
......@@ -112,9 +112,12 @@ __BEGIN_DECLS
112112size_t wcslen(const wchar_t *) __pure;
113113__END_DECLS
114114
115// zig patch: ssp/wchar.h header was added in FreeBSD 15
116#if __FreeBSD_version >= 1500500
115117#if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0
116118#include <ssp/wchar.h>
117119#endif
120#endif
118121
119122__BEGIN_DECLS
120123wint_t btowc(int);