diff options
Diffstat (limited to 'include')
209 files changed, 1939 insertions, 805 deletions
diff --git a/include/Makefile b/include/Makefile index 8d847a3a8dd2..af7ef2337941 100644 --- a/include/Makefile +++ b/include/Makefile @@ -1,21 +1,25 @@ -# @(#)Makefile 8.2 (Berkeley) 1/4/94 -# $FreeBSD$ -# # Doing a "make install" builds /usr/include. .include <src.opts.mk> -PACKAGE=runtime +PACKAGE=clibs CLEANFILES= osreldate.h version -SUBDIR= arpa protocols rpcsvc rpc xlocale +SUBDIR= arpa protocols rpcsvc rpc ssp xlocale .if ${MACHINE_CPUARCH} == "amd64" -SUBDIR+= i386 +SUBDIR+= i386 +INCLUDE_SUBDIRS+= i386 +.endif +.if ${MACHINE_CPUARCH} == "aarch64" +SUBDIR+= arm +INCLUDE_SUBDIRS+= arm .endif SUBDIR_PARALLEL= -INCS= a.out.h ar.h assert.h bitstring.h complex.h cpio.h _ctype.h ctype.h \ +INCS= a.out.h ar.h assert.h bitstring.h byteswap.h \ + complex.h cpio.h _ctype.h ctype.h \ db.h \ - dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \ - fts.h ftw.h getopt.h glob.h grp.h \ + dirent.h dlfcn.h elf.h elf-hints.h endian.h err.h exterr.h \ + fmtmsg.h fnmatch.h \ + fstab.h fts.h ftw.h getopt.h glob.h grp.h \ ieeefp.h ifaddrs.h \ inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \ locale.h malloc.h malloc_np.h memory.h monetary.h mpool.h mqueue.h \ @@ -25,7 +29,7 @@ INCS= a.out.h ar.h assert.h bitstring.h complex.h cpio.h _ctype.h ctype.h \ pthread_np.h pwd.h ranlib.h readpassphrase.h regex.h \ res_update.h resolv.h runetype.h sched.h \ search.h semaphore.h setjmp.h \ - signal.h spawn.h stab.h stdalign.h stdbool.h stddef.h \ + signal.h spawn.h stab.h stdalign.h stdbool.h stdckdint.h stddef.h \ stdnoreturn.h stdio.h stdlib.h string.h stringlist.h \ strings.h sysexits.h tar.h termios.h tgmath.h \ time.h timeconv.h timers.h ttyent.h \ @@ -35,21 +39,21 @@ INCS= a.out.h ar.h assert.h bitstring.h complex.h cpio.h _ctype.h ctype.h \ .PATH: ${SRCTOP}/contrib/libc-vis INCS+= vis.h -MHDRS= float.h floatingpoint.h stdarg.h +MHDRS= float.h floatingpoint.h -PHDRS= _semaphore.h +PHDRS= _semaphore.h stdarg.h LHDRS= aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \ syslog.h ucontext.h LDIRS= geom net net80211 netgraph netinet netinet6 \ - netipsec netsmb nfs nfsclient nfsserver sys vm + netipsec netlink netsmb nfs nfsclient nfsserver sys vm LSUBDIRS= dev/acpica dev/agp dev/ciss dev/filemon dev/firewire \ dev/hwpmc dev/hyperv \ - dev/ic dev/iicbus dev/io dev/mfi dev/mmc dev/nvme \ + dev/ic dev/iicbus dev/io dev/mfi dev/mmc \ dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/pwm \ - dev/smbus dev/speaker dev/tcp_log dev/veriexec dev/vkbd \ + dev/smbus dev/speaker dev/tcp_log dev/veriexec dev/vkbd dev/wg \ fs/devfs fs/fdescfs fs/msdosfs fs/nfs fs/nullfs \ fs/procfs fs/smbfs fs/udf fs/unionfs \ geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \ @@ -57,11 +61,14 @@ LSUBDIRS= dev/acpica dev/agp dev/ciss dev/filemon dev/firewire \ geom/raid geom/raid3 geom/shsec geom/stripe geom/union geom/virstor \ net/altq \ net/route \ - netgraph/atm netgraph/netflow \ + netgraph/netflow \ netinet/cc \ netinet/netdump \ netinet/tcp_stacks \ - security/mac_biba security/mac_bsdextended security/mac_lomac \ + netlink/route \ + security/mac_biba security/mac_bsdextended \ + security/mac_grantbylabel \ + security/mac_lomac \ security/mac_mls security/mac_partition \ security/mac_veriexec \ sys/disk \ @@ -90,10 +97,10 @@ BSM= audit.h \ BSMPACKAGE= libbsm BSMDIR= ${INCLUDEDIR}/bsm -.PATH: ${SRCTOP}/sys/security/audit -SECAUDIT= audit.h \ - audit_ioctl.h \ - audit_private.h +.PATH: ${SRCTOP}/sys/security +SECAUDIT= audit/audit.h \ + audit/audit_ioctl.h \ + audit/audit_private.h SECAUDITPACKAGE= libbsm SECAUDITDIR= ${INCLUDEDIR}/security/audit @@ -172,6 +179,15 @@ HYPERVDIR= ${INCLUDEDIR}/dev/hyperv OPENCRYPTO= cryptodev.h OPENCRYPTODIR= ${INCLUDEDIR}/crypto +.PATH: ${SRCTOP}/sys/dev/nvme +NVME= nvme.h +NVMEDIR= ${INCLUDEDIR}/dev/nvme + +.PATH: ${SRCTOP}/sys/dev/nvmf +NVMF= nvmf.h \ + nvmf_proto.h +NVMFDIR= ${INCLUDEDIR}/dev/nvmf + .PATH: ${SRCTOP}/sys/dev/pci PCI= pcireg.h PCIDIR= ${INCLUDEDIR}/dev/pci @@ -203,7 +219,8 @@ IPFILTERDIR= ${INCLUDEDIR}/netinet .PATH: ${SRCTOP}/sys/netpfil/pf PF= pf.h \ pf_altq.h \ - pf_mtag.h + pf_mtag.h \ + pf_nl.h PFPACKAGE= pf PFDIR= ${INCLUDEDIR}/netpfil/pf @@ -224,6 +241,10 @@ NVPAIRDIR= ${INCLUDEDIR}/sys MLX5= mlx5io.h MLX5DIR= ${INCLUDEDIR}/dev/mlx5 +.PATH: ${SRCTOP}/sys/dev/wg +WG= if_wg.h +WGDIR= ${INCLUDEDIR}/dev/wg + INCSGROUPS= INCS \ ACPICA \ AGP \ @@ -239,11 +260,14 @@ INCSGROUPS= INCS \ HID \ HYPERV \ OPENCRYPTO \ + NVME \ + NVMF \ PCI \ RPC \ SECAUDIT \ TEKEN \ - VERIEXEC + VERIEXEC \ + WG .if ${MK_IPFILTER} != "no" INCSGROUPS+= IPFILTER @@ -287,6 +311,13 @@ INCS+= iconv.h LSUBDIRS+= dev/usb .endif +.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "aarch64" || \ + ${MACHINE_CPUARCH} == "riscv" +.if ${MK_BHYVE} != "no" +LSUBDIRS+= dev/vmm +.endif +.endif + .if ${MACHINE_CPUARCH} == "powerpc" && ${MACHINE_ARCH} != "powerpcspe" _dev_powermac_nvram= dev/powermac_nvram .endif @@ -330,7 +361,7 @@ _MARCHS+= x86 META_TARGETS+= compat stage_includes: ${SHARED} -SDESTDIR= ${SYSROOT:U${DESTDIR}} +SDESTDIR?= ${SYSROOT:U${DESTDIR}} # Take care of stale directory-level symlinks. # Note: The "|| true" after find is needed in case one of the directories does @@ -341,40 +372,40 @@ compat: mtree -deU ${NO_ROOT:D-W} ${MTREE_FOLLOWS_SYMLINKS} \ -f ${SRCTOP}/etc/mtree/BSD.include.dist \ -p ${SDESTDIR}${INCLUDEDIR} > /dev/null -.if ${MACHINE_CPUARCH} == "amd64" +.for d in ${INCLUDE_SUBDIRS} ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \ - ${SDESTDIR}${INCLUDEDIR}/i386 -.endif + ${SDESTDIR}${INCLUDEDIR}/${d} +.endfor copies: .PHONY .META cd ${SDESTDIR}${INCLUDEDIR}; find ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} crypto \ machine machine/pc ${_MARCHS} -maxdepth 1 -mindepth 1 -type l \ -name "*.h" -print -delete || true -.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hid:Ndev/hyperv:Ndev/pci:Ndev/veriexec} ${LSUBSUBDIRS} +.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hid:Ndev/hyperv:Ndev/pci:Ndev/veriexec:Ndev/wg} ${LSUBSUBDIRS} cd ${SRCTOP}/sys; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ + ${INSTALL} -C ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ ${SDESTDIR}${INCLUDEDIR}/$i .endfor cd ${SRCTOP}/sys/${MACHINE}/include; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ + ${INSTALL} -C ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ ${SDESTDIR}${INCLUDEDIR}/machine .if exists(${SRCTOP}/sys/${MACHINE}/include/pc) cd ${SRCTOP}/sys/${MACHINE}/include/pc; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ + ${INSTALL} -C ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ ${SDESTDIR}${INCLUDEDIR}/machine/pc .endif .for _MARCH in ${_MARCHS} .if exists(${SRCTOP}/sys/${_MARCH}/include) - ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \ + ${INSTALL} -d ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 755 \ ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; \ cd ${SRCTOP}/sys/${_MARCH}/include; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ + ${INSTALL} -C ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ ${SDESTDIR}${INCLUDEDIR}/${_MARCH} .if exists(${SRCTOP}/sys/${_MARCH}/include/pc) - ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \ + ${INSTALL} -d ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 755 \ ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ cd ${SRCTOP}/sys/${_MARCH}/include/pc; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ + ${INSTALL} -C ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc .endif .endif @@ -386,7 +417,7 @@ symlinks: .PHONY .META cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ $$(printf '../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i .endfor -.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hid:Ndev/hyperv:Ndev/pci:Ndev/veriexec} +.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hid:Ndev/hyperv:Ndev/pci:Ndev/veriexec:Ndev/wg} cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ $$(printf '../../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i .endfor @@ -479,3 +510,16 @@ HOST_MACHINE_ARCH!= uname -p MACHINE:= ${HOST_MACHINE} MACHINE_ARCH:= ${HOST_MACHINE_ARCH} .endif + +check-ldirs: + missing_dirs=""; \ + for dir in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS}; do \ + if [ ! -d ${SRCTOP}/sys/$$dir ]; then \ + echo "${SRCTOP}/sys/$$dir"; \ + missing_dirs="$$missing_dirs $$dir"; \ + fi; \ + done; \ + if [ -n "$$missing_dirs" ]; then \ + echo "Nonexistant directories:" $$missing_dirs; \ + false; \ + fi diff --git a/include/Makefile.depend b/include/Makefile.depend index d7cfba0e4f6e..d04576c4c409 100644 --- a/include/Makefile.depend +++ b/include/Makefile.depend @@ -1,8 +1,7 @@ -# $FreeBSD$ # Autogenerated - do NOT edit! DIRDEPS = \ - usr.bin/xinstall.host \ + bin/sh.host \ .include <dirdeps.mk> diff --git a/include/Makefile.inc b/include/Makefile.inc new file mode 100644 index 000000000000..14d7bf96e6bc --- /dev/null +++ b/include/Makefile.inc @@ -0,0 +1,2 @@ +# Make sure all our subdirectory headers end up in clibs-dev +PACKAGE=clibs diff --git a/include/_ctype.h b/include/_ctype.h index 96fbaeba00d6..28815f9f4571 100644 --- a/include/_ctype.h +++ b/include/_ctype.h @@ -35,10 +35,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * From @(#)ctype.h 8.4 (Berkeley) 1/21/94 * From FreeBSD: src/include/ctype.h,v 1.27 2004/06/23 07:11:39 tjr Exp - * $FreeBSD$ */ #ifndef __CTYPE_H_ diff --git a/include/a.out.h b/include/a.out.h index d532d062cacf..02d9fca15441 100644 --- a/include/a.out.h +++ b/include/a.out.h @@ -27,9 +27,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)a.out.h 8.1 (Berkeley) 6/2/93 - * $FreeBSD$ */ #ifndef _AOUT_H_ diff --git a/include/ar.h b/include/ar.h index 01a57a57d785..70bf8ca206b6 100644 --- a/include/ar.h +++ b/include/ar.h @@ -35,10 +35,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)ar.h 8.2 (Berkeley) 1/21/94 - * - * $FreeBSD$ */ #ifndef _AR_H_ diff --git a/include/arm/Makefile b/include/arm/Makefile new file mode 100644 index 000000000000..27fa8dfb9de3 --- /dev/null +++ b/include/arm/Makefile @@ -0,0 +1,59 @@ +# arm headers installed on arm64 + +.PATH: ${SRCTOP}/sys/arm/include ${SRCTOP}/lib/msun/arm + +INCS= _align.h \ + _inttypes.h \ + _limits.h \ + _stdint.h \ + _types.h \ + acle-compat.h \ + armreg.h \ + asm.h \ + atomic.h \ + bus.h \ + counter.h \ + cpu.h \ + cpufunc.h \ + cpuinfo.h \ + efi.h \ + elf.h \ + exec.h \ + float.h \ + frame.h \ + ieeefp.h \ + param.h \ + pcb.h \ + pcpu.h \ + pmap.h \ + proc.h \ + profile.h \ + pte.h \ + reg.h \ + reloc.h \ + resource.h \ + setjmp.h \ + signal.h \ + sysarch.h \ + sysreg.h \ + tls.h \ + ucontext.h \ + vdso.h \ + vfp.h \ + vmparam.h +# These kernel-only headers are used by procstat's ZFS support. +# This should be fixed. +INCS+= pcpu_aux.h \ + sf_buf.h +# from lib/msun/arm +INCS+= fenv.h +INCSDIR= ${INCLUDEDIR}/arm + +beforeinstall: armdir +META_TARGETS+= armdir + +armdir: + ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \ + ${DESTDIR}${INCLUDEDIR}/arm + +.include <bsd.prog.mk> diff --git a/include/arpa/Makefile b/include/arpa/Makefile index 77ac03c3f14b..ba589cc192fd 100644 --- a/include/arpa/Makefile +++ b/include/arpa/Makefile @@ -1,5 +1,3 @@ -# $FreeBSD$ - .include <src.opts.mk> INCS= ftp.h inet.h nameser.h nameser_compat.h tftp.h diff --git a/include/arpa/Makefile.depend b/include/arpa/Makefile.depend index f80275d86ab1..11aba52f82cf 100644 --- a/include/arpa/Makefile.depend +++ b/include/arpa/Makefile.depend @@ -1,4 +1,3 @@ -# $FreeBSD$ # Autogenerated - do NOT edit! DIRDEPS = \ diff --git a/include/arpa/ftp.h b/include/arpa/ftp.h index 5ba431529404..3f7100e300e1 100644 --- a/include/arpa/ftp.h +++ b/include/arpa/ftp.h @@ -27,10 +27,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)ftp.h 8.1 (Berkeley) 6/2/93 - * - * $FreeBSD$ */ #ifndef _ARPA_FTP_H_ diff --git a/include/arpa/inet.h b/include/arpa/inet.h index 357a444a0d2e..84c338140d11 100644 --- a/include/arpa/inet.h +++ b/include/arpa/inet.h @@ -52,9 +52,7 @@ */ /*% - * @(#)inet.h 8.1 (Berkeley) 6/2/93 * $Id: inet.h,v 1.3 2005/04/27 04:56:16 sra Exp $ - * $FreeBSD$ */ #ifndef _ARPA_INET_H_ diff --git a/include/arpa/nameser.h b/include/arpa/nameser.h index 5dcc4f3b911c..4c4d0788b7df 100644 --- a/include/arpa/nameser.h +++ b/include/arpa/nameser.h @@ -48,7 +48,6 @@ /* * $Id: nameser.h,v 1.16 2009/03/03 01:52:48 each Exp $ - * $FreeBSD$ */ #ifndef _ARPA_NAMESER_H_ @@ -133,17 +132,6 @@ typedef struct __ns_msg { const u_char *_msg_ptr; } ns_msg; -/* - * This is a newmsg handle, used when constructing new messages with - * ns_newmsg_init, et al. - */ -struct ns_newmsg { - ns_msg msg; - const u_char *dnptrs[25]; - const u_char **lastdnptr; -}; -typedef struct ns_newmsg ns_newmsg; - /* Private data structure - do not use from outside library. */ struct _ns_flagdata { int mask, shift; }; extern struct _ns_flagdata _ns_flagdata[]; @@ -571,16 +559,6 @@ typedef enum __ns_cert_types { #endif #define ns_makecanon __ns_makecanon #define ns_samename __ns_samename -#define ns_newmsg_init __ns_newmsg_init -#define ns_newmsg_copy __ns_newmsg_copy -#define ns_newmsg_id __ns_newmsg_id -#define ns_newmsg_flag __ns_newmsg_flag -#define ns_newmsg_q __ns_newmsg_q -#define ns_newmsg_rr __ns_newmsg_rr -#define ns_newmsg_done __ns_newmsg_done -#define ns_rdata_unpack __ns_rdata_unpack -#define ns_rdata_equal __ns_rdata_equal -#define ns_rdata_refers __ns_rdata_refers __BEGIN_DECLS int ns_msg_getflag(ns_msg, int); @@ -653,25 +631,6 @@ int ns_subdomain(const char *, const char *); #endif int ns_makecanon(const char *, char *, size_t); int ns_samename(const char *, const char *); -int ns_newmsg_init(u_char *buffer, size_t bufsiz, ns_newmsg *); -int ns_newmsg_copy(ns_newmsg *, ns_msg *); -void ns_newmsg_id(ns_newmsg *handle, u_int16_t id); -void ns_newmsg_flag(ns_newmsg *handle, ns_flag flag, u_int value); -int ns_newmsg_q(ns_newmsg *handle, ns_nname_ct qname, - ns_type qtype, ns_class qclass); -int ns_newmsg_rr(ns_newmsg *handle, ns_sect sect, - ns_nname_ct name, ns_type type, - ns_class rr_class, u_int32_t ttl, - u_int16_t rdlen, const u_char *rdata); -size_t ns_newmsg_done(ns_newmsg *handle); -ssize_t ns_rdata_unpack(const u_char *, const u_char *, ns_type, - const u_char *, size_t, u_char *, size_t); -int ns_rdata_equal(ns_type, - const u_char *, size_t, - const u_char *, size_t); -int ns_rdata_refers(ns_type, - const u_char *, size_t, - const u_char *); __END_DECLS #ifdef BIND_4_COMPAT diff --git a/include/arpa/nameser_compat.h b/include/arpa/nameser_compat.h index 7562984ab0ff..fd5e397092d6 100644 --- a/include/arpa/nameser_compat.h +++ b/include/arpa/nameser_compat.h @@ -32,7 +32,6 @@ /*% * from nameser.h 8.1 (Berkeley) 6/2/93 * $Id: nameser_compat.h,v 1.8 2006/05/19 02:33:40 marka Exp $ - * $FreeBSD$ */ #ifndef _ARPA_NAMESER_COMPAT_ @@ -177,15 +176,33 @@ typedef struct { #define T_SRV ns_t_srv #define T_ATMA ns_t_atma #define T_NAPTR ns_t_naptr +#define T_KX ns_t_kx +#define T_CERT ns_t_cert #define T_A6 ns_t_a6 #define T_DNAME ns_t_dname +#define T_SINK ns_t_sink #define T_OPT ns_t_opt +#define T_APL ns_t_apl +#define T_DS ns_t_ds +#define T_SSHFP ns_t_sshfp +#define T_IPSECKEY ns_t_ipseckey +#define T_RRSIG ns_t_rrsig +#define T_NSEC ns_t_nsec +#define T_DNSKEY ns_t_dnskey +#define T_DHCID ns_t_dhcid +#define T_NSEC3 ns_t_nsec3 +#define T_NSEC3PARAM ns_t_nsec3param +#define T_HIP ns_t_hip +#define T_SPF ns_t_spf +#define T_TKEY ns_t_tkey #define T_TSIG ns_t_tsig #define T_IXFR ns_t_ixfr #define T_AXFR ns_t_axfr #define T_MAILB ns_t_mailb #define T_MAILA ns_t_maila #define T_ANY ns_t_any +#define T_ZXFR ns_t_zxfr +#define T_DLV ns_t_dlv #define C_IN ns_c_in #define C_CHAOS ns_c_chaos diff --git a/include/arpa/telnet.h b/include/arpa/telnet.h index 855b3d26f9cf..0fccf01e994d 100644 --- a/include/arpa/telnet.h +++ b/include/arpa/telnet.h @@ -27,9 +27,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)telnet.h 8.2 (Berkeley) 12/15/93 - * $FreeBSD$ */ #ifndef _ARPA_TELNET_H_ diff --git a/include/arpa/tftp.h b/include/arpa/tftp.h index 50147137db15..f6c31a6bcc09 100644 --- a/include/arpa/tftp.h +++ b/include/arpa/tftp.h @@ -27,9 +27,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)tftp.h 8.1 (Berkeley) 6/2/93 - * $FreeBSD$ */ #ifndef _ARPA_TFTP_H_ diff --git a/include/assert.h b/include/assert.h index 702e231603e6..a3dbe933e18f 100644 --- a/include/assert.h +++ b/include/assert.h @@ -32,9 +32,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)assert.h 8.2 (Berkeley) 1/21/94 - * $FreeBSD$ */ #include <sys/cdefs.h> @@ -46,15 +43,22 @@ #undef assert #undef _assert +#undef __assert_unreachable #ifdef NDEBUG #define assert(e) ((void)0) #define _assert(e) ((void)0) +#if __BSD_VISIBLE +#define __assert_unreachable() __unreachable() +#endif /* __BSD_VISIBLE */ #else #define _assert(e) assert(e) #define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \ __LINE__, #e)) +#if __BSD_VISIBLE +#define __assert_unreachable() assert(0 && "unreachable segment reached") +#endif /* __BSD_VISIBLE */ #endif /* NDEBUG */ #ifndef _ASSERT_H_ diff --git a/include/bitstring.h b/include/bitstring.h index b179880f1e42..c5a09c59bbfc 100644 --- a/include/bitstring.h +++ b/include/bitstring.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2003 Poul-Henning Kamp * All rights reserved. @@ -24,8 +24,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _BITSTRING_H_ diff --git a/include/byteswap.h b/include/byteswap.h new file mode 100644 index 000000000000..a7b816ee82b0 --- /dev/null +++ b/include/byteswap.h @@ -0,0 +1,41 @@ +/*- + * Copyright (c) 2021 M. Warner Losh <imp@FreeBSD.org> + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +/* + * A mostly Linux/glibc-compatible byteswap.h + */ + +#ifndef _BYTESWAP_H_ +#define _BYTESWAP_H_ + +/* + * sys/_endian.h brings in the shared interfaces between BSD's sys/endian.h, and + * glibc's endian.h. However, we need to include it here to get the + * __bswap{16,32,64} definitions that we use. sys/_endian.h has been consturcted to + * be compatible with including <endian.h>, <byteswap.h> or both in either order, + * as well as providing the BSD the bulk of sys/endian.h functionality. + */ +#include <sys/_endian.h> + +/* + * glibc's <byteswap.h> defines the bswap_* and __bswap_* macros below. Most + * software uses either just <sys/endian.h>, or both <endian.h> and + * <byteswap.h>. However, one can't define bswap16, etc in <endian.h> because + * several software packages will define them only when they detect <endian.h> + * is included (but not when sys/endian.h is included). Defining bswap16, etc + * here causes compilation errors for those packages. <endian.h> and + * <byteswap.h> need to be paired together, with the below defines here, for + * the highest level of glibc compatibility. + */ +#define __bswap_16(x) __bswap16(x) +#define __bswap_32(x) __bswap32(x) +#define __bswap_64(x) __bswap64(x) + +#define bswap_16(x) __bswap16(x) +#define bswap_32(x) __bswap32(x) +#define bswap_64(x) __bswap64(x) + +#endif /* _BYTESWAP_H_ */ diff --git a/include/complex.h b/include/complex.h index c31c15d9da4b..4be054ca174a 100644 --- a/include/complex.h +++ b/include/complex.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2001-2011 The FreeBSD Project. * All rights reserved. @@ -24,8 +24,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _COMPLEX_H diff --git a/include/cpio.h b/include/cpio.h index 9cbd44e16522..57e036882cdf 100644 --- a/include/cpio.h +++ b/include/cpio.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org> * All rights reserved. @@ -24,8 +24,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _CPIO_H_ diff --git a/include/ctype.h b/include/ctype.h index 13173139777b..e7b59c795846 100644 --- a/include/ctype.h +++ b/include/ctype.h @@ -35,9 +35,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)ctype.h 8.4 (Berkeley) 1/21/94 - * $FreeBSD$ */ #ifndef _CTYPE_H_ diff --git a/include/db.h b/include/db.h index 13fa91d68048..797eb98919f6 100644 --- a/include/db.h +++ b/include/db.h @@ -27,9 +27,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)db.h 8.7 (Berkeley) 6/16/94 - * $FreeBSD$ */ #ifndef _DB_H_ diff --git a/include/dirent.h b/include/dirent.h index 702153e28fc0..dff0e8675722 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -27,9 +27,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)dirent.h 8.2 (Berkeley) 7/28/94 - * $FreeBSD$ */ #ifndef _DIRENT_H_ @@ -108,6 +105,7 @@ int alphasort(const struct dirent **, const struct dirent **); int dirfd(DIR *); #endif #if __BSD_VISIBLE +int versionsort(const struct dirent **, const struct dirent **); DIR *__opendir2(const char *, int); int fdclosedir(DIR *); ssize_t getdents(int, char *, size_t); @@ -131,6 +129,24 @@ int scandir_b(const char *, struct dirent ***, int (^)(const struct dirent **, const struct dirent **)); #endif #endif +#if __BSD_VISIBLE +int fdscandir(int, struct dirent ***, + int (*)(const struct dirent *), int (*)(const struct dirent **, + const struct dirent **)); +#ifdef __BLOCKS__ +int fdscandir_b(int, struct dirent ***, + int (^)(const struct dirent *), + int (^)(const struct dirent **, const struct dirent **)); +#endif +int scandirat(int, const char *, struct dirent ***, + int (*)(const struct dirent *), int (*)(const struct dirent **, + const struct dirent **)); +#ifdef __BLOCKS__ +int scandirat_b(int, const char *, struct dirent ***, + int (^)(const struct dirent *), + int (^)(const struct dirent **, const struct dirent **)); +#endif +#endif #if __XSI_VISIBLE void seekdir(DIR *, long); long telldir(DIR *); diff --git a/include/dlfcn.h b/include/dlfcn.h index f219879b8fa5..9a4ac0faf786 100644 --- a/include/dlfcn.h +++ b/include/dlfcn.h @@ -27,13 +27,12 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _DLFCN_H_ #define _DLFCN_H_ +#include <sys/cdefs.h> #include <sys/_types.h> /* diff --git a/include/elf-hints.h b/include/elf-hints.h index 679cc34e249e..a4fca04ed309 100644 --- a/include/elf-hints.h +++ b/include/elf-hints.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 1997 John D. Polstra. * All rights reserved. @@ -24,8 +24,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _ELF_HINTS_H_ @@ -47,6 +45,8 @@ struct elfhints_hdr { #define ELFHINTS_MAGIC 0x746e6845 +#ifndef _PATH_ELF_HINTS #define _PATH_ELF_HINTS "/var/run/ld-elf.so.hints" +#endif #endif /* !_ELF_HINTS_H_ */ diff --git a/include/elf.h b/include/elf.h index f230ae729fea..2b62bdd04631 100644 --- a/include/elf.h +++ b/include/elf.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2001 David E. O'Brien. * All rights reserved. @@ -24,8 +24,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ /* diff --git a/include/endian.h b/include/endian.h new file mode 100644 index 000000000000..337309fd3a6f --- /dev/null +++ b/include/endian.h @@ -0,0 +1,68 @@ +/*- + * Copyright (c) 2021 M. Warner Losh <imp@FreeBSD.org> + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +/* + * A mostly Linux/glibc-compatible endian.h + */ + +#ifndef _ENDIAN_H_ +#define _ENDIAN_H_ + +/* + * POSIX.1-2024 requires that endian.h define uint{16,32,64}_t. Although POSIX + * allows stdint.h symbols here, be conservative and only define there required + * ones. FreeBSD's sys/_endian.h doesn't need to expose those types since it + * implements all the [bl]eXtoh hto[bl]eX interfaces as macros calling builtin + * functions. POSIX.1-2024 allows functions, macros or both. We opt for macros + * only. + */ +#include <sys/_types.h> + +#ifndef _UINT16_T_DECLARED +typedef __uint16_t uint16_t; +#define _UINT16_T_DECLARED +#endif + +#ifndef _UINT32_T_DECLARED +typedef __uint32_t uint32_t; +#define _UINT32_T_DECLARED +#endif + +#ifndef _UINT64_T_DECLARED +typedef __uint64_t uint64_t; +#define _UINT64_T_DECLARED +#endif + +/* + * FreeBSD's sys/_endian.h is very close to the interface provided on Linux by + * glibc's endian.h as well as POSIX.1-2024's endian.h. + */ +#include <sys/_endian.h> + +/* + * glibc uses double underscore for these symbols. Define these unconditionally. + * The compiler defines __BYTE_ORDER__ these days, so we don't do anything + * with that since sys/endian.h defines _BYTE_ORDER based on it. + */ +#define __BIG_ENDIAN _BIG_ENDIAN +#define __BYTE_ORDER _BYTE_ORDER +#define __LITTLE_ENDIAN _LITTLE_ENDIAN +#define __PDP_ENDIAN _PDP_ENDIAN + +/* + * FreeBSD's sys/endian.h and machine/endian.h doesn't define a separate + * byte order for floats. Use the host non-float byte order. + */ +#define __FLOAT_WORD_ORDER _BYTE_ORDER + +/* + * We don't define BIG_ENDI, LITTLE_ENDI, HIGH_HALF and LOW_HALF macros that + * glibc's endian.h defines since those appear to be internal to glibc. + * We also don't try to emulate the various helper macros that glibc uses to + * limit namespace visibility. + */ + +#endif /* _ENDIAN_H_ */ diff --git a/include/err.h b/include/err.h index 4b67275a3450..71bf2e5d73a6 100644 --- a/include/err.h +++ b/include/err.h @@ -27,9 +27,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)err.h 8.1 (Berkeley) 6/2/93 - * $FreeBSD$ */ #ifndef _ERR_H_ diff --git a/include/exterr.h b/include/exterr.h new file mode 100644 index 000000000000..c0273d72ce03 --- /dev/null +++ b/include/exterr.h @@ -0,0 +1,21 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2025 The FreeBSD Foundation + * All rights reserved. + * + * This software were developed by Konstantin Belousov <kib@FreeBSD.org> + * under sponsorship from the FreeBSD Foundation. + */ + +#ifndef _EXTERR_H_ +#define _EXTERR_H_ + +#include <sys/cdefs.h> +#include <sys/exterr_cat.h> + +__BEGIN_DECLS +int uexterr_gettext(char *buf, size_t bufsz); +__END_DECLS + +#endif diff --git a/include/fmtmsg.h b/include/fmtmsg.h index 1251c95d489d..d619dc81ac5b 100644 --- a/include/fmtmsg.h +++ b/include/fmtmsg.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org> * All rights reserved. @@ -24,8 +24,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _FMTMSG_H_ diff --git a/include/fnmatch.h b/include/fnmatch.h index 34485381abf7..4810b61570c5 100644 --- a/include/fnmatch.h +++ b/include/fnmatch.h @@ -27,9 +27,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ - * @(#)fnmatch.h 8.1 (Berkeley) 6/2/93 */ #ifndef _FNMATCH_H_ diff --git a/include/fstab.h b/include/fstab.h index 364d132bc4c8..5edaa441ace0 100644 --- a/include/fstab.h +++ b/include/fstab.h @@ -27,9 +27,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)fstab.h 8.1 (Berkeley) 6/2/93 - * $FreeBSD$ */ #ifndef _FSTAB_H_ diff --git a/include/fts.h b/include/fts.h index 6f4674e4a76e..479905bda463 100644 --- a/include/fts.h +++ b/include/fts.h @@ -27,9 +27,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)fts.h 8.3 (Berkeley) 8/14/94 - * $FreeBSD$ */ #ifndef _FTS_H_ @@ -37,35 +34,54 @@ #include <sys/_types.h> +typedef struct _ftsent FTSENT; + typedef struct { - struct _ftsent *fts_cur; /* current node */ - struct _ftsent *fts_child; /* linked list of children */ - struct _ftsent **fts_array; /* sort array */ + FTSENT *fts_cur; /* current node */ + FTSENT *fts_child; /* linked list of children */ + FTSENT **fts_array; /* sort array */ __dev_t fts_dev; /* starting device # */ char *fts_path; /* path for this descent */ int fts_rfd; /* fd for root */ __size_t fts_pathlen; /* sizeof(path) */ __size_t fts_nitems; /* elements in the sort array */ - int (*fts_compar) /* compare function */ - (const struct _ftsent * const *, const struct _ftsent * const *); - -#define FTS_COMFOLLOW 0x001 /* follow command line symlinks */ -#define FTS_LOGICAL 0x002 /* logical walk */ -#define FTS_NOCHDIR 0x004 /* don't change directories */ -#define FTS_NOSTAT 0x008 /* don't get stat info */ -#define FTS_PHYSICAL 0x010 /* physical walk */ -#define FTS_SEEDOT 0x020 /* return dot and dot-dot */ -#define FTS_XDEV 0x040 /* don't cross devices */ -#define FTS_WHITEOUT 0x080 /* return whiteout information */ -#define FTS_OPTIONMASK 0x0ff /* valid user option mask */ - -#define FTS_NAMEONLY 0x100 /* (private) child names only */ -#define FTS_STOP 0x200 /* (private) unrecoverable error */ + union { + int (*fts_compar) /* compare function */ + (const FTSENT * const *, const FTSENT * const *); +#ifdef __BLOCKS__ + int (^fts_compar_b) + (const FTSENT * const *, const FTSENT * const *); +#else + void *fts_compar_b; +#endif /* __BLOCKS__ */ + }; + +/* valid for fts_open() */ +#define FTS_COMFOLLOW 0x000001 /* follow command line symlinks */ +#define FTS_LOGICAL 0x000002 /* logical walk */ +#define FTS_NOCHDIR 0x000004 /* don't change directories */ +#define FTS_NOSTAT 0x000008 /* don't get stat info */ +#define FTS_PHYSICAL 0x000010 /* physical walk */ +#define FTS_SEEDOT 0x000020 /* return dot and dot-dot */ +#define FTS_XDEV 0x000040 /* don't cross devices */ +#define FTS_WHITEOUT 0x000080 /* return whiteout information */ + /* 0x0100 is FTS_NAMEONLY below */ + /* 0x0200 was previously FTS_STOP */ +#define FTS_COMFOLLOWDIR 0x00400 /* like COMFOLLOW but directories only */ +#define FTS_NOSTAT_TYPE 0x000800 /* like NOSTAT but use d_type */ +#define FTS_OPTIONMASK 0x000cff /* valid user option mask */ + +/* valid only for fts_children() */ +#define FTS_NAMEONLY 0x000100 /* child names only */ + +/* internal use only */ +#define FTS_STOP 0x010000 /* unrecoverable error */ +#define FTS_COMPAR_B 0x020000 /* compare function is a block */ int fts_options; /* fts_open options, global flags */ void *fts_clientptr; /* thunk for sort function */ } FTS; -typedef struct _ftsent { +struct _ftsent { struct _ftsent *fts_cycle; /* cycle node */ struct _ftsent *fts_parent; /* parent directory */ struct _ftsent *fts_link; /* next file in directory */ @@ -117,7 +133,7 @@ typedef struct _ftsent { struct stat *fts_statp; /* stat(2) information */ char *fts_name; /* file name */ FTS *fts_fts; /* back pointer to main FTS */ -} FTSENT; +}; #include <sys/cdefs.h> @@ -130,6 +146,10 @@ FTS *fts_get_stream(FTSENT *); #define fts_get_stream(ftsent) ((ftsent)->fts_fts) FTS *fts_open(char * const *, int, int (*)(const FTSENT * const *, const FTSENT * const *)); +#ifdef __BLOCKS__ +FTS *fts_open_b(char * const *, int, + int (^)(const FTSENT * const *, const FTSENT * const *)); +#endif /* __BLOCKS__ */ FTSENT *fts_read(FTS *); int fts_set(FTS *, FTSENT *, int); void fts_set_clientptr(FTS *, void *); diff --git a/include/ftw.h b/include/ftw.h index 95f2ef285c1a..c5693d5ecdf1 100644 --- a/include/ftw.h +++ b/include/ftw.h @@ -20,8 +20,6 @@ * Sponsored in part by the Defense Advanced Research Projects * Agency (DARPA) and Air Force Research Laboratory, Air Force * Materiel Command, USAF, under agreement number F39502-99-1-0512. - * - * $FreeBSD$ */ #ifndef _FTW_H diff --git a/include/getopt.h b/include/getopt.h index 789b4d1d434c..caeef8ff5ed7 100644 --- a/include/getopt.h +++ b/include/getopt.h @@ -1,8 +1,7 @@ /* $NetBSD: getopt.h,v 1.4 2000/07/07 10:43:54 ad Exp $ */ -/* $FreeBSD$ */ /*- - * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2000 The NetBSD Foundation, Inc. * All rights reserved. diff --git a/include/glob.h b/include/glob.h index 80d78a219444..ee2ecd93cfc3 100644 --- a/include/glob.h +++ b/include/glob.h @@ -30,9 +30,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)glob.h 8.1 (Berkeley) 6/2/93 - * $FreeBSD$ */ #ifndef _GLOB_H_ @@ -53,8 +50,15 @@ typedef struct { size_t gl_offs; /* Reserved at beginning of gl_pathv. */ int gl_flags; /* Copy of flags parameter to glob. */ char **gl_pathv; /* List of paths matching pattern. */ - /* Copy of errfunc parameter to glob. */ - int (*gl_errfunc)(const char *, int); + /* Copy of error callback parameter to glob. */ + union { + int (*gl_errfunc)(const char *, int); +#ifdef __BLOCKS__ + int (^gl_errblk)(const char *, int); +#else + void *gl_errblk; +#endif + }; /* * Alternate filesystem access methods for glob; replacement @@ -93,6 +97,7 @@ typedef struct { #define GLOB_QUOTE 0x0400 /* Quote special chars with \. */ #define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */ #define GLOB_LIMIT 0x1000 /* limit number of returned paths */ +#define _GLOB_ERR_BLOCK 0x08000000 /* (internal) error callback is a block */ /* source compatibility, these are the old names */ #define GLOB_MAXPATH GLOB_LIMIT @@ -102,6 +107,10 @@ typedef struct { __BEGIN_DECLS int glob(const char * __restrict, int, int (*)(const char *, int), glob_t * __restrict); +#if defined(__BLOCKS__) && __BSD_VISIBLE +int glob_b(const char * __restrict, int, + int (^)(const char *, int), glob_t * __restrict); +#endif void globfree(glob_t *); __END_DECLS diff --git a/include/grp.h b/include/grp.h index 655bfdc66ec8..6c603a2e86dc 100644 --- a/include/grp.h +++ b/include/grp.h @@ -32,9 +32,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)grp.h 8.2 (Berkeley) 1/21/94 - * $FreeBSD$ */ #ifndef _GRP_H_ diff --git a/include/gssapi.h b/include/gssapi.h index 5557de8f7356..560edb730960 100644 --- a/include/gssapi.h +++ b/include/gssapi.h @@ -1,4 +1,3 @@ -/* $FreeBSD$ */ #ifdef __GNUC__ #warning "this file includes <gssapi.h> which is deprecated, use <gssapi/gssapi.h> instead" #endif diff --git a/include/gssapi/Makefile b/include/gssapi/Makefile index b8b8ddea6166..fb6cd7ee7dab 100644 --- a/include/gssapi/Makefile +++ b/include/gssapi/Makefile @@ -1,5 +1,3 @@ -# $FreeBSD$ - INCS= gssapi.h INCSDIR= ${INCLUDEDIR}/gssapi diff --git a/include/gssapi/Makefile.depend b/include/gssapi/Makefile.depend index f80275d86ab1..11aba52f82cf 100644 --- a/include/gssapi/Makefile.depend +++ b/include/gssapi/Makefile.depend @@ -1,4 +1,3 @@ -# $FreeBSD$ # Autogenerated - do NOT edit! DIRDEPS = \ diff --git a/include/gssapi/gssapi.h b/include/gssapi/gssapi.h index bd2722c9a582..52eda5715bff 100644 --- a/include/gssapi/gssapi.h +++ b/include/gssapi/gssapi.h @@ -24,8 +24,6 @@ * BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION * HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * $FreeBSD$ */ #ifndef _GSSAPI_GSSAPI_H_ diff --git a/include/hesiod.h b/include/hesiod.h index e8c38d84dccb..1fb96b4dc0e0 100644 --- a/include/hesiod.h +++ b/include/hesiod.h @@ -1,9 +1,8 @@ /* $NetBSD: hesiod.h,v 1.3 1999/01/24 23:53:18 lukem Exp $ */ -/* $FreeBSD$ */ /*- - * SPDX-License-Identifier: (BSD-2-Clause-NetBSD AND ISC) + * SPDX-License-Identifier: (BSD-2-Clause AND ISC) * * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc. * All rights reserved. diff --git a/include/iconv.h b/include/iconv.h index 338ca1544d8a..a5a830b75fac 100644 --- a/include/iconv.h +++ b/include/iconv.h @@ -1,4 +1,3 @@ -/* $FreeBSD$ */ /* $NetBSD: iconv.h,v 1.6 2005/02/03 04:39:32 perry Exp $ */ /*- @@ -34,12 +33,10 @@ #ifndef _ICONV_H_ #define _ICONV_H_ -#include <sys/cdefs.h> #include <sys/types.h> #include <wchar.h> -#include <sys/cdefs.h> #include <sys/types.h> #ifdef __cplusplus diff --git a/include/ieeefp.h b/include/ieeefp.h index 3f64555d5a14..0639150e40b9 100644 --- a/include/ieeefp.h +++ b/include/ieeefp.h @@ -1,5 +1,4 @@ /* $NetBSD: ieeefp.h,v 1.4 1998/01/09 08:03:43 perry Exp $ */ -/* $FreeBSD$ */ /* * Written by J.T. Conklin, Apr 6, 1995 diff --git a/include/ifaddrs.h b/include/ifaddrs.h index 5e1953639af6..08a4a695b89f 100644 --- a/include/ifaddrs.h +++ b/include/ifaddrs.h @@ -1,4 +1,3 @@ -/* $FreeBSD$ */ /*- * SPDX-License-Identifier: BSD-1-Clause diff --git a/include/inttypes.h b/include/inttypes.h index adf74e5a3e9d..26d2065045cb 100644 --- a/include/inttypes.h +++ b/include/inttypes.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org> * All rights reserved. @@ -24,8 +24,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _INTTYPES_H_ diff --git a/include/iso646.h b/include/iso646.h index a2ab46abf4e0..181a2bb7942d 100644 --- a/include/iso646.h +++ b/include/iso646.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 1998 Alex Nash * All rights reserved. @@ -24,8 +24,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _ISO646_H_ diff --git a/include/kenv.h b/include/kenv.h index 0f5e8a92fa27..d32fa5c22bde 100644 --- a/include/kenv.h +++ b/include/kenv.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2002 Maxime Henrion <mux@FreeBSD.org> * All rights reserved. @@ -24,8 +24,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _KENV_H_ diff --git a/include/langinfo.h b/include/langinfo.h index 87273072a905..b2af199406d3 100644 --- a/include/langinfo.h +++ b/include/langinfo.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org> * All rights reserved. @@ -24,8 +24,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _LANGINFO_H_ diff --git a/include/libgen.h b/include/libgen.h index 615d1dd6202e..036362ebcb9a 100644 --- a/include/libgen.h +++ b/include/libgen.h @@ -1,5 +1,4 @@ /* $OpenBSD: libgen.h,v 1.4 1999/05/28 22:00:22 espie Exp $ */ -/* $FreeBSD$ */ /*- * SPDX-License-Identifier: BSD-3-Clause diff --git a/include/limits.h b/include/limits.h index fc1470c058cb..2b75b94cb513 100644 --- a/include/limits.h +++ b/include/limits.h @@ -27,9 +27,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)limits.h 8.2 (Berkeley) 1/4/94 - * $FreeBSD$ */ #ifndef _LIMITS_H_ @@ -140,6 +137,11 @@ #define MB_LEN_MAX 6 /* 31-bit UTF-8 */ +#if __POSIX_VISIBLE >= 202405 +#define GETENTROPY_MAX 256 +#define NSIG_MAX 128 /* _SIG_MAXSIG from <signal.h> */ +#endif + #include <sys/limits.h> #if __POSIX_VISIBLE diff --git a/include/link.h b/include/link.h index 60f6bd69add7..80fb058c34ec 100644 --- a/include/link.h +++ b/include/link.h @@ -28,8 +28,6 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ */ #include <sys/link_elf.h> diff --git a/include/locale.h b/include/locale.h index de8e03ade5c8..d9aa63331744 100644 --- a/include/locale.h +++ b/include/locale.h @@ -27,9 +27,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)locale.h 8.1 (Berkeley) 6/2/93 - * $FreeBSD$ */ #ifndef _LOCALE_H_ diff --git a/include/malloc.h b/include/malloc.h index 75673c72ed85..37cde282bdaa 100644 --- a/include/malloc.h +++ b/include/malloc.h @@ -1,6 +1,5 @@ /*- * This file is in the public domain. - * $FreeBSD$ */ #include <stdlib.h> #include <malloc_np.h> diff --git a/include/malloc_np.h b/include/malloc_np.h index 94c7026ef10f..35c74c4fa0ef 100644 --- a/include/malloc_np.h +++ b/include/malloc_np.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (C) 2006 Jason Evans <jasone@FreeBSD.org>. * All rights reserved. @@ -27,8 +27,6 @@ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _MALLOC_NP_H_ diff --git a/include/memory.h b/include/memory.h index dd0c63ac73b2..dbdedb8bd82f 100644 --- a/include/memory.h +++ b/include/memory.h @@ -27,10 +27,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)memory.h 8.1 (Berkeley) 6/2/93 - * - * $FreeBSD$ */ #include <string.h> diff --git a/include/mk-osreldate.sh b/include/mk-osreldate.sh index 037a308fa826..13ebff1f8b2b 100755 --- a/include/mk-osreldate.sh +++ b/include/mk-osreldate.sh @@ -1,5 +1,5 @@ #!/bin/sh - -# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# SPDX-License-Identifier: BSD-2-Clause # # Copyright (c) 2013 Garrett Cooper # All rights reserved. @@ -25,7 +25,6 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # -# $FreeBSD$ set -e diff --git a/include/monetary.h b/include/monetary.h index d7b381b82042..b85d4a58458c 100644 --- a/include/monetary.h +++ b/include/monetary.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org> * All rights reserved. @@ -24,8 +24,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _MONETARY_H_ diff --git a/include/mpool.h b/include/mpool.h index 2c6866020e7c..3946eb2f6a5e 100644 --- a/include/mpool.h +++ b/include/mpool.h @@ -27,9 +27,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)mpool.h 8.4 (Berkeley) 11/2/95 - * $FreeBSD$ */ #ifndef _MPOOL_H_ diff --git a/include/mqueue.h b/include/mqueue.h index 987cf0bd4e23..b814c3f1b4ad 100644 --- a/include/mqueue.h +++ b/include/mqueue.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2005 David Xu <davidxu@freebsd.org> * All rights reserved. @@ -24,14 +24,11 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _MQUEUE_H_ #define _MQUEUE_H_ -#include <sys/cdefs.h> #include <sys/types.h> #include <sys/mqueue.h> #include <sys/signal.h> diff --git a/include/ndbm.h b/include/ndbm.h index f9b0d2b4b0ff..0aa378f7ffaf 100644 --- a/include/ndbm.h +++ b/include/ndbm.h @@ -30,9 +30,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)ndbm.h 8.1 (Berkeley) 6/2/93 - * $FreeBSD$ */ #ifndef _NDBM_H_ diff --git a/include/netconfig.h b/include/netconfig.h index b459e2ee0bf2..6185d6890dfa 100644 --- a/include/netconfig.h +++ b/include/netconfig.h @@ -1,8 +1,7 @@ /* $NetBSD: netconfig.h,v 1.6 2008/04/28 20:22:54 martin Exp $ */ -/* $FreeBSD$ */ /*- - * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2004 The NetBSD Foundation, Inc. * All rights reserved. diff --git a/include/netdb.h b/include/netdb.h index 731e7f7376b5..905b2e659cec 100644 --- a/include/netdb.h +++ b/include/netdb.h @@ -51,9 +51,7 @@ */ /* - * @(#)netdb.h 8.1 (Berkeley) 6/2/93 * From: Id: netdb.h,v 8.9 1996/11/19 08:39:29 vixie Exp $ - * $FreeBSD$ */ #ifndef _NETDB_H_ @@ -161,8 +159,8 @@ struct addrinfo { /* * Error return codes from gai_strerror(3), see RFC 3493. */ -#if 0 -/* Obsoleted on RFC 2553bis-02 */ +#if __BSD_VISIBLE /* not in POSIX */ +/* EAI_ADDRFAMILY was obsoleted by RFC 3493, used as extension */ #define EAI_ADDRFAMILY 1 /* address family for hostname not supported */ #endif #define EAI_AGAIN 2 /* name could not be resolved at this time */ @@ -170,17 +168,20 @@ struct addrinfo { #define EAI_FAIL 4 /* non-recoverable failure in name resolution */ #define EAI_FAMILY 5 /* address family not recognized */ #define EAI_MEMORY 6 /* memory allocation failure */ -#if 0 -/* Obsoleted on RFC 2553bis-02 */ +#if __BSD_VISIBLE /* not in POSIX */ +/* EAI_NODATA was obsoleted by RFC 3493, retained here as extension */ #define EAI_NODATA 7 /* no address associated with hostname */ #endif #define EAI_NONAME 8 /* name does not resolve */ #define EAI_SERVICE 9 /* service not recognized for socket type */ #define EAI_SOCKTYPE 10 /* intended socket type was not recognized */ #define EAI_SYSTEM 11 /* system error returned in errno */ +#if __BSD_VISIBLE /* not in POSIX */ +/* The following 3 are not in RFC 3493 or POSIX, retained for compatibility */ #define EAI_BADHINTS 12 /* invalid value for hints */ #define EAI_PROTOCOL 13 /* resolved protocol is unknown */ #define EAI_OVERFLOW 14 /* argument buffer overflow */ +#endif #define EAI_MAX 15 /* diff --git a/include/nl_types.h b/include/nl_types.h index bf88144aefd4..120d1911631f 100644 --- a/include/nl_types.h +++ b/include/nl_types.h @@ -1,7 +1,7 @@ /* $NetBSD: nl_types.h,v 1.9 2000/10/03 19:53:32 sommerfeld Exp $ */ /*- - * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 1996 The NetBSD Foundation, Inc. * All rights reserved. @@ -29,14 +29,11 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _NL_TYPES_H_ #define _NL_TYPES_H_ -#include <sys/cdefs.h> #include <sys/types.h> #ifdef _NLS_PRIVATE diff --git a/include/nlist.h b/include/nlist.h index 5ea6f5ea555e..656afa706a76 100644 --- a/include/nlist.h +++ b/include/nlist.h @@ -32,10 +32,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)nlist.h 8.2 (Berkeley) 1/21/94 - * - * $FreeBSD$ */ #ifndef _NLIST_H_ diff --git a/include/nss.h b/include/nss.h index 0cc155a0393c..4736de97c5d7 100644 --- a/include/nss.h +++ b/include/nss.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2003 Networks Associates Technology, Inc. * All rights reserved. @@ -31,8 +31,6 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD$ - * * Compatibility header for the GNU C Library-style nsswitch interface. */ #ifndef _NSS_H_ diff --git a/include/nsswitch.h b/include/nsswitch.h index f7131292dd78..cf6ccabc9ea1 100644 --- a/include/nsswitch.h +++ b/include/nsswitch.h @@ -1,8 +1,7 @@ /* $NetBSD: nsswitch.h,v 1.6 1999/01/26 01:04:07 lukem Exp $ */ -/* $FreeBSD$ */ /*- - * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 1997, 1998, 1999 The NetBSD Foundation, Inc. * All rights reserved. @@ -53,6 +52,7 @@ #define NS_NOTFOUND (1<<2) /* source responded 'no such entry' */ #define NS_TRYAGAIN (1<<3) /* source busy, may respond to retry */ #define NS_RETURN (1<<4) /* stop search, e.g. for ERANGE */ +#define NS_ADDRFAMILY (1<<5) /* no addr for fam, getaddrinfo only */ #define NS_TERMINATE (NS_SUCCESS|NS_RETURN) /* flags that end search */ #define NS_STATUSMASK 0x000000ff /* bitmask to get the status flags */ @@ -185,7 +185,7 @@ typedef ns_mtab *(*nss_module_register_fn)(const char *, unsigned int *, /* * Many NSS interfaces follow the getXXnam, getXXid, getXXent pattern. - * Developers are encouraged to use nss_lookup_type where approriate. + * Developers are encouraged to use nss_lookup_type where appropriate. */ enum nss_lookup_type { nss_lt_name = 1, diff --git a/include/ossfuzz.h b/include/ossfuzz.h new file mode 100644 index 000000000000..5c12a3c9c9fb --- /dev/null +++ b/include/ossfuzz.h @@ -0,0 +1,79 @@ +/* + * ***************************************************************************** + * + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2018-2024 Gavin D. Howard and contributors. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * ***************************************************************************** + * + * Declarations for the OSS-Fuzz build of bc and dc. + * + */ + +#include <stdint.h> +#include <stdlib.h> + +#ifndef BC_OSSFUZZ_H +#define BC_OSSFUZZ_H + +/// The number of args in fuzzer arguments, including the NULL terminator. +extern const size_t bc_fuzzer_args_len; + +/// The standard arguments for the bc fuzzer with the -c argument. +extern const char* bc_fuzzer_args_c[]; + +/// The standard arguments for the bc fuzzer with the -C argument. +extern const char* bc_fuzzer_args_C[]; + +/// The standard arguments for the dc fuzzer with the -c argument. +extern const char* dc_fuzzer_args_c[]; + +/// The standard arguments for the dc fuzzer with the -C argument. +extern const char* dc_fuzzer_args_C[]; + +/// The data pointer. +extern uint8_t* bc_fuzzer_data; + +/** + * The function that the fuzzer runs. + * @param Data The data. + * @param Size The number of bytes in @a Data. + * @return 0 on success, -1 on error. + * @pre @a Data must not be equal to NULL if @a Size > 0. + */ +int +LLVMFuzzerTestOneInput(const uint8_t* Data, size_t Size); + +/** + * The initialization function for the fuzzer. + * @param argc A pointer to the argument count. + * @param argv A pointer to the argument list. + * @return 0 on success, -1 on error. + */ +int +LLVMFuzzerInitialize(int* argc, char*** argv); + +#endif // BC_OSSFUZZ_H diff --git a/include/paths.h b/include/paths.h index 9af602635552..26924bcdba91 100644 --- a/include/paths.h +++ b/include/paths.h @@ -27,9 +27,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)paths.h 8.1 (Berkeley) 6/2/93 - * $FreeBSD$ */ #ifndef _PATHS_H_ @@ -64,11 +61,10 @@ #define _PATH_FIRMWARE "/usr/share/firmware" #define _PATH_FTPUSERS "/etc/ftpusers" #define _PATH_FWMEM "/dev/fwmem" -#define _PATH_GBDE "/sbin/gbde" #define _PATH_GELI "/sbin/geli" #define _PATH_HALT "/sbin/halt" -#ifdef COMPAT_32BIT -#define _PATH_I18NMODULE "/usr/lib32/i18n" +#ifdef COMPAT_libcompat +#define _PATH_I18NMODULE "/usr/lib" COMPAT_libcompat "/i18n" #else #define _PATH_I18NMODULE "/usr/lib/i18n" #endif @@ -85,6 +81,7 @@ #define _PATH_MOUNT "/sbin/mount" #define _PATH_NEWFS "/sbin/newfs" #define _PATH_NOLOGIN "/var/run/nologin" +#define _PATH_NOSHUTDOWN "/var/run/noshutdown" #define _PATH_RCP "/bin/rcp" #define _PATH_REBOOT "/sbin/reboot" #define _PATH_RLOGIN "/usr/bin/rlogin" @@ -93,6 +90,7 @@ #define _PATH_SENDMAIL "/usr/sbin/sendmail" #define _PATH_SHELLS "/etc/shells" #define _PATH_TTY "/dev/tty" +#define _PATH_TUNEFS "/sbin/tunefs" #define _PATH_UNIX "don't use _PATH_UNIX" #define _PATH_UFSSUSPEND "/dev/ufssuspend" #define _PATH_VI "/usr/bin/vi" @@ -142,6 +140,8 @@ __END_DECLS #define _PATH_REBOOT "/rescue/reboot" #undef _PATH_RM #define _PATH_RM "/rescue/rm" +#undef _PATH_TUNEFS +#define _PATH_TUNEFS "/rescue/tunefs" #undef _PATH_VI #define _PATH_VI "/rescue/vi" #undef _PATH_WALL diff --git a/include/printf.h b/include/printf.h index 2a643f94c657..ba8284dfbc48 100644 --- a/include/printf.h +++ b/include/printf.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2005 Poul-Henning Kamp * All rights reserved. @@ -24,8 +24,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _PRINTF_H_ diff --git a/include/proc_service.h b/include/proc_service.h index 3b12ff949460..dafcd4f68597 100644 --- a/include/proc_service.h +++ b/include/proc_service.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2004 David Xu <davidxu@freebsd.org> * Copyright (c) 2004 Marcel Moolenaar @@ -25,8 +25,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _PROC_SERVICE_H_ diff --git a/include/protocols/Makefile b/include/protocols/Makefile index a41f3540e2c1..9817add2e9f1 100644 --- a/include/protocols/Makefile +++ b/include/protocols/Makefile @@ -1,5 +1,3 @@ -# $FreeBSD$ - INCS= dumprestore.h routed.h rwhod.h talkd.h timed.h INCSDIR=${INCLUDEDIR}/protocols diff --git a/include/protocols/Makefile.depend b/include/protocols/Makefile.depend index f80275d86ab1..11aba52f82cf 100644 --- a/include/protocols/Makefile.depend +++ b/include/protocols/Makefile.depend @@ -1,4 +1,3 @@ -# $FreeBSD$ # Autogenerated - do NOT edit! DIRDEPS = \ diff --git a/include/protocols/dumprestore.h b/include/protocols/dumprestore.h index 6d22763e96de..3964e26d2a7b 100644 --- a/include/protocols/dumprestore.h +++ b/include/protocols/dumprestore.h @@ -32,10 +32,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)dumprestore.h 8.2 (Berkeley) 1/21/94 - * - * $FreeBSD$ */ #ifndef _PROTOCOLS_DUMPRESTORE_H_ @@ -118,9 +114,9 @@ extern union u_spcl { char c_addr[TP_NINDIR]; /* 1 => data; 0 => hole in inode */ char c_label[LBLSIZE]; /* dump label */ int32_t c_level; /* level of this dump */ - char c_filesys[NAMELEN]; /* name of dumpped file system */ - char c_dev[NAMELEN]; /* name of dumpped device */ - char c_host[NAMELEN]; /* name of dumpped host */ + char c_filesys[NAMELEN]; /* name of dumped file system */ + char c_dev[NAMELEN]; /* name of dumped device */ + char c_host[NAMELEN]; /* name of dumped host */ int32_t c_flags; /* additional information */ int32_t c_old_firstrec; /* first record on volume */ int64_t c_date; /* date of this dump */ diff --git a/include/protocols/routed.h b/include/protocols/routed.h index dab9bba56617..1d80a233b737 100644 --- a/include/protocols/routed.h +++ b/include/protocols/routed.h @@ -27,10 +27,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)routed.h 8.1 (Berkeley) 6/2/93 - * - * $FreeBSD$ * $Revision: 2.26 $ */ diff --git a/include/protocols/rwhod.h b/include/protocols/rwhod.h index f598ec7a7ac3..3d4527da8ade 100644 --- a/include/protocols/rwhod.h +++ b/include/protocols/rwhod.h @@ -27,10 +27,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)rwhod.h 8.1 (Berkeley) 6/2/93 - * - * $FreeBSD$ */ #ifndef _PROTOCOLS_RWHOD_H_ diff --git a/include/protocols/talkd.h b/include/protocols/talkd.h index dc79bef77b6e..8864dba28085 100644 --- a/include/protocols/talkd.h +++ b/include/protocols/talkd.h @@ -27,10 +27,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)talkd.h 8.1 (Berkeley) 6/2/93 - * - * $FreeBSD$ */ #ifndef _PROTOCOLS_TALKD_H_ @@ -56,7 +52,7 @@ /* * The talk protocol embeds a 4.3BSD sockaddr. Define our own version - * rather then relying on namespace polution in kernel headers. + * rather then relying on namespace pollution in kernel headers. */ struct tsockaddr { unsigned short sa_family; diff --git a/include/protocols/timed.h b/include/protocols/timed.h index de4243c576fe..649fb248e2bf 100644 --- a/include/protocols/timed.h +++ b/include/protocols/timed.h @@ -27,10 +27,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)timed.h 8.1 (Berkeley) 6/2/93 - * - * $FreeBSD$ */ #ifndef _PROTOCOLS_TIMED_H_ diff --git a/include/pthread.h b/include/pthread.h index 455e27b89f8b..311211cb48f1 100644 --- a/include/pthread.h +++ b/include/pthread.h @@ -31,8 +31,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _PTHREAD_H_ #define _PTHREAD_H_ @@ -45,6 +43,9 @@ #include <machine/_limits.h> #include <sys/_types.h> #include <sys/_sigset.h> +#if __BSD_VISIBLE +#include <sys/_sigval.h> +#endif #include <sched.h> #include <time.h> @@ -304,6 +305,10 @@ void pthread_yield(void); int pthread_getname_np(pthread_t, char *, size_t); int pthread_setname_np(pthread_t, const char *); + +int pthread_sigqueue(pthread_t thread, int sig, + const union sigval value); + #endif int pthread_mutexattr_getprioceiling( diff --git a/include/pthread_np.h b/include/pthread_np.h index f93a023f0fce..a9e738540db4 100644 --- a/include/pthread_np.h +++ b/include/pthread_np.h @@ -27,8 +27,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _PTHREAD_NP_H_ #define _PTHREAD_NP_H_ @@ -37,11 +35,6 @@ #include <sys/cpuset.h> /* - * Non-POSIX type definitions: - */ -typedef void (*pthread_switch_routine_t)(pthread_t, pthread_t); - -/* * Non-POSIX thread function prototype definitions: */ __BEGIN_DECLS @@ -66,11 +59,11 @@ int pthread_resume_np(pthread_t); int pthread_peekjoin_np(pthread_t, void **); void pthread_set_name_np(pthread_t, const char *); int pthread_setaffinity_np(pthread_t, size_t, const cpuset_t *); +void pthread_signals_block_np(void); +void pthread_signals_unblock_np(void); int pthread_single_np(void); void pthread_suspend_all_np(void); int pthread_suspend_np(pthread_t); -int pthread_switch_add_np(pthread_switch_routine_t); -int pthread_switch_delete_np(pthread_switch_routine_t); int pthread_timedjoin_np(pthread_t, void **, const struct timespec *); __END_DECLS diff --git a/include/pwd.h b/include/pwd.h index 1548400b7eb8..8640052770c8 100644 --- a/include/pwd.h +++ b/include/pwd.h @@ -32,9 +32,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)pwd.h 8.2 (Berkeley) 1/21/94 - * $FreeBSD$ */ #ifndef _PWD_H_ diff --git a/include/ranlib.h b/include/ranlib.h index cdba75f9f6f3..e0bad414413b 100644 --- a/include/ranlib.h +++ b/include/ranlib.h @@ -27,10 +27,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)ranlib.h 8.1 (Berkeley) 6/2/93 - * - * $FreeBSD$ */ #ifndef _RANLIB_H_ diff --git a/include/readpassphrase.h b/include/readpassphrase.h index fd54642da21b..9dfef0bc9f25 100644 --- a/include/readpassphrase.h +++ b/include/readpassphrase.h @@ -1,5 +1,4 @@ /* $OpenBSD: readpassphrase.h,v 1.5 2003/06/17 21:56:23 millert Exp $ */ -/* $FreeBSD$ */ /*- * SPDX-License-Identifier: ISC diff --git a/include/regex.h b/include/regex.h index 3bea3df4f3d4..e859289d8340 100644 --- a/include/regex.h +++ b/include/regex.h @@ -31,9 +31,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)regex.h 8.2 (Berkeley) 1/3/94 - * $FreeBSD$ */ #ifndef _REGEX_H_ diff --git a/include/res_update.h b/include/res_update.h index 32d363bacfae..9f2d550b7265 100644 --- a/include/res_update.h +++ b/include/res_update.h @@ -19,7 +19,6 @@ /* * $Id: res_update.h,v 1.3 2005/04/27 04:56:15 sra Exp $ - * $FreeBSD$ */ #ifndef __RES_UPDATE_H diff --git a/include/resolv.h b/include/resolv.h index 2226c481c7e6..f32f52bab431 100644 --- a/include/resolv.h +++ b/include/resolv.h @@ -47,9 +47,7 @@ */ /*% - * @(#)resolv.h 8.1 (Berkeley) 6/2/93 * $Id: resolv.h,v 1.30 2009/03/03 01:52:48 each Exp $ - * $FreeBSD$ */ #ifndef _RESOLV_H_ @@ -60,6 +58,7 @@ #include <sys/cdefs.h> #include <sys/socket.h> #include <stdio.h> +#include <netinet/in.h> #include <arpa/nameser.h> /*% diff --git a/include/rpc/Makefile b/include/rpc/Makefile index cf17ca2d4d62..db8d78826eb2 100644 --- a/include/rpc/Makefile +++ b/include/rpc/Makefile @@ -1,5 +1,5 @@ -# from: @(#)Makefile 2.3 88/08/11 4.0 RPCSRC -# $FreeBSD$ +.include <src.opts.mk> +.PATH: ${SRCTOP}/sys/rpc .SUFFIXES: .x @@ -14,6 +14,9 @@ HFILES= auth.h auth_unix.h clnt.h clnt_soc.h clnt_stat.h \ rpc.h rpc_msg.h rpcb_clnt.h rpcent.h rpc_com.h rpcsec_gss.h \ svc.h svc_auth.h svc_soc.h svc_dg.h xdr.h +# User visible declarations for kernel RPC modules +HFILES+= clnt_nl.h + # Secure RPC HFILES+= auth_des.h des.h des_crypt.h diff --git a/include/rpc/Makefile.depend b/include/rpc/Makefile.depend index f80275d86ab1..11aba52f82cf 100644 --- a/include/rpc/Makefile.depend +++ b/include/rpc/Makefile.depend @@ -1,4 +1,3 @@ -# $FreeBSD$ # Autogenerated - do NOT edit! DIRDEPS = \ diff --git a/include/rpc/auth.h b/include/rpc/auth.h index bf0d76c046c6..3f889134e93b 100644 --- a/include/rpc/auth.h +++ b/include/rpc/auth.h @@ -28,11 +28,6 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * - * from: @(#)auth.h 1.17 88/02/08 SMI - * from: @(#)auth.h 2.3 88/08/07 4.0 RPCSRC - * from: @(#)auth.h 1.43 98/02/02 SMI - * $FreeBSD$ */ /* @@ -279,11 +274,12 @@ __END_DECLS * Netname manipulation routines. */ __BEGIN_DECLS -extern int getnetname(char *); -extern int host2netname(char *, const char *, const char *); -extern int user2netname(char *, const uid_t, const char *); -extern int netname2user(char *, uid_t *, gid_t *, int *, gid_t *); -extern int netname2host(char *, char *, const int); +extern int getnetname(char [MAXNETNAMELEN + 1]); +extern int host2netname(char [MAXNETNAMELEN + 1], const char *, const char *); +extern int user2netname(char [MAXNETNAMELEN + 1], const uid_t, const char *); +extern int netname2user(char [MAXNETNAMELEN + 1], uid_t *, gid_t *, int *, + gid_t *); +extern int netname2host(char [MAXNETNAMELEN + 1], char *, const int); extern void passwd2des ( char *, char * ); __END_DECLS diff --git a/include/rpc/auth_des.h b/include/rpc/auth_des.h index 3b860d8c7ac3..0ff43c13139b 100644 --- a/include/rpc/auth_des.h +++ b/include/rpc/auth_des.h @@ -1,5 +1,3 @@ -/* @(#)auth_des.h 2.2 88/07/29 4.0 RPCSRC; from 1.3 88/02/08 SMI */ -/* $FreeBSD$ */ /*- * SPDX-License-Identifier: BSD-3-Clause * @@ -29,8 +27,6 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * from: @(#)auth_des.h 2.2 88/07/29 4.0 RPCSRC - * from: @(#)auth_des.h 1.14 94/04/25 SMI */ /* diff --git a/include/rpc/auth_kerb.h b/include/rpc/auth_kerb.h index 29b09d507006..726741f91ddb 100644 --- a/include/rpc/auth_kerb.h +++ b/include/rpc/auth_kerb.h @@ -1,4 +1,3 @@ -/* $FreeBSD$ */ /*- * SPDX-License-Identifier: BSD-3-Clause * diff --git a/include/rpc/auth_unix.h b/include/rpc/auth_unix.h index 6d1fc315a18d..725da2154e1c 100644 --- a/include/rpc/auth_unix.h +++ b/include/rpc/auth_unix.h @@ -26,10 +26,6 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * - * from: @(#)auth_unix.h 1.8 88/02/08 SMI - * from: @(#)auth_unix.h 2.2 88/07/29 4.0 RPCSRC - * $FreeBSD$ */ /* diff --git a/include/rpc/clnt.h b/include/rpc/clnt.h index 8d9ce1eccb09..eb5e1f5b350f 100644 --- a/include/rpc/clnt.h +++ b/include/rpc/clnt.h @@ -28,10 +28,6 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * - * from: @(#)clnt.h 1.31 94/04/29 SMI - * from: @(#)clnt.h 2.1 88/07/29 4.0 RPCSRC - * $FreeBSD$ */ /* diff --git a/include/rpc/clnt_soc.h b/include/rpc/clnt_soc.h index c16609bb6aac..e20edc4cca0a 100644 --- a/include/rpc/clnt_soc.h +++ b/include/rpc/clnt_soc.h @@ -1,5 +1,4 @@ /* $NetBSD: clnt_soc.h,v 1.1 2000/06/02 22:57:55 fvdl Exp $ */ -/* $FreeBSD$ */ /*- * SPDX-License-Identifier: BSD-3-Clause diff --git a/include/rpc/clnt_stat.h b/include/rpc/clnt_stat.h index 6148b4eb94a5..7672b32f3f85 100644 --- a/include/rpc/clnt_stat.h +++ b/include/rpc/clnt_stat.h @@ -1,4 +1,3 @@ -/* $FreeBSD$ */ /* * Copyright (c) 1986 - 1991, 1994, 1996, 1997 by Sun Microsystems, Inc. * All rights reserved. @@ -12,8 +11,6 @@ #ifndef _RPC_CLNT_STAT_H #define _RPC_CLNT_STAT_H -/* #pragma ident "@(#)clnt_stat.h 1.2 97/04/28 SMI" */ - #ifdef __cplusplus extern "C" { #endif diff --git a/include/rpc/des.h b/include/rpc/des.h index 93698cce6cbc..5056e4b1545c 100644 --- a/include/rpc/des.h +++ b/include/rpc/des.h @@ -1,5 +1,3 @@ -/* @(#)des.h 2.2 88/08/10 4.0 RPCSRC; from 2.7 88/02/08 SMI */ -/* $FreeBSD$ */ /*- * SPDX-License-Identifier: BSD-3-Clause * diff --git a/include/rpc/des_crypt.h b/include/rpc/des_crypt.h index ef938c5cc900..9a40e25934ee 100644 --- a/include/rpc/des_crypt.h +++ b/include/rpc/des_crypt.h @@ -1,6 +1,4 @@ /* - * @(#)des_crypt.h 2.1 88/08/11 4.0 RPCSRC; from 1.4 88/02/08 (C) 1986 SMI - * $FreeBSD$ * * des_crypt.h, des library routine interface * Copyright (C) 1986, Sun Microsystems, Inc. diff --git a/include/rpc/nettype.h b/include/rpc/nettype.h index 39c1f76970fb..42986de892db 100644 --- a/include/rpc/nettype.h +++ b/include/rpc/nettype.h @@ -1,5 +1,4 @@ /* $NetBSD: nettype.h,v 1.2 2000/07/06 03:17:19 christos Exp $ */ -/* $FreeBSD$ */ /*- * SPDX-License-Identifier: BSD-3-Clause diff --git a/include/rpc/pmap_clnt.h b/include/rpc/pmap_clnt.h index 465cb0c02623..d3a67778530b 100644 --- a/include/rpc/pmap_clnt.h +++ b/include/rpc/pmap_clnt.h @@ -28,10 +28,6 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * - * from: @(#)pmap_clnt.h 1.11 88/02/08 SMI - * from: @(#)pmap_clnt.h 2.1 88/07/29 4.0 RPCSRC - * $FreeBSD$ */ /* diff --git a/include/rpc/pmap_prot.h b/include/rpc/pmap_prot.h index f69bad9ca1a7..81d3d349b776 100644 --- a/include/rpc/pmap_prot.h +++ b/include/rpc/pmap_prot.h @@ -28,10 +28,6 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * - * from: @(#)pmap_prot.h 1.14 88/02/08 SMI - * from: @(#)pmap_prot.h 2.1 88/07/29 4.0 RPCSRC - * $FreeBSD$ */ /* diff --git a/include/rpc/pmap_rmt.h b/include/rpc/pmap_rmt.h index 791b3f486bc2..1fe75c0caf5b 100644 --- a/include/rpc/pmap_rmt.h +++ b/include/rpc/pmap_rmt.h @@ -28,10 +28,6 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * - * from: @(#)pmap_rmt.h 1.2 88/02/08 SMI - * from: @(#)pmap_rmt.h 2.1 88/07/29 4.0 RPCSRC - * $FreeBSD$ */ /* diff --git a/include/rpc/raw.h b/include/rpc/raw.h index b56b9026d93f..e8ddf1d753ca 100644 --- a/include/rpc/raw.h +++ b/include/rpc/raw.h @@ -1,5 +1,4 @@ /* $NetBSD: raw.h,v 1.1 2000/06/02 22:57:56 fvdl Exp $ */ -/* $FreeBSD$ */ /*- * SPDX-License-Identifier: BSD-3-Clause @@ -37,9 +36,6 @@ #ifndef _RPC_RAW_H #define _RPC_RAW_H -/* from: @(#)raw.h 1.11 94/04/25 SMI */ -/* from: @(#)raw.h 1.2 88/10/25 SMI */ - #ifdef __cplusplus extern "C" { #endif diff --git a/include/rpc/rpc.h b/include/rpc/rpc.h index 561437c30943..30aad8d00b92 100644 --- a/include/rpc/rpc.h +++ b/include/rpc/rpc.h @@ -28,10 +28,6 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * - * from: @(#)rpc.h 1.9 88/02/08 SMI - * from: @(#)rpc.h 2.4 89/07/11 4.0 RPCSRC - * $FreeBSD$ */ /* diff --git a/include/rpc/rpc_com.h b/include/rpc/rpc_com.h index dd331e2601f6..b1d533ba5945 100644 --- a/include/rpc/rpc_com.h +++ b/include/rpc/rpc_com.h @@ -1,5 +1,4 @@ /* $NetBSD: rpc_com.h,v 1.3 2000/12/10 04:10:08 christos Exp $ */ -/* $FreeBSD$ */ /*- * SPDX-License-Identifier: BSD-3-Clause @@ -45,8 +44,6 @@ #include <sys/cdefs.h> -/* #pragma ident "@(#)rpc_com.h 1.11 93/07/05 SMI" */ - /* * The max size of the transport, if the size cannot be determined * by other means. @@ -59,7 +56,6 @@ __BEGIN_DECLS extern u_int __rpc_get_a_size(int); -extern int __rpc_dtbsize(void); extern int _rpc_dtablesize(void); extern struct netconfig * __rpcgettp(int); extern int __rpc_get_default_domain(char **); diff --git a/include/rpc/rpc_msg.h b/include/rpc/rpc_msg.h index 136b617f58e8..2a34354eb4d1 100644 --- a/include/rpc/rpc_msg.h +++ b/include/rpc/rpc_msg.h @@ -28,10 +28,6 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * - * from: @(#)rpc_msg.h 1.7 86/07/16 SMI - * from: @(#)rpc_msg.h 2.1 88/07/29 4.0 RPCSRC - * $FreeBSD$ */ /* @@ -49,7 +45,7 @@ /* * Bottom up definition of an rpc message. - * NOTE: call and reply use the same overall stuct but + * NOTE: call and reply use the same overall struct but * different parts of unions within it. */ diff --git a/include/rpc/rpcb_clnt.h b/include/rpc/rpcb_clnt.h index b642aacd6a57..6fb6b8c8f0ca 100644 --- a/include/rpc/rpcb_clnt.h +++ b/include/rpc/rpcb_clnt.h @@ -1,5 +1,4 @@ /* $NetBSD: rpcb_clnt.h,v 1.1 2000/06/02 22:57:56 fvdl Exp $ */ -/* $FreeBSD$ */ /*- * SPDX-License-Identifier: BSD-3-Clause @@ -56,7 +55,6 @@ #ifndef _RPC_RPCB_CLNT_H #define _RPC_RPCB_CLNT_H -/* #pragma ident "@(#)rpcb_clnt.h 1.13 94/04/25 SMI" */ /* rpcb_clnt.h 1.3 88/12/05 SMI */ #include <rpc/types.h> diff --git a/include/rpc/rpcb_prot.x b/include/rpc/rpcb_prot.x index a34bcc12502a..efbe8f4ba246 100644 --- a/include/rpc/rpcb_prot.x +++ b/include/rpc/rpcb_prot.x @@ -1,6 +1,4 @@ %/*- -% * $FreeBSD$ -% * % * Copyright (c) 2009, Sun Microsystems, Inc. % * All rights reserved. % * @@ -35,8 +33,6 @@ #ifdef RPC_HDR % -%/* #pragma ident "@(#)rpcb_prot.x 1.5 94/04/29 SMI" */ -% %#ifndef _KERNEL % #endif diff --git a/include/rpc/rpcent.h b/include/rpc/rpcent.h index 15c4ae4d00a6..92b083f7c391 100644 --- a/include/rpc/rpcent.h +++ b/include/rpc/rpcent.h @@ -1,5 +1,4 @@ /* $NetBSD: rpcent.h,v 1.1 2000/06/02 22:57:56 fvdl Exp $ */ -/* $FreeBSD$ */ /*- * SPDX-License-Identifier: BSD-3-Clause @@ -43,10 +42,6 @@ #ifndef _RPC_RPCENT_H #define _RPC_RPCENT_H -/* #pragma ident "@(#)rpcent.h 1.13 94/04/25 SMI" */ -/* @(#)rpcent.h 1.1 88/12/06 SMI */ - - struct rpcent { char *r_name; /* name of server for this rpc program */ char **r_aliases; /* alias list */ diff --git a/include/rpc/rpcsec_gss.h b/include/rpc/rpcsec_gss.h index 2878ae04b70d..ec7e57ee0935 100644 --- a/include/rpc/rpcsec_gss.h +++ b/include/rpc/rpcsec_gss.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2008 Doug Rabson * All rights reserved. @@ -24,8 +24,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _RPCSEC_GSS_H diff --git a/include/rpc/svc.h b/include/rpc/svc.h index 4cffd4070817..99e2fcee4121 100644 --- a/include/rpc/svc.h +++ b/include/rpc/svc.h @@ -28,10 +28,6 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * - * from: @(#)svc.h 1.35 88/12/17 SMI - * from: @(#)svc.h 1.27 94/04/25 SMI - * $FreeBSD$ */ /* @@ -460,6 +456,19 @@ extern SVCXPRT *svc_fd_create(const int, const u_int, const u_int); extern SVCXPRT *svcunixfd_create(int, u_int, u_int); /* + * netlink(4) server creation. To be used to service requests that + * originate from an in-kernel client. + */ +extern SVCXPRT *svc_nl_create(const char *); + +/* + * Arguments to SVC_CONTROL(svc_nl) + */ +enum { + SVCNL_GET_XIDKEY = 1, /* obtain pthread specific key for xid */ +}; + +/* * Memory based rpc (for speed check and testing) */ extern SVCXPRT *svc_raw_create(void); diff --git a/include/rpc/svc_auth.h b/include/rpc/svc_auth.h index e9b6cd4be4f3..a46ee804c253 100644 --- a/include/rpc/svc_auth.h +++ b/include/rpc/svc_auth.h @@ -28,10 +28,6 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * - * from: @(#)svc_auth.h 1.6 86/07/16 SMI - * @(#)svc_auth.h 2.1 88/07/29 4.0 RPCSRC - * $FreeBSD$ */ /* diff --git a/include/rpc/svc_dg.h b/include/rpc/svc_dg.h index d9f3012c4f06..51397113d372 100644 --- a/include/rpc/svc_dg.h +++ b/include/rpc/svc_dg.h @@ -1,5 +1,4 @@ /* $NetBSD: svc_dg.h,v 1.1 2000/06/02 23:11:16 fvdl Exp $ */ -/* $FreeBSD$ */ /*- * SPDX-License-Identifier: BSD-3-Clause diff --git a/include/rpc/svc_soc.h b/include/rpc/svc_soc.h index 912e2ec2df1f..3afcf88c38f0 100644 --- a/include/rpc/svc_soc.h +++ b/include/rpc/svc_soc.h @@ -1,5 +1,4 @@ /* $NetBSD: svc_soc.h,v 1.1 2000/06/02 22:57:57 fvdl Exp $ */ -/* $FreeBSD$ */ /*- * SPDX-License-Identifier: BSD-3-Clause @@ -42,7 +41,6 @@ #define _RPC_SVC_SOC_H #include <sys/cdefs.h> -/* #pragma ident "@(#)svc_soc.h 1.11 94/04/25 SMI" */ /* svc_soc.h 1.8 89/05/01 SMI */ /* diff --git a/include/rpc/xdr.h b/include/rpc/xdr.h index ad1672cd1db8..ecf10e1659e4 100644 --- a/include/rpc/xdr.h +++ b/include/rpc/xdr.h @@ -28,10 +28,6 @@ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. - * - * from: @(#)xdr.h 1.19 87/04/22 SMI - * from: @(#)xdr.h 2.2 88/07/29 4.0 RPCSRC - * $FreeBSD$ */ /* @@ -282,7 +278,7 @@ struct xdr_discrim { * These are the "generic" xdr routines. */ __BEGIN_DECLS -extern bool_t xdr_void(void); +extern bool_t xdr_void(XDR *, void *); extern bool_t xdr_int(XDR *, int *); extern bool_t xdr_u_int(XDR *, u_int *); extern bool_t xdr_long(XDR *, long *); diff --git a/include/rpcsvc/Makefile b/include/rpcsvc/Makefile index 66acc9d5a727..bc2b74561422 100644 --- a/include/rpcsvc/Makefile +++ b/include/rpcsvc/Makefile @@ -1,6 +1,3 @@ -# from: @(#)Makefile 2.3 88/08/11 4.0 RPCSRC -# $FreeBSD$ - .SUFFIXES: .x RPCCOM= RPCGEN_CPP=${CPP:Q} rpcgen -C diff --git a/include/rpcsvc/Makefile.depend b/include/rpcsvc/Makefile.depend index f80275d86ab1..11aba52f82cf 100644 --- a/include/rpcsvc/Makefile.depend +++ b/include/rpcsvc/Makefile.depend @@ -1,4 +1,3 @@ -# $FreeBSD$ # Autogenerated - do NOT edit! DIRDEPS = \ diff --git a/include/rpcsvc/bootparam_prot.x b/include/rpcsvc/bootparam_prot.x index 548d618755d7..51d315327a00 100644 --- a/include/rpcsvc/bootparam_prot.x +++ b/include/rpcsvc/bootparam_prot.x @@ -45,13 +45,6 @@ %#include <sys/errno.h> %#include <sys/param.h> %#include <sys/syslimits.h> -#else -%#ifndef lint -%/*static char sccsid[] = "from: @(#)bootparam_prot.x 1.2 87/06/24 Copyr 1987 Sun Micro";*/ -%/*static char sccsid[] = "from: @(#)bootparam_prot.x 2.1 88/08/01 4.0 RPCSRC";*/ -%#endif /* not lint */ -%#include <sys/cdefs.h> -%__FBSDID("$FreeBSD$"); #endif const MAX_MACHINE_NAME = 255; diff --git a/include/rpcsvc/crypt.x b/include/rpcsvc/crypt.x index 3b296c0ddf1d..63e4c8798152 100644 --- a/include/rpcsvc/crypt.x +++ b/include/rpcsvc/crypt.x @@ -30,11 +30,6 @@ * SUCH DAMAGE. */ -#ifndef RPC_HDR -%#include <sys/cdefs.h> -%__FBSDID("$FreeBSD$"); -#endif - /* * This protocol definition exists because of the U.S. government and * its stupid export laws. We can't export DES code from the United diff --git a/include/rpcsvc/key_prot.x b/include/rpcsvc/key_prot.x index 1fccd957941d..9143b979f16f 100644 --- a/include/rpcsvc/key_prot.x +++ b/include/rpcsvc/key_prot.x @@ -45,11 +45,6 @@ * requirements. */ -%/* From: #pragma ident "@(#)key_prot.x 1.7 94/04/29 SMI" */ -%/* Copyright (c) 1990, 1991 Sun Microsystems, Inc. */ -%#include <sys/cdefs.h> -%__FBSDID("$FreeBSD$"); -% %/* % * Compiled from key_prot.x using rpcgen. % * DO NOT EDIT THIS FILE! diff --git a/include/rpcsvc/klm_prot.x b/include/rpcsvc/klm_prot.x index 5860f3251c17..4dcfa00aab24 100644 --- a/include/rpcsvc/klm_prot.x +++ b/include/rpcsvc/klm_prot.x @@ -38,15 +38,6 @@ * above the kernel. */ -#ifndef RPC_HDR -%#ifndef lint -%/*static char sccsid[] = "from: @(#)klm_prot.x 1.7 87/07/08 Copyr 1987 Sun Micro";*/ -%/*static char sccsid[] = "from: @(#)klm_prot.x 2.1 88/08/01 4.0 RPCSRC";*/ -%#endif /* not lint */ -%#include <sys/cdefs.h> -%__FBSDID("$FreeBSD$"); -#endif - const LM_MAXSTRLEN = 1024; /* diff --git a/include/rpcsvc/mount.x b/include/rpcsvc/mount.x index 9ebee835b273..b3a4e11aa2c7 100644 --- a/include/rpcsvc/mount.x +++ b/include/rpcsvc/mount.x @@ -33,15 +33,6 @@ * Protocol description for the mount program */ -#ifndef RPC_HDR -%#ifndef lint -%/*static char sccsid[] = "from: @(#)mount.x 1.2 87/09/18 Copyr 1987 Sun Micro";*/ -%/*static char sccsid[] = "from: @(#)mount.x 2.1 88/08/01 4.0 RPCSRC";*/ -%#endif /* not lint */ -%#include <sys/cdefs.h> -%__FBSDID("$FreeBSD$"); -#endif - const MNTPATHLEN = 1024; /* maximum bytes in a pathname argument */ const MNTNAMLEN = 255; /* maximum bytes in a name argument */ const FHSIZE = 32; /* size in bytes of a file handle */ diff --git a/include/rpcsvc/nfs_prot.x b/include/rpcsvc/nfs_prot.x index 17791b6a18b2..99ac2fd68e85 100644 --- a/include/rpcsvc/nfs_prot.x +++ b/include/rpcsvc/nfs_prot.x @@ -29,15 +29,6 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef RPC_HDR -%#ifndef lint -%/*static char sccsid[] = "from: @(#)nfs_prot.x 1.2 87/10/12 Copyr 1987 Sun Micro";*/ -%/*static char sccsid[] = "from: @(#)nfs_prot.x 2.1 88/08/01 4.0 RPCSRC";*/ -%#endif /* not lint */ -%#include <sys/cdefs.h> -%__FBSDID("$FreeBSD$"); -#endif - const NFS_PORT = 2049; const NFS_MAXDATA = 8192; const NFS_MAXPATHLEN = 1024; diff --git a/include/rpcsvc/nis.x b/include/rpcsvc/nis.x index ee822d039b86..07a9c48e7638 100644 --- a/include/rpcsvc/nis.x +++ b/include/rpcsvc/nis.x @@ -29,13 +29,7 @@ % * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. % */ -#ifndef RPC_HDR -%#include <sys/cdefs.h> -%__FBSDID("$FreeBSD$"); -#endif - /* - * From 4.1 : @(#)nis.x 1.61 Copyright 1989 Sun Microsystems * * RPC Language Protocol description file for NIS Plus * This version : 1.61 diff --git a/include/rpcsvc/nis_cache.x b/include/rpcsvc/nis_cache.x index 6edaea92c38b..2b204f617b29 100644 --- a/include/rpcsvc/nis_cache.x +++ b/include/rpcsvc/nis_cache.x @@ -35,13 +35,6 @@ * All Rights Reserved. */ -/* From: %#pragma ident "@(#)nis_cache.x 1.11 94/05/03 SMI" */ - -#ifndef RPC_HDR -%#include <sys/cdefs.h> -%__FBSDID("$FreeBSD$"); -#endif - #ifdef RPC_HDR %#include <rpc/types.h> %#include <rpcsvc/nis.h> diff --git a/include/rpcsvc/nis_callback.x b/include/rpcsvc/nis_callback.x index 74a555b4f16b..3e74bbca50cd 100644 --- a/include/rpcsvc/nis_callback.x +++ b/include/rpcsvc/nis_callback.x @@ -36,15 +36,7 @@ * All Rights Reserved. */ -/* From: %#pragma ident "@(#)nis_callback.x 1.7 94/05/03 SMI" */ - -#ifndef RPC_HDR -%#include <sys/cdefs.h> -%__FBSDID("$FreeBSD$"); -#endif - /* - * "@(#)zns_cback.x 1.2 90/09/10 Copyr 1990 Sun Micro" * * RPCL description of the Callback Service. */ diff --git a/include/rpcsvc/nis_db.h b/include/rpcsvc/nis_db.h index 9dcc78376b1a..f3a59a0e9e96 100644 --- a/include/rpcsvc/nis_db.h +++ b/include/rpcsvc/nis_db.h @@ -25,8 +25,6 @@ * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 - * - * $FreeBSD$ */ /* @@ -44,8 +42,6 @@ #define _RPCSVC_NIS_DB_H -/* From: #pragma ident "@(#)nis_db.h 1.8 94/05/03 SMI" */ - /* * Note: although the version of <rpcsvc/nis_db.h> shipped with Solaris * 2.5/2.5.x is actually older than this one (according to the ident diff --git a/include/rpcsvc/nis_object.x b/include/rpcsvc/nis_object.x index f63cf938571a..4fac5b6b6a6b 100644 --- a/include/rpcsvc/nis_object.x +++ b/include/rpcsvc/nis_object.x @@ -36,9 +36,6 @@ * All Rights Reserved. */ -/* $FreeBSD$ */ -/* From: %#pragma ident "@(#)nis_object.x 1.10 94/05/03 SMI" */ - #if RPC_HDR % %#ifndef __nis_object_h diff --git a/include/rpcsvc/nis_tags.h b/include/rpcsvc/nis_tags.h index 55920a0297fd..20f1a0f7dcd7 100644 --- a/include/rpcsvc/nis_tags.h +++ b/include/rpcsvc/nis_tags.h @@ -45,8 +45,6 @@ #ifndef _RPCSVC_NIS_TAGS_H #define _RPCSVC_NIS_TAGS_H -/* $FreeBSD$ */ -/* From: #pragma ident "@(#)nis_tags.h 1.10 94/05/03 SMI" */ /* from file: zns_tags.h 1.7 Copyright (c) 1990 Sun Microsystems */ #ifdef __cplusplus diff --git a/include/rpcsvc/nislib.h b/include/rpcsvc/nislib.h index 754affe9a430..7db1e94e8d33 100644 --- a/include/rpcsvc/nislib.h +++ b/include/rpcsvc/nislib.h @@ -25,8 +25,6 @@ * Sun Microsystems, Inc. * 2550 Garcia Avenue * Mountain View, California 94043 - * - * $FreeBSD$ */ /* @@ -41,8 +39,6 @@ #ifndef _RPCSVC_NISLIB_H #define _RPCSVC_NISLIB_H -/* From: #pragma ident "@(#)nislib.h 1.16 94/05/03 SMI" */ - #ifdef __cplusplus extern "C" { #endif diff --git a/include/rpcsvc/nlm_prot.x b/include/rpcsvc/nlm_prot.x index 87bf6c844359..a8581ce9da0d 100644 --- a/include/rpcsvc/nlm_prot.x +++ b/include/rpcsvc/nlm_prot.x @@ -8,15 +8,8 @@ #ifdef RPC_HDR %#define LM_MAXSTRLEN 1024 %#define MAXNAMELEN LM_MAXSTRLEN+1 -#else -%#include <sys/cdefs.h> -%#ifndef lint -%/*static char sccsid[] = "from: @(#)nlm_prot.x 1.8 87/09/21 Copyr 1987 Sun Micro";*/ -%/*static char sccsid[] = "from: * @(#)nlm_prot.x 2.1 88/08/01 4.0 RPCSRC";*/ -%__RCSID("$NetBSD: nlm_prot.x,v 1.6 2000/06/07 14:30:15 bouyer Exp $"); -%#endif /* not lint */ -%__FBSDID("$FreeBSD$"); #endif +/* $NetBSD: nlm_prot.x,v 1.6 2000/06/07 14:30:15 bouyer Exp $ */ /* * status of a call to the lock manager diff --git a/include/rpcsvc/pmap_prot.x b/include/rpcsvc/pmap_prot.x index 19a4d8c5a2fd..d64bfc3cf73a 100644 --- a/include/rpcsvc/pmap_prot.x +++ b/include/rpcsvc/pmap_prot.x @@ -34,10 +34,6 @@ #ifdef RPC_HDR % -%#pragma ident "@(#)pmap_prot.x 1.6 94/04/29 SMI" -%#include <sys/cdefs.h> -%__FBSDID("$FreeBSD$"); -% %#ifndef _KERNEL % #endif diff --git a/include/rpcsvc/rex.x b/include/rpcsvc/rex.x index 4d4bda65f283..78003204df0f 100644 --- a/include/rpcsvc/rex.x +++ b/include/rpcsvc/rex.x @@ -33,15 +33,6 @@ * Remote execution (rex) protocol specification */ -#ifndef RPC_HDR -%#ifndef lint -%/*static char sccsid[] = "from: @(#)rex.x 1.3 87/09/18 Copyr 1987 Sun Micro";*/ -%/*static char sccsid[] = "from: @(#)rex.x 2.1 88/08/01 4.0 RPCSRC";*/ -%#endif /* not lint */ -%#include <sys/cdefs.h> -%__FBSDID("$FreeBSD$"); -#endif - const STRINGSIZE = 1024; typedef string rexstring<1024>; diff --git a/include/rpcsvc/rnusers.x b/include/rpcsvc/rnusers.x index 421a515ac725..3e2a426b6b9f 100644 --- a/include/rpcsvc/rnusers.x +++ b/include/rpcsvc/rnusers.x @@ -33,15 +33,6 @@ * Find out about remote users */ -#ifndef RPC_HDR -%#ifndef lint -%/*static char sccsid[] = "from: @(#)rnusers.x 1.2 87/09/20 Copyr 1987 Sun Micro";*/ -%/*static char sccsid[] = "from: @(#)rnusers.x 2.1 88/08/01 4.0 RPCSRC";*/ -%#endif /* not lint */ -%#include <sys/cdefs.h> -%__FBSDID("$FreeBSD$"); -#endif - const MAXUSERS = 100; const MAXUTLEN = 256; diff --git a/include/rpcsvc/rquota.x b/include/rpcsvc/rquota.x index 8c8dfe452b54..6349c35413d3 100644 --- a/include/rpcsvc/rquota.x +++ b/include/rpcsvc/rquota.x @@ -1,16 +1,8 @@ -/* @(#)rquota.x 2.1 88/08/01 4.0 RPCSRC */ -/* @(#)rquota.x 1.2 87/09/20 Copyr 1987 Sun Micro */ - /* * Remote quota protocol * Requires unix authentication */ -#ifndef RPC_HDR -%#include <sys/cdefs.h> -%__FBSDID("$FreeBSD$"); -#endif - const RQ_PATHLEN = 1024; struct sq_dqblk { diff --git a/include/rpcsvc/rstat.x b/include/rpcsvc/rstat.x index a34456082afa..17e9c9fedf3a 100644 --- a/include/rpcsvc/rstat.x +++ b/include/rpcsvc/rstat.x @@ -44,15 +44,6 @@ % %#endif /* ndef FSCALE */ -#else - -%#ifndef lint -%/*static char sccsid[] = "from: @(#)rstat.x 1.2 87/09/18 Copyr 1987 Sun Micro";*/ -%/*static char sccsid[] = "from: @(#)rstat.x 2.2 88/08/01 4.0 RPCSRC";*/ -%#endif /* not lint */ -%#include <sys/cdefs.h> -%__FBSDID("$FreeBSD$"); - #endif /* def RPC_HDR */ const RSTAT_CPUSTATES = 4; diff --git a/include/rpcsvc/rwall.x b/include/rpcsvc/rwall.x index 6c26c1f18f3e..0c3a989ede0f 100644 --- a/include/rpcsvc/rwall.x +++ b/include/rpcsvc/rwall.x @@ -31,8 +31,6 @@ %/* % * Copyright (c) 1984, 1990 by Sun Microsystems, Inc. % */ -% -%/* from @(#)rwall.x 1.6 91/03/11 TIRPC 1.0 */ #ifdef RPC_HDR % diff --git a/include/rpcsvc/sm_inter.x b/include/rpcsvc/sm_inter.x index 42a00915e8f7..14aaeadee8a7 100644 --- a/include/rpcsvc/sm_inter.x +++ b/include/rpcsvc/sm_inter.x @@ -1,6 +1,3 @@ -/* @(#)sm_inter.x 2.2 88/08/01 4.0 RPCSRC */ -/* @(#)sm_inter.x 1.7 87/06/24 Copyr 1987 Sun Micro */ - /*- * Copyright (c) 2010, Oracle America, Inc. * @@ -38,11 +35,6 @@ * */ -#ifndef RPC_HDR -%#include <sys/cdefs.h> -%__FBSDID("$FreeBSD$"); -#endif - program SM_PROG { version SM_VERS { /* res_stat = stat_succ if status monitor agrees to monitor */ diff --git a/include/rpcsvc/spray.x b/include/rpcsvc/spray.x index b6a5b849a079..8ef42f972c44 100644 --- a/include/rpcsvc/spray.x +++ b/include/rpcsvc/spray.x @@ -34,15 +34,6 @@ * Useful for testing flakiness of network interfaces */ -#ifndef RPC_HDR -%#ifndef lint -%/*static char sccsid[] = "from: @(#)spray.x 1.2 87/09/18 Copyr 1987 Sun Micro";*/ -%/*static char sccsid[] = "from: @(#)spray.x 2.1 88/08/01 4.0 RPCSRC";*/ -%#endif /* not lint */ -%#include <sys/cdefs.h> -%__FBSDID("$FreeBSD$"); -#endif - const SPRAYMAX = 8845; /* max amount can spray */ /* diff --git a/include/rpcsvc/yp.x b/include/rpcsvc/yp.x index 91614b20486f..fff06557b67e 100644 --- a/include/rpcsvc/yp.x +++ b/include/rpcsvc/yp.x @@ -1,5 +1,3 @@ -/* @(#)yp.x 2.1 88/08/01 4.0 RPCSRC */ - /*- * Copyright (c) 2010, Oracle America, Inc. * @@ -35,11 +33,6 @@ * Protocol description file for the Yellow Pages Service */ -#ifndef RPC_HDR -%#include <sys/cdefs.h> -%__FBSDID("$FreeBSD$"); -#endif - const YPMAXRECORD = 16777216; const YPMAXDOMAIN = 64; const YPMAXMAP = 64; diff --git a/include/rpcsvc/yp_prot.h b/include/rpcsvc/yp_prot.h index 889e7cceea8c..091347231c8b 100644 --- a/include/rpcsvc/yp_prot.h +++ b/include/rpcsvc/yp_prot.h @@ -27,8 +27,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _RPCSVC_YP_PROT_H_ @@ -273,7 +271,7 @@ struct ypbind_setdom { * * Sun says: * "Protocol between clients (ypxfr, only) and yppush - * yppush speaks a protocol in the transient range, which + * speaks a protocol in the transient range, which * is supplied to ypxfr as a command-line parameter when it * is activated by ypserv." * diff --git a/include/rpcsvc/ypclnt.h b/include/rpcsvc/ypclnt.h index c0a0a46e1851..12cc9d000bfc 100644 --- a/include/rpcsvc/ypclnt.h +++ b/include/rpcsvc/ypclnt.h @@ -27,8 +27,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _RPCSVC_YPCLNT_H_ diff --git a/include/rpcsvc/yppasswd.x b/include/rpcsvc/yppasswd.x index 1b39a632fa94..15741f37b27d 100644 --- a/include/rpcsvc/yppasswd.x +++ b/include/rpcsvc/yppasswd.x @@ -34,15 +34,6 @@ * Requires unix authentication */ -#ifndef RPC_HDR -%#ifndef lint -%/*static char sccsid[] = "from: @(#)yppasswd.x 1.1 87/04/13 Copyr 1987 Sun Micro";*/ -%/*static char sccsid[] = "from: @(#)yppasswd.x 2.1 88/08/01 4.0 RPCSRC";*/ -%#endif /* not lint */ -%#include <sys/cdefs.h> -%__FBSDID("$FreeBSD$"); -#endif - program YPPASSWDPROG { version YPPASSWDVERS { /* diff --git a/include/rpcsvc/ypupdate_prot.x b/include/rpcsvc/ypupdate_prot.x index 90648a023e6e..b989ad29468b 100644 --- a/include/rpcsvc/ypupdate_prot.x +++ b/include/rpcsvc/ypupdate_prot.x @@ -32,10 +32,8 @@ % * Copyright (c) 1986, 1990 by Sun Microsystems, Inc. % */ % -%/* from @(#)ypupdate_prot.x 1.3 91/03/11 TIRPC 1.0 */ #ifndef RPC_HDR %#include <sys/cdefs.h> -%__FBSDID("$FreeBSD$"); #endif % %/* diff --git a/include/rpcsvc/ypxfrd.x b/include/rpcsvc/ypxfrd.x index e6ff902a1dfe..44ce886f64f5 100644 --- a/include/rpcsvc/ypxfrd.x +++ b/include/rpcsvc/ypxfrd.x @@ -66,7 +66,6 @@ #ifndef RPC_HDR %#include <sys/cdefs.h> -%__FBSDID("$FreeBSD$"); #endif /* XXX cribbed from yp.x */ diff --git a/include/runetype.h b/include/runetype.h index 93007809dbf8..10a78bb56199 100644 --- a/include/runetype.h +++ b/include/runetype.h @@ -30,9 +30,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)runetype.h 8.1 (Berkeley) 6/2/93 - * $FreeBSD$ */ #ifndef _RUNETYPE_H_ diff --git a/include/sched.h b/include/sched.h index e03f076febb1..14512559e2a8 100644 --- a/include/sched.h +++ b/include/sched.h @@ -29,7 +29,6 @@ #ifndef __SCHED_H__ #define __SCHED_H__ -#include <sys/cdefs.h> #include <sys/types.h> #include <sys/sched.h> #if __BSD_VISIBLE diff --git a/include/search.h b/include/search.h index 068446fdcb88..0615da2b42ba 100644 --- a/include/search.h +++ b/include/search.h @@ -3,7 +3,6 @@ * Public domain. * * $NetBSD: search.h,v 1.16 2005/02/03 04:39:32 perry Exp $ - * $FreeBSD$ */ #ifndef _SEARCH_H_ diff --git a/include/semaphore.h b/include/semaphore.h index f330d5142058..039ee3f3bc0d 100644 --- a/include/semaphore.h +++ b/include/semaphore.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2010 David Xu <davidxu@freebsd.org> * @@ -25,8 +25,6 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ */ /* semaphore.h: POSIX 1003.1b semaphores */ diff --git a/include/setjmp.h b/include/setjmp.h index 1cc8b7762499..4739784c7ed2 100644 --- a/include/setjmp.h +++ b/include/setjmp.h @@ -32,9 +32,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)setjmp.h 8.2 (Berkeley) 1/21/94 - * $FreeBSD$ */ #ifndef _SETJMP_H_ diff --git a/include/signal.h b/include/signal.h index 3b20875290d6..9247aff56879 100644 --- a/include/signal.h +++ b/include/signal.h @@ -27,9 +27,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)signal.h 8.3 (Berkeley) 3/30/94 - * $FreeBSD$ */ #ifndef _SIGNAL_H_ @@ -43,6 +40,10 @@ #include <sys/_ucontext.h> #endif +#if __POSIX_VISIBLE >= 202405 || __BSD_VISIBLE +#define SIG2STR_MAX 32 /* size of buffer required for sig2str() */ +#endif + __NULLABILITY_PRAGMA_PUSH #if __BSD_VISIBLE @@ -71,6 +72,10 @@ typedef __pthread_t pthread_t; #endif #endif /* __POSIX_VISIBLE || __XSI_VISIBLE */ +#if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 +#include <ssp/signal.h> +#endif + __BEGIN_DECLS int raise(int); @@ -118,9 +123,15 @@ int siginterrupt(int, int); #endif #if __POSIX_VISIBLE >= 200809 +void psiginfo(const siginfo_t *, const char *); void psignal(int, const char *); #endif +#if __POSIX_VISIBLE >= 202405 || __BSD_VISIBLE +int sig2str(int, char *); +int str2sig(const char * __restrict, int * __restrict); +#endif + #if __BSD_VISIBLE int sigandset(sigset_t *dest, const sigset_t *left, const sigset_t *right); int sigblock(int); diff --git a/include/spawn.h b/include/spawn.h index 53373a6c8db8..a93315930954 100644 --- a/include/spawn.h +++ b/include/spawn.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org> * All rights reserved. @@ -24,8 +24,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _SPAWN_H_ @@ -61,6 +59,7 @@ typedef struct __posix_spawn_file_actions *posix_spawn_file_actions_t; #define POSIX_SPAWN_SETSCHEDULER 0x08 #define POSIX_SPAWN_SETSIGDEF 0x10 #define POSIX_SPAWN_SETSIGMASK 0x20 +#define POSIX_SPAWN_DISABLE_ASLR_NP 0x40 __BEGIN_DECLS /* diff --git a/include/ssp/Makefile b/include/ssp/Makefile new file mode 100644 index 000000000000..92e24dd4750a --- /dev/null +++ b/include/ssp/Makefile @@ -0,0 +1,5 @@ +INCS= poll.h random.h socket.h ssp.h signal.h stdio.h stdlib.h string.h strings.h +INCS+= uio.h unistd.h wchar.h +INCSDIR= ${INCLUDEDIR}/ssp + +.include <bsd.prog.mk> diff --git a/include/ssp/Makefile.depend b/include/ssp/Makefile.depend new file mode 100644 index 000000000000..11aba52f82cf --- /dev/null +++ b/include/ssp/Makefile.depend @@ -0,0 +1,10 @@ +# Autogenerated - do NOT edit! + +DIRDEPS = \ + + +.include <dirdeps.mk> + +.if ${DEP_RELDIR} == ${_DEP_RELDIR} +# local dependencies - needed for -jN in clean tree +.endif diff --git a/include/ssp/poll.h b/include/ssp/poll.h new file mode 100644 index 000000000000..90a8b368b8bf --- /dev/null +++ b/include/ssp/poll.h @@ -0,0 +1,60 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2024, Klara, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _SSP_POLL_H_ +#define _SSP_POLL_H_ + +#include <ssp/ssp.h> + +#if __SSP_FORTIFY_LEVEL > 0 + +__BEGIN_DECLS + +__ssp_redirect_raw_impl(int, poll, poll, + (struct pollfd fds[], nfds_t nfds, int timeout)) +{ + if (__ssp_bos(fds) / sizeof(fds[0]) < nfds) + __chk_fail(); + + return (__ssp_real(poll)(fds, nfds, timeout)); +} + +#if __POSIX_VISIBLE >= 202405 +__ssp_redirect_raw_impl(int, ppoll, ppoll, + (struct pollfd fds[], nfds_t nfds, + const struct timespec *__restrict timeout, + const sigset_t *__restrict newsigmask)) +{ + if (__ssp_bos(fds) / sizeof(fds[0]) < nfds) + __chk_fail(); + + return (__ssp_real(ppoll)(fds, nfds, timeout, newsigmask)); +} +#endif /* __POSIX_VISIBLE >= 202405 */ +__END_DECLS + +#endif /* __SSP_FORTIFY_LEVEL > 0 */ +#endif /* _SSP_POLL_H_ */ diff --git a/include/ssp/random.h b/include/ssp/random.h new file mode 100644 index 000000000000..9f98ad2315a1 --- /dev/null +++ b/include/ssp/random.h @@ -0,0 +1,42 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2024, Klara, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _SSP_RANDOM_H_ +#define _SSP_RANDOM_H_ + +#include <ssp/ssp.h> + +#if __SSP_FORTIFY_LEVEL > 0 + +__BEGIN_DECLS + +__ssp_redirect(ssize_t, getrandom, (void *__buf, size_t __len, + unsigned int __flags), (__buf, __len, __flags)); + +__END_DECLS + +#endif /* __SSP_FORTIFY_LEVEL > 0 */ +#endif /* _SSP_RANDOM_H_ */ diff --git a/include/ssp/signal.h b/include/ssp/signal.h new file mode 100644 index 000000000000..fb1da0db90d1 --- /dev/null +++ b/include/ssp/signal.h @@ -0,0 +1,52 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2025, Ricardo Branco <rbranco@suse.de> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _SSP_SIGNAL_H_ +#define _SSP_SIGNAL_H_ + +#include <ssp/ssp.h> + +#if __SSP_FORTIFY_LEVEL > 0 + +#include <signal.h> + +__BEGIN_DECLS + +#if __POSIX_VISIBLE >= 202405 || __BSD_VISIBLE +__ssp_redirect_raw_impl(int, sig2str, sig2str, + (int signum, char *__restrict str)) +{ + if (__ssp_bos(str) < SIG2STR_MAX) + __chk_fail(); + + return (__ssp_real(sig2str)(signum, str)); +} +#endif + +__END_DECLS + +#endif /* __SSP_FORTIFY_LEVEL > 0 */ +#endif /* _SSP_SIGNAL_H_ */ diff --git a/include/ssp/socket.h b/include/ssp/socket.h new file mode 100644 index 000000000000..30a8f0adf1ea --- /dev/null +++ b/include/ssp/socket.h @@ -0,0 +1,120 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2024, Klara, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _SSP_SOCKET_H_ +#define _SSP_SOCKET_H_ + +#include <ssp/ssp.h> + +#if __SSP_FORTIFY_LEVEL > 0 + +#include <sys/_null.h> + +__BEGIN_DECLS + +__ssp_inline void +__ssp_check_msghdr(struct msghdr *hdr) +{ + if (__ssp_bos(hdr->msg_name) < hdr->msg_namelen) + __chk_fail(); + + __ssp_check_iovec(hdr->msg_iov, hdr->msg_iovlen); + + if (__ssp_bos(hdr->msg_control) < hdr->msg_controllen) + __chk_fail(); +} + +__ssp_redirect_raw_impl(int, getpeername, getpeername, + (int fdes, struct sockaddr *__restrict name, socklen_t *__restrict namelen)) +{ + size_t namesz = __ssp_bos(name); + + if (namesz != (size_t)-1 && namesz < *namelen) + __chk_fail(); + + return (__ssp_real(getpeername)(fdes, name, namelen)); +} + +__ssp_redirect_raw_impl(int, getsockname, getsockname, + (int fdes, struct sockaddr *__restrict name, + socklen_t *__restrict namelen)) +{ + size_t namesz = __ssp_bos(name); + + if (namesz != (size_t)-1 && namesz < *namelen) + __chk_fail(); + + return (__ssp_real(getsockname)(fdes, name, namelen)); +} + +__ssp_redirect(ssize_t, recv, (int __sock, void *__buf, size_t __len, + int __flags), (__sock, __buf, __len, __flags)); + +__ssp_redirect_raw_impl(ssize_t, recvfrom, recvfrom, + (int s, void *buf, size_t len, int flags, + struct sockaddr *__restrict from, + socklen_t *__restrict fromlen)) +{ + if (__ssp_bos(buf) < len) + __chk_fail(); + if (from != NULL && __ssp_bos(from) < *fromlen) + __chk_fail(); + + return (__ssp_real(recvfrom)(s, buf, len, flags, from, fromlen)); +} + +__ssp_redirect_raw_impl(ssize_t, recvmsg, recvmsg, + (int s, struct msghdr *hdr, int flags)) +{ + __ssp_check_msghdr(hdr); + return (__ssp_real(recvmsg)(s, hdr, flags)); +} + +#if __BSD_VISIBLE +struct timespec; + +__ssp_redirect_raw_impl(ssize_t, recvmmsg, recvmmsg, + (int s, struct mmsghdr *__restrict hdrvec, size_t vlen, int flags, + const struct timespec *__restrict timeout)) +{ + const size_t vecsz = __ssp_bos(hdrvec); + size_t i; + + if (vecsz != (size_t)-1 && vecsz / sizeof(*hdrvec) < vlen) + __chk_fail(); + + for (i = 0; i < vlen; i++) { + __ssp_check_msghdr(&hdrvec[i].msg_hdr); + } + + return (__ssp_real(recvmmsg)(s, hdrvec, vlen, flags, timeout)); +} +#endif + +__END_DECLS + +#endif /* __SSP_FORTIFY_LEVEL > 0 */ +#endif /* _SSP_SOCKET_H_ */ diff --git a/include/ssp/ssp.h b/include/ssp/ssp.h new file mode 100644 index 000000000000..489f49a90218 --- /dev/null +++ b/include/ssp/ssp.h @@ -0,0 +1,127 @@ +/* $NetBSD: ssp.h,v 1.13 2015/09/03 20:43:47 plunky Exp $ */ + +/*- + * + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2006, 2011 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _SSP_SSP_H_ +#define _SSP_SSP_H_ + +#include <sys/cdefs.h> + +#if !defined(__cplusplus) +# if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && \ + (__OPTIMIZE__ > 0 || defined(__clang__)) +# if _FORTIFY_SOURCE > 1 +# define __SSP_FORTIFY_LEVEL 2 +# else +# define __SSP_FORTIFY_LEVEL 1 +# endif +# else +# define __SSP_FORTIFY_LEVEL 0 +# endif +#else +# define __SSP_FORTIFY_LEVEL 0 +#endif + +#define __ssp_var(type) __CONCAT(__ssp_ ## type, __COUNTER__) + +/* __ssp_real is used by the implementation in libc */ +#if __SSP_FORTIFY_LEVEL == 0 +#define __ssp_real_(fun) fun +#else +#define __ssp_real_(fun) __ssp_real_ ## fun +#endif +#define __ssp_real(fun) __ssp_real_(fun) + +#define __ssp_inline static __inline __attribute__((__always_inline__)) + +#define __ssp_bos(ptr) __builtin_object_size(ptr, __SSP_FORTIFY_LEVEL > 1) +#define __ssp_bos0(ptr) __builtin_object_size(ptr, 0) + +#define __ssp_check(buf, len, bos) \ + if (bos(buf) != (size_t)-1 && (size_t)len > bos(buf)) \ + __chk_fail() + +#define __ssp_redirect_raw_impl(rtype, fun, symbol, args) \ +rtype __ssp_real_(fun) args __RENAME(symbol); \ +__ssp_inline rtype fun args __RENAME(__ssp_protected_ ## fun); \ +__ssp_inline rtype fun args + +#define __ssp_redirect_raw(rtype, fun, symbol, args, call, cond, bos, len) \ +__ssp_redirect_raw_impl(rtype, fun, symbol, args) { \ + if (cond) \ + __ssp_check(__buf, len, bos); \ + return __ssp_real_(fun) call; \ +} + +#define __ssp_redirect(rtype, fun, args, call) \ + __ssp_redirect_raw(rtype, fun, fun, args, call, 1, __ssp_bos, __len) +#define __ssp_redirect0(rtype, fun, args, call) \ + __ssp_redirect_raw(rtype, fun, fun, args, call, 1, __ssp_bos0, __len) + +#include <sys/_types.h> +#include <machine/_limits.h> + +__ssp_inline int +__ssp_overlap(const void *leftp, const void *rightp, __size_t sz) +{ + __uintptr_t left = (__uintptr_t)leftp; + __uintptr_t right = (__uintptr_t)rightp; + + if (left <= right) + return (__SIZE_T_MAX - sz < left || right < left + sz); + + return (__SIZE_T_MAX - sz < right || left < right + sz); +} + +#include <sys/_iovec.h> + +__BEGIN_DECLS +void __stack_chk_fail(void) __dead2; +void __chk_fail(void) __dead2; +__END_DECLS + +__ssp_inline void +__ssp_check_iovec(const struct iovec *iov, int iovcnt) +{ + const size_t iovsz = __ssp_bos(iov); + int i; + + if (iovsz != (size_t)-1 && iovsz / sizeof(*iov) < (size_t)iovcnt) + __chk_fail(); + + for (i = 0; i < iovcnt; i++) { + if (__ssp_bos(iov[i].iov_base) < iov[i].iov_len) + __chk_fail(); + } +} + +#endif /* _SSP_SSP_H_ */ diff --git a/include/ssp/stdio.h b/include/ssp/stdio.h new file mode 100644 index 000000000000..630683951e4b --- /dev/null +++ b/include/ssp/stdio.h @@ -0,0 +1,107 @@ +/* $NetBSD: stdio.h,v 1.5 2011/07/17 20:54:34 joerg Exp $ */ + +/*- + * + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2006 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _SSP_STDIO_H_ +#define _SSP_STDIO_H_ + +#include <ssp/ssp.h> + +__BEGIN_DECLS +#if __SSP_FORTIFY_LEVEL > 0 +#if __POSIX_VISIBLE +__ssp_redirect_raw(char *, ctermid, ctermid, (char *__buf), (__buf), + __buf != NULL, __ssp_bos, L_ctermid); +#if __BSD_VISIBLE +__ssp_redirect_raw(char *, ctermid_r, ctermid_r, (char *__buf), (__buf), + __buf != NULL, __ssp_bos, L_ctermid); +#endif /* __BSD_VISIBLE */ +#endif /* __POSIX_VISIBLE */ +__ssp_redirect(size_t, fread, (void *__restrict __buf, size_t __len, + size_t __nmemb, FILE *__restrict __fp), (__buf, __len, __nmemb, __fp)); +__ssp_redirect(size_t, fread_unlocked, (void *__restrict __buf, size_t __len, + size_t __nmemb, FILE *__restrict __fp), (__buf, __len, __nmemb, __fp)); +#if __EXT1_VISIBLE +__ssp_redirect(char *, gets_s, (char *__buf, rsize_t __len), (__buf, __len)); +#endif /* __EXT1_VISIBLE */ +__ssp_redirect_raw(char *, tmpnam, tmpnam, (char *__buf), (__buf), 1, + __ssp_bos, L_tmpnam); +#endif + +int __sprintf_chk(char *__restrict, int, size_t, const char *__restrict, ...) + __printflike(4, 5); +int __vsprintf_chk(char *__restrict, int, size_t, const char *__restrict, + __va_list) + __printflike(4, 0); +int __snprintf_chk(char *__restrict, size_t, int, size_t, + const char *__restrict, ...) + __printflike(5, 6); +int __vsnprintf_chk(char *__restrict, size_t, int, size_t, + const char *__restrict, __va_list) + __printflike(5, 0); +char *__fgets_chk(char *, int, size_t, FILE *); +__END_DECLS + +#if __SSP_FORTIFY_LEVEL > 0 + +#define sprintf(str, ...) __extension__ ({ \ + char *_ssp_str = (str); \ + __builtin___sprintf_chk(_ssp_str, 0, __ssp_bos(_ssp_str), \ + __VA_ARGS__); \ +}) + +#define vsprintf(str, fmt, ap) __extension__ ({ \ + char *_ssp_str = (str); \ + __builtin___vsprintf_chk(_ssp_str, 0, __ssp_bos(_ssp_str), fmt, \ + ap); \ +}) + +#define snprintf(str, len, ...) __extension__ ({ \ + char *_ssp_str = (str); \ + __builtin___snprintf_chk(_ssp_str, len, 0, __ssp_bos(_ssp_str), \ + __VA_ARGS__); \ +}) + +#define vsnprintf(str, len, fmt, ap) __extension__ ({ \ + char *_ssp_str = (str); \ + __builtin___vsnprintf_chk(_ssp_str, len, 0, __ssp_bos(_ssp_str), \ + fmt, ap); \ +}) + +#define fgets(str, len, fp) __extension__ ({ \ + char *_ssp_str = (str); \ + __fgets_chk(_ssp_str, len, __ssp_bos(_ssp_str), fp); \ +}) + +#endif /* __SSP_FORTIFY_LEVEL > 0 */ + +#endif /* _SSP_STDIO_H_ */ diff --git a/include/ssp/stdlib.h b/include/ssp/stdlib.h new file mode 100644 index 000000000000..0a87be9f17d9 --- /dev/null +++ b/include/ssp/stdlib.h @@ -0,0 +1,57 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2024, Klara, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _SSP_STDLIB_H_ +#define _SSP_STDLIB_H_ + +#include <ssp/ssp.h> + +#if __SSP_FORTIFY_LEVEL > 0 + +#include <limits.h> + +__BEGIN_DECLS + +__ssp_redirect(void, arc4random_buf, (void *__buf, size_t __len), + (__buf, __len)); + +__ssp_redirect(int, getenv_r, + (const char *name, char * _Nonnull __buf, size_t __len), + (name, __buf, __len)); + +__ssp_redirect_raw_impl(char *, realpath, realpath, + (const char *__restrict path, char *__restrict buf)) +{ + if (__ssp_bos(buf) < PATH_MAX) + __chk_fail(); + + return (__ssp_real(realpath)(path, buf)); +} + +__END_DECLS + +#endif /* __SSP_FORTIFY_LEVEL > 0 */ +#endif /* _SSP_STDLIB_H_ */ diff --git a/include/ssp/string.h b/include/ssp/string.h new file mode 100644 index 000000000000..2999aed13cb1 --- /dev/null +++ b/include/ssp/string.h @@ -0,0 +1,141 @@ +/* $NetBSD: string.h,v 1.14 2020/09/05 13:37:59 mrg Exp $ */ + +/*- + * + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2006 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _SSP_STRING_H_ +#define _SSP_STRING_H_ + +#include <ssp/ssp.h> + +__BEGIN_DECLS +void *__memcpy_chk(void *, const void *, size_t, size_t); +void *__memmove_chk(void *, const void *, size_t, size_t); +void *__memset_chk(void *, int, size_t, size_t); +char *__stpcpy_chk(char *, const char *, size_t); +char *__stpncpy_chk(char *, const char *, size_t, size_t); +char *__strcat_chk(char *, const char *, size_t); +char *__strcpy_chk(char *, const char *, size_t); +char *__strncat_chk(char *, const char *, size_t, size_t); +size_t __strlcat_chk(char *, const char *, size_t, size_t); +char *__strncpy_chk(char *, const char *, size_t, size_t); +size_t __strlcpy_chk(char *, const char *, size_t, size_t); +__END_DECLS + +#if __SSP_FORTIFY_LEVEL > 0 + +#define __ssp_bos_check3_typed_var(fun, dsttype, dsrvar, dst, srctype, srcvar, \ + src, lenvar, len) __extension__ ({ \ + srctype srcvar = (src); \ + dsttype dstvar = (dst); \ + size_t lenvar = (len); \ + ((__ssp_bos0(dstvar) != (size_t)-1) ? \ + __builtin___ ## fun ## _chk(dstvar, srcvar, lenvar, \ + __ssp_bos0(dstvar)) : \ + __ ## fun ## _ichk(dstvar, srcvar, lenvar)); \ +}) + +#define __ssp_bos_check3_typed(fun, dsttype, dst, srctype, src, len) \ + __ssp_bos_check3_typed_var(fun, dsttype, __ssp_var(dstv), dst, \ + srctype, __ssp_var(srcv), src, __ssp_var(lenv), len) + +#define __ssp_bos_check3(fun, dst, src, len) \ + __ssp_bos_check3_typed_var(fun, void *, __ssp_var(dstv), dst, \ + const void *, __ssp_var(srcv), src, __ssp_var(lenv), len) + +#define __ssp_bos_check2_var(fun, dstvar, dst, srcvar, src) __extension__ ({ \ + const void *srcvar = (src); \ + void *dstvar = (dst); \ + ((__ssp_bos0(dstvar) != (size_t)-1) ? \ + __builtin___ ## fun ## _chk(dstvar, srcvar, \ + __ssp_bos0(dstvar)) : \ + __ ## fun ## _ichk(dstvar, srcvar)); \ +}) + +#define __ssp_bos_check2(fun, dst, src) \ + __ssp_bos_check2_var(fun, __ssp_var(dstv), dst, __ssp_var(srcv), src) + +#define __ssp_bos_icheck3_restrict(fun, type1, type2) \ +static __inline type1 __ ## fun ## _ichk(type1 __restrict, type2 __restrict, size_t); \ +static __inline __attribute__((__always_inline__)) type1 \ +__ ## fun ## _ichk(type1 __restrict dst, type2 __restrict src, size_t len) { \ + return __builtin___ ## fun ## _chk(dst, src, len, __ssp_bos0(dst)); \ +} + +#define __ssp_bos_icheck3(fun, type1, type2) \ +static __inline type1 __ ## fun ## _ichk(type1, type2, size_t); \ +static __inline __attribute__((__always_inline__)) type1 \ +__ ## fun ## _ichk(type1 dst, type2 src, size_t len) { \ + return __builtin___ ## fun ## _chk(dst, src, len, __ssp_bos0(dst)); \ +} + +#define __ssp_bos_icheck2_restrict(fun, type1, type2) \ +static __inline type1 __ ## fun ## _ichk(type1, type2); \ +static __inline __attribute__((__always_inline__)) type1 \ +__ ## fun ## _ichk(type1 __restrict dst, type2 __restrict src) { \ + return __builtin___ ## fun ## _chk(dst, src, __ssp_bos0(dst)); \ +} + +__BEGIN_DECLS +__ssp_bos_icheck3_restrict(memcpy, void *, const void *) +__ssp_bos_icheck3_restrict(mempcpy, void *, const void *) +__ssp_bos_icheck3(memmove, void *, const void *) +__ssp_bos_icheck3(memset, void *, int) +__ssp_redirect(void *, memset_explicit, (void *__buf, int __ch, size_t __len), + (__buf, __ch, __len)); +__ssp_bos_icheck2_restrict(stpcpy, char *, const char *) +__ssp_bos_icheck3_restrict(stpncpy, char *, const char *) +__ssp_bos_icheck2_restrict(strcpy, char *, const char *) +__ssp_bos_icheck2_restrict(strcat, char *, const char *) +__ssp_redirect0(int, strerror_r, (int __errnum, char *__buf, size_t __len), + (__errnum, __buf, __len)); +__ssp_bos_icheck3_restrict(strncpy, char *, const char *) +__ssp_bos_icheck3_restrict(strncat, char *, const char *) +__END_DECLS + +#define memcpy(dst, src, len) __ssp_bos_check3(memcpy, dst, src, len) +#define mempcpy(dst, src, len) __ssp_bos_check3(mempcpy, dst, src, len) +#define memmove(dst, src, len) __ssp_bos_check3(memmove, dst, src, len) +#define memset(dst, val, len) \ + __ssp_bos_check3_typed(memset, void *, dst, int, val, len) +#define stpcpy(dst, src) __ssp_bos_check2(stpcpy, dst, src) +#define stpncpy(dst, src, len) __ssp_bos_check3(stpncpy, dst, src, len) +#define strcpy(dst, src) __ssp_bos_check2(strcpy, dst, src) +#define strcat(dst, src) __ssp_bos_check2(strcat, dst, src) +#define strlcpy(dst, src, dstlen) \ + __strlcpy_chk(dst, src, dstlen, __ssp_bos(dst)) +#define strncpy(dst, src, len) __ssp_bos_check3(strncpy, dst, src, len) +#define strlcat(dst, src, dstlen) \ + __strlcat_chk(dst, src, dstlen, __ssp_bos(dst)) +#define strncat(dst, src, len) __ssp_bos_check3(strncat, dst, src, len) + +#endif /* __SSP_FORTIFY_LEVEL > 0 */ +#endif /* _SSP_STRING_H_ */ diff --git a/include/ssp/strings.h b/include/ssp/strings.h new file mode 100644 index 000000000000..79b70eba1c5c --- /dev/null +++ b/include/ssp/strings.h @@ -0,0 +1,72 @@ +/* $NetBSD: strings.h,v 1.3 2008/04/28 20:22:54 martin Exp $ */ + +/*- + * + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2007 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _SSP_STRINGS_H_ +#define _SSP_STRINGS_H_ + +#include <ssp/ssp.h> +#include <string.h> + +#if __SSP_FORTIFY_LEVEL > 0 + +#define _ssp_bcopy(srcvar, src, dstvar, dst, lenvar, len) __extension__ ({ \ + const void *srcvar = (src); \ + void *dstvar = (dst); \ + size_t lenvar = (len); \ + ((__ssp_bos0(dstvar) != (size_t)-1) ? \ + __builtin___memmove_chk(dstvar, srcvar, lenvar, \ + __ssp_bos0(dstvar)) : \ + __memmove_ichk(dstvar, srcvar, lenvar)); \ +}) + +#define bcopy(src, dst, len) \ + _ssp_bcopy(__ssp_var(srcv), src, __ssp_var(dstv), dst, __ssp_var(lenv), len) + +#define _ssp_bzero(dstvar, dst, lenvar, len) __extension__ ({ \ + void *dstvar = (dst); \ + size_t lenvar = (len); \ + ((__ssp_bos0(dstvar) != (size_t)-1) ? \ + __builtin___memset_chk(dstvar, 0, lenvar, \ + __ssp_bos0(dstvar)) : \ + __memset_ichk(dstvar, 0, lenvar)); \ +}) + +#define bzero(dst, len) _ssp_bzero(__ssp_var(dstv), dst, __ssp_var(lenv), len) + +__BEGIN_DECLS +__ssp_redirect(void, explicit_bzero, (void *__buf, size_t __len), + (__buf, __len)); +__END_DECLS + +#endif /* __SSP_FORTIFY_LEVEL > 0 */ +#endif /* _SSP_STRINGS_H_ */ diff --git a/include/ssp/uio.h b/include/ssp/uio.h new file mode 100644 index 000000000000..adf1dcbb3d67 --- /dev/null +++ b/include/ssp/uio.h @@ -0,0 +1,53 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2024, Klara, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _SSP_UIO_H_ +#define _SSP_UIO_H_ + +#include <ssp/ssp.h> + +#if __SSP_FORTIFY_LEVEL > 0 + +__BEGIN_DECLS + +__ssp_redirect_raw_impl(ssize_t, readv, readv, + (int fd, const struct iovec *iov, int iovcnt)) +{ + __ssp_check_iovec(iov, iovcnt); + return (__ssp_real(readv)(fd, iov, iovcnt)); +} + +__ssp_redirect_raw_impl(ssize_t, preadv, preadv, + (int fd, const struct iovec *iov, int iovcnt, off_t offset)) +{ + __ssp_check_iovec(iov, iovcnt); + return (__ssp_real(preadv)(fd, iov, iovcnt, offset)); +} + +__END_DECLS + +#endif /* __SSP_FORTIFY_LEVEL > 0 */ +#endif /* _SSP_UIO_H_ */ diff --git a/include/ssp/unistd.h b/include/ssp/unistd.h new file mode 100644 index 000000000000..7e9d72343dde --- /dev/null +++ b/include/ssp/unistd.h @@ -0,0 +1,90 @@ +/* $NetBSD: unistd.h,v 1.7 2015/06/25 18:41:03 joerg Exp $ */ + +/*- + * + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2006 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _SSP_UNISTD_H_ +#define _SSP_UNISTD_H_ + +#include <ssp/ssp.h> + +#if __SSP_FORTIFY_LEVEL > 0 +__BEGIN_DECLS + +#ifndef _FORTIFY_SOURCE_read +#define _FORTIFY_SOURCE_read read +#endif + +__ssp_inline size_t +__ssp_gid_bos(const void *ptr) +{ + size_t ptrsize = __ssp_bos(ptr); + + if (ptrsize == (size_t)-1) + return (ptrsize); + + return (ptrsize / sizeof(gid_t)); +} + +__ssp_redirect_raw(int, getgrouplist, getgrouplist, + (const char *__name, gid_t __base, gid_t *__buf, int *__lenp), + (__name, __base, __buf, __lenp), 1, __ssp_gid_bos, *__lenp); + +__ssp_redirect_raw(int, getgroups, getgroups, (int __len, gid_t *__buf), + (__len, __buf), 1, __ssp_gid_bos, __len); + +__ssp_redirect(int, getloginclass, (char *__buf, size_t __len), + (__buf, __len)); + +__ssp_redirect(ssize_t, _FORTIFY_SOURCE_read, (int __fd, void *__buf, + size_t __len), (__fd, __buf, __len)); +__ssp_redirect(ssize_t, pread, (int __fd, void *__buf, size_t __len, + off_t __offset), (__fd, __buf, __len, __offset)); + +__ssp_redirect(ssize_t, readlink, (const char *__restrict __path, \ + char *__restrict __buf, size_t __len), (__path, __buf, __len)); +__ssp_redirect(ssize_t, readlinkat, (int __fd, const char *__restrict __path, + char *__restrict __buf, size_t __len), (__fd, __path, __buf, __len)); + +__ssp_redirect_raw(char *, getcwd, getcwd, (char *__buf, size_t __len), + (__buf, __len), __buf != 0, __ssp_bos, __len); + +__ssp_redirect(int, getdomainname, (char *__buf, int __len), (__buf, __len)); +__ssp_redirect(int, getentropy, (void *__buf, size_t __len), (__buf, __len)); +__ssp_redirect(int, gethostname, (char *__buf, size_t __len), (__buf, __len)); +__ssp_redirect(int, getlogin_r, (char *__buf, size_t __len), (__buf, __len)); +__ssp_redirect(int, ttyname_r, (int __fd, char *__buf, size_t __len), + (__fd, __buf, __len)); + +__END_DECLS + +#endif /* __SSP_FORTIFY_LEVEL > 0 */ +#endif /* _SSP_UNISTD_H_ */ diff --git a/include/ssp/wchar.h b/include/ssp/wchar.h new file mode 100644 index 000000000000..7ed84e087f5d --- /dev/null +++ b/include/ssp/wchar.h @@ -0,0 +1,229 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2024, Klara, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _SSP_WCHAR_H_ +#define _SSP_WCHAR_H_ + +#include <ssp/ssp.h> + +#if __SSP_FORTIFY_LEVEL > 0 + +__ssp_inline int +__ssp_wchar_overlap(const void *leftp, const void *rightp, size_t len) +{ + + if (len > __SIZE_T_MAX / sizeof(wchar_t)) + return (1); + return (__ssp_overlap(leftp, rightp, len * sizeof(wchar_t))); +} + +/* + * __ssp_wbos for w*() calls where the size parameters are in sizeof(wchar_t) + * units, so the result needs to be scaled appropriately. + */ +__ssp_inline size_t +__ssp_wbos(void *ptr) +{ + const size_t ptrsize = __ssp_bos(ptr); + + if (ptrsize == (size_t)-1) + return (ptrsize); + + return (ptrsize / sizeof(wchar_t)); +} + +__BEGIN_DECLS +__ssp_redirect_raw_impl(wchar_t *, wmemcpy, wmemcpy, + (wchar_t *__restrict buf, const wchar_t *__restrict src, size_t len)) +{ + const size_t slen = __ssp_wbos(buf); + + if (len > slen) + __chk_fail(); + if (__ssp_wchar_overlap(src, buf, len)) + __chk_fail(); + + return (__ssp_real(wmemcpy)(buf, src, len)); +} + +__ssp_redirect_raw_impl(wchar_t *, wmempcpy, wmempcpy, + (wchar_t *__restrict buf, const wchar_t *__restrict src, size_t len)) +{ + const size_t slen = __ssp_wbos(buf); + + if (len > slen) + __chk_fail(); + if (__ssp_wchar_overlap(src, buf, len)) + __chk_fail(); + + return (__ssp_real(wmempcpy)(buf, src, len)); +} + +__ssp_redirect_raw_impl(wchar_t *, wmemmove, wmemmove, + (wchar_t *buf, const wchar_t *src, size_t len)) +{ + const size_t slen = __ssp_wbos(buf); + + if (len > slen) + __chk_fail(); + + return (__ssp_real(wmemmove)(buf, src, len)); +} + +__ssp_redirect_raw_impl(wchar_t *, wmemset, wmemset, + (wchar_t *buf, wchar_t c, size_t len)) +{ + const size_t slen = __ssp_wbos(buf); + + if (len > slen) + __chk_fail(); + return (__ssp_real(wmemset)(buf, c, len)); +} + +__ssp_redirect_raw_impl(wchar_t *, wcpcpy, wcpcpy, + (wchar_t *__restrict buf, const wchar_t *__restrict src)) +{ + const size_t slen = __ssp_wbos(buf); + const size_t len = wcslen(src); + + if (len >= slen) + __chk_fail(); + if (__ssp_wchar_overlap(buf, src, len)) + __chk_fail(); + + (void)__ssp_real(wmemcpy)(buf, src, len + 1); + return (buf + len); +} + +__ssp_redirect_raw_impl(wchar_t *, wcpncpy, wcpncpy, + (wchar_t *__restrict buf, const wchar_t *__restrict src, size_t len)) +{ + const size_t slen = __ssp_wbos(buf); + + if (len > slen) + __chk_fail(); + if (__ssp_wchar_overlap(buf, src, len)) + __chk_fail(); + + return (__ssp_real(wcpncpy)(buf, src, len)); +} + +__ssp_redirect_raw_impl(wchar_t *, wcscat, wcscat, + (wchar_t *__restrict buf, const wchar_t *__restrict src)) +{ + size_t slen = __ssp_wbos(buf); + wchar_t *cp; + + cp = buf; + while (*cp != L'\0') { + cp++; + if (slen-- == 0) + __chk_fail(); + } + + while (*src != L'\0') { + if (slen-- == 0) + __chk_fail(); + *cp++ = *src++; + } + + if (slen-- == 0) + __chk_fail(); + *cp = '\0'; + return (buf); +} + +__ssp_redirect_raw_impl(wchar_t *, wcscpy, wcscpy, + (wchar_t *__restrict buf, const wchar_t *__restrict src)) +{ + const size_t slen = __ssp_wbos(buf); + size_t len = wcslen(src) + 1; + + if (len > slen) + __chk_fail(); + if (__ssp_wchar_overlap(buf, src, len)) + __chk_fail(); + + return (__ssp_real(wmemcpy)(buf, src, len)); +} + +__ssp_redirect_raw_impl(wchar_t *, wcsncat, wcsncat, + (wchar_t *__restrict buf, const wchar_t *__restrict src, size_t len)) +{ + const size_t slen = __ssp_wbos(buf); + + if (len == 0) + return (buf); + if (len > slen) + __chk_fail(); + if (__ssp_wchar_overlap(buf, src, len)) + __chk_fail(); + + return (__ssp_real(wcsncat)(buf, src, len)); +} + +__ssp_redirect_raw_impl(size_t, wcslcat, wcslcat, + (wchar_t *__restrict buf, const wchar_t *__restrict src, size_t len)) +{ + const size_t slen = __ssp_wbos(buf); + + if (len > slen) + __chk_fail(); + if (__ssp_wchar_overlap(buf, src, len)) + __chk_fail(); + + return (__ssp_real(wcslcat)(buf, src, len)); +} + +__ssp_redirect_raw_impl(wchar_t *, wcsncpy, wcsncpy, + (wchar_t *__restrict buf, const wchar_t *__restrict src, size_t len)) +{ + const size_t slen = __ssp_wbos(buf); + + if (len > slen) + __chk_fail(); + if (__ssp_wchar_overlap(buf, src, len)) + __chk_fail(); + + return (__ssp_real(wcsncpy)(buf, src, len)); +} + +__ssp_redirect_raw_impl(size_t, wcslcpy, wcslcpy, + (wchar_t *__restrict buf, const wchar_t *__restrict src, size_t len)) +{ + const size_t slen = __ssp_wbos(buf); + + if (len > slen) + __chk_fail(); + if (__ssp_wchar_overlap(buf, src, len)) + __chk_fail(); + + return (__ssp_real(wcslcpy)(buf, src, len)); +} +__END_DECLS + +#endif /* __SSP_FORTIFY_LEVEL > 0 */ +#endif /* _SSP_WCHAR_H_ */ diff --git a/include/stab.h b/include/stab.h index 9abff130ff7d..e47274d2c763 100644 --- a/include/stab.h +++ b/include/stab.h @@ -27,10 +27,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)stab.h 8.1 (Berkeley) 6/2/93 - * - * $FreeBSD$ */ #ifndef _STAB_H_ diff --git a/include/stdalign.h b/include/stdalign.h index 6f777fde3df5..00ae5677f449 100644 --- a/include/stdalign.h +++ b/include/stdalign.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2012 Ed Schouten <ed@FreeBSD.org> * All rights reserved. @@ -24,8 +24,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef __alignas_is_defined diff --git a/include/stdbool.h b/include/stdbool.h index 2879da798da6..a03835ca6962 100644 --- a/include/stdbool.h +++ b/include/stdbool.h @@ -1,5 +1,5 @@ /* - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2000 Jeroen Ruigrok van der Werven <asmodai@FreeBSD.org> * All rights reserved. @@ -24,8 +24,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef __bool_true_false_are_defined diff --git a/include/stdckdint.h b/include/stdckdint.h new file mode 100644 index 000000000000..af3074dded89 --- /dev/null +++ b/include/stdckdint.h @@ -0,0 +1,40 @@ +/*- + * Copyright (c) 2023 Dag-Erling Smørgrav + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#ifndef __STDC_VERSION_STDCKDINT_H__ +#define __STDC_VERSION_STDCKDINT_H__ 202311L + +#include <sys/cdefs.h> + +#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 2023 + +#if __GNUC_PREREQ__(5, 1) || __has_builtin(__builtin_add_overflow) +#define ckd_add(result, a, b) \ + (_Bool)__builtin_add_overflow((a), (b), (result)) +#else +#define ckd_add(result, a, b) \ + _Static_assert(0, "checked addition not supported") +#endif + +#if __GNUC_PREREQ__(5, 1) || __has_builtin(__builtin_sub_overflow) +#define ckd_sub(result, a, b) \ + (_Bool)__builtin_sub_overflow((a), (b), (result)) +#else +#define ckd_sub(result, a, b) \ + _Static_assert(0, "checked subtraction not supported") +#endif + +#if __GNUC_PREREQ__(5, 1) || __has_builtin(__builtin_mul_overflow) +#define ckd_mul(result, a, b) \ + (_Bool)__builtin_mul_overflow((a), (b), (result)) +#else +#define ckd_mul(result, a, b) \ + _Static_assert(0, "checked multiplication not supported") +#endif + +#endif + +#endif diff --git a/include/stddef.h b/include/stddef.h index a52e6d312f84..3ba9a9946b01 100644 --- a/include/stddef.h +++ b/include/stddef.h @@ -27,31 +27,20 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)stddef.h 8.1 (Berkeley) 6/2/93 - * - * $FreeBSD$ */ #ifndef _STDDEF_H_ #define _STDDEF_H_ -#include <sys/cdefs.h> #include <sys/_null.h> #include <sys/_types.h> +#include <sys/_visible.h> #ifndef _PTRDIFF_T_DECLARED typedef __ptrdiff_t ptrdiff_t; #define _PTRDIFF_T_DECLARED #endif -#if __BSD_VISIBLE -#ifndef _RUNE_T_DECLARED -typedef __rune_t rune_t; -#define _RUNE_T_DECLARED -#endif -#endif - #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED @@ -72,7 +61,9 @@ typedef __max_align_t max_align_t; #endif #endif -#define offsetof(type, field) __offsetof(type, field) +#ifndef offsetof +#define offsetof(type, field) __builtin_offsetof(type, field) +#endif #if __EXT1_VISIBLE /* ISO/IEC 9899:2011 K.3.3.2 */ diff --git a/include/stdio.h b/include/stdio.h index e392bd5eb3e2..34e877b60c14 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -30,9 +30,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)stdio.h 8.5 (Berkeley) 4/29/95 - * $FreeBSD$ */ #ifndef _STDIO_H_ @@ -51,10 +48,13 @@ typedef __size_t size_t; #define _SIZE_T_DECLARED #endif +#if __EXT1_VISIBLE +/* ISO/IEC 9899:2011 K.3.3.2 */ #ifndef _RSIZE_T_DEFINED #define _RSIZE_T_DEFINED typedef size_t rsize_t; #endif +#endif /* __EXT1_VISIBLE */ #if __POSIX_VISIBLE >= 200809 #ifndef _OFF_T_DECLARED @@ -74,7 +74,7 @@ typedef __off64_t off64_t; #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE #ifndef _VA_LIST_DECLARED -typedef __va_list va_list; +typedef __builtin_va_list va_list; #define _VA_LIST_DECLARED #endif #endif @@ -241,6 +241,21 @@ __END_DECLS #define stdout __stdoutp #define stderr __stderrp +/* + * Functions defined in all versions of POSIX 1003.1. + */ +#if __BSD_VISIBLE || (__POSIX_VISIBLE && __POSIX_VISIBLE <= 199506) +#define L_cuserid 17 /* size for cuserid(3); MAXLOGNAME, legacy */ +#endif + +#if __POSIX_VISIBLE +#define L_ctermid 1024 /* size for ctermid(3); PATH_MAX */ +#endif /* __POSIX_VISIBLE */ + +#if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 +#include <ssp/stdio.h> +#endif + __BEGIN_DECLS #ifdef _XLOCALE_H_ #include <xlocale/_stdio.h> @@ -255,7 +270,7 @@ int ferror(FILE *); int fflush(FILE *); int fgetc(FILE *); int fgetpos(FILE * __restrict, fpos_t * __restrict); -char *fgets(char * __restrict, int, FILE * __restrict); +char *(fgets)(char * __restrict, int, FILE * __restrict); FILE *fopen(const char * __restrict, const char * __restrict); int fprintf(FILE * __restrict, const char * __restrict, ...); int fputc(int, FILE *); @@ -283,7 +298,7 @@ void rewind(FILE *); int scanf(const char * __restrict, ...); void setbuf(FILE * __restrict, char * __restrict); int setvbuf(FILE * __restrict, char * __restrict, int, size_t); -int sprintf(char * __restrict, const char * __restrict, ...); +int (sprintf)(char * __restrict, const char * __restrict, ...); int sscanf(const char * __restrict, const char * __restrict, ...); FILE *tmpfile(void); char *tmpnam(char *); @@ -291,13 +306,13 @@ int ungetc(int, FILE *); int vfprintf(FILE * __restrict, const char * __restrict, __va_list); int vprintf(const char * __restrict, __va_list); -int vsprintf(char * __restrict, const char * __restrict, +int (vsprintf)(char * __restrict, const char * __restrict, __va_list); #if __ISO_C_VISIBLE >= 1999 || __POSIX_VISIBLE >= 199506 -int snprintf(char * __restrict, size_t, const char * __restrict, +int (snprintf)(char * __restrict, size_t, const char * __restrict, ...) __printflike(3, 4); -int vsnprintf(char * __restrict, size_t, const char * __restrict, +int (vsnprintf)(char * __restrict, size_t, const char * __restrict, __va_list) __printflike(3, 0); #endif #if __ISO_C_VISIBLE >= 1999 @@ -308,16 +323,7 @@ int vsscanf(const char * __restrict, const char * __restrict, __va_list) __scanflike(2, 0); #endif -/* - * Functions defined in all versions of POSIX 1003.1. - */ -#if __BSD_VISIBLE || (__POSIX_VISIBLE && __POSIX_VISIBLE <= 199506) -#define L_cuserid 17 /* size for cuserid(3); MAXLOGNAME, legacy */ -#endif - #if __POSIX_VISIBLE -#define L_ctermid 1024 /* size for ctermid(3); PATH_MAX */ - char *ctermid(char *); FILE *fdopen(int, const char *); int fileno(FILE *); @@ -416,6 +422,7 @@ FILE *funopen(const void *, #define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0) #define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0) +#if __BSD_VISIBLE typedef __ssize_t cookie_read_function_t(void *, char *, size_t); typedef __ssize_t cookie_write_function_t(void *, const char *, size_t); typedef int cookie_seek_function_t(void *, off64_t *, int); @@ -427,6 +434,7 @@ typedef struct { cookie_close_function_t *close; } cookie_io_functions_t; FILE *fopencookie(void *, const char *, cookie_io_functions_t); +#endif /* * Portability hacks. See <sys/types.h>. @@ -498,10 +506,6 @@ extern int __isthreaded; #define ferror(p) (!__isthreaded ? __sferror(p) : (ferror)(p)) #define clearerr(p) (!__isthreaded ? __sclearerr(p) : (clearerr)(p)) -#if __POSIX_VISIBLE -#define fileno(p) (!__isthreaded ? __sfileno(p) : (fileno)(p)) -#endif - #define getc(fp) (!__isthreaded ? __sgetc(fp) : (getc)(fp)) #define putc(x, fp) (!__isthreaded ? __sputc(x, fp) : (putc)(x, fp)) diff --git a/include/stdlib.h b/include/stdlib.h index bf1a612190ee..ba0cf4b5e88e 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -27,9 +27,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)stdlib.h 8.5 (Berkeley) 5/19/95 - * $FreeBSD$ */ #ifndef _STDLIB_H_ @@ -41,13 +38,6 @@ __NULLABILITY_PRAGMA_PUSH -#if __BSD_VISIBLE -#ifndef _RUNE_T_DECLARED -typedef __rune_t rune_t; -#define _RUNE_T_DECLARED -#endif -#endif - #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED @@ -79,6 +69,10 @@ typedef struct { */ #define RAND_MAX 0x7fffffff +#if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 +#include <ssp/stdlib.h> +#endif + __BEGIN_DECLS #ifdef _XLOCALE_H_ #include <xlocale/_stdlib.h> @@ -87,9 +81,9 @@ extern int __mb_cur_max; extern int ___mb_cur_max(void); #define MB_CUR_MAX ((size_t)___mb_cur_max()) -_Noreturn void abort(void); +_Noreturn void abort(void) __noexcept; int abs(int) __pure2; -int atexit(void (* _Nonnull)(void)); +int atexit(void (* _Nonnull)(void)) __noexcept; double atof(const char *); int atoi(const char *); long atol(const char *); @@ -101,6 +95,9 @@ div_t div(int, int) __pure2; _Noreturn void exit(int); void free(void *); char *getenv(const char *); +#if __BSD_VISIBLE +int getenv_r(const char *, char * _Nonnull, size_t); +#endif long labs(long) __pure2; ldiv_t ldiv(long, long) __pure2; void *malloc(size_t) __malloc_like __result_use_check __alloc_size(1); @@ -131,7 +128,7 @@ size_t wcstombs(char * __restrict, const wchar_t * __restrict, size_t); * is not supported in the compilation environment (which therefore means * that it can't really be ISO C99). * - * (The only other extension made by C99 in thie header is _Exit().) + * (The only other extension made by C99 in this header is _Exit().) */ #if __ISO_C_VISIBLE >= 1999 || defined(__cplusplus) #ifdef __LONG_LONG_SUPPORTED @@ -157,7 +154,7 @@ unsigned long long strtoull(const char * __restrict, char ** __restrict, int); #endif /* __LONG_LONG_SUPPORTED */ -_Noreturn void _Exit(int); +_Noreturn void _Exit(int) __noexcept; #endif /* __ISO_C_VISIBLE >= 1999 */ /* @@ -166,9 +163,9 @@ _Noreturn void _Exit(int); #if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L void * aligned_alloc(size_t, size_t) __malloc_like __alloc_align(1) __alloc_size(2); -int at_quick_exit(void (*)(void)); +int at_quick_exit(void (*)(void)) __noexcept; _Noreturn void - quick_exit(int); + quick_exit(int) /* __noexcept -- not ready ABI issues? */; #endif /* __ISO_C_VISIBLE >= 2011 */ /* * Extensions made by POSIX relative to C. @@ -311,14 +308,15 @@ int mergesort_b(void *, size_t, size_t, int (^)(const void *, const void *)); int mkostemp(char *, int); int mkostemps(char *, int, int); int mkostempsat(int, char *, int, int); -void qsort_r(void *, size_t, size_t, void *, - int (*)(void *, const void *, const void *)); +void qsort_r(void *, size_t, size_t, + int (*)(const void *, const void *, void *), void *); int radixsort(const unsigned char **, int, const unsigned char *, unsigned); void *reallocarray(void *, size_t, size_t) __result_use_check __alloc_size2(2, 3); void *reallocf(void *, size_t) __result_use_check __alloc_size(2); int rpmatch(const char *); +char *secure_getenv(const char *); void setprogname(const char *); int sradixsort(const unsigned char **, int, const unsigned char *, unsigned); @@ -332,6 +330,43 @@ __int64_t __uint64_t strtouq(const char *, char **, int); +/* + * In FreeBSD 14, the prototype of qsort_r() was modified to comply with + * POSIX. The standardized qsort_r()'s order of last two parameters was + * changed, and the comparator function is now taking thunk as its last + * parameter, and both are different from the ones expected by the historical + * FreeBSD qsort_r() interface. + * + * Apply a workaround where we explicitly link against the historical interface, + * qsort_r@FBSD_1.0, in case when qsort_r() is called with the last parameter + * with a function pointer that exactly matches the historical FreeBSD qsort_r() + * comparator signature, so applications written for the historical interface + * can continue to work without modification. Toolchains that don't support + * symbol versioning don't define __sym_compat, so only provide this symbol in + * supported environments. + */ +#ifdef __sym_compat +#if defined(__generic) || defined(__cplusplus) +void __qsort_r_compat(void *, size_t, size_t, void *, + int (*)(void *, const void *, const void *)); +__sym_compat(qsort_r, __qsort_r_compat, FBSD_1.0); +#endif +#endif +#if defined(__generic) && !defined(__cplusplus) +#define qsort_r(base, nel, width, arg4, arg5) \ + __generic(arg5, int (*)(void *, const void *, const void *), \ + __qsort_r_compat, qsort_r)(base, nel, width, arg4, arg5) +#elif defined(__cplusplus) && defined(__sym_compat) +__END_DECLS +extern "C++" { +static inline void qsort_r(void *base, size_t nmemb, size_t size, + void *thunk, int (*compar)(void *, const void *, const void *)) { + __qsort_r_compat(base, nmemb, size, thunk, compar); +} +} +__BEGIN_DECLS +#endif + extern char *suboptarg; /* getsubopt(3) external variable */ #endif /* __BSD_VISIBLE */ diff --git a/include/stdnoreturn.h b/include/stdnoreturn.h index e8fc7dca71b3..541c2835e186 100644 --- a/include/stdnoreturn.h +++ b/include/stdnoreturn.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2012 Ed Schouten <ed@FreeBSD.org> * All rights reserved. @@ -24,8 +24,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifdef __cplusplus diff --git a/include/string.h b/include/string.h index 15d4dc7e9701..a3fa96ebb449 100644 --- a/include/string.h +++ b/include/string.h @@ -27,9 +27,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)string.h 8.1 (Berkeley) 6/2/93 - * $FreeBSD$ */ #ifndef _STRING_H_ @@ -52,8 +49,12 @@ typedef __size_t size_t; #define _SIZE_T_DECLARED #endif +#if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 +#include <ssp/string.h> +#endif + __BEGIN_DECLS -#if __XSI_VISIBLE >= 600 +#if __XSI_VISIBLE >= 600 || __ISO_C_VISIBLE >= 2023 void *memccpy(void * __restrict, const void * __restrict, int, size_t); #endif void *memchr(const void *, int, size_t) __pure; @@ -61,32 +62,36 @@ void *memchr(const void *, int, size_t) __pure; void *memrchr(const void *, int, size_t) __pure; #endif int memcmp(const void *, const void *, size_t) __pure; -void *memcpy(void * __restrict, const void * __restrict, size_t); +void *(memcpy)(void * __restrict, const void * __restrict, size_t); #if __BSD_VISIBLE void *memmem(const void *, size_t, const void *, size_t) __pure; #endif -void *memmove(void *, const void *, size_t); +void *(memmove)(void *, const void *, size_t); #if __BSD_VISIBLE -void *mempcpy(void * __restrict, const void * __restrict, size_t); +void *(mempcpy)(void * __restrict, const void * __restrict, size_t); +#endif +void *(memset)(void *, int, size_t); +#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 2023 +void *memset_explicit(void *, int, size_t); #endif -void *memset(void *, int, size_t); #if __POSIX_VISIBLE >= 200809 -char *stpcpy(char * __restrict, const char * __restrict); -char *stpncpy(char * __restrict, const char * __restrict, size_t); +char *(stpcpy)(char * __restrict, const char * __restrict); +char *(stpncpy)(char * __restrict, const char * __restrict, size_t); #endif #if __BSD_VISIBLE char *strcasestr(const char *, const char *) __pure; #endif -char *strcat(char * __restrict, const char * __restrict); +char *(strcat)(char * __restrict, const char * __restrict); char *strchr(const char *, int) __pure; #if __BSD_VISIBLE char *strchrnul(const char*, int) __pure; +int strverscmp(const char *, const char *) __pure; #endif int strcmp(const char *, const char *) __pure; int strcoll(const char *, const char *); -char *strcpy(char * __restrict, const char * __restrict); +char *(strcpy)(char * __restrict, const char * __restrict); size_t strcspn(const char *, const char *) __pure; -#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE +#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE || __ISO_C_VISIBLE >= 2023 char *strdup(const char *) __malloc_like; #endif char *strerror(int); @@ -94,8 +99,8 @@ char *strerror(int); int strerror_r(int, char *, size_t); #endif #if __BSD_VISIBLE -size_t strlcat(char * __restrict, const char * __restrict, size_t); -size_t strlcpy(char * __restrict, const char * __restrict, size_t); +size_t (strlcat)(char * __restrict, const char * __restrict, size_t); +size_t (strlcpy)(char * __restrict, const char * __restrict, size_t); #endif size_t strlen(const char *) __pure; #if __BSD_VISIBLE @@ -107,11 +112,13 @@ typedef __mode_t mode_t; void strmode(mode_t, char *); #endif -char *strncat(char * __restrict, const char * __restrict, size_t); +char *(strncat)(char * __restrict, const char * __restrict, size_t); int strncmp(const char *, const char *, size_t) __pure; -char *strncpy(char * __restrict, const char * __restrict, size_t); -#if __POSIX_VISIBLE >= 200809 +char *(strncpy)(char * __restrict, const char * __restrict, size_t); +#if __POSIX_VISIBLE >= 200809 || __ISO_C_VISIBLE >= 2023 char *strndup(const char *, size_t) __malloc_like; +#endif +#if __POSIX_VISIBLE >= 200809 size_t strnlen(const char *, size_t) __pure; #endif #if __BSD_VISIBLE diff --git a/include/stringlist.h b/include/stringlist.h index b570e631b526..c0ac84ef8679 100644 --- a/include/stringlist.h +++ b/include/stringlist.h @@ -1,7 +1,7 @@ /* $NetBSD: stringlist.h,v 1.2 1997/01/17 06:11:36 lukem Exp $ */ /*- - * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 1994 Christos Zoulas * All rights reserved. @@ -26,13 +26,11 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _STRINGLIST_H #define _STRINGLIST_H -#include <sys/cdefs.h> + #include <sys/types.h> /* diff --git a/include/strings.h b/include/strings.h index 9df19e4ce9ce..889f43bd2311 100644 --- a/include/strings.h +++ b/include/strings.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org> * All rights reserved. @@ -24,8 +24,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _STRINGS_H_ @@ -39,11 +37,15 @@ typedef __size_t size_t; #define _SIZE_T_DECLARED #endif +#if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 +#include <ssp/strings.h> +#endif + __BEGIN_DECLS #if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112 int bcmp(const void *, const void *, size_t) __pure; /* LEGACY */ -void bcopy(const void *, void *, size_t); /* LEGACY */ -void bzero(void *, size_t); /* LEGACY */ +void (bcopy)(const void *, void *, size_t); /* LEGACY */ +void (bzero)(void *, size_t); /* LEGACY */ #endif #if __BSD_VISIBLE void explicit_bzero(void *, size_t); diff --git a/include/sysexits.h b/include/sysexits.h index 5e414f24ce8d..3b24e131c647 100644 --- a/include/sysexits.h +++ b/include/sysexits.h @@ -27,10 +27,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)sysexits.h 8.1 (Berkeley) 6/2/93 - * - * $FreeBSD$ */ #ifndef _SYSEXITS_H_ @@ -39,9 +35,10 @@ /* * SYSEXITS.H -- Exit status codes for system programs. * - * This include file attempts to categorize possible error - * exit statuses for system programs, notably delivermail - * and the Berkeley network. + * This include file attempts to categorize error exit statuses + * for system programs, notably sendmail. These values exist only + * for interface compatibility, and are deprecated for FreeBSD + * base software. * * Error numbers begin at EX__BASE to reduce the possibility of * clashing with other exit statuses that random programs may diff --git a/include/tar.h b/include/tar.h index 3d54476520e6..1ab397f90e81 100644 --- a/include/tar.h +++ b/include/tar.h @@ -30,10 +30,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)tar.h 8.2 (Berkeley) 1/4/94 - * - * $FreeBSD$ */ #ifndef _TAR_H diff --git a/include/termios.h b/include/termios.h index 9b808329a426..f9a1eec89017 100644 --- a/include/termios.h +++ b/include/termios.h @@ -27,9 +27,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)termios.h 8.3 (Berkeley) 3/28/94 - * $FreeBSD$ */ #ifndef _TERMIOS_H_ diff --git a/include/tgmath.h b/include/tgmath.h index bf7a61c5f320..b8adfc793b6c 100644 --- a/include/tgmath.h +++ b/include/tgmath.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2004 Stefan Farfeleder. * All rights reserved. @@ -27,8 +27,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _TGMATH_H_ diff --git a/include/time.h b/include/time.h index a64a331ee52e..89a76ca5fd93 100644 --- a/include/time.h +++ b/include/time.h @@ -32,12 +32,9 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)time.h 8.3 (Berkeley) 1/21/94 */ /* - * $FreeBSD$ */ #ifndef _TIME_H_ @@ -158,6 +155,8 @@ int clock_nanosleep(clockid_t, int, const struct timespec *, struct timespec *); #if __POSIX_VISIBLE >= 199506 char *asctime_r(const struct tm *, char *); char *ctime_r(const time_t *, char *); +#endif +#if __POSIX_VISIBLE >= 199506 || __ISO_C_VISIBLE >= 2023 struct tm *gmtime_r(const time_t *, struct tm *); struct tm *localtime_r(const time_t *, struct tm *); #endif @@ -165,11 +164,11 @@ struct tm *localtime_r(const time_t *, struct tm *); #if __XSI_VISIBLE char *strptime(const char * __restrict, const char * __restrict, struct tm * __restrict); +extern long timezone; +extern int daylight; #endif #if __BSD_VISIBLE -char *timezone(int, int); /* XXX XSI conflict */ -void tzsetwall(void); time_t timelocal(struct tm * const); time_t timegm(struct tm * const); int timer_oshandle_np(timer_t timerid); @@ -181,12 +180,18 @@ time_t posix2time(time_t t); #include <xlocale/_time.h> #endif -#if defined(__BSD_VISIBLE) || __ISO_C_VISIBLE >= 2011 || \ +#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 2011 || \ (defined(__cplusplus) && __cplusplus >= 201703) #include <sys/_timespec.h> -/* ISO/IEC 9899:201x 7.27.2.5 The timespec_get function */ +/* ISO/IEC 9899:2011 7.27.2.5 The timespec_get function */ #define TIME_UTC 1 /* time elapsed since epoch */ int timespec_get(struct timespec *ts, int base); +#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 2023 +/* ISO/IEC 9899:2024 7.29.1 Components of time */ +#define TIME_MONOTONIC 2 /* monotonic time */ +/* ISO/IEC 9899:2024 7.29.2.7 The timespec_getres function */ +int timespec_getres(struct timespec *, int); +#endif #endif __END_DECLS diff --git a/include/timeconv.h b/include/timeconv.h index 1298cc238e57..ee0357670d95 100644 --- a/include/timeconv.h +++ b/include/timeconv.h @@ -32,12 +32,9 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)time.h 8.3 (Berkeley) 1/21/94 */ /* - * $FreeBSD$ */ #ifndef _TIMECONV_H_ diff --git a/include/timers.h b/include/timers.h index 20f95759e26b..69444d9f1540 100644 --- a/include/timers.h +++ b/include/timers.h @@ -31,8 +31,6 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD$ - * * Description : Basic timers header. * * 1.00 94/06/13 proven diff --git a/include/ttyent.h b/include/ttyent.h index a98fbdffb86f..db2930ad158b 100644 --- a/include/ttyent.h +++ b/include/ttyent.h @@ -27,9 +27,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)ttyent.h 8.1 (Berkeley) 6/2/93 - * $FreeBSD$ */ #ifndef _TTYENT_H_ diff --git a/include/uchar.h b/include/uchar.h index a84a58b3a2dd..951c6339abec 100644 --- a/include/uchar.h +++ b/include/uchar.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2013 Ed Schouten <ed@FreeBSD.org> * All rights reserved. @@ -24,8 +24,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _UCHAR_H_ diff --git a/include/ulimit.h b/include/ulimit.h index 2579a5201518..ef08cad84bad 100644 --- a/include/ulimit.h +++ b/include/ulimit.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2002 Kyle Martin <mkm@ieee.org> * All rights reserved. @@ -24,8 +24,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _ULIMIT_H_ diff --git a/include/unistd.h b/include/unistd.h index 8e44e472c6d6..21e3a7740607 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -27,20 +27,20 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)unistd.h 8.12 (Berkeley) 4/27/95 - * $FreeBSD$ */ #ifndef _UNISTD_H_ #define _UNISTD_H_ -#include <sys/cdefs.h> #include <sys/types.h> /* XXX adds too much pollution. */ #include <sys/unistd.h> #include <sys/_null.h> #include <sys/_types.h> +#if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 +#include <ssp/unistd.h> +#endif + #ifndef _GID_T_DECLARED typedef __gid_t gid_t; #define _GID_T_DECLARED @@ -292,6 +292,11 @@ typedef __useconds_t useconds_t; #define _SC_NPROCESSORS_CONF 57 #define _SC_NPROCESSORS_ONLN 58 #define _SC_CPUSET_SIZE 122 +#define _SC_UEXTERR_MAXLEN 123 /* user */ +#endif + +#if __POSIX_VISIBLE >= 202405 +#define _SC_NSIG 124 #endif /* Extensions found in Solaris and Linux. */ @@ -505,7 +510,9 @@ int eaccess(const char *, int); void endusershell(void); int exect(const char *, char * const *, char * const *); int execvP(const char *, const char *, char * const *); +int execvpe(const char *, char * const *, char * const *); int feature_present(const char *); +int fchroot(int); char *fflagstostr(u_long); int getdomainname(char *, int); int getentropy(void *, size_t); @@ -522,6 +529,7 @@ int iruserok(unsigned long, int, const char *, const char *); int iruserok_sa(const void *, int, int, const char *, const char *); int issetugid(void); void __FreeBSD_libc_enter_restricted_mode(void); +int kcmp(pid_t pid1, pid_t pid2, int type, uintptr_t idx1, uintptr_t idx2); long lpathconf(const char *, int); #ifndef _MKDTEMP_DECLARED char *mkdtemp(char *); diff --git a/include/utime.h b/include/utime.h index ec1d28b93e31..e14d13b3f3dc 100644 --- a/include/utime.h +++ b/include/utime.h @@ -27,9 +27,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)utime.h 8.1 (Berkeley) 6/2/93 - * $FreeBSD$ */ #ifndef _UTIME_H_ diff --git a/include/utmpx.h b/include/utmpx.h index b71d9638d81e..fefebe069506 100644 --- a/include/utmpx.h +++ b/include/utmpx.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2010 Ed Schouten <ed@FreeBSD.org> * All rights reserved. @@ -24,8 +24,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _UTMPX_H_ diff --git a/include/uuid.h b/include/uuid.h index 8056acaf7157..712a087c8e33 100644 --- a/include/uuid.h +++ b/include/uuid.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2002,2005 Marcel Moolenaar * Copyright (c) 2002 Hiten Mahesh Pandya @@ -25,8 +25,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _UUID_H_ diff --git a/include/varargs.h b/include/varargs.h index a5d59f46ddf1..5de64c7b4cc3 100644 --- a/include/varargs.h +++ b/include/varargs.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2003 Alexander Kabaev * All rights reserved. @@ -24,8 +24,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _VARARGS_H_ diff --git a/include/wchar.h b/include/wchar.h index 78f2f010048f..bf07062935d5 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: (BSD-2-Clause AND BSD-2-Clause-NetBSD) + * SPDX-License-Identifier: (BSD-2-Clause) * * Copyright (c)1999 Citrus Project, * All rights reserved. @@ -24,8 +24,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ /*- @@ -80,7 +78,7 @@ typedef __size_t size_t; #if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE #ifndef _VA_LIST_DECLARED -typedef __va_list va_list; +typedef __builtin_va_list va_list; #define _VA_LIST_DECLARED #endif #endif @@ -111,6 +109,14 @@ typedef struct __sFILE FILE; struct tm; __BEGIN_DECLS +size_t wcslen(const wchar_t *) __pure; +__END_DECLS + +#if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 +#include <ssp/wchar.h> +#endif + +__BEGIN_DECLS wint_t btowc(int); wint_t fgetwc(FILE *); wchar_t * @@ -148,7 +154,6 @@ wchar_t *wcscpy(wchar_t * __restrict, const wchar_t * __restrict); size_t wcscspn(const wchar_t *, const wchar_t *) __pure; size_t wcsftime(wchar_t * __restrict, size_t, const wchar_t * __restrict, const struct tm * __restrict); -size_t wcslen(const wchar_t *) __pure; wchar_t *wcsncat(wchar_t * __restrict, const wchar_t * __restrict, size_t); int wcsncmp(const wchar_t *, const wchar_t *, size_t) __pure; diff --git a/include/wctype.h b/include/wctype.h index 5882615ce048..d823f97fc84a 100644 --- a/include/wctype.h +++ b/include/wctype.h @@ -27,7 +27,6 @@ * * citrus Id: wctype.h,v 1.4 2000/12/21 01:50:21 itojun Exp * $NetBSD: wctype.h,v 1.3 2000/12/22 14:16:16 itojun Exp $ - * $FreeBSD$ */ #ifndef _WCTYPE_H_ diff --git a/include/wordexp.h b/include/wordexp.h index bda6ff542fb7..a0e80bc7ca71 100644 --- a/include/wordexp.h +++ b/include/wordexp.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2002 Tim J. Robbins. * All rights reserved. @@ -24,8 +24,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _WORDEXP_H_ diff --git a/include/xlocale.h b/include/xlocale.h index 647c43b315c9..cc2fc0839593 100644 --- a/include/xlocale.h +++ b/include/xlocale.h @@ -1,8 +1,7 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2011, 2012 The FreeBSD Foundation - * All rights reserved. * * This software was developed by David Chisnall under sponsorship from * the FreeBSD Foundation. @@ -27,8 +26,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _XLOCALE_H_ diff --git a/include/xlocale/Makefile b/include/xlocale/Makefile index 0ece6d297417..fc2569c36502 100644 --- a/include/xlocale/Makefile +++ b/include/xlocale/Makefile @@ -1,5 +1,3 @@ -# $FreeBSD$ - INCS= _ctype.h _inttypes.h _langinfo.h _locale.h _monetary.h _stdio.h\ _stdlib.h _string.h _strings.h _time.h _uchar.h _wchar.h INCSDIR=${INCLUDEDIR}/xlocale diff --git a/include/xlocale/Makefile.depend b/include/xlocale/Makefile.depend index f80275d86ab1..11aba52f82cf 100644 --- a/include/xlocale/Makefile.depend +++ b/include/xlocale/Makefile.depend @@ -1,4 +1,3 @@ -# $FreeBSD$ # Autogenerated - do NOT edit! DIRDEPS = \ diff --git a/include/xlocale/_ctype.h b/include/xlocale/_ctype.h index 7d25eec25f0a..ce915c273211 100644 --- a/include/xlocale/_ctype.h +++ b/include/xlocale/_ctype.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2011 The FreeBSD Foundation * @@ -26,8 +26,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ diff --git a/include/xlocale/_inttypes.h b/include/xlocale/_inttypes.h index 35729139c71e..0d904f1a242a 100644 --- a/include/xlocale/_inttypes.h +++ b/include/xlocale/_inttypes.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2011, 2012 The FreeBSD Foundation * @@ -26,8 +26,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ diff --git a/include/xlocale/_langinfo.h b/include/xlocale/_langinfo.h index 6886ca335f22..cadc40322f36 100644 --- a/include/xlocale/_langinfo.h +++ b/include/xlocale/_langinfo.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2011, 2012 The FreeBSD Foundation * @@ -26,8 +26,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _XLOCALE_LANGINFO_H diff --git a/include/xlocale/_locale.h b/include/xlocale/_locale.h index d186b04ecd6d..34a06192950f 100644 --- a/include/xlocale/_locale.h +++ b/include/xlocale/_locale.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2011, 2012 The FreeBSD Foundation * @@ -26,8 +26,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _XLOCALE_LOCALE_H diff --git a/include/xlocale/_monetary.h b/include/xlocale/_monetary.h index 13b1c3cc2a3d..1640da44b588 100644 --- a/include/xlocale/_monetary.h +++ b/include/xlocale/_monetary.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2011, 2012 The FreeBSD Foundation * @@ -26,8 +26,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _LOCALE_T_DEFINED diff --git a/include/xlocale/_stdio.h b/include/xlocale/_stdio.h index d0df7931cfd0..6429c8fc56a7 100644 --- a/include/xlocale/_stdio.h +++ b/include/xlocale/_stdio.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2011, 2012 The FreeBSD Foundation * @@ -26,8 +26,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ int asprintf_l(char **, locale_t, const char *, ...) __printflike(3, 4); diff --git a/include/xlocale/_stdlib.h b/include/xlocale/_stdlib.h index 380cbe0bdb1b..eda455f7b551 100644 --- a/include/xlocale/_stdlib.h +++ b/include/xlocale/_stdlib.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2011, 2012 The FreeBSD Foundation * @@ -26,8 +26,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ /* diff --git a/include/xlocale/_string.h b/include/xlocale/_string.h index 64b128df161d..cf14f9c00602 100644 --- a/include/xlocale/_string.h +++ b/include/xlocale/_string.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2011, 2012 The FreeBSD Foundation * @@ -23,8 +23,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _LOCALE_T_DEFINED diff --git a/include/xlocale/_strings.h b/include/xlocale/_strings.h index 1ec05ac79f2d..4804c984058c 100644 --- a/include/xlocale/_strings.h +++ b/include/xlocale/_strings.h @@ -21,8 +21,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _LOCALE_T_DEFINED diff --git a/include/xlocale/_time.h b/include/xlocale/_time.h index fe0057b0b15f..5f61b7cf6c9f 100644 --- a/include/xlocale/_time.h +++ b/include/xlocale/_time.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2011, 2012 The FreeBSD Foundation * @@ -26,8 +26,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _LOCALE_T_DEFINED diff --git a/include/xlocale/_uchar.h b/include/xlocale/_uchar.h index 0c6ed09373f2..22fe1701cf0d 100644 --- a/include/xlocale/_uchar.h +++ b/include/xlocale/_uchar.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2013 Ed Schouten <ed@FreeBSD.org> * All rights reserved. @@ -24,8 +24,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _LOCALE_T_DEFINED diff --git a/include/xlocale/_wchar.h b/include/xlocale/_wchar.h index 7ce562eb7c21..e19366e92b88 100644 --- a/include/xlocale/_wchar.h +++ b/include/xlocale/_wchar.h @@ -1,5 +1,5 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2011, 2012 The FreeBSD Foundation * @@ -26,8 +26,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #ifndef _LOCALE_T_DEFINED |