aboutsummaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/Makefile56
-rw-r--r--lib/libc/Makefile.depend2
-rw-r--r--lib/libc/Makefile.depend.options1
-rw-r--r--lib/libc/Versions.def8
-rw-r--r--lib/libc/aarch64/Makefile.inc1
-rw-r--r--lib/libc/aarch64/SYS.h71
-rw-r--r--lib/libc/aarch64/Symbol.map28
-rw-r--r--lib/libc/aarch64/_fpmath.h2
-rw-r--r--lib/libc/aarch64/arith.h2
-rw-r--r--lib/libc/aarch64/gd_qnan.h2
-rw-r--r--lib/libc/aarch64/gen/Makefile.inc7
-rw-r--r--lib/libc/aarch64/gen/_ctx_start.S5
-rw-r--r--lib/libc/aarch64/gen/_set_tp.c43
-rw-r--r--lib/libc/aarch64/gen/_setjmp.S9
-rw-r--r--lib/libc/aarch64/gen/fabs.S5
-rw-r--r--lib/libc/aarch64/gen/flt_rounds.c3
-rw-r--r--lib/libc/aarch64/gen/fpgetmask.c4
-rw-r--r--lib/libc/aarch64/gen/fpsetmask.c4
-rw-r--r--lib/libc/aarch64/gen/getcontextx.c (renamed from lib/libc/i386/string/ffs.S)89
-rw-r--r--lib/libc/aarch64/gen/infinity.c3
-rw-r--r--lib/libc/aarch64/gen/makecontext.c14
-rw-r--r--lib/libc/aarch64/gen/setjmp.S9
-rw-r--r--lib/libc/aarch64/gen/sigsetjmp.S6
-rw-r--r--lib/libc/aarch64/static_tls.h4
-rw-r--r--lib/libc/aarch64/string/Makefile.inc52
-rw-r--r--lib/libc/aarch64/string/memcpy.S6
-rw-r--r--lib/libc/aarch64/string/memmove.S9
-rw-r--r--lib/libc/aarch64/string/strchr.S5
-rw-r--r--lib/libc/aarch64/string/strrchr.S5
-rw-r--r--lib/libc/aarch64/sys/Makefile.inc13
-rw-r--r--lib/libc/aarch64/sys/__vdso_gettc.c76
-rw-r--r--lib/libc/aarch64/sys/cerror.S42
-rw-r--r--lib/libc/aarch64/sys/vfork.S42
-rw-r--r--lib/libc/amd64/Makefile.inc1
-rw-r--r--lib/libc/amd64/SYS.h54
-rw-r--r--lib/libc/amd64/Symbol.map42
-rw-r--r--lib/libc/amd64/_fpmath.h4
-rw-r--r--lib/libc/amd64/amd64_archlevel.h90
-rw-r--r--lib/libc/amd64/arith.h2
-rw-r--r--lib/libc/amd64/gd_qnan.h2
-rw-r--r--lib/libc/amd64/gen/Makefile.inc4
-rw-r--r--lib/libc/amd64/gen/_set_tp.c41
-rw-r--r--lib/libc/amd64/gen/_setjmp.S11
-rw-r--r--lib/libc/amd64/gen/fabs.S2
-rw-r--r--lib/libc/amd64/gen/flt_rounds.c3
-rw-r--r--lib/libc/amd64/gen/fpgetmask.c1
-rw-r--r--lib/libc/amd64/gen/fpgetprec.c1
-rw-r--r--lib/libc/amd64/gen/fpgetround.c1
-rw-r--r--lib/libc/amd64/gen/fpgetsticky.c1
-rw-r--r--lib/libc/amd64/gen/fpsetmask.c1
-rw-r--r--lib/libc/amd64/gen/fpsetprec.c1
-rw-r--r--lib/libc/amd64/gen/fpsetround.c1
-rw-r--r--lib/libc/amd64/gen/infinity.c3
-rw-r--r--lib/libc/amd64/gen/makecontext.c5
-rw-r--r--lib/libc/amd64/gen/rfork_thread.S95
-rw-r--r--lib/libc/amd64/gen/setjmp.S11
-rw-r--r--lib/libc/amd64/gen/signalcontext.c5
-rw-r--r--lib/libc/amd64/gen/sigsetjmp.S10
-rw-r--r--lib/libc/amd64/static_tls.h4
-rw-r--r--lib/libc/amd64/stdlib/Makefile.inc2
-rw-r--r--lib/libc/amd64/stdlib/div.S2
-rw-r--r--lib/libc/amd64/stdlib/ldiv.S2
-rw-r--r--lib/libc/amd64/stdlib/lldiv.S2
-rw-r--r--lib/libc/amd64/string/Makefile.inc30
-rw-r--r--lib/libc/amd64/string/amd64_archlevel.c241
-rw-r--r--lib/libc/amd64/string/bcmp.S122
-rw-r--r--lib/libc/amd64/string/bcopy.c3
-rw-r--r--lib/libc/amd64/string/bzero.c3
-rw-r--r--lib/libc/amd64/string/memccpy.S259
-rw-r--r--lib/libc/amd64/string/memchr.S207
-rw-r--r--lib/libc/amd64/string/memcmp.S218
-rw-r--r--lib/libc/amd64/string/memcpy.S1
-rw-r--r--lib/libc/amd64/string/memmove.S12
-rw-r--r--lib/libc/amd64/string/memrchr.S166
-rw-r--r--lib/libc/amd64/string/memset.S4
-rw-r--r--lib/libc/amd64/string/stpcpy.S143
-rw-r--r--lib/libc/amd64/string/stpncpy.S283
-rw-r--r--lib/libc/amd64/string/strcat.S49
-rw-r--r--lib/libc/amd64/string/strchrnul.S170
-rw-r--r--lib/libc/amd64/string/strcmp.S299
-rw-r--r--lib/libc/amd64/string/strcpy.c5
-rw-r--r--lib/libc/amd64/string/strcspn.S396
-rw-r--r--lib/libc/amd64/string/strlcat.c25
-rw-r--r--lib/libc/amd64/string/strlcpy.S281
-rw-r--r--lib/libc/amd64/string/strlen.S58
-rw-r--r--lib/libc/amd64/string/strncat.c29
-rw-r--r--lib/libc/amd64/string/strncmp.S488
-rw-r--r--lib/libc/amd64/string/strncpy.c (renamed from lib/libc/aarch64/gen/_get_tp.c)28
-rw-r--r--lib/libc/amd64/string/strnlen.c (renamed from lib/libc/i386/gen/_set_tp.c)27
-rw-r--r--lib/libc/amd64/string/strpbrk.c (renamed from lib/libc/i386/gen/_get_tp.c)28
-rw-r--r--lib/libc/amd64/string/strrchr.S209
-rw-r--r--lib/libc/amd64/string/strsep.c57
-rw-r--r--lib/libc/amd64/string/strspn.S358
-rw-r--r--lib/libc/amd64/string/timingsafe_bcmp.S232
-rw-r--r--lib/libc/amd64/string/timingsafe_memcmp.S145
-rw-r--r--lib/libc/amd64/sys/Makefile.inc13
-rw-r--r--lib/libc/amd64/sys/amd64_get_fsbase.c67
-rw-r--r--lib/libc/amd64/sys/amd64_set_fsbase.c67
-rw-r--r--lib/libc/amd64/sys/amd64_set_gsbase.c67
-rw-r--r--lib/libc/amd64/sys/cerror.S60
-rw-r--r--lib/libc/amd64/sys/getcontext.S48
-rw-r--r--lib/libc/amd64/sys/vfork.S54
-rw-r--r--lib/libc/arm/Makefile.inc3
-rw-r--r--lib/libc/arm/SYS.h82
-rw-r--r--lib/libc/arm/Symbol.map33
-rw-r--r--lib/libc/arm/Symbol_vfp.map1
-rw-r--r--lib/libc/arm/_fpmath.h4
-rw-r--r--lib/libc/arm/aeabi/Makefile.inc6
-rw-r--r--lib/libc/arm/aeabi/Symbol.map4
-rw-r--r--lib/libc/arm/aeabi/aeabi_asm_double.S2
-rw-r--r--lib/libc/arm/aeabi/aeabi_asm_float.S2
-rw-r--r--lib/libc/arm/aeabi/aeabi_atexit.c5
-rw-r--r--lib/libc/arm/aeabi/aeabi_double.c5
-rw-r--r--lib/libc/arm/aeabi/aeabi_float.c5
-rw-r--r--lib/libc/arm/aeabi/aeabi_int_div.S2
-rw-r--r--lib/libc/arm/aeabi/aeabi_unwind_cpp.c5
-rw-r--r--lib/libc/arm/aeabi/aeabi_unwind_exidx.c3
-rw-r--r--lib/libc/arm/aeabi/aeabi_vfp.h2
-rw-r--r--lib/libc/arm/aeabi/aeabi_vfp_double.S2
-rw-r--r--lib/libc/arm/aeabi/aeabi_vfp_float.S2
-rw-r--r--lib/libc/arm/arith.h9
-rw-r--r--lib/libc/arm/gd_qnan.h11
-rw-r--r--lib/libc/arm/gen/Makefile.inc6
-rw-r--r--lib/libc/arm/gen/__aeabi_read_tp.S2
-rw-r--r--lib/libc/arm/gen/_ctx_start.S1
-rw-r--r--lib/libc/arm/gen/_set_tp.c42
-rw-r--r--lib/libc/arm/gen/_setjmp.S3
-rw-r--r--lib/libc/arm/gen/alloca.S2
-rw-r--r--lib/libc/arm/gen/arm_drain_writebuf.22
-rw-r--r--lib/libc/arm/gen/arm_drain_writebuf.c3
-rw-r--r--lib/libc/arm/gen/arm_initfini.c5
-rw-r--r--lib/libc/arm/gen/arm_sync_icache.22
-rw-r--r--lib/libc/arm/gen/arm_sync_icache.c3
-rw-r--r--lib/libc/arm/gen/divsi3.S2
-rw-r--r--lib/libc/arm/gen/fabs.c3
-rw-r--r--lib/libc/arm/gen/flt_rounds.c5
-rw-r--r--lib/libc/arm/gen/fpgetmask_vfp.c7
-rw-r--r--lib/libc/arm/gen/fpgetround_vfp.c3
-rw-r--r--lib/libc/arm/gen/fpgetsticky_vfp.c7
-rw-r--r--lib/libc/arm/gen/fpsetmask_vfp.c3
-rw-r--r--lib/libc/arm/gen/fpsetround_vfp.c3
-rw-r--r--lib/libc/arm/gen/fpsetsticky_vfp.c3
-rw-r--r--lib/libc/arm/gen/getcontextx.c5
-rw-r--r--lib/libc/arm/gen/infinity.c3
-rw-r--r--lib/libc/arm/gen/makecontext.c15
-rw-r--r--lib/libc/arm/gen/setjmp.S3
-rw-r--r--lib/libc/arm/gen/signalcontext.c5
-rw-r--r--lib/libc/arm/gen/sigsetjmp.S2
-rw-r--r--lib/libc/arm/softfloat/arm-gcc.h1
-rw-r--r--lib/libc/arm/softfloat/milieu.h1
-rw-r--r--lib/libc/arm/softfloat/softfloat.h1
-rw-r--r--lib/libc/arm/static_tls.h4
-rw-r--r--lib/libc/arm/string/Makefile.inc2
-rw-r--r--lib/libc/arm/string/bcopy.S1
-rw-r--r--lib/libc/arm/string/bzero.S3
-rw-r--r--lib/libc/arm/string/ffs.S57
-rw-r--r--lib/libc/arm/string/memcmp.S3
-rw-r--r--lib/libc/arm/string/memcpy.S2
-rw-r--r--lib/libc/arm/string/memmove.S2
-rw-r--r--lib/libc/arm/string/memset.S2
-rw-r--r--lib/libc/arm/string/strcmp.S3
-rw-r--r--lib/libc/arm/string/strlen.S2
-rw-r--r--lib/libc/arm/string/strncmp.S3
-rw-r--r--lib/libc/arm/sys/Makefile.inc8
-rw-r--r--lib/libc/arm/sys/Ovfork.S57
-rw-r--r--lib/libc/arm/sys/__vdso_gettc.c91
-rw-r--r--lib/libc/arm/sys/cerror.S51
-rw-r--r--lib/libc/arm/sys/syscall.S40
-rw-r--r--lib/libc/capability/Makefile.inc1
-rw-r--r--lib/libc/capability/Symbol.map8
-rw-r--r--lib/libc/capability/cap_rights_init.322
-rw-r--r--lib/libc/compat-43/Makefile.inc6
-rw-r--r--lib/libc/compat-43/Symbol.map4
-rw-r--r--lib/libc/compat-43/creat.262
-rw-r--r--lib/libc/compat-43/gethostid.33
-rw-r--r--lib/libc/compat-43/gethostid.c6
-rw-r--r--lib/libc/compat-43/getwd.c6
-rw-r--r--lib/libc/compat-43/killpg.23
-rw-r--r--lib/libc/compat-43/killpg.c6
-rw-r--r--lib/libc/compat-43/sethostid.c6
-rw-r--r--lib/libc/compat-43/setpgrp.c6
-rw-r--r--lib/libc/compat-43/setrgid.c6
-rw-r--r--lib/libc/compat-43/setruid.33
-rw-r--r--lib/libc/compat-43/setruid.c6
-rw-r--r--lib/libc/compat-43/sigcompat.c6
-rw-r--r--lib/libc/compat-43/sigpause.23
-rw-r--r--lib/libc/compat-43/sigsetmask.23
-rw-r--r--lib/libc/compat-43/sigvec.214
-rw-r--r--lib/libc/csu/Makefile.inc10
-rw-r--r--lib/libc/csu/Symbol.map4
-rw-r--r--lib/libc/csu/aarch64/Makefile.inc4
-rw-r--r--lib/libc/csu/aarch64/reloc.c43
-rw-r--r--lib/libc/csu/amd64/Makefile.inc4
-rw-r--r--lib/libc/csu/amd64/reloc.c (renamed from lib/libc/mips/static_tls.h)70
-rw-r--r--lib/libc/csu/arm/Makefile.inc4
-rw-r--r--lib/libc/csu/i386/Makefile.inc4
-rw-r--r--lib/libc/csu/i386/reloc.c88
-rw-r--r--lib/libc/csu/libc_start1.c186
-rw-r--r--lib/libc/csu/powerpc/Makefile.inc4
-rw-r--r--lib/libc/csu/powerpc64/Makefile.inc4
-rw-r--r--lib/libc/csu/powerpc64/reloc.c66
-rw-r--r--lib/libc/csu/powerpcspe/Makefile.inc4
-rw-r--r--lib/libc/csu/riscv/Makefile.inc4
-rw-r--r--lib/libc/db/Makefile.inc3
-rw-r--r--lib/libc/db/README2
-rw-r--r--lib/libc/db/Symbol.map5
-rw-r--r--lib/libc/db/btree/Makefile.inc2
-rw-r--r--lib/libc/db/btree/bt_close.c6
-rw-r--r--lib/libc/db/btree/bt_conv.c6
-rw-r--r--lib/libc/db/btree/bt_debug.c6
-rw-r--r--lib/libc/db/btree/bt_delete.c6
-rw-r--r--lib/libc/db/btree/bt_get.c6
-rw-r--r--lib/libc/db/btree/bt_open.c11
-rw-r--r--lib/libc/db/btree/bt_overflow.c6
-rw-r--r--lib/libc/db/btree/bt_page.c6
-rw-r--r--lib/libc/db/btree/bt_put.c6
-rw-r--r--lib/libc/db/btree/bt_search.c6
-rw-r--r--lib/libc/db/btree/bt_seq.c8
-rw-r--r--lib/libc/db/btree/bt_split.c6
-rw-r--r--lib/libc/db/btree/bt_utils.c8
-rw-r--r--lib/libc/db/btree/btree.h3
-rw-r--r--lib/libc/db/btree/extern.h3
-rw-r--r--lib/libc/db/db/Makefile.inc2
-rw-r--r--lib/libc/db/db/db.c6
-rw-r--r--lib/libc/db/docs/hash.usenix.ps2
-rw-r--r--lib/libc/db/docs/libtp.usenix.ps2
-rw-r--r--lib/libc/db/hash/Makefile.inc2
-rw-r--r--lib/libc/db/hash/README2
-rw-r--r--lib/libc/db/hash/extern.h3
-rw-r--r--lib/libc/db/hash/hash.c6
-rw-r--r--lib/libc/db/hash/hash.h3
-rw-r--r--lib/libc/db/hash/hash_bigkey.c6
-rw-r--r--lib/libc/db/hash/hash_buf.c6
-rw-r--r--lib/libc/db/hash/hash_func.c6
-rw-r--r--lib/libc/db/hash/hash_log2.c6
-rw-r--r--lib/libc/db/hash/hash_page.c11
-rw-r--r--lib/libc/db/hash/ndbm.c6
-rw-r--r--lib/libc/db/hash/page.h3
-rw-r--r--lib/libc/db/man/Makefile.inc4
-rw-r--r--lib/libc/db/man/btree.33
-rw-r--r--lib/libc/db/man/dbm.315
-rw-r--r--lib/libc/db/man/dbopen.33
-rw-r--r--lib/libc/db/man/hash.33
-rw-r--r--lib/libc/db/man/mpool.33
-rw-r--r--lib/libc/db/man/recno.33
-rw-r--r--lib/libc/db/mpool/Makefile.inc2
-rw-r--r--lib/libc/db/mpool/README1
-rw-r--r--lib/libc/db/mpool/mpool-compat.c5
-rw-r--r--lib/libc/db/mpool/mpool.c6
-rw-r--r--lib/libc/db/mpool/mpool.libtp1
-rw-r--r--lib/libc/db/recno/Makefile.inc2
-rw-r--r--lib/libc/db/recno/extern.h3
-rw-r--r--lib/libc/db/recno/rec_close.c6
-rw-r--r--lib/libc/db/recno/rec_delete.c6
-rw-r--r--lib/libc/db/recno/rec_get.c6
-rw-r--r--lib/libc/db/recno/rec_open.c6
-rw-r--r--lib/libc/db/recno/rec_put.c6
-rw-r--r--lib/libc/db/recno/rec_search.c6
-rw-r--r--lib/libc/db/recno/rec_seq.c7
-rw-r--r--lib/libc/db/recno/rec_utils.c6
-rw-r--r--lib/libc/db/recno/recno.h3
-rw-r--r--lib/libc/db/test/Makefile2
-rw-r--r--lib/libc/db/test/README1
-rw-r--r--lib/libc/db/test/btree.tests/main.c6
-rw-r--r--lib/libc/db/test/dbtest.c12
-rw-r--r--lib/libc/db/test/hash.tests/driver2.c12
-rw-r--r--lib/libc/db/test/hash.tests/makedb.sh2
-rw-r--r--lib/libc/db/test/hash.tests/tcreat3.c12
-rw-r--r--lib/libc/db/test/hash.tests/tdel.c12
-rw-r--r--lib/libc/db/test/hash.tests/testit3
-rw-r--r--lib/libc/db/test/hash.tests/thash4.c12
-rw-r--r--lib/libc/db/test/hash.tests/tread2.c12
-rw-r--r--lib/libc/db/test/hash.tests/tseq.c12
-rw-r--r--lib/libc/db/test/hash.tests/tverify.c12
-rw-r--r--lib/libc/db/test/run.test3
-rw-r--r--lib/libc/gdtoa/Makefile.inc1
-rw-r--r--lib/libc/gdtoa/Symbol.map4
-rw-r--r--lib/libc/gdtoa/_hdtoa.c5
-rw-r--r--lib/libc/gdtoa/_hldtoa.c5
-rw-r--r--lib/libc/gdtoa/_ldtoa.c5
-rw-r--r--lib/libc/gdtoa/glue.c2
-rw-r--r--lib/libc/gdtoa/machdep_ldisQ.c7
-rw-r--r--lib/libc/gdtoa/machdep_ldisd.c7
-rw-r--r--lib/libc/gdtoa/machdep_ldisx.c7
-rw-r--r--lib/libc/gen/Makefile.inc61
-rw-r--r--lib/libc/gen/Symbol.map45
-rw-r--r--lib/libc/gen/__getosreldate.c70
-rw-r--r--lib/libc/gen/__pthread_mutex_init_calloc_cb_stub.c4
-rw-r--r--lib/libc/gen/__xuname.c5
-rw-r--r--lib/libc/gen/_once_stub.c5
-rw-r--r--lib/libc/gen/_pthread_stubs.c22
-rw-r--r--lib/libc/gen/_rand48.c3
-rw-r--r--lib/libc/gen/_spinlock_stub.c3
-rw-r--r--lib/libc/gen/_thread_init.c5
-rw-r--r--lib/libc/gen/aio_read2.c (renamed from lib/libc/powerpc64/sys/__vdso_gettc.c)59
-rw-r--r--lib/libc/gen/aio_write2.c58
-rw-r--r--lib/libc/gen/alarm.313
-rw-r--r--lib/libc/gen/alarm.c4
-rw-r--r--lib/libc/gen/arc4random-compat.c7
-rw-r--r--lib/libc/gen/arc4random.312
-rw-r--r--lib/libc/gen/arc4random.c13
-rw-r--r--lib/libc/gen/arc4random.h2
-rw-r--r--lib/libc/gen/arc4random_uniform.c2
-rw-r--r--lib/libc/gen/assert.c4
-rw-r--r--lib/libc/gen/auxv.3103
-rw-r--r--lib/libc/gen/auxv.c378
-rw-r--r--lib/libc/gen/basename.32
-rw-r--r--lib/libc/gen/basename.c3
-rw-r--r--lib/libc/gen/basename_compat.c3
-rw-r--r--lib/libc/gen/cap_rights_get.33
-rw-r--r--lib/libc/gen/cap_sandboxed.33
-rw-r--r--lib/libc/gen/cap_sandboxed.c6
-rw-r--r--lib/libc/gen/check_utility_compat.32
-rw-r--r--lib/libc/gen/check_utility_compat.c3
-rw-r--r--lib/libc/gen/clock.33
-rw-r--r--lib/libc/gen/clock.c4
-rw-r--r--lib/libc/gen/clock_getcpuclockid.32
-rw-r--r--lib/libc/gen/clock_getcpuclockid.c5
-rw-r--r--lib/libc/gen/closedir.c4
-rw-r--r--lib/libc/gen/confstr.33
-rw-r--r--lib/libc/gen/confstr.c4
-rw-r--r--lib/libc/gen/cpuset_alloc.c (renamed from lib/libc/gen/errno.c)15
-rw-r--r--lib/libc/gen/cpuset_free.c (renamed from lib/libc/powerpc/gen/_set_tp.c)16
-rw-r--r--lib/libc/gen/crypt.c4
-rw-r--r--lib/libc/gen/ctermid.33
-rw-r--r--lib/libc/gen/ctermid.c5
-rw-r--r--lib/libc/gen/daemon.315
-rw-r--r--lib/libc/gen/daemon.c4
-rw-r--r--lib/libc/gen/devname-compat11.c3
-rw-r--r--lib/libc/gen/devname.33
-rw-r--r--lib/libc/gen/devname.c6
-rw-r--r--lib/libc/gen/directory.33
-rw-r--r--lib/libc/gen/dirfd.c7
-rw-r--r--lib/libc/gen/dirname.32
-rw-r--r--lib/libc/gen/dirname.c3
-rw-r--r--lib/libc/gen/dirname_compat.c3
-rw-r--r--lib/libc/gen/disklabel.c4
-rw-r--r--lib/libc/gen/dl_iterate_phdr.31
-rw-r--r--lib/libc/gen/dladdr.32
-rw-r--r--lib/libc/gen/dlfcn.c56
-rw-r--r--lib/libc/gen/dlinfo.32
-rw-r--r--lib/libc/gen/dllockinit.32
-rw-r--r--lib/libc/gen/dlopen.311
-rw-r--r--lib/libc/gen/drand48.c3
-rw-r--r--lib/libc/gen/dup3.32
-rw-r--r--lib/libc/gen/dup3.c5
-rw-r--r--lib/libc/gen/elf_utils.c33
-rw-r--r--lib/libc/gen/erand48.c3
-rw-r--r--lib/libc/gen/err.33
-rw-r--r--lib/libc/gen/err.c4
-rw-r--r--lib/libc/gen/errlst.c4
-rw-r--r--lib/libc/gen/eventfd.c5
-rw-r--r--lib/libc/gen/exec.327
-rw-r--r--lib/libc/gen/exec.c10
-rw-r--r--lib/libc/gen/exect.c3
-rw-r--r--lib/libc/gen/fdevname.c5
-rw-r--r--lib/libc/gen/feature_present.32
-rw-r--r--lib/libc/gen/feature_present.c3
-rw-r--r--lib/libc/gen/fmtcheck.32
-rw-r--r--lib/libc/gen/fmtcheck.c5
-rw-r--r--lib/libc/gen/fmtmsg.32
-rw-r--r--lib/libc/gen/fmtmsg.c5
-rw-r--r--lib/libc/gen/fnmatch.39
-rw-r--r--lib/libc/gen/fnmatch.c6
-rw-r--r--lib/libc/gen/fpclassify.32
-rw-r--r--lib/libc/gen/fpclassify.c4
-rw-r--r--lib/libc/gen/frexp.33
-rw-r--r--lib/libc/gen/frexp.c4
-rw-r--r--lib/libc/gen/fstab.c12
-rw-r--r--lib/libc/gen/ftok.35
-rw-r--r--lib/libc/gen/ftok.c5
-rw-r--r--lib/libc/gen/fts-compat.c36
-rw-r--r--lib/libc/gen/fts-compat.h3
-rw-r--r--lib/libc/gen/fts-compat11.c37
-rw-r--r--lib/libc/gen/fts-compat11.h3
-rw-r--r--lib/libc/gen/fts.33
-rw-r--r--lib/libc/gen/fts.c37
-rw-r--r--lib/libc/gen/ftw-compat11.c3
-rw-r--r--lib/libc/gen/ftw.32
-rw-r--r--lib/libc/gen/ftw.c3
-rw-r--r--lib/libc/gen/gen-compat.h2
-rw-r--r--lib/libc/gen/gen-private.h2
-rw-r--r--lib/libc/gen/getbootfile.33
-rw-r--r--lib/libc/gen/getbootfile.c5
-rw-r--r--lib/libc/gen/getbsize.33
-rw-r--r--lib/libc/gen/getbsize.c4
-rw-r--r--lib/libc/gen/getcap.33
-rw-r--r--lib/libc/gen/getcap.c4
-rw-r--r--lib/libc/gen/getcontext.32
-rw-r--r--lib/libc/gen/getcwd.33
-rw-r--r--lib/libc/gen/getcwd.c4
-rw-r--r--lib/libc/gen/getdiskbyname.33
-rw-r--r--lib/libc/gen/getdomainname.33
-rw-r--r--lib/libc/gen/getdomainname.c4
-rw-r--r--lib/libc/gen/getentropy.32
-rw-r--r--lib/libc/gen/getentropy.c5
-rw-r--r--lib/libc/gen/getfsent.33
-rw-r--r--lib/libc/gen/getgrent.33
-rw-r--r--lib/libc/gen/getgrent.c18
-rw-r--r--lib/libc/gen/getgrouplist.33
-rw-r--r--lib/libc/gen/getgrouplist.c4
-rw-r--r--lib/libc/gen/gethostname.33
-rw-r--r--lib/libc/gen/gethostname.c4
-rw-r--r--lib/libc/gen/getloadavg.33
-rw-r--r--lib/libc/gen/getloadavg.c4
-rw-r--r--lib/libc/gen/getlogin.c4
-rw-r--r--lib/libc/gen/getmntinfo-compat11.c5
-rw-r--r--lib/libc/gen/getmntinfo.33
-rw-r--r--lib/libc/gen/getmntinfo.c4
-rw-r--r--lib/libc/gen/getnetgrent.33
-rw-r--r--lib/libc/gen/getnetgrent.c4
-rw-r--r--lib/libc/gen/getosreldate.32
-rw-r--r--lib/libc/gen/getosreldate.c4
-rw-r--r--lib/libc/gen/getpagesize.361
-rw-r--r--lib/libc/gen/getpagesize.c75
-rw-r--r--lib/libc/gen/getpagesizes.399
-rw-r--r--lib/libc/gen/getpagesizes.c87
-rw-r--r--lib/libc/gen/getpass.33
-rw-r--r--lib/libc/gen/getpeereid.37
-rw-r--r--lib/libc/gen/getpeereid.c5
-rw-r--r--lib/libc/gen/getprogname.32
-rw-r--r--lib/libc/gen/getprogname.c3
-rw-r--r--lib/libc/gen/getpwent.36
-rw-r--r--lib/libc/gen/getpwent.c17
-rw-r--r--lib/libc/gen/getttyent.33
-rw-r--r--lib/libc/gen/getttyent.c4
-rw-r--r--lib/libc/gen/getusershell.33
-rw-r--r--lib/libc/gen/getusershell.c2
-rw-r--r--lib/libc/gen/getutxent.32
-rw-r--r--lib/libc/gen/getutxent.c5
-rw-r--r--lib/libc/gen/getvfsbyname.33
-rw-r--r--lib/libc/gen/getvfsbyname.c4
-rw-r--r--lib/libc/gen/glob-compat11.c8
-rw-r--r--lib/libc/gen/glob-compat11.h5
-rw-r--r--lib/libc/gen/glob.33
-rw-r--r--lib/libc/gen/glob.c9
-rw-r--r--lib/libc/gen/initgroups.33
-rw-r--r--lib/libc/gen/initgroups.c4
-rw-r--r--lib/libc/gen/isatty.c4
-rw-r--r--lib/libc/gen/isgreater.32
-rw-r--r--lib/libc/gen/isinf.c4
-rw-r--r--lib/libc/gen/isnan.c4
-rw-r--r--lib/libc/gen/jrand48.c3
-rw-r--r--lib/libc/gen/kqueue1.c (renamed from lib/libc/amd64/gen/_get_tp.c)38
-rw-r--r--lib/libc/gen/lcong48.c3
-rw-r--r--lib/libc/gen/ldexp.33
-rw-r--r--lib/libc/gen/ldexp.c3
-rw-r--r--lib/libc/gen/libc_dlopen.c7
-rw-r--r--lib/libc/gen/libc_interposing_table.c (renamed from lib/libc/sys/ptrace.c)32
-rw-r--r--lib/libc/gen/lockf.3266
-rw-r--r--lib/libc/gen/lrand48.c3
-rw-r--r--lib/libc/gen/makecontext.32
-rw-r--r--lib/libc/gen/memalign.c13
-rw-r--r--lib/libc/gen/memfd_create.c121
-rw-r--r--lib/libc/gen/modf.33
-rw-r--r--lib/libc/gen/modf.c4
-rw-r--r--lib/libc/gen/mrand48.c3
-rw-r--r--lib/libc/gen/nftw-compat11.c3
-rw-r--r--lib/libc/gen/nftw.c3
-rw-r--r--lib/libc/gen/nice.33
-rw-r--r--lib/libc/gen/nice.c4
-rw-r--r--lib/libc/gen/nlist.33
-rw-r--r--lib/libc/gen/nlist.c6
-rw-r--r--lib/libc/gen/nrand48.c3
-rw-r--r--lib/libc/gen/opendir.c4
-rw-r--r--lib/libc/gen/pause.323
-rw-r--r--lib/libc/gen/pause.c4
-rw-r--r--lib/libc/gen/pmadvise.c3
-rw-r--r--lib/libc/gen/popen.33
-rw-r--r--lib/libc/gen/popen.c8
-rw-r--r--lib/libc/gen/posix_spawn.340
-rw-r--r--lib/libc/gen/posix_spawn.c125
-rw-r--r--lib/libc/gen/posix_spawn_file_actions_addopen.386
-rw-r--r--lib/libc/gen/posix_spawn_file_actions_init.35
-rw-r--r--lib/libc/gen/posix_spawnattr_getflags.312
-rw-r--r--lib/libc/gen/posix_spawnattr_getpgroup.32
-rw-r--r--lib/libc/gen/posix_spawnattr_getschedparam.32
-rw-r--r--lib/libc/gen/posix_spawnattr_getschedpolicy.32
-rw-r--r--lib/libc/gen/posix_spawnattr_getsigdefault.32
-rw-r--r--lib/libc/gen/posix_spawnattr_getsigmask.32
-rw-r--r--lib/libc/gen/posix_spawnattr_init.32
-rw-r--r--lib/libc/gen/psignal.33
-rw-r--r--lib/libc/gen/psignal.c4
-rw-r--r--lib/libc/gen/pututxline.c5
-rw-r--r--lib/libc/gen/pw_scan.c4
-rw-r--r--lib/libc/gen/pw_scan.h3
-rw-r--r--lib/libc/gen/raise.33
-rw-r--r--lib/libc/gen/raise.c4
-rw-r--r--lib/libc/gen/rand48.33
-rw-r--r--lib/libc/gen/rand48.h2
-rw-r--r--lib/libc/gen/readdir-compat11.c5
-rw-r--r--lib/libc/gen/readdir.c4
-rw-r--r--lib/libc/gen/readpassphrase.32
-rw-r--r--lib/libc/gen/readpassphrase.c3
-rw-r--r--lib/libc/gen/recvmmsg.c97
-rw-r--r--lib/libc/gen/rewinddir.c4
-rw-r--r--lib/libc/gen/rfork_thread.387
-rw-r--r--lib/libc/gen/scandir-compat11.c13
-rw-r--r--lib/libc/gen/scandir.386
-rw-r--r--lib/libc/gen/scandir.c74
-rw-r--r--lib/libc/gen/scandir_b.c2
-rw-r--r--lib/libc/gen/sched_getaffinity.c (renamed from lib/libc/arm/gen/_get_tp.c)34
-rw-r--r--lib/libc/gen/sched_setaffinity.c79
-rw-r--r--lib/libc/gen/seed48.c3
-rw-r--r--lib/libc/gen/seekdir.c4
-rw-r--r--lib/libc/gen/sem.c4
-rw-r--r--lib/libc/gen/sem_destroy.32
-rw-r--r--lib/libc/gen/sem_getvalue.32
-rw-r--r--lib/libc/gen/sem_init.32
-rw-r--r--lib/libc/gen/sem_new.c4
-rw-r--r--lib/libc/gen/sem_open.32
-rw-r--r--lib/libc/gen/sem_post.32
-rw-r--r--lib/libc/gen/sem_timedwait.32
-rw-r--r--lib/libc/gen/sem_wait.32
-rw-r--r--lib/libc/gen/semctl.c5
-rw-r--r--lib/libc/gen/sendmmsg.c64
-rw-r--r--lib/libc/gen/setdomainname.c4
-rw-r--r--lib/libc/gen/sethostname.c4
-rw-r--r--lib/libc/gen/setjmp.311
-rw-r--r--lib/libc/gen/setjmperr.c4
-rw-r--r--lib/libc/gen/setmode.33
-rw-r--r--lib/libc/gen/setmode.c4
-rw-r--r--lib/libc/gen/setproctitle.332
-rw-r--r--lib/libc/gen/setproctitle.c33
-rw-r--r--lib/libc/gen/setprogname.c3
-rw-r--r--lib/libc/gen/siginterrupt.33
-rw-r--r--lib/libc/gen/siginterrupt.c4
-rw-r--r--lib/libc/gen/siglist.c4
-rw-r--r--lib/libc/gen/signal.33
-rw-r--r--lib/libc/gen/signal.c4
-rw-r--r--lib/libc/gen/sigsetops.33
-rw-r--r--lib/libc/gen/sigsetops.c4
-rw-r--r--lib/libc/gen/sleep.383
-rw-r--r--lib/libc/gen/sleep.c8
-rw-r--r--lib/libc/gen/statvfs.32
-rw-r--r--lib/libc/gen/statvfs.c3
-rw-r--r--lib/libc/gen/stringlist.32
-rw-r--r--lib/libc/gen/stringlist.c2
-rw-r--r--lib/libc/gen/strtofflags.33
-rw-r--r--lib/libc/gen/strtofflags.c4
-rw-r--r--lib/libc/gen/sysconf.33
-rw-r--r--lib/libc/gen/sysconf.c6
-rw-r--r--lib/libc/gen/sysctl.350
-rw-r--r--lib/libc/gen/sysctl.c46
-rw-r--r--lib/libc/gen/sysctlbyname.c18
-rw-r--r--lib/libc/gen/sysctlnametomib.c5
-rw-r--r--lib/libc/gen/syslog.310
-rw-r--r--lib/libc/gen/syslog.c148
-rw-r--r--lib/libc/gen/tcgetpgrp.36
-rw-r--r--lib/libc/gen/tcgetsid.35
-rw-r--r--lib/libc/gen/tcgetwinsize.32
-rw-r--r--lib/libc/gen/tcsendbreak.33
-rw-r--r--lib/libc/gen/tcsetattr.33
-rw-r--r--lib/libc/gen/tcsetpgrp.36
-rw-r--r--lib/libc/gen/tcsetsid.35
-rw-r--r--lib/libc/gen/telldir.c4
-rw-r--r--lib/libc/gen/telldir.h2
-rw-r--r--lib/libc/gen/termios.c4
-rw-r--r--lib/libc/gen/time.362
-rw-r--r--lib/libc/gen/time.c4
-rw-r--r--lib/libc/gen/times.33
-rw-r--r--lib/libc/gen/times.c7
-rw-r--r--lib/libc/gen/timespec_get.319
-rw-r--r--lib/libc/gen/timespec_get.c6
-rw-r--r--lib/libc/gen/timespec_getres.351
-rw-r--r--lib/libc/gen/timespec_getres.c24
-rw-r--r--lib/libc/gen/timezone.369
-rw-r--r--lib/libc/gen/timezone.c11
-rw-r--r--lib/libc/gen/tls.c37
-rw-r--r--lib/libc/gen/trivial-getcontextx.c3
-rw-r--r--lib/libc/gen/ttyname.33
-rw-r--r--lib/libc/gen/ttyname.c4
-rw-r--r--lib/libc/gen/ttyslot.c2
-rw-r--r--lib/libc/gen/ualarm.33
-rw-r--r--lib/libc/gen/ualarm.c4
-rw-r--r--lib/libc/gen/ucontext.32
-rw-r--r--lib/libc/gen/ulimit.32
-rw-r--r--lib/libc/gen/ulimit.c4
-rw-r--r--lib/libc/gen/uname.33
-rw-r--r--lib/libc/gen/uname.c4
-rw-r--r--lib/libc/gen/unvis-compat.c4
-rw-r--r--lib/libc/gen/usleep.380
-rw-r--r--lib/libc/gen/usleep.c7
-rw-r--r--lib/libc/gen/utime.33
-rw-r--r--lib/libc/gen/utime.c4
-rw-r--r--lib/libc/gen/utxdb.c5
-rw-r--r--lib/libc/gen/utxdb.h4
-rw-r--r--lib/libc/gen/valloc.33
-rw-r--r--lib/libc/gen/valloc.c4
-rw-r--r--lib/libc/gen/wordexp.32
-rw-r--r--lib/libc/gen/wordexp.c6
-rw-r--r--lib/libc/gmon/Makefile.inc2
-rw-r--r--lib/libc/gmon/Symbol.map5
-rw-r--r--lib/libc/gmon/gmon.c6
-rw-r--r--lib/libc/gmon/mcount.c6
-rw-r--r--lib/libc/gmon/moncontrol.33
-rw-r--r--lib/libc/i386/Makefile.inc1
-rw-r--r--lib/libc/i386/SYS.h58
-rw-r--r--lib/libc/i386/Symbol.map52
-rw-r--r--lib/libc/i386/_fpmath.h4
-rw-r--r--lib/libc/i386/arith.h2
-rw-r--r--lib/libc/i386/gd_qnan.h2
-rw-r--r--lib/libc/i386/gen/Makefile.inc6
-rw-r--r--lib/libc/i386/gen/_ctx_start.S2
-rw-r--r--lib/libc/i386/gen/_setjmp.S5
-rw-r--r--lib/libc/i386/gen/fabs.S5
-rw-r--r--lib/libc/i386/gen/flt_rounds.c3
-rw-r--r--lib/libc/i386/gen/infinity.c3
-rw-r--r--lib/libc/i386/gen/makecontext.c5
-rw-r--r--lib/libc/i386/gen/rfork_thread.S115
-rw-r--r--lib/libc/i386/gen/setjmp.S5
-rw-r--r--lib/libc/i386/gen/signalcontext.c5
-rw-r--r--lib/libc/i386/gen/sigsetjmp.S4
-rw-r--r--lib/libc/i386/static_tls.h4
-rw-r--r--lib/libc/i386/stdlib/Makefile.inc2
-rw-r--r--lib/libc/i386/stdlib/div.S2
-rw-r--r--lib/libc/i386/stdlib/ldiv.S2
-rw-r--r--lib/libc/i386/string/Makefile.inc2
-rw-r--r--lib/libc/i386/string/bcmp.S2
-rw-r--r--lib/libc/i386/string/bcopy.S2
-rw-r--r--lib/libc/i386/string/bzero.S2
-rw-r--r--lib/libc/i386/string/memcmp.S2
-rw-r--r--lib/libc/i386/string/memcpy.S2
-rw-r--r--lib/libc/i386/string/memmove.S2
-rw-r--r--lib/libc/i386/string/memset.S2
-rw-r--r--lib/libc/i386/string/strcat.S2
-rw-r--r--lib/libc/i386/string/strchr.S2
-rw-r--r--lib/libc/i386/string/strcmp.S2
-rw-r--r--lib/libc/i386/string/strcpy.S2
-rw-r--r--lib/libc/i386/string/strncmp.S2
-rw-r--r--lib/libc/i386/string/strrchr.S2
-rw-r--r--lib/libc/i386/string/swab.S2
-rw-r--r--lib/libc/i386/string/wcschr.S2
-rw-r--r--lib/libc/i386/string/wcscmp.S2
-rw-r--r--lib/libc/i386/string/wcslen.S2
-rw-r--r--lib/libc/i386/string/wmemchr.S2
-rw-r--r--lib/libc/i386/sys/Makefile.inc19
-rw-r--r--lib/libc/i386/sys/Ovfork.S54
-rw-r--r--lib/libc/i386/sys/cerror.S68
-rw-r--r--lib/libc/i386/sys/getcontext.S48
-rw-r--r--lib/libc/i386/sys/i386_clr_watch.c48
-rw-r--r--lib/libc/i386/sys/i386_get_fsbase.c39
-rw-r--r--lib/libc/i386/sys/i386_get_gsbase.c39
-rw-r--r--lib/libc/i386/sys/i386_get_ioperm.287
-rw-r--r--lib/libc/i386/sys/i386_get_ioperm.c50
-rw-r--r--lib/libc/i386/sys/i386_get_ldt.2139
-rw-r--r--lib/libc/i386/sys/i386_get_ldt.c48
-rw-r--r--lib/libc/i386/sys/i386_set_fsbase.c39
-rw-r--r--lib/libc/i386/sys/i386_set_gsbase.c39
-rw-r--r--lib/libc/i386/sys/i386_set_ioperm.c44
-rw-r--r--lib/libc/i386/sys/i386_set_ldt.c48
-rw-r--r--lib/libc/i386/sys/i386_set_watch.3118
-rw-r--r--lib/libc/i386/sys/i386_set_watch.c86
-rw-r--r--lib/libc/i386/sys/i386_vm86.2141
-rw-r--r--lib/libc/i386/sys/i386_vm86.c43
-rw-r--r--lib/libc/i386/sys/syscall.S52
-rw-r--r--lib/libc/iconv/Makefile.inc1
-rw-r--r--lib/libc/iconv/Symbol.map42
-rw-r--r--lib/libc/iconv/__iconv.c4
-rw-r--r--lib/libc/iconv/__iconv_free_list.c4
-rw-r--r--lib/libc/iconv/__iconv_get_list.32
-rw-r--r--lib/libc/iconv/__iconv_get_list.c4
-rw-r--r--lib/libc/iconv/_strtol.h13
-rw-r--r--lib/libc/iconv/_strtoul.h13
-rw-r--r--lib/libc/iconv/bsd_iconv.c20
-rw-r--r--lib/libc/iconv/citrus_aliasname_local.h1
-rw-r--r--lib/libc/iconv/citrus_bcs.c6
-rw-r--r--lib/libc/iconv/citrus_bcs.h1
-rw-r--r--lib/libc/iconv/citrus_bcs_strtol.c2
-rw-r--r--lib/libc/iconv/citrus_bcs_strtoul.c2
-rw-r--r--lib/libc/iconv/citrus_csmapper.c2
-rw-r--r--lib/libc/iconv/citrus_csmapper.h1
-rw-r--r--lib/libc/iconv/citrus_db.c2
-rw-r--r--lib/libc/iconv/citrus_db.h1
-rw-r--r--lib/libc/iconv/citrus_db_factory.c2
-rw-r--r--lib/libc/iconv/citrus_db_factory.h1
-rw-r--r--lib/libc/iconv/citrus_db_file.h1
-rw-r--r--lib/libc/iconv/citrus_db_hash.c2
-rw-r--r--lib/libc/iconv/citrus_db_hash.h1
-rw-r--r--lib/libc/iconv/citrus_esdb.c2
-rw-r--r--lib/libc/iconv/citrus_esdb.h1
-rw-r--r--lib/libc/iconv/citrus_esdb_file.h1
-rw-r--r--lib/libc/iconv/citrus_fix_grouping.h1
-rw-r--r--lib/libc/iconv/citrus_hash.c2
-rw-r--r--lib/libc/iconv/citrus_hash.h1
-rw-r--r--lib/libc/iconv/citrus_iconv.c40
-rw-r--r--lib/libc/iconv/citrus_iconv.h1
-rw-r--r--lib/libc/iconv/citrus_iconv_local.h1
-rw-r--r--lib/libc/iconv/citrus_lock.h3
-rw-r--r--lib/libc/iconv/citrus_lookup.c2
-rw-r--r--lib/libc/iconv/citrus_lookup.h1
-rw-r--r--lib/libc/iconv/citrus_lookup_factory.c2
-rw-r--r--lib/libc/iconv/citrus_lookup_factory.h1
-rw-r--r--lib/libc/iconv/citrus_lookup_file.h1
-rw-r--r--lib/libc/iconv/citrus_mapper.c2
-rw-r--r--lib/libc/iconv/citrus_mapper.h1
-rw-r--r--lib/libc/iconv/citrus_mapper_local.h1
-rw-r--r--lib/libc/iconv/citrus_memstream.c2
-rw-r--r--lib/libc/iconv/citrus_memstream.h1
-rw-r--r--lib/libc/iconv/citrus_mmap.c2
-rw-r--r--lib/libc/iconv/citrus_mmap.h1
-rw-r--r--lib/libc/iconv/citrus_module.c8
-rw-r--r--lib/libc/iconv/citrus_module.h1
-rw-r--r--lib/libc/iconv/citrus_namespace.h2
-rw-r--r--lib/libc/iconv/citrus_none.c2
-rw-r--r--lib/libc/iconv/citrus_none.h1
-rw-r--r--lib/libc/iconv/citrus_pivot_factory.c2
-rw-r--r--lib/libc/iconv/citrus_pivot_factory.h1
-rw-r--r--lib/libc/iconv/citrus_pivot_file.h1
-rw-r--r--lib/libc/iconv/citrus_prop.c11
-rw-r--r--lib/libc/iconv/citrus_prop.h1
-rw-r--r--lib/libc/iconv/citrus_region.h1
-rw-r--r--lib/libc/iconv/citrus_stdenc.c2
-rw-r--r--lib/libc/iconv/citrus_stdenc.h15
-rw-r--r--lib/libc/iconv/citrus_stdenc_local.h3
-rw-r--r--lib/libc/iconv/citrus_stdenc_template.h7
-rw-r--r--lib/libc/iconv/citrus_types.h1
-rw-r--r--lib/libc/iconv/iconv-internal.h4
-rw-r--r--lib/libc/iconv/iconv.31
-rw-r--r--lib/libc/iconv/iconv.c4
-rw-r--r--lib/libc/iconv/iconv_canonicalize.32
-rw-r--r--lib/libc/iconv/iconv_canonicalize.c4
-rw-r--r--lib/libc/iconv/iconv_close.c4
-rw-r--r--lib/libc/iconv/iconv_compat.c4
-rw-r--r--lib/libc/iconv/iconv_open.c4
-rw-r--r--lib/libc/iconv/iconv_open_into.c4
-rw-r--r--lib/libc/iconv/iconv_set_relocation_prefix.c4
-rw-r--r--lib/libc/iconv/iconvctl.32
-rw-r--r--lib/libc/iconv/iconvctl.c4
-rw-r--r--lib/libc/iconv/iconvlist.36
-rw-r--r--lib/libc/iconv/iconvlist.c4
-rw-r--r--lib/libc/include/block_abi.h2
-rw-r--r--lib/libc/include/compat.h8
-rw-r--r--lib/libc/include/errlst.h5
-rw-r--r--lib/libc/include/fpmath.h4
-rw-r--r--lib/libc/include/isc/list.h1
-rw-r--r--lib/libc/include/isc/platform.h1
-rw-r--r--lib/libc/include/libc_private.h117
-rw-r--r--lib/libc/include/namespace.h4
-rw-r--r--lib/libc/include/nscache.h4
-rw-r--r--lib/libc/include/nscachedcli.h4
-rw-r--r--lib/libc/include/nss_tls.h4
-rw-r--r--lib/libc/include/port_after.h1
-rw-r--r--lib/libc/include/port_before.h1
-rw-r--r--lib/libc/include/reentrant.h4
-rw-r--r--lib/libc/include/spinlock.h3
-rw-r--r--lib/libc/include/un-namespace.h4
-rw-r--r--lib/libc/inet/Makefile.inc1
-rw-r--r--lib/libc/inet/Symbol.map4
-rw-r--r--lib/libc/inet/inet_addr.c7
-rw-r--r--lib/libc/inet/inet_cidr_ntop.c6
-rw-r--r--lib/libc/inet/inet_cidr_pton.c6
-rw-r--r--lib/libc/inet/inet_lnaof.c6
-rw-r--r--lib/libc/inet/inet_makeaddr.c6
-rw-r--r--lib/libc/inet/inet_net_ntop.c6
-rw-r--r--lib/libc/inet/inet_net_pton.c8
-rw-r--r--lib/libc/inet/inet_neta.c6
-rw-r--r--lib/libc/inet/inet_netof.c6
-rw-r--r--lib/libc/inet/inet_network.c6
-rw-r--r--lib/libc/inet/inet_ntoa.c7
-rw-r--r--lib/libc/inet/inet_ntop.c6
-rw-r--r--lib/libc/inet/inet_pton.c6
-rw-r--r--lib/libc/inet/nsap_addr.c6
-rw-r--r--lib/libc/isc/Makefile.inc1
-rw-r--r--lib/libc/isc/ev_streams.c6
-rw-r--r--lib/libc/isc/ev_timers.c6
-rw-r--r--lib/libc/isc/eventlib_p.h1
-rw-r--r--lib/libc/libc.ldscript1
-rw-r--r--lib/libc/libc_nossp.ldscript1
-rw-r--r--lib/libc/locale/DESIGN.xlocale1
-rw-r--r--lib/libc/locale/Makefile.inc20
-rw-r--r--lib/libc/locale/Symbol.map5
-rw-r--r--lib/libc/locale/ascii.c5
-rw-r--r--lib/libc/locale/big5.52
-rw-r--r--lib/libc/locale/big5.c8
-rw-r--r--lib/libc/locale/btowc.32
-rw-r--r--lib/libc/locale/btowc.c7
-rw-r--r--lib/libc/locale/c16rtomb.c5
-rw-r--r--lib/libc/locale/c16rtomb_iconv.c1
-rw-r--r--lib/libc/locale/c32rtomb.c5
-rw-r--r--lib/libc/locale/c32rtomb_iconv.c1
-rw-r--r--lib/libc/locale/cXXrtomb_iconv.h9
-rw-r--r--lib/libc/locale/collate.c44
-rw-r--r--lib/libc/locale/collate.h7
-rw-r--r--lib/libc/locale/collcmp.c7
-rw-r--r--lib/libc/locale/ctype.320
-rw-r--r--lib/libc/locale/ctype.c5
-rw-r--r--lib/libc/locale/ctype_l.352
-rw-r--r--lib/libc/locale/digittoint.323
-rw-r--r--lib/libc/locale/duplocale.33
-rw-r--r--lib/libc/locale/euc.53
-rw-r--r--lib/libc/locale/euc.c7
-rw-r--r--lib/libc/locale/fix_grouping.c5
-rw-r--r--lib/libc/locale/freelocale.33
-rw-r--r--lib/libc/locale/gb18030.52
-rw-r--r--lib/libc/locale/gb18030.c6
-rw-r--r--lib/libc/locale/gb2312.52
-rw-r--r--lib/libc/locale/gb2312.c6
-rw-r--r--lib/libc/locale/gbk.52
-rw-r--r--lib/libc/locale/gbk.c5
-rw-r--r--lib/libc/locale/isalnum.335
-rw-r--r--lib/libc/locale/isalpha.330
-rw-r--r--lib/libc/locale/isascii.310
-rw-r--r--lib/libc/locale/isblank.324
-rw-r--r--lib/libc/locale/iscntrl.327
-rw-r--r--lib/libc/locale/isctype.c6
-rw-r--r--lib/libc/locale/isdigit.331
-rw-r--r--lib/libc/locale/isgraph.317
-rw-r--r--lib/libc/locale/isideogram.343
-rw-r--r--lib/libc/locale/islower.323
-rw-r--r--lib/libc/locale/isphonogram.331
-rw-r--r--lib/libc/locale/isprint.336
-rw-r--r--lib/libc/locale/ispunct.324
-rw-r--r--lib/libc/locale/isrune.340
-rw-r--r--lib/libc/locale/isspace.326
-rw-r--r--lib/libc/locale/isspecial.342
-rw-r--r--lib/libc/locale/isupper.337
-rw-r--r--lib/libc/locale/iswalnum.33
-rw-r--r--lib/libc/locale/iswalnum_l.32
-rw-r--r--lib/libc/locale/iswctype.c3
-rw-r--r--lib/libc/locale/isxdigit.339
-rw-r--r--lib/libc/locale/ldpart.c5
-rw-r--r--lib/libc/locale/ldpart.h4
-rw-r--r--lib/libc/locale/lmessages.c39
-rw-r--r--lib/libc/locale/lmessages.h6
-rw-r--r--lib/libc/locale/lmonetary.c47
-rw-r--r--lib/libc/locale/lmonetary.h6
-rw-r--r--lib/libc/locale/lnumeric.c46
-rw-r--r--lib/libc/locale/lnumeric.h6
-rw-r--r--lib/libc/locale/localeconv.33
-rw-r--r--lib/libc/locale/localeconv.c10
-rw-r--r--lib/libc/locale/mblen.33
-rw-r--r--lib/libc/locale/mblen.c7
-rw-r--r--lib/libc/locale/mblocal.h6
-rw-r--r--lib/libc/locale/mbrlen.32
-rw-r--r--lib/libc/locale/mbrlen.c7
-rw-r--r--lib/libc/locale/mbrtoc16.c5
-rw-r--r--lib/libc/locale/mbrtoc16_iconv.c1
-rw-r--r--lib/libc/locale/mbrtoc32.c5
-rw-r--r--lib/libc/locale/mbrtoc32_iconv.c1
-rw-r--r--lib/libc/locale/mbrtocXX_iconv.h9
-rw-r--r--lib/libc/locale/mbrtowc.32
-rw-r--r--lib/libc/locale/mbrtowc.c7
-rw-r--r--lib/libc/locale/mbsinit.32
-rw-r--r--lib/libc/locale/mbsinit.c7
-rw-r--r--lib/libc/locale/mbsnrtowcs.c8
-rw-r--r--lib/libc/locale/mbsrtowcs.32
-rw-r--r--lib/libc/locale/mbsrtowcs.c7
-rw-r--r--lib/libc/locale/mbstowcs.33
-rw-r--r--lib/libc/locale/mbstowcs.c7
-rw-r--r--lib/libc/locale/mbtowc.33
-rw-r--r--lib/libc/locale/mbtowc.c7
-rw-r--r--lib/libc/locale/mskanji.52
-rw-r--r--lib/libc/locale/mskanji.c8
-rw-r--r--lib/libc/locale/multibyte.33
-rw-r--r--lib/libc/locale/newlocale.33
-rw-r--r--lib/libc/locale/nextwctype.32
-rw-r--r--lib/libc/locale/nextwctype.c7
-rw-r--r--lib/libc/locale/nl_langinfo.32
-rw-r--r--lib/libc/locale/nl_langinfo.c7
-rw-r--r--lib/libc/locale/nomacros.c3
-rw-r--r--lib/libc/locale/none.c8
-rw-r--r--lib/libc/locale/querylocale.33
-rw-r--r--lib/libc/locale/rpmatch.32
-rw-r--r--lib/libc/locale/rpmatch.c5
-rw-r--r--lib/libc/locale/rune.c6
-rw-r--r--lib/libc/locale/runefile.h4
-rw-r--r--lib/libc/locale/runetype.c5
-rw-r--r--lib/libc/locale/setlocale.33
-rw-r--r--lib/libc/locale/setlocale.c10
-rw-r--r--lib/libc/locale/setlocale.h4
-rw-r--r--lib/libc/locale/setrunelocale.c7
-rw-r--r--lib/libc/locale/table.c8
-rw-r--r--lib/libc/locale/toascii.33
-rw-r--r--lib/libc/locale/tolower.332
-rw-r--r--lib/libc/locale/tolower.c5
-rw-r--r--lib/libc/locale/toupper.332
-rw-r--r--lib/libc/locale/toupper.c5
-rw-r--r--lib/libc/locale/towlower.33
-rw-r--r--lib/libc/locale/towupper.33
-rw-r--r--lib/libc/locale/uselocale.33
-rw-r--r--lib/libc/locale/utf8.53
-rw-r--r--lib/libc/locale/utf8.c6
-rw-r--r--lib/libc/locale/wcrtomb.32
-rw-r--r--lib/libc/locale/wcrtomb.c7
-rw-r--r--lib/libc/locale/wcsftime.32
-rw-r--r--lib/libc/locale/wcsftime.c7
-rw-r--r--lib/libc/locale/wcsnrtombs.c7
-rw-r--r--lib/libc/locale/wcsrtombs.32
-rw-r--r--lib/libc/locale/wcsrtombs.c7
-rw-r--r--lib/libc/locale/wcstod.32
-rw-r--r--lib/libc/locale/wcstod.c7
-rw-r--r--lib/libc/locale/wcstof.c7
-rw-r--r--lib/libc/locale/wcstoimax.c23
-rw-r--r--lib/libc/locale/wcstol.32
-rw-r--r--lib/libc/locale/wcstol.c19
-rw-r--r--lib/libc/locale/wcstold.c7
-rw-r--r--lib/libc/locale/wcstoll.c23
-rw-r--r--lib/libc/locale/wcstombs.33
-rw-r--r--lib/libc/locale/wcstombs.c7
-rw-r--r--lib/libc/locale/wcstoul.c17
-rw-r--r--lib/libc/locale/wcstoull.c23
-rw-r--r--lib/libc/locale/wcstoumax.c23
-rw-r--r--lib/libc/locale/wctob.c7
-rw-r--r--lib/libc/locale/wctomb.33
-rw-r--r--lib/libc/locale/wctomb.c7
-rw-r--r--lib/libc/locale/wctrans.32
-rw-r--r--lib/libc/locale/wctrans.c7
-rw-r--r--lib/libc/locale/wctype.32
-rw-r--r--lib/libc/locale/wctype.c7
-rw-r--r--lib/libc/locale/wcwidth.32
-rw-r--r--lib/libc/locale/wcwidth.c5
-rw-r--r--lib/libc/locale/xlocale.313
-rw-r--r--lib/libc/locale/xlocale.c59
-rw-r--r--lib/libc/locale/xlocale_private.h10
-rw-r--r--lib/libc/md/Makefile.inc1
-rw-r--r--lib/libc/mips/Makefile.inc5
-rw-r--r--lib/libc/mips/SYS.h153
-rw-r--r--lib/libc/mips/Symbol.map53
-rw-r--r--lib/libc/mips/arith.h26
-rw-r--r--lib/libc/mips/gd_qnan.h48
-rw-r--r--lib/libc/mips/gen/Makefile.inc11
-rw-r--r--lib/libc/mips/gen/_ctx_start.S55
-rw-r--r--lib/libc/mips/gen/_get_tp.c103
-rw-r--r--lib/libc/mips/gen/_set_tp.c42
-rw-r--r--lib/libc/mips/gen/_setjmp.S200
-rw-r--r--lib/libc/mips/gen/fabs.S58
-rw-r--r--lib/libc/mips/gen/fabs.c47
-rw-r--r--lib/libc/mips/gen/flt_rounds.c42
-rw-r--r--lib/libc/mips/gen/hardfloat/fpgetmask.c29
-rw-r--r--lib/libc/mips/gen/hardfloat/fpgetround.c29
-rw-r--r--lib/libc/mips/gen/hardfloat/fpgetsticky.c29
-rw-r--r--lib/libc/mips/gen/hardfloat/fpsetmask.c38
-rw-r--r--lib/libc/mips/gen/hardfloat/fpsetround.c37
-rw-r--r--lib/libc/mips/gen/hardfloat/fpsetsticky.c38
-rw-r--r--lib/libc/mips/gen/infinity.c26
-rw-r--r--lib/libc/mips/gen/ldexp.S219
-rw-r--r--lib/libc/mips/gen/makecontext.c123
-rw-r--r--lib/libc/mips/gen/setjmp.S237
-rw-r--r--lib/libc/mips/gen/sigsetjmp.S76
-rw-r--r--lib/libc/mips/net/Makefile.inc4
-rw-r--r--lib/libc/mips/net/htonl.S51
-rw-r--r--lib/libc/mips/net/htons.S47
-rw-r--r--lib/libc/mips/net/ntohl.S51
-rw-r--r--lib/libc/mips/net/ntohs.S46
-rw-r--r--lib/libc/mips/softfloat/milieu.h48
-rw-r--r--lib/libc/mips/softfloat/mips-gcc.h91
-rw-r--r--lib/libc/mips/softfloat/softfloat.h315
-rw-r--r--lib/libc/mips/string/Makefile.inc13
-rw-r--r--lib/libc/mips/string/bcmp.S130
-rw-r--r--lib/libc/mips/string/bcopy.S297
-rw-r--r--lib/libc/mips/string/bzero.S83
-rw-r--r--lib/libc/mips/string/ffs.S59
-rw-r--r--lib/libc/mips/string/memcpy.S7
-rw-r--r--lib/libc/mips/string/memmove.S7
-rw-r--r--lib/libc/mips/string/strchr.S66
-rw-r--r--lib/libc/mips/string/strcmp.S68
-rw-r--r--lib/libc/mips/string/strlen.S55
-rw-r--r--lib/libc/mips/string/strrchr.S64
-rw-r--r--lib/libc/mips/sys/Makefile.inc8
-rw-r--r--lib/libc/mips/sys/Ovfork.S64
-rw-r--r--lib/libc/mips/sys/cerror.S72
-rw-r--r--lib/libc/mips/sys/syscall.S44
-rw-r--r--lib/libc/nameser/Makefile.inc1
-rw-r--r--lib/libc/nameser/Symbol.map14
-rw-r--r--lib/libc/nameser/ns_name.c8
-rw-r--r--lib/libc/nameser/ns_netint.c6
-rw-r--r--lib/libc/nameser/ns_parse.c6
-rw-r--r--lib/libc/nameser/ns_print.c6
-rw-r--r--lib/libc/nameser/ns_samedomain.c6
-rw-r--r--lib/libc/nameser/ns_ttl.c6
-rw-r--r--lib/libc/net/Makefile.inc135
-rw-r--r--lib/libc/net/Symbol.hesiod.map12
-rw-r--r--lib/libc/net/Symbol.map19
-rw-r--r--lib/libc/net/base64.c11
-rw-r--r--lib/libc/net/byteorder.33
-rw-r--r--lib/libc/net/ether_addr.c3
-rw-r--r--lib/libc/net/ethers.32
-rw-r--r--lib/libc/net/eui64.32
-rw-r--r--lib/libc/net/eui64.c3
-rw-r--r--lib/libc/net/gai_strerror.319
-rw-r--r--lib/libc/net/gai_strerror.c13
-rw-r--r--lib/libc/net/getaddrinfo.39
-rw-r--r--lib/libc/net/getaddrinfo.c21
-rw-r--r--lib/libc/net/gethostbydns.c12
-rw-r--r--lib/libc/net/gethostbyht.c6
-rw-r--r--lib/libc/net/gethostbyname.347
-rw-r--r--lib/libc/net/gethostbynis.c5
-rw-r--r--lib/libc/net/gethostnamadr.c21
-rw-r--r--lib/libc/net/getifaddrs.32
-rw-r--r--lib/libc/net/getifaddrs.c3
-rw-r--r--lib/libc/net/getifmaddrs.32
-rw-r--r--lib/libc/net/getifmaddrs.c5
-rw-r--r--lib/libc/net/getipnodebyname.38
-rw-r--r--lib/libc/net/getnameinfo.37
-rw-r--r--lib/libc/net/getnameinfo.c5
-rw-r--r--lib/libc/net/getnetbydns.c6
-rw-r--r--lib/libc/net/getnetbyht.c7
-rw-r--r--lib/libc/net/getnetbynis.c5
-rw-r--r--lib/libc/net/getnetent.335
-rw-r--r--lib/libc/net/getnetnamadr.c21
-rw-r--r--lib/libc/net/getproto.c6
-rw-r--r--lib/libc/net/getprotoent.33
-rw-r--r--lib/libc/net/getprotoent.c18
-rw-r--r--lib/libc/net/getprotoname.c6
-rw-r--r--lib/libc/net/getservent.39
-rw-r--r--lib/libc/net/getservent.c26
-rw-r--r--lib/libc/net/hesiod.37
-rw-r--r--lib/libc/net/hesiod.c59
-rw-r--r--lib/libc/net/hosts13
-rw-r--r--lib/libc/net/hosts.equiv1
-rw-r--r--lib/libc/net/if_indextoname.32
-rw-r--r--lib/libc/net/if_indextoname.c5
-rw-r--r--lib/libc/net/if_nameindex.c3
-rw-r--r--lib/libc/net/if_nametoindex.c3
-rw-r--r--lib/libc/net/inet.362
-rw-r--r--lib/libc/net/inet6_opt_init.330
-rw-r--r--lib/libc/net/inet6_option_space.32
-rw-r--r--lib/libc/net/inet6_rth_space.32
-rw-r--r--lib/libc/net/inet6_rthdr_space.32
-rw-r--r--lib/libc/net/inet_net.314
-rw-r--r--lib/libc/net/ip6opt.c3
-rw-r--r--lib/libc/net/linkaddr.33
-rw-r--r--lib/libc/net/linkaddr.c6
-rw-r--r--lib/libc/net/map_v4v6.c6
-rw-r--r--lib/libc/net/name6.c3
-rw-r--r--lib/libc/net/netdb_private.h4
-rw-r--r--lib/libc/net/networks3
-rw-r--r--lib/libc/net/nscache.c5
-rw-r--r--lib/libc/net/nscachedcli.c11
-rw-r--r--lib/libc/net/nsdispatch.32
-rw-r--r--lib/libc/net/nsdispatch.c7
-rw-r--r--lib/libc/net/nslexer.l8
-rw-r--r--lib/libc/net/nsparser.y5
-rw-r--r--lib/libc/net/nss_backends.h4
-rw-r--r--lib/libc/net/nss_compat.c5
-rw-r--r--lib/libc/net/nsswitch.conf1
-rw-r--r--lib/libc/net/ntoh.c5
-rw-r--r--lib/libc/net/protocols4
-rw-r--r--lib/libc/net/rcmd.33
-rw-r--r--lib/libc/net/rcmd.c8
-rw-r--r--lib/libc/net/rcmdsh.32
-rw-r--r--lib/libc/net/rcmdsh.c3
-rw-r--r--lib/libc/net/res_config.h1
-rw-r--r--lib/libc/net/resolver.314
-rw-r--r--lib/libc/net/rthdr.c3
-rw-r--r--lib/libc/net/sctp_bindx.319
-rw-r--r--lib/libc/net/sctp_connectx.318
-rw-r--r--lib/libc/net/sctp_freepaddrs.321
-rw-r--r--lib/libc/net/sctp_getaddrlen.33
-rw-r--r--lib/libc/net/sctp_getassocid.32
-rw-r--r--lib/libc/net/sctp_getpaddrs.321
-rw-r--r--lib/libc/net/sctp_opt_info.33
-rw-r--r--lib/libc/net/sctp_recvmsg.3196
-rw-r--r--lib/libc/net/sctp_send.3194
-rw-r--r--lib/libc/net/sctp_sendmsg.39
-rw-r--r--lib/libc/net/sctp_sys_calls.c39
-rw-r--r--lib/libc/net/sockatmark.319
-rw-r--r--lib/libc/net/sockatmark.c4
-rw-r--r--lib/libc/net/sourcefilter.32
-rw-r--r--lib/libc/net/sourcefilter.c5
-rw-r--r--lib/libc/net/vars.c3
-rw-r--r--lib/libc/nls/C.msg1
-rw-r--r--lib/libc/nls/Makefile.inc1
-rw-r--r--lib/libc/nls/Symbol.map4
-rw-r--r--lib/libc/nls/be_BY.UTF-8.msg1
-rw-r--r--lib/libc/nls/ca_ES.ISO8859-1.msg1
-rw-r--r--lib/libc/nls/catclose.32
-rw-r--r--lib/libc/nls/catgets.32
-rw-r--r--lib/libc/nls/catopen.32
-rw-r--r--lib/libc/nls/de_DE.ISO8859-1.msg1
-rw-r--r--lib/libc/nls/el_GR.ISO8859-7.msg1
-rw-r--r--lib/libc/nls/es_ES.ISO8859-1.msg1
-rw-r--r--lib/libc/nls/fi_FI.ISO8859-1.msg1
-rw-r--r--lib/libc/nls/fr_FR.ISO8859-1.msg1
-rw-r--r--lib/libc/nls/gl_ES.ISO8859-1.msg1
-rw-r--r--lib/libc/nls/hu_HU.ISO8859-2.msg1
-rw-r--r--lib/libc/nls/it_IT.ISO8859-15.msg1
-rw-r--r--lib/libc/nls/ja_JP.UTF-8.msg1
-rw-r--r--lib/libc/nls/ja_JP.eucJP.msg1
-rw-r--r--lib/libc/nls/ko_KR.UTF-8.msg1
-rw-r--r--lib/libc/nls/ko_KR.eucKR.msg1
-rw-r--r--lib/libc/nls/mn_MN.UTF-8.msg1
-rw-r--r--lib/libc/nls/msgcat.c5
-rw-r--r--lib/libc/nls/nl_NL.ISO8859-1.msg1
-rw-r--r--lib/libc/nls/no_NO.ISO8859-1.msg1
-rw-r--r--lib/libc/nls/pl_PL.ISO8859-2.msg1
-rw-r--r--lib/libc/nls/pt_BR.ISO8859-1.msg1
-rw-r--r--lib/libc/nls/ru_RU.KOI8-R.msg1
-rw-r--r--lib/libc/nls/sk_SK.ISO8859-2.msg1
-rw-r--r--lib/libc/nls/sv_SE.ISO8859-1.msg1
-rw-r--r--lib/libc/nls/uk_UA.UTF-8.msg1
-rw-r--r--lib/libc/nls/zh_CN.GB18030.msg1
-rw-r--r--lib/libc/nls/zh_CN.GB2312.msg1
-rw-r--r--lib/libc/nls/zh_CN.UTF-8.msg1
-rw-r--r--lib/libc/posix1e/Makefile.inc13
-rw-r--r--lib/libc/posix1e/Symbol.map4
-rw-r--r--lib/libc/posix1e/acl.314
-rw-r--r--lib/libc/posix1e/acl_add_flag_np.32
-rw-r--r--lib/libc/posix1e/acl_add_perm.32
-rw-r--r--lib/libc/posix1e/acl_branding.c5
-rw-r--r--lib/libc/posix1e/acl_calc_mask.32
-rw-r--r--lib/libc/posix1e/acl_calc_mask.c5
-rw-r--r--lib/libc/posix1e/acl_clear_flags_np.32
-rw-r--r--lib/libc/posix1e/acl_clear_perms.32
-rw-r--r--lib/libc/posix1e/acl_cmp_np.c5
-rw-r--r--lib/libc/posix1e/acl_compat.c5
-rw-r--r--lib/libc/posix1e/acl_copy.c5
-rw-r--r--lib/libc/posix1e/acl_copy_entry.32
-rw-r--r--lib/libc/posix1e/acl_create_entry.32
-rw-r--r--lib/libc/posix1e/acl_delete.32
-rw-r--r--lib/libc/posix1e/acl_delete.c5
-rw-r--r--lib/libc/posix1e/acl_delete_entry.32
-rw-r--r--lib/libc/posix1e/acl_delete_entry.c8
-rw-r--r--lib/libc/posix1e/acl_delete_flag_np.32
-rw-r--r--lib/libc/posix1e/acl_delete_perm.32
-rw-r--r--lib/libc/posix1e/acl_dup.32
-rw-r--r--lib/libc/posix1e/acl_entry.c5
-rw-r--r--lib/libc/posix1e/acl_equiv_mode_np.c8
-rw-r--r--lib/libc/posix1e/acl_extended_file_np.c5
-rw-r--r--lib/libc/posix1e/acl_flag.c5
-rw-r--r--lib/libc/posix1e/acl_free.32
-rw-r--r--lib/libc/posix1e/acl_free.c5
-rw-r--r--lib/libc/posix1e/acl_from_mode_np.c5
-rw-r--r--lib/libc/posix1e/acl_from_text.32
-rw-r--r--lib/libc/posix1e/acl_from_text.c5
-rw-r--r--lib/libc/posix1e/acl_from_text_nfs4.c5
-rw-r--r--lib/libc/posix1e/acl_get.314
-rw-r--r--lib/libc/posix1e/acl_get.c5
-rw-r--r--lib/libc/posix1e/acl_get_brand_np.32
-rw-r--r--lib/libc/posix1e/acl_get_entry.38
-rw-r--r--lib/libc/posix1e/acl_get_entry_type_np.32
-rw-r--r--lib/libc/posix1e/acl_get_flag_np.32
-rw-r--r--lib/libc/posix1e/acl_get_flagset_np.32
-rw-r--r--lib/libc/posix1e/acl_get_perm_np.32
-rw-r--r--lib/libc/posix1e/acl_get_permset.35
-rw-r--r--lib/libc/posix1e/acl_get_qualifier.32
-rw-r--r--lib/libc/posix1e/acl_get_tag_type.32
-rw-r--r--lib/libc/posix1e/acl_id_to_name.c5
-rw-r--r--lib/libc/posix1e/acl_init.32
-rw-r--r--lib/libc/posix1e/acl_init.c5
-rw-r--r--lib/libc/posix1e/acl_is_trivial_np.313
-rw-r--r--lib/libc/posix1e/acl_perm.c5
-rw-r--r--lib/libc/posix1e/acl_set.32
-rw-r--r--lib/libc/posix1e/acl_set.c5
-rw-r--r--lib/libc/posix1e/acl_set_entry_type_np.32
-rw-r--r--lib/libc/posix1e/acl_set_flagset_np.32
-rw-r--r--lib/libc/posix1e/acl_set_permset.32
-rw-r--r--lib/libc/posix1e/acl_set_qualifier.32
-rw-r--r--lib/libc/posix1e/acl_set_tag_type.32
-rw-r--r--lib/libc/posix1e/acl_strip.c5
-rw-r--r--lib/libc/posix1e/acl_strip_np.32
-rw-r--r--lib/libc/posix1e/acl_support.c5
-rw-r--r--lib/libc/posix1e/acl_support.h4
-rw-r--r--lib/libc/posix1e/acl_support_nfs4.c5
-rw-r--r--lib/libc/posix1e/acl_to_text.32
-rw-r--r--lib/libc/posix1e/acl_to_text.c7
-rw-r--r--lib/libc/posix1e/acl_to_text_nfs4.c8
-rw-r--r--lib/libc/posix1e/acl_valid.32
-rw-r--r--lib/libc/posix1e/acl_valid.c5
-rw-r--r--lib/libc/posix1e/extattr.32
-rw-r--r--lib/libc/posix1e/extattr.c5
-rw-r--r--lib/libc/posix1e/mac.32
-rw-r--r--lib/libc/posix1e/mac.c10
-rw-r--r--lib/libc/posix1e/mac.conf1
-rw-r--r--lib/libc/posix1e/mac.conf.52
-rw-r--r--lib/libc/posix1e/mac_exec.c5
-rw-r--r--lib/libc/posix1e/mac_free.310
-rw-r--r--lib/libc/posix1e/mac_get.310
-rw-r--r--lib/libc/posix1e/mac_get.c3
-rw-r--r--lib/libc/posix1e/mac_is_present.32
-rw-r--r--lib/libc/posix1e/mac_prepare.310
-rw-r--r--lib/libc/posix1e/mac_set.32
-rw-r--r--lib/libc/posix1e/mac_set.c3
-rw-r--r--lib/libc/posix1e/mac_text.310
-rw-r--r--lib/libc/posix1e/posix1e.32
-rw-r--r--lib/libc/powerpc/Makefile.inc1
-rw-r--r--lib/libc/powerpc/SYS.h73
-rw-r--r--lib/libc/powerpc/Symbol.map30
-rw-r--r--lib/libc/powerpc/_fpmath.h4
-rw-r--r--lib/libc/powerpc/arith.h2
-rw-r--r--lib/libc/powerpc/gd_qnan.h2
-rw-r--r--lib/libc/powerpc/gen/Makefile.common5
-rw-r--r--lib/libc/powerpc/gen/Makefile.inc1
-rw-r--r--lib/libc/powerpc/gen/_ctx_start.S3
-rw-r--r--lib/libc/powerpc/gen/_get_tp.c47
-rw-r--r--lib/libc/powerpc/gen/_setjmp.S2
-rw-r--r--lib/libc/powerpc/gen/eabi.S2
-rw-r--r--lib/libc/powerpc/gen/fabs.S2
-rw-r--r--lib/libc/powerpc/gen/flt_rounds.c3
-rw-r--r--lib/libc/powerpc/gen/fpgetmask.c5
-rw-r--r--lib/libc/powerpc/gen/fpgetround.c5
-rw-r--r--lib/libc/powerpc/gen/fpgetsticky.c9
-rw-r--r--lib/libc/powerpc/gen/fpsetmask.c5
-rw-r--r--lib/libc/powerpc/gen/fpsetround.c5
-rw-r--r--lib/libc/powerpc/gen/infinity.c2
-rw-r--r--lib/libc/powerpc/gen/makecontext.c5
-rw-r--r--lib/libc/powerpc/gen/setjmp.S2
-rw-r--r--lib/libc/powerpc/gen/signalcontext.c5
-rw-r--r--lib/libc/powerpc/gen/sigsetjmp.S2
-rw-r--r--lib/libc/powerpc/gen/syncicache.c5
-rw-r--r--lib/libc/powerpc/softfloat/milieu.h1
-rw-r--r--lib/libc/powerpc/softfloat/powerpc-gcc.h1
-rw-r--r--lib/libc/powerpc/softfloat/softfloat.h1
-rw-r--r--lib/libc/powerpc/static_tls.h4
-rw-r--r--lib/libc/powerpc/sys/Makefile.inc4
-rw-r--r--lib/libc/powerpc/sys/__vdso_gettc.c68
-rw-r--r--lib/libc/powerpc/sys/cerror.S68
-rw-r--r--lib/libc/powerpc64/Makefile.inc1
-rw-r--r--lib/libc/powerpc64/SYS.h98
-rw-r--r--lib/libc/powerpc64/Symbol.map37
-rw-r--r--lib/libc/powerpc64/_fpmath.h4
-rw-r--r--lib/libc/powerpc64/arith.h2
-rw-r--r--lib/libc/powerpc64/gd_qnan.h16
-rw-r--r--lib/libc/powerpc64/gen/Makefile.inc6
-rw-r--r--lib/libc/powerpc64/gen/_ctx_start.S3
-rw-r--r--lib/libc/powerpc64/gen/_get_tp.c47
-rw-r--r--lib/libc/powerpc64/gen/_setjmp.S2
-rw-r--r--lib/libc/powerpc64/gen/fabs.S2
-rw-r--r--lib/libc/powerpc64/gen/flt_rounds.c5
-rw-r--r--lib/libc/powerpc64/gen/fpgetmask.c5
-rw-r--r--lib/libc/powerpc64/gen/fpgetround.c5
-rw-r--r--lib/libc/powerpc64/gen/fpgetsticky.c9
-rw-r--r--lib/libc/powerpc64/gen/fpsetmask.c5
-rw-r--r--lib/libc/powerpc64/gen/fpsetround.c5
-rw-r--r--lib/libc/powerpc64/gen/infinity.c2
-rw-r--r--lib/libc/powerpc64/gen/makecontext.c5
-rw-r--r--lib/libc/powerpc64/gen/setjmp.S2
-rw-r--r--lib/libc/powerpc64/gen/signalcontext.c5
-rw-r--r--lib/libc/powerpc64/gen/sigsetjmp.S2
-rw-r--r--lib/libc/powerpc64/gen/syncicache.c5
-rw-r--r--lib/libc/powerpc64/softfloat/milieu.h1
-rw-r--r--lib/libc/powerpc64/softfloat/powerpc-gcc.h1
-rw-r--r--lib/libc/powerpc64/softfloat/softfloat.h1
-rw-r--r--lib/libc/powerpc64/static_tls.h4
-rw-r--r--lib/libc/powerpc64/string/Makefile.inc1
-rw-r--r--lib/libc/powerpc64/string/bcopy.S2
-rw-r--r--lib/libc/powerpc64/string/bcopy_resolver.c3
-rw-r--r--lib/libc/powerpc64/string/bcopy_vsx.S2
-rw-r--r--lib/libc/powerpc64/string/memcpy.S2
-rw-r--r--lib/libc/powerpc64/string/memcpy_resolver.c1
-rw-r--r--lib/libc/powerpc64/string/memcpy_vsx.S2
-rw-r--r--lib/libc/powerpc64/string/memmove.S1
-rw-r--r--lib/libc/powerpc64/string/memmove_resolver.c1
-rw-r--r--lib/libc/powerpc64/string/memmove_vsx.S1
-rw-r--r--lib/libc/powerpc64/string/strcpy.c3
-rw-r--r--lib/libc/powerpc64/string/strcpy_arch_2_05.S2
-rw-r--r--lib/libc/powerpc64/string/strcpy_resolver.c3
-rw-r--r--lib/libc/powerpc64/string/strncpy.c3
-rw-r--r--lib/libc/powerpc64/string/strncpy_arch_2_05.S2
-rw-r--r--lib/libc/powerpc64/string/strncpy_resolver.c3
-rw-r--r--lib/libc/powerpc64/sys/Makefile.inc4
-rw-r--r--lib/libc/powerpc64/sys/cerror.S61
-rw-r--r--lib/libc/powerpcspe/Makefile.inc1
-rw-r--r--lib/libc/powerpcspe/_fpmath.h (renamed from lib/libc/mips/_fpmath.h)12
-rw-r--r--lib/libc/powerpcspe/gen/Makefile.inc1
-rw-r--r--lib/libc/powerpcspe/gen/_setjmp.S2
-rw-r--r--lib/libc/powerpcspe/gen/fabs.S2
-rw-r--r--lib/libc/powerpcspe/gen/flt_rounds.c3
-rw-r--r--lib/libc/powerpcspe/gen/fpgetmask.c3
-rw-r--r--lib/libc/powerpcspe/gen/fpgetround.c3
-rw-r--r--lib/libc/powerpcspe/gen/fpgetsticky.c7
-rw-r--r--lib/libc/powerpcspe/gen/fpsetmask.c3
-rw-r--r--lib/libc/powerpcspe/gen/fpsetround.c3
-rw-r--r--lib/libc/powerpcspe/gen/setjmp.S2
-rw-r--r--lib/libc/powerpcspe/gen/sigsetjmp.S2
-rw-r--r--lib/libc/powerpcspe/softfloat/milieu.h1
-rw-r--r--lib/libc/powerpcspe/softfloat/powerpc-gcc.h1
-rw-r--r--lib/libc/powerpcspe/softfloat/softfloat.h1
-rw-r--r--lib/libc/powerpcspe/sys/Makefile.inc4
-rw-r--r--lib/libc/quad/Makefile.inc2
-rw-r--r--lib/libc/quad/Symbol.map14
-rw-r--r--lib/libc/quad/TESTS/Makefile1
-rw-r--r--lib/libc/quad/TESTS/divrem.c12
-rw-r--r--lib/libc/quad/TESTS/mul.c12
-rw-r--r--lib/libc/quad/adddi3.c6
-rw-r--r--lib/libc/quad/anddi3.c6
-rw-r--r--lib/libc/quad/ashldi3.c6
-rw-r--r--lib/libc/quad/ashrdi3.c6
-rw-r--r--lib/libc/quad/cmpdi2.c6
-rw-r--r--lib/libc/quad/divdi3.c6
-rw-r--r--lib/libc/quad/fixdfdi.c6
-rw-r--r--lib/libc/quad/fixsfdi.c6
-rw-r--r--lib/libc/quad/fixunsdfdi.c6
-rw-r--r--lib/libc/quad/fixunssfdi.c6
-rw-r--r--lib/libc/quad/floatdidf.c6
-rw-r--r--lib/libc/quad/floatdisf.c6
-rw-r--r--lib/libc/quad/floatunsdidf.c6
-rw-r--r--lib/libc/quad/iordi3.c6
-rw-r--r--lib/libc/quad/lshldi3.c6
-rw-r--r--lib/libc/quad/lshrdi3.c6
-rw-r--r--lib/libc/quad/moddi3.c6
-rw-r--r--lib/libc/quad/muldi3.c6
-rw-r--r--lib/libc/quad/negdi2.c6
-rw-r--r--lib/libc/quad/notdi2.c6
-rw-r--r--lib/libc/quad/qdivrem.c8
-rw-r--r--lib/libc/quad/quad.h3
-rw-r--r--lib/libc/quad/subdi3.c6
-rw-r--r--lib/libc/quad/ucmpdi2.c6
-rw-r--r--lib/libc/quad/udivdi3.c6
-rw-r--r--lib/libc/quad/umoddi3.c6
-rw-r--r--lib/libc/quad/xordi3.c6
-rw-r--r--lib/libc/regex/COPYRIGHT2
-rw-r--r--lib/libc/regex/Makefile.inc2
-rw-r--r--lib/libc/regex/Symbol.map4
-rw-r--r--lib/libc/regex/WHATSNEW1
-rw-r--r--lib/libc/regex/cname.h3
-rw-r--r--lib/libc/regex/engine.c5
-rw-r--r--lib/libc/regex/grot/Makefile1
-rw-r--r--lib/libc/regex/grot/debug.c3
-rw-r--r--lib/libc/regex/grot/main.c3
-rwxr-xr-xlib/libc/regex/grot/mkh1
-rw-r--r--lib/libc/regex/grot/split.c3
-rw-r--r--lib/libc/regex/grot/tests1
-rw-r--r--lib/libc/regex/re_format.73
-rw-r--r--lib/libc/regex/regcomp.c45
-rw-r--r--lib/libc/regex/regerror.c8
-rw-r--r--lib/libc/regex/regex.33
-rw-r--r--lib/libc/regex/regex2.h3
-rw-r--r--lib/libc/regex/regexec.c12
-rw-r--r--lib/libc/regex/regfree.c8
-rw-r--r--lib/libc/regex/utils.h3
-rw-r--r--lib/libc/resolv/Makefile.inc1
-rw-r--r--lib/libc/resolv/Symbol.map4
-rw-r--r--lib/libc/resolv/h_errno.c4
-rw-r--r--lib/libc/resolv/herror.c7
-rw-r--r--lib/libc/resolv/mtctxres.c3
-rw-r--r--lib/libc/resolv/res_comp.c7
-rw-r--r--lib/libc/resolv/res_data.c6
-rw-r--r--lib/libc/resolv/res_debug.c7
-rw-r--r--lib/libc/resolv/res_debug.h2
-rw-r--r--lib/libc/resolv/res_findzonecut.c6
-rw-r--r--lib/libc/resolv/res_init.c17
-rw-r--r--lib/libc/resolv/res_mkquery.c9
-rw-r--r--lib/libc/resolv/res_mkupdate.c6
-rw-r--r--lib/libc/resolv/res_private.h1
-rw-r--r--lib/libc/resolv/res_query.c11
-rw-r--r--lib/libc/resolv/res_send.c7
-rw-r--r--lib/libc/resolv/res_state.c4
-rw-r--r--lib/libc/resolv/res_update.c6
-rw-r--r--lib/libc/riscv/Makefile.inc1
-rw-r--r--lib/libc/riscv/SYS.h72
-rw-r--r--lib/libc/riscv/Symbol.map27
-rw-r--r--lib/libc/riscv/_fpmath.h2
-rw-r--r--lib/libc/riscv/arith.h2
-rw-r--r--lib/libc/riscv/gd_qnan.h2
-rw-r--r--lib/libc/riscv/gen/Makefile.inc5
-rw-r--r--lib/libc/riscv/gen/_ctx_start.S2
-rw-r--r--lib/libc/riscv/gen/_get_tp.c47
-rw-r--r--lib/libc/riscv/gen/_set_tp.c51
-rw-r--r--lib/libc/riscv/gen/_setjmp.S5
-rw-r--r--lib/libc/riscv/gen/fabs.S2
-rw-r--r--lib/libc/riscv/gen/flt_rounds.c13
-rw-r--r--lib/libc/riscv/gen/fpgetmask.c3
-rw-r--r--lib/libc/riscv/gen/fpsetmask.c3
-rw-r--r--lib/libc/riscv/gen/infinity.c3
-rw-r--r--lib/libc/riscv/gen/makecontext.c3
-rw-r--r--lib/libc/riscv/gen/setjmp.S5
-rw-r--r--lib/libc/riscv/gen/sigsetjmp.S2
-rw-r--r--lib/libc/riscv/softfloat/milieu.h1
-rw-r--r--lib/libc/riscv/softfloat/riscv-gcc.h1
-rw-r--r--lib/libc/riscv/softfloat/softfloat.h1
-rw-r--r--lib/libc/riscv/static_tls.h4
-rw-r--r--lib/libc/riscv/sys/Makefile.inc10
-rw-r--r--lib/libc/riscv/sys/__vdso_gettc.c56
-rw-r--r--lib/libc/riscv/sys/cerror.S50
-rw-r--r--lib/libc/riscv/sys/syscall.S40
-rw-r--r--lib/libc/riscv/sys/vfork.S53
-rw-r--r--lib/libc/rpc/DISCLAIMER1
-rw-r--r--lib/libc/rpc/Makefile.inc4
-rw-r--r--lib/libc/rpc/README1
-rw-r--r--lib/libc/rpc/Symbol.map4
-rw-r--r--lib/libc/rpc/auth_des.c7
-rw-r--r--lib/libc/rpc/auth_none.c7
-rw-r--r--lib/libc/rpc/auth_time.c5
-rw-r--r--lib/libc/rpc/auth_unix.c7
-rw-r--r--lib/libc/rpc/authdes_prot.c6
-rw-r--r--lib/libc/rpc/authunix_prot.c7
-rw-r--r--lib/libc/rpc/bindresvport.32
-rw-r--r--lib/libc/rpc/bindresvport.c7
-rw-r--r--lib/libc/rpc/clnt_bcast.c8
-rw-r--r--lib/libc/rpc/clnt_dg.c177
-rw-r--r--lib/libc/rpc/clnt_generic.c9
-rw-r--r--lib/libc/rpc/clnt_perror.c7
-rw-r--r--lib/libc/rpc/clnt_raw.c7
-rw-r--r--lib/libc/rpc/clnt_simple.c7
-rw-r--r--lib/libc/rpc/clnt_vc.c187
-rw-r--r--lib/libc/rpc/crypt_client.c3
-rw-r--r--lib/libc/rpc/des_crypt.32
-rw-r--r--lib/libc/rpc/des_crypt.c6
-rw-r--r--lib/libc/rpc/des_soft.c6
-rw-r--r--lib/libc/rpc/getnetconfig.32
-rw-r--r--lib/libc/rpc/getnetconfig.c6
-rw-r--r--lib/libc/rpc/getnetpath.32
-rw-r--r--lib/libc/rpc/getnetpath.c8
-rw-r--r--lib/libc/rpc/getpublickey.c6
-rw-r--r--lib/libc/rpc/getrpcent.32
-rw-r--r--lib/libc/rpc/getrpcent.c18
-rw-r--r--lib/libc/rpc/getrpcport.32
-rw-r--r--lib/libc/rpc/getrpcport.c7
-rw-r--r--lib/libc/rpc/key_call.c4
-rw-r--r--lib/libc/rpc/key_prot_xdr.c4
-rw-r--r--lib/libc/rpc/mt_misc.c4
-rw-r--r--lib/libc/rpc/mt_misc.h4
-rw-r--r--lib/libc/rpc/netconfig1
-rw-r--r--lib/libc/rpc/netconfig.51
-rw-r--r--lib/libc/rpc/netname.c6
-rw-r--r--lib/libc/rpc/netnamer.c8
-rw-r--r--lib/libc/rpc/pmap_clnt.c7
-rw-r--r--lib/libc/rpc/pmap_getmaps.c7
-rw-r--r--lib/libc/rpc/pmap_getport.c7
-rw-r--r--lib/libc/rpc/pmap_prot.c7
-rw-r--r--lib/libc/rpc/pmap_prot2.c7
-rw-r--r--lib/libc/rpc/pmap_rmt.c7
-rw-r--r--lib/libc/rpc/publickey.32
-rw-r--r--lib/libc/rpc/publickey.52
-rw-r--r--lib/libc/rpc/rpc1
-rw-r--r--lib/libc/rpc/rpc.32
-rw-r--r--lib/libc/rpc/rpc.52
-rw-r--r--lib/libc/rpc/rpc_callmsg.c7
-rw-r--r--lib/libc/rpc/rpc_clnt_auth.33
-rw-r--r--lib/libc/rpc/rpc_clnt_calls.33
-rw-r--r--lib/libc/rpc/rpc_clnt_create.33
-rw-r--r--lib/libc/rpc/rpc_com.h6
-rw-r--r--lib/libc/rpc/rpc_commondata.c6
-rw-r--r--lib/libc/rpc/rpc_dtablesize.c7
-rw-r--r--lib/libc/rpc/rpc_generic.c27
-rw-r--r--lib/libc/rpc/rpc_prot.c7
-rw-r--r--lib/libc/rpc/rpc_secure.32
-rw-r--r--lib/libc/rpc/rpc_soc.32
-rw-r--r--lib/libc/rpc/rpc_soc.c10
-rw-r--r--lib/libc/rpc/rpc_svc_calls.33
-rw-r--r--lib/libc/rpc/rpc_svc_create.33
-rw-r--r--lib/libc/rpc/rpc_svc_err.33
-rw-r--r--lib/libc/rpc/rpc_svc_reg.33
-rw-r--r--lib/libc/rpc/rpc_xdr.33
-rw-r--r--lib/libc/rpc/rpcb_clnt.c23
-rw-r--r--lib/libc/rpc/rpcb_prot.c8
-rw-r--r--lib/libc/rpc/rpcb_st_xdr.c3
-rw-r--r--lib/libc/rpc/rpcbind.32
-rw-r--r--lib/libc/rpc/rpcdname.c6
-rw-r--r--lib/libc/rpc/rpcsec_gss_stub.c4
-rw-r--r--lib/libc/rpc/rtime.32
-rw-r--r--lib/libc/rpc/rtime.c6
-rw-r--r--lib/libc/rpc/svc.c7
-rw-r--r--lib/libc/rpc/svc_auth.c9
-rw-r--r--lib/libc/rpc/svc_auth_des.c6
-rw-r--r--lib/libc/rpc/svc_auth_unix.c7
-rw-r--r--lib/libc/rpc/svc_dg.c6
-rw-r--r--lib/libc/rpc/svc_generic.c7
-rw-r--r--lib/libc/rpc/svc_raw.c8
-rw-r--r--lib/libc/rpc/svc_run.c7
-rw-r--r--lib/libc/rpc/svc_simple.c4
-rw-r--r--lib/libc/rpc/svc_vc.c9
-rw-r--r--lib/libc/secure/Makefile.inc1
-rw-r--r--lib/libc/secure/Symbol.map4
-rw-r--r--lib/libc/secure/stack_protector.c13
-rw-r--r--lib/libc/secure/stack_protector_compat.c2
-rw-r--r--lib/libc/softfloat/Makefile.inc1
-rw-r--r--lib/libc/softfloat/README.NetBSD1
-rw-r--r--lib/libc/softfloat/README.txt1
-rw-r--r--lib/libc/softfloat/Symbol.map10
-rw-r--r--lib/libc/softfloat/bits32/softfloat-macros1
-rw-r--r--lib/libc/softfloat/bits32/softfloat.c3
-rw-r--r--lib/libc/softfloat/bits64/softfloat-macros1
-rw-r--r--lib/libc/softfloat/bits64/softfloat.c3
-rw-r--r--lib/libc/softfloat/eqdf2.c3
-rw-r--r--lib/libc/softfloat/eqsf2.c3
-rw-r--r--lib/libc/softfloat/eqtf2.c3
-rw-r--r--lib/libc/softfloat/fpgetmask.c10
-rw-r--r--lib/libc/softfloat/fpgetround.c5
-rw-r--r--lib/libc/softfloat/fpgetsticky.c10
-rw-r--r--lib/libc/softfloat/fpsetmask.c5
-rw-r--r--lib/libc/softfloat/fpsetround.c5
-rw-r--r--lib/libc/softfloat/fpsetsticky.c5
-rw-r--r--lib/libc/softfloat/gedf2.c3
-rw-r--r--lib/libc/softfloat/gesf2.c3
-rw-r--r--lib/libc/softfloat/getf2.c3
-rw-r--r--lib/libc/softfloat/gexf2.c3
-rw-r--r--lib/libc/softfloat/gtdf2.c3
-rw-r--r--lib/libc/softfloat/gtsf2.c3
-rw-r--r--lib/libc/softfloat/gttf2.c3
-rw-r--r--lib/libc/softfloat/gtxf2.c3
-rw-r--r--lib/libc/softfloat/ledf2.c3
-rw-r--r--lib/libc/softfloat/lesf2.c3
-rw-r--r--lib/libc/softfloat/letf2.c3
-rw-r--r--lib/libc/softfloat/ltdf2.c3
-rw-r--r--lib/libc/softfloat/ltsf2.c3
-rw-r--r--lib/libc/softfloat/lttf2.c3
-rw-r--r--lib/libc/softfloat/nedf2.c3
-rw-r--r--lib/libc/softfloat/negdf2.c3
-rw-r--r--lib/libc/softfloat/negsf2.c3
-rw-r--r--lib/libc/softfloat/negtf2.c3
-rw-r--r--lib/libc/softfloat/negxf2.c3
-rw-r--r--lib/libc/softfloat/nesf2.c3
-rw-r--r--lib/libc/softfloat/netf2.c3
-rw-r--r--lib/libc/softfloat/nexf2.c3
-rw-r--r--lib/libc/softfloat/softfloat-for-gcc.h1
-rw-r--r--lib/libc/softfloat/softfloat-history.txt1
-rw-r--r--lib/libc/softfloat/softfloat-source.txt1
-rw-r--r--lib/libc/softfloat/softfloat-specialize1
-rw-r--r--lib/libc/softfloat/softfloat.txt1
-rw-r--r--lib/libc/softfloat/templates/milieu.h1
-rw-r--r--lib/libc/softfloat/templates/softfloat-specialize1
-rw-r--r--lib/libc/softfloat/templates/softfloat.h1
-rw-r--r--lib/libc/softfloat/timesoftfloat.c3
-rw-r--r--lib/libc/softfloat/timesoftfloat.txt3
-rw-r--r--lib/libc/softfloat/unorddf2.c3
-rw-r--r--lib/libc/softfloat/unordsf2.c3
-rw-r--r--lib/libc/stdio/Makefile.inc120
-rw-r--r--lib/libc/stdio/Symbol.map5
-rw-r--r--lib/libc/stdio/_flock_stub.c3
-rw-r--r--lib/libc/stdio/asprintf.c5
-rw-r--r--lib/libc/stdio/clrerr.c6
-rw-r--r--lib/libc/stdio/dprintf.c5
-rw-r--r--lib/libc/stdio/fclose.38
-rw-r--r--lib/libc/stdio/fclose.c6
-rw-r--r--lib/libc/stdio/fcloseall.c5
-rw-r--r--lib/libc/stdio/fdopen.c6
-rw-r--r--lib/libc/stdio/feof.c6
-rw-r--r--lib/libc/stdio/ferror.314
-rw-r--r--lib/libc/stdio/ferror.c6
-rw-r--r--lib/libc/stdio/fflush.33
-rw-r--r--lib/libc/stdio/fflush.c25
-rw-r--r--lib/libc/stdio/fgetc.c6
-rw-r--r--lib/libc/stdio/fgetln.33
-rw-r--r--lib/libc/stdio/fgetln.c6
-rw-r--r--lib/libc/stdio/fgetpos.c6
-rw-r--r--lib/libc/stdio/fgets.312
-rw-r--r--lib/libc/stdio/fgets.c6
-rw-r--r--lib/libc/stdio/fgetwc.c7
-rw-r--r--lib/libc/stdio/fgetwln.33
-rw-r--r--lib/libc/stdio/fgetwln.c7
-rw-r--r--lib/libc/stdio/fgetws.33
-rw-r--r--lib/libc/stdio/fgetws.c7
-rw-r--r--lib/libc/stdio/fileno.c6
-rw-r--r--lib/libc/stdio/findfp.c6
-rw-r--r--lib/libc/stdio/flags.c6
-rw-r--r--lib/libc/stdio/floatio.h3
-rw-r--r--lib/libc/stdio/flockfile.32
-rw-r--r--lib/libc/stdio/fmemopen.c5
-rw-r--r--lib/libc/stdio/fopen.318
-rw-r--r--lib/libc/stdio/fopen.c6
-rw-r--r--lib/libc/stdio/fopencookie.32
-rw-r--r--lib/libc/stdio/fopencookie.c3
-rw-r--r--lib/libc/stdio/fprintf.c8
-rw-r--r--lib/libc/stdio/fpurge.c6
-rw-r--r--lib/libc/stdio/fputc.c6
-rw-r--r--lib/libc/stdio/fputs.33
-rw-r--r--lib/libc/stdio/fputs.c6
-rw-r--r--lib/libc/stdio/fputwc.c7
-rw-r--r--lib/libc/stdio/fputws.33
-rw-r--r--lib/libc/stdio/fputws.c7
-rw-r--r--lib/libc/stdio/fread.312
-rw-r--r--lib/libc/stdio/fread.c18
-rw-r--r--lib/libc/stdio/freopen.c6
-rw-r--r--lib/libc/stdio/fscanf.c8
-rw-r--r--lib/libc/stdio/fseek.313
-rw-r--r--lib/libc/stdio/fseek.c6
-rw-r--r--lib/libc/stdio/fsetpos.c6
-rw-r--r--lib/libc/stdio/ftell.c6
-rw-r--r--lib/libc/stdio/funopen.33
-rw-r--r--lib/libc/stdio/funopen.c6
-rw-r--r--lib/libc/stdio/fvwrite.c6
-rw-r--r--lib/libc/stdio/fvwrite.h3
-rw-r--r--lib/libc/stdio/fwalk.c6
-rw-r--r--lib/libc/stdio/fwide.31
-rw-r--r--lib/libc/stdio/fwide.c5
-rw-r--r--lib/libc/stdio/fwprintf.c7
-rw-r--r--lib/libc/stdio/fwrite.c6
-rw-r--r--lib/libc/stdio/fwscanf.c7
-rw-r--r--lib/libc/stdio/getc.33
-rw-r--r--lib/libc/stdio/getc.c6
-rw-r--r--lib/libc/stdio/getchar.c6
-rw-r--r--lib/libc/stdio/getdelim.c5
-rw-r--r--lib/libc/stdio/getline.32
-rw-r--r--lib/libc/stdio/getline.c5
-rw-r--r--lib/libc/stdio/gets.c6
-rw-r--r--lib/libc/stdio/gets_s.c3
-rw-r--r--lib/libc/stdio/getw.c6
-rw-r--r--lib/libc/stdio/getwc.33
-rw-r--r--lib/libc/stdio/getwc.c7
-rw-r--r--lib/libc/stdio/getwchar.c7
-rw-r--r--lib/libc/stdio/glue.h3
-rw-r--r--lib/libc/stdio/local.h5
-rw-r--r--lib/libc/stdio/makebuf.c6
-rw-r--r--lib/libc/stdio/mktemp.33
-rw-r--r--lib/libc/stdio/mktemp.c6
-rw-r--r--lib/libc/stdio/open_memstream.32
-rw-r--r--lib/libc/stdio/open_memstream.c5
-rw-r--r--lib/libc/stdio/open_wmemstream.c5
-rw-r--r--lib/libc/stdio/perror.c6
-rw-r--r--lib/libc/stdio/printf-pos.c6
-rw-r--r--lib/libc/stdio/printf.339
-rw-r--r--lib/libc/stdio/printf.c8
-rw-r--r--lib/libc/stdio/printf_l.32
-rw-r--r--lib/libc/stdio/printfcommon.h18
-rw-r--r--lib/libc/stdio/printflocal.h3
-rw-r--r--lib/libc/stdio/putc.33
-rw-r--r--lib/libc/stdio/putc.c6
-rw-r--r--lib/libc/stdio/putchar.c6
-rw-r--r--lib/libc/stdio/puts.c6
-rw-r--r--lib/libc/stdio/putw.c6
-rw-r--r--lib/libc/stdio/putwc.33
-rw-r--r--lib/libc/stdio/putwc.c7
-rw-r--r--lib/libc/stdio/putwchar.c7
-rw-r--r--lib/libc/stdio/refill.c6
-rw-r--r--lib/libc/stdio/remove.33
-rw-r--r--lib/libc/stdio/remove.c6
-rw-r--r--lib/libc/stdio/rewind.c6
-rw-r--r--lib/libc/stdio/rget.c6
-rw-r--r--lib/libc/stdio/scanf.375
-rw-r--r--lib/libc/stdio/scanf.c8
-rw-r--r--lib/libc/stdio/scanf_l.32
-rw-r--r--lib/libc/stdio/setbuf.33
-rw-r--r--lib/libc/stdio/setbuf.c6
-rw-r--r--lib/libc/stdio/setbuffer.c6
-rw-r--r--lib/libc/stdio/setvbuf.c9
-rw-r--r--lib/libc/stdio/snprintf.c8
-rw-r--r--lib/libc/stdio/sprintf.c8
-rw-r--r--lib/libc/stdio/sscanf.c8
-rw-r--r--lib/libc/stdio/stdio.33
-rw-r--r--lib/libc/stdio/stdio.c6
-rw-r--r--lib/libc/stdio/swprintf.c7
-rw-r--r--lib/libc/stdio/swscanf.c7
-rw-r--r--lib/libc/stdio/tempnam.c8
-rw-r--r--lib/libc/stdio/tmpfile.c10
-rw-r--r--lib/libc/stdio/tmpnam.33
-rw-r--r--lib/libc/stdio/tmpnam.c6
-rw-r--r--lib/libc/stdio/ungetc.33
-rw-r--r--lib/libc/stdio/ungetc.c6
-rw-r--r--lib/libc/stdio/ungetwc.33
-rw-r--r--lib/libc/stdio/ungetwc.c7
-rw-r--r--lib/libc/stdio/vasprintf.c5
-rw-r--r--lib/libc/stdio/vdprintf.c7
-rw-r--r--lib/libc/stdio/vfprintf.c71
-rw-r--r--lib/libc/stdio/vfscanf.c315
-rw-r--r--lib/libc/stdio/vfwprintf.c67
-rw-r--r--lib/libc/stdio/vfwscanf.c315
-rw-r--r--lib/libc/stdio/vprintf.c8
-rw-r--r--lib/libc/stdio/vscanf.c8
-rw-r--r--lib/libc/stdio/vsnprintf.c8
-rw-r--r--lib/libc/stdio/vsprintf.c8
-rw-r--r--lib/libc/stdio/vsscanf.c8
-rw-r--r--lib/libc/stdio/vswprintf.c8
-rw-r--r--lib/libc/stdio/vswscanf.c11
-rw-r--r--lib/libc/stdio/vwprintf.c7
-rw-r--r--lib/libc/stdio/vwscanf.c7
-rw-r--r--lib/libc/stdio/wbuf.c10
-rw-r--r--lib/libc/stdio/wprintf.33
-rw-r--r--lib/libc/stdio/wprintf.c7
-rw-r--r--lib/libc/stdio/wscanf.33
-rw-r--r--lib/libc/stdio/wscanf.c7
-rw-r--r--lib/libc/stdio/wsetup.c6
-rw-r--r--lib/libc/stdio/xprintf.c2
-rw-r--r--lib/libc/stdio/xprintf_errno.c17
-rw-r--r--lib/libc/stdio/xprintf_float.c2
-rw-r--r--lib/libc/stdio/xprintf_hexdump.c4
-rw-r--r--lib/libc/stdio/xprintf_int.c2
-rw-r--r--lib/libc/stdio/xprintf_quote.c4
-rw-r--r--lib/libc/stdio/xprintf_str.c2
-rw-r--r--lib/libc/stdio/xprintf_time.c2
-rw-r--r--lib/libc/stdio/xprintf_vis.c4
-rw-r--r--lib/libc/stdlib/Makefile.inc59
-rw-r--r--lib/libc/stdlib/Symbol.map13
-rw-r--r--lib/libc/stdlib/_Exit.c2
-rw-r--r--lib/libc/stdlib/a64l.32
-rw-r--r--lib/libc/stdlib/a64l.c2
-rw-r--r--lib/libc/stdlib/abort.33
-rw-r--r--lib/libc/stdlib/abort.c6
-rw-r--r--lib/libc/stdlib/abs.310
-rw-r--r--lib/libc/stdlib/abs.c6
-rw-r--r--lib/libc/stdlib/alloca.33
-rw-r--r--lib/libc/stdlib/at_quick_exit.32
-rw-r--r--lib/libc/stdlib/atexit.33
-rw-r--r--lib/libc/stdlib/atexit.c6
-rw-r--r--lib/libc/stdlib/atexit.h3
-rw-r--r--lib/libc/stdlib/atof.33
-rw-r--r--lib/libc/stdlib/atof.c8
-rw-r--r--lib/libc/stdlib/atoi.33
-rw-r--r--lib/libc/stdlib/atoi.c8
-rw-r--r--lib/libc/stdlib/atol.33
-rw-r--r--lib/libc/stdlib/atol.c8
-rw-r--r--lib/libc/stdlib/atoll.c5
-rw-r--r--lib/libc/stdlib/bsearch.33
-rw-r--r--lib/libc/stdlib/bsearch.c9
-rw-r--r--lib/libc/stdlib/bsearch_b.c2
-rw-r--r--lib/libc/stdlib/cxa_thread_atexit.c4
-rw-r--r--lib/libc/stdlib/cxa_thread_atexit_impl.c8
-rw-r--r--lib/libc/stdlib/div.33
-rw-r--r--lib/libc/stdlib/div.c39
-rw-r--r--lib/libc/stdlib/exit.35
-rw-r--r--lib/libc/stdlib/exit.c6
-rw-r--r--lib/libc/stdlib/getenv.349
-rw-r--r--lib/libc/stdlib/getenv.c50
-rw-r--r--lib/libc/stdlib/getopt.33
-rw-r--r--lib/libc/stdlib/getopt.c6
-rw-r--r--lib/libc/stdlib/getopt_long.321
-rw-r--r--lib/libc/stdlib/getopt_long.c8
-rw-r--r--lib/libc/stdlib/getsubopt.33
-rw-r--r--lib/libc/stdlib/getsubopt.c6
-rw-r--r--lib/libc/stdlib/hcreate.32
-rw-r--r--lib/libc/stdlib/hcreate.c5
-rw-r--r--lib/libc/stdlib/hcreate_r.c3
-rw-r--r--lib/libc/stdlib/hdestroy_r.c3
-rw-r--r--lib/libc/stdlib/heapsort.c6
-rw-r--r--lib/libc/stdlib/heapsort_b.c2
-rw-r--r--lib/libc/stdlib/hsearch.h2
-rw-r--r--lib/libc/stdlib/hsearch_r.c3
-rw-r--r--lib/libc/stdlib/imaxabs.32
-rw-r--r--lib/libc/stdlib/imaxabs.c5
-rw-r--r--lib/libc/stdlib/imaxdiv.32
-rw-r--r--lib/libc/stdlib/imaxdiv.c12
-rw-r--r--lib/libc/stdlib/insque.32
-rw-r--r--lib/libc/stdlib/insque.c3
-rw-r--r--lib/libc/stdlib/l64a.c2
-rw-r--r--lib/libc/stdlib/labs.33
-rw-r--r--lib/libc/stdlib/labs.c6
-rw-r--r--lib/libc/stdlib/ldiv.311
-rw-r--r--lib/libc/stdlib/ldiv.c16
-rw-r--r--lib/libc/stdlib/llabs.32
-rw-r--r--lib/libc/stdlib/llabs.c5
-rw-r--r--lib/libc/stdlib/lldiv.32
-rw-r--r--lib/libc/stdlib/lldiv.c12
-rw-r--r--lib/libc/stdlib/lsearch.32
-rw-r--r--lib/libc/stdlib/lsearch.c3
-rw-r--r--lib/libc/stdlib/malloc/Makefile.inc3
-rw-r--r--lib/libc/stdlib/malloc/Symbol.map (renamed from lib/libc/stdlib/jemalloc/Symbol.map)4
-rw-r--r--lib/libc/stdlib/malloc/jemalloc/Makefile.inc (renamed from lib/libc/stdlib/jemalloc/Makefile.inc)6
-rw-r--r--lib/libc/stdlib/memory.360
-rw-r--r--lib/libc/stdlib/merge.c6
-rw-r--r--lib/libc/stdlib/mergesort_b.c2
-rw-r--r--lib/libc/stdlib/ptsname.319
-rw-r--r--lib/libc/stdlib/ptsname.c7
-rw-r--r--lib/libc/stdlib/qsort.323
-rw-r--r--lib/libc/stdlib/qsort.c29
-rw-r--r--lib/libc/stdlib/qsort_r.c13
-rw-r--r--lib/libc/stdlib/qsort_r_compat.c19
-rw-r--r--lib/libc/stdlib/qsort_s.c2
-rw-r--r--lib/libc/stdlib/quick_exit.32
-rw-r--r--lib/libc/stdlib/quick_exit.c44
-rw-r--r--lib/libc/stdlib/radixsort.33
-rw-r--r--lib/libc/stdlib/radixsort.c6
-rw-r--r--lib/libc/stdlib/rand.33
-rw-r--r--lib/libc/stdlib/rand.c6
-rw-r--r--lib/libc/stdlib/random.33
-rw-r--r--lib/libc/stdlib/random.c6
-rw-r--r--lib/libc/stdlib/random.h2
-rw-r--r--lib/libc/stdlib/reallocarray.32
-rw-r--r--lib/libc/stdlib/reallocarray.c3
-rw-r--r--lib/libc/stdlib/reallocf.33
-rw-r--r--lib/libc/stdlib/reallocf.c5
-rw-r--r--lib/libc/stdlib/realpath.33
-rw-r--r--lib/libc/stdlib/realpath.c6
-rw-r--r--lib/libc/stdlib/remque.c3
-rw-r--r--lib/libc/stdlib/set_constraint_handler_s.32
-rw-r--r--lib/libc/stdlib/set_constraint_handler_s.c3
-rw-r--r--lib/libc/stdlib/strfmon.368
-rw-r--r--lib/libc/stdlib/strfmon.c379
-rw-r--r--lib/libc/stdlib/strtod.33
-rw-r--r--lib/libc/stdlib/strtoimax.c15
-rw-r--r--lib/libc/stdlib/strtol.37
-rw-r--r--lib/libc/stdlib/strtol.c15
-rw-r--r--lib/libc/stdlib/strtold.c6
-rw-r--r--lib/libc/stdlib/strtoll.c20
-rw-r--r--lib/libc/stdlib/strtonum.31
-rw-r--r--lib/libc/stdlib/strtonum.c3
-rw-r--r--lib/libc/stdlib/strtoq.c6
-rw-r--r--lib/libc/stdlib/strtoul.37
-rw-r--r--lib/libc/stdlib/strtoul.c15
-rw-r--r--lib/libc/stdlib/strtoull.c15
-rw-r--r--lib/libc/stdlib/strtoumax.c15
-rw-r--r--lib/libc/stdlib/strtouq.c6
-rw-r--r--lib/libc/stdlib/system.37
-rw-r--r--lib/libc/stdlib/system.c6
-rw-r--r--lib/libc/stdlib/tdelete.c3
-rw-r--r--lib/libc/stdlib/tfind.c2
-rw-r--r--lib/libc/stdlib/tsearch.31
-rw-r--r--lib/libc/stdlib/tsearch.c3
-rw-r--r--lib/libc/stdlib/tsearch_path.h2
-rw-r--r--lib/libc/stdlib/twalk.c2
-rw-r--r--lib/libc/stdtime/Makefile.inc26
-rw-r--r--lib/libc/stdtime/Symbol.map10
-rw-r--r--lib/libc/stdtime/ctime.3402
-rw-r--r--lib/libc/stdtime/strftime.38
-rw-r--r--lib/libc/stdtime/strftime.c21
-rw-r--r--lib/libc/stdtime/strptime.32
-rw-r--r--lib/libc/stdtime/strptime.c15
-rw-r--r--lib/libc/stdtime/time32.c3
-rw-r--r--lib/libc/stdtime/timelocal.c7
-rw-r--r--lib/libc/stdtime/timelocal.h6
-rw-r--r--lib/libc/stdtime/tzset.3 (renamed from lib/libc/gen/tzset.3)38
-rw-r--r--lib/libc/string/Makefile.inc13
-rw-r--r--lib/libc/string/Symbol.map5
-rw-r--r--lib/libc/string/bcmp.33
-rw-r--r--lib/libc/string/bcmp.c10
-rw-r--r--lib/libc/string/bcopy.33
-rw-r--r--lib/libc/string/bcopy.c6
-rw-r--r--lib/libc/string/bstring.313
-rw-r--r--lib/libc/string/bzero.33
-rw-r--r--lib/libc/string/bzero.c3
-rw-r--r--lib/libc/string/ffs.33
-rw-r--r--lib/libc/string/ffs.c18
-rw-r--r--lib/libc/string/ffsl.c15
-rw-r--r--lib/libc/string/ffsll.c15
-rw-r--r--lib/libc/string/fls.c16
-rw-r--r--lib/libc/string/flsl.c17
-rw-r--r--lib/libc/string/flsll.c16
-rw-r--r--lib/libc/string/index.33
-rw-r--r--lib/libc/string/memccpy.336
-rw-r--r--lib/libc/string/memccpy.c8
-rw-r--r--lib/libc/string/memchr.33
-rw-r--r--lib/libc/string/memchr.c3
-rw-r--r--lib/libc/string/memcmp.33
-rw-r--r--lib/libc/string/memcmp.c6
-rw-r--r--lib/libc/string/memcpy.318
-rw-r--r--lib/libc/string/memcpy.c3
-rw-r--r--lib/libc/string/memmem.37
-rw-r--r--lib/libc/string/memmem.c3
-rw-r--r--lib/libc/string/memmove.33
-rw-r--r--lib/libc/string/memmove.c3
-rw-r--r--lib/libc/string/mempcpy.c6
-rw-r--r--lib/libc/string/memrchr.c2
-rw-r--r--lib/libc/string/memset.33
-rw-r--r--lib/libc/string/memset.c6
-rw-r--r--lib/libc/string/memset_s.c3
-rw-r--r--lib/libc/string/stpcpy.c6
-rw-r--r--lib/libc/string/stpncpy.c5
-rw-r--r--lib/libc/string/strcasecmp.33
-rw-r--r--lib/libc/string/strcasecmp.c8
-rw-r--r--lib/libc/string/strcasestr.c5
-rw-r--r--lib/libc/string/strcat.314
-rw-r--r--lib/libc/string/strcat.c6
-rw-r--r--lib/libc/string/strchr.33
-rw-r--r--lib/libc/string/strchr.c3
-rw-r--r--lib/libc/string/strchrnul.c3
-rw-r--r--lib/libc/string/strcmp.314
-rw-r--r--lib/libc/string/strcmp.c6
-rw-r--r--lib/libc/string/strcoll.33
-rw-r--r--lib/libc/string/strcoll.c7
-rw-r--r--lib/libc/string/strcpy.33
-rw-r--r--lib/libc/string/strcpy.c6
-rw-r--r--lib/libc/string/strcspn.c5
-rw-r--r--lib/libc/string/strdup.33
-rw-r--r--lib/libc/string/strdup.c6
-rw-r--r--lib/libc/string/strerror.33
-rw-r--r--lib/libc/string/strerror.c16
-rw-r--r--lib/libc/string/string.38
-rw-r--r--lib/libc/string/strlcat.c3
-rw-r--r--lib/libc/string/strlcpy.332
-rw-r--r--lib/libc/string/strlcpy.c3
-rw-r--r--lib/libc/string/strlen.318
-rw-r--r--lib/libc/string/strlen.c5
-rw-r--r--lib/libc/string/strmode.33
-rw-r--r--lib/libc/string/strmode.c6
-rw-r--r--lib/libc/string/strncat.c6
-rw-r--r--lib/libc/string/strncmp.c6
-rw-r--r--lib/libc/string/strncpy.c6
-rw-r--r--lib/libc/string/strndup.c3
-rw-r--r--lib/libc/string/strnlen.c5
-rw-r--r--lib/libc/string/strnstr.c6
-rw-r--r--lib/libc/string/strpbrk.33
-rw-r--r--lib/libc/string/strpbrk.c6
-rw-r--r--lib/libc/string/strrchr.c6
-rw-r--r--lib/libc/string/strsep.33
-rw-r--r--lib/libc/string/strsep.c6
-rw-r--r--lib/libc/string/strsignal.c6
-rw-r--r--lib/libc/string/strspn.33
-rw-r--r--lib/libc/string/strspn.c5
-rw-r--r--lib/libc/string/strstr.39
-rw-r--r--lib/libc/string/strstr.c7
-rw-r--r--lib/libc/string/strtok.33
-rw-r--r--lib/libc/string/strtok.c6
-rw-r--r--lib/libc/string/strverscmp.356
-rw-r--r--lib/libc/string/strverscmp.c91
-rw-r--r--lib/libc/string/strxfrm.33
-rw-r--r--lib/libc/string/strxfrm.c7
-rw-r--r--lib/libc/string/swab.33
-rw-r--r--lib/libc/string/swab.c63
-rw-r--r--lib/libc/string/timingsafe_bcmp.34
-rw-r--r--lib/libc/string/timingsafe_bcmp.c3
-rw-r--r--lib/libc/string/timingsafe_memcmp.c3
-rw-r--r--lib/libc/string/wcpcpy.c6
-rw-r--r--lib/libc/string/wcpncpy.c5
-rw-r--r--lib/libc/string/wcscasecmp.c5
-rw-r--r--lib/libc/string/wcscat.c4
-rw-r--r--lib/libc/string/wcschr.c5
-rw-r--r--lib/libc/string/wcscmp.c10
-rw-r--r--lib/libc/string/wcscoll.33
-rw-r--r--lib/libc/string/wcscoll.c7
-rw-r--r--lib/libc/string/wcscpy.c2
-rw-r--r--lib/libc/string/wcscspn.c2
-rw-r--r--lib/libc/string/wcsdup.c5
-rw-r--r--lib/libc/string/wcslcat.c2
-rw-r--r--lib/libc/string/wcslcpy.c2
-rw-r--r--lib/libc/string/wcslen.c2
-rw-r--r--lib/libc/string/wcsncasecmp.c5
-rw-r--r--lib/libc/string/wcsncat.c2
-rw-r--r--lib/libc/string/wcsncmp.c9
-rw-r--r--lib/libc/string/wcsncpy.c8
-rw-r--r--lib/libc/string/wcsnlen.c5
-rw-r--r--lib/libc/string/wcspbrk.c2
-rw-r--r--lib/libc/string/wcsrchr.c5
-rw-r--r--lib/libc/string/wcsspn.c2
-rw-r--r--lib/libc/string/wcsstr.c8
-rw-r--r--lib/libc/string/wcstok.32
-rw-r--r--lib/libc/string/wcstok.c3
-rw-r--r--lib/libc/string/wcswidth.32
-rw-r--r--lib/libc/string/wcswidth.c5
-rw-r--r--lib/libc/string/wcsxfrm.33
-rw-r--r--lib/libc/string/wcsxfrm.c7
-rw-r--r--lib/libc/string/wmemchr.310
-rw-r--r--lib/libc/string/wmemchr.c2
-rw-r--r--lib/libc/string/wmemcmp.c2
-rw-r--r--lib/libc/string/wmemcpy.c2
-rw-r--r--lib/libc/string/wmemmove.c2
-rw-r--r--lib/libc/string/wmempcpy.c6
-rw-r--r--lib/libc/string/wmemset.c2
-rw-r--r--lib/libc/sys/Makefile.inc536
-rw-r--r--lib/libc/sys/POSIX2x_Fork.c4
-rw-r--r--lib/libc/sys/Symbol.map978
-rw-r--r--lib/libc/sys/__error.c60
-rw-r--r--lib/libc/sys/__vdso_gettimeofday.c199
-rw-r--r--lib/libc/sys/_exit.2125
-rw-r--r--lib/libc/sys/_umtx_op.21531
-rw-r--r--lib/libc/sys/abort2.2113
-rw-r--r--lib/libc/sys/accept.2239
-rw-r--r--lib/libc/sys/accept.c8
-rw-r--r--lib/libc/sys/accept4.c8
-rw-r--r--lib/libc/sys/access.2272
-rw-r--r--lib/libc/sys/acct.2133
-rw-r--r--lib/libc/sys/adjtime.2109
-rw-r--r--lib/libc/sys/aio_cancel.2117
-rw-r--r--lib/libc/sys/aio_error.2105
-rw-r--r--lib/libc/sys/aio_fsync.2188
-rw-r--r--lib/libc/sys/aio_mlock.2138
-rw-r--r--lib/libc/sys/aio_read.2263
-rw-r--r--lib/libc/sys/aio_return.2110
-rw-r--r--lib/libc/sys/aio_suspend.2117
-rw-r--r--lib/libc/sys/aio_suspend.c9
-rw-r--r--lib/libc/sys/aio_waitcomplete.2137
-rw-r--r--lib/libc/sys/aio_write.2258
-rw-r--r--lib/libc/sys/bind.2141
-rw-r--r--lib/libc/sys/bindat.2108
-rw-r--r--lib/libc/sys/brk.2190
-rw-r--r--lib/libc/sys/brk.c5
-rw-r--r--lib/libc/sys/cap_enter.2164
-rw-r--r--lib/libc/sys/cap_fcntls_limit.2132
-rw-r--r--lib/libc/sys/cap_ioctls_limit.2165
-rw-r--r--lib/libc/sys/cap_rights_limit.2161
-rw-r--r--lib/libc/sys/chdir.2134
-rw-r--r--lib/libc/sys/chflags.2359
-rw-r--r--lib/libc/sys/chmod.2360
-rw-r--r--lib/libc/sys/chown.2301
-rw-r--r--lib/libc/sys/chroot.2165
-rw-r--r--lib/libc/sys/clock_gettime.2196
-rw-r--r--lib/libc/sys/clock_gettime.c54
-rw-r--r--lib/libc/sys/clock_nanosleep.c9
-rw-r--r--lib/libc/sys/close.2144
-rw-r--r--lib/libc/sys/close.c7
-rw-r--r--lib/libc/sys/closefrom.290
-rw-r--r--lib/libc/sys/closefrom.c5
-rw-r--r--lib/libc/sys/compat-ino64.h101
-rw-r--r--lib/libc/sys/compat-stub.c3
-rw-r--r--lib/libc/sys/connect.2185
-rw-r--r--lib/libc/sys/connect.c8
-rw-r--r--lib/libc/sys/connectat.2109
-rw-r--r--lib/libc/sys/copy_file_range.2212
-rw-r--r--lib/libc/sys/cpuset.2302
-rw-r--r--lib/libc/sys/cpuset_getaffinity.2174
-rw-r--r--lib/libc/sys/cpuset_getdomain.2191
-rw-r--r--lib/libc/sys/creat.c (renamed from lib/libc/compat-43/creat.c)12
-rw-r--r--lib/libc/sys/dup.2171
-rw-r--r--lib/libc/sys/eventfd.2208
-rw-r--r--lib/libc/sys/execve.2379
-rw-r--r--lib/libc/sys/extattr_get_file.2292
-rw-r--r--lib/libc/sys/fcntl.2772
-rw-r--r--lib/libc/sys/fcntl.c9
-rw-r--r--lib/libc/sys/fdatasync.c7
-rw-r--r--lib/libc/sys/ffclock.2177
-rw-r--r--lib/libc/sys/fhlink.2250
-rw-r--r--lib/libc/sys/fhopen.2147
-rw-r--r--lib/libc/sys/fhreadlink.294
-rw-r--r--lib/libc/sys/flock.2173
-rw-r--r--lib/libc/sys/fork.2271
-rw-r--r--lib/libc/sys/fork.c7
-rw-r--r--lib/libc/sys/fspacectl.2205
-rw-r--r--lib/libc/sys/fstat.c53
-rw-r--r--lib/libc/sys/fstatat.c49
-rw-r--r--lib/libc/sys/fstatfs.c53
-rw-r--r--lib/libc/sys/fsync.2134
-rw-r--r--lib/libc/sys/fsync.c7
-rw-r--r--lib/libc/sys/getdents.c10
-rw-r--r--lib/libc/sys/getdirentries.2208
-rw-r--r--lib/libc/sys/getdirentries.c116
-rw-r--r--lib/libc/sys/getdtablesize.262
-rw-r--r--lib/libc/sys/getfh.2223
-rw-r--r--lib/libc/sys/getfsstat.2132
-rw-r--r--lib/libc/sys/getfsstat.c64
-rw-r--r--lib/libc/sys/getgid.285
-rw-r--r--lib/libc/sys/getgroups.2107
-rw-r--r--lib/libc/sys/getitimer.2195
-rw-r--r--lib/libc/sys/getlogin.2204
-rw-r--r--lib/libc/sys/getloginclass.299
-rw-r--r--lib/libc/sys/getpeername.298
-rw-r--r--lib/libc/sys/getpgrp.2142
-rw-r--r--lib/libc/sys/getpid.290
-rw-r--r--lib/libc/sys/getpriority.2150
-rw-r--r--lib/libc/sys/getrandom.2133
-rw-r--r--lib/libc/sys/getrlimit.2238
-rw-r--r--lib/libc/sys/getrusage.2186
-rw-r--r--lib/libc/sys/getsid.282
-rw-r--r--lib/libc/sys/getsockname.298
-rw-r--r--lib/libc/sys/getsockopt.2625
-rw-r--r--lib/libc/sys/gettimeofday.2131
-rw-r--r--lib/libc/sys/gettimeofday.c50
-rw-r--r--lib/libc/sys/getuid.291
-rw-r--r--lib/libc/sys/interposing_table.c94
-rw-r--r--lib/libc/sys/intro.2768
-rw-r--r--lib/libc/sys/ioctl.2155
-rw-r--r--lib/libc/sys/issetugid.298
-rw-r--r--lib/libc/sys/jail.2414
-rw-r--r--lib/libc/sys/kenv.2193
-rw-r--r--lib/libc/sys/kevent.c11
-rw-r--r--lib/libc/sys/kill.2159
-rw-r--r--lib/libc/sys/kldfind.286
-rw-r--r--lib/libc/sys/kldfirstmod.276
-rw-r--r--lib/libc/sys/kldload.296
-rw-r--r--lib/libc/sys/kldnext.289
-rw-r--r--lib/libc/sys/kldstat.2133
-rw-r--r--lib/libc/sys/kldsym.2121
-rw-r--r--lib/libc/sys/kldunload.294
-rw-r--r--lib/libc/sys/kqueue.2860
-rw-r--r--lib/libc/sys/ktrace.2206
-rw-r--r--lib/libc/sys/link.2319
-rw-r--r--lib/libc/sys/lio_listio.2237
-rw-r--r--lib/libc/sys/listen.2193
-rw-r--r--lib/libc/sys/lockf.c (renamed from lib/libc/gen/lockf.c)12
-rw-r--r--lib/libc/sys/lseek.2246
-rw-r--r--lib/libc/sys/lstat.c16
-rw-r--r--lib/libc/sys/madvise.2186
-rw-r--r--lib/libc/sys/mincore.2152
-rw-r--r--lib/libc/sys/minherit.2151
-rw-r--r--lib/libc/sys/mkdir.2182
-rw-r--r--lib/libc/sys/mkfifo.2183
-rw-r--r--lib/libc/sys/mknod.2184
-rw-r--r--lib/libc/sys/mknod.c3
-rw-r--r--lib/libc/sys/mlock.2179
-rw-r--r--lib/libc/sys/mlockall.2146
-rw-r--r--lib/libc/sys/mmap.2568
-rw-r--r--lib/libc/sys/modfind.286
-rw-r--r--lib/libc/sys/modnext.297
-rw-r--r--lib/libc/sys/modstat.2127
-rw-r--r--lib/libc/sys/mount.2403
-rw-r--r--lib/libc/sys/mprotect.2131
-rw-r--r--lib/libc/sys/mq_close.2105
-rw-r--r--lib/libc/sys/mq_getattr.2127
-rw-r--r--lib/libc/sys/mq_notify.2165
-rw-r--r--lib/libc/sys/mq_open.2334
-rw-r--r--lib/libc/sys/mq_receive.2217
-rw-r--r--lib/libc/sys/mq_send.2236
-rw-r--r--lib/libc/sys/mq_setattr.2123
-rw-r--r--lib/libc/sys/mq_unlink.2121
-rw-r--r--lib/libc/sys/msgctl.2208
-rw-r--r--lib/libc/sys/msgget.2154
-rw-r--r--lib/libc/sys/msgrcv.2222
-rw-r--r--lib/libc/sys/msgsnd.2184
-rw-r--r--lib/libc/sys/msync.2126
-rw-r--r--lib/libc/sys/msync.c8
-rw-r--r--lib/libc/sys/munmap.278
-rw-r--r--lib/libc/sys/nanosleep.2205
-rw-r--r--lib/libc/sys/nanosleep.c8
-rw-r--r--lib/libc/sys/nfssvc.2258
-rw-r--r--lib/libc/sys/ntp_adjtime.2315
-rw-r--r--lib/libc/sys/open.2686
-rw-r--r--lib/libc/sys/open.c7
-rw-r--r--lib/libc/sys/openat.c7
-rw-r--r--lib/libc/sys/pathconf.2269
-rw-r--r--lib/libc/sys/pdfork.2188
-rw-r--r--lib/libc/sys/pdfork.c9
-rw-r--r--lib/libc/sys/pipe.2178
-rw-r--r--lib/libc/sys/pipe.c3
-rw-r--r--lib/libc/sys/poll.2294
-rw-r--r--lib/libc/sys/poll.c8
-rw-r--r--lib/libc/sys/posix_fadvise.2143
-rw-r--r--lib/libc/sys/posix_fallocate.2152
-rw-r--r--lib/libc/sys/posix_openpt.2140
-rw-r--r--lib/libc/sys/ppoll.c9
-rw-r--r--lib/libc/sys/procctl.2853
-rw-r--r--lib/libc/sys/profil.2122
-rw-r--r--lib/libc/sys/pselect.2123
-rw-r--r--lib/libc/sys/pselect.c9
-rw-r--r--lib/libc/sys/ptrace.21271
-rw-r--r--lib/libc/sys/quotactl.2263
-rw-r--r--lib/libc/sys/rctl_add_rule.2220
-rw-r--r--lib/libc/sys/read.2310
-rw-r--r--lib/libc/sys/read.c8
-rw-r--r--lib/libc/sys/readlink.2160
-rw-r--r--lib/libc/sys/readv.c8
-rw-r--r--lib/libc/sys/reboot.2164
-rw-r--r--lib/libc/sys/recv.2374
-rw-r--r--lib/libc/sys/recv.c (renamed from lib/libc/net/recv.c)11
-rw-r--r--lib/libc/sys/recvfrom.c10
-rw-r--r--lib/libc/sys/recvmsg.c8
-rw-r--r--lib/libc/sys/rename.2342
-rw-r--r--lib/libc/sys/revoke.2110
-rw-r--r--lib/libc/sys/rfork.2205
-rw-r--r--lib/libc/sys/rmdir.2120
-rw-r--r--lib/libc/sys/rtprio.2201
-rw-r--r--lib/libc/sys/sched_get_priority_max.2123
-rw-r--r--lib/libc/sys/sched_setparam.2174
-rw-r--r--lib/libc/sys/sched_setscheduler.2166
-rw-r--r--lib/libc/sys/sched_yield.258
-rw-r--r--lib/libc/sys/sctp_generic_recvmsg.274
-rw-r--r--lib/libc/sys/sctp_generic_sendmsg.286
-rw-r--r--lib/libc/sys/sctp_peeloff.276
-rw-r--r--lib/libc/sys/select.2228
-rw-r--r--lib/libc/sys/select.c8
-rw-r--r--lib/libc/sys/semctl.2202
-rw-r--r--lib/libc/sys/semget.2156
-rw-r--r--lib/libc/sys/semop.2289
-rw-r--r--lib/libc/sys/send.2295
-rw-r--r--lib/libc/sys/send.c (renamed from lib/libc/net/send.c)11
-rw-r--r--lib/libc/sys/sendfile.2445
-rw-r--r--lib/libc/sys/sendmsg.c8
-rw-r--r--lib/libc/sys/sendto.c10
-rw-r--r--lib/libc/sys/setcontext.c8
-rw-r--r--lib/libc/sys/setfib.2107
-rw-r--r--lib/libc/sys/setgroups.2104
-rw-r--r--lib/libc/sys/setpgid.2110
-rw-r--r--lib/libc/sys/setregid.290
-rw-r--r--lib/libc/sys/setresuid.294
-rw-r--r--lib/libc/sys/setreuid.290
-rw-r--r--lib/libc/sys/setsid.281
-rw-r--r--lib/libc/sys/setuid.2189
-rw-r--r--lib/libc/sys/shm_open.2473
-rw-r--r--lib/libc/sys/shm_open.c98
-rw-r--r--lib/libc/sys/shmat.2156
-rw-r--r--lib/libc/sys/shmctl.2141
-rw-r--r--lib/libc/sys/shmget.2142
-rw-r--r--lib/libc/sys/shutdown.2171
-rw-r--r--lib/libc/sys/sigaction.2795
-rw-r--r--lib/libc/sys/sigaction.c8
-rw-r--r--lib/libc/sys/sigaltstack.2162
-rw-r--r--lib/libc/sys/sigfastblock.2166
-rw-r--r--lib/libc/sys/sigpending.277
-rw-r--r--lib/libc/sys/sigprocmask.2131
-rw-r--r--lib/libc/sys/sigprocmask.c8
-rw-r--r--lib/libc/sys/sigqueue.2163
-rw-r--r--lib/libc/sys/sigreturn.289
-rw-r--r--lib/libc/sys/sigstack.250
-rw-r--r--lib/libc/sys/sigsuspend.285
-rw-r--r--lib/libc/sys/sigsuspend.c8
-rw-r--r--lib/libc/sys/sigtimedwait.c9
-rw-r--r--lib/libc/sys/sigwait.2124
-rw-r--r--lib/libc/sys/sigwait.c24
-rw-r--r--lib/libc/sys/sigwaitinfo.2206
-rw-r--r--lib/libc/sys/sigwaitinfo.c8
-rw-r--r--lib/libc/sys/socket.2351
-rw-r--r--lib/libc/sys/socketpair.2107
-rw-r--r--lib/libc/sys/stat.2492
-rw-r--r--lib/libc/sys/stat.c16
-rw-r--r--lib/libc/sys/statfs.2240
-rw-r--r--lib/libc/sys/statfs.c49
-rw-r--r--lib/libc/sys/swapcontext.c7
-rw-r--r--lib/libc/sys/swapon.2146
-rw-r--r--lib/libc/sys/symlink.2206
-rw-r--r--lib/libc/sys/sync.277
-rw-r--r--lib/libc/sys/sysarch.281
-rw-r--r--lib/libc/sys/syscall.277
-rw-r--r--lib/libc/sys/thr_exit.295
-rw-r--r--lib/libc/sys/thr_kill.2140
-rw-r--r--lib/libc/sys/thr_new.2250
-rw-r--r--lib/libc/sys/thr_self.295
-rw-r--r--lib/libc/sys/thr_set_name.299
-rw-r--r--lib/libc/sys/thr_suspend.2134
-rw-r--r--lib/libc/sys/thr_wake.2117
-rw-r--r--lib/libc/sys/timer_create.2200
-rw-r--r--lib/libc/sys/timer_delete.280
-rw-r--r--lib/libc/sys/timer_settime.2265
-rw-r--r--lib/libc/sys/trivial-vdso_tc.c48
-rw-r--r--lib/libc/sys/truncate.2170
-rw-r--r--lib/libc/sys/umask.288
-rw-r--r--lib/libc/sys/undelete.2107
-rw-r--r--lib/libc/sys/unlink.2284
-rw-r--r--lib/libc/sys/utimensat.2322
-rw-r--r--lib/libc/sys/utimes.2264
-rw-r--r--lib/libc/sys/utrace.280
-rw-r--r--lib/libc/sys/uuidgen.2142
-rw-r--r--lib/libc/sys/vadvise.c3
-rw-r--r--lib/libc/sys/vfork.2145
-rw-r--r--lib/libc/sys/wait.2689
-rw-r--r--lib/libc/sys/wait.c (renamed from lib/libc/gen/wait.c)8
-rw-r--r--lib/libc/sys/wait3.c (renamed from lib/libc/gen/wait3.c)8
-rw-r--r--lib/libc/sys/wait4.c8
-rw-r--r--lib/libc/sys/wait6.c9
-rw-r--r--lib/libc/sys/waitid.c (renamed from lib/libc/gen/waitid.c)9
-rw-r--r--lib/libc/sys/waitpid.c (renamed from lib/libc/gen/waitpid.c)8
-rw-r--r--lib/libc/sys/write.2314
-rw-r--r--lib/libc/sys/write.c8
-rw-r--r--lib/libc/sys/writev.c8
-rw-r--r--lib/libc/tests/Makefile1
-rw-r--r--lib/libc/tests/Makefile.depend1
-rw-r--r--lib/libc/tests/Makefile.netbsd-tests1
-rw-r--r--lib/libc/tests/c063/Makefile1
-rw-r--r--lib/libc/tests/c063/Makefile.depend1
-rw-r--r--lib/libc/tests/db/Makefile1
-rw-r--r--lib/libc/tests/db/Makefile.depend1
-rw-r--r--lib/libc/tests/gen/Makefile1
-rw-r--r--lib/libc/tests/gen/Makefile.depend1
-rw-r--r--lib/libc/tests/gen/arc4random_test.c3
-rw-r--r--lib/libc/tests/gen/dir2_test.c3
-rw-r--r--lib/libc/tests/gen/dlopen_empty_test.c3
-rw-r--r--lib/libc/tests/gen/execve/Makefile1
-rw-r--r--lib/libc/tests/gen/execve/Makefile.depend1
-rw-r--r--lib/libc/tests/gen/fmtcheck_test.c3
-rw-r--r--lib/libc/tests/gen/fmtmsg_test.c3
-rw-r--r--lib/libc/tests/gen/fnmatch_test.c3
-rw-r--r--lib/libc/tests/gen/fnmatch_testcases.h3
-rw-r--r--lib/libc/tests/gen/fpclassify2_test.c2
-rw-r--r--lib/libc/tests/gen/ftw_test.c3
-rw-r--r--lib/libc/tests/gen/getentropy_test.c5
-rw-r--r--lib/libc/tests/gen/getmntinfo_test.c3
-rw-r--r--lib/libc/tests/gen/glob2_test.c3
-rw-r--r--lib/libc/tests/gen/makecontext_test.c5
-rw-r--r--lib/libc/tests/gen/popen_test.c3
-rw-r--r--lib/libc/tests/gen/posix_spawn/Makefile1
-rw-r--r--lib/libc/tests/gen/posix_spawn/Makefile.depend1
-rw-r--r--lib/libc/tests/gen/posix_spawn_test.c12
-rw-r--r--lib/libc/tests/gen/realpath2_test.c3
-rw-r--r--lib/libc/tests/gen/sigsetops_test.c5
-rwxr-xr-xlib/libc/tests/gen/spawnp_enoexec.sh1
-rw-r--r--lib/libc/tests/gen/test-fnmatch.c3
-rw-r--r--lib/libc/tests/gen/wordexp_test.c3
-rw-r--r--lib/libc/tests/hash/Makefile1
-rw-r--r--lib/libc/tests/hash/Makefile.depend1
-rw-r--r--lib/libc/tests/iconv/Makefile1
-rw-r--r--lib/libc/tests/iconv/Makefile.depend1
-rw-r--r--lib/libc/tests/iconv/iconvctl_test.c3
-rw-r--r--lib/libc/tests/inet/Makefile1
-rw-r--r--lib/libc/tests/inet/Makefile.depend1
-rw-r--r--lib/libc/tests/locale/Makefile2
-rw-r--r--lib/libc/tests/locale/Makefile.depend1
-rw-r--r--lib/libc/tests/locale/btowc_test.c3
-rw-r--r--lib/libc/tests/locale/c16rtomb_test.c3
-rw-r--r--lib/libc/tests/locale/iswctype_test.c3
-rw-r--r--lib/libc/tests/locale/mblen_test.c3
-rw-r--r--lib/libc/tests/locale/mbrlen_test.c3
-rw-r--r--lib/libc/tests/locale/mbrtoc16_test.c3
-rw-r--r--lib/libc/tests/locale/mbrtowc_test.c3
-rw-r--r--lib/libc/tests/locale/mbsnrtowcs_test.c3
-rw-r--r--lib/libc/tests/locale/mbsrtowcs_test.c3
-rw-r--r--lib/libc/tests/locale/mbstowcs_test.c3
-rw-r--r--lib/libc/tests/locale/mbtowc_test.c3
-rw-r--r--lib/libc/tests/locale/newlocale_test.c111
-rw-r--r--lib/libc/tests/locale/towctrans_test.c3
-rw-r--r--lib/libc/tests/locale/wcrtomb_test.c3
-rw-r--r--lib/libc/tests/locale/wcsnrtombs_test.c3
-rw-r--r--lib/libc/tests/locale/wcsrtombs_test.c3
-rw-r--r--lib/libc/tests/locale/wcstombs_test.c3
-rw-r--r--lib/libc/tests/locale/wctomb_test.c3
-rw-r--r--lib/libc/tests/net/Makefile1
-rw-r--r--lib/libc/tests/net/Makefile.depend1
-rw-r--r--lib/libc/tests/net/ether_test.c2
-rw-r--r--lib/libc/tests/net/eui64_aton_test.c2
-rw-r--r--lib/libc/tests/net/eui64_ntoa_test.c2
-rw-r--r--lib/libc/tests/net/getaddrinfo/Makefile3
-rw-r--r--lib/libc/tests/net/test-eui64.h2
-rw-r--r--lib/libc/tests/nss/Makefile1
-rw-r--r--lib/libc/tests/nss/Makefile.depend1
-rw-r--r--lib/libc/tests/nss/getaddrinfo_test.c3
-rw-r--r--lib/libc/tests/nss/getgr_test.c3
-rw-r--r--lib/libc/tests/nss/gethostby_test.c3
-rw-r--r--lib/libc/tests/nss/getproto_test.c3
-rw-r--r--lib/libc/tests/nss/getpw_test.c3
-rw-r--r--lib/libc/tests/nss/getrpc_test.c3
-rw-r--r--lib/libc/tests/nss/getserv_test.c3
-rw-r--r--lib/libc/tests/nss/getusershell_test.c3
-rw-r--r--lib/libc/tests/nss/testutil.h2
-rw-r--r--lib/libc/tests/regex/Makefile1
-rw-r--r--lib/libc/tests/regex/Makefile.depend1
-rw-r--r--lib/libc/tests/regex/Makefile.inc1
-rwxr-xr-xlib/libc/tests/regex/multibyte.sh44
-rw-r--r--lib/libc/tests/resolv/Makefile1
-rw-r--r--lib/libc/tests/resolv/Makefile.depend1
-rw-r--r--lib/libc/tests/resolv/mach1
-rw-r--r--lib/libc/tests/resolv/resolv_test.c1
-rw-r--r--lib/libc/tests/rpc/Makefile1
-rw-r--r--lib/libc/tests/rpc/Makefile.depend1
-rw-r--r--lib/libc/tests/setjmp/Makefile1
-rw-r--r--lib/libc/tests/setjmp/Makefile.depend1
-rw-r--r--lib/libc/tests/ssp/Makefile4
-rw-r--r--lib/libc/tests/ssp/Makefile.depend1
-rw-r--r--lib/libc/tests/stdio/Makefile16
-rw-r--r--lib/libc/tests/stdio/Makefile.depend1
-rw-r--r--lib/libc/tests/stdio/eintr_test.c143
-rw-r--r--lib/libc/tests/stdio/fdopen_test.c3
-rw-r--r--lib/libc/tests/stdio/flushlbuf_test.c155
-rw-r--r--lib/libc/tests/stdio/fmemopen2_test.c3
-rw-r--r--lib/libc/tests/stdio/fopen_test.c3
-rw-r--r--lib/libc/tests/stdio/freopen_test.c3
-rw-r--r--lib/libc/tests/stdio/getdelim_test.c3
-rw-r--r--lib/libc/tests/stdio/gets_s_test.c3
-rw-r--r--lib/libc/tests/stdio/mkostemp_test.c3
-rw-r--r--lib/libc/tests/stdio/open_memstream2_test.c3
-rw-r--r--lib/libc/tests/stdio/open_wmemstream_test.c3
-rw-r--r--lib/libc/tests/stdio/perror_test.c3
-rw-r--r--lib/libc/tests/stdio/print_positional_test.c3
-rw-r--r--lib/libc/tests/stdio/printbasic_test.c3
-rw-r--r--lib/libc/tests/stdio/printfloat_test.c3
-rw-r--r--lib/libc/tests/stdio/scanfloat_test.c3
-rw-r--r--lib/libc/tests/stdio/snprintf_test.c205
-rw-r--r--lib/libc/tests/stdio/sscanf_test.c331
-rw-r--r--lib/libc/tests/stdio/swprintf_test.c206
-rw-r--r--lib/libc/tests/stdio/swscanf_test.c334
-rw-r--r--lib/libc/tests/stdlib/Makefile13
-rw-r--r--lib/libc/tests/stdlib/Makefile.depend1
-rw-r--r--lib/libc/tests/stdlib/clearenv_test.c173
-rw-r--r--lib/libc/tests/stdlib/cxa_thread_atexit_nothr_test.cc3
-rw-r--r--lib/libc/tests/stdlib/cxa_thread_atexit_test.cc3
-rw-r--r--lib/libc/tests/stdlib/dynthr_mod/Makefile2
-rw-r--r--lib/libc/tests/stdlib/dynthr_mod/dynthr_mod.c4
-rw-r--r--lib/libc/tests/stdlib/dynthr_test.c3
-rw-r--r--lib/libc/tests/stdlib/heapsort_test.c3
-rw-r--r--lib/libc/tests/stdlib/mergesort_test.c3
-rw-r--r--lib/libc/tests/stdlib/qsort_b_test.c (renamed from lib/libc/mips/gen/signalcontext.c)65
-rw-r--r--lib/libc/tests/stdlib/qsort_r_compat_test.c (renamed from lib/libc/amd64/sys/amd64_get_gsbase.c)76
-rw-r--r--lib/libc/tests/stdlib/qsort_r_test.c9
-rw-r--r--lib/libc/tests/stdlib/qsort_s_test.c3
-rw-r--r--lib/libc/tests/stdlib/qsort_test.c3
-rw-r--r--lib/libc/tests/stdlib/quick_exit_test.c81
-rw-r--r--lib/libc/tests/stdlib/set_constraint_handler_s_test.c3
-rw-r--r--lib/libc/tests/stdlib/strfmon_test.c191
-rw-r--r--lib/libc/tests/stdlib/test-sort.h2
-rw-r--r--lib/libc/tests/stdlib/tsearch_test.c3
-rw-r--r--lib/libc/tests/string/Makefile29
-rw-r--r--lib/libc/tests/string/Makefile.depend1
-rw-r--r--lib/libc/tests/string/bcmp_test.c (renamed from lib/libc/powerpc64/gen/_set_tp.c)23
-rw-r--r--lib/libc/tests/string/ffs_test.c87
-rw-r--r--lib/libc/tests/string/ffsl_test.c32
-rw-r--r--lib/libc/tests/string/ffsll_test.c32
-rw-r--r--lib/libc/tests/string/fls_test.c87
-rw-r--r--lib/libc/tests/string/flsl_test.c32
-rw-r--r--lib/libc/tests/string/flsll_test.c32
-rw-r--r--lib/libc/tests/string/memccpy_test.c205
-rw-r--r--lib/libc/tests/string/memcmp_test.c90
-rw-r--r--lib/libc/tests/string/memrchr_test.c116
-rw-r--r--lib/libc/tests/string/memset_s_test.c3
-rw-r--r--lib/libc/tests/string/stpncpy_test.c115
-rw-r--r--lib/libc/tests/string/strcmp_test.c132
-rw-r--r--lib/libc/tests/string/strcspn_test.c269
-rw-r--r--lib/libc/tests/string/strerror_test.c2
-rw-r--r--lib/libc/tests/string/strlcpy_test.c183
-rw-r--r--lib/libc/tests/string/strncmp_test.c165
-rw-r--r--lib/libc/tests/string/strspn_test.c30
-rw-r--r--lib/libc/tests/string/strverscmp_test.c93
-rw-r--r--lib/libc/tests/string/strxfrm_test.c3
-rw-r--r--lib/libc/tests/string/timingsafe_bcmp_test.c (renamed from lib/libc/aarch64/sys/syscall.S)21
-rw-r--r--lib/libc/tests/string/timingsafe_memcmp_test.c32
-rw-r--r--lib/libc/tests/string/wcscasecmp_test.c3
-rw-r--r--lib/libc/tests/string/wcscoll_test.c3
-rw-r--r--lib/libc/tests/string/wcsnlen_test.c16
-rw-r--r--lib/libc/tests/sys/Makefile9
-rw-r--r--lib/libc/tests/sys/Makefile.depend1
-rw-r--r--lib/libc/tests/sys/brk_test.c5
-rw-r--r--lib/libc/tests/sys/cpuset_test.c3
-rw-r--r--lib/libc/tests/sys/errno_test.c36
-rw-r--r--lib/libc/tests/sys/mlock_helper.c3
-rw-r--r--lib/libc/tests/sys/queue_test.c3
-rw-r--r--lib/libc/tests/sys/sendfile_test.c59
-rw-r--r--lib/libc/tests/termios/Makefile1
-rw-r--r--lib/libc/tests/termios/Makefile.depend1
-rw-r--r--lib/libc/tests/time/Makefile1
-rw-r--r--lib/libc/tests/time/Makefile.depend1
-rw-r--r--lib/libc/tests/tls/Makefile1
-rw-r--r--lib/libc/tests/tls/Makefile.depend1
-rw-r--r--lib/libc/tests/tls/dso/Makefile2
-rw-r--r--lib/libc/tests/tls/dso/Makefile.depend1
-rw-r--r--lib/libc/tests/tls_dso/Makefile2
-rw-r--r--lib/libc/tests/tls_dso/Makefile.depend1
-rw-r--r--lib/libc/tests/ttyio/Makefile1
-rw-r--r--lib/libc/tests/ttyio/Makefile.depend1
-rw-r--r--lib/libc/uuid/Makefile.inc1
-rw-r--r--lib/libc/uuid/Symbol.map4
-rw-r--r--lib/libc/uuid/uuid.375
-rw-r--r--lib/libc/uuid/uuid_compare.c4
-rw-r--r--lib/libc/uuid/uuid_create.c4
-rw-r--r--lib/libc/uuid/uuid_create_nil.c4
-rw-r--r--lib/libc/uuid/uuid_equal.c4
-rw-r--r--lib/libc/uuid/uuid_from_string.c4
-rw-r--r--lib/libc/uuid/uuid_hash.c4
-rw-r--r--lib/libc/uuid/uuid_is_nil.c4
-rw-r--r--lib/libc/uuid/uuid_stream.c5
-rw-r--r--lib/libc/uuid/uuid_to_string.c4
-rw-r--r--lib/libc/x86/gen/Makefile.inc1
-rw-r--r--lib/libc/x86/gen/getcontextx.c5
-rw-r--r--lib/libc/x86/sys/Makefile.inc22
-rw-r--r--lib/libc/x86/sys/__vdso_gettc.c423
-rw-r--r--lib/libc/x86/sys/pkru.3206
-rw-r--r--lib/libc/x86/sys/pkru.c138
-rw-r--r--lib/libc/xdr/Makefile.inc19
-rw-r--r--lib/libc/xdr/Symbol.map4
-rw-r--r--lib/libc/xdr/xdr.32
-rw-r--r--lib/libc/xdr/xdr.c17
-rw-r--r--lib/libc/xdr/xdr_array.c7
-rw-r--r--lib/libc/xdr/xdr_float.c7
-rw-r--r--lib/libc/xdr/xdr_mem.c7
-rw-r--r--lib/libc/xdr/xdr_rec.c15
-rw-r--r--lib/libc/xdr/xdr_reference.c9
-rw-r--r--lib/libc/xdr/xdr_sizeof.c3
-rw-r--r--lib/libc/xdr/xdr_stdio.c7
-rw-r--r--lib/libc/yp/Makefile.inc2
-rw-r--r--lib/libc/yp/Symbol.map4
-rw-r--r--lib/libc/yp/xdryp.c5
-rw-r--r--lib/libc/yp/yplib.c11
2415 files changed, 15171 insertions, 66293 deletions
diff --git a/lib/libc/Makefile b/lib/libc/Makefile
index fdf6aa49932b..674986a7e065 100644
--- a/lib/libc/Makefile
+++ b/lib/libc/Makefile
@@ -1,22 +1,20 @@
-# @(#)Makefile 8.2 (Berkeley) 2/3/94
-# $FreeBSD$
PACKAGE= clibs
SHLIBDIR?= /lib
.include <src.opts.mk>
-# Force building of libc_pic.a
-MK_TOOLCHAIN= yes
-
LIBC_SRCTOP?= ${.CURDIR}
-
-# Pick the current architecture directory for libc. In general, this is
-# named MACHINE_CPUARCH, but some ABIs are different enough to require
-# their own libc, so allow a directory named MACHINE_ARCH to override this.
-
-.if exists(${LIBC_SRCTOP}/${MACHINE_ARCH:S/powerpc64le/powerpc64/})
-LIBC_ARCH=${MACHINE_ARCH:S/powerpc64le/powerpc64/}
+LIBSYS_SRCTOP?= ${.CURDIR:H}/libsys
+
+# Pick the current architecture directory for libc. In general, this is named
+# MACHINE_CPUARCH, but some ABIs are different enough to require their own libc,
+# so allow a directory named MACHINE_ARCH to override this (though treat
+# powerpc64le and powerpc64 the same).
+# Note: This is copied to msun/Makefile
+M=${MACHINE_ARCH:S/powerpc64le/powerpc64/}
+.if exists(${LIBC_SRCTOP}/${M})
+LIBC_ARCH=${M}
.else
LIBC_ARCH=${MACHINE_CPUARCH}
.endif
@@ -32,7 +30,7 @@ CFLAGS+=-DNO__SCCSID -DNO__RCSID
LIB=c
SHLIB_MAJOR= 7
.if ${MK_SSP} != "no" && \
- (${LIBC_ARCH} == "i386" || ${MACHINE_ARCH:Mpower*} != "")
+ (${LIBC_ARCH} == "i386" || ${LIBC_ARCH:Mpowerpc*} != "")
SHLIB_LDSCRIPT=libc.ldscript
.else
SHLIB_LDSCRIPT=libc_nossp.ldscript
@@ -41,6 +39,7 @@ SHLIB_LDSCRIPT_LINKS=libxnet.so
WARNS?= 2
CFLAGS+=-I${LIBC_SRCTOP}/include -I${SRCTOP}/include
CFLAGS+=-I${LIBC_SRCTOP}/${LIBC_ARCH}
+CFLAGS+=-I${LIBSYS_SRCTOP}/${LIBC_ARCH}
.if ${MK_NLS} != "no"
CFLAGS+=-DNLS
.endif
@@ -56,19 +55,24 @@ CFLAGS+=${CANCELPOINTS_CFLAGS}
# Use a more efficient TLS model for libc since we can reasonably assume that
# it will be loaded during program startup.
-.if ${LIBC_ARCH} == "aarch64" || ${LIBC_ARCH} == "amd64" || \
- ${LIBC_ARCH} == "i386" || ${LIBC_ARCH} == "riscv"
CFLAGS+= -ftls-model=initial-exec
-.endif
#
# Link with static libcompiler_rt.a.
#
LDFLAGS+= -nodefaultlibs
LIBADD+= compiler_rt
+LIBADD+= sys
+.if defined(COMPAT_libcompat)
+# XXX: work around gcc -m32 + bfd ld path issue for DT_NEEDED symbols.
+# https://sourceware.org/bugzilla/show_bug.cgi?id=31395
+LDFLAGS+= -Wl,--rpath=/usr/lib${COMPAT_libcompat}
+.endif
+
+LDFLAGS+=-Wl,--auxiliary,libsys.so.7
.if ${MK_SSP} != "no" && \
- (${LIBC_ARCH} == "i386" || ${MACHINE_ARCH:Mpower*} != "")
+ (${LIBC_ARCH} == "i386" || ${LIBC_ARCH:Mpowerpc*} != "")
LIBADD+= ssp_nonshared
.endif
@@ -92,6 +96,7 @@ MIASM=
NOASM=
.include "${LIBC_SRCTOP}/${LIBC_ARCH}/Makefile.inc"
+.include "${LIBC_SRCTOP}/csu/Makefile.inc"
.include "${LIBC_SRCTOP}/db/Makefile.inc"
.include "${LIBC_SRCTOP}/compat-43/Makefile.inc"
.include "${LIBC_SRCTOP}/gdtoa/Makefile.inc"
@@ -108,19 +113,13 @@ NOASM=
.include "${LIBC_SRCTOP}/net/Makefile.inc"
.include "${LIBC_SRCTOP}/nls/Makefile.inc"
.include "${LIBC_SRCTOP}/posix1e/Makefile.inc"
-.if ${LIBC_ARCH} != "aarch64" && \
- ${LIBC_ARCH} != "amd64" && \
- ${LIBC_ARCH} != "powerpc64" && \
- ${LIBC_ARCH} != "riscv" && \
- ${MACHINE_ARCH:Mmipsn32*} == "" && \
- ${MACHINE_ARCH:Mmips64*} == ""
+.if ${MACHINE_ABI:Mlong32}
.include "${LIBC_SRCTOP}/quad/Makefile.inc"
.endif
.include "${LIBC_SRCTOP}/regex/Makefile.inc"
.include "${LIBC_SRCTOP}/resolv/Makefile.inc"
.include "${LIBC_SRCTOP}/stdio/Makefile.inc"
.include "${LIBC_SRCTOP}/stdlib/Makefile.inc"
-.include "${LIBC_SRCTOP}/stdlib/jemalloc/Makefile.inc"
.include "${LIBC_SRCTOP}/stdtime/Makefile.inc"
.include "${LIBC_SRCTOP}/string/Makefile.inc"
.include "${LIBC_SRCTOP}/sys/Makefile.inc"
@@ -128,14 +127,10 @@ NOASM=
.include "${LIBC_SRCTOP}/rpc/Makefile.inc"
.include "${LIBC_SRCTOP}/uuid/Makefile.inc"
.include "${LIBC_SRCTOP}/xdr/Makefile.inc"
-.if (${LIBC_ARCH} == "arm" && \
- (${MACHINE_ARCH:Marmv[67]*} == "" || (defined(CPUTYPE) && ${CPUTYPE:M*soft*}))) || \
- (${LIBC_ARCH} == "mips" && ${MACHINE_ARCH:Mmips*hf} == "") || \
- (${LIBC_ARCH} == "riscv" && ${MACHINE_ARCH:Mriscv*sf} != "")
+.if (${LIBC_ARCH} == "arm" && (defined(CPUTYPE) && ${CPUTYPE:M*soft*}))
.include "${LIBC_SRCTOP}/softfloat/Makefile.inc"
.endif
.if ${LIBC_ARCH} == "i386" || ${LIBC_ARCH} == "amd64"
-.include "${LIBC_SRCTOP}/x86/sys/Makefile.inc"
.include "${LIBC_SRCTOP}/x86/gen/Makefile.inc"
.endif
.if ${MK_NIS} != "no"
@@ -160,11 +155,10 @@ STATICOBJS+=${LIBC_NONSHARED_SRCS:S/.c$/.o/}
VERSION_DEF=${LIBC_SRCTOP}/Versions.def
SYMBOL_MAPS=${SYM_MAPS}
-CFLAGS+= -DSYMBOL_VERSIONING
# If there are no machine dependent sources, append all the
# machine-independent sources:
-.if empty(MDSRCS)
+.if empty(MDSRCS) || ${MK_MACHDEP_OPTIMIZATIONS} == no
SRCS+= ${MISRCS}
.else
# Append machine-dependent sources, then append machine-independent sources
diff --git a/lib/libc/Makefile.depend b/lib/libc/Makefile.depend
index 3f0d19343f93..69e7d1f9c9fd 100644
--- a/lib/libc/Makefile.depend
+++ b/lib/libc/Makefile.depend
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
@@ -7,6 +6,7 @@ DIRDEPS = \
include/rpcsvc \
lib/${CSU_DIR} \
lib/libcompiler_rt \
+ usr.bin/awk.host \
usr.bin/yacc.host \
diff --git a/lib/libc/Makefile.depend.options b/lib/libc/Makefile.depend.options
index ff00fa428df2..dd18153daebb 100644
--- a/lib/libc/Makefile.depend.options
+++ b/lib/libc/Makefile.depend.options
@@ -1,4 +1,3 @@
-# $FreeBSD$
# This file is not autogenerated - take care!
DIRDEPS_OPTIONS= SSP
diff --git a/lib/libc/Versions.def b/lib/libc/Versions.def
index fea6693cee8a..184e107d225a 100644
--- a/lib/libc/Versions.def
+++ b/lib/libc/Versions.def
@@ -1,4 +1,3 @@
-# $FreeBSD$
#
# Note: Whenever bumping the FBSD version, always make
@@ -35,9 +34,14 @@ FBSD_1.5 {
FBSD_1.6 {
} FBSD_1.5;
+# This version was first added to 14.0-current.
FBSD_1.7 {
} FBSD_1.6;
+# This version was first added to 15.0-current.
+FBSD_1.8 {
+} FBSD_1.7;
+
# This is our private namespace. Any global interfaces that are
# strictly for use only by other FreeBSD applications and libraries
# are listed here. We use a separate namespace so we can write
@@ -45,4 +49,4 @@ FBSD_1.7 {
#
# Please do NOT increment the version of this namespace.
FBSDprivate_1.0 {
-} FBSD_1.7;
+} FBSD_1.8;
diff --git a/lib/libc/aarch64/Makefile.inc b/lib/libc/aarch64/Makefile.inc
index f059154cd4c0..be880c6dc1c9 100644
--- a/lib/libc/aarch64/Makefile.inc
+++ b/lib/libc/aarch64/Makefile.inc
@@ -1,4 +1,3 @@
-# $FreeBSD$
#
# Machine dependent definitions for the arm 64-bit architecture.
#
diff --git a/lib/libc/aarch64/SYS.h b/lib/libc/aarch64/SYS.h
deleted file mode 100644
index 2cefc8c123d6..000000000000
--- a/lib/libc/aarch64/SYS.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*-
- * Copyright (c) 2014 Andrew Turner
- * Copyright (c) 2015 The FreeBSD Foundation
- * All rights reserved.
- *
- * This software was developed by Andrew Turner under
- * sponsorship from the FreeBSD Foundation.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- *
- * $FreeBSD$
- */
-
-#include <sys/syscall.h>
-#include <machine/asm.h>
-
-#define _SYSCALL(name) \
- mov x8, SYS_ ## name; \
- svc 0
-
-#define SYSCALL(name) \
-ENTRY(__sys_##name); \
- WEAK_REFERENCE(__sys_##name, name); \
- WEAK_REFERENCE(__sys_##name, _##name); \
- _SYSCALL(name); \
- ret; \
-END(__sys_##name)
-
-/*
- * Conditional jumps can only go up to one megabyte in either
- * direction, and cerror can be located anywhere, so we have
- * to jump around to use more capable unconditional branch
- * instruction.
- */
-#define PSEUDO(name) \
-ENTRY(__sys_##name); \
- WEAK_REFERENCE(__sys_##name, _##name); \
- _SYSCALL(name); \
- b.cs 1f; \
- ret; \
-1: b cerror; \
-END(__sys_##name)
-
-#define RSYSCALL(name) \
-ENTRY(__sys_##name); \
- WEAK_REFERENCE(__sys_##name, name); \
- WEAK_REFERENCE(__sys_##name, _##name); \
- _SYSCALL(name); \
- b.cs 1f; \
- ret; \
-1: b cerror; \
-END(__sys_##name)
diff --git a/lib/libc/aarch64/Symbol.map b/lib/libc/aarch64/Symbol.map
index d9121798140c..cb4669039942 100644
--- a/lib/libc/aarch64/Symbol.map
+++ b/lib/libc/aarch64/Symbol.map
@@ -1,37 +1,11 @@
/*
- * $FreeBSD$
- */
-
-/*
* This only needs to contain symbols that are not listed in
* symbol maps from other parts of libc (i.e., not found in
* stdlib/Symbol.map, string/Symbol.map, sys/Symbol.map, ...).
*/
FBSD_1.0 {
- /* PSEUDO syscalls */
- _exit;
-
- _setjmp;
- _longjmp;
- fabs;
+ .mcount;
__flt_rounds;
fpgetmask;
fpsetmask;
- __infinity;
- __nan;
- setjmp;
- longjmp;
- sigsetjmp;
- siglongjmp;
- htonl;
- htons;
- ntohl;
- ntohs;
- vfork;
- makecontext;
-};
-
-FBSDprivate_1.0 {
- _set_tp;
- __makecontext;
};
diff --git a/lib/libc/aarch64/_fpmath.h b/lib/libc/aarch64/_fpmath.h
index 71d0a715233f..019172578899 100644
--- a/lib/libc/aarch64/_fpmath.h
+++ b/lib/libc/aarch64/_fpmath.h
@@ -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$
*/
union IEEEl2bits {
diff --git a/lib/libc/aarch64/arith.h b/lib/libc/aarch64/arith.h
index ecb1a33fccb0..9c695c74a33e 100644
--- a/lib/libc/aarch64/arith.h
+++ b/lib/libc/aarch64/arith.h
@@ -1,7 +1,5 @@
/*
* MD header for contrib/gdtoa
- *
- * $FreeBSD$
*/
/*
diff --git a/lib/libc/aarch64/gd_qnan.h b/lib/libc/aarch64/gd_qnan.h
index 27e8d5811b7e..d4e3baeed108 100644
--- a/lib/libc/aarch64/gd_qnan.h
+++ b/lib/libc/aarch64/gd_qnan.h
@@ -3,8 +3,6 @@
*
* This file can be generated by compiling and running contrib/gdtoa/qnan.c
* on the target architecture after arith.h has been generated.
- *
- * $FreeBSD$
*/
#define f_QNAN 0x7fc00000
diff --git a/lib/libc/aarch64/gen/Makefile.inc b/lib/libc/aarch64/gen/Makefile.inc
index 7c530b93b4e4..4f4fb3d199bf 100644
--- a/lib/libc/aarch64/gen/Makefile.inc
+++ b/lib/libc/aarch64/gen/Makefile.inc
@@ -1,4 +1,3 @@
-# $FreeBSD$
CFLAGS+= -DNO_COMPAT7
@@ -7,12 +6,10 @@ SRCS+= _ctx_start.S \
flt_rounds.c \
fpgetmask.c \
fpsetmask.c \
- _get_tp.c \
+ getcontextx.c \
infinity.c \
ldexp.c \
makecontext.c \
_setjmp.S \
- _set_tp.c \
setjmp.S \
- sigsetjmp.S \
- trivial-getcontextx.c
+ sigsetjmp.S
diff --git a/lib/libc/aarch64/gen/_ctx_start.S b/lib/libc/aarch64/gen/_ctx_start.S
index 8664f69667c3..a4049e6c241a 100644
--- a/lib/libc/aarch64/gen/_ctx_start.S
+++ b/lib/libc/aarch64/gen/_ctx_start.S
@@ -1,6 +1,5 @@
/*-
* Copyright (c) 2015 The FreeBSD Foundation
- * All rights reserved.
*
* This software was developed by Andrew Turner under
* sponsorship from the FreeBSD Foundation.
@@ -28,7 +27,7 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
+#include <sys/elf_common.h>
ENTRY(_ctx_start)
blr x19 /* Call func from makecontext */
@@ -36,3 +35,5 @@ ENTRY(_ctx_start)
bl _C_LABEL(ctx_done)
bl _C_LABEL(abort)
END(_ctx_start)
+
+GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
diff --git a/lib/libc/aarch64/gen/_set_tp.c b/lib/libc/aarch64/gen/_set_tp.c
deleted file mode 100644
index 871acb3001a3..000000000000
--- a/lib/libc/aarch64/gen/_set_tp.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*-
- * Copyright (c) 2014 Andrew Turner
- * All rights reserved.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <string.h>
-#include <sys/types.h>
-
-#include <machine/sysarch.h>
-
-#include <stdlib.h>
-#include "libc_private.h"
-
-void
-_set_tp(void *tp)
-{
-
- asm volatile("msr tpidr_el0, %0" : : "r"(tp));
-}
diff --git a/lib/libc/aarch64/gen/_setjmp.S b/lib/libc/aarch64/gen/_setjmp.S
index ae00195d3ff7..037eccf1a48a 100644
--- a/lib/libc/aarch64/gen/_setjmp.S
+++ b/lib/libc/aarch64/gen/_setjmp.S
@@ -1,7 +1,6 @@
/*-
* Copyright (c) 2014 Andrew Turner
* Copyright (c) 2014 The FreeBSD Foundation
- * All rights reserved.
*
* Portions of this software were developed by Andrew Turner
* under sponsorship from the FreeBSD Foundation
@@ -30,9 +29,8 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
#include <machine/setjmp.h>
+#include <sys/elf_common.h>
ENTRY(_setjmp)
/* Store the magic value and stack pointer */
@@ -92,7 +90,8 @@ ENTRY(_longjmp)
#endif
/* Load the return value */
- mov x0, x1
+ cmp x1, #0
+ csinc x0, x1, xzr, ne
ret
botch:
@@ -103,3 +102,5 @@ botch:
bl _C_LABEL(abort)
#endif
END(_longjmp)
+
+GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
diff --git a/lib/libc/aarch64/gen/fabs.S b/lib/libc/aarch64/gen/fabs.S
index 2f5fd06dec6c..91967a10299b 100644
--- a/lib/libc/aarch64/gen/fabs.S
+++ b/lib/libc/aarch64/gen/fabs.S
@@ -1,6 +1,5 @@
/*-
* Copyright (c) 2015 The FreeBSD Foundation
- * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -25,9 +24,11 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
+#include <sys/elf_common.h>
ENTRY(fabs)
fabs d0, d0
ret
END(fabs)
+
+GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
diff --git a/lib/libc/aarch64/gen/flt_rounds.c b/lib/libc/aarch64/gen/flt_rounds.c
index 6f8eeebbad80..b62536aafaf8 100644
--- a/lib/libc/aarch64/gen/flt_rounds.c
+++ b/lib/libc/aarch64/gen/flt_rounds.c
@@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <fenv.h>
diff --git a/lib/libc/aarch64/gen/fpgetmask.c b/lib/libc/aarch64/gen/fpgetmask.c
index afc05b479a44..b6f398d202f5 100644
--- a/lib/libc/aarch64/gen/fpgetmask.c
+++ b/lib/libc/aarch64/gen/fpgetmask.c
@@ -1,6 +1,5 @@
/*-
* Copyright (c) 2015 The FreeBSD Foundation
- * All rights reserved.
*
* This software was developed by Andrew Turner under
* sponsorship from the FreeBSD Foundation.
@@ -27,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <ieeefp.h>
diff --git a/lib/libc/aarch64/gen/fpsetmask.c b/lib/libc/aarch64/gen/fpsetmask.c
index de9ac043b472..4bc72913a8b9 100644
--- a/lib/libc/aarch64/gen/fpsetmask.c
+++ b/lib/libc/aarch64/gen/fpsetmask.c
@@ -1,6 +1,5 @@
/*-
* Copyright (c) 2015 The FreeBSD Foundation
- * All rights reserved.
*
* This software was developed by Andrew Turner under
* sponsorship from the FreeBSD Foundation.
@@ -27,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <ieeefp.h>
diff --git a/lib/libc/i386/string/ffs.S b/lib/libc/aarch64/gen/getcontextx.c
index 3a0431c6a845..9972d3208d08 100644
--- a/lib/libc/i386/string/ffs.S
+++ b/lib/libc/aarch64/gen/getcontextx.c
@@ -1,20 +1,16 @@
/*
- * Copyright (c) 1993 Winning Strategies, Inc.
+ * Copyright (c) 2011 Konstantin Belousov <kib@FreeBSD.org>
* All rights reserved.
*
* 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Winning Strategies, Inc.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@@ -28,29 +24,66 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
+#include <sys/types.h>
+#include <sys/ucontext.h>
+#include <errno.h>
+#include <stdlib.h>
-/*
- * ffs(value)
- * finds the first bit set in value and returns the index of
- * that bit. Bits are numbered starting from 1, starting at the
- * rightmost bit. A return value of 0 means that the argument
- * was zero.
- *
- * Written by:
- * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
- */
+int
+__getcontextx_size(void)
+{
+ size_t size;
+
+ size = sizeof(ucontext_t);
+ size += sizeof(struct arm64_reg_context); /* Space for ARM64_CTX_END */
+
+ return (size);
+}
+
+int
+__fillcontextx2(char *ctx)
+{
+ struct arm64_reg_context *reg_ctx;
+ ucontext_t *ucp;
+
+ ucp = (ucontext_t *)ctx;
+ ucp->uc_mcontext.mc_ptr = (uint64_t)(ucp + 1);
+
+ reg_ctx = (struct arm64_reg_context *)ucp->uc_mcontext.mc_ptr;
+ reg_ctx->ctx_id = ARM64_CTX_END;
+ reg_ctx->ctx_size = sizeof(struct arm64_reg_context);
+
+ return (0);
+}
+
+int
+__fillcontextx(char *ctx)
+{
+ ucontext_t *ucp;
+
+ ucp = (ucontext_t *)ctx;
+ if (getcontext(ucp) == -1)
+ return (-1);
+ __fillcontextx2(ctx);
+ return (0);
+}
-ENTRY(ffs)
- bsfl 4(%esp),%eax
- jz L1 /* ZF is set if all bits are 0 */
- incl %eax /* bits numbered from 1, not 0 */
- ret
+__weak_reference(__getcontextx, getcontextx);
- .align 2
-L1: xorl %eax,%eax /* clear result */
- ret
-END(ffs)
+ucontext_t *
+__getcontextx(void)
+{
+ char *ctx;
+ int error;
- .section .note.GNU-stack,"",%progbits
+ ctx = malloc(__getcontextx_size());
+ if (ctx == NULL)
+ return (NULL);
+ if (__fillcontextx(ctx) == -1) {
+ error = errno;
+ free(ctx);
+ errno = error;
+ return (NULL);
+ }
+ return ((ucontext_t *)ctx);
+}
diff --git a/lib/libc/aarch64/gen/infinity.c b/lib/libc/aarch64/gen/infinity.c
index c96045e581b6..b7688798765f 100644
--- a/lib/libc/aarch64/gen/infinity.c
+++ b/lib/libc/aarch64/gen/infinity.c
@@ -2,9 +2,6 @@
* infinity.c
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <math.h>
/* bytes for +Infinity on aarch64 */
diff --git a/lib/libc/aarch64/gen/makecontext.c b/lib/libc/aarch64/gen/makecontext.c
index 747d2c53b198..8c9b4edd7a15 100644
--- a/lib/libc/aarch64/gen/makecontext.c
+++ b/lib/libc/aarch64/gen/makecontext.c
@@ -1,6 +1,5 @@
/*-
* Copyright (c) 2015 The FreeBSD Foundation
- * All rights reserved.
*
* This software was developed by Andrew Turner under
* sponsorship from the FreeBSD Foundation.
@@ -27,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <machine/armreg.h>
@@ -43,16 +39,16 @@ void _ctx_start(void);
void
ctx_done(ucontext_t *ucp)
-{
-
+{
+
if (ucp->uc_link == NULL) {
exit(0);
- } else {
+ } else {
setcontext((const ucontext_t *)ucp->uc_link);
abort();
- }
+ }
}
-
+
__weak_reference(__makecontext, makecontext);
void
diff --git a/lib/libc/aarch64/gen/setjmp.S b/lib/libc/aarch64/gen/setjmp.S
index 7d68406f00be..97d98ae2fb52 100644
--- a/lib/libc/aarch64/gen/setjmp.S
+++ b/lib/libc/aarch64/gen/setjmp.S
@@ -1,7 +1,6 @@
/*-
* Copyright (c) 2014 Andrew Turner
* Copyright (c) 2014 The FreeBSD Foundation
- * All rights reserved.
*
* Portions of this software were developed by Andrew Turner
* under sponsorship from the FreeBSD Foundation
@@ -30,9 +29,8 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
#include <machine/setjmp.h>
+#include <sys/elf_common.h>
ENTRY(setjmp)
sub sp, sp, #16
@@ -114,10 +112,13 @@ ENTRY(longjmp)
ldp d14, d15, [x0]
/* Load the return value */
- mov x0, x1
+ cmp x1, #0
+ csinc x0, x1, xzr, ne
ret
botch:
bl _C_LABEL(longjmperror)
bl _C_LABEL(abort)
END(longjmp)
+
+GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
diff --git a/lib/libc/aarch64/gen/sigsetjmp.S b/lib/libc/aarch64/gen/sigsetjmp.S
index 917e1ef6ee56..daf3914b6278 100644
--- a/lib/libc/aarch64/gen/sigsetjmp.S
+++ b/lib/libc/aarch64/gen/sigsetjmp.S
@@ -1,6 +1,5 @@
/*-
* Copyright (c) 2014 The FreeBSD Foundation
- * All rights reserved.
*
* This software was developed by Andrew Turner under
* sponsorship from the FreeBSD Foundation.
@@ -28,9 +27,8 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
#include <machine/setjmp.h>
+#include <sys/elf_common.h>
ENTRY(sigsetjmp)
cmp x1, #0
@@ -55,3 +53,5 @@ ENTRY(siglongjmp)
.Lmagic:
.quad _JB_MAGIC__SETJMP
END(siglongjmp)
+
+GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
diff --git a/lib/libc/aarch64/static_tls.h b/lib/libc/aarch64/static_tls.h
index 78f6b50f0127..2bb717eb75ce 100644
--- a/lib/libc/aarch64/static_tls.h
+++ b/lib/libc/aarch64/static_tls.h
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2019 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 _LIBC_AARCH64_STATIC_TLS_H
diff --git a/lib/libc/aarch64/string/Makefile.inc b/lib/libc/aarch64/string/Makefile.inc
index 5ce355f8b0c1..cabc79e4f351 100644
--- a/lib/libc/aarch64/string/Makefile.inc
+++ b/lib/libc/aarch64/string/Makefile.inc
@@ -1,20 +1,40 @@
-# $FreeBSD$
#
-# String handling from the Cortex Strings library
-# https://git.linaro.org/toolchain/cortex-strings.git
+# String handling from the Arm Optimized Routines
+# https://github.com/ARM-software/optimized-routines
#
-.PATH: ${SRCTOP}/contrib/cortex-strings/src/aarch64
+AARCH64_STRING_FUNCS= \
+ memchr \
+ memcmp \
+ memcpy \
+ memmove \
+ memrchr \
+ memset \
+ stpcpy \
+ strchr \
+ strchrnul \
+ strcmp \
+ strcpy \
+ strlen \
+ strncmp \
+ strnlen \
+ strrchr
-MDSRCS+= \
- memchr.S \
- memcmp.S \
- memcpy.S \
- memmove.S \
- memset.S \
- strchr.S \
- strcmp.S \
- strcpy.S \
- strlen.S \
- strncmp.S \
- strnlen.S
+#
+# Add the above functions. Generate an asm file that includes the needed
+# Arm Optimized Routines file defining the function name to the libc name.
+# Some file need multiple macros defined or a weak symbol added we can
+# override the generated file in these cases.
+#
+.for FUNC in ${AARCH64_STRING_FUNCS}
+.if !exists(${FUNC}.S)
+${FUNC}.S:
+ printf '/* %sgenerated by libc/aarch64/string/Makefile.inc */\n' @ > ${.TARGET}
+ printf '#define __%s_aarch64 %s\n' ${FUNC} ${FUNC} >> ${.TARGET}
+ printf '#include "aarch64/%s.S"\n' ${FUNC} >> ${.TARGET}
+CLEANFILES+= ${FUNC}.S
+.endif
+
+MDSRCS+= ${FUNC}.S
+CFLAGS.${FUNC}.S+=-I${SRCTOP}/contrib/arm-optimized-routines/string
+.endfor
diff --git a/lib/libc/aarch64/string/memcpy.S b/lib/libc/aarch64/string/memcpy.S
new file mode 100644
index 000000000000..ac4fbe8d6175
--- /dev/null
+++ b/lib/libc/aarch64/string/memcpy.S
@@ -0,0 +1,6 @@
+#define __memcpy_aarch64 memcpy
+#define __memmove_aarch64 memmove
+#include "aarch64/memcpy.S"
+
+.weak index
+.equ index, strchr
diff --git a/lib/libc/aarch64/string/memmove.S b/lib/libc/aarch64/string/memmove.S
new file mode 100644
index 000000000000..6ca014b3a565
--- /dev/null
+++ b/lib/libc/aarch64/string/memmove.S
@@ -0,0 +1,9 @@
+/*
+ * memmove is implemented in memcpy.S. Having this file simplifies the build
+ * as it stops MISRCS from picking up the C implementation and rtld expects
+ * to copy the memmove object file into its object directory.
+ */
+
+#include <machine/asm.h>
+#include <sys/elf_common.h>
+GNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)
diff --git a/lib/libc/aarch64/string/strchr.S b/lib/libc/aarch64/string/strchr.S
new file mode 100644
index 000000000000..e241b35004bb
--- /dev/null
+++ b/lib/libc/aarch64/string/strchr.S
@@ -0,0 +1,5 @@
+#define __strchr_aarch64 strchr
+#include "aarch64/strchr.S"
+
+.weak index
+.equ index, strchr
diff --git a/lib/libc/aarch64/string/strrchr.S b/lib/libc/aarch64/string/strrchr.S
new file mode 100644
index 000000000000..46e966e3188a
--- /dev/null
+++ b/lib/libc/aarch64/string/strrchr.S
@@ -0,0 +1,5 @@
+#define __strrchr_aarch64 strrchr
+#include "aarch64/strrchr.S"
+
+.weak rindex
+.equ rindex, strrchr
diff --git a/lib/libc/aarch64/sys/Makefile.inc b/lib/libc/aarch64/sys/Makefile.inc
deleted file mode 100644
index 623a06b7faf8..000000000000
--- a/lib/libc/aarch64/sys/Makefile.inc
+++ /dev/null
@@ -1,13 +0,0 @@
-# $FreeBSD$
-
-MIASM:= ${MIASM:Nfreebsd[467]_*}
-
-SRCS+= __vdso_gettc.c
-
-MDASM= cerror.S \
- syscall.S \
- vfork.S
-
-# Don't generate default code for these syscalls:
-NOASM+= sbrk.o \
- vfork.o
diff --git a/lib/libc/aarch64/sys/__vdso_gettc.c b/lib/libc/aarch64/sys/__vdso_gettc.c
deleted file mode 100644
index 85e1b2e23cd3..000000000000
--- a/lib/libc/aarch64/sys/__vdso_gettc.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*-
- * Copyright (c) 2015 The FreeBSD Foundation
- *
- * This software was developed by Konstantin Belousov
- * under sponsorship from the FreeBSD Foundation.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <sys/elf.h>
-#include <sys/time.h>
-#include <sys/vdso.h>
-#include <machine/cpufunc.h>
-#include <errno.h>
-#include "libc_private.h"
-
-static inline uint64_t
-cp15_cntvct_get(void)
-{
- uint64_t reg;
-
- __asm __volatile("mrs %0, cntvct_el0" : "=r" (reg));
- return (reg);
-}
-
-static inline uint64_t
-cp15_cntpct_get(void)
-{
- uint64_t reg;
-
- __asm __volatile("mrs %0, cntpct_el0" : "=r" (reg));
- return (reg);
-}
-
-#pragma weak __vdso_gettc
-int
-__vdso_gettc(const struct vdso_timehands *th, u_int *tc)
-{
-
- if (th->th_algo != VDSO_TH_ALGO_ARM_GENTIM)
- return (ENOSYS);
- __asm __volatile("isb" : : : "memory");
- *tc = th->th_physical == 0 ? cp15_cntvct_get() : cp15_cntpct_get();
- return (0);
-}
-
-#pragma weak __vdso_gettimekeep
-int
-__vdso_gettimekeep(struct vdso_timekeep **tk)
-{
-
- return (_elf_aux_info(AT_TIMEKEEP, tk, sizeof(*tk)));
-}
diff --git a/lib/libc/aarch64/sys/cerror.S b/lib/libc/aarch64/sys/cerror.S
deleted file mode 100644
index 7e1627dc8ab8..000000000000
--- a/lib/libc/aarch64/sys/cerror.S
+++ /dev/null
@@ -1,42 +0,0 @@
-/*-
- * Copyright (c) 2014 Andrew Turner
- * All rights reserved.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- *
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-ENTRY(cerror)
- .hidden cerror
- sub sp, sp, #16
- stp x0, lr, [sp]
- bl _C_LABEL(__error)
- ldp x1, lr, [sp]
- str w1, [x0]
- movn x0, #0
- movn x1, #0
- add sp, sp, #16
- ret
-END(cerror)
diff --git a/lib/libc/aarch64/sys/vfork.S b/lib/libc/aarch64/sys/vfork.S
deleted file mode 100644
index daecd1f04a33..000000000000
--- a/lib/libc/aarch64/sys/vfork.S
+++ /dev/null
@@ -1,42 +0,0 @@
-/*-
- * Copyright (c) 2014 Andrew Turner
- * All rights reserved.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- *
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-#include "SYS.h"
-
-ENTRY(__sys_vfork)
- WEAK_REFERENCE(__sys_vfork, vfork)
- WEAK_REFERENCE(__sys_vfork, _vfork)
- mov x2, lr
- _SYSCALL(vfork)
- b.cs cerror
- sub x1, x1, #1
- and x0, x0, x1
- mov lr, x2
- ret
-END(__sys_vfork)
diff --git a/lib/libc/amd64/Makefile.inc b/lib/libc/amd64/Makefile.inc
index cd8f0f121ea6..1e5bebcab52f 100644
--- a/lib/libc/amd64/Makefile.inc
+++ b/lib/libc/amd64/Makefile.inc
@@ -1,4 +1,3 @@
-# $FreeBSD$
#
# Machine dependent definitions for the amd64 architecture.
#
diff --git a/lib/libc/amd64/SYS.h b/lib/libc/amd64/SYS.h
deleted file mode 100644
index 3adc0b7fb655..000000000000
--- a/lib/libc/amd64/SYS.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-3-Clause
- *
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- *
- * @(#)SYS.h 5.5 (Berkeley) 5/7/91
- * $FreeBSD$
- */
-
-#include <sys/syscall.h>
-#include <machine/asm.h>
-
-#define RSYSCALL(name) ENTRY(__sys_##name); \
- WEAK_REFERENCE(__sys_##name, name); \
- WEAK_REFERENCE(__sys_##name, _##name); \
- mov $SYS_##name,%eax; KERNCALL; \
- jb HIDENAME(cerror); ret; \
- END(__sys_##name)
-
-#define PSEUDO(name) ENTRY(__sys_##name); \
- WEAK_REFERENCE(__sys_##name, _##name); \
- mov $SYS_##name,%eax; KERNCALL; \
- jb HIDENAME(cerror); ret; \
- END(__sys_##name)
-
-#define KERNCALL movq %rcx, %r10; syscall
diff --git a/lib/libc/amd64/Symbol.map b/lib/libc/amd64/Symbol.map
index 0655bd5eeb36..36f54de24fbd 100644
--- a/lib/libc/amd64/Symbol.map
+++ b/lib/libc/amd64/Symbol.map
@@ -1,21 +1,12 @@
/*
- * $FreeBSD$
- */
-
-/*
* This only needs to contain symbols that are not listed in
* symbol maps from other parts of libc (i.e., not found in
* stdlib/Symbol.map, string/Symbol.map, sys/Symbol.map, ...).
*/
FBSD_1.0 {
- /* PSEUDO syscalls */
- _exit;
-
.mcount;
- _setjmp;
- _longjmp;
- fabs;
__flt_rounds;
+ brk;
fpgetmask;
fpgetprec;
fpgetround;
@@ -23,32 +14,7 @@ FBSD_1.0 {
fpsetmask;
fpsetprec;
fpsetround;
- __infinity;
- __nan;
- makecontext;
- rfork_thread;
- setjmp;
- longjmp;
- sigsetjmp;
- siglongjmp;
- htonl;
- htons;
- ntohl;
- ntohs;
- amd64_get_fsbase;
- amd64_get_gsbase;
- amd64_set_fsbase;
- amd64_set_gsbase;
- brk;
sbrk;
- vfork;
-};
-
-FBSD_1.6 {
- x86_pkru_get_perm;
- x86_pkru_set_perm;
- x86_pkru_protect_range;
- x86_pkru_unprotect_range;
};
/*
@@ -57,16 +23,10 @@ FBSD_1.6 {
*
*/
FBSDprivate_1.0 {
- /* PSEUDO syscalls */
- _getlogin;
-
- _set_tp;
___longjmp;
- __makecontext;
__longjmp;
__signalcontext;
signalcontext;
__siglongjmp;
_brk;
- _vfork;
};
diff --git a/lib/libc/amd64/_fpmath.h b/lib/libc/amd64/_fpmath.h
index 8be7b7dbaf7d..d56138f48ba0 100644
--- a/lib/libc/amd64/_fpmath.h
+++ b/lib/libc/amd64/_fpmath.h
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002, 2003 David Schultz <das@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$
*/
union IEEEl2bits {
diff --git a/lib/libc/amd64/amd64_archlevel.h b/lib/libc/amd64/amd64_archlevel.h
new file mode 100644
index 000000000000..047beb9855d1
--- /dev/null
+++ b/lib/libc/amd64/amd64_archlevel.h
@@ -0,0 +1,90 @@
+/*-
+ * Copyright (c) 2023 The FreeBSD Foundation
+ *
+ * This software was developed by Robert Clausecker <fuz@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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 AUTHOR 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 AUTHOR 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
+ */
+
+/* must be macros so they can be accessed from assembly */
+#define X86_64_SCALAR 0 /* disable SIMD optimisations */
+#define X86_64_BASELINE 1 /* CMOV, CX8, FPU, FXSR, MMX, OSFXSR, SSE, SSE2 */
+#define X86_64_V2 2 /* CMPXCHG16B, LAHF-SAHF, POPCNT, SSE3, SSSE3, SSE4_1, SSE4_2 */
+#define X86_64_V3 3 /* AVX, AVX2, BMI1, BMI2, F16C, FMA, LZCNT, MOVBE, OSXSAVE */
+#define X86_64_V4 4 /* AVX512F, AVX512BW, AVX512CD, AVX512DQ, AVX512VL */
+
+#define X86_64_MAX X86_64_V4 /* highest supported architecture level */
+#define X86_64_UNDEFINED -1 /* architecture level not set yet */
+
+#ifndef __ASSEMBLER__
+#include <dlfcn.h>
+
+dlfunc_t __archlevel_resolve(u_int, u_int, u_int, u_int,
+ int32_t[X86_64_MAX + 1]) __hidden;
+#else
+#include <machine/asm.h>
+
+#define ARCHRESOLVE(func) \
+ .globl CNAME(func); \
+ .type CNAME(func), @gnu_indirect_function; \
+ .set CNAME(func), __CONCAT(func,_resolver); \
+ ARCHENTRY(func, resolver); \
+ lea __CONCAT(func,_funcs)(%rip), %r8; \
+ jmp CNAME(__archlevel_resolve); \
+ ARCHEND(func, resolver)
+
+/*
+ * The func_funcs array stores the location of the implementations
+ * as the distance from the func_funcs array to the function. Due
+ * to compiling for the medium code model, a 32 bit integer suffices
+ * to hold the distance.
+ *
+ * Doing it this way both saves storage and avoids giving rtld
+ * relocations to process at load time.
+ */
+#define ARCHFUNCS(func) \
+ ARCHRESOLVE(func); \
+ .section .rodata; \
+ .align 4; \
+ __CONCAT(func,_funcs):
+
+#define NOARCHFUNC \
+ .4byte 0
+
+#define ARCHFUNC(func, level) \
+ .4byte __CONCAT(__CONCAT(func,_),level) - __CONCAT(func,_funcs)
+
+#define ENDARCHFUNCS(func) \
+ .zero 4*(X86_64_MAX+1)-(.-__CONCAT(func,_funcs)); \
+ .size __CONCAT(func,_funcs), .-__CONCAT(func,_funcs)
+
+#define ARCHENTRY(func, level) \
+ _START_ENTRY; \
+ .type __CONCAT(__CONCAT(func,_),level), @function; \
+ __CONCAT(__CONCAT(func,_),level):; \
+ .cfi_startproc
+
+#define ARCHEND(func, level) \
+ END(__CONCAT(__CONCAT(func,_),level))
+
+#endif /* __ASSEMBLER__ */
diff --git a/lib/libc/amd64/arith.h b/lib/libc/amd64/arith.h
index ecb1a33fccb0..9c695c74a33e 100644
--- a/lib/libc/amd64/arith.h
+++ b/lib/libc/amd64/arith.h
@@ -1,7 +1,5 @@
/*
* MD header for contrib/gdtoa
- *
- * $FreeBSD$
*/
/*
diff --git a/lib/libc/amd64/gd_qnan.h b/lib/libc/amd64/gd_qnan.h
index 39923860db07..3387ae94a862 100644
--- a/lib/libc/amd64/gd_qnan.h
+++ b/lib/libc/amd64/gd_qnan.h
@@ -3,8 +3,6 @@
*
* This file can be generated by compiling and running contrib/gdtoa/qnan.c
* on the target architecture after arith.h has been generated.
- *
- * $FreeBSD$
*/
#define f_QNAN 0x7fc00000
diff --git a/lib/libc/amd64/gen/Makefile.inc b/lib/libc/amd64/gen/Makefile.inc
index 4df3c044493e..583418c4620e 100644
--- a/lib/libc/amd64/gen/Makefile.inc
+++ b/lib/libc/amd64/gen/Makefile.inc
@@ -1,7 +1,5 @@
-# @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
-# $FreeBSD$
-SRCS+= _setjmp.S _get_tp.c _set_tp.c rfork_thread.S setjmp.S sigsetjmp.S \
+SRCS+= _setjmp.S setjmp.S sigsetjmp.S \
fabs.S \
infinity.c ldexp.c makecontext.c signalcontext.c \
flt_rounds.c fpgetmask.c fpsetmask.c fpgetprec.c fpsetprec.c \
diff --git a/lib/libc/amd64/gen/_set_tp.c b/lib/libc/amd64/gen/_set_tp.c
deleted file mode 100644
index 6e3a4c07499b..000000000000
--- a/lib/libc/amd64/gen/_set_tp.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 2004 Doug Rabson
- * All rights reserved.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- *
- * $FreeBSD$
- */
-
-#include <string.h>
-#include <stdint.h>
-#include <machine/sysarch.h>
-#include "libc_private.h"
-
-void
-_set_tp(void *tp)
-{
-
- amd64_set_fsbase(tp);
-}
diff --git a/lib/libc/amd64/gen/_setjmp.S b/lib/libc/amd64/gen/_setjmp.S
index 0e1e5f8f265d..93b27de49ea0 100644
--- a/lib/libc/amd64/gen/_setjmp.S
+++ b/lib/libc/amd64/gen/_setjmp.S
@@ -30,12 +30,7 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
- .asciz "@(#)_setjmp.s 5.1 (Berkeley) 4/23/90"
-#endif /* LIBC_SCCS and not lint */
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* C library -- _setjmp, _longjmp
*
@@ -48,8 +43,8 @@ __FBSDID("$FreeBSD$");
ENTRY(_setjmp)
movq %rdi,%rax
- movq 0(%rsp),%rdx /* retval */
- movq %rdx, 0(%rax) /* 0; retval */
+ movq 0(%rsp),%rdx /* return address */
+ movq %rdx, 0(%rax) /* 0; return address */
movq %rbx, 8(%rax) /* 1; rbx */
movq %rsp,16(%rax) /* 2; rsp */
movq %rbp,24(%rax) /* 3; rbp */
@@ -88,7 +83,7 @@ ENTRY(___longjmp)
testq %rax,%rax
jnz 1f
incq %rax
-1: movq %rcx,0(%rsp)
+1: movq %rcx,0(%rsp) /* return address */
ret
END(___longjmp)
diff --git a/lib/libc/amd64/gen/fabs.S b/lib/libc/amd64/gen/fabs.S
index 38e67ab03873..8c7e4464d1f5 100644
--- a/lib/libc/amd64/gen/fabs.S
+++ b/lib/libc/amd64/gen/fabs.S
@@ -25,8 +25,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* Return floating point absolute value of a double.
*/
diff --git a/lib/libc/amd64/gen/flt_rounds.c b/lib/libc/amd64/gen/flt_rounds.c
index c0ce81f6dfa9..cd7e501af5af 100644
--- a/lib/libc/amd64/gen/flt_rounds.c
+++ b/lib/libc/amd64/gen/flt_rounds.c
@@ -3,9 +3,6 @@
* Public domain.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <float.h>
static const int map[] = {
diff --git a/lib/libc/amd64/gen/fpgetmask.c b/lib/libc/amd64/gen/fpgetmask.c
index 03bb2741ef6a..a1ab8a79c2ea 100644
--- a/lib/libc/amd64/gen/fpgetmask.c
+++ b/lib/libc/amd64/gen/fpgetmask.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
#define __IEEEFP_NOINLINES__ 1
#include <ieeefp.h>
diff --git a/lib/libc/amd64/gen/fpgetprec.c b/lib/libc/amd64/gen/fpgetprec.c
index 22d21480566a..eed244f3c36f 100644
--- a/lib/libc/amd64/gen/fpgetprec.c
+++ b/lib/libc/amd64/gen/fpgetprec.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
#define __IEEEFP_NOINLINES__ 1
#include <ieeefp.h>
diff --git a/lib/libc/amd64/gen/fpgetround.c b/lib/libc/amd64/gen/fpgetround.c
index 9c066b149ca2..6d79bb9d30c6 100644
--- a/lib/libc/amd64/gen/fpgetround.c
+++ b/lib/libc/amd64/gen/fpgetround.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
#define __IEEEFP_NOINLINES__ 1
#include <ieeefp.h>
diff --git a/lib/libc/amd64/gen/fpgetsticky.c b/lib/libc/amd64/gen/fpgetsticky.c
index c3acb91d63e5..842fb2cdf748 100644
--- a/lib/libc/amd64/gen/fpgetsticky.c
+++ b/lib/libc/amd64/gen/fpgetsticky.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
#define __IEEEFP_NOINLINES__ 1
#include <ieeefp.h>
diff --git a/lib/libc/amd64/gen/fpsetmask.c b/lib/libc/amd64/gen/fpsetmask.c
index 996e167ac1d9..808144dce4b8 100644
--- a/lib/libc/amd64/gen/fpsetmask.c
+++ b/lib/libc/amd64/gen/fpsetmask.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
#define __IEEEFP_NOINLINES__ 1
#include <ieeefp.h>
diff --git a/lib/libc/amd64/gen/fpsetprec.c b/lib/libc/amd64/gen/fpsetprec.c
index 5898de7e0e82..8fd0249652bd 100644
--- a/lib/libc/amd64/gen/fpsetprec.c
+++ b/lib/libc/amd64/gen/fpsetprec.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
#define __IEEEFP_NOINLINES__ 1
#include <ieeefp.h>
diff --git a/lib/libc/amd64/gen/fpsetround.c b/lib/libc/amd64/gen/fpsetround.c
index 6f13367510d6..a069ec2e372c 100644
--- a/lib/libc/amd64/gen/fpsetround.c
+++ b/lib/libc/amd64/gen/fpsetround.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
#define __IEEEFP_NOINLINES__ 1
#include <ieeefp.h>
diff --git a/lib/libc/amd64/gen/infinity.c b/lib/libc/amd64/gen/infinity.c
index 464b4029b35a..bc05708abd2b 100644
--- a/lib/libc/amd64/gen/infinity.c
+++ b/lib/libc/amd64/gen/infinity.c
@@ -2,9 +2,6 @@
* infinity.c
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <math.h>
/* bytes for +Infinity on a 387 */
diff --git a/lib/libc/amd64/gen/makecontext.c b/lib/libc/amd64/gen/makecontext.c
index 720b48b6a97d..c5767c9d5d75 100644
--- a/lib/libc/amd64/gen/makecontext.c
+++ b/lib/libc/amd64/gen/makecontext.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2003 Marcel Moolenaar
* All rights reserved.
@@ -26,9 +26,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/ucontext.h>
#include <stdarg.h>
diff --git a/lib/libc/amd64/gen/rfork_thread.S b/lib/libc/amd64/gen/rfork_thread.S
deleted file mode 100644
index d08700fb4fe4..000000000000
--- a/lib/libc/amd64/gen/rfork_thread.S
+++ /dev/null
@@ -1,95 +0,0 @@
-/*-
- * Copyright (c) 2000 Peter Wemm <peter@FreeBSD.org>
- * Copyright (c) 2003 Alan L. Cox <alc@cs.rice.edu>
- * All rights reserved.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * With thanks to John Dyson for the original version of this.
- */
-
-#include <SYS.h>
-
-/*
- * %edi %rsi %rdx %rcx
- * rfork_thread(flags, stack_addr, start_fnc, start_arg);
- *
- * flags: Flags to rfork system call. See rfork(2).
- * stack_addr: Top of stack for thread.
- * start_fnc: Address of thread function to call in child.
- * start_arg: Argument to pass to the thread function in child.
- */
-
-ENTRY(rfork_thread)
- pushq %rbx
- pushq %r12
- movq %rdx, %rbx
- movq %rcx, %r12
-
- /*
- * Prepare and execute the thread creation syscall
- */
- movq $SYS_rfork, %rax
- KERNCALL
- jb 2f
-
- /*
- * Check to see if we are in the parent or child
- */
- cmpl $0, %edx
- jnz 1f
- popq %r12
- popq %rbx
- ret
-
- /*
- * If we are in the child (new thread), then
- * set-up the call to the internal subroutine. If it
- * returns, then call __exit.
- */
-1:
- movq %rsi, %rsp
- movq %r12, %rdi
- call *%rbx
- movl %eax, %edi
-
- /*
- * Exit system call
- */
- movq $SYS_exit, %rax
- KERNCALL
-
- /*
- * Branch here if the thread creation fails:
- */
-2:
- popq %r12
- popq %rbx
- jmp HIDENAME(cerror)
-END(rfork_thread)
-
- .section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/amd64/gen/setjmp.S b/lib/libc/amd64/gen/setjmp.S
index 90eff9e9ed6b..54939f123807 100644
--- a/lib/libc/amd64/gen/setjmp.S
+++ b/lib/libc/amd64/gen/setjmp.S
@@ -30,12 +30,7 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
- .asciz "@(#)setjmp.s 5.1 (Berkeley) 4/23/90"
-#endif /* LIBC_SCCS and not lint */
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* C library -- _setjmp, _longjmp
*
@@ -58,8 +53,8 @@ ENTRY(setjmp)
call __libc_sigprocmask
popq %rdi
movq %rdi,%rcx
- movq 0(%rsp),%rdx /* retval */
- movq %rdx, 0(%rcx) /* 0; retval */
+ movq 0(%rsp),%rdx /* return address */
+ movq %rdx, 0(%rcx) /* 0; return address */
movq %rbx, 8(%rcx) /* 1; rbx */
movq %rsp,16(%rcx) /* 2; rsp */
movq %rbp,24(%rcx) /* 3; rbp */
@@ -109,7 +104,7 @@ ENTRY(__longjmp)
testq %rax,%rax
jnz 1f
incq %rax
-1: movq %rcx,0(%rsp)
+1: movq %rcx,0(%rsp) /* return address */
ret
END(__longjmp)
diff --git a/lib/libc/amd64/gen/signalcontext.c b/lib/libc/amd64/gen/signalcontext.c
index a489a14b3012..a97dd158542a 100644
--- a/lib/libc/amd64/gen/signalcontext.c
+++ b/lib/libc/amd64/gen/signalcontext.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2003 Marcel Moolenaar
* All rights reserved.
@@ -26,9 +26,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/ucontext.h>
#include <signal.h>
diff --git a/lib/libc/amd64/gen/sigsetjmp.S b/lib/libc/amd64/gen/sigsetjmp.S
index 447134122019..c4775b1c2bea 100644
--- a/lib/libc/amd64/gen/sigsetjmp.S
+++ b/lib/libc/amd64/gen/sigsetjmp.S
@@ -28,8 +28,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.s 5.1 (Berkeley) 4/23/90"
*/
#if defined(LIBC_SCCS) && !defined(lint)
@@ -37,8 +35,6 @@
.asciz "$Id: sigsetjmp.S,v 1.1 1993/12/05 13:01:05 ats Exp $"
#endif /* LIBC_SCCS and not lint */
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
#include "SYS.h"
/*-
@@ -66,8 +62,8 @@ ENTRY(sigsetjmp)
call __libc_sigprocmask
popq %rdi
2: movq %rdi,%rcx
- movq 0(%rsp),%rdx /* retval */
- movq %rdx, 0(%rcx) /* 0; retval */
+ movq 0(%rsp),%rdx /* return address */
+ movq %rdx, 0(%rcx) /* 0; return address */
movq %rbx, 8(%rcx) /* 1; rbx */
movq %rsp,16(%rcx) /* 2; rsp */
movq %rbp,24(%rcx) /* 3; rbp */
@@ -109,7 +105,7 @@ ENTRY(__siglongjmp)
testq %rax,%rax
jnz 1f
incq %rax
-1: movq %rcx,0(%rsp)
+1: movq %rcx,0(%rsp) /* return address */
ret
END(__siglongjmp)
diff --git a/lib/libc/amd64/static_tls.h b/lib/libc/amd64/static_tls.h
index 1e9b76f58221..1ee738b231c7 100644
--- a/lib/libc/amd64/static_tls.h
+++ b/lib/libc/amd64/static_tls.h
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2019 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 _LIBC_AMD64_STATIC_TLS_H
diff --git a/lib/libc/amd64/stdlib/Makefile.inc b/lib/libc/amd64/stdlib/Makefile.inc
index 5b7e675ede0d..f0abf7ce8254 100644
--- a/lib/libc/amd64/stdlib/Makefile.inc
+++ b/lib/libc/amd64/stdlib/Makefile.inc
@@ -1,4 +1,2 @@
-# @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
-# $FreeBSD$
MDSRCS+=div.S ldiv.S lldiv.S
diff --git a/lib/libc/amd64/stdlib/div.S b/lib/libc/amd64/stdlib/div.S
index 366010c3d208..f15ef2ffc5bb 100644
--- a/lib/libc/amd64/stdlib/div.S
+++ b/lib/libc/amd64/stdlib/div.S
@@ -6,8 +6,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
ENTRY(div)
movl %edi,%eax
cltd
diff --git a/lib/libc/amd64/stdlib/ldiv.S b/lib/libc/amd64/stdlib/ldiv.S
index f11472c671dc..6c1e2292d7f2 100644
--- a/lib/libc/amd64/stdlib/ldiv.S
+++ b/lib/libc/amd64/stdlib/ldiv.S
@@ -6,8 +6,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
ENTRY(ldiv)
movq %rdi,%rax
cqto
diff --git a/lib/libc/amd64/stdlib/lldiv.S b/lib/libc/amd64/stdlib/lldiv.S
index 4dab0fdd5278..744cfefd064b 100644
--- a/lib/libc/amd64/stdlib/lldiv.S
+++ b/lib/libc/amd64/stdlib/lldiv.S
@@ -6,8 +6,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
ENTRY(lldiv)
movq %rdi,%rax
cqto
diff --git a/lib/libc/amd64/string/Makefile.inc b/lib/libc/amd64/string/Makefile.inc
index cb370bc6be1c..d5bb646c5c53 100644
--- a/lib/libc/amd64/string/Makefile.inc
+++ b/lib/libc/amd64/string/Makefile.inc
@@ -1,12 +1,36 @@
-# $FreeBSD$
-
MDSRCS+= \
+ amd64_archlevel.c \
bcmp.S \
+ memchr.S \
memcmp.S \
+ memccpy.S \
memcpy.S \
memmove.S \
+ memrchr.S \
memset.S \
+ stpcpy.S \
+ stpncpy.S \
strcat.S \
+ strchrnul.S \
strcmp.S \
+ strcpy.c \
+ strcspn.S \
+ strlcat.c \
+ strlcpy.S \
strlen.S \
- stpcpy.S
+ strncat.c \
+ strncmp.S \
+ strncpy.c \
+ strnlen.c \
+ strpbrk.c \
+ strrchr.S \
+ strsep.c \
+ strspn.S \
+ timingsafe_bcmp.S \
+ timingsafe_memcmp.S
+
+.if ${MK_ASAN} != "no"
+# Disable ASAN for amd64_archlevel.c since its code is executed before the
+# sanitizer runtime can initialize itself.
+CFLAGS.amd64_archlevel.c+= -fno-sanitize=address
+.endif
diff --git a/lib/libc/amd64/string/amd64_archlevel.c b/lib/libc/amd64/string/amd64_archlevel.c
new file mode 100644
index 000000000000..c06566658c59
--- /dev/null
+++ b/lib/libc/amd64/string/amd64_archlevel.c
@@ -0,0 +1,241 @@
+/*-
+ * Copyright (c) 2023 The FreeBSD Foundation
+ *
+ * This software was developed by Robert Clausecker <fuz@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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 AUTHOR 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 AUTHOR 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
+ */
+
+#include <sys/types.h>
+
+#include <machine/atomic.h>
+#include <machine/cpufunc.h>
+#include <machine/specialreg.h>
+
+#include <stddef.h>
+#include <string.h>
+
+#include "amd64_archlevel.h"
+#include "libc_private.h"
+
+#define ARCHLEVEL_ENV "ARCHLEVEL"
+
+static volatile int amd64_archlevel = X86_64_UNDEFINED;
+
+static const struct archlevel {
+ char name[10];
+ /* CPUID feature bits that need to be present */
+ u_int feat_edx, feat_ecx, amd_ecx, ext_ebx;
+} levels[] = {
+ {
+ .name = "scalar",
+ .feat_edx = 0,
+ .feat_ecx = 0,
+ .amd_ecx = 0,
+ .ext_ebx = 0,
+ }, {
+#define FEAT_EDX_BASELINE (CPUID_FPU | CPUID_CX8 | CPUID_CMOV | CPUID_MMX | \
+ CPUID_FXSR | CPUID_SSE | CPUID_SSE2)
+ .name = "baseline",
+ .feat_edx = FEAT_EDX_BASELINE,
+ .feat_ecx = 0,
+ .amd_ecx = 0,
+ .ext_ebx = 0,
+ }, {
+#define FEAT_ECX_V2 (CPUID2_SSE3 | CPUID2_SSSE3 | CPUID2_CX16 | CPUID2_SSE41 | \
+ CPUID2_SSE42 | CPUID2_POPCNT)
+#define AMD_ECX_V2 AMDID2_LAHF
+ .name = "x86-64-v2",
+ .feat_edx = FEAT_EDX_BASELINE,
+ .feat_ecx = FEAT_ECX_V2,
+ .amd_ecx = AMD_ECX_V2,
+ .ext_ebx = 0,
+ }, {
+#define FEAT_ECX_V3 (FEAT_ECX_V2 | CPUID2_FMA | CPUID2_MOVBE | \
+ CPUID2_OSXSAVE | CPUID2_AVX | CPUID2_F16C)
+#define AMD_ECX_V3 (AMD_ECX_V2 | AMDID2_ABM)
+#define EXT_EBX_V3 (CPUID_STDEXT_BMI1 | CPUID_STDEXT_AVX2 | CPUID_STDEXT_BMI2)
+ .name = "x86-64-v3",
+ .feat_edx = FEAT_EDX_BASELINE,
+ .feat_ecx = FEAT_ECX_V3,
+ .amd_ecx = AMD_ECX_V3,
+ .ext_ebx = EXT_EBX_V3,
+ }, {
+#define EXT_EBX_V4 (EXT_EBX_V3 | CPUID_STDEXT_AVX512F | \
+ CPUID_STDEXT_AVX512DQ | CPUID_STDEXT_AVX512CD | \
+ CPUID_STDEXT_AVX512BW | CPUID_STDEXT_AVX512VL)
+ .name = "x86-64-v4",
+ .feat_edx = FEAT_EDX_BASELINE,
+ .feat_ecx = FEAT_ECX_V3,
+ .amd_ecx = AMD_ECX_V3,
+ .ext_ebx = EXT_EBX_V4,
+ }
+};
+
+static int
+supported_archlevel(u_int feat_edx, u_int feat_ecx, u_int ext_ebx, u_int ext_ecx)
+{
+ int level;
+ u_int p[4], max_leaf;
+ u_int amd_ecx = 0;
+
+ (void)ext_ecx;
+
+ do_cpuid(0x80000000, p);
+ max_leaf = p[0];
+
+ if (max_leaf >= 0x80000001) {
+ do_cpuid(0x80000001, p);
+ amd_ecx = p[2];
+ }
+
+ for (level = X86_64_BASELINE; level <= X86_64_MAX; level++) {
+ const struct archlevel *lvl = &levels[level];
+
+ if ((lvl->feat_edx & feat_edx) != lvl->feat_edx ||
+ (lvl->feat_ecx & feat_ecx) != lvl->feat_ecx ||
+ (lvl->amd_ecx & amd_ecx) != lvl->amd_ecx ||
+ (lvl->ext_ebx & ext_ebx) != lvl->ext_ebx)
+ return (level - 1);
+ }
+
+ return (X86_64_MAX);
+}
+
+static int
+match_archlevel(const char *str, int *force)
+{
+ int level, want_force = 0;
+
+ *force = 0;
+
+ if (str[0] == '!') {
+ str++;
+ want_force = 1;
+ }
+
+ for (level = 0; level <= X86_64_MAX; level++) {
+ size_t i;
+ const char *candidate = levels[level].name;
+
+ /* can't use strcmp here: would recurse during ifunc resolution */
+ for (i = 0; str[i] == candidate[i]; i++)
+ /* suffixes starting with : or + are ignored for future extensions */
+ if (str[i] == '\0' || str[i] == ':' || str[i] == '+') {
+ if (want_force)
+ *force = 1;
+
+ return (level);
+ }
+ }
+
+ return (X86_64_UNDEFINED);
+}
+
+/*
+ * We can't use getenv(), strcmp(), and a bunch of other functions here as
+ * they may in turn call SIMD-optimised string functions.
+ *
+ * *force is set to 1 if the architecture level is valid and begins with a !
+ * and to 0 otherwise.
+ */
+static int
+env_archlevel(int *force)
+{
+ size_t i;
+
+ if (environ == NULL)
+ return (X86_64_UNDEFINED);
+
+ for (i = 0; environ[i] != NULL; i++) {
+ size_t j;
+
+ for (j = 0; environ[i][j] == ARCHLEVEL_ENV "="[j]; j++)
+ if (environ[i][j] == '=')
+ return (match_archlevel(&environ[i][j + 1], force));
+ }
+
+ *force = 0;
+
+ return (X86_64_UNDEFINED);
+
+}
+
+/*
+ * Determine the architecture level by checking the CPU capabilities
+ * and the environment:
+ *
+ * 1. If environment variable ARCHLEVEL starts with a ! and is followed
+ * by a valid architecture level, that level is returned.
+ * 2. Else if ARCHLEVEL is set to a valid architecture level that is
+ * supported by the CPU, that level is returned.
+ * 3. Else the highest architecture level supported by the CPU is
+ * returned.
+ *
+ * Valid architecture levels are those defined in the levels array.
+ * The architecture level "scalar" indicates that SIMD enhancements
+ * shall not be used.
+ */
+static int
+archlevel(u_int feat_edx, u_int feat_ecx, u_int ext_ebx, u_int ext_ecx)
+{
+ int islevel, wantlevel, hwlevel, force;
+
+ islevel = atomic_load_int(&amd64_archlevel);
+ if (islevel != X86_64_UNDEFINED)
+ return (islevel);
+
+ wantlevel = env_archlevel(&force);
+ if (!force) {
+ hwlevel = supported_archlevel(feat_edx, feat_ecx, ext_ebx, ext_ecx);
+ if (wantlevel == X86_64_UNDEFINED || wantlevel > hwlevel)
+ wantlevel = hwlevel;
+ }
+
+ /*
+ * Ensure amd64_archlevel is set only once and
+ * all calls agree on what it was set to.
+ */
+ if (atomic_cmpset_int(&amd64_archlevel, islevel, wantlevel))
+ return (wantlevel);
+ else
+ return (atomic_load_int(&amd64_archlevel));
+}
+
+/*
+ * Helper function for SIMD ifunc dispatch: select the highest level
+ * implementation up to the current architecture level.
+ */
+dlfunc_t
+__archlevel_resolve(u_int feat_edx, u_int feat_ecx, u_int ext_ebx,
+ u_int ext_ecx, int32_t funcs[static X86_64_MAX + 1])
+{
+ int level;
+
+ for (level = archlevel(feat_edx, feat_ecx, ext_ebx, ext_ecx); level >= 0; level--)
+ if (funcs[level] != 0)
+ return (dlfunc_t)((uintptr_t)funcs + (ptrdiff_t)funcs[level]);
+
+ /* no function is present -- what now? */
+ __builtin_trap();
+}
diff --git a/lib/libc/amd64/string/bcmp.S b/lib/libc/amd64/string/bcmp.S
index efdc6d33e4dd..f7a4603f6c5a 100644
--- a/lib/libc/amd64/string/bcmp.S
+++ b/lib/libc/amd64/string/bcmp.S
@@ -1,121 +1,7 @@
/*-
- * Copyright (c) 2018 The FreeBSD Foundation
- *
- * This software was developed by Mateusz Guzik <mjg@FreeBSD.org>
- * under sponsorship from the FreeBSD Foundation.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- *
- * $FreeBSD$
+ * Written by Mateusz Guzik <mjg@freebsd.org>
+ * Public domain.
*/
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-ENTRY(bcmp)
- cmpq $16,%rdx
- jae 5f
-1:
- testq %rdx,%rdx
- je 3f
- xorl %ecx,%ecx
-2:
- movzbl (%rdi,%rcx,1),%eax
- movzbl (%rsi,%rcx,1),%r8d
- cmpb %r8b,%al
- jne 4f
- addq $1,%rcx
- cmpq %rcx,%rdx
- jz 3f
- movzbl (%rdi,%rcx,1),%eax
- movzbl (%rsi,%rcx,1),%r8d
- cmpb %r8b,%al
- jne 4f
- addq $1,%rcx
- cmpq %rcx,%rdx
- jz 3f
- movzbl (%rdi,%rcx,1),%eax
- movzbl (%rsi,%rcx,1),%r8d
- cmpb %r8b,%al
- jne 4f
- addq $1,%rcx
- cmpq %rcx,%rdx
- jz 3f
- movzbl (%rdi,%rcx,1),%eax
- movzbl (%rsi,%rcx,1),%r8d
- cmpb %r8b,%al
- jne 4f
- addq $1,%rcx
- cmpq %rcx,%rdx
- jne 2b
-3:
- xorl %eax,%eax
- ret
-4:
- movl $1,%eax
- ret
-5:
- cmpq $32,%rdx
- jae 7f
-6:
- /*
- * 8 bytes
- */
- movq (%rdi),%r8
- movq (%rsi),%r9
- cmpq %r8,%r9
- jne 4b
- leaq 8(%rdi),%rdi
- leaq 8(%rsi),%rsi
- subq $8,%rdx
- cmpq $8,%rdx
- jae 6b
- jl 1b
- jmp 3b
-7:
- /*
- * 32 bytes
- */
- movq (%rsi),%r8
- movq 8(%rsi),%r9
- subq (%rdi),%r8
- subq 8(%rdi),%r9
- or %r8,%r9
- jnz 4b
-
- movq 16(%rsi),%r8
- movq 24(%rsi),%r9
- subq 16(%rdi),%r8
- subq 24(%rdi),%r9
- or %r8,%r9
- jnz 4b
-
- leaq 32(%rdi),%rdi
- leaq 32(%rsi),%rsi
- subq $32,%rdx
- cmpq $32,%rdx
- jae 7b
- jnz 1b
- jmp 3b
-END(bcmp)
-
- .section .note.GNU-stack,"",%progbits
+#define BCMP
+#include "memcmp.S"
diff --git a/lib/libc/amd64/string/bcopy.c b/lib/libc/amd64/string/bcopy.c
index 9e0c4187e439..868567711e8b 100644
--- a/lib/libc/amd64/string/bcopy.c
+++ b/lib/libc/amd64/string/bcopy.c
@@ -2,9 +2,6 @@
* Public domain.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <string.h>
void
diff --git a/lib/libc/amd64/string/bzero.c b/lib/libc/amd64/string/bzero.c
index 1ab391076b0d..92adb2bb4f0e 100644
--- a/lib/libc/amd64/string/bzero.c
+++ b/lib/libc/amd64/string/bzero.c
@@ -2,9 +2,6 @@
* Public domain.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <string.h>
void
diff --git a/lib/libc/amd64/string/memccpy.S b/lib/libc/amd64/string/memccpy.S
new file mode 100644
index 000000000000..a2d9e33b3d36
--- /dev/null
+++ b/lib/libc/amd64/string/memccpy.S
@@ -0,0 +1,259 @@
+/*
+ * Copyright (c) 2023 The FreeBSD Foundation
+ *
+ * This software was developed by Robert Clausecker <fuz@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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 AUTHOR 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 AUTHOR 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
+ */
+
+#include <machine/asm.h>
+
+#include "amd64_archlevel.h"
+
+#define ALIGN_TEXT .p2align 4, 0x90
+
+ .weak memccpy
+ .set memccpy, __memccpy
+ARCHFUNCS(__memccpy)
+ ARCHFUNC(__memccpy, scalar)
+ ARCHFUNC(__memccpy, baseline)
+ENDARCHFUNCS(__memccpy)
+
+ARCHENTRY(__memccpy, scalar)
+ push %rbp # establish stack frame
+ mov %rsp, %rbp
+ push %rax # dummy push for alignment
+ push %rbx
+ push %rdi
+ push %rsi
+
+ mov %rsi, %rdi
+ mov %edx, %esi
+ mov %rcx, %rdx
+ mov %rcx, %rbx
+ call CNAME(__memchr) # ptr = memchr(src, c, len)
+
+ pop %rsi
+ pop %rdi
+ lea 1(%rax), %rdx
+ sub %rsi, %rdx # size = ptr - src + 1
+ mov %rbx, %rcx
+ lea (%rdi, %rdx, 1), %rbx # res = dest + size
+ test %rax, %rax # if (ptr == NULL)
+ cmovz %rcx, %rdx # size = len
+ cmovz %rax, %rbx # res = NULL
+ call CNAME(memcpy)
+
+ mov %rbx, %rax # return (res)
+ pop %rbx
+ leave
+ ret
+ARCHEND(__memccpy, scalar)
+
+ARCHENTRY(__memccpy, baseline)
+ sub $1, %rcx # RCX refers to last character in buffer
+ jb .L0 # go to special code path if len was 0
+
+ movd %edx, %xmm4
+ mov %rcx, %rdx
+ punpcklbw %xmm4, %xmm4 # c -> cc
+ mov %esi, %ecx
+ punpcklwd %xmm4, %xmm4 # cc -> cccc
+ mov %rsi, %r9 # stash a copy of the source pointer for later
+ pshufd $0, %xmm4, %xmm4 # cccc -> cccccccccccccccc
+ and $~0xf, %rsi
+ movdqa %xmm4, %xmm1
+ pcmpeqb (%rsi), %xmm1 # NUL found in head?
+ mov $-1, %r8d
+ and $0xf, %ecx
+ shl %cl, %r8d # mask of bytes in the string
+ pmovmskb %xmm1, %eax
+ and %r8d, %eax
+ jnz .Lhead_nul
+
+ movdqa 16(%rsi), %xmm3 # load second string chunk
+ movdqu (%r9), %xmm2 # load unaligned string head
+ mov $32, %r8d
+ sub %ecx, %r8d # head length + length of second chunk
+ movdqa %xmm4, %xmm1
+ pcmpeqb %xmm3, %xmm1 # NUL found in second chunk?
+
+ sub %r8, %rdx # enough space left for the second chunk?
+ jb .Lhead_buf_end
+
+ /* process second chunk */
+ pmovmskb %xmm1, %eax
+ test %eax, %eax
+ jnz .Lsecond_nul
+
+ /* string didn't end in second chunk and neither did buffer -- not a runt! */
+ movdqa 32(%rsi), %xmm0 # load next string chunk
+ movdqa %xmm4, %xmm1
+ movdqu %xmm2, (%rdi) # deposit head into buffer
+ sub %rcx, %rdi # adjust RDI to correspond to RSI
+ movdqu %xmm3, 16(%rdi) # deposit second chunk
+ sub %rsi, %rdi # express RDI as distance from RSI
+ add $32, %rsi # advance RSI past first two chunks
+ sub $16, %rdx # enough left for another round?
+ jb 1f
+
+ /* main loop unrolled twice */
+ ALIGN_TEXT
+0: pcmpeqb %xmm0, %xmm1 # NUL byte encountered?
+ pmovmskb %xmm1, %eax
+ test %eax, %eax
+ jnz 3f
+
+ movdqu %xmm0, (%rsi, %rdi)
+ movdqa 16(%rsi), %xmm0 # load next string chunk
+ movdqa %xmm4, %xmm1
+ cmp $16, %rdx # more than a full chunk left?
+ jb 2f
+
+ add $32, %rsi # advance pointers to next chunk
+ pcmpeqb %xmm0, %xmm1 # NUL byte encountered?
+ pmovmskb %xmm1, %eax
+ test %eax, %eax
+ jnz 4f
+
+ movdqu %xmm0, -16(%rsi, %rdi)
+ movdqa (%rsi), %xmm0 # load next string chunk
+ movdqa %xmm4, %xmm1
+ sub $32, %rdx
+ jae 0b
+
+1: sub $16, %rsi # undo second advancement
+ add $16, %edx
+
+ /* 1--16 bytes left in the buffer but string has not ended yet */
+2: pcmpeqb %xmm1, %xmm0 # NUL byte encountered?
+ pmovmskb %xmm0, %r8d
+ mov %r8d, %ecx
+ bts %edx, %r8d # treat end of buffer as end of string
+ or $0x10000, %eax # ensure TZCNT finds a set bit
+ tzcnt %r8d, %r8d # find tail length
+ add %rsi, %rdi # restore RDI
+ movdqu 1(%rsi, %r8, 1), %xmm0 # load string tail
+ movdqu %xmm0, 1(%rdi, %r8, 1) # store string tail
+ lea 17(%rdi, %r8, 1), %rsi # return value if terminator encountered
+ xor %eax, %eax # return value if no terminator encountered
+ bt %r8d, %ecx # terminator encountered inside buffer?
+ cmovc %rsi, %rax # if yes, return pointer, else NULL
+ ret
+
+4: sub $16, %rsi # undo second advancement
+ add $16, %rdx # restore number of remaining bytes
+
+ /* string has ended but buffer has not */
+3: tzcnt %eax, %eax # find length of string tail
+ movdqu -15(%rsi, %rax, 1), %xmm0 # load string tail (incl. NUL)
+ add %rsi, %rdi # restore destination pointer
+ movdqu %xmm0, -15(%rdi, %rax, 1) # store string tail (incl. NUL)
+ lea 1(%rdi, %rax, 1), %rax # compute return value
+ ret
+
+.Lhead_buf_end:
+ pmovmskb %xmm1, %r8d
+ add $32, %edx # restore edx to (len-1) + ecx
+ shl $16, %r8d # place 2nd chunk NUL mask into bits 16--31
+ mov %r8d, %r10d
+ bts %rdx, %r8 # treat end of buffer as if terminator present
+ xor %eax, %eax # return value if terminator not found
+ tzcnt %r8, %rdx # find string/buffer len from alignment boundary
+ lea 1(%rdi, %rdx, 1), %r8 # return value if terminator found + rcx
+ sub %rcx, %r8 # subtract rcx
+ bt %rdx, %r10 # was the terminator present?
+ cmovc %r8, %rax # if yes, return pointer, else NULL
+ sub %ecx, %edx # find actual string/buffer len
+ jmp .L0132
+
+.Lsecond_nul:
+ add %r8, %rdx # restore buffer length
+ tzcnt %eax, %r8d # where is the NUL byte?
+ lea -16(%rcx), %eax
+ sub %eax, %r8d # string length
+ lea 1(%rdi, %r8, 1), %rax # return value if NUL before end of buffer
+ xor %ecx, %ecx # return value if not
+ cmp %r8, %rdx # is the string shorter than the buffer?
+ cmova %r8, %rdx # copy only min(buflen, srclen) bytes
+ cmovb %rcx, %rax # return NUL if buffer ended before string
+.L0132: cmp $16, %rdx # at least 17 bytes to copy (not incl NUL)?
+ jb .L0116
+
+ /* copy 17--32 bytes */
+ movdqu (%r9), %xmm0 # load first 16 bytes
+ movdqu -15(%r9, %rdx, 1), %xmm1 # load last 16 bytes
+ movdqu %xmm0, (%rdi)
+ movdqu %xmm1, -15(%rdi, %rdx, 1)
+ ret
+
+.Lhead_nul:
+ tzcnt %eax, %r8d # where is the NUL byte?
+ sub %ecx, %r8d # ... from the beginning of the string?
+ lea 1(%rdi, %r8, 1), %rax # return value if NUL before end of buffer
+ xor %ecx, %ecx # return value if not
+ cmp %r8, %rdx # is the string shorter than the buffer?
+ cmova %r8, %rdx # copy only min(buflen, srclen) bytes
+ cmovb %rcx, %rax # return NUL if buffer ended before string
+
+ /* process strings of 1--16 bytes (rdx: min(buflen, srclen), rax: srclen) */
+.L0116: cmp $8, %rdx # at least 9 bytes to copy?
+ jae .L0916
+
+ cmp $4, %rdx # at least 5 bytes to copy?
+ jae .L0508
+
+ cmp $2, %rdx # at least 3 bytes to copy?
+ jae .L0304
+
+ /* copy one or two bytes */
+ movzbl (%r9), %ecx # load first byte from src
+ movzbl (%r9, %rdx, 1), %esi # load last byte from src
+ mov %cl, (%rdi) # deposit into destination
+ mov %sil, (%rdi, %rdx, 1)
+ ret
+
+.L0304: movzwl (%r9), %ecx
+ movzwl -1(%r9, %rdx, 1), %esi
+ mov %cx, (%rdi)
+ mov %si, -1(%rdi, %rdx, 1)
+ ret
+
+.L0508: mov (%r9), %ecx
+ mov -3(%r9, %rdx, 1), %esi
+ mov %ecx, (%rdi)
+ mov %esi, -3(%rdi, %rdx, 1)
+ ret
+
+.L0916: mov (%r9), %rcx
+ mov -7(%r9, %rdx, 1), %rsi
+ mov %rcx, (%rdi)
+ mov %rsi, -7(%rdi, %rdx, 1)
+ ret
+
+ /* length zero destination: return null pointer */
+.L0: xor %eax, %eax
+ ret
+ARCHEND(__memccpy, baseline)
+
+ .section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/amd64/string/memchr.S b/lib/libc/amd64/string/memchr.S
new file mode 100644
index 000000000000..cfab9b1302de
--- /dev/null
+++ b/lib/libc/amd64/string/memchr.S
@@ -0,0 +1,207 @@
+/*-
+ * Copyright (c) 2023 The FreeBSD Foundation
+ *
+ * This software was developed by Robert Clausecker <fuz@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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 AUTHOR 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 AUTHOR 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
+ */
+
+#include <machine/asm.h>
+
+#include "amd64_archlevel.h"
+
+#define ALIGN_TEXT .p2align 4,0x90 /* 16-byte alignment, nop filled */
+
+ .weak memchr
+ .set memchr, __memchr
+ARCHFUNCS(__memchr)
+ ARCHFUNC(__memchr, scalar)
+ ARCHFUNC(__memchr, baseline)
+ENDARCHFUNCS(__memchr)
+
+ARCHENTRY(__memchr, scalar)
+ test %rdx, %rdx # empty input?
+ je .Lnomatch
+
+ lea (, %rdi, 8), %ecx
+ mov $-1, %rax
+ add %rdi, %rdx # pointer to end of buffer or to end of
+ cmovc %rax, %rdx # address space (whichever comes first)
+ and $~7, %rdi # align to 8 bytes
+ mov (%rdi), %rax # load first word
+ movzbl %sil, %esi # clear stray high bits
+ movabs $0x0101010101010101, %r8
+ imul %r8, %rsi # replicate char 8 times
+
+ /* compute head and tail masks */
+ mov %r8, %r10
+ movabs $0x8080808080808080, %r9
+ shl %cl, %r10 # 0x01 where string head is
+ lea (, %rdx, 8), %ecx
+ xor %r8, %r10 # 0x01 where it is not
+ neg %r8 # negate 01..01 so we can use lea
+ mov %r9, %r11
+ xor %rsi, %rax # str ^ c (0x00 where str[i] == c)
+ neg %ecx
+ or %r10, %rax # except before the string
+ shr %cl, %r11 # 0x80 where string tail is
+
+ add $8, %rdi # advance to next 8 bytes
+ cmp %rdx, %rdi # end of buffer reached during head?
+ jae .Ltail # and go to tail-processing code
+
+ /* main loop, unrolled twice */
+ ALIGN_TEXT
+0: lea (%rax, %r8, 1), %rcx # (str ^ c) - 0x01..01
+ not %rax # ~(str ^ c)
+ and %r9, %rax # ((str^c) - 0x01..01) & ~(str^c)
+ and %rcx, %rax # not including junk bytes
+ jnz .Lmatch
+
+ mov (%rdi), %rax
+ add $8, %rdi
+ xor %rsi, %rax # str ^ c
+ cmp %rdx, %rdi
+ jae .Ltail
+
+ lea (%rax, %r8, 1), %rcx # (str ^ c) - 0x01..01
+ not %rax # ~(str ^ c)
+ and %r9, %rax # ((str^c) - 0x01..01) & ~(str^c)
+ and %rcx, %rax # not including junk bytes
+ jnz .Lmatch
+
+ mov (%rdi), %rax
+ add $8, %rdi
+ xor %rsi, %rax # str ^ c
+ cmp %rdx, %rdi
+ jb 0b
+
+.Ltail: lea (%rax, %r8, 1), %rcx # (str ^ c) - 0x01..01
+ not %rax # ~(str ^ c)
+ and %r11, %rax # ((str^c) - 0x01..01) & ~(str^c)
+ and %rcx, %rax # not including junk bytes or bytes past buffer
+ jz .Lnomatch
+
+.Lmatch:
+ tzcnt %rax, %rax # first match
+ shr $3, %eax # scale from bit to byte index
+ lea -8(%rdi, %rax), %rax # pointer to found c
+ ret
+
+ /* no match found */
+.Lnomatch:
+ xor %eax, %eax # return null pointer
+ ret
+ARCHEND(__memchr, scalar)
+
+ARCHENTRY(__memchr, baseline)
+ test %rdx, %rdx # empty input?
+ je .Lnomatchb
+
+ movd %esi, %xmm2
+ mov %edi, %ecx
+ mov $-1, %r9
+ add %rdi, %rdx # pointer to end of buffer or to end of
+ cmovc %r9, %rdx # address space (whichever comes first)
+ and $~0x1f, %rdi # align to 32 bytes
+ movdqa (%rdi), %xmm0 # load first 32 bytes
+ movdqa 16(%rdi), %xmm1
+
+ punpcklbw %xmm2, %xmm2 # c -> cc
+
+ shl %cl, %r9d # mask with zeroes before the string
+
+ punpcklwd %xmm2, %xmm2 # cc -> cccc
+
+ mov $-1, %r8d
+ xor %ecx, %ecx
+ sub %edx, %ecx # edx = -ecx
+ shr %cl, %r8d # bytes in tail that are part of the buffer
+
+ pshufd $0, %xmm2, %xmm2 # cccc -> cccccccccccccccc
+
+ add $32, %rdi # advance to next 32 bytes
+ mov $-1, %eax
+ cmp %rdx, %rdi # end of buffer reached during head?
+ cmovae %r8d, %eax # if yes, do combined head/tail processing
+ and %r9d, %eax # mask of bytes in head part of string
+
+ /* process head */
+ pcmpeqb %xmm2, %xmm1
+ pcmpeqb %xmm2, %xmm0
+ pmovmskb %xmm1, %esi
+ pmovmskb %xmm0, %ecx
+ shl $16, %esi
+ or %esi, %ecx # locations of matches
+ and %ecx, %eax # any match inside buffer?
+ jnz .Lprecisematchb
+
+ cmp %rdx, %rdi # did the buffer end here?
+ jae .Lnomatchb # if yes we are done
+
+ /* main loop */
+ ALIGN_TEXT
+0: movdqa (%rdi), %xmm0 # load next string chunk
+ movdqa 16(%rdi), %xmm1
+ add $32, %rdi
+ cmp %rdx, %rdi # ready for main loop?
+ jae .Ltailb
+
+ pcmpeqb %xmm2, %xmm0
+ pcmpeqb %xmm2, %xmm1
+ por %xmm1, %xmm0 # match in either half?
+ pmovmskb %xmm0, %eax
+ test %eax, %eax
+ jz 0b
+
+.Lmatchb:
+ pcmpeqb -32(%rdi), %xmm2 # redo comparison of first 16 bytes
+ pmovmskb %xmm1, %ecx
+ pmovmskb %xmm2, %eax
+ shl $16, %ecx
+ or %ecx, %eax # location of matches
+
+.Lprecisematchb:
+ tzcnt %eax, %eax # find location of match
+ lea -32(%rdi, %rax, 1), %rax # point to matching byte
+ ret
+
+.Ltailb:
+ pcmpeqb %xmm2, %xmm1
+ pcmpeqb %xmm2, %xmm0
+ pmovmskb %xmm1, %edx
+ pmovmskb %xmm0, %eax
+ shl $16, %edx
+ or %edx, %eax # location of matches
+ and %r8d, %eax # mask out matches beyond buffer
+ bsf %eax, %edx # location of match
+ lea -32(%rdi, %rdx, 1), %rdx # pointer to match (if any)
+ cmovnz %rdx, %rax # point to match if present,
+ ret # else null pointer
+
+.Lnomatchb:
+ xor %eax, %eax # return null pointer
+ ret
+ARCHEND(__memchr, baseline)
+
+ .section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/amd64/string/memcmp.S b/lib/libc/amd64/string/memcmp.S
index 0c8121f9d885..dc8bcff73cb9 100644
--- a/lib/libc/amd64/string/memcmp.S
+++ b/lib/libc/amd64/string/memcmp.S
@@ -1,9 +1,12 @@
/*-
- * Copyright (c) 2018 The FreeBSD Foundation
+ * Copyright (c) 2018, 2023 The FreeBSD Foundation
*
* This software was developed by Mateusz Guzik <mjg@FreeBSD.org>
* under sponsorship from the FreeBSD Foundation.
*
+ * Portions of this software were developed by Robert Clausecker
+ * <fuz@FreeBSD.org> under sponsorship from the FreeBSD Foundation.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -24,12 +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$
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
+#include <machine/param.h>
+
+#include "amd64_archlevel.h"
/*
* Note: this routine was written with kernel use in mind (read: no simd),
@@ -39,7 +42,16 @@ __FBSDID("$FreeBSD$");
#define ALIGN_TEXT .p2align 4,0x90 /* 16-byte alignment, nop filled */
-ENTRY(memcmp)
+#ifdef BCMP
+#define memcmp bcmp
+#endif
+
+ARCHFUNCS(memcmp)
+ ARCHFUNC(memcmp, scalar)
+ ARCHFUNC(memcmp, baseline)
+ENDARCHFUNCS(memcmp)
+
+ARCHENTRY(memcmp, scalar)
xorl %eax,%eax
10:
cmpq $16,%rdx
@@ -143,8 +155,24 @@ ENTRY(memcmp)
/*
* Mismatch was found.
- *
- * Before we compute it we narrow down the range (16 -> 8 -> 4 bytes).
+ */
+#ifdef BCMP
+ ALIGN_TEXT
+10320016:
+10320000:
+10081608:
+10163224:
+10163216:
+10163208:
+10040804:
+80:
+1:
+ leal 1(%eax),%eax
+ ret
+#else
+/*
+ * We need to compute the difference between strings.
+ * Start with narrowing the range down (16 -> 8 -> 4 bytes).
*/
ALIGN_TEXT
10320016:
@@ -213,6 +241,180 @@ ENTRY(memcmp)
2:
subl %r8d,%eax
ret
-END(memcmp)
+#endif
+ARCHEND(memcmp, scalar)
+
+ARCHENTRY(memcmp, baseline)
+ cmp $32, %rdx # enough to permit use of the long kernel?
+ ja .Llong
+
+ test %rdx, %rdx # zero bytes buffer?
+ je .L0
+
+ /*
+ * Compare strings of 1--32 bytes. We want to do this by
+ * loading into two xmm registers and then comparing. To avoid
+ * crossing into unmapped pages, we either load 32 bytes from
+ * the start of the buffer or 32 bytes before its end, depending
+ * on whether there is a page boundary between the overread area
+ * or not.
+ */
+
+ /* check for page boundaries overreads */
+ lea 31(%rdi), %eax # end of overread
+ lea 31(%rsi), %r8d
+ lea -1(%rdi, %rdx, 1), %ecx # last character in buffer
+ lea -1(%rsi, %rdx, 1), %r9d
+ xor %ecx, %eax
+ xor %r9d, %r8d
+ test $PAGE_SIZE, %eax # are they on different pages?
+ jz 0f
+
+ /* fix up rdi */
+ movdqu -32(%rdi, %rdx, 1), %xmm0
+ movdqu -16(%rdi, %rdx, 1), %xmm1
+ lea -8(%rsp), %rdi # end of replacement buffer
+ sub %rdx, %rdi # start of replacement buffer
+ movdqa %xmm0, -40(%rsp) # copy to replacement buffer
+ movdqa %xmm1, -24(%rsp)
+
+0: test $PAGE_SIZE, %r8d
+ jz 0f
+
+ /* fix up rsi */
+ movdqu -32(%rsi, %rdx, 1), %xmm0
+ movdqu -16(%rsi, %rdx, 1), %xmm1
+ lea -40(%rsp), %rsi # end of replacement buffer
+ sub %rdx, %rsi # start of replacement buffer
+ movdqa %xmm0, -72(%rsp) # copy to replacement buffer
+ movdqa %xmm1, -56(%rsp)
+
+ /* load data and compare properly */
+0: movdqu 16(%rdi), %xmm1
+ movdqu 16(%rsi), %xmm3
+ movdqu (%rdi), %xmm0
+ movdqu (%rsi), %xmm2
+ mov %edx, %ecx
+ mov $-1, %edx
+ shl %cl, %rdx # ones where the buffer is not
+ pcmpeqb %xmm3, %xmm1
+ pcmpeqb %xmm2, %xmm0
+ pmovmskb %xmm1, %ecx
+ pmovmskb %xmm0, %eax
+ shl $16, %ecx
+ or %ecx, %eax # ones where the buffers match
+ or %edx, %eax # including where the buffer is not
+ not %eax # ones where there is a mismatch
+#ifndef BCMP
+ bsf %eax, %edx # location of the first mismatch
+ cmovz %eax, %edx # including if there is no mismatch
+ movzbl (%rdi, %rdx, 1), %eax # mismatching bytes
+ movzbl (%rsi, %rdx, 1), %edx
+ sub %edx, %eax
+#endif
+ ret
+
+ /* empty input */
+.L0: xor %eax, %eax
+ ret
+
+ /* compare 33+ bytes */
+ ALIGN_TEXT
+.Llong: movdqu (%rdi), %xmm0 # load head
+ movdqu (%rsi), %xmm2
+ mov %rdi, %rcx
+ sub %rdi, %rsi # express rsi as distance from rdi
+ and $~0xf, %rdi # align rdi to 16 bytes
+ movdqu 16(%rsi, %rdi, 1), %xmm1
+ pcmpeqb 16(%rdi), %xmm1 # compare second half of this iteration
+ add %rcx, %rdx # pointer to last byte in buffer
+ jc .Loverflow # did this overflow?
+0: pcmpeqb %xmm2, %xmm0
+ pmovmskb %xmm0, %eax
+ xor $0xffff, %eax # any mismatch?
+ jne .Lmismatch_head
+ add $64, %rdi # advance to next iteration
+ jmp 1f # and get going with the loop
+
+ /*
+ * If we got here, a buffer length was passed to memcmp(a, b, len)
+ * such that a + len < a. While this sort of usage is illegal,
+ * it is plausible that a caller tries to do something like
+ * memcmp(a, b, SIZE_MAX) if a and b are known to differ, intending
+ * for memcmp() to stop comparing at the first mismatch. This
+ * behaviour is not guaranteed by any version of ISO/IEC 9899,
+ * but usually works out in practice. Let's try to make this
+ * case work by comparing until the end of the address space.
+ */
+.Loverflow:
+ mov $-1, %rdx # compare until the end of memory
+ jmp 0b
+
+ /* process buffer 32 bytes at a time */
+ ALIGN_TEXT
+0: movdqu -32(%rsi, %rdi, 1), %xmm0
+ movdqu -16(%rsi, %rdi, 1), %xmm1
+ pcmpeqb -32(%rdi), %xmm0
+ pcmpeqb -16(%rdi), %xmm1
+ add $32, %rdi # advance to next iteration
+1: pand %xmm0, %xmm1 # 0xff where both halves matched
+ pmovmskb %xmm1, %eax
+ cmp $0xffff, %eax # all bytes matched?
+ jne .Lmismatch
+ cmp %rdx, %rdi # end of buffer reached?
+ jb 0b
+
+ /* less than 32 bytes left to compare */
+ movdqu -16(%rdx), %xmm1 # load 32 byte tail through end pointer
+ movdqu -16(%rdx, %rsi, 1), %xmm3
+ movdqu -32(%rdx), %xmm0
+ movdqu -32(%rdx, %rsi, 1), %xmm2
+ pcmpeqb %xmm3, %xmm1
+ pcmpeqb %xmm2, %xmm0
+ pmovmskb %xmm1, %ecx
+ pmovmskb %xmm0, %eax
+ shl $16, %ecx
+ or %ecx, %eax # ones where the buffers match
+ not %eax # ones where there is a mismatch
+#ifndef BCMP
+ bsf %eax, %ecx # location of the first mismatch
+ cmovz %eax, %ecx # including if there is no mismatch
+ add %rcx, %rdx # pointer to potential mismatch
+ movzbl -32(%rdx), %eax # mismatching bytes
+ movzbl -32(%rdx, %rsi, 1), %edx
+ sub %edx, %eax
+#endif
+ ret
+
+#ifdef BCMP
+.Lmismatch:
+ mov $1, %eax
+.Lmismatch_head:
+ ret
+#else /* memcmp */
+.Lmismatch_head:
+ tzcnt %eax, %eax # location of mismatch
+ add %rax, %rcx # pointer to mismatch
+ movzbl (%rcx), %eax # mismatching bytes
+ movzbl (%rcx, %rsi, 1), %ecx
+ sub %ecx, %eax
+ ret
+
+.Lmismatch:
+ movdqu -48(%rsi, %rdi, 1), %xmm1
+ pcmpeqb -48(%rdi), %xmm1 # reconstruct xmm1 before PAND
+ pmovmskb %xmm0, %eax # mismatches in first 16 bytes
+ pmovmskb %xmm1, %edx # mismatches in second 16 bytes
+ shl $16, %edx
+ or %edx, %eax # mismatches in both
+ not %eax # matches in both
+ tzcnt %eax, %eax # location of mismatch
+ add %rax, %rdi # pointer to mismatch
+ movzbl -64(%rdi), %eax # mismatching bytes
+ movzbl -64(%rdi, %rsi, 1), %ecx
+ sub %ecx, %eax
+ ret
+#endif
+ARCHEND(memcmp, baseline)
.section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/amd64/string/memcpy.S b/lib/libc/amd64/string/memcpy.S
index 2b6c73abeb98..1876ee600f20 100644
--- a/lib/libc/amd64/string/memcpy.S
+++ b/lib/libc/amd64/string/memcpy.S
@@ -1,5 +1,4 @@
/* $NetBSD: memcpy.S,v 1.1 2001/06/19 00:25:05 fvdl Exp $ */
-/* $FreeBSD$ */
#define MEMCPY
#include "memmove.S"
diff --git a/lib/libc/amd64/string/memmove.S b/lib/libc/amd64/string/memmove.S
index 3d75ff45c798..7878e6e9bee6 100644
--- a/lib/libc/amd64/string/memmove.S
+++ b/lib/libc/amd64/string/memmove.S
@@ -27,8 +27,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* Note: this routine was written with kernel use in mind (read: no simd),
* it is only present in userspace as a temporary measure until something
@@ -274,13 +272,6 @@ __FBSDID("$FreeBSD$");
ALIGN_TEXT
2256:
std
-.if \erms == 1
- leaq -1(%rdi,%rcx),%rdi
- leaq -1(%rsi,%rcx),%rsi
- rep
- movsb
- cld
-.else
leaq -8(%rdi,%rcx),%rdi
leaq -8(%rsi,%rcx),%rsi
shrq $3,%rcx
@@ -290,7 +281,6 @@ __FBSDID("$FreeBSD$");
movq %rdx,%rcx
andb $7,%cl
jne 2004b
-.endif
\end
ret
.endif
@@ -314,3 +304,5 @@ ENTRY(memcpy)
MEMMOVE erms=0 overlap=1 begin=MEMMOVE_BEGIN end=MEMMOVE_END
END(memcpy)
#endif
+
+ .section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/amd64/string/memrchr.S b/lib/libc/amd64/string/memrchr.S
new file mode 100644
index 000000000000..4f6c5a238daa
--- /dev/null
+++ b/lib/libc/amd64/string/memrchr.S
@@ -0,0 +1,166 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2023 Robert Clausecker
+ */
+
+#include <machine/asm.h>
+
+#include "amd64_archlevel.h"
+
+#define ALIGN_TEXT .p2align 4, 0x90
+
+ARCHFUNCS(memrchr)
+ ARCHFUNC(memrchr, scalar)
+ ARCHFUNC(memrchr, baseline)
+ENDARCHFUNCS(memrchr)
+
+ARCHENTRY(memrchr, scalar)
+ xor %eax, %eax # prospective return value
+ sub $4, %rdx # 4 bytes left to process?
+ jb 1f
+
+ ALIGN_TEXT
+0: xor %r8, %r8
+ lea 2(%rdi), %r10
+ cmp %sil, 2(%rdi)
+ cmovne %r8, %r10 # point to null if no match
+
+ cmp %sil, (%rdi)
+ cmove %rdi, %r8 # point to first char if match
+
+ lea 1(%rdi), %r9
+ cmp %sil, 1(%rdi)
+ cmovne %r8, %r9 # point to first result if no match in second
+
+ lea 3(%rdi), %r11
+ cmp %sil, 3(%rdi)
+ cmovne %r10, %r11
+
+ test %r11, %r11
+ cmovz %r9, %r11 # take first pair match if none in second
+
+ test %r11, %r11
+ cmovnz %r11, %rax # take match in current set if any
+
+ add $4, %rdi
+ sub $4, %rdx
+ jae 0b
+
+1: cmp $-3, %edx # a least one character left to process?
+ jb 2f
+
+ cmp %sil, (%rdi)
+ cmove %rdi, %rax
+
+ lea 1(%rdi), %rcx
+ cmp $-2, %edx # at least two characters left to process?
+ jb 2f
+
+ cmp %sil, 1(%rdi)
+ cmove %rcx, %rax
+
+ lea 2(%rdi), %rcx
+ cmp $-1, %edx # at least three character left to process?
+ jb 2f
+
+ cmp %sil, 2(%rdi)
+ cmove %rcx, %rax
+
+2: ret
+ARCHEND(memrchr, scalar)
+
+ARCHENTRY(memrchr, baseline)
+ movd %esi, %xmm4
+ test %rdx, %rdx # empty buffer?
+ jz .L0 # if yes, return immediately
+
+ punpcklbw %xmm4, %xmm4 # c -> cc
+ mov %edi, %ecx
+ punpcklwd %xmm4, %xmm4 # cc -> cccc
+ and $~0xf, %rdi # align source pointer
+ pshufd $0, %xmm4, %xmm4 # cccc -> cccccccccccccccc
+ and $0xf, %ecx
+ movdqa %xmm4, %xmm0
+ mov $-1, %r8d
+ pcmpeqb (%rdi), %xmm0 # compare aligned head
+ shl %cl, %r8d # mask of bytes in the head of the buffer
+ pmovmskb %xmm0, %eax
+
+ sub $16, %rcx
+ and %r8d, %eax # match mask
+ add %rcx, %rdx # advance past head
+ cmc
+ jbe .Lrunt # did the string end in the buffer?
+
+ mov %rdi, %rsi # pointer to matching chunk
+ add $16, %rdi
+ sub $16, %rdx # enough left for another round?
+ jbe 1f
+
+ /* main loop unrolled twice */
+ ALIGN_TEXT
+0: movdqa %xmm4, %xmm0
+ pcmpeqb (%rdi), %xmm0
+ pmovmskb %xmm0, %r8d
+
+ cmp $16, %rdx # enough left for second chunk?
+ jbe 2f
+
+ movdqa %xmm4, %xmm0
+ pcmpeqb 16(%rdi), %xmm0
+ pmovmskb %xmm0, %ecx
+
+ lea 16(%rdi), %r9
+ test %ecx, %ecx # match found in second chunk?
+ cmovz %r8d, %ecx # if not, use match data from first chunk
+ cmovz %rdi, %r9
+
+ test %ecx, %ecx # any match found?
+ cmovnz %ecx, %eax # if yes, overwrite previously found match
+ cmovnz %r9, %rsi
+
+ add $32, %rdi # advance to next iteration
+ sub $32, %rdx # advance to next chunks
+ ja 0b
+
+ /* process remaining 1--16 bytes */
+1: pcmpeqb (%rdi), %xmm4
+ mov $0xffff, %r8d
+ xor %ecx, %ecx
+ sub %edx, %ecx # number of bytes to be masked out
+ pmovmskb %xmm4, %r9d
+ shr %cl, %r8d # mask of bytes to be kept in the buffer
+ and %r9d, %r8d
+ cmovnz %r8d, %eax
+ cmovnz %rdi, %rsi
+ bsr %eax, %eax
+ lea (%rsi, %rax, 1), %rsi # pointer to match (or junk)
+ cmovnz %rsi, %rax # if any match was found, return it
+ ret
+
+ /* end of chunk reached within first half iteration */
+2: test %r8d, %r8d # match in previous chunk?
+ cmovnz %r8d, %eax # if yes, overwrite previous chunks
+ cmovnz %rdi, %rsi
+ add $16, %rdi # point to tail
+ sub $16, %edx
+ jmp 1b # handle tail the same otherwise
+
+ /* runt: string ends within head, edx has negated amount of invalid head bytes */
+.Lrunt: mov $0xffff, %r8d
+ xor %ecx, %ecx
+ sub %edx, %ecx
+ shr %cl, %r8d
+ and %r8d, %eax
+ bsr %eax, %eax
+ lea (%rdi, %rax, 1), %rdi
+ cmovnz %rdi, %rax
+ ret
+
+ /* empty buffer: return a null pointer */
+.L0: xor %eax, %eax
+ ret
+ARCHEND(memrchr, baseline)
+
+ .section .note.GNU-stack, "", %progbits
diff --git a/lib/libc/amd64/string/memset.S b/lib/libc/amd64/string/memset.S
index 050711302354..bfab34eeaeb9 100644
--- a/lib/libc/amd64/string/memset.S
+++ b/lib/libc/amd64/string/memset.S
@@ -24,13 +24,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.
- *
- * $FreeBSD$
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* Note: this routine was written with kernel use in mind (read: no simd),
* it is only present in userspace as a temporary measure until something
diff --git a/lib/libc/amd64/string/stpcpy.S b/lib/libc/amd64/string/stpcpy.S
index 52ac69c5f7e2..59358e3245a8 100644
--- a/lib/libc/amd64/string/stpcpy.S
+++ b/lib/libc/amd64/string/stpcpy.S
@@ -1,11 +1,29 @@
-/*
- * Adapted by Guillaume Morin <guillaume@morinfr.org> from strcpy.S
- * written by J.T. Conklin <jtc@acorntoolworks.com>
- * Public domain.
+/*-
+ * Copyright (c) 2023, The FreeBSD Foundation
+ *
+ * SPDX-License-Expression: BSD-2-Clause
+ *
+ * Portions of this software were developed by Robert Clausecker
+ * <fuz@FreeBSD.org> under sponsorship from the FreeBSD Foundation.
+ *
+ * Adapted from NetBSD's common/lib/libc/arch/x86_64/string/strcpy.S
+ * written by J.T. Conklin <jtc@acorntoolworks.com> and
+ * adapted by Guillaume Morin <guillaume@morinfr.org> to implement stpcpy
+ * that was originally dedicated to the public domain
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
+
+#include "amd64_archlevel.h"
+
+#define ALIGN_TEXT .p2align 4, 0x90
+
+ .weak stpcpy
+ .set stpcpy, __stpcpy
+ARCHFUNCS(__stpcpy)
+ ARCHFUNC(__stpcpy, scalar)
+ ARCHFUNC(__stpcpy, baseline)
+ENDARCHFUNCS(__stpcpy)
/*
* This stpcpy implementation copies a byte at a time until the
@@ -20,9 +38,7 @@ __FBSDID("$FreeBSD$");
* requirements.
*/
- .globl stpcpy,__stpcpy
-ENTRY(stpcpy)
-__stpcpy:
+ARCHENTRY(__stpcpy, scalar)
movabsq $0x0101010101010101,%r8
movabsq $0x8080808080808080,%r9
@@ -43,7 +59,7 @@ __stpcpy:
dec %rax
ret
- .p2align 4
+ ALIGN_TEXT
.Lloop:
movq %rdx,(%rdi)
addq $8,%rdi
@@ -111,6 +127,111 @@ __stpcpy:
.Ldone:
movq %rdi,%rax
ret
-END(stpcpy)
-
+ARCHEND(__stpcpy, scalar)
+
+ARCHENTRY(__stpcpy, baseline)
+ mov %esi, %ecx
+ mov %rdi, %rdx
+ sub %rsi, %rdi # express destination as distance to surce
+ and $~0xf, %rsi # align source to 16 byte
+ movdqa (%rsi), %xmm0 # head of string with junk before
+ pxor %xmm1, %xmm1
+ and $0xf, %ecx # misalignment in bytes
+ pcmpeqb %xmm1, %xmm0 # NUL byte present?
+ pmovmskb %xmm0, %eax
+ shr %cl, %eax # clear out matches in junk bytes
+ bsf %eax, %eax # find match if any
+ jnz .Lrunt
+
+ /* first normal iteration: write head back if it succeeds */
+ movdqa 16(%rsi), %xmm0 # 16 bytes of current iteration
+ movdqu (%rsi, %rcx, 1), %xmm2 # first 16 bytes of the string
+ pcmpeqb %xmm0, %xmm1 # NUL byte present?
+ pmovmskb %xmm1, %eax
+ test %eax, %eax # find match if any
+ jnz .Lshorty
+
+ movdqu %xmm2, (%rdx) # store beginning of string
+
+ /* main loop, unrolled twice */
+ ALIGN_TEXT
+0: movdqa 32(%rsi), %xmm2 # load current iteraion
+ movdqu %xmm0, 16(%rsi, %rdi, 1) # write back previous iteraion
+ pxor %xmm1, %xmm1
+ add $32, %rsi
+ pcmpeqb %xmm2, %xmm1 # NUL byte present?
+ pmovmskb %xmm1, %eax
+ test %eax, %eax
+ jnz 1f
+
+ movdqa 16(%rsi), %xmm0 # load current iteraion
+ movdqu %xmm2, (%rsi, %rdi, 1) # write back previous iteraion
+ pxor %xmm1, %xmm1
+ pcmpeqb %xmm0, %xmm1 # NUL byte present?
+ pmovmskb %xmm1, %eax
+ test %eax, %eax
+ jz 0b
+
+ /* end of string after main loop has iterated */
+ add $16, %rsi # advance rsi to second unrolled half
+1: tzcnt %eax, %eax # find location of match
+ # (behaves as bsf on pre-x86-64-v3 CPUs)
+ add %rsi, %rax # point to NUL byte
+ movdqu -15(%rax), %xmm0 # last 16 bytes of string
+ movdqu %xmm0, -15(%rax, %rdi, 1) # copied to destination
+ add %rdi, %rax # point to destination's NUL byte
+ ret
+
+ /* NUL encountered in second iteration */
+.Lshorty:
+ tzcnt %eax, %eax
+ add $16, %eax # account for length of first iteration
+ sub %ecx, %eax # but not the parts before the string
+
+ /* NUL encountered in first iteration */
+.Lrunt: lea 1(%rax), %edi # string length including NUL byte
+ add %rcx, %rsi # point to beginning of string
+ add %rdx, %rax # point to NUL byte
+
+ /* transfer 16--32 bytes */
+.L1632: cmp $16, %edi
+ jb .L0815
+
+ movdqu -16(%rsi, %rdi, 1), %xmm0 # load last 16 bytes
+ movdqu %xmm2, (%rdx) # store first 16 bytes
+ movdqu %xmm0, -15(%rax) # store last 16 bytes
+ ret
+
+ /* transfer 8--15 bytes */
+.L0815: cmp $8, %edi
+ jb .L0407
+
+ mov (%rsi), %rcx # load first 8 bytes
+ mov -8(%rsi, %rdi, 1), %rdi # load last 8 bytes
+ mov %rcx, (%rdx) # store to dst
+ mov %rdi, -7(%rax) # dito
+ ret
+
+ /* transfer 4--7 bytes */
+.L0407: cmp $4, %edi
+ jb .L0203
+
+ mov (%rsi), %ecx
+ mov -4(%rsi, %rdi, 1), %edi
+ mov %ecx, (%rdx)
+ mov %edi, -3(%rax)
+ ret
+
+ /* transfer 2--3 bytes */
+.L0203: cmp $2, %edi
+ jb .L0101
+
+ movzwl (%rsi), %ecx
+ mov %cx, (%rdx) # store first two bytes
+
+ /* transfer 0 bytes (last byte is always NUL) */
+.L0101: movb $0, (%rax) # store terminating NUL byte
+ ret
+ARCHEND(__stpcpy, baseline)
+
.section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/amd64/string/stpncpy.S b/lib/libc/amd64/string/stpncpy.S
new file mode 100644
index 000000000000..5ce0dd093a9e
--- /dev/null
+++ b/lib/libc/amd64/string/stpncpy.S
@@ -0,0 +1,283 @@
+/*
+ * Copyright (c) 2023 The FreeBSD Foundation
+ *
+ * This software was developed by Robert Clausecker <fuz@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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 AUTHOR 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 AUTHOR 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
+ */
+
+#include <machine/asm.h>
+
+#include "amd64_archlevel.h"
+
+#define ALIGN_TEXT .p2align 4, 0x90
+
+ .weak stpncpy
+ .set stpncpy, __stpncpy
+ARCHFUNCS(__stpncpy)
+ ARCHFUNC(__stpncpy, scalar)
+ ARCHFUNC(__stpncpy, baseline)
+ENDARCHFUNCS(__stpncpy)
+
+ARCHENTRY(__stpncpy, scalar)
+ push %rbp # establish stack frame
+ mov %rsp, %rbp
+
+ push %rdx
+ push %rdi
+ push %rsi
+ push %rax # dummy push for alignment
+
+ mov %rsi, %rdi
+ xor %esi, %esi
+ call CNAME(__memchr) # memchr(src, '\0', len)
+ pop %rcx # dummy pop
+ pop %rsi
+ mov -16(%rbp), %rdi
+
+ test %rax, %rax # NUL found?
+ jz .Lfullcopy
+
+ mov %rax, %rdx
+ sub %rsi, %rdx # copy until the NUL byte
+ add %rdx, -16(%rbp) # advance destination by string length
+ sub %rdx, -8(%rbp) # and shorten buffer size by string length
+ call CNAME(memcpy)
+
+ pop %rdi
+ pop %rdx
+ xor %esi, %esi
+ pop %rbp
+ jmp CNAME(memset) # clear remaining buffer
+
+.Lfullcopy:
+ mov -8(%rbp), %rdx
+ call CNAME(memcpy) # copy whole string
+ add -8(%rbp), %rax # point to dest[n]
+ leave
+ ret
+ARCHEND(__stpncpy, scalar)
+
+ /*
+ * this mask allows us to generate masks of 16-n 0xff bytes
+ * followed by n 0x00 bytes by loading from .Lmask+n.
+ */
+ .section .rodata
+.Lmask: .quad 0xffffffffffffffff
+ .quad 0xffffffffffffffff
+ .quad 0x0000000000000000
+ .quad 0x0000000000000000
+
+/* stpncpy(char *restrict rdi, const char *rsi, size_t rdx) */
+ARCHENTRY(__stpncpy, baseline)
+#define bounce (-3*16-8) /* location of on-stack bounce buffer */
+
+ test %rdx, %rdx # no bytes to copy?
+ jz .L0
+
+ mov %esi, %ecx
+ and $~0xf, %rsi # align source to 16 bytes
+ movdqa (%rsi), %xmm0 # load head
+ and $0xf, %ecx # offset from alignment
+ mov $-1, %r9d
+ lea -32(%rcx), %rax # set up overflow-proof comparison rdx+rcx<=32
+ shl %cl, %r9d # mask of bytes belonging to the string
+ sub %rcx, %rdi # adjust RDI to correspond to RSI
+ pxor %xmm1, %xmm1
+ movdqa %xmm0, bounce(%rsp) # stash copy of head on the stack
+ pcmpeqb %xmm1, %xmm0
+ pmovmskb %xmm0, %r8d
+
+ lea (%rdx, %rcx, 1), %r10 # buffer length from alignment boundary
+ add %rdx, %rax # less than 2 chunks (32 bytes) to play with?
+ jnc .Lrunt # if yes, use special runt processing
+
+ movdqu %xmm1, -16(%rdi, %r10, 1) # clear final bytes of destination
+ and %r9d, %r8d # end of string within head?
+ jnz .Lheadnul
+
+ movdqu (%rsi, %rcx, 1), %xmm2 # load head from source buffer
+ movdqu %xmm2, (%rdi, %rcx, 1) # an deposit
+
+ add $16, %rsi
+ add $16, %rdi
+ sub $32, %r10
+
+ /* main loop unrolled twice */
+ ALIGN_TEXT
+0: movdqa (%rsi), %xmm0
+ pxor %xmm1, %xmm1
+ pcmpeqb %xmm0, %xmm1 # NUL byte encountered?
+ pmovmskb %xmm1, %r8d
+ test %r8d, %r8d
+ jnz 3f
+
+ movdqu %xmm0, (%rdi)
+ cmp $16, %r10 # more than a full chunk left?
+ jbe 1f
+
+ movdqa 16(%rsi), %xmm0
+ add $32, %rdi # advance pointers to next chunk
+ add $32, %rsi
+ pxor %xmm1, %xmm1
+ pcmpeqb %xmm0, %xmm1 # NUL byte encountered?
+ pmovmskb %xmm1, %r8d
+ test %r8d, %r8d
+ jnz 2f
+
+ movdqu %xmm0, -16(%rdi)
+ sub $32, %r10 # more than another full chunk left?
+ ja 0b
+
+ sub $16, %rdi # undo second advancement
+ sub $16, %rsi
+ add $16, %r10d # restore number of remaining bytes
+
+ /* 1--16 bytes left but string has not ended yet */
+1: pxor %xmm1, %xmm1
+ pcmpeqb 16(%rsi), %xmm1 # NUL byte in source tail?
+ pmovmskb %xmm1, %r8d
+ bts %r10d, %r8d # treat end of buffer as NUL
+ tzcnt %r8d, %r8d # where is the NUL byte?
+ movdqu (%rsi, %r8, 1), %xmm0 # load source tail before NUL
+ lea 16(%rdi, %r8, 1), %rax # point return value to NUL byte
+ # or end of buffer
+ movdqu %xmm0, (%rdi, %r8, 1) # store tail into the buffer
+ ret
+
+2: sub $16, %rdi # undo second advancement
+ sub $16, %rsi
+ sub $16, %r10
+
+ /* string has ended and buffer has not */
+3: tzcnt %r8d, %r8d # where did the string end?
+ lea .Lmask+16(%rip), %rcx
+ lea (%rdi, %r8, 1), %rax # where the NUL byte will be
+ neg %r8
+ movdqu (%rcx, %r8, 1), %xmm1 # mask with FF where the string is,
+ # 00 where it is not
+ pand %xmm1, %xmm0 # mask out bytes after the string
+ movdqu %xmm0, (%rdi) # store masked current chunk
+ pxor %xmm1, %xmm1
+ sub $16, %r10 # another full chunk left?
+ jbe 1f
+
+ /* clear remaining destination buffer (tail has been cleared earlier) */
+ ALIGN_TEXT
+0: movdqu %xmm1, 16(%rdi)
+ cmp $16, %r10
+ jbe 1f
+
+ movdqu %xmm1, 32(%rdi)
+ add $32, %rdi
+ sub $32, %r10
+ ja 0b
+
+1: ret
+
+ /* at least two chunks to play with and NUL while processing head */
+.Lheadnul:
+ movdqu bounce(%rsp, %rcx, 1), %xmm0 # load start of source from stack
+ tzcnt %r8d, %r8d # find location of NUL byte
+ movdqu %xmm0, (%rdi, %rcx, 1) # deposit head in the destination
+ movdqu %xmm1, (%rdi, %r8, 1) # clear out following bytes
+ movdqu %xmm1, 16(%rdi) # clear out second chunk
+ lea (%rdi, %r8, 1), %rax # make RAX point to the NUL byte
+
+ add $32, %rdi # advance past first two chunks
+ sub $32+16, %r10 # advance past first three chunks
+ jbe 1f # did we pass the end of the buffer?
+
+ /* clear remaining destination buffer (tail has been cleared earlier) */
+ ALIGN_TEXT
+0: movdqu %xmm1, (%rdi) # clear out buffer chunk
+ cmp $16, %r10
+ jbe 1f
+
+ movdqu %xmm1, 16(%rdi)
+ add $32, %rdi
+ sub $32, %r10
+ ja 0b
+
+1: ret
+
+ /* 1--32 bytes to copy, bounce through the stack */
+.Lrunt: movdqa %xmm1, bounce+16(%rsp) # clear out rest of on-stack copy
+ bts %r10d, %r8d # treat end of buffer as end of string
+ and %r9w, %r8w # end of string within first buffer?
+ jnz 0f # if yes, do not inspect second buffer
+
+ movdqa 16(%rsi), %xmm0 # load second chunk of input
+ movdqa %xmm0, bounce+16(%rsp) # stash copy on stack
+ pcmpeqb %xmm1, %xmm0 # NUL in second chunk?
+ pmovmskb %xmm0, %r9d
+ shl $16, %r9d
+ or %r9d, %r8d # merge found NUL bytes into NUL mask
+
+ /* end of string after one buffer */
+0: tzcnt %r8d, %r8d # location of last char in string
+ movdqu %xmm1, bounce(%rsp, %r8, 1) # clear bytes behind string
+ lea bounce(%rsp, %rcx, 1), %rsi # start of string copy on stack
+ lea (%rdi, %r8, 1), %rax # return pointer to NUL byte
+
+ cmp $16, %edx # at least 16 bytes to transfer?
+ jae .L1631
+
+ mov (%rsi), %r8 # load string head
+ cmp $8, %edx # at least 8 bytes to transfer?
+ jae .L0815
+
+ cmp $4, %edx # at least 4 bytes to transfer?
+ jae .L0407
+
+ movzwl -2(%rsi, %rdx, 1), %esi # load last two bytes of string
+ mov %r8b, (%rdi, %rcx, 1) # store first byte
+
+ cmp $2, %edx # at least 2 bytes to transfer?
+ jb .L1
+
+ mov %si, -2(%rdi, %r10, 1) # store last two bytes of string
+.L1: ret
+
+.L1631: movdqu (%rsi), %xmm0 # load first 16 bytes of string
+ movdqu -16(%rsi, %rdx, 1), %xmm1 # load last 16 bytes of string
+ movdqu %xmm0, (%rdi, %rcx, 1)
+ movdqu %xmm1, -16(%rdi, %r10, 1)
+ ret
+
+.L0815: mov -8(%rsi, %rdx, 1), %rdx # load last 8 bytes of string
+ mov %r8, (%rdi, %rcx, 1)
+ mov %rdx, -8(%rdi, %r10, 1)
+ ret
+
+.L0407: mov -4(%rsi, %rdx, 1), %edx # load last four bytes of string
+ mov %r8d, (%rdi, %rcx, 1)
+ mov %edx, -4(%rdi, %r10, 1)
+ ret
+
+ /* length 0 buffer: just return dest */
+.L0: mov %rdi, %rax
+ ret
+ARCHEND(__stpncpy, baseline)
+
+ .section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/amd64/string/strcat.S b/lib/libc/amd64/string/strcat.S
index 7b5a1dd39cd3..081e98840cee 100644
--- a/lib/libc/amd64/string/strcat.S
+++ b/lib/libc/amd64/string/strcat.S
@@ -1,16 +1,29 @@
-/*
- * Written by J.T. Conklin <jtc@acorntoolworks.com>
- * Public domain.
+/*-
+ * Copyright (c) 2023, The FreeBSD Foundation
+ *
+ * SPDX-License-Expression: BSD-2-Clause
+ *
+ * Portions of this software were developed by Robert Clausecker
+ * <fuz@FreeBSD.org> under sponsorship from the FreeBSD Foundation.
+ *
+ * Adapted from NetBSD's common/lib/libc/arch/x86_64/string/strcat.S
+ * written by J.T. Conklin <jtc@acorntoolworks.com>
+ * that was originally dedicated to the public domain
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
#if 0
RCSID("$NetBSD: strcat.S,v 1.4 2004/07/26 18:51:21 drochner Exp $")
#endif
-ENTRY(strcat)
+#include "amd64_archlevel.h"
+
+ARCHFUNCS(strcat)
+ ARCHFUNC(strcat, scalar)
+ ARCHFUNC(strcat, baseline)
+ENDARCHFUNCS(strcat)
+
+ARCHENTRY(strcat, scalar)
movq %rdi,%rax
movabsq $0x0101010101010101,%r8
movabsq $0x8080808080808080,%r9
@@ -163,6 +176,28 @@ ENTRY(strcat)
.Ldone:
ret
-END(strcat)
+ARCHEND(strcat, scalar)
+
+/*
+ * Call into strlen + strcpy if we have any SIMD at all.
+ * The scalar implementation above is better for the scalar
+ * case as it avoids the function call overhead, but pessimal
+ * if we could call SIMD routines instead.
+ */
+ARCHENTRY(strcat, baseline)
+ push %rbp
+ mov %rsp, %rbp
+ push %rsi
+ push %rbx
+ mov %rdi, %rbx # remember destination for later
+ call CNAME(strlen) # strlen(dest)
+ mov -8(%rbp), %rsi
+ lea (%rbx, %rax, 1), %rdi # dest + strlen(dest)
+ call CNAME(__stpcpy) # stpcpy(dest + strlen(dest), src)
+ mov %rbx, %rax # return dest
+ pop %rbx
+ leave
+ ret
+ARCHEND(strcat, baseline)
.section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/amd64/string/strchrnul.S b/lib/libc/amd64/string/strchrnul.S
new file mode 100644
index 000000000000..0e70b02311d7
--- /dev/null
+++ b/lib/libc/amd64/string/strchrnul.S
@@ -0,0 +1,170 @@
+/*-
+ * Copyright (c) 2023 The FreeBSD Foundation
+ *
+ * This software was developed by Robert Clausecker <fuz@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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 AUTHOR 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 AUTHOR 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
+ */
+
+#include <machine/asm.h>
+
+#include "amd64_archlevel.h"
+
+#define ALIGN_TEXT .p2align 4,0x90 # 16-byte alignment, nop-filled
+
+ .weak strchrnul
+ .set strchrnul, __strchrnul
+
+ARCHFUNCS(__strchrnul)
+ ARCHFUNC(__strchrnul, scalar)
+ ARCHFUNC(__strchrnul, baseline)
+ENDARCHFUNCS(__strchrnul)
+
+/*
+ * strchrnul(str, c)
+ * This is implemented like strlen(str), but we check for the
+ * presence of both NUL and c in each iteration.
+ */
+ARCHENTRY(__strchrnul, scalar)
+ mov %edi, %ecx
+ and $~7, %rdi # align to 8 byte
+ movzbl %sil, %esi # clear stray high bits
+ movabs $0x0101010101010101, %r8
+ mov (%rdi), %rax # load first word
+ imul %r8, %rsi # replicate char 8 times
+
+ /*
+ * Unaligned input: align to 8 bytes. Then proceed the same
+ * way as with aligned input, but prevent matches before the
+ * beginning of the string. This is achieved by oring 0x01
+ * into each byte of the buffer before the string
+ */
+ shl $3, %ecx
+ mov %r8, %r10
+ add $8, %rdi
+ shl %cl, %r10 # 0x01 where the string is
+ xor %r8, %r10 # 0x01 where it is not
+ neg %r8 # negate 01..01 so we can use lea
+ movabs $0x8080808080808080, %r9
+
+ mov %rsi, %rcx
+ xor %rax, %rcx # str ^ c
+ or %r10, %rax # str without NUL bytes before it
+ or %r10, %rcx # (str ^ c) without matches before it
+ lea (%rax, %r8, 1), %rdx # str - 0x01..01
+ lea (%rcx, %r8, 1), %r11 # (str ^ c) - 0x01..01
+ not %rax # ~str
+ not %rcx # ~(str ^ c)
+ and %rdx, %rax # (str - 0x01..01) & ~str
+ and %r11, %rcx # ((str ^ c - 0x01..01) & ~(str ^ c)
+ or %rcx, %rax # matches for both
+ and %r9, %rax # not including junk bytes
+ jnz 1f
+
+ /* main loop unrolled twice */
+ ALIGN_TEXT
+0: mov (%rdi), %rax # str
+ mov %rsi, %rcx
+ xor %rax, %rcx # str ^ c
+ lea (%rax, %r8, 1), %rdx # str - 0x01..01
+ lea (%rcx, %r8, 1), %r11 # (str ^ c) - 0x01..01
+ not %rax # ~str
+ not %rcx # ~(str ^ c)
+ and %rdx, %rax # (str - 0x01..01) & ~str
+ and %r11, %rcx # ((str ^ c - 0x01..01) & ~(str ^ c)
+ or %rcx, %rax # matches for both
+ and %r9, %rax # not including junk bits
+ jnz 2f
+
+ mov 8(%rdi), %rax # str
+ add $16, %rdi
+ mov %rsi, %rcx
+ xor %rax, %rcx # str ^ c
+ lea (%rax, %r8, 1), %rdx # str - 0x01..01
+ lea (%rcx, %r8, 1), %r11 # (str ^ c) - 0x01..01
+ not %rax # ~str
+ not %rcx # ~(str ^ c)
+ and %rdx, %rax # (str - 0x01..01) & ~str
+ and %r11, %rcx # ((str ^ c - 0x01..01) & ~(str ^ c)
+ or %rcx, %rax # matches for both
+ and %r9, %rax # not including junk bits
+ jz 0b
+
+ /* NUL or c found */
+1: sub $8, %rdi # undo advance past buffer
+2: tzcnt %rax, %rax # first NUL or c byte match
+ shr $3, %eax # scale from bit to byte index
+ add %rdi, %rax # pointer to found c or NUL
+ ret
+ARCHEND(__strchrnul, scalar)
+
+ARCHENTRY(__strchrnul, baseline)
+ mov %edi, %ecx
+ and $~0xf, %rdi # align to 16 byte
+ movdqa (%rdi), %xmm1
+ movd %esi, %xmm0
+ and $0xf, %ecx # distance from (%rdi) to start of string
+ pxor %xmm2, %xmm2
+ mov $-1, %edx
+ punpcklbw %xmm0, %xmm0 # c -> cc
+ shl %cl, %edx # bits corresponding to bytes in the string
+ punpcklwd %xmm0, %xmm0 # cc -> cccc
+ add $16, %rdi
+
+ /* check for match in head */
+ pcmpeqb %xmm1, %xmm2 # NUL bytes present?
+ pshufd $0, %xmm0, %xmm0 # cccc -> cccccccccccccccc
+ pcmpeqb %xmm0, %xmm1 # c present?
+ por %xmm2, %xmm1 # either present?
+ pmovmskb %xmm1, %eax
+ and %edx, %eax # match in the string?
+ jnz 1f
+
+ /* main loop unrolled twice */
+ ALIGN_TEXT
+0: movdqa (%rdi), %xmm1
+ pxor %xmm2, %xmm2
+ pcmpeqb %xmm1, %xmm2 # NUL bytes present?
+ pcmpeqb %xmm0, %xmm1 # c present?
+ por %xmm2, %xmm1 # either present?
+ pmovmskb %xmm1, %eax
+ test %eax, %eax # match in the string?
+ jnz 2f
+
+ movdqa 16(%rdi), %xmm1
+ add $32, %rdi
+ pxor %xmm2, %xmm2
+ pcmpeqb %xmm1, %xmm2 # NUL bytes present?
+ pcmpeqb %xmm0, %xmm1 # c present?
+ por %xmm2, %xmm1 # either present?
+ pmovmskb %xmm1, %eax
+ test %eax, %eax # match in the string?
+ jz 0b
+
+1: sub $16, %rdi # undo advance past buffer
+2: tzcnt %eax, %eax # where is the match?
+ add %rdi, %rax # pointer to found c or NUL
+ ret
+ARCHEND(__strchrnul, baseline)
+
+ .section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/amd64/string/strcmp.S b/lib/libc/amd64/string/strcmp.S
index 787e1e07b1b0..eb354bd2af82 100644
--- a/lib/libc/amd64/string/strcmp.S
+++ b/lib/libc/amd64/string/strcmp.S
@@ -1,16 +1,33 @@
-/*
- * Written by J.T. Conklin <jtc@acorntoolworks.com>
- * Public domain.
+/*-
+ * Copyright (c) 2023, The FreeBSD Foundation
+ *
+ * SPDX-License-Expression: BSD-2-Clause
+ *
+ * Portions of this software were developed by Robert Clausecker
+ * <fuz@FreeBSD.org> under sponsorship from the FreeBSD Foundation.
+ *
+ * Adapted from NetBSD's common/lib/libc/arch/x86_64/string/strcmp.S
+ * written by J.T. Conklin <jtc@acorntoolworks.com> that was originally
+ * dedicated to the public domain.
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
+#include <machine/param.h>
#if 0
RCSID("$NetBSD: strcmp.S,v 1.3 2004/07/19 20:04:41 drochner Exp $")
#endif
-ENTRY(strcmp)
+#include "amd64_archlevel.h"
+
+#define ALIGN_TEXT .p2align 4, 0x90
+
+ARCHFUNCS(strcmp)
+ ARCHFUNC(strcmp, scalar)
+ ARCHFUNC(strcmp, baseline)
+ENDARCHFUNCS(strcmp)
+
+ARCHENTRY(strcmp, scalar)
/*
* Align s1 to word boundary.
* Consider unrolling loop?
@@ -41,7 +58,7 @@ ENTRY(strcmp)
movabsq $0x8080808080808080,%r9
subq $8,%rsi
- .align 4
+ ALIGN_TEXT
.Lword_loop:
movq 8(%rdi),%rax
addq $8,%rdi
@@ -55,7 +72,7 @@ ENTRY(strcmp)
testq %r9,%rdx
je .Lword_loop
- .align 4
+ ALIGN_TEXT
.Lbyte_loop:
movb (%rdi),%al
incq %rdi
@@ -71,6 +88,272 @@ ENTRY(strcmp)
movzbq %dl,%rdx
subq %rdx,%rax
ret
-END(strcmp)
+ARCHEND(strcmp, scalar)
+
+ARCHENTRY(strcmp, baseline)
+ /* check if either string crosses a page in the head */
+ lea 15(%rdi), %r8d # end of head
+ lea 15(%rsi), %r9d
+ mov %edi, %eax
+ mov %esi, %edx
+ xor %edi, %r8d # bits that changed between first and last byte
+ xor %esi, %r9d
+ and $~0xf, %rdi # align heads to 16 bytes
+ and $~0xf, %rsi
+ or %r8d, %r9d # in either RSI or RDI
+ and $0xf, %eax # offset from alignment
+ and $0xf, %edx
+ pxor %xmm1, %xmm1
+ test $PAGE_SIZE, %r9d # did the page change?
+ jz 0f # if not, take fast path
+
+ /* heads may cross page boundary, avoid unmapped loads */
+ movdqa (%rdi), %xmm0 # load aligned heads
+ movdqa (%rsi), %xmm2
+ mov $-1, %r8d
+ mov $-1, %r9d
+ mov %eax, %ecx
+ shl %cl, %r8d # string head in XMM0
+ mov %edx, %ecx
+ shl %cl, %r9d # string head in XMM2
+ movdqa %xmm0, -40(%rsp) # stash copies of the heads on the stack
+ movdqa %xmm2, -24(%rsp)
+ pcmpeqb %xmm1, %xmm0
+ pcmpeqb %xmm1, %xmm2
+ pmovmskb %xmm0, %r10d
+ pmovmskb %xmm2, %r11d
+ test %r8d, %r10d # NUL byte present in first string?
+ lea -40(%rsp), %r8
+ cmovz %rdi, %r8
+ test %r9d, %r11d # NUL byte present in second string?
+ lea -24(%rsp), %r9
+ cmovz %rsi, %r9
+ movdqu (%r8, %rax, 1), %xmm0 # load true (or fake) heads
+ movdqu (%r9, %rdx, 1), %xmm4
+ jmp 1f
+
+0: movdqu (%rdi, %rax, 1), %xmm0 # load true heads
+ movdqu (%rsi, %rdx, 1), %xmm4
+1: pxor %xmm2, %xmm2
+ pcmpeqb %xmm0, %xmm2 # NUL byte present?
+ pcmpeqb %xmm0, %xmm4 # which bytes match?
+ pandn %xmm4, %xmm2 # match and not NUL byte?
+ pmovmskb %xmm2, %r9d
+ xor $0xffff, %r9d # mismatch or NUL byte?
+ jnz .Lhead_mismatch
+
+ /* load head and second chunk */
+ movdqa 16(%rdi), %xmm2 # load second chunks
+ movdqa 16(%rsi), %xmm3
+ sub %rdx, %rax # is a&0xf >= b&0xf?
+ jb .Lswapped # if not, proceed with swapped operands
+
+ neg %rax
+ movdqu 16(%rsi, %rax, 1), %xmm0
+ sub %rdi, %rsi # express RSI as distance from RDI
+ lea (%rsi, %rax, 1), %rdx # point RDX to offset in second string
+ neg %rax
+ pcmpeqb %xmm3, %xmm1 # ... corresponding to RDI
+ pcmpeqb %xmm2, %xmm0
+ pmovmskb %xmm1, %r8d
+ pmovmskb %xmm0, %r9d
+ add $16, %rdi
+ test %r8d, %r8d
+ jnz .Lnul_found
+ xor $0xffff, %r9d
+ jnz .Lmismatch
+ add $16, %rdi # advance aligned pointers
+
+ /*
+ * During the main loop, the layout of the two strings is something like:
+ *
+ * v ------1------ v ------2------ v
+ * RDI: AAAAAAAAAAAAABBBBBBBBBBBBBBBB...
+ * RSI: AAAAAAAAAAAAABBBBBBBBBBBBBBBBCCC...
+ *
+ * where v indicates the alignment boundaries and corresponding chunks
+ * of the strings have the same letters. Chunk A has been checked in
+ * the previous iteration. This iteration, we first check that string
+ * RSI doesn't end within region 2, then we compare chunk B between the
+ * two strings. As RSI is known not to hold a NUL byte in regsions 1
+ * and 2 at this point, this also ensures that RDI has not ended yet.
+ */
+ ALIGN_TEXT
+0: movdqu (%rdi, %rdx, 1), %xmm0 # chunk of 2nd string corresponding to RDI?
+ pxor %xmm1, %xmm1
+ pcmpeqb (%rdi, %rsi, 1), %xmm1 # end of string in RSI?
+ pcmpeqb (%rdi), %xmm0 # where do the chunks match?
+ pmovmskb %xmm1, %r8d
+ pmovmskb %xmm0, %r9d
+ test %r8d, %r8d
+ jnz .Lnul_found
+ xor $0xffff, %r9d # any mismatches?
+ jnz .Lmismatch
+
+ /* main loop unrolled twice */
+ movdqu 16(%rdi, %rdx, 1), %xmm0 # chunk of 2nd string corresponding to RDI?
+ pxor %xmm1, %xmm1
+ pcmpeqb 16(%rdi, %rsi, 1), %xmm1 # end of string in RSI?
+ pcmpeqb 16(%rdi), %xmm0 # where do the chunks match?
+ pmovmskb %xmm1, %r8d
+ pmovmskb %xmm0, %r9d
+ add $32, %rdi
+ test %r8d, %r8d
+ jnz .Lnul_found2
+ xor $0xffff, %r9d # any mismatches?
+ jz 0b
+
+ sub $16, %rdi # roll back second increment
+
+ /* a mismatch has been found between RDX and RSI */
+.Lmismatch:
+ tzcnt %r9d, %r9d # where is the mismatch?
+ add %rdi, %rdx # turn RDX from offset to pointer
+ movzbl (%rdx, %r9, 1), %ecx
+ movzbl (%rdi, %r9, 1), %eax
+ sub %ecx, %eax # difference of the mismatching chars
+ ret
+
+ /* mismatch in true heads */
+.Lhead_mismatch:
+ tzcnt %r9d, %r9d # where is the mismatch?
+ add %rax, %rdi # return to true heads
+ add %rdx, %rsi
+ movzbl (%rdi, %r9, 1), %eax # mismatching characters
+ movzbl (%rsi, %r9, 1), %ecx
+ sub %ecx, %eax
+ ret
+
+.Lnul_found2:
+ sub $16, %rdi # roll back second increment
+
+ /* a NUL has been found in RSI */
+.Lnul_found:
+ mov %eax, %ecx
+ mov %r8d, %r10d
+ shl %cl, %r8w # adjust NUL mask to positions in RDI/RDX
+ xor $0xffff, %r9d # mask of mismatches
+ or %r8d, %r9d # NUL bytes also count as mismatches
+ jnz .Lmismatch
+
+ /*
+ * (RDI) == (RSI) and NUL is past the string.
+ * Compare (RSI) with the corresponding part
+ * of the other string until the NUL byte.
+ */
+ movdqu (%rdi, %rax, 1), %xmm0
+ pcmpeqb (%rdi, %rsi, 1), %xmm0
+ add %rdi, %rsi # restore RSI pointer
+ add %rax, %rdi # point RDI to chunk corresponding to (RSI)
+ pmovmskb %xmm0, %ecx # mask of matches
+ not %ecx # mask of mismatches
+ or %r10d, %ecx # mask of mismatches or NUL bytes
+ tzcnt %ecx, %ecx # location of first mismatch
+ movzbl (%rdi, %rcx, 1), %eax
+ movzbl (%rsi, %rcx, 1), %ecx
+ sub %ecx, %eax
+ ret
+
+ /*
+ * If (a&0xf) < (b&0xf), we do the same thing but with swapped
+ * operands. I found that this performs slightly better than
+ * using conditional moves to do the swap branchless.
+ */
+.Lswapped:
+ movdqu 16(%rdi, %rax, 1), %xmm0
+ sub %rsi, %rdi # express RDI as distance from RSI
+ lea (%rdi, %rax, 1), %rdx # point RDX to offset in RDI corresponding to RSI
+ neg %rax # make difference positive
+ pcmpeqb %xmm2, %xmm1
+ pcmpeqb %xmm3, %xmm0
+ pmovmskb %xmm1, %r8d
+ pmovmskb %xmm0, %r9d
+ add $16, %rsi # advance aligned pointers
+ test %r8d, %r8d
+ jnz .Lnul_founds
+ xor $0xffff, %r9d
+ jnz .Lmismatchs
+ add $16, %rsi
+
+ /*
+ * During the main loop, the layout of the two strings is something like:
+ *
+ * v ------1------ v ------2------ v
+ * RDI: AAAAAAAAAAAAABBBBBBBBBBBBBBBB...
+ * RSI: AAAAAAAAAAAAABBBBBBBBBBBBBBBBCCC...
+ *
+ * where v indicates the alignment boundaries and corresponding chunks
+ * of the strings have the same letters. Chunk A has been checked in
+ * the previous iteration. This iteration, we first check that string
+ * RSI doesn't end within region 2, then we compare chunk B between the
+ * two strings. As RSI is known not to hold a NUL byte in regsions 1
+ * and 2 at this point, this also ensures that RDI has not ended yet.
+ */
+ ALIGN_TEXT
+0: movdqu (%rsi, %rdx, 1), %xmm0 # chunk of 2nd string corresponding to RDI?
+ pxor %xmm1, %xmm1
+ pcmpeqb (%rsi, %rdi, 1), %xmm1 # end of string in RSI?
+ pcmpeqb (%rsi), %xmm0 # where do the chunks match?
+ pmovmskb %xmm1, %r8d
+ pmovmskb %xmm0, %r9d
+ test %r8d, %r8d
+ jnz .Lnul_founds
+ xor $0xffff, %r9d # any mismatches?
+ jnz .Lmismatchs
+
+ /* main loop unrolled twice */
+ movdqu 16(%rsi, %rdx, 1), %xmm0 # chunk of 2nd string corresponding to RDI?
+ pxor %xmm1, %xmm1
+ pcmpeqb 16(%rsi, %rdi, 1), %xmm1 # end of string in RSI?
+ pcmpeqb 16(%rsi), %xmm0 # where do the chunks match?
+ pmovmskb %xmm1, %r8d
+ pmovmskb %xmm0, %r9d
+ add $32, %rsi
+ test %r8d, %r8d
+ jnz .Lnul_found2s
+ xor $0xffff, %r9d # any mismatches?
+ jz 0b
+
+ sub $16, %rsi # roll back second increment
+
+ /* a mismatch has been found between RDX and RDI */
+.Lmismatchs:
+ tzcnt %r9d, %r9d # where is the mismatch?
+ add %rsi, %rdx # turn RDX from offset to pointer
+ movzbl (%rdx, %r9, 1), %eax
+ movzbl (%rsi, %r9, 1), %ecx
+ sub %ecx, %eax # difference of the mismatching chars
+ ret
+
+.Lnul_found2s:
+ sub $16, %rsi # roll back second increment
+
+ /* a NUL has been found in RSI */
+.Lnul_founds:
+ mov %eax, %ecx
+ mov %r8d, %r10d
+ shl %cl, %r8w # adjust NUL mask to positions in RDI/RDX
+ xor $0xffff, %r9d # mask of mismatches
+ or %r8d, %r9d # NUL bytes also count as mismatches
+ jnz .Lmismatchs
+
+ /*
+ * (RDI) == (RSI) and NUL is past the string.
+ * Compare (RSI) with the corresponding part
+ * of the other string until the NUL byte.
+ */
+ movdqu (%rsi, %rax, 1), %xmm0
+ pcmpeqb (%rsi, %rdi, 1), %xmm0
+ add %rsi, %rdi # restore RDI pointer
+ add %rax, %rsi # point RSI to chunk corresponding to (RDI)
+ pmovmskb %xmm0, %ecx # mask of matches
+ not %ecx # mask of mismatches
+ or %r10d, %ecx # mask of mismatches or NUL bytes
+ tzcnt %ecx, %ecx # location of first mismatch
+ movzbl (%rdi, %rcx, 1), %eax
+ movzbl (%rsi, %rcx, 1), %ecx
+ sub %ecx, %eax
+ ret
+ARCHEND(strcmp, baseline)
.section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/amd64/string/strcpy.c b/lib/libc/amd64/string/strcpy.c
index df1facefb105..eb93b0defbaa 100644
--- a/lib/libc/amd64/string/strcpy.c
+++ b/lib/libc/amd64/string/strcpy.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright 2011 George V. Neville-Neil. All rights reserved.
*
@@ -27,9 +27,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
char *__stpcpy(char * __restrict, const char * __restrict);
char *
diff --git a/lib/libc/amd64/string/strcspn.S b/lib/libc/amd64/string/strcspn.S
new file mode 100644
index 000000000000..7ebd7a847d67
--- /dev/null
+++ b/lib/libc/amd64/string/strcspn.S
@@ -0,0 +1,396 @@
+/*
+ * Copyright (c) 2023 The FreeBSD Foundation
+ *
+ * This software was developed by Robert Clausecker <fuz@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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 AUTHOR 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 AUTHOR 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
+ */
+
+#include <machine/asm.h>
+#include <machine/param.h>
+
+#include "amd64_archlevel.h"
+
+#define ALIGN_TEXT .p2align 4,0x90 /* 16-byte alignment, nop filled */
+
+ .weak strcspn
+ .set strcspn, __strcspn
+ARCHFUNCS(__strcspn)
+ ARCHFUNC(__strcspn, scalar)
+ NOARCHFUNC
+ ARCHFUNC(__strcspn, x86_64_v2)
+ENDARCHFUNCS(__strcspn)
+
+ARCHENTRY(__strcspn, scalar)
+ push %rbp # align stack to enable function call
+ mov %rsp, %rbp
+ sub $256, %rsp # allocate space for lookup table
+
+ /* check for special cases */
+ movzbl (%rsi), %eax # first character in the set
+ test %eax, %eax
+ jz .Lstrlen
+
+ movzbl 1(%rsi), %edx # second character in the set
+ test %edx, %edx
+ jz .Lstrchr
+
+ /* no special case matches -- prepare lookup table */
+ xor %r8d, %r8d
+ mov $28, %ecx
+0: mov %r8, (%rsp, %rcx, 8)
+ mov %r8, 8(%rsp, %rcx, 8)
+ mov %r8, 16(%rsp, %rcx, 8)
+ mov %r8, 24(%rsp, %rcx, 8)
+ sub $4, %ecx
+ jnc 0b
+
+ add $2, %rsi
+ movb $1, (%rsp, %rax, 1) # register first chars in set
+ movb $1, (%rsp, %rdx, 1)
+ mov %rdi, %rax # a copy of the source to iterate over
+
+ /* process remaining chars in set */
+ ALIGN_TEXT
+0: movzbl (%rsi), %ecx
+ movb $1, (%rsp, %rcx, 1)
+ test %ecx, %ecx
+ jz 1f
+
+ movzbl 1(%rsi), %ecx
+ movb $1, (%rsp, %rcx, 1)
+ test %ecx, %ecx
+ jz 1f
+
+ add $2, %rsi
+ jmp 0b
+
+ /* find match */
+ ALIGN_TEXT
+1: movzbl (%rax), %ecx
+ cmpb $0, (%rsp, %rcx, 1)
+ jne 2f
+
+ movzbl 1(%rax), %ecx
+ cmpb $0, (%rsp, %rcx, 1)
+ jne 3f
+
+ movzbl 2(%rax), %ecx
+ cmpb $0, (%rsp, %rcx, 1)
+ jne 4f
+
+ movzbl 3(%rax), %ecx
+ add $4, %rax
+ cmpb $0, (%rsp, %rcx, 1)
+ je 1b
+
+ sub $3, %rax
+4: dec %rdi
+3: inc %rax
+2: sub %rdi, %rax # number of characters preceding match
+ leave
+ ret
+
+ /* set is empty, degrades to strlen */
+.Lstrlen:
+ leave
+ jmp CNAME(strlen)
+
+ /* just one character in set, degrades to strchr */
+.Lstrchr:
+ mov %rdi, (%rsp) # stash a copy of the string
+ mov %eax, %esi # find the character in the set
+ call CNAME(strchrnul)
+ sub (%rsp), %rax # length of prefix before match
+ leave
+ ret
+ARCHEND(__strcspn, scalar)
+
+ /*
+ * This kernel uses pcmpistri to do the heavy lifting.
+ * We provide five code paths, depending on set size:
+ *
+ * 0: call strlen()
+ * 1: call strchr()
+ * 2--16: one pcmpistri per 16 bytes of input
+ * 17--32: two pcmpistri per 16 bytes of input
+ * >=33: fall back to look up table
+ */
+ARCHENTRY(__strcspn, x86_64_v2)
+ push %rbp
+ mov %rsp, %rbp
+ sub $256, %rsp
+
+ /* check for special cases */
+ movzbl (%rsi), %eax
+ test %eax, %eax # empty string?
+ jz .Lstrlenv2
+
+ cmpb $0, 1(%rsi) # single character string?
+ jz .Lstrchrv2
+
+ /* find set size and copy up to 32 bytes to (%rsp) */
+ mov %esi, %ecx
+ and $~0xf, %rsi # align set pointer
+ movdqa (%rsi), %xmm0
+ pxor %xmm1, %xmm1
+ and $0xf, %ecx # amount of bytes rsi is past alignment
+ xor %edx, %edx
+ pcmpeqb %xmm0, %xmm1 # end of string reached?
+ movdqa %xmm0, 32(%rsp) # transfer head of set to stack
+ pmovmskb %xmm1, %eax
+ shr %cl, %eax # clear out junk before string
+ test %eax, %eax # end of set reached?
+ jnz 0f
+
+ movdqa 16(%rsi), %xmm0 # second chunk of the set
+ mov $16, %edx
+ sub %ecx, %edx # length of set preceding xmm0
+ pxor %xmm1, %xmm1
+ pcmpeqb %xmm0, %xmm1
+ movdqa %xmm0, 48(%rsp)
+ movdqu 32(%rsp, %rcx, 1), %xmm2 # head of set
+ pmovmskb %xmm1, %eax
+ test %eax, %eax
+ jnz 1f
+
+ movdqa 32(%rsi), %xmm0 # third chunk
+ add $16, %edx
+ pxor %xmm1, %xmm1
+ pcmpeqb %xmm0, %xmm1
+ movdqa %xmm0, 64(%rsp)
+ pmovmskb %xmm1, %eax
+ test %eax, %eax # still not done?
+ jz .Lgt32v2
+
+0: movdqu 32(%rsp, %rcx, 1), %xmm2 # head of set
+1: tzcnt %eax, %eax
+ add %eax, %edx # length of set (excluding NUL byte)
+ cmp $32, %edx # above 32 bytes?
+ ja .Lgt32v2
+
+ /*
+ * At this point we know that we want to use pcmpistri.
+ * one last problem obtains: the head of the string is not
+ * aligned and may cross a cacheline. If this is the case,
+ * we take the part before the page boundary and repeat the
+ * last byte to fill up the xmm register.
+ */
+ mov %rdi, %rax # save original string pointer
+ lea 15(%rdi), %esi # last byte of the head
+ xor %edi, %esi
+ test $PAGE_SIZE, %esi # does the head cross a page?
+ jz 0f
+
+ /* head crosses page: copy to stack to fix up */
+ and $~0xf, %rax # align head pointer temporarily
+ movzbl 15(%rax), %esi # last head byte on the page
+ movdqa (%rax), %xmm0
+ movabs $0x0101010101010101, %r8
+ imul %r8, %rsi # repeated 8 times
+ movdqa %xmm0, (%rsp) # head word on stack
+ mov %rsi, 16(%rsp) # followed by filler (last byte x8)
+ mov %rsi, 24(%rsp)
+ mov %edi, %eax
+ and $0xf, %eax # offset of head from alignment
+ add %rsp, %rax # pointer to fake head
+
+0: movdqu (%rax), %xmm0 # load head (fake or real)
+ lea 16(%rdi), %rax
+ and $~0xf, %rax # second 16 bytes of string (aligned)
+1: cmp $16, %edx # 16--32 bytes?
+ ja .Lgt16v2
+
+
+ /* set is 2--16 bytes in size */
+
+ /* _SIDD_UBYTE_OPS|_SIDD_CMP_EQUAL_ANY|_SIDD_LEAST_SIGNIFICANT */
+ pcmpistri $0, %xmm0, %xmm2 # match in head?
+ jbe .Lheadmatchv2
+
+ ALIGN_TEXT
+0: pcmpistri $0, (%rax), %xmm2
+ jbe 1f # match or end of string?
+ pcmpistri $0, 16(%rax), %xmm2
+ lea 32(%rax), %rax
+ ja 0b # match or end of string?
+
+3: lea -16(%rax), %rax # go back to second half
+1: jc 2f # jump if match found
+ movdqa (%rax), %xmm0 # reload string piece
+ pxor %xmm1, %xmm1
+ pcmpeqb %xmm1, %xmm0 # where is the NUL byte?
+ pmovmskb %xmm0, %ecx
+ tzcnt %ecx, %ecx # location of NUL byte in (%rax)
+2: sub %rdi, %rax # offset of %xmm0 from beginning of string
+ add %rcx, %rax # prefix length before match/NUL
+ leave
+ ret
+
+.Lheadmatchv2:
+ jc 2f # jump if match found
+ pxor %xmm1, %xmm1
+ pcmpeqb %xmm1, %xmm0
+ pmovmskb %xmm0, %ecx
+ tzcnt %ecx, %ecx # location of NUL byte
+2: mov %ecx, %eax # prefix length before match/NUL
+ leave
+ ret
+
+ /* match in first set half during head */
+.Lheadmatchv2first:
+ mov %ecx, %eax
+ pcmpistri $0, %xmm0, %xmm3 # match in second set half?
+ cmp %ecx, %eax # before the first half match?
+ cmova %ecx, %eax # use the earlier match
+ leave
+ ret
+
+.Lgt16v2:
+ movdqu 48(%rsp, %rcx, 1), %xmm3 # second part of set
+
+ /* set is 17--32 bytes in size */
+ pcmpistri $0, %xmm0, %xmm2 # match in first set half?
+ jb .Lheadmatchv2first
+ pcmpistri $0, %xmm0, %xmm3 # match in second set half or end of string?
+ jbe .Lheadmatchv2
+
+ ALIGN_TEXT
+0: movdqa (%rax), %xmm0
+ pcmpistri $0, %xmm0, %xmm2
+ jb 4f # match in first set half?
+ pcmpistri $0, %xmm0, %xmm3
+ jbe 1f # match in second set half or end of string?
+ movdqa 16(%rax), %xmm0
+ add $32, %rax
+ pcmpistri $0, %xmm0, %xmm2
+ jb 3f # match in first set half?
+ pcmpistri $0, %xmm0, %xmm3
+ ja 0b # neither match in 2nd half nor string end?
+
+ /* match in second half or NUL */
+ lea -16(%rax), %rax # go back to second half
+1: jc 2f # jump if match found
+ pxor %xmm1, %xmm1
+ pcmpeqb %xmm1, %xmm0 # where is the NUL byte?
+ pmovmskb %xmm0, %ecx
+ tzcnt %ecx, %ecx # location of NUL byte in (%rax)
+2: sub %rdi, %rax # offset of %xmm0 from beginning of string
+ add %rcx, %rax # prefix length before match/NUL
+ leave
+ ret
+
+ /* match in first half */
+3: sub $16, %rax # go back to second half
+4: sub %rdi, %rax # offset of %xmm0 from beginning of string
+ mov %ecx, %edx
+ pcmpistri $0, %xmm0, %xmm3 # match in second set half?
+ cmp %ecx, %edx # before the first half match?
+ cmova %ecx, %edx # use the earlier match
+ add %rdx, %rax # return full ofset
+ leave
+ ret
+
+ /* set is empty, degrades to strlen */
+.Lstrlenv2:
+ leave
+ jmp CNAME(strlen)
+
+ /* just one character in set, degrades to strchr */
+.Lstrchrv2:
+ mov %rdi, (%rsp) # stash a copy of the string
+ mov %eax, %esi # find this character
+ call CNAME(strchrnul)
+ sub (%rsp), %rax # length of prefix before match
+ leave
+ ret
+
+ /* set is >=33 bytes in size */
+.Lgt32v2:
+ xorps %xmm0, %xmm0
+ mov $256-64, %edx
+
+ /* clear out look up table */
+0: movaps %xmm0, (%rsp, %rdx, 1)
+ movaps %xmm0, 16(%rsp, %rdx, 1)
+ movaps %xmm0, 32(%rsp, %rdx, 1)
+ movaps %xmm0, 48(%rsp, %rdx, 1)
+ sub $64, %edx
+ jnc 0b
+
+ add %rcx, %rsi # restore string pointer
+ mov %rdi, %rax # keep a copy of the string
+
+ /* initialise look up table */
+ ALIGN_TEXT
+0: movzbl (%rsi), %ecx
+ movb $1, (%rsp, %rcx, 1)
+ test %ecx, %ecx
+ jz 1f
+
+ movzbl 1(%rsi), %ecx
+ movb $1, (%rsp, %rcx, 1)
+ test %ecx, %ecx
+ jz 1f
+
+ movzbl 2(%rsi), %ecx
+ movb $1, (%rsp, %rcx, 1)
+ test %ecx, %ecx
+ jz 1f
+
+ movzbl 3(%rsi), %ecx
+ movb $1, (%rsp, %rcx, 1)
+ test %ecx, %ecx
+ jz 1f
+
+ add $4, %rsi
+ jmp 0b
+
+ /* find match */
+ ALIGN_TEXT
+1: movzbl (%rax), %ecx
+ cmpb $0, (%rsp, %rcx, 1)
+ jne 2f
+
+ movzbl 1(%rax), %ecx
+ cmpb $0, (%rsp, %rcx, 1)
+ jne 3f
+
+ movzbl 2(%rax), %ecx
+ cmpb $0, (%rsp, %rcx, 1)
+ jne 4f
+
+ movzbl 3(%rax), %ecx
+ add $4, %rax
+ cmpb $0, (%rsp, %rcx, 1)
+ je 1b
+
+ sub $3, %rax
+4: dec %rdi
+3: inc %rax
+2: sub %rdi, %rax # number of characters preceding match
+ leave
+ ret
+ARCHEND(__strcspn, x86_64_v2)
+
+ .section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/amd64/string/strlcat.c b/lib/libc/amd64/string/strlcat.c
new file mode 100644
index 000000000000..0c1e1c5d05f7
--- /dev/null
+++ b/lib/libc/amd64/string/strlcat.c
@@ -0,0 +1,25 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2023 Robert Clausecker
+ */
+
+#include <sys/cdefs.h>
+
+#include <string.h>
+
+void *__memchr(const void *, int, size_t);
+size_t __strlcpy(char *restrict, const char *restrict, size_t);
+
+size_t
+strlcat(char *restrict dst, const char *restrict src, size_t dstsize)
+{
+ char *loc = __memchr(dst, '\0', dstsize);
+
+ if (loc != NULL) {
+ size_t dstlen = (size_t)(loc - dst);
+
+ return (dstlen + __strlcpy(loc, src, dstsize - dstlen));
+ } else
+ return (dstsize + strlen(src));
+}
diff --git a/lib/libc/amd64/string/strlcpy.S b/lib/libc/amd64/string/strlcpy.S
new file mode 100644
index 000000000000..2b32c6c78047
--- /dev/null
+++ b/lib/libc/amd64/string/strlcpy.S
@@ -0,0 +1,281 @@
+/*
+ * Copyright (c) 2023 The FreeBSD Foundation
+ *
+ * This software was developed by Robert Clausecker <fuz@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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 AUTHOR 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 AUTHOR 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
+ */
+
+#include <machine/asm.h>
+
+#include "amd64_archlevel.h"
+
+#define ALIGN_TEXT .p2align 4, 0x90
+
+ .weak strlcpy
+ .set strlcpy, __strlcpy
+ARCHFUNCS(__strlcpy)
+ ARCHFUNC(__strlcpy, scalar)
+ ARCHFUNC(__strlcpy, baseline)
+ENDARCHFUNCS(__strlcpy)
+
+ARCHENTRY(__strlcpy, scalar)
+ push %rbp # establish stack frame
+ mov %rsp, %rbp
+ push %rsi
+ push %rbx
+ push %rdi
+ push %rdx
+ mov %rsi, %rdi
+ call CNAME(strlen) # strlen(src)
+ pop %rdx
+ pop %rdi
+ mov -8(%rbp), %rsi
+ mov %rax, %rbx # remember string length for return value
+ sub $1, %rdx # do not copy into the final byte of the buffer
+ jc 0f # skip copying altogether if buffer was empty
+ cmp %rax, %rdx # is the buffer longer than the input?
+ cmova %rax, %rdx # if yes, only copy the part that fits
+ movb $0, (%rdi, %rdx, 1) # NUL-terminate output buffer
+ call CNAME(memcpy) # copy string to output
+0: mov %rbx, %rax # restore return value
+ pop %rbx
+ leave
+ ret
+ARCHEND(__strlcpy, scalar)
+
+ARCHENTRY(__strlcpy, baseline)
+ sub $1, %rdx # do not count NUL byte in buffer length
+ jb .L0 # go to special code path if len was 0
+
+ mov %esi, %ecx
+ pxor %xmm1, %xmm1
+ mov %rsi, %r9 # stash a copy of the source pointer for later
+ and $~0xf, %rsi
+ pcmpeqb (%rsi), %xmm1 # NUL found in head?
+ mov $-1, %r8d
+ and $0xf, %ecx
+ shl %cl, %r8d # mask of bytes in the string
+ pmovmskb %xmm1, %eax
+ and %r8d, %eax
+ jnz .Lhead_nul
+
+ movdqa 16(%rsi), %xmm3 # load second string chunk
+ movdqu (%r9), %xmm2 # load unaligned string head
+ mov $32, %r8d
+ sub %ecx, %r8d # head length + length of second chunk
+ pxor %xmm1, %xmm1
+ pcmpeqb %xmm3, %xmm1 # NUL found in second chunk?
+
+ sub %r8, %rdx # enough space left for the second chunk?
+ jbe .Lhead_buf_end
+
+ /* process second chunk */
+ pmovmskb %xmm1, %eax
+ test %eax, %eax
+ jnz .Lsecond_nul
+
+ /* string didn't end in second chunk and neither did buffer -- not a runt! */
+ movdqa 32(%rsi), %xmm0 # load next string chunk
+ pxor %xmm1, %xmm1
+ movdqu %xmm2, (%rdi) # deposit head into buffer
+ sub %rcx, %rdi # adjust RDI to correspond to RSI
+ movdqu %xmm3, 16(%rdi) # deposit second chunk
+ sub %rsi, %rdi # express RDI as distance from RSI
+ add $32, %rsi # advance RSI past first two chunks
+ sub $16, %rdx # enough left for another round?
+ jbe 1f
+
+ /* main loop unrolled twice */
+ ALIGN_TEXT
+0: pcmpeqb %xmm0, %xmm1 # NUL byte encountered?
+ pmovmskb %xmm1, %eax
+ test %eax, %eax
+ jnz 3f
+
+ movdqu %xmm0, (%rsi, %rdi)
+ movdqa 16(%rsi), %xmm0 # load next string chunk
+ pxor %xmm1, %xmm1
+ cmp $16, %rdx # more than a full chunk left?
+ jbe 2f
+
+ add $32, %rsi # advance pointers to next chunk
+ pcmpeqb %xmm0, %xmm1 # NUL byte encountered?
+ pmovmskb %xmm1, %eax
+ test %eax, %eax
+ jnz 4f
+
+ movdqu %xmm0, -16(%rsi, %rdi)
+ movdqa (%rsi), %xmm0 # load next string chunk
+ pxor %xmm1, %xmm1
+ sub $32, %rdx
+ ja 0b
+
+1: sub $16, %rsi # undo second advancement
+ add $16, %edx
+
+ /* 1--16 bytes left in the buffer but string has not ended yet */
+2: pcmpeqb %xmm1, %xmm0 # NUL byte encountered?
+ pmovmskb %xmm0, %r8d
+ mov %r8d, %eax
+ bts %edx, %r8d # treat end of buffer as end of string
+ tzcnt %r8d, %r8d # find tail length
+ add %rsi, %rdi # restore RDI
+ movdqu (%rsi, %r8, 1), %xmm0 # load string tail
+ movdqu %xmm0, (%rdi, %r8, 1) # store string tail
+ movb $0, 16(%rdi, %r8, 1) # NUL terminate
+
+ /* continue to find the end of the string */
+ test %eax, %eax # end of string already reached?
+ jnz 1f
+
+ ALIGN_TEXT
+0: pcmpeqb 32(%rsi), %xmm1
+ pmovmskb %xmm1, %eax
+ pxor %xmm1, %xmm1
+ test %eax, %eax
+ jnz 2f
+
+ pcmpeqb 48(%rsi), %xmm1
+ pmovmskb %xmm1, %eax
+ add $32, %rsi
+ pxor %xmm1, %xmm1
+ test %eax, %eax
+ jz 0b
+
+1: sub $16, %rsi # undo second advancement
+2: tzcnt %eax, %eax # where is the NUL byte?
+ sub %r9, %rsi
+ lea 32(%rsi, %rax, 1), %rax # return string length
+ ret
+
+4: sub $16, %rsi # undo second advancement
+ add $16, %rdx # restore number of remaining bytes
+
+ /* string has ended but buffer has not */
+3: tzcnt %eax, %eax # find length of string tail
+ movdqu -15(%rsi, %rax, 1), %xmm0 # load string tail (incl. NUL)
+ add %rsi, %rdi # restore destination pointer
+ movdqu %xmm0, -15(%rdi, %rax, 1) # store string tail (incl. NUL)
+ sub %r9, %rsi # string length to current chunk
+ add %rsi, %rax # plus length of current chunk
+ ret
+
+.Lhead_buf_end:
+ pmovmskb %xmm1, %r8d
+ add $32, %edx # restore edx to (len-1) + ecx
+ mov %r8d, %eax
+ shl $16, %r8d # place 2nd chunk NUL mask into bits 16--31
+ bts %rdx, %r8 # treat end of buffer as end of string
+ tzcnt %r8, %rdx # find string/bufer len from alignment boundary
+ sub %ecx, %edx # find actual string/buffer len
+ movb $0, (%rdi, %rdx, 1) # write NUL terminator
+
+ /* continue to find the end of the string */
+ test %eax, %eax # end of string already reached?
+ jnz 1f
+
+ ALIGN_TEXT
+0: pcmpeqb 32(%rsi), %xmm1
+ pmovmskb %xmm1, %eax
+ pxor %xmm1, %xmm1
+ test %eax, %eax
+ jnz 2f
+
+ pcmpeqb 48(%rsi), %xmm1
+ pmovmskb %xmm1, %eax
+ add $32, %rsi
+ pxor %xmm1, %xmm1
+ test %eax, %eax
+ jz 0b
+
+1: sub $16, %rsi
+2: tzcnt %eax, %eax
+ sub %r9, %rsi
+ lea 32(%rsi, %rax, 1), %rax # return string length
+ jmp .L0031
+
+.Lsecond_nul:
+ add %r8, %rdx # restore buffer length
+ tzcnt %eax, %eax # where is the NUL byte?
+ lea -16(%rcx), %r8d
+ sub %r8d, %eax # string length
+ cmp %rax, %rdx # is the string shorter than the buffer?
+ cmova %rax, %rdx # copy only min(buflen, srclen) bytes
+ movb $0, (%rdi, %rdx, 1) # write NUL terminator
+.L0031: cmp $16, %rdx # at least 16 bytes to copy (not incl NUL)?
+ jb .L0015
+
+ /* copy 16--31 bytes */
+ movdqu (%r9), %xmm0 # load first 16 bytes
+ movdqu -16(%r9, %rdx, 1), %xmm1 # load last 16 bytes
+ movdqu %xmm0, (%rdi)
+ movdqu %xmm1, -16(%rdi, %rdx, 1)
+ ret
+
+.Lhead_nul:
+ tzcnt %eax, %eax # where is the NUL byte?
+ sub %ecx, %eax # ... from the beginning of the string?
+ cmp %rax, %rdx # is the string shorter than the buffer?
+ cmova %rax, %rdx # copy only min(buflen, srclen) bytes
+ movb $0, (%rdi, %rdx, 1) # write NUL terminator
+
+ /* process strings of 0--15 bytes (rdx: min(buflen, srclen), rax: srclen) */
+.L0015: cmp $8, %rdx # at least 8 bytes to copy?
+ jae .L0815
+
+ cmp $4, %rdx # at least 4 bytes to copy?
+ jae .L0407
+
+ cmp $2, %rdx # at least 2 bytes to copy?
+ jae .L0203
+
+ movzbl (%r9), %ecx # load first byte from src
+ mov %cl, (%rdi) # deposit into destination
+ movb $0, (%rdi, %rdx, 1) # add NUL terminator (again)
+ ret
+
+.L0203: movzwl (%r9), %ecx
+ movzwl -2(%r9, %rdx, 1), %esi
+ mov %cx, (%rdi)
+ mov %si, -2(%rdi, %rdx, 1)
+ ret
+
+.L0407: mov (%r9), %ecx
+ mov -4(%r9, %rdx, 1), %esi
+ mov %ecx, (%rdi)
+ mov %esi, -4(%rdi, %rdx, 1)
+ ret
+
+.L0815: mov (%r9), %rcx
+ mov -8(%r9, %rdx, 1), %rsi
+ mov %rcx, (%rdi)
+ mov %rsi, -8(%rdi, %rdx, 1)
+ ret
+
+ /* length zero destination: just return the string length */
+.L0: mov %rsi, %rdi
+ jmp CNAME(strlen)
+ARCHEND(__strlcpy, baseline)
+
+ .section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/amd64/string/strlen.S b/lib/libc/amd64/string/strlen.S
index 1d2428e3420e..cc248af001ac 100644
--- a/lib/libc/amd64/string/strlen.S
+++ b/lib/libc/amd64/string/strlen.S
@@ -1,10 +1,15 @@
-/*
+/*-
* Written by Mateusz Guzik <mjg@freebsd.org>
+ * Copyright (c) 2023 The FreeBSD Foundation
+ *
+ * Portions of this software were developed by Robert Clausecker
+ * <fuz@FreeBSD.org> under sponsorship from the FreeBSD Foundation.
+ *
* Public domain.
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
+#include "amd64_archlevel.h"
/*
* Note: this routine was written with kernel use in mind (read: no simd),
@@ -14,6 +19,11 @@ __FBSDID("$FreeBSD$");
#define ALIGN_TEXT .p2align 4,0x90 /* 16-byte alignment, nop filled */
+ARCHFUNCS(strlen)
+ ARCHFUNC(strlen, scalar)
+ ARCHFUNC(strlen, baseline)
+ENDARCHFUNCS(strlen)
+
/*
* strlen(string)
* %rdi
@@ -30,7 +40,7 @@ __FBSDID("$FreeBSD$");
*
* The latter contains a 32-bit variant of the same algorithm coded in assembly for i386.
*/
-ENTRY(strlen)
+ARCHENTRY(strlen, scalar)
movabsq $0xfefefefefefefeff,%r8
movabsq $0x8080808080808080,%r9
@@ -76,6 +86,46 @@ ENTRY(strlen)
leaq (%rcx,%rdi),%rax
subq %r10,%rax
ret
-END(strlen)
+ARCHEND(strlen, scalar)
+
+ARCHENTRY(strlen, baseline)
+ mov %rdi, %rcx
+ pxor %xmm1, %xmm1
+ and $~0xf, %rdi # align string
+ pcmpeqb (%rdi), %xmm1 # compare head (with junk before string)
+ mov %rcx, %rsi # string pointer copy for later
+ and $0xf, %ecx # amount of bytes rdi is past 16 byte alignment
+ pmovmskb %xmm1, %eax
+ add $32, %rdi # advance to next iteration
+ shr %cl, %eax # clear out matches in junk bytes
+ test %eax, %eax # any match? (can't use ZF from SHR as CL=0 is possible)
+ jnz 2f
+
+ ALIGN_TEXT
+1: pxor %xmm1, %xmm1
+ pcmpeqb -16(%rdi), %xmm1 # find NUL bytes
+ pmovmskb %xmm1, %eax
+ test %eax, %eax # were any NUL bytes present?
+ jnz 3f
+
+ /* the same unrolled once more */
+ pxor %xmm1, %xmm1
+ pcmpeqb (%rdi), %xmm1
+ pmovmskb %xmm1, %eax
+ add $32, %rdi # advance to next iteration
+ test %eax, %eax
+ jz 1b
+
+ /* match found in loop body */
+ sub $16, %rdi # undo half the advancement
+3: tzcnt %eax, %eax # find the first NUL byte
+ sub %rsi, %rdi # string length until beginning of (%rdi)
+ lea -16(%rdi, %rax, 1), %rax # that plus loc. of NUL byte: full string length
+ ret
+
+ /* match found in head */
+2: tzcnt %eax, %eax # compute string length
+ ret
+ARCHEND(strlen, baseline)
.section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/amd64/string/strncat.c b/lib/libc/amd64/string/strncat.c
new file mode 100644
index 000000000000..33b278ac5e04
--- /dev/null
+++ b/lib/libc/amd64/string/strncat.c
@@ -0,0 +1,29 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2023 Robert Clausecker
+ */
+
+#include <sys/cdefs.h>
+
+#include <string.h>
+
+void *__memccpy(void *restrict, const void *restrict, int, size_t);
+
+char *
+strncat(char *dest, const char *src, size_t n)
+{
+ size_t len;
+ char *endptr;
+
+ len = strlen(dest);
+ endptr = __memccpy(dest + len, src, '\0', n);
+
+ /* avoid an extra branch */
+ if (endptr == NULL)
+ endptr = dest + len + n + 1;
+
+ endptr[-1] = '\0';
+
+ return (dest);
+}
diff --git a/lib/libc/amd64/string/strncmp.S b/lib/libc/amd64/string/strncmp.S
new file mode 100644
index 000000000000..932cf078bdfc
--- /dev/null
+++ b/lib/libc/amd64/string/strncmp.S
@@ -0,0 +1,488 @@
+/*-
+ * Copyright (c) 2023 The FreeBSD Foundation
+ *
+ * This software was developed by Robert Clausecker <fuz@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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 AUTHOR 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 AUTHOR 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
+ */
+
+#include <machine/asm.h>
+#include <machine/param.h>
+
+#include "amd64_archlevel.h"
+
+#define ALIGN_TEXT .p2align 4, 0x90
+
+ARCHFUNCS(strncmp)
+ ARCHFUNC(strncmp, scalar)
+ ARCHFUNC(strncmp, baseline)
+ENDARCHFUNCS(strncmp)
+
+/*
+ * This is just the scalar loop unrolled a bunch of times.
+ */
+ARCHENTRY(strncmp, scalar)
+ xor %eax, %eax
+ sub $4, %rdx # 4 chars left to compare?
+ jbe 1f
+
+ ALIGN_TEXT
+0: movzbl (%rdi), %ecx
+ test %ecx, %ecx # NUL char in first string?
+ jz .L0
+ cmpb (%rsi), %cl # mismatch between strings?
+ jnz .L0
+
+ movzbl 1(%rdi), %ecx
+ test %ecx, %ecx
+ jz .L1
+ cmpb 1(%rsi), %cl
+ jnz .L1
+
+ movzbl 2(%rdi), %ecx
+ test %ecx, %ecx
+ jz .L2
+ cmpb 2(%rsi), %cl
+ jnz .L2
+
+ movzbl 3(%rdi), %ecx
+ test %ecx, %ecx
+ jz .L3
+ cmpb 3(%rsi), %cl
+ jnz .L3
+
+ add $4, %rdi # advance to next iteration
+ add $4, %rsi
+ sub $4, %rdx
+ ja 0b
+
+ /* end of string within the next 4 characters */
+1: cmp $-4, %edx # end of string reached immediately?
+ jz .Leq
+ movzbl (%rdi), %ecx
+ test %ecx, %ecx
+ jz .L0
+ cmpb (%rsi), %cl
+ jnz .L0
+
+ cmp $-3, %edx # end of string reached after 1 char?
+ jz .Leq
+ movzbl 1(%rdi), %ecx
+ test %ecx, %ecx
+ jz .L1
+ cmpb 1(%rsi), %cl
+ jnz .L1
+
+ cmp $-2, %edx
+ jz .Leq
+ movzbl 2(%rdi), %ecx
+ test %ecx, %ecx
+ jz .L2
+ cmpb 2(%rsi), %cl
+ jnz .L2
+
+ cmp $-1, %edx # either end of string after 3 chars,
+ jz .Leq # or it boils down to the last char
+
+.L3: inc %eax
+.L2: inc %eax
+.L1: inc %eax
+.L0: movzbl (%rsi, %rax, 1), %ecx
+ movzbl (%rdi, %rax, 1), %eax
+ sub %ecx, %eax
+.Leq: ret
+ARCHEND(strncmp, scalar)
+
+ARCHENTRY(strncmp, baseline)
+ push %rbx
+ sub $1, %rdx # RDX--, so RDX points to the last byte to compare
+ jb .Lempty # where there any bytes to compare at all?
+
+ lea 15(%rdi), %r8d # end of head
+ lea 15(%rsi), %r9d
+ mov %edi, %eax
+ mov %esi, %ebx
+ xor %edi, %r8d # bits that changed between first and last byte
+ xor %esi, %r9d
+ and $~0xf, %rdi # align heads to 16 bytes
+ and $~0xf, %rsi
+ or %r8d, %r9d
+ and $0xf, %eax # offset from alignment
+ and $0xf, %ebx
+ movdqa (%rdi), %xmm0 # load aligned heads
+ movdqa (%rsi), %xmm2
+ pxor %xmm1, %xmm1
+ cmp $16, %rdx # end of buffer within the first 32 bytes?
+ jb .Llt16
+
+ test $PAGE_SIZE, %r9d # did the page change?
+ jz 0f # if not, take fast path
+
+
+ /* heads may cross page boundary, avoid unmapped loads */
+ movdqa %xmm0, -32(%rsp) # stash copies of the heads on the stack
+ movdqa %xmm2, -16(%rsp)
+ mov $-1, %r8d
+ mov $-1, %r9d
+ mov %eax, %ecx
+ shl %cl, %r8d # string head in XMM0
+ mov %ebx, %ecx
+ shl %cl, %r9d # string head in XMM2
+ pcmpeqb %xmm1, %xmm0
+ pcmpeqb %xmm1, %xmm2
+ pmovmskb %xmm0, %r10d
+ pmovmskb %xmm2, %r11d
+ test %r8d, %r10d # NUL byte present in first string?
+ lea -32(%rsp), %r8
+ cmovz %rdi, %r8
+ test %r9d, %r11d # NUL byte present in second string?
+ lea -16(%rsp), %r9
+ cmovz %rsi, %r9
+ movdqu (%r8, %rax, 1), %xmm0 # load true (or fake) heads
+ movdqu (%r9, %rbx, 1), %xmm4
+ jmp 1f
+
+ /* rdx == 0 */
+.Lempty:
+ xor %eax, %eax # zero-length buffers compare equal
+ pop %rbx
+ ret
+
+0: movdqu (%rdi, %rax, 1), %xmm0 # load true heads
+ movdqu (%rsi, %rbx, 1), %xmm4
+1: pxor %xmm2, %xmm2
+ pcmpeqb %xmm0, %xmm2 # NUL byte present?
+ pcmpeqb %xmm0, %xmm4 # which bytes match?
+ pandn %xmm4, %xmm2 # match and not NUL byte?
+ pmovmskb %xmm2, %r9d
+ xor $0xffff, %r9d # mismatch or NUL byte?
+ jnz .Lhead_mismatch
+
+ /* load head and second chunk */
+ movdqa 16(%rdi), %xmm2 # load second chunks
+ movdqa 16(%rsi), %xmm3
+ lea -16(%rdx, %rbx, 1), %rdx # account for length of RSI chunk
+ sub %rbx, %rax # is a&0xf >= b&0xf?
+ jb .Lswapped # if not, proceed with swapped operands
+ jmp .Lnormal
+
+ /* buffer ends within the first 16 bytes */
+.Llt16: test $PAGE_SIZE, %r9d # did the page change?
+ jz 0f # if not, take fast path
+
+ /* heads may cross page boundary */
+ movdqa %xmm0, -32(%rsp) # stash copies of the heads on the stack
+ movdqa %xmm2, -16(%rsp)
+ mov $-1, %r8d
+ mov $-1, %r9d
+ mov %eax, %ecx
+ shl %cl, %r8d # string head in XMM0
+ mov %ebx, %ecx
+ shl %cl, %r9d # string head in XMM2
+ pcmpeqb %xmm1, %xmm0
+ pcmpeqb %xmm1, %xmm2
+ pmovmskb %xmm0, %r10d
+ pmovmskb %xmm2, %r11d
+ lea (%rdx, %rax, 1), %ecx # location of last buffer byte in xmm0
+ bts %ecx, %r10d # treat as if NUL byte present
+ lea (%rdx, %rbx, 1), %ecx
+ bts %ecx, %r11d
+ test %r8w, %r10w # NUL byte present in first string head?
+ lea -32(%rsp), %r8
+ cmovz %rdi, %r8
+ test %r9w, %r11w # NUL byte present in second string head?
+ lea -16(%rsp), %r9
+ cmovz %rsi, %r9
+ movdqu (%r8, %rax, 1), %xmm0 # load true (or fake) heads
+ movdqu (%r9, %rbx, 1), %xmm4
+ jmp 1f
+
+0: movdqu (%rdi, %rax, 1), %xmm0 # load true heads
+ movdqu (%rsi, %rbx, 1), %xmm4
+1: pxor %xmm2, %xmm2
+ pcmpeqb %xmm0, %xmm2 # NUL byte present?
+ pcmpeqb %xmm0, %xmm4 # which bytes match?
+ pandn %xmm4, %xmm2 # match and not NUL byte?
+ pmovmskb %xmm2, %r9d
+ btr %edx, %r9d # induce mismatch in last byte of buffer
+ not %r9d # mismatch or NUL byte?
+
+ /* mismatch in true heads */
+ ALIGN_TEXT
+.Lhead_mismatch:
+ tzcnt %r9d, %r9d # where is the mismatch?
+ add %rax, %rdi # return to true heads
+ add %rbx, %rsi
+ movzbl (%rdi, %r9, 1), %eax # mismatching characters
+ movzbl (%rsi, %r9, 1), %ecx
+ sub %ecx, %eax
+ pop %rbx
+ ret
+
+ /* rax >= 0 */
+ ALIGN_TEXT
+.Lnormal:
+ neg %rax
+ movdqu 16(%rsi, %rax, 1), %xmm0
+ sub %rdi, %rsi # express RSI as distance from RDI
+ lea (%rsi, %rax, 1), %rbx # point RBX to offset in second string
+ neg %rax # ... corresponding to RDI
+ pcmpeqb %xmm3, %xmm1 # NUL present?
+ pcmpeqb %xmm2, %xmm0 # Mismatch between chunks?
+ pmovmskb %xmm1, %r8d
+ pmovmskb %xmm0, %r9d
+ mov $16, %ecx
+ cmp %rcx, %rdx # does the buffer end within (RDI,RSI,1)?
+ cmovb %edx, %ecx # ECX = min(16, RDX)
+ add $32, %rdi # advance to next iteration
+ bts %ecx, %r8d # mark end-of-buffer as if there was a NUL byte
+ test %r8w, %r8w # NUL or end of buffer found?
+ jnz .Lnul_found2
+ xor $0xffff, %r9d
+ jnz .Lmismatch2
+ sub $48, %rdx # end of buffer within first main loop iteration?
+ jb .Ltail # if yes, process tail
+
+ /*
+ * During the main loop, the layout of the two strings is something like:
+ *
+ * v ------1------ v ------2------ v
+ * RDI: AAAAAAAAAAAAABBBBBBBBBBBBBBBB...
+ * RSI: AAAAAAAAAAAAABBBBBBBBBBBBBBBBCCC...
+ *
+ * where v indicates the alignment boundaries and corresponding chunks
+ * of the strings have the same letters. Chunk A has been checked in
+ * the previous iteration. This iteration, we first check that string
+ * RSI doesn't end within region 2, then we compare chunk B between the
+ * two strings. As RSI is known not to hold a NUL byte in regsions 1
+ * and 2 at this point, this also ensures that RDI has not ended yet.
+ */
+ ALIGN_TEXT
+0: movdqu (%rdi, %rbx, 1), %xmm0 # chunk of 2nd string corresponding to RDI
+ pxor %xmm1, %xmm1
+ pcmpeqb (%rdi, %rsi, 1), %xmm1 # end of string in RSI?
+ pcmpeqb (%rdi), %xmm0 # where do the chunks match?
+ pmovmskb %xmm1, %r8d
+ pmovmskb %xmm0, %r9d
+ test %r8d, %r8d
+ jnz .Lnul_found
+ xor $0xffff, %r9d # any mismatches?
+ jnz .Lmismatch
+
+ /* main loop unrolled twice */
+ movdqu 16(%rdi, %rbx, 1), %xmm0
+ pxor %xmm1, %xmm1
+ pcmpeqb 16(%rdi, %rsi, 1), %xmm1
+ pcmpeqb 16(%rdi), %xmm0
+ pmovmskb %xmm1, %r8d
+ pmovmskb %xmm0, %r9d
+ add $32, %rdi
+ test %r8d, %r8d
+ jnz .Lnul_found2
+ xor $0xffff, %r9d
+ jnz .Lmismatch2
+ sub $32, %rdx # end of buffer within next iteration?
+ jae 0b
+
+ /* end of buffer will occur in next 32 bytes */
+.Ltail: movdqu (%rdi, %rbx, 1), %xmm0 # chunk of 2nd string corresponding to RDI
+ pxor %xmm1, %xmm1
+ pcmpeqb (%rdi, %rsi, 1), %xmm1 # end of string in RSI?
+ pcmpeqb (%rdi), %xmm0 # where do the chunks match?
+ pmovmskb %xmm1, %r8d
+ pmovmskb %xmm0, %r9d
+ bts %edx, %r8d # indicate NUL byte at last byte in buffer
+ test %r8w, %r8w # NUL byte in first chunk?
+ jnz .Lnul_found
+ xor $0xffff, %r9d # any mismatches?
+ jnz .Lmismatch
+
+ /* main loop unrolled twice */
+ movdqu 16(%rdi, %rbx, 1), %xmm0
+ pxor %xmm1, %xmm1
+ pcmpeqb 16(%rdi, %rsi, 1), %xmm1
+ pcmpeqb 16(%rdi), %xmm0
+ pmovmskb %xmm1, %r8d
+ pmovmskb %xmm0, %r9d
+ sub $16, %edx # take first half into account
+ bts %edx, %r8d # indicate NUL byte at last byte in buffer
+ add $32, %rdi
+
+.Lnul_found2:
+ sub $16, %rdi
+
+.Lnul_found:
+ mov %eax, %ecx
+ mov %r8d, %r10d
+ shl %cl, %r8d # adjust NUL mask to positions in RDI/RBX
+ not %r9d # mask of mismatches
+ or %r8w, %r9w # NUL bytes als count as mismatches
+ jnz .Lmismatch
+
+ /*
+ * (RDI) == (RSI) and NUL is past the string.
+ * compare (RSI) with the corresponding part
+ * of the other string until the NUL byte.
+ */
+ movdqu (%rdi, %rax, 1), %xmm0
+ pcmpeqb (%rdi, %rsi, 1), %xmm0
+ add %rdi, %rsi # restore RSI pointer
+ add %rax, %rdi # point RDI to chunk corresponding to (RSI)
+ pmovmskb %xmm0, %ecx # mask of matches
+ not %ecx # mask of mismatches
+ or %r10d, %ecx # mask of mismatches or NUL bytes
+ tzcnt %ecx, %ecx # location of first mismatch
+ movzbl (%rdi, %rcx, 1), %eax
+ movzbl (%rsi, %rcx, 1), %ecx
+ sub %ecx, %eax
+ pop %rbx
+ ret
+
+.Lmismatch2:
+ sub $16, %rdi
+
+ /* a mismatch has been found between RBX and RSI */
+.Lmismatch:
+ tzcnt %r9d, %r9d # where is the mismatch?
+ add %rdi, %rbx # turn RBX from offset into pointer
+ movzbl (%rbx, %r9, 1), %ecx
+ movzbl (%rdi, %r9, 1), %eax
+ sub %ecx, %eax
+ pop %rbx
+ ret
+
+ /* rax < 0 */
+ ALIGN_TEXT
+.Lswapped:
+ movdqu 16(%rdi, %rax, 1), %xmm0
+ sub %rsi, %rdi # express RDI as distance from RDI
+ lea (%rdi, %rax, 1), %rbx # point RBX to offset in first string
+ pcmpeqb %xmm2, %xmm1 # NUL present?
+ pcmpeqb %xmm3, %xmm0 # mismatch between chunks?
+ pmovmskb %xmm1, %r8d
+ pmovmskb %xmm0, %r9d
+ add %rax, %rdx # RDX points to buffer end in RSI
+ neg %rax # ... corresponding to RSI
+ mov $16, %ecx
+ cmp %rcx, %rdx # does the buffer end within (RSI,RDI,1)?
+ cmovb %edx, %ecx # ECX = min(16, RDX)
+ add $32, %rsi
+ bts %ecx, %r8d # mark end-of-buffer as if there was a NUL byte
+ test %r8w, %r8w # NUL or end of buffer found?
+ jnz .Lnul_found2s
+ xor $0xffff, %r9d
+ jnz .Lmismatch2s
+ sub $48, %rdx # end of buffer within first main loop iteration?
+ jb .Ltails # if yes, process tail
+
+ ALIGN_TEXT
+0: movdqu (%rsi, %rbx, 1), %xmm0 # chunk of 1st string corresponding to RSI
+ pxor %xmm1, %xmm1
+ pcmpeqb (%rsi, %rdi, 1), %xmm1 # end of string in RDI?
+ pcmpeqb (%rsi), %xmm0 # where do the chunks match?
+ pmovmskb %xmm1, %r8d
+ pmovmskb %xmm0, %r9d
+ test %r8d, %r8d
+ jnz .Lnul_founds
+ xor $0xffff, %r9d # any mismatches?
+ jnz .Lmismatchs
+
+ /* main loop unrolled twice */
+ movdqu 16(%rsi, %rbx, 1), %xmm0
+ pxor %xmm1, %xmm1
+ pcmpeqb 16(%rsi, %rdi, 1), %xmm1
+ pcmpeqb 16(%rsi), %xmm0
+ pmovmskb %xmm1, %r8d
+ pmovmskb %xmm0, %r9d
+ add $32, %rsi
+ test %r8d, %r8d
+ jnz .Lnul_found2s
+ xor $0xffff, %r9d
+ jnz .Lmismatch2s
+ sub $32, %rdx # end of buffer within next iteration?
+ jae 0b
+
+ /* end of buffer will occur in next 32 bytes */
+.Ltails:
+ movdqu (%rsi, %rbx, 1), %xmm0 # chunk of 1st string corresponding to RSI
+ pxor %xmm1, %xmm1
+ pcmpeqb (%rsi, %rdi, 1), %xmm1 # end of string in RDI?
+ pcmpeqb (%rsi), %xmm0 # where do the chunks match?
+ pmovmskb %xmm1, %r8d
+ pmovmskb %xmm0, %r9d
+ bts %edx, %r8d # indicate NUL byte at laste byte in buffer
+ test %r8w, %r8w # NUL byte in first chunk?
+ jnz .Lnul_founds
+ xor $0xffff, %r9d # any mismatches?
+ jnz .Lmismatchs
+
+ /* main loop unrolled twice */
+ movdqu 16(%rsi, %rbx, 1), %xmm0
+ pxor %xmm1, %xmm1
+ pcmpeqb 16(%rsi, %rdi, 1), %xmm1
+ pcmpeqb 16(%rsi), %xmm0
+ pmovmskb %xmm1, %r8d
+ pmovmskb %xmm0, %r9d
+ sub $16, %edx # take first half into account
+ bts %edx, %r8d # indicate NUL byte at laste byte in buffer
+ add $32, %rsi
+
+.Lnul_found2s:
+ sub $16, %rsi
+
+.Lnul_founds:
+ mov %eax, %ecx
+ mov %r8d, %r10d
+ shl %cl, %r8d # adjust NUL mask to positions in RSI/RBX
+ not %r9d # mask of mismatches
+ or %r8w, %r9w # NUL bytes also count as mismatches
+ jnz .Lmismatchs
+
+ movdqu (%rsi, %rax, 1), %xmm0
+ pcmpeqb (%rsi, %rdi, 1), %xmm0
+ add %rsi, %rdi # restore RDI pointer
+ add %rax, %rsi # point RSI to chunk corresponding to (RDI)
+ pmovmskb %xmm0, %ecx # mask of matches
+ not %ecx # mask of mismatches
+ or %r10d, %ecx # mask of mismatches or NUL bytes
+ tzcnt %ecx, %ecx # location of first mismatch
+ movzbl (%rdi, %rcx, 1), %eax
+ movzbl (%rsi, %rcx, 1), %ecx
+ sub %ecx, %eax
+ pop %rbx
+ ret
+
+.Lmismatch2s:
+ sub $16, %rsi
+
+.Lmismatchs:
+ tzcnt %r9d, %r9d # where is the mismatch?
+ add %rsi, %rbx # turn RBX from offset into pointer
+ movzbl (%rbx, %r9, 1), %eax
+ movzbl (%rsi, %r9, 1), %ecx
+ sub %ecx, %eax
+ pop %rbx
+ ret
+ARCHEND(strncmp, baseline)
+
+ .section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/aarch64/gen/_get_tp.c b/lib/libc/amd64/string/strncpy.c
index ce51b400b542..b3d868787fbe 100644
--- a/lib/libc/aarch64/gen/_get_tp.c
+++ b/lib/libc/amd64/string/strncpy.c
@@ -1,9 +1,7 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * Copyright (c) 2023 The FreeBSD Foundation
*
- * Copyright (c) 2021 The FreeBSD Foundation
- *
- * This software were developed by Konstantin Belousov
+ * This software was developed by Robert Clausecker <fuz@FreeBSD.org>
* under sponsorship from the FreeBSD Foundation.
*
* Redistribution and use in source and binary forms, with or without
@@ -15,31 +13,29 @@
* 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR OR CONTRIBUTORS BE LIABLE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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.
+ * SUCH DAMAGE
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <string.h>
-#include <stdint.h>
-#include "libc_private.h"
-void *
-_get_tp(void)
+char *__stpncpy(char *restrict, const char *restrict, size_t);
+
+char *
+strncpy(char *restrict dst, const char *restrict src, size_t len)
{
- void *res;
- __asm __volatile("mrs %0, tpidr_el0" : "=r" (res));
- return (res);
+ __stpncpy(dst, src, len);
+
+ return (dst);
}
diff --git a/lib/libc/i386/gen/_set_tp.c b/lib/libc/amd64/string/strnlen.c
index 2da48988eb37..74020f1b1c65 100644
--- a/lib/libc/i386/gen/_set_tp.c
+++ b/lib/libc/amd64/string/strnlen.c
@@ -1,8 +1,8 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * Copyright (c) 2023 The FreeBSD Foundation
*
- * Copyright (c) 2004 Doug Rabson
- * All rights reserved.
+ * This software was developed by Robert Clausecker <fuz@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -13,30 +13,29 @@
* 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR OR CONTRIBUTORS BE LIABLE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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.
- *
- * $FreeBSD$
+ * SUCH DAMAGE
*/
#include <string.h>
-#include <stdint.h>
-#include <machine/sysarch.h>
-#include "libc_private.h"
+char *__memchr(const void *, int, size_t);
-void
-_set_tp(void *tp)
+size_t
+strnlen(const char *s, size_t maxlen)
{
+ const char *loc;
+
+ loc = __memchr(s, '\0', maxlen);
- i386_set_gsbase(tp);
+ return (loc == NULL ? maxlen : (size_t)(loc - s));
}
diff --git a/lib/libc/i386/gen/_get_tp.c b/lib/libc/amd64/string/strpbrk.c
index f96695247928..87f587789991 100644
--- a/lib/libc/i386/gen/_get_tp.c
+++ b/lib/libc/amd64/string/strpbrk.c
@@ -1,9 +1,7 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * Copyright (c) 2023 The FreeBSD Foundation
*
- * Copyright (c) 2021 The FreeBSD Foundation
- *
- * This software were developed by Konstantin Belousov
+ * This software was developed by Robert Clausecker <fuz@FreeBSD.org>
* under sponsorship from the FreeBSD Foundation.
*
* Redistribution and use in source and binary forms, with or without
@@ -15,31 +13,31 @@
* 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR OR CONTRIBUTORS BE LIABLE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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.
+ * SUCH DAMAGE
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
#include <string.h>
-#include <stdint.h>
-#include "libc_private.h"
-void *
-_get_tp(void)
+size_t __strcspn(const char *, const char *);
+
+char *
+strpbrk(const char *s, const char *charset)
{
- void **res;
+ size_t loc;
+
+ loc = __strcspn(s, charset);
- __asm __volatile("movl %%gs:0, %0" : "=r" (res));
- return (&res[1]);
+ return (s[loc] == '\0' ? NULL : (char *)&s[loc]);
}
diff --git a/lib/libc/amd64/string/strrchr.S b/lib/libc/amd64/string/strrchr.S
new file mode 100644
index 000000000000..e397bbcd3478
--- /dev/null
+++ b/lib/libc/amd64/string/strrchr.S
@@ -0,0 +1,209 @@
+/*-
+ * Copyright (c) 2023 The FreeBSD Foundation
+ *
+ * This software was developed by Robert Clausecker <fuz@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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 AUTHOR 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 AUTHOR 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
+ */
+
+#include <machine/asm.h>
+
+#include "amd64_archlevel.h"
+
+#define ALIGN_TEXT .p2align 4,0x90 # 16-byte alignment, nop-filled
+
+ .weak rindex
+ .set rindex, strrchr
+
+ARCHFUNCS(strrchr)
+ ARCHFUNC(strrchr, scalar)
+ ARCHFUNC(strrchr, baseline)
+ENDARCHFUNCS(strrchr)
+
+ARCHENTRY(strrchr, scalar)
+ mov %edi, %ecx
+ and $~7, %rdi # align to 8 byte
+ movzbl %sil, %esi # clear stray high bits
+ movabs $0x0101010101010101, %r8
+ mov (%rdi), %rax # load first word
+ imul %r8, %rsi # replicate char 8 times
+
+ /*
+ * Unaligned input: align to 8 bytes. Then proceed the same
+ * way as with aligned input, but prevent matches before the
+ * beginning of the string. This is achieved by oring 0x01
+ * into each byte of the buffer before the string
+ */
+ shl $3, %ecx
+ mov %r8, %r10
+ shl %cl, %r10 # 0x01 where the string is
+ xor %r8, %r10 # 0x01 where it is not
+ neg %r8 # negate 01..01 so we can use lea
+ movabs $0x8080808080808080, %r9
+
+ mov %rsi, %rcx
+ xor %rax, %rcx # str ^ c
+ or %r10, %rax # ensure str != 0 before string
+ or %r10, %rcx # ensure str^c != 0 before string
+ bswap %rcx # in reverse order, to find last match
+ mov %rdi, %r10 # location of initial mismatch (if any)
+ xor %r11, %r11 # initial mismatch (none)
+ add $8, %rdi # advance to next iteration
+ lea (%rax, %r8, 1), %rdx # str - 0x01..01
+ not %rax # ~str
+ and %rdx, %rax # (str - 0x01..01) & ~str
+ and %r9, %rax # not including junk bits
+ jnz 1f # end of string?
+
+ lea (%rcx, %r8, 1), %rdx # (str ^ c) - 0x01..01
+ not %rcx # ~(str ^ c)
+ and %rdx, %rcx # ((str ^ c - 0x01..01) & ~(str ^ c)
+ and %r9, %rcx # not including junk bits
+ mov %rcx, %r11 # remember mismatch in head
+ jmp 0f
+
+ /* main loop unrolled twice */
+ ALIGN_TEXT
+3: lea (%rcx, %r8, 1), %rdx # (str ^ c) - 0x01..01
+ not %rcx # ~(str ^ c)
+ and %rdx, %rcx # ((str ^ c - 0x01..01) & ~(str ^ c)
+ and %r9, %rcx # not including junk bits
+ lea -8(%rdi), %rdx
+ cmovnz %rdx, %r10 # remember location of current mismatch
+ cmovnz %rcx, %r11
+
+0: mov (%rdi), %rax # str
+ mov %rsi, %rcx
+ xor %rax, %rcx # str ^ c
+ bswap %rcx # in reverse order, to find last match
+ lea (%rax, %r8, 1), %rdx # str - 0x01..01
+ not %rax # ~str
+ and %rdx, %rax # (str - 0x01..01) & ~str
+ and %r9, %rax # not including junk bits
+ jnz 2f # end of string?
+
+ lea (%rcx, %r8, 1), %rdx # (str ^ c) - 0x01..01
+ not %rcx # ~(str ^ c)
+ and %rdx, %rcx # ((str ^ c - 0x01..01) & ~(str ^ c)
+ and %r9, %rcx # not including junk bits
+ cmovnz %rdi, %r10 # remember location of current mismatch
+ cmovnz %rcx, %r11
+
+ mov 8(%rdi), %rax # str
+ add $16, %rdi
+ mov %rsi, %rcx
+ xor %rax, %rcx # str ^ c
+ bswap %rcx
+ lea (%rax, %r8, 1), %rdx # str - 0x01..01
+ not %rax # ~str
+ and %rdx, %rax # (str - 0x01..01) & ~str
+ and %r9, %rax # not including junk bits
+ jz 3b # end of string?
+
+ /* NUL found */
+1: sub $8, %rdi # undo advance past buffer
+2: lea (%rcx, %r8, 1), %rdx # (str ^ c) - 0x01..01
+ not %rcx # ~(str ^ c)
+ and %rdx, %rcx # ((str ^ c - 0x01..01) & ~(str ^ c)
+ and %r9, %rcx # not including junk bits
+ lea -1(%rax), %rdx
+ xor %rdx, %rax # mask of bytes in the string
+ bswap %rdx # in reverse order
+ and %rdx, %rcx # c found in the tail?
+ cmovnz %rdi, %r10
+ cmovnz %rcx, %r11
+ bswap %r11 # unreverse byte order
+ bsr %r11, %rcx # last location of c in (R10)
+ shr $3, %rcx # as byte offset
+ lea (%r10, %rcx, 1), %rax # pointer to match
+ test %r11, %r11 # was there actually a match?
+ cmovz %r11, %rax # if not, return null pointer
+ ret
+ARCHEND(strrchr, scalar)
+
+ARCHENTRY(strrchr, baseline)
+ mov %edi, %ecx
+ and $~0xf, %rdi # align to 16 bytes
+ movdqa (%rdi), %xmm1
+ movd %esi, %xmm0
+ and $0xf, %ecx # offset from alignment
+ pxor %xmm2, %xmm2
+ mov $-1, %edx
+ punpcklbw %xmm0, %xmm0 # c -> cc
+ shl %cl, %edx # bits corresponding to bytes in the string
+ punpcklwd %xmm0, %xmm0 # cc -> cccc
+ xor %r8, %r8 # address of latest match
+ mov $1, %esi # bit mask of latest match
+ mov %rdi, %r9 # candidate location for next match
+ add $16, %rdi # advance to next chunk
+
+ /* check for match in head */
+ pcmpeqb %xmm1, %xmm2 # NUL byte present?
+ pshufd $0, %xmm0, %xmm0 # cccc -> cccccccccccccccc
+ pcmpeqb %xmm0, %xmm1 # c present?
+ pmovmskb %xmm2, %eax
+ pmovmskb %xmm1, %ecx
+ and %edx, %ecx # c present in the string?
+ and %edx, %eax # NUL present in the string?
+ jnz .Lend2
+
+ /* main loop unrolled twice */
+ ALIGN_TEXT
+0: movdqa (%rdi), %xmm1
+ test %ecx, %ecx # was there a match in the last iter.?
+ cmovnz %r9, %r8 # remember match if any
+ cmovnz %ecx, %esi
+ pxor %xmm2, %xmm2
+ pcmpeqb %xmm1, %xmm2 # NUL byte present?
+ pcmpeqb %xmm0, %xmm1 # c present?
+ pmovmskb %xmm2, %eax
+ pmovmskb %xmm1, %ecx
+ test %eax, %eax # end of string in first half?
+ jnz .Lend
+
+ movdqa 16(%rdi), %xmm1
+ test %ecx, %ecx # was there a match in the last iter.?
+ cmovnz %rdi, %r8 # remember match if any
+ cmovnz %ecx, %esi
+ pxor %xmm2, %xmm2
+ pcmpeqb %xmm1, %xmm2 # NUL byte present?
+ pcmpeqb %xmm0, %xmm1 # c present?
+ pmovmskb %xmm2, %eax
+ pmovmskb %xmm1, %ecx
+ lea 16(%rdi), %r9
+ add $32, %rdi
+ test %eax, %eax # end of string in second half?
+ jz 0b
+
+ ALIGN_TEXT
+.Lend2: sub $16, %rdi
+.Lend: lea -1(%rax), %edx
+ xor %edx, %eax # mask of bytes in the string
+ and %eax, %ecx # c found in the tail?
+ cmovnz %rdi, %r8
+ cmovnz %ecx, %esi
+ bsr %esi, %esi # last location of c in (R8)
+ lea (%r8, %rsi, 1), %rax # pointer to match
+ ret
+ARCHEND(strrchr, baseline)
+ .section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/amd64/string/strsep.c b/lib/libc/amd64/string/strsep.c
new file mode 100644
index 000000000000..9fda56d7e135
--- /dev/null
+++ b/lib/libc/amd64/string/strsep.c
@@ -0,0 +1,57 @@
+/*-
+ * Copyright (c) 2023 The FreeBSD Foundation
+ *
+ * This software was developed by Robert Clausecker <fuz@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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 AUTHOR 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 AUTHOR 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
+ */
+
+#include <sys/cdefs.h>
+#include <string.h>
+
+size_t __strcspn(const char *, const char *);
+
+/*
+ * We have a fast strcspn() on amd64. Use it over a direct
+ * implementation of strsep for better performance.
+ */
+char *
+strsep(char **stringp, const char *delim)
+{
+ size_t n;
+ char *s;
+
+ s = *stringp;
+ if (s == NULL)
+ return (NULL);
+
+ n = __strcspn(s, delim);
+ if (s[n] == '\0')
+ *stringp = NULL;
+ else {
+ s[n] = '\0';
+ *stringp = s + n + 1;
+ }
+
+ return (s);
+}
diff --git a/lib/libc/amd64/string/strspn.S b/lib/libc/amd64/string/strspn.S
new file mode 100644
index 000000000000..565330f0c385
--- /dev/null
+++ b/lib/libc/amd64/string/strspn.S
@@ -0,0 +1,358 @@
+/*-
+ * Copyright (c) 2023 The FreeBSD Foundation
+ *
+ * This software was developed by Robert Clausecker <fuz@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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 AUTHOR 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 AUTHOR 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
+ */
+
+#include <machine/asm.h>
+#include <machine/param.h>
+
+#include "amd64_archlevel.h"
+
+#define ALIGN_TEXT .p2align 4,0x90 /* 16-byte alignment, nop filled */
+
+ARCHFUNCS(strspn)
+ ARCHFUNC(strspn, scalar)
+ NOARCHFUNC
+ ARCHFUNC(strspn, x86_64_v2)
+ENDARCHFUNCS(strspn)
+
+ARCHENTRY(strspn, scalar)
+ push %rbp # align stack to enable function call
+ mov %rsp, %rbp
+ sub $256, %rsp # allocate space for lookup table
+
+ /* check for special cases */
+ movzbl (%rsi), %edx # first character in the set
+ test %edx, %edx
+ jz .Lzero # empty set always returns 0
+
+ movzbl 1(%rsi), %eax # second character in the set
+ test %eax, %eax
+ jz .Lsingle
+
+ /* no special case matches -- prepare lookup table */
+ xor %r8d, %r8d
+ mov $28, %ecx
+0: mov %r8, (%rsp, %rcx, 8)
+ mov %r8, 8(%rsp, %rcx, 8)
+ mov %r8, 16(%rsp, %rcx, 8)
+ mov %r8, 24(%rsp, %rcx, 8)
+ sub $4, %ecx
+ jnc 0b
+
+ movb $1, (%rsp, %rdx, 1) # register first char in set
+ add $2, %rsi
+
+ /* process remaining chars in set */
+ ALIGN_TEXT
+0: movb $1, (%rsp, %rax, 1) # register previous char
+ movzbl (%rsi), %eax # next char in set
+ test %eax, %eax # end of string?
+ jz 1f
+
+ movb $1, (%rsp, %rax, 1)
+ add $2, %rsi
+ movzbl -1(%rsi), %eax
+ test %eax, %eax
+ jnz 0b
+
+1: mov %rdi, %rax # a copy of the source to iterate over
+
+ /* find mismatch */
+ ALIGN_TEXT
+0: movzbl (%rax), %ecx
+ cmpb $0, (%rsp, %rcx, 1)
+ je 2f
+
+ movzbl 1(%rax), %ecx
+ cmpb $0, (%rsp, %rcx, 1)
+ je 3f
+
+ movzbl 2(%rax), %ecx
+ cmpb $0, (%rsp, %rcx, 1)
+ je 4f
+
+ movzbl 3(%rax), %ecx
+ add $4, %rax
+ cmpb $0, (%rsp, %rcx, 1)
+ jne 0b
+
+ sub $3, %rax
+4: dec %rdi
+3: inc %rax
+2: sub %rdi, %rax # number of characters preceding match
+ leave
+ ret
+
+ /* empty set never matches */
+.Lzero: xor %eax, %eax
+ leave
+ ret
+
+ /* find repeated single character */
+ ALIGN_TEXT
+.Lsingle:
+ cmpb %dl, (%rdi, %rax, 1)
+ jne 1f
+
+ cmpb %dl, 1(%rdi, %rax, 1)
+ jne 2f
+
+ cmpb %dl, 2(%rdi, %rax, 1)
+ jne 3f
+
+ cmpb %dl, 3(%rdi, %rax, 1)
+ lea 4(%rax), %rax
+ je .Lsingle
+
+ sub $3, %rax
+3: inc %rax
+2: inc %rax
+1: leave
+ ret
+ARCHEND(strspn, scalar)
+
+ /*
+ * This kernel uses pcmpistri to do the heavy lifting.
+ * We provide three code paths, depending on set size:
+ *
+ * 0--16: one pcmpistri per 16 bytes of input
+ * 17--32: two pcmpistri per 16 bytes of input
+ * >=33: fall back to look up table
+ */
+ARCHENTRY(strspn, x86_64_v2)
+ push %rbp
+ mov %rsp, %rbp
+ sub $256, %rsp
+
+ /* find set size and copy up to 32 bytes to (%rsp) */
+ mov %esi, %ecx
+ and $~0xf, %rsi # align set pointer
+ movdqa (%rsi), %xmm0
+ pxor %xmm1, %xmm1
+ and $0xf, %ecx # amount of bytes rsi is past alignment
+ xor %edx, %edx
+ pcmpeqb %xmm0, %xmm1 # end of string reached?
+ movdqa %xmm0, 32(%rsp) # transfer head of set to stack
+ pmovmskb %xmm1, %eax
+ shr %cl, %eax # clear out junk before string
+ test %eax, %eax # end of set reached?
+ jnz 0f
+
+ movdqa 16(%rsi), %xmm0 # second chunk of the set
+ mov $16, %edx
+ sub %ecx, %edx # length of set preceding xmm0
+ pxor %xmm1, %xmm1
+ pcmpeqb %xmm0, %xmm1
+ movdqa %xmm0, 48(%rsp)
+ movdqu 32(%rsp, %rcx, 1), %xmm2 # head of set
+ pmovmskb %xmm1, %eax
+ test %eax, %eax
+ jnz 1f
+
+ movdqa 32(%rsi), %xmm0 # third chunk
+ add $16, %edx
+ pxor %xmm1, %xmm1
+ pcmpeqb %xmm0, %xmm1
+ movdqa %xmm0, 64(%rsp)
+ pmovmskb %xmm1, %eax
+ test %eax, %eax # still not done?
+ jz .Lgt32v2
+
+0: movdqu 32(%rsp, %rcx, 1), %xmm2 # head of set
+1: tzcnt %eax, %eax
+ add %eax, %edx # length of set (excluding NUL byte)
+ cmp $32, %edx # above 32 bytes?
+ ja .Lgt32v2
+
+ /*
+ * At this point we know that we want to use pcmpistri.
+ * one last problem obtains: the head of the string is not
+ * aligned and may cross a cacheline. If this is the case,
+ * we take the part before the page boundary and repeat the
+ * last byte to fill up the xmm register.
+ */
+ mov %rdi, %rax # save original string pointer
+ lea 15(%rdi), %esi # last byte of the head
+ xor %edi, %esi
+ test $PAGE_SIZE, %esi # does the head cross a page?
+ jz 0f
+
+ /* head crosses page: copy to stack to fix up */
+ and $~0xf, %rax # align head pointer temporarily
+ movzbl 15(%rax), %esi # last head byte on the page
+ movdqa (%rax), %xmm0
+ movabs $0x0101010101010101, %r8
+ imul %r8, %rsi # repeated 8 times
+ movdqa %xmm0, (%rsp) # head word on stack
+ mov %rsi, 16(%rsp) # followed by filler (last byte x8)
+ mov %rsi, 24(%rsp)
+ mov %edi, %eax
+ and $0xf, %eax # offset of head from alignment
+ add %rsp, %rax # pointer to fake head
+
+0: movdqu (%rax), %xmm1 # load head (fake or real)
+ lea 16(%rdi), %rax
+ and $~0xf, %rax # second 16 bytes of string (aligned)
+1: cmp $16, %edx # 16--32 bytes?
+ ja .Lgt16v2
+
+
+ /* set is 2--16 bytes in size */
+
+ /* _SIDD_UBYTE_OPS|_SIDD_CMP_EQUAL_ANY|_SIDD_LEAST_SIGNIFICANT|_SIDD_NEGATIVE_POLARITY */
+ pcmpistri $0x10, %xmm1, %xmm2 # match in head?
+ jc .Lheadmismatchv2
+
+ ALIGN_TEXT
+0: pcmpistri $0x10, (%rax), %xmm2
+ jc 1f # match or end of string?
+ pcmpistri $0x10, 16(%rax), %xmm2
+ lea 32(%rax), %rax
+ jnc 0b # match or end of string?
+
+ sub $16, %rax # go back to second half
+1: sub %rdi, %rax # offset of (%rax) from beginning of string
+ add %rcx, %rax # prefix length before match/NUL
+ leave
+ ret
+
+.Lheadmismatchv2:
+ mov %ecx, %eax # prefix length before mismatch/NUL
+ leave
+ ret
+
+ /* set is 17--32 bytes in size */
+.Lgt16v2:
+ movdqu 48(%rsp, %rcx, 1), %xmm3 # second part of set
+
+ /* _SIDD_UBYTE_OPS|_SIDD_CMP_EQUAL_ANY|_SIDD_BIT_MASK|_SIDD_NEGATIVE_POLARITY */
+ pcmpistrm $0x10, %xmm1, %xmm2 # any mismatch in first half?
+ movdqa %xmm0, %xmm4
+ pcmpistrm $0x10, %xmm1, %xmm3 # any mismatch in the second half?
+ ptest %xmm0, %xmm4 # any entry that doesn't match either?
+ jnz 2f
+
+ ALIGN_TEXT
+0: movdqa (%rax), %xmm1
+ pcmpistrm $0x10, %xmm1, %xmm2
+ movdqa %xmm0, %xmm4
+ pcmpistrm $0x10, %xmm1, %xmm3
+ ptest %xmm0, %xmm4
+ jnz 1f
+ movdqa 16(%rax), %xmm1
+ add $32, %rax
+ pcmpistrm $0x10, %xmm1, %xmm2
+ movdqa %xmm0, %xmm4
+ pcmpistrm $0x10, %xmm1, %xmm3
+ ptest %xmm0, %xmm4
+ jz 0b
+
+ sub $16, %rax
+1: pand %xmm4, %xmm0
+ movd %xmm0, %ecx
+ sub %rdi, %rax # offset of %xmm1 from beginning of string
+ tzcnt %ecx, %ecx
+ add %rcx, %rax # prefix length before match/NUL
+ leave
+ ret
+
+ /* mismatch or string end in head */
+2: pand %xmm4, %xmm0 # bit mask of mismatches (end of string counts)
+ movd %xmm0, %eax
+ tzcnt %eax, %eax # prefix length before mismatch/NUL
+ leave
+ ret
+
+ /* set is >=33 bytes in size */
+.Lgt32v2:
+ xorps %xmm0, %xmm0
+ mov $256-64, %edx
+
+ /* clear out look up table */
+0: movaps %xmm0, (%rsp, %rdx, 1)
+ movaps %xmm0, 16(%rsp, %rdx, 1)
+ movaps %xmm0, 32(%rsp, %rdx, 1)
+ movaps %xmm0, 48(%rsp, %rdx, 1)
+ sub $64, %edx
+ jnc 0b
+
+ add %rcx, %rsi # restore string pointer
+ mov %rdi, %rax # keep a copy of the string
+
+ /* initialise look up table */
+ movzbl (%rsi), %ecx # string is known not to be empty
+
+ ALIGN_TEXT
+0: movb $1, (%rsp, %rcx, 1)
+ movzbl 1(%rsi), %ecx
+ test %ecx, %ecx
+ jz 1f
+
+ movb $1, (%rsp, %rcx, 1)
+ movzbl 2(%rsi), %ecx
+ test %ecx, %ecx
+ jz 1f
+
+ movb $1, (%rsp, %rcx, 1)
+ movzbl 3(%rsi), %ecx
+ add $4, %rsi
+ test %ecx, %ecx
+ jz 1f
+
+ movb $1, (%rsp, %rcx, 1)
+ movzbl (%rsi), %ecx
+ test %ecx, %ecx
+ jnz 0b
+
+ /* find match */
+ ALIGN_TEXT
+1: movzbl (%rax), %ecx
+ cmpb $0, (%rsp, %rcx, 1)
+ je 2f
+
+ movzbl 1(%rax), %ecx
+ cmpb $0, (%rsp, %rcx, 1)
+ je 3f
+
+ movzbl 2(%rax), %ecx
+ cmpb $0, (%rsp, %rcx, 1)
+ je 4f
+
+ movzbl 3(%rax), %ecx
+ add $4, %rax
+ cmpb $0, (%rsp, %rcx, 1)
+ jne 1b
+
+ sub $3, %rax
+4: dec %rdi
+3: inc %rax
+2: sub %rdi, %rax # number of characters preceding match
+ leave
+ ret
+ARCHEND(strspn, x86_64_v2)
+
+ .section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/amd64/string/timingsafe_bcmp.S b/lib/libc/amd64/string/timingsafe_bcmp.S
new file mode 100644
index 000000000000..c003da2ea9a7
--- /dev/null
+++ b/lib/libc/amd64/string/timingsafe_bcmp.S
@@ -0,0 +1,232 @@
+/*-
+ * Copyright (c) 2023 The FreeBSD Foundation
+ *
+ * This software was developed by Robert Clausecker <fuz@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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 AUTHOR 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 AUTHOR 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
+ */
+
+#include <machine/asm.h>
+
+#include "amd64_archlevel.h"
+
+#define ALIGN_TEXT .p2align 4,0x90 /* 16-byte alignment, nop filled */
+
+ARCHFUNCS(timingsafe_bcmp)
+ ARCHFUNC(timingsafe_bcmp, scalar)
+ ARCHFUNC(timingsafe_bcmp, baseline)
+ENDARCHFUNCS(timingsafe_bcmp)
+
+ARCHENTRY(timingsafe_bcmp, scalar)
+ cmp $16, %rdx # at least 17 bytes to process?
+ ja .Lgt16
+
+ cmp $8, %edx # at least 9 bytes to process?
+ ja .L0916
+
+ cmp $4, %edx # at least 5 bytes to process?
+ ja .L0508
+
+ cmp $2, %edx # at least 3 bytes to process?
+ ja .L0304
+
+ test %edx, %edx # buffer empty?
+ jnz .L0102
+
+ xor %eax, %eax # empty buffer always matches
+ ret
+
+.L0102: movzbl (%rdi), %eax # load 1--2 bytes from first buffer
+ movzbl -1(%rdi, %rdx, 1), %ecx
+ xor (%rsi), %al # xor in second buffer
+ xor -1(%rsi, %rdx, 1), %cl
+ or %ecx, %eax # mismatch in any of the two?
+ ret
+
+.L0304: movzwl (%rdi), %eax
+ movzwl -2(%rdi, %rdx, 1), %ecx
+ xor (%rsi), %ax
+ xor -2(%rsi, %rdx, 1), %cx
+ or %ecx, %eax
+ ret
+
+.L0508: mov (%rdi), %eax
+ mov -4(%rdi, %rdx, 1), %ecx
+ xor (%rsi), %eax
+ xor -4(%rsi, %rdx, 1), %ecx
+ or %ecx, %eax
+ ret
+
+.L0916: mov (%rdi), %rax
+ mov -8(%rdi, %rdx, 1), %rcx
+ xor (%rsi), %rax
+ xor -8(%rsi, %rdx, 1), %rcx
+ or %rcx, %rax
+ setnz %al # ensure EAX nonzero even if only
+ ret # high bits of RAX were set
+
+ /* more than 16 bytes: process buffer in a loop */
+.Lgt16: mov (%rdi), %rax # process first 16 bytes
+ mov 8(%rdi), %r9
+ mov $32, %ecx
+ xor (%rsi), %rax
+ xor 8(%rsi), %r9
+ or %r9, %rax
+
+ cmp %rdx, %rcx # enough left for a full iteration?
+ jae .Ltail
+
+ /* main loop processing 16 bytes per iteration */
+ ALIGN_TEXT
+0: mov -16(%rdi, %rcx, 1), %r8
+ mov -8(%rdi, %rcx, 1), %r9
+ xor -16(%rsi, %rcx, 1), %r8
+ xor -8(%rsi, %rcx, 1), %r9
+ add $16, %rcx
+ or %r9, %r8
+ or %r8, %rax
+
+ cmp %rdx, %rcx
+ jb 0b
+
+ /* process last 16 bytes */
+.Ltail: mov -16(%rdi, %rdx, 1), %r8
+ mov -8(%rdi, %rdx, 1), %r9
+ xor -16(%rsi, %rdx, 1), %r8
+ xor -8(%rsi, %rdx, 1), %r9
+ or %r9, %r8
+ or %r8, %rax
+ setnz %al
+ ret
+ARCHEND(timingsafe_bcmp, scalar)
+
+ARCHENTRY(timingsafe_bcmp, baseline)
+ cmp $32, %rdx # at least 33 bytes to process?
+ ja .Lgt32b
+
+ cmp $16, %edx # at least 17 bytes to process?
+ ja .L1732b
+
+ cmp $8, %edx # at least 9 bytes to process?
+ ja .L0916b
+
+ cmp $4, %edx # at least 5 bytes to process?
+ ja .L0508b
+
+ cmp $2, %edx # at least 3 bytes to process?
+ ja .L0304b
+
+ test %edx, %edx # buffer empty?
+ jnz .L0102b
+
+ xor %eax, %eax # empty buffer always matches
+ ret
+
+.L0102b:
+ movzbl (%rdi), %eax # load 1--2 bytes from first buffer
+ movzbl -1(%rdi, %rdx, 1), %ecx
+ xor (%rsi), %al # xor in second buffer
+ xor -1(%rsi, %rdx, 1), %cl
+ or %ecx, %eax # mismatch in any of the two?
+ ret
+
+.L0304b:
+ movzwl (%rdi), %eax
+ movzwl -2(%rdi, %rdx, 1), %ecx
+ xor (%rsi), %ax
+ xor -2(%rsi, %rdx, 1), %cx
+ or %ecx, %eax
+ ret
+
+.L0508b:
+ mov (%rdi), %eax
+ mov -4(%rdi, %rdx, 1), %ecx
+ xor (%rsi), %eax
+ xor -4(%rsi, %rdx, 1), %ecx
+ or %ecx, %eax
+ ret
+
+.L0916b:
+ mov (%rdi), %rax
+ mov -8(%rdi, %rdx, 1), %rcx
+ xor (%rsi), %rax
+ xor -8(%rsi, %rdx, 1), %rcx
+ or %rcx, %rax
+ setnz %al # ensure EAX nonzero even if only
+ ret # high bits of RAX were set
+
+.L1732b:
+ movdqu (%rdi), %xmm0
+ movdqu (%rsi), %xmm2
+ movdqu -16(%rdi, %rdx, 1), %xmm1
+ movdqu -16(%rsi, %rdx, 1), %xmm3
+ pcmpeqb %xmm2, %xmm0
+ pcmpeqb %xmm3, %xmm1
+ pand %xmm1, %xmm0
+ pmovmskb %xmm0, %eax # 1 where equal
+ xor $0xffff, %eax # 1 where not equal
+ ret
+
+ /* more than 32 bytes: process buffer in a loop */
+.Lgt32b:
+ movdqu (%rdi), %xmm4
+ movdqu (%rsi), %xmm2
+ movdqu 16(%rdi), %xmm1
+ movdqu 16(%rsi), %xmm3
+ mov $64, %ecx
+ pcmpeqb %xmm2, %xmm4
+ pcmpeqb %xmm3, %xmm1
+ pand %xmm1, %xmm4
+ cmp %rdx, %rcx # enough left for a full iteration?
+ jae .Ltailb
+
+ /* main loop processing 32 bytes per iteration */
+ ALIGN_TEXT
+0: movdqu -32(%rdi, %rcx, 1), %xmm0
+ movdqu -32(%rsi, %rcx, 1), %xmm2
+ movdqu -16(%rdi, %rcx, 1), %xmm1
+ movdqu -16(%rsi, %rcx, 1), %xmm3
+ add $32, %rcx
+ pcmpeqb %xmm2, %xmm0
+ pcmpeqb %xmm3, %xmm1
+ pand %xmm1, %xmm0
+ pand %xmm0, %xmm4
+ cmp %rdx, %rcx
+ jb 0b
+
+ /* process last 32 bytes */
+.Ltailb:
+ movdqu -32(%rdi, %rdx, 1), %xmm0
+ movdqu -32(%rsi, %rdx, 1), %xmm2
+ movdqu -16(%rdi, %rdx, 1), %xmm1
+ movdqu -16(%rsi, %rdx, 1), %xmm3
+ pcmpeqb %xmm2, %xmm0
+ pcmpeqb %xmm3, %xmm1
+ pand %xmm1, %xmm0
+ pand %xmm4, %xmm0
+ pmovmskb %xmm0, %eax
+ xor $0xffff, %eax
+ ret
+ARCHEND(timingsafe_bcmp, baseline)
+
+ .section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/amd64/string/timingsafe_memcmp.S b/lib/libc/amd64/string/timingsafe_memcmp.S
new file mode 100644
index 000000000000..3f1eccdbd640
--- /dev/null
+++ b/lib/libc/amd64/string/timingsafe_memcmp.S
@@ -0,0 +1,145 @@
+/*-
+ * Copyright (c) 2023 The FreeBSD Foundation
+ *
+ * This software was developed by Robert Clausecker <fuz@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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 AUTHOR 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 AUTHOR 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
+ */
+
+#include <machine/asm.h>
+
+#define ALIGN_TEXT .p2align 4,0x90 /* 16-byte alignment, nop filled */
+
+/* int timingsafe_memcmp(const void *rdi, const void *rsi, size_t rdx) */
+ENTRY(timingsafe_memcmp)
+ cmp $16, %rdx # at least 17 bytes to process?
+ ja .Lgt16
+
+ cmp $8, %edx # at least 9 bytes to process?
+ ja .L0916
+
+ cmp $4, %edx # at least 5 bytes to process?
+ ja .L0508
+
+ cmp $2, %edx # at least 3 bytes to process?
+ ja .L0304
+
+ test %edx, %edx # buffer empty?
+ jnz .L0102
+
+ xor %eax, %eax # empty buffer always matches
+ ret
+
+.L0102: movzbl -1(%rdi, %rdx, 1), %eax # load 1--2 bytes from first buffer
+ movzbl -1(%rsi, %rdx, 1), %ecx
+ mov (%rdi), %ah # in big endian
+ mov (%rsi), %ch
+ sub %ecx, %eax
+ ret
+
+.L0304: movzwl -2(%rdi, %rdx, 1), %ecx
+ movzwl -2(%rsi, %rdx, 1), %edx
+ movzwl (%rdi), %eax
+ movzwl (%rsi), %esi
+ bswap %ecx # convert to big endian
+ bswap %edx # dito for edx, (e)ax, and (e)si
+ rol $8, %ax # ROLW is used here so the upper two
+ rol $8, %si # bytes stay clear, allowing us to
+ sub %edx, %ecx # save a SBB compared to .L0508
+ sbb %esi, %eax
+ or %eax, %ecx # nonzero if not equal
+ setnz %al
+ ret
+
+.L0508: mov -4(%rdi, %rdx, 1), %ecx
+ mov -4(%rsi, %rdx, 1), %edx
+ mov (%rdi), %edi
+ mov (%rsi), %esi
+ bswap %ecx # compare in big endian
+ bswap %edx
+ bswap %edi
+ bswap %esi
+ sub %edx, %ecx
+ sbb %esi, %edi
+ sbb %eax, %eax # -1 if less, 0 if greater or equal
+ or %edi, %ecx # nonzero if not equal
+ setnz %al # negative if <, 0 if =, 1 if >
+ ret
+
+.L0916: mov -8(%rdi, %rdx, 1), %rcx
+ mov -8(%rsi, %rdx, 1), %rdx
+ mov (%rdi), %rdi
+ mov (%rsi), %rsi
+ bswap %rcx # compare in big endian
+ bswap %rdx
+ bswap %rdi
+ bswap %rsi
+ sub %rdx, %rcx
+ sbb %rsi, %rdi
+ sbb %eax, %eax # -1 if less, 0 if greater or equal
+ or %rdi, %rcx # nonzero if not equal
+ setnz %al # negative if <, 0 if =, 1 if >
+ ret
+
+ /* compare 17+ bytes */
+.Lgt16: mov (%rdi), %r8 # process first 16 bytes
+ mov (%rsi), %r9
+ mov $32, %ecx
+ cmp %r8, %r9 # mismatch in head?
+ cmove 8(%rdi), %r8 # if not, try second pair
+ cmove 8(%rsi), %r9
+ cmp %rdx, %rcx
+ jae .Ltail
+
+ /* main loop processing 16 bytes per iteration */
+ ALIGN_TEXT
+0: mov -16(%rdi, %rcx, 1), %r10
+ mov -16(%rsi, %rcx, 1), %r11
+ cmp %r10, %r11 # mismatch in first pair?
+ cmove -8(%rdi, %rcx, 1), %r10 # if not, try second pair
+ cmove -8(%rsi, %rcx, 1), %r11
+ cmp %r8, %r9 # was there a mismatch previously?
+ cmove %r10, %r8 # apply new pair if there was not
+ cmove %r11, %r9
+ add $16, %rcx
+ cmp %rdx, %rcx
+ jb 0b
+
+.Ltail: mov -8(%rdi, %rdx, 1), %r10
+ mov -8(%rsi, %rdx, 1), %r11
+ cmp %r8, %r9
+ cmove -16(%rdi, %rdx, 1), %r8
+ cmove -16(%rsi, %rdx, 1), %r9
+ bswap %r10 # compare in big endian
+ bswap %r11
+ bswap %r8
+ bswap %r9
+ sub %r11, %r10
+ sbb %r9, %r8
+ sbb %eax, %eax # -1 if less, 0 if greater or equal
+ or %r10, %r8 # nonzero if not equal
+ setnz %al # negative if <, 0 if =, 1 if >
+ ret
+END(timingsafe_memcmp)
+
+ .section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/amd64/sys/Makefile.inc b/lib/libc/amd64/sys/Makefile.inc
deleted file mode 100644
index aea6755182a0..000000000000
--- a/lib/libc/amd64/sys/Makefile.inc
+++ /dev/null
@@ -1,13 +0,0 @@
-# from: Makefile.inc,v 1.1 1993/09/03 19:04:23 jtc Exp
-# $FreeBSD$
-
-SRCS+= \
- amd64_get_fsbase.c \
- amd64_get_gsbase.c \
- amd64_set_fsbase.c \
- amd64_set_gsbase.c
-
-MDASM= vfork.S cerror.S getcontext.S
-
-# Don't generate default code for these syscalls:
-NOASM+= sbrk.o vfork.o
diff --git a/lib/libc/amd64/sys/amd64_get_fsbase.c b/lib/libc/amd64/sys/amd64_get_fsbase.c
deleted file mode 100644
index 2de99912daf2..000000000000
--- a/lib/libc/amd64/sys/amd64_get_fsbase.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 2003 Peter Wemm
- * Copyright (c) 2017, 2018 The FreeBSD Foundation
- * All rights reserved.
- *
- * Portions of this software were developed by Konstantin Belousov
- * under sponsorship from the FreeBSD Foundation.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#define IN_RTLD 1
-#include <sys/param.h>
-#undef IN_RTLD
-#include <machine/cpufunc.h>
-#include <machine/specialreg.h>
-#include <machine/sysarch.h>
-#include <x86/ifunc.h>
-#include "libc_private.h"
-
-static int
-amd64_get_fsbase_cpu(void **addr)
-{
-
- *addr = (void *)rdfsbase();
- return (0);
-}
-
-static int
-amd64_get_fsbase_syscall(void **addr)
-{
-
- return (sysarch(AMD64_GET_FSBASE, addr));
-}
-
-DEFINE_UIFUNC(, int, amd64_get_fsbase, (void **))
-{
-
- if (__getosreldate() >= P_OSREL_WRFSBASE &&
- (cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0)
- return (amd64_get_fsbase_cpu);
- return (amd64_get_fsbase_syscall);
-}
diff --git a/lib/libc/amd64/sys/amd64_set_fsbase.c b/lib/libc/amd64/sys/amd64_set_fsbase.c
deleted file mode 100644
index 02ca9233d855..000000000000
--- a/lib/libc/amd64/sys/amd64_set_fsbase.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 2003 Peter Wemm
- * Copyright (c) 2017, 2018 The FreeBSD Foundation
- * All rights reserved.
- *
- * Portions of this software were developed by Konstantin Belousov
- * under sponsorship from the FreeBSD Foundation.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#define IN_RTLD 1
-#include <sys/param.h>
-#undef IN_RTLD
-#include <machine/cpufunc.h>
-#include <machine/specialreg.h>
-#include <machine/sysarch.h>
-#include <x86/ifunc.h>
-#include "libc_private.h"
-
-static int
-amd64_set_fsbase_cpu(void *addr)
-{
-
- wrfsbase((uintptr_t)addr);
- return (0);
-}
-
-static int
-amd64_set_fsbase_syscall(void *addr)
-{
-
- return (sysarch(AMD64_SET_FSBASE, &addr));
-}
-
-DEFINE_UIFUNC(, int, amd64_set_fsbase, (void *))
-{
-
- if (__getosreldate() >= P_OSREL_WRFSBASE &&
- (cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0)
- return (amd64_set_fsbase_cpu);
- return (amd64_set_fsbase_syscall);
-}
diff --git a/lib/libc/amd64/sys/amd64_set_gsbase.c b/lib/libc/amd64/sys/amd64_set_gsbase.c
deleted file mode 100644
index c4880c126ae9..000000000000
--- a/lib/libc/amd64/sys/amd64_set_gsbase.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 2003 Peter Wemm
- * Copyright (c) 2017, 2018 The FreeBSD Foundation
- * All rights reserved.
- *
- * Portions of this software were developed by Konstantin Belousov
- * under sponsorship from the FreeBSD Foundation.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#define IN_RTLD 1
-#include <sys/param.h>
-#undef IN_RTLD
-#include <machine/cpufunc.h>
-#include <machine/specialreg.h>
-#include <machine/sysarch.h>
-#include <x86/ifunc.h>
-#include "libc_private.h"
-
-static int
-amd64_set_gsbase_cpu(void *addr)
-{
-
- wrgsbase((uintptr_t)addr);
- return (0);
-}
-
-static int
-amd64_set_gsbase_syscall(void *addr)
-{
-
- return (sysarch(AMD64_SET_GSBASE, &addr));
-}
-
-DEFINE_UIFUNC(, int, amd64_set_gsbase, (void *))
-{
-
- if (__getosreldate() >= P_OSREL_WRFSBASE &&
- (cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0)
- return (amd64_set_gsbase_cpu);
- return (amd64_set_gsbase_syscall);
-}
diff --git a/lib/libc/amd64/sys/cerror.S b/lib/libc/amd64/sys/cerror.S
deleted file mode 100644
index 1928acd0b7a9..000000000000
--- a/lib/libc/amd64/sys/cerror.S
+++ /dev/null
@@ -1,60 +0,0 @@
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- */
-
-#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)cerror.s 5.1 (Berkeley) 4/23/90"
-#endif /* SYSLIBC_SCCS and not lint */
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#include "SYS.h"
-
- .globl HIDENAME(cerror)
- .hidden HIDENAME(cerror)
-
- /*
- * The __error() function is thread aware. For non-threaded
- * programs and the initial thread in threaded programs,
- * it returns a pointer to the global errno variable.
- */
- .globl CNAME(__error)
- .type CNAME(__error),@function
-HIDENAME(cerror):
- pushq %rax
- call PIC_PLT(CNAME(__error))
- popq %rcx
- movl %ecx,(%rax)
- movq $-1,%rax
- movq $-1,%rdx
- ret
-
- .section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/amd64/sys/getcontext.S b/lib/libc/amd64/sys/getcontext.S
deleted file mode 100644
index b11e65caf580..000000000000
--- a/lib/libc/amd64/sys/getcontext.S
+++ /dev/null
@@ -1,48 +0,0 @@
-/*-
- * Copyright (c) 2003 Peter Wemm <peter@FreeBSD.org>
- * All rights reserved.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#include <SYS.h>
-
-/*
- * This has to be magic to handle the multiple returns.
- * Otherwise, the setcontext() syscall will return here and we'll
- * pop off the return address and go to the *setcontext* call.
- */
- WEAK_REFERENCE(__sys_getcontext, _getcontext)
- WEAK_REFERENCE(__sys_getcontext, getcontext)
-ENTRY(__sys_getcontext)
- movq (%rsp),%rsi /* save getcontext return address */
- mov $SYS_getcontext,%rax
- KERNCALL
- jb HIDENAME(cerror)
- addq $8,%rsp /* remove stale (setcontext) return address */
- jmp *%rsi /* restore return address */
-END(__sys_getcontext)
-
- .section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/amd64/sys/vfork.S b/lib/libc/amd64/sys/vfork.S
deleted file mode 100644
index 550f14c3b60b..000000000000
--- a/lib/libc/amd64/sys/vfork.S
+++ /dev/null
@@ -1,54 +0,0 @@
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- */
-
-#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)Ovfork.s 5.1 (Berkeley) 4/23/90"
-#endif /* SYSLIBC_SCCS and not lint */
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#include "SYS.h"
-
- WEAK_REFERENCE(__sys_vfork, _vfork)
- WEAK_REFERENCE(__sys_vfork, vfork)
-ENTRY(__sys_vfork)
- popq %rsi /* fetch return address (%rsi preserved) */
- mov $SYS_vfork,%rax
- KERNCALL
- jb 1f
- jmp *%rsi
-1:
- pushq %rsi
- jmp HIDENAME(cerror)
-END(__sys_vfork)
-
- .section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/arm/Makefile.inc b/lib/libc/arm/Makefile.inc
index c4b3458ba2cd..70605ac1ac35 100644
--- a/lib/libc/arm/Makefile.inc
+++ b/lib/libc/arm/Makefile.inc
@@ -1,4 +1,3 @@
-# $FreeBSD$
#
# Machine dependent definitions for the arm architecture.
#
@@ -11,7 +10,7 @@ SYM_MAPS+=${LIBC_SRCTOP}/arm/Symbol.map
.include "${LIBC_SRCTOP}/arm/aeabi/Makefile.inc"
-.if ${MACHINE_ARCH:Marmv[67]*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "")
+.if !defined(CPUTYPE) || ${CPUTYPE:M*soft*} == ""
SYM_MAPS+=${LIBC_SRCTOP}/arm/Symbol_vfp.map
.endif
diff --git a/lib/libc/arm/SYS.h b/lib/libc/arm/SYS.h
deleted file mode 100644
index 8a3225fa6df5..000000000000
--- a/lib/libc/arm/SYS.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* $NetBSD: SYS.h,v 1.8 2003/08/07 16:42:02 agc Exp $ */
-
-/*-
- * SPDX-License-Identifier: BSD-3-Clause
- *
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- *
- * from: @(#)SYS.h 5.5 (Berkeley) 5/7/91
- * $FreeBSD$
- */
-
-#include <machine/asm.h>
-#include <sys/syscall.h>
-#include <machine/swi.h>
-
-#define SYSTRAP(x) \
- mov ip, r7; \
- ldr r7, =SYS_ ## x; \
- swi 0; \
- mov r7, ip
-
-#define CERROR _C_LABEL(cerror)
-#define CURBRK _C_LABEL(curbrk)
-
-#define _SYSCALL_NOERROR(x) \
- ENTRY(__CONCAT(__sys_, x)); \
- .weak _C_LABEL(x); \
- .set _C_LABEL(x), _C_LABEL(__CONCAT(__sys_,x)); \
- .weak _C_LABEL(__CONCAT(_,x)); \
- .set _C_LABEL(__CONCAT(_,x)),_C_LABEL(__CONCAT(__sys_,x)); \
- SYSTRAP(x)
-
-#define _SYSCALL(x) \
- _SYSCALL_NOERROR(x); \
- it cs; \
- bcs PIC_SYM(CERROR, PLT)
-
-#define SYSCALL(x) \
- _SYSCALL(x)
-
-#define PSEUDO(x) \
- ENTRY(__CONCAT(__sys_, x)); \
- .weak _C_LABEL(__CONCAT(_,x)); \
- .set _C_LABEL(__CONCAT(_,x)),_C_LABEL(__CONCAT(__sys_,x)); \
- SYSTRAP(x); \
- it cs; \
- bcs PIC_SYM(CERROR, PLT); \
- RET
-
-#define RSYSCALL(x) \
- _SYSCALL(x); \
- RET
-
- .globl CERROR
diff --git a/lib/libc/arm/Symbol.map b/lib/libc/arm/Symbol.map
index 530c19798d60..49476d2e176a 100644
--- a/lib/libc/arm/Symbol.map
+++ b/lib/libc/arm/Symbol.map
@@ -1,33 +1,11 @@
/*
- * $FreeBSD$
- */
-
-/*
* This only needs to contain symbols that are not listed in
* symbol maps from other parts of libc (i.e., not found in
* stdlib/Symbol.map, string/Symbol.map, sys/Symbol.map, ...).
*/
FBSD_1.0 {
- /* PSEUDO syscalls */
- _exit;
-
__mcount;
- _setjmp;
- _longjmp;
alloca;
- fabs;
- __infinity;
- __nan;
- makecontext;
- setjmp;
- longjmp;
- sigsetjmp;
- siglongjmp;
- htonl;
- htons;
- ntohl;
- ntohs;
- vfork;
brk;
sbrk;
};
@@ -47,20 +25,13 @@ FBSD_1.6 {
};
FBSDprivate_1.0 {
- /* PSEUDO syscalls */
- _getlogin;
-
- _set_tp;
+ _brk;
__aeabi_read_tp;
___longjmp;
- __makecontext;
__longjmp;
signalcontext;
- _signalcontext;
+ __signalcontext;
__siglongjmp;
- _vfork;
- _brk;
- _sbrk;
_libc_arm_fpu_present;
};
diff --git a/lib/libc/arm/Symbol_vfp.map b/lib/libc/arm/Symbol_vfp.map
index 692b72f544cb..29d2b66af1bc 100644
--- a/lib/libc/arm/Symbol_vfp.map
+++ b/lib/libc/arm/Symbol_vfp.map
@@ -1,5 +1,4 @@
/*
- * $FreeBSD$
*/
FBSD_1.0 {
diff --git a/lib/libc/arm/_fpmath.h b/lib/libc/arm/_fpmath.h
index f5ae2f95ad28..51dd039641b0 100644
--- a/lib/libc/arm/_fpmath.h
+++ b/lib/libc/arm/_fpmath.h
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002, 2003 David Schultz <das@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$
*/
#if defined(__VFP_FP__) || defined(__ARM_EABI__)
diff --git a/lib/libc/arm/aeabi/Makefile.inc b/lib/libc/arm/aeabi/Makefile.inc
index 9ccabc2186f9..08158f1d8e63 100644
--- a/lib/libc/arm/aeabi/Makefile.inc
+++ b/lib/libc/arm/aeabi/Makefile.inc
@@ -1,18 +1,16 @@
-# $FreeBSD$
.PATH: ${LIBC_SRCTOP}/arm/aeabi
SRCS+= aeabi_atexit.c \
aeabi_unwind_cpp.c \
aeabi_unwind_exidx.c
-.if (${MACHINE_ARCH:Marmv[67]*} && defined(CPUTYPE) && ${CPUTYPE:M*soft*} != "") || \
- ${MACHINE_ARCH:Marmv[67]*} == ""
+.if defined(CPUTYPE) && ${CPUTYPE:M*soft*} != ""
SRCS+= aeabi_asm_double.S \
aeabi_asm_float.S \
aeabi_double.c \
aeabi_float.c
.endif
-.if ${MACHINE_ARCH:Marmv[67]*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "")
+.if !defined(CPUTYPE) || ${CPUTYPE:M*soft*} == ""
SRCS+= aeabi_vfp_double.S \
aeabi_vfp_float.S
.endif
diff --git a/lib/libc/arm/aeabi/Symbol.map b/lib/libc/arm/aeabi/Symbol.map
index 4a08d31d601b..175884c82881 100644
--- a/lib/libc/arm/aeabi/Symbol.map
+++ b/lib/libc/arm/aeabi/Symbol.map
@@ -1,8 +1,4 @@
/*
- * $FreeBSD$
- */
-
-/*
* This only needs to contain AEABI symbols that are not listed in
* symbol maps from other parts of libc (i.e., not found in
* stdlib/Symbol.map, string/Symbol.map, sys/Symbol.map, ...).
diff --git a/lib/libc/arm/aeabi/aeabi_asm_double.S b/lib/libc/arm/aeabi/aeabi_asm_double.S
index ced4d78b6cbf..767c62a7edf8 100644
--- a/lib/libc/arm/aeabi/aeabi_asm_double.S
+++ b/lib/libc/arm/aeabi/aeabi_asm_double.S
@@ -26,8 +26,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
#define PCR_Z (1 << 30)
#define PCR_C (1 << 29)
diff --git a/lib/libc/arm/aeabi/aeabi_asm_float.S b/lib/libc/arm/aeabi/aeabi_asm_float.S
index de6b1c88f4f2..f9dff9e0aec6 100644
--- a/lib/libc/arm/aeabi/aeabi_asm_float.S
+++ b/lib/libc/arm/aeabi/aeabi_asm_float.S
@@ -26,8 +26,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
#define PCR_Z (1 << 30)
#define PCR_C (1 << 29)
diff --git a/lib/libc/arm/aeabi/aeabi_atexit.c b/lib/libc/arm/aeabi/aeabi_atexit.c
index a33ca8f78af4..d688edf9c4e9 100644
--- a/lib/libc/arm/aeabi/aeabi_atexit.c
+++ b/lib/libc/arm/aeabi/aeabi_atexit.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (C) 2012 Andrew Turner
* All rights reserved.
@@ -27,9 +27,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
int __cxa_atexit(void (*)(void *), void *, void *);
int
diff --git a/lib/libc/arm/aeabi/aeabi_double.c b/lib/libc/arm/aeabi/aeabi_double.c
index 0ec3e625c25c..190354e5c6eb 100644
--- a/lib/libc/arm/aeabi/aeabi_double.c
+++ b/lib/libc/arm/aeabi/aeabi_double.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (C) 2012 Andrew Turner
* All rights reserved.
@@ -27,9 +27,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "softfloat-for-gcc.h"
#include "milieu.h"
#include "softfloat.h"
diff --git a/lib/libc/arm/aeabi/aeabi_float.c b/lib/libc/arm/aeabi/aeabi_float.c
index 62f78495e844..ac6b11ae9dfe 100644
--- a/lib/libc/arm/aeabi/aeabi_float.c
+++ b/lib/libc/arm/aeabi/aeabi_float.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (C) 2012 Andrew Turner
* All rights reserved.
@@ -27,9 +27,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "softfloat-for-gcc.h"
#include "milieu.h"
#include "softfloat.h"
diff --git a/lib/libc/arm/aeabi/aeabi_int_div.S b/lib/libc/arm/aeabi/aeabi_int_div.S
index 41f5c123b1e4..708b478b3881 100644
--- a/lib/libc/arm/aeabi/aeabi_int_div.S
+++ b/lib/libc/arm/aeabi/aeabi_int_div.S
@@ -26,8 +26,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* Due to bug in libcompiler_rt, all symbols declared by
* DEFINE_AEABI_FUNCTION_ALIAS() are not hidden. All these but
diff --git a/lib/libc/arm/aeabi/aeabi_unwind_cpp.c b/lib/libc/arm/aeabi/aeabi_unwind_cpp.c
index 78b77c351cdb..efcace2c0675 100644
--- a/lib/libc/arm/aeabi/aeabi_unwind_cpp.c
+++ b/lib/libc/arm/aeabi/aeabi_unwind_cpp.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (C) 2011 Andrew Turner
* All rights reserved.
@@ -34,9 +34,6 @@
* check this.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdlib.h>
void __aeabi_unwind_cpp_pr0(void) __hidden;
diff --git a/lib/libc/arm/aeabi/aeabi_unwind_exidx.c b/lib/libc/arm/aeabi/aeabi_unwind_exidx.c
index d5af8b3fc6e0..cf61922d4304 100644
--- a/lib/libc/arm/aeabi/aeabi_unwind_exidx.c
+++ b/lib/libc/arm/aeabi/aeabi_unwind_exidx.c
@@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <machine/elf.h>
#include <link.h>
diff --git a/lib/libc/arm/aeabi/aeabi_vfp.h b/lib/libc/arm/aeabi/aeabi_vfp.h
index a7b6b7b54618..f87f9acfd0a2 100644
--- a/lib/libc/arm/aeabi/aeabi_vfp.h
+++ b/lib/libc/arm/aeabi/aeabi_vfp.h
@@ -23,8 +23,6 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD$
- *
*/
#ifndef AEABI_VFP_H
diff --git a/lib/libc/arm/aeabi/aeabi_vfp_double.S b/lib/libc/arm/aeabi/aeabi_vfp_double.S
index be4309dd6efc..89287d922f78 100644
--- a/lib/libc/arm/aeabi/aeabi_vfp_double.S
+++ b/lib/libc/arm/aeabi/aeabi_vfp_double.S
@@ -26,8 +26,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
#include "aeabi_vfp.h"
.fpu vfp
diff --git a/lib/libc/arm/aeabi/aeabi_vfp_float.S b/lib/libc/arm/aeabi/aeabi_vfp_float.S
index c9df41cf4b2e..389e58935f89 100644
--- a/lib/libc/arm/aeabi/aeabi_vfp_float.S
+++ b/lib/libc/arm/aeabi/aeabi_vfp_float.S
@@ -26,8 +26,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
#include "aeabi_vfp.h"
.fpu vfp
diff --git a/lib/libc/arm/arith.h b/lib/libc/arm/arith.h
index 86121bf9a80c..418f83f64ccb 100644
--- a/lib/libc/arm/arith.h
+++ b/lib/libc/arm/arith.h
@@ -1,16 +1,15 @@
/*
* MD header for contrib/gdtoa
*
- * $FreeBSD$
- */
-
-/*
* NOTE: The definitions in this file must be correct or strtod(3) and
* floating point formats in printf(3) will break! The file can be
* generated by running contrib/gdtoa/arithchk.c on the target
* architecture. See contrib/gdtoa/gdtoaimp.h for details.
+ *
+ * Generated on CA15, verified on CA9, CA7(with VFP lite) and on 32-bit ARMv9.
+ *
*/
#define IEEE_8087
#define Arith_Kind_ASL 1
-#define Sudden_Underflow
+#define Double_Align
diff --git a/lib/libc/arm/gd_qnan.h b/lib/libc/arm/gd_qnan.h
index 8fa9edd83415..acf13d0b7852 100644
--- a/lib/libc/arm/gd_qnan.h
+++ b/lib/libc/arm/gd_qnan.h
@@ -4,20 +4,19 @@
* This file can be generated by compiling and running contrib/gdtoa/qnan.c
* on the target architecture after arith.h has been generated.
*
- * XXX I don't have ARM hardware, so I just guessed. --das
+ * Generated on CA15, verified on CA9, CA7(with VFP lite) and on 32-bit ARMv9.
*
- * $FreeBSD$
*/
#define f_QNAN 0x7fc00000
#define d_QNAN0 0x0
#define d_QNAN1 0x7ff80000
#define ld_QNAN0 0x0
-#define ld_QNAN1 0xc0000000
-#define ld_QNAN2 0x7fff
+#define ld_QNAN1 0x7ff80000
+#define ld_QNAN2 0x0
#define ld_QNAN3 0x0
#define ldus_QNAN0 0x0
#define ldus_QNAN1 0x0
#define ldus_QNAN2 0x0
-#define ldus_QNAN3 0xc000
-#define ldus_QNAN4 0x7fff
+#define ldus_QNAN3 0x7ff8
+#define ldus_QNAN4 0x0
diff --git a/lib/libc/arm/gen/Makefile.inc b/lib/libc/arm/gen/Makefile.inc
index 35aa465e4904..3a76c1de4e7d 100644
--- a/lib/libc/arm/gen/Makefile.inc
+++ b/lib/libc/arm/gen/Makefile.inc
@@ -1,11 +1,7 @@
-# @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
-# $FreeBSD$
SRCS+= \
__aeabi_read_tp.S \
_ctx_start.S \
- _get_tp.c \
- _set_tp.c \
_setjmp.S \
alloca.S \
arm_initfini.c \
@@ -25,7 +21,7 @@ MAN+= \
arm_drain_writebuf.2 \
arm_sync_icache.2 \
-.if ${MACHINE_ARCH:Marmv[67]*} && (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "")
+.if !defined(CPUTYPE) || ${CPUTYPE:M*soft*} == ""
SRCS+= \
fpgetmask_vfp.c \
diff --git a/lib/libc/arm/gen/__aeabi_read_tp.S b/lib/libc/arm/gen/__aeabi_read_tp.S
index 6229c951b344..066d92e2e956 100644
--- a/lib/libc/arm/gen/__aeabi_read_tp.S
+++ b/lib/libc/arm/gen/__aeabi_read_tp.S
@@ -26,8 +26,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
#include <machine/sysarch.h>
ENTRY(__aeabi_read_tp)
diff --git a/lib/libc/arm/gen/_ctx_start.S b/lib/libc/arm/gen/_ctx_start.S
index faedfb5c6443..cd8d25b9e583 100644
--- a/lib/libc/arm/gen/_ctx_start.S
+++ b/lib/libc/arm/gen/_ctx_start.S
@@ -1,6 +1,5 @@
#include <machine/asm.h>
-.ident "$FreeBSD$"
ENTRY(_ctx_start)
mov lr, pc
mov pc, r4
diff --git a/lib/libc/arm/gen/_set_tp.c b/lib/libc/arm/gen/_set_tp.c
deleted file mode 100644
index 1346ece5c9ef..000000000000
--- a/lib/libc/arm/gen/_set_tp.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 2004 Doug Rabson
- * All rights reserved.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- *
- * $FreeBSD$
- */
-
-#include <string.h>
-#include <sys/types.h>
-
-#include <machine/sysarch.h>
-#include "libc_private.h"
-
-void
-_set_tp(void *tp)
-{
-
- sysarch(ARM_SET_TP, tp);
-}
diff --git a/lib/libc/arm/gen/_setjmp.S b/lib/libc/arm/gen/_setjmp.S
index d79697ace307..19b8b6b07059 100644
--- a/lib/libc/arm/gen/_setjmp.S
+++ b/lib/libc/arm/gen/_setjmp.S
@@ -42,9 +42,6 @@
#include <machine/asm.h>
#include <machine/setjmp.h>
-
-__FBSDID("$FreeBSD$");
-
/*
* C library -- _setjmp, _longjmp
*
diff --git a/lib/libc/arm/gen/alloca.S b/lib/libc/arm/gen/alloca.S
index 2539b7a80c97..3545cc642aad 100644
--- a/lib/libc/arm/gen/alloca.S
+++ b/lib/libc/arm/gen/alloca.S
@@ -35,8 +35,6 @@
/* like alloc, but automatic automatic free in return */
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
ENTRY(alloca)
add r0, r0, #0x00000007 /* round up to next 8 byte alignment */
bic r0, r0, #0x00000007
diff --git a/lib/libc/arm/gen/arm_drain_writebuf.2 b/lib/libc/arm/gen/arm_drain_writebuf.2
index 6aecea7a132f..613c35d39ef2 100644
--- a/lib/libc/arm/gen/arm_drain_writebuf.2
+++ b/lib/libc/arm/gen/arm_drain_writebuf.2
@@ -21,8 +21,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd July 10, 2019
.Dt ARM_DRAIN_WRITEBUF 2
.Os
diff --git a/lib/libc/arm/gen/arm_drain_writebuf.c b/lib/libc/arm/gen/arm_drain_writebuf.c
index e20c8bc7a833..30c93718bfe6 100644
--- a/lib/libc/arm/gen/arm_drain_writebuf.c
+++ b/lib/libc/arm/gen/arm_drain_writebuf.c
@@ -25,9 +25,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <machine/sysarch.h>
#include <stddef.h>
diff --git a/lib/libc/arm/gen/arm_initfini.c b/lib/libc/arm/gen/arm_initfini.c
index 4dabe6743c9f..31756aa852a4 100644
--- a/lib/libc/arm/gen/arm_initfini.c
+++ b/lib/libc/arm/gen/arm_initfini.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-NetBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2013 The NetBSD Foundation, Inc.
* Copyright (c) 2013 Andrew Turner
@@ -33,9 +33,6 @@
* $NetBSD: arm_initfini.c,v 1.2 2013/01/31 06:47:55 matt Exp $
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* To properly implement setjmp/longjmp for the ARM AAPCS ABI, it has to be
* aware of whether there is a FPU is present or not. Regardless of whether
diff --git a/lib/libc/arm/gen/arm_sync_icache.2 b/lib/libc/arm/gen/arm_sync_icache.2
index 667246e40cbb..c91904aa55d6 100644
--- a/lib/libc/arm/gen/arm_sync_icache.2
+++ b/lib/libc/arm/gen/arm_sync_icache.2
@@ -21,8 +21,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd July 10, 2019
.Dt ARM_sync_icache 2
.Os
diff --git a/lib/libc/arm/gen/arm_sync_icache.c b/lib/libc/arm/gen/arm_sync_icache.c
index 5a029b45c47d..b5872fb8ef00 100644
--- a/lib/libc/arm/gen/arm_sync_icache.c
+++ b/lib/libc/arm/gen/arm_sync_icache.c
@@ -25,9 +25,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <machine/sysarch.h>
#include <stddef.h>
diff --git a/lib/libc/arm/gen/divsi3.S b/lib/libc/arm/gen/divsi3.S
index fac0663cdb2a..9fddebaf96f3 100644
--- a/lib/libc/arm/gen/divsi3.S
+++ b/lib/libc/arm/gen/divsi3.S
@@ -15,8 +15,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* stack is aligned as there's a possibility of branching to L_overflow
* which makes a C call
diff --git a/lib/libc/arm/gen/fabs.c b/lib/libc/arm/gen/fabs.c
index 6730a6746289..2e0abbb8a42a 100644
--- a/lib/libc/arm/gen/fabs.c
+++ b/lib/libc/arm/gen/fabs.c
@@ -36,9 +36,6 @@
/*
* fabs(x) returns the absolute value of x.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
double
fabs(double x)
{
diff --git a/lib/libc/arm/gen/flt_rounds.c b/lib/libc/arm/gen/flt_rounds.c
index 17ca3fb9aa90..7621262419a4 100644
--- a/lib/libc/arm/gen/flt_rounds.c
+++ b/lib/libc/arm/gen/flt_rounds.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2012 Ian Lepore <freebsd@damnhippie.dyndns.org>
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <fenv.h>
#include <float.h>
diff --git a/lib/libc/arm/gen/fpgetmask_vfp.c b/lib/libc/arm/gen/fpgetmask_vfp.c
index 7c4d76fc403d..5e73a274dafa 100644
--- a/lib/libc/arm/gen/fpgetmask_vfp.c
+++ b/lib/libc/arm/gen/fpgetmask_vfp.c
@@ -25,16 +25,9 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <ieeefp.h>
-#ifdef __weak_alias
-__weak_alias(fpgetmask,_fpgetmask)
-#endif
-
#define FP_X_MASK (FP_X_INV | FP_X_DZ | FP_X_OFL | FP_X_UFL | FP_X_IMP)
fp_except_t
diff --git a/lib/libc/arm/gen/fpgetround_vfp.c b/lib/libc/arm/gen/fpgetround_vfp.c
index ed9438865649..21debc0b028d 100644
--- a/lib/libc/arm/gen/fpgetround_vfp.c
+++ b/lib/libc/arm/gen/fpgetround_vfp.c
@@ -25,9 +25,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <ieeefp.h>
diff --git a/lib/libc/arm/gen/fpgetsticky_vfp.c b/lib/libc/arm/gen/fpgetsticky_vfp.c
index f1e0ba5bfdb2..651610dddf83 100644
--- a/lib/libc/arm/gen/fpgetsticky_vfp.c
+++ b/lib/libc/arm/gen/fpgetsticky_vfp.c
@@ -25,16 +25,9 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <ieeefp.h>
-#ifdef __weak_alias
-__weak_alias(fpgetsticky,_fpgetsticky)
-#endif
-
#define FP_X_MASK (FP_X_INV | FP_X_DZ | FP_X_OFL | FP_X_UFL | FP_X_IMP)
fp_except
diff --git a/lib/libc/arm/gen/fpsetmask_vfp.c b/lib/libc/arm/gen/fpsetmask_vfp.c
index 170e06d74fa9..92ad97e6dfa2 100644
--- a/lib/libc/arm/gen/fpsetmask_vfp.c
+++ b/lib/libc/arm/gen/fpsetmask_vfp.c
@@ -25,9 +25,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <ieeefp.h>
diff --git a/lib/libc/arm/gen/fpsetround_vfp.c b/lib/libc/arm/gen/fpsetround_vfp.c
index dc65a2e10057..4e55335f6a3b 100644
--- a/lib/libc/arm/gen/fpsetround_vfp.c
+++ b/lib/libc/arm/gen/fpsetround_vfp.c
@@ -25,9 +25,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <ieeefp.h>
diff --git a/lib/libc/arm/gen/fpsetsticky_vfp.c b/lib/libc/arm/gen/fpsetsticky_vfp.c
index ddc15938417c..fb3a59b25178 100644
--- a/lib/libc/arm/gen/fpsetsticky_vfp.c
+++ b/lib/libc/arm/gen/fpsetsticky_vfp.c
@@ -25,9 +25,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <ieeefp.h>
diff --git a/lib/libc/arm/gen/getcontextx.c b/lib/libc/arm/gen/getcontextx.c
index 38a9a8abfe11..357d3a2a0416 100644
--- a/lib/libc/arm/gen/getcontextx.c
+++ b/lib/libc/arm/gen/getcontextx.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2017 Michal Meloun <mmel@FreeBSD.org>
* All rights reserved.
@@ -26,9 +26,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/ucontext.h>
#include <errno.h>
diff --git a/lib/libc/arm/gen/infinity.c b/lib/libc/arm/gen/infinity.c
index 60faf42a7ea3..1a78a03be2e3 100644
--- a/lib/libc/arm/gen/infinity.c
+++ b/lib/libc/arm/gen/infinity.c
@@ -2,9 +2,6 @@
* infinity.c
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <math.h>
/* bytes for +Infinity on a 387 */
diff --git a/lib/libc/arm/gen/makecontext.c b/lib/libc/arm/gen/makecontext.c
index 421cf0dd3ed2..ac338085f2ed 100644
--- a/lib/libc/arm/gen/makecontext.c
+++ b/lib/libc/arm/gen/makecontext.c
@@ -1,7 +1,7 @@
/* $NetBSD: makecontext.c,v 1.2 2003/01/18 11:06:24 thorpej Exp $ */
/*-
- * SPDX-License-Identifier: BSD-2-Clause-NetBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -31,9 +31,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdlib.h>
#include <stddef.h>
#include <inttypes.h>
@@ -45,15 +42,15 @@ extern void _ctx_start(void);
void
ctx_done(ucontext_t *ucp)
-{
-
+{
+
if (ucp->uc_link == NULL)
exit(0);
- else {
+ else {
setcontext((const ucontext_t *)ucp->uc_link);
abort();
- }
-}
+ }
+}
__weak_reference(__makecontext, makecontext);
diff --git a/lib/libc/arm/gen/setjmp.S b/lib/libc/arm/gen/setjmp.S
index 58353ca9a5fc..5a6c899e2b23 100644
--- a/lib/libc/arm/gen/setjmp.S
+++ b/lib/libc/arm/gen/setjmp.S
@@ -40,9 +40,6 @@
#include <machine/asm.h>
#include <machine/setjmp.h>
-
-__FBSDID("$FreeBSD$");
-
/*
* C library -- setjmp, longjmp
*
diff --git a/lib/libc/arm/gen/signalcontext.c b/lib/libc/arm/gen/signalcontext.c
index 7d17733c3c2c..e66a08928355 100644
--- a/lib/libc/arm/gen/signalcontext.c
+++ b/lib/libc/arm/gen/signalcontext.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2004 Olivier Houchard
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/signal.h>
#include <sys/ucontext.h>
diff --git a/lib/libc/arm/gen/sigsetjmp.S b/lib/libc/arm/gen/sigsetjmp.S
index 236f5310a7f3..a4e2e974c945 100644
--- a/lib/libc/arm/gen/sigsetjmp.S
+++ b/lib/libc/arm/gen/sigsetjmp.S
@@ -33,8 +33,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
#include <machine/setjmp.h>
/*
diff --git a/lib/libc/arm/softfloat/arm-gcc.h b/lib/libc/arm/softfloat/arm-gcc.h
index 0e20ef91f059..00ee99a5af3e 100644
--- a/lib/libc/arm/softfloat/arm-gcc.h
+++ b/lib/libc/arm/softfloat/arm-gcc.h
@@ -1,5 +1,4 @@
/* $NetBSD: arm-gcc.h,v 1.2 2001/02/21 18:09:25 bjh21 Exp $ */
-/* $FreeBSD$ */
/*
-------------------------------------------------------------------------------
diff --git a/lib/libc/arm/softfloat/milieu.h b/lib/libc/arm/softfloat/milieu.h
index 54775c768b91..a3f829c4281b 100644
--- a/lib/libc/arm/softfloat/milieu.h
+++ b/lib/libc/arm/softfloat/milieu.h
@@ -1,5 +1,4 @@
/* $NetBSD: milieu.h,v 1.1 2000/12/29 20:13:54 bjh21 Exp $ */
-/* $FreeBSD$ */
/*
===============================================================================
diff --git a/lib/libc/arm/softfloat/softfloat.h b/lib/libc/arm/softfloat/softfloat.h
index 6aef49975a38..d202a1f7f420 100644
--- a/lib/libc/arm/softfloat/softfloat.h
+++ b/lib/libc/arm/softfloat/softfloat.h
@@ -1,5 +1,4 @@
/* $NetBSD: softfloat.h,v 1.6 2002/05/12 13:12:46 bjh21 Exp $ */
-/* $FreeBSD$ */
/* This is a derivative work. */
diff --git a/lib/libc/arm/static_tls.h b/lib/libc/arm/static_tls.h
index 9f24cd4aae39..557748d75347 100644
--- a/lib/libc/arm/static_tls.h
+++ b/lib/libc/arm/static_tls.h
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2019 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 _LIBC_ARM_STATIC_TLS_H
diff --git a/lib/libc/arm/string/Makefile.inc b/lib/libc/arm/string/Makefile.inc
index cf3175ea4e8c..9f0d10f70c9c 100644
--- a/lib/libc/arm/string/Makefile.inc
+++ b/lib/libc/arm/string/Makefile.inc
@@ -1,9 +1,7 @@
-# $FreeBSD$
MDSRCS+= \
bcopy.S \
bzero.S \
- ffs.S \
memcmp.S \
memcpy.S \
memmove.S \
diff --git a/lib/libc/arm/string/bcopy.S b/lib/libc/arm/string/bcopy.S
index f2583fc7ffc8..dbe9efc06194 100644
--- a/lib/libc/arm/string/bcopy.S
+++ b/lib/libc/arm/string/bcopy.S
@@ -1,6 +1,5 @@
/* $NetBSD: bcopy.S,v 1.3 2003/10/14 07:51:45 scw Exp $ */
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
#define _BCOPY
#include "memmove.S"
diff --git a/lib/libc/arm/string/bzero.S b/lib/libc/arm/string/bzero.S
index b31358d6d928..db524c3529ad 100644
--- a/lib/libc/arm/string/bzero.S
+++ b/lib/libc/arm/string/bzero.S
@@ -30,8 +30,5 @@
*/
#include <machine/asm.h>
-
-__FBSDID("$FreeBSD$");
-
#define _BZERO
#include "memset.S"
diff --git a/lib/libc/arm/string/ffs.S b/lib/libc/arm/string/ffs.S
deleted file mode 100644
index 5756dd81d21d..000000000000
--- a/lib/libc/arm/string/ffs.S
+++ /dev/null
@@ -1,57 +0,0 @@
-/* $NetBSD: ffs.S,v 1.5 2003/04/05 23:08:52 bjh21 Exp $ */
-/*
- * Copyright (c) 2001 Christopher Gilbert
- * All rights reserved.
- *
- * 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.
- * 3. The name of the company nor the name of the author may be used to
- * endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-#include <machine/asm.h>
-
-__FBSDID("$FreeBSD$");
-
-.syntax unified
-
-/*
- * ffs - find first set bit, this algorithm isolates the first set
- * bit, then multiplies the number by 0x0450fbaf which leaves the top
- * 6 bits as an index into the table. This algorithm should be a win
- * over the checking each bit in turn as per the C compiled version.
- *
- * This is the ffs algorithm devised by d.seal and posted to comp.sys.arm on
- * 16 Feb 1994.
- */
-
-ENTRY(ffs)
- /* Standard trick to isolate bottom bit in r0 or 0 if r0 = 0 on entry */
- rsb r1, r0, #0
- ands r0, r0, r1
- itt ne
- clzne r0, r0
- rsbne r0, r0, #32
- RET
-END(ffs)
-
- .section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/arm/string/memcmp.S b/lib/libc/arm/string/memcmp.S
index 33a11b7c4c49..2dbb1831c724 100644
--- a/lib/libc/arm/string/memcmp.S
+++ b/lib/libc/arm/string/memcmp.S
@@ -63,9 +63,6 @@
*/
#include <machine/asm.h>
-
-__FBSDID("$FreeBSD$");
-
.syntax unified
ENTRY(memcmp)
diff --git a/lib/libc/arm/string/memcpy.S b/lib/libc/arm/string/memcpy.S
index 63390edeaa95..6ea7bec7e9cc 100644
--- a/lib/libc/arm/string/memcpy.S
+++ b/lib/libc/arm/string/memcpy.S
@@ -36,8 +36,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
.syntax unified
/* LINTSTUB: Func: void *memcpy(void *dst, const void *src, size_t len) */
diff --git a/lib/libc/arm/string/memmove.S b/lib/libc/arm/string/memmove.S
index 27ec743bb44a..fa871d9274e9 100644
--- a/lib/libc/arm/string/memmove.S
+++ b/lib/libc/arm/string/memmove.S
@@ -30,8 +30,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
.syntax unified
#ifndef _BCOPY
diff --git a/lib/libc/arm/string/memset.S b/lib/libc/arm/string/memset.S
index 6ac64274db95..40e0e567668b 100644
--- a/lib/libc/arm/string/memset.S
+++ b/lib/libc/arm/string/memset.S
@@ -67,8 +67,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
.syntax unified
/*
diff --git a/lib/libc/arm/string/strcmp.S b/lib/libc/arm/string/strcmp.S
index 1cdce8bcbab9..19145c61ebd8 100644
--- a/lib/libc/arm/string/strcmp.S
+++ b/lib/libc/arm/string/strcmp.S
@@ -29,9 +29,6 @@
*/
#include <machine/asm.h>
-
-__FBSDID("$FreeBSD$");
-
ENTRY(strcmp)
1:
ldrb r2, [r0], #1
diff --git a/lib/libc/arm/string/strlen.S b/lib/libc/arm/string/strlen.S
index fdfd8643ae16..5b68e51b8a25 100644
--- a/lib/libc/arm/string/strlen.S
+++ b/lib/libc/arm/string/strlen.S
@@ -25,8 +25,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
.syntax unified
ENTRY(strlen)
diff --git a/lib/libc/arm/string/strncmp.S b/lib/libc/arm/string/strncmp.S
index affcaa0537b2..d3d6ce08e0c3 100644
--- a/lib/libc/arm/string/strncmp.S
+++ b/lib/libc/arm/string/strncmp.S
@@ -29,9 +29,6 @@
*/
#include <machine/asm.h>
-
-__FBSDID("$FreeBSD$");
-
ENTRY(strncmp)
/* if (len == 0) return 0 */
cmp r2, #0
diff --git a/lib/libc/arm/sys/Makefile.inc b/lib/libc/arm/sys/Makefile.inc
deleted file mode 100644
index be6a58f8aaf5..000000000000
--- a/lib/libc/arm/sys/Makefile.inc
+++ /dev/null
@@ -1,8 +0,0 @@
-# $FreeBSD$
-
-SRCS+= __vdso_gettc.c
-
-MDASM= Ovfork.S cerror.S syscall.S
-
-# Don't generate default code for these syscalls:
-NOASM+= sbrk.o vfork.o
diff --git a/lib/libc/arm/sys/Ovfork.S b/lib/libc/arm/sys/Ovfork.S
deleted file mode 100644
index 73c619e3609d..000000000000
--- a/lib/libc/arm/sys/Ovfork.S
+++ /dev/null
@@ -1,57 +0,0 @@
-/* $NetBSD: Ovfork.S,v 1.6 2003/08/07 16:42:03 agc Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- *
- * from: @(#)Ovfork.s 5.1 (Berkeley) 4/23/90
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-#include "SYS.h"
-
-/*
- * pid = vfork();
- *
- * On return from the SWI:
- * r1 == 0 in parent process, r1 == 1 in child process.
- * r0 == pid of child in parent, r0 == pid of parent in child.
- */
- .text
- .align 0
-
-ENTRY(vfork)
- mov r2, r14
- SYSTRAP(vfork)
- bcs PIC_SYM(CERROR, PLT)
- sub r1, r1, #1 /* r1 == 0xffffffff if parent, 0 if child */
- and r0, r0, r1 /* r0 == 0 if child, else unchanged */
- mov r15, r2
-END(vfork)
-
- .section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/arm/sys/__vdso_gettc.c b/lib/libc/arm/sys/__vdso_gettc.c
deleted file mode 100644
index eff19118185b..000000000000
--- a/lib/libc/arm/sys/__vdso_gettc.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 2015 The FreeBSD Foundation
- *
- * This software was developed by Konstantin Belousov
- * under sponsorship from the FreeBSD Foundation.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <sys/elf.h>
-#include <sys/time.h>
-#include <sys/vdso.h>
-#include <machine/cpufunc.h>
-#include <machine/acle-compat.h>
-#include <errno.h>
-#include "libc_private.h"
-
-#if __ARM_ARCH >= 6
-static inline uint64_t
-cp15_cntvct_get(void)
-{
- uint64_t reg;
-
- __asm __volatile("mrrc\tp15, 1, %Q0, %R0, c14" : "=r" (reg));
- return (reg);
-}
-
-static inline uint64_t
-cp15_cntpct_get(void)
-{
- uint64_t reg;
-
- __asm __volatile("mrrc\tp15, 0, %Q0, %R0, c14" : "=r" (reg));
- return (reg);
-}
-#endif
-
-#pragma weak __vdso_gettc
-int
-__vdso_gettc(const struct vdso_timehands *th, u_int *tc)
-{
-
- if (th->th_algo != VDSO_TH_ALGO_ARM_GENTIM)
- return (ENOSYS);
-#if __ARM_ARCH >= 6
- /*
- * Userspace gettimeofday() is only enabled on ARMv7 CPUs, but
- * libc is compiled for ARMv6. Due to clang issues, .arch
- * armv7-a directive does not work.
- */
- __asm __volatile(".word\t0xf57ff06f" : : : "memory"); /* isb */
- *tc = th->th_physical == 0 ? cp15_cntvct_get() : cp15_cntpct_get();
- return (0);
-#else
- *tc = 0;
- return (ENOSYS);
-#endif
-}
-
-#pragma weak __vdso_gettimekeep
-int
-__vdso_gettimekeep(struct vdso_timekeep **tk)
-{
-
- return (_elf_aux_info(AT_TIMEKEEP, tk, sizeof(*tk)));
-}
diff --git a/lib/libc/arm/sys/cerror.S b/lib/libc/arm/sys/cerror.S
deleted file mode 100644
index 5fad698caf11..000000000000
--- a/lib/libc/arm/sys/cerror.S
+++ /dev/null
@@ -1,51 +0,0 @@
-/* $NetBSD: cerror.S,v 1.5 2003/08/07 16:42:04 agc Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- *
- * from: @(#)cerror.s 5.1 (Berkeley) 4/23/90
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-#include "SYS.h"
-
-.globl _C_LABEL(__error)
-.type _C_LABEL(__error),%function
-
-ASENTRY(CERROR)
- stmfd sp!, {r4, lr}
- mov r4, r0
- bl PIC_SYM(_C_LABEL(__error), PLT)
- str r4, [r0]
- mvn r0, #0x00000000
- mvn r1, #0x00000000
- ldmfd sp!, {r4, pc}
-END(CERROR)
-
- .section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/arm/sys/syscall.S b/lib/libc/arm/sys/syscall.S
deleted file mode 100644
index c88d1aeb4b65..000000000000
--- a/lib/libc/arm/sys/syscall.S
+++ /dev/null
@@ -1,40 +0,0 @@
-/* $NetBSD: syscall.S,v 1.4 2003/08/07 16:42:05 agc Exp $ */
-
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- *
- * from: @(#)syscall.s 5.1 (Berkeley) 4/23/90
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-#include "SYS.h"
-
-RSYSCALL(syscall)
-
- .section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/capability/Makefile.inc b/lib/libc/capability/Makefile.inc
index a53ba1f23049..cf214d7f5627 100644
--- a/lib/libc/capability/Makefile.inc
+++ b/lib/libc/capability/Makefile.inc
@@ -1,4 +1,3 @@
-# $FreeBSD$
# capability sources
.PATH: ${SRCTOP}/sys/kern ${LIBC_SRCTOP}/capability
diff --git a/lib/libc/capability/Symbol.map b/lib/libc/capability/Symbol.map
index c5c18c2f5315..8bf11670a5a8 100644
--- a/lib/libc/capability/Symbol.map
+++ b/lib/libc/capability/Symbol.map
@@ -1,7 +1,3 @@
-/*
- * $FreeBSD$
- */
-
FBSD_1.3 {
__cap_rights_clear;
cap_rights_contains;
@@ -12,3 +8,7 @@ FBSD_1.3 {
cap_rights_remove;
__cap_rights_set;
};
+
+FBSD_1.8 {
+ cap_rights_is_empty;
+};
diff --git a/lib/libc/capability/cap_rights_init.3 b/lib/libc/capability/cap_rights_init.3
index 9695a188e317..98b50f653f2c 100644
--- a/lib/libc/capability/cap_rights_init.3
+++ b/lib/libc/capability/cap_rights_init.3
@@ -1,6 +1,5 @@
.\"
.\" Copyright (c) 2013 The FreeBSD Foundation
-.\" All rights reserved.
.\"
.\" This documentation was written by Pawel Jakub Dawidek under sponsorship
.\" from the FreeBSD Foundation.
@@ -26,9 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd May 5, 2020
+.Dd November 25, 2023
.Dt CAP_RIGHTS_INIT 3
.Os
.Sh NAME
@@ -36,6 +33,7 @@
.Nm cap_rights_set ,
.Nm cap_rights_clear ,
.Nm cap_rights_is_set ,
+.Nm cap_rights_is_empty ,
.Nm cap_rights_is_valid ,
.Nm cap_rights_merge ,
.Nm cap_rights_remove ,
@@ -54,6 +52,8 @@
.Ft bool
.Fn cap_rights_is_set "const cap_rights_t *rights" "..."
.Ft bool
+.Fn cap_rights_is_empty "const cap_rights_t *rights"
+.Ft bool
.Fn cap_rights_is_valid "const cap_rights_t *rights"
.Ft cap_rights_t *
.Fn cap_rights_merge "cap_rights_t *dst" "const cap_rights_t *src"
@@ -121,6 +121,12 @@ function checks if all the given capability rights are set for the given
structure.
.Pp
The
+.Fn cap_rights_is_empty
+function checks if the
+.Fa rights
+structure is empty.
+.Pp
+The
.Fn cap_rights_is_valid
function verifies if the given
.Vt cap_rights_t
@@ -185,6 +191,14 @@ if all the given capability rights are set in the
argument.
.Pp
The
+.Fn cap_rights_is_empty
+function returns
+.Va true
+if none of the capability rights are set in the
+.Fa rights
+structure.
+.Pp
+The
.Fn cap_rights_is_valid
function performs various checks to see if the given
.Vt cap_rights_t
diff --git a/lib/libc/compat-43/Makefile.inc b/lib/libc/compat-43/Makefile.inc
index 597a0f8fd51e..b0fcd0d4af8b 100644
--- a/lib/libc/compat-43/Makefile.inc
+++ b/lib/libc/compat-43/Makefile.inc
@@ -1,15 +1,13 @@
-# @(#)Makefile.inc 8.1 (Berkeley) 6/2/93
-# $FreeBSD$
# compat-43 sources
.PATH: ${LIBC_SRCTOP}/${LIBC_ARCH}/compat-43 ${LIBC_SRCTOP}/compat-43
-SRCS+= creat.c gethostid.c getwd.c killpg.c sethostid.c setpgrp.c \
+SRCS+= gethostid.c getwd.c killpg.c sethostid.c setpgrp.c \
setrgid.c setruid.c sigcompat.c
SYM_MAPS+=${LIBC_SRCTOP}/compat-43/Symbol.map
-MAN+= creat.2 killpg.2 sigpause.2 sigsetmask.2 sigvec.2
+MAN+= killpg.2 sigpause.2 sigsetmask.2 sigvec.2
MAN+= gethostid.3 setruid.3
MLINKS+=gethostid.3 sethostid.3
diff --git a/lib/libc/compat-43/Symbol.map b/lib/libc/compat-43/Symbol.map
index bd49f99e2df6..b0ce99f4e416 100644
--- a/lib/libc/compat-43/Symbol.map
+++ b/lib/libc/compat-43/Symbol.map
@@ -1,7 +1,3 @@
-/*
- * $FreeBSD$
- */
-
FBSD_1.0 {
creat;
gethostid;
diff --git a/lib/libc/compat-43/creat.2 b/lib/libc/compat-43/creat.2
deleted file mode 100644
index 5e9e0226db19..000000000000
--- a/lib/libc/compat-43/creat.2
+++ /dev/null
@@ -1,62 +0,0 @@
-.\" Copyright (c) 1989, 1990, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)creat.2 8.1 (Berkeley) 6/2/93
-.\" $FreeBSD$
-.\"
-.Dd September 4, 2019
-.Dt CREAT 2
-.Os
-.Sh NAME
-.Nm creat
-.Nd create a new file
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In fcntl.h
-.Ft int
-.Fn creat "const char *path" "mode_t mode"
-.Sh DESCRIPTION
-.Bf -symbolic
-This interface is made obsolete by:
-.Ef
-.Xr open 2 .
-.Pp
-The
-.Fn creat
-function
-is the same as:
-.Bd -literal -offset indent
-open(path, O_CREAT | O_TRUNC | O_WRONLY, mode);
-.Ed
-.Sh SEE ALSO
-.Xr open 2
-.Sh HISTORY
-The
-.Fn creat
-function appeared in
-.At v1 .
diff --git a/lib/libc/compat-43/gethostid.3 b/lib/libc/compat-43/gethostid.3
index 1472d9d2f558..ed8d939921c2 100644
--- a/lib/libc/compat-43/gethostid.3
+++ b/lib/libc/compat-43/gethostid.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)gethostid.3 8.1 (Berkeley) 6/2/93
-.\" $FreeBSD$
-.\"
.Dd June 2, 1993
.Dt GETHOSTID 3
.Os
diff --git a/lib/libc/compat-43/gethostid.c b/lib/libc/compat-43/gethostid.c
index d58f11bbb972..bb3670f19670 100644
--- a/lib/libc/compat-43/gethostid.c
+++ b/lib/libc/compat-43/gethostid.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)gethostid.c 8.1 (Berkeley) 6/2/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/sysctl.h>
diff --git a/lib/libc/compat-43/getwd.c b/lib/libc/compat-43/getwd.c
index ba5b095ec178..bfc167960f79 100644
--- a/lib/libc/compat-43/getwd.c
+++ b/lib/libc/compat-43/getwd.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getwd.c 8.1 (Berkeley) 6/2/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <unistd.h>
#include <errno.h>
diff --git a/lib/libc/compat-43/killpg.2 b/lib/libc/compat-43/killpg.2
index 5331de8a14ee..9e94279f8201 100644
--- a/lib/libc/compat-43/killpg.2
+++ b/lib/libc/compat-43/killpg.2
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)killpg.2 8.1 (Berkeley) 6/2/93
-.\" $FreeBSD$
-.\"
.Dd March 15, 2012
.Dt KILLPG 2
.Os
diff --git a/lib/libc/compat-43/killpg.c b/lib/libc/compat-43/killpg.c
index fa8893b050fb..a83a0c426e0b 100644
--- a/lib/libc/compat-43/killpg.c
+++ b/lib/libc/compat-43/killpg.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)killpg.c 8.1 (Berkeley) 6/2/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <signal.h>
#include <errno.h>
diff --git a/lib/libc/compat-43/sethostid.c b/lib/libc/compat-43/sethostid.c
index 00f4d89f82f7..97a239eb4d06 100644
--- a/lib/libc/compat-43/sethostid.c
+++ b/lib/libc/compat-43/sethostid.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)sethostid.c 8.1 (Berkeley) 6/2/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/sysctl.h>
diff --git a/lib/libc/compat-43/setpgrp.c b/lib/libc/compat-43/setpgrp.c
index 12766ce4d20d..8d0b5ea10cf9 100644
--- a/lib/libc/compat-43/setpgrp.c
+++ b/lib/libc/compat-43/setpgrp.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)setpgrp.c 8.1 (Berkeley) 6/2/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <unistd.h>
diff --git a/lib/libc/compat-43/setrgid.c b/lib/libc/compat-43/setrgid.c
index 4d83651a85b1..695270b827b4 100644
--- a/lib/libc/compat-43/setrgid.c
+++ b/lib/libc/compat-43/setrgid.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)setrgid.c 8.1 (Berkeley) 6/2/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <unistd.h>
int
diff --git a/lib/libc/compat-43/setruid.3 b/lib/libc/compat-43/setruid.3
index 993faba954cd..f9f14c2e4346 100644
--- a/lib/libc/compat-43/setruid.3
+++ b/lib/libc/compat-43/setruid.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)setruid.3 8.1 (Berkeley) 6/2/93
-.\" $FreeBSD$
-.\"
.Dd June 2, 1993
.Dt SETRUID 3
.Os
diff --git a/lib/libc/compat-43/setruid.c b/lib/libc/compat-43/setruid.c
index 9d581303fcdb..1889f3bff746 100644
--- a/lib/libc/compat-43/setruid.c
+++ b/lib/libc/compat-43/setruid.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)setruid.c 8.1 (Berkeley) 6/2/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <unistd.h>
int
diff --git a/lib/libc/compat-43/sigcompat.c b/lib/libc/compat-43/sigcompat.c
index 0a04adae019f..77cfc279a3b3 100644
--- a/lib/libc/compat-43/sigcompat.c
+++ b/lib/libc/compat-43/sigcompat.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)sigcompat.c 8.1 (Berkeley) 6/2/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#include <errno.h>
diff --git a/lib/libc/compat-43/sigpause.2 b/lib/libc/compat-43/sigpause.2
index 63e559969672..802c177e9f91 100644
--- a/lib/libc/compat-43/sigpause.2
+++ b/lib/libc/compat-43/sigpause.2
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)sigpause.2 8.1 (Berkeley) 6/2/93
-.\" $FreeBSD$
-.\"
.\" Part of the content of the man page was derived from
.\" The Open Group Base Specifications Issue 7
.\" IEEE Std 1003.1-2008
diff --git a/lib/libc/compat-43/sigsetmask.2 b/lib/libc/compat-43/sigsetmask.2
index fb15dd90a729..4a98fae1f698 100644
--- a/lib/libc/compat-43/sigsetmask.2
+++ b/lib/libc/compat-43/sigsetmask.2
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)sigsetmask.2 8.1 (Berkeley) 6/2/93
-.\" $FreeBSD$
-.\"
.Dd June 2, 1993
.Dt SIGSETMASK 2
.Os
diff --git a/lib/libc/compat-43/sigvec.2 b/lib/libc/compat-43/sigvec.2
index 12cf81fe0508..183db89883d6 100644
--- a/lib/libc/compat-43/sigvec.2
+++ b/lib/libc/compat-43/sigvec.2
@@ -25,10 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)sigvec.2 8.2 (Berkeley) 4/19/94
-.\" $FreeBSD$
-.\"
-.Dd April 19, 1994
+.Dd April 2, 2022
.Dt SIGVEC 2
.Os
.Sh NAME
@@ -338,5 +335,14 @@ or
.Xr signal 3 ,
.Xr sigsetops 3 ,
.Xr tty 4
+.Sh HISTORY
+A
+.Fn sigvec
+system call first appeared in
+.Bx 4.2 .
+It was reimplemented as a wrapper around
+.Xr sigaction 2
+in
+.Bx 4.3 Reno .
.Sh BUGS
This manual page is still confusing.
diff --git a/lib/libc/csu/Makefile.inc b/lib/libc/csu/Makefile.inc
new file mode 100644
index 000000000000..666744f27c8b
--- /dev/null
+++ b/lib/libc/csu/Makefile.inc
@@ -0,0 +1,10 @@
+#
+
+.PATH: ${LIBC_SRCTOP}/csu
+.include "${LIBC_SRCTOP}/csu/${LIBC_ARCH}/Makefile.inc"
+
+SRCS+= \
+ libc_start1.c
+
+CFLAGS+= -I${LIBC_SRCTOP}/csu/${LIBC_ARCH}
+SYM_MAPS+=${LIBC_SRCTOP}/csu/Symbol.map
diff --git a/lib/libc/csu/Symbol.map b/lib/libc/csu/Symbol.map
new file mode 100644
index 000000000000..7fc09add5e45
--- /dev/null
+++ b/lib/libc/csu/Symbol.map
@@ -0,0 +1,4 @@
+FBSD_1.7 {
+ __libc_start1;
+ __libc_start1_gcrt;
+};
diff --git a/lib/libc/csu/aarch64/Makefile.inc b/lib/libc/csu/aarch64/Makefile.inc
new file mode 100644
index 000000000000..b3420a638164
--- /dev/null
+++ b/lib/libc/csu/aarch64/Makefile.inc
@@ -0,0 +1,4 @@
+#
+
+CFLAGS+= -DCRT_IRELOC_RELA \
+ -DINIT_IRELOCS=""
diff --git a/lib/libc/csu/aarch64/reloc.c b/lib/libc/csu/aarch64/reloc.c
new file mode 100644
index 000000000000..ead48a8ad4fb
--- /dev/null
+++ b/lib/libc/csu/aarch64/reloc.c
@@ -0,0 +1,43 @@
+/*-
+ * Copyright (c) 2019 Leandro Lupori
+ * Copyright (c) 2021 The FreeBSD Foundation
+ *
+ * Portions of this software were developed by Andrew Turner
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
+ */
+
+static void
+crt1_handle_rela(const Elf_Rela *r)
+{
+ typedef Elf_Addr (*ifunc_resolver_t)(
+ uint64_t, uint64_t, uint64_t, uint64_t,
+ uint64_t, uint64_t, uint64_t, uint64_t);
+ Elf_Addr *ptr, *where, target;
+
+ switch (ELF_R_TYPE(r->r_info)) {
+ case R_AARCH64_IRELATIVE:
+ ptr = (Elf_Addr *)r->r_addend;
+ where = (Elf_Addr *)r->r_offset;
+ target = ((ifunc_resolver_t)ptr)(0, 0, 0, 0, 0, 0, 0, 0);
+ *where = target;
+ break;
+ }
+}
diff --git a/lib/libc/csu/amd64/Makefile.inc b/lib/libc/csu/amd64/Makefile.inc
new file mode 100644
index 000000000000..f14033217580
--- /dev/null
+++ b/lib/libc/csu/amd64/Makefile.inc
@@ -0,0 +1,4 @@
+#
+
+CFLAGS+= -DCRT_IRELOC_RELA \
+ -DINIT_IRELOCS="init_cpu_features()"
diff --git a/lib/libc/mips/static_tls.h b/lib/libc/csu/amd64/reloc.c
index 67ee8afe14c6..6424d69fbd5c 100644
--- a/lib/libc/mips/static_tls.h
+++ b/lib/libc/csu/amd64/reloc.c
@@ -1,7 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 2019 The FreeBSD Foundation
+ * Copyright (c) 2018 The FreeBSD Foundation
*
* This software was developed by Konstantin Belousov <kib@FreeBSD.org>
* under sponsorship from the FreeBSD Foundation.
@@ -11,9 +9,6 @@
* 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -26,39 +21,46 @@
* 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 _LIBC_MIPS_STATIC_TLS_H
-#define _LIBC_MIPS_STATIC_TLS_H
+#include <machine/specialreg.h>
+#include <machine/cpufunc.h>
-#include <machine/tls.h>
+static uint32_t cpu_feature, cpu_feature2;
+static uint32_t cpu_stdext_feature, cpu_stdext_feature2;
-static __inline uintptr_t
-_libc_get_static_tls_base(size_t offset)
+static void
+init_cpu_features(void)
{
- uintptr_t tlsbase;
+ u_int p[4];
-#if defined(__mips_n64)
- __asm__ __volatile__ (
- ".set\tpush\n\t"
- ".set\tmips64r2\n\t"
- "rdhwr\t%0, $29\n\t"
- ".set\tpop"
- : "=r" (tlsbase));
- tlsbase -= TLS_TP_OFFSET + TLS_TCB_SIZE;
-#else /* mips 32 */
- __asm__ __volatile__ (
- ".set\tpush\n\t"
- ".set\tmips32r2\n\t"
- "rdhwr\t%0, $29\n\t"
- ".set\tpop"
- : "=r" (tlsbase));
- tlsbase -= TLS_TP_OFFSET + TLS_TCB_SIZE;
-#endif /* ! __mips_n64 */
- tlsbase += offset;
- return (tlsbase);
+ do_cpuid(1, p);
+ cpu_feature = p[3];
+ cpu_feature2 = p[2];
+ do_cpuid(0, p);
+ if (p[0] >= 7) {
+ cpuid_count(7, 0, p);
+ cpu_stdext_feature = p[1];
+ cpu_stdext_feature2 = p[2];
+ } else {
+ cpu_stdext_feature = 0;
+ cpu_stdext_feature2 = 0;
+ }
}
-#endif
+static void
+crt1_handle_rela(const Elf_Rela *r)
+{
+ Elf_Addr *ptr, *where, target;
+
+ switch (ELF_R_TYPE(r->r_info)) {
+ case R_X86_64_IRELATIVE:
+ ptr = (Elf_Addr *)r->r_addend;
+ where = (Elf_Addr *)r->r_offset;
+ target = ((Elf_Addr (*)(uint32_t, uint32_t, uint32_t,
+ uint32_t))ptr)(cpu_feature, cpu_feature2,
+ cpu_stdext_feature, cpu_stdext_feature2);
+ *where = target;
+ break;
+ }
+}
diff --git a/lib/libc/csu/arm/Makefile.inc b/lib/libc/csu/arm/Makefile.inc
new file mode 100644
index 000000000000..2534e6579f38
--- /dev/null
+++ b/lib/libc/csu/arm/Makefile.inc
@@ -0,0 +1,4 @@
+#
+
+CFLAGS+= -DCRT_IRELOC_SUPPRESS \
+ -DINIT_IRELOCS=""
diff --git a/lib/libc/csu/i386/Makefile.inc b/lib/libc/csu/i386/Makefile.inc
new file mode 100644
index 000000000000..f3f8c2b176ce
--- /dev/null
+++ b/lib/libc/csu/i386/Makefile.inc
@@ -0,0 +1,4 @@
+#
+
+CFLAGS+= -DCRT_IRELOC_REL \
+ -DINIT_IRELOCS="init_cpu_features()"
diff --git a/lib/libc/csu/i386/reloc.c b/lib/libc/csu/i386/reloc.c
new file mode 100644
index 000000000000..1c9ec173facc
--- /dev/null
+++ b/lib/libc/csu/i386/reloc.c
@@ -0,0 +1,88 @@
+/*-
+ * Copyright (c) 2018 The FreeBSD Foundation
+ *
+ * This software was developed by Konstantin Belousov <kib@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
+ */
+
+#include <machine/specialreg.h>
+#include <machine/cpufunc.h>
+
+static uint32_t cpu_feature, cpu_feature2;
+static uint32_t cpu_stdext_feature, cpu_stdext_feature2;
+
+static void
+init_cpu_features(void)
+{
+ u_int cpuid_supported, p[4];
+
+ __asm __volatile(
+ " pushfl\n"
+ " popl %%eax\n"
+ " movl %%eax,%%ecx\n"
+ " xorl $0x200000,%%eax\n"
+ " pushl %%eax\n"
+ " popfl\n"
+ " pushfl\n"
+ " popl %%eax\n"
+ " xorl %%eax,%%ecx\n"
+ " je 1f\n"
+ " movl $1,%0\n"
+ " jmp 2f\n"
+ "1: movl $0,%0\n"
+ "2:\n"
+ : "=r" (cpuid_supported) : : "eax", "ecx", "cc");
+ if (cpuid_supported) {
+ do_cpuid(1, p);
+ cpu_feature = p[3];
+ cpu_feature2 = p[2];
+ do_cpuid(0, p);
+ if (p[0] >= 7) {
+ cpuid_count(7, 0, p);
+ cpu_stdext_feature = p[1];
+ cpu_stdext_feature2 = p[2];
+ } else {
+ cpu_stdext_feature = 0;
+ cpu_stdext_feature2 = 0;
+ }
+ } else {
+ cpu_feature = 0;
+ cpu_feature2 = 0;
+ cpu_stdext_feature = 0;
+ cpu_stdext_feature2 = 0;
+ }
+}
+
+static void
+crt1_handle_rel(const Elf_Rel *r)
+{
+ Elf_Addr *where, target;
+
+ switch (ELF_R_TYPE(r->r_info)) {
+ case R_386_IRELATIVE:
+ where = (Elf_Addr *)r->r_offset;
+ target = ((Elf_Addr (*)(uint32_t, uint32_t, uint32_t,
+ uint32_t))*where)(cpu_feature, cpu_feature2,
+ cpu_stdext_feature, cpu_stdext_feature2);
+ *where = target;
+ break;
+ }
+}
diff --git a/lib/libc/csu/libc_start1.c b/lib/libc/csu/libc_start1.c
new file mode 100644
index 000000000000..f0e708e405ce
--- /dev/null
+++ b/lib/libc/csu/libc_start1.c
@@ -0,0 +1,186 @@
+/*-
+ * SPDX-License-Identifier: BSD-1-Clause
+ *
+ * Copyright 2012 Konstantin Belousov <kib@FreeBSD.org>
+ * Copyright (c) 2018, 2023 The FreeBSD Foundation
+ *
+ * Parts of this software was developed by Konstantin Belousov
+ * <kib@FreeBSD.org> under sponsorship from the FreeBSD Foundation.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ */
+
+#include <sys/param.h>
+#include <sys/elf.h>
+#include <sys/elf_common.h>
+#include <stdlib.h>
+#include "libc_private.h"
+
+extern void (*__preinit_array_start[])(int, char **, char **) __hidden;
+extern void (*__preinit_array_end[])(int, char **, char **) __hidden;
+extern void (*__init_array_start[])(int, char **, char **) __hidden;
+extern void (*__init_array_end[])(int, char **, char **) __hidden;
+extern void (*__fini_array_start[])(void) __hidden;
+extern void (*__fini_array_end[])(void) __hidden;
+extern void _fini(void) __hidden;
+extern void _init(void) __hidden;
+
+extern int _DYNAMIC;
+#pragma weak _DYNAMIC
+
+#if defined(CRT_IRELOC_RELA)
+extern const Elf_Rela __rela_iplt_start[] __weak_symbol __hidden;
+extern const Elf_Rela __rela_iplt_end[] __weak_symbol __hidden;
+
+#include "reloc.c"
+
+static void
+process_irelocs(void)
+{
+ const Elf_Rela *r;
+
+ for (r = &__rela_iplt_start[0]; r < &__rela_iplt_end[0]; r++)
+ crt1_handle_rela(r);
+}
+#elif defined(CRT_IRELOC_REL)
+extern const Elf_Rel __rel_iplt_start[] __weak_symbol __hidden;
+extern const Elf_Rel __rel_iplt_end[] __weak_symbol __hidden;
+
+#include "reloc.c"
+
+static void
+process_irelocs(void)
+{
+ const Elf_Rel *r;
+
+ for (r = &__rel_iplt_start[0]; r < &__rel_iplt_end[0]; r++)
+ crt1_handle_rel(r);
+}
+#elif defined(CRT_IRELOC_SUPPRESS)
+#else
+#error "Define platform reloc type"
+#endif
+
+#ifndef PIC
+static void
+finalizer(void)
+{
+ void (*fn)(void);
+ size_t array_size, n;
+
+ array_size = __fini_array_end - __fini_array_start;
+ for (n = array_size; n > 0; n--) {
+ fn = __fini_array_start[n - 1];
+ if ((uintptr_t)fn != 0 && (uintptr_t)fn != 1)
+ (fn)();
+ }
+ _fini();
+}
+#endif
+
+static void
+handle_static_init(int argc, char **argv, char **env)
+{
+#ifndef PIC
+ void (*fn)(int, char **, char **);
+ size_t array_size, n;
+
+ if (&_DYNAMIC != NULL)
+ return;
+
+ atexit(finalizer);
+
+ array_size = __preinit_array_end - __preinit_array_start;
+ for (n = 0; n < array_size; n++) {
+ fn = __preinit_array_start[n];
+ if ((uintptr_t)fn != 0 && (uintptr_t)fn != 1)
+ fn(argc, argv, env);
+ }
+ _init();
+ array_size = __init_array_end - __init_array_start;
+ for (n = 0; n < array_size; n++) {
+ fn = __init_array_start[n];
+ if ((uintptr_t)fn != 0 && (uintptr_t)fn != 1)
+ fn(argc, argv, env);
+ }
+#endif
+}
+
+static void
+handle_argv(int argc, char *argv[], char **env)
+{
+ const char *s;
+
+ if (environ == NULL)
+ environ = env;
+ if (argc > 0 && argv[0] != NULL) {
+ __progname = argv[0];
+ for (s = __progname; *s != '\0'; s++) {
+ if (*s == '/')
+ __progname = s + 1;
+ }
+ }
+}
+
+void
+__libc_start1(int argc, char *argv[], char *env[], void (*cleanup)(void),
+ int (*mainX)(int, char *[], char *[]))
+{
+ handle_argv(argc, argv, env);
+
+ if (&_DYNAMIC != NULL) {
+ atexit(cleanup);
+ } else {
+#ifndef CRT_IRELOC_SUPPRESS
+ INIT_IRELOCS;
+ process_irelocs();
+#endif
+ _init_tls();
+ }
+
+ handle_static_init(argc, argv, env);
+ exit(mainX(argc, argv, env));
+}
+
+/* XXXKIB _mcleanup and monstartup defs */
+extern void _mcleanup(void);
+extern void monstartup(void *, void *);
+
+void
+__libc_start1_gcrt(int argc, char *argv[], char *env[],
+ void (*cleanup)(void), int (*mainX)(int, char *[], char *[]),
+ int *eprolp, int *etextp)
+{
+ handle_argv(argc, argv, env);
+
+ if (&_DYNAMIC != NULL) {
+ atexit(cleanup);
+ } else {
+#ifndef CRT_IRELOC_SUPPRESS
+ INIT_IRELOCS;
+ process_irelocs();
+#endif
+ _init_tls();
+ }
+
+ atexit(_mcleanup);
+ monstartup(eprolp, etextp);
+
+ handle_static_init(argc, argv, env);
+ exit(mainX(argc, argv, env));
+}
diff --git a/lib/libc/csu/powerpc/Makefile.inc b/lib/libc/csu/powerpc/Makefile.inc
new file mode 100644
index 000000000000..2534e6579f38
--- /dev/null
+++ b/lib/libc/csu/powerpc/Makefile.inc
@@ -0,0 +1,4 @@
+#
+
+CFLAGS+= -DCRT_IRELOC_SUPPRESS \
+ -DINIT_IRELOCS=""
diff --git a/lib/libc/csu/powerpc64/Makefile.inc b/lib/libc/csu/powerpc64/Makefile.inc
new file mode 100644
index 000000000000..5d59d40eb393
--- /dev/null
+++ b/lib/libc/csu/powerpc64/Makefile.inc
@@ -0,0 +1,4 @@
+#
+
+CFLAGS+= -DCRT_IRELOC_RELA \
+ -DINIT_IRELOCS="init_cpu_features(env)"
diff --git a/lib/libc/csu/powerpc64/reloc.c b/lib/libc/csu/powerpc64/reloc.c
new file mode 100644
index 000000000000..41419bf0e6c2
--- /dev/null
+++ b/lib/libc/csu/powerpc64/reloc.c
@@ -0,0 +1,66 @@
+/*-
+ * Copyright (c) 2019 Leandro Lupori
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
+ */
+
+static uint32_t cpu_features;
+static uint32_t cpu_features2;
+
+static void
+init_cpu_features(char **env)
+{
+ const Elf_Auxinfo *aux;
+
+ /* Find the auxiliary vector on the stack. */
+ while (*env++ != 0) /* Skip over environment, and NULL terminator */
+ ;
+ aux = (const Elf_Auxinfo *)env;
+
+ /* Digest the auxiliary vector. */
+ for (; aux->a_type != AT_NULL; aux++) {
+ switch (aux->a_type) {
+ case AT_HWCAP:
+ cpu_features = (uint32_t)aux->a_un.a_val;
+ break;
+ case AT_HWCAP2:
+ cpu_features2 = (uint32_t)aux->a_un.a_val;
+ break;
+ }
+ }
+}
+
+static void
+crt1_handle_rela(const Elf_Rela *r)
+{
+ typedef Elf_Addr (*ifunc_resolver_t)(
+ uint32_t, uint32_t, uint64_t, uint64_t,
+ uint64_t, uint64_t, uint64_t, uint64_t);
+ Elf_Addr *ptr, *where, target;
+
+ switch (ELF_R_TYPE(r->r_info)) {
+ case R_PPC_IRELATIVE:
+ ptr = (Elf_Addr *)r->r_addend;
+ where = (Elf_Addr *)r->r_offset;
+ target = ((ifunc_resolver_t)ptr)(cpu_features, cpu_features2,
+ 0, 0, 0, 0, 0, 0);
+ *where = target;
+ break;
+ }
+}
diff --git a/lib/libc/csu/powerpcspe/Makefile.inc b/lib/libc/csu/powerpcspe/Makefile.inc
new file mode 100644
index 000000000000..2534e6579f38
--- /dev/null
+++ b/lib/libc/csu/powerpcspe/Makefile.inc
@@ -0,0 +1,4 @@
+#
+
+CFLAGS+= -DCRT_IRELOC_SUPPRESS \
+ -DINIT_IRELOCS=""
diff --git a/lib/libc/csu/riscv/Makefile.inc b/lib/libc/csu/riscv/Makefile.inc
new file mode 100644
index 000000000000..2534e6579f38
--- /dev/null
+++ b/lib/libc/csu/riscv/Makefile.inc
@@ -0,0 +1,4 @@
+#
+
+CFLAGS+= -DCRT_IRELOC_SUPPRESS \
+ -DINIT_IRELOCS=""
diff --git a/lib/libc/db/Makefile.inc b/lib/libc/db/Makefile.inc
index a8905ef02997..e80128e78956 100644
--- a/lib/libc/db/Makefile.inc
+++ b/lib/libc/db/Makefile.inc
@@ -1,6 +1,3 @@
-# from @(#)Makefile.inc 8.2 (Berkeley) 2/21/94
-# $FreeBSD$
-#
CFLAGS+=-D__DBINTERFACE_PRIVATE
.include "${LIBC_SRCTOP}/db/btree/Makefile.inc"
diff --git a/lib/libc/db/README b/lib/libc/db/README
index 1f9ae7240658..9bcc1e09acbe 100644
--- a/lib/libc/db/README
+++ b/lib/libc/db/README
@@ -1,5 +1,3 @@
-# @(#)README 8.27 (Berkeley) 9/1/94
-# $FreeBSD$
This is version 1.85 of the Berkeley DB code.
diff --git a/lib/libc/db/Symbol.map b/lib/libc/db/Symbol.map
index 225fd401cb57..b46fb17e499d 100644
--- a/lib/libc/db/Symbol.map
+++ b/lib/libc/db/Symbol.map
@@ -1,7 +1,3 @@
-/*
- * $FreeBSD$
- */
-
FBSD_1.0 {
dbopen;
dbm_open;
@@ -20,7 +16,6 @@ FBSD_1.0 {
mpool_put;
mpool_close;
mpool_sync;
- mpool_stat;
};
FBSD_1.1 {
diff --git a/lib/libc/db/btree/Makefile.inc b/lib/libc/db/btree/Makefile.inc
index b6305738d9fd..44c4d16275e9 100644
--- a/lib/libc/db/btree/Makefile.inc
+++ b/lib/libc/db/btree/Makefile.inc
@@ -1,5 +1,3 @@
-# from @(#)Makefile.inc 8.2 (Berkeley) 7/14/94
-# $FreeBSD$
.PATH: ${LIBC_SRCTOP}/db/btree
diff --git a/lib/libc/db/btree/bt_close.c b/lib/libc/db/btree/bt_close.c
index c09557377af9..36fc593adb25 100644
--- a/lib/libc/db/btree/bt_close.c
+++ b/lib/libc/db/btree/bt_close.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)bt_close.c 8.7 (Berkeley) 8/17/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
diff --git a/lib/libc/db/btree/bt_conv.c b/lib/libc/db/btree/bt_conv.c
index a929d51de948..db7516de80f7 100644
--- a/lib/libc/db/btree/bt_conv.c
+++ b/lib/libc/db/btree/bt_conv.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)bt_conv.c 8.5 (Berkeley) 8/17/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <stdio.h>
diff --git a/lib/libc/db/btree/bt_debug.c b/lib/libc/db/btree/bt_debug.c
index b4af2fbda2ec..d8f4599efde5 100644
--- a/lib/libc/db/btree/bt_debug.c
+++ b/lib/libc/db/btree/bt_debug.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)bt_debug.c 8.5 (Berkeley) 8/17/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <stdio.h>
diff --git a/lib/libc/db/btree/bt_delete.c b/lib/libc/db/btree/bt_delete.c
index 46afeeef00b6..420617167e4a 100644
--- a/lib/libc/db/btree/bt_delete.c
+++ b/lib/libc/db/btree/bt_delete.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)bt_delete.c 8.13 (Berkeley) 7/28/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <errno.h>
diff --git a/lib/libc/db/btree/bt_get.c b/lib/libc/db/btree/bt_get.c
index f9998a719764..ac4c43ab9f0f 100644
--- a/lib/libc/db/btree/bt_get.c
+++ b/lib/libc/db/btree/bt_get.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)bt_get.c 8.6 (Berkeley) 7/20/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <errno.h>
diff --git a/lib/libc/db/btree/bt_open.c b/lib/libc/db/btree/bt_open.c
index ce3b8a1ecf1b..92e75120d4a2 100644
--- a/lib/libc/db/btree/bt_open.c
+++ b/lib/libc/db/btree/bt_open.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)bt_open.c 8.10 (Berkeley) 8/17/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* Implementation of btree access method for 4.4BSD.
*
@@ -391,11 +385,10 @@ tmp(void)
{
sigset_t set, oset;
int fd, len;
- char *envtmp = NULL;
+ char *envtmp;
char path[MAXPATHLEN];
- if (issetugid() == 0)
- envtmp = getenv("TMPDIR");
+ envtmp = secure_getenv("TMPDIR");
len = snprintf(path,
sizeof(path), "%s/bt.XXXXXXXXXX", envtmp ? envtmp : "/tmp");
if (len < 0 || len >= (int)sizeof(path)) {
diff --git a/lib/libc/db/btree/bt_overflow.c b/lib/libc/db/btree/bt_overflow.c
index e116c359578c..0ce85f097af1 100644
--- a/lib/libc/db/btree/bt_overflow.c
+++ b/lib/libc/db/btree/bt_overflow.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)bt_overflow.c 8.5 (Berkeley) 7/16/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <stdio.h>
diff --git a/lib/libc/db/btree/bt_page.c b/lib/libc/db/btree/bt_page.c
index 725df366a3ec..ba5e1cf0d6dd 100644
--- a/lib/libc/db/btree/bt_page.c
+++ b/lib/libc/db/btree/bt_page.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)bt_page.c 8.3 (Berkeley) 7/14/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <stdio.h>
diff --git a/lib/libc/db/btree/bt_put.c b/lib/libc/db/btree/bt_put.c
index 31ad28b155dc..5af8a6dc316f 100644
--- a/lib/libc/db/btree/bt_put.c
+++ b/lib/libc/db/btree/bt_put.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)bt_put.c 8.8 (Berkeley) 7/26/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <errno.h>
diff --git a/lib/libc/db/btree/bt_search.c b/lib/libc/db/btree/bt_search.c
index e5e50bfb01ca..82489b540b7d 100644
--- a/lib/libc/db/btree/bt_search.c
+++ b/lib/libc/db/btree/bt_search.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)bt_search.c 8.8 (Berkeley) 7/31/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <stdio.h>
diff --git a/lib/libc/db/btree/bt_seq.c b/lib/libc/db/btree/bt_seq.c
index 0ba3155a7642..2562724faf33 100644
--- a/lib/libc/db/btree/bt_seq.c
+++ b/lib/libc/db/btree/bt_seq.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)bt_seq.c 8.7 (Berkeley) 7/20/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <errno.h>
@@ -89,7 +83,7 @@ __bt_seq(const DB *dbp, DBT *key, DBT *data, u_int flags)
}
/*
- * If scan unitialized as yet, or starting at a specific record, set
+ * If scan uninitialized as yet, or starting at a specific record, set
* the scan to a specific key. Both __bt_seqset and __bt_seqadv pin
* the page the cursor references if they're successful.
*/
diff --git a/lib/libc/db/btree/bt_split.c b/lib/libc/db/btree/bt_split.c
index ec51a10dec12..5fbf8c3ac0f3 100644
--- a/lib/libc/db/btree/bt_split.c
+++ b/lib/libc/db/btree/bt_split.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)bt_split.c 8.10 (Berkeley) 1/9/95";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <limits.h>
diff --git a/lib/libc/db/btree/bt_utils.c b/lib/libc/db/btree/bt_utils.c
index 6cd32cd3a5ac..0594fbad6e9c 100644
--- a/lib/libc/db/btree/bt_utils.c
+++ b/lib/libc/db/btree/bt_utils.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)bt_utils.c 8.8 (Berkeley) 7/20/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <stdio.h>
@@ -72,7 +66,7 @@ __bt_ret(BTREE *t, EPG *e, DBT *key, DBT *rkey, DBT *data, DBT *rdata, int copy)
bl = GETBLEAF(e->page, e->index);
/*
- * We must copy big keys/data to make them contigous. Otherwise,
+ * We must copy big keys/data to make them contiguous. Otherwise,
* leave the page pinned and don't copy unless the user specified
* concurrent access.
*/
diff --git a/lib/libc/db/btree/btree.h b/lib/libc/db/btree/btree.h
index 1db1e3485717..9e30f097bc72 100644
--- a/lib/libc/db/btree/btree.h
+++ b/lib/libc/db/btree/btree.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.
- *
- * @(#)btree.h 8.11 (Berkeley) 8/17/94
- * $FreeBSD$
*/
/* Macros to set/clear/test flags. */
diff --git a/lib/libc/db/btree/extern.h b/lib/libc/db/btree/extern.h
index 581504cc6833..4ed2bad9cfc1 100644
--- a/lib/libc/db/btree/extern.h
+++ b/lib/libc/db/btree/extern.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.
- *
- * @(#)extern.h 8.10 (Berkeley) 7/20/94
- * $FreeBSD$
*/
int __bt_close(DB *);
diff --git a/lib/libc/db/db/Makefile.inc b/lib/libc/db/db/Makefile.inc
index 8dcf9fe5c753..0597b4e60290 100644
--- a/lib/libc/db/db/Makefile.inc
+++ b/lib/libc/db/db/Makefile.inc
@@ -1,5 +1,3 @@
-# from @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
-# $FreeBSD$
.PATH: ${LIBC_SRCTOP}/db/db
diff --git a/lib/libc/db/db/db.c b/lib/libc/db/db/db.c
index 7158cc80e44e..2c748cfe34a5 100644
--- a/lib/libc/db/db/db.c
+++ b/lib/libc/db/db/db.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)db.c 8.4 (Berkeley) 2/21/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <errno.h>
diff --git a/lib/libc/db/docs/hash.usenix.ps b/lib/libc/db/docs/hash.usenix.ps
index 3a0cf444b1ac..98adfdf209b5 100644
--- a/lib/libc/db/docs/hash.usenix.ps
+++ b/lib/libc/db/docs/hash.usenix.ps
@@ -3,11 +3,9 @@
%%Title: stdin (ditroff)
%%CreationDate: Tue Dec 11 15:06:45 1990
%%EndComments
-% @(#)psdit.pro 1.3 4/15/88
% lib/psdit.pro -- prolog for psdit (ditroff) files
% Copyright (c) 1984, 1985 Adobe Systems Incorporated. All Rights Reserved.
% last edit: shore Sat Nov 23 20:28:03 1985
-% RCSID: $FreeBSD$
% Changed by Edward Wang (edward@ucbarpa.berkeley.edu) to handle graphics,
% 17 Feb, 87.
diff --git a/lib/libc/db/docs/libtp.usenix.ps b/lib/libc/db/docs/libtp.usenix.ps
index b7e441a5755e..2ec31308cb0e 100644
--- a/lib/libc/db/docs/libtp.usenix.ps
+++ b/lib/libc/db/docs/libtp.usenix.ps
@@ -3,11 +3,9 @@
%%Title: stdin (ditroff)
%%CreationDate: Thu Dec 12 15:32:11 1991
%%EndComments
-% @(#)psdit.pro 1.3 4/15/88
% lib/psdit.pro -- prolog for psdit (ditroff) files
% Copyright (c) 1984, 1985 Adobe Systems Incorporated. All Rights Reserved.
% last edit: shore Sat Nov 23 20:28:03 1985
-% RCSID: $FreeBSD$
% Changed by Edward Wang (edward@ucbarpa.berkeley.edu) to handle graphics,
% 17 Feb, 87.
diff --git a/lib/libc/db/hash/Makefile.inc b/lib/libc/db/hash/Makefile.inc
index e1be7a565a2c..369985d55ed2 100644
--- a/lib/libc/db/hash/Makefile.inc
+++ b/lib/libc/db/hash/Makefile.inc
@@ -1,5 +1,3 @@
-# from @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
-# $FreeBSD$
.PATH: ${LIBC_SRCTOP}/db/hash
diff --git a/lib/libc/db/hash/README b/lib/libc/db/hash/README
index 80d674396c0a..0a5a8142e896 100644
--- a/lib/libc/db/hash/README
+++ b/lib/libc/db/hash/README
@@ -1,5 +1,3 @@
-# @(#)README 8.1 (Berkeley) 6/4/93
-# $FreeBSD$
This package implements a superset of the hsearch and dbm/ndbm libraries.
diff --git a/lib/libc/db/hash/extern.h b/lib/libc/db/hash/extern.h
index e938f9123914..d3850752ad3a 100644
--- a/lib/libc/db/hash/extern.h
+++ b/lib/libc/db/hash/extern.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.
- *
- * @(#)extern.h 8.4 (Berkeley) 6/16/94
- * $FreeBSD$
*/
BUFHEAD *__add_ovflpage(HTAB *, BUFHEAD *);
diff --git a/lib/libc/db/hash/hash.c b/lib/libc/db/hash/hash.c
index ebb8790b3f23..7a66f5443d94 100644
--- a/lib/libc/db/hash/hash.c
+++ b/lib/libc/db/hash/hash.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)hash.c 8.9 (Berkeley) 6/16/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#include <sys/stat.h>
diff --git a/lib/libc/db/hash/hash.h b/lib/libc/db/hash/hash.h
index 5d4f8d5e8735..91d2a459bed2 100644
--- a/lib/libc/db/hash/hash.h
+++ b/lib/libc/db/hash/hash.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.
- *
- * @(#)hash.h 8.3 (Berkeley) 5/31/94
- * $FreeBSD$
*/
/* Operations */
diff --git a/lib/libc/db/hash/hash_bigkey.c b/lib/libc/db/hash/hash_bigkey.c
index 24596cf780ea..15fc0899e27e 100644
--- a/lib/libc/db/hash/hash_bigkey.c
+++ b/lib/libc/db/hash/hash_bigkey.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)hash_bigkey.c 8.3 (Berkeley) 5/31/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* PACKAGE: hash
* DESCRIPTION:
diff --git a/lib/libc/db/hash/hash_buf.c b/lib/libc/db/hash/hash_buf.c
index 63cc9eb4d9ad..94f95c8c0383 100644
--- a/lib/libc/db/hash/hash_buf.c
+++ b/lib/libc/db/hash/hash_buf.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)hash_buf.c 8.5 (Berkeley) 7/15/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* PACKAGE: hash
*
diff --git a/lib/libc/db/hash/hash_func.c b/lib/libc/db/hash/hash_func.c
index 988e0eed2a30..529180b7698d 100644
--- a/lib/libc/db/hash/hash_func.c
+++ b/lib/libc/db/hash/hash_func.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)hash_func.c 8.2 (Berkeley) 2/21/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <db.h>
diff --git a/lib/libc/db/hash/hash_log2.c b/lib/libc/db/hash/hash_log2.c
index d89351cb415f..035b073e5d52 100644
--- a/lib/libc/db/hash/hash_log2.c
+++ b/lib/libc/db/hash/hash_log2.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)hash_log2.c 8.2 (Berkeley) 5/31/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <db.h>
#include "hash.h"
#include "page.h"
diff --git a/lib/libc/db/hash/hash_page.c b/lib/libc/db/hash/hash_page.c
index fba854b51f33..2a7b594dc3ea 100644
--- a/lib/libc/db/hash/hash_page.c
+++ b/lib/libc/db/hash/hash_page.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)hash_page.c 8.7 (Berkeley) 8/16/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* PACKAGE: hashing
*
@@ -855,11 +849,10 @@ open_temp(HTAB *hashp)
{
sigset_t set, oset;
int len;
- char *envtmp = NULL;
+ char *envtmp;
char path[MAXPATHLEN];
- if (issetugid() == 0)
- envtmp = getenv("TMPDIR");
+ envtmp = secure_getenv("TMPDIR");
len = snprintf(path,
sizeof(path), "%s/_hash.XXXXXX", envtmp ? envtmp : "/tmp");
if (len < 0 || len >= (int)sizeof(path)) {
diff --git a/lib/libc/db/hash/ndbm.c b/lib/libc/db/hash/ndbm.c
index ace1fb8b9fa7..b9d663a2de4c 100644
--- a/lib/libc/db/hash/ndbm.c
+++ b/lib/libc/db/hash/ndbm.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)ndbm.c 8.4 (Berkeley) 7/21/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* This package provides a dbm compatible interface to the new hashing
* package described in db(3).
diff --git a/lib/libc/db/hash/page.h b/lib/libc/db/hash/page.h
index 17070e1ff584..372669a5e6d4 100644
--- a/lib/libc/db/hash/page.h
+++ b/lib/libc/db/hash/page.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.
- *
- * @(#)page.h 8.2 (Berkeley) 5/31/94
- * $FreeBSD$
*/
/*
diff --git a/lib/libc/db/man/Makefile.inc b/lib/libc/db/man/Makefile.inc
index 7c2db8bf5ea4..c3045ca980b2 100644
--- a/lib/libc/db/man/Makefile.inc
+++ b/lib/libc/db/man/Makefile.inc
@@ -1,5 +1,3 @@
-# from @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
-# $FreeBSD$
.PATH: ${LIBC_SRCTOP}/db/man
@@ -8,7 +6,7 @@ MAN+= btree.3 dbm.3 dbopen.3 hash.3 mpool.3 recno.3
MLINKS+= dbm.3 dbm_clearerr.3
MLINKS+= dbm.3 dbm_close.3
MLINKS+= dbm.3 dbm_delete.3
-MLINKS+= dbm.3 dbm_dirnfo.3
+MLINKS+= dbm.3 dbm_dirfno.3
MLINKS+= dbm.3 dbm_error.3
MLINKS+= dbm.3 dbm_fetch.3
MLINKS+= dbm.3 dbm_firstkey.3
diff --git a/lib/libc/db/man/btree.3 b/lib/libc/db/man/btree.3
index a07b4f417db0..0ff39e763067 100644
--- a/lib/libc/db/man/btree.3
+++ b/lib/libc/db/man/btree.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)btree.3 8.4 (Berkeley) 8/18/94
-.\" $FreeBSD$
-.\"
.Dd August 18, 1994
.Dt BTREE 3
.Os
diff --git a/lib/libc/db/man/dbm.3 b/lib/libc/db/man/dbm.3
index 4fe5d82d6902..c5a83c7acef4 100644
--- a/lib/libc/db/man/dbm.3
+++ b/lib/libc/db/man/dbm.3
@@ -13,9 +13,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd May 30, 2016
+.Dd April 2, 2022
.Dt DBM 3
.Os
.Sh NAME
@@ -224,3 +222,14 @@ These functions (except
.Fn dbm_dirfno )
are included in the
.St -susv2 .
+.Sh HISTORY
+The functions
+.Fn dbminit ,
+.Fn fetch ,
+.Fn store ,
+.Fn delete ,
+.Fn firstkey ,
+and
+.Fn nextkey
+first appeared in
+.At v7 .
diff --git a/lib/libc/db/man/dbopen.3 b/lib/libc/db/man/dbopen.3
index 665a4eae7354..64cef88506d8 100644
--- a/lib/libc/db/man/dbopen.3
+++ b/lib/libc/db/man/dbopen.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)dbopen.3 8.5 (Berkeley) 1/2/94
-.\" $FreeBSD$
-.\"
.Dd September 10, 2010
.Dt DBOPEN 3
.Os
diff --git a/lib/libc/db/man/hash.3 b/lib/libc/db/man/hash.3
index ff8f88420cbf..2d01ec67f0d1 100644
--- a/lib/libc/db/man/hash.3
+++ b/lib/libc/db/man/hash.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)hash.3 8.6 (Berkeley) 8/18/94
-.\" $FreeBSD$
-.\"
.Dd August 18, 1994
.Dt HASH 3
.Os
diff --git a/lib/libc/db/man/mpool.3 b/lib/libc/db/man/mpool.3
index 4894c85809c6..3b4613f51fd7 100644
--- a/lib/libc/db/man/mpool.3
+++ b/lib/libc/db/man/mpool.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)mpool.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd June 17, 2011
.Dt MPOOL 3
.Os
diff --git a/lib/libc/db/man/recno.3 b/lib/libc/db/man/recno.3
index 34c0e26bf80a..55c15d8fcc0a 100644
--- a/lib/libc/db/man/recno.3
+++ b/lib/libc/db/man/recno.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)recno.3 8.5 (Berkeley) 8/18/94
-.\" $FreeBSD$
-.\"
.Dd August 18, 1994
.Dt RECNO 3
.Os
diff --git a/lib/libc/db/mpool/Makefile.inc b/lib/libc/db/mpool/Makefile.inc
index bd57a65e1f06..526d70cc2364 100644
--- a/lib/libc/db/mpool/Makefile.inc
+++ b/lib/libc/db/mpool/Makefile.inc
@@ -1,5 +1,3 @@
-# from @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
-# $FreeBSD$
.PATH: ${LIBC_SRCTOP}/db/mpool
diff --git a/lib/libc/db/mpool/README b/lib/libc/db/mpool/README
index 0f01fbcdb449..1d70e47a09ef 100644
--- a/lib/libc/db/mpool/README
+++ b/lib/libc/db/mpool/README
@@ -1,4 +1,3 @@
-# @(#)README 8.1 (Berkeley) 6/4/93
These are the current memory pool routines.
They aren't ready for prime time, yet, and
diff --git a/lib/libc/db/mpool/mpool-compat.c b/lib/libc/db/mpool/mpool-compat.c
index 08a111711641..191b1cf6089b 100644
--- a/lib/libc/db/mpool/mpool-compat.c
+++ b/lib/libc/db/mpool/mpool-compat.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2009 Xin LI <delphij@FreeBSD.org>
*
@@ -26,9 +26,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <db.h>
#include <mpool.h>
diff --git a/lib/libc/db/mpool/mpool.c b/lib/libc/db/mpool/mpool.c
index df08299f0990..9dab032134bc 100644
--- a/lib/libc/db/mpool/mpool.c
+++ b/lib/libc/db/mpool/mpool.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)mpool.c 8.7 (Berkeley) 11/2/95";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#include <sys/queue.h>
diff --git a/lib/libc/db/mpool/mpool.libtp b/lib/libc/db/mpool/mpool.libtp
index bcd827dce29d..b4e893a9987d 100644
--- a/lib/libc/db/mpool/mpool.libtp
+++ b/lib/libc/db/mpool/mpool.libtp
@@ -1,6 +1,5 @@
/******************************************************************************
-VERSION $FreeBSD$
PACKAGE: User Level Shared Memory Manager
DESCRIPTION:
diff --git a/lib/libc/db/recno/Makefile.inc b/lib/libc/db/recno/Makefile.inc
index 744109f46d83..0a4da32314bf 100644
--- a/lib/libc/db/recno/Makefile.inc
+++ b/lib/libc/db/recno/Makefile.inc
@@ -1,5 +1,3 @@
-# from @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
-# $FreeBSD$
.PATH: ${LIBC_SRCTOP}/db/recno
diff --git a/lib/libc/db/recno/extern.h b/lib/libc/db/recno/extern.h
index 11e3ca223622..6c7cf02e666e 100644
--- a/lib/libc/db/recno/extern.h
+++ b/lib/libc/db/recno/extern.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.
- *
- * @(#)extern.h 8.3 (Berkeley) 6/4/94
- * $FreeBSD$
*/
#include "../btree/extern.h"
diff --git a/lib/libc/db/recno/rec_close.c b/lib/libc/db/recno/rec_close.c
index d481da5f15ea..32c79eee2cc6 100644
--- a/lib/libc/db/recno/rec_close.c
+++ b/lib/libc/db/recno/rec_close.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)rec_close.c 8.6 (Berkeley) 8/18/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/types.h>
#include <sys/uio.h>
diff --git a/lib/libc/db/recno/rec_delete.c b/lib/libc/db/recno/rec_delete.c
index 6d7b91b187bb..7c423934ceb3 100644
--- a/lib/libc/db/recno/rec_delete.c
+++ b/lib/libc/db/recno/rec_delete.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)rec_delete.c 8.7 (Berkeley) 7/14/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <errno.h>
diff --git a/lib/libc/db/recno/rec_get.c b/lib/libc/db/recno/rec_get.c
index 2524318c4b86..4d15505adfaf 100644
--- a/lib/libc/db/recno/rec_get.c
+++ b/lib/libc/db/recno/rec_get.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)rec_get.c 8.9 (Berkeley) 8/18/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <errno.h>
diff --git a/lib/libc/db/recno/rec_open.c b/lib/libc/db/recno/rec_open.c
index 19acac61864f..e337768e86c7 100644
--- a/lib/libc/db/recno/rec_open.c
+++ b/lib/libc/db/recno/rec_open.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)rec_open.c 8.10 (Berkeley) 9/1/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/types.h>
#include <sys/mman.h>
diff --git a/lib/libc/db/recno/rec_put.c b/lib/libc/db/recno/rec_put.c
index dd0b5b8b504b..017eaabfec1d 100644
--- a/lib/libc/db/recno/rec_put.c
+++ b/lib/libc/db/recno/rec_put.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)rec_put.c 8.7 (Berkeley) 8/18/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <errno.h>
diff --git a/lib/libc/db/recno/rec_search.c b/lib/libc/db/recno/rec_search.c
index f18c66675ac1..d565b89202f3 100644
--- a/lib/libc/db/recno/rec_search.c
+++ b/lib/libc/db/recno/rec_search.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)rec_search.c 8.4 (Berkeley) 7/14/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <errno.h>
diff --git a/lib/libc/db/recno/rec_seq.c b/lib/libc/db/recno/rec_seq.c
index c2d21d27b147..7f1ba88e73df 100644
--- a/lib/libc/db/recno/rec_seq.c
+++ b/lib/libc/db/recno/rec_seq.c
@@ -29,13 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-#ifndef lint
-/* XXX use __SCCSID */
-static char sccsid[] __unused = "@(#)rec_seq.c 8.3 (Berkeley) 7/14/94";
-#endif /* not lint */
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <errno.h>
diff --git a/lib/libc/db/recno/rec_utils.c b/lib/libc/db/recno/rec_utils.c
index 7d930195c0bd..2004179a1904 100644
--- a/lib/libc/db/recno/rec_utils.c
+++ b/lib/libc/db/recno/rec_utils.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)rec_utils.c 8.6 (Berkeley) 7/16/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <stdio.h>
diff --git a/lib/libc/db/recno/recno.h b/lib/libc/db/recno/recno.h
index ae0eb85cc3ca..7589c1d93b44 100644
--- a/lib/libc/db/recno/recno.h
+++ b/lib/libc/db/recno/recno.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.
- *
- * @(#)recno.h 8.1 (Berkeley) 6/4/93
- * $FreeBSD$
*/
enum SRCHOP { SDELETE, SINSERT, SEARCH}; /* Rec_search operation. */
diff --git a/lib/libc/db/test/Makefile b/lib/libc/db/test/Makefile
index 712ad6258376..0e1c295a61a6 100644
--- a/lib/libc/db/test/Makefile
+++ b/lib/libc/db/test/Makefile
@@ -1,5 +1,3 @@
-# @(#)Makefile 8.15 (Berkeley) 7/28/94
-# $FreeBSD$
PROG= dbtest
OBJS= dbtest.o strerror.o
diff --git a/lib/libc/db/test/README b/lib/libc/db/test/README
index 0c0cd13d8fa0..55eb85ee76fb 100644
--- a/lib/libc/db/test/README
+++ b/lib/libc/db/test/README
@@ -1,4 +1,3 @@
-# @(#)README 8.8 (Berkeley) 7/31/94
To build this portably, try something like:
diff --git a/lib/libc/db/test/btree.tests/main.c b/lib/libc/db/test/btree.tests/main.c
index a125402cdfb7..94727882dc9f 100644
--- a/lib/libc/db/test/btree.tests/main.c
+++ b/lib/libc/db/test/btree.tests/main.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <fcntl.h>
#include <db.h>
diff --git a/lib/libc/db/test/dbtest.c b/lib/libc/db/test/dbtest.c
index fbc20f0e6918..8ce8239f41b6 100644
--- a/lib/libc/db/test/dbtest.c
+++ b/lib/libc/db/test/dbtest.c
@@ -29,18 +29,6 @@
* SUCH DAMAGE.
*/
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1992, 1993, 1994\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)dbtest.c 8.17 (Berkeley) 9/1/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/stat.h>
diff --git a/lib/libc/db/test/hash.tests/driver2.c b/lib/libc/db/test/hash.tests/driver2.c
index 9123fa82fc40..eb05a6da2dab 100644
--- a/lib/libc/db/test/hash.tests/driver2.c
+++ b/lib/libc/db/test/hash.tests/driver2.c
@@ -32,18 +32,6 @@
* SUCH DAMAGE.
*/
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1991, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)driver2.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* Test driver, to try to tackle the large ugly-split problem.
*/
diff --git a/lib/libc/db/test/hash.tests/makedb.sh b/lib/libc/db/test/hash.tests/makedb.sh
index f28e281fd19c..e4a1a2de1267 100644
--- a/lib/libc/db/test/hash.tests/makedb.sh
+++ b/lib/libc/db/test/hash.tests/makedb.sh
@@ -1,6 +1,4 @@
#!/bin/sh
-#
-# @(#)makedb.sh 8.1 (Berkeley) 6/4/93
awk '{i++; print $0; print i;}' /usr/share/dict/words > WORDS
ls /bin /usr/bin /usr/ucb /etc | egrep '^(...|....|.....|......)$' | \
diff --git a/lib/libc/db/test/hash.tests/tcreat3.c b/lib/libc/db/test/hash.tests/tcreat3.c
index 508585871e1e..163992dd17a6 100644
--- a/lib/libc/db/test/hash.tests/tcreat3.c
+++ b/lib/libc/db/test/hash.tests/tcreat3.c
@@ -32,18 +32,6 @@
* SUCH DAMAGE.
*/
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1991, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)tcreat3.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/file.h>
#include <stdio.h>
diff --git a/lib/libc/db/test/hash.tests/tdel.c b/lib/libc/db/test/hash.tests/tdel.c
index 5b066756af7b..78a5618995a9 100644
--- a/lib/libc/db/test/hash.tests/tdel.c
+++ b/lib/libc/db/test/hash.tests/tdel.c
@@ -32,18 +32,6 @@
* SUCH DAMAGE.
*/
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1991, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)tdel.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/file.h>
#include <db.h>
diff --git a/lib/libc/db/test/hash.tests/testit b/lib/libc/db/test/hash.tests/testit
index 039457a9c4e4..57c1f38a62b5 100644
--- a/lib/libc/db/test/hash.tests/testit
+++ b/lib/libc/db/test/hash.tests/testit
@@ -1,7 +1,4 @@
#!/bin/csh -f
-#
-# @(#)testit 8.1 (Berkeley) 6/4/93
-#
echo ""
echo "PAGE FILL "
diff --git a/lib/libc/db/test/hash.tests/thash4.c b/lib/libc/db/test/hash.tests/thash4.c
index daeaa03fe7ae..8dfdf003eafe 100644
--- a/lib/libc/db/test/hash.tests/thash4.c
+++ b/lib/libc/db/test/hash.tests/thash4.c
@@ -32,18 +32,6 @@
* SUCH DAMAGE.
*/
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1991, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)thash4.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/file.h>
#include <sys/timeb.h>
diff --git a/lib/libc/db/test/hash.tests/tread2.c b/lib/libc/db/test/hash.tests/tread2.c
index 359667b87f79..eead3b3105f0 100644
--- a/lib/libc/db/test/hash.tests/tread2.c
+++ b/lib/libc/db/test/hash.tests/tread2.c
@@ -32,18 +32,6 @@
* SUCH DAMAGE.
*/
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1991, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)tread2.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/file.h>
#include <stdio.h>
diff --git a/lib/libc/db/test/hash.tests/tseq.c b/lib/libc/db/test/hash.tests/tseq.c
index 0b1f7a9a0867..5b27d80881e9 100644
--- a/lib/libc/db/test/hash.tests/tseq.c
+++ b/lib/libc/db/test/hash.tests/tseq.c
@@ -32,18 +32,6 @@
* SUCH DAMAGE.
*/
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1991, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)tseq.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/file.h>
#include <stdio.h>
diff --git a/lib/libc/db/test/hash.tests/tverify.c b/lib/libc/db/test/hash.tests/tverify.c
index d72c2466533c..6a2342c96bd9 100644
--- a/lib/libc/db/test/hash.tests/tverify.c
+++ b/lib/libc/db/test/hash.tests/tverify.c
@@ -32,18 +32,6 @@
* SUCH DAMAGE.
*/
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1991, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)tverify.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/file.h>
#include <stdio.h>
diff --git a/lib/libc/db/test/run.test b/lib/libc/db/test/run.test
index 52b74c316199..33ef393ce1ce 100644
--- a/lib/libc/db/test/run.test
+++ b/lib/libc/db/test/run.test
@@ -1,7 +1,4 @@
#!/bin/sh -
-#
-# @(#)run.test 8.10 (Berkeley) 7/26/94
-#
# db regression tests
main()
diff --git a/lib/libc/gdtoa/Makefile.inc b/lib/libc/gdtoa/Makefile.inc
index c900a24e3899..5a7bc9fab150 100644
--- a/lib/libc/gdtoa/Makefile.inc
+++ b/lib/libc/gdtoa/Makefile.inc
@@ -1,4 +1,3 @@
-# $FreeBSD$
# netlib gdtoa sources
.PATH: ${LIBC_SRCTOP}/gdtoa
diff --git a/lib/libc/gdtoa/Symbol.map b/lib/libc/gdtoa/Symbol.map
index 4483e9a3adff..55fe12e87c57 100644
--- a/lib/libc/gdtoa/Symbol.map
+++ b/lib/libc/gdtoa/Symbol.map
@@ -1,7 +1,3 @@
-/*
- * $FreeBSD$
- */
-
FBSD_1.0 {
/*
* Standard functions from contrib/gdtoa
diff --git a/lib/libc/gdtoa/_hdtoa.c b/lib/libc/gdtoa/_hdtoa.c
index f1cf62977dd2..8ae739acf0db 100644
--- a/lib/libc/gdtoa/_hdtoa.c
+++ b/lib/libc/gdtoa/_hdtoa.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2004-2008 David Schultz <das@FreeBSD.ORG>
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <float.h>
#include <limits.h>
#include <math.h>
diff --git a/lib/libc/gdtoa/_hldtoa.c b/lib/libc/gdtoa/_hldtoa.c
index 409c83adb285..965d2349d103 100644
--- a/lib/libc/gdtoa/_hldtoa.c
+++ b/lib/libc/gdtoa/_hldtoa.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2004-2008 David Schultz <das@FreeBSD.ORG>
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <float.h>
#include <limits.h>
#include <math.h>
diff --git a/lib/libc/gdtoa/_ldtoa.c b/lib/libc/gdtoa/_ldtoa.c
index 0047f9d3e168..81da06013855 100644
--- a/lib/libc/gdtoa/_ldtoa.c
+++ b/lib/libc/gdtoa/_ldtoa.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2003 David Schultz <das@FreeBSD.ORG>
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <float.h>
#include <inttypes.h>
#include <limits.h>
diff --git a/lib/libc/gdtoa/glue.c b/lib/libc/gdtoa/glue.c
index 39e491a7a277..2d09896f6051 100644
--- a/lib/libc/gdtoa/glue.c
+++ b/lib/libc/gdtoa/glue.c
@@ -1,8 +1,6 @@
/*
* Machine-independent glue to integrate David Gay's gdtoa
* package into libc.
- *
- * $FreeBSD$
*/
#include <pthread.h>
diff --git a/lib/libc/gdtoa/machdep_ldisQ.c b/lib/libc/gdtoa/machdep_ldisQ.c
index a64f889b6e23..abd9f4288884 100644
--- a/lib/libc/gdtoa/machdep_ldisQ.c
+++ b/lib/libc/gdtoa/machdep_ldisQ.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2003 David Schultz <das@FreeBSD.ORG>
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -37,9 +37,6 @@
* uses quad precision, such as aarch64 or riscv.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <float.h>
#include "gdtoaimp.h"
diff --git a/lib/libc/gdtoa/machdep_ldisd.c b/lib/libc/gdtoa/machdep_ldisd.c
index 456d782a2a8a..061c67f0bb5a 100644
--- a/lib/libc/gdtoa/machdep_ldisd.c
+++ b/lib/libc/gdtoa/machdep_ldisd.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2003 David Schultz <das@FreeBSD.ORG>
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -37,9 +37,6 @@
* is the same as a double, such as the Alpha.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "gdtoaimp.h"
#undef strtold_l
diff --git a/lib/libc/gdtoa/machdep_ldisx.c b/lib/libc/gdtoa/machdep_ldisx.c
index ad918a03d52f..e3cd4899452d 100644
--- a/lib/libc/gdtoa/machdep_ldisx.c
+++ b/lib/libc/gdtoa/machdep_ldisx.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2003 David Schultz <das@FreeBSD.ORG>
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -37,9 +37,6 @@
* is an IEEE extended precision number.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <float.h>
#include "gdtoaimp.h"
diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc
index aa9a4c0cbf67..2f034e7d476a 100644
--- a/lib/libc/gen/Makefile.inc
+++ b/lib/libc/gen/Makefile.inc
@@ -1,5 +1,3 @@
-# @(#)Makefile.inc 8.6 (Berkeley) 5/4/95
-# $FreeBSD$
# machine-independent gen sources
.PATH: ${LIBC_SRCTOP}/${LIBC_ARCH}/gen ${LIBC_SRCTOP}/gen ${SRCTOP}/etc
@@ -8,7 +6,7 @@ CONFS+= group master.passwd shells
CONFSMODE_master.passwd= 600
CONFSPACKAGE= runtime
-SRCS+= __getosreldate.c \
+SRCS+= \
__pthread_mutex_init_calloc_cb_stub.c \
__xuname.c \
_once_stub.c \
@@ -16,12 +14,13 @@ SRCS+= __getosreldate.c \
_rand48.c \
_spinlock_stub.c \
_thread_init.c \
+ aio_read2.c \
+ aio_write2.c \
alarm.c \
arc4random.c \
arc4random-compat.c \
arc4random_uniform.c \
assert.c \
- auxv.c \
basename.c \
basename_compat.c \
cap_sandboxed.c \
@@ -30,6 +29,8 @@ SRCS+= __getosreldate.c \
clock_getcpuclockid.c \
closedir.c \
confstr.c \
+ cpuset_alloc.c \
+ cpuset_free.c \
crypt.c \
ctermid.c \
daemon.c \
@@ -46,7 +47,6 @@ SRCS+= __getosreldate.c \
erand48.c \
err.c \
errlst.c \
- errno.c \
eventfd.c \
exec.c \
exect.c \
@@ -79,8 +79,6 @@ SRCS+= __getosreldate.c \
getmntinfo-compat11.c \
getnetgrent.c \
getosreldate.c \
- getpagesize.c \
- getpagesizes.c \
getpeereid.c \
getprogname.c \
getpwent.c \
@@ -95,11 +93,13 @@ SRCS+= __getosreldate.c \
isinf.c \
isnan.c \
jrand48.c \
+ kqueue1.c \
lcong48.c \
libc_dlopen.c \
- lockf.c \
+ libc_interposing_table.c \
lrand48.c \
memalign.c \
+ memfd_create.c \
mrand48.c \
nftw.c \
nftw-compat11.c \
@@ -118,15 +118,15 @@ SRCS+= __getosreldate.c \
readdir.c \
readdir-compat11.c \
readpassphrase.c \
- recvmmsg.c \
rewinddir.c \
scandir.c \
scandir_b.c \
scandir-compat11.c \
+ sched_getaffinity.c \
+ sched_setaffinity.c \
seed48.c \
seekdir.c \
semctl.c \
- sendmmsg.c \
setdomainname.c \
sethostname.c \
setjmperr.c \
@@ -152,6 +152,7 @@ SRCS+= __getosreldate.c \
time.c \
times.c \
timespec_get.c \
+ timespec_getres.c \
timezone.c \
tls.c \
ttyname.c \
@@ -164,14 +165,12 @@ SRCS+= __getosreldate.c \
utime.c \
utxdb.c \
valloc.c \
- wait.c \
- wait3.c \
- waitpid.c \
- waitid.c \
wordexp.c
CFLAGS.arc4random.c= -I${SRCTOP}/sys -I${SRCTOP}/sys/crypto/chacha20
+CFLAGS.sysconf.c= -I${SRCTOP}/contrib/tzcode
+
CFLAGS.dlfcn.c= ${RTLD_HDRS}
CFLAGS.tls.c= ${RTLD_HDRS}
@@ -199,7 +198,6 @@ SYM_MAPS+=${LIBC_SRCTOP}/gen/Symbol.map
MAN+= alarm.3 \
arc4random.3 \
- auxv.3 \
basename.3 \
cap_rights_get.3 \
cap_sandboxed.3 \
@@ -245,8 +243,6 @@ MAN+= alarm.3 \
getmntinfo.3 \
getnetgrent.3 \
getosreldate.3 \
- getpagesize.3 \
- getpagesizes.3 \
getpass.3 \
getpeereid.3 \
getprogname.3 \
@@ -259,7 +255,6 @@ MAN+= alarm.3 \
initgroups.3 \
isgreater.3 \
ldexp.3 \
- lockf.3 \
makecontext.3 \
modf.3 \
nice.3 \
@@ -281,7 +276,6 @@ MAN+= alarm.3 \
raise.3 \
rand48.3 \
readpassphrase.3 \
- rfork_thread.3 \
scandir.3 \
sem_destroy.3 \
sem_getvalue.3 \
@@ -296,7 +290,6 @@ MAN+= alarm.3 \
siginterrupt.3 \
signal.3 \
sigsetops.3 \
- sleep.3 \
statvfs.3 \
stringlist.3 \
strtofflags.3 \
@@ -313,15 +306,13 @@ MAN+= alarm.3 \
time.3 \
times.3 \
timespec_get.3 \
- timezone.3 \
+ timespec_getres.3 \
ttyname.3 \
- tzset.3 \
ualarm.3 \
ucontext.3 \
ulimit.3 \
uname.3 \
unvis.3 \
- usleep.3 \
utime.3 \
valloc.3 \
vis.3 \
@@ -329,7 +320,6 @@ MAN+= alarm.3 \
MLINKS+=arc4random.3 arc4random_buf.3 \
arc4random.3 arc4random_uniform.3
-MLINKS+=auxv.3 elf_aux_info.3
MLINKS+=ctermid.3 ctermid_r.3
MLINKS+=daemon.3 daemonfd.3
MLINKS+=devname.3 devname_r.3
@@ -461,7 +451,10 @@ MLINKS+=modf.3 modff.3 \
MLINKS+=popen.3 pclose.3
MLINKS+=posix_spawn.3 posix_spawnp.3 \
posix_spawn_file_actions_addopen.3 posix_spawn_file_actions_addclose.3 \
+ posix_spawn_file_actions_addopen.3 posix_spawn_file_actions_addclosefrom_np.3 \
posix_spawn_file_actions_addopen.3 posix_spawn_file_actions_adddup2.3 \
+ posix_spawn_file_actions_addopen.3 posix_spawn_file_actions_addchdir_np.3 \
+ posix_spawn_file_actions_addopen.3 posix_spawn_file_actions_addfchdir_np.3 \
posix_spawn_file_actions_init.3 posix_spawn_file_actions_destroy.3 \
posix_spawnattr_getflags.3 posix_spawnattr_setflags.3 \
posix_spawnattr_getpgroup.3 posix_spawnattr_setpgroup.3 \
@@ -473,7 +466,11 @@ MLINKS+=posix_spawn.3 posix_spawnp.3 \
MLINKS+=psignal.3 strsignal.3 \
psignal.3 sys_siglist.3 \
psignal.3 sys_signame.3
-MLINKS+=pwcache.3 group_from_gid.3 \
+MLINKS+=pwcache.3 gid_from_group.3 \
+ pwcache.3 group_from_gid.3 \
+ pwcache.3 pwcache_groupdb.3 \
+ pwcache.3 pwcache_userdb.3 \
+ pwcache.3 uid_from_user.3 \
pwcache.3 user_from_uid.3
MLINKS+=rand48.3 _rand48.3 \
rand48.3 drand48.3 \
@@ -485,13 +482,14 @@ MLINKS+=rand48.3 _rand48.3 \
rand48.3 nrand48.3 \
rand48.3 seed48.3 \
rand48.3 srand48.3
-MLINKS+=recv.2 recvmmsg.2
-MLINKS+=scandir.3 alphasort.3
+MLINKS+=scandir.3 alphasort.3 \
+ scandir.3 scandirat.3 \
+ scandir.3 scandir_b.3 \
+ scandir.3 versionsort.3
MLINKS+=sem_open.3 sem_close.3 \
sem_open.3 sem_unlink.3
MLINKS+=sem_wait.3 sem_trywait.3
MLINKS+=sem_timedwait.3 sem_clockwait_np.3
-MLINKS+=send.2 sendmmsg.2
MLINKS+=setjmp.3 _longjmp.3 \
setjmp.3 _setjmp.3 \
setjmp.3 longjmp.3 \
@@ -535,7 +533,6 @@ MLINKS+=tcsetattr.3 cfgetispeed.3 \
tcsetattr.3 tcgetattr.3
MLINKS+=ttyname.3 isatty.3 \
ttyname.3 ttyname_r.3
-MLINKS+=tzset.3 tzsetwall.3
MLINKS+=unvis.3 strunvis.3 \
unvis.3 strunvisx.3
MLINKS+=vis.3 nvis.3 \
@@ -566,8 +563,8 @@ install-passwd: .PHONY
${PWD_MKDB_CMD} -i -p -d ${DESTDIR}/etc ${DESTDIR}/etc/master.passwd
.if defined(NO_ROOT) && defined(METALOG)
( \
- echo "./etc/pwd.db type=file mode=0644 uname=root gname=wheel"; \
- echo "./etc/spwd.db type=file mode=0600 uname=root gname=wheel"; \
- echo "./etc/passwd type=file mode=0644 uname=root gname=wheel"; \
+ echo ".${DISTBASE}/etc/pwd.db type=file mode=0644 uname=root gname=wheel"; \
+ echo ".${DISTBASE}/etc/spwd.db type=file mode=0600 uname=root gname=wheel"; \
+ echo ".${DISTBASE}/etc/passwd type=file mode=0644 uname=root gname=wheel"; \
) | cat -l >> ${METALOG}
.endif
diff --git a/lib/libc/gen/Symbol.map b/lib/libc/gen/Symbol.map
index c89eb63caada..17d114c96677 100644
--- a/lib/libc/gen/Symbol.map
+++ b/lib/libc/gen/Symbol.map
@@ -1,7 +1,3 @@
-/*
- * $FreeBSD$
- */
-
FBSD_1.0 {
__xuname;
pthread_atfork;
@@ -103,7 +99,6 @@ FBSD_1.0 {
vwarnx;
sys_errlist;
sys_nerr;
- errno;
exect;
execl;
execle;
@@ -111,6 +106,7 @@ FBSD_1.0 {
execv;
execvp;
execvP;
+ fabs;
fmtcheck;
fmtmsg;
fnmatch;
@@ -162,7 +158,6 @@ FBSD_1.0 {
endnetgrent;
innetgr;
getosreldate;
- getpagesize;
getpeereid;
_getprogname;
getprogname;
@@ -185,10 +180,12 @@ FBSD_1.0 {
endusershell;
setusershell;
getvfsbyname;
+ __nan;
__isnan;
isnan;
__isnanf;
isnanf;
+ __infinity;
__isinf;
isinf;
__isinff;
@@ -200,6 +197,7 @@ FBSD_1.0 {
ldexp;
lockf;
lrand48;
+ makecontext;
modf;
mrand48;
nice;
@@ -221,6 +219,12 @@ FBSD_1.0 {
group_from_gid;
setdomainname;
sethostname;
+ _setjmp;
+ _longjmp;
+ setjmp;
+ longjmp;
+ sigsetjmp;
+ siglongjmp;
longjmperror;
getmode;
setmode;
@@ -257,7 +261,6 @@ FBSD_1.0 {
setlogmask;
ttyname_r;
ttyname;
- timezone;
times;
time;
telldir;
@@ -333,7 +336,6 @@ FBSD_1.1 {
FBSD_1.2 {
cfmakesane;
endutxent;
- getpagesizes;
getutxent;
getutxid;
getutxline;
@@ -355,6 +357,7 @@ FBSD_1.2 {
};
FBSD_1.3 {
+ cap_sandboxed;
clock_getcpuclockid;
dirfd;
dup3;
@@ -398,7 +401,6 @@ FBSD_1.5 {
devname;
devname_r;
dirname;
- elf_aux_info;
fts_children;
fts_close;
fts_get_clientptr;
@@ -427,6 +429,8 @@ FBSD_1.6 {
eventfd_write;
getlogin_r;
memalign;
+ memfd_create;
+ pthread_getname_np;
scandir_b;
sigandset;
sigisemptyset;
@@ -435,6 +439,25 @@ FBSD_1.6 {
tcsetwinsize;
};
+FBSD_1.7 {
+ kqueue1;
+ posix_spawn_file_actions_addchdir_np;
+ posix_spawn_file_actions_addclosefrom_np;
+ posix_spawn_file_actions_addfchdir_np;
+ scandirat;
+ sched_getaffinity;
+ sched_setaffinity;
+ versionsort;
+ __cpuset_alloc;
+ __cpuset_free;
+};
+
+FBSD_1.8 {
+ aio_read2;
+ aio_write2;
+ execvpe;
+};
+
FBSDprivate_1.0 {
/* needed by thread libraries */
__thr_jtable;
@@ -541,6 +564,8 @@ FBSDprivate_1.0 {
__waitpid;
_waitpid;
+ __libc_interposing_slot;
+
_libc_sem_init_compat;
_libc_sem_destroy_compat;
_libc_sem_open_compat;
@@ -554,10 +579,10 @@ FBSDprivate_1.0 {
__libc_tcdrain;
- __elf_aux_vector;
__pthread_distribute_static_tls;
__pthread_map_stacks_exec;
__fillcontextx;
__fillcontextx2;
__getcontextx_size;
+ __makecontext;
};
diff --git a/lib/libc/gen/__getosreldate.c b/lib/libc/gen/__getosreldate.c
deleted file mode 100644
index 938b1dc0e7f3..000000000000
--- a/lib/libc/gen/__getosreldate.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 2007 Peter Wemm
- * All rights reserved.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/sysctl.h>
-#include <errno.h>
-#include <link.h>
-#include "libc_private.h"
-
-/*
- * This is private to libc. It is intended for wrapping syscall stubs in order
- * to avoid having to put SIGSYS signal handlers in place to test for presence
- * of new syscalls. This caches the result in order to be as quick as possible.
- *
- * Use getosreldate(3) for public use as it respects the $OSVERSION environment
- * variable.
- */
-
-int
-__getosreldate(void)
-{
- static int osreldate;
- size_t len;
- int oid[2];
- int error, osrel;
-
- if (osreldate != 0)
- return (osreldate);
-
- error = _elf_aux_info(AT_OSRELDATE, &osreldate, sizeof(osreldate));
- if (error == 0 && osreldate != 0)
- return (osreldate);
-
- oid[0] = CTL_KERN;
- oid[1] = KERN_OSRELDATE;
- osrel = 0;
- len = sizeof(osrel);
- error = sysctl(oid, 2, &osrel, &len, NULL, 0);
- if (error == 0 && osrel > 0 && len == sizeof(osrel))
- osreldate = osrel;
- return (osreldate);
-}
diff --git a/lib/libc/gen/__pthread_mutex_init_calloc_cb_stub.c b/lib/libc/gen/__pthread_mutex_init_calloc_cb_stub.c
index 1c566ecf4809..3a81ace8a0f4 100644
--- a/lib/libc/gen/__pthread_mutex_init_calloc_cb_stub.c
+++ b/lib/libc/gen/__pthread_mutex_init_calloc_cb_stub.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2014 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <pthread.h>
#include "libc_private.h"
diff --git a/lib/libc/gen/__xuname.c b/lib/libc/gen/__xuname.c
index fba5eaeebc88..4257c42f9519 100644
--- a/lib/libc/gen/__xuname.c
+++ b/lib/libc/gen/__xuname.c
@@ -27,13 +27,8 @@
* 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: @(#)uname.c 8.1 (Berkeley) 1/4/94
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/sysctl.h>
#include <sys/utsname.h>
diff --git a/lib/libc/gen/_once_stub.c b/lib/libc/gen/_once_stub.c
index 302f8536aec3..518072cbd28f 100644
--- a/lib/libc/gen/_once_stub.c
+++ b/lib/libc/gen/_once_stub.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2009 Hudson River Trading LLC
* Written by: John H. Baldwin <jhb@FreeBSD.org>
@@ -27,9 +27,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <pthread.h>
#include "un-namespace.h"
diff --git a/lib/libc/gen/_pthread_stubs.c b/lib/libc/gen/_pthread_stubs.c
index fe5d704c3bb9..a8723bbe72be 100644
--- a/lib/libc/gen/_pthread_stubs.c
+++ b/lib/libc/gen/_pthread_stubs.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2001 Daniel Eischen <deischen@FreeBSD.org>.
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <signal.h>
#include <pthread.h>
#include <stdlib.h>
@@ -53,13 +50,14 @@ struct pthread {
static struct pthread main_thread;
static int stub_main(void);
-static void *stub_null(void);
+static void *stub_null(void);
static struct pthread *stub_self(void);
static int stub_zero(void);
static int stub_fail(void);
static int stub_true(void);
static void stub_exit(void);
static int stub_esrch(void);
+static int stub_getname_np(pthread_t, char *, size_t);
#define PJT_DUAL_ENTRY(entry) \
(pthread_func_t)entry, (pthread_func_t)entry
@@ -133,6 +131,7 @@ pthread_func_entry_t __thr_jtable[PJT_MAX] = {
[PJT_MUTEXATTR_SETROBUST] = {PJT_DUAL_ENTRY(stub_zero)},
[PJT_GETTHREADID_NP] = {PJT_DUAL_ENTRY(stub_zero)},
[PJT_ATTR_GET_NP] = {PJT_DUAL_ENTRY(stub_esrch)},
+ [PJT_GETNAME_NP] = {PJT_DUAL_ENTRY(stub_getname_np)},
};
/*
@@ -242,7 +241,7 @@ STUB_FUNC2(pthread_mutexattr_getrobust, PJT_MUTEXATTR_GETROBUST, int, void *,
int *)
STUB_FUNC2(pthread_mutexattr_setrobust, PJT_MUTEXATTR_SETROBUST, int, void *,
int)
-STUB_FUNC2(pthread_once, PJT_ONCE, int, void *, void *)
+STUB_FUNC2(pthread_once, PJT_ONCE, int, void *, void *)
STUB_FUNC1(pthread_rwlock_destroy, PJT_RWLOCK_DESTROY, int, void *)
STUB_FUNC2(pthread_rwlock_init, PJT_RWLOCK_INIT, int, void *, void *)
STUB_FUNC1(pthread_rwlock_rdlock, PJT_RWLOCK_RDLOCK, int, void *)
@@ -291,6 +290,7 @@ STUB_FUNC3(__pthread_cleanup_push_imp, PJT_CLEANUP_PUSH_IMP, void, void *,
STUB_FUNC1(_pthread_cancel_enter, PJT_CANCEL_ENTER, void, int)
STUB_FUNC1(_pthread_cancel_leave, PJT_CANCEL_LEAVE, void, int)
STUB_FUNC2(pthread_attr_get_np, PJT_ATTR_GET_NP, int, pthread_t, pthread_attr_t *)
+STUB_FUNC3(pthread_getname_np, PJT_GETNAME_NP, int, pthread_t, char *, size_t)
static int
stub_zero(void)
@@ -339,3 +339,13 @@ stub_esrch(void)
{
return (ESRCH);
}
+
+static int
+stub_getname_np(pthread_t thread, char *buf, size_t len)
+{
+ if (thread != &main_thread)
+ return (ESRCH);
+ if (len >= 1)
+ buf[0] = '\0';
+ return (0);
+}
diff --git a/lib/libc/gen/_rand48.c b/lib/libc/gen/_rand48.c
index 279bbc362394..990e2c86949b 100644
--- a/lib/libc/gen/_rand48.c
+++ b/lib/libc/gen/_rand48.c
@@ -11,9 +11,6 @@
* to anyone/anything when using this software.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "rand48.h"
unsigned short _rand48_seed[3] = {
diff --git a/lib/libc/gen/_spinlock_stub.c b/lib/libc/gen/_spinlock_stub.c
index 5d7ee3b2d2be..30e5c61f5f74 100644
--- a/lib/libc/gen/_spinlock_stub.c
+++ b/lib/libc/gen/_spinlock_stub.c
@@ -29,9 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
#include "spinlock.h"
diff --git a/lib/libc/gen/_thread_init.c b/lib/libc/gen/_thread_init.c
index 5778ad53f03f..66fa8b8c2e96 100644
--- a/lib/libc/gen/_thread_init.c
+++ b/lib/libc/gen/_thread_init.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2001 Daniel Eischen <deischen@FreeBSD.org>
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
void _thread_init_stub(void);
diff --git a/lib/libc/powerpc64/sys/__vdso_gettc.c b/lib/libc/gen/aio_read2.c
index 0ccf91d5d214..a5186d509b26 100644
--- a/lib/libc/powerpc64/sys/__vdso_gettc.c
+++ b/lib/libc/gen/aio_read2.c
@@ -1,9 +1,9 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2020 Brandon Bergren <bdragon@FreeBSD.org>
+ * Copyright (c) 2024 The FreeBSD Foundation
*
- * This software was developed by Konstantin Belousov
+ * This software were developed by Konstantin Belousov <kib@FreeBSD.org>
* under sponsorship from the FreeBSD Foundation.
*
* Redistribution and use in source and binary forms, with or without
@@ -28,38 +28,31 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <sys/elf.h>
-#include <sys/time.h>
-#include <sys/vdso.h>
-
-#include <machine/cpufunc.h>
-
+#include <sys/aio.h>
#include <errno.h>
+#include <stddef.h>
-#include "libc_private.h"
-
-#pragma weak __vdso_gettc
int
-__vdso_gettc(const struct vdso_timehands *th, u_int *tc)
+aio_read2(struct aiocb *iocb, int flags)
{
- u_quad_t tb;
-
- if (__predict_false(th->th_algo != VDSO_TH_ALGO_PPC_TB))
- return (ENOSYS);
-
- __asm __volatile ("mftb %0" : "=r"(tb));
- *tc = tb;
- return (0);
-}
-
-#pragma weak __vdso_gettimekeep
-int
-__vdso_gettimekeep(struct vdso_timekeep **tk)
-{
-
- return (_elf_aux_info(AT_TIMEKEEP, tk, sizeof(*tk)));
+ int error;
+
+ if ((flags & ~(AIO_OP2_FOFFSET | AIO_OP2_VECTORED)) != 0) {
+ errno = EINVAL;
+ return (-1);
+ }
+ iocb->aio_lio_opcode = LIO_READ;
+ if ((flags & AIO_OP2_FOFFSET) != 0)
+ iocb->aio_lio_opcode |= LIO_FOFFSET;
+ if ((flags & AIO_OP2_VECTORED) != 0)
+ iocb->aio_lio_opcode |= LIO_VECTORED;
+
+ error = lio_listio(LIO_NOWAIT, &iocb, 1, NULL);
+ if (error == -1 && errno == EIO) {
+ error = aio_error(iocb);
+ if (error != -1 && error != 0)
+ errno = error;
+ error = -1;
+ }
+ return (error);
}
diff --git a/lib/libc/gen/aio_write2.c b/lib/libc/gen/aio_write2.c
new file mode 100644
index 000000000000..8f4f6a35fd4d
--- /dev/null
+++ b/lib/libc/gen/aio_write2.c
@@ -0,0 +1,58 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2024 The FreeBSD Foundation
+ *
+ * This software were developed by Konstantin Belousov <kib@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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 AUTHOR 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 AUTHOR 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.
+ */
+
+#include <sys/aio.h>
+#include <errno.h>
+#include <stddef.h>
+
+int
+aio_write2(struct aiocb *iocb, int flags)
+{
+ int error;
+
+ if ((flags & ~(AIO_OP2_FOFFSET | AIO_OP2_VECTORED)) != 0) {
+ errno = EINVAL;
+ return (-1);
+ }
+ iocb->aio_lio_opcode = LIO_WRITE;
+ if ((flags & AIO_OP2_FOFFSET) != 0)
+ iocb->aio_lio_opcode |= LIO_FOFFSET;
+ if ((flags & AIO_OP2_VECTORED) != 0)
+ iocb->aio_lio_opcode |= LIO_VECTORED;
+
+ error = lio_listio(LIO_NOWAIT, &iocb, 1, NULL);
+ if (error == -1 && errno == EIO) {
+ error = aio_error(iocb);
+ if (error != -1 && error != 0)
+ errno = error;
+ error = -1;
+ }
+ return (error);
+}
diff --git a/lib/libc/gen/alarm.3 b/lib/libc/gen/alarm.3
index deb455ea4a7f..8aeda29481eb 100644
--- a/lib/libc/gen/alarm.3
+++ b/lib/libc/gen/alarm.3
@@ -25,10 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)alarm.3 8.2 (Berkeley) 4/19/94
-.\" $FreeBSD$
-.\"
-.Dd April 19, 1994
+.Dd April 2, 2022
.Dt ALARM 3
.Os
.Sh NAME
@@ -89,5 +86,11 @@ If no alarm is currently set, the return value is 0.
.Sh HISTORY
An
.Fn alarm
-function appeared in
+system call appeared in the Programmer's Workbench (PWB/UNIX)
+and was ported to
.At v7 .
+For
+.Bx 4.1c ,
+it was reimplemented as a wrapper around the
+.Xr setitimer 2
+system call.
diff --git a/lib/libc/gen/alarm.c b/lib/libc/gen/alarm.c
index 64bc7a86ebb5..043571ff89a1 100644
--- a/lib/libc/gen/alarm.c
+++ b/lib/libc/gen/alarm.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)alarm.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
/*
* Backwards compatible alarm.
*/
diff --git a/lib/libc/gen/arc4random-compat.c b/lib/libc/gen/arc4random-compat.c
index 065998e80553..beeb4d75964a 100644
--- a/lib/libc/gen/arc4random-compat.c
+++ b/lib/libc/gen/arc4random-compat.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018 Google LLC
* All rights reserved.
@@ -24,13 +24,8 @@
* 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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <stdbool.h>
#include <syslog.h>
diff --git a/lib/libc/gen/arc4random.3 b/lib/libc/gen/arc4random.3
index 75f77a5cab59..1d5b3b9f43cb 100644
--- a/lib/libc/gen/arc4random.3
+++ b/lib/libc/gen/arc4random.3
@@ -29,7 +29,6 @@
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" Manual page, using -mandoc macros
-.\" $FreeBSD$
.\"
.Dd April 13, 2020
.Dt ARC4RANDOM 3
@@ -133,6 +132,17 @@ functions using
.Sh HISTORY
These functions first appeared in
.Ox 2.1 .
+.Fn arc4random
+first appeared in
+.Fx 3.0 .
+.Fn arc4random_buf
+and
+.Fn arc4random_uniform
+first appeared in
+.Fx 8.0 .
+.Fn arc4random_stir
+was removed in
+.Fx 12.0 .
.Pp
The original version of this random number generator used the
RC4 (also known as ARC4) algorithm.
diff --git a/lib/libc/gen/arc4random.c b/lib/libc/gen/arc4random.c
index aecbdb8911bd..fdb1688cfe9c 100644
--- a/lib/libc/gen/arc4random.c
+++ b/lib/libc/gen/arc4random.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arc4random.c,v 1.55 2019/03/24 17:56:54 deraadt Exp $ */
+/* $OpenBSD: arc4random.c,v 1.58 2022/07/31 13:41:45 tb Exp $ */
/*
* Copyright (c) 1996, David Mazieres <dm@uun.org>
@@ -23,9 +23,6 @@
* ChaCha based random number generator for OpenBSD.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#if defined(__FreeBSD__)
#include <assert.h>
@@ -66,6 +63,8 @@ __FBSDID("$FreeBSD$");
#define BLOCKSZ 64
#define RSBUFSZ (16*BLOCKSZ)
+#define REKEY_BASE (1024*1024) /* NB. should be a power of 2 */
+
/* Marked INHERIT_ZERO, so zero'd out in fork children. */
static struct _rs {
size_t rs_have; /* valid bytes at end of rs_buf */
@@ -106,6 +105,7 @@ static void
_rs_stir(void)
{
u_char rnd[KEYSZ + IVSZ];
+ uint32_t rekey_fuzz = 0;
#if defined(__FreeBSD__)
bool need_init;
@@ -152,7 +152,10 @@ _rs_stir(void)
rs->rs_have = 0;
memset(rsx->rs_buf, 0, sizeof(rsx->rs_buf));
- rs->rs_count = 1600000;
+ /* rekey interval should not be predictable */
+ chacha_encrypt_bytes(&rsx->rs_chacha, (uint8_t *)&rekey_fuzz,
+ (uint8_t *)&rekey_fuzz, sizeof(rekey_fuzz));
+ rs->rs_count = REKEY_BASE + (rekey_fuzz % REKEY_BASE);
}
static inline void
diff --git a/lib/libc/gen/arc4random.h b/lib/libc/gen/arc4random.h
index 459fcc7f6e1d..e6332f155db2 100644
--- a/lib/libc/gen/arc4random.h
+++ b/lib/libc/gen/arc4random.h
@@ -17,8 +17,6 @@
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * $FreeBSD$
*/
/*
diff --git a/lib/libc/gen/arc4random_uniform.c b/lib/libc/gen/arc4random_uniform.c
index 5f5e190790b0..06cd29c6dbe4 100644
--- a/lib/libc/gen/arc4random_uniform.c
+++ b/lib/libc/gen/arc4random_uniform.c
@@ -14,8 +14,6 @@
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * $FreeBSD$
*/
#include <stdint.h>
diff --git a/lib/libc/gen/assert.c b/lib/libc/gen/assert.c
index 1a6ef1a8404b..21e5a44522ec 100644
--- a/lib/libc/gen/assert.c
+++ b/lib/libc/gen/assert.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)assert.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/lib/libc/gen/auxv.3 b/lib/libc/gen/auxv.3
deleted file mode 100644
index 007e8066c791..000000000000
--- a/lib/libc/gen/auxv.3
+++ /dev/null
@@ -1,103 +0,0 @@
-.\"
-.\" Copyright (c) 2019 Ian Lepore <ian@freebsd.org>
-.\"
-.\" 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 AUTHOR ``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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd November 17, 2019
-.Dt ELF_AUX_INFO 3
-.Os
-.Sh NAME
-.Nm elf_aux_info
-.Nd extract data from the elf auxiliary vector of the current process
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/auxv.h
-.Ft int
-.Fn elf_aux_info "int aux" "void *buf" "int buflen"
-.Sh DESCRIPTION
-The
-.Fn elf_aux_info
-function retrieves the auxiliary info vector requested in
-.Va aux .
-The information is stored into the provided buffer if it will fit.
-The following values, defined in
-.In sys/elf_common.h
-can be requested (corresponding buffer sizes are specified in parenthesis):
-.Bl -tag -width AT_OSRELDATE
-.It AT_CANARY
-The canary value for SSP (arbitrary sized buffer, as many bytes are
-returned as it fits into it, rest is zeroed).
-.It AT_EXECPATH
-The path of executed program
-.Dv (MAXPATHLEN).
-This may not be present if the process was initialized by
-.Xr fexecve 2
-and the namecache no longer contains the file's name.
-.It AT_HWCAP
-CPU / hardware feature flags
-.Dv (sizeof(u_long)).
-.It AT_HWCAP2
-CPU / hardware feature flags
-.Dv (sizeof(u_long)).
-.It AT_NCPUS
-Number of CPUs
-.Dv (sizeof(int)).
-.It AT_OSRELDATE
-The
-.Dv OSRELDATE
-of the kernel or jail the program is running on
-.Dv (sizeof(int)).
-.It AT_PAGESIZES
-Vector of page sizes (arbitrary sized buffer, as many elements of the
-.Dv pagesizes
-array are returned as it fits).
-.It AT_PAGESZ
-Page size in bytes
-.Dv (sizeof(int)).
-.It AT_TIMEKEEP
-Pointer to VDSO timehands (for library internal use,
-.Dv sizeof(void *)).
-.El
-.Sh RETURN VALUES
-Returns zero on success, or an error number on failure.
-.Sh ERRORS
-.Bl -tag -width Er
-.It Bq Er EINVAL
-An unknown item was requested.
-.It Bq Er EINVAL
-The provided buffer was not the right size for the requested item.
-.It Bq Er ENOENT
-The requested item is not available.
-.El
-.Sh HISTORY
-The
-.Fn elf_aux_info
-function appeared in
-.Fx 12.0 .
-.Sh BUGS
-Only a small subset of available auxiliary info vector items are
-accessible with this function.
-Some items require a "right-sized" buffer while others just require a
-"big enough" buffer.
diff --git a/lib/libc/gen/auxv.c b/lib/libc/gen/auxv.c
deleted file mode 100644
index ae21d088a8d1..000000000000
--- a/lib/libc/gen/auxv.c
+++ /dev/null
@@ -1,378 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright 2010, 2012 Konstantin Belousov <kib@FreeBSD.ORG>.
- * All rights reserved.
- *
- * 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 AUTHOR ``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 AUTHOR 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.
- *
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "namespace.h"
-#include <elf.h>
-#include <errno.h>
-#include <link.h>
-#include <pthread.h>
-#include <string.h>
-#include <sys/auxv.h>
-#include "un-namespace.h"
-#include "libc_private.h"
-
-extern char **environ;
-extern int _DYNAMIC;
-#pragma weak _DYNAMIC
-
-void *__elf_aux_vector;
-static pthread_once_t aux_vector_once = PTHREAD_ONCE_INIT;
-
-static void
-init_aux_vector_once(void)
-{
- Elf_Addr *sp;
-
- sp = (Elf_Addr *)environ;
- while (*sp++ != 0)
- ;
- __elf_aux_vector = (Elf_Auxinfo *)sp;
-}
-
-void
-__init_elf_aux_vector(void)
-{
-
- if (&_DYNAMIC != NULL)
- return;
- _once(&aux_vector_once, init_aux_vector_once);
-}
-
-static pthread_once_t aux_once = PTHREAD_ONCE_INIT;
-static int pagesize, osreldate, canary_len, ncpus, pagesizes_len, bsdflags;
-static int hwcap_present, hwcap2_present;
-static char *canary, *pagesizes, *execpath;
-static void *ps_strings, *timekeep;
-static u_long hwcap, hwcap2;
-static void *fxrng_seed_version;
-
-#ifdef __powerpc__
-static int powerpc_new_auxv_format = 0;
-static void _init_aux_powerpc_fixup(void);
-int _powerpc_elf_aux_info(int, void *, int);
-#endif
-
-static void
-init_aux(void)
-{
- Elf_Auxinfo *aux;
-
- for (aux = __elf_aux_vector; aux->a_type != AT_NULL; aux++) {
- switch (aux->a_type) {
- case AT_BSDFLAGS:
- bsdflags = aux->a_un.a_val;
- break;
-
- case AT_CANARY:
- canary = (char *)(aux->a_un.a_ptr);
- break;
-
- case AT_CANARYLEN:
- canary_len = aux->a_un.a_val;
- break;
-
- case AT_EXECPATH:
- execpath = (char *)(aux->a_un.a_ptr);
- break;
-
- case AT_HWCAP:
- hwcap_present = 1;
- hwcap = (u_long)(aux->a_un.a_val);
- break;
-
- case AT_HWCAP2:
- hwcap2_present = 1;
- hwcap2 = (u_long)(aux->a_un.a_val);
- break;
-
- case AT_PAGESIZES:
- pagesizes = (char *)(aux->a_un.a_ptr);
- break;
-
- case AT_PAGESIZESLEN:
- pagesizes_len = aux->a_un.a_val;
- break;
-
- case AT_PAGESZ:
- pagesize = aux->a_un.a_val;
- break;
-
- case AT_OSRELDATE:
- osreldate = aux->a_un.a_val;
- break;
-
- case AT_NCPUS:
- ncpus = aux->a_un.a_val;
- break;
-
- case AT_TIMEKEEP:
- timekeep = aux->a_un.a_ptr;
- break;
-
- case AT_PS_STRINGS:
- ps_strings = aux->a_un.a_ptr;
- break;
-
- case AT_FXRNG:
- fxrng_seed_version = aux->a_un.a_ptr;
- break;
-#ifdef __powerpc__
- /*
- * Since AT_STACKPROT is always set, and the common
- * value 23 is mutually exclusive with the legacy powerpc
- * value 21, the existence of AT_STACKPROT proves we are
- * on the common format.
- */
- case AT_STACKPROT: /* 23 */
- powerpc_new_auxv_format = 1;
- break;
-#endif
- }
- }
-#ifdef __powerpc__
- if (!powerpc_new_auxv_format)
- _init_aux_powerpc_fixup();
-#endif
-}
-
-#ifdef __powerpc__
-static void
-_init_aux_powerpc_fixup(void)
-{
- Elf_Auxinfo *aux;
-
- /*
- * Before 1300070, PowerPC platforms had nonstandard numbering for
- * the aux vector. When running old binaries, the kernel will pass
- * the vector using the old numbering. Reload affected variables.
- */
- for (aux = __elf_aux_vector; aux->a_type != AT_NULL; aux++) {
- switch (aux->a_type) {
- case AT_OLD_CANARY:
- canary = (char *)(aux->a_un.a_ptr);
- break;
- case AT_OLD_CANARYLEN:
- canary_len = aux->a_un.a_val;
- break;
- case AT_OLD_EXECPATH:
- execpath = (char *)(aux->a_un.a_ptr);
- break;
- case AT_OLD_PAGESIZES:
- pagesizes = (char *)(aux->a_un.a_ptr);
- break;
- case AT_OLD_PAGESIZESLEN:
- pagesizes_len = aux->a_un.a_val;
- break;
- case AT_OLD_OSRELDATE:
- osreldate = aux->a_un.a_val;
- break;
- case AT_OLD_NCPUS:
- ncpus = aux->a_un.a_val;
- break;
- }
- }
-}
-
-int
-_powerpc_elf_aux_info(int aux, void *buf, int buflen)
-{
-
- /*
- * If we are in the old auxv format, we need to translate the aux
- * parameter of elf_aux_info() calls into the common auxv format.
- * Internal libc calls always use the common format, and they
- * directly call _elf_aux_info instead of using the weak symbol.
- */
- if (!powerpc_new_auxv_format) {
- switch (aux) {
- case AT_OLD_EXECPATH:
- aux = AT_EXECPATH;
- break;
- case AT_OLD_CANARY:
- aux = AT_CANARY;
- break;
- case AT_OLD_CANARYLEN:
- aux = AT_CANARYLEN;
- break;
- case AT_OLD_OSRELDATE:
- aux = AT_OSRELDATE;
- break;
- case AT_OLD_NCPUS:
- aux = AT_NCPUS;
- break;
- case AT_OLD_PAGESIZES:
- aux = AT_PAGESIZES;
- break;
- case AT_OLD_PAGESIZESLEN:
- aux = AT_PAGESIZESLEN;
- break;
- case AT_OLD_STACKPROT:
- aux = AT_STACKPROT;
- break;
- }
- }
- return _elf_aux_info(aux, buf, buflen);
-}
-__weak_reference(_powerpc_elf_aux_info, elf_aux_info);
-#else
-__weak_reference(_elf_aux_info, elf_aux_info);
-#endif
-
-int
-_elf_aux_info(int aux, void *buf, int buflen)
-{
- int res;
-
- __init_elf_aux_vector();
- if (__elf_aux_vector == NULL)
- return (ENOSYS);
- _once(&aux_once, init_aux);
-
- if (buflen < 0)
- return (EINVAL);
-
- switch (aux) {
- case AT_CANARY:
- if (canary != NULL && canary_len >= buflen) {
- memcpy(buf, canary, buflen);
- memset(canary, 0, canary_len);
- canary = NULL;
- res = 0;
- } else
- res = ENOENT;
- break;
- case AT_EXECPATH:
- if (execpath == NULL)
- res = ENOENT;
- else if (buf == NULL)
- res = EINVAL;
- else {
- if (strlcpy(buf, execpath, buflen) >=
- (unsigned int)buflen)
- res = EINVAL;
- else
- res = 0;
- }
- break;
- case AT_HWCAP:
- if (hwcap_present && buflen == sizeof(u_long)) {
- *(u_long *)buf = hwcap;
- res = 0;
- } else
- res = ENOENT;
- break;
- case AT_HWCAP2:
- if (hwcap2_present && buflen == sizeof(u_long)) {
- *(u_long *)buf = hwcap2;
- res = 0;
- } else
- res = ENOENT;
- break;
- case AT_PAGESIZES:
- if (pagesizes != NULL && pagesizes_len >= buflen) {
- memcpy(buf, pagesizes, buflen);
- res = 0;
- } else
- res = ENOENT;
- break;
- case AT_PAGESZ:
- if (buflen == sizeof(int)) {
- if (pagesize != 0) {
- *(int *)buf = pagesize;
- res = 0;
- } else
- res = ENOENT;
- } else
- res = EINVAL;
- break;
- case AT_OSRELDATE:
- if (buflen == sizeof(int)) {
- if (osreldate != 0) {
- *(int *)buf = osreldate;
- res = 0;
- } else
- res = ENOENT;
- } else
- res = EINVAL;
- break;
- case AT_NCPUS:
- if (buflen == sizeof(int)) {
- if (ncpus != 0) {
- *(int *)buf = ncpus;
- res = 0;
- } else
- res = ENOENT;
- } else
- res = EINVAL;
- break;
- case AT_TIMEKEEP:
- if (buflen == sizeof(void *)) {
- if (timekeep != NULL) {
- *(void **)buf = timekeep;
- res = 0;
- } else
- res = ENOENT;
- } else
- res = EINVAL;
- break;
- case AT_BSDFLAGS:
- if (buflen == sizeof(int)) {
- *(int *)buf = bsdflags;
- res = 0;
- } else
- res = EINVAL;
- break;
- case AT_PS_STRINGS:
- if (buflen == sizeof(void *)) {
- if (ps_strings != NULL) {
- *(void **)buf = ps_strings;
- res = 0;
- } else
- res = ENOENT;
- } else
- res = EINVAL;
- break;
- case AT_FXRNG:
- if (buflen == sizeof(void *)) {
- if (fxrng_seed_version != NULL) {
- *(void **)buf = fxrng_seed_version;
- res = 0;
- } else
- res = ENOENT;
- } else
- res = EINVAL;
- break;
- default:
- res = ENOENT;
- break;
- }
- return (res);
-}
diff --git a/lib/libc/gen/basename.3 b/lib/libc/gen/basename.3
index 3bbddd9233e2..e3fb25606172 100644
--- a/lib/libc/gen/basename.3
+++ b/lib/libc/gen/basename.3
@@ -14,8 +14,6 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.\" $FreeBSD$
-.\"
.Dd May 22, 2017
.Dt BASENAME 3
.Os
diff --git a/lib/libc/gen/basename.c b/lib/libc/gen/basename.c
index 7569ab9c3029..d0ba1bd9229c 100644
--- a/lib/libc/gen/basename.c
+++ b/lib/libc/gen/basename.c
@@ -23,9 +23,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <libgen.h>
#include <string.h>
diff --git a/lib/libc/gen/basename_compat.c b/lib/libc/gen/basename_compat.c
index c7488f2dcb67..19a4bd6c03eb 100644
--- a/lib/libc/gen/basename_compat.c
+++ b/lib/libc/gen/basename_compat.c
@@ -16,9 +16,6 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <libgen.h>
#include <stdlib.h>
diff --git a/lib/libc/gen/cap_rights_get.3 b/lib/libc/gen/cap_rights_get.3
index 521f3cde25c5..e99424c7afdc 100644
--- a/lib/libc/gen/cap_rights_get.3
+++ b/lib/libc/gen/cap_rights_get.3
@@ -1,6 +1,5 @@
.\"
.\" Copyright (c) 2013 The FreeBSD Foundation
-.\" All rights reserved.
.\"
.\" This documentation was written by Pawel Jakub Dawidek under sponsorship
.\" from the FreeBSD Foundation.
@@ -26,8 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd May 5, 2020
.Dt CAP_RIGHTS_GET 3
.Os
diff --git a/lib/libc/gen/cap_sandboxed.3 b/lib/libc/gen/cap_sandboxed.3
index 5dc5c8be6570..6e2004fb7a29 100644
--- a/lib/libc/gen/cap_sandboxed.3
+++ b/lib/libc/gen/cap_sandboxed.3
@@ -1,6 +1,5 @@
.\"
.\" Copyright (c) 2012 The FreeBSD Foundation
-.\" All rights reserved.
.\"
.\" This documentation was written by Pawel Jakub Dawidek under sponsorship
.\" from the FreeBSD Foundation.
@@ -26,8 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd May 5, 2020
.Dt CAP_SANDBOXED 3
.Os
diff --git a/lib/libc/gen/cap_sandboxed.c b/lib/libc/gen/cap_sandboxed.c
index fd16c4845dce..63c2439382a6 100644
--- a/lib/libc/gen/cap_sandboxed.c
+++ b/lib/libc/gen/cap_sandboxed.c
@@ -1,8 +1,7 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2012 The FreeBSD Foundation
- * All rights reserved.
*
* This software was developed by Pawel Jakub Dawidek under sponsorship from
* the FreeBSD Foundation.
@@ -29,9 +28,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/capsicum.h>
#include <assert.h>
diff --git a/lib/libc/gen/check_utility_compat.3 b/lib/libc/gen/check_utility_compat.3
index 89449a4064bb..05dea4f124b6 100644
--- a/lib/libc/gen/check_utility_compat.3
+++ b/lib/libc/gen/check_utility_compat.3
@@ -26,8 +26,6 @@
.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd October 27, 2002
.Dt CHECK_UTILITY_COMPAT 3
.Os
diff --git a/lib/libc/gen/check_utility_compat.c b/lib/libc/gen/check_utility_compat.c
index 04c594b52665..63a268896daa 100644
--- a/lib/libc/gen/check_utility_compat.c
+++ b/lib/libc/gen/check_utility_compat.c
@@ -27,9 +27,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* I din't use "namespace.h" here because none of the relevant utilities
* are threaded, so I'm not concerned about cancellation points or other
diff --git a/lib/libc/gen/clock.3 b/lib/libc/gen/clock.3
index 390e35234cdc..77d7ce085d2e 100644
--- a/lib/libc/gen/clock.3
+++ b/lib/libc/gen/clock.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)clock.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd June 4, 1993
.Dt CLOCK 3
.Os
diff --git a/lib/libc/gen/clock.c b/lib/libc/gen/clock.c
index d20bbf878f50..4d78fff73028 100644
--- a/lib/libc/gen/clock.c
+++ b/lib/libc/gen/clock.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)clock.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/time.h>
#include <sys/resource.h>
diff --git a/lib/libc/gen/clock_getcpuclockid.3 b/lib/libc/gen/clock_getcpuclockid.3
index 7a476846f51e..b14c956be71d 100644
--- a/lib/libc/gen/clock_getcpuclockid.3
+++ b/lib/libc/gen/clock_getcpuclockid.3
@@ -32,8 +32,6 @@
.\" the referee document. The original Standard can be obtained online at
.\" http://www.opengroup.org/unix/online.html.
.\"
-.\" $FreeBSD$
-.\"
.Dd August 21, 2012
.Dt CLOCK_GETCPUCLOCKID 3
.Os
diff --git a/lib/libc/gen/clock_getcpuclockid.c b/lib/libc/gen/clock_getcpuclockid.c
index fe951392d3c6..77d6c3423301 100644
--- a/lib/libc/gen/clock_getcpuclockid.c
+++ b/lib/libc/gen/clock_getcpuclockid.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2012 David Xu <davidxu@FreeBSD.org>.
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <time.h>
#include <unistd.h>
diff --git a/lib/libc/gen/closedir.c b/lib/libc/gen/closedir.c
index b83ef273895b..6015114d6c47 100644
--- a/lib/libc/gen/closedir.c
+++ b/lib/libc/gen/closedir.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)closedir.c 8.1 (Berkeley) 6/10/93");
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/types.h>
#include <dirent.h>
diff --git a/lib/libc/gen/confstr.3 b/lib/libc/gen/confstr.3
index 923f5db96aa1..df19339c612a 100644
--- a/lib/libc/gen/confstr.3
+++ b/lib/libc/gen/confstr.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)confstr.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd December 3, 2006
.Dt CONFSTR 3
.Os
diff --git a/lib/libc/gen/confstr.c b/lib/libc/gen/confstr.c
index dc8ffff0d68f..491df0cba67a 100644
--- a/lib/libc/gen/confstr.c
+++ b/lib/libc/gen/confstr.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)confstr.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <errno.h>
diff --git a/lib/libc/gen/errno.c b/lib/libc/gen/cpuset_alloc.c
index 4ee9b6475655..ac307f07f263 100644
--- a/lib/libc/gen/errno.c
+++ b/lib/libc/gen/cpuset_alloc.c
@@ -1,8 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 2002 Peter Wemm <peter@freebsd.org>
- * All rights reserved.
+ * Copyright (c) 2021 Stefan Esser <se@FreeBSD.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,7 +23,11 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+#include <stdlib.h>
+#include <sched.h>
-int errno;
+cpuset_t *
+__cpuset_alloc(size_t ncpus)
+{
+ return (malloc(CPU_ALLOC_SIZE(ncpus)));
+}
diff --git a/lib/libc/powerpc/gen/_set_tp.c b/lib/libc/gen/cpuset_free.c
index 61986f21c697..4cd993853241 100644
--- a/lib/libc/powerpc/gen/_set_tp.c
+++ b/lib/libc/gen/cpuset_free.c
@@ -1,8 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 2004 Doug Rabson
- * All rights reserved.
+ * Copyright (c) 2021 Stefan Esser <se@FreeBSD.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -24,14 +21,13 @@
* 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 "libc_private.h"
+
+#include <stdlib.h>
+#include <sched.h>
void
-_set_tp(void *tpval)
+__cpuset_free(cpuset_t *ptr)
{
-
- __asm __volatile("mr 2,%0" :: "r"((char*)tpval + 0x7008));
+ free(ptr);
}
diff --git a/lib/libc/gen/crypt.c b/lib/libc/gen/crypt.c
index 7995196ef234..ddcd6719775f 100644
--- a/lib/libc/gen/crypt.c
+++ b/lib/libc/gen/crypt.c
@@ -32,10 +32,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)crypt.c 5.11 (Berkeley) 6/25/91");
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
#include <string.h>
#include <unistd.h>
diff --git a/lib/libc/gen/ctermid.3 b/lib/libc/gen/ctermid.3
index 946ce49fd94f..2a53412f1b29 100644
--- a/lib/libc/gen/ctermid.3
+++ b/lib/libc/gen/ctermid.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)ctermid.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd October 1, 2011
.Dt CTERMID 3
.Os
diff --git a/lib/libc/gen/ctermid.c b/lib/libc/gen/ctermid.c
index eda960f80a51..9265d402930c 100644
--- a/lib/libc/gen/ctermid.c
+++ b/lib/libc/gen/ctermid.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2011 Ed Schouten <ed@FreeBSD.org>
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/sysctl.h>
diff --git a/lib/libc/gen/daemon.3 b/lib/libc/gen/daemon.3
index f4129fc47144..4619ba3489aa 100644
--- a/lib/libc/gen/daemon.3
+++ b/lib/libc/gen/daemon.3
@@ -25,10 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)daemon.3 8.1 (Berkeley) 6/9/93
-.\" $FreeBSD$
-.\"
-.Dd December 23, 2017
+.Dd February 27, 2023
.Dt DAEMON 3
.Os
.Sh NAME
@@ -48,18 +45,18 @@ The
function is for programs wishing to detach themselves from the
controlling terminal and run in the background as system daemons.
.Pp
-Unless the argument
+If the argument
.Fa nochdir
-is non-zero,
+is zero,
.Fn daemon
changes the current working directory to the root
.Pq Pa / .
.Pp
-Unless the argument
+If the argument
.Fa noclose
-is non-zero,
+is zero,
.Fn daemon
-will redirect standard input, standard output, and standard error to
+redirects standard input, standard output, and standard error to
.Pa /dev/null .
.Pp
The
diff --git a/lib/libc/gen/daemon.c b/lib/libc/gen/daemon.c
index f6753a84c44a..525c99761aa3 100644
--- a/lib/libc/gen/daemon.c
+++ b/lib/libc/gen/daemon.c
@@ -30,10 +30,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)daemon.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <errno.h>
#include <fcntl.h>
diff --git a/lib/libc/gen/devname-compat11.c b/lib/libc/gen/devname-compat11.c
index 70cb6f0d641e..b01b0845e261 100644
--- a/lib/libc/gen/devname-compat11.c
+++ b/lib/libc/gen/devname-compat11.c
@@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
diff --git a/lib/libc/gen/devname.3 b/lib/libc/gen/devname.3
index c5d9ec036f4b..44c1ff951cfa 100644
--- a/lib/libc/gen/devname.3
+++ b/lib/libc/gen/devname.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)devname.3 8.2 (Berkeley) 4/29/95
-.\" $FreeBSD$
-.\"
.Dd February 22, 2005
.Dt DEVNAME 3
.Os
diff --git a/lib/libc/gen/devname.c b/lib/libc/gen/devname.c
index e519b505f1f8..ebb56132c48d 100644
--- a/lib/libc/gen/devname.c
+++ b/lib/libc/gen/devname.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)devname.c 8.2 (Berkeley) 4/29/95");
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/sysctl.h>
@@ -48,7 +44,7 @@ devname_r(dev_t dev, mode_t type, char *buf, int len)
int i;
size_t j;
- if (dev == NODEV || !(S_ISCHR(type) || S_ISBLK(dev))) {
+ if (dev == NODEV || !(S_ISCHR(type) || S_ISBLK(type))) {
strlcpy(buf, "#NODEV", len);
return (buf);
}
diff --git a/lib/libc/gen/directory.3 b/lib/libc/gen/directory.3
index f517a00386c6..263dfdd6eb95 100644
--- a/lib/libc/gen/directory.3
+++ b/lib/libc/gen/directory.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)directory.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd August 1, 2020
.Dt DIRECTORY 3
.Os
diff --git a/lib/libc/gen/dirfd.c b/lib/libc/gen/dirfd.c
index 14fd3c8fc823..85090bd4da6c 100644
--- a/lib/libc/gen/dirfd.c
+++ b/lib/libc/gen/dirfd.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2011 Gleb Kurtsou <gleb@FreeBSD.org>
* All rights reserved.
@@ -24,13 +24,8 @@
* 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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
diff --git a/lib/libc/gen/dirname.3 b/lib/libc/gen/dirname.3
index 67eee664a1e1..bb3be09ab4c4 100644
--- a/lib/libc/gen/dirname.3
+++ b/lib/libc/gen/dirname.3
@@ -14,8 +14,6 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.\" $FreeBSD$
-.\"
.Dd September 5, 2016
.Dt DIRNAME 3
.Os
diff --git a/lib/libc/gen/dirname.c b/lib/libc/gen/dirname.c
index ae7b928d54eb..7157fec23630 100644
--- a/lib/libc/gen/dirname.c
+++ b/lib/libc/gen/dirname.c
@@ -23,9 +23,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <libgen.h>
#include <string.h>
diff --git a/lib/libc/gen/dirname_compat.c b/lib/libc/gen/dirname_compat.c
index f85d40993a91..7eca7eb03f83 100644
--- a/lib/libc/gen/dirname_compat.c
+++ b/lib/libc/gen/dirname_compat.c
@@ -16,9 +16,6 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <libgen.h>
#include <stdlib.h>
diff --git a/lib/libc/gen/disklabel.c b/lib/libc/gen/disklabel.c
index d02644e1e1ce..4b3730920529 100644
--- a/lib/libc/gen/disklabel.c
+++ b/lib/libc/gen/disklabel.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)disklabel.c 8.2 (Berkeley) 5/3/95");
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#define DKTYPENAMES
#define FSTYPENAMES
diff --git a/lib/libc/gen/dl_iterate_phdr.3 b/lib/libc/gen/dl_iterate_phdr.3
index fe4face9eeb7..448d6fbb2fc5 100644
--- a/lib/libc/gen/dl_iterate_phdr.3
+++ b/lib/libc/gen/dl_iterate_phdr.3
@@ -14,7 +14,6 @@
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\" $OpenBSD: dl_iterate_phdr.3,v 1.3 2007/05/31 19:19:48 jmc Exp $
-.\" $FreeBSD$
.Dd April 5, 2021
.Dt DL_ITERATE_PHDR 3
.Os
diff --git a/lib/libc/gen/dladdr.3 b/lib/libc/gen/dladdr.3
index 65662793b59d..a9abf95393c3 100644
--- a/lib/libc/gen/dladdr.3
+++ b/lib/libc/gen/dladdr.3
@@ -23,8 +23,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd February 5, 1998
.Dt DLADDR 3
.Os
diff --git a/lib/libc/gen/dlfcn.c b/lib/libc/gen/dlfcn.c
index 337ad48fd691..b678df9eef47 100644
--- a/lib/libc/gen/dlfcn.c
+++ b/lib/libc/gen/dlfcn.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1998 John D. Polstra
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#if !defined(IN_LIBDL) || defined(PIC)
/*
@@ -40,6 +37,7 @@ __FBSDID("$FreeBSD$");
#include <dlfcn.h>
#include <link.h>
#include <stddef.h>
+#include <string.h>
#include "namespace.h"
#include <pthread.h>
#include "un-namespace.h"
@@ -168,7 +166,9 @@ _rtld_thread_init(void *li __unused)
#ifndef IN_LIBDL
static pthread_once_t dl_phdr_info_once = PTHREAD_ONCE_INIT;
static struct dl_phdr_info phdr_info;
+#ifndef PIC
static mutex_t dl_phdr_info_lock = MUTEX_INITIALIZER;
+#endif
static void
dl_init_phdr_info(void)
@@ -207,7 +207,16 @@ int
dl_iterate_phdr(int (*callback)(struct dl_phdr_info *, size_t, void *) __unused,
void *data __unused)
{
-#ifndef IN_LIBDL
+#if defined IN_LIBDL
+ return (0);
+#elif defined PIC
+ int (*r)(int (*)(struct dl_phdr_info *, size_t, void *), void *);
+
+ r = dlsym(RTLD_DEFAULT, "dl_iterate_phdr");
+ if (r == NULL)
+ return (0);
+ return (r(callback, data));
+#else
tls_index ti;
int ret;
@@ -222,8 +231,6 @@ dl_iterate_phdr(int (*callback)(struct dl_phdr_info *, size_t, void *) __unused,
ret = callback(&phdr_info, sizeof(phdr_info), data);
mutex_unlock(&dl_phdr_info_lock);
return (ret);
-#else
- return (0);
#endif
}
@@ -248,13 +255,48 @@ _rtld_atfork_post(int *locks __unused)
{
}
+#ifndef IN_LIBDL
+struct _rtld_addr_phdr_cb_data {
+ const void *addr;
+ struct dl_phdr_info *dli;
+};
+
+static int
+_rtld_addr_phdr_cb(struct dl_phdr_info *dli, size_t sz, void *arg)
+{
+ struct _rtld_addr_phdr_cb_data *rd;
+ const Elf_Phdr *ph;
+ unsigned i;
+
+ rd = arg;
+ for (i = 0; i < dli->dlpi_phnum; i++) {
+ ph = &dli->dlpi_phdr[i];
+ if (ph->p_type == PT_LOAD &&
+ dli->dlpi_addr + ph->p_vaddr <= (uintptr_t)rd->addr &&
+ (uintptr_t)rd->addr < dli->dlpi_addr + ph->p_vaddr +
+ ph->p_memsz) {
+ memcpy(rd->dli, dli, sz);
+ return (1);
+ }
+ }
+ return (0);
+}
+#endif
+
#pragma weak _rtld_addr_phdr
int
_rtld_addr_phdr(const void *addr __unused,
struct dl_phdr_info *phdr_info_a __unused)
{
+#ifndef IN_LIBDL
+ struct _rtld_addr_phdr_cb_data rd;
+ rd.addr = addr;
+ rd.dli = phdr_info_a;
+ return (dl_iterate_phdr(_rtld_addr_phdr_cb, &rd));
+#else
return (0);
+#endif
}
#pragma weak _rtld_get_stack_prot
diff --git a/lib/libc/gen/dlinfo.3 b/lib/libc/gen/dlinfo.3
index e5da2bc9ffda..8f30e5f10af1 100644
--- a/lib/libc/gen/dlinfo.3
+++ b/lib/libc/gen/dlinfo.3
@@ -23,8 +23,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd May 21, 2020
.Dt DLINFO 3
.Os
diff --git a/lib/libc/gen/dllockinit.3 b/lib/libc/gen/dllockinit.3
index be3e2cab87f7..8fe29f2516f9 100644
--- a/lib/libc/gen/dllockinit.3
+++ b/lib/libc/gen/dllockinit.3
@@ -23,8 +23,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd July 5, 2000
.Dt DLLOCKINIT 3
.Os
diff --git a/lib/libc/gen/dlopen.3 b/lib/libc/gen/dlopen.3
index 8bafb0897fd9..9871029a84b5 100644
--- a/lib/libc/gen/dlopen.3
+++ b/lib/libc/gen/dlopen.3
@@ -29,9 +29,6 @@
.\"
.\" Copyright (c) 1991 Sun Microsystems, Inc.
.\"
-.\" @(#) dlopen.3 1.6 90/01/31 SMI
-.\" $FreeBSD$
-.\"
.Dd May 14, 2020
.Dt DLOPEN 3
.Os
@@ -326,11 +323,9 @@ triggering compiler diagnostics.
(The
.Fn dlsym
function
-returns a data pointer; in the C standard, conversions between
-data and function pointer types are undefined.
-Some compilers and
-.Xr lint 1
-utilities warn about such casts.)
+returns an object pointer; in the C standard, conversions between
+object and function pointer types are undefined.
+Some compilers and lint utilities warn about such casts.)
The precise return type of
.Fn dlfunc
is unspecified; applications must cast it to an appropriate function pointer
diff --git a/lib/libc/gen/drand48.c b/lib/libc/gen/drand48.c
index 672b5eef6b19..cec04a6a2425 100644
--- a/lib/libc/gen/drand48.c
+++ b/lib/libc/gen/drand48.c
@@ -11,9 +11,6 @@
* to anyone/anything when using this software.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "rand48.h"
extern unsigned short _rand48_seed[3];
diff --git a/lib/libc/gen/dup3.3 b/lib/libc/gen/dup3.3
index d3bb116189b7..f2798930797b 100644
--- a/lib/libc/gen/dup3.3
+++ b/lib/libc/gen/dup3.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd August 16, 2013
.Dt DUP3 3
.Os
diff --git a/lib/libc/gen/dup3.c b/lib/libc/gen/dup3.c
index c091f3427738..fca1e99fb47b 100644
--- a/lib/libc/gen/dup3.c
+++ b/lib/libc/gen/dup3.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2012 Jukka A. Ukkonen
* All rights reserved.
@@ -28,9 +28,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <unistd.h>
#include <fcntl.h>
diff --git a/lib/libc/gen/elf_utils.c b/lib/libc/gen/elf_utils.c
index fbf3bf17082c..5b87e012d0eb 100644
--- a/lib/libc/gen/elf_utils.c
+++ b/lib/libc/gen/elf_utils.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2010 Konstantin Belousov <kib@freebsd.org>
* All rights reserved.
@@ -24,11 +24,10 @@
* 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/types.h>
+#include <sys/param.h>
+#include <sys/auxv.h>
#include <sys/mman.h>
#include <sys/resource.h>
#include <sys/sysctl.h>
@@ -77,19 +76,23 @@ __libc_map_stacks_exec(void)
{
int mib[2];
struct rlimit rlim;
- u_long usrstack;
+ u_long usrstack, stacksz;
size_t len;
- mib[0] = CTL_KERN;
- mib[1] = KERN_USRSTACK;
- len = sizeof(usrstack);
- if (sysctl(mib, sizeof(mib) / sizeof(mib[0]), &usrstack, &len, NULL, 0)
- == -1)
- return;
- if (getrlimit(RLIMIT_STACK, &rlim) == -1)
- return;
- mprotect((void *)(uintptr_t)(usrstack - rlim.rlim_cur),
- rlim.rlim_cur, _rtld_get_stack_prot());
+ if (_elf_aux_info(AT_USRSTACKBASE, &usrstack, sizeof(usrstack)) != 0) {
+ mib[0] = CTL_KERN;
+ mib[1] = KERN_USRSTACK;
+ len = sizeof(usrstack);
+ if (sysctl(mib, nitems(mib), &usrstack, &len, NULL, 0) == -1)
+ return;
+ }
+ if (_elf_aux_info(AT_USRSTACKLIM, &stacksz, sizeof(stacksz)) != 0) {
+ if (getrlimit(RLIMIT_STACK, &rlim) == -1)
+ return;
+ stacksz = rlim.rlim_cur;
+ }
+ mprotect((void *)(uintptr_t)(usrstack - stacksz), stacksz,
+ _rtld_get_stack_prot());
}
#pragma weak __pthread_map_stacks_exec
diff --git a/lib/libc/gen/erand48.c b/lib/libc/gen/erand48.c
index cdb3ec85052b..286904c27839 100644
--- a/lib/libc/gen/erand48.c
+++ b/lib/libc/gen/erand48.c
@@ -11,9 +11,6 @@
* to anyone/anything when using this software.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "rand48.h"
double
diff --git a/lib/libc/gen/err.3 b/lib/libc/gen/err.3
index 140772a4a6b8..088ead71239b 100644
--- a/lib/libc/gen/err.3
+++ b/lib/libc/gen/err.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" From: @(#)err.3 8.1 (Berkeley) 6/9/93
-.\" $FreeBSD$
-.\"
.Dd March 29, 2012
.Dt ERR 3
.Os
diff --git a/lib/libc/gen/err.c b/lib/libc/gen/err.c
index e72fac99ee61..24ea242560b8 100644
--- a/lib/libc/gen/err.c
+++ b/lib/libc/gen/err.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)err.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <err.h>
#include <errno.h>
diff --git a/lib/libc/gen/errlst.c b/lib/libc/gen/errlst.c
index bc673e8c9c66..a73fa06feb5e 100644
--- a/lib/libc/gen/errlst.c
+++ b/lib/libc/gen/errlst.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)errlst.c 8.2 (Berkeley) 11/16/93");
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <stdio.h>
#include "errlst.h"
diff --git a/lib/libc/gen/eventfd.c b/lib/libc/gen/eventfd.c
index b757f82029a9..44a33915c2fb 100644
--- a/lib/libc/gen/eventfd.c
+++ b/lib/libc/gen/eventfd.c
@@ -2,7 +2,7 @@
* SPDX-License-Identifier: MIT
*
* Copyright (c) 2005-2020 Rich Felker, et al.
- * Copyright (c) 2020 Greg V
+ * Copyright (c) 2020 Val Packett
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
@@ -24,9 +24,6 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/eventfd.h>
#include <sys/specialfd.h>
diff --git a/lib/libc/gen/exec.3 b/lib/libc/gen/exec.3
index 37954fe1bf75..8f866e5ab321 100644
--- a/lib/libc/gen/exec.3
+++ b/lib/libc/gen/exec.3
@@ -25,10 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)exec.3 8.3 (Berkeley) 1/24/94
-.\" $FreeBSD$
-.\"
-.Dd March 22, 2020
+.Dd December 11, 2023
.Dt EXEC 3
.Os
.Sh NAME
@@ -38,6 +35,7 @@
.Nm exect ,
.Nm execv ,
.Nm execvp ,
+.Nm execvpe ,
.Nm execvP
.Nd execute a file
.Sh LIBRARY
@@ -59,6 +57,8 @@
.Ft int
.Fn execvp "const char *file" "char *const argv[]"
.Ft int
+.Fn execvpe "const char *file" "char *const argv[]" "char *const envp[]"
+.Ft int
.Fn execvP "const char *file" "const char *search_path" "char *const argv[]"
.Sh DESCRIPTION
The
@@ -100,6 +100,7 @@ The
.Fn exect ,
.Fn execv ,
.Fn execvp ,
+.Fn execvpe ,
and
.Fn execvP
functions provide an array of pointers to null-terminated strings that
@@ -113,9 +114,10 @@ be terminated by a
pointer.
.Pp
The
-.Fn execle
+.Fn execle ,
+.Fn exect ,
and
-.Fn exect
+.Fn execvpe
functions also specify the environment of the executed process by following
the
.Dv NULL
@@ -137,6 +139,7 @@ Some of these functions have special semantics.
The functions
.Fn execlp ,
.Fn execvp ,
+.Fn execvpe ,
and
.Fn execvP
will duplicate the actions of the shell in searching for an executable file
@@ -147,6 +150,7 @@ For
.Fn execlp
and
.Fn execvp ,
+.Fn execvpe ,
search path is the path specified in the environment by
.Dq Ev PATH
variable.
@@ -272,7 +276,8 @@ The
.Fn execl ,
.Fn execle ,
.Fn execlp ,
-.Fn execvp
+.Fn execvp ,
+.Fn execvpe ,
and
.Fn execvP
functions
@@ -310,6 +315,9 @@ and
functions
conform to
.St -p1003.1-88 .
+The
+.Fn execvpe
+function is a GNU extension.
.Sh HISTORY
The
.Fn exec
@@ -333,6 +341,10 @@ The
.Fn execvP
function first appeared in
.Fx 5.2 .
+The
+.Fn execvpe
+function first appeared in
+.Fx 15.0 .
.Sh BUGS
The type of the
.Fa argv
@@ -343,6 +355,7 @@ parameters to
.Fn exect ,
.Fn execv ,
.Fn execvp ,
+.Fn execvpe ,
and
.Fn execvP
is a historical accident and no sane implementation should modify the provided
diff --git a/lib/libc/gen/exec.c b/lib/libc/gen/exec.c
index 2c703bb4e73e..d9285733e965 100644
--- a/lib/libc/gen/exec.c
+++ b/lib/libc/gen/exec.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)exec.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#include <sys/stat.h>
@@ -47,8 +43,6 @@ __FBSDID("$FreeBSD$");
#include "un-namespace.h"
#include "libc_private.h"
-extern char **environ;
-
static const char execvPe_err_preamble[] = "execvP: ";
static const char execvPe_err_trailer[] = ": path too long\n";
@@ -142,7 +136,7 @@ execv(const char *name, char * const *argv)
int
execvp(const char *name, char * const *argv)
{
- return (_execvpe(name, argv, environ));
+ return (execvpe(name, argv, environ));
}
static int
@@ -294,7 +288,7 @@ execvP(const char *name, const char *path, char * const argv[])
}
int
-_execvpe(const char *name, char * const argv[], char * const envp[])
+execvpe(const char *name, char * const argv[], char * const envp[])
{
const char *path;
diff --git a/lib/libc/gen/exect.c b/lib/libc/gen/exect.c
index b878d8cac085..e5be7a4d8755 100644
--- a/lib/libc/gen/exect.c
+++ b/lib/libc/gen/exect.c
@@ -24,9 +24,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/ptrace.h>
#include <errno.h>
diff --git a/lib/libc/gen/fdevname.c b/lib/libc/gen/fdevname.c
index 217448fe2f59..62e71e98af63 100644
--- a/lib/libc/gen/fdevname.c
+++ b/lib/libc/gen/fdevname.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2009 Ed Schouten <ed@FreeBSD.org>
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#include <sys/ioctl.h>
diff --git a/lib/libc/gen/feature_present.3 b/lib/libc/gen/feature_present.3
index 3a702d441df2..3741ea0d3975 100644
--- a/lib/libc/gen/feature_present.3
+++ b/lib/libc/gen/feature_present.3
@@ -26,8 +26,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd January 8, 2008
.Dt FEATURE_PRESENT 3
.Os
diff --git a/lib/libc/gen/feature_present.c b/lib/libc/gen/feature_present.c
index 3615d50f2349..4c0b41cfb23e 100644
--- a/lib/libc/gen/feature_present.c
+++ b/lib/libc/gen/feature_present.c
@@ -30,9 +30,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/sysctl.h>
#include <stdio.h>
diff --git a/lib/libc/gen/fmtcheck.3 b/lib/libc/gen/fmtcheck.3
index 0bd429982ead..07982f28b296 100644
--- a/lib/libc/gen/fmtcheck.3
+++ b/lib/libc/gen/fmtcheck.3
@@ -23,8 +23,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.
-.\"
-.\" $FreeBSD$
.Dd October 16, 2002
.Dt FMTCHECK 3
.Os
diff --git a/lib/libc/gen/fmtcheck.c b/lib/libc/gen/fmtcheck.c
index a772f50e51c8..de889ad3421c 100644
--- a/lib/libc/gen/fmtcheck.c
+++ b/lib/libc/gen/fmtcheck.c
@@ -1,7 +1,7 @@
/* $NetBSD: fmtcheck.c,v 1.8 2008/04/28 20:22:59 martin Exp $ */
/*-
- * SPDX-License-Identifier: BSD-2-Clause-NetBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -30,9 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
#include <string.h>
#include <ctype.h>
diff --git a/lib/libc/gen/fmtmsg.3 b/lib/libc/gen/fmtmsg.3
index 7995d7bd31c5..e50ab317e1aa 100644
--- a/lib/libc/gen/fmtmsg.3
+++ b/lib/libc/gen/fmtmsg.3
@@ -23,8 +23,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd August 5, 2002
.Dt FMTMSG 3
.Os
diff --git a/lib/libc/gen/fmtmsg.c b/lib/libc/gen/fmtmsg.c
index c5246561e0aa..9edeee4405ce 100644
--- a/lib/libc/gen/fmtmsg.c
+++ b/lib/libc/gen/fmtmsg.c
@@ -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.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <fmtmsg.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/lib/libc/gen/fnmatch.3 b/lib/libc/gen/fnmatch.3
index 5503884665b6..804bc968c1ce 100644
--- a/lib/libc/gen/fnmatch.3
+++ b/lib/libc/gen/fnmatch.3
@@ -27,10 +27,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)fnmatch.3 8.3 (Berkeley) 4/28/95
-.\" $FreeBSD$
-.\"
-.Dd July 18, 2004
+.Dd April 2, 2022
.Dt FNMATCH 3
.Os
.Sh NAME
@@ -139,6 +136,10 @@ conform to
Collating symbol expressions, equivalence class expressions and
character class expressions are not supported.
.Sh HISTORY
+A predecessor to
+.Fn fnmatch ,
+.Fn gmatch ,
+first appeared in the Programmer's Workbench (PWB/UNIX).
The
.Fn fnmatch
function first appeared in
diff --git a/lib/libc/gen/fnmatch.c b/lib/libc/gen/fnmatch.c
index a14905cc0747..fb1829e69502 100644
--- a/lib/libc/gen/fnmatch.c
+++ b/lib/libc/gen/fnmatch.c
@@ -8,7 +8,7 @@
* Guido van Rossum.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -37,10 +37,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)fnmatch.c 8.2 (Berkeley) 4/16/94");
-__FBSDID("$FreeBSD$");
-
/*
* Function fnmatch() as specified in POSIX 1003.2-1992, section B.6.
* Compares a filename or pathname to a pattern.
diff --git a/lib/libc/gen/fpclassify.3 b/lib/libc/gen/fpclassify.3
index a547eeb45466..5a5228463b3c 100644
--- a/lib/libc/gen/fpclassify.3
+++ b/lib/libc/gen/fpclassify.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd January 26, 2005
.Dt FPCLASSIFY 3
.Os
diff --git a/lib/libc/gen/fpclassify.c b/lib/libc/gen/fpclassify.c
index 998656938936..876cb253a742 100644
--- a/lib/libc/gen/fpclassify.c
+++ b/lib/libc/gen/fpclassify.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2003 Mike Barcroft <mike@FreeBSD.org>
* Copyright (c) 2002, 2003 David Schultz <das@FreeBSD.ORG>
@@ -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$
*/
#include <sys/endian.h>
diff --git a/lib/libc/gen/frexp.3 b/lib/libc/gen/frexp.3
index 36f526c5b683..1424ac888ad6 100644
--- a/lib/libc/gen/frexp.3
+++ b/lib/libc/gen/frexp.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)frexp.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd March 4, 2005
.Dt FREXP 3
.Os
diff --git a/lib/libc/gen/frexp.c b/lib/libc/gen/frexp.c
index e65332a0bdde..4207d5d7e9b7 100644
--- a/lib/libc/gen/frexp.c
+++ b/lib/libc/gen/frexp.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2004 David Schultz <das@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$
*/
#include <math.h>
diff --git a/lib/libc/gen/fstab.c b/lib/libc/gen/fstab.c
index 3813202afb15..ae21b4696883 100644
--- a/lib/libc/gen/fstab.c
+++ b/lib/libc/gen/fstab.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)fstab.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#include <sys/mount.h>
@@ -259,12 +255,8 @@ setfsent(void)
LineNo = 0;
return (1);
}
- if (fsp_set == 0) {
- if (issetugid())
- setfstab(NULL);
- else
- setfstab(getenv("PATH_FSTAB"));
- }
+ if (fsp_set == 0)
+ setfstab(secure_getenv("PATH_FSTAB"));
if ((_fs_fp = fopen(path_fstab, "re")) != NULL) {
LineNo = 0;
return (1);
diff --git a/lib/libc/gen/ftok.3 b/lib/libc/gen/ftok.3
index b819dbd185d4..490d93cc1f67 100644
--- a/lib/libc/gen/ftok.3
+++ b/lib/libc/gen/ftok.3
@@ -22,9 +22,7 @@
.\" 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$
-.Dd July 9, 2009
+.Dd November 28, 2022
.Dt FTOK 3
.Os
.Sh NAME
@@ -33,7 +31,6 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
-.In sys/types.h
.In sys/ipc.h
.Ft key_t
.Fn ftok "const char *path" "int id"
diff --git a/lib/libc/gen/ftok.c b/lib/libc/gen/ftok.c
index 6ea7dadbdd0e..04fa5d464fb0 100644
--- a/lib/libc/gen/ftok.c
+++ b/lib/libc/gen/ftok.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1994 SigmaSoft, Th. Lockert <tholo@sigmasoft.com>
* All rights reserved.
@@ -27,9 +27,6 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ipc.h>
diff --git a/lib/libc/gen/fts-compat.c b/lib/libc/gen/fts-compat.c
index ccdd4f15905b..f87cabf085f7 100644
--- a/lib/libc/gen/fts-compat.c
+++ b/lib/libc/gen/fts-compat.c
@@ -27,14 +27,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.
- *
- * From: @(#)fts.c 8.6 (Berkeley) 8/14/94
* From: $OpenBSD: fts.c,v 1.22 1999/10/03 19:22:22 millert Exp $
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#define _WANT_FREEBSD11_STATFS
@@ -610,6 +605,19 @@ __fts_set_clientptr_44bsd(FTS *sp, void *clientptr)
sp->fts_clientptr = clientptr;
}
+static struct freebsd11_dirent *
+fts_safe_readdir(DIR *dirp, int *readdir_errno)
+{
+ struct freebsd11_dirent *ret;
+
+ errno = 0;
+ if (!dirp)
+ return (NULL);
+ ret = freebsd11_readdir(dirp);
+ *readdir_errno = errno;
+ return (ret);
+}
+
/*
* This is the tricky part -- do not casually change *anything* in here. The
* idea is to build the linked list of entries that are used by fts_children
@@ -634,7 +642,7 @@ fts_build(FTS *sp, int type)
DIR *dirp;
void *oldaddr;
int cderrno, descend, len, level, maxlen, nlinks, oflag, saved_errno,
- nostat, doadjust, dnamlen;
+ nostat, doadjust, dnamlen, readdir_errno;
char *cp;
/* Set current node pointer. */
@@ -738,8 +746,9 @@ fts_build(FTS *sp, int type)
/* Read the directory, attaching each entry to the `link' pointer. */
doadjust = 0;
+ readdir_errno = 0;
for (head = tail = NULL, nitems = 0;
- dirp && (dp = freebsd11_readdir(dirp));) {
+ (dp = fts_safe_readdir(dirp, &readdir_errno));) {
dnamlen = dp->d_namlen;
if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name))
continue;
@@ -839,6 +848,16 @@ mem1: saved_errno = errno;
}
++nitems;
}
+
+ if (readdir_errno) {
+ cur->fts_errno = readdir_errno;
+ /*
+ * If we've not read any items yet, treat
+ * the error as if we can't access the dir.
+ */
+ cur->fts_info = nitems ? FTS_ERR : FTS_DNR;
+ }
+
if (dirp)
(void)closedir(dirp);
@@ -877,7 +896,8 @@ mem1: saved_errno = errno;
/* If didn't find anything, return NULL. */
if (!nitems) {
- if (type == BREAD)
+ if (type == BREAD &&
+ cur->fts_info != FTS_DNR && cur->fts_info != FTS_ERR)
cur->fts_info = FTS_DP;
return (NULL);
}
diff --git a/lib/libc/gen/fts-compat.h b/lib/libc/gen/fts-compat.h
index 6367ec9ebc4b..d522e3befedb 100644
--- a/lib/libc/gen/fts-compat.h
+++ b/lib/libc/gen/fts-compat.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_
diff --git a/lib/libc/gen/fts-compat11.c b/lib/libc/gen/fts-compat11.c
index 288351d2008b..0351ce5ac690 100644
--- a/lib/libc/gen/fts-compat11.c
+++ b/lib/libc/gen/fts-compat11.c
@@ -25,14 +25,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.
- *
- * From: @(#)fts.c 8.6 (Berkeley) 8/14/94
* From: $OpenBSD: fts.c,v 1.22 1999/10/03 19:22:22 millert Exp $
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#define _WANT_FREEBSD11_STATFS
@@ -607,6 +602,19 @@ freebsd11_fts_set_clientptr(FTS11 *sp, void *clientptr)
sp->fts_clientptr = clientptr;
}
+static struct freebsd11_dirent *
+fts_safe_readdir(DIR *dirp, int *readdir_errno)
+{
+ struct freebsd11_dirent *ret;
+
+ errno = 0;
+ if (!dirp)
+ return (NULL);
+ ret = freebsd11_readdir(dirp);
+ *readdir_errno = errno;
+ return (ret);
+}
+
/*
* This is the tricky part -- do not casually change *anything* in here. The
* idea is to build the linked list of entries that are used by fts_children
@@ -630,7 +638,8 @@ fts_build(FTS11 *sp, int type)
DIR *dirp;
void *oldaddr;
char *cp;
- int cderrno, descend, oflag, saved_errno, nostat, doadjust;
+ int cderrno, descend, oflag, saved_errno, nostat, doadjust,
+ readdir_errno;
long level;
long nlinks; /* has to be signed because -1 is a magic value */
size_t dnamlen, len, maxlen, nitems;
@@ -736,8 +745,9 @@ fts_build(FTS11 *sp, int type)
/* Read the directory, attaching each entry to the `link' pointer. */
doadjust = 0;
+ readdir_errno = 0;
for (head = tail = NULL, nitems = 0;
- dirp && (dp = freebsd11_readdir(dirp));) {
+ (dp = fts_safe_readdir(dirp, &readdir_errno));) {
dnamlen = dp->d_namlen;
if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name))
continue;
@@ -823,6 +833,16 @@ mem1: saved_errno = errno;
}
++nitems;
}
+
+ if (readdir_errno) {
+ cur->fts_errno = readdir_errno;
+ /*
+ * If we've not read any items yet, treat
+ * the error as if we can't access the dir.
+ */
+ cur->fts_info = nitems ? FTS_ERR : FTS_DNR;
+ }
+
if (dirp)
(void)closedir(dirp);
@@ -859,7 +879,8 @@ mem1: saved_errno = errno;
/* If didn't find anything, return NULL. */
if (!nitems) {
- if (type == BREAD)
+ if (type == BREAD &&
+ cur->fts_info != FTS_DNR && cur->fts_info != FTS_ERR)
cur->fts_info = FTS_DP;
return (NULL);
}
diff --git a/lib/libc/gen/fts-compat11.h b/lib/libc/gen/fts-compat11.h
index 52c0637395fb..f53e312374c5 100644
--- a/lib/libc/gen/fts-compat11.h
+++ b/lib/libc/gen/fts-compat11.h
@@ -25,9 +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.
- *
- * @(#)fts.h 8.3 (Berkeley) 8/14/94
- * $FreeBSD$
*/
#ifndef _FTS_COPMAT11_H_
diff --git a/lib/libc/gen/fts.3 b/lib/libc/gen/fts.3
index bba6f61094d5..468b14115ec6 100644
--- a/lib/libc/gen/fts.3
+++ b/lib/libc/gen/fts.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)fts.3 8.5 (Berkeley) 4/16/94
-.\" $FreeBSD$
-.\"
.Dd January 12, 2014
.Dt FTS 3
.Os
diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c
index d0705e123775..976edacc361e 100644
--- a/lib/libc/gen/fts.c
+++ b/lib/libc/gen/fts.c
@@ -31,10 +31,6 @@
* $OpenBSD: fts.c,v 1.22 1999/10/03 19:22:22 millert Exp $
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)fts.c 8.6 (Berkeley) 8/14/94");
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#include <sys/mount.h>
@@ -604,6 +600,19 @@ fts_set_clientptr(FTS *sp, void *clientptr)
sp->fts_clientptr = clientptr;
}
+static struct dirent *
+fts_safe_readdir(DIR *dirp, int *readdir_errno)
+{
+ struct dirent *ret;
+
+ errno = 0;
+ if (!dirp)
+ return (NULL);
+ ret = readdir(dirp);
+ *readdir_errno = errno;
+ return (ret);
+}
+
/*
* This is the tricky part -- do not casually change *anything* in here. The
* idea is to build the linked list of entries that are used by fts_children
@@ -627,7 +636,8 @@ fts_build(FTS *sp, int type)
DIR *dirp;
void *oldaddr;
char *cp;
- int cderrno, descend, oflag, saved_errno, nostat, doadjust;
+ int cderrno, descend, oflag, saved_errno, nostat, doadjust,
+ readdir_errno;
long level;
long nlinks; /* has to be signed because -1 is a magic value */
size_t dnamlen, len, maxlen, nitems;
@@ -733,7 +743,9 @@ fts_build(FTS *sp, int type)
/* Read the directory, attaching each entry to the `link' pointer. */
doadjust = 0;
- for (head = tail = NULL, nitems = 0; dirp && (dp = readdir(dirp));) {
+ readdir_errno = 0;
+ for (head = tail = NULL, nitems = 0;
+ (dp = fts_safe_readdir(dirp, &readdir_errno));) {
dnamlen = dp->d_namlen;
if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name))
continue;
@@ -819,6 +831,16 @@ mem1: saved_errno = errno;
}
++nitems;
}
+
+ if (readdir_errno) {
+ cur->fts_errno = readdir_errno;
+ /*
+ * If we've not read any items yet, treat
+ * the error as if we can't access the dir.
+ */
+ cur->fts_info = nitems ? FTS_ERR : FTS_DNR;
+ }
+
if (dirp)
(void)closedir(dirp);
@@ -855,7 +877,8 @@ mem1: saved_errno = errno;
/* If didn't find anything, return NULL. */
if (!nitems) {
- if (type == BREAD)
+ if (type == BREAD &&
+ cur->fts_info != FTS_DNR && cur->fts_info != FTS_ERR)
cur->fts_info = FTS_DP;
return (NULL);
}
diff --git a/lib/libc/gen/ftw-compat11.c b/lib/libc/gen/ftw-compat11.c
index 92ce058726a7..28d6398f6fd8 100644
--- a/lib/libc/gen/ftw-compat11.c
+++ b/lib/libc/gen/ftw-compat11.c
@@ -22,9 +22,6 @@
* From: FreeBSD: head/lib/libc/gen/ftw.c 239151 2012-08-09 15:11:38Z jilles
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
diff --git a/lib/libc/gen/ftw.3 b/lib/libc/gen/ftw.3
index a936e431d882..c9a1d6f1eee9 100644
--- a/lib/libc/gen/ftw.3
+++ b/lib/libc/gen/ftw.3
@@ -18,8 +18,6 @@
.\" Agency (DARPA) and Air Force Research Laboratory, Air Force
.\" Materiel Command, USAF, under agreement number F39502-99-1-0512.
.\"
-.\" $FreeBSD$
-.\"
.Dd March 12, 2020
.Dt FTW 3
.Os
diff --git a/lib/libc/gen/ftw.c b/lib/libc/gen/ftw.c
index 253a29583f36..35557d930bf4 100644
--- a/lib/libc/gen/ftw.c
+++ b/lib/libc/gen/ftw.c
@@ -20,9 +20,6 @@
* Materiel Command, USAF, under agreement number F39502-99-1-0512.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
diff --git a/lib/libc/gen/gen-compat.h b/lib/libc/gen/gen-compat.h
index 728a15a51b18..08e80ede6b6e 100644
--- a/lib/libc/gen/gen-compat.h
+++ b/lib/libc/gen/gen-compat.h
@@ -22,8 +22,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 _GEN_COMPAT_H_
diff --git a/lib/libc/gen/gen-private.h b/lib/libc/gen/gen-private.h
index 034d186de56c..3792a61ff942 100644
--- a/lib/libc/gen/gen-private.h
+++ b/lib/libc/gen/gen-private.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 _GEN_PRIVATE_H_
diff --git a/lib/libc/gen/getbootfile.3 b/lib/libc/gen/getbootfile.3
index b68b226a531b..a857b3e8859e 100644
--- a/lib/libc/gen/getbootfile.3
+++ b/lib/libc/gen/getbootfile.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" From: @(#)gethostname.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd September 23, 1994
.Dt GETBOOTFILE 3
.Os
diff --git a/lib/libc/gen/getbootfile.c b/lib/libc/gen/getbootfile.c
index 983199471792..6250e3e2509b 100644
--- a/lib/libc/gen/getbootfile.c
+++ b/lib/libc/gen/getbootfile.c
@@ -27,13 +27,8 @@
* 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: @(#)gethostname.c 8.1 (Berkeley) 6/4/93
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/sysctl.h>
diff --git a/lib/libc/gen/getbsize.3 b/lib/libc/gen/getbsize.3
index acbe409a8456..1d9d43fdfffb 100644
--- a/lib/libc/gen/getbsize.3
+++ b/lib/libc/gen/getbsize.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)getbsize.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd June 11, 2017
.Dt GETBSIZE 3
.Os
diff --git a/lib/libc/gen/getbsize.c b/lib/libc/gen/getbsize.c
index e91c12282ddf..efcabea663a0 100644
--- a/lib/libc/gen/getbsize.c
+++ b/lib/libc/gen/getbsize.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)getbsize.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/lib/libc/gen/getcap.3 b/lib/libc/gen/getcap.3
index 3f2428d7996f..00c7edd8026f 100644
--- a/lib/libc/gen/getcap.3
+++ b/lib/libc/gen/getcap.3
@@ -28,9 +28,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)getcap.3 8.4 (Berkeley) 5/13/94
-.\" $FreeBSD$
-.\"
.Dd March 22, 2002
.Dt GETCAP 3
.Os
diff --git a/lib/libc/gen/getcap.c b/lib/libc/gen/getcap.c
index 364423fff0e0..cfb81ed0d065 100644
--- a/lib/libc/gen/getcap.c
+++ b/lib/libc/gen/getcap.c
@@ -32,10 +32,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)getcap.c 8.3 (Berkeley) 3/25/94");
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/types.h>
diff --git a/lib/libc/gen/getcontext.3 b/lib/libc/gen/getcontext.3
index f093f674edd1..db6d5ddcb00d 100644
--- a/lib/libc/gen/getcontext.3
+++ b/lib/libc/gen/getcontext.3
@@ -33,8 +33,6 @@
.\" THE USE OF THIS SOFTWARE, EVEN IF PACKET DESIGN IS ADVISED OF
.\" THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd March 23, 2020
.Dt GETCONTEXT 3
.Os
diff --git a/lib/libc/gen/getcwd.3 b/lib/libc/gen/getcwd.3
index 84190c319a2f..43d7718e92d6 100644
--- a/lib/libc/gen/getcwd.3
+++ b/lib/libc/gen/getcwd.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)getcwd.3 8.2 (Berkeley) 12/11/93
-.\" $FreeBSD$
-.\"
.Dd April 17, 2010
.Dt GETCWD 3
.Os
diff --git a/lib/libc/gen/getcwd.c b/lib/libc/gen/getcwd.c
index 42a6c204ba06..191fa50a599b 100644
--- a/lib/libc/gen/getcwd.c
+++ b/lib/libc/gen/getcwd.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)getcwd.c 8.5 (Berkeley) 2/7/95");
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#include <sys/stat.h>
diff --git a/lib/libc/gen/getdiskbyname.3 b/lib/libc/gen/getdiskbyname.3
index 3fc10d2180c8..8de4f3976dd2 100644
--- a/lib/libc/gen/getdiskbyname.3
+++ b/lib/libc/gen/getdiskbyname.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)getdiskbyname.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd June 4, 1993
.Dt GETDISKBYNAME 3
.Os
diff --git a/lib/libc/gen/getdomainname.3 b/lib/libc/gen/getdomainname.3
index 16801104d561..47fb139ac23c 100644
--- a/lib/libc/gen/getdomainname.3
+++ b/lib/libc/gen/getdomainname.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)gethostname.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd May 6, 1994
.Dt GETDOMAINNAME 3
.Os
diff --git a/lib/libc/gen/getdomainname.c b/lib/libc/gen/getdomainname.c
index 3df611b7e4c7..a9527b36a247 100644
--- a/lib/libc/gen/getdomainname.c
+++ b/lib/libc/gen/getdomainname.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)gethostname.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/sysctl.h>
diff --git a/lib/libc/gen/getentropy.3 b/lib/libc/gen/getentropy.3
index 83812c6c7a92..0a3ba3e25610 100644
--- a/lib/libc/gen/getentropy.3
+++ b/lib/libc/gen/getentropy.3
@@ -15,8 +15,6 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.\" $FreeBSD$
-.\"
.Dd February 24, 2018
.Dt GETENTROPY 3
.Os
diff --git a/lib/libc/gen/getentropy.c b/lib/libc/gen/getentropy.c
index 2db3b8030243..38cd515e74d7 100644
--- a/lib/libc/gen/getentropy.c
+++ b/lib/libc/gen/getentropy.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018 Conrad Meyer <cem@FreeBSD.org>
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/random.h>
#include <sys/sysctl.h>
diff --git a/lib/libc/gen/getfsent.3 b/lib/libc/gen/getfsent.3
index c5694ab08c2b..4783c7469910 100644
--- a/lib/libc/gen/getfsent.3
+++ b/lib/libc/gen/getfsent.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)getfsent.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd April 7, 2003
.Dt GETFSENT 3
.Os
diff --git a/lib/libc/gen/getgrent.3 b/lib/libc/gen/getgrent.3
index d89ac631eff3..e4a703f3bfad 100644
--- a/lib/libc/gen/getgrent.3
+++ b/lib/libc/gen/getgrent.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" From: @(#)getgrent.3 8.2 (Berkeley) 4/19/94
-.\" $FreeBSD$
-.\"
.Dd July 31, 2016
.Dt GETGRENT 3
.Os
diff --git a/lib/libc/gen/getgrent.c b/lib/libc/gen/getgrent.c
index 5832cb8c6799..508e3d63eb60 100644
--- a/lib/libc/gen/getgrent.c
+++ b/lib/libc/gen/getgrent.c
@@ -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.
@@ -32,9 +32,6 @@
* SUCH DAMAGE.
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#ifdef YP
@@ -210,12 +207,11 @@ static int
grp_marshal_func(char *buffer, size_t *buffer_size, void *retval, va_list ap,
void *cache_mdata)
{
- char *name;
- gid_t gid;
+ char *name __unused;
+ gid_t gid __unused;
struct group *grp;
- char *orig_buf;
- size_t orig_buf_size;
-
+ char *orig_buf __unused;
+ size_t orig_buf_size __unused;
struct group new_grp;
size_t desired_size, size, mem_size;
char *p, **mem;
@@ -305,8 +301,8 @@ static int
grp_unmarshal_func(char *buffer, size_t buffer_size, void *retval, va_list ap,
void *cache_mdata)
{
- char *name;
- gid_t gid;
+ char *name __unused;
+ gid_t gid __unused;
struct group *grp;
char *orig_buf;
size_t orig_buf_size;
diff --git a/lib/libc/gen/getgrouplist.3 b/lib/libc/gen/getgrouplist.3
index 4982ebba2696..e9a980f99751 100644
--- a/lib/libc/gen/getgrouplist.3
+++ b/lib/libc/gen/getgrouplist.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)getgrouplist.3 8.1 (Berkeley) 6/9/93
-.\" $FreeBSD$
-.\"
.Dd October 26, 2014
.Dt GETGROUPLIST 3
.Os
diff --git a/lib/libc/gen/getgrouplist.c b/lib/libc/gen/getgrouplist.c
index c3c4af5f7cdb..1c29b249f8c4 100644
--- a/lib/libc/gen/getgrouplist.c
+++ b/lib/libc/gen/getgrouplist.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)getgrouplist.c 8.2 (Berkeley) 12/8/94");
-__FBSDID("$FreeBSD$");
-
/*
* get credential
*/
diff --git a/lib/libc/gen/gethostname.3 b/lib/libc/gen/gethostname.3
index 00a67c77fb0f..99e723fa9595 100644
--- a/lib/libc/gen/gethostname.3
+++ b/lib/libc/gen/gethostname.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)gethostname.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd July 13, 2020
.Dt GETHOSTNAME 3
.Os
diff --git a/lib/libc/gen/gethostname.c b/lib/libc/gen/gethostname.c
index 8af10d6d0624..36e988c91ecc 100644
--- a/lib/libc/gen/gethostname.c
+++ b/lib/libc/gen/gethostname.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)gethostname.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/sysctl.h>
diff --git a/lib/libc/gen/getloadavg.3 b/lib/libc/gen/getloadavg.3
index 0e240be2d3f9..42a9f511c9ef 100644
--- a/lib/libc/gen/getloadavg.3
+++ b/lib/libc/gen/getloadavg.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)getloadavg.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd June 4, 1993
.Dt GETLOADAVG 3
.Os
diff --git a/lib/libc/gen/getloadavg.c b/lib/libc/gen/getloadavg.c
index a0a707b6db9d..4f6c23627f0e 100644
--- a/lib/libc/gen/getloadavg.c
+++ b/lib/libc/gen/getloadavg.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)getloadavg.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/time.h>
#include <sys/resource.h>
diff --git a/lib/libc/gen/getlogin.c b/lib/libc/gen/getlogin.c
index a8bc2fd0688f..55ed83795f7d 100644
--- a/lib/libc/gen/getlogin.c
+++ b/lib/libc/gen/getlogin.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)getlogin.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <errno.h>
#include <pwd.h>
diff --git a/lib/libc/gen/getmntinfo-compat11.c b/lib/libc/gen/getmntinfo-compat11.c
index b18da03133fd..d5c308b387a0 100644
--- a/lib/libc/gen/getmntinfo-compat11.c
+++ b/lib/libc/gen/getmntinfo-compat11.c
@@ -25,13 +25,8 @@
* 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: @(#)getmntinfo.c 8.1 (Berkeley) 6/4/93
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/ucred.h>
#define _WANT_FREEBSD11_STATFS
diff --git a/lib/libc/gen/getmntinfo.3 b/lib/libc/gen/getmntinfo.3
index d8821258b6e5..2bbe436078d6 100644
--- a/lib/libc/gen/getmntinfo.3
+++ b/lib/libc/gen/getmntinfo.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)getmntinfo.3 8.1 (Berkeley) 6/9/93
-.\" $FreeBSD$
-.\"
.Dd December 27, 2016
.Dt GETMNTINFO 3
.Os
diff --git a/lib/libc/gen/getmntinfo.c b/lib/libc/gen/getmntinfo.c
index 250be99c27c5..3c224ef27d76 100644
--- a/lib/libc/gen/getmntinfo.c
+++ b/lib/libc/gen/getmntinfo.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)getmntinfo.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/ucred.h>
#include <sys/mount.h>
diff --git a/lib/libc/gen/getnetgrent.3 b/lib/libc/gen/getnetgrent.3
index 29e0ce3265bc..be2e3cd1cdd5 100644
--- a/lib/libc/gen/getnetgrent.3
+++ b/lib/libc/gen/getnetgrent.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)getnetgrent.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd June 5, 2016
.Dt GETNETGRENT 3
.Os
diff --git a/lib/libc/gen/getnetgrent.c b/lib/libc/gen/getnetgrent.c
index 733fe024ee28..7c92bc2ce9a9 100644
--- a/lib/libc/gen/getnetgrent.c
+++ b/lib/libc/gen/getnetgrent.c
@@ -32,10 +32,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)getnetgrent.c 8.2 (Berkeley) 4/27/95");
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <ctype.h>
diff --git a/lib/libc/gen/getosreldate.3 b/lib/libc/gen/getosreldate.3
index 0bb96d138c8f..6ce5a11d131c 100644
--- a/lib/libc/gen/getosreldate.3
+++ b/lib/libc/gen/getosreldate.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd June 13, 2018
.Dt GETOSRELDATE 3
.Os
diff --git a/lib/libc/gen/getosreldate.c b/lib/libc/gen/getosreldate.c
index 6a54df907546..edd978973ade 100644
--- a/lib/libc/gen/getosreldate.c
+++ b/lib/libc/gen/getosreldate.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)gethostid.c 8.1 (Berkeley) 6/2/93");
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/sysctl.h>
diff --git a/lib/libc/gen/getpagesize.3 b/lib/libc/gen/getpagesize.3
deleted file mode 100644
index eeea6854a258..000000000000
--- a/lib/libc/gen/getpagesize.3
+++ /dev/null
@@ -1,61 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)getpagesize.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd April 26, 2017
-.Dt GETPAGESIZE 3
-.Os
-.Sh NAME
-.Nm getpagesize
-.Nd get system page size
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn getpagesize void
-.Sh DESCRIPTION
-The
-.Fn getpagesize
-function
-returns the number of bytes in a page.
-Page granularity is the granularity of many of the memory
-management calls.
-.Pp
-The page size is a system
-page size and may not be the same as the underlying
-hardware page size.
-.Sh SEE ALSO
-.Xr pagesize 1 ,
-.Xr sbrk 2
-.Sh HISTORY
-The
-.Fn getpagesize
-function appeared in
-.Bx 4.2 .
diff --git a/lib/libc/gen/getpagesize.c b/lib/libc/gen/getpagesize.c
deleted file mode 100644
index b722bd27c0a3..000000000000
--- a/lib/libc/gen/getpagesize.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-3-Clause
- *
- * Copyright (c) 1989, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- */
-
-#include <sys/cdefs.h>
-__SCCSID("@(#)getpagesize.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/sysctl.h>
-
-#include <errno.h>
-#include <link.h>
-#include <unistd.h>
-
-#include "libc_private.h"
-
-/*
- * This is unlikely to change over the running time of any
- * program, so we cache the result to save some syscalls.
- *
- * NB: This function may be called from malloc(3) at initialization
- * NB: so must not result in a malloc(3) related call!
- */
-
-int
-getpagesize(void)
-{
- int mib[2];
- static int value;
- size_t size;
- int error;
-
- if (value != 0)
- return (value);
-
- error = _elf_aux_info(AT_PAGESZ, &value, sizeof(value));
- if (error == 0 && value != 0)
- return (value);
-
- mib[0] = CTL_HW;
- mib[1] = HW_PAGESIZE;
- size = sizeof value;
- if (sysctl(mib, nitems(mib), &value, &size, NULL, 0) == -1)
- return (PAGE_SIZE);
-
- return (value);
-}
diff --git a/lib/libc/gen/getpagesizes.3 b/lib/libc/gen/getpagesizes.3
deleted file mode 100644
index 52fa866821f2..000000000000
--- a/lib/libc/gen/getpagesizes.3
+++ /dev/null
@@ -1,99 +0,0 @@
-.\" Copyright (c) 2009 Alan L. Cox <alc@cs.rice.edu>
-.\" All rights reserved.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd September 21, 2009
-.Dt GETPAGESIZES 3
-.Os
-.Sh NAME
-.Nm getpagesizes
-.Nd "get system page sizes"
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/mman.h
-.Ft int
-.Fn getpagesizes "size_t pagesize[]" "int nelem"
-.Sh DESCRIPTION
-The
-.Fn getpagesizes
-function retrieves page size information from the system.
-When it is called with
-.Fa pagesize
-specified as
-.Dv NULL
-and
-.Fa nelem
-specified as 0, it returns the number of distinct page sizes that are
-supported by the system.
-Otherwise, it assigns up to
-.Fa nelem
-of the system-supported page sizes to consecutive elements of the
-array referenced by
-.Fa pagesize .
-These page sizes are expressed in bytes.
-In this case,
-.Fn getpagesizes
-returns the number of such page sizes that it assigned to the array.
-.Sh RETURN VALUES
-If successful, the
-.Fn getpagesizes
-function returns either the number of page sizes that are supported by
-the system or the number of supported page sizes that it assigned to
-the array referenced by
-.Fa pagesize .
-Otherwise, it returns the value\~\-1 and sets
-.Va errno
-to indicate the error.
-.Sh ERRORS
-The
-.Fn getpagesizes
-function will succeed unless:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Fa pagesize
-argument is
-.Dv NULL
-and the
-.Fa nelem
-argument is non-zero.
-.It Bq Er EINVAL
-The
-.Fa nelem
-argument is less than zero.
-.El
-.Sh SEE ALSO
-.Xr getpagesize 3
-.Sh HISTORY
-The
-.Fn getpagesizes
-function first appeared in Solaris 9.
-This manual page was written in conjunction with a new but compatible
-implementation that was first released in
-.Fx 7.3 .
-.Sh AUTHORS
-This manual page was written by
-.An Alan L. Cox Aq Mt alc@cs.rice.edu .
diff --git a/lib/libc/gen/getpagesizes.c b/lib/libc/gen/getpagesizes.c
deleted file mode 100644
index b138f6a49158..000000000000
--- a/lib/libc/gen/getpagesizes.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 2009 Alan L. Cox <alc@cs.rice.edu>
- * All rights reserved.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/mman.h>
-#include <sys/sysctl.h>
-
-#include <errno.h>
-#include <link.h>
-
-#include "libc_private.h"
-
-/*
- * Retrieves page size information from the system. Specifically, returns the
- * number of distinct page sizes that are supported by the system, if
- * "pagesize" is NULL and "nelem" is 0. Otherwise, assigns up to "nelem" of
- * the system-supported page sizes to consecutive elements of the array
- * referenced by "pagesize", and returns the number of such page sizes that it
- * assigned to the array. These page sizes are expressed in bytes.
- *
- * The implementation of this function does not directly or indirectly call
- * malloc(3) or any other dynamic memory allocator that may itself call this
- * function.
- */
-int
-getpagesizes(size_t pagesize[], int nelem)
-{
- static u_long ps[MAXPAGESIZES];
- static int nops;
- size_t size;
- int error, i;
-
- if (nelem < 0 || (nelem > 0 && pagesize == NULL)) {
- errno = EINVAL;
- return (-1);
- }
- /* Cache the result of the sysctl(2). */
- if (nops == 0) {
- error = _elf_aux_info(AT_PAGESIZES, ps, sizeof(ps));
- size = sizeof(ps);
- if (error != 0 || ps[0] == 0) {
- if (sysctlbyname("hw.pagesizes", ps, &size, NULL, 0)
- == -1)
- return (-1);
- }
- /* Count the number of page sizes that are supported. */
- nops = size / sizeof(ps[0]);
- while (nops > 0 && ps[nops - 1] == 0)
- nops--;
- }
- if (pagesize == NULL)
- return (nops);
- /* Return up to "nelem" page sizes from the cached result. */
- if (nelem > nops)
- nelem = nops;
- for (i = 0; i < nelem; i++)
- pagesize[i] = ps[i];
- return (nelem);
-}
diff --git a/lib/libc/gen/getpass.3 b/lib/libc/gen/getpass.3
index 87f2b12b36d3..c88e072e1900 100644
--- a/lib/libc/gen/getpass.3
+++ b/lib/libc/gen/getpass.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)getpass.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd June 4, 1993
.Dt GETPASS 3
.Os
diff --git a/lib/libc/gen/getpeereid.3 b/lib/libc/gen/getpeereid.3
index 3c99eeda37f0..8e3b763f716a 100644
--- a/lib/libc/gen/getpeereid.3
+++ b/lib/libc/gen/getpeereid.3
@@ -23,9 +23,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd February 3, 2017
+.Dd November 16, 2023
.Dt GETPEEREID 3
.Os
.Sh NAME
@@ -34,7 +32,6 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
-.In sys/types.h
.In unistd.h
.Ft int
.Fn getpeereid "int s" "uid_t *euid" "gid_t *egid"
@@ -47,7 +44,7 @@ peer connected to a
socket.
The argument
.Fa s
-must be a
+must be a connected
.Ux Ns -domain
socket
.Pq Xr unix 4
diff --git a/lib/libc/gen/getpeereid.c b/lib/libc/gen/getpeereid.c
index 86396d359ba3..444dd2664cc4 100644
--- a/lib/libc/gen/getpeereid.c
+++ b/lib/libc/gen/getpeereid.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2001 Dima Dorfman.
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#include <sys/socket.h>
diff --git a/lib/libc/gen/getprogname.3 b/lib/libc/gen/getprogname.3
index f43a7b8c6b69..7bc2c50d79c4 100644
--- a/lib/libc/gen/getprogname.3
+++ b/lib/libc/gen/getprogname.3
@@ -29,8 +29,6 @@
.\" (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$
-.\"
.Dd April 18, 2021
.Dt GETPROGNAME 3
.Os
diff --git a/lib/libc/gen/getprogname.c b/lib/libc/gen/getprogname.c
index fd51d1322517..54e59b6ac412 100644
--- a/lib/libc/gen/getprogname.c
+++ b/lib/libc/gen/getprogname.c
@@ -1,6 +1,3 @@
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <stdlib.h>
#include "un-namespace.h"
diff --git a/lib/libc/gen/getpwent.3 b/lib/libc/gen/getpwent.3
index d7043d814802..486f0cab2399 100644
--- a/lib/libc/gen/getpwent.3
+++ b/lib/libc/gen/getpwent.3
@@ -25,10 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" From: @(#)getpwent.3 8.2 (Berkeley) 12/11/93
-.\" $FreeBSD$
-.\"
-.Dd April 16, 2003
+.Dd November 28, 2022
.Dt GETPWENT 3
.Os
.Sh NAME
@@ -45,7 +42,6 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
-.In sys/types.h
.In pwd.h
.Ft struct passwd *
.Fn getpwent void
diff --git a/lib/libc/gen/getpwent.c b/lib/libc/gen/getpwent.c
index bc1d341fd3ad..1cbf97e7eb52 100644
--- a/lib/libc/gen/getpwent.c
+++ b/lib/libc/gen/getpwent.c
@@ -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.
@@ -32,9 +32,6 @@
* SUCH DAMAGE.
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#ifdef YP
@@ -257,11 +254,11 @@ static int
pwd_marshal_func(char *buffer, size_t *buffer_size, void *retval, va_list ap,
void *cache_mdata)
{
- char *name;
- uid_t uid;
+ char *name __unused;
+ uid_t uid __unused;
struct passwd *pwd;
- char *orig_buf;
- size_t orig_buf_size;
+ char *orig_buf __unused;
+ size_t orig_buf_size __unused;
struct passwd new_pwd;
size_t desired_size, size;
@@ -361,8 +358,8 @@ static int
pwd_unmarshal_func(char *buffer, size_t buffer_size, void *retval, va_list ap,
void *cache_mdata)
{
- char *name;
- uid_t uid;
+ char *name __unused;
+ uid_t uid __unused;
struct passwd *pwd;
char *orig_buf;
size_t orig_buf_size;
diff --git a/lib/libc/gen/getttyent.3 b/lib/libc/gen/getttyent.3
index 79b765163556..bf38f417ac58 100644
--- a/lib/libc/gen/getttyent.3
+++ b/lib/libc/gen/getttyent.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)getttyent.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd November 17, 1996
.Dt GETTTYENT 3
.Os
diff --git a/lib/libc/gen/getttyent.c b/lib/libc/gen/getttyent.c
index 4b152095a946..3c92f603ff06 100644
--- a/lib/libc/gen/getttyent.c
+++ b/lib/libc/gen/getttyent.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)getttyent.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/sysctl.h>
diff --git a/lib/libc/gen/getusershell.3 b/lib/libc/gen/getusershell.3
index 4fe2027a2100..728e87c9d56a 100644
--- a/lib/libc/gen/getusershell.3
+++ b/lib/libc/gen/getusershell.3
@@ -27,9 +27,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)getusershell.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd January 16, 1999
.Dt GETUSERSHELL 3
.Os
diff --git a/lib/libc/gen/getusershell.c b/lib/libc/gen/getusershell.c
index 7ea09df4d847..26c6e326e94d 100644
--- a/lib/libc/gen/getusershell.c
+++ b/lib/libc/gen/getusershell.c
@@ -30,9 +30,7 @@
*/
#include <sys/cdefs.h>
-__SCCSID("@(#)getusershell.c 8.1 (Berkeley) 6/4/93");
__RCSID("$NetBSD: getusershell.c,v 1.17 1999/01/25 01:09:34 lukem Exp $");
-__FBSDID("$FreeBSD$");
#include "namespace.h"
#include <sys/param.h>
diff --git a/lib/libc/gen/getutxent.3 b/lib/libc/gen/getutxent.3
index 85c37b16e0fc..96d376dc29bc 100644
--- a/lib/libc/gen/getutxent.3
+++ b/lib/libc/gen/getutxent.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd October 27, 2011
.Dt GETUTXENT 3
.Os
diff --git a/lib/libc/gen/getutxent.c b/lib/libc/gen/getutxent.c
index 664498126f13..d0c307538930 100644
--- a/lib/libc/gen/getutxent.c
+++ b/lib/libc/gen/getutxent.c
@@ -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.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/endian.h>
#include <sys/param.h>
diff --git a/lib/libc/gen/getvfsbyname.3 b/lib/libc/gen/getvfsbyname.3
index 656d671cd0e1..23036429b27e 100644
--- a/lib/libc/gen/getvfsbyname.3
+++ b/lib/libc/gen/getvfsbyname.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)kvm_getvfsbyname.3 8.3 (Berkeley) 5/4/95
-.\" $FreeBSD$
-.\"
.Dd August 16, 2018
.Dt GETVFSBYNAME 3
.Os
diff --git a/lib/libc/gen/getvfsbyname.c b/lib/libc/gen/getvfsbyname.c
index 91f4490bf504..b782e5793334 100644
--- a/lib/libc/gen/getvfsbyname.c
+++ b/lib/libc/gen/getvfsbyname.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)kvm_getvfsbyname.c 8.1 (Berkeley) 4/3/95");
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/sysctl.h>
diff --git a/lib/libc/gen/glob-compat11.c b/lib/libc/gen/glob-compat11.c
index 76a4553c922c..cdae52056f61 100644
--- a/lib/libc/gen/glob-compat11.c
+++ b/lib/libc/gen/glob-compat11.c
@@ -33,14 +33,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.
- *
- * From: @(#)glob.c 8.3 (Berkeley) 10/13/93
* From: FreeBSD: head/lib/libc/gen/glob.c 317913 2017-05-07 19:52:56Z jilles
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#define _WANT_FREEBSD11_STAT
#include <sys/stat.h>
@@ -422,8 +417,7 @@ globtilde(const Char *pattern, Char *patbuf, size_t patbuf_len, glob11_t *pglob)
* we're not running setuid or setgid) and then trying
* the password file
*/
- if (issetugid() != 0 ||
- (h = getenv("HOME")) == NULL) {
+ if ((h = secure_getenv("HOME")) == NULL) {
if (((h = getlogin()) != NULL &&
(pwd = getpwnam(h)) != NULL) ||
(pwd = getpwuid(getuid())) != NULL)
diff --git a/lib/libc/gen/glob-compat11.h b/lib/libc/gen/glob-compat11.h
index d43086f819c5..713e1a454b7f 100644
--- a/lib/libc/gen/glob-compat11.h
+++ b/lib/libc/gen/glob-compat11.h
@@ -28,16 +28,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.
- *
- * @(#)glob.h 8.1 (Berkeley) 6/2/93
- * from: $FreeBSD$
- * $FreeBSD$
*/
#ifndef _GLOB_COMPAT11_H_
#define _GLOB_COMPAT11_H_
-#include <sys/cdefs.h>
#include <sys/types.h>
#include <glob.h>
diff --git a/lib/libc/gen/glob.3 b/lib/libc/gen/glob.3
index d8b1b65d9c59..006e8decb3db 100644
--- a/lib/libc/gen/glob.3
+++ b/lib/libc/gen/glob.3
@@ -27,9 +27,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)glob.3 8.3 (Berkeley) 4/16/94
-.\" $FreeBSD$
-.\"
.Dd December 20, 2011
.Dt GLOB 3
.Os
diff --git a/lib/libc/gen/glob.c b/lib/libc/gen/glob.c
index b014c8b716fa..7a988196549a 100644
--- a/lib/libc/gen/glob.c
+++ b/lib/libc/gen/glob.c
@@ -8,7 +8,7 @@
* Guido van Rossum.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -37,10 +37,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)glob.c 8.3 (Berkeley) 10/13/93");
-__FBSDID("$FreeBSD$");
-
/*
* glob(3) -- a superset of the one defined in POSIX 1003.2.
*
@@ -453,8 +449,7 @@ globtilde(const Char *pattern, Char *patbuf, size_t patbuf_len, glob_t *pglob)
* we're not running setuid or setgid) and then trying
* the password file
*/
- if (issetugid() != 0 ||
- (h = getenv("HOME")) == NULL) {
+ if ((h = secure_getenv("HOME")) == NULL) {
if (((h = getlogin()) != NULL &&
(pwd = getpwnam(h)) != NULL) ||
(pwd = getpwuid(getuid())) != NULL)
diff --git a/lib/libc/gen/initgroups.3 b/lib/libc/gen/initgroups.3
index 179e6da4f57d..03bd07494fc9 100644
--- a/lib/libc/gen/initgroups.3
+++ b/lib/libc/gen/initgroups.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)initgroups.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd October 26, 2014
.Dt INITGROUPS 3
.Os
diff --git a/lib/libc/gen/initgroups.c b/lib/libc/gen/initgroups.c
index 882dadbeb9ab..b6697dd7ed8f 100644
--- a/lib/libc/gen/initgroups.c
+++ b/lib/libc/gen/initgroups.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)initgroups.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include "namespace.h"
diff --git a/lib/libc/gen/isatty.c b/lib/libc/gen/isatty.c
index de55b67ac0d0..8844f3121538 100644
--- a/lib/libc/gen/isatty.c
+++ b/lib/libc/gen/isatty.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)isatty.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include <termios.h>
#include <unistd.h>
diff --git a/lib/libc/gen/isgreater.3 b/lib/libc/gen/isgreater.3
index 27e958f19b09..279867a2ba36 100644
--- a/lib/libc/gen/isgreater.3
+++ b/lib/libc/gen/isgreater.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd February 12, 2003
.Dt ISGREATER 3
.Os
diff --git a/lib/libc/gen/isinf.c b/lib/libc/gen/isinf.c
index ec62762c641a..3f4fdacb791f 100644
--- a/lib/libc/gen/isinf.c
+++ b/lib/libc/gen/isinf.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2004 David Schultz <das@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$
*/
#include <machine/float.h>
diff --git a/lib/libc/gen/isnan.c b/lib/libc/gen/isnan.c
index ea84c7ebe403..e6e2b16a92ce 100644
--- a/lib/libc/gen/isnan.c
+++ b/lib/libc/gen/isnan.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2004 David Schultz <das@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$
*/
#include <math.h>
diff --git a/lib/libc/gen/jrand48.c b/lib/libc/gen/jrand48.c
index 5aab1e1bec9e..0a9f780a9e5c 100644
--- a/lib/libc/gen/jrand48.c
+++ b/lib/libc/gen/jrand48.c
@@ -11,9 +11,6 @@
* to anyone/anything when using this software.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdint.h>
#include "rand48.h"
diff --git a/lib/libc/amd64/gen/_get_tp.c b/lib/libc/gen/kqueue1.c
index 3c74b9e769c1..b27a8f63019e 100644
--- a/lib/libc/amd64/gen/_get_tp.c
+++ b/lib/libc/gen/kqueue1.c
@@ -1,9 +1,7 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * Copyright (c) 2023 The FreeBSD Foundation
*
- * Copyright (c) 2021 The FreeBSD Foundation
- *
- * This software were developed by Konstantin Belousov
+ * This software were developed by Konstantin Belousov <kib@FreeBSD.org>
* under sponsorship from the FreeBSD Foundation.
*
* Redistribution and use in source and binary forms, with or without
@@ -28,19 +26,27 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <string.h>
-#include <stdint.h>
-#include "libc_private.h"
+#include <sys/param.h>
+#include <sys/event.h>
+#include <errno.h>
+#include <fcntl.h>
-void *
-_get_tp(void)
+/*
+ * Provide some NetBSD compatibility. They support a set of O_*
+ * flags, we only carry O_CLOEXEC, and accept but ignore O_NONBLOCK.
+ */
+int
+kqueue1(int openflags)
{
- void **res;
+ u_int flags;
+
+ if ((openflags & ~(O_CLOEXEC | O_NONBLOCK)) != 0) {
+ errno = EINVAL;
+ return (-1);
+ }
- /* This function is used by rtld, avoid ifuncs. */
- __asm __volatile("movq %%fs:0, %0" : "=r" (res));
- return (&res[1]);
+ flags = 0;
+ if ((openflags & O_CLOEXEC) != 0)
+ flags |= KQUEUE_CLOEXEC;
+ return (kqueuex(flags));
}
diff --git a/lib/libc/gen/lcong48.c b/lib/libc/gen/lcong48.c
index ab0d1f762d80..f13826b3d3f3 100644
--- a/lib/libc/gen/lcong48.c
+++ b/lib/libc/gen/lcong48.c
@@ -11,9 +11,6 @@
* to anyone/anything when using this software.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "rand48.h"
extern unsigned short _rand48_seed[3];
diff --git a/lib/libc/gen/ldexp.3 b/lib/libc/gen/ldexp.3
index 91d9e2b15800..d89dea2d16c7 100644
--- a/lib/libc/gen/ldexp.3
+++ b/lib/libc/gen/ldexp.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)ldexp.3 8.2 (Berkeley) 4/19/94
-.\" $FreeBSD$
-.\"
.Dd March 4, 2005
.Dt LDEXP 3
.Os
diff --git a/lib/libc/gen/ldexp.c b/lib/libc/gen/ldexp.c
index cbbcf0782387..1db62afc609e 100644
--- a/lib/libc/gen/ldexp.c
+++ b/lib/libc/gen/ldexp.c
@@ -1,6 +1,3 @@
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* ldexp() and scalbn() are defined to be identical, but ldexp() lives in libc
* for backwards compatibility.
diff --git a/lib/libc/gen/libc_dlopen.c b/lib/libc/gen/libc_dlopen.c
index 5c386b649456..4e5ec2961ac2 100644
--- a/lib/libc/gen/libc_dlopen.c
+++ b/lib/libc/gen/libc_dlopen.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2011 Xin LI <delphij@FreeBSD.org>
*
@@ -23,13 +23,8 @@
* 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/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <dlfcn.h>
#include <stddef.h>
#include <unistd.h>
diff --git a/lib/libc/sys/ptrace.c b/lib/libc/gen/libc_interposing_table.c
index 2bb615fe563e..d15d32711910 100644
--- a/lib/libc/sys/ptrace.c
+++ b/lib/libc/gen/libc_interposing_table.c
@@ -1,6 +1,5 @@
/*
- * Copyright (c) 2016 The FreeBSD Foundation.
- * All rights reserved.
+ * Copyright (c) 2014 The FreeBSD Foundation.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,20 +29,27 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
-#include <sys/ptrace.h>
-#include <errno.h>
+#include <stddef.h>
#include "libc_private.h"
-__weak_reference(_ptrace, ptrace);
+#define SLOT(a, b) \
+ [INTERPOS_##a] = (interpos_func_t)b
+interpos_func_t __libc_interposing[INTERPOS_MAX] = {
+ SLOT(system, __libc_system),
+ SLOT(tcdrain, __libc_tcdrain),
+ SLOT(_pthread_mutex_init_calloc_cb, _pthread_mutex_init_calloc_cb_stub),
+ SLOT(spinlock, __libc_spinlock_stub),
+ SLOT(spinunlock, __libc_spinunlock_stub),
+ SLOT(map_stacks_exec, __libc_map_stacks_exec),
+ SLOT(distribute_static_tls, __libc_distribute_static_tls),
+};
+#undef SLOT
-int
-_ptrace(int request, pid_t pid, caddr_t addr, int data)
+interpos_func_t *
+__libc_interposing_slot(int interposno)
{
-
- errno = 0;
- return (__sys_ptrace(request, pid, addr, data));
+ if (__libc_interposing[interposno] == NULL)
+ return (__libsys_interposing_slot(interposno));
+ return (&__libc_interposing[interposno]);
}
diff --git a/lib/libc/gen/lockf.3 b/lib/libc/gen/lockf.3
deleted file mode 100644
index a4adcfa6e2ab..000000000000
--- a/lib/libc/gen/lockf.3
+++ /dev/null
@@ -1,266 +0,0 @@
-.\" $NetBSD: lockf.3,v 1.10 2008/04/30 13:10:50 martin Exp $
-.\"
-.\" Copyright (c) 1997 The NetBSD Foundation, Inc.
-.\" All rights reserved.
-.\"
-.\" This code is derived from software contributed to The NetBSD Foundation
-.\" by Klaus Klein and S.P. Zeidler.
-.\"
-.\" 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd September 11, 2013
-.Dt LOCKF 3
-.Os
-.Sh NAME
-.Nm lockf
-.Nd record locking on files
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn lockf "int fd" "int function" "off_t size"
-.Sh DESCRIPTION
-The
-.Fn lockf
-function allows sections of a file to be locked with advisory-mode locks.
-Calls to
-.Fn lockf
-from other processes which attempt to lock the locked file section will
-either return an error value or block until the section becomes unlocked.
-All the locks for a process are removed when the process terminates.
-.Pp
-The argument
-.Fa fd
-is an open file descriptor.
-The file descriptor must have been opened either for write-only
-.Dv ( O_WRONLY )
-or read/write
-.Dv ( O_RDWR )
-operation.
-.Pp
-The
-.Fa function
-argument is a control value which specifies the action to be taken.
-The permissible values for
-.Fa function
-are as follows:
-.Bl -tag -width F_ULOCKXX -compact -offset indent
-.It Sy Function
-.Sy Description
-.It Dv F_ULOCK
-unlock locked sections
-.It Dv F_LOCK
-lock a section for exclusive use
-.It Dv F_TLOCK
-test and lock a section for exclusive use
-.It Dv F_TEST
-test a section for locks by other processes
-.El
-.Pp
-.Dv F_ULOCK
-removes locks from a section of the file;
-.Dv F_LOCK
-and
-.Dv F_TLOCK
-both lock a section of a file if the section is available;
-.Dv F_TEST
-detects if a lock by another process is present on the specified section.
-.Pp
-The
-.Fa size
-argument is the number of contiguous bytes to be locked or
-unlocked.
-The section to be locked or unlocked starts at the current
-offset in the file and extends forward for a positive size or backward
-for a negative size (the preceding bytes up to but not including the
-current offset).
-However, it is not permitted to lock a section that
-starts or extends before the beginning of the file.
-If
-.Fa size
-is 0, the section from the current offset through the largest possible
-file offset is locked (that is, from the current offset through the
-present or any future end-of-file).
-.Pp
-The sections locked with
-.Dv F_LOCK
-or
-.Dv F_TLOCK
-may, in whole or in part, contain or be contained by a previously
-locked section for the same process.
-When this occurs, or if adjacent
-locked sections would occur, the sections are combined into a single
-locked section.
-If the request would cause the number of locks to
-exceed a system-imposed limit, the request will fail.
-.Pp
-.Dv F_LOCK
-and
-.Dv F_TLOCK
-requests differ only by the action taken if the section is not
-available.
-.Dv F_LOCK
-blocks the calling process until the section is available.
-.Dv F_TLOCK
-makes the function fail if the section is already locked by another
-process.
-.Pp
-File locks are released on first close by the locking process of any
-file descriptor for the file.
-.Pp
-.Dv F_ULOCK
-requests release (wholly or in part) one or more locked sections
-controlled by the process.
-Locked sections will be unlocked starting
-at the current file offset through
-.Fa size
-bytes or to the end of file if size is 0.
-When all of a locked section
-is not released (that is, when the beginning or end of the area to be
-unlocked falls within a locked section), the remaining portions of
-that section are still locked by the process.
-Releasing the center
-portion of a locked section will cause the remaining locked beginning
-and end portions to become two separate locked sections.
-If the
-request would cause the number of locks in the system to exceed a
-system-imposed limit, the request will fail.
-.Pp
-An
-.Dv F_ULOCK
-request in which size is non-zero and the offset of the last byte of
-the requested section is the maximum value for an object of type
-off_t, when the process has an existing lock in which size is 0 and
-which includes the last byte of the requested section, will be treated
-as a request to unlock from the start of the requested section with a
-size equal to 0.
-Otherwise an
-.Dv F_ULOCK
-request will attempt to unlock only the requested section.
-.Pp
-A potential for deadlock occurs if a process controlling a locked
-region is put to sleep by attempting to lock the locked region of
-another process.
-This implementation detects that sleeping until a
-locked region is unlocked would cause a deadlock and fails with an
-.Er EDEADLK
-error.
-.Pp
-The
-.Fn lockf ,
-.Xr fcntl 2 ,
-and
-.Xr flock 2
-locks are compatible.
-Processes using different locking interfaces can cooperate
-over the same file safely.
-However, only one of such interfaces should be used within
-the same process.
-If a file is locked by a process through
-.Xr flock 2 ,
-any record within the file will be seen as locked
-from the viewpoint of another process using
-.Xr fcntl 2
-or
-.Fn lockf ,
-and vice versa.
-.Pp
-Blocking on a section is interrupted by any signal.
-.Sh RETURN VALUES
-.Rv -std lockf
-In the case of a failure, existing locks are not changed.
-.Sh ERRORS
-The
-.Fn lockf
-function
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EAGAIN
-The argument
-.Fa function
-is
-.Dv F_TLOCK
-or
-.Dv F_TEST
-and the section is already locked by another process.
-.It Bq Er EBADF
-The argument
-.Fa fd
-is not a valid open file descriptor.
-.Pp
-The argument
-.Fa function
-is
-.Dv F_LOCK
-or
-.Dv F_TLOCK ,
-and
-.Fa fd
-is not a valid file descriptor open for writing.
-.It Bq Er EDEADLK
-The argument
-.Fa function
-is
-.Dv F_LOCK
-and a deadlock is detected.
-.It Bq Er EINTR
-The argument
-.Fa function
-is F_LOCK
-and
-.Fn lockf
-was interrupted by the delivery of a signal.
-.It Bq Er EINVAL
-The argument
-.Fa function
-is not one of
-.Dv F_ULOCK ,
-.Dv F_LOCK ,
-.Dv F_TLOCK
-or
-.Dv F_TEST .
-.Pp
-The argument
-.Fa fd
-refers to a file that does not support locking.
-.It Bq Er ENOLCK
-The argument
-.Fa function
-is
-.Dv F_ULOCK ,
-.Dv F_LOCK
-or
-.Dv F_TLOCK ,
-and satisfying the lock or unlock request would result in the number
-of locked regions in the system exceeding a system-imposed limit.
-.El
-.Sh SEE ALSO
-.Xr fcntl 2 ,
-.Xr flock 2
-.Sh STANDARDS
-The
-.Fn lockf
-function conforms to
-.St -xpg4.2 .
diff --git a/lib/libc/gen/lrand48.c b/lib/libc/gen/lrand48.c
index 44a7f5d0e924..a3d0111cf4d5 100644
--- a/lib/libc/gen/lrand48.c
+++ b/lib/libc/gen/lrand48.c
@@ -11,9 +11,6 @@
* to anyone/anything when using this software.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "rand48.h"
extern unsigned short _rand48_seed[3];
diff --git a/lib/libc/gen/makecontext.3 b/lib/libc/gen/makecontext.3
index e75681795bee..bcf836979962 100644
--- a/lib/libc/gen/makecontext.3
+++ b/lib/libc/gen/makecontext.3
@@ -33,8 +33,6 @@
.\" THE USE OF THIS SOFTWARE, EVEN IF PACKET DESIGN IS ADVISED OF
.\" THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd March 23, 2020
.Dt MAKECONTEXT 3
.Os
diff --git a/lib/libc/gen/memalign.c b/lib/libc/gen/memalign.c
index ff1c967482cd..269a5bc829b1 100644
--- a/lib/libc/gen/memalign.c
+++ b/lib/libc/gen/memalign.c
@@ -1,6 +1,5 @@
/*-
* Copyright (c) 2020 The FreeBSD Foundation
- * All rights reserved.
*
* This software was developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -27,14 +26,18 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <stdlib.h>
void *
memalign(size_t align, size_t size)
{
- return (aligned_alloc(align, roundup(size, align)));
+ /*
+ * glibc allows align == 0, but that is not valid for roundup.
+ * Just pass through to malloc in that case.
+ */
+ if (align != 0)
+ return (aligned_alloc(align, roundup(size, align)));
+ else
+ return (malloc(size));
}
diff --git a/lib/libc/gen/memfd_create.c b/lib/libc/gen/memfd_create.c
new file mode 100644
index 000000000000..78131f46d7b1
--- /dev/null
+++ b/lib/libc/gen/memfd_create.c
@@ -0,0 +1,121 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2019 Kyle Evans <kevans@FreeBSD.org>
+ *
+ * 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(s), this list of conditions and the following disclaimer as
+ * the first lines of this file unmodified other than the possible
+ * addition of one or more copyright notices.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice(s), 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 HOLDER(S) ``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(S) 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.
+ */
+
+#include <sys/param.h>
+#include <sys/filio.h>
+#include <sys/mman.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "libc_private.h"
+
+#define MEMFD_NAME_PREFIX "memfd:"
+
+/*
+ * The path argument is passed to the kernel, but the kernel doesn't currently
+ * do anything with it. Linux exposes it in linprocfs for debugging purposes
+ * only, but our kernel currently will not do the same.
+ */
+int
+memfd_create(const char *name, unsigned int flags)
+{
+ char memfd_name[NAME_MAX + 1];
+ size_t pgs[MAXPAGESIZES];
+ size_t namelen, pgsize;
+ struct shm_largepage_conf slc;
+ int error, fd, npgs, oflags, pgidx, saved_errno, shmflags;
+
+ if (name == NULL) {
+ errno = EBADF;
+ return (-1);
+ }
+ namelen = strlen(name);
+ if (namelen + sizeof(MEMFD_NAME_PREFIX) - 1 > NAME_MAX) {
+ errno = EINVAL;
+ return (-1);
+ }
+ if ((flags & ~(MFD_CLOEXEC | MFD_ALLOW_SEALING | MFD_HUGETLB |
+ MFD_HUGE_MASK)) != 0) {
+ errno = EINVAL;
+ return (-1);
+ }
+ /* Size specified but no HUGETLB. */
+ if ((flags & MFD_HUGE_MASK) != 0 && (flags & MFD_HUGETLB) == 0) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ /* We've already validated that we're sufficiently sized. */
+ snprintf(memfd_name, NAME_MAX + 1, "%s%s", MEMFD_NAME_PREFIX, name);
+ oflags = O_RDWR;
+ shmflags = 0;
+ if ((flags & MFD_CLOEXEC) != 0)
+ oflags |= O_CLOEXEC;
+ if ((flags & MFD_ALLOW_SEALING) != 0)
+ shmflags |= SHM_ALLOW_SEALING;
+ if ((flags & MFD_HUGETLB) != 0)
+ shmflags |= SHM_LARGEPAGE;
+ else
+ shmflags |= SHM_GROW_ON_WRITE;
+ fd = __sys_shm_open2(SHM_ANON, oflags, 0, shmflags, memfd_name);
+ if (fd == -1 || (flags & MFD_HUGETLB) == 0)
+ return (fd);
+
+ npgs = getpagesizes(pgs, nitems(pgs));
+ if (npgs == -1)
+ goto clean;
+ pgsize = (size_t)1 << ((flags & MFD_HUGE_MASK) >> MFD_HUGE_SHIFT);
+ for (pgidx = 0; pgidx < npgs; pgidx++) {
+ if (pgsize == pgs[pgidx])
+ break;
+ }
+ if (pgidx == npgs) {
+ errno = EOPNOTSUPP;
+ goto clean;
+ }
+
+ memset(&slc, 0, sizeof(slc));
+ slc.psind = pgidx;
+ slc.alloc_policy = SHM_LARGEPAGE_ALLOC_DEFAULT;
+ error = ioctl(fd, FIOSSHMLPGCNF, &slc);
+ if (error == -1)
+ goto clean;
+ return (fd);
+
+clean:
+ saved_errno = errno;
+ close(fd);
+ errno = saved_errno;
+ return (-1);
+}
diff --git a/lib/libc/gen/modf.3 b/lib/libc/gen/modf.3
index 493f5866d6e1..9d698ff62ce6 100644
--- a/lib/libc/gen/modf.3
+++ b/lib/libc/gen/modf.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)modf.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd March 29, 2008
.Dt MODF 3
.Os
diff --git a/lib/libc/gen/modf.c b/lib/libc/gen/modf.c
index d67b44121aaa..b4093d6e930c 100644
--- a/lib/libc/gen/modf.c
+++ b/lib/libc/gen/modf.c
@@ -1,4 +1,3 @@
-/* @(#)s_modf.c 5.1 93/09/24 */
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
@@ -10,9 +9,6 @@
* ====================================================
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* modf(double x, double *iptr)
* return fraction part of x, and return x's integral part in *iptr.
diff --git a/lib/libc/gen/mrand48.c b/lib/libc/gen/mrand48.c
index 795a8585802d..15b0bfb1bd6e 100644
--- a/lib/libc/gen/mrand48.c
+++ b/lib/libc/gen/mrand48.c
@@ -11,9 +11,6 @@
* to anyone/anything when using this software.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdint.h>
#include "rand48.h"
diff --git a/lib/libc/gen/nftw-compat11.c b/lib/libc/gen/nftw-compat11.c
index 1cf9ba8cb9b6..36970424bf2a 100644
--- a/lib/libc/gen/nftw-compat11.c
+++ b/lib/libc/gen/nftw-compat11.c
@@ -21,9 +21,6 @@
* From: FreeBSD: head/lib/libc/gen/nftw.c 239160 2012-08-09 22:05:40Z jilles
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
diff --git a/lib/libc/gen/nftw.c b/lib/libc/gen/nftw.c
index a338e5a34c84..95cc9947b7c1 100644
--- a/lib/libc/gen/nftw.c
+++ b/lib/libc/gen/nftw.c
@@ -20,9 +20,6 @@
* Materiel Command, USAF, under agreement number F39502-99-1-0512.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
diff --git a/lib/libc/gen/nice.3 b/lib/libc/gen/nice.3
index dee1a3da9100..011b4c33effc 100644
--- a/lib/libc/gen/nice.3
+++ b/lib/libc/gen/nice.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)nice.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd February 28, 2015
.Dt NICE 3
.Os
diff --git a/lib/libc/gen/nice.c b/lib/libc/gen/nice.c
index 7f217059fb11..a96d4d06e081 100644
--- a/lib/libc/gen/nice.c
+++ b/lib/libc/gen/nice.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)nice.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
diff --git a/lib/libc/gen/nlist.3 b/lib/libc/gen/nlist.3
index ea9ad732d387..f4ef59083dab 100644
--- a/lib/libc/gen/nlist.3
+++ b/lib/libc/gen/nlist.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)nlist.3 8.3 (Berkeley) 4/19/94
-.\" $FreeBSD$
-.\"
.Dd April 19, 1994
.Dt NLIST 3
.Os
diff --git a/lib/libc/gen/nlist.c b/lib/libc/gen/nlist.c
index 3d69157904a4..ebf4ae92641a 100644
--- a/lib/libc/gen/nlist.c
+++ b/lib/libc/gen/nlist.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)nlist.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#include <sys/mman.h>
@@ -106,7 +102,7 @@ __elf_is_okay__(Elf_Ehdr *ehdr)
* We need to check magic, class size, endianess,
* and version before we look at the rest of the
* Elf_Ehdr structure. These few elements are
- * represented in a machine independant fashion.
+ * represented in a machine independent fashion.
*/
if (IS_ELF(*ehdr) &&
ehdr->e_ident[EI_CLASS] == ELF_TARG_CLASS &&
diff --git a/lib/libc/gen/nrand48.c b/lib/libc/gen/nrand48.c
index 16c8ca111b5e..6c54065e7e0f 100644
--- a/lib/libc/gen/nrand48.c
+++ b/lib/libc/gen/nrand48.c
@@ -11,9 +11,6 @@
* to anyone/anything when using this software.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "rand48.h"
long
diff --git a/lib/libc/gen/opendir.c b/lib/libc/gen/opendir.c
index c294081847e2..a47725578c33 100644
--- a/lib/libc/gen/opendir.c
+++ b/lib/libc/gen/opendir.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)opendir.c 8.8 (Berkeley) 5/1/95");
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
diff --git a/lib/libc/gen/pause.3 b/lib/libc/gen/pause.3
index fc057c7aa634..6b17ae10777d 100644
--- a/lib/libc/gen/pause.3
+++ b/lib/libc/gen/pause.3
@@ -25,10 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)pause.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd June 4, 1993
+.Dd April 3, 2022
.Dt PAUSE 3
.Os
.Sh NAME
@@ -77,6 +74,18 @@ The call was interrupted.
.Sh HISTORY
A
.Fn pause
-syscall
-appeared in
-.At v6 .
+system call first appeared in the Programmer's Workbench (PWB/UNIX)
+and was then ported to
+.At v7 .
+It was reimplemeted as a wrapper around the
+.Fn sigpause
+and
+.Fn sigblock
+system calls in
+.Bx 4.2 ,
+and around the
+.Xr sigsuspend 2
+and
+.Xr sigprocmask 2
+system calls in
+.Bx 4.3 Reno .
diff --git a/lib/libc/gen/pause.c b/lib/libc/gen/pause.c
index f6650a73a710..38aed9da7439 100644
--- a/lib/libc/gen/pause.c
+++ b/lib/libc/gen/pause.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)pause.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include <signal.h>
#include <unistd.h>
diff --git a/lib/libc/gen/pmadvise.c b/lib/libc/gen/pmadvise.c
index 0dc77e3e992b..19525c939c26 100644
--- a/lib/libc/gen/pmadvise.c
+++ b/lib/libc/gen/pmadvise.c
@@ -4,9 +4,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/mman.h>
#include <errno.h>
diff --git a/lib/libc/gen/popen.3 b/lib/libc/gen/popen.3
index 36af39ac1a8a..bae37eed14cf 100644
--- a/lib/libc/gen/popen.3
+++ b/lib/libc/gen/popen.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)popen.3 8.2 (Berkeley) 5/3/95
-.\" $FreeBSD$
-.\"
.Dd May 20, 2013
.Dt POPEN 3
.Os
diff --git a/lib/libc/gen/popen.c b/lib/libc/gen/popen.c
index 4f94405c2ff4..db6b91d08af6 100644
--- a/lib/libc/gen/popen.c
+++ b/lib/libc/gen/popen.c
@@ -32,10 +32,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)popen.c 8.3 (Berkeley) 5/3/95");
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#include <sys/queue.h>
@@ -53,8 +49,6 @@ __FBSDID("$FreeBSD$");
#include "un-namespace.h"
#include "libc_private.h"
-extern char **environ;
-
struct pid {
SLIST_ENTRY(pid) next;
FILE *fp;
@@ -181,7 +175,7 @@ popen(const char *command, const char *type)
* the list which will cause an explicit close.
*/
if (!cloexec)
- (void)_fcntl(*type == 'r' ? pdes[0] : pdes[1], F_SETFD, 0);
+ (void)_fcntl(fileno(iop), F_SETFD, 0);
return (iop);
}
diff --git a/lib/libc/gen/posix_spawn.3 b/lib/libc/gen/posix_spawn.3
index 596dac318673..55559ae7222b 100644
--- a/lib/libc/gen/posix_spawn.3
+++ b/lib/libc/gen/posix_spawn.3
@@ -32,9 +32,7 @@
.\" the referee document. The original Standard can be obtained online at
.\" http://www.opengroup.org/unix/online.html.
.\"
-.\" $FreeBSD$
-.\"
-.Dd January 5, 2016
+.Dd March 4, 2024
.Dt POSIX_SPAWN 3
.Os
.Sh NAME
@@ -46,9 +44,23 @@
.Sh SYNOPSIS
.In spawn.h
.Ft int
-.Fn posix_spawn "pid_t *restrict pid" "const char *restrict path" "const posix_spawn_file_actions_t *file_actions" "const posix_spawnattr_t *restrict attrp" "char *const argv[restrict]" "char *const envp[restrict]"
+.Fo posix_spawn
+.Fa "pid_t *restrict pid"
+.Fa "const char *restrict path"
+.Fa "const posix_spawn_file_actions_t *file_actions"
+.Fa "const posix_spawnattr_t *restrict attrp"
+.Fa "char *const argv[restrict]"
+.Fa "char *const envp[restrict]"
+.Fc
.Ft int
-.Fn posix_spawnp "pid_t *restrict pid" "const char *restrict file" "const posix_spawn_file_actions_t *file_actions" "const posix_spawnattr_t *restrict attrp" "char *const argv[restrict]" "char *const envp[restrict]"
+.Fo posix_spawnp
+.Fa "pid_t *restrict pid"
+.Fa "const char *restrict file"
+.Fa "const posix_spawn_file_actions_t *file_actions"
+.Fa "const posix_spawnattr_t *restrict attrp"
+.Fa "char *const argv[restrict]"
+.Fa "char *const envp[restrict]"
+.Fc
.Sh DESCRIPTION
The
.Fn posix_spawn
@@ -285,6 +297,15 @@ and the signals being indicated in the spawn-sigdefault attribute
of the object referenced by
.Fa attrp .
.Pp
+The Address Space Layout Randomization for the newly spawned process
+can be disabled by specifying the
+.Dv POSIX_SPAWN_DISABLE_ASLR_NP
+flag in the spawn-flags attribute.
+This setting is inherited by future children of the child as well.
+See
+.Xr procctl 2
+for more details.
+.Pp
If the value of the
.Fa attrp
pointer is NULL, then the default values are used.
@@ -408,6 +429,11 @@ in addition to those described by
This implementation ignores any errors from
.Fn close ,
including trying to close a descriptor that is not open.
+The ignore extends to any errors from individual file descriptors
+.Fn close
+executed as part of the
+.Fn closefrom
+action.
.El
.Sh SEE ALSO
.Xr close 2 ,
@@ -415,13 +441,17 @@ including trying to close a descriptor that is not open.
.Xr execve 2 ,
.Xr fcntl 2 ,
.Xr open 2 ,
+.Xr procctl 2 ,
.Xr sched_setparam 2 ,
.Xr sched_setscheduler 2 ,
.Xr setpgid 2 ,
.Xr vfork 2 ,
.Xr posix_spawn_file_actions_addclose 3 ,
+.Xr posix_spawn_file_actions_addclosefrom_np 3 ,
.Xr posix_spawn_file_actions_adddup2 3 ,
.Xr posix_spawn_file_actions_addopen 3 ,
+.Xr posix_spawn_file_actions_addchdir_np 3 ,
+.Xr posix_spawn_file_actions_addfchdir_np 3 ,
.Xr posix_spawn_file_actions_destroy 3 ,
.Xr posix_spawn_file_actions_init 3 ,
.Xr posix_spawnattr_destroy 3 ,
diff --git a/lib/libc/gen/posix_spawn.c b/lib/libc/gen/posix_spawn.c
index 0bca52811e30..ee2ce05ff317 100644
--- a/lib/libc/gen/posix_spawn.c
+++ b/lib/libc/gen/posix_spawn.c
@@ -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.
@@ -26,11 +26,9 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
+#include <sys/procctl.h>
#include <sys/queue.h>
#include <sys/wait.h>
@@ -45,8 +43,6 @@ __FBSDID("$FreeBSD$");
#include "un-namespace.h"
#include "libc_private.h"
-extern char **environ;
-
struct __posix_spawnattr {
short sa_flags;
pid_t sa_pgroup;
@@ -62,7 +58,14 @@ struct __posix_spawn_file_actions {
typedef struct __posix_spawn_file_actions_entry {
STAILQ_ENTRY(__posix_spawn_file_actions_entry) fae_list;
- enum { FAE_OPEN, FAE_DUP2, FAE_CLOSE } fae_action;
+ enum {
+ FAE_OPEN,
+ FAE_DUP2,
+ FAE_CLOSE,
+ FAE_CHDIR,
+ FAE_FCHDIR,
+ FAE_CLOSEFROM,
+ } fae_action;
int fae_fildes;
union {
@@ -89,7 +92,7 @@ static int
process_spawnattr(const posix_spawnattr_t sa)
{
struct sigaction sigact = { .sa_flags = 0, .sa_handler = SIG_DFL };
- int i;
+ int aslr, i;
/*
* POSIX doesn't really describe in which order everything
@@ -137,6 +140,13 @@ process_spawnattr(const posix_spawnattr_t sa)
}
}
+ /* Disable ASLR. */
+ if ((sa->sa_flags & POSIX_SPAWN_DISABLE_ASLR_NP) != 0) {
+ aslr = PROC_ASLR_FORCE_DISABLE;
+ if (procctl(P_PID, 0, PROC_ASLR_CTL, &aslr) != 0)
+ return (errno);
+ }
+
return (0);
}
@@ -176,6 +186,17 @@ process_file_actions_entry(posix_spawn_file_actions_entry_t *fae)
/* Perform a close(), do not fail if already closed */
(void)_close(fae->fae_fildes);
break;
+ case FAE_CHDIR:
+ if (chdir(fae->fae_path) != 0)
+ return (errno);
+ break;
+ case FAE_FCHDIR:
+ if (fchdir(fae->fae_fildes) != 0)
+ return (errno);
+ break;
+ case FAE_CLOSEFROM:
+ closefrom(fae->fae_fildes);
+ break;
}
return (0);
}
@@ -213,7 +234,7 @@ struct posix_spawn_args {
#if defined(__i386__) || defined(__amd64__)
/*
* Below we'll assume that _RFORK_THREAD_STACK_SIZE is appropriately aligned for
- * the posix_spawn() case where we do not end up calling _execvpe and won't ever
+ * the posix_spawn() case where we do not end up calling execvpe and won't ever
* try to allocate space on the stack for argv[].
*/
#define _RFORK_THREAD_STACK_SIZE 4096
@@ -240,7 +261,7 @@ _posix_spawn_thr(void *data)
}
envp = psa->envp != NULL ? psa->envp : environ;
if (psa->use_env_path)
- _execvpe(psa->path, psa->argv, envp);
+ execvpe(psa->path, psa->argv, envp);
else
_execve(psa->path, psa->argv, envp);
psa->error = errno;
@@ -304,11 +325,16 @@ do_posix_spawn(pid_t *pid, const char *path,
* ideal vfork(2) if we get an EINVAL from rfork -- this should only
* happen with newer libc on older kernel that doesn't accept
* RFSPAWN.
+ *
+ * Combination of vfork() (or its equivalent rfork() form) and
+ * a special property of the libthr rtld locks ensure that
+ * rtld is operational in the child. In particular, libthr
+ * rtld locks do not store owner' tid into the lock word.
*/
#ifdef _RFORK_THREAD_STACK_SIZE
/*
* x86 stores the return address on the stack, so rfork(2) cannot work
- * as-is because the child would clobber the return address om the
+ * as-is because the child would clobber the return address of the
* parent. Because of this, we must use rfork_thread instead while
* almost every other arch stores the return address in a register.
*/
@@ -349,7 +375,7 @@ posix_spawn(pid_t *pid, const char *path,
const posix_spawnattr_t *sa,
char * const argv[], char * const envp[])
{
- return do_posix_spawn(pid, path, fa, sa, argv, envp, 0);
+ return (do_posix_spawn(pid, path, fa, sa, argv, envp, 0));
}
int
@@ -358,7 +384,7 @@ posix_spawnp(pid_t *pid, const char *path,
const posix_spawnattr_t *sa,
char * const argv[], char * const envp[])
{
- return do_posix_spawn(pid, path, fa, sa, argv, envp, 1);
+ return (do_posix_spawn(pid, path, fa, sa, argv, envp, 1));
}
/*
@@ -389,7 +415,8 @@ posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *fa)
STAILQ_REMOVE_HEAD(&(*fa)->fa_list, fae_list);
/* Deallocate file action entry */
- if (fae->fae_action == FAE_OPEN)
+ if (fae->fae_action == FAE_OPEN ||
+ fae->fae_action == FAE_CHDIR)
free(fae->fae_path);
free(fae);
}
@@ -474,6 +501,71 @@ posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *fa,
return (0);
}
+int
+posix_spawn_file_actions_addchdir_np(posix_spawn_file_actions_t *
+ __restrict fa, const char *__restrict path)
+{
+ posix_spawn_file_actions_entry_t *fae;
+ int error;
+
+ fae = malloc(sizeof(posix_spawn_file_actions_entry_t));
+ if (fae == NULL)
+ return (errno);
+
+ fae->fae_action = FAE_CHDIR;
+ fae->fae_path = strdup(path);
+ if (fae->fae_path == NULL) {
+ error = errno;
+ free(fae);
+ return (error);
+ }
+
+ STAILQ_INSERT_TAIL(&(*fa)->fa_list, fae, fae_list);
+ return (0);
+}
+
+int
+posix_spawn_file_actions_addfchdir_np(posix_spawn_file_actions_t *__restrict fa,
+ int fildes)
+{
+ posix_spawn_file_actions_entry_t *fae;
+
+ if (fildes < 0)
+ return (EBADF);
+
+ /* Allocate object */
+ fae = malloc(sizeof(posix_spawn_file_actions_entry_t));
+ if (fae == NULL)
+ return (errno);
+
+ fae->fae_action = FAE_FCHDIR;
+ fae->fae_fildes = fildes;
+
+ STAILQ_INSERT_TAIL(&(*fa)->fa_list, fae, fae_list);
+ return (0);
+}
+
+int
+posix_spawn_file_actions_addclosefrom_np (posix_spawn_file_actions_t *
+ __restrict fa, int from)
+{
+ posix_spawn_file_actions_entry_t *fae;
+
+ if (from < 0)
+ return (EBADF);
+
+ /* Allocate object */
+ fae = malloc(sizeof(posix_spawn_file_actions_entry_t));
+ if (fae == NULL)
+ return (errno);
+
+ fae->fae_action = FAE_CLOSEFROM;
+ fae->fae_fildes = from;
+
+ STAILQ_INSERT_TAIL(&(*fa)->fa_list, fae, fae_list);
+ return (0);
+}
+
/*
* Spawn attributes
*/
@@ -550,6 +642,11 @@ posix_spawnattr_getsigmask(const posix_spawnattr_t * __restrict sa,
int
posix_spawnattr_setflags(posix_spawnattr_t *sa, short flags)
{
+ if ((flags & ~(POSIX_SPAWN_RESETIDS | POSIX_SPAWN_SETPGROUP |
+ POSIX_SPAWN_SETSCHEDPARAM | POSIX_SPAWN_SETSCHEDULER |
+ POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETSIGMASK |
+ POSIX_SPAWN_DISABLE_ASLR_NP)) != 0)
+ return (EINVAL);
(*sa)->sa_flags = flags;
return (0);
}
diff --git a/lib/libc/gen/posix_spawn_file_actions_addopen.3 b/lib/libc/gen/posix_spawn_file_actions_addopen.3
index 0b57999bf4be..80bc91454471 100644
--- a/lib/libc/gen/posix_spawn_file_actions_addopen.3
+++ b/lib/libc/gen/posix_spawn_file_actions_addopen.3
@@ -32,26 +32,55 @@
.\" the referee document. The original Standard can be obtained online at
.\" http://www.opengroup.org/unix/online.html.
.\"
-.\" $FreeBSD$
-.\"
.Dd May 9, 2013
.Dt POSIX_SPAWN_FILE_ACTIONS_ADDOPEN 3
.Os
.Sh NAME
.Nm posix_spawn_file_actions_addopen ,
.Nm posix_spawn_file_actions_adddup2 ,
-.Nm posix_spawn_file_actions_addclose
-.Nd "add open, dup2 or close action to spawn file actions object"
+.Nm posix_spawn_file_actions_addclose ,
+.Nm posix_spawn_file_actions_addclosefrom_np ,
+.Nm posix_spawn_file_actions_addchdir_np ,
+.Nm posix_spawn_file_actions_addfchdir_np
+.Nd "add open, dup2, close, closefrom, or chdir/fchdir actions to spawn file actions object"
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.In spawn.h
.Ft int
-.Fn posix_spawn_file_actions_addopen "posix_spawn_file_actions_t * file_actions" "int fildes" "const char *restrict path" "int oflag" "mode_t mode"
+.Fo posix_spawn_file_actions_addopen
+.Fa "posix_spawn_file_actions_t * file_actions"
+.Fa "int fildes"
+.Fa "const char *restrict path"
+.Fa "int oflag"
+.Fa "mode_t mode"
+.Fc
+.Ft int
+.Fo posix_spawn_file_actions_adddup2
+.Fa "posix_spawn_file_actions_t * file_actions"
+.Fa "int fildes"
+.Fa "int newfildes"
+.Fc
+.Ft int
+.Fo posix_spawn_file_actions_addclose
+.Fa "posix_spawn_file_actions_t * file_actions"
+.Fa "int fildes"
+.Fc
.Ft int
-.Fn posix_spawn_file_actions_adddup2 "posix_spawn_file_actions_t * file_actions" "int fildes" "int newfildes"
+.Fo posix_spawn_file_actions_addclosefrom_np
+.Fa "posix_spawn_file_actions_t * file_actions"
+.Fa "int from"
+.Fc
.Ft int
-.Fn posix_spawn_file_actions_addclose "posix_spawn_file_actions_t * file_actions" "int fildes"
+.Fo posix_spawn_file_actions_addchdir_np
+.Fa "posix_spawn_file_actions_t *restrict file_actions"
+.Fa "const char *restrict path"
+.Fc
+.Ft int
+.Fo posix_spawn_file_actions_addfchdir_np
+.Fa "posix_spawn_file_actions_t * file_actions"
+.Fa "int fildes"
+.Fc
.Sh DESCRIPTION
These functions add an open, dup2 or close action to a spawn
file actions object.
@@ -150,6 +179,34 @@ close(fildes)
.Pp
had been called) when a new process is spawned using this file actions
object.
+.Pp
+The
+.Fn posix_spawn_file_actions_addclosefrom_np
+function adds a close action to close all file descriptors numerically
+equal or greater then the argument
+.Fa from .
+For each open file descriptor, logically the close action is performed,
+and any possible errors encountered are ignored.
+.Pp
+The
+.Fn posix_spawn_file_actions_addchdir_np
+and
+.Fn posix_spawn_file_actions_addfchdir_np
+functions add a change current directory action to the object
+referenced by
+.Fa file_actions
+that affects actions (opens with relative path) performed after the operation,
+in the order of insertion into the
+.Fa file_actions
+object.
+It also sets the working directory for the spawned program.
+The
+.Fn posix_spawn_file_actions_addchdir_np
+function takes the
+.Fa path
+to set as the working directory, while
+.Fn posix_spawn_file_actions_addfchdir_np
+takes the directory file descriptor.
.Sh RETURN VALUES
Upon successful completion, these functions return zero;
otherwise, an error number is returned to indicate the error.
@@ -191,6 +248,14 @@ is equal to
(clearing
.Dv FD_CLOEXEC ) .
A future update of the Standard is expected to require this behavior.
+.Pp
+The
+.Fn posix_spawn_file_actions_addchdir_np ,
+.Fn posix_spawn_file_actions_addfchdir_np ,
+and
+.Fn posix_spawn_file_actions_addclosefrom_np
+functions are non-standard functions implemented after the similar
+functionality provided by glibc.
.Sh HISTORY
The
.Fn posix_spawn_file_actions_addopen ,
@@ -199,5 +264,12 @@ and
.Fn posix_spawn_file_actions_addclose
functions first appeared in
.Fx 8.0 .
+The
+.Fn posix_spawn_file_actions_addchdir_np ,
+.Fn posix_spawn_file_actions_addfchdir_np ,
+and
+.Fn posix_spawn_file_actions_addclosefrom_np
+functions first appeared in
+.Fx 13.1 .
.Sh AUTHORS
.An \&Ed Schouten Aq Mt ed@FreeBSD.org
diff --git a/lib/libc/gen/posix_spawn_file_actions_init.3 b/lib/libc/gen/posix_spawn_file_actions_init.3
index 380eed769003..43b176441381 100644
--- a/lib/libc/gen/posix_spawn_file_actions_init.3
+++ b/lib/libc/gen/posix_spawn_file_actions_init.3
@@ -32,9 +32,7 @@
.\" the referee document. The original Standard can be obtained online at
.\" http://www.opengroup.org/unix/online.html.
.\"
-.\" $FreeBSD$
-.\"
-.Dd March 24, 2008
+.Dd November 28, 2021
.Dt POSIX_SPAWN_FILE_ACTIONS_INIT 3
.Os
.Sh NAME
@@ -83,6 +81,7 @@ Insufficient memory exists to initialize the spawn file actions object.
.Sh SEE ALSO
.Xr posix_spawn 3 ,
.Xr posix_spawn_file_actions_addclose 3 ,
+.Xr posix_spawn_file_actions_addclosefrom_np 3 ,
.Xr posix_spawn_file_actions_adddup2 3 ,
.Xr posix_spawn_file_actions_addopen 3 ,
.Xr posix_spawnp 3
diff --git a/lib/libc/gen/posix_spawnattr_getflags.3 b/lib/libc/gen/posix_spawnattr_getflags.3
index 2571f4ab307c..308bbb386d76 100644
--- a/lib/libc/gen/posix_spawnattr_getflags.3
+++ b/lib/libc/gen/posix_spawnattr_getflags.3
@@ -32,9 +32,7 @@
.\" the referee document. The original Standard can be obtained online at
.\" http://www.opengroup.org/unix/online.html.
.\"
-.\" $FreeBSD$
-.\"
-.Dd March 24, 2008
+.Dd March 4, 2024
.Dt POSIX_SPAWNATTR_GETFLAGS 3
.Os
.Sh NAME
@@ -77,6 +75,7 @@ It is the bitwise-inclusive OR of zero or more of the following flags
.It Dv POSIX_SPAWN_SETSIGMASK
.It Dv POSIX_SPAWN_SETSCHEDPARAM
.It Dv POSIX_SPAWN_SETSCHEDULER
+.It Dv POSIX_SPAWN_DISABLE_ASLR_NP
.El
.Pp
These flags are defined in
@@ -85,9 +84,12 @@ The default value of this attribute is as if no flags were set.
.Sh RETURN VALUES
The
.Fn posix_spawnattr_getflags
-and
+function returns zero.
+The
.Fn posix_spawnattr_setflags
-functions return zero.
+function returns zero on success, and
+.Er EINVAL
+on failure due to invalid flag specified.
.Sh SEE ALSO
.Xr posix_spawn 3 ,
.Xr posix_spawnattr_destroy 3 ,
diff --git a/lib/libc/gen/posix_spawnattr_getpgroup.3 b/lib/libc/gen/posix_spawnattr_getpgroup.3
index cfc1b54ab633..cd8cb4899fa3 100644
--- a/lib/libc/gen/posix_spawnattr_getpgroup.3
+++ b/lib/libc/gen/posix_spawnattr_getpgroup.3
@@ -32,8 +32,6 @@
.\" the referee document. The original Standard can be obtained online at
.\" http://www.opengroup.org/unix/online.html.
.\"
-.\" $FreeBSD$
-.\"
.Dd March 24, 2008
.Dt POSIX_SPAWNATTR_GETPGROUP 3
.Os
diff --git a/lib/libc/gen/posix_spawnattr_getschedparam.3 b/lib/libc/gen/posix_spawnattr_getschedparam.3
index 5eef96ea825d..bdb560d954e6 100644
--- a/lib/libc/gen/posix_spawnattr_getschedparam.3
+++ b/lib/libc/gen/posix_spawnattr_getschedparam.3
@@ -32,8 +32,6 @@
.\" the referee document. The original Standard can be obtained online at
.\" http://www.opengroup.org/unix/online.html.
.\"
-.\" $FreeBSD$
-.\"
.Dd March 24, 2008
.Dt POSIX_SPAWNATTR_GETSCHEDPARAM 3
.Os
diff --git a/lib/libc/gen/posix_spawnattr_getschedpolicy.3 b/lib/libc/gen/posix_spawnattr_getschedpolicy.3
index 5276de5a2f35..f6d32babd29b 100644
--- a/lib/libc/gen/posix_spawnattr_getschedpolicy.3
+++ b/lib/libc/gen/posix_spawnattr_getschedpolicy.3
@@ -32,8 +32,6 @@
.\" the referee document. The original Standard can be obtained online at
.\" http://www.opengroup.org/unix/online.html.
.\"
-.\" $FreeBSD$
-.\"
.Dd March 24, 2008
.Dt POSIX_SPAWNATTR_GETSCHEDPOLICY 3
.Os
diff --git a/lib/libc/gen/posix_spawnattr_getsigdefault.3 b/lib/libc/gen/posix_spawnattr_getsigdefault.3
index a81c71417449..897c337badfe 100644
--- a/lib/libc/gen/posix_spawnattr_getsigdefault.3
+++ b/lib/libc/gen/posix_spawnattr_getsigdefault.3
@@ -32,8 +32,6 @@
.\" the referee document. The original Standard can be obtained online at
.\" http://www.opengroup.org/unix/online.html.
.\"
-.\" $FreeBSD$
-.\"
.Dd March 24, 2008
.Dt POSIX_SPAWNATTR_GETSIGDEFAULT 3
.Os
diff --git a/lib/libc/gen/posix_spawnattr_getsigmask.3 b/lib/libc/gen/posix_spawnattr_getsigmask.3
index be15d9d47d82..3800a9bc4325 100644
--- a/lib/libc/gen/posix_spawnattr_getsigmask.3
+++ b/lib/libc/gen/posix_spawnattr_getsigmask.3
@@ -32,8 +32,6 @@
.\" the referee document. The original Standard can be obtained online at
.\" http://www.opengroup.org/unix/online.html.
.\"
-.\" $FreeBSD$
-.\"
.Dd March 24, 2008
.Dt POSIX_SPAWNATTR_GETSIGMASK 3
.Os
diff --git a/lib/libc/gen/posix_spawnattr_init.3 b/lib/libc/gen/posix_spawnattr_init.3
index b4ec52c30e25..e5b921967bf0 100644
--- a/lib/libc/gen/posix_spawnattr_init.3
+++ b/lib/libc/gen/posix_spawnattr_init.3
@@ -32,8 +32,6 @@
.\" the referee document. The original Standard can be obtained online at
.\" http://www.opengroup.org/unix/online.html.
.\"
-.\" $FreeBSD$
-.\"
.Dd March 24, 2008
.Dt POSIX_SPAWNATTR_INIT 3
.Os
diff --git a/lib/libc/gen/psignal.3 b/lib/libc/gen/psignal.3
index 597d4fc9c35b..cd3cef0b44a9 100644
--- a/lib/libc/gen/psignal.3
+++ b/lib/libc/gen/psignal.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)psignal.3 8.2 (Berkeley) 2/27/95
-.\" $FreeBSD$
-.\"
.Dd May 30, 2016
.Dt PSIGNAL 3
.Os
diff --git a/lib/libc/gen/psignal.c b/lib/libc/gen/psignal.c
index f4cb1079a493..ab044f683d86 100644
--- a/lib/libc/gen/psignal.c
+++ b/lib/libc/gen/psignal.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)psignal.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
/*
* Print the name of the signal indicated
* along with the supplied message.
diff --git a/lib/libc/gen/pututxline.c b/lib/libc/gen/pututxline.c
index 45a9d3e95e59..15df7b5f6783 100644
--- a/lib/libc/gen/pututxline.c
+++ b/lib/libc/gen/pututxline.c
@@ -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.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/endian.h>
#include <sys/stat.h>
diff --git a/lib/libc/gen/pw_scan.c b/lib/libc/gen/pw_scan.c
index 619092d3d4bc..35072d7c1b59 100644
--- a/lib/libc/gen/pw_scan.c
+++ b/lib/libc/gen/pw_scan.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)pw_scan.c 8.3 (Berkeley) 4/2/94");
-__FBSDID("$FreeBSD$");
-
/*
* This module is used to "verify" password entries by chpass(1) and
* pwd_mkdb(8).
diff --git a/lib/libc/gen/pw_scan.h b/lib/libc/gen/pw_scan.h
index b56703677ac0..63457a382821 100644
--- a/lib/libc/gen/pw_scan.h
+++ b/lib/libc/gen/pw_scan.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.
- *
- * @(#)pw_scan.h 8.1 (Berkeley) 4/1/94
- * $FreeBSD$
*/
#define _PWSCAN_MASTER 0x01
diff --git a/lib/libc/gen/raise.3 b/lib/libc/gen/raise.3
index efc4a50cce3a..c74777e7faa9 100644
--- a/lib/libc/gen/raise.3
+++ b/lib/libc/gen/raise.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)raise.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd May 7, 2010
.Dt RAISE 3
.Os
diff --git a/lib/libc/gen/raise.c b/lib/libc/gen/raise.c
index 1b987c5fdadf..9829de18dcdc 100644
--- a/lib/libc/gen/raise.c
+++ b/lib/libc/gen/raise.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)raise.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include <signal.h>
#include <unistd.h>
diff --git a/lib/libc/gen/rand48.3 b/lib/libc/gen/rand48.3
index c70a8320c15b..1e47c843058e 100644
--- a/lib/libc/gen/rand48.3
+++ b/lib/libc/gen/rand48.3
@@ -9,9 +9,6 @@
.\" of any kind. I shall in no event be liable for anything that happens
.\" to anyone/anything when using this software.
.\"
-.\" @(#)rand48.3 V1.0 MB 8 Oct 1993
-.\" $FreeBSD$
-.\"
.Dd September 4, 2012
.Dt RAND48 3
.Os
diff --git a/lib/libc/gen/rand48.h b/lib/libc/gen/rand48.h
index b6602dc5a9f7..9861e99683cb 100644
--- a/lib/libc/gen/rand48.h
+++ b/lib/libc/gen/rand48.h
@@ -9,8 +9,6 @@
* This software is provided ``as is'', and comes with no warranties
* of any kind. I shall in no event be liable for anything that happens
* to anyone/anything when using this software.
- *
- * $FreeBSD$
*/
#ifndef _RAND48_H_
diff --git a/lib/libc/gen/readdir-compat11.c b/lib/libc/gen/readdir-compat11.c
index ecdaf824cb78..606e15bd7b36 100644
--- a/lib/libc/gen/readdir-compat11.c
+++ b/lib/libc/gen/readdir-compat11.c
@@ -25,14 +25,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.
- *
- * From: @(#)readdir.c 8.3 (Berkeley) 9/29/94
* From: FreeBSD: head/lib/libc/gen/readdir.c 314436 2017-02-28 23:42:47Z imp
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#define _WANT_FREEBSD11_DIRENT
diff --git a/lib/libc/gen/readdir.c b/lib/libc/gen/readdir.c
index 9a2fae2784af..2a2fa999b7ce 100644
--- a/lib/libc/gen/readdir.c
+++ b/lib/libc/gen/readdir.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)readdir.c 8.3 (Berkeley) 9/29/94");
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#include <dirent.h>
diff --git a/lib/libc/gen/readpassphrase.3 b/lib/libc/gen/readpassphrase.3
index 174639263997..5703ba5f1aaf 100644
--- a/lib/libc/gen/readpassphrase.3
+++ b/lib/libc/gen/readpassphrase.3
@@ -18,8 +18,6 @@
.\" Agency (DARPA) and Air Force Research Laboratory, Air Force
.\" Materiel Command, USAF, under agreement number F39502-99-1-0512.
.\"
-.\" $FreeBSD$
-.\"
.Dd May 31, 2007
.Dt READPASSPHRASE 3
.Os
diff --git a/lib/libc/gen/readpassphrase.c b/lib/libc/gen/readpassphrase.c
index 0961fbb35a8b..5319d3e634af 100644
--- a/lib/libc/gen/readpassphrase.c
+++ b/lib/libc/gen/readpassphrase.c
@@ -21,9 +21,6 @@
* Materiel Command, USAF, under agreement number F39502-99-1-0512.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <ctype.h>
#include <errno.h>
diff --git a/lib/libc/gen/recvmmsg.c b/lib/libc/gen/recvmmsg.c
deleted file mode 100644
index 7c5c289569ee..000000000000
--- a/lib/libc/gen/recvmmsg.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2016 Boris Astardzhiev, Smartcom-Bulgaria AD
- * All rights reserved.
- *
- * 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(s), this list of conditions and the following disclaimer as
- * the first lines of this file unmodified other than the possible
- * addition of one or more copyright notices.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice(s), 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 HOLDER(S) ``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(S) 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <errno.h>
-#include <poll.h>
-#include <stddef.h>
-#include "libc_private.h"
-
-ssize_t
-recvmmsg(int s, struct mmsghdr *__restrict msgvec, size_t vlen, int flags,
- const struct timespec *__restrict timeout)
-{
- struct pollfd pfd[1];
- size_t i, rcvd;
- ssize_t ret;
- int res;
- short ev;
-
- if (timeout != NULL) {
- pfd[0].fd = s;
- pfd[0].revents = 0;
- pfd[0].events = ev = POLLIN | POLLRDNORM | POLLRDBAND |
- POLLPRI;
- res = ppoll(&pfd[0], 1, timeout, NULL);
- if (res == -1 || res == 0)
- return (res);
- if (pfd[0].revents & POLLNVAL) {
- errno = EBADF;
- return (-1);
- }
- if ((pfd[0].revents & ev) == 0) {
- errno = ETIMEDOUT;
- return (-1);
- }
- }
-
- ret = __sys_recvmsg(s, &msgvec[0].msg_hdr, flags);
- if (ret == -1)
- return (ret);
-
- msgvec[0].msg_len = ret;
-
- /*
- * Do non-blocking receive for second and later messages if
- * WAITFORONE is set.
- */
- if (flags & MSG_WAITFORONE)
- flags |= MSG_DONTWAIT;
-
- rcvd = 1;
- for (i = rcvd; i < vlen; i++, rcvd++) {
- ret = __sys_recvmsg(s, &msgvec[i].msg_hdr, flags);
- if (ret == -1) {
- /* We have received messages. Let caller know
- * about the data received, socket error is
- * returned on next invocation.
- */
- return (rcvd);
- }
-
- /* Save received bytes. */
- msgvec[i].msg_len = ret;
- }
-
- return (rcvd);
-}
diff --git a/lib/libc/gen/rewinddir.c b/lib/libc/gen/rewinddir.c
index 973e3e147cc7..df829e98d138 100644
--- a/lib/libc/gen/rewinddir.c
+++ b/lib/libc/gen/rewinddir.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)rewinddir.c 8.1 (Berkeley) 6/8/93");
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/types.h>
#include <dirent.h>
diff --git a/lib/libc/gen/rfork_thread.3 b/lib/libc/gen/rfork_thread.3
deleted file mode 100644
index dfd6fbcc3c68..000000000000
--- a/lib/libc/gen/rfork_thread.3
+++ /dev/null
@@ -1,87 +0,0 @@
-.\"
-.\" Copyright (c) 2000 Peter Wemm <peter@FreeBSD.org>
-.\" All rights reserved.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd February 6, 2011
-.Dt RFORK_THREAD 3
-.Os
-.Sh NAME
-.Nm rfork_thread
-.Nd create a rfork-based process thread
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft pid_t
-.Fn rfork_thread "int flags" "void *stack" "int (*func)(void *arg)" "void *arg"
-.Sh DESCRIPTION
-.Bf -symbolic
-The
-.Fn rfork_thread
-function has been deprecated in favor of
-.Xr pthread_create 3 .
-.Ef
-.Pp
-The
-.Fn rfork_thread
-function
-is a helper function for
-.Xr rfork 2 .
-It arranges for a new process to be created and the child process will
-call the specified function with the specified argument, while running on
-the supplied stack.
-.Pp
-Using this function should avoid the need to implement complex stack
-swap code.
-.Sh RETURN VALUES
-Upon successful completion,
-.Fn rfork_thread
-returns the process ID of the child process to the parent process.
-Otherwise, a value of -1 is returned
-to the parent process, no child process is created, and the global
-variable
-.Va errno
-is set to indicate the error.
-.Pp
-The child process context is not aware of a return from the
-.Fn rfork_thread
-function as it begins executing directly with the supplied function.
-.Sh ERRORS
-See
-.Xr rfork 2
-for error return codes.
-.Sh SEE ALSO
-.Xr fork 2 ,
-.Xr intro 2 ,
-.Xr minherit 2 ,
-.Xr rfork 2 ,
-.Xr vfork 2 ,
-.Xr pthread_create 3
-.Sh HISTORY
-The
-.Fn rfork_thread
-function first appeared in
-.Fx 4.3 .
diff --git a/lib/libc/gen/scandir-compat11.c b/lib/libc/gen/scandir-compat11.c
index 2c86b548f1d9..96c9b1052b48 100644
--- a/lib/libc/gen/scandir-compat11.c
+++ b/lib/libc/gen/scandir-compat11.c
@@ -25,14 +25,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.
- *
- * From: @(#)scandir.c 8.3 (Berkeley) 1/2/94
* From: FreeBSD: head/lib/libc/gen/scandir.c 317372 2017-04-24 14:56:41Z pfg
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* Scan the directory dirname calling select to make a list of selected
* directory entries then sort using qsort and compare routine dcomp.
@@ -58,8 +53,8 @@ __FBSDID("$FreeBSD$");
#define SELECT(x) select(x)
-static int freebsd11_alphasort_thunk(void *thunk, const void *p1,
- const void *p2);
+static int freebsd11_scandir_thunk_cmp(const void *p1, const void *p2,
+ void *thunk);
int
freebsd11_scandir(const char *dirname, struct freebsd11_dirent ***namelist,
@@ -116,7 +111,7 @@ freebsd11_scandir(const char *dirname, struct freebsd11_dirent ***namelist,
closedir(dirp);
if (numitems && dcomp != NULL)
qsort_r(names, numitems, sizeof(struct freebsd11_dirent *),
- &dcomp, freebsd11_alphasort_thunk);
+ freebsd11_scandir_thunk_cmp, &dcomp);
*namelist = names;
return (numitems);
@@ -141,7 +136,7 @@ freebsd11_alphasort(const struct freebsd11_dirent **d1,
}
static int
-freebsd11_alphasort_thunk(void *thunk, const void *p1, const void *p2)
+freebsd11_scandir_thunk_cmp(const void *p1, const void *p2, void *thunk)
{
int (*dc)(const struct freebsd11_dirent **, const struct
freebsd11_dirent **);
diff --git a/lib/libc/gen/scandir.3 b/lib/libc/gen/scandir.3
index 7f9891343a1a..6656842c251f 100644
--- a/lib/libc/gen/scandir.3
+++ b/lib/libc/gen/scandir.3
@@ -25,26 +25,46 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)scandir.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd January 3, 2010
+.Dd August 31, 2023
.Dt SCANDIR 3
.Os
.Sh NAME
.Nm scandir ,
-.Nm alphasort
+.Nm scandirat ,
+.Nm scandir_b ,
+.Nm alphasort ,
+.Nm versionsort
.Nd scan a directory
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.In dirent.h
.Ft int
-.Fn scandir "const char *dirname" "struct dirent ***namelist" "int \*(lp*select\*(rp\*(lpconst struct dirent *\*(rp" "int \*(lp*compar\*(rp\*(lpconst struct dirent **, const struct dirent **\*(rp"
+.Fo scandir
+.Fa "const char *dirname"
+.Fa "struct dirent ***namelist"
+.Fa "int \*(lp*select\*(rp\*(lpconst struct dirent *\*(rp"
+.Fa "int \*(lp*compar\*(rp\*(lpconst struct dirent **, const struct dirent **\*(rp"
+.Fc
+.Ft int
+.Fo scandirat
+.Fa "int dirfd"
+.Fa "const char *dirname"
+.Fa "struct dirent ***namelist"
+.Fa "int \*(lp*select\*(rp\*(lpconst struct dirent *\*(rp"
+.Fa "int \*(lp*compar\*(rp\*(lpconst struct dirent **, const struct dirent **\*(rp"
+.Fc
.Ft int
-.Fn scandir_b "const char *dirname" "struct dirent ***namelist" "int \*(lp*select\^(rp\*(lpconst struct dirent *\*(rp" "int \*(lp^compar\*(rp\*(lpconst struct dirent **, const struct dirent **\*(rp"
+.Fo scandir_b
+.Fa "const char *dirname"
+.Fa "struct dirent ***namelist"
+.Fa "int \*(lp^select\*(rp\*(lpconst struct dirent *\*(rp"
+.Fa "int \*(lp^compar\*(rp\*(lpconst struct dirent **, const struct dirent **\*(rp"
+.Fc
.Ft int
.Fn alphasort "const struct dirent **d1" "const struct dirent **d2"
+.Ft int
+.Fn versionsort "const struct dirent **d1" "const struct dirent **d2"
.Sh DESCRIPTION
The
.Fn scandir
@@ -86,11 +106,51 @@ is a routine which can be used for the
argument to sort the array alphabetically using
.Xr strcoll 3 .
.Pp
+The
+.Fn versionsort
+function is a routine which can be used for the
+.Fa compar
+argument to sort the array naturally using
+.Xr strverscmp 3 .
+.Pp
The memory allocated for the array can be deallocated with
.Xr free 3 ,
by freeing each pointer in the array and then the array itself.
.Pp
The
+.Fn scandirat
+function is similar to
+.Fn scandir ,
+but takes an additional
+.Fa dirfd
+argument.
+If the supplied
+.Fa dirname
+is absolute, the function's behavior is identical to that of
+.Fn scandir ,
+the
+.Fa dirfd
+argument is unused.
+If
+.Fa dirname
+is relative,
+.Fa dirfd
+must be a valid file descriptor referencing a directory, in
+which case the
+.Fa dirname
+lookup is performed relative to the directory referenced by
+.Fa dirfd .
+If
+.Fa dirfd
+has the special value
+.Va AT_FDCWD ,
+then the current process directory is used as the base for
+relative lookups.
+See
+.Xr openat 2
+for additional details.
+.Pp
+The
.Fn scandir_b
function behaves in the same way as
.Fn scandir ,
@@ -103,11 +163,17 @@ Returns \-1 if the directory cannot be opened for reading or if
.Xr malloc 3
cannot allocate enough memory to hold all the data structures.
.Sh SEE ALSO
+.Xr openat 2 ,
.Xr directory 3 ,
.Xr malloc 3 ,
.Xr qsort 3 ,
.Xr strcoll 3 ,
+.Xr strverscmp 3 ,
.Xr dir 5
+.Sh STANDARDS
+The
+.Fn versionsort
+function is a GNU extension and conforms to no standard.
.Sh HISTORY
The
.Fn scandir
@@ -115,3 +181,9 @@ and
.Fn alphasort
functions appeared in
.Bx 4.2 .
+The
+.Fn scandirat
+and
+.Fn versionsort
+functions were added in
+.Fx 13.2 .
diff --git a/lib/libc/gen/scandir.c b/lib/libc/gen/scandir.c
index 10cd7633dac1..f59f57047278 100644
--- a/lib/libc/gen/scandir.c
+++ b/lib/libc/gen/scandir.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)scandir.c 8.3 (Berkeley) 1/2/94");
-__FBSDID("$FreeBSD$");
-
/*
* Scan the directory dirname calling select to make a list of selected
* directory entries then sort using qsort and compare routine dcomp.
@@ -42,8 +38,10 @@ __FBSDID("$FreeBSD$");
#include "namespace.h"
#include <dirent.h>
+#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include "un-namespace.h"
#ifdef I_AM_SCANDIR_B
@@ -61,25 +59,21 @@ typedef DECLARE_BLOCK(int, select_block, const struct dirent *);
typedef DECLARE_BLOCK(int, dcomp_block, const struct dirent **,
const struct dirent **);
#else
-static int alphasort_thunk(void *thunk, const void *p1, const void *p2);
+static int scandir_thunk_cmp(const void *p1, const void *p2, void *thunk);
#endif
-int
+static int
#ifdef I_AM_SCANDIR_B
-scandir_b(const char *dirname, struct dirent ***namelist, select_block select,
+scandir_b_dirp(DIR *dirp, struct dirent ***namelist, select_block select,
dcomp_block dcomp)
#else
-scandir(const char *dirname, struct dirent ***namelist,
+scandir_dirp(DIR *dirp, struct dirent ***namelist,
int (*select)(const struct dirent *), int (*dcomp)(const struct dirent **,
- const struct dirent **))
+ const struct dirent **))
#endif
{
struct dirent *d, *p, **names = NULL;
size_t arraysz, numitems;
- DIR *dirp;
-
- if ((dirp = opendir(dirname)) == NULL)
- return(-1);
numitems = 0;
arraysz = 32; /* initial estimate of the array size */
@@ -125,7 +119,7 @@ scandir(const char *dirname, struct dirent ***namelist,
qsort_b(names, numitems, sizeof(struct dirent *), (void*)dcomp);
#else
qsort_r(names, numitems, sizeof(struct dirent *),
- &dcomp, alphasort_thunk);
+ scandir_thunk_cmp, &dcomp);
#endif
*namelist = names;
return (numitems);
@@ -138,7 +132,50 @@ fail:
return (-1);
}
+int
+#ifdef I_AM_SCANDIR_B
+scandir_b(const char *dirname, struct dirent ***namelist, select_block select,
+ dcomp_block dcomp)
+#else
+scandir(const char *dirname, struct dirent ***namelist,
+ int (*select)(const struct dirent *), int (*dcomp)(const struct dirent **,
+ const struct dirent **))
+#endif
+{
+ DIR *dirp;
+
+ dirp = opendir(dirname);
+ if (dirp == NULL)
+ return (-1);
+ return (
+#ifdef I_AM_SCANDIR_B
+ scandir_b_dirp
+#else
+ scandir_dirp
+#endif
+ (dirp, namelist, select, dcomp));
+}
+
#ifndef I_AM_SCANDIR_B
+int
+scandirat(int dirfd, const char *dirname, struct dirent ***namelist,
+ int (*select)(const struct dirent *), int (*dcomp)(const struct dirent **,
+ const struct dirent **))
+{
+ DIR *dirp;
+ int fd;
+
+ fd = _openat(dirfd, dirname, O_RDONLY | O_DIRECTORY | O_CLOEXEC);
+ if (fd == -1)
+ return (-1);
+ dirp = fdopendir(fd);
+ if (dirp == NULL) {
+ _close(fd);
+ return (-1);
+ }
+ return (scandir_dirp(dirp, namelist, select, dcomp));
+}
+
/*
* Alphabetic order comparison routine for those who want it.
* POSIX 2008 requires that alphasort() uses strcoll().
@@ -150,8 +187,15 @@ alphasort(const struct dirent **d1, const struct dirent **d2)
return (strcoll((*d1)->d_name, (*d2)->d_name));
}
+int
+versionsort(const struct dirent **d1, const struct dirent **d2)
+{
+
+ return (strverscmp((*d1)->d_name, (*d2)->d_name));
+}
+
static int
-alphasort_thunk(void *thunk, const void *p1, const void *p2)
+scandir_thunk_cmp(const void *p1, const void *p2, void *thunk)
{
int (*dc)(const struct dirent **, const struct dirent **);
diff --git a/lib/libc/gen/scandir_b.c b/lib/libc/gen/scandir_b.c
index 6310a9110598..3350ce8227b9 100644
--- a/lib/libc/gen/scandir_b.c
+++ b/lib/libc/gen/scandir_b.c
@@ -22,8 +22,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$
*/
#define I_AM_SCANDIR_B
#include "scandir.c"
diff --git a/lib/libc/arm/gen/_get_tp.c b/lib/libc/gen/sched_getaffinity.c
index 495fa982dd6f..fce47fbfc0d2 100644
--- a/lib/libc/arm/gen/_get_tp.c
+++ b/lib/libc/gen/sched_getaffinity.c
@@ -1,9 +1,7 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
* Copyright (c) 2021 The FreeBSD Foundation
*
- * This software were developed by Konstantin Belousov
+ * This software were developed by Konstantin Belousov <kib@FreeBSD.org>
* under sponsorship from the FreeBSD Foundation.
*
* Redistribution and use in source and binary forms, with or without
@@ -28,19 +26,31 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
+#define _WANT_P_OSREL
#include <sys/param.h>
+#include <errno.h>
+#include <sched.h>
#include <string.h>
-#include <stdint.h>
+
#include "libc_private.h"
-void *
-_get_tp(void)
+int
+sched_getaffinity(pid_t pid, size_t cpusetsz, cpuset_t *cpuset)
{
- void *res;
+ cpuwhich_t which;
+ int error;
+
+ if (__getosreldate() < P_OSREL_TIDPID) {
+ if (pid == 0 || pid > _PID_MAX)
+ which = CPU_WHICH_TID;
+ else
+ which = CPU_WHICH_PID;
+ } else
+ which = CPU_WHICH_TIDPID;
- __asm __volatile("mrc p15, 0, %0, c13, c0, 3" : "=r" (res));
- return (res);
+ error = cpuset_getaffinity(CPU_LEVEL_WHICH, which,
+ pid == 0 ? -1 : pid, cpusetsz, cpuset);
+ if (error == -1 && errno == ERANGE)
+ errno = EINVAL;
+ return (error);
}
diff --git a/lib/libc/gen/sched_setaffinity.c b/lib/libc/gen/sched_setaffinity.c
new file mode 100644
index 000000000000..b878e1affc41
--- /dev/null
+++ b/lib/libc/gen/sched_setaffinity.c
@@ -0,0 +1,79 @@
+/*-
+ * Copyright (c) 2021 The FreeBSD Foundation
+ *
+ * This software were developed by Konstantin Belousov <kib@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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 AUTHOR 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 AUTHOR 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.
+ */
+
+#define _WANT_P_OSREL
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <errno.h>
+#include <sched.h>
+#include <string.h>
+
+#include "libc_private.h"
+
+int
+sched_setaffinity(pid_t pid, size_t cpusetsz, const cpuset_t *cpuset)
+{
+ static int mp_maxid;
+ cpuwhich_t which;
+ cpuset_t c;
+ int error, lbs, cpu;
+ size_t len, sz;
+
+ if (__getosreldate() < P_OSREL_TIDPID) {
+ if (pid == 0 || pid > _PID_MAX)
+ which = CPU_WHICH_TID;
+ else
+ which = CPU_WHICH_PID;
+ } else
+ which = CPU_WHICH_TIDPID;
+
+ sz = cpusetsz > sizeof(cpuset_t) ? sizeof(cpuset_t) : cpusetsz;
+ memset(&c, 0, sizeof(c));
+ memcpy(&c, cpuset, sz);
+
+ /* Linux ignores high bits */
+ if (mp_maxid == 0) {
+ len = sizeof(mp_maxid);
+ error = sysctlbyname("kern.smp.maxid", &mp_maxid, &len,
+ NULL, 0);
+ if (error == -1)
+ return (error);
+ }
+ lbs = CPU_FLS(&c) - 1;
+ if (lbs > mp_maxid) {
+ CPU_FOREACH_ISSET(cpu, &c)
+ if (cpu > mp_maxid)
+ CPU_CLR(cpu, &c);
+ }
+ error = cpuset_setaffinity(CPU_LEVEL_WHICH, which,
+ pid == 0 ? -1 : pid, sizeof(cpuset_t), &c);
+ if (error == -1 && errno == EDEADLK)
+ errno = EINVAL;
+
+ return (error);
+}
diff --git a/lib/libc/gen/seed48.c b/lib/libc/gen/seed48.c
index 5339b8c0c4e9..258c4bac3c9f 100644
--- a/lib/libc/gen/seed48.c
+++ b/lib/libc/gen/seed48.c
@@ -11,9 +11,6 @@
* to anyone/anything when using this software.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "rand48.h"
extern unsigned short _rand48_seed[3];
diff --git a/lib/libc/gen/seekdir.c b/lib/libc/gen/seekdir.c
index 3974af7d73ee..c796aa7e3550 100644
--- a/lib/libc/gen/seekdir.c
+++ b/lib/libc/gen/seekdir.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)seekdir.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#include <dirent.h>
diff --git a/lib/libc/gen/sem.c b/lib/libc/gen/sem.c
index a04926a950fe..9b0071bc64c0 100644
--- a/lib/libc/gen/sem.c
+++ b/lib/libc/gen/sem.c
@@ -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>.
* Copyright (C) 2000 Jason Evans <jasone@freebsd.org>.
@@ -28,8 +28,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$
*/
/*
diff --git a/lib/libc/gen/sem_destroy.3 b/lib/libc/gen/sem_destroy.3
index b43742065620..13cc81a03710 100644
--- a/lib/libc/gen/sem_destroy.3
+++ b/lib/libc/gen/sem_destroy.3
@@ -25,8 +25,6 @@
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd February 15, 2000
.Dt SEM_DESTROY 3
.Os
diff --git a/lib/libc/gen/sem_getvalue.3 b/lib/libc/gen/sem_getvalue.3
index d81c2b17eaaa..8b2970373287 100644
--- a/lib/libc/gen/sem_getvalue.3
+++ b/lib/libc/gen/sem_getvalue.3
@@ -25,8 +25,6 @@
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd February 15, 2000
.Dt SEM_GETVALUE 3
.Os
diff --git a/lib/libc/gen/sem_init.3 b/lib/libc/gen/sem_init.3
index a96749b0bad2..e0e4b3b3d6c2 100644
--- a/lib/libc/gen/sem_init.3
+++ b/lib/libc/gen/sem_init.3
@@ -25,8 +25,6 @@
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd January 9, 2010
.Dt SEM_INIT 3
.Os
diff --git a/lib/libc/gen/sem_new.c b/lib/libc/gen/sem_new.c
index 409f4ce76608..ba81fb0ded78 100644
--- a/lib/libc/gen/sem_new.c
+++ b/lib/libc/gen/sem_new.c
@@ -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>.
* 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$
*/
#include "namespace.h"
diff --git a/lib/libc/gen/sem_open.3 b/lib/libc/gen/sem_open.3
index 2fdc01934172..76fa3463e1ab 100644
--- a/lib/libc/gen/sem_open.3
+++ b/lib/libc/gen/sem_open.3
@@ -25,8 +25,6 @@
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd January 9, 2010
.Dt SEM_OPEN 3
.Os
diff --git a/lib/libc/gen/sem_post.3 b/lib/libc/gen/sem_post.3
index dea8eb697169..b389b6686a20 100644
--- a/lib/libc/gen/sem_post.3
+++ b/lib/libc/gen/sem_post.3
@@ -25,8 +25,6 @@
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd January 28, 2015
.Dt SEM_POST 3
.Os
diff --git a/lib/libc/gen/sem_timedwait.3 b/lib/libc/gen/sem_timedwait.3
index e5e651541d37..8f253bb35f72 100644
--- a/lib/libc/gen/sem_timedwait.3
+++ b/lib/libc/gen/sem_timedwait.3
@@ -32,8 +32,6 @@
.\" the referee document. The original Standard can be obtained online at
.\" http://www.opengroup.org/unix/online.html.
.\"
-.\" $FreeBSD$
-.\"
.Dd May 24, 2017
.Dt SEM_TIMEDWAIT 3
.Os
diff --git a/lib/libc/gen/sem_wait.3 b/lib/libc/gen/sem_wait.3
index cb5a2f68b782..2d4c77829a95 100644
--- a/lib/libc/gen/sem_wait.3
+++ b/lib/libc/gen/sem_wait.3
@@ -25,8 +25,6 @@
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd April 16, 2013
.Dt SEM_WAIT 3
.Os
diff --git a/lib/libc/gen/semctl.c b/lib/libc/gen/semctl.c
index 8760d76a82fa..374f01508236 100644
--- a/lib/libc/gen/semctl.c
+++ b/lib/libc/gen/semctl.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002 Doug Rabson
* All rights reserved.
@@ -28,9 +28,6 @@
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#ifndef NO_COMPAT7
#define _WANT_SEMUN_OLD
#endif
diff --git a/lib/libc/gen/sendmmsg.c b/lib/libc/gen/sendmmsg.c
deleted file mode 100644
index 7b3e8f357613..000000000000
--- a/lib/libc/gen/sendmmsg.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2016 Boris Astardzhiev, Smartcom-Bulgaria AD
- * All rights reserved.
- *
- * 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(s), this list of conditions and the following disclaimer as
- * the first lines of this file unmodified other than the possible
- * addition of one or more copyright notices.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice(s), 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 HOLDER(S) ``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(S) 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include "libc_private.h"
-
-ssize_t
-sendmmsg(int s, struct mmsghdr *__restrict msgvec, size_t vlen, int flags)
-{
- size_t i, sent;
- ssize_t ret;
-
- sent = 0;
- for (i = 0; i < vlen; i++, sent++) {
- ret = __sys_sendmsg(s, &msgvec[i].msg_hdr, flags);
- if (ret == -1) {
- if (sent != 0) {
- /*
- * We have sent messages. Let caller
- * know about the data sent, socket
- * error is returned on next
- * invocation.
- */
- return (sent);
- }
- return (ret);
- }
-
- /* Save sent bytes. */
- msgvec[i].msg_len = ret;
- }
-
- return (sent);
-}
diff --git a/lib/libc/gen/setdomainname.c b/lib/libc/gen/setdomainname.c
index 2a001b9ffa98..c40b7a393e3b 100644
--- a/lib/libc/gen/setdomainname.c
+++ b/lib/libc/gen/setdomainname.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)sethostname.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/sysctl.h>
diff --git a/lib/libc/gen/sethostname.c b/lib/libc/gen/sethostname.c
index 0e120775afb9..eeb3ec5cc6db 100644
--- a/lib/libc/gen/sethostname.c
+++ b/lib/libc/gen/sethostname.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)sethostname.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/sysctl.h>
diff --git a/lib/libc/gen/setjmp.3 b/lib/libc/gen/setjmp.3
index 5a5c0964ce10..e7c52473dbc9 100644
--- a/lib/libc/gen/setjmp.3
+++ b/lib/libc/gen/setjmp.3
@@ -29,10 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)setjmp.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd June 4, 1993
+.Dd April 2, 2022
.Dt SETJMP 3
.Os
.Sh NAME
@@ -170,3 +167,9 @@ and
.Fn siglongjmp
functions conform to
.St -p1003.1-88 .
+.Sh HISTORY
+The
+.Fn setjmp
+and
+.Fn longjmp
+functions first appeared in the Programmer's Workbench (PWB/UNIX).
diff --git a/lib/libc/gen/setjmperr.c b/lib/libc/gen/setjmperr.c
index abc13c0339f1..1ba722c30146 100644
--- a/lib/libc/gen/setjmperr.c
+++ b/lib/libc/gen/setjmperr.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)setjmperr.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
/*
* This routine is called from longjmp() when an error occurs.
* Programs that wish to exit gracefully from this error may
diff --git a/lib/libc/gen/setmode.3 b/lib/libc/gen/setmode.3
index 3e6796239db0..a5dd05a5e7c6 100644
--- a/lib/libc/gen/setmode.3
+++ b/lib/libc/gen/setmode.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)setmode.3 8.2 (Berkeley) 4/28/95
-.\" $FreeBSD$
-.\"
.Dd July 18, 2019
.Dt SETMODE 3
.Os
diff --git a/lib/libc/gen/setmode.c b/lib/libc/gen/setmode.c
index 66976cdd7bcf..8d7ba905067f 100644
--- a/lib/libc/gen/setmode.c
+++ b/lib/libc/gen/setmode.c
@@ -32,10 +32,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)setmode.c 8.2 (Berkeley) 3/25/94");
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/lib/libc/gen/setproctitle.3 b/lib/libc/gen/setproctitle.3
index 1dd602ef58dc..15bafa23a982 100644
--- a/lib/libc/gen/setproctitle.3
+++ b/lib/libc/gen/setproctitle.3
@@ -1,26 +1,31 @@
-.\" Copyright (c) 1995 Peter Wemm <peter@FreeBSD.org>
-.\" All rights reserved.
+.\"
+.\" SPDX-License-Identifier: BSD-2-Clause
+.\"
+.\" Copyright (c) 1995 Peter Wemm
.\"
.\" Redistribution and use in source and binary forms, with or without
-.\" modification, is permitted provided that the following conditions
+.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
-.\" notice immediately at the beginning of the file, without modification,
-.\" this list of conditions, and the following disclaimer.
+.\" 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.
-.\" 3. This work was done expressly for inclusion into FreeBSD. Other use
-.\" is permitted provided this notation is included.
-.\" 4. Absolutely no warranty of function or purpose is made by the author
-.\" Peter Wemm.
-.\" 5. Modifications may be freely made to this file providing the above
-.\" conditions are met.
.\"
-.\" $FreeBSD$
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
.\"
.\" The following requests are required for all man pages.
-.Dd November 13, 2020
+.Dd November 28, 2022
.Dt SETPROCTITLE 3
.Os
.Sh NAME
@@ -28,7 +33,6 @@
.Nm setproctitle_fast
.Nd set process title
.Sh SYNOPSIS
-.In sys/types.h
.In unistd.h
.Ft void
.Fn setproctitle "const char *fmt" "..."
diff --git a/lib/libc/gen/setproctitle.c b/lib/libc/gen/setproctitle.c
index 3f858952255c..715951a8c96d 100644
--- a/lib/libc/gen/setproctitle.c
+++ b/lib/libc/gen/setproctitle.c
@@ -1,23 +1,30 @@
-/*
- * Copyright (c) 1995 Peter Wemm <peter@freebsd.org>
- * All rights reserved.
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 1995 Peter Wemm
*
* Redistribution and use in source and binary forms, with or without
- * modification, is permitted provided that the following conditions
+ * modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
- * notice immediately at the beginning of the file, without modification,
- * this list of conditions, and the following disclaimer.
+ * 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.
- * 3. Absolutely no warranty of function or purpose is made by the author
- * Peter Wemm.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#include <sys/elf_common.h>
@@ -62,7 +69,7 @@ setproctitle_internal(const char *fmt, va_list ap)
static struct ps_strings *ps_strings;
static char *buf = NULL;
static char *obuf = NULL;
- static char **oargv, *kbuf;
+ static char **oargv;
static int oargc = -1;
static char *nargv[2] = { NULL, NULL };
char **nargvp;
@@ -103,12 +110,10 @@ setproctitle_internal(const char *fmt, va_list ap)
nargvp = nargv;
nargc = 1;
- kbuf = buf;
} else if (*obuf != '\0') {
/* Idea from NetBSD - reset the title on fmt == NULL */
nargvp = oargv;
nargc = oargc;
- kbuf = obuf;
} else
/* Nothing to restore */
return (NULL);
diff --git a/lib/libc/gen/setprogname.c b/lib/libc/gen/setprogname.c
index 29a6cd025ec8..853c5f277386 100644
--- a/lib/libc/gen/setprogname.c
+++ b/lib/libc/gen/setprogname.c
@@ -1,6 +1,3 @@
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdlib.h>
#include <string.h>
diff --git a/lib/libc/gen/siginterrupt.3 b/lib/libc/gen/siginterrupt.3
index 0fcbcb984b6a..4e286f28df7c 100644
--- a/lib/libc/gen/siginterrupt.3
+++ b/lib/libc/gen/siginterrupt.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)siginterrupt.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd June 4, 1993
.Dt SIGINTERRUPT 3
.Os
diff --git a/lib/libc/gen/siginterrupt.c b/lib/libc/gen/siginterrupt.c
index 2d7f9950776e..0a05e89982dc 100644
--- a/lib/libc/gen/siginterrupt.c
+++ b/lib/libc/gen/siginterrupt.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)siginterrupt.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <signal.h>
#include "un-namespace.h"
diff --git a/lib/libc/gen/siglist.c b/lib/libc/gen/siglist.c
index 796a0b702136..c1d0a8d425e1 100644
--- a/lib/libc/gen/siglist.c
+++ b/lib/libc/gen/siglist.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)siglist.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include <signal.h>
const char *const sys_signame[NSIG] = {
diff --git a/lib/libc/gen/signal.3 b/lib/libc/gen/signal.3
index 4e32d8cb75e7..56e77325eed8 100644
--- a/lib/libc/gen/signal.3
+++ b/lib/libc/gen/signal.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)signal.3 8.3 (Berkeley) 4/19/94
-.\" $FreeBSD$
-.\"
.Dd December 1, 2017
.Dt SIGNAL 3
.Os
diff --git a/lib/libc/gen/signal.c b/lib/libc/gen/signal.c
index 62af2e95bc79..dce06bba3678 100644
--- a/lib/libc/gen/signal.c
+++ b/lib/libc/gen/signal.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)signal.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
/*
* Almost backwards compatible signal.
*/
diff --git a/lib/libc/gen/sigsetops.3 b/lib/libc/gen/sigsetops.3
index a184289aeb8a..109b1d9d4a8c 100644
--- a/lib/libc/gen/sigsetops.3
+++ b/lib/libc/gen/sigsetops.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)sigsetops.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd October 29, 2019
.Dt SIGSETOPS 3
.Os
diff --git a/lib/libc/gen/sigsetops.c b/lib/libc/gen/sigsetops.c
index 53a450c0e5f6..3e22b0dba5e9 100644
--- a/lib/libc/gen/sigsetops.c
+++ b/lib/libc/gen/sigsetops.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)sigsetops.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <signal.h>
diff --git a/lib/libc/gen/sleep.3 b/lib/libc/gen/sleep.3
deleted file mode 100644
index c40dea9f8f83..000000000000
--- a/lib/libc/gen/sleep.3
+++ /dev/null
@@ -1,83 +0,0 @@
-.\" Copyright (c) 1986, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)sleep.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd February 13, 1998
-.Dt SLEEP 3
-.Os
-.Sh NAME
-.Nm sleep
-.Nd suspend thread execution for an interval measured in seconds
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft unsigned int
-.Fn sleep "unsigned int seconds"
-.Sh DESCRIPTION
-The
-.Fn sleep
-function suspends execution of the calling thread until either
-.Fa seconds
-seconds have elapsed or a signal is delivered to the thread and its
-action is to invoke a signal-catching function or to terminate the
-thread or process.
-System activity may lengthen the sleep by an indeterminate amount.
-.Pp
-This function is implemented using
-.Xr nanosleep 2
-by pausing for
-.Fa seconds
-seconds or until a signal occurs.
-Consequently, in this implementation,
-sleeping has no effect on the state of process timers,
-and there is no special handling for SIGALRM.
-.Sh RETURN VALUES
-If the
-.Fn sleep
-function returns because the requested time has elapsed, the value
-returned will be zero.
-If the
-.Fn sleep
-function returns due to the delivery of a signal, the value returned
-will be the unslept amount (the requested time minus the time actually
-slept) in seconds.
-.Sh SEE ALSO
-.Xr nanosleep 2 ,
-.Xr usleep 3
-.Sh STANDARDS
-The
-.Fn sleep
-function conforms to
-.St -p1003.1-90 .
-.Sh HISTORY
-A
-.Fn sleep
-function appeared in
-.At v7 .
diff --git a/lib/libc/gen/sleep.c b/lib/libc/gen/sleep.c
index 620fda36ac10..e32d434d4d33 100644
--- a/lib/libc/gen/sleep.c
+++ b/lib/libc/gen/sleep.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)sleep.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <errno.h>
#include <limits.h>
@@ -59,9 +55,7 @@ __sleep(unsigned int seconds)
time_to_sleep.tv_sec = seconds;
time_to_sleep.tv_nsec = 0;
- if (((int (*)(const struct timespec *, struct timespec *))
- __libc_interposing[INTERPOS_nanosleep])(
- &time_to_sleep, &time_remaining) != -1)
+ if (INTERPOS_SYS(nanosleep, &time_to_sleep, &time_remaining) != -1)
return (0);
if (errno != EINTR)
return (seconds); /* best guess */
diff --git a/lib/libc/gen/statvfs.3 b/lib/libc/gen/statvfs.3
index 73109bd98342..e88f01eeeb26 100644
--- a/lib/libc/gen/statvfs.3
+++ b/lib/libc/gen/statvfs.3
@@ -26,8 +26,6 @@
.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd July 13, 2002
.Dt STATVFS 3
.Os
diff --git a/lib/libc/gen/statvfs.c b/lib/libc/gen/statvfs.c
index fe9462bd307b..94c61f0cd73d 100644
--- a/lib/libc/gen/statvfs.c
+++ b/lib/libc/gen/statvfs.c
@@ -27,9 +27,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#include <sys/mount.h>
diff --git a/lib/libc/gen/stringlist.3 b/lib/libc/gen/stringlist.3
index d4480beb0e2d..5e116f636281 100644
--- a/lib/libc/gen/stringlist.3
+++ b/lib/libc/gen/stringlist.3
@@ -26,8 +26,6 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd November 28, 1999
.Dt STRINGLIST 3
.Os
diff --git a/lib/libc/gen/stringlist.c b/lib/libc/gen/stringlist.c
index 158f3d20705d..5f333f3807aa 100644
--- a/lib/libc/gen/stringlist.c
+++ b/lib/libc/gen/stringlist.c
@@ -28,8 +28,6 @@
#include <sys/cdefs.h>
__RCSID("$NetBSD: stringlist.c,v 1.2 1997/01/17 07:26:20 lukem Exp $");
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <stdio.h>
#include <string.h>
diff --git a/lib/libc/gen/strtofflags.3 b/lib/libc/gen/strtofflags.3
index 871936aa3fed..0cf996275480 100644
--- a/lib/libc/gen/strtofflags.3
+++ b/lib/libc/gen/strtofflags.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)setmode.3 8.2 (Berkeley) 4/28/95
-.\" $FreeBSD$
-.\"
.Dd January 1, 2000
.Dt STRTOFFLAGS 3
.Os
diff --git a/lib/libc/gen/strtofflags.c b/lib/libc/gen/strtofflags.c
index 174c6742e232..73b4db54ccdd 100644
--- a/lib/libc/gen/strtofflags.c
+++ b/lib/libc/gen/strtofflags.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)stat_flags.c 8.1 (Berkeley) 5/31/93");
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/lib/libc/gen/sysconf.3 b/lib/libc/gen/sysconf.3
index c30c4453b3e7..e38357b898a7 100644
--- a/lib/libc/gen/sysconf.3
+++ b/lib/libc/gen/sysconf.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)sysconf.3 8.3 (Berkeley) 4/19/94
-.\" $FreeBSD$
-.\"
.Dd April 26, 2013
.Dt SYSCONF 3
.Os
diff --git a/lib/libc/gen/sysconf.c b/lib/libc/gen/sysconf.c
index 26bb9043ed3c..be42dd238b56 100644
--- a/lib/libc/gen/sysconf.c
+++ b/lib/libc/gen/sysconf.c
@@ -32,10 +32,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)sysconf.c 8.2 (Berkeley) 3/20/94");
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#include <sys/time.h>
@@ -54,7 +50,7 @@ __FBSDID("$FreeBSD$");
#include "un-namespace.h"
#include "../stdlib/atexit.h"
-#include "tzfile.h" /* from ../../../contrib/tzcode/stdtime */
+#include "tzdir.h" /* from ../../../contrib/tzcode/stdtime */
#include "libc_private.h"
#define _PATH_ZONEINFO TZDIR /* from tzfile.h */
diff --git a/lib/libc/gen/sysctl.3 b/lib/libc/gen/sysctl.3
index 2d8da3974086..7896e99e275f 100644
--- a/lib/libc/gen/sysctl.3
+++ b/lib/libc/gen/sysctl.3
@@ -25,10 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)sysctl.3 8.4 (Berkeley) 5/9/95
-.\" $FreeBSD$
-.\"
-.Dd October 18, 2021
+.Dd March 16, 2023
.Dt SYSCTL 3
.Os
.Sh NAME
@@ -349,13 +346,11 @@ information.
.It Dv KERN_OSTYPE Ta string Ta no
.It Dv KERN_POSIX1 Ta integer Ta no
.It Dv KERN_PROC Ta node Ta not applicable
-.It Dv KERN_PROF Ta node Ta not applicable
.It Dv KERN_QUANTUM Ta integer Ta yes
.It Dv KERN_SAVED_IDS Ta integer Ta no
.It Dv KERN_SECURELVL Ta integer Ta raise only
.It Dv KERN_UPDATEINTERVAL Ta integer Ta no
.It Dv KERN_VERSION Ta string Ta no
-.It Dv KERN_VNODE Ta struct xvnode Ta no
.El
.Bl -tag -width 6n
.It Li KERN_ARGMAX
@@ -477,41 +472,6 @@ implies the current process.
.It Dv KERN_PROC_ARGS Ta "A process ID"
.It Dv KERN_PROC_PATHNAME Ta "A process ID"
.El
-.It Li KERN_PROF
-Return profiling information about the kernel.
-If the kernel is not compiled for profiling,
-attempts to retrieve any of the KERN_PROF values will
-fail with
-.Er ENOENT .
-The third level names for the string and integer profiling information
-is detailed below.
-The changeable column shows whether a process with appropriate
-privilege may change the value.
-.Bl -column "GPROFXGMONPARAMXXX" "struct gmonparamXXX" -offset indent
-.It Sy Third Level Name Ta Sy Type Ta Sy Changeable
-.It Dv GPROF_STATE Ta integer Ta yes
-.It Dv GPROF_COUNT Ta u_short[\|] Ta yes
-.It Dv GPROF_FROMS Ta u_short[\|] Ta yes
-.It Dv GPROF_TOS Ta struct tostruct Ta yes
-.It Dv GPROF_GMONPARAM Ta struct gmonparam Ta no
-.El
-.Pp
-The variables are as follows:
-.Bl -tag -width 6n
-.It Li GPROF_STATE
-Returns GMON_PROF_ON or GMON_PROF_OFF to show that profiling
-is running or stopped.
-.It Li GPROF_COUNT
-Array of statistical program counter counts.
-.It Li GPROF_FROMS
-Array indexed by program counter of call-from points.
-.It Li GPROF_TOS
-Array of
-.Va struct tostruct
-describing destination of calls and their counts.
-.It Li GPROF_GMONPARAM
-Structure giving the sizes of the above arrays.
-.El
.It Li KERN_QUANTUM
The maximum period of time, in microseconds, for which a process is allowed
to run without being preempted if other processes are in the run queue.
@@ -523,14 +483,6 @@ This level may be raised by processes with appropriate privilege.
It may not be lowered.
.It Li KERN_VERSION
The system version string.
-.It Li KERN_VNODE
-Return the entire vnode table.
-Note, the vnode table is not necessarily a consistent snapshot of
-the system.
-The returned data consists of an array whose size depends on the
-current number of such objects in the system.
-Each element of the array consists of a
-.Va struct xvnode .
.El
.Ss CTL_NET
The string and integer information available for the CTL_NET level
diff --git a/lib/libc/gen/sysctl.c b/lib/libc/gen/sysctl.c
index cdd2d3e391e6..d6fadd3c3e5c 100644
--- a/lib/libc/gen/sysctl.c
+++ b/lib/libc/gen/sysctl.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)sysctl.c 8.2 (Berkeley) 1/4/94");
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/sysctl.h>
@@ -46,6 +42,25 @@ __FBSDID("$FreeBSD$");
extern int __sysctl(const int *name, u_int namelen, void *oldp,
size_t *oldlenp, const void *newp, size_t newlen);
+static int
+set_user_str(void *dstp, size_t *dstlenp, const char *src, size_t len,
+ size_t maxlen)
+{
+ int retval;
+
+ retval = 0;
+ if (dstp != NULL) {
+ if (len > maxlen) {
+ len = maxlen;
+ errno = ENOMEM;
+ retval = -1;
+ }
+ memcpy(dstp, src, len);
+ }
+ *dstlenp = len;
+ return (retval);
+}
+
int
sysctl(const int *name, u_int namelen, void *oldp, size_t *oldlenp,
const void *newp, size_t newlen)
@@ -74,17 +89,10 @@ sysctl(const int *name, u_int namelen, void *oldp, size_t *oldlenp,
/* Variables under CLT_USER that may be overridden by kernel values */
switch (name[1]) {
case USER_LOCALBASE:
- if (oldlenp == NULL || *oldlenp != 1)
+ if (oldlenp == NULL || *oldlenp > sizeof(""))
return (0);
- if (oldp != NULL) {
- if (orig_oldlen < sizeof(_PATH_LOCALBASE)) {
- errno = ENOMEM;
- return (-1);
- }
- memmove(oldp, _PATH_LOCALBASE, sizeof(_PATH_LOCALBASE));
- }
- *oldlenp = sizeof(_PATH_LOCALBASE);
- return (0);
+ return (set_user_str(oldp, oldlenp, _PATH_LOCALBASE,
+ sizeof(_PATH_LOCALBASE), orig_oldlen));
}
/* Variables under CLT_USER whose values are immutably defined below */
@@ -95,14 +103,8 @@ sysctl(const int *name, u_int namelen, void *oldp, size_t *oldlenp,
switch (name[1]) {
case USER_CS_PATH:
- if (oldp != NULL && orig_oldlen < sizeof(_PATH_STDPATH)) {
- errno = ENOMEM;
- return (-1);
- }
- *oldlenp = sizeof(_PATH_STDPATH);
- if (oldp != NULL)
- memmove(oldp, _PATH_STDPATH, sizeof(_PATH_STDPATH));
- return (0);
+ return (set_user_str(oldp, oldlenp, _PATH_STDPATH,
+ sizeof(_PATH_STDPATH), orig_oldlen));
}
if (oldp != NULL && *oldlenp < sizeof(int)) {
diff --git a/lib/libc/gen/sysctlbyname.c b/lib/libc/gen/sysctlbyname.c
index 9b4ffc0ca4ae..8cc9599f7a95 100644
--- a/lib/libc/gen/sysctlbyname.c
+++ b/lib/libc/gen/sysctlbyname.c
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/sysctl.h>
#include <string.h>
@@ -41,8 +38,17 @@ sysctlbyname(const char *name, void *oldp, size_t *oldlenp,
const void *newp, size_t newlen)
{
size_t len;
+ int oid[2];
- len = strlen(name);
- return (__sysctlbyname(name, len, oldp, oldlenp, newp,
- newlen));
+ if (__predict_true(strncmp(name, "user.", 5) != 0)) {
+ len = strlen(name);
+ return (__sysctlbyname(name, len, oldp, oldlenp, newp,
+ newlen));
+ } else {
+ len = nitems(oid);
+ if (sysctlnametomib(name, oid, &len) == -1)
+ return (-1);
+ return (sysctl(oid, (u_int)len, oldp, oldlenp, newp,
+ newlen));
+ }
}
diff --git a/lib/libc/gen/sysctlnametomib.c b/lib/libc/gen/sysctlnametomib.c
index 86e02e98f9e3..e45d23e10714 100644
--- a/lib/libc/gen/sysctlnametomib.c
+++ b/lib/libc/gen/sysctlnametomib.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright 2001 The FreeBSD Project. All Rights Reserved.
*
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/sysctl.h>
#include <string.h>
diff --git a/lib/libc/gen/syslog.3 b/lib/libc/gen/syslog.3
index ce7dfdccf55e..62140554f4f5 100644
--- a/lib/libc/gen/syslog.3
+++ b/lib/libc/gen/syslog.3
@@ -25,10 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)syslog.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd May 13, 2021
+.Dd July 3, 2023
.Dt SYSLOG 3
.Os
.Sh NAME
@@ -131,6 +128,11 @@ The
.Fa ident
argument
is a string that will be prepended to every message.
+It may be formatted as
+.Fa ident[N]
+in which case decimal number
+.Fa N
+replaces the process id within messages.
The
.Fa logopt
argument
diff --git a/lib/libc/gen/syslog.c b/lib/libc/gen/syslog.c
index 797c7389d1a2..a6290ee81a29 100644
--- a/lib/libc/gen/syslog.c
+++ b/lib/libc/gen/syslog.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)syslog.c 8.5 (Berkeley) 4/29/95");
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#include <sys/socket.h>
@@ -46,6 +42,7 @@ __FBSDID("$FreeBSD$");
#include <fcntl.h>
#include <paths.h>
#include <pthread.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -61,10 +58,12 @@ __FBSDID("$FreeBSD$");
#define MAXLINE 8192
static int LogFile = -1; /* fd for log */
-static int status; /* connection status */
+static bool connected; /* have done connect */
static int opened; /* have done openlog() */
static int LogStat = 0; /* status bits, set by openlog() */
+static pid_t LogPid = -1; /* process id to tag the entry with */
static const char *LogTag = NULL; /* string to tag the entry with */
+static int LogTagLength = -1; /* usable part of LogTag */
static int LogFacility = LOG_USER; /* default facility code */
static int LogMask = 0xff; /* mask of priorities to be logged */
static pthread_mutex_t syslog_mutex = PTHREAD_MUTEX_INITIALIZER;
@@ -84,12 +83,7 @@ static pthread_mutex_t syslog_mutex = PTHREAD_MUTEX_INITIALIZER;
static void disconnectlog(void); /* disconnect from syslogd */
static void connectlog(void); /* (re)connect to syslogd */
static void openlog_unlocked(const char *, int, int);
-
-enum {
- NOCONN = 0,
- CONNDEF,
- CONNPRIV,
-};
+static void parse_tag(void); /* parse ident[NNN] if needed */
/*
* Format of the magic cookie passed through the stdio hook
@@ -209,13 +203,20 @@ vsyslog1(int pri, const char *fmt, va_list ap)
/* Application name. */
if (LogTag == NULL)
LogTag = _getprogname();
- (void)fprintf(fp, "%s ", LogTag == NULL ? NILVALUE : LogTag);
+ else if (LogTagLength == -1)
+ parse_tag();
+ if (LogTagLength > 0)
+ (void)fprintf(fp, "%.*s ", LogTagLength, LogTag);
+ else
+ (void)fprintf(fp, "%s ", LogTag == NULL ? NILVALUE : LogTag);
/*
* Provide the process ID regardless of whether LOG_PID has been
* specified, as it provides valuable information. Many
* applications tend not to use this, even though they should.
*/
- (void)fprintf(fp, "%d ", getpid());
+ if (LogTagLength <= 0)
+ LogPid = getpid();
+ (void)fprintf(fp, "%d ", (int)LogPid);
/* Message ID. */
(void)fputs(NILVALUE " ", fp);
/* Structured data. */
@@ -291,48 +292,19 @@ vsyslog1(int pri, const char *fmt, va_list ap)
connectlog();
/*
- * If the send() fails, there are two likely scenarios:
- * 1) syslogd was restarted
- * 2) /var/run/log is out of socket buffer space, which
- * in most cases means local DoS.
- * If the error does not indicate a full buffer, we address
- * case #1 by attempting to reconnect to /var/run/log[priv]
- * and resending the message once.
- *
- * If we are working with a privileged socket, the retry
- * attempts end there, because we don't want to freeze a
- * critical application like su(1) or sshd(8).
- *
- * Otherwise, we address case #2 by repeatedly retrying the
- * send() to give syslogd a chance to empty its socket buffer.
+ * If the send() failed, there are two likely scenarios:
+ * 1) syslogd was restarted. In this case make one (only) attempt
+ * to reconnect.
+ * 2) We filled our buffer due to syslogd not being able to read
+ * as fast as we write. In this case prefer to lose the current
+ * message rather than whole buffer of previously logged data.
*/
-
if (send(LogFile, tbuf, cnt, 0) < 0) {
if (errno != ENOBUFS) {
- /*
- * Scenario 1: syslogd was restarted
- * reconnect and resend once
- */
disconnectlog();
connectlog();
if (send(LogFile, tbuf, cnt, 0) >= 0)
return;
- /*
- * if the resend failed, fall through to
- * possible scenario 2
- */
- }
- while (errno == ENOBUFS) {
- /*
- * Scenario 2: out of socket buffer space
- * possible DoS, fail fast on a privileged
- * socket
- */
- if (status == CONNPRIV)
- break;
- _usleep(1);
- if (send(LogFile, tbuf, cnt, 0) >= 0)
- return;
}
} else
return;
@@ -389,7 +361,7 @@ disconnectlog(void)
_close(LogFile);
LogFile = -1;
}
- status = NOCONN; /* retry connect */
+ connected = false; /* retry connect */
}
/* Should be called with mutex acquired */
@@ -413,41 +385,16 @@ connectlog(void)
}
}
}
- if (LogFile != -1 && status == NOCONN) {
+ if (!connected) {
SyslogAddr.sun_len = sizeof(SyslogAddr);
SyslogAddr.sun_family = AF_UNIX;
- /*
- * First try privileged socket. If no success,
- * then try default socket.
- */
- (void)strncpy(SyslogAddr.sun_path, _PATH_LOG_PRIV,
+ (void)strncpy(SyslogAddr.sun_path, _PATH_LOG,
sizeof SyslogAddr.sun_path);
if (_connect(LogFile, (struct sockaddr *)&SyslogAddr,
sizeof(SyslogAddr)) != -1)
- status = CONNPRIV;
-
- if (status == NOCONN) {
- (void)strncpy(SyslogAddr.sun_path, _PATH_LOG,
- sizeof SyslogAddr.sun_path);
- if (_connect(LogFile, (struct sockaddr *)&SyslogAddr,
- sizeof(SyslogAddr)) != -1)
- status = CONNDEF;
- }
-
- if (status == NOCONN) {
- /*
- * Try the old "/dev/log" path, for backward
- * compatibility.
- */
- (void)strncpy(SyslogAddr.sun_path, _PATH_OLDLOG,
- sizeof SyslogAddr.sun_path);
- if (_connect(LogFile, (struct sockaddr *)&SyslogAddr,
- sizeof(SyslogAddr)) != -1)
- status = CONNDEF;
- }
-
- if (status == NOCONN) {
+ connected = true;
+ else {
(void)_close(LogFile);
LogFile = -1;
}
@@ -457,9 +404,12 @@ connectlog(void)
static void
openlog_unlocked(const char *ident, int logstat, int logfac)
{
- if (ident != NULL)
+ if (ident != NULL) {
LogTag = ident;
+ LogTagLength = -1;
+ }
LogStat = logstat;
+ parse_tag();
if (logfac != 0 && (logfac &~ LOG_FACMASK) == 0)
LogFacility = logfac;
@@ -489,7 +439,8 @@ closelog(void)
LogFile = -1;
}
LogTag = NULL;
- status = NOCONN;
+ LogTagLength = -1;
+ connected = false;
THREAD_UNLOCK();
}
@@ -506,3 +457,40 @@ setlogmask(int pmask)
THREAD_UNLOCK();
return (omask);
}
+
+/*
+ * Obtain LogPid from LogTag formatted as per RFC 3164,
+ * Section 5.3 Originating Process Information:
+ *
+ * ident[NNN]
+ */
+static void
+parse_tag(void)
+{
+ char *begin, *end, *p;
+ pid_t pid;
+
+ if (LogTag == NULL || (LogStat & LOG_PID) != 0)
+ return;
+ /*
+ * LogTagLength is -1 if LogTag was not parsed yet.
+ * Avoid multiple passes over same LogTag.
+ */
+ LogTagLength = 0;
+
+ /* Check for presence of opening [ and non-empty ident. */
+ if ((begin = strchr(LogTag, '[')) == NULL || begin == LogTag)
+ return;
+ /* Check for presence of closing ] at the very end and non-empty pid. */
+ if ((end = strchr(begin + 1, ']')) == NULL || end[1] != 0 ||
+ (end - begin) < 2)
+ return;
+
+ /* Check for pid to contain digits only. */
+ pid = (pid_t)strtol(begin + 1, &p, 10);
+ if (p != end)
+ return;
+
+ LogPid = pid;
+ LogTagLength = begin - LogTag;
+}
diff --git a/lib/libc/gen/tcgetpgrp.3 b/lib/libc/gen/tcgetpgrp.3
index 965416e9a50e..2c9bd2983e06 100644
--- a/lib/libc/gen/tcgetpgrp.3
+++ b/lib/libc/gen/tcgetpgrp.3
@@ -25,10 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)tcgetpgrp.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd June 4, 1993
+.Dd November 28, 2022
.Dt TCGETPGRP 3
.Os
.Sh NAME
@@ -37,7 +34,6 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
-.In sys/types.h
.In unistd.h
.Ft pid_t
.Fn tcgetpgrp "int fd"
diff --git a/lib/libc/gen/tcgetsid.3 b/lib/libc/gen/tcgetsid.3
index 60bff8d0b98a..d613f9d9d7cb 100644
--- a/lib/libc/gen/tcgetsid.3
+++ b/lib/libc/gen/tcgetsid.3
@@ -22,9 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd April 15, 2008
+.Dd November 28, 2022
.Dt TCGETSID 3
.Os
.Sh NAME
@@ -33,7 +31,6 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
-.In sys/types.h
.In termios.h
.Ft pid_t
.Fn tcgetsid "int fd"
diff --git a/lib/libc/gen/tcgetwinsize.3 b/lib/libc/gen/tcgetwinsize.3
index 1bc96689c792..cc3c288d8169 100644
--- a/lib/libc/gen/tcgetwinsize.3
+++ b/lib/libc/gen/tcgetwinsize.3
@@ -32,8 +32,6 @@
.\" the referee document. The original Standard can be obtained online at
.\" http://www.opengroup.org/unix/online.html.
.\"
-.\" $FreeBSD$
-.\"
.Dd December 28, 2020
.Dt TCGETWINSIZE 3
.Os
diff --git a/lib/libc/gen/tcsendbreak.3 b/lib/libc/gen/tcsendbreak.3
index 4fa3fab4906f..0eb132e22e8c 100644
--- a/lib/libc/gen/tcsendbreak.3
+++ b/lib/libc/gen/tcsendbreak.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)tcsendbreak.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd January 11, 2017
.Dt TCSENDBREAK 3
.Os
diff --git a/lib/libc/gen/tcsetattr.3 b/lib/libc/gen/tcsetattr.3
index ce28e985cd60..6afa90af556b 100644
--- a/lib/libc/gen/tcsetattr.3
+++ b/lib/libc/gen/tcsetattr.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)tcsetattr.3 8.3 (Berkeley) 1/2/94
-.\" $FreeBSD$
-.\"
.Dd July 15, 2020
.Dt TCSETATTR 3
.Os
diff --git a/lib/libc/gen/tcsetpgrp.3 b/lib/libc/gen/tcsetpgrp.3
index d59dcf03f446..4ae67d4520bf 100644
--- a/lib/libc/gen/tcsetpgrp.3
+++ b/lib/libc/gen/tcsetpgrp.3
@@ -25,10 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)tcsetpgrp.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd June 4, 1993
+.Dd November 28, 2022
.Dt TCSETPGRP 3
.Os
.Sh NAME
@@ -37,7 +34,6 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
-.In sys/types.h
.In unistd.h
.Ft int
.Fn tcsetpgrp "int fd" "pid_t pgrp_id"
diff --git a/lib/libc/gen/tcsetsid.3 b/lib/libc/gen/tcsetsid.3
index d0f1d985753e..a0a1907a6434 100644
--- a/lib/libc/gen/tcsetsid.3
+++ b/lib/libc/gen/tcsetsid.3
@@ -22,9 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd May 4, 2009
+.Dd November 28, 2022
.Dt TCSETSID 3
.Os
.Sh NAME
@@ -33,7 +31,6 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
-.In sys/types.h
.In termios.h
.Ft int
.Fn tcsetsid "int fd" "pid_t pid"
diff --git a/lib/libc/gen/telldir.c b/lib/libc/gen/telldir.c
index d801345fc24c..b751fafd975f 100644
--- a/lib/libc/gen/telldir.c
+++ b/lib/libc/gen/telldir.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)telldir.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#include <sys/queue.h>
diff --git a/lib/libc/gen/telldir.h b/lib/libc/gen/telldir.h
index 6880ec562a45..aafa6ac71b1e 100644
--- a/lib/libc/gen/telldir.h
+++ b/lib/libc/gen/telldir.h
@@ -30,8 +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.
- *
- * $FreeBSD$
*/
#ifndef _TELLDIR_H_
diff --git a/lib/libc/gen/termios.c b/lib/libc/gen/termios.c
index f072b2f045d9..2178cc7c419d 100644
--- a/lib/libc/gen/termios.c
+++ b/lib/libc/gen/termios.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)termios.c 8.2 (Berkeley) 2/21/94");
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/types.h>
#include <sys/fcntl.h>
diff --git a/lib/libc/gen/time.3 b/lib/libc/gen/time.3
index 1ff703ff572a..6df74df2dcb4 100644
--- a/lib/libc/gen/time.3
+++ b/lib/libc/gen/time.3
@@ -29,10 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)time.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd July 18, 2003
+.Dd April 14, 2022
.Dt TIME 3
.Os
.Sh NAME
@@ -49,7 +46,7 @@ The
.Fn time
function
returns the value of time in seconds since 0 hours, 0 minutes,
-0 seconds, January 1, 1970, Coordinated Universal Time.
+0 seconds, January 1, 1970, Coordinated Universal Time (UTC).
If an error occurs,
.Fn time
returns the value
@@ -64,7 +61,7 @@ is non-null.
The
.Fn time
function may fail for any of the reasons described in
-.Xr gettimeofday 2 .
+.Xr clock_gettime 2 .
.Sh SEE ALSO
.Xr clock_gettime 2 ,
.Xr gettimeofday 2 ,
@@ -73,12 +70,54 @@ function may fail for any of the reasons described in
The
.Nm
function conforms to
-.St -p1003.1-2001 .
+.St -p1003.1-2008 .
.Sh HISTORY
-A
+The
+.Fn time
+system call first appeared in
+.At v1 .
+Through the
+.At v3 ,
+it returned 60 Hz ticks since an epoch that changed occasionally, because it
+was a 32-bit value that overflowed in a little over 2 years.
+.Pp
+In
+.At v4
+the granularity of the return value was reduced to whole seconds,
+delaying the aforementioned overflow until 2038.
+.Pp
+.At v7
+introduced the
+.Fn ftime
+system call, which returned time at a millisecond level,
+though retained the
+.Fn gtime
+system call (exposed as
+.Fn time
+in userland).
+.Fn time
+could have been implemented as a wrapper around
+.Fn ftime ,
+but that wasn't done.
+.Pp
+.Bx 4.1c
+implemented a higher-precision time function
+.Fn gettimeofday
+to replace
+.Fn ftime
+and reimplemented
+.Fn time
+in terms of that.
+.Pp
+Since
+.Fx 9
+the implementation of
.Fn time
-function appeared in
-.At v6 .
+uses
+.Fn clock_gettime "CLOCK_SECOND"
+instead of
+.Fn gettimeofday
+for performance reasons.
.Sh BUGS
Neither
.St -isoC-99
@@ -92,8 +131,7 @@ on failure; thus, it is impossible for an application to distinguish
the valid time value \-1 (representing the last UTC second of 1969)
from the error return value.
.Pp
-Systems conforming to earlier versions of the C and
-.Tn POSIX
+Systems conforming to earlier versions of the C and POSIX
standards (including older versions of
.Fx )
did not set
diff --git a/lib/libc/gen/time.c b/lib/libc/gen/time.c
index c08d58ed9a66..3f26c937d15b 100644
--- a/lib/libc/gen/time.c
+++ b/lib/libc/gen/time.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)time.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/time.h>
diff --git a/lib/libc/gen/times.3 b/lib/libc/gen/times.3
index 487339480e2a..71449767b551 100644
--- a/lib/libc/gen/times.3
+++ b/lib/libc/gen/times.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)times.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd December 1, 2008
.Dt TIMES 3
.Os
diff --git a/lib/libc/gen/times.c b/lib/libc/gen/times.c
index d811b553b990..b609faedc7a1 100644
--- a/lib/libc/gen/times.c
+++ b/lib/libc/gen/times.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)times.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/time.h>
#include <sys/times.h>
@@ -45,8 +41,7 @@ __FBSDID("$FreeBSD$");
#define CONVTCK(r) (r.tv_sec * CLK_TCK + r.tv_usec / (1000000 / CLK_TCK))
clock_t
-times(tp)
- struct tms *tp;
+times(struct tms *tp)
{
struct rusage ru;
struct timespec t;
diff --git a/lib/libc/gen/timespec_get.3 b/lib/libc/gen/timespec_get.3
index 43300074eea7..7edf4fe17c30 100644
--- a/lib/libc/gen/timespec_get.3
+++ b/lib/libc/gen/timespec_get.3
@@ -27,9 +27,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd August 10, 2018
+.Dd August 21, 2023
.Dt TIMESPEC_GET 3
.Os
.Sh NAME
@@ -57,6 +55,14 @@ In
.Fx ,
this corresponds to
.Dv CLOCK_REALTIME .
+.Pp
+The base
+.Dv TIME_MONOTONIC
+returns a monotonically-increasing time since an unspecified point in the past.
+In
+.Fx ,
+this corresponds to
+.Dv CLOCK_MONOTONIC .
.Sh RETURN VALUES
The
.Nm
@@ -68,7 +74,8 @@ on failure.
.Sh SEE ALSO
.Xr clock_gettime 2 ,
.Xr gettimeofday 2 ,
-.Xr time 3
+.Xr time 3 ,
+.Xr timespec_getres 3
.Sh STANDARDS
The
.Nm
@@ -78,6 +85,10 @@ of
.Dv TIME_UTC
conforms to
.St -isoC-2011 .
+.\" The
+.\" .Dv TIME_MONOTONIC
+.\" base conforms to
+.\" -isoC-2023 .
.Sh HISTORY
This interface first appeared in
.Fx 12 .
diff --git a/lib/libc/gen/timespec_get.c b/lib/libc/gen/timespec_get.c
index 1dd0147e933d..96845d545048 100644
--- a/lib/libc/gen/timespec_get.c
+++ b/lib/libc/gen/timespec_get.c
@@ -31,8 +31,6 @@
#include <sys/cdefs.h>
__RCSID("$NetBSD: timespec_get.c,v 1.2 2016/10/04 12:48:15 christos Exp $");
-__FBSDID("$FreeBSD$");
-
#include <time.h>
/* ISO/IEC 9899:201x 7.27.2.5 The timespec_get function */
@@ -46,6 +44,10 @@ timespec_get(struct timespec *ts, int base)
if (clock_gettime(CLOCK_REALTIME, ts) == -1)
return 0;
break;
+ case TIME_MONOTONIC:
+ if (clock_gettime(CLOCK_MONOTONIC, ts) == -1)
+ return 0;
+ break;
default:
return 0;
}
diff --git a/lib/libc/gen/timespec_getres.3 b/lib/libc/gen/timespec_getres.3
new file mode 100644
index 000000000000..e00af6758f1a
--- /dev/null
+++ b/lib/libc/gen/timespec_getres.3
@@ -0,0 +1,51 @@
+.\"-
+.\" Copyright (c) 2023 Dag-Erling Smørgrav
+.\"
+.\" SPDX-License-Identifier: BSD-2-Clause
+.\"
+.Dd August 21, 2023
+.Dt TIMESPEC_GETRES 3
+.Os
+.Sh NAME
+.Nm timespec_getres
+.Nd get clock resolution
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In time.h
+.Ft int
+.Fn timespec_getres "struct timespec *ts" "int base"
+.Sh DESCRIPTION
+If
+.Fa ts
+is non-null and
+.Fa base
+refers to a supported time base as described in
+.Xr timespec_get 3 ,
+the
+.Nm
+function fills in the structure pointed to by
+.Fa ts
+to reflect the resolution of that time base.
+.Sh RETURN VALUES
+The
+.Nm
+function returns the value of
+.Fa base
+if successful and zero otherwise.
+.Sh SEE ALSO
+.Xr clock_getres 2 ,
+.Xr timespec_get 3
+.\" .Sh STANDARDS
+.\" The
+.\" .Nm
+.\" function conforms to
+.\" .St -isoC-2023 .
+.Sh HISTORY
+This interface first appeared in
+.Fx 14 .
+.Sh AUTHORS
+The
+.Nm
+function and this manual page were written by
+.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org .
diff --git a/lib/libc/gen/timespec_getres.c b/lib/libc/gen/timespec_getres.c
new file mode 100644
index 000000000000..4977d22cf910
--- /dev/null
+++ b/lib/libc/gen/timespec_getres.c
@@ -0,0 +1,24 @@
+/*-
+ * Copyright (c) 2023 Dag-Erling Smørgrav
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <time.h>
+
+int
+timespec_getres(struct timespec *ts, int base)
+{
+
+ switch (base) {
+ case TIME_UTC:
+ if (clock_getres(CLOCK_REALTIME, ts) == 0)
+ return (base);
+ break;
+ case TIME_MONOTONIC:
+ if (clock_getres(CLOCK_MONOTONIC, ts) == 0)
+ return (base);
+ break;
+ }
+ return (0);
+}
diff --git a/lib/libc/gen/timezone.3 b/lib/libc/gen/timezone.3
deleted file mode 100644
index 58aff536f76c..000000000000
--- a/lib/libc/gen/timezone.3
+++ /dev/null
@@ -1,69 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)timezone.3 8.2 (Berkeley) 4/19/94
-.\" $FreeBSD$
-.\"
-.Dd April 19, 1994
-.Dt TIMEZONE 3
-.Os
-.Sh NAME
-.Nm timezone
-.Nd return the timezone abbreviation
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.Ft char *
-.Fn timezone "int zone" "int dst"
-.Sh DESCRIPTION
-.Bf Sy
-This interface is for compatibility only; it is impossible to reliably
-map timezone's arguments to a time zone abbreviation.
-See
-.Xr ctime 3 .
-.Ef
-.Pp
-The
-.Fn timezone
-function returns a pointer to a time zone abbreviation for the specified
-.Fa zone
-and
-.Fa dst
-values.
-The
-.Fa zone
-argument
-is the number of minutes west of GMT and
-.Fa dst
-is non-zero if daylight savings time is in effect.
-.Sh SEE ALSO
-.Xr ctime 3
-.Sh HISTORY
-A
-.Fn timezone
-function appeared in
-.At v7 .
diff --git a/lib/libc/gen/timezone.c b/lib/libc/gen/timezone.c
index f99a6f919262..2809067eb8d8 100644
--- a/lib/libc/gen/timezone.c
+++ b/lib/libc/gen/timezone.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)timezone.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/time.h>
#include <stdio.h>
@@ -40,7 +36,7 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#define TZ_MAX_CHARS 255
-char *_tztab(int, int);
+static char *_tztab(int, int);
/*
* timezone --
@@ -53,7 +49,7 @@ char *_tztab(int, int);
static char czone[TZ_MAX_CHARS]; /* space for zone name */
char *
-timezone(int zone, int dst)
+__timezone_compat(int zone, int dst)
{
char *beg,
*end;
@@ -72,6 +68,7 @@ timezone(int zone, int dst)
}
return(_tztab(zone,dst)); /* default: table or created zone */
}
+__sym_compat(timezone, __timezone_compat, FBSD_1.0);
static struct zone {
int offset;
@@ -103,7 +100,7 @@ static struct zone {
* aren't in place in /etc. DO NOT USE THIS ROUTINE OUTSIDE OF THE
* STANDARD LIBRARY.
*/
-char *
+static char *
_tztab(int zone, int dst)
{
struct zone *zp;
diff --git a/lib/libc/gen/tls.c b/lib/libc/gen/tls.c
index d90aac028b88..3c1a5472c0e5 100644
--- a/lib/libc/gen/tls.c
+++ b/lib/libc/gen/tls.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2004 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$
*/
/*
@@ -34,7 +32,6 @@
* runtime from ld-elf.so.1.
*/
-#include <sys/cdefs.h>
#include <sys/param.h>
#include <stdlib.h>
#include <string.h>
@@ -72,15 +69,6 @@ void _rtld_free_tls(void *tls, size_t tcbsize, size_t tcbalign);
void *__libc_allocate_tls(void *oldtls, size_t tcbsize, size_t tcbalign);
void __libc_free_tls(void *tls, size_t tcbsize, size_t tcbalign);
-#if defined(__amd64__)
-#define TLS_TCB_ALIGN 16
-#elif defined(__aarch64__) || defined(__arm__) || defined(__i386__) || \
- defined(__mips__) || defined(__powerpc__) || defined(__riscv)
-#define TLS_TCB_ALIGN sizeof(void *)
-#else
-#error TLS_TCB_ALIGN undefined for target architecture
-#endif
-
#ifndef PIC
static size_t libc_tls_static_space;
@@ -92,11 +80,10 @@ static void *libc_tls_init;
void *
__libc_tls_get_addr(void *vti)
{
- Elf_Addr **dtvp, *dtv;
+ uintptr_t *dtv;
tls_index *ti;
- dtvp = _get_tp();
- dtv = *dtvp;
+ dtv = _tcb_get()->tcb_dtv;
ti = vti;
return ((char *)(dtv[ti->ti_module + 1] + ti->ti_offset) +
TLS_DTV_OFFSET);
@@ -158,11 +145,11 @@ libc_free_aligned(void *ptr)
* Note: for Local Exec TLS Model, the offsets from TP (TCB in this case) to
* TLS variables are computed by linker, so we cannot overalign TLS section.
*
- * - MIPS, PowerPC and RISC-V use modified version of variant I,
- * described in [3] where TP points (with bias) to TLS and TCB immediately
- * precedes TLS without any alignment gap[4]. Only TLS should be aligned.
- * The TCB[0] points to DTV vector and DTV values are biased by constant
- * value (0x8000) from real addresses[5].
+ * - PowerPC and RISC-V use modified version of variant I, described in [3]
+ * where TP points (with bias) to TLS and TCB immediately precedes TLS without
+ * any alignment gap[4]. Only TLS should be aligned. The TCB[0] points to DTV
+ * vector and DTV values are biased by constant value (TLS_DTV_OFFSET) from
+ * real addresses[5].
*
* [1] Ulrich Drepper: ELF Handling for Thread-Local Storage
* www.akkadia.org/drepper/tls.pdf
@@ -175,7 +162,7 @@ libc_free_aligned(void *ptr)
* https://members.openpowerfoundation.org/document/dl/576
*
* [4] Its unclear if "without any alignment gap" is hard ABI requirement,
- * but we must follow this rule due to suboptimal _set_tp()
+ * but we must follow this rule due to suboptimal _tcb_set()
* (aka <ARCH>_SET_TP) implementation. This function doesn't expect TP but
* TCB as argument.
*
@@ -307,8 +294,6 @@ __libc_allocate_tls(void *oldtcb, size_t tcbsize, size_t tcbalign)
#ifdef TLS_VARIANT_II
-#define TLS_TCB_SIZE (3 * sizeof(Elf_Addr))
-
/*
* Free Static TLS using the Variant II method.
*/
@@ -413,8 +398,6 @@ __libc_free_tls(void *tcb __unused, size_t tcbsize __unused,
#endif /* PIC */
-extern char **environ;
-
void
_init_tls(void)
{
@@ -462,6 +445,6 @@ _init_tls(void)
}
tls = _rtld_allocate_tls(NULL, TLS_TCB_SIZE, TLS_TCB_ALIGN);
- _set_tp(tls);
+ _tcb_set(tls);
#endif
}
diff --git a/lib/libc/gen/trivial-getcontextx.c b/lib/libc/gen/trivial-getcontextx.c
index 54f851384811..b9d4522d96ee 100644
--- a/lib/libc/gen/trivial-getcontextx.c
+++ b/lib/libc/gen/trivial-getcontextx.c
@@ -24,9 +24,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/ucontext.h>
#include <errno.h>
diff --git a/lib/libc/gen/ttyname.3 b/lib/libc/gen/ttyname.3
index 320764fb2202..741b25946ace 100644
--- a/lib/libc/gen/ttyname.3
+++ b/lib/libc/gen/ttyname.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)ttyname.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd July 18, 2014
.Dt TTYNAME 3
.Os
diff --git a/lib/libc/gen/ttyname.c b/lib/libc/gen/ttyname.c
index 0984538eaf76..268b2e0f7b65 100644
--- a/lib/libc/gen/ttyname.c
+++ b/lib/libc/gen/ttyname.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)ttyname.c 8.2 (Berkeley) 1/27/94");
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/types.h>
#include <sys/ioctl.h>
diff --git a/lib/libc/gen/ttyslot.c b/lib/libc/gen/ttyslot.c
index fc1b0565afee..a57b18dcf030 100644
--- a/lib/libc/gen/ttyslot.c
+++ b/lib/libc/gen/ttyslot.c
@@ -30,8 +30,6 @@
*/
#include <sys/cdefs.h>
-__SCCSID("@(#)ttyslot.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
int __ttyslot(void);
diff --git a/lib/libc/gen/ualarm.3 b/lib/libc/gen/ualarm.3
index 7d40b2a53a81..f4e0973b133a 100644
--- a/lib/libc/gen/ualarm.3
+++ b/lib/libc/gen/ualarm.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" From: @(#)ualarm.3 8.2 (Berkeley) 4/19/94
-.\" $FreeBSD$
-.\"
.Dd April 19, 1994
.Dt UALARM 3
.Os
diff --git a/lib/libc/gen/ualarm.c b/lib/libc/gen/ualarm.c
index e1353176845f..44e77252202f 100644
--- a/lib/libc/gen/ualarm.c
+++ b/lib/libc/gen/ualarm.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)ualarm.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include <sys/time.h>
#include <unistd.h>
diff --git a/lib/libc/gen/ucontext.3 b/lib/libc/gen/ucontext.3
index d6e05dc2c1fa..4166049957db 100644
--- a/lib/libc/gen/ucontext.3
+++ b/lib/libc/gen/ucontext.3
@@ -33,8 +33,6 @@
.\" THE USE OF THIS SOFTWARE, EVEN IF PACKET DESIGN IS ADVISED OF
.\" THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd March 23, 2020
.Dt UCONTEXT 3
.Os
diff --git a/lib/libc/gen/ulimit.3 b/lib/libc/gen/ulimit.3
index e4c2d769323c..771c40126944 100644
--- a/lib/libc/gen/ulimit.3
+++ b/lib/libc/gen/ulimit.3
@@ -21,8 +21,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd January 4, 2003
.Dt ULIMIT 3
.Os
diff --git a/lib/libc/gen/ulimit.c b/lib/libc/gen/ulimit.c
index c9602491cc20..93231bb86fa8 100644
--- a/lib/libc/gen/ulimit.c
+++ b/lib/libc/gen/ulimit.c
@@ -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$
*/
#include <sys/types.h>
diff --git a/lib/libc/gen/uname.3 b/lib/libc/gen/uname.3
index a4c7d9030b06..ed1596529c4c 100644
--- a/lib/libc/gen/uname.3
+++ b/lib/libc/gen/uname.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)uname.3 8.1 (Berkeley) 1/4/94
-.\" $FreeBSD$
-.\"
.Dd December 2, 2005
.Dt UNAME 3
.Os
diff --git a/lib/libc/gen/uname.c b/lib/libc/gen/uname.c
index bc72ff9d3c39..3a14ae3fefc1 100644
--- a/lib/libc/gen/uname.c
+++ b/lib/libc/gen/uname.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)uname.c 8.1 (Berkeley) 1/4/94");
-__FBSDID("$FreeBSD$");
-
#define uname wrapped_uname
#include <sys/param.h>
#include <sys/sysctl.h>
diff --git a/lib/libc/gen/unvis-compat.c b/lib/libc/gen/unvis-compat.c
index 2249f847621e..4562b8f7a383 100644
--- a/lib/libc/gen/unvis-compat.c
+++ b/lib/libc/gen/unvis-compat.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2012 SRI International
* All rights reserved.
@@ -28,8 +28,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$
*/
#include <vis.h>
diff --git a/lib/libc/gen/usleep.3 b/lib/libc/gen/usleep.3
deleted file mode 100644
index f6ed9e6bb52e..000000000000
--- a/lib/libc/gen/usleep.3
+++ /dev/null
@@ -1,80 +0,0 @@
-.\" Copyright (c) 1986, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)usleep.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd February 11, 2021
-.Dt USLEEP 3
-.Os
-.Sh NAME
-.Nm usleep
-.Nd suspend thread execution for an interval measured in microseconds
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn usleep "useconds_t microseconds"
-.Sh DESCRIPTION
-The
-.Fn usleep
-function suspends execution of the calling thread until either
-.Fa microseconds
-microseconds have elapsed or a signal is delivered to the thread and its
-action is to invoke a signal-catching function or to terminate the
-process.
-System activity may lengthen the sleep by an indeterminate amount.
-.Pp
-This function is implemented using
-.Xr nanosleep 2
-by pausing for
-.Fa microseconds
-microseconds or until a signal occurs.
-Consequently, in this implementation,
-sleeping has no effect on the state of process timers,
-and there is no special handling for SIGALRM.
-.Sh RETURN VALUES
-.Rv -std usleep
-.Sh ERRORS
-The
-.Fn usleep
-function
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EINTR
-A signal was delivered to the calling thread and its
-action was to invoke a signal-catching function.
-.El
-.Sh SEE ALSO
-.Xr nanosleep 2 ,
-.Xr sleep 3
-.Sh HISTORY
-The
-.Fn usleep
-function appeared in
-.Bx 4.3 .
diff --git a/lib/libc/gen/usleep.c b/lib/libc/gen/usleep.c
index e800f6275617..31d5567d562d 100644
--- a/lib/libc/gen/usleep.c
+++ b/lib/libc/gen/usleep.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)usleep.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <time.h>
#include <unistd.h>
@@ -49,8 +45,7 @@ __usleep(useconds_t useconds)
time_to_sleep.tv_nsec = (useconds % 1000000) * 1000;
time_to_sleep.tv_sec = useconds / 1000000;
- return (((int (*)(const struct timespec *, struct timespec *))
- __libc_interposing[INTERPOS_nanosleep])(&time_to_sleep, NULL));
+ return (INTERPOS_SYS(nanosleep, &time_to_sleep, NULL));
}
__weak_reference(__usleep, usleep);
diff --git a/lib/libc/gen/utime.3 b/lib/libc/gen/utime.3
index b995ea523cf5..e17fab908497 100644
--- a/lib/libc/gen/utime.3
+++ b/lib/libc/gen/utime.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)utime.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd June 9, 2016
.Dt UTIME 3
.Os
diff --git a/lib/libc/gen/utime.c b/lib/libc/gen/utime.c
index 3474849571b7..208c6bdae449 100644
--- a/lib/libc/gen/utime.c
+++ b/lib/libc/gen/utime.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)utime.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include <sys/time.h>
#include <utime.h>
diff --git a/lib/libc/gen/utxdb.c b/lib/libc/gen/utxdb.c
index 3edccdbd2c2f..4c4c73bffea3 100644
--- a/lib/libc/gen/utxdb.c
+++ b/lib/libc/gen/utxdb.c
@@ -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.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/endian.h>
#include <sys/param.h>
diff --git a/lib/libc/gen/utxdb.h b/lib/libc/gen/utxdb.h
index 912dd0fa113e..5b1f35f99fd7 100644
--- a/lib/libc/gen/utxdb.h
+++ b/lib/libc/gen/utxdb.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 _UTXDB_H_
diff --git a/lib/libc/gen/valloc.3 b/lib/libc/gen/valloc.3
index 2fc20bb82a4a..063e781e3174 100644
--- a/lib/libc/gen/valloc.3
+++ b/lib/libc/gen/valloc.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)valloc.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd October 30, 2007
.Dt VALLOC 3
.Os
diff --git a/lib/libc/gen/valloc.c b/lib/libc/gen/valloc.c
index b058543f54ac..6f3fd2d2d10c 100644
--- a/lib/libc/gen/valloc.c
+++ b/lib/libc/gen/valloc.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)valloc.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include <stdlib.h>
#include <unistd.h>
diff --git a/lib/libc/gen/wordexp.3 b/lib/libc/gen/wordexp.3
index dd4605ffa6fd..f54d8af3f38c 100644
--- a/lib/libc/gen/wordexp.3
+++ b/lib/libc/gen/wordexp.3
@@ -23,8 +23,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd September 30, 2015
.Dt WORDEXP 3
.Os
diff --git a/lib/libc/gen/wordexp.c b/lib/libc/gen/wordexp.c
index 0322c1176d69..f1437e30bbe2 100644
--- a/lib/libc/gen/wordexp.c
+++ b/lib/libc/gen/wordexp.c
@@ -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.
@@ -27,7 +27,6 @@
*/
#include "namespace.h"
-#include <sys/cdefs.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <errno.h>
@@ -42,9 +41,6 @@
#include <wordexp.h>
#include "un-namespace.h"
#include "libc_private.h"
-
-__FBSDID("$FreeBSD$");
-
static int we_askshell(const char *, wordexp_t *, int);
static int we_check(const char *);
diff --git a/lib/libc/gmon/Makefile.inc b/lib/libc/gmon/Makefile.inc
index 3e3dede8a45e..92db74d48888 100644
--- a/lib/libc/gmon/Makefile.inc
+++ b/lib/libc/gmon/Makefile.inc
@@ -1,5 +1,3 @@
-# from @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
-# $FreeBSD$
# gmon sources
.PATH: ${LIBC_SRCTOP}/gmon
diff --git a/lib/libc/gmon/Symbol.map b/lib/libc/gmon/Symbol.map
index 822789972ebf..573c20020237 100644
--- a/lib/libc/gmon/Symbol.map
+++ b/lib/libc/gmon/Symbol.map
@@ -1,12 +1,7 @@
-/*
- * $FreeBSD$
- */
-
FBSD_1.0 {
_mcleanup;
monstartup;
moncontrol;
- mexitcount;
};
FBSDprivate_1.0 {
diff --git a/lib/libc/gmon/gmon.c b/lib/libc/gmon/gmon.c
index 0d06f3888030..4bc3ca7facbe 100644
--- a/lib/libc/gmon/gmon.c
+++ b/lib/libc/gmon/gmon.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)gmon.c 8.1 (Berkeley) 6/4/93";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#include <sys/time.h>
diff --git a/lib/libc/gmon/mcount.c b/lib/libc/gmon/mcount.c
index 0d816a734350..01b1044142f9 100644
--- a/lib/libc/gmon/mcount.c
+++ b/lib/libc/gmon/mcount.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if !defined(_KERNEL) && defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)mcount.c 8.1 (Berkeley) 6/4/93";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/gmon.h>
#ifdef _KERNEL
diff --git a/lib/libc/gmon/moncontrol.3 b/lib/libc/gmon/moncontrol.3
index dea5973518b7..8548c20f7172 100644
--- a/lib/libc/gmon/moncontrol.3
+++ b/lib/libc/gmon/moncontrol.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)moncontrol.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd June 14, 2004
.Dt MONCONTROL 3
.Os
diff --git a/lib/libc/i386/Makefile.inc b/lib/libc/i386/Makefile.inc
index 4470cdbaed35..79ecb7597547 100644
--- a/lib/libc/i386/Makefile.inc
+++ b/lib/libc/i386/Makefile.inc
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Long double is 80 bits
GDTOASRCS+=strtorx.c
diff --git a/lib/libc/i386/SYS.h b/lib/libc/i386/SYS.h
deleted file mode 100644
index 18bcb102691e..000000000000
--- a/lib/libc/i386/SYS.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-3-Clause
- *
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- *
- * @(#)SYS.h 5.5 (Berkeley) 5/7/91
- * $FreeBSD$
- */
-
-#include <sys/syscall.h>
-#include <machine/asm.h>
-
-#define SYSCALL(name) ENTRY(__sys_##name); \
- WEAK_REFERENCE(__sys_##name, name); \
- WEAK_REFERENCE(__sys_##name, _##name); \
- mov $SYS_##name,%eax; KERNCALL; \
- jb HIDENAME(cerror)
-
-#define RSYSCALL(name) SYSCALL(name); ret; END(__sys_##name)
-
-#define PSEUDO(name) ENTRY(__sys_##name); \
- WEAK_REFERENCE(__sys_##name, _##name); \
- mov $SYS_##name,%eax; KERNCALL; \
- jb HIDENAME(cerror); ret; \
- END(__sys_##name)
-
-/* gas messes up offset -- although we don't currently need it, do for BCS */
-#define LCALL(x,y) .byte 0x9a ; .long y; .word x
-
-#define KERNCALL int $0x80
diff --git a/lib/libc/i386/Symbol.map b/lib/libc/i386/Symbol.map
index 96ec93bfba6c..d7961009417e 100644
--- a/lib/libc/i386/Symbol.map
+++ b/lib/libc/i386/Symbol.map
@@ -1,69 +1,21 @@
/*
- * $FreeBSD$
- */
-
-/*
* This only needs to contain symbols that are not listed in
* symbol maps from other parts of libc (i.e., not found in
* stdlib/Symbol.map, string/Symbol.map, sys/Symbol.map, ...).
*/
FBSD_1.0 {
- /* PSEUDO syscalls */
- _exit;
-
.mcount;
- _setjmp;
- _longjmp;
- alloca;
- fabs;
- __flt_rounds;
- __nan;
- __infinity;
- makecontext;
- rfork_thread;
- setjmp;
- longjmp;
- sigsetjmp;
- siglongjmp;
- htonl;
- htons;
- ntohl;
- ntohs;
- vfork;
brk;
- i386_clr_watch;
- i386_get_fsbase;
- i386_get_gsbase;
- i386_get_ioperm;
- i386_get_ldt;
- i386_set_fsbase;
- i386_set_gsbase;
- i386_set_ioperm;
- i386_set_ldt;
- i386_set_watch;
- i386_vm86;
- sbrk;
+ __flt_rounds;
___tls_get_addr;
-};
-
-FBSD_1.6 {
- x86_pkru_get_perm;
- x86_pkru_set_perm;
- x86_pkru_protect_range;
- x86_pkru_unprotect_range;
+ sbrk;
};
FBSDprivate_1.0 {
- /* PSEUDO syscalls */
- _getlogin;
-
- _set_tp;
___longjmp;
- __makecontext;
__longjmp;
__signalcontext;
signalcontext;
__siglongjmp;
- _vfork;
_brk;
};
diff --git a/lib/libc/i386/_fpmath.h b/lib/libc/i386/_fpmath.h
index 874439c34b76..780f38562d8d 100644
--- a/lib/libc/i386/_fpmath.h
+++ b/lib/libc/i386/_fpmath.h
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002, 2003 David Schultz <das@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$
*/
union IEEEl2bits {
diff --git a/lib/libc/i386/arith.h b/lib/libc/i386/arith.h
index 2d65061e82a7..790dc584fe45 100644
--- a/lib/libc/i386/arith.h
+++ b/lib/libc/i386/arith.h
@@ -1,7 +1,5 @@
/*
* MD header for contrib/gdtoa
- *
- * $FreeBSD$
*/
/*
diff --git a/lib/libc/i386/gd_qnan.h b/lib/libc/i386/gd_qnan.h
index 39923860db07..3387ae94a862 100644
--- a/lib/libc/i386/gd_qnan.h
+++ b/lib/libc/i386/gd_qnan.h
@@ -3,8 +3,6 @@
*
* This file can be generated by compiling and running contrib/gdtoa/qnan.c
* on the target architecture after arith.h has been generated.
- *
- * $FreeBSD$
*/
#define f_QNAN 0x7fc00000
diff --git a/lib/libc/i386/gen/Makefile.inc b/lib/libc/i386/gen/Makefile.inc
index bad73852f6eb..1c4eb2a9981f 100644
--- a/lib/libc/i386/gen/Makefile.inc
+++ b/lib/libc/i386/gen/Makefile.inc
@@ -1,6 +1,4 @@
-# @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
-# $FreeBSD$
-SRCS+= _ctx_start.S _setjmp.S _set_tp.c _get_tp.c fabs.S \
+SRCS+= _ctx_start.S _setjmp.S fabs.S \
flt_rounds.c infinity.c ldexp.c makecontext.c \
- rfork_thread.S setjmp.S signalcontext.c sigsetjmp.S
+ setjmp.S signalcontext.c sigsetjmp.S
diff --git a/lib/libc/i386/gen/_ctx_start.S b/lib/libc/i386/gen/_ctx_start.S
index fdea3719815b..0fdb3140804c 100644
--- a/lib/libc/i386/gen/_ctx_start.S
+++ b/lib/libc/i386/gen/_ctx_start.S
@@ -25,8 +25,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* _ctx_start((void *func)(int arg1, ..., argn),
* int arg1, ..., argn, ucontext_t *ucp)
diff --git a/lib/libc/i386/gen/_setjmp.S b/lib/libc/i386/gen/_setjmp.S
index 9199a46d2fb1..0d00bf7a998f 100644
--- a/lib/libc/i386/gen/_setjmp.S
+++ b/lib/libc/i386/gen/_setjmp.S
@@ -30,12 +30,7 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
- .asciz "@(#)_setjmp.s 5.1 (Berkeley) 4/23/90"
-#endif /* LIBC_SCCS and not lint */
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* C library -- _setjmp, _longjmp
*
diff --git a/lib/libc/i386/gen/fabs.S b/lib/libc/i386/gen/fabs.S
index 2dc89af9506c..d19cfd24ccc1 100644
--- a/lib/libc/i386/gen/fabs.S
+++ b/lib/libc/i386/gen/fabs.S
@@ -30,12 +30,7 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
- .asciz "@(#)fabs.s 5.2 (Berkeley) 12/17/90"
-#endif /* LIBC_SCCS and not lint */
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
ENTRY(fabs)
fldl 4(%esp)
fabs
diff --git a/lib/libc/i386/gen/flt_rounds.c b/lib/libc/i386/gen/flt_rounds.c
index 16417ffd46e2..cebd8e1eb098 100644
--- a/lib/libc/i386/gen/flt_rounds.c
+++ b/lib/libc/i386/gen/flt_rounds.c
@@ -3,9 +3,6 @@
* Public domain.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <float.h>
static const int map[] = {
diff --git a/lib/libc/i386/gen/infinity.c b/lib/libc/i386/gen/infinity.c
index 464b4029b35a..bc05708abd2b 100644
--- a/lib/libc/i386/gen/infinity.c
+++ b/lib/libc/i386/gen/infinity.c
@@ -2,9 +2,6 @@
* infinity.c
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <math.h>
/* bytes for +Infinity on a 387 */
diff --git a/lib/libc/i386/gen/makecontext.c b/lib/libc/i386/gen/makecontext.c
index 19258460ac44..7b4845ac6bee 100644
--- a/lib/libc/i386/gen/makecontext.c
+++ b/lib/libc/i386/gen/makecontext.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2001 Daniel M. Eischen <deischen@freebsd.org>
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/signal.h>
#include <sys/ucontext.h>
diff --git a/lib/libc/i386/gen/rfork_thread.S b/lib/libc/i386/gen/rfork_thread.S
deleted file mode 100644
index fb23ed041d09..000000000000
--- a/lib/libc/i386/gen/rfork_thread.S
+++ /dev/null
@@ -1,115 +0,0 @@
-/*-
- * Copyright (c) 2000 Peter Wemm <peter@FreeBSD.org>
- * All rights reserved.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * With thanks to John Dyson for the original version of this.
- */
-
-#include <SYS.h>
-
-/*
- * 8 12 16 20
- * rfork_thread(flags, stack_addr, start_fnc, start_arg);
- *
- * flags: Flags to rfork system call. See rfork(2).
- * stack_addr: Top of stack for thread.
- * start_fnc: Address of thread function to call in child.
- * start_arg: Argument to pass to the thread function in child.
- */
-
-ENTRY(rfork_thread)
- pushl %ebp
- movl %esp, %ebp
- pushl %esi
-
- /*
- * Push thread info onto the new thread's stack
- */
- movl 12(%ebp), %esi # get stack addr
-
- subl $4, %esi
- movl 20(%ebp), %eax # get start argument
- movl %eax, (%esi)
-
- subl $4, %esi
- movl 16(%ebp), %eax # get start thread address
- movl %eax, (%esi)
-
- /*
- * Prepare and execute the thread creation syscall
- */
- pushl 8(%ebp)
- pushl $0
- movl $SYS_rfork, %eax
- KERNCALL
- jb 2f
-
- /*
- * Check to see if we are in the parent or child
- */
- cmpl $0, %edx
- jnz 1f
- addl $8, %esp
- popl %esi
- movl %ebp, %esp
- popl %ebp
- ret
- .p2align 2
-
- /*
- * If we are in the child (new thread), then
- * set-up the call to the internal subroutine. If it
- * returns, then call __exit.
- */
-1:
- movl %esi,%esp
- popl %eax
- call *%eax
- addl $4, %esp
-
- /*
- * Exit system call
- */
- pushl %eax
- pushl $0
- movl $SYS_exit, %eax
- KERNCALL
-
- /*
- * Branch here if the thread creation fails:
- */
-2:
- addl $8, %esp
- popl %esi
- movl %ebp, %esp
- popl %ebp
- jmp HIDENAME(cerror)
-END(rfork_thread)
-
- .section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/i386/gen/setjmp.S b/lib/libc/i386/gen/setjmp.S
index 454ae1e59c88..e16f01d02f20 100644
--- a/lib/libc/i386/gen/setjmp.S
+++ b/lib/libc/i386/gen/setjmp.S
@@ -30,12 +30,7 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
- .asciz "@(#)setjmp.s 5.1 (Berkeley) 4/23/90"
-#endif /* LIBC_SCCS and not lint */
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* C library -- _setjmp, _longjmp
*
diff --git a/lib/libc/i386/gen/signalcontext.c b/lib/libc/i386/gen/signalcontext.c
index 35487093a869..38b306501c3c 100644
--- a/lib/libc/i386/gen/signalcontext.c
+++ b/lib/libc/i386/gen/signalcontext.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002 Jonathan Mini <mini@freebsd.org>
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/ucontext.h>
#include <machine/psl.h>
diff --git a/lib/libc/i386/gen/sigsetjmp.S b/lib/libc/i386/gen/sigsetjmp.S
index 5bf6d8e1750a..588788f32e0a 100644
--- a/lib/libc/i386/gen/sigsetjmp.S
+++ b/lib/libc/i386/gen/sigsetjmp.S
@@ -28,8 +28,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.s 5.1 (Berkeley) 4/23/90"
*/
#if defined(LIBC_SCCS) && !defined(lint)
@@ -37,8 +35,6 @@
.asciz "$Id: sigsetjmp.S,v 1.1 1993/12/05 13:01:05 ats Exp $"
#endif /* LIBC_SCCS and not lint */
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
#include "SYS.h"
/*-
diff --git a/lib/libc/i386/static_tls.h b/lib/libc/i386/static_tls.h
index b0685d2e0f80..baf9dfc59a5a 100644
--- a/lib/libc/i386/static_tls.h
+++ b/lib/libc/i386/static_tls.h
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2019 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 _LIBC_I386_STATIC_TLS_H
diff --git a/lib/libc/i386/stdlib/Makefile.inc b/lib/libc/i386/stdlib/Makefile.inc
index e4197d80b022..072bcb2ace0b 100644
--- a/lib/libc/i386/stdlib/Makefile.inc
+++ b/lib/libc/i386/stdlib/Makefile.inc
@@ -1,4 +1,2 @@
-# @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
-# $FreeBSD$
MDSRCS+=div.S ldiv.S
diff --git a/lib/libc/i386/stdlib/div.S b/lib/libc/i386/stdlib/div.S
index 81d6e6e4aa52..463dbabceb68 100644
--- a/lib/libc/i386/stdlib/div.S
+++ b/lib/libc/i386/stdlib/div.S
@@ -26,8 +26,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
ENTRY(div)
movl 4(%esp),%eax
movl 8(%esp),%ecx
diff --git a/lib/libc/i386/stdlib/ldiv.S b/lib/libc/i386/stdlib/ldiv.S
index c40c6314fc03..386d9c5e0c91 100644
--- a/lib/libc/i386/stdlib/ldiv.S
+++ b/lib/libc/i386/stdlib/ldiv.S
@@ -29,8 +29,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
ENTRY(ldiv)
movl 4(%esp),%eax
movl 8(%esp),%ecx
diff --git a/lib/libc/i386/string/Makefile.inc b/lib/libc/i386/string/Makefile.inc
index a8c50a285cbd..391b81be4d68 100644
--- a/lib/libc/i386/string/Makefile.inc
+++ b/lib/libc/i386/string/Makefile.inc
@@ -1,10 +1,8 @@
-# $FreeBSD$
MDSRCS+= \
bcmp.S \
bcopy.S \
bzero.S \
- ffs.S \
memcmp.S \
memcpy.S \
memmove.S \
diff --git a/lib/libc/i386/string/bcmp.S b/lib/libc/i386/string/bcmp.S
index b25ee6ef8dc1..44425ca6aa70 100644
--- a/lib/libc/i386/string/bcmp.S
+++ b/lib/libc/i386/string/bcmp.S
@@ -29,8 +29,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* bcmp (void *b1, void *b2, size_t len)
*
diff --git a/lib/libc/i386/string/bcopy.S b/lib/libc/i386/string/bcopy.S
index 4c653d744f15..9d1aa3d3608d 100644
--- a/lib/libc/i386/string/bcopy.S
+++ b/lib/libc/i386/string/bcopy.S
@@ -30,8 +30,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
#if 0
RCSID("$NetBSD: bcopy.S,v 1.6 1996/11/12 00:50:06 jtc Exp $")
#endif
diff --git a/lib/libc/i386/string/bzero.S b/lib/libc/i386/string/bzero.S
index c8d3776cf83f..3689b6a58b09 100644
--- a/lib/libc/i386/string/bzero.S
+++ b/lib/libc/i386/string/bzero.S
@@ -29,8 +29,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* bzero (void *b, size_t len)
* write len zero bytes to the string b.
diff --git a/lib/libc/i386/string/memcmp.S b/lib/libc/i386/string/memcmp.S
index cbb3b8a468a3..acabd2f6842f 100644
--- a/lib/libc/i386/string/memcmp.S
+++ b/lib/libc/i386/string/memcmp.S
@@ -29,8 +29,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* memcmp (void *b1, void *b2, size_t len)
*
diff --git a/lib/libc/i386/string/memcpy.S b/lib/libc/i386/string/memcpy.S
index f85a1a5b8021..1e753728aa56 100644
--- a/lib/libc/i386/string/memcpy.S
+++ b/lib/libc/i386/string/memcpy.S
@@ -1,5 +1,3 @@
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
#define MEMCOPY
#include "bcopy.S"
diff --git a/lib/libc/i386/string/memmove.S b/lib/libc/i386/string/memmove.S
index 02330c44414b..3447a68a16cf 100644
--- a/lib/libc/i386/string/memmove.S
+++ b/lib/libc/i386/string/memmove.S
@@ -1,5 +1,3 @@
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
#define MEMMOVE
#include "bcopy.S"
diff --git a/lib/libc/i386/string/memset.S b/lib/libc/i386/string/memset.S
index f5da603bae21..35079a9594d3 100644
--- a/lib/libc/i386/string/memset.S
+++ b/lib/libc/i386/string/memset.S
@@ -29,8 +29,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* memset(void *b, int c, size_t len)
* write len bytes of value c (converted to an unsigned char) to
diff --git a/lib/libc/i386/string/strcat.S b/lib/libc/i386/string/strcat.S
index 835a7e9ccf48..951aebadd724 100644
--- a/lib/libc/i386/string/strcat.S
+++ b/lib/libc/i386/string/strcat.S
@@ -29,8 +29,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* strcat(s, append)
* append a copy of the null-terminated string "append" to the end
diff --git a/lib/libc/i386/string/strchr.S b/lib/libc/i386/string/strchr.S
index 83aa87f1919e..25cf679fec7e 100644
--- a/lib/libc/i386/string/strchr.S
+++ b/lib/libc/i386/string/strchr.S
@@ -29,8 +29,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* strchr(s, c)
* return a pointer to the first occurrence of the character c in
diff --git a/lib/libc/i386/string/strcmp.S b/lib/libc/i386/string/strcmp.S
index 6599577b9e96..7d6fcaf563f1 100644
--- a/lib/libc/i386/string/strcmp.S
+++ b/lib/libc/i386/string/strcmp.S
@@ -29,8 +29,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* strcmp(s1, s2)
* return an integer greater than, equal to, or less than 0,
diff --git a/lib/libc/i386/string/strcpy.S b/lib/libc/i386/string/strcpy.S
index c5113f6a1959..9b393a739de0 100644
--- a/lib/libc/i386/string/strcpy.S
+++ b/lib/libc/i386/string/strcpy.S
@@ -29,8 +29,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* strcpy (dst, src)
* copy the string src to dst.
diff --git a/lib/libc/i386/string/strncmp.S b/lib/libc/i386/string/strncmp.S
index ec9b5311c6ab..865294eb9711 100644
--- a/lib/libc/i386/string/strncmp.S
+++ b/lib/libc/i386/string/strncmp.S
@@ -29,8 +29,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* strncmp(s1, s2, n)
* return an integer greater than, equal to, or less than 0,
diff --git a/lib/libc/i386/string/strrchr.S b/lib/libc/i386/string/strrchr.S
index 5e250b0c91aa..6549d4038ccf 100644
--- a/lib/libc/i386/string/strrchr.S
+++ b/lib/libc/i386/string/strrchr.S
@@ -29,8 +29,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* strrchr(s, c)
* return a pointer to the last occurrence of the character c in
diff --git a/lib/libc/i386/string/swab.S b/lib/libc/i386/string/swab.S
index 3d21e6496576..9f63c9518e34 100644
--- a/lib/libc/i386/string/swab.S
+++ b/lib/libc/i386/string/swab.S
@@ -29,8 +29,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* void
* swab (const void *src, void *dst, size_t len)
diff --git a/lib/libc/i386/string/wcschr.S b/lib/libc/i386/string/wcschr.S
index 37862a96f53e..a63bcf153284 100644
--- a/lib/libc/i386/string/wcschr.S
+++ b/lib/libc/i386/string/wcschr.S
@@ -25,8 +25,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* wchar_t *
* wcschr(const wchar_t *s, wchar_t c) --
diff --git a/lib/libc/i386/string/wcscmp.S b/lib/libc/i386/string/wcscmp.S
index 6fbcb8cc35ba..ce15c1dfc955 100644
--- a/lib/libc/i386/string/wcscmp.S
+++ b/lib/libc/i386/string/wcscmp.S
@@ -25,8 +25,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* int
* wcscmp(const wchar_t *s1, const wchar_t *s2) --
diff --git a/lib/libc/i386/string/wcslen.S b/lib/libc/i386/string/wcslen.S
index 691e17f98410..f6199b9ef726 100644
--- a/lib/libc/i386/string/wcslen.S
+++ b/lib/libc/i386/string/wcslen.S
@@ -25,8 +25,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* size_t
* wcslen(const wchar_t *s) --
diff --git a/lib/libc/i386/string/wmemchr.S b/lib/libc/i386/string/wmemchr.S
index 2e81c09bdca1..e945c12d2efd 100644
--- a/lib/libc/i386/string/wmemchr.S
+++ b/lib/libc/i386/string/wmemchr.S
@@ -25,8 +25,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* wchar_t *
* wmemchr(const wchar_t *buf, wchar_t c, size_t n) --
diff --git a/lib/libc/i386/sys/Makefile.inc b/lib/libc/i386/sys/Makefile.inc
deleted file mode 100644
index cf5d390ca094..000000000000
--- a/lib/libc/i386/sys/Makefile.inc
+++ /dev/null
@@ -1,19 +0,0 @@
-# from: Makefile.inc,v 1.1 1993/09/03 19:04:23 jtc Exp
-# $FreeBSD$
-
-.if !defined(COMPAT_32BIT)
-SRCS+= i386_clr_watch.c i386_set_watch.c i386_vm86.c
-.endif
-SRCS+= i386_get_fsbase.c i386_get_gsbase.c i386_get_ioperm.c i386_get_ldt.c \
- i386_set_fsbase.c i386_set_gsbase.c i386_set_ioperm.c i386_set_ldt.c
-
-MDASM= Ovfork.S cerror.S getcontext.S syscall.S
-
-NOASM+= sbrk.o vfork.o
-
-MAN+= i386_get_ioperm.2 i386_get_ldt.2 i386_vm86.2
-MAN+= i386_set_watch.3
-
-MLINKS+=i386_get_ioperm.2 i386_set_ioperm.2
-MLINKS+=i386_get_ldt.2 i386_set_ldt.2
-MLINKS+=i386_set_watch.3 i386_clr_watch.3
diff --git a/lib/libc/i386/sys/Ovfork.S b/lib/libc/i386/sys/Ovfork.S
deleted file mode 100644
index dfbe46ab6b25..000000000000
--- a/lib/libc/i386/sys/Ovfork.S
+++ /dev/null
@@ -1,54 +0,0 @@
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- */
-
-#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)Ovfork.s 5.1 (Berkeley) 4/23/90"
-#endif /* SYSLIBC_SCCS and not lint */
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#include "SYS.h"
-
- WEAK_REFERENCE(__sys_vfork, _vfork)
- WEAK_REFERENCE(__sys_vfork, vfork)
-ENTRY(__sys_vfork)
- popl %ecx /* my rta into ecx */
- mov $SYS_vfork,%eax
- KERNCALL
- jb 1f
- jmp *%ecx
-1:
- pushl %ecx
- jmp HIDENAME(cerror)
-END(__sys_vfork)
-
- .section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/i386/sys/cerror.S b/lib/libc/i386/sys/cerror.S
deleted file mode 100644
index 47bd0fade000..000000000000
--- a/lib/libc/i386/sys/cerror.S
+++ /dev/null
@@ -1,68 +0,0 @@
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- */
-
-#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)cerror.s 5.1 (Berkeley) 4/23/90"
-#endif /* SYSLIBC_SCCS and not lint */
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#include "SYS.h"
-
- .globl HIDENAME(cerror)
- .hidden HIDENAME(cerror)
-
- /*
- * The __error() function is thread aware. For non-threaded
- * programs and the initial thread in threaded programs,
- * it returns a pointer to the global errno variable.
- */
- .globl CNAME(__error)
- .type CNAME(__error),@function
-HIDENAME(cerror):
-#ifdef PIC
- PIC_PROLOGUE
- pushl %eax
- call PIC_PLT(CNAME(__error))
- popl %ecx
- PIC_EPILOGUE
-#else
- pushl %eax
- call CNAME(__error)
- popl %ecx
-#endif
- movl %ecx,(%eax)
- movl $-1,%eax
- movl $-1,%edx
- ret
-
- .section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/i386/sys/getcontext.S b/lib/libc/i386/sys/getcontext.S
deleted file mode 100644
index 4923382e7368..000000000000
--- a/lib/libc/i386/sys/getcontext.S
+++ /dev/null
@@ -1,48 +0,0 @@
-/*-
- * Copyright (c) 2003 Peter Wemm <peter@FreeBSD.org>
- * All rights reserved.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#include <SYS.h>
-
-/*
- * This has to be magic to handle the multiple returns.
- * Otherwise, the setcontext() syscall will return here and we'll
- * pop off the return address and go to the *setcontext* call.
- */
- WEAK_REFERENCE(__sys_getcontext, _getcontext)
- WEAK_REFERENCE(__sys_getcontext, getcontext)
-ENTRY(__sys_getcontext)
- movl (%esp),%ecx /* save getcontext return address */
- mov $SYS_getcontext,%eax
- KERNCALL
- jb HIDENAME(cerror)
- addl $4,%esp /* remove stale (setcontext) return address */
- jmp *%ecx /* restore return address */
-END(__sys_getcontext)
-
- .section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/i386/sys/i386_clr_watch.c b/lib/libc/i386/sys/i386_clr_watch.c
deleted file mode 100644
index 885ed7ddc398..000000000000
--- a/lib/libc/i386/sys/i386_clr_watch.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright 2000 Brian S. Dean <bsd@bsdhome.com>
- * All Rights Reserved.
- *
- * 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 BRIAN S. DEAN ``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 BRIAN S. DEAN 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <machine/reg.h>
-#include <machine/sysarch.h>
-
-int
-i386_clr_watch(int watchnum, struct dbreg * d)
-{
-
- if (watchnum < 0 || watchnum >= 4)
- return -1;
-
- DBREG_DRX(d,7) = DBREG_DRX(d,7) & ~((0x3 << (watchnum*2)) | (0x0f << (watchnum*4+16)));
- DBREG_DRX(d,watchnum) = 0;
-
- return 0;
-}
diff --git a/lib/libc/i386/sys/i386_get_fsbase.c b/lib/libc/i386/sys/i386_get_fsbase.c
deleted file mode 100644
index 973dea2c31ee..000000000000
--- a/lib/libc/i386/sys/i386_get_fsbase.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 2005 Peter Wemm
- * All rights reserved.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <machine/sysarch.h>
-
-int
-i386_get_fsbase(void **addr)
-{
-
- return (sysarch(I386_GET_FSBASE, addr));
-}
diff --git a/lib/libc/i386/sys/i386_get_gsbase.c b/lib/libc/i386/sys/i386_get_gsbase.c
deleted file mode 100644
index 908a15eed24c..000000000000
--- a/lib/libc/i386/sys/i386_get_gsbase.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 2005 Peter Wemm
- * All rights reserved.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <machine/sysarch.h>
-
-int
-i386_get_gsbase(void **addr)
-{
-
- return (sysarch(I386_GET_GSBASE, addr));
-}
diff --git a/lib/libc/i386/sys/i386_get_ioperm.2 b/lib/libc/i386/sys/i386_get_ioperm.2
deleted file mode 100644
index 75fdd10e94b9..000000000000
--- a/lib/libc/i386/sys/i386_get_ioperm.2
+++ /dev/null
@@ -1,87 +0,0 @@
-.\" Copyright (c) 1998 Jonathan Lemon
-.\" All rights reserved.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd July 27, 1998
-.Dt I386_GET_IOPERM 2
-.Os
-.Sh NAME
-.Nm i386_get_ioperm ,
-.Nm i386_set_ioperm
-.Nd manage per-process access to the i386 I/O port space
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In machine/sysarch.h
-.Ft int
-.Fn i386_get_ioperm "unsigned int start" "unsigned int *length" "int *enable"
-.Ft int
-.Fn i386_set_ioperm "unsigned int start" "unsigned int length" "int enable"
-.Sh DESCRIPTION
-The
-.Fn i386_get_ioperm
-system call
-will return the permission for the process' I/O port space in the
-.Fa *enable
-argument.
-The port range starts at
-.Fa start
-and the number of contiguous entries will be returned in
-.Fa *length .
-.Pp
-The
-.Fn i386_set_ioperm
-system call
-will set access to a range of I/O ports described by the
-.Fa start
-and
-.Fa length
-arguments to the state specified by the
-.Fa enable
-argument.
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-The
-.Fn i386_get_ioperm
-and
-.Fn i386_set_ioperm
-system calls
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-An invalid range was specified by the
-.Fa start
-or
-.Fa length
-arguments.
-.It Bq Er EPERM
-The caller of i386_set_ioperm was not the superuser.
-.El
-.Sh SEE ALSO
-.Xr io 4
-.Sh AUTHORS
-This man page was written by
-.An Jonathan Lemon .
diff --git a/lib/libc/i386/sys/i386_get_ioperm.c b/lib/libc/i386/sys/i386_get_ioperm.c
deleted file mode 100644
index 1bdabb2794f0..000000000000
--- a/lib/libc/i386/sys/i386_get_ioperm.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 1998 Jonathan Lemon
- * All rights reserved.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <machine/sysarch.h>
-
-int
-i386_get_ioperm(unsigned int start, unsigned int *length, int *enable)
-{
- struct i386_ioperm_args p;
- int error;
-
- p.start = start;
- p.length = *length;
- p.enable = *enable;
-
- error = sysarch(I386_GET_IOPERM, &p);
-
- *length = p.length;
- *enable = p.enable;
-
- return (error);
-}
diff --git a/lib/libc/i386/sys/i386_get_ldt.2 b/lib/libc/i386/sys/i386_get_ldt.2
deleted file mode 100644
index 792b3ace94d0..000000000000
--- a/lib/libc/i386/sys/i386_get_ldt.2
+++ /dev/null
@@ -1,139 +0,0 @@
-.\" Copyright (c) 1980, 1991 Regents of the University of California.
-.\" All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" from: @(#)fork.2 6.5 (Berkeley) 3/10/91
-.\" $FreeBSD$
-.\"
-.Dd October 14, 2006
-.Dt I386_GET_LDT 2
-.Os
-.Sh NAME
-.Nm i386_get_ldt ,
-.Nm i386_set_ldt
-.Nd manage i386 per-process Local Descriptor Table entries
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In machine/segments.h
-.In machine/sysarch.h
-.Ft int
-.Fn i386_get_ldt "int start_sel" "union descriptor *descs" "int num_sels"
-.Ft int
-.Fn i386_set_ldt "int start_sel" "union descriptor *descs" "int num_sels"
-.Sh DESCRIPTION
-The
-.Fn i386_get_ldt
-system call
-returns a list of the i386 descriptors in the current process'
-LDT.
-The
-.Fn i386_set_ldt
-system call
-sets a list of i386 descriptors in the current process'
-LDT.
-For both routines,
-.Fa start_sel
-specifies the index of the selector in the LDT at which to begin and
-.Fa descs
-points to an array of
-.Fa num_sels
-descriptors to be set or returned.
-.Pp
-Each entry in the
-.Fa descs
-array can be either a segment_descriptor or gate_descriptor and are defined in
-.In i386/segments.h .
-These structures are defined by the architecture
-as disjoint bit-fields, so care must be taken in constructing them.
-.Pp
-If
-.Fa start_sel
-is
-.Em LDT_AUTO_ALLOC ,
-.Fa num_sels
-is 1 and the descriptor pointed to by
-.Fa descs
-is legal, then
-.Fn i386_set_ldt
-will allocate a descriptor and return its
-selector number.
-.Pp
-If
-.Fa num_descs
-is 1,
-.Fa start_sels
-is valid, and
-.Fa descs
-is NULL, then
-.Fn i386_set_ldt
-will free that descriptor
-(making it available to be reallocated again later).
-.Pp
-If
-.Fa num_descs
-is 0,
-.Fa start_sels
-is 0 and
-.Fa descs
-is NULL then, as a special case,
-.Fn i386_set_ldt
-will free all descriptors.
-.Sh RETURN VALUES
-Upon successful completion,
-.Fn i386_get_ldt
-returns the number of descriptors currently in the LDT.
-The
-.Fn i386_set_ldt
-system call
-returns the first selector set on success.
-If the kernel allocated a descriptor in the LDT,
-the allocated index is returned.
-Otherwise, a value of -1 is returned and the global
-variable
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-The
-.Fn i386_get_ldt
-and
-.Fn i386_set_ldt
-system calls
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-An inappropriate value was used for
-.Fa start_sel
-or
-.Fa num_sels .
-.It Bq Er EACCES
-The caller attempted to use a descriptor that would
-circumvent protection or cause a failure.
-.El
-.Sh SEE ALSO
-i386 Microprocessor Programmer's Reference Manual, Intel
-.Sh WARNING
-You can really hose your process using this.
diff --git a/lib/libc/i386/sys/i386_get_ldt.c b/lib/libc/i386/sys/i386_get_ldt.c
deleted file mode 100644
index 78dd16cb77b3..000000000000
--- a/lib/libc/i386/sys/i386_get_ldt.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-3-Clause
- *
- * Copyright (c) 1993 John Brezak
- * All rights reserved.
- *
- * 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.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/cdefs.h>
-#include <machine/segments.h>
-#include <machine/sysarch.h>
-
-int
-i386_get_ldt(int start, union descriptor *descs, int num)
-{
- struct i386_ldt_args p;
-
- p.start = start;
- p.descs = descs;
- p.num = num;
-
- return sysarch(I386_GET_LDT, &p);
-}
diff --git a/lib/libc/i386/sys/i386_set_fsbase.c b/lib/libc/i386/sys/i386_set_fsbase.c
deleted file mode 100644
index daa14591fce6..000000000000
--- a/lib/libc/i386/sys/i386_set_fsbase.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 2005 Peter Wemm
- * All rights reserved.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <machine/sysarch.h>
-
-int
-i386_set_fsbase(void *addr)
-{
-
- return (sysarch(I386_SET_FSBASE, &addr));
-}
diff --git a/lib/libc/i386/sys/i386_set_gsbase.c b/lib/libc/i386/sys/i386_set_gsbase.c
deleted file mode 100644
index ffb435244b44..000000000000
--- a/lib/libc/i386/sys/i386_set_gsbase.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 2005 Peter Wemm
- * All rights reserved.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <machine/sysarch.h>
-
-int
-i386_set_gsbase(void *addr)
-{
-
- return (sysarch(I386_SET_GSBASE, &addr));
-}
diff --git a/lib/libc/i386/sys/i386_set_ioperm.c b/lib/libc/i386/sys/i386_set_ioperm.c
deleted file mode 100644
index a18336841b83..000000000000
--- a/lib/libc/i386/sys/i386_set_ioperm.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 1998 Jonathan Lemon
- * All rights reserved.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <machine/sysarch.h>
-
-int
-i386_set_ioperm(unsigned int start, unsigned int length, int enable)
-{
- struct i386_ioperm_args p;
-
- p.start = start;
- p.length = length;
- p.enable = enable;
-
- return (sysarch(I386_SET_IOPERM, &p));
-}
diff --git a/lib/libc/i386/sys/i386_set_ldt.c b/lib/libc/i386/sys/i386_set_ldt.c
deleted file mode 100644
index 7abcc33deb6c..000000000000
--- a/lib/libc/i386/sys/i386_set_ldt.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-3-Clause
- *
- * Copyright (c) 1993 John Brezak
- * All rights reserved.
- *
- * 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.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/cdefs.h>
-#include <machine/segments.h>
-#include <machine/sysarch.h>
-
-int
-i386_set_ldt(int start, union descriptor *descs, int num)
-{
- struct i386_ldt_args p;
-
- p.start = start;
- p.descs = descs;
- p.num = num;
-
- return sysarch(I386_SET_LDT, &p);
-}
diff --git a/lib/libc/i386/sys/i386_set_watch.3 b/lib/libc/i386/sys/i386_set_watch.3
deleted file mode 100644
index 9f37c9d65136..000000000000
--- a/lib/libc/i386/sys/i386_set_watch.3
+++ /dev/null
@@ -1,118 +0,0 @@
-.\" Copyright (c) 2000 Brian S. Dean
-.\" All rights reserved.
-.\"
-.\" This man-page is based on a similar man-page by Jonathan Lemon
-.\" which is copyrighted under the following conditions:
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd August 24, 2000
-.Dt I386_SET_WATCH 3
-.Os
-.Sh NAME
-.Nm i386_clr_watch ,
-.Nm i386_set_watch
-.Nd manage i386 debug register values
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In machine/reg.h
-.In machine/sysarch.h
-.Ft int
-.Fn i386_clr_watch "int watchnum" "struct dbreg *d"
-.Ft int
-.Fn i386_set_watch "int watchnum" "unsigned int watchaddr" "int size" "int access" "struct dbreg *d"
-.Sh DESCRIPTION
-The
-.Fn i386_clr_watch
-function
-will disable the indicated watch point within the specified debug
-register set.
-.Pp
-The
-.Fn i386_set_watch
-function
-will set up the specified debug registers as indicated by the
-arguments.
-The
-.Fa watchnum
-argument specifies which watch register is used, 0, 1, 2, 3, or \-1.
-If
-.Fa watchnum
-is \-1, a free watch register is found and used.
-If there are no free
-watch registers, an error code of \-1 is returned.
-The
-.Fa watchaddr
-argument
-specifies the watch address,
-.Fa size
-specifies the size in bytes of the area to be watched (1, 2, or 4 bytes),
-and
-.Fa access
-specifies the type of watch point:
-.Pp
-.Bd -literal -offset indent -compact
-DBREG_DR7_EXEC An execution breakpoint.
-DBREG_DR7_WRONLY Break only when the watch area is written to.
-DBREG_DR7_RDWR Break when the watch area is read from or written
- to.
-.Ed
-.Pp
-Note that these functions do not actually set or clear breakpoints;
-they manipulate the indicated debug register set.
-You must use
-.Xr ptrace 2
-to retrieve and install the debug register values for a process.
-.Sh RETURN VALUES
-On success, the
-.Fn i386_clr_watch
-function returns 0.
-On error, \-1 returned which indicates that
-.Fa watchnum
-is invalid (not in the range of 0-3).
-If the specified watchnum was already disabled, no error is returned.
-.Pp
-On success, the
-.Fn i386_set_watch
-function returns the
-.Fa watchnum
-argument, or the watchnum actually used in the case where the specified
-.Fa watchnum
-was \-1.
-On error, the
-.Fn i386_set_watch
-function returns \-1 indicating that the watchpoint could not established
-because either no more watchpoints are available, or
-.Fa watchnum ,
-.Fa size ,
-or
-.Fa access
-is invalid.
-.Sh SEE ALSO
-.Xr ptrace 2 ,
-.Xr procfs 5
-.Sh AUTHORS
-This man page was written by
-.An Brian S. Dean .
diff --git a/lib/libc/i386/sys/i386_set_watch.c b/lib/libc/i386/sys/i386_set_watch.c
deleted file mode 100644
index 181df83ea2a8..000000000000
--- a/lib/libc/i386/sys/i386_set_watch.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright 2000 Brian S. Dean <bsd@bsdhome.com>
- * All Rights Reserved.
- *
- * 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 BRIAN S. DEAN ``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 BRIAN S. DEAN 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <machine/reg.h>
-#include <machine/sysarch.h>
-
-int
-i386_set_watch(int watchnum, unsigned int watchaddr, int size,
- int access, struct dbreg * d)
-{
- int i;
- unsigned int mask;
-
- if (watchnum == -1) {
- for (i = 0, mask = 0x3; i < 4; i++, mask <<= 2)
- if ((DBREG_DRX(d,7) & mask) == 0)
- break;
- if (i < 4)
- watchnum = i;
- else
- return -1;
- }
-
- switch (access) {
- case DBREG_DR7_EXEC:
- size = 1; /* size must be 1 for an execution breakpoint */
- /* fall through */
- case DBREG_DR7_WRONLY:
- case DBREG_DR7_RDWR:
- break;
- default : return -1; break;
- }
-
- /*
- * we can watch a 1, 2, or 4 byte sized location
- */
- switch (size) {
- case 1 : mask = 0x00; break;
- case 2 : mask = 0x01 << 2; break;
- case 4 : mask = 0x03 << 2; break;
- default : return -1; break;
- }
-
- mask |= access;
-
- /* clear the bits we are about to affect */
- DBREG_DRX(d,7) &= ~((0x3 << (watchnum*2)) | (0x0f << (watchnum*4+16)));
-
- /* set drN register to the address, N=watchnum */
- DBREG_DRX(d,watchnum) = watchaddr;
-
- /* enable the watchpoint */
- DBREG_DRX(d,7) |= (0x2 << (watchnum*2)) | (mask << (watchnum*4+16));
-
- return watchnum;
-}
diff --git a/lib/libc/i386/sys/i386_vm86.2 b/lib/libc/i386/sys/i386_vm86.2
deleted file mode 100644
index 5958f31d2cbf..000000000000
--- a/lib/libc/i386/sys/i386_vm86.2
+++ /dev/null
@@ -1,141 +0,0 @@
-.\" Copyright (c) 1998 Jonathan Lemon
-.\" All rights reserved.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd July 27, 1998
-.Dt I386_VM86 2
-.Os
-.Sh NAME
-.Nm i386_vm86
-.Nd control vm86-related functions
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In machine/sysarch.h
-.In machine/vm86.h
-.Ft int
-.Fn i386_vm86 "int function" "void *data"
-.Sh DESCRIPTION
-The
-.Fn i386_vm86
-system call
-is used to call various vm86 related functions.
-The
-.Fa function
-argument
-can be one of the following values:
-.Bl -tag -offset indent -width VM86_SET_VME
-.It Dv VM86_INIT
-This will initialize the kernel's vm86 parameter area for the
-process, and permit the process to make vm86 calls.
-The
-.Fa data
-argument
-points to the following structure:
-.Bd -literal
-struct vm86_init_args {
- int debug;
- int cpu_type;
- u_char int_map[32];
-};
-.Ed
-.Pp
-The
-.Fa debug
-argument
-is used to turn on debugging code.
-The
-.Fa cpu_type
-argument
-controls the type of CPU being emulated, and is currently unimplemented.
-The
-.Fa int_map
-argument
-is a bitmap which determines whether vm86 interrupts should be handled
-in vm86 mode, or reflected back to the process.
-If the
-.Em Nth
-bit is set, the interrupt will be reflected to the process, otherwise
-it will be dispatched by the vm86 interrupt table.
-.It Dv VM86_INTCALL
-This allows calls to be made to vm86 interrupt handlers by the process.
-It effectively simulates an INT instruction.
-.Fa data
-should point to the following structure:
-.Bd -literal
-struct vm86_intcall_args {
- int intnum;
- struct vm86frame vmf;
-};
-.Ed
-.Pp
-.Fa intnum
-specifies the operand of INT for the simulated call.
-A value of 0x10, for example, would often be used to call into the VGA BIOS.
-.Fa vmf
-is used to initialize CPU registers according to the calling convention for
-the interrupt handler.
-.It Dv VM86_GET_VME
-This is used to retrieve the current state of the Pentium(r) processor's
-VME (Virtual-8086 Mode Extensions) flag, which is bit 0 of CR4.
-.Fa data
-should be initialized to point to the following:
-.Bd -literal
-struct vm86_vme_args {
- int state; /* status */
-};
-.Ed
-.Pp
-.Fa state
-will contain the state of the VME flag on return.
-.\" .It Dv VM86_SET_VME
-.El
-.Pp
-vm86 mode is entered by calling
-.Xr sigreturn 2
-with the correct machine context for vm86, and with the
-.Dv PSL_VM
-bit set.
-Control returns to the process upon delivery of a signal.
-.Sh RETURN VALUES
-.Rv -std i386_vm86
-.Sh ERRORS
-The
-.Fn i386_vm86
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The kernel does not have vm86 support, or an invalid function was specified.
-.It Bq Er ENOMEM
-There is not enough memory to initialize the kernel data structures.
-.El
-.Sh AUTHORS
-.An -nosplit
-This man page was written by
-.An Jonathan Lemon ,
-and updated by
-.An Bruce M Simpson .
diff --git a/lib/libc/i386/sys/i386_vm86.c b/lib/libc/i386/sys/i386_vm86.c
deleted file mode 100644
index 90d90242d4a0..000000000000
--- a/lib/libc/i386/sys/i386_vm86.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 1998 Jonathan Lemon
- * All rights reserved.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <machine/sysarch.h>
-
-int
-i386_vm86(int fcn, void *data)
-{
- struct i386_vm86_args p;
-
- p.sub_op = fcn;
- p.sub_args = (char *)data;
-
- return (sysarch(I386_VM86, &p));
-}
diff --git a/lib/libc/i386/sys/syscall.S b/lib/libc/i386/sys/syscall.S
deleted file mode 100644
index 4a9d2717a75d..000000000000
--- a/lib/libc/i386/sys/syscall.S
+++ /dev/null
@@ -1,52 +0,0 @@
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- */
-
-#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)syscall.s 5.1 (Berkeley) 4/23/90"
-#endif /* SYSLIBC_SCCS and not lint */
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#include "SYS.h"
-
-ENTRY(syscall)
- pop %ecx /* rta */
- pop %eax /* syscall number */
- push %ecx
- KERNCALL
- push %ecx /* need to push a word to keep stack frame intact
- upon return; the word must be the return address. */
- jb HIDENAME(cerror)
- ret
-END(syscall)
-
- .section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/iconv/Makefile.inc b/lib/libc/iconv/Makefile.inc
index 09a51e1cdba2..1e23f1a6fc94 100644
--- a/lib/libc/iconv/Makefile.inc
+++ b/lib/libc/iconv/Makefile.inc
@@ -1,4 +1,3 @@
-# $FreeBSD$
# iconv sources
.PATH: ${LIBC_SRCTOP}/iconv
diff --git a/lib/libc/iconv/Symbol.map b/lib/libc/iconv/Symbol.map
index 8a9a75d519ed..d36e0733a4f0 100644
--- a/lib/libc/iconv/Symbol.map
+++ b/lib/libc/iconv/Symbol.map
@@ -1,7 +1,3 @@
-/*
- * $FreeBSD$
- */
-
FBSD_1.3 {
__bsd___iconv;
__bsd___iconv_free_list;
@@ -19,15 +15,6 @@ FBSD_1.3 {
FBSDprivate_1.0 {
_citrus_bcs_convert_to_lower;
_citrus_bcs_convert_to_upper;
- _citrus_bcs_isalnum;
- _citrus_bcs_isalpha;
- _citrus_bcs_isblank;
- _citrus_bcs_isdigit;
- _citrus_bcs_iseol;
- _citrus_bcs_islower;
- _citrus_bcs_isspace;
- _citrus_bcs_isupper;
- _citrus_bcs_isxdigit;
_citrus_bcs_skip_nonws;
_citrus_bcs_skip_nonws_len;
_citrus_bcs_skip_ws;
@@ -36,12 +23,8 @@ FBSDprivate_1.0 {
_citrus_bcs_strncasecmp;
_citrus_bcs_strtol;
_citrus_bcs_strtoul;
- _citrus_bcs_tolower;
- _citrus_bcs_toupper;
_citrus_bcs_trunc_rws_len;
- _citrus_bcs_trunc_ws_len;
_citrus_csmapper_open;
- _citrus_csmapper_close;
_citrus_db_factory_add_by_string;
_citrus_db_factory_add_string_by_string;
_citrus_db_factory_add32_by_string;
@@ -63,41 +46,16 @@ FBSDprivate_1.0 {
_citrus_lookup_factory_convert;
_citrus_map_file;
_citrus_mapper_close;
- _citrus_mapper_convert;
_citrus_mapper_create_area;
- _citrus_mapper_get_dst_max;
- _citrus_mapper_get_src_max;
- _citrus_mapper_get_state_size;
- _citrus_mapper_init_state;
_citrus_mapper_open;
_citrus_mapper_open_direct;
_citrus_mapper_set_persistent;
- _citrus_memory_stream_bind;
_citrus_memory_stream_chr;
- _citrus_memory_stream_getc;
_citrus_memory_stream_getln;
- _citrus_memory_stream_getln_region;
- _citrus_memory_stream_getregion;
- _citrus_memory_stream_iseof;
_citrus_memory_stream_matchline;
- _citrus_memory_stream_peek;
- _citrus_memory_stream_remainder;
- _citrus_memory_stream_rewind;
- _citrus_memory_stream_seek;
_citrus_memory_stream_skip_ws;
- _citrus_memory_stream_tell;
- _citrus_memory_stream_ungetc;
_citrus_pivot_factory_convert;
- _citrus_prop_object_init;
- _citrus_prop_object_uninit;
_citrus_prop_parse_variable;
- _citrus_prop_read_bool;
- _citrus_prop_read_character;
- _citrus_prop_read_character_common;
- _citrus_prop_read_element;
- _citrus_prop_read_num;
- _citrus_prop_read_str;
- _citrus_prop_read_symbol;
_citrus_stdenc_close;
_citrus_stdenc_open;
_citrus_unmap_file;
diff --git a/lib/libc/iconv/__iconv.c b/lib/libc/iconv/__iconv.c
index 9fd0567087a2..3e412ee1eab7 100644
--- a/lib/libc/iconv/__iconv.c
+++ b/lib/libc/iconv/__iconv.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2013 Peter Wemm
* 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$
*/
#include <sys/types.h>
diff --git a/lib/libc/iconv/__iconv_free_list.c b/lib/libc/iconv/__iconv_free_list.c
index 0f2b92355e32..f5407562cb43 100644
--- a/lib/libc/iconv/__iconv_free_list.c
+++ b/lib/libc/iconv/__iconv_free_list.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2013 Peter Wemm
* 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$
*/
#include <sys/types.h>
diff --git a/lib/libc/iconv/__iconv_get_list.3 b/lib/libc/iconv/__iconv_get_list.3
index 14f1560d56f4..08d11c05918b 100644
--- a/lib/libc/iconv/__iconv_get_list.3
+++ b/lib/libc/iconv/__iconv_get_list.3
@@ -32,8 +32,6 @@
.\" the referee document. The original Standard can be obtained online at
.\" http://www.opengroup.org/unix/online.html.
.\"
-.\" $FreeBSD$
-.\"
.Dd October 20, 2009
.Dt __ICONV_GET_LIST 3
.Os
diff --git a/lib/libc/iconv/__iconv_get_list.c b/lib/libc/iconv/__iconv_get_list.c
index cb80ed78ef48..49f23f45bf0a 100644
--- a/lib/libc/iconv/__iconv_get_list.c
+++ b/lib/libc/iconv/__iconv_get_list.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2013 Peter Wemm
* 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$
*/
#include <sys/types.h>
diff --git a/lib/libc/iconv/_strtol.h b/lib/libc/iconv/_strtol.h
index dee7bab733e8..94a13c56db98 100644
--- a/lib/libc/iconv/_strtol.h
+++ b/lib/libc/iconv/_strtol.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: _strtol.h,v 1.2 2009/05/20 22:03:29 christos Exp $ */
/*-
@@ -84,11 +83,21 @@ _FUNCNAME(const char *nptr, char **endptr, int base)
c = *s++;
}
if ((base == 0 || base == 16) &&
- c == '0' && (*s == 'x' || *s == 'X')) {
+ c == '0' && (*s == 'x' || *s == 'X') &&
+ ((s[1] >= '0' && s[1] <= '9') ||
+ (s[1] >= 'A' && s[1] <= 'F') ||
+ (s[1] >= 'a' && s[1] <= 'f'))) {
c = s[1];
s += 2;
base = 16;
}
+ if ((base == 0 || base == 2) &&
+ c == '0' && (*s == 'b' || *s == 'B') &&
+ (s[1] >= '0' && s[1] <= '1')) {
+ c = s[1];
+ s += 2;
+ base = 2;
+ }
if (base == 0)
base = (c == '0' ? 8 : 10);
diff --git a/lib/libc/iconv/_strtoul.h b/lib/libc/iconv/_strtoul.h
index 2dd3e92ba302..4944e1fb06e0 100644
--- a/lib/libc/iconv/_strtoul.h
+++ b/lib/libc/iconv/_strtoul.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: _strtoul.h,v 1.1 2008/08/20 12:42:26 joerg Exp $ */
/*-
@@ -80,11 +79,21 @@ _FUNCNAME(const char *nptr, char **endptr, int base)
c = *s++;
}
if ((base == 0 || base == 16) &&
- c == '0' && (*s == 'x' || *s == 'X')) {
+ c == '0' && (*s == 'x' || *s == 'X') &&
+ ((s[1] >= '0' && s[1] <= '9') ||
+ (s[1] >= 'A' && s[1] <= 'F') ||
+ (s[1] >= 'a' && s[1] <= 'f'))) {
c = s[1];
s += 2;
base = 16;
}
+ if ((base == 0 || base == 2) &&
+ c == '0' && (*s == 'b' || *s == 'B') &&
+ (s[1] >= '0' && s[1] <= '1')) {
+ c = s[1];
+ s += 2;
+ base = 2;
+ }
if (base == 0)
base = (c == '0' ? 8 : 10);
diff --git a/lib/libc/iconv/bsd_iconv.c b/lib/libc/iconv/bsd_iconv.c
index 0fcff0e2d1b8..d3da6fd1a271 100644
--- a/lib/libc/iconv/bsd_iconv.c
+++ b/lib/libc/iconv/bsd_iconv.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: iconv.c,v 1.11 2009/03/03 16:22:33 explorer Exp $ */
/*-
@@ -30,7 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <sys/queue.h>
#include <sys/types.h>
@@ -56,8 +54,6 @@
static iconv_t
__bsd___iconv_open(const char *out, const char *in, struct _citrus_iconv *handle)
{
- const char *out_slashes;
- char *out_noslashes;
int ret;
/*
@@ -66,27 +62,13 @@ __bsd___iconv_open(const char *out, const char *in, struct _citrus_iconv *handle
* This is for compatibility with software that uses these
* blindly.
*/
- out_slashes = strstr(out, "//");
- if (out_slashes != NULL) {
- out_noslashes = strndup(out, out_slashes - out);
- if (out_noslashes == NULL) {
- errno = ENOMEM;
- return ((iconv_t)-1);
- }
- ret = _citrus_iconv_open(&handle, in, out_noslashes);
- free(out_noslashes);
- } else {
- ret = _citrus_iconv_open(&handle, in, out);
- }
-
+ ret = _citrus_iconv_open(&handle, in, out);
if (ret) {
errno = ret == ENOENT ? EINVAL : ret;
return ((iconv_t)-1);
}
handle->cv_shared->ci_discard_ilseq = strcasestr(out, "//IGNORE");
- handle->cv_shared->ci_ilseq_invalid = false;
- handle->cv_shared->ci_hooks = NULL;
return ((iconv_t)(void *)handle);
}
diff --git a/lib/libc/iconv/citrus_aliasname_local.h b/lib/libc/iconv/citrus_aliasname_local.h
index 0dc883a54c92..e4ae8c70562c 100644
--- a/lib/libc/iconv/citrus_aliasname_local.h
+++ b/lib/libc/iconv/citrus_aliasname_local.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_aliasname_local.h,v 1.2 2009/01/11 02:46:24 christos Exp $ */
/*-
diff --git a/lib/libc/iconv/citrus_bcs.c b/lib/libc/iconv/citrus_bcs.c
index b8484a0d793e..8409e1fbac7b 100644
--- a/lib/libc/iconv/citrus_bcs.c
+++ b/lib/libc/iconv/citrus_bcs.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_bcs.c,v 1.5 2005/05/14 17:55:42 tshiozak Exp $ */
/*-
@@ -29,7 +28,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <assert.h>
#include <stdlib.h>
@@ -109,7 +107,7 @@ const char *
_citrus_bcs_skip_ws_len(const char * __restrict p, size_t * __restrict len)
{
- while (*p && *len > 0 && _bcs_isspace(*p)) {
+ while (*len > 0 && *p && _bcs_isspace(*p)) {
p++;
(*len)--;
}
@@ -124,7 +122,7 @@ const char *
_citrus_bcs_skip_nonws_len(const char * __restrict p, size_t * __restrict len)
{
- while (*p && *len > 0 && !_bcs_isspace(*p)) {
+ while (*len > 0 && *p && !_bcs_isspace(*p)) {
p++;
(*len)--;
}
diff --git a/lib/libc/iconv/citrus_bcs.h b/lib/libc/iconv/citrus_bcs.h
index 3bf6f72e988e..ba4d97aa7c3f 100644
--- a/lib/libc/iconv/citrus_bcs.h
+++ b/lib/libc/iconv/citrus_bcs.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_bcs.h,v 1.6 2009/01/11 02:46:24 christos Exp $ */
/*-
diff --git a/lib/libc/iconv/citrus_bcs_strtol.c b/lib/libc/iconv/citrus_bcs_strtol.c
index fda263b6479f..55d4d1ca565d 100644
--- a/lib/libc/iconv/citrus_bcs_strtol.c
+++ b/lib/libc/iconv/citrus_bcs_strtol.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_bcs_strtol.c,v 1.4 2013/04/26 21:20:47 joerg Exp $ */
/*-
@@ -30,7 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <assert.h>
#include <errno.h>
diff --git a/lib/libc/iconv/citrus_bcs_strtoul.c b/lib/libc/iconv/citrus_bcs_strtoul.c
index 981aa5ad1b8c..280397a72428 100644
--- a/lib/libc/iconv/citrus_bcs_strtoul.c
+++ b/lib/libc/iconv/citrus_bcs_strtoul.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_bcs_strtoul.c,v 1.5 2013/04/26 21:20:48 joerg Exp $ */
/*-
@@ -30,7 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <assert.h>
#include <errno.h>
diff --git a/lib/libc/iconv/citrus_csmapper.c b/lib/libc/iconv/citrus_csmapper.c
index 90d52cba2ce3..642abafbe9a2 100644
--- a/lib/libc/iconv/citrus_csmapper.c
+++ b/lib/libc/iconv/citrus_csmapper.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_csmapper.c,v 1.11 2011/11/20 07:43:52 tnozaki Exp $ */
/*-
@@ -29,7 +28,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <sys/endian.h>
#include <sys/types.h>
#include <sys/queue.h>
diff --git a/lib/libc/iconv/citrus_csmapper.h b/lib/libc/iconv/citrus_csmapper.h
index cdc7b0e3375e..d19e754adb44 100644
--- a/lib/libc/iconv/citrus_csmapper.h
+++ b/lib/libc/iconv/citrus_csmapper.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_csmapper.h,v 1.3 2013/06/24 17:28:35 joerg Exp $ */
/*-
diff --git a/lib/libc/iconv/citrus_db.c b/lib/libc/iconv/citrus_db.c
index 09df5bfaf07f..bb74668a2d4c 100644
--- a/lib/libc/iconv/citrus_db.c
+++ b/lib/libc/iconv/citrus_db.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_db.c,v 1.5 2008/02/09 14:56:20 junyoung Exp $ */
/*-
@@ -29,7 +28,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <sys/endian.h>
#include <sys/types.h>
diff --git a/lib/libc/iconv/citrus_db.h b/lib/libc/iconv/citrus_db.h
index fd46675a5d0b..b885df55c53f 100644
--- a/lib/libc/iconv/citrus_db.h
+++ b/lib/libc/iconv/citrus_db.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_db.h,v 1.2 2008/02/09 14:56:20 junyoung Exp $ */
/*-
diff --git a/lib/libc/iconv/citrus_db_factory.c b/lib/libc/iconv/citrus_db_factory.c
index fd3375d6b2e0..c1753195c767 100644
--- a/lib/libc/iconv/citrus_db_factory.c
+++ b/lib/libc/iconv/citrus_db_factory.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_db_factory.c,v 1.10 2013/09/14 13:05:51 joerg Exp $ */
/*-
@@ -29,7 +28,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <sys/types.h>
#include <sys/queue.h>
diff --git a/lib/libc/iconv/citrus_db_factory.h b/lib/libc/iconv/citrus_db_factory.h
index c542046532c1..cf3c1b166cb7 100644
--- a/lib/libc/iconv/citrus_db_factory.h
+++ b/lib/libc/iconv/citrus_db_factory.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_db_factory.h,v 1.3 2008/02/09 14:56:20 junyoung Exp $ */
/*-
diff --git a/lib/libc/iconv/citrus_db_file.h b/lib/libc/iconv/citrus_db_file.h
index 7eea27694746..6fedc6064646 100644
--- a/lib/libc/iconv/citrus_db_file.h
+++ b/lib/libc/iconv/citrus_db_file.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_db_file.h,v 1.4 2008/02/10 05:58:22 junyoung Exp $ */
/*-
diff --git a/lib/libc/iconv/citrus_db_hash.c b/lib/libc/iconv/citrus_db_hash.c
index 1033c3fe8867..24b7213ee268 100644
--- a/lib/libc/iconv/citrus_db_hash.c
+++ b/lib/libc/iconv/citrus_db_hash.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_db_hash.c,v 1.5 2008/02/09 14:56:20 junyoung Exp $ */
/*-
@@ -29,7 +28,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <sys/types.h>
#include <assert.h>
diff --git a/lib/libc/iconv/citrus_db_hash.h b/lib/libc/iconv/citrus_db_hash.h
index ca2caa5282af..5f8703396502 100644
--- a/lib/libc/iconv/citrus_db_hash.h
+++ b/lib/libc/iconv/citrus_db_hash.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_db_hash.h,v 1.2 2008/02/09 14:56:20 junyoung Exp $ */
/*-
diff --git a/lib/libc/iconv/citrus_esdb.c b/lib/libc/iconv/citrus_esdb.c
index a07d5d09e72f..65b518f838c6 100644
--- a/lib/libc/iconv/citrus_esdb.c
+++ b/lib/libc/iconv/citrus_esdb.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_esdb.c,v 1.5 2008/02/09 14:56:20 junyoung Exp $ */
/*-
@@ -29,7 +28,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <sys/types.h>
#include <assert.h>
diff --git a/lib/libc/iconv/citrus_esdb.h b/lib/libc/iconv/citrus_esdb.h
index a2fb8041554d..3c4ef2f7e1e6 100644
--- a/lib/libc/iconv/citrus_esdb.h
+++ b/lib/libc/iconv/citrus_esdb.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_esdb.h,v 1.1 2003/06/25 09:51:32 tshiozak Exp $ */
/*-
diff --git a/lib/libc/iconv/citrus_esdb_file.h b/lib/libc/iconv/citrus_esdb_file.h
index 518d35587326..81548d49c061 100644
--- a/lib/libc/iconv/citrus_esdb_file.h
+++ b/lib/libc/iconv/citrus_esdb_file.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_esdb_file.h,v 1.1 2003/06/25 09:51:32 tshiozak Exp $ */
/*-
diff --git a/lib/libc/iconv/citrus_fix_grouping.h b/lib/libc/iconv/citrus_fix_grouping.h
index 31f9c23f42de..460989426b53 100644
--- a/lib/libc/iconv/citrus_fix_grouping.h
+++ b/lib/libc/iconv/citrus_fix_grouping.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_fix_grouping.h,v 1.2 2009/01/11 02:46:24 christos Exp $ */
/*-
diff --git a/lib/libc/iconv/citrus_hash.c b/lib/libc/iconv/citrus_hash.c
index aff6d55bcfbd..3a34efde3044 100644
--- a/lib/libc/iconv/citrus_hash.c
+++ b/lib/libc/iconv/citrus_hash.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_hash.c,v 1.3 2008/02/09 14:56:20 junyoung Exp $ */
/*-
@@ -29,7 +28,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <sys/types.h>
#include <assert.h>
diff --git a/lib/libc/iconv/citrus_hash.h b/lib/libc/iconv/citrus_hash.h
index 62f2ae23b872..d44571d00a40 100644
--- a/lib/libc/iconv/citrus_hash.h
+++ b/lib/libc/iconv/citrus_hash.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_hash.h,v 1.3 2004/01/02 21:49:35 itojun Exp $ */
/*-
diff --git a/lib/libc/iconv/citrus_iconv.c b/lib/libc/iconv/citrus_iconv.c
index fbabf6524399..e785e6721968 100644
--- a/lib/libc/iconv/citrus_iconv.c
+++ b/lib/libc/iconv/citrus_iconv.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_iconv.c,v 1.10 2011/11/19 18:34:21 tnozaki Exp $ */
/*-
@@ -29,7 +28,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <sys/types.h>
#include <sys/queue.h>
@@ -81,8 +79,9 @@ init_cache(void)
_CITRUS_HASH_INIT(&shared_pool, CI_HASH_SIZE);
TAILQ_INIT(&shared_unused);
shared_max_reuse = -1;
- if (!issetugid() && getenv(CI_ENV_MAX_REUSE))
- shared_max_reuse = atoi(getenv(CI_ENV_MAX_REUSE));
+ if (secure_getenv(CI_ENV_MAX_REUSE) != NULL)
+ shared_max_reuse =
+ atoi(secure_getenv(CI_ENV_MAX_REUSE));
if (shared_max_reuse < 0)
shared_max_reuse = CI_INITIAL_MAX_REUSE;
isinit = true;
@@ -126,7 +125,12 @@ open_shared(struct _citrus_iconv_shared * __restrict * __restrict rci,
* See gettext-0.18.3+ NEWS:
* msgfmt now checks PO file headers more strictly with less
* false-positives.
- * NetBSD don't do this either.
+ * NetBSD, also, doesn't do the below pass-through.
+ *
+ * Also note that this currently falls short if dst options have been
+ * specified. It may be the case that we want to ignore EILSEQ, in which
+ * case we should also select iconv_std anyways. This trick, while
+ * clever, may not be worth it.
*/
module = (strcmp(src, dst) != 0) ? "iconv_std" : "iconv_none";
#else
@@ -135,14 +139,11 @@ open_shared(struct _citrus_iconv_shared * __restrict * __restrict rci,
/* initialize iconv handle */
len_convname = strlen(convname);
- ci = malloc(sizeof(*ci) + len_convname + 1);
+ ci = calloc(1, sizeof(*ci) + len_convname + 1);
if (!ci) {
ret = errno;
goto err;
}
- ci->ci_module = NULL;
- ci->ci_ops = NULL;
- ci->ci_closure = NULL;
ci->ci_convname = (void *)&ci[1];
memcpy(ci->ci_convname, convname, len_convname + 1);
@@ -279,7 +280,7 @@ _citrus_iconv_open(struct _citrus_iconv * __restrict * __restrict rcv,
{
struct _citrus_iconv *cv = NULL;
struct _citrus_iconv_shared *ci = NULL;
- char realdst[PATH_MAX], realsrc[PATH_MAX];
+ char realdst[PATH_MAX], realsrc[PATH_MAX], *slashes;
#ifdef _PATH_ICONV
char buf[PATH_MAX], path[PATH_MAX];
#endif
@@ -293,16 +294,25 @@ _citrus_iconv_open(struct _citrus_iconv * __restrict * __restrict rcv,
if ((strcmp(dst, "") == 0) || (strcmp(dst, "char") == 0))
dst = nl_langinfo(CODESET);
+ strlcpy(realsrc, src, (size_t)PATH_MAX);
+ if ((slashes = strstr(realsrc, "//")) != NULL)
+ *slashes = '\0';
+ strlcpy(realdst, dst, (size_t)PATH_MAX);
+ if ((slashes = strstr(realdst, "//")) != NULL)
+ *slashes = '\0';
+
/* resolve codeset name aliases */
#ifdef _PATH_ICONV
+ /*
+ * Note that the below reads from realsrc and realdst while it's
+ * repopulating (writing to) realsrc and realdst, but it's done so with
+ * a trip through `buf`.
+ */
snprintf(path, sizeof(path), "%s/%s", _PATH_ICONV, _CITRUS_ICONV_ALIAS);
- strlcpy(realsrc, _lookup_alias(path, src, buf, (size_t)PATH_MAX,
+ strlcpy(realsrc, _lookup_alias(path, realsrc, buf, (size_t)PATH_MAX,
_LOOKUP_CASE_IGNORE), (size_t)PATH_MAX);
- strlcpy(realdst, _lookup_alias(path, dst, buf, (size_t)PATH_MAX,
+ strlcpy(realdst, _lookup_alias(path, realdst, buf, (size_t)PATH_MAX,
_LOOKUP_CASE_IGNORE), (size_t)PATH_MAX);
-#else
- strlcpy(realsrc, src, (size_t)PATH_MAX);
- strlcpy(realdst, dst, (size_t)PATH_MAX);
#endif
/* sanity check */
diff --git a/lib/libc/iconv/citrus_iconv.h b/lib/libc/iconv/citrus_iconv.h
index 8fe630af6c2d..49117cc15051 100644
--- a/lib/libc/iconv/citrus_iconv.h
+++ b/lib/libc/iconv/citrus_iconv.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_iconv.h,v 1.5 2008/02/09 14:56:20 junyoung Exp $ */
/*-
diff --git a/lib/libc/iconv/citrus_iconv_local.h b/lib/libc/iconv/citrus_iconv_local.h
index bd02d085d1ca..0374a05c324c 100644
--- a/lib/libc/iconv/citrus_iconv_local.h
+++ b/lib/libc/iconv/citrus_iconv_local.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_iconv_local.h,v 1.3 2008/02/09 14:56:20 junyoung Exp $ */
/*-
diff --git a/lib/libc/iconv/citrus_lock.h b/lib/libc/iconv/citrus_lock.h
index 3daaf1c31dd0..7c42e7bc7c26 100644
--- a/lib/libc/iconv/citrus_lock.h
+++ b/lib/libc/iconv/citrus_lock.h
@@ -1,6 +1,5 @@
-/* $FreeBSD$ */
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (C) 2010 Gabor Kovesdan <gabor@FreeBSD.org>
* All rights reserved.
diff --git a/lib/libc/iconv/citrus_lookup.c b/lib/libc/iconv/citrus_lookup.c
index 51a82951376c..ed224001bffb 100644
--- a/lib/libc/iconv/citrus_lookup.c
+++ b/lib/libc/iconv/citrus_lookup.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_lookup.c,v 1.7 2012/05/04 16:45:05 joerg Exp $ */
/*-
@@ -29,7 +28,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <sys/types.h>
#include <assert.h>
diff --git a/lib/libc/iconv/citrus_lookup.h b/lib/libc/iconv/citrus_lookup.h
index 88a0d4e7ef51..53ce42ea943b 100644
--- a/lib/libc/iconv/citrus_lookup.h
+++ b/lib/libc/iconv/citrus_lookup.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_lookup.h,v 1.2 2004/07/21 14:16:34 tshiozak Exp $ */
/*-
diff --git a/lib/libc/iconv/citrus_lookup_factory.c b/lib/libc/iconv/citrus_lookup_factory.c
index 85d20dfe8cfe..59b119e24872 100644
--- a/lib/libc/iconv/citrus_lookup_factory.c
+++ b/lib/libc/iconv/citrus_lookup_factory.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_lookup_factory.c,v 1.4 2003/10/27 00:12:42 lukem Exp $ */
/*-
@@ -29,7 +28,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <assert.h>
#include <ctype.h>
diff --git a/lib/libc/iconv/citrus_lookup_factory.h b/lib/libc/iconv/citrus_lookup_factory.h
index e716184a8d17..e630578b931e 100644
--- a/lib/libc/iconv/citrus_lookup_factory.h
+++ b/lib/libc/iconv/citrus_lookup_factory.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_lookup_factory.h,v 1.1 2003/06/25 09:51:35 tshiozak Exp $ */
/*-
diff --git a/lib/libc/iconv/citrus_lookup_file.h b/lib/libc/iconv/citrus_lookup_file.h
index a2ada5fc7d5c..c7510d134d00 100644
--- a/lib/libc/iconv/citrus_lookup_file.h
+++ b/lib/libc/iconv/citrus_lookup_file.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_lookup_file.h,v 1.1 2003/06/25 09:51:36 tshiozak Exp $ */
/*-
diff --git a/lib/libc/iconv/citrus_mapper.c b/lib/libc/iconv/citrus_mapper.c
index cbc0a58c35c9..45ea2d65de48 100644
--- a/lib/libc/iconv/citrus_mapper.c
+++ b/lib/libc/iconv/citrus_mapper.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_mapper.c,v 1.10 2012/06/08 07:49:42 martin Exp $ */
/*-
@@ -29,7 +28,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/queue.h>
diff --git a/lib/libc/iconv/citrus_mapper.h b/lib/libc/iconv/citrus_mapper.h
index 7e9056c761e9..ae093fc97ce3 100644
--- a/lib/libc/iconv/citrus_mapper.h
+++ b/lib/libc/iconv/citrus_mapper.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_mapper.h,v 1.3 2003/07/12 15:39:19 tshiozak Exp $ */
/*-
diff --git a/lib/libc/iconv/citrus_mapper_local.h b/lib/libc/iconv/citrus_mapper_local.h
index cfdb3be868e2..cb18e2eae8c1 100644
--- a/lib/libc/iconv/citrus_mapper_local.h
+++ b/lib/libc/iconv/citrus_mapper_local.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_mapper_local.h,v 1.2 2008/02/09 14:56:20 junyoung Exp $ */
/*-
diff --git a/lib/libc/iconv/citrus_memstream.c b/lib/libc/iconv/citrus_memstream.c
index 51092cb792b7..10918bf2c5e0 100644
--- a/lib/libc/iconv/citrus_memstream.c
+++ b/lib/libc/iconv/citrus_memstream.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_memstream.c,v 1.5 2012/03/13 21:13:31 christos Exp $ */
/*-
@@ -29,7 +28,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <assert.h>
#include <stdio.h>
diff --git a/lib/libc/iconv/citrus_memstream.h b/lib/libc/iconv/citrus_memstream.h
index 4c398a8c7a5b..998aeefe1dff 100644
--- a/lib/libc/iconv/citrus_memstream.h
+++ b/lib/libc/iconv/citrus_memstream.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_memstream.h,v 1.3 2005/05/14 17:55:42 tshiozak Exp $ */
/*-
diff --git a/lib/libc/iconv/citrus_mmap.c b/lib/libc/iconv/citrus_mmap.c
index e058f3d2cdc3..7686a389edec 100644
--- a/lib/libc/iconv/citrus_mmap.c
+++ b/lib/libc/iconv/citrus_mmap.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_mmap.c,v 1.4 2011/10/15 23:00:01 christos Exp $ */
/*-
@@ -30,7 +29,6 @@
*/
#include "namespace.h"
-#include <sys/cdefs.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/lib/libc/iconv/citrus_mmap.h b/lib/libc/iconv/citrus_mmap.h
index 83520646f378..b06ddd4909c6 100644
--- a/lib/libc/iconv/citrus_mmap.h
+++ b/lib/libc/iconv/citrus_mmap.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_mmap.h,v 1.1 2003/06/25 09:51:38 tshiozak Exp $ */
/*-
diff --git a/lib/libc/iconv/citrus_module.c b/lib/libc/iconv/citrus_module.c
index 64ef0271ea18..1d862ed6ccad 100644
--- a/lib/libc/iconv/citrus_module.c
+++ b/lib/libc/iconv/citrus_module.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_module.c,v 1.9 2009/01/11 02:46:24 christos Exp $ */
/*-
@@ -90,7 +89,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <sys/types.h>
#include <assert.h>
@@ -106,7 +104,7 @@
#include <string.h>
#include <unistd.h>
-#define I18NMODULE_MAJOR 4
+#define I18NMODULE_MAJOR 5
#include "citrus_namespace.h"
#include "citrus_bcs.h"
@@ -282,8 +280,8 @@ _citrus_load_module(_citrus_module_t *rhandle, const char *encname)
int maj, min;
if (_pathI18nModule == NULL) {
- p = getenv("PATH_I18NMODULE");
- if (p != NULL && !issetugid()) {
+ p = secure_getenv("PATH_I18NMODULE");
+ if (p != NULL) {
_pathI18nModule = strdup(p);
if (_pathI18nModule == NULL)
return (ENOMEM);
diff --git a/lib/libc/iconv/citrus_module.h b/lib/libc/iconv/citrus_module.h
index 0bcb53e2efa5..c733fb1fe3cb 100644
--- a/lib/libc/iconv/citrus_module.h
+++ b/lib/libc/iconv/citrus_module.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_module.h,v 1.1 2002/03/17 22:14:20 tshiozak Exp $ */
/*-
diff --git a/lib/libc/iconv/citrus_namespace.h b/lib/libc/iconv/citrus_namespace.h
index 4244c70d701e..454e9ca2bdc4 100644
--- a/lib/libc/iconv/citrus_namespace.h
+++ b/lib/libc/iconv/citrus_namespace.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_namespace.h,v 1.8 2009/01/11 02:46:24 christos Exp $ */
/*-
@@ -223,6 +222,7 @@
#define _stdenc_wctomb _citrus_stdenc_wctomb
#define _stdenc_put_state_reset _citrus_stdenc_put_state_reset
#define _stdenc_get_state_size _citrus_stdenc_get_state_size
+#define _stdenc_get_mb_cur_min _citrus_stdenc_get_mb_cur_min
#define _stdenc_get_mb_cur_max _citrus_stdenc_get_mb_cur_max
#define _stdenc_get_state_desc _citrus_stdenc_get_state_desc
#define _STDENC_SDID_GENERIC _CITRUS_STDENC_SDID_GENERIC
diff --git a/lib/libc/iconv/citrus_none.c b/lib/libc/iconv/citrus_none.c
index 033fe4011e00..194d78853955 100644
--- a/lib/libc/iconv/citrus_none.c
+++ b/lib/libc/iconv/citrus_none.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_none.c,v 1.18 2008/06/14 16:01:07 tnozaki Exp $ */
/*-
@@ -30,7 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <sys/types.h>
#include <assert.h>
diff --git a/lib/libc/iconv/citrus_none.h b/lib/libc/iconv/citrus_none.h
index a0ebd61f296e..241b4db1cd58 100644
--- a/lib/libc/iconv/citrus_none.h
+++ b/lib/libc/iconv/citrus_none.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_none.h,v 1.3 2003/06/25 09:51:38 tshiozak Exp $ */
/*-
diff --git a/lib/libc/iconv/citrus_pivot_factory.c b/lib/libc/iconv/citrus_pivot_factory.c
index c307a9d5aa32..ed5e6863beab 100644
--- a/lib/libc/iconv/citrus_pivot_factory.c
+++ b/lib/libc/iconv/citrus_pivot_factory.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_pivot_factory.c,v 1.7 2009/04/12 14:20:19 lukem Exp $ */
/*-
@@ -29,7 +28,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <sys/queue.h>
#include <assert.h>
diff --git a/lib/libc/iconv/citrus_pivot_factory.h b/lib/libc/iconv/citrus_pivot_factory.h
index adbfc8c77524..0b4d8513f732 100644
--- a/lib/libc/iconv/citrus_pivot_factory.h
+++ b/lib/libc/iconv/citrus_pivot_factory.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_pivot_factory.h,v 1.1 2003/06/25 09:51:39 tshiozak Exp $ */
/*-
diff --git a/lib/libc/iconv/citrus_pivot_file.h b/lib/libc/iconv/citrus_pivot_file.h
index b2b4f2408dba..24b9101b9071 100644
--- a/lib/libc/iconv/citrus_pivot_file.h
+++ b/lib/libc/iconv/citrus_pivot_file.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_pivot_file.h,v 1.1 2003/06/25 09:51:39 tshiozak Exp $ */
/*-
diff --git a/lib/libc/iconv/citrus_prop.c b/lib/libc/iconv/citrus_prop.c
index 7ac39bbee6e5..6dadce92e3eb 100644
--- a/lib/libc/iconv/citrus_prop.c
+++ b/lib/libc/iconv/citrus_prop.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_prop.c,v 1.4 2011/03/30 08:22:01 jruoho Exp $ */
/*-
@@ -30,7 +29,6 @@
*
*/
-#include <sys/cdefs.h>
#include <assert.h>
#include <errno.h>
@@ -79,7 +77,7 @@ static const char *xdigit = "0123456789ABCDEF";
#define _CITRUS_PROP_READ_UINT_COMMON(_func_, _type_, _max_) \
static int \
_citrus_prop_read_##_func_##_common(struct _memstream * __restrict ms, \
- _type_ * __restrict result, int base) \
+ _type_ * __restrict result, int base, int neg) \
{ \
_type_ acc, cutoff; \
int ch, cutlim, n; \
@@ -99,7 +97,7 @@ _citrus_prop_read_##_func_##_common(struct _memstream * __restrict ms, \
acc += n; \
} \
_memstream_ungetc(ms, ch); \
- *result = acc; \
+ *result = neg ? -acc : acc; \
return (0); \
}
_CITRUS_PROP_READ_UINT_COMMON(chr, int, UCHAR_MAX)
@@ -139,7 +137,7 @@ _citrus_prop_read_##_func_(struct _memstream * __restrict ms, \
return (EINVAL); \
_memstream_ungetc(ms, ch); \
return (_citrus_prop_read_##_func_##_common \
- (ms, &obj->u._func_, base)); \
+ (ms, &obj->u._func_, base, neg)); \
}
_CITRUS_PROP_READ_INT(chr, int)
_CITRUS_PROP_READ_INT(num, uint64_t)
@@ -185,7 +183,8 @@ _citrus_prop_read_character_common(struct _memstream * __restrict ms,
base -= 8;
/*FALLTHROUGH*/
case 'x':
- return (_citrus_prop_read_chr_common(ms, result, base));
+ return (_citrus_prop_read_chr_common(ms, result,
+ base, 0));
/*NOTREACHED*/
default:
/* unknown escape */
diff --git a/lib/libc/iconv/citrus_prop.h b/lib/libc/iconv/citrus_prop.h
index f09c833b8da6..065055f0d9bc 100644
--- a/lib/libc/iconv/citrus_prop.h
+++ b/lib/libc/iconv/citrus_prop.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_prop.h,v 1.5 2011/05/23 14:52:32 joerg Exp $ */
/*-
diff --git a/lib/libc/iconv/citrus_region.h b/lib/libc/iconv/citrus_region.h
index 0a78eec2b85c..f84d4163e240 100644
--- a/lib/libc/iconv/citrus_region.h
+++ b/lib/libc/iconv/citrus_region.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_region.h,v 1.7 2008/02/09 14:56:20 junyoung Exp $ */
/*-
diff --git a/lib/libc/iconv/citrus_stdenc.c b/lib/libc/iconv/citrus_stdenc.c
index 2bc79a11d333..c4778132750b 100644
--- a/lib/libc/iconv/citrus_stdenc.c
+++ b/lib/libc/iconv/citrus_stdenc.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_stdenc.c,v 1.4 2011/11/19 18:39:58 tnozaki Exp $ */
/*-
@@ -29,7 +28,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
#include <assert.h>
#include <errno.h>
diff --git a/lib/libc/iconv/citrus_stdenc.h b/lib/libc/iconv/citrus_stdenc.h
index a643b77a27aa..daab0d9afe2b 100644
--- a/lib/libc/iconv/citrus_stdenc.h
+++ b/lib/libc/iconv/citrus_stdenc.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_stdenc.h,v 1.4 2005/10/29 18:02:04 tshiozak Exp $ */
/*-
@@ -115,6 +114,20 @@ _citrus_stdenc_get_state_size(struct _citrus_stdenc *ce)
return (ce->ce_traits->et_state_size);
}
+static __inline size_t
+_citrus_stdenc_get_mb_cur_min(struct _citrus_stdenc *ce)
+{
+
+ return (ce->ce_traits->et_mb_cur_min);
+}
+
+static __inline size_t
+_citrus_stdenc_get_mb_cur_max(struct _citrus_stdenc *ce)
+{
+
+ return (ce->ce_traits->et_mb_cur_max);
+}
+
static __inline int
_citrus_stdenc_get_state_desc(struct _citrus_stdenc * __restrict ce,
void * __restrict ps, int id,
diff --git a/lib/libc/iconv/citrus_stdenc_local.h b/lib/libc/iconv/citrus_stdenc_local.h
index 2af3b8a992b7..8d26fc3cf2cd 100644
--- a/lib/libc/iconv/citrus_stdenc_local.h
+++ b/lib/libc/iconv/citrus_stdenc_local.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_stdenc_local.h,v 1.4 2008/02/09 14:56:20 junyoung Exp $ */
/*-
@@ -149,6 +148,8 @@ struct _citrus_stdenc_traits {
/* version 0x00000001 */
size_t et_state_size;
size_t et_mb_cur_max;
+ /* version 0x00000005 */
+ size_t et_mb_cur_min;
};
struct _citrus_stdenc {
diff --git a/lib/libc/iconv/citrus_stdenc_template.h b/lib/libc/iconv/citrus_stdenc_template.h
index 06fca844392f..ef95bf71ad07 100644
--- a/lib/libc/iconv/citrus_stdenc_template.h
+++ b/lib/libc/iconv/citrus_stdenc_template.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_stdenc_template.h,v 1.4 2008/02/09 14:56:20 junyoung Exp $ */
/*-
@@ -49,6 +48,11 @@
#define _CE_TO_EI(_ce_) (_TO_EI((_ce_)->ce_closure))
#define _TO_STATE(_ps_) ((_ENCODING_STATE*)(_ps_))
+#ifndef _ENCODING_MB_CUR_MIN
+/* Assume one byte minimum unless otherwise specified. */
+#define _ENCODING_MB_CUR_MIN(_ei_) 1
+#endif
+
/* ----------------------------------------------------------------------
* templates for public functions
*/
@@ -87,6 +91,7 @@ _FUNCNAME(stdenc_init)(struct _citrus_stdenc * __restrict ce,
ce->ce_closure = ei;
et->et_state_size = sizeof(_ENCODING_STATE);
et->et_mb_cur_max = _ENCODING_MB_CUR_MAX(_CE_TO_EI(ce));
+ et->et_mb_cur_min = _ENCODING_MB_CUR_MIN(_CE_TO_EI(ce));
return (0);
}
diff --git a/lib/libc/iconv/citrus_types.h b/lib/libc/iconv/citrus_types.h
index 2e4be11dd4cd..55ef4929ec6f 100644
--- a/lib/libc/iconv/citrus_types.h
+++ b/lib/libc/iconv/citrus_types.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/* $NetBSD: citrus_types.h,v 1.3 2003/10/27 00:12:42 lukem Exp $ */
/*-
diff --git a/lib/libc/iconv/iconv-internal.h b/lib/libc/iconv/iconv-internal.h
index 731b6856ca22..4c691441f705 100644
--- a/lib/libc/iconv/iconv-internal.h
+++ b/lib/libc/iconv/iconv-internal.h
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2013 Peter Wemm
* 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/lib/libc/iconv/iconv.3 b/lib/libc/iconv/iconv.3
index 1a4f8c3cfd75..577b537e5c21 100644
--- a/lib/libc/iconv/iconv.3
+++ b/lib/libc/iconv/iconv.3
@@ -1,4 +1,3 @@
-.\" $FreeBSD$
.\" $NetBSD: iconv.3,v 1.12 2004/08/02 13:38:21 tshiozak Exp $
.\"
.\" Copyright (c) 2003 Citrus Project,
diff --git a/lib/libc/iconv/iconv.c b/lib/libc/iconv/iconv.c
index 57c614029df0..5034b39a6566 100644
--- a/lib/libc/iconv/iconv.c
+++ b/lib/libc/iconv/iconv.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2013 Peter Wemm
* 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$
*/
#include <sys/types.h>
diff --git a/lib/libc/iconv/iconv_canonicalize.3 b/lib/libc/iconv/iconv_canonicalize.3
index d98235aabbfd..c1d0c6522500 100644
--- a/lib/libc/iconv/iconv_canonicalize.3
+++ b/lib/libc/iconv/iconv_canonicalize.3
@@ -32,8 +32,6 @@
.\" the referee document. The original Standard can be obtained online at
.\" http://www.opengroup.org/unix/online.html.
.\"
-.\" $FreeBSD$
-.\"
.Dd October 20, 2009
.Dt ICONV_CANONICALIZE 3
.Os
diff --git a/lib/libc/iconv/iconv_canonicalize.c b/lib/libc/iconv/iconv_canonicalize.c
index 7c3e6f0fdbae..c906f5f3388a 100644
--- a/lib/libc/iconv/iconv_canonicalize.c
+++ b/lib/libc/iconv/iconv_canonicalize.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2013 Peter Wemm
* 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$
*/
#include <sys/types.h>
diff --git a/lib/libc/iconv/iconv_close.c b/lib/libc/iconv/iconv_close.c
index f7d0231afcd8..d61dfd3622ce 100644
--- a/lib/libc/iconv/iconv_close.c
+++ b/lib/libc/iconv/iconv_close.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2013 Peter Wemm
* 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$
*/
#include <sys/types.h>
diff --git a/lib/libc/iconv/iconv_compat.c b/lib/libc/iconv/iconv_compat.c
index 2a6a120aa2cd..ade815c1a4c1 100644
--- a/lib/libc/iconv/iconv_compat.c
+++ b/lib/libc/iconv/iconv_compat.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2013 Peter Wemm
* 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/lib/libc/iconv/iconv_open.c b/lib/libc/iconv/iconv_open.c
index a386f13007b1..a8ddb0919292 100644
--- a/lib/libc/iconv/iconv_open.c
+++ b/lib/libc/iconv/iconv_open.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2013 Peter Wemm
* 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$
*/
#include <sys/types.h>
diff --git a/lib/libc/iconv/iconv_open_into.c b/lib/libc/iconv/iconv_open_into.c
index 9db00c3e7710..dc4f5002a730 100644
--- a/lib/libc/iconv/iconv_open_into.c
+++ b/lib/libc/iconv/iconv_open_into.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2013 Peter Wemm
* 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$
*/
#include <sys/types.h>
diff --git a/lib/libc/iconv/iconv_set_relocation_prefix.c b/lib/libc/iconv/iconv_set_relocation_prefix.c
index 969381c12984..8832892bba09 100644
--- a/lib/libc/iconv/iconv_set_relocation_prefix.c
+++ b/lib/libc/iconv/iconv_set_relocation_prefix.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2013 Peter Wemm
* 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$
*/
#include <sys/types.h>
diff --git a/lib/libc/iconv/iconvctl.3 b/lib/libc/iconv/iconvctl.3
index d6bc67f9b98d..b9a75e0a7eb9 100644
--- a/lib/libc/iconv/iconvctl.3
+++ b/lib/libc/iconv/iconvctl.3
@@ -32,8 +32,6 @@
.\" the referee document. The original Standard can be obtained online at
.\" http://www.opengroup.org/unix/online.html.
.\"
-.\" $FreeBSD$
-.\"
.Dd November 25, 2009
.Dt ICONVCTL 3
.Os
diff --git a/lib/libc/iconv/iconvctl.c b/lib/libc/iconv/iconvctl.c
index d6357f637752..412a5e20b860 100644
--- a/lib/libc/iconv/iconvctl.c
+++ b/lib/libc/iconv/iconvctl.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2013 Peter Wemm
* 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$
*/
#include <sys/types.h>
diff --git a/lib/libc/iconv/iconvlist.3 b/lib/libc/iconv/iconvlist.3
index b1a6e0564341..90d431da748e 100644
--- a/lib/libc/iconv/iconvlist.3
+++ b/lib/libc/iconv/iconvlist.3
@@ -32,9 +32,7 @@
.\" the referee document. The original Standard can be obtained online at
.\" http://www.opengroup.org/unix/online.html.
.\"
-.\" $FreeBSD$
-.\"
-.Dd October 20, 2009
+.Dd February 23, 2023
.Dt ICONVLIST 3
.Os
.Sh NAME
@@ -47,7 +45,7 @@
.In iconv.h
.Ft void
.Fo iconvlist
-.Fa "int \*[lp]*do_one\*[rp]\*[lp]unsigned int *count, const char * const *names, void *arg\*[rp]"
+.Fa "int \*[lp]*do_one\*[rp]\*[lp]unsigned int count, const char * const *names, void *arg\*[rp]"
.Fa "void *arg"
.Fc
.Sh DESCRIPTION
diff --git a/lib/libc/iconv/iconvlist.c b/lib/libc/iconv/iconvlist.c
index dbd0a1eddf99..48bcacbd389d 100644
--- a/lib/libc/iconv/iconvlist.c
+++ b/lib/libc/iconv/iconvlist.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2013 Peter Wemm
* 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$
*/
#include <sys/types.h>
diff --git a/lib/libc/include/block_abi.h b/lib/libc/include/block_abi.h
index b0d6e5723937..e04998d6148d 100644
--- a/lib/libc/include/block_abi.h
+++ b/lib/libc/include/block_abi.h
@@ -22,8 +22,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 __BLOCKS__
diff --git a/lib/libc/include/compat.h b/lib/libc/include/compat.h
index ccb92c0fd930..70fb8dcd97f3 100644
--- a/lib/libc/include/compat.h
+++ b/lib/libc/include/compat.h
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2009 Hudson River Trading LLC
* Written by: John H. Baldwin <jhb@FreeBSD.org>
@@ -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$
*/
/*
@@ -69,13 +67,13 @@ __sym_compat(mknodat, freebsd11_mknodat, FBSD_1.1);
__sym_compat(kevent, freebsd11_kevent, FBSD_1.0);
+__sym_compat(swapoff, freebsd13_swapoff, FBSD_1.0);
+
#undef __sym_compat
#define __weak_reference(sym,alias) \
.weak alias;.equ alias,sym
-__weak_reference(__sys_fcntl, __fcntl_compat)
-
#undef __weak_reference
#endif /* __LIBC_COMPAT_H__ */
diff --git a/lib/libc/include/errlst.h b/lib/libc/include/errlst.h
index 99492f840da5..b71d547bda81 100644
--- a/lib/libc/include/errlst.h
+++ b/lib/libc/include/errlst.h
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2013 Jilles Tjoelker
* 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 __ERRLST_H__
#define __ERRLST_H__
-#include <sys/cdefs.h>
#ifdef PIC
/* If the main executable imports these, do not use its copy from libc.so. */
diff --git a/lib/libc/include/fpmath.h b/lib/libc/include/fpmath.h
index ce935eb403e2..c7f4f8846817 100644
--- a/lib/libc/include/fpmath.h
+++ b/lib/libc/include/fpmath.h
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2003 Mike Barcroft <mike@FreeBSD.org>
* Copyright (c) 2002 David Schultz <das@FreeBSD.ORG>
@@ -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 _FPMATH_H_
diff --git a/lib/libc/include/isc/list.h b/lib/libc/include/isc/list.h
index cdc98a8474be..66c67a72a22b 100644
--- a/lib/libc/include/isc/list.h
+++ b/lib/libc/include/isc/list.h
@@ -17,7 +17,6 @@
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $FreeBSD$ */
#ifndef LIST_H
#define LIST_H 1
diff --git a/lib/libc/include/isc/platform.h b/lib/libc/include/isc/platform.h
index b514cb4243a3..06997eea3c8e 100644
--- a/lib/libc/include/isc/platform.h
+++ b/lib/libc/include/isc/platform.h
@@ -17,7 +17,6 @@
*/
/* $Id: platform.h.in,v 1.2.6.2 2008/01/23 02:15:02 tbox Exp $ */
-/* $FreeBSD$ */
/*! \file */
diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h
index 5a524c0211d1..2b16ce736e3a 100644
--- a/lib/libc/include/libc_private.h
+++ b/lib/libc/include/libc_private.h
@@ -28,8 +28,6 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD$
- *
* Private definitions for libc, libc_r and libpthread.
*
*/
@@ -39,6 +37,16 @@
#include <sys/_types.h>
#include <sys/_pthreadtypes.h>
+#include <libsys.h>
+
+extern char **environ;
+
+/*
+ * The kernel doesn't expose PID_MAX to the user space. Save it here
+ * to allow to run a newer world on a pre-1400079 kernel.
+ */
+#define _PID_MAX 99999
+
/*
* This global flag is non-zero when a process has created one
* or more threads. It is used to avoid calling locking functions
@@ -178,6 +186,7 @@ typedef enum {
PJT_MUTEXATTR_SETROBUST,
PJT_GETTHREADID_NP,
PJT_ATTR_GET_NP,
+ PJT_GETNAME_NP,
PJT_MAX
} pjt_index_t;
@@ -193,6 +202,7 @@ int _pthread_mutex_init_calloc_cb_stub(pthread_mutex_t *mutex,
typedef int (*interpos_func_t)(void);
interpos_func_t *__libc_interposing_slot(int interposno);
extern interpos_func_t __libc_interposing[] __hidden;
+interpos_func_t *__libsys_interposing_slot(int interposno);
enum {
INTERPOS_accept,
@@ -242,6 +252,12 @@ enum {
INTERPOS_MAX
};
+#define _INTERPOS_SYS(type, idx, ...) \
+ ((type *)*(__libc_interposing_slot(idx)))(__VA_ARGS__)
+#define INTERPOS_SYS(syscall, ...) \
+ _INTERPOS_SYS(__sys_## syscall ##_t, INTERPOS_## syscall \
+ __VA_OPT__(,) __VA_ARGS__)
+
/*
* yplib internal interfaces
*/
@@ -249,6 +265,12 @@ enum {
int _yp_check(char **);
#endif
+void __libc_start1(int, char *[], char *[],
+ void (*)(void), int (*)(int, char *[], char *[])) __dead2;
+void __libc_start1_gcrt(int, char *[], char *[],
+ void (*)(void), int (*)(int, char *[], char *[]),
+ int *, int *) __dead2;
+
/*
* Initialise TLS for static programs
*/
@@ -261,12 +283,6 @@ void _init_tls(void);
int _once(pthread_once_t *, void (*)(void));
/*
- * Get/set the TLS thread pointer
- */
-void *_get_tp(void);
-void _set_tp(void *tp);
-
-/*
* This is a pointer in the C run-time startup code. It is used
* by getprogname() and setprogname().
*/
@@ -326,96 +342,15 @@ struct __siginfo;
struct __ucontext;
struct __wrusage;
enum idtype;
-int __sys_aio_suspend(const struct aiocb * const[], int,
- const struct timespec *);
-int __sys_accept(int, struct sockaddr *, __socklen_t *);
-int __sys_accept4(int, struct sockaddr *, __socklen_t *, int);
-int __sys_clock_gettime(__clockid_t, struct timespec *ts);
-int __sys_clock_nanosleep(__clockid_t, int,
- const struct timespec *, struct timespec *);
-int __sys_close(int);
-int __sys_close_range(unsigned, unsigned, int);
-int __sys_connect(int, const struct sockaddr *, __socklen_t);
-int __sys_fcntl(int, int, ...);
-int __sys_fdatasync(int);
-int __sys_fstat(int fd, struct stat *);
-int __sys_fstatfs(int fd, struct statfs *);
-int __sys_fstatat(int, const char *, struct stat *, int);
-int __sys_fsync(int);
-__pid_t __sys_fork(void);
-int __sys_ftruncate(int, __off_t);
-__ssize_t __sys_getdirentries(int, char *, __size_t, __off_t *);
-int __sys_getfsstat(struct statfs *, long, int);
-int __sys_gettimeofday(struct timeval *, struct timezone *);
-int __sys_kevent(int, const struct kevent *, int, struct kevent *,
- int, const struct timespec *);
-__off_t __sys_lseek(int, __off_t, int);
-void *__sys_mmap(void *, __size_t, int, int, int, __off_t);
-int __sys_msync(void *, __size_t, int);
-int __sys_nanosleep(const struct timespec *, struct timespec *);
-int __sys_open(const char *, int, ...);
-int __sys_openat(int, const char *, int, ...);
-int __sys_pdfork(int *, int);
-int __sys_pselect(int, struct fd_set *, struct fd_set *,
- struct fd_set *, const struct timespec *,
- const __sigset_t *);
-int __sys_ptrace(int, __pid_t, char *, int);
-int __sys_poll(struct pollfd *, unsigned, int);
-int __sys_ppoll(struct pollfd *, unsigned, const struct timespec *,
- const __sigset_t *);
-__ssize_t __sys_pread(int, void *, __size_t, __off_t);
-__ssize_t __sys_pwrite(int, const void *, __size_t, __off_t);
-__ssize_t __sys_read(int, void *, __size_t);
-__ssize_t __sys_readv(int, const struct iovec *, int);
-__ssize_t __sys_recv(int, void *, __size_t, int);
-__ssize_t __sys_recvfrom(int, void *, __size_t, int, struct sockaddr *,
- __socklen_t *);
-__ssize_t __sys_recvmsg(int, struct msghdr *, int);
-int __sys_select(int, struct fd_set *, struct fd_set *,
- struct fd_set *, struct timeval *);
-__ssize_t __sys_sendmsg(int, const struct msghdr *, int);
-__ssize_t __sys_sendto(int, const void *, __size_t, int,
- const struct sockaddr *, __socklen_t);
-int __sys_setcontext(const struct __ucontext *);
-int __sys_sigaction(int, const struct sigaction *,
- struct sigaction *);
-int __sys_sigprocmask(int, const __sigset_t *, __sigset_t *);
-int __sys_sigsuspend(const __sigset_t *);
-int __sys_sigtimedwait(const __sigset_t *, struct __siginfo *,
- const struct timespec *);
-int __sys_sigwait(const __sigset_t *, int *);
-int __sys_sigwaitinfo(const __sigset_t *, struct __siginfo *);
-int __sys___specialfd(int, const void *, __size_t);
-int __sys_statfs(const char *, struct statfs *);
-int __sys_swapcontext(struct __ucontext *,
- const struct __ucontext *);
-int __sys_thr_kill(long, int);
-int __sys_thr_self(long *);
-int __sys_truncate(const char *, __off_t);
-__pid_t __sys_wait4(__pid_t, int *, int, struct rusage *);
-__pid_t __sys_wait6(enum idtype, __id_t, int *, int,
- struct __wrusage *, struct __siginfo *);
-__ssize_t __sys_write(int, const void *, __size_t);
-__ssize_t __sys_writev(int, const struct iovec *, int);
-int __sys_shm_open2(const char *, int, __mode_t, int, const char *);
int __libc_sigaction(int, const struct sigaction *,
struct sigaction *) __hidden;
int __libc_sigprocmask(int, const __sigset_t *, __sigset_t *)
__hidden;
int __libc_sigsuspend(const __sigset_t *) __hidden;
-int __libc_sigwait(const __sigset_t * __restrict,
- int * restrict sig);
+int __libsys_sigwait(const __sigset_t *, int *) __hidden;
int __libc_system(const char *);
int __libc_tcdrain(int);
-int __fcntl_compat(int fd, int cmd, ...);
-
-int __sys_futimens(int fd, const struct timespec *times) __hidden;
-int __sys_utimensat(int fd, const char *path,
- const struct timespec *times, int flag) __hidden;
-
-/* execve() with PATH processing to implement posix_spawnp() */
-int _execvpe(const char *, char * const *, char * const *);
int _elf_aux_info(int aux, void *buf, int buflen);
struct dl_phdr_info;
@@ -439,5 +374,7 @@ struct __nl_cat_d;
struct _xlocale;
struct __nl_cat_d *__catopen_l(const char *name, int type,
struct _xlocale *locale);
+int __strerror_rl(int errnum, char *strerrbuf, size_t buflen,
+ struct _xlocale *locale);
#endif /* _LIBC_PRIVATE_H_ */
diff --git a/lib/libc/include/namespace.h b/lib/libc/include/namespace.h
index d0c26ee581e3..040caebe235d 100644
--- a/lib/libc/include/namespace.h
+++ b/lib/libc/include/namespace.h
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2001 Daniel Eischen <deischen@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 _NAMESPACE_H_
diff --git a/lib/libc/include/nscache.h b/lib/libc/include/nscache.h
index 8e79fa8eab6d..aab29e411ddc 100644
--- a/lib/libc/include/nscache.h
+++ b/lib/libc/include/nscache.h
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2005 Michael Bushkov <bushman@rsu.ru>
* 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 __NS_CACHE_H__
diff --git a/lib/libc/include/nscachedcli.h b/lib/libc/include/nscachedcli.h
index 4feed2b14208..082517f69bab 100644
--- a/lib/libc/include/nscachedcli.h
+++ b/lib/libc/include/nscachedcli.h
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2004 Michael Bushkov <bushman@rsu.ru>
* 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 __NS_CACHED_CLI_H__
diff --git a/lib/libc/include/nss_tls.h b/lib/libc/include/nss_tls.h
index 16b27c04ac1c..bfc34cd7fd58 100644
--- a/lib/libc/include/nss_tls.h
+++ b/lib/libc/include/nss_tls.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$
- *
* Macros which generate thread local storage handling code in NSS modules.
*/
#ifndef _NSS_TLS_H_
diff --git a/lib/libc/include/port_after.h b/lib/libc/include/port_after.h
index 94f3a6431e98..1bbece4f350b 100644
--- a/lib/libc/include/port_after.h
+++ b/lib/libc/include/port_after.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
#ifndef _PORT_AFTER_H_
#define _PORT_AFTER_H_
diff --git a/lib/libc/include/port_before.h b/lib/libc/include/port_before.h
index 430d23363c87..cfc43c53f157 100644
--- a/lib/libc/include/port_before.h
+++ b/lib/libc/include/port_before.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
#ifndef _PORT_BEFORE_H_
#define _PORT_BEFORE_H_
diff --git a/lib/libc/include/reentrant.h b/lib/libc/include/reentrant.h
index 690f4ef1b9aa..cc22f76075d1 100644
--- a/lib/libc/include/reentrant.h
+++ b/lib/libc/include/reentrant.h
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1997,98 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -27,8 +27,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.
- *
- * $FreeBSD$
*/
/*
diff --git a/lib/libc/include/spinlock.h b/lib/libc/include/spinlock.h
index c81ef76d21c1..5dcb961a035f 100644
--- a/lib/libc/include/spinlock.h
+++ b/lib/libc/include/spinlock.h
@@ -28,15 +28,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD$
- *
* Lock definitions used in both libc and libpthread.
*
*/
#ifndef _SPINLOCK_H_
#define _SPINLOCK_H_
-#include <sys/cdefs.h>
#include <sys/types.h>
/*
diff --git a/lib/libc/include/un-namespace.h b/lib/libc/include/un-namespace.h
index 8d05ab90c7dc..a5c6bfeb8a80 100644
--- a/lib/libc/include/un-namespace.h
+++ b/lib/libc/include/un-namespace.h
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2001 Daniel Eischen <deischen@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 _UN_NAMESPACE_H_
diff --git a/lib/libc/inet/Makefile.inc b/lib/libc/inet/Makefile.inc
index c957b11533a2..9cc1b6547261 100644
--- a/lib/libc/inet/Makefile.inc
+++ b/lib/libc/inet/Makefile.inc
@@ -1,4 +1,3 @@
-# $FreeBSD$
# inet sources
.PATH: ${LIBC_SRCTOP}/inet
diff --git a/lib/libc/inet/Symbol.map b/lib/libc/inet/Symbol.map
index f188b137de94..11e22a1f6945 100644
--- a/lib/libc/inet/Symbol.map
+++ b/lib/libc/inet/Symbol.map
@@ -1,7 +1,3 @@
-/*
- * $FreeBSD$
- */
-
FBSD_1.0 {
__inet_addr;
__inet_aton;
diff --git a/lib/libc/inet/inet_addr.c b/lib/libc/inet/inet_addr.c
index ac45b104e2bc..7a07b4ff85b5 100644
--- a/lib/libc/inet/inet_addr.c
+++ b/lib/libc/inet/inet_addr.c
@@ -66,13 +66,6 @@
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char sccsid[] = "@(#)inet_addr.c 8.1 (Berkeley) 6/17/93";
-static const char rcsid[] = "$Id: inet_addr.c,v 1.5 2005/04/27 04:56:19 sra Exp $";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "port_before.h"
#include <sys/param.h>
diff --git a/lib/libc/inet/inet_cidr_ntop.c b/lib/libc/inet/inet_cidr_ntop.c
index 8be860a72700..e75d7ba7a49a 100644
--- a/lib/libc/inet/inet_cidr_ntop.c
+++ b/lib/libc/inet/inet_cidr_ntop.c
@@ -17,12 +17,6 @@
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: inet_cidr_ntop.c,v 1.7 2006/10/11 02:18:18 marka Exp $";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "port_before.h"
#include <sys/types.h>
diff --git a/lib/libc/inet/inet_cidr_pton.c b/lib/libc/inet/inet_cidr_pton.c
index 413db6c979e2..e24efcedc935 100644
--- a/lib/libc/inet/inet_cidr_pton.c
+++ b/lib/libc/inet/inet_cidr_pton.c
@@ -17,12 +17,6 @@
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: inet_cidr_pton.c,v 1.6 2005/04/27 04:56:19 sra Exp $";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "port_before.h"
#include <sys/types.h>
diff --git a/lib/libc/inet/inet_lnaof.c b/lib/libc/inet/inet_lnaof.c
index c09692efeb8b..fb384872154b 100644
--- a/lib/libc/inet/inet_lnaof.c
+++ b/lib/libc/inet/inet_lnaof.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char sccsid[] = "@(#)inet_lnaof.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "port_before.h"
#include <sys/param.h>
diff --git a/lib/libc/inet/inet_makeaddr.c b/lib/libc/inet/inet_makeaddr.c
index acdc4edbbc2f..1ac3b30886c9 100644
--- a/lib/libc/inet/inet_makeaddr.c
+++ b/lib/libc/inet/inet_makeaddr.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char sccsid[] = "@(#)inet_makeaddr.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "port_before.h"
#include <sys/param.h>
diff --git a/lib/libc/inet/inet_net_ntop.c b/lib/libc/inet/inet_net_ntop.c
index 53b284577cdb..9d98dbb5ca99 100644
--- a/lib/libc/inet/inet_net_ntop.c
+++ b/lib/libc/inet/inet_net_ntop.c
@@ -17,12 +17,6 @@
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: inet_net_ntop.c,v 1.5 2006/06/20 02:50:14 marka Exp $";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "port_before.h"
#include <sys/types.h>
diff --git a/lib/libc/inet/inet_net_pton.c b/lib/libc/inet/inet_net_pton.c
index 6d21087cdce9..d566a0e1d3c3 100644
--- a/lib/libc/inet/inet_net_pton.c
+++ b/lib/libc/inet/inet_net_pton.c
@@ -17,12 +17,6 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: inet_net_pton.c,v 1.10 2008/11/14 02:36:51 marka Exp $";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "port_before.h"
#include <sys/types.h>
@@ -144,7 +138,7 @@ inet_net_pton_ipv4(const char *src, u_char *dst, size_t size) {
goto enoent;
}
- /* Firey death and destruction unless we prefetched EOS. */
+ /* Fiery death and destruction unless we prefetched EOS. */
if (ch != '\0')
goto enoent;
diff --git a/lib/libc/inet/inet_neta.c b/lib/libc/inet/inet_neta.c
index ab2a97ad2a7d..2cf40ef3505d 100644
--- a/lib/libc/inet/inet_neta.c
+++ b/lib/libc/inet/inet_neta.c
@@ -17,12 +17,6 @@
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: inet_neta.c,v 1.3 2005/04/27 04:56:20 sra Exp $";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "port_before.h"
#include <sys/types.h>
diff --git a/lib/libc/inet/inet_netof.c b/lib/libc/inet/inet_netof.c
index 5e3bd95d46ad..74648ae87d9d 100644
--- a/lib/libc/inet/inet_netof.c
+++ b/lib/libc/inet/inet_netof.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char sccsid[] = "@(#)inet_netof.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "port_before.h"
#include <sys/param.h>
diff --git a/lib/libc/inet/inet_network.c b/lib/libc/inet/inet_network.c
index b776f7e8e406..29bd708b8c92 100644
--- a/lib/libc/inet/inet_network.c
+++ b/lib/libc/inet/inet_network.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char sccsid[] = "@(#)inet_network.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "port_before.h"
#include <sys/types.h>
diff --git a/lib/libc/inet/inet_ntoa.c b/lib/libc/inet/inet_ntoa.c
index e7a585267b33..52380d8623d1 100644
--- a/lib/libc/inet/inet_ntoa.c
+++ b/lib/libc/inet/inet_ntoa.c
@@ -29,13 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char sccsid[] = "@(#)inet_ntoa.c 8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$Id: inet_ntoa.c,v 1.2 2005/04/27 04:56:21 sra Exp $";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "port_before.h"
#include <sys/types.h>
diff --git a/lib/libc/inet/inet_ntop.c b/lib/libc/inet/inet_ntop.c
index 650ffaf178d6..3227a855fd85 100644
--- a/lib/libc/inet/inet_ntop.c
+++ b/lib/libc/inet/inet_ntop.c
@@ -17,12 +17,6 @@
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: inet_ntop.c,v 1.5 2005/11/03 22:59:52 marka Exp $";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "port_before.h"
#include <sys/param.h>
diff --git a/lib/libc/inet/inet_pton.c b/lib/libc/inet/inet_pton.c
index 19b119764e97..6524125ac5be 100644
--- a/lib/libc/inet/inet_pton.c
+++ b/lib/libc/inet/inet_pton.c
@@ -17,12 +17,6 @@
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: inet_pton.c,v 1.5 2005/07/28 06:51:47 marka Exp $";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "port_before.h"
#include <sys/param.h>
#include <sys/socket.h>
diff --git a/lib/libc/inet/nsap_addr.c b/lib/libc/inet/nsap_addr.c
index 0bf190d7c12a..de0ee80b209c 100644
--- a/lib/libc/inet/nsap_addr.c
+++ b/lib/libc/inet/nsap_addr.c
@@ -17,12 +17,6 @@
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: nsap_addr.c,v 1.5 2005/07/28 06:51:48 marka Exp $";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "port_before.h"
#include <sys/param.h>
diff --git a/lib/libc/isc/Makefile.inc b/lib/libc/isc/Makefile.inc
index aa63ecd8f583..11b3da0a1b45 100644
--- a/lib/libc/isc/Makefile.inc
+++ b/lib/libc/isc/Makefile.inc
@@ -1,4 +1,3 @@
-# $FreeBSD$
# isc sources
.PATH: ${LIBC_SRCTOP}/isc
diff --git a/lib/libc/isc/ev_streams.c b/lib/libc/isc/ev_streams.c
index 59f01eda6a3f..aebf757a9755 100644
--- a/lib/libc/isc/ev_streams.c
+++ b/lib/libc/isc/ev_streams.c
@@ -21,12 +21,6 @@
* vix 04mar96 [initial]
*/
-#if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: ev_streams.c,v 1.5 2005/04/27 04:56:36 sra Exp $";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "port_before.h"
#ifndef _LIBC
#include "fd_setsize.h"
diff --git a/lib/libc/isc/ev_timers.c b/lib/libc/isc/ev_timers.c
index 94a7b003f529..07cd2e1d624c 100644
--- a/lib/libc/isc/ev_timers.c
+++ b/lib/libc/isc/ev_timers.c
@@ -21,12 +21,6 @@
* vix 09sep95 [initial]
*/
-#if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: ev_timers.c,v 1.6 2005/04/27 04:56:36 sra Exp $";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/* Import. */
#include "port_before.h"
diff --git a/lib/libc/isc/eventlib_p.h b/lib/libc/isc/eventlib_p.h
index a56334f0a87d..72b17a7a855b 100644
--- a/lib/libc/isc/eventlib_p.h
+++ b/lib/libc/isc/eventlib_p.h
@@ -22,7 +22,6 @@
* \author vix 09sep95 [initial]
*
* $Id: eventlib_p.h,v 1.9 2006/03/09 23:57:56 marka Exp $
- * $FreeBSD$
*/
#ifndef _EVENTLIB_P_H
diff --git a/lib/libc/libc.ldscript b/lib/libc/libc.ldscript
index 02e4d962a318..0e89e1868f9a 100644
--- a/lib/libc/libc.ldscript
+++ b/lib/libc/libc.ldscript
@@ -1,2 +1 @@
-/* $FreeBSD$ */
GROUP ( @@SHLIB@@ @@LIBDIR@@/libc_nonshared.a @@LIBDIR@@/libssp_nonshared.a )
diff --git a/lib/libc/libc_nossp.ldscript b/lib/libc/libc_nossp.ldscript
index c610cc21e018..be6325610595 100644
--- a/lib/libc/libc_nossp.ldscript
+++ b/lib/libc/libc_nossp.ldscript
@@ -1,2 +1 @@
-/* $FreeBSD$ */
GROUP ( @@SHLIB@@ @@LIBDIR@@/libc_nonshared.a )
diff --git a/lib/libc/locale/DESIGN.xlocale b/lib/libc/locale/DESIGN.xlocale
index 5d998d32314d..03e065d82d73 100644
--- a/lib/libc/locale/DESIGN.xlocale
+++ b/lib/libc/locale/DESIGN.xlocale
@@ -1,4 +1,3 @@
-$FreeBSD$
Design of xlocale
=================
diff --git a/lib/libc/locale/Makefile.inc b/lib/libc/locale/Makefile.inc
index a8daa1ff284e..ad00b38a1baf 100644
--- a/lib/libc/locale/Makefile.inc
+++ b/lib/libc/locale/Makefile.inc
@@ -1,5 +1,3 @@
-# from @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
-# $FreeBSD$
# locale sources
.PATH: ${LIBC_SRCTOP}/${LIBC_ARCH}/locale ${LIBC_SRCTOP}/locale
@@ -52,11 +50,24 @@ MAN+= btowc.3 \
MAN+= big5.5 euc.5 gb18030.5 gb2312.5 gbk.5 mskanji.5 utf8.5
MLINKS+=btowc.3 wctob.3
-MLINKS+=isdigit.3 isnumber.3
+MLINKS+=digittoint.3 digittoint_l.3
+MLINKS+=isalnum.3 isalnum_l.3
+MLINKS+=isalpha.3 isalpha_l.3
+MLINKS+=isblank.3 isblank_l.3
+MLINKS+=iscntrl.3 iscntrl_l.3
+MLINKS+=isdigit.3 isnumber.3 isdigit.3 isdigit_l.3 isdigit.3 isnumber_l.3
MLINKS+=isgraph.3 isgraph_l.3
+MLINKS+=isideogram.3 isideogram_l.3
MLINKS+=islower.3 islower_l.3
+MLINKS+=isphonogram.3 isphonogram_l.3
+MLINKS+=isprint.3 isprint_l.3
MLINKS+=ispunct.3 ispunct_l.3
+MLINKS+=isrune.3 isrune_l.3
MLINKS+=isspace.3 isspace_l.3
+MLINKS+=isspecial.3 isspecial_l.3
+MLINKS+=isupper.3 isupper_l.3
+MLINKS+=tolower.3 tolower_l.3
+MLINKS+=toupper.3 toupper_l.3
MLINKS+=nl_langinfo.3 nl_langinfo_l.3
MLINKS+=iswalnum.3 iswalpha.3 iswalnum.3 iswascii.3 iswalnum.3 iswblank.3 \
iswalnum.3 iswcntrl.3 iswalnum.3 iswdigit.3 iswalnum.3 iswgraph.3 \
@@ -77,7 +88,8 @@ MLINKS+=iswalnum_l.3 iswalpha_l.3 iswalnum_l.3 iswcntrl_l.3 \
iswalnum_l.3 iswphonogram_l.3 iswalnum_l.3 iswrune_l.3 \
iswalnum_l.3 iswspecial_l.3 iswalnum_l.3 nextwctype_l.3 \
iswalnum_l.3 towctrans_l.3 iswalnum_l.3 wctrans_l.3
-MLINKS+=isxdigit.3 ishexnumber.3
+MLINKS+=isxdigit.3 ishexnumber.3 isxdigit.3 isxdigit_l.3 \
+ isxdigit.3 ishexnumber_l.3
MLINKS+=localeconv.3 localeconv_l.3
MLINKS+=mbrtowc.3 mbrtoc16.3 mbrtowc.3 mbrtoc32.3
MLINKS+=mbsrtowcs.3 mbsnrtowcs.3
diff --git a/lib/libc/locale/Symbol.map b/lib/libc/locale/Symbol.map
index b2f2a35f2fe4..dc9bb56d7870 100644
--- a/lib/libc/locale/Symbol.map
+++ b/lib/libc/locale/Symbol.map
@@ -1,7 +1,3 @@
-/*
- * $FreeBSD$
- */
-
FBSD_1.0 {
btowc;
digittoint;
@@ -212,6 +208,5 @@ FBSD_1.3 {
FBSDprivate_1.0 {
_PathLocale;
__detect_path_locale;
- __collate_load_error;
__collate_range_cmp;
};
diff --git a/lib/libc/locale/ascii.c b/lib/libc/locale/ascii.c
index 99bf94108c89..2afbcea9cab9 100644
--- a/lib/libc/locale/ascii.c
+++ b/lib/libc/locale/ascii.c
@@ -9,7 +9,7 @@
* Paul Borman at Krystal Technologies.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -38,9 +38,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <limits.h>
#include <runetype.h>
diff --git a/lib/libc/locale/big5.5 b/lib/libc/locale/big5.5
index 8eb1a6a9ddb1..bada6cfbe180 100644
--- a/lib/libc/locale/big5.5
+++ b/lib/libc/locale/big5.5
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd April 1, 2020
.Dt BIG5 5
.Os
diff --git a/lib/libc/locale/big5.c b/lib/libc/locale/big5.c
index c1f94d39c7da..f67ea97af91c 100644
--- a/lib/libc/locale/big5.c
+++ b/lib/libc/locale/big5.c
@@ -9,7 +9,7 @@
* Paul Borman at Krystal Technologies.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -38,12 +38,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)big5.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <errno.h>
#include <runetype.h>
diff --git a/lib/libc/locale/btowc.3 b/lib/libc/locale/btowc.3
index 2d8cb493351b..fc15950f0373 100644
--- a/lib/libc/locale/btowc.3
+++ b/lib/libc/locale/btowc.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd February 13, 2012
.Dt BTOWC 3
.Os
diff --git a/lib/libc/locale/btowc.c b/lib/libc/locale/btowc.c
index a695da477d58..a5bf7182298d 100644
--- a/lib/libc/locale/btowc.c
+++ b/lib/libc/locale/btowc.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002, 2003 Tim J. Robbins.
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
#include <wchar.h>
#include "mblocal.h"
diff --git a/lib/libc/locale/c16rtomb.c b/lib/libc/locale/c16rtomb.c
index 46b930786592..7814da308fc9 100644
--- a/lib/libc/locale/c16rtomb.c
+++ b/lib/libc/locale/c16rtomb.c
@@ -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.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <uchar.h>
#include "mblocal.h"
diff --git a/lib/libc/locale/c16rtomb_iconv.c b/lib/libc/locale/c16rtomb_iconv.c
index 86bd9dab2a52..df671bd6e320 100644
--- a/lib/libc/locale/c16rtomb_iconv.c
+++ b/lib/libc/locale/c16rtomb_iconv.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
#define charXX_t char16_t
#define cXXrtomb c16rtomb
#define cXXrtomb_l c16rtomb_l
diff --git a/lib/libc/locale/c32rtomb.c b/lib/libc/locale/c32rtomb.c
index ebd671a404cc..1addb222e588 100644
--- a/lib/libc/locale/c32rtomb.c
+++ b/lib/libc/locale/c32rtomb.c
@@ -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.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <uchar.h>
#include <wchar.h>
diff --git a/lib/libc/locale/c32rtomb_iconv.c b/lib/libc/locale/c32rtomb_iconv.c
index dabbfd7f7ab4..5d89baac3f69 100644
--- a/lib/libc/locale/c32rtomb_iconv.c
+++ b/lib/libc/locale/c32rtomb_iconv.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
#define charXX_t char32_t
#define cXXrtomb c32rtomb
#define cXXrtomb_l c32rtomb_l
diff --git a/lib/libc/locale/cXXrtomb_iconv.h b/lib/libc/locale/cXXrtomb_iconv.h
index 1f87e353e052..f75126df3c14 100644
--- a/lib/libc/locale/cXXrtomb_iconv.h
+++ b/lib/libc/locale/cXXrtomb_iconv.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.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/queue.h>
#include <assert.h>
@@ -77,8 +74,6 @@ cXXrtomb_l(char * __restrict s, charXX_t c, mbstate_t * __restrict ps,
errno = EINVAL;
return (-1);
}
- handle->cv_shared->ci_discard_ilseq = true;
- handle->cv_shared->ci_hooks = NULL;
cs->srcbuf_len = 0;
cs->initialized = true;
if (s == NULL)
@@ -94,7 +89,7 @@ cXXrtomb_l(char * __restrict s, charXX_t c, mbstate_t * __restrict ps,
dst = s;
dstleft = MB_CUR_MAX_L(locale);
err = _citrus_iconv_convert(handle, &src, &srcleft, &dst, &dstleft,
- 0, &invlen);
+ _CITRUS_ICONV_F_HIDE_INVALID, &invlen);
/* Character is part of a surrogate pair. We need more input. */
if (err == EINVAL)
diff --git a/lib/libc/locale/collate.c b/lib/libc/locale/collate.c
index 7afb2043e6a4..8e3635485f10 100644
--- a/lib/libc/locale/collate.c
+++ b/lib/libc/locale/collate.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright 2014 Garrett D'Amore <garrett@damore.org>
* Copyright 2010 Nexenta Systems, Inc. All rights reserved.
@@ -8,7 +8,7 @@
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -36,9 +36,6 @@
* Adapted to xlocale by John Marino <draco@marino.st>
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/types.h>
@@ -68,6 +65,14 @@ struct xlocale_collate __xlocale_C_collate = {
{{0}, "C"}, 1, 0, 0, 0
};
+struct xlocale_collate __xlocale_POSIX_collate = {
+ {{0}, "POSIX"}, 1, 0, 0, 0
+};
+
+struct xlocale_collate __xlocale_CUTF8_collate = {
+ {{0}, "C.UTF-8"}, 1, 0, 0, 0
+};
+
static int
__collate_load_tables_l(const char *encoding, struct xlocale_collate *table);
@@ -84,19 +89,28 @@ destruct_collate(void *t)
void *
__collate_load(const char *encoding, __unused locale_t unused)
{
- if (strcmp(encoding, "C") == 0 || strcmp(encoding, "POSIX") == 0 ||
- strncmp(encoding, "C.", 2) == 0) {
- return &__xlocale_C_collate;
- }
- struct xlocale_collate *table = calloc(sizeof(struct xlocale_collate), 1);
+ if (strcmp(encoding, "C") == 0)
+ return (&__xlocale_C_collate);
+ else if (strcmp(encoding, "POSIX") == 0)
+ return (&__xlocale_POSIX_collate);
+ else if (strcmp(encoding, "C.UTF-8") == 0)
+ return (&__xlocale_CUTF8_collate);
+
+ struct xlocale_collate *table = calloc(sizeof(struct xlocale_collate),
+ 1);
+ if (table == NULL)
+ return (NULL);
table->header.header.destructor = destruct_collate;
- // FIXME: Make sure that _LDP_CACHE is never returned. We should be doing
- // the caching outside of this section
+
+ /*
+ * FIXME: Make sure that _LDP_CACHE is never returned. We
+ * should be doing the caching outside of this section.
+ */
if (__collate_load_tables_l(encoding, table) != _LDP_LOADED) {
xlocale_release(table);
- return NULL;
+ return (NULL);
}
- return table;
+ return (table);
}
/**
@@ -142,7 +156,7 @@ __collate_load_tables_l(const char *encoding, struct xlocale_collate *table)
}
if (sbuf.st_size < (COLLATE_FMT_VERSION_LEN +
XLOCALE_DEF_VERSION_LEN +
- sizeof (info))) {
+ sizeof (*info))) {
(void) _close(fd);
errno = EINVAL;
return (_LDP_ERROR);
diff --git a/lib/libc/locale/collate.h b/lib/libc/locale/collate.h
index 9983cdbd969d..f157d8651899 100644
--- a/lib/libc/locale/collate.h
+++ b/lib/libc/locale/collate.h
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright 2010 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 1995 Alex Tatmanjants <alex@elvisti.kiev.ua>
@@ -7,7 +7,7 @@
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,14 +31,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 _COLLATE_H_
#define _COLLATE_H_
-#include <sys/cdefs.h>
#include <sys/types.h>
#include <limits.h>
#include "xlocale_private.h"
diff --git a/lib/libc/locale/collcmp.c b/lib/libc/locale/collcmp.c
index b444ea0652ac..855f84d884da 100644
--- a/lib/libc/locale/collcmp.c
+++ b/lib/libc/locale/collcmp.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (C) 1996 by Andrey A. Chernov, Moscow, Russia.
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <string.h>
#include <wchar.h>
#include "collate.h"
diff --git a/lib/libc/locale/ctype.3 b/lib/libc/locale/ctype.3
index 5401fdb92b16..25568d6f062c 100644
--- a/lib/libc/locale/ctype.3
+++ b/lib/libc/locale/ctype.3
@@ -25,10 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)ctype.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2004
+.Dd April 3, 2022
.Dt CTYPE 3
.Os
.Sh NAME
@@ -149,3 +146,18 @@ and
.Fn toascii ,
conform to
.St -isoC .
+.Sh HISTORY
+The functions
+.Fn isalpha ,
+.Fn isupper ,
+.Fn islower ,
+.Fn isdigit ,
+.Fn isalnum ,
+.Fn isspace ,
+.Fn ispunct ,
+.Fn isprint ,
+.Fn iscntrl ,
+and
+.Fn isascii
+first appeared in
+.At v7 .
diff --git a/lib/libc/locale/ctype.c b/lib/libc/locale/ctype.c
index 8a88b8d6512e..a907ac4234fd 100644
--- a/lib/libc/locale/ctype.c
+++ b/lib/libc/locale/ctype.c
@@ -1,8 +1,7 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
*
* This software was developed by David Chisnall under sponsorship from
* the FreeBSD Foundation.
@@ -26,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$
*/
#define _XLOCALE_INLINE
#include <ctype.h>
diff --git a/lib/libc/locale/ctype_l.3 b/lib/libc/locale/ctype_l.3
index 5f427de06394..6879ba72706e 100644
--- a/lib/libc/locale/ctype_l.3
+++ b/lib/libc/locale/ctype_l.3
@@ -1,5 +1,4 @@
.\" Copyright (c) 2011 The FreeBSD Foundation
-.\" All rights reserved.
.\"
.\" This documentation was written by David Chisnall under sponsorship from
.\" the FreeBSD Foundation.
@@ -25,16 +24,13 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd March 6, 2012
+.Dd December 19, 2022
.Dt CTYPE_L 3
.Os
.Sh NAME
.Nm digittoint_l ,
.Nm isalnum_l ,
.Nm isalpha_l ,
-.Nm isascii_l ,
.Nm isblank_l ,
.Nm iscntrl_l ,
.Nm isdigit_l ,
@@ -65,8 +61,6 @@
.Ft int
.Fn isalpha_l "int c" "locale_t loc"
.Ft int
-.Fn isascii_l "int c" "locale_t loc"
-.Ft int
.Fn iscntrl_l "int c" "locale_t loc"
.Ft int
.Fn isdigit_l "int c" "locale_t loc"
@@ -111,34 +105,32 @@ specified locale rather than the global or per-thread locale.
or as true functions in the C library.
See the specific manual pages for more information.
.Sh SEE ALSO
-.Xr digittoint 3 ,
-.Xr isalnum 3 ,
-.Xr isalpha 3 ,
-.Xr isascii 3 ,
-.Xr isblank 3 ,
-.Xr iscntrl 3 ,
-.Xr isdigit 3 ,
-.Xr isgraph 3 ,
-.Xr isideogram 3 ,
-.Xr islower 3 ,
-.Xr isphonogram 3 ,
-.Xr isprint 3 ,
-.Xr ispunct 3 ,
-.Xr isrune 3 ,
-.Xr isspace 3 ,
-.Xr isspecial 3 ,
-.Xr isupper 3 ,
-.Xr isxdigit 3 ,
-.Xr tolower 3 ,
-.Xr toupper 3 ,
-.Xr wctype 3 ,
-.Xr xlocale 3
+.Xr digittoint_l 3 ,
+.Xr isalnum_l 3 ,
+.Xr isalpha_l 3 ,
+.Xr isblank_l 3 ,
+.Xr iscntrl_l 3 ,
+.Xr isdigit_l 3 ,
+.Xr isgraph_l 3 ,
+.Xr isideogram_l 3 ,
+.Xr islower_l 3 ,
+.Xr isphonogram_l 3 ,
+.Xr isprint_l 3 ,
+.Xr ispunct_l 3 ,
+.Xr isrune_l 3 ,
+.Xr isspace_l 3 ,
+.Xr isspecial_l 3 ,
+.Xr isupper_l 3 ,
+.Xr isxdigit_l 3 ,
+.Xr tolower_l 3 ,
+.Xr toupper_l 3 ,
+.Xr wctype_l 3 ,
+.Xr xlocale_l 3
.Sh STANDARDS
These functions conform to
.St -p1003.1-2008 ,
except for
.Fn digittoint_l ,
-.Fn isascii_l ,
.Fn ishexnumber_l ,
.Fn isideogram_l ,
.Fn isnumber_l ,
diff --git a/lib/libc/locale/digittoint.3 b/lib/libc/locale/digittoint.3
index 5caef66461e4..363b736bf442 100644
--- a/lib/libc/locale/digittoint.3
+++ b/lib/libc/locale/digittoint.3
@@ -25,14 +25,12 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)digittoint.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd April 6, 2001
+.Dd December 19, 2022
.Dt DIGITTOINT 3
.Os
.Sh NAME
-.Nm digittoint
+.Nm digittoint ,
+.Nm digittoint_l
.Nd convert a numeric character to its integer value
.Sh LIBRARY
.Lb libc
@@ -45,7 +43,9 @@
.Sh DESCRIPTION
The
.Fn digittoint
-function converts a numeric character to its corresponding integer value.
+and
+.Fn digittoint_l
+functions convert a numeric character to its corresponding integer value.
The character can be any decimal digit or hexadecimal digit.
With hexadecimal characters, the case of the values does not matter.
.Pp
@@ -57,12 +57,19 @@ function use the current global or per-thread locale.
.Sh RETURN VALUES
The
.Fn digittoint
-function always returns an integer from the range of 0 to 15.
+and
+.Fn digittoint_l
+functions always return an integer from the range of 0 to 15.
If the given character was not a digit as defined by
-.Xr isxdigit 3 ,
+.Xr isxdigit 3
+or
+.Xr isxdigit_l 3 ,
the function will return 0.
.Sh SEE ALSO
.Xr ctype 3 ,
+.Xr ctype_l 3 ,
.Xr isdigit 3 ,
+.Xr isdigit_l 3 ,
.Xr isxdigit 3 ,
+.Xr isxdigit_l 3 ,
.Xr xlocale 3
diff --git a/lib/libc/locale/duplocale.3 b/lib/libc/locale/duplocale.3
index bc0c4bced812..2e44df8c63a5 100644
--- a/lib/libc/locale/duplocale.3
+++ b/lib/libc/locale/duplocale.3
@@ -1,5 +1,4 @@
.\" Copyright (c) 2011 The FreeBSD Foundation
-.\" All rights reserved.
.\"
.\" This documentation was written by David Chisnall under sponsorship from
.\" the FreeBSD Foundation.
@@ -25,8 +24,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd September 17, 2011
.Dt DUPLOCALE 3
.Os
diff --git a/lib/libc/locale/euc.5 b/lib/libc/locale/euc.5
index 7d097769f962..23eab67c0737 100644
--- a/lib/libc/locale/euc.5
+++ b/lib/libc/locale/euc.5
@@ -28,9 +28,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)euc.4 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd September 9, 2019
.Dt EUC 5
.Os
diff --git a/lib/libc/locale/euc.c b/lib/libc/locale/euc.c
index 55055965ab4e..c54a6ceceff2 100644
--- a/lib/libc/locale/euc.c
+++ b/lib/libc/locale/euc.c
@@ -11,7 +11,7 @@
* Paul Borman at Krystal Technologies.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -40,12 +40,7 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)euc.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <limits.h>
#include <runetype.h>
diff --git a/lib/libc/locale/fix_grouping.c b/lib/libc/locale/fix_grouping.c
index d15faef80781..2ae165661d84 100644
--- a/lib/libc/locale/fix_grouping.c
+++ b/lib/libc/locale/fix_grouping.c
@@ -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.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <ctype.h>
#include <limits.h>
#include <stddef.h>
diff --git a/lib/libc/locale/freelocale.3 b/lib/libc/locale/freelocale.3
index d3e2d4498226..594720f4dfab 100644
--- a/lib/libc/locale/freelocale.3
+++ b/lib/libc/locale/freelocale.3
@@ -1,5 +1,4 @@
.\" Copyright (c) 2011 The FreeBSD Foundation
-.\" All rights reserved.
.\"
.\" This documentation was written by David Chisnall under sponsorship from
.\" the FreeBSD Foundation.
@@ -24,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$
.Dd July 26, 2016
.Dt FREELOCALE 3
.Os
diff --git a/lib/libc/locale/gb18030.5 b/lib/libc/locale/gb18030.5
index 3a296c017844..7b772752187a 100644
--- a/lib/libc/locale/gb18030.5
+++ b/lib/libc/locale/gb18030.5
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd August 10, 2003
.Dt GB18030 5
.Os
diff --git a/lib/libc/locale/gb18030.c b/lib/libc/locale/gb18030.c
index b4f80678d840..1ddb3e463872 100644
--- a/lib/libc/locale/gb18030.c
+++ b/lib/libc/locale/gb18030.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright 2013 Garrett D'Amore <garrett@damore.org>
* Copyright 2010 Nexenta Systems, Inc. All rights reserved.
@@ -7,7 +7,7 @@
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -40,8 +40,6 @@
*/
#include <sys/param.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <runetype.h>
#include <stdlib.h>
diff --git a/lib/libc/locale/gb2312.5 b/lib/libc/locale/gb2312.5
index 5f1f712097d5..3da610cdb19a 100644
--- a/lib/libc/locale/gb2312.5
+++ b/lib/libc/locale/gb2312.5
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd November 7, 2003
.Dt GB2312 5
.Os
diff --git a/lib/libc/locale/gb2312.c b/lib/libc/locale/gb2312.c
index 07a6c4764bb3..dbcb56435ab6 100644
--- a/lib/libc/locale/gb2312.c
+++ b/lib/libc/locale/gb2312.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright 2013 Garrett D'Amore <garrett@damore.org>
* Copyright 2010 Nexenta Systems, Inc. All rights reserved.
@@ -8,7 +8,7 @@
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -35,8 +35,6 @@
*/
#include <sys/param.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <runetype.h>
#include <stdlib.h>
diff --git a/lib/libc/locale/gbk.5 b/lib/libc/locale/gbk.5
index cec22c639540..ce5680b73cca 100644
--- a/lib/libc/locale/gbk.5
+++ b/lib/libc/locale/gbk.5
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd August 10, 2003
.Dt GBK 5
.Os
diff --git a/lib/libc/locale/gbk.c b/lib/libc/locale/gbk.c
index 78ff623be379..c64a9d534701 100644
--- a/lib/libc/locale/gbk.c
+++ b/lib/libc/locale/gbk.c
@@ -11,7 +11,7 @@
* Paul Borman at Krystal Technologies.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -40,9 +40,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <errno.h>
#include <runetype.h>
diff --git a/lib/libc/locale/isalnum.3 b/lib/libc/locale/isalnum.3
index 5dcc4cc1f12b..ab79ba79fd5b 100644
--- a/lib/libc/locale/isalnum.3
+++ b/lib/libc/locale/isalnum.3
@@ -29,14 +29,12 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)isalnum.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd July 17, 2005
+.Dd December 19, 2022
.Dt ISALNUM 3
.Os
.Sh NAME
-.Nm isalnum
+.Nm isalnum ,
+.Nm isalnum_l
.Nd alphanumeric character test
.Sh LIBRARY
.Lb libc
@@ -49,10 +47,14 @@
.Sh DESCRIPTION
The
.Fn isalnum
-function tests for any character for which
-.Xr isalpha 3
+and
+.Fn isalnum_l
+functions test for any character for which
+.Xr isalpha 3 ,
+.Xr isalpha_l 3
or
-.Xr isdigit 3
+.Xr isdigit 3 ,
+.Xr isdigit_l 3
is true.
The value of the argument must be representable as an
.Vt "unsigned char"
@@ -85,8 +87,10 @@ function uses the current global or per-thread locale.
.Sh RETURN VALUES
The
.Fn isalnum
-function returns zero if the character tests false and
-returns non-zero if the character tests true.
+and
+.Fn isalnum_l
+functions return zero if the character tests false and
+return non-zero if the character tests true.
.Sh COMPATIBILITY
The
.Bx 4.4
@@ -96,12 +100,18 @@ type in locales with large character sets is considered obsolete
and may not be supported in future releases.
The
.Fn iswalnum
+or
+.Fn iswalnum_l
function should be used instead.
.Sh SEE ALSO
.Xr ctype 3 ,
+.Xr ctype_l 3 ,
.Xr isalpha 3 ,
+.Xr isalpha_l 3 ,
.Xr isdigit 3 ,
+.Xr isdigit_l 3 ,
.Xr iswalnum 3 ,
+.Xr iswalnum_l 3 ,
.Xr xlocale 3 ,
.Xr ascii 7
.Sh STANDARDS
@@ -113,3 +123,8 @@ The
.Fn isalnum_l
function conforms to
.St -p1003.1-2008 .
+.Sh HISTORY
+The
+.Fn isalnum
+function first appeared in
+.At v7 .
diff --git a/lib/libc/locale/isalpha.3 b/lib/libc/locale/isalpha.3
index 1a7330f3a0d1..fe695b70f7b6 100644
--- a/lib/libc/locale/isalpha.3
+++ b/lib/libc/locale/isalpha.3
@@ -29,14 +29,12 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)isalpha.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd July 17, 2005
+.Dd December 19, 2022
.Dt ISALPHA 3
.Os
.Sh NAME
-.Nm isalpha
+.Nm isalpha ,
+.Nm isalpha_l
.Nd alphabetic character test
.Sh LIBRARY
.Lb libc
@@ -49,10 +47,14 @@
.Sh DESCRIPTION
The
.Fn isalpha
-function tests for any character for which
-.Xr isupper 3
+and
+.Fn isalpha_l
+functions test for any character for which
+.Xr isupper 3 ,
+.Xr isupper_l 3
or
-.Xr islower 3
+.Xr islower 3 ,
+.Xr islower_l 3
is true.
The value of the argument must be representable as an
.Vt "unsigned char"
@@ -83,8 +85,10 @@ function uses the current global or per-thread locale.
.Sh RETURN VALUES
The
.Fn isalpha
-function returns zero if the character tests false and
-returns non-zero if the character tests true.
+and
+.Fn isalpha_l
+functions return zero if the character tests false and
+return non-zero if the character tests true.
.Sh COMPATIBILITY
The
.Bx 4.4
@@ -94,12 +98,18 @@ type in locales with large character sets is considered obsolete
and may not be supported in future releases.
The
.Fn iswalpha
+or
+.Fn iswalpha_l
function should be used instead.
.Sh SEE ALSO
.Xr ctype 3 ,
+.Xr ctype_l 3 ,
.Xr islower 3 ,
+.Xr islower_l 3 ,
.Xr isupper 3 ,
+.Xr isupper_l 3 ,
.Xr iswalpha 3 ,
+.Xr iswalpha_l 3 ,
.Xr xlocale 3 ,
.Xr ascii 7
.Sh STANDARDS
diff --git a/lib/libc/locale/isascii.3 b/lib/libc/locale/isascii.3
index 933293ca8895..d395dd232d00 100644
--- a/lib/libc/locale/isascii.3
+++ b/lib/libc/locale/isascii.3
@@ -25,10 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)isascii.3 8.2 (Berkeley) 12/11/93
-.\" $FreeBSD$
-.\"
-.Dd October 6, 2002
+.Dd April 2, 2022
.Dt ISASCII 3
.Os
.Sh NAME
@@ -51,3 +48,8 @@ between 0 and octal 0177 inclusive.
.Xr ctype 3 ,
.Xr iswascii 3 ,
.Xr ascii 7
+.Sh HISTORY
+The
+.Fn isascii
+function first appeared in
+.At v7 .
diff --git a/lib/libc/locale/isblank.3 b/lib/libc/locale/isblank.3
index b3e805ae0085..e28bd8294d43 100644
--- a/lib/libc/locale/isblank.3
+++ b/lib/libc/locale/isblank.3
@@ -25,14 +25,12 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)isblank.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd July 17, 2005
+.Dd December 19, 2022
.Dt ISBLANK 3
.Os
.Sh NAME
-.Nm isblank
+.Nm isblank ,
+.Nm isblank_l
.Nd space or tab character test
.Sh LIBRARY
.Lb libc
@@ -45,7 +43,9 @@
.Sh DESCRIPTION
The
.Fn isblank
-function tests for a space or tab character.
+and
+.Fn isblank_l
+functions test for a space or tab character.
For any locale, this includes the following standard characters:
.Bl -column XXXX
.It Do \et Dc Ta Dq " "
@@ -53,6 +53,8 @@ For any locale, this includes the following standard characters:
.Pp
In the "C" locale, a successful
.Fn isblank
+or
+.Fn isblank_l
test is limited to these characters only.
The value of the argument must be representable as an
.Vt "unsigned char"
@@ -67,8 +69,10 @@ function uses the current global or per-thread locale.
.Sh RETURN VALUES
The
.Fn isblank
-function returns zero if the character tests false and
-returns non-zero if the character tests true.
+and
+.Fn isblank_l
+functions return zero if the character tests false and
+return non-zero if the character tests true.
.Sh COMPATIBILITY
The
.Bx 4.4
@@ -78,10 +82,14 @@ type in locales with large character sets is considered obsolete
and may not be supported in future releases.
The
.Fn iswblank
+or
+.Fn iswblank_l
function should be used instead.
.Sh SEE ALSO
.Xr ctype 3 ,
+.Xr ctype_l 3 ,
.Xr iswblank 3 ,
+.Xr iswblank_l 3 ,
.Xr xlocale 3 ,
.Xr ascii 7
.Sh STANDARDS
diff --git a/lib/libc/locale/iscntrl.3 b/lib/libc/locale/iscntrl.3
index 717e1e568239..9df266ba9780 100644
--- a/lib/libc/locale/iscntrl.3
+++ b/lib/libc/locale/iscntrl.3
@@ -29,14 +29,12 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)iscntrl.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd July 17, 2005
+.Dd December 19, 2022
.Dt ISCNTRL 3
.Os
.Sh NAME
-.Nm iscntrl
+.Nm iscntrl ,
+.Nm iscntrl_l
.Nd control character test
.Sh LIBRARY
.Lb libc
@@ -49,7 +47,9 @@
.Sh DESCRIPTION
The
.Fn iscntrl
-function tests for any control character.
+and
+.Fn iscntrl_l
+functions test for any control character.
The value of the argument must be representable as an
.Vt "unsigned char"
or the value of
@@ -75,8 +75,10 @@ function uses the current global or per-thread locale.
.Sh RETURN VALUES
The
.Fn iscntrl
-function returns zero if the character tests false and
-returns non-zero if the character tests true.
+and
+.Fn iscntrl_l
+functions return zero if the character tests false and
+return non-zero if the character tests true.
.Sh COMPATIBILITY
The
.Bx 4.4
@@ -86,10 +88,14 @@ type in locales with large character sets is considered obsolete
and may not be supported in future releases.
The
.Fn iswcntrl
+or
+.Fn iswcntrl_l
function should be used instead.
.Sh SEE ALSO
.Xr ctype 3 ,
+.Xr ctype_l 3 ,
.Xr iswcntrl 3 ,
+.Xr iswcntrl_l 3 ,
.Xr xlocale 3 ,
.Xr ascii 7
.Sh STANDARDS
@@ -101,3 +107,8 @@ The
.Fn iscntrl_l
function conforms to
.St -p1003.1-2008 .
+.Sh HISTORY
+The
+.Fn iscntrl
+function first appeared in
+.At v7 .
diff --git a/lib/libc/locale/isctype.c b/lib/libc/locale/isctype.c
index 3731508ba15a..c6bea890d154 100644
--- a/lib/libc/locale/isctype.c
+++ b/lib/libc/locale/isctype.c
@@ -37,12 +37,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)isctype.c 8.3 (Berkeley) 2/24/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <ctype.h>
#undef digittoint
diff --git a/lib/libc/locale/isdigit.3 b/lib/libc/locale/isdigit.3
index d1a75465e277..eac334ef40d1 100644
--- a/lib/libc/locale/isdigit.3
+++ b/lib/libc/locale/isdigit.3
@@ -29,15 +29,14 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)isdigit.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd May 4, 2007
+.Dd December 19, 2022
.Dt ISDIGIT 3
.Os
.Sh NAME
.Nm isdigit ,
-.Nm isnumber
+.Nm isnumber ,
+.Nm isdigit_l ,
+.Nm isnumber_l
.Nd decimal-digit character test
.Sh LIBRARY
.Lb libc
@@ -54,7 +53,9 @@
.Sh DESCRIPTION
The
.Fn isdigit
-function tests for a decimal digit character.
+and
+.Fn isdigit_l
+functions test for a decimal digit character.
Regardless of locale, this includes the following characters only:
.Bl -column \&``0''______ \&``0''______ \&``0''______ \&``0''______ \&``0''______
.It "\&``0''" Ta "``1''" Ta "``2''" Ta "``3''" Ta "``4''"
@@ -63,8 +64,12 @@ Regardless of locale, this includes the following characters only:
.Pp
The
.Fn isnumber
-function behaves similarly to
-.Fn isdigit ,
+and
+.Fn isnumber_l
+functions behave similarly to
+.Fn isdigit
+and
+.Fn isdigit_l ,
but may recognize additional characters, depending on the current locale
setting.
.Pp
@@ -77,9 +82,11 @@ The _l-suffixed versions take an explicit locale argument, whereas the
non-suffixed versions use the current global or per-thread locale.
.Sh RETURN VALUES
The
-.Fn isdigit
+.Fn isdigit ,
+.Fn isdigit_l ,
+.Fn isnumber ,
and
-.Fn isnumber
+.Fn isnumber_l
functions return zero if the character tests false and
return non-zero if the character tests true.
.Sh COMPATIBILITY
@@ -91,10 +98,14 @@ type in locales with large character sets is considered obsolete
and may not be supported in future releases.
The
.Fn iswdigit
+or
+.Fn iswdigit_l
function should be used instead.
.Sh SEE ALSO
.Xr ctype 3 ,
+.Xr ctype_l 3 ,
.Xr iswdigit 3 ,
+.Xr iswdigit_l 3 ,
.Xr multibyte 3 ,
.Xr xlocale 3 ,
.Xr ascii 7
diff --git a/lib/libc/locale/isgraph.3 b/lib/libc/locale/isgraph.3
index b3c078cea079..a9b727987e59 100644
--- a/lib/libc/locale/isgraph.3
+++ b/lib/libc/locale/isgraph.3
@@ -29,14 +29,12 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)isgraph.3 8.2 (Berkeley) 12/11/93
-.\" $FreeBSD$
-.\"
-.Dd July 30, 2012
+.Dd December 19, 2022
.Dt ISGRAPH 3
.Os
.Sh NAME
-.Nm isgraph
+.Nm isgraph ,
+.Nm isgraph_l
.Nd printing character test (space character exclusive)
.Sh LIBRARY
.Lb libc
@@ -49,7 +47,9 @@
.Sh DESCRIPTION
The
.Fn isgraph
-function tests for any printing character except space
+and
+.Fn isgraph_l
+functions test for any printing character except space
.Pq Ql "\~"
and other
locale-specific space-like characters.
@@ -103,10 +103,15 @@ type in locales with large character sets is considered obsolete
and may not be supported in future releases.
The
.Fn iswgraph
+or
+.Fn iswgraph_l
function should be used instead.
.Sh SEE ALSO
.Xr ctype 3 ,
+.Xr ctype_l 3 ,
.Xr iswgraph 3 ,
+.Xr iswgraph_l 3 ,
+.Xr xlocale 3 ,
.Xr ascii 7
.Sh STANDARDS
The
diff --git a/lib/libc/locale/isideogram.3 b/lib/libc/locale/isideogram.3
index cbaa625e91df..ba60ade81b32 100644
--- a/lib/libc/locale/isideogram.3
+++ b/lib/libc/locale/isideogram.3
@@ -23,13 +23,12 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2004
+.Dd December 19, 2022
.Dt ISIDEOGRAM 3
.Os
.Sh NAME
-.Nm isideogram
+.Nm isideogram ,
+.Nm isideogram_l
.Nd ideographic character test
.Sh LIBRARY
.Lb libc
@@ -37,19 +36,47 @@
.In ctype.h
.Ft int
.Fn isideogram "int c"
+.Ft int
+.Fn isideogram_l "int c" "locale_t loc"
.Sh DESCRIPTION
The
.Fn isideogram
-function tests for an ideographic character.
+and
+.Fn isideogram_l
+functions test for an ideographic character.
+.Pp
+The
+.Fn isideogram_l
+function takes an explicit locale argument, whereas the
+.Fn isideogram
+function use the current global or per-thread locale.
.Sh RETURN VALUES
The
.Fn isideogram
-function returns zero if the character tests false and
-returns non-zero if the character tests true.
+and
+.Fn isideogram_l
+functions return zero if the character tests false and
+return non-zero if the character tests true.
+.Sh COMPATIBILITY
+The
+.Bx 4.4
+extension of accepting arguments outside of the range of the
+.Vt "unsigned char"
+type in locales with large character sets is considered obsolete
+and may not be supported in future releases.
+The
+.Fn iswideogram
+or
+.Fn iswideogram_l
+function should be used instead.
.Sh SEE ALSO
.Xr ctype 3 ,
+.Xr ctype_l 3 ,
.Xr isphonogram 3 ,
-.Xr iswideogram 3
+.Xr isphonogram_l 3 ,
+.Xr iswideogram 3 ,
+.Xr iswideogram_l 3 ,
+.Xr xlocale 3
.Sh HISTORY
The
.Fn isideogram
diff --git a/lib/libc/locale/islower.3 b/lib/libc/locale/islower.3
index 7f31ad9c7c5a..78503eed93b9 100644
--- a/lib/libc/locale/islower.3
+++ b/lib/libc/locale/islower.3
@@ -29,14 +29,12 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)islower.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd July 30, 2012
+.Dd December 19, 2022
.Dt ISLOWER 3
.Os
.Sh NAME
-.Nm islower
+.Nm islower ,
+.Nm islower_l
.Nd lower-case character test
.Sh LIBRARY
.Lb libc
@@ -49,7 +47,9 @@
.Sh DESCRIPTION
The
.Fn islower
-function tests for any lower-case letters.
+and
+.Fn islower_l
+functions test for any lower-case letters.
The value of the argument must be representable as an
.Vt "unsigned char"
or the value of
@@ -86,11 +86,17 @@ type in locales with large character sets is considered obsolete
and may not be supported in future releases.
The
.Fn iswlower
+or
+.Fn iswlower_l
function should be used instead.
.Sh SEE ALSO
.Xr ctype 3 ,
+.Xr ctype_l 3 ,
.Xr iswlower 3 ,
+.Xr iswlower_l 3 ,
.Xr tolower 3 ,
+.Xr tolower_l 3 ,
+.Xr xlocale 3 ,
.Xr ascii 7
.Sh STANDARDS
The
@@ -101,3 +107,8 @@ The
.Fn islower_l
function conforms to
.St -p1003.1-2008 .
+.Sh HISTORY
+The
+.Fn islower
+function first appeared in
+.At v7 .
diff --git a/lib/libc/locale/isphonogram.3 b/lib/libc/locale/isphonogram.3
index b0d82c428cba..ec7fd9b720d2 100644
--- a/lib/libc/locale/isphonogram.3
+++ b/lib/libc/locale/isphonogram.3
@@ -23,13 +23,12 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2004
+.Dd December 19, 2022
.Dt ISPHONOGRAM 3
.Os
.Sh NAME
-.Nm isphonogram
+.Nm isphonogram ,
+.Nm isphonogram_l
.Nd phonographic character test
.Sh LIBRARY
.Lb libc
@@ -37,19 +36,35 @@
.In ctype.h
.Ft int
.Fn isphonogram "int c"
+.Ft int
+.Fn isphonogram_l "int c" "locale_t loc"
.Sh DESCRIPTION
The
.Fn isphonogram
-function tests for a phonographic character.
+and
+.Fn isphonogram_l
+functions test for a phonographic character.
+.Pp
+The
+.Fn isphonogram_l
+function takes an explicit locale argument, whereas the
+.Fn isphonogram
+function uses the current global or per-thread locale.
.Sh RETURN VALUES
The
.Fn isphonogram
-function returns zero if the character tests false and
-returns non-zero if the character tests true.
+and
+.Fn isphonogram_l
+functions return zero if the character tests false and
+return non-zero if the character tests true.
.Sh SEE ALSO
.Xr ctype 3 ,
+.Xr ctype_l 3 ,
.Xr isideogram 3 ,
-.Xr iswphonogram 3
+.Xr isideogram_l 3 ,
+.Xr iswphonogram 3 ,
+.Xr iswphonogram_l 3 ,
+.Xr xlocale 3
.Sh HISTORY
The
.Fn isphonogram
diff --git a/lib/libc/locale/isprint.3 b/lib/libc/locale/isprint.3
index 4a374304dad2..c54e122cc621 100644
--- a/lib/libc/locale/isprint.3
+++ b/lib/libc/locale/isprint.3
@@ -29,14 +29,12 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)isprint.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd July 17, 2005
+.Dd December 19, 2022
.Dt ISPRINT 3
.Os
.Sh NAME
-.Nm isprint
+.Nm isprint ,
+.Nm isprint_l
.Nd printing character test (space character inclusive)
.Sh LIBRARY
.Lb libc
@@ -44,10 +42,14 @@
.In ctype.h
.Ft int
.Fn isprint "int c"
+.Ft int
+.Fn isprint_l "int c" "locale_t loc"
.Sh DESCRIPTION
The
.Fn isprint
-function tests for any printing character, including space
+and
+.Fn isprint_l
+functions test for any printing character, including space
.Pq Ql "\ " .
The value of the argument must be representable as an
.Vt "unsigned char"
@@ -77,11 +79,19 @@ In the ASCII character set, this includes the following characters
.It "\&165\ ``u''" Ta "166\ ``v''" Ta "167\ ``w''" Ta "170\ ``x''" Ta "171\ ``y''"
.It "\&172\ ``z''" Ta "173\ ``{''" Ta "174\ ``|''" Ta "175\ ``}''" Ta "176\ ``~''"
.El
+.Pp
+The
+.Fn isprint_l
+function takes an explicit locale argument, whereas the
+.Fn isprint
+function uses the current global or per-thread locale.
.Sh RETURN VALUES
The
.Fn isprint
-function returns zero if the character tests false and
-returns non-zero if the character tests true.
+and
+.Fn isprint_l
+functions return zero if the character tests false and
+return non-zero if the character tests true.
.Sh COMPATIBILITY
The
.Bx 4.4
@@ -91,13 +101,23 @@ type in locales with large character sets is considered obsolete
and may not be supported in future releases.
The
.Fn iswprint
+or
+.Fn iswprint_l
function should be used instead.
.Sh SEE ALSO
.Xr ctype 3 ,
+.Xr ctype_l 3 ,
.Xr iswprint 3 ,
+.Xr iswprint_l 3 ,
+.Xr xlocale 3 ,
.Xr ascii 7
.Sh STANDARDS
The
.Fn isprint
function conforms to
.St -isoC .
+.Sh HISTORY
+The
+.Fn isprint
+function first appeared in
+.At v7 .
diff --git a/lib/libc/locale/ispunct.3 b/lib/libc/locale/ispunct.3
index 7ebfc06c4c87..23fec2b17528 100644
--- a/lib/libc/locale/ispunct.3
+++ b/lib/libc/locale/ispunct.3
@@ -29,14 +29,12 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)ispunct.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd July 30, 2012
+.Dd December 19, 2022
.Dt ISPUNCT 3
.Os
.Sh NAME
-.Nm ispunct
+.Nm ispunct ,
+.Nm ispunct_l
.Nd punctuation character test
.Sh LIBRARY
.Lb libc
@@ -49,11 +47,15 @@
.Sh DESCRIPTION
The
.Fn ispunct
-function tests for any printing character except for space
+and
+.Fn ispunct_l
+functions test for any printing character except for space
.Pq Ql "\ "
or a
character for which
.Xr isalnum 3
+or
+.Xr isalnum_l 3
is true.
The value of the argument must be representable as an
.Vt "unsigned char"
@@ -93,10 +95,15 @@ type in locales with large character sets is considered obsolete
and may not be supported in future releases.
The
.Fn iswpunct
+or
+.Fn iswpunct_l
function should be used instead.
.Sh SEE ALSO
.Xr ctype 3 ,
+.Xr ctype_l 3 ,
.Xr iswpunct 3 ,
+.Xr iswpunct_l 3 ,
+.Xr xlocale 3 ,
.Xr ascii 7
.Sh STANDARDS
The
@@ -107,3 +114,8 @@ The
.Fn ispunct_l
function conforms to
.St -p1003.1-2008 .
+.Sh HISTORY
+The
+.Fn ispunct
+function first appeared in
+.At v7 .
diff --git a/lib/libc/locale/isrune.3 b/lib/libc/locale/isrune.3
index 424c367d2014..b83b8a26e444 100644
--- a/lib/libc/locale/isrune.3
+++ b/lib/libc/locale/isrune.3
@@ -23,13 +23,12 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2004
+.Dd December 19, 2022
.Dt ISRUNE 3
.Os
.Sh NAME
-.Nm isrune
+.Nm isrune ,
+.Nm isrune_l
.Nd valid character test
.Sh LIBRARY
.Lb libc
@@ -37,24 +36,51 @@
.In ctype.h
.Ft int
.Fn isrune "int c"
+.Ft int
+.Fn isrune_l "int c" "locale_t loc"
.Sh DESCRIPTION
The
.Fn isrune
-function tests for any character that is valid in the current
+and
+.Fn isrune_l
+functions test for any character that is valid in the current
character set.
In the
.Tn ASCII
character set, this is equivalent to
.Fn isascii .
+.Pp
+The
+.Fn isrune_l
+function takes an explicit locale argument, whereas the
+.Fn isrune
+function uses the current global or per-thread locale.
.Sh RETURN VALUES
The
.Fn isrune
-function returns zero if the character tests false and
-returns non-zero if the character tests true.
+and
+.Fn isrune_l
+functions return zero if the character tests false and
+return non-zero if the character tests true.
+.Sh COMPATIBILITY
+The
+.Bx 4.4
+extension of accepting arguments outside of the range of the
+.Vt "unsigned char"
+type in locales with large character sets is considered obsolete
+and may not be supported in future releases.
+The
+.Fn iswrune
+or
+.Fn iswrune_l
+function should be used instead.
.Sh SEE ALSO
.Xr ctype 3 ,
+.Xr ctype_l 3 ,
.Xr isascii 3 ,
.Xr iswrune 3 ,
+.Xr iswrune_l 3 ,
+.Xr xlocale 3 ,
.Xr ascii 7
.Sh HISTORY
The
diff --git a/lib/libc/locale/isspace.3 b/lib/libc/locale/isspace.3
index 9c120c41917a..e52d2bebe76c 100644
--- a/lib/libc/locale/isspace.3
+++ b/lib/libc/locale/isspace.3
@@ -29,14 +29,12 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)isspace.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd July 30, 2012
+.Dd December 19, 2022
.Dt ISSPACE 3
.Os
.Sh NAME
-.Nm isspace
+.Nm isspace ,
+.Nm isspace_l
.Nd white-space character test
.Sh LIBRARY
.Lb libc
@@ -49,7 +47,9 @@
.Sh DESCRIPTION
The
.Fn isspace
-function tests for white-space characters.
+and
+.Fn isspace_l
+functions test for white-space characters.
For any locale, this includes the following standard characters:
.Bl -column \&`\et''___ \&``\et''___ \&``\et''___ \&``\et''___ \&``\et''___ \&``\et''___
.It "\&``\et''" Ta "``\en''" Ta "``\ev''" Ta "``\ef''" Ta "``\er''" Ta "`` ''"
@@ -57,7 +57,9 @@ For any locale, this includes the following standard characters:
.Pp
In the "C" locale,
.Fn isspace
-returns non-zero for these characters only.
+and
+.Fn isspace_l
+return non-zero for these characters only.
The value of the argument must be representable as an
.Vt "unsigned char"
or the value of
@@ -84,11 +86,16 @@ type in locales with large character sets is considered obsolete
and may not be supported in future releases.
The
.Fn iswspace
+or
+.Fn iswspace_l
function should be used instead.
.Sh SEE ALSO
.Xr ctype 3 ,
+.Xr ctype_l 3 ,
.Xr iswspace 3 ,
+.Xr iswspace_l 3 ,
.Xr multibyte 3 ,
+.Xr xlocale 3 ,
.Xr ascii 7
.Sh STANDARDS
The
@@ -99,3 +106,8 @@ The
.Fn isspace_l
function conforms to
.St -p1003.1-2008 .
+.Sh HISTORY
+The
+.Fn isspace
+function first appeared in
+.At v7 .
diff --git a/lib/libc/locale/isspecial.3 b/lib/libc/locale/isspecial.3
index de361d28f96b..b88d5361ab9f 100644
--- a/lib/libc/locale/isspecial.3
+++ b/lib/libc/locale/isspecial.3
@@ -23,13 +23,12 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2004
+.Dd December 19, 2022
.Dt ISSPECIAL 3
.Os
.Sh NAME
-.Nm isspecial
+.Nm isspecial ,
+.Nm isspecial_l
.Nd special character test
.Sh LIBRARY
.Lb libc
@@ -37,18 +36,45 @@
.In ctype.h
.Ft int
.Fn isspecial "int c"
+.Ft int
+.Fn isspecial_l "int c" "locale_t loc"
.Sh DESCRIPTION
The
.Fn isspecial
-function tests for a special character.
+and
+.Fn isspecial_l
+functions test for a special character.
+.Pp
+The
+.Fn isspecial_l
+function takes an explicit locale argument, whereas the
+.Fn isspecial
+function uses the current global or per-thread locale.
.Sh RETURN VALUES
The
.Fn isspecial
-function returns zero if the character tests false and
-returns non-zero if the character tests true.
+and
+.Fn isspecial_l
+functions return zero if the character tests false and
+return non-zero if the character tests true.
+.Sh COMPATIBILITY
+The
+.Bx 4.4
+extension of accepting arguments outside of the range of the
+.Vt "unsigned char"
+type in locales with large character sets is considered obsolete
+and may not be supported in future releases.
+The
+.Fn iswspecial
+or
+.Fn iswspecial_l
+function should be used instead.
.Sh SEE ALSO
.Xr ctype 3 ,
-.Xr iswspecial 3
+.Xr ctype_l 3 ,
+.Xr iswspecial 3 ,
+.Xr iswspecial_l 3 ,
+.Xr xlocale 3
.Sh HISTORY
The
.Fn isspecial
diff --git a/lib/libc/locale/isupper.3 b/lib/libc/locale/isupper.3
index 891ba2cffa40..212ab1d93625 100644
--- a/lib/libc/locale/isupper.3
+++ b/lib/libc/locale/isupper.3
@@ -29,14 +29,12 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)isupper.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd July 17, 2005
+.Dd December 19, 2022
.Dt ISUPPER 3
.Os
.Sh NAME
-.Nm isupper
+.Nm isupper ,
+.Nm isupper_l
.Nd upper-case character test
.Sh LIBRARY
.Lb libc
@@ -44,10 +42,14 @@
.In ctype.h
.Ft int
.Fn isupper "int c"
+.Ft int
+.Fn isupper_l "int c" "locale_t loc"
.Sh DESCRIPTION
The
.Fn isupper
-function tests for any upper-case letter.
+and
+.Fn isupper_l
+functions test for any upper-case letter.
The value of the argument must be representable as an
.Vt "unsigned char"
or the value of
@@ -63,11 +65,19 @@ In the ASCII character set, this includes the following characters
.It "\&125\ ``U''" Ta "126\ ``V''" Ta "127\ ``W''" Ta "130\ ``X''" Ta "131\ ``Y''"
.It "\&132\ ``Z''" Ta \& Ta \& Ta \& Ta \&
.El
+.Pp
+The
+.Fn isupper_l
+function takes an explicit locale argument, whereas the
+.Fn isupper
+function uses the current global or per-thread locale.
.Sh RETURN VALUES
The
.Fn isupper
-function returns zero if the character tests false and
-returns non-zero if the character tests true.
+and
+.Fn isupper_l
+functions return zero if the character tests false and
+return non-zero if the character tests true.
.Sh COMPATIBILITY
The
.Bx 4.4
@@ -77,14 +87,25 @@ type in locales with large character sets is considered obsolete
and may not be supported in future releases.
The
.Fn iswupper
+or
+.Fn iswupper_l
function should be used instead.
.Sh SEE ALSO
.Xr ctype 3 ,
+.Xr ctype_l 3 ,
.Xr iswupper 3 ,
+.Xr iswupper_l 3 ,
.Xr toupper 3 ,
+.Xr toupper_l 3 ,
+.Xr xlocale 3 ,
.Xr ascii 7
.Sh STANDARDS
The
.Fn isupper
function conforms to
.St -isoC .
+.Sh HISTORY
+The
+.Fn isupper
+function first appeared in
+.At v7 .
diff --git a/lib/libc/locale/iswalnum.3 b/lib/libc/locale/iswalnum.3
index 9004b34ea65e..5425ceeb7e5f 100644
--- a/lib/libc/locale/iswalnum.3
+++ b/lib/libc/locale/iswalnum.3
@@ -31,9 +31,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)isalnum.3 5.2 (Berkeley) 6/29/91
-.\" $FreeBSD$
-.\"
.Dd October 3, 2002
.Dt ISWALNUM 3
.Os
diff --git a/lib/libc/locale/iswalnum_l.3 b/lib/libc/locale/iswalnum_l.3
index 21ee48fa7b5b..69ac921c8208 100644
--- a/lib/libc/locale/iswalnum_l.3
+++ b/lib/libc/locale/iswalnum_l.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd July 25, 2012
.Dt ISWALNUM_L 3
.Os
diff --git a/lib/libc/locale/iswctype.c b/lib/libc/locale/iswctype.c
index 251e98c2b9c7..0693da602116 100644
--- a/lib/libc/locale/iswctype.c
+++ b/lib/libc/locale/iswctype.c
@@ -37,9 +37,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <wctype.h>
#undef iswalnum
diff --git a/lib/libc/locale/isxdigit.3 b/lib/libc/locale/isxdigit.3
index 7e065a4e255a..f6c4a47b4971 100644
--- a/lib/libc/locale/isxdigit.3
+++ b/lib/libc/locale/isxdigit.3
@@ -29,15 +29,14 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)isxdigit.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd July 17, 2005
+.Dd December 19, 2022
.Dt ISXDIGIT 3
.Os
.Sh NAME
.Nm isxdigit ,
-.Nm ishexnumber
+.Nm ishexnumber ,
+.Nm isxdigit_l ,
+.Nm ishexnumber_l
.Nd hexadecimal-digit character test
.Sh LIBRARY
.Lb libc
@@ -47,10 +46,16 @@
.Fn isxdigit "int c"
.Ft int
.Fn ishexnumber "int c"
+.Ft int
+.Fn isxdigit_l "int c" "locale_t loc"
+.Ft int
+.Fn ishexnumber_l "int c" "locale_t loc"
.Sh DESCRIPTION
The
.Fn isxdigit
-function tests for any hexadecimal-digit character.
+and
+.Fn isxdigit_l
+functions test for any hexadecimal-digit character.
Regardless of locale, this includes the following characters only:
.Bl -column \&``0''______ \&``0''______ \&``0''______ \&``0''______ \&``0''______
.It "\&``0''" Ta "``1''" Ta "``2''" Ta "``3''" Ta "``4''"
@@ -62,8 +67,12 @@ Regardless of locale, this includes the following characters only:
.Pp
The
.Fn ishexnumber
-function behaves similarly to
-.Fn isxdigit ,
+and
+.Fn ishexnumber_l
+functions behave similarly to
+.Fn isxdigit
+and
+.Fn isxdigit_l ,
but may recognize additional characters,
depending on the current locale setting.
.Pp
@@ -71,11 +80,16 @@ The value of the argument must be representable as an
.Vt "unsigned char"
or the value of
.Dv EOF .
+.Pp
+The _l-suffixed versions take an explicit locale argument, whereas the
+non-suffixed versions use the current global or per-thread locale.
.Sh RETURN VALUES
The
.Fn isxdigit
-function returns zero if the character tests false and
-returns non-zero if the character tests true.
+and
+.Fn isxdigit_l
+functions return zero if the character tests false and
+return non-zero if the character tests true.
.Sh COMPATIBILITY
The
.Bx 4.4
@@ -85,10 +99,15 @@ type in locales with large character sets is considered obsolete
and may not be supported in future releases.
The
.Fn iswxdigit
+or
+.Fn iswxdigit_l
function should be used instead.
.Sh SEE ALSO
.Xr ctype 3 ,
+.Xr ctype_l 3 ,
.Xr iswxdigit 3 ,
+.Xr iswxdigit_l 3 ,
+.Xr xlocale 3 ,
.Xr ascii 7
.Sh STANDARDS
The
diff --git a/lib/libc/locale/ldpart.c b/lib/libc/locale/ldpart.c
index 889291cf3168..77be5404b199 100644
--- a/lib/libc/locale/ldpart.c
+++ b/lib/libc/locale/ldpart.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2000, 2001 Alexey Zelkin <phantom@FreeBSD.org>
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/lib/libc/locale/ldpart.h b/lib/libc/locale/ldpart.h
index 8985b324ae03..a784d12f29c0 100644
--- a/lib/libc/locale/ldpart.h
+++ b/lib/libc/locale/ldpart.h
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2000, 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 _LDPART_H_
diff --git a/lib/libc/locale/lmessages.c b/lib/libc/locale/lmessages.c
index 9c442dc3d7a1..716dc1ead6ea 100644
--- a/lib/libc/locale/lmessages.c
+++ b/lib/libc/locale/lmessages.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org>
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stddef.h>
#include "ldpart.h"
@@ -60,7 +57,8 @@ static const struct lc_messages_T _C_messages_locale = {
"no" /* nostr */
};
-static void destruct_messages(void *v)
+static void
+destruct_messages(void *v)
{
struct xlocale_messages *l = v;
if (l->buffer)
@@ -69,7 +67,8 @@ static void destruct_messages(void *v)
}
static int
-messages_load_locale(struct xlocale_messages *loc, int *using_locale, const char *name)
+messages_load_locale(struct xlocale_messages *loc, int *using_locale,
+ const char *name)
{
int ret;
struct lc_messages_T *l = &loc->locale;
@@ -86,35 +85,41 @@ messages_load_locale(struct xlocale_messages *loc, int *using_locale, const char
}
return (ret);
}
+
int
__messages_load_locale(const char *name)
{
- return messages_load_locale(&__xlocale_global_messages,
- &__xlocale_global_locale.using_messages_locale, name);
+ return (messages_load_locale(&__xlocale_global_messages,
+ &__xlocale_global_locale.using_messages_locale, name));
}
+
void *
__messages_load(const char *name, locale_t l)
{
- struct xlocale_messages *new = calloc(sizeof(struct xlocale_messages), 1);
+ struct xlocale_messages *new = calloc(sizeof(struct xlocale_messages),
+ 1);
+ if (new == NULL)
+ return (NULL);
new->header.header.destructor = destruct_messages;
- if (messages_load_locale(new, &l->using_messages_locale, name) == _LDP_ERROR) {
+ if (messages_load_locale(new, &l->using_messages_locale, name) ==
+ _LDP_ERROR) {
xlocale_release(new);
- return NULL;
+ return (NULL);
}
- return new;
+ return (new);
}
struct lc_messages_T *
__get_current_messages_locale(locale_t loc)
{
- return (loc->using_messages_locale
- ? &((struct xlocale_messages *)loc->components[XLC_MESSAGES])->locale
- : (struct lc_messages_T *)&_C_messages_locale);
+ return (loc->using_messages_locale ? &((struct xlocale_messages *)
+ loc->components[XLC_MESSAGES])->locale :
+ (struct lc_messages_T *)&_C_messages_locale);
}
#ifdef LOCALE_DEBUG
void
-msgdebug() {
+msgdebug(void) {
printf( "yesexpr = %s\n"
"noexpr = %s\n"
"yesstr = %s\n"
diff --git a/lib/libc/locale/lmessages.h b/lib/libc/locale/lmessages.h
index 0e8278f4a650..a6057caa0ecf 100644
--- a/lib/libc/locale/lmessages.h
+++ b/lib/libc/locale/lmessages.h
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2000, 2001 Alexey Zelkin <phantom@FreeBSD.org>
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -29,8 +29,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 _LMESSAGES_H_
diff --git a/lib/libc/locale/lmonetary.c b/lib/libc/locale/lmonetary.c
index b8b4e78c060b..75ef6b3d53dc 100644
--- a/lib/libc/locale/lmonetary.c
+++ b/lib/libc/locale/lmonetary.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2000, 2001 Alexey Zelkin <phantom@FreeBSD.org>
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <limits.h>
#include <stddef.h>
#include <stdlib.h>
@@ -98,15 +95,15 @@ destruct_monetary(void *v)
static int
monetary_load_locale_l(struct xlocale_monetary *loc, int *using_locale,
- int *changed, const char *name)
+ int *changed, const char *name)
{
int ret;
struct lc_monetary_T *l = &loc->locale;
ret = __part_load_locale(name, using_locale,
- &loc->buffer, "LC_MONETARY",
- LCMONETARY_SIZE_FULL, LCMONETARY_SIZE_MIN,
- (const char **)l);
+ &loc->buffer, "LC_MONETARY",
+ LCMONETARY_SIZE_FULL, LCMONETARY_SIZE_MIN,
+ (const char **)l);
if (ret == _LDP_LOADED) {
l->mon_grouping =
__fix_locale_grouping_str(l->mon_grouping);
@@ -148,38 +145,42 @@ monetary_load_locale_l(struct xlocale_monetary *loc, int *using_locale,
atomic_store_rel_int(changed, 1);
return (ret);
}
+
int
__monetary_load_locale(const char *name)
{
- return monetary_load_locale_l(&__xlocale_global_monetary,
- &__xlocale_global_locale.using_monetary_locale,
- &__xlocale_global_locale.monetary_locale_changed, name);
+ return (monetary_load_locale_l(&__xlocale_global_monetary,
+ &__xlocale_global_locale.using_monetary_locale,
+ &__xlocale_global_locale.monetary_locale_changed, name));
}
-void* __monetary_load(const char *name, locale_t l)
+
+void *
+__monetary_load(const char *name, locale_t l)
{
- struct xlocale_monetary *new = calloc(sizeof(struct xlocale_monetary), 1);
+ struct xlocale_monetary *new = calloc(sizeof(struct xlocale_monetary),
+ 1);
+ if (new == NULL)
+ return (NULL);
new->header.header.destructor = destruct_monetary;
if (monetary_load_locale_l(new, &l->using_monetary_locale,
- &l->monetary_locale_changed, name) == _LDP_ERROR)
- {
+ &l->monetary_locale_changed, name) == _LDP_ERROR) {
xlocale_release(new);
- return NULL;
+ return (NULL);
}
- return new;
+ return (new);
}
-
struct lc_monetary_T *
__get_current_monetary_locale(locale_t loc)
{
- return (loc->using_monetary_locale
- ? &((struct xlocale_monetary*)loc->components[XLC_MONETARY])->locale
- : (struct lc_monetary_T *)&_C_monetary_locale);
+ return (loc->using_monetary_locale ?
+ &((struct xlocale_monetary*)loc->components[XLC_MONETARY])->locale :
+ (struct lc_monetary_T *)&_C_monetary_locale);
}
#ifdef LOCALE_DEBUG
void
-monetdebug() {
+monetdebug(void) {
printf( "int_curr_symbol = %s\n"
"currency_symbol = %s\n"
"mon_decimal_point = %s\n"
diff --git a/lib/libc/locale/lmonetary.h b/lib/libc/locale/lmonetary.h
index 69facf9f88dd..11e39545482d 100644
--- a/lib/libc/locale/lmonetary.h
+++ b/lib/libc/locale/lmonetary.h
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2000, 2001 Alexey Zelkin <phantom@FreeBSD.org>
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -29,8 +29,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 _LMONETARY_H_
diff --git a/lib/libc/locale/lnumeric.c b/lib/libc/locale/lnumeric.c
index cc1daa3863e3..8f8443668314 100644
--- a/lib/libc/locale/lnumeric.c
+++ b/lib/libc/locale/lnumeric.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2000, 2001 Alexey Zelkin <phantom@FreeBSD.org>
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <limits.h>
#include "ldpart.h"
@@ -46,8 +43,8 @@ extern const char *__fix_locale_grouping_str(const char *);
static char numempty[] = { CHAR_MAX, '\0' };
static const struct lc_numeric_T _C_numeric_locale = {
- ".", /* decimal_point */
- "", /* thousands_sep */
+ ".", /* decimal_point */
+ "", /* thousands_sep */
numempty /* grouping */
};
@@ -63,16 +60,16 @@ destruct_numeric(void *v)
struct xlocale_numeric __xlocale_global_numeric;
static int
-numeric_load_locale(struct xlocale_numeric *loc, int *using_locale, int *changed,
- const char *name)
+numeric_load_locale(struct xlocale_numeric *loc, int *using_locale,
+ int *changed, const char *name)
{
int ret;
struct lc_numeric_T *l = &loc->locale;
ret = __part_load_locale(name, using_locale,
- &loc->buffer, "LC_NUMERIC",
- LCNUMERIC_SIZE, LCNUMERIC_SIZE,
- (const char**)l);
+ &loc->buffer, "LC_NUMERIC",
+ LCNUMERIC_SIZE, LCNUMERIC_SIZE,
+ (const char**)l);
if (ret == _LDP_LOADED) {
/* Can't be empty according to C99 */
if (*l->decimal_point == '\0')
@@ -89,30 +86,33 @@ numeric_load_locale(struct xlocale_numeric *loc, int *using_locale, int *changed
int
__numeric_load_locale(const char *name)
{
- return numeric_load_locale(&__xlocale_global_numeric,
- &__xlocale_global_locale.using_numeric_locale,
- &__xlocale_global_locale.numeric_locale_changed, name);
+ return (numeric_load_locale(&__xlocale_global_numeric,
+ &__xlocale_global_locale.using_numeric_locale,
+ &__xlocale_global_locale.numeric_locale_changed, name));
}
+
void *
__numeric_load(const char *name, locale_t l)
{
- struct xlocale_numeric *new = calloc(sizeof(struct xlocale_numeric), 1);
+ struct xlocale_numeric *new = calloc(sizeof(struct xlocale_numeric),
+ 1);
+ if (new == NULL)
+ return (NULL);
new->header.header.destructor = destruct_numeric;
if (numeric_load_locale(new, &l->using_numeric_locale,
- &l->numeric_locale_changed, name) == _LDP_ERROR)
- {
+ &l->numeric_locale_changed, name) == _LDP_ERROR) {
xlocale_release(new);
- return NULL;
+ return (NULL);
}
- return new;
+ return (new);
}
struct lc_numeric_T *
__get_current_numeric_locale(locale_t loc)
{
- return (loc->using_numeric_locale
- ? &((struct xlocale_numeric *)loc->components[XLC_NUMERIC])->locale
- : (struct lc_numeric_T *)&_C_numeric_locale);
+ return (loc->using_numeric_locale ?
+ &((struct xlocale_numeric *)loc->components[XLC_NUMERIC])->locale :
+ (struct lc_numeric_T *)&_C_numeric_locale);
}
#ifdef LOCALE_DEBUG
diff --git a/lib/libc/locale/lnumeric.h b/lib/libc/locale/lnumeric.h
index 43ff16127862..eaba6ed0bf54 100644
--- a/lib/libc/locale/lnumeric.h
+++ b/lib/libc/locale/lnumeric.h
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2000, 2001 Alexey Zelkin <phantom@FreeBSD.org>
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -29,8 +29,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 _LNUMERIC_H_
diff --git a/lib/libc/locale/localeconv.3 b/lib/libc/locale/localeconv.3
index 6262bf886346..caea8a7529f8 100644
--- a/lib/libc/locale/localeconv.3
+++ b/lib/libc/locale/localeconv.3
@@ -27,10 +27,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 @(#)setlocale.3 8.1 (Berkeley) 6/9/93
.\" From FreeBSD: src/lib/libc/locale/setlocale.3,v 1.28 2003/11/15 02:26:04 tjr Exp
-.\" $FreeBSD$
.\"
.Dd November 21, 2003
.Dt LOCALECONV 3
diff --git a/lib/libc/locale/localeconv.c b/lib/libc/locale/localeconv.c
index 130f93c178f4..2cd629e8210d 100644
--- a/lib/libc/locale/localeconv.c
+++ b/lib/libc/locale/localeconv.c
@@ -6,7 +6,7 @@
* The Regents of the University of California. All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -35,12 +35,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)localeconv.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <locale.h>
#include "lmonetary.h"
@@ -51,7 +45,7 @@ __FBSDID("$FreeBSD$");
* monetary and numeric locales.
*
* Because localeconv() may be called many times (especially by library
- * routines like printf() & strtod()), the approprate members of the
+ * routines like printf() & strtod()), the appropriate members of the
* lconv structure are computed only when the monetary or numeric
* locale has been changed.
*/
diff --git a/lib/libc/locale/mblen.3 b/lib/libc/locale/mblen.3
index a491096cbbab..10404f51f785 100644
--- a/lib/libc/locale/mblen.3
+++ b/lib/libc/locale/mblen.3
@@ -28,10 +28,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 @(#)multibyte.3 8.1 (Berkeley) 6/4/93
.\" From FreeBSD: src/lib/libc/locale/multibyte.3,v 1.22 2003/11/08 03:23:11 tjr Exp
-.\" $FreeBSD$
.\"
.Dd April 11, 2004
.Dt MBLEN 3
diff --git a/lib/libc/locale/mblen.c b/lib/libc/locale/mblen.c
index 77d9745da198..f0723b2c05a9 100644
--- a/lib/libc/locale/mblen.c
+++ b/lib/libc/locale/mblen.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002-2004 Tim J. Robbins.
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdlib.h>
#include <wchar.h>
#include "mblocal.h"
diff --git a/lib/libc/locale/mblocal.h b/lib/libc/locale/mblocal.h
index 1fb5902a8d11..a39117cc6352 100644
--- a/lib/libc/locale/mblocal.h
+++ b/lib/libc/locale/mblocal.h
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright 2013 Garrett D'Amore <garrett@damore.org>
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
@@ -7,7 +7,7 @@
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -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 _MBLOCAL_H_
diff --git a/lib/libc/locale/mbrlen.3 b/lib/libc/locale/mbrlen.3
index 524d2c7b4016..5c58ecea495e 100644
--- a/lib/libc/locale/mbrlen.3
+++ b/lib/libc/locale/mbrlen.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd April 7, 2004
.Dt MBRLEN 3
.Os
diff --git a/lib/libc/locale/mbrlen.c b/lib/libc/locale/mbrlen.c
index 4f687e98628f..e4470070752f 100644
--- a/lib/libc/locale/mbrlen.c
+++ b/lib/libc/locale/mbrlen.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002-2004 Tim J. Robbins.
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <wchar.h>
#include "mblocal.h"
diff --git a/lib/libc/locale/mbrtoc16.c b/lib/libc/locale/mbrtoc16.c
index 7f5674d97d3c..0c0d33e944f6 100644
--- a/lib/libc/locale/mbrtoc16.c
+++ b/lib/libc/locale/mbrtoc16.c
@@ -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.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <uchar.h>
#include "mblocal.h"
diff --git a/lib/libc/locale/mbrtoc16_iconv.c b/lib/libc/locale/mbrtoc16_iconv.c
index f1eaf1925496..f4e37a0489eb 100644
--- a/lib/libc/locale/mbrtoc16_iconv.c
+++ b/lib/libc/locale/mbrtoc16_iconv.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
#define charXX_t char16_t
#define mbrtocXX mbrtoc16
#define mbrtocXX_l mbrtoc16_l
diff --git a/lib/libc/locale/mbrtoc32.c b/lib/libc/locale/mbrtoc32.c
index 1238ca228b20..29b32abcf4fc 100644
--- a/lib/libc/locale/mbrtoc32.c
+++ b/lib/libc/locale/mbrtoc32.c
@@ -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.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <uchar.h>
#include <wchar.h>
#include "mblocal.h"
diff --git a/lib/libc/locale/mbrtoc32_iconv.c b/lib/libc/locale/mbrtoc32_iconv.c
index ec2c0145d9d6..503d7b378538 100644
--- a/lib/libc/locale/mbrtoc32_iconv.c
+++ b/lib/libc/locale/mbrtoc32_iconv.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
#define charXX_t char32_t
#define mbrtocXX mbrtoc32
#define mbrtocXX_l mbrtoc32_l
diff --git a/lib/libc/locale/mbrtocXX_iconv.h b/lib/libc/locale/mbrtocXX_iconv.h
index d753b3523244..35d0fd914b1f 100644
--- a/lib/libc/locale/mbrtocXX_iconv.h
+++ b/lib/libc/locale/mbrtocXX_iconv.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.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/queue.h>
#include <assert.h>
@@ -80,8 +77,6 @@ mbrtocXX_l(charXX_t * __restrict pc, const char * __restrict s, size_t n,
errno = EINVAL;
return (-1);
}
- handle->cv_shared->ci_discard_ilseq = true;
- handle->cv_shared->ci_hooks = NULL;
cs->srcbuf_len = cs->dstbuf_len = 0;
cs->initialized = true;
if (s == NULL)
@@ -112,7 +107,7 @@ mbrtocXX_l(charXX_t * __restrict pc, const char * __restrict s, size_t n,
assert(srcleft <= sizeof(cs->srcbuf) &&
dstleft <= sizeof(cs->dstbuf.bytes));
err = _citrus_iconv_convert(handle, &src, &srcleft,
- &dst, &dstleft, 0, &invlen);
+ &dst, &dstleft, _CITRUS_ICONV_F_HIDE_INVALID, &invlen);
cs->dstbuf_len = (dst - cs->dstbuf.bytes) / sizeof(charXX_t);
/* Got new character(s). Return the first. */
diff --git a/lib/libc/locale/mbrtowc.3 b/lib/libc/locale/mbrtowc.3
index 22b26cd2a244..da64e2382629 100644
--- a/lib/libc/locale/mbrtowc.3
+++ b/lib/libc/locale/mbrtowc.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd May 21, 2013
.Dt MBRTOWC 3
.Os
diff --git a/lib/libc/locale/mbrtowc.c b/lib/libc/locale/mbrtowc.c
index 7585ef16bca2..ac1afc49a94f 100644
--- a/lib/libc/locale/mbrtowc.c
+++ b/lib/libc/locale/mbrtowc.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002-2004 Tim J. Robbins.
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <wchar.h>
#include "mblocal.h"
diff --git a/lib/libc/locale/mbsinit.3 b/lib/libc/locale/mbsinit.3
index afc2500c3a77..6e30c3b8f958 100644
--- a/lib/libc/locale/mbsinit.3
+++ b/lib/libc/locale/mbsinit.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd April 8, 2004
.Dt MBSINIT 3
.Os
diff --git a/lib/libc/locale/mbsinit.c b/lib/libc/locale/mbsinit.c
index a7df81911b26..5b964c1b3d58 100644
--- a/lib/libc/locale/mbsinit.c
+++ b/lib/libc/locale/mbsinit.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002-2004 Tim J. Robbins.
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <wchar.h>
#include "mblocal.h"
diff --git a/lib/libc/locale/mbsnrtowcs.c b/lib/libc/locale/mbsnrtowcs.c
index 69e48eafdc57..9a261a297e73 100644
--- a/lib/libc/locale/mbsnrtowcs.c
+++ b/lib/libc/locale/mbsnrtowcs.c
@@ -1,15 +1,14 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright 2013 Garrett D'Amore <garrett@damore.org>
* Copyright 2010 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2002-2004 Tim J. Robbins.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
- * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -33,9 +32,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <limits.h>
#include <stdlib.h>
diff --git a/lib/libc/locale/mbsrtowcs.3 b/lib/libc/locale/mbsrtowcs.3
index fb2076f98cdf..b1e2457583ec 100644
--- a/lib/libc/locale/mbsrtowcs.3
+++ b/lib/libc/locale/mbsrtowcs.3
@@ -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$
.Dd August 7, 2020
.Dt MBSRTOWCS 3
.Os
diff --git a/lib/libc/locale/mbsrtowcs.c b/lib/libc/locale/mbsrtowcs.c
index e85b22b492bf..0d7157cdd643 100644
--- a/lib/libc/locale/mbsrtowcs.c
+++ b/lib/libc/locale/mbsrtowcs.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002-2004 Tim J. Robbins.
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <limits.h>
#include <stdlib.h>
diff --git a/lib/libc/locale/mbstowcs.3 b/lib/libc/locale/mbstowcs.3
index d74d6a5df748..4d8d9907f3e0 100644
--- a/lib/libc/locale/mbstowcs.3
+++ b/lib/libc/locale/mbstowcs.3
@@ -28,10 +28,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 @(#)multibyte.3 8.1 (Berkeley) 6/4/93
.\" From FreeBSD: src/lib/libc/locale/multibyte.3,v 1.22 2003/11/08 03:23:11 tjr Exp
-.\" $FreeBSD$
.\"
.Dd April 8, 2004
.Dt MBSTOWCS 3
diff --git a/lib/libc/locale/mbstowcs.c b/lib/libc/locale/mbstowcs.c
index 3226d22ea254..338db46185ad 100644
--- a/lib/libc/locale/mbstowcs.c
+++ b/lib/libc/locale/mbstowcs.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002-2004 Tim J. Robbins.
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <limits.h>
#include <stdlib.h>
#include <wchar.h>
diff --git a/lib/libc/locale/mbtowc.3 b/lib/libc/locale/mbtowc.3
index 859cdf819c40..597c3acd0f63 100644
--- a/lib/libc/locale/mbtowc.3
+++ b/lib/libc/locale/mbtowc.3
@@ -28,10 +28,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 @(#)multibyte.3 8.1 (Berkeley) 6/4/93
.\" From FreeBSD: src/lib/libc/locale/multibyte.3,v 1.22 2003/11/08 03:23:11 tjr Exp
-.\" $FreeBSD$
.\"
.Dd April 11, 2004
.Dt MBTOWC 3
diff --git a/lib/libc/locale/mbtowc.c b/lib/libc/locale/mbtowc.c
index ec634807560d..c36d1d46f1c0 100644
--- a/lib/libc/locale/mbtowc.c
+++ b/lib/libc/locale/mbtowc.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002-2004 Tim J. Robbins.
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <stdlib.h>
#include <wchar.h>
diff --git a/lib/libc/locale/mskanji.5 b/lib/libc/locale/mskanji.5
index 8ebaccdd7af2..75ed206204be 100644
--- a/lib/libc/locale/mskanji.5
+++ b/lib/libc/locale/mskanji.5
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd August 7, 2003
.Dt MSKANJI 5
.Os
diff --git a/lib/libc/locale/mskanji.c b/lib/libc/locale/mskanji.c
index 1585886cea31..f0731443c154 100644
--- a/lib/libc/locale/mskanji.c
+++ b/lib/libc/locale/mskanji.c
@@ -11,7 +11,7 @@
* May 12, 1995
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -42,12 +42,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)mskanji.c 1.0 (Phase One) 5/5/95";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <errno.h>
#include <runetype.h>
diff --git a/lib/libc/locale/multibyte.3 b/lib/libc/locale/multibyte.3
index 71d978458358..e134579512e3 100644
--- a/lib/libc/locale/multibyte.3
+++ b/lib/libc/locale/multibyte.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)multibyte.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd September 9, 2019
.Dt MULTIBYTE 3
.Os
diff --git a/lib/libc/locale/newlocale.3 b/lib/libc/locale/newlocale.3
index cc5043df8eb1..8dbe52e10eb9 100644
--- a/lib/libc/locale/newlocale.3
+++ b/lib/libc/locale/newlocale.3
@@ -1,5 +1,4 @@
.\" Copyright (c) 2011 The FreeBSD Foundation
-.\" All rights reserved.
.\"
.\" This documentation was written by David Chisnall under sponsorship from
.\" the FreeBSD Foundation.
@@ -24,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$
.Dd October 2, 2020
.Dt NEWLOCALE 3
.Os
diff --git a/lib/libc/locale/nextwctype.3 b/lib/libc/locale/nextwctype.3
index 0f6f88079f64..b3d0b01930a5 100644
--- a/lib/libc/locale/nextwctype.3
+++ b/lib/libc/locale/nextwctype.3
@@ -23,8 +23,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd July 21, 2005
.Dt NEXTWCTYPE 3
.Os
diff --git a/lib/libc/locale/nextwctype.c b/lib/libc/locale/nextwctype.c
index 3ef73ddec7b6..b0416a9a1138 100644
--- a/lib/libc/locale/nextwctype.c
+++ b/lib/libc/locale/nextwctype.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2004 Tim J. Robbins.
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <runetype.h>
#include <wchar.h>
#include <wctype.h>
diff --git a/lib/libc/locale/nl_langinfo.3 b/lib/libc/locale/nl_langinfo.3
index 73cba4c18084..591b76b6e8e6 100644
--- a/lib/libc/locale/nl_langinfo.3
+++ b/lib/libc/locale/nl_langinfo.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd December 14, 2020
.Dt NL_LANGINFO 3
.Os
diff --git a/lib/libc/locale/nl_langinfo.c b/lib/libc/locale/nl_langinfo.c
index b51b0425515b..7cdf2856c5bc 100644
--- a/lib/libc/locale/nl_langinfo.c
+++ b/lib/libc/locale/nl_langinfo.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2001, 2003 Alexey Zelkin <phantom@FreeBSD.org>
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <langinfo.h>
#include <limits.h>
#include <locale.h>
diff --git a/lib/libc/locale/nomacros.c b/lib/libc/locale/nomacros.c
index 66cf40e61ec9..680682d4447a 100644
--- a/lib/libc/locale/nomacros.c
+++ b/lib/libc/locale/nomacros.c
@@ -1,6 +1,3 @@
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* Tell <ctype.h> to generate extern versions of all its inline
* functions. The extern versions get called if the system doesn't
diff --git a/lib/libc/locale/none.c b/lib/libc/locale/none.c
index d95bb0087c09..8130a2f9b49e 100644
--- a/lib/libc/locale/none.c
+++ b/lib/libc/locale/none.c
@@ -11,7 +11,7 @@
* Paul Borman at Krystal Technologies.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -40,12 +40,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)none.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <limits.h>
#include <runetype.h>
diff --git a/lib/libc/locale/querylocale.3 b/lib/libc/locale/querylocale.3
index ecafee49a712..6ac317ef42bf 100644
--- a/lib/libc/locale/querylocale.3
+++ b/lib/libc/locale/querylocale.3
@@ -1,5 +1,4 @@
.\" Copyright (c) 2011 The FreeBSD Foundation
-.\" All rights reserved.
.\"
.\" This documentation was written by David Chisnall under sponsorship from
.\" the FreeBSD Foundation.
@@ -25,8 +24,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd November 8, 2020
.Dt QUERYLOCALE 3
.Os
diff --git a/lib/libc/locale/rpmatch.3 b/lib/libc/locale/rpmatch.3
index b34c5bfa199a..1518d3b14be3 100644
--- a/lib/libc/locale/rpmatch.3
+++ b/lib/libc/locale/rpmatch.3
@@ -23,8 +23,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd July 21, 2005
.Dt RPMATCH 3
.Os
diff --git a/lib/libc/locale/rpmatch.c b/lib/libc/locale/rpmatch.c
index e4c366a00afb..fb778876bc30 100644
--- a/lib/libc/locale/rpmatch.c
+++ b/lib/libc/locale/rpmatch.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2004-2005 Tim J. Robbins.
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <langinfo.h>
#include <regex.h>
#include <stdlib.h>
diff --git a/lib/libc/locale/rune.c b/lib/libc/locale/rune.c
index ce2095763eba..59537c440a39 100644
--- a/lib/libc/locale/rune.c
+++ b/lib/libc/locale/rune.c
@@ -34,12 +34,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)rune.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <arpa/inet.h>
#include <errno.h>
diff --git a/lib/libc/locale/runefile.h b/lib/libc/locale/runefile.h
index 18a603c03e31..dfd85bb3d504 100644
--- a/lib/libc/locale/runefile.h
+++ b/lib/libc/locale/runefile.h
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2005 Ruslan Ermilov
* 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 _RUNEFILE_H_
diff --git a/lib/libc/locale/runetype.c b/lib/libc/locale/runetype.c
index 8fe656aded05..e26104e97234 100644
--- a/lib/libc/locale/runetype.c
+++ b/lib/libc/locale/runetype.c
@@ -8,7 +8,7 @@
* Paul Borman at Krystal Technologies.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -37,9 +37,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <ctype.h>
#include <stdio.h>
#include <runetype.h>
diff --git a/lib/libc/locale/setlocale.3 b/lib/libc/locale/setlocale.3
index acaba2f0a660..df64f3178fbe 100644
--- a/lib/libc/locale/setlocale.3
+++ b/lib/libc/locale/setlocale.3
@@ -28,9 +28,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)setlocale.3 8.1 (Berkeley) 6/9/93
-.\" $FreeBSD$
-.\"
.Dd August 7, 2020
.Dt SETLOCALE 3
.Os
diff --git a/lib/libc/locale/setlocale.c b/lib/libc/locale/setlocale.c
index e0ba66e0e35a..00226b2c5f00 100644
--- a/lib/libc/locale/setlocale.c
+++ b/lib/libc/locale/setlocale.c
@@ -33,12 +33,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)setlocale.c 8.1 (Berkeley) 7/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
@@ -312,9 +306,9 @@ int
__detect_path_locale(void)
{
if (_PathLocale == NULL) {
- char *p = getenv("PATH_LOCALE");
+ char *p = secure_getenv("PATH_LOCALE");
- if (p != NULL && !issetugid()) {
+ if (p != NULL) {
if (strlen(p) + 1/*"/"*/ + ENCODING_LEN +
1/*"/"*/ + CATEGORY_LEN >= PATH_MAX)
return (ENAMETOOLONG);
diff --git a/lib/libc/locale/setlocale.h b/lib/libc/locale/setlocale.h
index c199cdf62daf..c6d6f7b0fac1 100644
--- a/lib/libc/locale/setlocale.h
+++ b/lib/libc/locale/setlocale.h
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (C) 1997 by Andrey A. Chernov, Moscow, Russia.
* 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 _SETLOCALE_H_
diff --git a/lib/libc/locale/setrunelocale.c b/lib/libc/locale/setrunelocale.c
index 551d32b7ab6a..bb89812486fa 100644
--- a/lib/libc/locale/setrunelocale.c
+++ b/lib/libc/locale/setrunelocale.c
@@ -8,7 +8,7 @@
* Paul Borman at Krystal Technologies.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -37,9 +37,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#define __RUNETYPE_INTERNAL 1
#include <runetype.h>
@@ -214,6 +211,8 @@ void *
__ctype_load(const char *locale, locale_t unused __unused)
{
struct xlocale_ctype *l = calloc(sizeof(struct xlocale_ctype), 1);
+ if (l == NULL)
+ return (NULL);
l->header.header.destructor = destruct_ctype;
if (__setrunelocale(l, locale)) {
diff --git a/lib/libc/locale/table.c b/lib/libc/locale/table.c
index 2f790afd4dd8..da600f4a44df 100644
--- a/lib/libc/locale/table.c
+++ b/lib/libc/locale/table.c
@@ -8,7 +8,7 @@
* Paul Borman at Krystal Technologies.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -37,12 +37,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)table.c 8.1 (Berkeley) 6/27/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <ctype.h>
#include <runetype.h>
#include <wchar.h>
diff --git a/lib/libc/locale/toascii.3 b/lib/libc/locale/toascii.3
index 0a11a017b3ae..960b62b3cb1d 100644
--- a/lib/libc/locale/toascii.3
+++ b/lib/libc/locale/toascii.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)toascii.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd June 4, 1993
.Dt TOASCII 3
.Os
diff --git a/lib/libc/locale/tolower.3 b/lib/libc/locale/tolower.3
index 0c6dfd9349fb..dddf1f38f75c 100644
--- a/lib/libc/locale/tolower.3
+++ b/lib/libc/locale/tolower.3
@@ -29,14 +29,12 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)tolower.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd July 25, 2010
+.Dd December 19, 2022
.Dt TOLOWER 3
.Os
.Sh NAME
-.Nm tolower
+.Nm tolower ,
+.Nm tolower_l
.Nd upper case to lower case letter conversion
.Sh LIBRARY
.Lb libc
@@ -44,19 +42,31 @@
.In ctype.h
.Ft int
.Fn tolower "int c"
+.Ft int
+.Fn tolower_l "int c" "locale_t loc"
.Sh DESCRIPTION
The
.Fn tolower
-function converts an upper-case letter to the corresponding lower-case
+and
+.Fn tolower_l
+functions convert an upper-case letter to the corresponding lower-case
letter.
The argument must be representable as an
.Vt "unsigned char"
or the value of
.Dv EOF .
+.Pp
+The
+.Fn tolower_l
+function takes an explicit locale argument, whereas the
+.Fn tolower
+function uses the current global or per-thread locale.
.Sh RETURN VALUES
If the argument is an upper-case letter, the
.Fn tolower
-function returns the corresponding lower-case letter if there is
+and
+.Fn tolower_l
+functions return the corresponding lower-case letter if there is
one; otherwise, the argument is returned unchanged.
.Sh COMPATIBILITY
The
@@ -67,11 +77,17 @@ type in locales with large character sets is considered obsolete
and may not be supported in future releases.
The
.Fn towlower
+or
+.Fn towlower_l
function should be used instead.
.Sh SEE ALSO
.Xr ctype 3 ,
+.Xr ctype_l 3 ,
.Xr islower 3 ,
-.Xr towlower 3
+.Xr islower_l 3 ,
+.Xr towlower 3 ,
+.Xr towlower_l 3 ,
+.Xr xlocale 3
.Sh STANDARDS
The
.Fn tolower
diff --git a/lib/libc/locale/tolower.c b/lib/libc/locale/tolower.c
index 00ac7279fbb4..0401147705c6 100644
--- a/lib/libc/locale/tolower.c
+++ b/lib/libc/locale/tolower.c
@@ -8,7 +8,7 @@
* Paul Borman at Krystal Technologies.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -37,9 +37,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <ctype.h>
#include <stdio.h>
#include <runetype.h>
diff --git a/lib/libc/locale/toupper.3 b/lib/libc/locale/toupper.3
index 5a3cf3fadeff..e0e6b367e8c7 100644
--- a/lib/libc/locale/toupper.3
+++ b/lib/libc/locale/toupper.3
@@ -29,14 +29,12 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)toupper.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd July 25, 2010
+.Dd December 19, 2022
.Dt TOUPPER 3
.Os
.Sh NAME
-.Nm toupper
+.Nm toupper ,
+.Nm toupper_l
.Nd lower case to upper case letter conversion
.Sh LIBRARY
.Lb libc
@@ -44,19 +42,31 @@
.In ctype.h
.Ft int
.Fn toupper "int c"
+.Ft int
+.Fn toupper_l "int c" "locale_t loc"
.Sh DESCRIPTION
The
.Fn toupper
-function converts a lower-case letter to the corresponding
+and
+.Fn toupper_l
+functions convert a lower-case letter to the corresponding
upper-case letter.
The argument must be representable as an
.Vt "unsigned char"
or the value of
.Dv EOF .
+.Pp
+The
+.Fn toupper_l
+function takes an explicit locale argument, whereas the
+.Fn toupper
+function uses the current global or per-thread locale.
.Sh RETURN VALUES
If the argument is a lower-case letter, the
.Fn toupper
-function returns the corresponding upper-case letter if there is
+and
+.Fn toupper_l
+functions return the corresponding upper-case letter if there is
one; otherwise, the argument is returned unchanged.
.Sh COMPATIBILITY
The
@@ -67,11 +77,17 @@ type in locales with large character sets is considered obsolete
and may not be supported in future releases.
The
.Fn towupper
+or
+.Fn towupper_l
function should be used instead.
.Sh SEE ALSO
.Xr ctype 3 ,
+.Xr ctype_l 3 ,
.Xr isupper 3 ,
-.Xr towupper 3
+.Xr isupper_l 3 ,
+.Xr towupper 3 ,
+.Xr towupper_l 3 ,
+.Xr xlocale 3
.Sh STANDARDS
The
.Fn toupper
diff --git a/lib/libc/locale/toupper.c b/lib/libc/locale/toupper.c
index 26bb93f3f2da..bff6c5bf32e3 100644
--- a/lib/libc/locale/toupper.c
+++ b/lib/libc/locale/toupper.c
@@ -8,7 +8,7 @@
* Paul Borman at Krystal Technologies.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -37,9 +37,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <ctype.h>
#include <stdio.h>
#include <runetype.h>
diff --git a/lib/libc/locale/towlower.3 b/lib/libc/locale/towlower.3
index d8742aba1aac..bcc78da10689 100644
--- a/lib/libc/locale/towlower.3
+++ b/lib/libc/locale/towlower.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)tolower.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd October 3, 2002
.Dt TOWLOWER 3
.Os
diff --git a/lib/libc/locale/towupper.3 b/lib/libc/locale/towupper.3
index f139b94a6ef6..f9e9b115b13e 100644
--- a/lib/libc/locale/towupper.3
+++ b/lib/libc/locale/towupper.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)toupper.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd October 3, 2002
.Dt TOWUPPER 3
.Os
diff --git a/lib/libc/locale/uselocale.3 b/lib/libc/locale/uselocale.3
index 96d0008f7837..269430e40da6 100644
--- a/lib/libc/locale/uselocale.3
+++ b/lib/libc/locale/uselocale.3
@@ -1,5 +1,4 @@
.\" Copyright (c) 2011 The FreeBSD Foundation
-.\" All rights reserved.
.\"
.\" This documentation was written by David Chisnall under sponsorship from
.\" the FreeBSD Foundation.
@@ -25,8 +24,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd September 17, 2011
.Dt USELOCALE 3
.Os
diff --git a/lib/libc/locale/utf8.5 b/lib/libc/locale/utf8.5
index ca7f3f81e2f9..890caee1559c 100644
--- a/lib/libc/locale/utf8.5
+++ b/lib/libc/locale/utf8.5
@@ -28,9 +28,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)utf2.4 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd April 7, 2004
.Dt UTF8 5
.Os
diff --git a/lib/libc/locale/utf8.c b/lib/libc/locale/utf8.c
index 13f957989fa2..3eb5f21bc3b3 100644
--- a/lib/libc/locale/utf8.c
+++ b/lib/libc/locale/utf8.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright 2013 Garrett D'Amore <garrett@damore.org>
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
@@ -7,7 +7,7 @@
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -34,8 +34,6 @@
*/
#include <sys/param.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <limits.h>
#include <runetype.h>
diff --git a/lib/libc/locale/wcrtomb.3 b/lib/libc/locale/wcrtomb.3
index bc741740a249..b1881c390c71 100644
--- a/lib/libc/locale/wcrtomb.3
+++ b/lib/libc/locale/wcrtomb.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd May 21, 2013
.Dt WCRTOMB 3
.Os
diff --git a/lib/libc/locale/wcrtomb.c b/lib/libc/locale/wcrtomb.c
index fa5c08474475..ef7d502486b8 100644
--- a/lib/libc/locale/wcrtomb.c
+++ b/lib/libc/locale/wcrtomb.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002-2004 Tim J. Robbins.
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <wchar.h>
#include "mblocal.h"
diff --git a/lib/libc/locale/wcsftime.3 b/lib/libc/locale/wcsftime.3
index 92aee9313f59..473eec567d63 100644
--- a/lib/libc/locale/wcsftime.3
+++ b/lib/libc/locale/wcsftime.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd September 8, 2002
.Dt WCSFTIME 3
.Os
diff --git a/lib/libc/locale/wcsftime.c b/lib/libc/locale/wcsftime.c
index 772c96c2f9f4..f77b4e9a33f8 100644
--- a/lib/libc/locale/wcsftime.c
+++ b/lib/libc/locale/wcsftime.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002 Tim J. Robbins
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <limits.h>
#include <stdlib.h>
diff --git a/lib/libc/locale/wcsnrtombs.c b/lib/libc/locale/wcsnrtombs.c
index 7fdbfc75156d..b7c7738bd85f 100644
--- a/lib/libc/locale/wcsnrtombs.c
+++ b/lib/libc/locale/wcsnrtombs.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright 2013 Garrett D'Amore <garrett@damore.org>
* Copyright 2010 Nexenta Systems, Inc. All rights reserved.
@@ -7,7 +7,7 @@
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -33,9 +33,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <limits.h>
#include <stdlib.h>
#include <string.h>
diff --git a/lib/libc/locale/wcsrtombs.3 b/lib/libc/locale/wcsrtombs.3
index ff607c2dad11..2de5bc956f5c 100644
--- a/lib/libc/locale/wcsrtombs.3
+++ b/lib/libc/locale/wcsrtombs.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd July 21, 2004
.Dt WCSRTOMBS 3
.Os
diff --git a/lib/libc/locale/wcsrtombs.c b/lib/libc/locale/wcsrtombs.c
index 1466eab7046d..f949d9331abb 100644
--- a/lib/libc/locale/wcsrtombs.c
+++ b/lib/libc/locale/wcsrtombs.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002-2004 Tim J. Robbins.
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <limits.h>
#include <stdlib.h>
#include <string.h>
diff --git a/lib/libc/locale/wcstod.3 b/lib/libc/locale/wcstod.3
index f8c5135ee86b..15af283fdd06 100644
--- a/lib/libc/locale/wcstod.3
+++ b/lib/libc/locale/wcstod.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd February 22, 2003
.Dt WCSTOD 3
.Os
diff --git a/lib/libc/locale/wcstod.c b/lib/libc/locale/wcstod.c
index 42d8acdafcdb..94a5ff4612a5 100644
--- a/lib/libc/locale/wcstod.c
+++ b/lib/libc/locale/wcstod.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002 Tim J. Robbins
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdlib.h>
#include <wchar.h>
#include <wctype.h>
diff --git a/lib/libc/locale/wcstof.c b/lib/libc/locale/wcstof.c
index 34117557ee0f..0c2c7946e89b 100644
--- a/lib/libc/locale/wcstof.c
+++ b/lib/libc/locale/wcstof.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002, 2003 Tim J. Robbins
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdlib.h>
#include <wchar.h>
#include <wctype.h>
diff --git a/lib/libc/locale/wcstoimax.c b/lib/libc/locale/wcstoimax.c
index 5e4d9af26a80..29e12f809812 100644
--- a/lib/libc/locale/wcstoimax.c
+++ b/lib/libc/locale/wcstoimax.c
@@ -5,7 +5,7 @@
* The Regents of the University of California. All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -34,15 +34,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "from @(#)strtol.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-__FBSDID("FreeBSD: src/lib/libc/stdlib/strtoimax.c,v 1.8 2002/09/06 11:23:59 tjr Exp ");
-#endif
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <inttypes.h>
#include <stdlib.h>
@@ -80,11 +71,21 @@ wcstoimax_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
c = *s++;
}
if ((base == 0 || base == 16) &&
- c == L'0' && (*s == L'x' || *s == L'X')) {
+ c == L'0' && (*s == L'x' || *s == L'X') &&
+ ((s[1] >= L'0' && s[1] <= L'9') ||
+ (s[1] >= L'A' && s[1] <= L'F') ||
+ (s[1] >= L'a' && s[1] <= L'f'))) {
c = s[1];
s += 2;
base = 16;
}
+ if ((base == 0 || base == 2) &&
+ c == L'0' && (*s == L'b' || *s == L'B') &&
+ (s[1] >= L'0' && s[1] <= L'1')) {
+ c = s[1];
+ s += 2;
+ base = 2;
+ }
if (base == 0)
base = c == L'0' ? 8 : 10;
acc = any = 0;
diff --git a/lib/libc/locale/wcstol.3 b/lib/libc/locale/wcstol.3
index e69a72672d54..725473cebb66 100644
--- a/lib/libc/locale/wcstol.3
+++ b/lib/libc/locale/wcstol.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd September 7, 2002
.Dt WCSTOL 3
.Os
diff --git a/lib/libc/locale/wcstol.c b/lib/libc/locale/wcstol.c
index 98bd5f85a4d1..2b83187347c2 100644
--- a/lib/libc/locale/wcstol.c
+++ b/lib/libc/locale/wcstol.c
@@ -5,7 +5,7 @@
* The Regents of the University of California. All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -34,9 +34,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <ctype.h>
#include <errno.h>
#include <limits.h>
@@ -65,7 +62,7 @@ wcstol_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int
do {
c = *s++;
} while (iswspace_l(c, locale));
- if (c == '-') {
+ if (c == L'-') {
neg = 1;
c = *s++;
} else {
@@ -74,11 +71,21 @@ wcstol_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr, int
c = *s++;
}
if ((base == 0 || base == 16) &&
- c == L'0' && (*s == L'x' || *s == L'X')) {
+ c == L'0' && (*s == L'x' || *s == L'X') &&
+ ((s[1] >= L'0' && s[1] <= L'9') ||
+ (s[1] >= L'A' && s[1] <= L'F') ||
+ (s[1] >= L'a' && s[1] <= L'f'))) {
c = s[1];
s += 2;
base = 16;
}
+ if ((base == 0 || base == 2) &&
+ c == L'0' && (*s == L'b' || *s == L'B') &&
+ (s[1] >= L'0' && s[1] <= L'1')) {
+ c = s[1];
+ s += 2;
+ base = 2;
+ }
if (base == 0)
base = c == L'0' ? 8 : 10;
acc = any = 0;
diff --git a/lib/libc/locale/wcstold.c b/lib/libc/locale/wcstold.c
index c31f84118a2f..1fe7c26ff79a 100644
--- a/lib/libc/locale/wcstold.c
+++ b/lib/libc/locale/wcstold.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002, 2003 Tim J. Robbins
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdlib.h>
#include <wchar.h>
#include <wctype.h>
diff --git a/lib/libc/locale/wcstoll.c b/lib/libc/locale/wcstoll.c
index 6c3184a0de34..01ee701af016 100644
--- a/lib/libc/locale/wcstoll.c
+++ b/lib/libc/locale/wcstoll.c
@@ -5,7 +5,7 @@
* The Regents of the University of California. All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -34,15 +34,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strtoq.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-__FBSDID("FreeBSD: src/lib/libc/stdlib/strtoll.c,v 1.19 2002/09/06 11:23:59 tjr Exp ");
-#endif
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <limits.h>
#include <stdlib.h>
@@ -80,11 +71,21 @@ wcstoll_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
c = *s++;
}
if ((base == 0 || base == 16) &&
- c == L'0' && (*s == L'x' || *s == L'X')) {
+ c == L'0' && (*s == L'x' || *s == L'X') &&
+ ((s[1] >= L'0' && s[1] <= L'9') ||
+ (s[1] >= L'A' && s[1] <= L'F') ||
+ (s[1] >= L'a' && s[1] <= L'f'))) {
c = s[1];
s += 2;
base = 16;
}
+ if ((base == 0 || base == 2) &&
+ c == L'0' && (*s == L'b' || *s == L'B') &&
+ (s[1] >= L'0' && s[1] <= L'1')) {
+ c = s[1];
+ s += 2;
+ base = 2;
+ }
if (base == 0)
base = c == L'0' ? 8 : 10;
acc = any = 0;
diff --git a/lib/libc/locale/wcstombs.3 b/lib/libc/locale/wcstombs.3
index 0f216f62d11a..82476de25427 100644
--- a/lib/libc/locale/wcstombs.3
+++ b/lib/libc/locale/wcstombs.3
@@ -28,10 +28,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 @(#)multibyte.3 8.1 (Berkeley) 6/4/93
.\" From FreeBSD: src/lib/libc/locale/multibyte.3,v 1.22 2003/11/08 03:23:11 tjr Exp
-.\" $FreeBSD$
.\"
.Dd April 8, 2004
.Dt WCSTOMBS 3
diff --git a/lib/libc/locale/wcstombs.c b/lib/libc/locale/wcstombs.c
index a34b58ecdb05..962614bf88f3 100644
--- a/lib/libc/locale/wcstombs.c
+++ b/lib/libc/locale/wcstombs.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002-2004 Tim J. Robbins.
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <limits.h>
#include <stdlib.h>
#include <wchar.h>
diff --git a/lib/libc/locale/wcstoul.c b/lib/libc/locale/wcstoul.c
index b550e869f7c5..b4fa4d439e10 100644
--- a/lib/libc/locale/wcstoul.c
+++ b/lib/libc/locale/wcstoul.c
@@ -5,7 +5,7 @@
* The Regents of the University of California. All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -34,9 +34,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <ctype.h>
#include <errno.h>
#include <limits.h>
@@ -74,11 +71,21 @@ wcstoul_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
c = *s++;
}
if ((base == 0 || base == 16) &&
- c == L'0' && (*s == L'x' || *s == L'X')) {
+ c == L'0' && (*s == L'x' || *s == L'X') &&
+ ((s[1] >= L'0' && s[1] <= L'9') ||
+ (s[1] >= L'A' && s[1] <= L'F') ||
+ (s[1] >= L'a' && s[1] <= L'f'))) {
c = s[1];
s += 2;
base = 16;
}
+ if ((base == 0 || base == 2) &&
+ c == L'0' && (*s == L'b' || *s == L'B') &&
+ (s[1] >= L'0' && s[1] <= L'1')) {
+ c = s[1];
+ s += 2;
+ base = 2;
+ }
if (base == 0)
base = c == L'0' ? 8 : 10;
acc = any = 0;
diff --git a/lib/libc/locale/wcstoull.c b/lib/libc/locale/wcstoull.c
index 6a04d213ff9b..db77acd2a55d 100644
--- a/lib/libc/locale/wcstoull.c
+++ b/lib/libc/locale/wcstoull.c
@@ -5,7 +5,7 @@
* The Regents of the University of California. All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -34,15 +34,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strtouq.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-__FBSDID("FreeBSD: src/lib/libc/stdlib/strtoull.c,v 1.18 2002/09/06 11:23:59 tjr Exp ");
-#endif
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <limits.h>
#include <stdlib.h>
@@ -80,11 +71,21 @@ wcstoull_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
c = *s++;
}
if ((base == 0 || base == 16) &&
- c == L'0' && (*s == L'x' || *s == L'X')) {
+ c == L'0' && (*s == L'x' || *s == L'X') &&
+ ((s[1] >= L'0' && s[1] <= L'9') ||
+ (s[1] >= L'A' && s[1] <= L'F') ||
+ (s[1] >= L'a' && s[1] <= L'f'))) {
c = s[1];
s += 2;
base = 16;
}
+ if ((base == 0 || base == 2) &&
+ c == L'0' && (*s == L'b' || *s == L'B') &&
+ (s[1] >= L'0' && s[1] <= L'1')) {
+ c = s[1];
+ s += 2;
+ base = 2;
+ }
if (base == 0)
base = c == L'0' ? 8 : 10;
acc = any = 0;
diff --git a/lib/libc/locale/wcstoumax.c b/lib/libc/locale/wcstoumax.c
index 0c1cd0b4b8dc..6a3861618e3e 100644
--- a/lib/libc/locale/wcstoumax.c
+++ b/lib/libc/locale/wcstoumax.c
@@ -5,7 +5,7 @@
* The Regents of the University of California. All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -34,15 +34,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "from @(#)strtoul.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-__FBSDID("FreeBSD: src/lib/libc/stdlib/strtoumax.c,v 1.8 2002/09/06 11:23:59 tjr Exp ");
-#endif
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <inttypes.h>
#include <stdlib.h>
@@ -80,11 +71,21 @@ wcstoumax_l(const wchar_t * __restrict nptr, wchar_t ** __restrict endptr,
c = *s++;
}
if ((base == 0 || base == 16) &&
- c == L'0' && (*s == L'x' || *s == L'X')) {
+ c == L'0' && (*s == L'x' || *s == L'X') &&
+ ((s[1] >= L'0' && s[1] <= L'9') ||
+ (s[1] >= L'A' && s[1] <= L'F') ||
+ (s[1] >= L'a' && s[1] <= L'f'))) {
c = s[1];
s += 2;
base = 16;
}
+ if ((base == 0 || base == 2) &&
+ c == L'0' && (*s == L'b' || *s == L'B') &&
+ (s[1] >= L'0' && s[1] <= L'1')) {
+ c = s[1];
+ s += 2;
+ base = 2;
+ }
if (base == 0)
base = c == L'0' ? 8 : 10;
acc = any = 0;
diff --git a/lib/libc/locale/wctob.c b/lib/libc/locale/wctob.c
index b43761c48d45..9ae1aa003331 100644
--- a/lib/libc/locale/wctob.c
+++ b/lib/libc/locale/wctob.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002-2004 Tim J. Robbins.
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <limits.h>
#include <stdio.h>
#include <wchar.h>
diff --git a/lib/libc/locale/wctomb.3 b/lib/libc/locale/wctomb.3
index e70a2bde71d0..bd6ea0f36519 100644
--- a/lib/libc/locale/wctomb.3
+++ b/lib/libc/locale/wctomb.3
@@ -28,10 +28,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 @(#)multibyte.3 8.1 (Berkeley) 6/4/93
.\" From FreeBSD: src/lib/libc/locale/multibyte.3,v 1.22 2003/11/08 03:23:11 tjr Exp
-.\" $FreeBSD$
.\"
.Dd April 8, 2004
.Dt WCTOMB 3
diff --git a/lib/libc/locale/wctomb.c b/lib/libc/locale/wctomb.c
index 820021a3e0ab..7138ae7df3a2 100644
--- a/lib/libc/locale/wctomb.c
+++ b/lib/libc/locale/wctomb.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002-2004 Tim J. Robbins.
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdlib.h>
#include <wchar.h>
#include "mblocal.h"
diff --git a/lib/libc/locale/wctrans.3 b/lib/libc/locale/wctrans.3
index ce3e68c9eb34..df0de9c4332d 100644
--- a/lib/libc/locale/wctrans.3
+++ b/lib/libc/locale/wctrans.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd October 3, 2002
.Dt WCTRANS 3
.Os
diff --git a/lib/libc/locale/wctrans.c b/lib/libc/locale/wctrans.c
index 36cb25e45549..9d2371814560 100644
--- a/lib/libc/locale/wctrans.c
+++ b/lib/libc/locale/wctrans.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002 Tim J. Robbins.
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <string.h>
#include <wctype.h>
diff --git a/lib/libc/locale/wctype.3 b/lib/libc/locale/wctype.3
index 099631d51790..41ac77d38648 100644
--- a/lib/libc/locale/wctype.3
+++ b/lib/libc/locale/wctype.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd March 27, 2004
.Dt WCTYPE 3
.Os
diff --git a/lib/libc/locale/wctype.c b/lib/libc/locale/wctype.c
index dd8f218306b2..1b3ac054bc0b 100644
--- a/lib/libc/locale/wctype.c
+++ b/lib/libc/locale/wctype.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002 Tim J. Robbins.
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <ctype.h>
#include <string.h>
#include <wctype.h>
diff --git a/lib/libc/locale/wcwidth.3 b/lib/libc/locale/wcwidth.3
index 0c7c74fed155..28d39e949ca3 100644
--- a/lib/libc/locale/wcwidth.3
+++ b/lib/libc/locale/wcwidth.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd August 17, 2004
.Dt WCWIDTH 3
.Os
diff --git a/lib/libc/locale/wcwidth.c b/lib/libc/locale/wcwidth.c
index 53145e9b8254..118680d4f2bd 100644
--- a/lib/libc/locale/wcwidth.c
+++ b/lib/libc/locale/wcwidth.c
@@ -13,7 +13,7 @@
* Paul Borman at Krystal Technologies.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -42,9 +42,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <wchar.h>
#include <wctype.h>
#include <xlocale.h>
diff --git a/lib/libc/locale/xlocale.3 b/lib/libc/locale/xlocale.3
index da217c601100..3af7a38a76d1 100644
--- a/lib/libc/locale/xlocale.3
+++ b/lib/libc/locale/xlocale.3
@@ -1,5 +1,4 @@
.\" Copyright (c) 2011 The FreeBSD Foundation
-.\" All rights reserved.
.\"
.\" This documentation was written by David Chisnall under sponsorship from
.\" the FreeBSD Foundation.
@@ -25,8 +24,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd September 17, 2011
.Dt XLOCALE 3
.Os
@@ -169,10 +166,10 @@ along with the headers that expose them, is provided here:
.Xr vsprintf_l 3 ,
.Xr vsscanf_l 3
.It In stdlib.h
-.Xr atof_l 3 ,
-.Xr atoi_l 3 ,
-.Xr atol_l 3 ,
-.Xr atoll_l 3 ,
+.\".Xr atof_l 3 ,
+.\".Xr atoi_l 3 ,
+.\".Xr atol_l 3 ,
+.\".Xr atoll_l 3 ,
.Xr mblen_l 3 ,
.Xr mbstowcs_l 3 ,
.Xr mbtowc_l 3 ,
@@ -181,10 +178,8 @@ along with the headers that expose them, is provided here:
.Xr strtol_l 3 ,
.Xr strtold_l 3 ,
.Xr strtoll_l 3 ,
-.Xr strtoq_l 3 ,
.Xr strtoul_l 3 ,
.Xr strtoull_l 3 ,
-.Xr strtouq_l 3 ,
.Xr wcstombs_l 3 ,
.Xr wctomb_l 3
.It In string.h
diff --git a/lib/libc/locale/xlocale.c b/lib/libc/locale/xlocale.c
index d64262da809e..0a95fda83aeb 100644
--- a/lib/libc/locale/xlocale.c
+++ b/lib/libc/locale/xlocale.c
@@ -1,8 +1,7 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2011 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$
*/
#include <pthread.h>
@@ -64,13 +61,12 @@ _Thread_local locale_t __thread_locale;
* Flag indicating that one or more per-thread locales exist.
*/
int __has_thread_locale;
+
/*
* Private functions in setlocale.c.
*/
-const char *
-__get_locale_env(int category);
-int
-__detect_path_locale(void);
+const char *__get_locale_env(int category);
+int __detect_path_locale(void);
struct _xlocale __xlocale_global_locale = {
{0},
@@ -101,7 +97,7 @@ struct _xlocale __xlocale_C_locale = {
0
};
-static void*(*constructors[])(const char*, locale_t) =
+static void *(*constructors[])(const char *, locale_t) =
{
__collate_load,
__ctype_load,
@@ -115,13 +111,19 @@ static pthread_key_t locale_info_key;
static int fake_tls;
static locale_t thread_local_locale;
-static void init_key(void)
+static void
+init_key(void)
{
+ int error;
- pthread_key_create(&locale_info_key, xlocale_release);
- pthread_setspecific(locale_info_key, (void*)42);
- if (pthread_getspecific(locale_info_key) == (void*)42) {
- pthread_setspecific(locale_info_key, 0);
+ error = pthread_key_create(&locale_info_key, xlocale_release);
+ if (error == 0) {
+ pthread_setspecific(locale_info_key, (void*)42);
+ if (pthread_getspecific(locale_info_key) == (void*)42) {
+ pthread_setspecific(locale_info_key, 0);
+ } else {
+ fake_tls = 1;
+ }
} else {
fake_tls = 1;
}
@@ -139,7 +141,7 @@ get_thread_locale(void)
_once(&once_control, init_key);
return (fake_tls ? thread_local_locale :
- pthread_getspecific(locale_info_key));
+ pthread_getspecific(locale_info_key));
}
static void
@@ -193,11 +195,15 @@ alloc_locale(void)
{
locale_t new = calloc(sizeof(struct _xlocale), 1);
+ if (new == NULL)
+ return (NULL);
+
new->header.destructor = destruct_locale;
new->monetary_locale_changed = 1;
new->numeric_locale_changed = 1;
return (new);
}
+
static void
copyflags(locale_t new, locale_t old)
{
@@ -207,7 +213,8 @@ copyflags(locale_t new, locale_t old)
new->using_messages_locale = old->using_messages_locale;
}
-static int dupcomponent(int type, locale_t base, locale_t new)
+static int
+dupcomponent(int type, locale_t base, locale_t new)
{
/* Always copy from the global locale, since it has mutable components.
*/
@@ -238,7 +245,8 @@ static int dupcomponent(int type, locale_t base, locale_t new)
* xlocale interface.
*/
-locale_t newlocale(int mask, const char *locale, locale_t base)
+locale_t
+newlocale(int mask, const char *locale, locale_t base)
{
locale_t orig_base;
int type;
@@ -246,13 +254,13 @@ locale_t newlocale(int mask, const char *locale, locale_t base)
int useenv = 0;
int success = 1;
- _once(&once_control, init_key);
-
locale_t new = alloc_locale();
if (NULL == new) {
return (NULL);
}
+ _once(&once_control, init_key);
+
orig_base = base;
FIX_LOCALE(base);
copyflags(new, base);
@@ -295,17 +303,18 @@ locale_t newlocale(int mask, const char *locale, locale_t base)
return (new);
}
-locale_t duplocale(locale_t base)
+locale_t
+duplocale(locale_t base)
{
locale_t new = alloc_locale();
int type;
- _once(&once_control, init_key);
-
if (NULL == new) {
return (NULL);
}
+ _once(&once_control, init_key);
+
FIX_LOCALE(base);
copyflags(new, base);
@@ -338,7 +347,8 @@ freelocale(locale_t loc)
* Returns the name or version of the locale for a particular component of a
* locale_t.
*/
-const char *querylocale(int mask, locale_t loc)
+const char *
+querylocale(int mask, locale_t loc)
{
int type = ffs(mask & ~LC_VERSION_MASK) - 1;
FIX_LOCALE(loc);
@@ -358,7 +368,8 @@ const char *querylocale(int mask, locale_t loc)
/*
* Installs the specified locale_t as this thread's locale.
*/
-locale_t uselocale(locale_t loc)
+locale_t
+uselocale(locale_t loc)
{
locale_t old = get_thread_locale();
if (NULL != loc) {
diff --git a/lib/libc/locale/xlocale_private.h b/lib/libc/locale/xlocale_private.h
index bc40f28fc9eb..ef1a8687a376 100644
--- a/lib/libc/locale/xlocale_private.h
+++ b/lib/libc/locale/xlocale_private.h
@@ -1,8 +1,7 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2011 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_PRIVATE__H_
@@ -164,7 +161,10 @@ xlocale_release(void *val)
/**
* Load functions. Each takes the name of a locale and a pointer to the data
- * to be initialised as arguments. Two special values are allowed for the
+ * to be initialised as arguments. Three special values are allowed for the
+ * name of the locale: C, POSIX, and C.UTF-8. When these are used, we may
+ * use some statically defined tables rather than allocating memory for the
+ * locales' use.
*/
extern void* __collate_load(const char*, locale_t);
extern void* __ctype_load(const char*, locale_t);
diff --git a/lib/libc/md/Makefile.inc b/lib/libc/md/Makefile.inc
index 3f173c866d1d..e7bf932c1ffe 100644
--- a/lib/libc/md/Makefile.inc
+++ b/lib/libc/md/Makefile.inc
@@ -1,4 +1,3 @@
-# $FreeBSD$
.PATH: ${SRCTOP}/lib/libmd
diff --git a/lib/libc/mips/Makefile.inc b/lib/libc/mips/Makefile.inc
deleted file mode 100644
index f340477ad22a..000000000000
--- a/lib/libc/mips/Makefile.inc
+++ /dev/null
@@ -1,5 +0,0 @@
-# $NetBSD: Makefile.inc,v 1.7 2005/09/17 11:49:39 tsutsui Exp $
-# $FreeBSD$
-
-SRCS+= machdep_ldisd.c
-SYM_MAPS+= ${LIBC_SRCTOP}/mips/Symbol.map
diff --git a/lib/libc/mips/SYS.h b/lib/libc/mips/SYS.h
deleted file mode 100644
index c4767a5cd96b..000000000000
--- a/lib/libc/mips/SYS.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/* $NetBSD: SYS.h,v 1.19 2009/12/14 01:07:41 matt Exp $ */
-/* $FreeBSD$ */
-
-/*-
- * SPDX-License-Identifier: (BSD-4-Clause AND BSD-3-Clause)
- *
- * Copyright (c) 1996 Jonathan Stone
- * All rights reserved.
- *
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Jonathan Stone for
- * the NetBSD Project.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
- */
-
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- *
- * from: @(#)SYS.h 8.1 (Berkeley) 6/4/93
- */
-
-#include <sys/syscall.h>
-
-#include <machine/asm.h>
-
-/*
- * If compiling for shared libs, Emit sysV ABI PIC segment pseudo-ops.
- *
- * i) Emit .abicalls before .LEAF entrypoint, and .cpload/.cprestore after.
- * ii) Do interprocedure jumps indirectly via t9, with the side-effect of
- * preserving the callee's entry address in t9.
- */
-#ifdef __ABICALLS__
- .abicalls
-# if defined(__mips_o32) || defined(__mips_o64)
-# define PIC_PROLOGUE(x) SETUP_GP
-# define PIC_TAILCALL(l) PTR_LA t9, _C_LABEL(l); jr t9
-# define PIC_RETURN() j ra
-# else
-# define PIC_PROLOGUE(x) SETUP_GP64(t3, x)
-# define PIC_TAILCALL(l) PTR_LA t9, _C_LABEL(l); RESTORE_GP64; jr t9
-# define PIC_RETURN() RESTORE_GP64; j ra
-# endif
-#else
-# define PIC_PROLOGUE(x)
-# define PIC_TAILCALL(l) j _C_LABEL(l)
-# define PIC_RETURN() j ra
-#endif /* __ABICALLS__ */
-
-# define SYSTRAP(x) li v0,SYS_ ## x; syscall;
-
-/*
- * Do a syscall that cannot fail (sync, get{p,u,g,eu,eg)id)
- */
-#define RSYSCALL_NOERROR(x) \
-LEAF(__sys_ ## x); \
- .weak _C_LABEL(x); \
- _C_LABEL(x) = _C_LABEL(__CONCAT(__sys_,x)); \
- .weak _C_LABEL(__CONCAT(_,x)); \
- _C_LABEL(__CONCAT(_,x)) = _C_LABEL(__CONCAT(__sys_,x)); \
- SYSTRAP(x); \
- j ra; \
-END(__sys_ ## x)
-
-/*
- * Do a normal syscall.
- */
-#define RSYSCALL(x) \
-LEAF(__sys_ ## x); \
- .weak _C_LABEL(x); \
- _C_LABEL(x) = _C_LABEL(__CONCAT(__sys_,x)); \
- .weak _C_LABEL(__CONCAT(_,x)); \
- _C_LABEL(__CONCAT(_,x)) = _C_LABEL(__CONCAT(__sys_,x)); \
- PIC_PROLOGUE(__sys_ ## x); \
- SYSTRAP(x); \
- bne a3,zero,err; \
- PIC_RETURN(); \
-err: \
- PIC_TAILCALL(__cerror); \
-END(__sys_ ## x)
-
-/*
- * Do a renamed or pseudo syscall (e.g., _exit()), where the entrypoint
- * and syscall name are not the same.
- */
-#define PSEUDO_NOERROR(x) \
-LEAF(__sys_ ## x); \
- .weak _C_LABEL(__CONCAT(_,x)); \
- _C_LABEL(__CONCAT(_,x)) = _C_LABEL(__CONCAT(__sys_,x)); \
- SYSTRAP(x); \
- j ra; \
-END(__sys_ ## x)
-
-#define PSEUDO(x) \
-LEAF(__sys_ ## x); \
- .weak _C_LABEL(__CONCAT(_,x)); \
- _C_LABEL(__CONCAT(_,x)) = _C_LABEL(__CONCAT(__sys_,x)); \
- PIC_PROLOGUE(__sys_ ## x); \
- SYSTRAP(x); \
- bne a3,zero,err; \
- PIC_RETURN(); \
-err: \
- PIC_TAILCALL(__cerror); \
-END(__sys_ ## x)
diff --git a/lib/libc/mips/Symbol.map b/lib/libc/mips/Symbol.map
deleted file mode 100644
index b66a26cd91dc..000000000000
--- a/lib/libc/mips/Symbol.map
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * $FreeBSD$
- */
-
-/*
- * This only needs to contain symbols that are not listed in
- * symbol maps from other parts of libc (i.e., not found in
- * stdlib/Symbol.map, string/Symbol.map, sys/Symbol.map, ...).
- */
-FBSD_1.0 {
- /* PSEUDO syscalls */
- _exit;
-
- _mcount;
- _setjmp;
- _longjmp;
- alloca;
- fabs;
- __infinity;
- __nan;
- makecontext;
- setjmp;
- longjmp;
- sigsetjmp;
- siglongjmp;
- htonl;
- htons;
- ntohl;
- ntohs;
- vfork;
- brk;
- sbrk;
-};
-
-FBSD_1.3 {
- __flt_rounds;
-};
-
-FBSDprivate_1.0 {
- /* PSEUDO syscalls */
- _getlogin;
-
- _set_tp;
- ___longjmp;
- __makecontext;
- __longjmp;
- signalcontext;
- _signalcontext;
- __siglongjmp;
- _vfork;
- _brk;
- _sbrk;
-};
diff --git a/lib/libc/mips/arith.h b/lib/libc/mips/arith.h
deleted file mode 100644
index 61f3930f4a89..000000000000
--- a/lib/libc/mips/arith.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * MD header for contrib/gdtoa
- *
- * $FreeBSD$
- */
-
-/*
- * NOTE: The definitions in this file must be correct or strtod(3) and
- * floating point formats in printf(3) will break! The file can be
- * generated by running contrib/gdtoa/arithchk.c on the target
- * architecture. See contrib/gdtoa/gdtoaimp.h for details.
- */
-#include <machine/endian.h>
-
-#if BYTE_ORDER == BIG_ENDIAN
-#define IEEE_MC68k
-#define Arith_Kind_ASL 2
-#define Double_Align
-#else
-/* TODO: Generate these values on a LE machine */
-#define IEEE_8087
-#define Arith_Kind_ASL 1
-#define Long int
-#define Intcast (int)(long)
-#define Double_Align
-#endif
diff --git a/lib/libc/mips/gd_qnan.h b/lib/libc/mips/gd_qnan.h
deleted file mode 100644
index 69eeaf988fa0..000000000000
--- a/lib/libc/mips/gd_qnan.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * MD header for contrib/gdtoa
- *
- * This file can be generated by compiling and running contrib/gdtoa/qnan.c
- * on the target architecture after arith.h has been generated.
- *
- * $FreeBSD$
- */
-
-
-#include <machine/endian.h>
-
-#if BYTE_ORDER == BIG_ENDIAN
-/* These values were gained on a running
- * Octeon in Big Endian order. They were gotten
- * by running ./qnan after arithchk was ran and
- * got us the proper values for arith.h.
- */
-#define f_QNAN 0x7f900000
-#define d_QNAN0 0x7ff80000
-#define d_QNAN1 0x0
-#define ld_QNAN0 0x7ff80000
-#define ld_QNAN1 0x0
-#define ld_QNAN2 0x0
-#define ld_QNAN3 0x0
-#define ldus_QNAN0 0x7ff8
-#define ldus_QNAN1 0x0
-#define ldus_QNAN2 0x0
-#define ldus_QNAN3 0x0
-#define ldus_QNAN4 0x0
-#else
-/* FIX FIX, need to run this on a Little Endian
- * machine and get the proper values, these here
- * were stolen fromn i386/gd_qnan.h
- */
-#define f_QNAN 0x7fc00000
-#define d_QNAN0 0x0
-#define d_QNAN1 0x7ff80000
-#define ld_QNAN0 0x0
-#define ld_QNAN1 0xc0000000
-#define ld_QNAN2 0x7fff
-#define ld_QNAN3 0x0
-#define ldus_QNAN0 0x0
-#define ldus_QNAN1 0x0
-#define ldus_QNAN2 0x0
-#define ldus_QNAN3 0xc000
-#define ldus_QNAN4 0x7fff
-#endif
diff --git a/lib/libc/mips/gen/Makefile.inc b/lib/libc/mips/gen/Makefile.inc
deleted file mode 100644
index d2dc9b5f4bdb..000000000000
--- a/lib/libc/mips/gen/Makefile.inc
+++ /dev/null
@@ -1,11 +0,0 @@
-# $NetBSD: Makefile.inc,v 1.27 2005/10/07 17:16:40 tsutsui Exp $
-# $FreeBSD$
-
-SRCS+= infinity.c fabs.c ldexp.c flt_rounds.c
-
-# SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
-# fpsetround.c fpsetsticky.c
-
-SRCS+= _ctx_start.S _get_tp.c _set_tp.c _setjmp.S makecontext.c \
- setjmp.S signalcontext.c sigsetjmp.S \
- trivial-getcontextx.c
diff --git a/lib/libc/mips/gen/_ctx_start.S b/lib/libc/mips/gen/_ctx_start.S
deleted file mode 100644
index f1f5cdc32641..000000000000
--- a/lib/libc/mips/gen/_ctx_start.S
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * Copyright (c) 2010 Juli Mallett.
- * All rights reserved.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-/*
- * This requires makecontext() to setup a valid GP for locating
- * _ctx_done rather than deriving GP from T9 on entry. Currently this
- * uses the GP inherited from getcontext() assuming that getcontext()
- * is in the same shared object as _ctx_done(). For N32 and N64, GP
- * is caller-save so will be preserved across the call to the callback
- * function. For O32, GP is callee-save, so save it in a different
- * caller-save register (S1) while invoking the callback. This is
- * done instead of the usual SETUP_GP/SAVE_GP to avoid disturbing the
- * stack frame setup by makecontext() for the callback function.
- */
-ENTRY(_ctx_start)
-#ifdef __mips_o32
- move s1, gp
-#endif
- jalr t9
-
-#ifdef __mips_o32
- move gp, s1
-#endif
- move a0, s0
- PTR_LA t9, _ctx_done
- jalr t9
-
- break 0
-END(_ctx_start)
diff --git a/lib/libc/mips/gen/_get_tp.c b/lib/libc/mips/gen/_get_tp.c
deleted file mode 100644
index 45c5f8f35d42..000000000000
--- a/lib/libc/mips/gen/_get_tp.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 2021 The FreeBSD Foundation
- *
- * This software were developed by Konstantin Belousov
- * under sponsorship from the FreeBSD Foundation.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <string.h>
-#include <stdint.h>
-#include <machine/sysarch.h>
-#include <machine/tls.h>
-
-#include "libc_private.h"
-
-#ifdef __mips_n64
-static void *
-_mips_get_tls(void)
-{
- uint64_t _rv;
-
- __asm__ __volatile__ (
- ".set\tpush\n\t"
- ".set\tmips64r2\n\t"
- "rdhwr\t%0, $29\n\t"
- ".set\tpop"
- : "=r" (_rv));
- /*
- * XXXSS See 'git show c6be4f4d2d1b71c04de5d3bbb6933ce2dbcdb317'
- *
- * Remove the offset since this really a request to get the TLS
- * pointer via sysarch() (in theory). Of course, this may go away
- * once the TLS code is rewritten.
- */
- _rv = _rv - TLS_TP_OFFSET - TLS_TCB_SIZE;
-
- return (void *)_rv;
-}
-
-#else /* mips 32 */
-
-static void *
-_mips_get_tls(void)
-{
- uint32_t _rv;
-
- __asm__ __volatile__ (
- ".set\tpush\n\t"
- ".set\tmips32r2\n\t"
- "rdhwr\t%0, $29\n\t"
- ".set\tpop"
- : "=r" (_rv));
- /*
- * XXXSS See 'git show c6be4f4d2d1b71c04de5d3bbb6933ce2dbcdb317'
- *
- * Remove the offset since this really a request to get the TLS
- * pointer via sysarch() (in theory). Of course, this may go away
- * once the TLS code is rewritten.
- */
- _rv = _rv - TLS_TP_OFFSET - TLS_TCB_SIZE;
-
- return (void *)_rv;
-}
-#endif /* ! __mips_n64 */
-
-void *
-_get_tp(void)
-{
- void *res;
-
-#ifdef TLS_USE_SYSARCH
- sysarch(MIPS_GET_TLS, &res);
-#else
- res = _mips_get_tls();
-#endif
- return (res);
-}
diff --git a/lib/libc/mips/gen/_set_tp.c b/lib/libc/mips/gen/_set_tp.c
deleted file mode 100644
index d20a55149a53..000000000000
--- a/lib/libc/mips/gen/_set_tp.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 2004 Doug Rabson
- * All rights reserved.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- *
- * $FreeBSD$
- */
-
-#include <string.h>
-#include <stdint.h>
-
-#include <machine/sysarch.h>
-#include "libc_private.h"
-
-void
-_set_tp(void *tp)
-{
-
- sysarch(MIPS_SET_TLS, tp);
-}
diff --git a/lib/libc/mips/gen/_setjmp.S b/lib/libc/mips/gen/_setjmp.S
deleted file mode 100644
index 10c4cda5e0c1..000000000000
--- a/lib/libc/mips/gen/_setjmp.S
+++ /dev/null
@@ -1,200 +0,0 @@
-/* $NetBSD: _setjmp.S,v 1.20.34.5 2010/02/03 23:46:47 matt Exp $ */
-
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#include "SYS.h"
-
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
- RCSID("from: @(#)_setjmp.s 8.1 (Berkeley) 6/4/93")
-#else
- RCSID("$NetBSD: _setjmp.S,v 1.20.34.5 2010/02/03 23:46:47 matt Exp $")
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-/*
- * C library -- _setjmp, _longjmp
- *
- * _longjmp(a,v)
- * will generate a "return(v)" from
- * the last call to
- * _setjmp(a)
- * by restoring registers from the stack,
- * The previous signal state is NOT restored.
- */
-
- .set noreorder
-
-LEAF(_setjmp)
- REG_PROLOGUE
- REG_LI v0, _JB_MAGIC__SETJMP # sigcontext magic number
- REG_S v0, (_JB_MAGIC * SZREG)(a0)
- REG_S ra, (_JB_REG_RA * SZREG)(a0)
- /*
- * From "MIPSpro N32 ABI Handbook", Table 2-1:
- * Registers s0..s7 are callee-saved.
- * The sp register is callee-saved.
- * The fp (or s8) register is callee-saved.
- * The gp register is callee-saved (for n32/n64).
- */
- REG_S s0, (_JB_REG_S0 * SZREG)(a0)
- REG_S s1, (_JB_REG_S1 * SZREG)(a0)
- REG_S s2, (_JB_REG_S2 * SZREG)(a0)
- REG_S s3, (_JB_REG_S3 * SZREG)(a0)
- REG_S s4, (_JB_REG_S4 * SZREG)(a0)
- REG_S s5, (_JB_REG_S5 * SZREG)(a0)
- REG_S s6, (_JB_REG_S6 * SZREG)(a0)
- REG_S s7, (_JB_REG_S7 * SZREG)(a0)
- REG_S sp, (_JB_REG_SP * SZREG)(a0)
- REG_S s8, (_JB_REG_S8 * SZREG)(a0)
-#if defined(__mips_n32) || defined(__mips_n64)
- REG_S gp, (_JB_REG_GP * SZREG)(a0) # newabi gp is callee-saved
-#endif
- /*
- * From "MIPSpro N32 ABI Handbook", Table 2-1:
- * In N32, FP registers F20, F22, F24, F26, F28, F30 are callee-saved.
- * In N64, FP registers F24 .. F31 are callee-saved.
- * In O32, FP registers F20 .. F23 are callee-saved.
- */
-#ifndef __mips_soft_float
- cfc1 v0, $31 # too bad can't check if FP used
-#if defined(__mips_n64) || defined(__mips_n32)
- FP_S $f30, (_JB_FPREG_F30 * SZREG)(a0)
- FP_S $f28, (_JB_FPREG_F28 * SZREG)(a0)
- FP_S $f26, (_JB_FPREG_F26 * SZREG)(a0)
- FP_S $f24, (_JB_FPREG_F24 * SZREG)(a0)
-#endif
-#if defined(__mips_n32) || defined(__mips_o32) || defined(__mips_o64)
- FP_S $f22, (_JB_FPREG_F22 * SZREG)(a0)
- FP_S $f20, (_JB_FPREG_F20 * SZREG)(a0)
-#endif
-#if defined(__mips_o32) || defined(__mips_o64)
- FP_S $f21, (_JB_FPREG_F21 * SZREG)(a0)
- FP_S $f23, (_JB_FPREG_F23 * SZREG)(a0)
-#endif
-#if defined(__mips_n64)
- FP_S $f25, (_JB_FPREG_F25 * SZREG)(a0)
- FP_S $f27, (_JB_FPREG_F27 * SZREG)(a0)
- FP_S $f29, (_JB_FPREG_F29 * SZREG)(a0)
- FP_S $f31, (_JB_FPREG_F31 * SZREG)(a0)
-#endif
- INT_S v0, (_JB_FPREG_FCSR * SZREG)(a0)
-#endif /* ! __mips_soft_float */
- REG_EPILOGUE
-
- j ra
- move v0, zero
-END(_setjmp)
-
-LEAF(_longjmp)
- PIC_PROLOGUE(_longjmp)
- PTR_SUBU sp, sp, CALLFRAME_SIZ
- SAVE_GP(CALLFRAME_GP)
-
- REG_PROLOGUE
- REG_L v0, (_JB_MAGIC * SZREG)(a0) # get magic number
- REG_L ra, (_JB_REG_RA * SZREG)(a0)
- REG_LI t0, _JB_MAGIC__SETJMP
- bne v0, t0, botch # jump if error
- PTR_ADDU sp, sp, CALLFRAME_SIZ # does not matter, sanity
- /*
- * From "MIPSpro N32 ABI Handbook", Table 2-1:
- * Registers s0..s7 are callee-saved.
- * The sp register is callee-saved.
- * The fp (or s8) register is callee-saved.
- * The gp register is callee-saved (for n32/n64).
- */
- REG_L s0, (_JB_REG_S0 * SZREG)(a0)
- REG_L s1, (_JB_REG_S1 * SZREG)(a0)
- REG_L s2, (_JB_REG_S2 * SZREG)(a0)
- REG_L s3, (_JB_REG_S3 * SZREG)(a0)
- REG_L s4, (_JB_REG_S4 * SZREG)(a0)
- REG_L s5, (_JB_REG_S5 * SZREG)(a0)
- REG_L s6, (_JB_REG_S6 * SZREG)(a0)
- REG_L s7, (_JB_REG_S7 * SZREG)(a0)
- REG_L sp, (_JB_REG_SP * SZREG)(a0)
- REG_L s8, (_JB_REG_S8 * SZREG)(a0)
-#if defined(__mips_n32) || defined(__mips_n64)
- REG_L gp, (_JB_REG_GP * SZREG)(a0)
-#endif
-#ifndef __mips_soft_float
- # get fpu status
- INT_L v0, (_JB_FPREG_FCSR * SZREG)(a0)
- ctc1 v0, $31
- /*
- * From "MIPSpro N32 ABI Handbook", Table 2-1:
- * In N32, FP registers F20, F22, F24, F26, F28, F30 are callee-saved.
- * In N64, FP registers F24 .. F31 are callee-saved.
- * In O32, FP registers F20 .. F23 are callee-saved.
- */
-#if defined(__mips_n64) || defined(__mips_n32)
- FP_L $f30, (_JB_FPREG_F30 * SZREG)(a0)
- FP_L $f28, (_JB_FPREG_F28 * SZREG)(a0)
- FP_L $f26, (_JB_FPREG_F26 * SZREG)(a0)
- FP_L $f24, (_JB_FPREG_F24 * SZREG)(a0)
-#endif
-#if defined(__mips_n32) || defined(__mips_o32) || defined(__mips_o64)
- FP_L $f22, (_JB_FPREG_F22 * SZREG)(a0)
- FP_L $f20, (_JB_FPREG_F20 * SZREG)(a0)
-#endif
-#if defined(__mips_o32) || defined(__mips_o64)
- FP_L $f21, (_JB_FPREG_F21 * SZREG)(a0)
- FP_L $f23, (_JB_FPREG_F23 * SZREG)(a0)
-#endif
-#if defined(__mips_n64)
- FP_L $f25, (_JB_FPREG_F25 * SZREG)(a0)
- FP_L $f27, (_JB_FPREG_F27 * SZREG)(a0)
- FP_L $f29, (_JB_FPREG_F29 * SZREG)(a0)
- FP_L $f31, (_JB_FPREG_F31 * SZREG)(a0)
-#endif
-#endif /* ! __mips_soft_float */
-
- REG_EPILOGUE
- move v0, a1 # get return value in 1st arg
- j ra
- nop
-
-botch:
- /*
- * We know we aren't returning so we don't care about restoring
- * our caller's GP.
- */
- PTR_LA t9, _C_LABEL(longjmperror)
- jalr t9
- nop
-
- PIC_TAILCALL(abort)
-END(_longjmp)
diff --git a/lib/libc/mips/gen/fabs.S b/lib/libc/mips/gen/fabs.S
deleted file mode 100644
index 3b79249864d1..000000000000
--- a/lib/libc/mips/gen/fabs.S
+++ /dev/null
@@ -1,58 +0,0 @@
-/* $NetBSD: fabs.S,v 1.7 2003/08/07 16:42:15 agc Exp $ */
-
-/*-
- * Copyright (c) 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#if defined(LIBC_SCCS) && !defined(lint)
- ASMSTR("from: @(#)fabs.s 8.1 (Berkeley) 2/16/94")
- ASMSTR("$NetBSD: fabs.S,v 1.7 2003/08/07 16:42:15 agc Exp $")
-#endif /* LIBC_SCCS and not lint */
-
-
-#ifdef __ABICALLS__
- .abicalls
-#endif
- .set noreorder
-
-/*
- * fabs(x)
- * double x;
- *
- * Return absolute value of x.
- */
-LEAF(fabs)
- j ra
- abs.d $f0, $f12 # compute absolute value of x
-END(fabs)
diff --git a/lib/libc/mips/gen/fabs.c b/lib/libc/mips/gen/fabs.c
deleted file mode 100644
index 9c51f43ff4e7..000000000000
--- a/lib/libc/mips/gen/fabs.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* $NetBSD: fabs.c,v 1.2 2002/05/26 11:48:01 wiz Exp $ */
-
-/*-
- * SPDX-License-Identifier: BSD-4-Clause
- *
- * Copyright (c) 1996 Mark Brinicombe
- *
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Mark Brinicombe
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
- */
-
-/*
- * fabs(x) returns the absolute value of x.
- */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-double
-fabs(double x)
-{
-
- return (__builtin_fabs(x));
-}
diff --git a/lib/libc/mips/gen/flt_rounds.c b/lib/libc/mips/gen/flt_rounds.c
deleted file mode 100644
index 27d8bf35315f..000000000000
--- a/lib/libc/mips/gen/flt_rounds.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* $NetBSD: flt_rounds.c,v 1.5 2005/12/24 23:10:08 perry Exp $ */
-
-/*
- * Written by J.T. Conklin, Apr 11, 1995
- * Public domain.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: flt_rounds.c,v 1.5 2005/12/24 23:10:08 perry Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include <fenv.h>
-#include <float.h>
-
-#ifdef __mips_soft_float
-#include "softfloat-for-gcc.h"
-#include "milieu.h"
-#include "softfloat.h"
-#endif
-
-static const int map[] = {
- 1, /* round to nearest */
- 0, /* round to zero */
- 2, /* round to positive infinity */
- 3 /* round to negative infinity */
-};
-
-int
-__flt_rounds()
-{
- int mode;
-
-#ifdef __mips_soft_float
- mode = __softfloat_float_rounding_mode;
-#else
- __asm __volatile("cfc1 %0,$31" : "=r" (mode));
-#endif
-
- return map[mode & 0x03];
-}
diff --git a/lib/libc/mips/gen/hardfloat/fpgetmask.c b/lib/libc/mips/gen/hardfloat/fpgetmask.c
deleted file mode 100644
index 505a74c68466..000000000000
--- a/lib/libc/mips/gen/hardfloat/fpgetmask.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* $NetBSD: fpgetmask.c,v 1.5 2005/12/24 23:10:08 perry Exp $ */
-
-/*
- * Written by J.T. Conklin, Apr 11, 1995
- * Public domain.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fpgetmask.c,v 1.5 2005/12/24 23:10:08 perry Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-
-#include <ieeefp.h>
-
-#ifdef __weak_alias
-__weak_alias(fpgetmask,_fpgetmask)
-#endif
-
-fp_except_t
-fpgetmask()
-{
- int x;
-
- __asm("cfc1 %0,$31" : "=r" (x));
- return (x >> 7) & 0x1f;
-}
diff --git a/lib/libc/mips/gen/hardfloat/fpgetround.c b/lib/libc/mips/gen/hardfloat/fpgetround.c
deleted file mode 100644
index 6d0f11a5cb6e..000000000000
--- a/lib/libc/mips/gen/hardfloat/fpgetround.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* $NetBSD: fpgetround.c,v 1.5 2005/12/24 23:10:08 perry Exp $ */
-
-/*
- * Written by J.T. Conklin, Apr 11, 1995
- * Public domain.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fpgetround.c,v 1.5 2005/12/24 23:10:08 perry Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-
-#include <ieeefp.h>
-
-#ifdef __weak_alias
-__weak_alias(fpgetround,_fpgetround)
-#endif
-
-fp_rnd_t
-fpgetround()
-{
- int x;
-
- __asm("cfc1 %0,$31" : "=r" (x));
- return x & 0x03;
-}
diff --git a/lib/libc/mips/gen/hardfloat/fpgetsticky.c b/lib/libc/mips/gen/hardfloat/fpgetsticky.c
deleted file mode 100644
index 8028261c2c81..000000000000
--- a/lib/libc/mips/gen/hardfloat/fpgetsticky.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* $NetBSD: fpgetsticky.c,v 1.5 2005/12/24 23:10:08 perry Exp $ */
-
-/*
- * Written by J.T. Conklin, Apr 11, 1995
- * Public domain.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fpgetsticky.c,v 1.5 2005/12/24 23:10:08 perry Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-
-#include <ieeefp.h>
-
-#ifdef __weak_alias
-__weak_alias(fpgetsticky,_fpgetsticky)
-#endif
-
-fp_except_t
-fpgetsticky()
-{
- int x;
-
- __asm("cfc1 %0,$31" : "=r" (x));
- return (x >> 2) & 0x1f;
-}
diff --git a/lib/libc/mips/gen/hardfloat/fpsetmask.c b/lib/libc/mips/gen/hardfloat/fpsetmask.c
deleted file mode 100644
index 7abb3fd05f92..000000000000
--- a/lib/libc/mips/gen/hardfloat/fpsetmask.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* $NetBSD: fpsetmask.c,v 1.5 2005/12/24 23:10:08 perry Exp $ */
-
-/*
- * Written by J.T. Conklin, Apr 11, 1995
- * Public domain.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fpsetmask.c,v 1.5 2005/12/24 23:10:08 perry Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-
-#include <ieeefp.h>
-
-#ifdef __weak_alias
-__weak_alias(fpsetmask,_fpsetmask)
-#endif
-
-fp_except_t
-fpsetmask(mask)
- fp_except_t mask;
-{
- fp_except_t old;
- fp_except_t new;
-
- __asm("cfc1 %0,$31" : "=r" (old));
-
- new = old;
- new &= ~(0x1f << 7);
- new |= ((mask & 0x1f) << 7);
-
- __asm("ctc1 %0,$31" : : "r" (new));
-
- return (old >> 7) & 0x1f;
-}
diff --git a/lib/libc/mips/gen/hardfloat/fpsetround.c b/lib/libc/mips/gen/hardfloat/fpsetround.c
deleted file mode 100644
index 020516180033..000000000000
--- a/lib/libc/mips/gen/hardfloat/fpsetround.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/* $NetBSD: fpsetround.c,v 1.5 2005/12/24 23:10:08 perry Exp $ */
-
-/*
- * Written by J.T. Conklin, Apr 11, 1995
- * Public domain.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fpsetround.c,v 1.5 2005/12/24 23:10:08 perry Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-
-#include <ieeefp.h>
-
-#ifdef __weak_alias
-__weak_alias(fpsetround,_fpsetround)
-#endif
-
-fp_rnd_t
-fpsetround(fp_rnd_t rnd_dir)
-{
- fp_rnd_t old;
- fp_rnd_t new;
-
- __asm("cfc1 %0,$31" : "=r" (old));
-
- new = old;
- new &= ~0x03;
- new |= (rnd_dir & 0x03);
-
- __asm("ctc1 %0,$31" : : "r" (new));
-
- return old & 0x03;
-}
diff --git a/lib/libc/mips/gen/hardfloat/fpsetsticky.c b/lib/libc/mips/gen/hardfloat/fpsetsticky.c
deleted file mode 100644
index e43367117792..000000000000
--- a/lib/libc/mips/gen/hardfloat/fpsetsticky.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* $NetBSD: fpsetsticky.c,v 1.5 2005/12/24 23:10:08 perry Exp $ */
-
-/*
- * Written by J.T. Conklin, Apr 11, 1995
- * Public domain.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fpsetsticky.c,v 1.5 2005/12/24 23:10:08 perry Exp $");
-#endif /* LIBC_SCCS and not lint */
-
-#include "namespace.h"
-
-#include <ieeefp.h>
-
-#ifdef __weak_alias
-__weak_alias(fpsetsticky,_fpsetsticky)
-#endif
-
-fp_except
-fpsetsticky(sticky)
- fp_except sticky;
-{
- fp_except old;
- fp_except new;
-
- __asm("cfc1 %0,$31" : "=r" (old));
-
- new = old;
- new &= ~(0x1f << 2);
- new |= ((sticky & 0x1f) << 2);
-
- __asm("ctc1 %0,$31" : : "r" (new));
-
- return (old >> 2) & 0x1f;
-}
diff --git a/lib/libc/mips/gen/infinity.c b/lib/libc/mips/gen/infinity.c
deleted file mode 100644
index 55cf25f8e9d7..000000000000
--- a/lib/libc/mips/gen/infinity.c
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * infinity.c
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <math.h>
-
-/* bytes for +Infinity on a 387 */
-const union __infinity_un __infinity = {
-#if BYTE_ORDER == BIG_ENDIAN
- { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 }
-#else
- { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f }
-#endif
-};
-
-/* bytes for NaN */
-const union __nan_un __nan = {
-#if BYTE_ORDER == BIG_ENDIAN
- {0x7f, 0xa0, 0, 0}
-#else
- { 0, 0, 0xa0, 0x7f }
-#endif
-};
diff --git a/lib/libc/mips/gen/ldexp.S b/lib/libc/mips/gen/ldexp.S
deleted file mode 100644
index caee70380707..000000000000
--- a/lib/libc/mips/gen/ldexp.S
+++ /dev/null
@@ -1,219 +0,0 @@
-/* $NetBSD: ldexp.S,v 1.8 2003/08/07 16:42:15 agc Exp $ */
-
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#if defined(LIBC_SCCS) && !defined(lint)
- ASMSTR("from: @(#)ldexp.s 8.1 (Berkeley) 6/4/93")
- ASMSTR("$NetBSD: ldexp.S,v 1.8 2003/08/07 16:42:15 agc Exp $")
-#endif /* LIBC_SCCS and not lint */
-
-#ifdef __ABICALLS__
- .abicalls
-#endif
-
-#define DEXP_INF 0x7ff
-#define DEXP_BIAS 1023
-#define DEXP_MIN -1022
-#define DEXP_MAX 1023
-#define DFRAC_BITS 52
-#define DIMPL_ONE 0x00100000
-#define DLEAD_ZEROS 31 - 20
-#define STICKYBIT 1
-#define GUARDBIT 0x80000000
-#define DSIGNAL_NAN 0x00040000
-#define DQUIET_NAN0 0x0007ffff
-#define DQUIET_NAN1 0xffffffff
-
-/*
- * double ldexp(x, N)
- * double x; int N;
- *
- * Return x * (2**N), for integer values N.
- */
-LEAF(ldexp)
- mfc1 v1, $f13 # get MSW of x
- mfc1 t3, $f12 # get LSW of x
- sll t1, v1, 1 # get x exponent
- srl t1, t1, 32 - 11
- beq t1, DEXP_INF, 9f # is it a NAN or infinity?
- beq t1, zero, 1f # zero or denormalized number?
- addu t1, t1, a2 # scale exponent
- sll v0, a2, 20 # position N for addition
- bge t1, DEXP_INF, 8f # overflow?
- addu v0, v0, v1 # multiply by (2**N)
- ble t1, zero, 4f # underflow?
- mtc1 v0, $f1 # save MSW of result
- mtc1 t3, $f0 # save LSW of result
- j ra
-1:
- sll t2, v1, 32 - 20 # get x fraction
- srl t2, t2, 32 - 20
- srl t0, v1, 31 # get x sign
- bne t2, zero, 1f
- beq t3, zero, 9f # result is zero
-1:
-/*
- * Find out how many leading zero bits are in t2,t3 and put in t9.
- */
- move v0, t2
- move t9, zero
- bne t2, zero, 1f
- move v0, t3
- addu t9, 32
-1:
- srl ta0, v0, 16
- bne ta0, zero, 1f
- addu t9, 16
- sll v0, 16
-1:
- srl ta0, v0, 24
- bne ta0, zero, 1f
- addu t9, 8
- sll v0, 8
-1:
- srl ta0, v0, 28
- bne ta0, zero, 1f
- addu t9, 4
- sll v0, 4
-1:
- srl ta0, v0, 30
- bne ta0, zero, 1f
- addu t9, 2
- sll v0, 2
-1:
- srl ta0, v0, 31
- bne ta0, zero, 1f
- addu t9, 1
-/*
- * Now shift t2,t3 the correct number of bits.
- */
-1:
- subu t9, t9, DLEAD_ZEROS # dont count normal leading zeros
- li t1, DEXP_MIN + DEXP_BIAS
- subu t1, t1, t9 # adjust exponent
- addu t1, t1, a2 # scale exponent
- li v0, 32
- blt t9, v0, 1f
- subu t9, t9, v0 # shift fraction left >= 32 bits
- sll t2, t3, t9
- move t3, zero
- b 2f
-1:
- subu v0, v0, t9 # shift fraction left < 32 bits
- sll t2, t2, t9
- srl ta0, t3, v0
- or t2, t2, ta0
- sll t3, t3, t9
-2:
- bge t1, DEXP_INF, 8f # overflow?
- ble t1, zero, 4f # underflow?
- sll t2, t2, 32 - 20 # clear implied one bit
- srl t2, t2, 32 - 20
-3:
- sll t1, t1, 31 - 11 # reposition exponent
- sll t0, t0, 31 # reposition sign
- or t0, t0, t1 # put result back together
- or t0, t0, t2
- mtc1 t0, $f1 # save MSW of result
- mtc1 t3, $f0 # save LSW of result
- j ra
-4:
- li v0, 0x80000000
- ble t1, -52, 7f # is result too small for denorm?
- sll t2, v1, 31 - 20 # clear exponent, extract fraction
- or t2, t2, v0 # set implied one bit
- blt t1, -30, 2f # will all bits in t3 be shifted out?
- srl t2, t2, 31 - 20 # shift fraction back to normal position
- subu t1, t1, 1
- sll ta0, t2, t1 # shift right t2,t3 based on exponent
- srl t8, t3, t1 # save bits shifted out
- negu t1
- srl t3, t3, t1
- or t3, t3, ta0
- srl t2, t2, t1
- bge t8, zero, 1f # does result need to be rounded?
- addu t3, t3, 1 # round result
- sltu ta0, t3, 1
- sll t8, t8, 1
- addu t2, t2, ta0
- bne t8, zero, 1f # round result to nearest
- and t3, t3, ~1
-1:
- mtc1 t3, $f0 # save denormalized result (LSW)
- mtc1 t2, $f1 # save denormalized result (MSW)
- bge v1, zero, 1f # should result be negative?
- neg.d $f0, $f0 # negate result
-1:
- j ra
-2:
- mtc1 zero, $f1 # exponent and upper fraction
- addu t1, t1, 20 # compute amount to shift right by
- sll t8, t2, t1 # save bits shifted out
- negu t1
- srl t3, t2, t1
- bge t8, zero, 1f # does result need to be rounded?
- addu t3, t3, 1 # round result
- sltu ta0, t3, 1
- sll t8, t8, 1
- mtc1 ta0, $f1 # exponent and upper fraction
- bne t8, zero, 1f # round result to nearest
- and t3, t3, ~1
-1:
- mtc1 t3, $f0
- bge v1, zero, 1f # is result negative?
- neg.d $f0, $f0 # negate result
-1:
- j ra
-7:
- mtc1 zero, $f0 # result is zero
- mtc1 zero, $f1
- beq t0, zero, 1f # is result positive?
- neg.d $f0, $f0 # negate result
-1:
- j ra
-8:
- li t1, 0x7ff00000 # result is infinity (MSW)
- mtc1 t1, $f1
- mtc1 zero, $f0 # result is infinity (LSW)
- bge v1, zero, 1f # should result be negative infinity?
- neg.d $f0, $f0 # result is negative infinity
-1:
- add.d $f0, $f0 # cause overflow faults if enabled
- j ra
-9:
- mov.d $f0, $f12 # yes, result is just x
- j ra
-END(ldexp)
diff --git a/lib/libc/mips/gen/makecontext.c b/lib/libc/mips/gen/makecontext.c
deleted file mode 100644
index 7d3e647b4d09..000000000000
--- a/lib/libc/mips/gen/makecontext.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/* $NetBSD: makecontext.c,v 1.5 2009/12/14 01:07:42 matt Exp $ */
-
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-NetBSD
- *
- * Copyright (c) 2001 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Klaus Klein.
- *
- * 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: makecontext.c,v 1.5 2009/12/14 01:07:42 matt Exp $");
-#endif
-
-#include <sys/param.h>
-#include <machine/abi.h>
-#define _WANT_MIPS_REGNUM
-#include <machine/regnum.h>
-
-#include <stdarg.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <ucontext.h>
-
-__weak_reference(__makecontext, makecontext);
-
-void _ctx_done(ucontext_t *);
-void _ctx_start(void);
-
-void
-__makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
-{
- mcontext_t *mc;
- register_t *sp;
- int i;
- va_list ap;
-
- /*
- * XXX/juli
- * We need an mc_len or mc_flags like other architectures
- * so that we can mark a context as invalid. Store it in
- * mc->mc_regs[ZERO] perhaps?
- */
- if (argc < 0 || ucp == NULL ||
- ucp->uc_stack.ss_sp == NULL ||
- ucp->uc_stack.ss_size < MINSIGSTKSZ)
- return;
- mc = &ucp->uc_mcontext;
-
- sp = (register_t *)
- ((uintptr_t)ucp->uc_stack.ss_sp + ucp->uc_stack.ss_size);
-#if defined(__mips_o32) || defined(__mips_o64)
- sp -= (argc >= 4 ? argc : 4); /* Make room for >=4 arguments. */
-#elif defined(__mips_n32) || defined(__mips_n64)
- sp -= (argc > 8 ? argc - 8 : 0); /* Make room for > 8 arguments. */
-#endif
- sp = (register_t *)((uintptr_t)sp & ~(STACK_ALIGN - 1));
-
- mc->mc_regs[SP] = (intptr_t)sp;
- mc->mc_regs[S0] = (intptr_t)ucp;
- mc->mc_regs[T9] = (intptr_t)func;
- mc->mc_pc = (intptr_t)_ctx_start;
-
- /* Construct argument list. */
- va_start(ap, argc);
-#if defined(__mips_o32) || defined(__mips_o64)
- /* Up to the first four arguments are passed in $a0-3. */
- for (i = 0; i < argc && i < 4; i++)
- /* LINTED register_t is safe */
- mc->mc_regs[A0 + i] = va_arg(ap, register_t);
- /* Skip over the $a0-3 gap. */
- sp += 4;
-#endif
-#if defined(__mips_n32) || defined(__mips_n64)
- /* Up to the first 8 arguments are passed in $a0-7. */
- for (i = 0; i < argc && i < 8; i++)
- /* LINTED register_t is safe */
- mc->mc_regs[A0 + i] = va_arg(ap, register_t);
-#endif
- /* Pass remaining arguments on the stack. */
- for (; i < argc; i++)
- /* LINTED register_t is safe */
- *sp++ = va_arg(ap, register_t);
- va_end(ap);
-}
-
-void
-_ctx_done(ucontext_t *ucp)
-{
-
- if (ucp->uc_link == NULL)
- exit(0);
- else {
- setcontext((const ucontext_t *)ucp->uc_link);
- abort();
- }
-}
diff --git a/lib/libc/mips/gen/setjmp.S b/lib/libc/mips/gen/setjmp.S
deleted file mode 100644
index 3ef6878bb608..000000000000
--- a/lib/libc/mips/gen/setjmp.S
+++ /dev/null
@@ -1,237 +0,0 @@
-/* $NetBSD: setjmp.S,v 1.17 2005/09/17 11:49:39 tsutsui Exp $ */
-
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#if defined(LIBC_SCCS) && !defined(lint)
- ASMSTR("from: @(#)setjmp.s 8.1 (Berkeley) 6/4/93")
- ASMSTR("$NetBSD: setjmp.S,v 1.17 2005/09/17 11:49:39 tsutsui Exp $")
-#endif /* LIBC_SCCS and not lint */
-
-#include "SYS.h"
-
-#ifdef __ABICALLS__
- .abicalls
-#endif
-
-/*
- * C library -- setjmp, longjmp
- *
- * longjmp(a,v)
- * will generate a "return(v)" from
- * the last call to
- * setjmp(a)
- * by restoring registers from the stack,
- * and a struct sigcontext, see <signal.h>
- */
-
-#define SETJMP_FRAME_SIZE (CALLFRAME_SIZ + (SZREG * 2))
-
-
-NESTED(setjmp, SETJMP_FRAME_SIZE, ra)
- .mask 0x80000000, (CALLFRAME_RA - CALLFRAME_SIZ)
- SETUP_GP
- PTR_SUBU sp, sp, SETJMP_FRAME_SIZE # allocate stack frame
- SAVE_GP(CALLFRAME_GP)
- SETUP_GP64(CALLFRAME_GP, setjmp)
-
- REG_S ra, CALLFRAME_RA(sp) # save RA
- REG_S a0, CALLFRAME_SIZ(sp) # store env
-
- /* Get the signal mask. */
- PTR_ADDU a2, a0, _JB_SIGMASK * SZREG # &oenv
- li a0, 1 # SIG_SETBLOCK
- move a1, zero # &env == 0
- PTR_LA t9, _C_LABEL(sigprocmask) # get current signal mask
- jalr t9
-
- RESTORE_GP64
- REG_L a0, CALLFRAME_SIZ(sp) # restore env pointer
- REG_L ra, CALLFRAME_RA(sp) # restore RA
- PTR_ADDU sp, sp, SETJMP_FRAME_SIZE # pop stack frame
-
- REG_LI v0, _JB_MAGIC_SETJMP
- REG_S v0, (_JB_MAGIC * SZREG)(a0)
- REG_S ra, (_JB_REG_RA * SZREG)(a0)
- /*
- * From "MIPSpro N32 ABI Handbook", Table 2-1:
- * Registers s0..s7 are callee-saved.
- * The sp register is callee-saved.
- * The fp (or s8) register is callee-saved.
- * The gp register is callee-saved (for n32/n64).
- */
- REG_S s0, (_JB_REG_S0 * SZREG)(a0)
- REG_S s1, (_JB_REG_S1 * SZREG)(a0)
- REG_S s2, (_JB_REG_S2 * SZREG)(a0)
- REG_S s3, (_JB_REG_S3 * SZREG)(a0)
- REG_S s4, (_JB_REG_S4 * SZREG)(a0)
- REG_S s5, (_JB_REG_S5 * SZREG)(a0)
- REG_S s6, (_JB_REG_S6 * SZREG)(a0)
- REG_S s7, (_JB_REG_S7 * SZREG)(a0)
- REG_S sp, (_JB_REG_SP * SZREG)(a0)
- REG_S s8, (_JB_REG_S8 * SZREG)(a0)
-#if defined(__mips_n32) || defined(__mips_n64)
- REG_S gp, (_JB_REG_GP * SZREG)(a0)
-#endif
-#ifndef __mips_soft_float
- /*
- * From "MIPSpro N32 ABI Handbook", Table 2-1:
- * In N32, FP registers F20, F22, F24, F26, F28, F30 are callee-saved.
- * In N64, FP registers F24 .. F31 are callee-saved.
- * In O32, FP registers F20 .. F23 are callee-saved.
- */
- cfc1 v0, $31
- INT_S v0, (_JB_FPREG_FCSR * SZREG)(a0)
-#if defined(__mips_o32) || defined(__mips_o64) || defined(__mips_n32)
- FP_S $f20, (_JB_FPREG_F20 * SZREG)(a0)
- FP_S $f22, (_JB_FPREG_F22 * SZREG)(a0)
-#endif
-#if defined(__mips_o32) || defined(__mips_o64)
- FP_S $f21, (_JB_FPREG_F21 * SZREG)(a0)
- FP_S $f23, (_JB_FPREG_F23 * SZREG)(a0)
-#endif
-#if defined(__mips_n32) || defined(__mips_n64)
- FP_S $f24, (_JB_FPREG_F24 * SZREG)(a0)
- FP_S $f26, (_JB_FPREG_F26 * SZREG)(a0)
- FP_S $f28, (_JB_FPREG_F28 * SZREG)(a0)
- FP_S $f30, (_JB_FPREG_F30 * SZREG)(a0)
-#endif
-#if defined(__mips_n64)
- FP_S $f25, (_JB_FPREG_F25 * SZREG)(a0)
- FP_S $f27, (_JB_FPREG_F27 * SZREG)(a0)
- FP_S $f29, (_JB_FPREG_F29 * SZREG)(a0)
- FP_S $f31, (_JB_FPREG_F31 * SZREG)(a0)
-#endif
-#endif /* ! __mips_soft_float */
-
- move v0, zero
- jr ra
-END(setjmp)
-
-#define LONGJMP_FRAME_SIZE (CALLFRAME_SIZ + (SZREG * 2))
-
-NESTED(longjmp, LONGJMP_FRAME_SIZE, ra)
- .mask 0x80000000, (CALLFRAME_RA - CALLFRAME_SIZ)
- PIC_PROLOGUE(longjmp)
- PTR_SUBU sp, sp, LONGJMP_FRAME_SIZE # allocate stack frame
- SAVE_GP(CALLFRAME_GP)
-
- REG_S ra, CALLFRAME_RA(sp) # save RA
- REG_L v0, (_JB_MAGIC * SZREG)(a0)
- REG_LI t0, _JB_MAGIC_SETJMP
- bne v0, t0, botch # jump if error
- nop
-
- REG_S a0, CALLFRAME_SIZ(sp) # save env
- REG_S a1, (CALLFRAME_SIZ + SZREG)(sp) # save return value
-
- # set sigmask
- PTR_ADDU a1, a0, _JB_SIGMASK * SZREG # &set
- move a2, zero # &oset == NULL
- li a0, 3 # SIG_SETMASK
- PTR_LA t9,_C_LABEL(sigprocmask) # set current signal mask
- jal t9
- nop
-
- REG_L a0, CALLFRAME_SIZ(sp) # restore env
- REG_L a1, (CALLFRAME_SIZ + SZREG)(sp) # restore return value
-
- REG_L ra, (_JB_REG_RA * SZREG)(a0)
- /*
- * From "MIPSpro N32 ABI Handbook", Table 2-1:
- * Registers s0..s7 are callee-saved.
- * The sp register is callee-saved.
- * The fp (or s8) register is callee-saved.
- * The gp register is callee-saved (for n32/n64).
- */
- REG_L s0, (_JB_REG_S0 * SZREG)(a0)
- REG_L s1, (_JB_REG_S1 * SZREG)(a0)
- REG_L s2, (_JB_REG_S2 * SZREG)(a0)
- REG_L s3, (_JB_REG_S3 * SZREG)(a0)
- REG_L s4, (_JB_REG_S4 * SZREG)(a0)
- REG_L s5, (_JB_REG_S5 * SZREG)(a0)
- REG_L s6, (_JB_REG_S6 * SZREG)(a0)
- REG_L s7, (_JB_REG_S7 * SZREG)(a0)
- REG_L sp, (_JB_REG_SP * SZREG)(a0)
- REG_L s8, (_JB_REG_S8 * SZREG)(a0)
-#if defined(__mips_n32) || defined(__mips_n64)
- REG_L gp, (_JB_REG_GP * SZREG)(a0)
-#endif
-#ifndef __mips_soft_float
- /*
- * From "MIPSpro N32 ABI Handbook", Table 2-1:
- * In N32, FP registers F20, F22, F24, F26, F28, F30 are callee-saved.
- * In N64, FP registers F23 .. F31 are callee-saved.
- * In O32, FP registers F20 .. F23 are callee-saved.
- */
- INT_L v0, (_JB_FPREG_FCSR * SZREG)(a0)
- ctc1 v0, $31
-#if defined(__mips_n64) || defined(__mips_n32)
- FP_L $f30, (_JB_FPREG_F30 * SZREG)(a0)
- FP_L $f28, (_JB_FPREG_F28 * SZREG)(a0)
- FP_L $f26, (_JB_FPREG_F26 * SZREG)(a0)
- FP_L $f24, (_JB_FPREG_F24 * SZREG)(a0)
-#endif
-#if defined(__mips_n32) || defined(__mips_o32) || defined(__mips_o64)
- FP_L $f22, (_JB_FPREG_F22 * SZREG)(a0)
- FP_L $f20, (_JB_FPREG_F20 * SZREG)(a0)
-#endif
-#if defined(__mips_o32) || defined(__mips_o64)
- FP_L $f21, (_JB_FPREG_F21 * SZREG)(a0)
- FP_L $f23, (_JB_FPREG_F23 * SZREG)(a0)
-#endif
-#if defined(__mips_n64)
- FP_L $f25, (_JB_FPREG_F25 * SZREG)(a0)
- FP_L $f27, (_JB_FPREG_F27 * SZREG)(a0)
- FP_L $f29, (_JB_FPREG_F29 * SZREG)(a0)
- FP_L $f31, (_JB_FPREG_F31 * SZREG)(a0)
-#endif
-#endif /* ! __mips_soft_float */
-
- move v0, a1
- j ra
- nop
-
-botch:
- /*
- * We know we aren't returning so we don't care about restoring
- * our caller's GP.
- */
- PTR_LA t9, _C_LABEL(longjmperror)
- jalr t9
- nop
-
- PIC_TAILCALL(abort)
-END(longjmp)
diff --git a/lib/libc/mips/gen/sigsetjmp.S b/lib/libc/mips/gen/sigsetjmp.S
deleted file mode 100644
index a36b2803a10b..000000000000
--- a/lib/libc/mips/gen/sigsetjmp.S
+++ /dev/null
@@ -1,76 +0,0 @@
-/* $NetBSD: sigsetjmp.S,v 1.8 2005/09/17 11:49:39 tsutsui Exp $ */
-
-/*-
- * Copyright (c) 1991, 1993, 1995,
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Havard Eidnes.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-#if defined(LIBC_SCCS) && !defined(lint)
- ASMSTR("from: @(#)setjmp.s 8.1 (Berkeley) 6/4/93")
- ASMSTR("$NetBSD: sigsetjmp.S,v 1.8 2005/09/17 11:49:39 tsutsui Exp $")
-#endif /* LIBC_SCCS and not lint */
-
-#include "SYS.h"
-
-#ifdef __ABICALLS__
- .abicalls
-#endif
-
-/*
- * C library -- sigsetjmp, siglongjmp
- *
- * siglongjmp(a,v)
- * will generate a "return(v)" from
- * the last call to
- * sigsetjmp(a, savemask)
- * by restoring registers from the stack,
- * and dependent on savemask restores the
- * signal mask.
- */
-
-LEAF(sigsetjmp)
- PIC_PROLOGUE(sigsetjmp)
-
- bne a1, zero, 1f # do saving of signal mask?
- PIC_TAILCALL(_setjmp)
-
-1: PIC_TAILCALL(setjmp)
-END(sigsetjmp)
-
-LEAF(siglongjmp)
- PIC_PROLOGUE(siglongjmp)
- REG_L t0, (_JB_MAGIC * SZREG)(a0)
- REG_LI t1, _JB_MAGIC__SETJMP
- bne t0, t1, 1f # setjmp or _setjmp magic?
- PIC_TAILCALL(_longjmp)
-1: PIC_TAILCALL(longjmp)
-END(siglongjmp)
diff --git a/lib/libc/mips/net/Makefile.inc b/lib/libc/mips/net/Makefile.inc
deleted file mode 100644
index 304d5cac1a3e..000000000000
--- a/lib/libc/mips/net/Makefile.inc
+++ /dev/null
@@ -1,4 +0,0 @@
-# $NetBSD: Makefile.inc,v 1.3 2003/08/01 17:03:51 lukem Exp $
-# $FreeBSD$
-
-SRCS+= htonl.S ntohl.S htons.S ntohs.S
diff --git a/lib/libc/mips/net/htonl.S b/lib/libc/mips/net/htonl.S
deleted file mode 100644
index 66c4f90fd65f..000000000000
--- a/lib/libc/mips/net/htonl.S
+++ /dev/null
@@ -1,51 +0,0 @@
-/* $NetBSD: byte_swap_4.S,v 1.2 2006/02/08 21:52:36 simonb Exp $ */
-
-/*-
- * Copyright (c) 1997 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Neil A. Carson
- *
- * 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.
- */
-
-#include <machine/asm.h>
-
-__FBSDID("$FreeBSD$");
-
-LEAF(htonl) # a0 = 0x11223344, return 0x44332211
-#ifdef __MIPSEB__
- move v0, a0
-#else
- srl v1, a0, 24 # v1 = 0x00000011
- sll v0, a0, 24 # v0 = 0x44000000
- or v0, v0, v1
- and v1, a0, 0xff00
- sll v1, v1, 8 # v1 = 0x00330000
- or v0, v0, v1
- srl v1, a0, 8
- and v1, v1, 0xff00 # v1 = 0x00002200
- or v0, v0, v1
-#endif
- j ra
-END(htonl)
diff --git a/lib/libc/mips/net/htons.S b/lib/libc/mips/net/htons.S
deleted file mode 100644
index 0449c4d82e5c..000000000000
--- a/lib/libc/mips/net/htons.S
+++ /dev/null
@@ -1,47 +0,0 @@
-/* $NetBSD: byte_swap_2.S,v 1.2 2006/02/08 21:52:36 simonb Exp $ */
-
-/*-
- * Copyright (c) 1999 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Charles M. Hannum.
- *
- * 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.
- */
-
-#include <machine/asm.h>
-
-__FBSDID("$FreeBSD$");
-
-LEAF(htons)
-#ifdef __MIPSEB__
- move v0, a0
-#else
- srl v0, a0, 8
- and v0, v0, 0xff
- sll v1, a0, 8
- and v1, v1, 0xff00
- or v0, v0, v1
-#endif
- j ra
-END(htons)
diff --git a/lib/libc/mips/net/ntohl.S b/lib/libc/mips/net/ntohl.S
deleted file mode 100644
index 39001aa86bbe..000000000000
--- a/lib/libc/mips/net/ntohl.S
+++ /dev/null
@@ -1,51 +0,0 @@
-/* $NetBSD: byte_swap_4.S,v 1.2 2006/02/08 21:52:36 simonb Exp $ */
-
-/*-
- * Copyright (c) 1997 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Neil A. Carson
- *
- * 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.
- */
-
-#include <machine/asm.h>
-
-__FBSDID("$FreeBSD$");
-
-LEAF(ntohl) # a0 = 0x11223344, return 0x44332211
-#ifdef __MIPSEB__
- move v0, a0
-#else
- srl v1, a0, 24 # v1 = 0x00000011
- sll v0, a0, 24 # v0 = 0x44000000
- or v0, v0, v1
- and v1, a0, 0xff00
- sll v1, v1, 8 # v1 = 0x00330000
- or v0, v0, v1
- srl v1, a0, 8
- and v1, v1, 0xff00 # v1 = 0x00002200
- or v0, v0, v1
-#endif
- j ra
-END(ntohl)
diff --git a/lib/libc/mips/net/ntohs.S b/lib/libc/mips/net/ntohs.S
deleted file mode 100644
index 4761371be1af..000000000000
--- a/lib/libc/mips/net/ntohs.S
+++ /dev/null
@@ -1,46 +0,0 @@
-/* $NetBSD: byte_swap_2.S,v 1.2 2006/02/08 21:52:36 simonb Exp $ */
-
-/*-
- * Copyright (c) 1999 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Charles M. Hannum.
- *
- * 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.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-LEAF(ntohs)
-#ifdef __MIPSEB__
- move v0, a0
-#else
- srl v0, a0, 8
- and v0, v0, 0xff
- sll v1, a0, 8
- and v1, v1, 0xff00
- or v0, v0, v1
-#endif
- j ra
-END(ntohs)
diff --git a/lib/libc/mips/softfloat/milieu.h b/lib/libc/mips/softfloat/milieu.h
deleted file mode 100644
index e04b26692113..000000000000
--- a/lib/libc/mips/softfloat/milieu.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* $FreeBSD$ */
-
-/*
-===============================================================================
-
-This C header file is part of the SoftFloat IEC/IEEE Floating-point
-Arithmetic Package, Release 2a.
-
-Written by John R. Hauser. This work was made possible in part by the
-International Computer Science Institute, located at Suite 600, 1947 Center
-Street, Berkeley, California 94704. Funding was partially provided by the
-National Science Foundation under grant MIP-9311980. The original version
-of this code was written as part of a project to build a fixed-point vector
-processor in collaboration with the University of California at Berkeley,
-overseen by Profs. Nelson Morgan and John Wawrzynek. More information
-is available through the Web page `http://HTTP.CS.Berkeley.EDU/~jhauser/
-arithmetic/SoftFloat.html'.
-
-THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort
-has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
-TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO
-PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
-AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
-
-Derivative works are acceptable, even for commercial purposes, so long as
-(1) they include prominent notice that the work is derivative, and (2) they
-include prominent notice akin to these four paragraphs for those parts of
-this code that are retained.
-
-===============================================================================
-*/
-
-/*
--------------------------------------------------------------------------------
-Include common integer types and flags.
--------------------------------------------------------------------------------
-*/
-#include "mips-gcc.h"
-
-/*
--------------------------------------------------------------------------------
-Symbolic Boolean literals.
--------------------------------------------------------------------------------
-*/
-enum {
- FALSE = 0,
- TRUE = 1
-};
diff --git a/lib/libc/mips/softfloat/mips-gcc.h b/lib/libc/mips/softfloat/mips-gcc.h
deleted file mode 100644
index c8ec07c839c8..000000000000
--- a/lib/libc/mips/softfloat/mips-gcc.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* $NetBSD: arm-gcc.h,v 1.2 2001/02/21 18:09:25 bjh21 Exp $ */
-/* $FreeBSD$ */
-
-/*
--------------------------------------------------------------------------------
-One of the macros `BIGENDIAN' or `LITTLEENDIAN' must be defined.
--------------------------------------------------------------------------------
-*/
-#ifdef __MIPSEB__
-#define BIGENDIAN
-#else
-#define LITTLEENDIAN
-#endif
-
-/*
--------------------------------------------------------------------------------
-The macro `BITS64' can be defined to indicate that 64-bit integer types are
-supported by the compiler.
--------------------------------------------------------------------------------
-*/
-#define BITS64
-
-/*
--------------------------------------------------------------------------------
-Each of the following `typedef's defines the most convenient type that holds
-integers of at least as many bits as specified. For example, `uint8' should
-be the most convenient type that can hold unsigned integers of as many as
-8 bits. The `flag' type must be able to hold either a 0 or 1. For most
-implementations of C, `flag', `uint8', and `int8' should all be `typedef'ed
-to the same as `int'.
--------------------------------------------------------------------------------
-*/
-typedef int flag;
-typedef int uint8;
-typedef int int8;
-typedef int uint16;
-typedef int int16;
-typedef unsigned int uint32;
-typedef signed int int32;
-#ifdef BITS64
-typedef unsigned long long int uint64;
-typedef signed long long int int64;
-#endif
-
-/*
--------------------------------------------------------------------------------
-Each of the following `typedef's defines a type that holds integers
-of _exactly_ the number of bits specified. For instance, for most
-implementation of C, `bits16' and `sbits16' should be `typedef'ed to
-`unsigned short int' and `signed short int' (or `short int'), respectively.
--------------------------------------------------------------------------------
-*/
-typedef unsigned char bits8;
-typedef signed char sbits8;
-typedef unsigned short int bits16;
-typedef signed short int sbits16;
-typedef unsigned int bits32;
-typedef signed int sbits32;
-#ifdef BITS64
-typedef unsigned long long int bits64;
-typedef signed long long int sbits64;
-#endif
-
-#ifdef BITS64
-/*
--------------------------------------------------------------------------------
-The `LIT64' macro takes as its argument a textual integer literal and
-if necessary ``marks'' the literal as having a 64-bit integer type.
-For example, the GNU C Compiler (`gcc') requires that 64-bit literals be
-appended with the letters `LL' standing for `long long', which is `gcc's
-name for the 64-bit integer type. Some compilers may allow `LIT64' to be
-defined as the identity macro: `#define LIT64( a ) a'.
--------------------------------------------------------------------------------
-*/
-#define LIT64( a ) a##LL
-#endif
-
-/*
--------------------------------------------------------------------------------
-The macro `INLINE' can be used before functions that should be inlined. If
-a compiler does not support explicit inlining, this macro should be defined
-to be `static'.
--------------------------------------------------------------------------------
-*/
-#define INLINE static __inline
-
-#if defined(SOFTFLOAT_FOR_GCC)
-/* XXXMIPS: check this one */
-#define FLOAT64_DEMANGLE(a) (a)
-#define FLOAT64_MANGLE(a) (a)
-#endif
diff --git a/lib/libc/mips/softfloat/softfloat.h b/lib/libc/mips/softfloat/softfloat.h
deleted file mode 100644
index 6aef49975a38..000000000000
--- a/lib/libc/mips/softfloat/softfloat.h
+++ /dev/null
@@ -1,315 +0,0 @@
-/* $NetBSD: softfloat.h,v 1.6 2002/05/12 13:12:46 bjh21 Exp $ */
-/* $FreeBSD$ */
-
-/* This is a derivative work. */
-
-/*
-===============================================================================
-
-This C header file is part of the SoftFloat IEC/IEEE Floating-point
-Arithmetic Package, Release 2a.
-
-Written by John R. Hauser. This work was made possible in part by the
-International Computer Science Institute, located at Suite 600, 1947 Center
-Street, Berkeley, California 94704. Funding was partially provided by the
-National Science Foundation under grant MIP-9311980. The original version
-of this code was written as part of a project to build a fixed-point vector
-processor in collaboration with the University of California at Berkeley,
-overseen by Profs. Nelson Morgan and John Wawrzynek. More information
-is available through the Web page `http://HTTP.CS.Berkeley.EDU/~jhauser/
-arithmetic/SoftFloat.html'.
-
-THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort
-has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
-TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO
-PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
-AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
-
-Derivative works are acceptable, even for commercial purposes, so long as
-(1) they include prominent notice that the work is derivative, and (2) they
-include prominent notice akin to these four paragraphs for those parts of
-this code that are retained.
-
-===============================================================================
-*/
-
-/*
--------------------------------------------------------------------------------
-The macro `FLOATX80' must be defined to enable the extended double-precision
-floating-point format `floatx80'. If this macro is not defined, the
-`floatx80' type will not be defined, and none of the functions that either
-input or output the `floatx80' type will be defined. The same applies to
-the `FLOAT128' macro and the quadruple-precision format `float128'.
--------------------------------------------------------------------------------
-*/
-/* #define FLOATX80 */
-/* #define FLOAT128 */
-
-#include <fenv.h>
-
-/*
--------------------------------------------------------------------------------
-Software IEC/IEEE floating-point types.
--------------------------------------------------------------------------------
-*/
-typedef unsigned int float32;
-typedef unsigned long long float64;
-#ifdef FLOATX80
-typedef struct {
- unsigned short high;
- unsigned long long low;
-} floatx80;
-#endif
-#ifdef FLOAT128
-typedef struct {
- unsigned long long high, low;
-} float128;
-#endif
-
-/*
--------------------------------------------------------------------------------
-Software IEC/IEEE floating-point underflow tininess-detection mode.
--------------------------------------------------------------------------------
-*/
-#ifndef SOFTFLOAT_FOR_GCC
-extern int float_detect_tininess;
-#endif
-enum {
- float_tininess_after_rounding = 0,
- float_tininess_before_rounding = 1
-};
-
-/*
--------------------------------------------------------------------------------
-Software IEC/IEEE floating-point rounding mode.
--------------------------------------------------------------------------------
-*/
-extern int float_rounding_mode;
-enum {
- float_round_nearest_even = FE_TONEAREST,
- float_round_to_zero = FE_TOWARDZERO,
- float_round_down = FE_DOWNWARD,
- float_round_up = FE_UPWARD
-};
-
-/*
--------------------------------------------------------------------------------
-Software IEC/IEEE floating-point exception flags.
--------------------------------------------------------------------------------
-*/
-extern int float_exception_flags;
-extern int float_exception_mask;
-enum {
- float_flag_inexact = FE_INEXACT,
- float_flag_underflow = FE_UNDERFLOW,
- float_flag_overflow = FE_OVERFLOW,
- float_flag_divbyzero = FE_DIVBYZERO,
- float_flag_invalid = FE_INVALID
-};
-
-/*
--------------------------------------------------------------------------------
-Routine to raise any or all of the software IEC/IEEE floating-point
-exception flags.
--------------------------------------------------------------------------------
-*/
-void float_raise( int );
-
-/*
--------------------------------------------------------------------------------
-Software IEC/IEEE integer-to-floating-point conversion routines.
--------------------------------------------------------------------------------
-*/
-float32 int32_to_float32( int );
-float64 int32_to_float64( int );
-#ifdef FLOATX80
-floatx80 int32_to_floatx80( int );
-#endif
-#ifdef FLOAT128
-float128 int32_to_float128( int );
-#endif
-#ifndef SOFTFLOAT_FOR_GCC /* __floatdi?f is in libgcc2.c */
-float32 int64_to_float32( long long );
-float64 int64_to_float64( long long );
-#ifdef FLOATX80
-floatx80 int64_to_floatx80( long long );
-#endif
-#ifdef FLOAT128
-float128 int64_to_float128( long long );
-#endif
-#endif
-
-/*
--------------------------------------------------------------------------------
-Software IEC/IEEE single-precision conversion routines.
--------------------------------------------------------------------------------
-*/
-int float32_to_int32( float32 );
-int float32_to_int32_round_to_zero( float32 );
-#if defined(SOFTFLOAT_FOR_GCC) && defined(SOFTFLOAT_NEED_FIXUNS)
-unsigned int float32_to_uint32_round_to_zero( float32 );
-#endif
-#ifndef SOFTFLOAT_FOR_GCC /* __fix?fdi provided by libgcc2.c */
-long long float32_to_int64( float32 );
-long long float32_to_int64_round_to_zero( float32 );
-#endif
-float64 float32_to_float64( float32 );
-#ifdef FLOATX80
-floatx80 float32_to_floatx80( float32 );
-#endif
-#ifdef FLOAT128
-float128 float32_to_float128( float32 );
-#endif
-
-/*
--------------------------------------------------------------------------------
-Software IEC/IEEE single-precision operations.
--------------------------------------------------------------------------------
-*/
-float32 float32_round_to_int( float32 );
-float32 float32_add( float32, float32 );
-float32 float32_sub( float32, float32 );
-float32 float32_mul( float32, float32 );
-float32 float32_div( float32, float32 );
-float32 float32_rem( float32, float32 );
-float32 float32_sqrt( float32 );
-int float32_eq( float32, float32 );
-int float32_le( float32, float32 );
-int float32_lt( float32, float32 );
-int float32_eq_signaling( float32, float32 );
-int float32_le_quiet( float32, float32 );
-int float32_lt_quiet( float32, float32 );
-#ifndef SOFTFLOAT_FOR_GCC
-int float32_is_signaling_nan( float32 );
-#endif
-
-/*
--------------------------------------------------------------------------------
-Software IEC/IEEE double-precision conversion routines.
--------------------------------------------------------------------------------
-*/
-int float64_to_int32( float64 );
-int float64_to_int32_round_to_zero( float64 );
-#if defined(SOFTFLOAT_FOR_GCC) && defined(SOFTFLOAT_NEED_FIXUNS)
-unsigned int float64_to_uint32_round_to_zero( float64 );
-#endif
-#ifndef SOFTFLOAT_FOR_GCC /* __fix?fdi provided by libgcc2.c */
-long long float64_to_int64( float64 );
-long long float64_to_int64_round_to_zero( float64 );
-#endif
-float32 float64_to_float32( float64 );
-#ifdef FLOATX80
-floatx80 float64_to_floatx80( float64 );
-#endif
-#ifdef FLOAT128
-float128 float64_to_float128( float64 );
-#endif
-
-/*
--------------------------------------------------------------------------------
-Software IEC/IEEE double-precision operations.
--------------------------------------------------------------------------------
-*/
-float64 float64_round_to_int( float64 );
-float64 float64_add( float64, float64 );
-float64 float64_sub( float64, float64 );
-float64 float64_mul( float64, float64 );
-float64 float64_div( float64, float64 );
-float64 float64_rem( float64, float64 );
-float64 float64_sqrt( float64 );
-int float64_eq( float64, float64 );
-int float64_le( float64, float64 );
-int float64_lt( float64, float64 );
-int float64_eq_signaling( float64, float64 );
-int float64_le_quiet( float64, float64 );
-int float64_lt_quiet( float64, float64 );
-#ifndef SOFTFLOAT_FOR_GCC
-int float64_is_signaling_nan( float64 );
-#endif
-
-#ifdef FLOATX80
-
-/*
--------------------------------------------------------------------------------
-Software IEC/IEEE extended double-precision conversion routines.
--------------------------------------------------------------------------------
-*/
-int floatx80_to_int32( floatx80 );
-int floatx80_to_int32_round_to_zero( floatx80 );
-long long floatx80_to_int64( floatx80 );
-long long floatx80_to_int64_round_to_zero( floatx80 );
-float32 floatx80_to_float32( floatx80 );
-float64 floatx80_to_float64( floatx80 );
-#ifdef FLOAT128
-float128 floatx80_to_float128( floatx80 );
-#endif
-
-/*
--------------------------------------------------------------------------------
-Software IEC/IEEE extended double-precision rounding precision. Valid
-values are 32, 64, and 80.
--------------------------------------------------------------------------------
-*/
-extern int floatx80_rounding_precision;
-
-/*
--------------------------------------------------------------------------------
-Software IEC/IEEE extended double-precision operations.
--------------------------------------------------------------------------------
-*/
-floatx80 floatx80_round_to_int( floatx80 );
-floatx80 floatx80_add( floatx80, floatx80 );
-floatx80 floatx80_sub( floatx80, floatx80 );
-floatx80 floatx80_mul( floatx80, floatx80 );
-floatx80 floatx80_div( floatx80, floatx80 );
-floatx80 floatx80_rem( floatx80, floatx80 );
-floatx80 floatx80_sqrt( floatx80 );
-int floatx80_eq( floatx80, floatx80 );
-int floatx80_le( floatx80, floatx80 );
-int floatx80_lt( floatx80, floatx80 );
-int floatx80_eq_signaling( floatx80, floatx80 );
-int floatx80_le_quiet( floatx80, floatx80 );
-int floatx80_lt_quiet( floatx80, floatx80 );
-int floatx80_is_signaling_nan( floatx80 );
-
-#endif
-
-#ifdef FLOAT128
-
-/*
--------------------------------------------------------------------------------
-Software IEC/IEEE quadruple-precision conversion routines.
--------------------------------------------------------------------------------
-*/
-int float128_to_int32( float128 );
-int float128_to_int32_round_to_zero( float128 );
-long long float128_to_int64( float128 );
-long long float128_to_int64_round_to_zero( float128 );
-float32 float128_to_float32( float128 );
-float64 float128_to_float64( float128 );
-#ifdef FLOATX80
-floatx80 float128_to_floatx80( float128 );
-#endif
-
-/*
--------------------------------------------------------------------------------
-Software IEC/IEEE quadruple-precision operations.
--------------------------------------------------------------------------------
-*/
-float128 float128_round_to_int( float128 );
-float128 float128_add( float128, float128 );
-float128 float128_sub( float128, float128 );
-float128 float128_mul( float128, float128 );
-float128 float128_div( float128, float128 );
-float128 float128_rem( float128, float128 );
-float128 float128_sqrt( float128 );
-int float128_eq( float128, float128 );
-int float128_le( float128, float128 );
-int float128_lt( float128, float128 );
-int float128_eq_signaling( float128, float128 );
-int float128_le_quiet( float128, float128 );
-int float128_lt_quiet( float128, float128 );
-int float128_is_signaling_nan( float128 );
-
-#endif
-
diff --git a/lib/libc/mips/string/Makefile.inc b/lib/libc/mips/string/Makefile.inc
deleted file mode 100644
index 266446c9d132..000000000000
--- a/lib/libc/mips/string/Makefile.inc
+++ /dev/null
@@ -1,13 +0,0 @@
-# $FreeBSD$
-
-MDSRCS+= \
- bcmp.S \
- bcopy.S \
- bzero.S \
- ffs.S \
- memcpy.S \
- memmove.S \
- strchr.S \
- strcmp.S \
- strlen.S \
- strrchr.S
diff --git a/lib/libc/mips/string/bcmp.S b/lib/libc/mips/string/bcmp.S
deleted file mode 100644
index ffcaeeb1a3fa..000000000000
--- a/lib/libc/mips/string/bcmp.S
+++ /dev/null
@@ -1,130 +0,0 @@
-/* $NetBSD: bcmp.S,v 1.9 2009/12/14 01:07:42 matt Exp $ */
-
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#define _LOCORE /* XXX not really, just assembly-code source */
-#include <machine/endian.h> /* LWLO/LWHI, SWLO/SWHI */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
- ASMSTR("from: @(#)bcmp.s 8.1 (Berkeley) 6/4/93")
-#else
- ASMSTR("$NetBSD: bcmp.S,v 1.9 2009/12/14 01:07:42 matt Exp $")
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#ifdef __ABICALLS__
- .abicalls
-#endif
-
-/* bcmp(s1, s2, n) */
-
-
-LEAF(bcmp)
- .set noreorder
- blt a2, 16, small # is it worth any trouble?
- xor v0, a0, a1 # compare low two bits of addresses
- and v0, v0, 3
- PTR_SUBU a3, zero, a1 # compute # bytes to word align address
- bne v0, zero, unaligned # not possible to align addresses
- and a3, a3, 3
-
- beq a3, zero, 1f
- PTR_SUBU a2, a2, a3 # subtract from remaining count
- move v0, v1 # init v0,v1 so unmodified bytes match
- LWHI v0, 0(a0) # read 1, 2, or 3 bytes
- LWHI v1, 0(a1)
- PTR_ADDU a1, a1, a3
- bne v0, v1, nomatch
- PTR_ADDU a0, a0, a3
-1:
- and a3, a2, ~3 # compute number of whole words left
- PTR_SUBU a2, a2, a3 # which has to be >= (16-3) & ~3
- PTR_ADDU a3, a3, a0 # compute ending address
-2:
- lw v0, 0(a0) # compare words
- lw v1, 0(a1)
- PTR_ADDU a0, a0, 4
- bne v0, v1, nomatch
- PTR_ADDU a1, a1, 4
- bne a0, a3, 2b
- nop
- b small # finish remainder
- nop
-unaligned:
- beq a3, zero, 2f
- PTR_SUBU a2, a2, a3 # subtract from remaining count
- PTR_ADDU a3, a3, a0 # compute ending address
-1:
- lbu v0, 0(a0) # compare bytes until a1 word aligned
- lbu v1, 0(a1)
- PTR_ADDU a0, a0, 1
- bne v0, v1, nomatch
- PTR_ADDU a1, a1, 1
- bne a0, a3, 1b
- nop
-2:
- and a3, a2, ~3 # compute number of whole words left
- PTR_SUBU a2, a2, a3 # which has to be >= (16-3) & ~3
- PTR_ADDU a3, a3, a0 # compute ending address
-3:
- LWHI v0, 0(a0) # compare words a0 unaligned, a1 aligned
- LWLO v0, 3(a0)
- lw v1, 0(a1)
- PTR_ADDU a0, a0, 4
- bne v0, v1, nomatch
- PTR_ADDU a1, a1, 4
- bne a0, a3, 3b
- nop
-small:
- ble a2, zero, match
- PTR_ADDU a3, a2, a0 # compute ending address
-1:
- lbu v0, 0(a0)
- lbu v1, 0(a1)
- PTR_ADDU a0, a0, 1
- bne v0, v1, nomatch
- PTR_ADDU a1, a1, 1
- bne a0, a3, 1b
- nop
-match:
- j ra
- move v0, zero
-nomatch:
- j ra
- li v0, 1
- .set reorder
-END(bcmp)
diff --git a/lib/libc/mips/string/bcopy.S b/lib/libc/mips/string/bcopy.S
deleted file mode 100644
index bc227e07d662..000000000000
--- a/lib/libc/mips/string/bcopy.S
+++ /dev/null
@@ -1,297 +0,0 @@
-/* $NetBSD: bcopy.S,v 1.3 2009/12/14 00:39:00 matt Exp $ */
-
-/*
- * Mach Operating System
- * Copyright (c) 1993 Carnegie Mellon University
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
- * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie Mellon
- * the rights to redistribute these changes.
- */
-
-/*
- * File: mips_bcopy.s
- * Author: Chris Maeda
- * Date: June 1993
- *
- * Fast copy routine. Derived from aligned_block_copy.
- */
-
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#define _LOCORE /* XXX not really, just assembly-code source */
-#include <machine/endian.h>
-
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
- ASMSTR("from: @(#)mips_bcopy.s 2.2 CMU 18/06/93")
-#else
- ASMSTR("$NetBSD: bcopy.S,v 1.3 2009/12/14 00:39:00 matt Exp $")
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#ifdef __ABICALLS__
- .abicalls
-#endif
-
-/*
- * bcopy(caddr_t src, caddr_t dst, unsigned int len)
- *
- * a0 src address
- * a1 dst address
- * a2 length
- */
-
-#if defined(MEMCOPY) || defined(MEMMOVE)
-#ifdef MEMCOPY
-#define FUNCTION memcpy
-#else
-#define FUNCTION memmove
-#endif
-#define SRCREG a1
-#define DSTREG a0
-#else
-#define FUNCTION bcopy
-#define SRCREG a0
-#define DSTREG a1
-#endif
-
-#define SIZEREG a2
-
-LEAF(FUNCTION)
- .set noat
- .set noreorder
-
-#if defined(MEMCOPY) || defined(MEMMOVE)
- /* set up return value, while we still can */
- move v0,DSTREG
-#endif
- /*
- * Make sure we can copy forwards.
- */
- sltu t0,SRCREG,DSTREG # t0 == SRCREG < DSTREG
- bne t0,zero,6f # copy backwards
-
- /*
- * There are four alignment cases (with frequency)
- * (Based on measurements taken with a DECstation 5000/200
- * inside a Mach kernel.)
- *
- * aligned -> aligned (mostly)
- * unaligned -> aligned (sometimes)
- * aligned,unaligned -> unaligned (almost never)
- *
- * Note that we could add another case that checks if
- * the destination and source are unaligned but the
- * copy is alignable. eg if src and dest are both
- * on a halfword boundary.
- */
- andi t1,DSTREG,(SZREG-1) # get last bits of dest
- bne t1,zero,3f # dest unaligned
- andi t0,SRCREG,(SZREG-1) # get last bits of src
- bne t0,zero,5f
-
- /*
- * Forward aligned->aligned copy, 8 words at a time.
- */
-98:
- li AT,-(SZREG*8)
- and t0,SIZEREG,AT # count truncated to multiples
- PTR_ADDU a3,SRCREG,t0 # run fast loop up to this addr
- sltu AT,SRCREG,a3 # any work to do?
- beq AT,zero,2f
- PTR_SUBU SIZEREG,t0
-
- /*
- * loop body
- */
-1: # cp
- REG_L t3,(0*SZREG)(SRCREG)
- REG_L v1,(1*SZREG)(SRCREG)
- REG_L t0,(2*SZREG)(SRCREG)
- REG_L t1,(3*SZREG)(SRCREG)
- PTR_ADDU SRCREG,SZREG*8
- REG_S t3,(0*SZREG)(DSTREG)
- REG_S v1,(1*SZREG)(DSTREG)
- REG_S t0,(2*SZREG)(DSTREG)
- REG_S t1,(3*SZREG)(DSTREG)
- REG_L t1,(-1*SZREG)(SRCREG)
- REG_L t0,(-2*SZREG)(SRCREG)
- REG_L v1,(-3*SZREG)(SRCREG)
- REG_L t3,(-4*SZREG)(SRCREG)
- PTR_ADDU DSTREG,SZREG*8
- REG_S t1,(-1*SZREG)(DSTREG)
- REG_S t0,(-2*SZREG)(DSTREG)
- REG_S v1,(-3*SZREG)(DSTREG)
- bne SRCREG,a3,1b
- REG_S t3,(-4*SZREG)(DSTREG)
-
- /*
- * Copy a word at a time, no loop unrolling.
- */
-2: # wordcopy
- andi t2,SIZEREG,(SZREG-1) # get byte count / SZREG
- PTR_SUBU t2,SIZEREG,t2 # t2 = words to copy * SZREG
- beq t2,zero,3f
- PTR_ADDU t0,SRCREG,t2 # stop at t0
- PTR_SUBU SIZEREG,SIZEREG,t2
-1:
- REG_L t3,0(SRCREG)
- PTR_ADDU SRCREG,SZREG
- REG_S t3,0(DSTREG)
- bne SRCREG,t0,1b
- PTR_ADDU DSTREG,SZREG
-
-3: # bytecopy
- beq SIZEREG,zero,4f # nothing left to do?
- nop
-1:
- lb t3,0(SRCREG)
- PTR_ADDU SRCREG,1
- sb t3,0(DSTREG)
- PTR_SUBU SIZEREG,1
- bgtz SIZEREG,1b
- PTR_ADDU DSTREG,1
-
-4: # copydone
- j ra
- nop
-
- /*
- * Copy from unaligned source to aligned dest.
- */
-5: # destaligned
- andi t0,SIZEREG,(SZREG-1) # t0 = bytecount mod SZREG
- PTR_SUBU a3,SIZEREG,t0 # number of words to transfer
- beq a3,zero,3b
- nop
- move SIZEREG,t0 # this many to do after we are done
- PTR_ADDU a3,SRCREG,a3 # stop point
-
-1:
- REG_LHI t3,0(SRCREG)
- REG_LLO t3,SZREG-1(SRCREG)
- PTR_ADDI SRCREG,SZREG
- REG_S t3,0(DSTREG)
- bne SRCREG,a3,1b
- PTR_ADDI DSTREG,SZREG
-
- b 3b
- nop
-
-6: # backcopy -- based on above
- PTR_ADDU SRCREG,SIZEREG
- PTR_ADDU DSTREG,SIZEREG
- andi t1,DSTREG,SZREG-1 # get last 3 bits of dest
- bne t1,zero,3f
- andi t0,SRCREG,SZREG-1 # get last 3 bits of src
- bne t0,zero,5f
-
- /*
- * Forward aligned->aligned copy, 8*4 bytes at a time.
- */
- li AT,(-8*SZREG)
- and t0,SIZEREG,AT # count truncated to multiple of 32
- beq t0,zero,2f # any work to do?
- PTR_SUBU SIZEREG,t0
- PTR_SUBU a3,SRCREG,t0
-
- /*
- * loop body
- */
-1: # cp
- REG_L t3,(-4*SZREG)(SRCREG)
- REG_L v1,(-3*SZREG)(SRCREG)
- REG_L t0,(-2*SZREG)(SRCREG)
- REG_L t1,(-1*SZREG)(SRCREG)
- PTR_SUBU SRCREG,8*SZREG
- REG_S t3,(-4*SZREG)(DSTREG)
- REG_S v1,(-3*SZREG)(DSTREG)
- REG_S t0,(-2*SZREG)(DSTREG)
- REG_S t1,(-1*SZREG)(DSTREG)
- REG_L t1,(3*SZREG)(SRCREG)
- REG_L t0,(2*SZREG)(SRCREG)
- REG_L v1,(1*SZREG)(SRCREG)
- REG_L t3,(0*SZREG)(SRCREG)
- PTR_SUBU DSTREG,8*SZREG
- REG_S t1,(3*SZREG)(DSTREG)
- REG_S t0,(2*SZREG)(DSTREG)
- REG_S v1,(1*SZREG)(DSTREG)
- bne SRCREG,a3,1b
- REG_S t3,(0*SZREG)(DSTREG)
-
- /*
- * Copy a word at a time, no loop unrolling.
- */
-2: # wordcopy
- andi t2,SIZEREG,SZREG-1 # get byte count / 4
- PTR_SUBU t2,SIZEREG,t2 # t2 = number of words to copy
- beq t2,zero,3f
- PTR_SUBU t0,SRCREG,t2 # stop at t0
- PTR_SUBU SIZEREG,SIZEREG,t2
-1:
- REG_L t3,-SZREG(SRCREG)
- PTR_SUBU SRCREG,SZREG
- REG_S t3,-SZREG(DSTREG)
- bne SRCREG,t0,1b
- PTR_SUBU DSTREG,SZREG
-
-3: # bytecopy
- beq SIZEREG,zero,4f # nothing left to do?
- nop
-1:
- lb t3,-1(SRCREG)
- PTR_SUBU SRCREG,1
- sb t3,-1(DSTREG)
- PTR_SUBU SIZEREG,1
- bgtz SIZEREG,1b
- PTR_SUBU DSTREG,1
-
-4: # copydone
- j ra
- nop
-
- /*
- * Copy from unaligned source to aligned dest.
- */
-5: # destaligned
- andi t0,SIZEREG,SZREG-1 # t0 = bytecount mod 4
- PTR_SUBU a3,SIZEREG,t0 # number of words to transfer
- beq a3,zero,3b
- nop
- move SIZEREG,t0 # this many to do after we are done
- PTR_SUBU a3,SRCREG,a3 # stop point
-
-1:
- REG_LHI t3,-SZREG(SRCREG)
- REG_LLO t3,-1(SRCREG)
- PTR_SUBU SRCREG,SZREG
- REG_S t3,-SZREG(DSTREG)
- bne SRCREG,a3,1b
- PTR_SUBU DSTREG,SZREG
-
- b 3b
- nop
-
- .set reorder
- .set at
- END(FUNCTION)
diff --git a/lib/libc/mips/string/bzero.S b/lib/libc/mips/string/bzero.S
deleted file mode 100644
index 83e54ba4baea..000000000000
--- a/lib/libc/mips/string/bzero.S
+++ /dev/null
@@ -1,83 +0,0 @@
-/* $NetBSD: bzero.S,v 1.10 2009/12/14 02:53:52 matt Exp $ */
-
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
- ASMSTR("from: @(#)bzero.s 8.1 (Berkeley) 6/4/93")
-#else
- ASMSTR("$NetBSD: bzero.S,v 1.10 2009/12/14 02:53:52 matt Exp $")
-#endif
-#endif /* LIBC_SCCS and not lint */
-
-#define _LOCORE /* XXX not really, just assembly-code source */
-#include <machine/endian.h>
-
-#ifdef __ABICALLS__
- .abicalls
-#endif
-
-/* bzero(s1, n) */
-
-LEAF(bzero)
- .set noreorder
- blt a1, 3*SZREG, smallclr # small amount to clear?
- PTR_SUBU a3, zero, a0 # compute # bytes to word align address
- and a3, a3, SZREG-1
- beq a3, zero, 1f # skip if word aligned
- PTR_SUBU a1, a1, a3 # subtract from remaining count
- REG_SHI zero, 0(a0) # clear 1, 2, or 3 bytes to align
- PTR_ADDU a0, a0, a3
-1:
- and v0, a1, SZREG-1 # compute number of words left
- PTR_SUBU a3, a1, v0
- move a1, v0
- PTR_ADDU a3, a3, a0 # compute ending address
-2:
- PTR_ADDU a0, a0, SZREG # clear words
- bne a0, a3, 2b # unrolling loop doesnt help
- REG_S zero, -SZREG(a0) # since we are limited by memory speed
-smallclr:
- ble a1, zero, 2f
- PTR_ADDU a3, a1, a0 # compute ending address
-1:
- PTR_ADDU a0, a0, 1 # clear bytes
- bne a0, a3, 1b
- sb zero, -1(a0)
-2:
- j ra
- nop
-END(bzero)
diff --git a/lib/libc/mips/string/ffs.S b/lib/libc/mips/string/ffs.S
deleted file mode 100644
index 17e509c24637..000000000000
--- a/lib/libc/mips/string/ffs.S
+++ /dev/null
@@ -1,59 +0,0 @@
-/* $NetBSD: ffs.S,v 1.2 2009/12/14 00:39:00 matt Exp $ */
-
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#if defined(LIBC_SCCS) && !defined(lint)
- ASMSTR("from: @(#)ffs.s 8.1 (Berkeley) 6/4/93")
- ASMSTR("$NetBSD: ffs.S,v 1.2 2009/12/14 00:39:00 matt Exp $")
-#endif /* LIBC_SCCS and not lint */
-
-#ifdef __ABICALLS__
- .abicalls
-#endif
-
-/* bit = ffs(value) */
-
-LEAF(ffs)
- move v0, zero
- beq a0, zero, done
-1:
- and v1, a0, 1 # bit set?
- addu v0, v0, 1
- srl a0, a0, 1
- beq v1, zero, 1b # no, continue
-done:
- j ra
-END(ffs)
diff --git a/lib/libc/mips/string/memcpy.S b/lib/libc/mips/string/memcpy.S
deleted file mode 100644
index 8d3c0dbfcf2c..000000000000
--- a/lib/libc/mips/string/memcpy.S
+++ /dev/null
@@ -1,7 +0,0 @@
-/* $NetBSD: memcpy.S,v 1.1 2005/12/20 19:28:50 christos Exp $ */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#define MEMCOPY
-#include "bcopy.S"
diff --git a/lib/libc/mips/string/memmove.S b/lib/libc/mips/string/memmove.S
deleted file mode 100644
index 29d9e707ee46..000000000000
--- a/lib/libc/mips/string/memmove.S
+++ /dev/null
@@ -1,7 +0,0 @@
-/* $NetBSD: memmove.S,v 1.1 2005/12/20 19:28:50 christos Exp $ */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#define MEMMOVE
-#include "bcopy.S"
diff --git a/lib/libc/mips/string/strchr.S b/lib/libc/mips/string/strchr.S
deleted file mode 100644
index 19dae58415e2..000000000000
--- a/lib/libc/mips/string/strchr.S
+++ /dev/null
@@ -1,66 +0,0 @@
-/* $NetBSD: index.S,v 1.8 2005/04/22 06:59:00 simonb Exp $ */
-
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#if defined(LIBC_SCCS) && !defined(lint)
- ASMSTR("from: @(#)index.s 8.1 (Berkeley) 6/4/93")
- ASMSTR("$NetBSD: index.S,v 1.8 2005/04/22 06:59:00 simonb Exp $")
-#endif /* LIBC_SCCS and not lint */
-
-#ifdef __ABICALLS__
- .abicalls
-#endif
-
-/*
- * char *
- * strchr(const char *s, int c);
- */
-LEAF(strchr)
- and a1, a1, 0xff
-1:
- lbu a2, 0(a0) # get a byte
- PTR_ADDU a0, a0, 1
- beq a2, a1, fnd
- bne a2, zero, 1b
-notfnd:
- move v0, zero
- j ra
-fnd:
- PTR_SUBU v0, a0, 1
- j ra
-END(strchr)
-
-WEAK_ALIAS(index, strchr)
diff --git a/lib/libc/mips/string/strcmp.S b/lib/libc/mips/string/strcmp.S
deleted file mode 100644
index 8a9905630ce8..000000000000
--- a/lib/libc/mips/string/strcmp.S
+++ /dev/null
@@ -1,68 +0,0 @@
-/* $NetBSD: strcmp.S,v 1.2 2009/12/14 00:39:00 matt Exp $ */
-
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#if defined(LIBC_SCCS) && !defined(lint)
- ASMSTR("from: @(#)strcmp.s 8.1 (Berkeley) 6/4/93")
- ASMSTR("$NetBSD: strcmp.S,v 1.2 2009/12/14 00:39:00 matt Exp $")
-#endif /* LIBC_SCCS and not lint */
-
-#ifdef __ABICALLS__
- .abicalls
-#endif
-
-/*
- * NOTE: this version assumes unsigned chars in order to be "8 bit clean".
- */
-LEAF(strcmp)
-1:
- lbu t0, 0(a0) # get two bytes and compare them
- lbu t1, 0(a1)
- beq t0, zero, LessOrEq # end of first string?
- bne t0, t1, NotEq
- lbu t0, 1(a0) # unroll loop
- lbu t1, 1(a1)
- PTR_ADD a0, a0, 2
- beq t0, zero, LessOrEq # end of first string?
- PTR_ADD a1, a1, 2
- beq t0, t1, 1b
-NotEq:
- subu v0, t0, t1
- j ra
-LessOrEq:
- subu v0, zero, t1
- j ra
-END(strcmp)
diff --git a/lib/libc/mips/string/strlen.S b/lib/libc/mips/string/strlen.S
deleted file mode 100644
index 3b46ccceb54b..000000000000
--- a/lib/libc/mips/string/strlen.S
+++ /dev/null
@@ -1,55 +0,0 @@
-/* $NetBSD: strlen.S,v 1.2 2009/12/14 00:39:00 matt Exp $ */
-
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#if defined(LIBC_SCCS) && !defined(lint)
- ASMSTR("from: @(#)strlen.s 8.1 (Berkeley) 6/4/93")
- ASMSTR("$NetBSD: strlen.S,v 1.2 2009/12/14 00:39:00 matt Exp $")
-#endif /* LIBC_SCCS and not lint */
-
-#ifdef __ABICALLS__
- .abicalls
-#endif
-
-LEAF(strlen)
- PTR_ADDU v1, a0, 1
-1:
- lb v0, 0(a0) # get byte from string
- PTR_ADDU a0, a0, 1 # increment pointer
- bne v0, zero, 1b # continue if not end
- PTR_SUBU v0, a0, v1 # compute length - 1 for '\0' char
- j ra
-END(strlen)
diff --git a/lib/libc/mips/string/strrchr.S b/lib/libc/mips/string/strrchr.S
deleted file mode 100644
index c0dcef049d6e..000000000000
--- a/lib/libc/mips/string/strrchr.S
+++ /dev/null
@@ -1,64 +0,0 @@
-/* $NetBSD: rindex.S,v 1.7 2003/08/07 16:42:16 agc Exp $ */
-
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#if defined(LIBC_SCCS) && !defined(lint)
- ASMSTR("from: @(#)rindex.s 8.1 (Berkeley) 6/4/93")
- ASMSTR("$NetBSD: rindex.S,v 1.7 2003/08/07 16:42:16 agc Exp $")
-#endif /* LIBC_SCCS and not lint */
-
-#ifdef __ABICALLS__
- .abicalls
-#endif
-
-/*
- * char *
- * strrchr(const char *s, int c);
- */
-LEAF(strrchr)
- move v0, zero # default if not found
- and a1, a1, 0xff
-1:
- lbu a3, 0(a0) # get a byte
- PTR_ADDU a0, a0, 1
- bne a3, a1, 2f
- PTR_SUBU v0, a0, 1 # save address of last match
-2:
- bne a3, zero, 1b # continue if not end
- j ra
-END(strrchr)
-
-WEAK_ALIAS(rindex, strrchr)
diff --git a/lib/libc/mips/sys/Makefile.inc b/lib/libc/mips/sys/Makefile.inc
deleted file mode 100644
index d7cc70d01b07..000000000000
--- a/lib/libc/mips/sys/Makefile.inc
+++ /dev/null
@@ -1,8 +0,0 @@
-# $FreeBSD$
-
-SRCS+= trivial-vdso_tc.c
-
-MDASM= Ovfork.S cerror.S syscall.S
-
-# Don't generate default code for these syscalls:
-NOASM+= sbrk.o vfork.o
diff --git a/lib/libc/mips/sys/Ovfork.S b/lib/libc/mips/sys/Ovfork.S
deleted file mode 100644
index 9df93ea59e9d..000000000000
--- a/lib/libc/mips/sys/Ovfork.S
+++ /dev/null
@@ -1,64 +0,0 @@
-/* $NetBSD: compat_Ovfork.S,v 1.1 2005/09/17 11:49:39 tsutsui Exp $ */
-
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-#include "SYS.h"
-
-#if defined(LIBC_SCCS) && !defined(lint)
- ASMSTR("from: @(#)Ovfork.s 8.1 (Berkeley) 6/4/93")
- ASMSTR("$NetBSD: compat_Ovfork.S,v 1.1 2005/09/17 11:49:39 tsutsui Exp $")
-#endif /* LIBC_SCCS and not lint */
-
-/*
- * pid = vfork();
- *
- * v1 == 0 in parent process, v1 == 1 in child process.
- * v0 == pid of child in parent, v0 == pid of parent in child.
- */
-
-LEAF(__sys_vfork)
- WEAK_ALIAS(vfork, __sys_vfork)
- WEAK_ALIAS(_vfork, __sys_vfork)
- PIC_PROLOGUE(__sys_vfork)
- li v0, SYS_vfork # system call number for vfork
- syscall
- beq a3, zero, 1f # jump if no errors
- PIC_TAILCALL(__cerror)
-1:
- beq v1, zero, 2f # parent process ?
- move v0, zero # return zero in child
-2:
- PIC_RETURN()
-END(__sys_vfork)
diff --git a/lib/libc/mips/sys/cerror.S b/lib/libc/mips/sys/cerror.S
deleted file mode 100644
index c504d73afa3f..000000000000
--- a/lib/libc/mips/sys/cerror.S
+++ /dev/null
@@ -1,72 +0,0 @@
-/* $NetBSD: cerror.S,v 1.14 2009/12/14 01:07:42 matt Exp $ */
-
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-#include "SYS.h"
-
-#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
- RCSID("from: @(#)cerror.s 8.1 (Berkeley) 6/16/93")
-#else
- RCSID("$NetBSD: cerror.S,v 1.14 2009/12/14 01:07:42 matt Exp $")
-#endif
-#endif /* LIBC_SCCS and not lint */
-
- .globl _C_LABEL(__error)
-NESTED_NOPROFILE(__cerror, CALLFRAME_SIZ, ra)
- .mask 0x80000000, (CALLFRAME_RA - CALLFRAME_SIZ)
- SETUP_GP
- PTR_SUBU sp, sp, CALLFRAME_SIZ
- SETUP_GP64(CALLFRAME_GP, __cerror)
- SAVE_GP(CALLFRAME_GP)
-
- PTR_S ra, CALLFRAME_RA(sp)
- REG_S v0, CALLFRAME_S0(sp) # save errno value
-
- PTR_LA t9, _C_LABEL(__error) # locate address of errno
- jalr t9
-
- REG_L t0, CALLFRAME_S0(sp)
- PTR_L ra, CALLFRAME_RA(sp)
- INT_S t0, 0(v0) # update errno value
-
- RESTORE_GP64
- PTR_ADDU sp, sp, CALLFRAME_SIZ
-
- li v0, -1
- li v1, -1
-
- j ra
-END(__cerror)
diff --git a/lib/libc/mips/sys/syscall.S b/lib/libc/mips/sys/syscall.S
deleted file mode 100644
index b3c6708b5da5..000000000000
--- a/lib/libc/mips/sys/syscall.S
+++ /dev/null
@@ -1,44 +0,0 @@
-/* $NetBSD: syscall.S,v 1.5 2003/08/07 16:42:18 agc Exp $ */
-
-/*-
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-#include "SYS.h"
-
-#if defined(LIBC_SCCS) && !defined(lint)
- ASMSTR("from: @(#)syscall.s 8.1 (Berkeley) 6/4/93")
- ASMSTR("$NetBSD: syscall.S,v 1.5 2003/08/07 16:42:18 agc Exp $")
-#endif /* LIBC_SCCS and not lint */
-
-RSYSCALL(syscall)
diff --git a/lib/libc/nameser/Makefile.inc b/lib/libc/nameser/Makefile.inc
index cbb21220040b..f91cccbc1713 100644
--- a/lib/libc/nameser/Makefile.inc
+++ b/lib/libc/nameser/Makefile.inc
@@ -1,4 +1,3 @@
-# $FreeBSD$
# nameser sources
.PATH: ${LIBC_SRCTOP}/nameser
diff --git a/lib/libc/nameser/Symbol.map b/lib/libc/nameser/Symbol.map
index 2c4b76e69410..0d328cb0f23c 100644
--- a/lib/libc/nameser/Symbol.map
+++ b/lib/libc/nameser/Symbol.map
@@ -1,7 +1,3 @@
-/*
- * $FreeBSD$
- */
-
FBSD_1.0 {
__ns_makecanon;
__ns_msg_getflag;
@@ -39,14 +35,4 @@ FBSD_1.4 {
__ns_name_owned;
__ns_name_map;
__ns_name_labels;
- __ns_newmsg_init;
- __ns_newmsg_copy;
- __ns_newmsg_id;
- __ns_newmsg_flag;
- __ns_newmsg_q;
- __ns_newmsg_rr;
- __ns_newmsg_done;
- __ns_rdata_unpack;
- __ns_rdata_equal;
- __ns_rdata_refers;
};
diff --git a/lib/libc/nameser/ns_name.c b/lib/libc/nameser/ns_name.c
index f45278b989b1..ab6a81ed7b4e 100644
--- a/lib/libc/nameser/ns_name.c
+++ b/lib/libc/nameser/ns_name.c
@@ -17,12 +17,6 @@
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#ifndef lint
-static const char rcsid[] = "$Id: ns_name.c,v 1.11 2009/01/23 19:59:16 each Exp $";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "port_before.h"
#include <sys/types.h>
@@ -1150,7 +1144,7 @@ labellen(const u_char *lp)
bitlen = 256;
return ((bitlen + 7 ) / 8 + 1);
}
- return (-1); /*%< unknwon ELT */
+ return (-1); /*%< unknown ELT */
}
return (l);
}
diff --git a/lib/libc/nameser/ns_netint.c b/lib/libc/nameser/ns_netint.c
index fc179e225288..0253ea1aa58e 100644
--- a/lib/libc/nameser/ns_netint.c
+++ b/lib/libc/nameser/ns_netint.c
@@ -17,12 +17,6 @@
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#ifndef lint
-static const char rcsid[] = "$Id: ns_netint.c,v 1.3 2005/04/27 04:56:40 sra Exp $";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/* Import. */
#include "port_before.h"
diff --git a/lib/libc/nameser/ns_parse.c b/lib/libc/nameser/ns_parse.c
index 7a3382ed7703..40f19d33c2bc 100644
--- a/lib/libc/nameser/ns_parse.c
+++ b/lib/libc/nameser/ns_parse.c
@@ -17,12 +17,6 @@
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#ifndef lint
-static const char rcsid[] = "$Id: ns_parse.c,v 1.10 2009/01/23 19:59:16 each Exp $";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/* Import. */
#include "port_before.h"
diff --git a/lib/libc/nameser/ns_print.c b/lib/libc/nameser/ns_print.c
index 52f13e2673c7..bf2cb1d2ce24 100644
--- a/lib/libc/nameser/ns_print.c
+++ b/lib/libc/nameser/ns_print.c
@@ -17,12 +17,6 @@
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#ifndef lint
-static const char rcsid[] = "$Id: ns_print.c,v 1.12 2009/03/03 05:29:58 each Exp $";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/* Import. */
#include "port_before.h"
diff --git a/lib/libc/nameser/ns_samedomain.c b/lib/libc/nameser/ns_samedomain.c
index 858d0d1436a5..d80688b9d335 100644
--- a/lib/libc/nameser/ns_samedomain.c
+++ b/lib/libc/nameser/ns_samedomain.c
@@ -17,12 +17,6 @@
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#ifndef lint
-static const char rcsid[] = "$Id: ns_samedomain.c,v 1.6 2005/04/27 04:56:40 sra Exp $";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "port_before.h"
#include <sys/types.h>
diff --git a/lib/libc/nameser/ns_ttl.c b/lib/libc/nameser/ns_ttl.c
index 2ebbcc4f8c17..2050eb5754be 100644
--- a/lib/libc/nameser/ns_ttl.c
+++ b/lib/libc/nameser/ns_ttl.c
@@ -17,12 +17,6 @@
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#ifndef lint
-static const char rcsid[] = "$Id: ns_ttl.c,v 1.4 2005/07/28 06:51:49 marka Exp $";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/* Import. */
#include "port_before.h"
diff --git a/lib/libc/net/Makefile.inc b/lib/libc/net/Makefile.inc
index 6628028ccc83..cd4ccaefac92 100644
--- a/lib/libc/net/Makefile.inc
+++ b/lib/libc/net/Makefile.inc
@@ -1,5 +1,3 @@
-# from @(#)Makefile.inc 8.2 (Berkeley) 9/5/93
-# $FreeBSD$
# machine-independent net sources
.PATH: ${LIBC_SRCTOP}/net
@@ -14,7 +12,7 @@ SRCS+= base64.c ether_addr.c eui64.c \
if_indextoname.c if_nameindex.c if_nametoindex.c \
ip6opt.c linkaddr.c map_v4v6.c name6.c ntoh.c \
nsdispatch.c nslexer.l nsparser.y nss_compat.c \
- rcmd.c rcmdsh.c recv.c rthdr.c sctp_sys_calls.c send.c \
+ rcmd.c rcmdsh.c rthdr.c sctp_sys_calls.c \
sockatmark.c sourcefilter.c vars.c
.if ${MK_NS_CACHING} != "no"
@@ -51,38 +49,75 @@ MAN+= byteorder.3 ethers.3 eui64.3 \
sctp_getaddrlen.3 sctp_getassocid.3 sctp_getpaddrs.3 \
sctp_opt_info.3 sctp_recvmsg.3 sctp_send.3 sctp_sendmsg.3 \
-MLINKS+=byteorder.3 htonl.3 byteorder.3 htons.3 byteorder.3 ntohl.3 \
+MLINKS+=byteorder.3 htonl.3 \
+ byteorder.3 htons.3 \
+ byteorder.3 ntohl.3 \
byteorder.3 ntohs.3
-MLINKS+=ethers.3 ether_aton.3 ethers.3 ether_hostton.3 ethers.3 ether_line.3 \
- ethers.3 ether_ntoa.3 ethers.3 ether_ntohost.3
-MLINKS+=eui64.3 eui64_aton.3 eui64.3 eui64_hostton.3 \
- eui64.3 eui64_ntoa.3 eui64.3 eui64_ntohost.3
-MLINKS+=getaddrinfo.3 freeaddrinfo.3
-MLINKS+=gethostbyname.3 endhostent.3 gethostbyname.3 gethostbyaddr.3 \
- gethostbyname.3 gethostbyname2.3 gethostbyname.3 gethostent.3 \
- gethostbyname.3 herror.3 gethostbyname.3 hstrerror.3 \
+MLINKS+=ethers.3 ether_aton.3 \
+ ethers.3 ether_aton_r.3 \
+ ethers.3 ether_hostton.3 \
+ ethers.3 ether_line.3 \
+ ethers.3 ether_ntoa.3 \
+ ethers.3 ether_ntoa_r.3 \
+ ethers.3 ether_ntohost.3
+MLINKS+=eui64.3 eui64_aton.3 \
+ eui64.3 eui64_hostton.3 \
+ eui64.3 eui64_ntoa.3 \
+ eui64.3 eui64_ntohost.3
+MLINKS+=getaddrinfo.3 freeaddrinfo.3
+MLINKS+=gethostbyname.3 endhostent.3 \
+ gethostbyname.3 gethostbyaddr.3 \
+ gethostbyname.3 gethostbyaddr_r.3 \
+ gethostbyname.3 gethostbyname2.3 \
+ gethostbyname.3 gethostbyname2_r.3 \
+ gethostbyname.3 gethostbyname_r.3 \
+ gethostbyname.3 gethostent.3 \
+ gethostbyname.3 herror.3 \
+ gethostbyname.3 hstrerror.3 \
gethostbyname.3 sethostent.3
MLINKS+=getifaddrs.3 freeifaddrs.3
MLINKS+=getifmaddrs.3 freeifmaddrs.3
-MLINKS+=getipnodebyname.3 getipnodebyaddr.3 getipnodebyname.3 freehostent.3
-MLINKS+=getnetent.3 endnetent.3 getnetent.3 getnetbyaddr.3 \
- getnetent.3 getnetbyname.3 getnetent.3 setnetent.3
-MLINKS+=getprotoent.3 endprotoent.3 getprotoent.3 getprotobyname.3 \
- getprotoent.3 getprotobynumber.3 getprotoent.3 setprotoent.3
-MLINKS+=getservent.3 endservent.3 getservent.3 getservbyname.3 \
- getservent.3 getservbyport.3 getservent.3 setservent.3
-MLINKS+=if_indextoname.3 if_nametoindex.3 if_indextoname.3 if_nameindex.3 \
+MLINKS+=getipnodebyname.3 getipnodebyaddr.3 \
+ getipnodebyname.3 freehostent.3
+MLINKS+=getnetent.3 endnetent.3 \
+ getnetent.3 getnetbyaddr.3 \
+ getnetent.3 getnetbyaddr_r.3 \
+ getnetent.3 getnetbyname.3 \
+ getnetent.3 getnetbyname_r.3 \
+ getnetent.3 setnetent.3 \
+ getnetent.3 getnetent_r.3
+MLINKS+=getprotoent.3 endprotoent.3 \
+ getprotoent.3 getprotobyname.3 \
+ getprotoent.3 getprotobynumber.3 \
+ getprotoent.3 setprotoent.3
+MLINKS+=getservent.3 endservent.3 \
+ getservent.3 getservbyname.3 \
+ getservent.3 getservbyport.3 \
+ getservent.3 setservent.3
+MLINKS+=if_indextoname.3 if_nametoindex.3 \
+ if_indextoname.3 if_nameindex.3 \
if_indextoname.3 if_freenameindex.3
-MLINKS+=inet.3 addr.3 inet.3 inet_addr.3 inet.3 inet_aton.3 \
- inet.3 inet_lnaof.3 inet.3 inet_makeaddr.3 inet.3 inet_netof.3 \
- inet.3 inet_network.3 inet.3 inet_ntoa.3 inet.3 inet_ntoa_r.3\
- inet.3 inet_ntop.3 inet.3 inet_pton.3 \
- inet.3 network.3 inet.3 ntoa.3
-MLINKS+= sctp_send.3 sctp_sendx.3
-MLINKS+= sctp_sendmsg.3 sctp_sendmsgx.3
-MLINKS+= sctp_freepaddrs.3 sctp_freeladdrs.3
-MLINKS+= sctp_getpaddrs.3 sctp_getladdrs.3
-MLINKS+=inet_net.3 inet_net_ntop.3 inet_net.3 inet_net_pton.3
+MLINKS+=inet.3 addr.3 \
+ inet.3 inet_addr.3 \
+ inet.3 inet_aton.3 \
+ inet.3 inet_lnaof.3 \
+ inet.3 inet_makeaddr.3 \
+ inet.3 inet_netof.3 \
+ inet.3 inet_network.3 \
+ inet.3 inet_ntoa.3 \
+ inet.3 inet_ntoa_r.3 \
+ inet.3 inet_ntop.3 \
+ inet.3 inet_pton.3 \
+ inet.3 network.3 \
+ inet.3 ntoa.3
+MLINKS+=sctp_freepaddrs.3 sctp_freeladdrs.3
+MLINKS+=sctp_getpaddrs.3 sctp_getladdrs.3
+MLINKS+=sctp_recvmsg.3 sctp_recvv.3
+MLINKS+=sctp_sendmsg.3 sctp_sendmsgx.3
+MLINKS+=sctp_send.3 sctp_sendx.3 \
+ sctp_send.3 sctp_sendv.3
+MLINKS+=inet_net.3 inet_net_ntop.3 \
+ inet_net.3 inet_net_pton.3
MLINKS+=inet6_opt_init.3 inet6_opt_append.3 \
inet6_opt_init.3 inet6_opt_find.3 \
inet6_opt_init.3 inet6_opt_finish.3 \
@@ -106,22 +141,40 @@ MLINKS+=inet6_opt_init.3 inet6_opt_append.3 \
inet6_rthdr_space.3 inet6_rthdr_lasthop.3 \
inet6_rthdr_space.3 inet6_rthdr_reverse.3 \
inet6_rthdr_space.3 inet6_rthdr_segments.3
-MLINKS+=linkaddr.3 link_addr.3 linkaddr.3 link_ntoa.3
-MLINKS+=rcmd.3 iruserok.3 rcmd.3 iruserok_sa.3 \
+MLINKS+=linkaddr.3 link_addr.3 \
+ linkaddr.3 link_ntoa.3
+MLINKS+=rcmd.3 iruserok.3 \
+ rcmd.3 iruserok_sa.3 \
rcmd.3 rcmd_af.3 \
- rcmd.3 rresvport.3 rcmd.3 rresvport_af.3 \
+ rcmd.3 rresvport.3 \
+ rcmd.3 rresvport_af.3 \
rcmd.3 ruserok.3
-MLINKS+=resolver.3 dn_comp.3 resolver.3 dn_expand.3 resolver.3 res_init.3 \
- resolver.3 res_mkquery.3 resolver.3 res_query.3 \
- resolver.3 res_search.3 resolver.3 res_send.3 resolver.3 dn_skipname.3 \
- resolver.3 ns_get16.3 resolver.3 ns_get32.3 \
- resolver.3 ns_put16.3 resolver.3 ns_put32.3
-MLINKS+=sourcefilter.3 setipv4sourcefilter.3 sourcefilter.3 getipv4sourcefilter.3 \
- sourcefilter.3 setsourcefilter.3 sourcefilter.3 getsourcefilter.3
+MLINKS+=resolver.3 dn_comp.3 \
+ resolver.3 dn_expand.3 \
+ resolver.3 res_init.3 \
+ resolver.3 res_mkquery.3 \
+ resolver.3 res_query.3 \
+ resolver.3 res_search.3 \
+ resolver.3 res_send.3 \
+ resolver.3 dn_skipname.3 \
+ resolver.3 ns_get16.3 \
+ resolver.3 ns_get32.3 \
+ resolver.3 ns_put16.3 \
+ resolver.3 ns_put32.3
+MLINKS+=sourcefilter.3 setipv4sourcefilter.3 \
+ sourcefilter.3 getipv4sourcefilter.3 \
+ sourcefilter.3 setsourcefilter.3 \
+ sourcefilter.3 getsourcefilter.3
.if ${MK_HESIOD} != "no"
-SRCS+= hesiod.c
+SRCS+= hesiod.c
+SYM_MAPS+=${LIBC_SRCTOP}/net/Symbol.hesiod.map
MAN+= hesiod.3
+MLINKS+=hesiod.3 hesiod_init.3 \
+ hesiod.3 hesiod_resolve.3 \
+ hesiod.3 hesiod_free_list.3 \
+ hesiod.3 hesiod_to_bind.3 \
+ hesiod.3 hesiod_end.3
.endif
afterinstallconfig: modify-nsswitch-conf
diff --git a/lib/libc/net/Symbol.hesiod.map b/lib/libc/net/Symbol.hesiod.map
new file mode 100644
index 000000000000..bb020c969ee9
--- /dev/null
+++ b/lib/libc/net/Symbol.hesiod.map
@@ -0,0 +1,12 @@
+FBSD_1.0 {
+ hesiod_init;
+ hesiod_end;
+ hesiod_to_bind;
+ hesiod_resolve;
+ hesiod_free_list;
+ hes_init;
+ hes_to_bind;
+ hes_resolve;
+ hes_error;
+ hes_free;
+};
diff --git a/lib/libc/net/Symbol.map b/lib/libc/net/Symbol.map
index 01d3bcb888d0..ebc3a56b549f 100644
--- a/lib/libc/net/Symbol.map
+++ b/lib/libc/net/Symbol.map
@@ -1,7 +1,3 @@
-/*
- * $FreeBSD$
- */
-
FBSD_1.0 {
__b64_ntop;
__b64_pton;
@@ -58,16 +54,10 @@ FBSD_1.0 {
endservent;
getservent;
getservent_r;
- hesiod_init;
- hesiod_end;
- hesiod_to_bind;
- hesiod_resolve;
- hesiod_free_list;
- hes_init;
- hes_to_bind;
- hes_resolve;
- hes_error;
- hes_free;
+ htonl;
+ htons;
+ ntohl;
+ ntohs;
if_indextoname;
if_nameindex;
if_freenameindex;
@@ -92,7 +82,6 @@ FBSD_1.0 {
freehostent;
__nsdefaultsrc;
_nsdbtaddsrc;
- _nsdbtdump;
_nsdbtput;
nsdispatch;
rcmd;
diff --git a/lib/libc/net/base64.c b/lib/libc/net/base64.c
index 998c3c213834..f508275e4eb9 100644
--- a/lib/libc/net/base64.c
+++ b/lib/libc/net/base64.c
@@ -40,9 +40,6 @@
* IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/socket.h>
@@ -110,9 +107,9 @@ static const char Pad64 = '=';
end of the data is performed using the '=' character.
Since all base64 input is an integral number of octets, only the
- -------------------------------------------------
+ -------------------------------------------------
following cases can arise:
-
+
(1) the final quantum of encoding input is an integral
multiple of 24 bits; here, the final unit of encoded
output will be an integral multiple of 4 characters
@@ -154,14 +151,14 @@ b64_ntop(u_char const *src, size_t srclength, char *target, size_t targsize) {
target[datalength++] = Base64[output[2]];
target[datalength++] = Base64[output[3]];
}
-
+
/* Now we worry about padding. */
if (0 != srclength) {
/* Get what's left. */
input[0] = input[1] = input[2] = '\0';
for (i = 0; i < srclength; i++)
input[i] = *src++;
-
+
output[0] = input[0] >> 2;
output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
diff --git a/lib/libc/net/byteorder.3 b/lib/libc/net/byteorder.3
index fa6daf5e8a68..9c28e7b80882 100644
--- a/lib/libc/net/byteorder.3
+++ b/lib/libc/net/byteorder.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)byteorder.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd March 20, 2005
.Dt BYTEORDER 3
.Os
diff --git a/lib/libc/net/ether_addr.c b/lib/libc/net/ether_addr.c
index 98e5398096ff..efcd84a53437 100644
--- a/lib/libc/net/ether_addr.c
+++ b/lib/libc/net/ether_addr.c
@@ -39,9 +39,6 @@
* Columbia University, New York City
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/socket.h>
diff --git a/lib/libc/net/ethers.3 b/lib/libc/net/ethers.3
index 6fe568b8765f..d68f98016b97 100644
--- a/lib/libc/net/ethers.3
+++ b/lib/libc/net/ethers.3
@@ -29,8 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd October 30, 2007
.Dt ETHERS 3
.Os
diff --git a/lib/libc/net/eui64.3 b/lib/libc/net/eui64.3
index fc563d157a14..f04766692363 100644
--- a/lib/libc/net/eui64.3
+++ b/lib/libc/net/eui64.3
@@ -54,8 +54,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd March 4, 2004
.Dt EUI64 3
.Os
diff --git a/lib/libc/net/eui64.c b/lib/libc/net/eui64.c
index 2c2c4ea57b21..274c00186153 100644
--- a/lib/libc/net/eui64.c
+++ b/lib/libc/net/eui64.c
@@ -67,9 +67,6 @@
* Columbia University, New York City
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
#include <paths.h>
#include <sys/param.h>
diff --git a/lib/libc/net/gai_strerror.3 b/lib/libc/net/gai_strerror.3
index d948083447db..b9d35e1f37e6 100644
--- a/lib/libc/net/gai_strerror.3
+++ b/lib/libc/net/gai_strerror.3
@@ -16,9 +16,7 @@
.\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
.\" PERFORMANCE OF THIS SOFTWARE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd December 23, 2018
+.Dd November 2, 2022
.Dt GAI_STRERROR 3
.Os
.Sh NAME
@@ -42,7 +40,9 @@ or
The following error codes and their meaning are defined in
.In netdb.h :
.Pp
-.Bl -tag -width ".Dv EAI_BADFLAGS" -offset indent -compact
+.Bl -tag -width ".Dv EAI_ADDRFAMILY" -offset indent -compact
+.It Dv EAI_ADDRFAMILY
+Address family for hostname not supported
.It Dv EAI_AGAIN
Name could not be resolved at this time
.It Dv EAI_BADFLAGS
@@ -56,6 +56,8 @@ Non-recoverable failure in name resolution
Address family was not recognized
.It Dv EAI_MEMORY
Memory allocation failure
+.It Dv EAI_NODATA
+No address associated with hostname
.It Dv EAI_NONAME
Name does not resolve
.It Dv EAI_OVERFLOW
@@ -83,7 +85,14 @@ is out of range, an implementation-specific error message string is returned.
.Xr getaddrinfo 3 ,
.Xr getnameinfo 3
.Sh STANDARDS
-.Bl -tag -width ".It RFC 2743"
+.Bl -tag -width ".It RFC 3493"
.It RFC 3493
Basic Socket Interface Extensions for IPv6
.El
+.Pp
+EAI_ADDRFAMILY and EAI_NODATA were in previous RFCs, but not in RFC 3493.
+They are not in POSIX (IEEE Std 1003.1-2017).
+They were in
+.Fx
+before 5.2, and were re-added for 14.0.
+EAI_BADHINTS, EAI_OVERFLOW, and EAI_PROTOCOL are not in RFC 3493 or POSIX.
diff --git a/lib/libc/net/gai_strerror.c b/lib/libc/net/gai_strerror.c
index f168c3093735..0d4303e76a73 100644
--- a/lib/libc/net/gai_strerror.c
+++ b/lib/libc/net/gai_strerror.c
@@ -29,9 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <netdb.h>
#if defined(NLS)
@@ -44,17 +41,19 @@ __FBSDID("$FreeBSD$");
#endif
#include "un-namespace.h"
-/* Entries EAI_ADDRFAMILY (1) and EAI_NODATA (7) are obsoleted, but left */
-/* for backwards compatibility with userland code prior to RFC2553bis-02 */
+/*
+ * Entries EAI_ADDRFAMILY (1) and EAI_NODATA (7) were omitted from RFC 3493,
+ * but are or may be used as extensions or in old code.
+ */
static const char *ai_errlist[] = {
"Success", /* 0 */
- "Address family for hostname not supported", /* 1: Obsolete */
+ "Address family for hostname not supported", /* EAI_ADDRFAMILY */
"Name could not be resolved at this time", /* EAI_AGAIN */
"Flags parameter had an invalid value", /* EAI_BADFLAGS */
"Non-recoverable failure in name resolution", /* EAI_FAIL */
"Address family not recognized", /* EAI_FAMILY */
"Memory allocation failure", /* EAI_MEMORY */
- "No address associated with hostname", /* 7: Obsolete*/
+ "No address associated with hostname", /* EAI_NODATA*/
"Name does not resolve", /* EAI_NONAME */
"Service was not recognized for socket type", /* EAI_SERVICE */
"Intended socket type was not recognized", /* EAI_SOCKTYPE */
diff --git a/lib/libc/net/getaddrinfo.3 b/lib/libc/net/getaddrinfo.3
index bd0084db2b3c..271ef8a0102b 100644
--- a/lib/libc/net/getaddrinfo.3
+++ b/lib/libc/net/getaddrinfo.3
@@ -16,9 +16,7 @@
.\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
.\" PERFORMANCE OF THIS SOFTWARE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd February 10, 2019
+.Dd June 27, 2022
.Dt GETADDRINFO 3
.Os
.Sh NAME
@@ -353,7 +351,7 @@ structure created by a call to
.Fn getaddrinfo .
.Sh IMPLEMENTATION NOTES
The behavior of
-.Li freeadrinfo(NULL)
+.Li freeaddrinfo(NULL)
is left unspecified by both
.St -susv4
and
@@ -482,8 +480,7 @@ freeaddrinfo(res0);
.Xr hosts 5 ,
.Xr resolv.conf 5 ,
.Xr services 5 ,
-.Xr hostname 7 ,
-.Xr named 8
+.Xr hostname 7
.Rs
.%A R. Gilligan
.%A S. Thomson
diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c
index a33f240bc376..2b9499d5099b 100644
--- a/lib/libc/net/getaddrinfo.c
+++ b/lib/libc/net/getaddrinfo.c
@@ -53,9 +53,6 @@
* - FreeBSD supported $GAI. The code does not.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#include <sys/socket.h>
@@ -1953,6 +1950,9 @@ explore_fqdn(const struct addrinfo *pai, const char *hostname,
case NS_NOTFOUND:
error = EAI_NONAME;
goto free;
+ case NS_ADDRFAMILY:
+ error = EAI_ADDRFAMILY;
+ goto free;
case NS_SUCCESS:
error = 0;
for (cur = result; cur; cur = cur->ai_next) {
@@ -2091,7 +2091,7 @@ getanswer(const querybuf *answer, int anslen, const char *qname, int qtype,
} else if (type != qtype) {
#ifdef DEBUG
if (type != T_KEY && type != T_SIG &&
- type != ns_t_dname)
+ type != T_DNAME && type != T_RRSIG)
syslog(LOG_NOTICE|LOG_AUTH,
"gethostby*.getanswer: asked for \"%s %s %s\", got type \"%s\"",
qname, p_class(C_IN), p_type(qtype),
@@ -2341,7 +2341,9 @@ _dns_getaddrinfo(void *rv, void *cb_data, va_list ap)
if (res_searchN(hostname, &q, res) < 0) {
free(buf);
free(buf2);
- return NS_NOTFOUND;
+ if (res->res_h_errno == NO_DATA)
+ return (NS_ADDRFAMILY);
+ return (NS_NOTFOUND);
}
/* prefer IPv6 */
if (q.next) {
@@ -2363,15 +2365,16 @@ _dns_getaddrinfo(void *rv, void *cb_data, va_list ap)
if (sentinel.ai_next == NULL)
switch (res->res_h_errno) {
case HOST_NOT_FOUND:
+ return (NS_NOTFOUND);
case NO_DATA:
- return NS_NOTFOUND;
+ return (NS_ADDRFAMILY);
case TRY_AGAIN:
- return NS_TRYAGAIN;
+ return (NS_TRYAGAIN);
default:
- return NS_UNAVAIL;
+ return (NS_UNAVAIL);
}
*((struct addrinfo **)rv) = sentinel.ai_next;
- return NS_SUCCESS;
+ return (NS_SUCCESS);
}
static void
diff --git a/lib/libc/net/gethostbydns.c b/lib/libc/net/gethostbydns.c
index 09800b874f90..b29fa1cdd845 100644
--- a/lib/libc/net/gethostbydns.c
+++ b/lib/libc/net/gethostbydns.c
@@ -51,13 +51,6 @@
* --Copyright--
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93";
-static char fromrcsid[] = "From: Id: gethnamaddr.c,v 8.23 1998/04/07 04:59:46 vixie Exp $";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
@@ -292,11 +285,14 @@ gethostanswer(const querybuf *answer, int anslen, const char *qname, int qtype,
continue;
}
if (type != qtype) {
- if (type != T_SIG && type != ns_t_dname)
+#ifdef DEBUG
+ if (type != T_KEY && type != T_SIG &&
+ type != T_DNAME && type != T_RRSIG)
syslog(LOG_NOTICE|LOG_AUTH,
"gethostby*.gethostanswer: asked for \"%s %s %s\", got type \"%s\"",
qname, p_class(C_IN), p_type(qtype),
p_type(type));
+#endif
cp += n;
continue; /* XXX - had_error++ ? */
}
diff --git a/lib/libc/net/gethostbyht.c b/lib/libc/net/gethostbyht.c
index 3251f407f439..ac8585439ccf 100644
--- a/lib/libc/net/gethostbyht.c
+++ b/lib/libc/net/gethostbyht.c
@@ -49,12 +49,6 @@
* --Copyright--
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
diff --git a/lib/libc/net/gethostbyname.3 b/lib/libc/net/gethostbyname.3
index 8a624e90cbdc..1d817679c028 100644
--- a/lib/libc/net/gethostbyname.3
+++ b/lib/libc/net/gethostbyname.3
@@ -25,10 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" From: @(#)gethostbyname.3 8.4 (Berkeley) 5/25/95
-.\" $FreeBSD$
-.\"
-.Dd October 4, 2017
+.Dd June 27, 2022
.Dt GETHOSTBYNAME 3
.Os
.Sh NAME
@@ -39,7 +36,10 @@
.Nm sethostent ,
.Nm endhostent ,
.Nm herror ,
-.Nm hstrerror
+.Nm hstrerror ,
+.Nm gethostbyname_r ,
+.Nm gethostbyname2_r ,
+.Nm gethostbyaddr_r
.Nd get network host entry
.Sh LIBRARY
.Lb libc
@@ -62,6 +62,12 @@
.Fn herror "const char *string"
.Ft const char *
.Fn hstrerror "int err"
+.Ft int
+.Fn gethostbyname_r "const char *name" "struct hostent *he" "char *buffer" "size_t buflen" "struct hostent **result" "int *h_errnop"
+.Ft int
+.Fn gethostbyname2_r "const char *name" "int af" "struct hostent *he" "char *buffer" "size_t buflen" "struct hostent **result" "int *h_errnop"
+.Ft int
+.Fn gethostbyaddr_r "const void *addr" "socklen_t len" "int af" "struct hostent *hp" "char *buf" "size_t buflen" "struct hostent **result" "int *h_errno"p
.Sh DESCRIPTION
.Bf -symbolic
The
@@ -114,9 +120,7 @@ argument specifies the address family
etc.) of this address.
.Pp
The structure returned contains either the information obtained from the name
-server,
-.Xr named 8 ,
-broken-out fields from a line in
+server, broken-out fields from a line in
.Pa /etc/hosts ,
or database entries supplied by the
.Xr yp 8
@@ -227,6 +231,26 @@ function returns a string which is the message text corresponding to the
value of the
.Fa err
argument.
+.Pp
+Functions with the
+.Em _r
+suffix provide reentrant versions of their respective counterparts.
+The caller must supply five additional parameters: a
+.Vt struct hostent
+variable to be filled on success, a
+.Va buffer
+of
+.Va buflen
+bytes in size, a
+.Vt struct hostent
+.Va result
+variable that will point to the result on success or be set to
+.Dv NULL
+on failure or if the name is not found.
+The
+.Va h_errnop
+variable will be filled with the error code if any.
+All these functions return 0 on success.
.Sh FILES
.Bl -tag -width /etc/nsswitch.conf -compact
.It Pa /etc/hosts
@@ -301,8 +325,7 @@ for example, a mail-forwarder may be registered for this domain.
.Xr inet_aton 3 ,
.Xr resolver 3 ,
.Xr hosts 5 ,
-.Xr hostname 7 ,
-.Xr named 8
+.Xr hostname 7
.Sh HISTORY
The
.Fn herror
@@ -322,6 +345,10 @@ The
function first appeared in
.Tn BIND
version 4.9.4.
+The
+.Fn gethostbyname_r
+function first appeared in
+.Fx 6.2 .
.Sh CAVEATS
The
.Fn gethostent
diff --git a/lib/libc/net/gethostbynis.c b/lib/libc/net/gethostbynis.c
index edc0a092ae10..2d6abb49b44f 100644
--- a/lib/libc/net/gethostbynis.c
+++ b/lib/libc/net/gethostbynis.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1994, Garrett Wollman
*
@@ -25,9 +25,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
diff --git a/lib/libc/net/gethostnamadr.c b/lib/libc/net/gethostnamadr.c
index 718a64defab9..b54ca8b2998e 100644
--- a/lib/libc/net/gethostnamadr.c
+++ b/lib/libc/net/gethostnamadr.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1994, Garrett Wollman
*
@@ -25,9 +25,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include "reentrant.h"
#include <sys/param.h>
@@ -258,10 +255,10 @@ static int
host_marshal_func(char *buffer, size_t *buffer_size, void *retval, va_list ap,
void *cache_mdata)
{
- char *str;
- void *addr;
- socklen_t len;
- int type;
+ char *str __unused;
+ void *addr __unused;
+ socklen_t len __unused;
+ int type __unused;
struct hostent *ht;
struct hostent new_ht;
@@ -364,10 +361,10 @@ static int
host_unmarshal_func(char *buffer, size_t buffer_size, void *retval, va_list ap,
void *cache_mdata)
{
- char *str;
- void *addr;
- socklen_t len;
- int type;
+ char *str __unused;
+ void *addr __unused;
+ socklen_t len __unused;
+ int type __unused;
struct hostent *ht;
char *p;
diff --git a/lib/libc/net/getifaddrs.3 b/lib/libc/net/getifaddrs.3
index b0b17bb388da..7bec595b1f8a 100644
--- a/lib/libc/net/getifaddrs.3
+++ b/lib/libc/net/getifaddrs.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd November 25, 2014
.Dt GETIFADDRS 3
.Os
diff --git a/lib/libc/net/getifaddrs.c b/lib/libc/net/getifaddrs.c
index 2de869ca6f9e..35d31d46af78 100644
--- a/lib/libc/net/getifaddrs.c
+++ b/lib/libc/net/getifaddrs.c
@@ -31,9 +31,6 @@
* try-and-error for region size.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/types.h>
#include <sys/ioctl.h>
diff --git a/lib/libc/net/getifmaddrs.3 b/lib/libc/net/getifmaddrs.3
index 14c40875439c..0e18c148314d 100644
--- a/lib/libc/net/getifmaddrs.3
+++ b/lib/libc/net/getifmaddrs.3
@@ -18,8 +18,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd May 21, 2013
.Dt GETIFMADDRS 3
.Os
diff --git a/lib/libc/net/getifmaddrs.c b/lib/libc/net/getifmaddrs.c
index 92a032f9f2ee..415c25f11968 100644
--- a/lib/libc/net/getifmaddrs.c
+++ b/lib/libc/net/getifmaddrs.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2003 Bruce M. Simpson.
* All rights reserved
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#include <sys/sysctl.h>
diff --git a/lib/libc/net/getipnodebyname.3 b/lib/libc/net/getipnodebyname.3
index 3af6ea21bcff..2e5b05edec9c 100644
--- a/lib/libc/net/getipnodebyname.3
+++ b/lib/libc/net/getipnodebyname.3
@@ -27,10 +27,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" From: @(#)gethostbyname.3 8.4 (Berkeley) 5/25/95
-.\" $FreeBSD$
-.\"
-.Dd August 6, 2004
+.Dd June 27, 2022
.Dt GETIPNODEBYNAME 3
.Os
.\"
@@ -430,8 +427,7 @@ The meanings of each error code are described in
.Xr hosts 5 ,
.Xr nsswitch.conf 5 ,
.Xr services 5 ,
-.Xr hostname 7 ,
-.Xr named 8
+.Xr hostname 7
.Pp
.Rs
.%A R. Gilligan
diff --git a/lib/libc/net/getnameinfo.3 b/lib/libc/net/getnameinfo.3
index 5d5719c010c7..7c6ef419d8ea 100644
--- a/lib/libc/net/getnameinfo.3
+++ b/lib/libc/net/getnameinfo.3
@@ -16,9 +16,7 @@
.\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
.\" PERFORMANCE OF THIS SOFTWARE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd March 15, 2018
+.Dd June 27, 2022
.Dt GETNAMEINFO 3
.Os
.Sh NAME
@@ -212,8 +210,7 @@ printf("host=%s\en", hbuf);
.Xr hosts 5 ,
.Xr resolv.conf 5 ,
.Xr services 5 ,
-.Xr hostname 7 ,
-.Xr named 8
+.Xr hostname 7
.Rs
.%A R. Gilligan
.%A S. Thomson
diff --git a/lib/libc/net/getnameinfo.c b/lib/libc/net/getnameinfo.c
index ad54920aa793..7ab490abb67f 100644
--- a/lib/libc/net/getnameinfo.c
+++ b/lib/libc/net/getnameinfo.c
@@ -46,9 +46,6 @@
* beware on merge.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
@@ -467,7 +464,7 @@ getnameinfo_link(const struct afd *afd,
* The following have zero-length addresses.
* IFT_GIF (net/if_gif.c)
* IFT_LOOP (net/if_loop.c)
- * IFT_PPP (net/if_ppp.c, net/if_spppsubr.c)
+ * IFT_PPP (net/if_tuntap.c)
* IFT_SLIP (net/if_sl.c, net/if_strip.c)
* IFT_STF (net/if_stf.c)
* IFT_L2VLAN (net/if_vlan.c)
diff --git a/lib/libc/net/getnetbydns.c b/lib/libc/net/getnetbydns.c
index ac35ae4a96c4..deca8c58fca5 100644
--- a/lib/libc/net/getnetbydns.c
+++ b/lib/libc/net/getnetbydns.c
@@ -56,12 +56,6 @@
* copyright notice and this permission notice appear in all copies.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
diff --git a/lib/libc/net/getnetbyht.c b/lib/libc/net/getnetbyht.c
index 9db1a37ebd36..00bfd61552af 100644
--- a/lib/libc/net/getnetbyht.c
+++ b/lib/libc/net/getnetbyht.c
@@ -39,13 +39,6 @@
* from getnetent.c 1.1 (Coimbra) 93/06/02
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getnetent.c 8.1 (Berkeley) 6/4/93";
-static char orig_rcsid[] = "From: Id: getnetent.c,v 8.4 1997/06/01 20:34:37 vixie Exp";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
diff --git a/lib/libc/net/getnetbynis.c b/lib/libc/net/getnetbynis.c
index 48407eb12b29..a56404a14fe7 100644
--- a/lib/libc/net/getnetbynis.c
+++ b/lib/libc/net/getnetbynis.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1994, Garrett Wollman
*
@@ -25,9 +25,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
diff --git a/lib/libc/net/getnetent.3 b/lib/libc/net/getnetent.3
index adf2760d132f..bd588bd7551a 100644
--- a/lib/libc/net/getnetent.3
+++ b/lib/libc/net/getnetent.3
@@ -25,10 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)getnetent.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd June 4, 1993
+.Dd June 27, 2022
.Dt GETNETENT 3
.Os
.Sh NAME
@@ -52,6 +49,12 @@
.Fn setnetent "int stayopen"
.Ft void
.Fn endnetent void
+.Ft int
+.Fn getnetent_r "struct netent *ne" "char *buffer" "size_t buflen" "struct netent **result" "int *h_errnop"
+.Ft int
+.Fn getnetbyaddr_r "uint32_t net" "int type" "struct netent *ne" "char *buffer" "size_t buflen" "struct netent **result" int *h_errorp"
+.Ft int
+.Fn getnetbyname_r "const char *name" "struct netent *ne" "char *buffer" "size_t buflen" "struct netent **result" "int *h_errorp"
.Sh DESCRIPTION
The
.Fn getnetent ,
@@ -62,9 +65,7 @@ functions
each return a pointer to an object with the
following structure describing an internet network.
This structure contains either the information obtained
-from the nameserver,
-.Xr named 8 ,
-broken-out fields of a line in the network data base
+from the nameserver, broken-out fields of a line in the network data base
.Pa /etc/networks ,
or entries supplied by the
.Xr yp 8
@@ -135,6 +136,26 @@ argument
must be
.Dv AF_INET .
Network numbers are supplied in host order.
+.Pp
+Functions with the
+.Em _r
+suffix provide reentrant versions of their respective counterparts.
+The caller must supply five additional parameters: a
+.Vt struct netent
+variable to be filled on success, a
+.Va buffer
+of
+.Va buflen
+bytes in size, a
+.Vt struct netent
+.Va result
+variable that will point to the result on success or be set to
+.Dv NULL
+on failure or if the name is not found.
+The
+.Va h_errnop
+variable will be filled with the error code if any.
+All these functions return 0 on success.
.Sh FILES
.Bl -tag -width /etc/nsswitch.conf -compact
.It Pa /etc/networks
diff --git a/lib/libc/net/getnetnamadr.c b/lib/libc/net/getnetnamadr.c
index 2d9776685cf9..660de3302606 100644
--- a/lib/libc/net/getnetnamadr.c
+++ b/lib/libc/net/getnetnamadr.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1994, Garrett Wollman
*
@@ -25,9 +25,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include "reentrant.h"
#include <sys/param.h>
@@ -121,12 +118,12 @@ static int
net_marshal_func(char *buffer, size_t *buffer_size, void *retval, va_list ap,
void *cache_mdata)
{
- char *name;
- uint32_t net;
- int type;
+ char *name __unused;
+ uint32_t net __unused;
+ int type __unused;
struct netent *ne;
- char *orig_buf;
- size_t orig_buf_size;
+ char *orig_buf __unused;
+ size_t orig_buf_size __unused;
struct netent new_ne;
size_t desired_size, size, aliases_size;
@@ -210,9 +207,9 @@ static int
net_unmarshal_func(char *buffer, size_t buffer_size, void *retval, va_list ap,
void *cache_mdata)
{
- char *name;
- uint32_t net;
- int type;
+ char *name __unused;
+ uint32_t net __unused;
+ int type __unused;
struct netent *ne;
char *orig_buf;
size_t orig_buf_size;
diff --git a/lib/libc/net/getproto.c b/lib/libc/net/getproto.c
index ec7ee39447a5..62ecb04972c4 100644
--- a/lib/libc/net/getproto.c
+++ b/lib/libc/net/getproto.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getproto.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <netdb.h>
#include <nsswitch.h>
diff --git a/lib/libc/net/getprotoent.3 b/lib/libc/net/getprotoent.3
index e416824f8479..eeea57ac9859 100644
--- a/lib/libc/net/getprotoent.3
+++ b/lib/libc/net/getprotoent.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)getprotoent.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd June 4, 1993
.Dt GETPROTOENT 3
.Os
diff --git a/lib/libc/net/getprotoent.c b/lib/libc/net/getprotoent.c
index 73b069250499..9fcbf41530cf 100644
--- a/lib/libc/net/getprotoent.c
+++ b/lib/libc/net/getprotoent.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getprotoent.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/socket.h>
#include <errno.h>
@@ -144,11 +138,11 @@ int
__proto_marshal_func(char *buffer, size_t *buffer_size, void *retval,
va_list ap, void *cache_mdata)
{
- char *name;
- int num;
+ char *name __unused;
+ int num __unused;
struct protoent *proto;
- char *orig_buf;
- size_t orig_buf_size;
+ char *orig_buf __unused;
+ size_t orig_buf_size __unused;
struct protoent new_proto;
size_t desired_size, size, aliases_size;
@@ -231,8 +225,8 @@ int
__proto_unmarshal_func(char *buffer, size_t buffer_size, void *retval,
va_list ap, void *cache_mdata)
{
- char *name;
- int num;
+ char *name __unused;
+ int num __unused;
struct protoent *proto;
char *orig_buf;
size_t orig_buf_size;
diff --git a/lib/libc/net/getprotoname.c b/lib/libc/net/getprotoname.c
index 22c2938dd53e..f3654a8955ec 100644
--- a/lib/libc/net/getprotoname.c
+++ b/lib/libc/net/getprotoname.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getprotoname.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <netdb.h>
#include <nsswitch.h>
diff --git a/lib/libc/net/getservent.3 b/lib/libc/net/getservent.3
index 9223369fe19e..996d1606eb79 100644
--- a/lib/libc/net/getservent.3
+++ b/lib/libc/net/getservent.3
@@ -25,10 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" From: @(#)getservent.3 8.3 (Berkeley) 1/12/94
-.\" $FreeBSD$
-.\"
-.Dd July 9, 1995
+.Dd December 7, 2020
.Dt GETSERVENT 3
.Os
.Sh NAME
@@ -128,6 +125,7 @@ searches must also match the protocol.
.Sh FILES
.Bl -tag -width /etc/services -compact
.It Pa /etc/services
+.It Pa /var/db/services.db
.El
.Sh DIAGNOSTICS
Null pointer returned on
@@ -135,7 +133,8 @@ Null pointer returned on
or error.
.Sh SEE ALSO
.Xr getprotoent 3 ,
-.Xr services 5
+.Xr services 5 ,
+.Xr services_mkdb 8
.Sh HISTORY
The
.Fn getservent ,
diff --git a/lib/libc/net/getservent.c b/lib/libc/net/getservent.c
index 76db40d96cf5..26f68f24cc78 100644
--- a/lib/libc/net/getservent.c
+++ b/lib/libc/net/getservent.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getservent.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/socket.h>
#include <arpa/inet.h>
@@ -943,16 +937,16 @@ fin:
return (res);
}
-int
+static int
serv_marshal_func(char *buffer, size_t *buffer_size, void *retval, va_list ap,
void *cache_mdata)
{
- char *name;
- char *proto;
- int port;
+ char *name __unused;
+ char *proto __unused;
+ int port __unused;
struct servent *serv;
- char *orig_buf;
- size_t orig_buf_size;
+ char *orig_buf __unused;
+ size_t orig_buf_size __unused;
struct servent new_serv;
size_t desired_size;
@@ -1044,13 +1038,13 @@ serv_marshal_func(char *buffer, size_t *buffer_size, void *retval, va_list ap,
return (NS_SUCCESS);
}
-int
+static int
serv_unmarshal_func(char *buffer, size_t buffer_size, void *retval, va_list ap,
void *cache_mdata)
{
- char *name;
- char *proto;
- int port;
+ char *name __unused;
+ char *proto __unused;
+ int port __unused;
struct servent *serv;
char *orig_buf;
char *p;
diff --git a/lib/libc/net/hesiod.3 b/lib/libc/net/hesiod.3
index bae4e4419f82..c6e75ff42db7 100644
--- a/lib/libc/net/hesiod.3
+++ b/lib/libc/net/hesiod.3
@@ -16,9 +16,7 @@
.\" this software for any purpose. It is provided "as is"
.\" without express or implied warranty.
.\"
-.\" $FreeBSD$
-.\"
-.Dd November 30, 1996
+.Dd June 27, 2022
.Dt HESIOD 3
.Os
.Sh NAME
@@ -154,8 +152,7 @@ argument had a domain extension which could not be resolved with type
in the local Hesiod domain.
.El
.Sh SEE ALSO
-.Xr hesiod.conf 5 ,
-.Xr named 8
+.Xr hesiod.conf 5
.Rs
.%T "Hesiod - Project Athena Technical Plan -- Name Service"
.Re
diff --git a/lib/libc/net/hesiod.c b/lib/libc/net/hesiod.c
index 0966b6d7ef91..18d5c7348c78 100644
--- a/lib/libc/net/hesiod.c
+++ b/lib/libc/net/hesiod.c
@@ -43,13 +43,6 @@
* it uses res_send() and accesses _res.
*/
-#include <sys/cdefs.h>
-
-#if 0
-static char *orig_rcsid = "$NetBSD: hesiod.c,v 1.9 1999/02/11 06:16:38 simonb Exp $";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <netinet/in.h>
@@ -83,8 +76,7 @@ static void translate_errors(void);
* initialize a hesiod_p.
*/
int
-hesiod_init(context)
- void **context;
+hesiod_init(void **context)
{
struct hesiod_p *ctx;
const char *p, *configname;
@@ -92,10 +84,7 @@ hesiod_init(context)
ctx = malloc(sizeof(struct hesiod_p));
if (ctx) {
*context = ctx;
- if (!issetugid())
- configname = getenv("HESIOD_CONFIG");
- else
- configname = NULL;
+ configname = secure_getenv("HESIOD_CONFIG");
if (!configname)
configname = _PATH_HESIOD_CONF;
if (read_config_file(ctx, configname) >= 0) {
@@ -103,10 +92,7 @@ hesiod_init(context)
* The default rhs can be overridden by an
* environment variable.
*/
- if (!issetugid())
- p = getenv("HES_DOMAIN");
- else
- p = NULL;
+ p = secure_getenv("HES_DOMAIN");
if (p) {
if (ctx->rhs)
free(ctx->rhs);
@@ -138,8 +124,7 @@ hesiod_init(context)
* Deallocates the hesiod_p.
*/
void
-hesiod_end(context)
- void *context;
+hesiod_end(void *context)
{
struct hesiod_p *ctx = (struct hesiod_p *) context;
@@ -229,10 +214,7 @@ hesiod_to_bind(void *context, const char *name, const char *type)
* by the resolver.
*/
char **
-hesiod_resolve(context, name, type)
- void *context;
- const char *name;
- const char *type;
+hesiod_resolve(void *context, const char *name, const char *type)
{
struct hesiod_p *ctx = (struct hesiod_p *) context;
char *bindname, **retvec;
@@ -251,9 +233,7 @@ hesiod_resolve(context, name, type)
/*ARGSUSED*/
void
-hesiod_free_list(context, list)
- void *context;
- char **list;
+hesiod_free_list(void *context, char **list)
{
char **p;
@@ -271,9 +251,7 @@ hesiod_free_list(context, list)
* or ctx->rhs which need to be freed by the caller.
*/
static int
-read_config_file(ctx, filename)
- struct hesiod_p *ctx;
- const char *filename;
+read_config_file(struct hesiod_p *ctx, const char *filename)
{
char *key, *data, *p, **which;
char buf[MAXDNAME + 7];
@@ -365,9 +343,7 @@ read_config_file(ctx, filename)
* return a list of them.
*/
static char **
-get_txt_records(qclass, name)
- int qclass;
- const char *name;
+get_txt_records(int qclass, const char *name)
{
HEADER *hp;
unsigned char qbuf[PACKETSZ], abuf[MAX_HESRESP], *p, *eom, *eor;
@@ -491,16 +467,14 @@ static void *context;
static int errval = HES_ER_UNINIT;
int
-hes_init()
+hes_init(void)
{
init_context();
return errval;
}
char *
-hes_to_bind(name, type)
- const char *name;
- const char *type;
+hes_to_bind(const char *name, const char *type)
{
static char *bindname;
if (init_context() < 0)
@@ -514,9 +488,7 @@ hes_to_bind(name, type)
}
char **
-hes_resolve(name, type)
- const char *name;
- const char *type;
+hes_resolve(const char *name, const char *type)
{
static char **list;
@@ -537,20 +509,19 @@ hes_resolve(name, type)
}
int
-hes_error()
+hes_error(void)
{
return errval;
}
void
-hes_free(hp)
- char **hp;
+hes_free(char **hp)
{
hesiod_free_list(context, hp);
}
static int
-init_context()
+init_context(void)
{
if (!inited) {
inited = 1;
@@ -564,7 +535,7 @@ init_context()
}
static void
-translate_errors()
+translate_errors(void)
{
switch (errno) {
case ENOENT:
diff --git a/lib/libc/net/hosts b/lib/libc/net/hosts
index 2690a9ad48e1..f6933fcaaf33 100644
--- a/lib/libc/net/hosts
+++ b/lib/libc/net/hosts
@@ -1,4 +1,3 @@
-# $FreeBSD$
#
# Host Database
#
@@ -17,14 +16,14 @@
#10.0.0.2 myname.my.domain myname
#10.0.0.3 myfriend.my.domain myfriend
#
-# According to RFC 1918, you can use the following IP networks for
-# private nets which will never be connected to the Internet:
+# According to RFC 1918, you can use the following IP blocks for
+# private internets:
#
-# 10.0.0.0 - 10.255.255.255
-# 172.16.0.0 - 172.31.255.255
-# 192.168.0.0 - 192.168.255.255
+# 10.0.0.0 - 10.255.255.255 (10/8 prefix)
+# 172.16.0.0 - 172.31.255.255 (172.16/12 prefix)
+# 192.168.0.0 - 192.168.255.255 (192.168/16 prefix)
#
-# In case you want to be able to connect to the Internet, you need
+# In case you want to make addresses available on the Internet, you need
# real official assigned numbers. Do not try to invent your own network
# numbers but instead get one from your network provider (if any) or
# from your regional registry (ARIN, APNIC, LACNIC, RIPE NCC, or AfriNIC.)
diff --git a/lib/libc/net/hosts.equiv b/lib/libc/net/hosts.equiv
index d8a71c1ebc7f..77e9ccd4b12c 100644
--- a/lib/libc/net/hosts.equiv
+++ b/lib/libc/net/hosts.equiv
@@ -1,4 +1,3 @@
-# $FreeBSD$
#
#localhost
#my_very_good_friend.domain
diff --git a/lib/libc/net/if_indextoname.3 b/lib/libc/net/if_indextoname.3
index 715c33cfedcd..29bf565e3429 100644
--- a/lib/libc/net/if_indextoname.3
+++ b/lib/libc/net/if_indextoname.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd November 23, 2005
.Dt IF_NAMETOINDEX 3
.Os
diff --git a/lib/libc/net/if_indextoname.c b/lib/libc/net/if_indextoname.c
index 454823e5e016..99620c9cac0d 100644
--- a/lib/libc/net/if_indextoname.c
+++ b/lib/libc/net/if_indextoname.c
@@ -27,9 +27,6 @@
* BSDI Id: if_indextoname.c,v 2.3 2000/04/17 22:38:05 dab Exp
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if_dl.h>
@@ -40,7 +37,7 @@ __FBSDID("$FreeBSD$");
#include <errno.h>
/*
- * From RFC 2533:
+ * From RFC 2553:
*
* The second function maps an interface index into its corresponding
* name.
diff --git a/lib/libc/net/if_nameindex.c b/lib/libc/net/if_nameindex.c
index 4b6b15ecefb1..a7c2c92bd8d1 100644
--- a/lib/libc/net/if_nameindex.c
+++ b/lib/libc/net/if_nameindex.c
@@ -27,9 +27,6 @@
* BSDI Id: if_nameindex.c,v 2.3 2000/04/17 22:38:05 dab Exp
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if_dl.h>
diff --git a/lib/libc/net/if_nametoindex.c b/lib/libc/net/if_nametoindex.c
index c38fce76b037..febf33b86667 100644
--- a/lib/libc/net/if_nametoindex.c
+++ b/lib/libc/net/if_nametoindex.c
@@ -27,9 +27,6 @@
* BSDI Id: if_nametoindex.c,v 2.3 2000/04/17 22:38:05 dab Exp
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/types.h>
#include <sys/socket.h>
diff --git a/lib/libc/net/inet.3 b/lib/libc/net/inet.3
index a36cb313f7d3..7b1a5fcc8ede 100644
--- a/lib/libc/net/inet.3
+++ b/lib/libc/net/inet.3
@@ -25,10 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" From: @(#)inet.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd June 14, 2007
+.Dd November 9, 2021
.Dt INET 3
.Os
.Sh NAME
@@ -157,27 +154,34 @@ The routine
.Fn inet_ntoa_r
is the reentrant version of
.Fn inet_ntoa .
-The routine
+The deprecated routine
.Fn inet_makeaddr
takes an Internet network number and a local
-network address and constructs an Internet address
+host address on that network, and constructs an Internet address
from it.
-The routines
+It should only be assumed to work for historical class A/B/C networks.
+The deprecated routines
.Fn inet_netof
and
.Fn inet_lnaof
break apart Internet host addresses, returning
-the network number and local network address part,
-respectively.
+the network number and local host address part,
+respectively,
+assuming the historical class A/B/C network masks.
.Pp
All Internet addresses are returned in network
order (bytes ordered from left to right).
All network numbers and local address parts are
returned as machine byte order integer values.
-.Sh INTERNET ADDRESSES
-Values specified using the
+.Sh INTERNET ADDRESSES (IP VERSION 4)
+The
+.Fn inet_aton
+and
+.Fn inet_addr
+functions accept IPv4
+values specified using the
.Ql .\&
-notation take one
+notation in one
of the following forms:
.Bd -literal -offset indent
a.b.c.d
@@ -189,31 +193,14 @@ a
When four parts are specified, each is interpreted
as a byte of data and assigned, from left to right,
to the four bytes of an Internet address.
-Note
-that when an Internet address is viewed as a 32-bit
-integer quantity on the
-.Tn VAX
-the bytes referred to
-above appear as
-.Dq Li d.c.b.a .
-That is,
-.Tn VAX
-bytes are
-ordered from right to left.
.Pp
When a three part address is specified, the last
part is interpreted as a 16-bit quantity and placed
-in the right-most two bytes of the network address.
-This makes the three part address format convenient
-for specifying Class B network addresses as
-.Dq Li 128.net.host .
+in the least significant two bytes of the network address.
.Pp
When a two part address is supplied, the last part
is interpreted as a 24-bit quantity and placed in
-the right most three bytes of the network address.
-This makes the two part address format convenient
-for specifying Class A network addresses as
-.Dq Li net.host .
+the least significant three bytes of the network address.
.Pp
When only one part is given, the value is stored
directly in the network address without any byte
@@ -228,6 +215,13 @@ may be decimal, octal, or hexadecimal, as specified
in the C language (i.e., a leading 0x or 0X implies
hexadecimal; otherwise, a leading 0 implies octal;
otherwise, the number is interpreted as decimal).
+.Pp
+Note that
+.Fn inet_pton
+does not accept 1-, 2-, or 3-part dotted addresses; all four parts
+must be specified and are interpreted only as decimal values.
+This is a narrower input set than that accepted by
+.Fn inet_aton .
.Sh DIAGNOSTICS
The constant
.Dv INADDR_NONE
@@ -274,12 +268,6 @@ and
.Fn inet_pton
functions conform to
.St -xns5.2 .
-Note that
-.Fn inet_pton
-does not accept 1-, 2-, or 3-part dotted addresses; all four parts
-must be specified and are interpreted only as decimal values.
-This is a narrower input set than that accepted by
-.Fn inet_aton .
.Sh HISTORY
These
functions appeared in
diff --git a/lib/libc/net/inet6_opt_init.3 b/lib/libc/net/inet6_opt_init.3
index 484767f781fa..bccc08fa4700 100644
--- a/lib/libc/net/inet6_opt_init.3
+++ b/lib/libc/net/inet6_opt_init.3
@@ -27,9 +27,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd August 1, 2021
+.Dd February 25, 2023
.Dt INET6_OPT_INIT 3
.Os
.\"
@@ -43,20 +41,22 @@
.Nm inet6_opt_get_val
.Nd IPv6 Hop-by-Hop and Destination Options manipulation
.\"
+.Sh LIBRARY
+.Lb libc
.Sh SYNOPSIS
.In netinet/in.h
.Ft "int"
.Fn inet6_opt_init "void *extbuf" "socklen_t extlen"
.Ft "int"
-.Fn inet6_opt_append "void *extbuf" "socklen_t extlen" "int offset" "u_int8_t type" "socklen_t len" "u_int8_t align" "void **databufp"
+.Fn inet6_opt_append "void *extbuf" "socklen_t extlen" "int offset" "uint8_t type" "socklen_t len" "uint8_t align" "void **databufp"
.Ft "int"
.Fn inet6_opt_finish "void *extbuf" "socklen_t extlen" "int offset"
.Ft "int"
.Fn inet6_opt_set_val "void *databuf" "int offset" "void *val" "socklen_t vallen"
.Ft "int"
-.Fn inet6_opt_next "void *extbuf" "socklen_t extlen" "int offset" "u_int8_t *typep" "socklen_t *lenp" "void **databufp"
+.Fn inet6_opt_next "void *extbuf" "socklen_t extlen" "int offset" "uint8_t *typep" "socklen_t *lenp" "void **databufp"
.Ft "int"
-.Fn inet6_opt_find "void *extbuf" "socklen_t extlen" "int offset" "u_int8_t type" "socklen_t *lenp" "void **databufp"
+.Fn inet6_opt_find "void *extbuf" "socklen_t extlen" "int offset" "uint8_t type" "socklen_t *lenp" "void **databufp"
.Ft "int"
.Fn inet6_opt_get_val "void *databuf" "int offset" "void *val" "socklen_t vallen"
.\"
@@ -67,9 +67,9 @@ The advanced sockets API defines a set of functions to
help applications create and manipulate Hop-by-Hop and Destination
options.
This man page describes the functions specified in
-IETF Draft RFC3542.
+IETF Draft RFC 3542.
These functions use the
-formatting rules specified in Appendix B in RFC2460, i.e., that the
+formatting rules specified in Appendix B in RFC 2460, i.e., that the
largest field is placed last in the option.
The function prototypes
for these functions are all contained in the
@@ -206,7 +206,7 @@ inserted into the extension header, and the
argument indicates how much data to copy.
.Pp
The caller should ensure that each field is aligned on its natural
-boundaries as described in Appendix B of RFC2460.
+boundaries as described in Appendix B of RFC 2460.
.Pp
The function returns the offset for the next field which is calculated as
.Fa offset
@@ -281,7 +281,7 @@ or
functions.
The
.Fa val
-argument points where the data will be extracted.
+argument points to where the data will be extracted.
The
.Fa offset
argument specifies from where in the data portion of the option the
@@ -289,7 +289,7 @@ value should be extracted; the first byte of option data is specified
by an offset of zero.
.Pp
It is expected that each field is aligned on its natural boundaries as
-described in Appendix B of RFC2460.
+described in Appendix B of RFC 2460.
.Pp
The function returns the offset for the next field
by calculating
@@ -305,7 +305,7 @@ All the functions return
on an error.
.\"
.Sh EXAMPLES
-RFC3542 gives comprehensive examples in Section 22.
+RFC 3542 gives comprehensive examples in Section 22.
.Pp
KAME also provides examples in the
.Pa advapitest
@@ -318,20 +318,20 @@ directory of its kit.
.%A E. Nordmark
.%A T. Jinmei
.%T "Advanced Sockets API for IPv6"
-.%N RFC3542
+.%N RFC 3542
.%D October 2002
.Re
.Rs
.%A S. Deering
.%A R. Hinden
.%T "Internet Protocol, Version 6 (IPv6) Specification"
-.%N RFC2460
+.%N RFC 2460
.%D December 1998
.Re
.Sh STANDARDS
The functions are documented in
.Dq Advanced Sockets API for IPv6
-.Pq RFC3542 .
+.Pq RFC 3542 .
.\"
.Sh HISTORY
The implementation first appeared in KAME advanced networking kit.
diff --git a/lib/libc/net/inet6_option_space.3 b/lib/libc/net/inet6_option_space.3
index e17855a32ba7..87395fba347d 100644
--- a/lib/libc/net/inet6_option_space.3
+++ b/lib/libc/net/inet6_option_space.3
@@ -27,8 +27,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd January 24, 2005
.Dt INET6_OPTION_SPACE 3
.Os
diff --git a/lib/libc/net/inet6_rth_space.3 b/lib/libc/net/inet6_rth_space.3
index a3db7942c6cd..7c42cdaf46a0 100644
--- a/lib/libc/net/inet6_rth_space.3
+++ b/lib/libc/net/inet6_rth_space.3
@@ -27,8 +27,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd December 24, 2004
.Dt INET6_RTH_SPACE 3
.Os
diff --git a/lib/libc/net/inet6_rthdr_space.3 b/lib/libc/net/inet6_rthdr_space.3
index bfb2f231a874..d7856a686098 100644
--- a/lib/libc/net/inet6_rthdr_space.3
+++ b/lib/libc/net/inet6_rthdr_space.3
@@ -27,8 +27,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd January 24, 2005
.Dt INET6_RTHDR_SPACE 3
.Os
diff --git a/lib/libc/net/inet_net.3 b/lib/libc/net/inet_net.3
index f0721729ff05..3102f949ebca 100644
--- a/lib/libc/net/inet_net.3
+++ b/lib/libc/net/inet_net.3
@@ -30,9 +30,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd August 18, 2016
+.Dd November 9, 2021
.Dt INET_NET 3
.Os
.Sh NAME
@@ -120,17 +118,11 @@ That is, little-endian bytes are ordered from right to left.
.Pp
When a three part number is specified, the last
part is interpreted as a 16-bit quantity and placed
-in the rightmost two bytes of the Internet network number.
-This makes the three part number format convenient
-for specifying Class B network numbers as
-.Dq Li 128.net.host .
+in the least significant two bytes of the Internet network number.
.Pp
When a two part number is supplied, the last part
is interpreted as a 24-bit quantity and placed in
-the rightmost three bytes of the Internet network number.
-This makes the two part number format convenient
-for specifying Class A network numbers as
-.Dq Li net.host .
+the least significant three bytes of the Internet network number.
.Pp
When only one part is given, the value is stored
directly in the Internet network number without any byte
diff --git a/lib/libc/net/ip6opt.c b/lib/libc/net/ip6opt.c
index 5e2f9df8d008..4f53840299ea 100644
--- a/lib/libc/net/ip6opt.c
+++ b/lib/libc/net/ip6opt.c
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/socket.h>
diff --git a/lib/libc/net/linkaddr.3 b/lib/libc/net/linkaddr.3
index e17847cfca4c..ee3ea3056c71 100644
--- a/lib/libc/net/linkaddr.3
+++ b/lib/libc/net/linkaddr.3
@@ -28,9 +28,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" From: @(#)linkaddr.3 8.1 (Berkeley) 7/28/93
-.\" $FreeBSD$
-.\"
.Dd February 28, 2007
.Dt LINK_ADDR 3
.Os
diff --git a/lib/libc/net/linkaddr.c b/lib/libc/net/linkaddr.c
index f50197ec32a8..dedc910b9474 100644
--- a/lib/libc/net/linkaddr.c
+++ b/lib/libc/net/linkaddr.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)linkaddr.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
diff --git a/lib/libc/net/map_v4v6.c b/lib/libc/net/map_v4v6.c
index addc5194786c..bb3d580473ec 100644
--- a/lib/libc/net/map_v4v6.c
+++ b/lib/libc/net/map_v4v6.c
@@ -51,12 +51,6 @@
* --Copyright--
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/socket.h>
#include <netinet/in.h>
diff --git a/lib/libc/net/name6.c b/lib/libc/net/name6.c
index 9b7aaf66ae21..ae1a117665cb 100644
--- a/lib/libc/net/name6.c
+++ b/lib/libc/net/name6.c
@@ -85,9 +85,6 @@
* Atsushi Onoe <onoe@sm.sony.co.jp>
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#include <sys/socket.h>
diff --git a/lib/libc/net/netdb_private.h b/lib/libc/net/netdb_private.h
index 9f2bde221c92..5049bcf3fbda 100644
--- a/lib/libc/net/netdb_private.h
+++ b/lib/libc/net/netdb_private.h
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (C) 2005 The FreeBSD Project. All rights reserved.
*
@@ -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 _NETDB_PRIVATE_H_
diff --git a/lib/libc/net/networks b/lib/libc/net/networks
index a6b15d4519b7..48e5e38269d2 100644
--- a/lib/libc/net/networks
+++ b/lib/libc/net/networks
@@ -1,6 +1,3 @@
-# $FreeBSD$
-# @(#)networks 5.1 (Berkeley) 6/30/90
-#
# Your Local Networks Database
#
your-net 127 # your comment
diff --git a/lib/libc/net/nscache.c b/lib/libc/net/nscache.c
index e9954386b24f..3537d77edbbe 100644
--- a/lib/libc/net/nscache.c
+++ b/lib/libc/net/nscache.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2005 Michael Bushkov <bushman@rsu.ru>
* All rights reserved.
@@ -27,9 +27,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#define _NS_PRIVATE
#include <nsswitch.h>
diff --git a/lib/libc/net/nscachedcli.c b/lib/libc/net/nscachedcli.c
index 53f69dda7fbb..f57e69bdceb2 100644
--- a/lib/libc/net/nscachedcli.c
+++ b/lib/libc/net/nscachedcli.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2005 Michael Bushkov <bushman@rsu.ru>
* All rights reserved.
@@ -27,9 +27,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/types.h>
#include <sys/socket.h>
@@ -153,7 +150,6 @@ send_credentials(struct cached_connection_ *connection, int type)
struct kevent eventlist;
int nevents;
ssize_t result;
- int res;
memset(&cmsg, 0, sizeof(cmsg));
cmsg.hdr.cmsg_len = CMSG_LEN(sizeof(struct cmsgcred));
@@ -171,7 +167,7 @@ send_credentials(struct cached_connection_ *connection, int type)
EV_SET(&eventlist, connection->sockfd, EVFILT_WRITE, EV_ADD,
NOTE_LOWAT, sizeof(int), NULL);
- res = _kevent(connection->write_queue, &eventlist, 1, NULL, 0, NULL);
+ (void)_kevent(connection->write_queue, &eventlist, 1, NULL, 0, NULL);
nevents = _kevent(connection->write_queue, NULL, 0, &eventlist, 1,
NULL);
@@ -474,10 +470,9 @@ int
__close_cached_mp_write_session(struct cached_connection_ *ws)
{
int notification;
- int result;
notification = CET_MP_WRITE_SESSION_CLOSE_NOTIFICATION;
- result = safe_write(ws, &notification, sizeof(int));
+ (void)safe_write(ws, &notification, sizeof(int));
__close_cached_connection(ws);
return (0);
}
diff --git a/lib/libc/net/nsdispatch.3 b/lib/libc/net/nsdispatch.3
index e53bbb9647ce..ef998bdf061d 100644
--- a/lib/libc/net/nsdispatch.3
+++ b/lib/libc/net/nsdispatch.3
@@ -30,8 +30,6 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd October 15, 2018
.Dt NSDISPATCH 3
.Os
diff --git a/lib/libc/net/nsdispatch.c b/lib/libc/net/nsdispatch.c
index b0f80d079b0b..60baa0014904 100644
--- a/lib/libc/net/nsdispatch.c
+++ b/lib/libc/net/nsdispatch.c
@@ -1,7 +1,7 @@
/* $NetBSD: nsdispatch.c,v 1.9 1999/01/25 00:16:17 lukem Exp $ */
/*-
- * 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.
@@ -62,9 +62,6 @@
* SUCH DAMAGE.
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#include <sys/stat.h>
@@ -335,7 +332,9 @@ static int
nss_configure(void)
{
static time_t confmod;
+#ifndef NS_REREAD_CONF
static int already_initialized = 0;
+#endif
struct stat statbuf;
int result, isthreaded;
const char *path;
diff --git a/lib/libc/net/nslexer.l b/lib/libc/net/nslexer.l
index 946aace3a8a8..ce0f18670e21 100644
--- a/lib/libc/net/nslexer.l
+++ b/lib/libc/net/nslexer.l
@@ -2,7 +2,7 @@
/* $NetBSD: nslexer.l,v 1.3 1999/01/25 00:16:17 lukem Exp $ */
/*-
- * 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.
@@ -32,12 +32,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid =
- "$FreeBSD$";
-#endif /* LIBC_SCCS and not lint */
-
#include "namespace.h"
#include <ctype.h>
#define _NS_PRIVATE
diff --git a/lib/libc/net/nsparser.y b/lib/libc/net/nsparser.y
index 6e90fc73d8c9..ec840d996f90 100644
--- a/lib/libc/net/nsparser.y
+++ b/lib/libc/net/nsparser.y
@@ -2,7 +2,7 @@
/* $NetBSD: nsparser.y,v 1.3 1999/01/25 00:16:18 lukem Exp $ */
/*-
- * 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.
@@ -32,9 +32,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#define _NS_PRIVATE
#include <nsswitch.h>
diff --git a/lib/libc/net/nss_backends.h b/lib/libc/net/nss_backends.h
index 0ec803220ada..3167208f09cd 100644
--- a/lib/libc/net/nss_backends.h
+++ b/lib/libc/net/nss_backends.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.
@@ -30,8 +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.
- *
- * $FreeBSD$
*/
/*
* Eventually, the implementations of existing built-in NSS functions
diff --git a/lib/libc/net/nss_compat.c b/lib/libc/net/nss_compat.c
index 110cd66090d6..fb1956b1e71a 100644
--- a/lib/libc/net/nss_compat.c
+++ b/lib/libc/net/nss_compat.c
@@ -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.
@@ -33,9 +33,6 @@
*
* Compatibility shims for the GNU C Library-style nsswitch interface.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#include <errno.h>
diff --git a/lib/libc/net/nsswitch.conf b/lib/libc/net/nsswitch.conf
index e0f14af76f2d..846b58754184 100644
--- a/lib/libc/net/nsswitch.conf
+++ b/lib/libc/net/nsswitch.conf
@@ -1,6 +1,5 @@
#
# nsswitch.conf(5) - name service switch configuration file
-# $FreeBSD$
#
group: compat
group_compat: nis
diff --git a/lib/libc/net/ntoh.c b/lib/libc/net/ntoh.c
index 7b2bf9edc113..508a2c81d466 100644
--- a/lib/libc/net/ntoh.c
+++ b/lib/libc/net/ntoh.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2006 Olivier Houchard
* All rights reserved.
@@ -26,9 +26,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/endian.h>
#define _BYTEORDER_FUNC_DEFINED
#include <arpa/inet.h>
diff --git a/lib/libc/net/protocols b/lib/libc/net/protocols
index 05702d430da1..7581cff17908 100644
--- a/lib/libc/net/protocols
+++ b/lib/libc/net/protocols
@@ -1,9 +1,5 @@
#
# Internet protocols
-#
-# $FreeBSD$
-# from: @(#)protocols 5.1 (Berkeley) 4/17/89
-#
# See also http://www.iana.org/assignments/protocol-numbers
#
ip 0 IP # internet protocol, pseudo protocol number
diff --git a/lib/libc/net/rcmd.3 b/lib/libc/net/rcmd.3
index 7bd586975d3c..b4b80e4385cf 100644
--- a/lib/libc/net/rcmd.3
+++ b/lib/libc/net/rcmd.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" From: @(#)rcmd.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd March 3, 2000
.Dt RCMD 3
.Os
diff --git a/lib/libc/net/rcmd.c b/lib/libc/net/rcmd.c
index e8b4ffd356c4..f9f70c7921ca 100644
--- a/lib/libc/net/rcmd.c
+++ b/lib/libc/net/rcmd.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)rcmd.c 8.3 (Berkeley) 3/26/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#include <sys/socket.h>
@@ -97,7 +91,7 @@ rcmd_af(char **ahost, int rport, const char *locuser, const char *remuser,
static char canonnamebuf[MAXDNAME]; /* is it proper here? */
/* call rcmdsh() with specified remote shell if appropriate. */
- if (!issetugid() && (p = getenv("RSH"))) {
+ if ((p = secure_getenv("RSH")) != NULL) {
struct servent *sp = getservbyname("shell", "tcp");
if (sp && sp->s_port == rport)
diff --git a/lib/libc/net/rcmdsh.3 b/lib/libc/net/rcmdsh.3
index d9929d540570..371c5b1160cb 100644
--- a/lib/libc/net/rcmdsh.3
+++ b/lib/libc/net/rcmdsh.3
@@ -27,8 +27,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd September 1, 1996
.Dt RCMDSH 3
.Os
diff --git a/lib/libc/net/rcmdsh.c b/lib/libc/net/rcmdsh.c
index b321b5a51a2f..7e400e99cb3b 100644
--- a/lib/libc/net/rcmdsh.c
+++ b/lib/libc/net/rcmdsh.c
@@ -35,9 +35,6 @@
* Chris Siebenmann <cks@utcc.utoronto.ca>.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/types.h>
#include <sys/socket.h>
diff --git a/lib/libc/net/res_config.h b/lib/libc/net/res_config.h
index 51b609b48eaf..f049d6817b7a 100644
--- a/lib/libc/net/res_config.h
+++ b/lib/libc/net/res_config.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
#define DEBUG 1 /* enable debugging code (needed for dig) */
#define RESOLVSORT /* allow sorting of addresses in gethostbyname */
diff --git a/lib/libc/net/resolver.3 b/lib/libc/net/resolver.3
index 684f2e8d98fc..f1220dcf9b7f 100644
--- a/lib/libc/net/resolver.3
+++ b/lib/libc/net/resolver.3
@@ -25,10 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)resolver.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd May 29, 2009
+.Dd January 8, 2024
.Dt RESOLVER 3
.Os
.Sh NAME
@@ -48,9 +45,6 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
-.In sys/types.h
-.In netinet/in.h
-.In arpa/nameser.h
.In resolv.h
.Ft int
.Fo res_query
@@ -443,17 +437,13 @@ see
.Sh SEE ALSO
.Xr gethostbyname 3 ,
.Xr resolver 5 ,
-.Xr hostname 7 ,
-.Xr named 8
+.Xr hostname 7
.Pp
.%T RFC1032 ,
.%T RFC1033 ,
.%T RFC1034 ,
.%T RFC1035 ,
.%T RFC974
-.Rs
-.%T "Name Server Operations Guide for BIND"
-.Re
.Sh HISTORY
The
.Nm
diff --git a/lib/libc/net/rthdr.c b/lib/libc/net/rthdr.c
index 81f07c0e77dd..0698a3f7712e 100644
--- a/lib/libc/net/rthdr.c
+++ b/lib/libc/net/rthdr.c
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/socket.h>
diff --git a/lib/libc/net/sctp_bindx.3 b/lib/libc/net/sctp_bindx.3
index c121eb4d9eeb..93a9857ddc86 100644
--- a/lib/libc/net/sctp_bindx.3
+++ b/lib/libc/net/sctp_bindx.3
@@ -25,10 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" From: @(#)send.2 8.2 (Berkeley) 2/21/94
-.\" $FreeBSD$
-.\"
-.Dd June 14, 2015
+.Dd February 2, 2024
.Dt SCTP_BINDX 3
.Os
.Sh NAME
@@ -108,3 +105,17 @@ is not a socket.
.Sh SEE ALSO
.Xr bind 2 ,
.Xr sctp 4
+.Rs
+.%A R. Stewart
+.%A M. Tuexen
+.%A K. Poon
+.%A P. Lei
+.%A V. Yasevich
+.%T Sockets API Extensions for the Stream Control Transmission Protocol (SCTP)
+.%R RFC 6458
+.%D December 2011
+.Re
+.Sh STANDARDS
+The
+.Fn sctp_bindx
+function conforms to RFC 6458.
diff --git a/lib/libc/net/sctp_connectx.3 b/lib/libc/net/sctp_connectx.3
index 0c298e1ea00a..c6cbca14006d 100644
--- a/lib/libc/net/sctp_connectx.3
+++ b/lib/libc/net/sctp_connectx.3
@@ -25,9 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd June 19, 2007
+.Dd February 2, 2024
.Dt SCTP_CONNECTX 3
.Os
.Sh NAME
@@ -100,3 +98,17 @@ is not a socket.
.Sh SEE ALSO
.Xr connect 2 ,
.Xr sctp 4
+.Rs
+.%A R. Stewart
+.%A M. Tuexen
+.%A K. Poon
+.%A P. Lei
+.%A V. Yasevich
+.%T Sockets API Extensions for the Stream Control Transmission Protocol (SCTP)
+.%R RFC 6458
+.%D December 2011
+.Re
+.Sh STANDARDS
+The
+.Fn sctp_connectx
+function conforms to RFC 6458.
diff --git a/lib/libc/net/sctp_freepaddrs.3 b/lib/libc/net/sctp_freepaddrs.3
index 400f21d8d808..07d486920125 100644
--- a/lib/libc/net/sctp_freepaddrs.3
+++ b/lib/libc/net/sctp_freepaddrs.3
@@ -25,10 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" From: @(#)send.2 8.2 (Berkeley) 2/21/94
-.\" $FreeBSD$
-.\"
-.Dd December 15, 2006
+.Dd February 2, 2024
.Dt SCTP_FREEPADDRS 3
.Os
.Sh NAME
@@ -62,3 +59,19 @@ none.
.Xr sctp_getladdrs 3 ,
.Xr sctp_getpaddrs 3 ,
.Xr sctp 4
+.Rs
+.%A R. Stewart
+.%A M. Tuexen
+.%A K. Poon
+.%A P. Lei
+.%A V. Yasevich
+.%T Sockets API Extensions for the Stream Control Transmission Protocol (SCTP)
+.%R RFC 6458
+.%D December 2011
+.Re
+.Sh STANDARDS
+The
+.Fn sctp_freepaddrs
+and
+.Fn sctp_freeladdrs
+functions conform to RFC 6458.
diff --git a/lib/libc/net/sctp_getaddrlen.3 b/lib/libc/net/sctp_getaddrlen.3
index 70e3688c74d6..cb755a71d107 100644
--- a/lib/libc/net/sctp_getaddrlen.3
+++ b/lib/libc/net/sctp_getaddrlen.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" From: @(#)send.2 8.2 (Berkeley) 2/21/94
-.\" $FreeBSD$
-.\"
.Dd December 15, 2006
.Dt SCTP_GETADDRLEN 3
.Os
diff --git a/lib/libc/net/sctp_getassocid.3 b/lib/libc/net/sctp_getassocid.3
index e0da322f943a..533833d15784 100644
--- a/lib/libc/net/sctp_getassocid.3
+++ b/lib/libc/net/sctp_getassocid.3
@@ -25,8 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd December 15, 2006
.Dt SCTP_GETASSOCID 3
.Os
diff --git a/lib/libc/net/sctp_getpaddrs.3 b/lib/libc/net/sctp_getpaddrs.3
index 0c7b8ecb5051..0e80e72bbaf6 100644
--- a/lib/libc/net/sctp_getpaddrs.3
+++ b/lib/libc/net/sctp_getpaddrs.3
@@ -25,10 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" From: @(#)send.2 8.2 (Berkeley) 2/21/94
-.\" $FreeBSD$
-.\"
-.Dd December 15, 2006
+.Dd February 2, 2024
.Dt SCTP_GETPADDRS 3
.Os
.Sh NAME
@@ -94,3 +91,19 @@ is not a socket.
.Xr sctp_freeladdrs 3 ,
.Xr sctp_freepaddrs 3 ,
.Xr sctp 4
+.Rs
+.%A R. Stewart
+.%A M. Tuexen
+.%A K. Poon
+.%A P. Lei
+.%A V. Yasevich
+.%T Sockets API Extensions for the Stream Control Transmission Protocol (SCTP)
+.%R RFC 6458
+.%D December 2011
+.Re
+.Sh STANDARDS
+The
+.Fn sctp_getpaddrs
+and
+.Fn sctp_getladdrs
+functions conform to RFC 6458.
diff --git a/lib/libc/net/sctp_opt_info.3 b/lib/libc/net/sctp_opt_info.3
index 170692cfd3fc..b8b4c1a832b5 100644
--- a/lib/libc/net/sctp_opt_info.3
+++ b/lib/libc/net/sctp_opt_info.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" From: @(#)send.2 8.2 (Berkeley) 2/21/94
-.\" $FreeBSD$
-.\"
.Dd June 18, 2011
.Dt SCTP_OPT_INFO 3
.Os
diff --git a/lib/libc/net/sctp_recvmsg.3 b/lib/libc/net/sctp_recvmsg.3
index a8b073418657..53aae5dd2527 100644
--- a/lib/libc/net/sctp_recvmsg.3
+++ b/lib/libc/net/sctp_recvmsg.3
@@ -25,13 +25,12 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd April 23, 2015
+.Dd February 2, 2024
.Dt SCTP_RECVMSG 3
.Os
.Sh NAME
-.Nm sctp_recvmsg
+.Nm sctp_recvmsg ,
+.Nm sctp_recvv
.Nd receive a message from an SCTP socket
.Sh LIBRARY
.Lb libc
@@ -44,15 +43,19 @@
.Fa "int s" "void *msg" "size_t len" "struct sockaddr * restrict from"
.Fa "socklen_t * restrict fromlen" "struct sctp_sndrcvinfo *sinfo" "int *flags"
.Fc
+.Ft ssize_t
+.Fo sctp_recvv
+.Fa "int s" "const struct iovec *iov" "int iovlen" "struct sockaddr *from"
+.Fa "socklen_t *fromlen" "void *info" "socklen_t *infolen"
+.Fa "unsigned int *infotype" "int *flags"
+.Fc
.Sh DESCRIPTION
The
.Fn sctp_recvmsg
-system call
-is used to receive a message from another SCTP endpoint.
-The
-.Fn sctp_recvmsg
-call is used by one-to-one (SOCK_STREAM) type sockets after a
-successful
+and
+.Fn sctp_recvv
+functions are used to receive a message from another SCTP endpoint.
+They are used by one-to-one (SOCK_STREAM) type sockets after a successful
.Fn connect
call or after the application has performed a
.Fn listen
@@ -60,6 +63,8 @@ followed by a successful
.Fn accept .
For a one-to-many (SOCK_SEQPACKET) type socket, an endpoint may call
.Fn sctp_recvmsg
+or
+.Fn sctp_recvv
after having implicitly started an association via one
of the send calls including
.Fn sctp_sendmsg ,
@@ -233,6 +238,159 @@ The
.Fa sinfo->info_timetolive
field is not used by
.Fn sctp_recvmsg .
+.Pp
+The
+.Fn sctp_recvv
+function works as
+.Fn sctp_recvmsg
+with two differences.
+Firstly, the receive buffer is passed as an array containing
+.Vt iocnt
+objects of type
+.Vt struct iovec ,
+where the received data will be scattered in the same manner as
+.Xr readv 2 .
+Secondly, the
+.Fa sinfo
+argument is replaced by the tuple
+.Fa info ,
+.Fa infolen ,
+and
+.Fa infotype ,
+which allow different information to be received based on the socket options.
+.Pp
+To receive an
+.Vt sctp_rcvinfo
+structure, set the
+.Va SCTP_RECVRCVINFO
+socket option, and pass a pointer to a
+.Vt struct sctp_rcvinfo
+structure in
+.Fa info .
+The
+.Vt sctp_rcvinfo
+structure has the following format:
+.Bd -literal
+struct sctp_rcvinfo {
+ uint16_t rcv_sid; /* Stream arriving on */
+ uint16_t rcv_ssn; /* Stream Sequence Number */
+ uint16_t rcv_flags; /* Flags on the incoming message */
+ uint32_t rcv_ppid; /* The ppid field */
+ uint32_t rcv_tsn; /* The transport sequence number */
+ uint32_t rcv_cumtsn; /* The cumulative TSN */
+ uint32_t rcv_context; /* Opaque context field */
+ sctp_assoc_t rcv_assoc_id; /* Peer association id */
+};
+.Ed
+.Pp
+These fields have the same meaning as the equivalent fields in
+.Vt struct sctp_sndrcvinfo ,
+defined above.
+.Pp
+To receive an
+.Vt sctp_nxtinfo
+structure, set the
+.Va SCTP_RECVNXTINFO
+socket option, and pass a pointer to a
+.Vt struct sctp_nxtinfo
+structure in
+.Fa info .
+The
+.Vt struct sctp_nxtinfo
+structure has the following format:
+.Bd -literal
+struct sctp_nxtinfo {
+ uint16_t nxt_sid; /* Next message's stream number */
+ uint16_t nxt_flags; /* Flags (see below) */
+ uint32_t nxt_ppid; /* The ppid field */
+ uint32_t nxt_length; /* Length of next message */
+ sctp_assoc_t nxt_assoc_id; /* Peer association id */
+};
+.Ed
+.Pp
+The fields
+.Va nxt_sid ,
+.Va nxt_ppid ,
+and
+.Va nxt_assoc_id
+have the same meaning as in
+.Vt struct sctp_rcvinfo ,
+except they refer to the next message rather than the message that was
+received.
+The field
+.Va nxt_length
+contains the length of the part of the next message currently available in
+the socket buffer.
+This may not represent the length of the entire message unless the
+.Va SCTP_COMPLETE
+flag is set in
+.Va nxt_flags .
+.Pp
+The
+.Va nxt_flags
+field is a bitmask which may contain any of the following values:
+.Bl -bullet
+.It
+.Va SCTP_UNORDERED :
+The next message was sent unordered.
+.It
+.Va SCTP_COMPLETE :
+The entirety of the next message has been received in the socket buffer.
+In this case, the
+.Va nxt_length
+field contains the length of the entire message.
+.It
+.Va SCTP_NOTIFICATION :
+The next message is a notification, not a user message.
+.El
+.Pp
+If both the
+.Va SCTP_RECVRCVINFO
+and
+.Va SCTP_RECVNXTINFO
+socket options are set, then pass a pointer to a
+.Vt struct sctp_recvv_rn
+structure in
+.Fa info .
+This struct has the following format:
+.Bd -literal
+struct sctp_recvv_rn {
+ struct sctp_rcvinfo recvv_rcvinfo;
+ struct sctp_nxtinfo recvv_nxtinfo;
+};
+.Ed
+.Pp
+The value pointed to by
+.Fa infolen
+should initially contain the length of the structure to which
+.Fa info
+points.
+When the function returns, it will be set to the length of the
+returned structure.
+Additionally,
+.Fa *infotype
+will be set to one of the following values depending on what type of info
+was returned:
+.Bl -bullet
+.It
+.Va SCTP_RECVV_NOINFO :
+no information was returned.
+.It
+.Va SCTP_RECVV_RCVINFO :
+.Fa *info
+contains an object of type
+.Vt struct sctp_rcvinfo .
+.It
+.Va SCTP_RECVV_NXTINFO :
+.Fa *info
+contains an object of type
+.Vt struct sctp_nxtinfo .
+.It
+.Va SCTP_RECVV_RN :
+.Fa *info
+contains an object of type
+.Vt struct sctp_recvv_rn .
+.El
.Sh RETURN VALUES
The call returns the number of bytes received, or -1
if an error occurred.
@@ -281,6 +439,12 @@ has been set on the socket).
This typically means that the socket
is not connected and is a one-to-one style socket.
.El
+.Sh NOTES
+The
+.Fn sctp_recvmsg
+function is deprecated.
+New applications should use
+.Fn sctp_recvv .
.Sh SEE ALSO
.Xr getsockopt 2 ,
.Xr recv 2 ,
@@ -292,3 +456,15 @@ is not connected and is a one-to-one style socket.
.Xr sctp_send 3 ,
.Xr sctp_sendmsg 3 ,
.Xr sctp 4
+.Rs
+.%A R. Stewart
+.%A M. Tuexen
+.%A K. Poon
+.%A P. Lei
+.%A V. Yasevich
+.%T Sockets API Extensions for the Stream Control Transmission Protocol (SCTP)
+.%R RFC 6458
+.%D December 2011
+.Re
+.Sh STANDARDS
+The functions described in this document conform to RFC 6458.
diff --git a/lib/libc/net/sctp_send.3 b/lib/libc/net/sctp_send.3
index 18a3e99473d8..ce34a2554576 100644
--- a/lib/libc/net/sctp_send.3
+++ b/lib/libc/net/sctp_send.3
@@ -25,14 +25,13 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd December 15, 2006
+.Dd February 2, 2024
.Dt SCTP_SEND 3
.Os
.Sh NAME
.Nm sctp_send ,
-.Nm sctp_sendx
+.Nm sctp_sendx ,
+.Nm sctp_sendv
.Nd send a message from an SCTP socket
.Sh LIBRARY
.Lb libc
@@ -50,11 +49,27 @@
.Fa "int sd" "const void *msg" "size_t len" "struct sockaddr *addrs"
.Fa "int addrcnt" "const struct sctp_sndrcvinfo *sinfo" "int flags"
.Fc
+.Ft ssize_t
+.Fo sctp_sendv
+.Fa "int sd" "const struct iovec *iov" "int iocnt" "struct sockaddr *addrs"
+.Fa "int addrcnt" "void *info" "socklen_t infolen" "unsigned int infotype"
+.Fa "int flags"
+.Fc
.Sh DESCRIPTION
The
.Fn sctp_send
system call
is used to transmit a message to another SCTP endpoint.
+The
+.Fn sctp_sendx
+function is used to specify multiple peer addresses when creating an implicit
+association, as in
+.Xr sctp_connectx 3 .
+The
+.Fn sctp_sendv
+function is used to transmit a message whose data is gathered from the
+provided I/O buffers.
+.Pp
.Fn sctp_send
may be used to send data to an existing association for both
one-to-many (SOCK_SEQPACKET) and one-to-one (SOCK_STREAM) socket types.
@@ -255,6 +270,7 @@ and
.Fa sinfo->sinfo_cumtsn
are used only when receiving messages and are thus ignored by
.Fn sctp_send .
+.Pp
The function
.Fn sctp_sendx
has the same properties as
@@ -283,6 +299,156 @@ the association in place of the association id.
If both
an address and an association id are specified, the association
id has priority.
+.Pp
+The function
+.Fn sctp_sendv
+works as
+.Fn sctp_sendx ,
+with two differences.
+Firstly, the data to be written is passed as an array containing
+.Vt iocnt
+objects of type
+.Vt struct iovec ,
+which will be gathered for sending in the same manner as
+.Xr writev 2 .
+Secondly, the
+.Fa info
+argument is replaced by the tuple
+.Fa sinfo ,
+.Fa infolen ,
+.Fa infotype ,
+where
+.Fa sinfo
+is a pointer to a struct of size
+.Fa infolen
+whose type is indicated by the
+.Fa infotype
+argument.
+.Pp
+If no information is passed, set
+.Fa infotype
+to
+.Va SCTP_SENDV_NOINFO .
+.Fa sinfo
+may be a null pointer.
+.Pp
+If
+.Fa sinfo
+points to a
+.Vt struct sctp_sndinfo ,
+set
+.Fa infotype
+to
+.Va SCTP_SENDV_SNDINFO .
+The
+.Vt sctp_sndinfo
+structure has the following format:
+.Bd -literal
+struct sctp_sndinfo {
+ uint16_t snd_sid; /* stream identifier */
+ uint16_t snd_flags; /* Flags */
+ uint32_t snd_ppid; /* ppid field */
+ uint32_t snd_context; /* context field */
+ sctp_assoc_t snd_assoc_id; /* association id */
+};
+.Ed
+.Pp
+The meaning of these fields is the same as in
+.Vt struct sctp_sndrcvinfo ,
+described above.
+.Pp
+If
+.Fa sinfo
+points to a
+.Vt struct sctp_authinfo ,
+set
+.Fa infotype
+to
+.Va SCTP_SENDV_AUTHINFO .
+The
+.Vt sctp_authinfo
+struct has the following format:
+.Bd -literal
+struct sctp_authinfo {
+ uint16_t auth_keynumber; /* Shared key identifier */
+};
+.Ed
+.Pp
+The
+.Va auth_keynumber
+field specifies the shared key identifier that will be used for sending the
+message.
+.Pp
+If
+.Fa sinfo
+points to a
+.Vt struct sctp_prinfo ,
+set
+.Fa infotype
+to
+.Va SCTP_SENDV_PRINFO .
+The
+.Vt sctp_prinfo
+structure has the following format:
+.Bd -literal
+struct sctp_prinfo {
+ uint16_t pr_policy; /* PR-SCTP policy */
+ uint32_t pr_value; /* PR-SCTP Policy option */
+};
+.Ed
+.Pp
+The
+.Va pr_policy
+field should be set to either
+.Va SCTP_PR_SCTP_NONE
+to use reliable transmission (in which case the field
+.Va pr_value
+is ignored), or
+.Va SCTP_PR_SCTP_TTL
+to use RFC 3758 timed reliability, in which case the field
+.Va pr_value
+contains the lifetime in milliseconds.
+.Pp
+To pass two or more types in
+.Fa sinfo ,
+set
+.Fa infotype
+to
+.Va SCTP_SENDV_SPA
+and pass a pointer to a
+.Vt struct sctp_sendv_spa
+in
+.Fa sinfo .
+The
+.Ft sctp_sendv_spa
+structure has the following format:
+.Bd -literal
+struct sctp_sendv_spa {
+ uint32_t sendv_flags;
+ struct sctp_sndinfo sendv_sndinfo;
+ struct sctp_prinfo sendv_prinfo;
+ struct sctp_authinfo sendv_authinfo;
+};
+.Ed
+.Pp
+The
+.Va sendv_flags
+member should be set to the bitwise OR of the flags
+.Va SCTP_SEND_SNDINFO_VALID ,
+.Va SCTP_SEND_PRINFO_VALID ,
+and
+.Va SCTP_SEND_AUTHINFO_VALID
+to indicate which fields of the struct contain valid data.
+.Pp
+If
+.Fa infotype
+is set to SCTP_SENDV_NOINFO, the
+.Fa infolen
+argument should be set to zero.
+Otherwise,
+.Fa infolen
+should be set to the length of the data structure pointed to by
+.Fa info .
.Sh RETURN VALUES
The call returns the number of characters sent, or -1
if an error occurred.
@@ -331,6 +497,14 @@ has been set on the socket).
This typically means that the socket
is not connected and is a one-to-one style socket.
.El
+.Sh NOTES
+The functions
+.Fn sctp_send
+and
+.Fn sctp_sendx
+are deprecated.
+New applications should use
+.Fn sctp_sendv .
.Sh SEE ALSO
.Xr getsockopt 2 ,
.Xr recv 2 ,
@@ -342,6 +516,18 @@ is not connected and is a one-to-one style socket.
.Xr sctp_recvmsg 3 ,
.Xr sctp_sendmsg 3 ,
.Xr sctp 4
+.Rs
+.%A R. Stewart
+.%A M. Tuexen
+.%A K. Poon
+.%A P. Lei
+.%A V. Yasevich
+.%T Sockets API Extensions for the Stream Control Transmission Protocol (SCTP)
+.%R RFC 6458
+.%D December 2011
+.Re
+.Sh STANDARDS
+The functions described in this document conform to RFC 6458.
.Sh BUGS
Because
.Fn sctp_send
diff --git a/lib/libc/net/sctp_sendmsg.3 b/lib/libc/net/sctp_sendmsg.3
index 65f790ab8a3f..47a7c7db2d8b 100644
--- a/lib/libc/net/sctp_sendmsg.3
+++ b/lib/libc/net/sctp_sendmsg.3
@@ -25,10 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" From: @(#)send.2 8.2 (Berkeley) 2/21/94
-.\" $FreeBSD$
-.\"
-.Dd December 15, 2006
+.Dd February 2, 2024
.Dt SCTP_SENDMSG 3
.Os
.Sh NAME
@@ -99,13 +96,13 @@ is set to
the message is not transmitted.
.Pp
No indication of failure to deliver is implicit in a
-.Xr sctp_sendmsg 3
+.Fn sctp_sendmsg
call.
Locally detected errors are indicated by a return value of -1.
.Pp
If no space is available at the socket to hold
the message to be transmitted, then
-.Xr sctp_sendmsg 3
+.Fn sctp_sendmsg
normally blocks, unless the socket has been placed in
non-blocking I/O mode.
The
diff --git a/lib/libc/net/sctp_sys_calls.c b/lib/libc/net/sctp_sys_calls.c
index 66a0f6adac3a..5cb26266c888 100644
--- a/lib/libc/net/sctp_sys_calls.c
+++ b/lib/libc/net/sctp_sys_calls.c
@@ -32,9 +32,6 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
@@ -391,23 +388,27 @@ sctp_getpaddrs(int sd, sctp_assoc_t id, struct sockaddr **raddrs)
{
struct sctp_getaddresses *addrs;
struct sockaddr *sa;
- sctp_assoc_t asoc;
caddr_t lim;
socklen_t opt_len;
+ uint32_t size_of_addresses;
int cnt;
if (raddrs == NULL) {
errno = EFAULT;
return (-1);
}
- asoc = id;
- opt_len = (socklen_t)sizeof(sctp_assoc_t);
+ /* When calling getsockopt(), the value contains the assoc_id. */
+ size_of_addresses = (uint32_t)id;
+ opt_len = (socklen_t)sizeof(uint32_t);
if (getsockopt(sd, IPPROTO_SCTP, SCTP_GET_REMOTE_ADDR_SIZE,
- &asoc, &opt_len) != 0) {
- return (-1);
+ &size_of_addresses, &opt_len) != 0) {
+ if (errno == ENOENT) {
+ return (0);
+ } else {
+ return (-1);
+ }
}
- /* size required is returned in 'asoc' */
- opt_len = (socklen_t)((size_t)asoc + sizeof(struct sctp_getaddresses));
+ opt_len = (socklen_t)((size_t)size_of_addresses + sizeof(struct sctp_getaddresses));
addrs = calloc(1, (size_t)opt_len);
if (addrs == NULL) {
errno = ENOMEM;
@@ -446,10 +447,10 @@ int
sctp_getladdrs(int sd, sctp_assoc_t id, struct sockaddr **raddrs)
{
struct sctp_getaddresses *addrs;
- caddr_t lim;
struct sockaddr *sa;
- size_t size_of_addresses;
+ caddr_t lim;
socklen_t opt_len;
+ uint32_t size_of_addresses;
int cnt;
if (raddrs == NULL) {
@@ -457,17 +458,12 @@ sctp_getladdrs(int sd, sctp_assoc_t id, struct sockaddr **raddrs)
return (-1);
}
size_of_addresses = 0;
- opt_len = (socklen_t)sizeof(int);
+ opt_len = (socklen_t)sizeof(uint32_t);
if (getsockopt(sd, IPPROTO_SCTP, SCTP_GET_LOCAL_ADDR_SIZE,
&size_of_addresses, &opt_len) != 0) {
- errno = ENOMEM;
- return (-1);
- }
- if (size_of_addresses == 0) {
- errno = ENOTCONN;
return (-1);
}
- opt_len = (socklen_t)(size_of_addresses + sizeof(struct sctp_getaddresses));
+ opt_len = (socklen_t)((size_t)size_of_addresses + sizeof(struct sctp_getaddresses));
addrs = calloc(1, (size_t)opt_len);
if (addrs == NULL) {
errno = ENOMEM;
@@ -478,9 +474,12 @@ sctp_getladdrs(int sd, sctp_assoc_t id, struct sockaddr **raddrs)
if (getsockopt(sd, IPPROTO_SCTP, SCTP_GET_LOCAL_ADDRESSES, addrs,
&opt_len) != 0) {
free(addrs);
- errno = ENOMEM;
return (-1);
}
+ if (size_of_addresses == 0) {
+ free(addrs);
+ return (0);
+ }
*raddrs = &addrs->addr[0].sa;
cnt = 0;
sa = &addrs->addr[0].sa;
diff --git a/lib/libc/net/sockatmark.3 b/lib/libc/net/sockatmark.3
index 61a1a9f52989..f499eb0b902d 100644
--- a/lib/libc/net/sockatmark.3
+++ b/lib/libc/net/sockatmark.3
@@ -21,9 +21,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd October 13, 2002
+.Dd July 3, 2022
.Dt SOCKATMARK 3
.Os
.Sh NAME
@@ -107,6 +105,21 @@ is a descriptor for a file, not a socket.
.Sh SEE ALSO
.Xr recv 2 ,
.Xr send 2
+.Rs
+.%T "An Introductory 4.4BSD Interprocess Communication Tutorial"
+.%A Stuart Sechrest
+.Re
+.%U https://docs.freebsd.org/44doc/psd/20.ipctut/paper.pdf
+.Rs
+.%T "An Advanced 4.4BSD Interprocess Communication Tutorial"
+.%A Samuel J. Leffler
+.%A Robert S. Fabry
+.%A William N. Joy
+.%A Phil Lapsley
+.%A Steve Miller
+.%A Chris Torek
+.%U https://docs.freebsd.org/44doc/psd/21.ipc/paper.pdf
+.Re
.Sh HISTORY
The
.Fn sockatmark
diff --git a/lib/libc/net/sockatmark.c b/lib/libc/net/sockatmark.c
index f56304359a76..4a26b09e3c88 100644
--- a/lib/libc/net/sockatmark.c
+++ b/lib/libc/net/sockatmark.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002 William C. Fenner. All rights reserved.
*
@@ -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$
*/
#include "namespace.h"
#include <sys/ioctl.h>
diff --git a/lib/libc/net/sourcefilter.3 b/lib/libc/net/sourcefilter.3
index a123ff38d68e..41f0fdca04de 100644
--- a/lib/libc/net/sourcefilter.3
+++ b/lib/libc/net/sourcefilter.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd February 13, 2009
.Dt SOURCEFILTER 3
.Os
diff --git a/lib/libc/net/sourcefilter.c b/lib/libc/net/sourcefilter.c
index 9bfb72d84504..81fa55741d0c 100644
--- a/lib/libc/net/sourcefilter.c
+++ b/lib/libc/net/sourcefilter.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2007-2009 Bruce Simpson.
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
diff --git a/lib/libc/net/vars.c b/lib/libc/net/vars.c
index 5bcfb9f9263e..1a8824740dec 100644
--- a/lib/libc/net/vars.c
+++ b/lib/libc/net/vars.c
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <netinet/in.h>
diff --git a/lib/libc/nls/C.msg b/lib/libc/nls/C.msg
index 4004011d260f..7feea372ed86 100644
--- a/lib/libc/nls/C.msg
+++ b/lib/libc/nls/C.msg
@@ -1,4 +1,3 @@
-$ $FreeBSD$
$
$ Message catalog for C locale (template)
$
diff --git a/lib/libc/nls/Makefile.inc b/lib/libc/nls/Makefile.inc
index 2734e51fe216..0d4c245c6911 100644
--- a/lib/libc/nls/Makefile.inc
+++ b/lib/libc/nls/Makefile.inc
@@ -1,5 +1,4 @@
# from $NetBSD: Makefile.inc,v 1.7 1995/02/27 13:06:20 cgd Exp $
-# $FreeBSD$
.PATH: ${LIBC_SRCTOP}/nls
diff --git a/lib/libc/nls/Symbol.map b/lib/libc/nls/Symbol.map
index 818466e6ffb1..0703131b8415 100644
--- a/lib/libc/nls/Symbol.map
+++ b/lib/libc/nls/Symbol.map
@@ -1,7 +1,3 @@
-/*
- * $FreeBSD$
- */
-
FBSD_1.0 {
catopen;
catgets;
diff --git a/lib/libc/nls/be_BY.UTF-8.msg b/lib/libc/nls/be_BY.UTF-8.msg
index 56bd038aca48..5498580e19a4 100644
--- a/lib/libc/nls/be_BY.UTF-8.msg
+++ b/lib/libc/nls/be_BY.UTF-8.msg
@@ -1,4 +1,3 @@
-$ $FreeBSD$
$
$ Message catalog for be_BY.UTF-8 locale
$
diff --git a/lib/libc/nls/ca_ES.ISO8859-1.msg b/lib/libc/nls/ca_ES.ISO8859-1.msg
index e786c29c6b26..5d7556f1b15e 100644
--- a/lib/libc/nls/ca_ES.ISO8859-1.msg
+++ b/lib/libc/nls/ca_ES.ISO8859-1.msg
@@ -1,4 +1,3 @@
-$ $FreeBSD$
$
$ Message catalog for ca_ES.ISO8859-1 locale
$
diff --git a/lib/libc/nls/catclose.3 b/lib/libc/nls/catclose.3
index ed0f639d2393..6ac08992e1e5 100644
--- a/lib/libc/nls/catclose.3
+++ b/lib/libc/nls/catclose.3
@@ -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$
.Dd February 12, 2005
.Dt CATCLOSE 3
.Os
diff --git a/lib/libc/nls/catgets.3 b/lib/libc/nls/catgets.3
index 38e92ba23c30..b71c616a566f 100644
--- a/lib/libc/nls/catgets.3
+++ b/lib/libc/nls/catgets.3
@@ -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$
.Dd February 12, 2005
.Dt CATGETS 3
.Os
diff --git a/lib/libc/nls/catopen.3 b/lib/libc/nls/catopen.3
index 7744b0bd864c..6fd50956be1f 100644
--- a/lib/libc/nls/catopen.3
+++ b/lib/libc/nls/catopen.3
@@ -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$
.Dd February 12, 2005
.Dt CATOPEN 3
.Os
diff --git a/lib/libc/nls/de_DE.ISO8859-1.msg b/lib/libc/nls/de_DE.ISO8859-1.msg
index 1bb4a3b45334..d2af2c51a807 100644
--- a/lib/libc/nls/de_DE.ISO8859-1.msg
+++ b/lib/libc/nls/de_DE.ISO8859-1.msg
@@ -1,4 +1,3 @@
-$ $FreeBSD$
$
$ Message catalog for de_DE.ISO8859-1 locale
$
diff --git a/lib/libc/nls/el_GR.ISO8859-7.msg b/lib/libc/nls/el_GR.ISO8859-7.msg
index ca84929b9eed..b8de3f70b84d 100644
--- a/lib/libc/nls/el_GR.ISO8859-7.msg
+++ b/lib/libc/nls/el_GR.ISO8859-7.msg
@@ -1,4 +1,3 @@
-$ $FreeBSD$
$
$ Message catalog for C locale (template)
$
diff --git a/lib/libc/nls/es_ES.ISO8859-1.msg b/lib/libc/nls/es_ES.ISO8859-1.msg
index 2687c177fd57..01182d7c6e44 100644
--- a/lib/libc/nls/es_ES.ISO8859-1.msg
+++ b/lib/libc/nls/es_ES.ISO8859-1.msg
@@ -1,4 +1,3 @@
-$ $FreeBSD$
$
$ Message catalog for es_ES.ISO8859-1 locale
$
diff --git a/lib/libc/nls/fi_FI.ISO8859-1.msg b/lib/libc/nls/fi_FI.ISO8859-1.msg
index 491f9a13ab6e..8325f762776c 100644
--- a/lib/libc/nls/fi_FI.ISO8859-1.msg
+++ b/lib/libc/nls/fi_FI.ISO8859-1.msg
@@ -1,4 +1,3 @@
-$ $FreeBSD$
$
$ Message catalog for fi_FI.ISO8859-1 locale
$
diff --git a/lib/libc/nls/fr_FR.ISO8859-1.msg b/lib/libc/nls/fr_FR.ISO8859-1.msg
index ebc1739ea28c..758e1106ee99 100644
--- a/lib/libc/nls/fr_FR.ISO8859-1.msg
+++ b/lib/libc/nls/fr_FR.ISO8859-1.msg
@@ -1,4 +1,3 @@
-$ $FreeBSD$
$
$ Message catalog for fr_FR.ISO8859-1 locale
$
diff --git a/lib/libc/nls/gl_ES.ISO8859-1.msg b/lib/libc/nls/gl_ES.ISO8859-1.msg
index 4255dc8a959a..b5b208d99f66 100644
--- a/lib/libc/nls/gl_ES.ISO8859-1.msg
+++ b/lib/libc/nls/gl_ES.ISO8859-1.msg
@@ -1,4 +1,3 @@
-$ $FreeBSD$
$
$ Message catalog for gl_ES.ISO8859-1 locale
$
diff --git a/lib/libc/nls/hu_HU.ISO8859-2.msg b/lib/libc/nls/hu_HU.ISO8859-2.msg
index 330d486a7b8e..a131eea163c5 100644
--- a/lib/libc/nls/hu_HU.ISO8859-2.msg
+++ b/lib/libc/nls/hu_HU.ISO8859-2.msg
@@ -1,4 +1,3 @@
-$ $FreeBSD$
$
$ Message catalog for hu_HU.ISO8859-2 locale
$
diff --git a/lib/libc/nls/it_IT.ISO8859-15.msg b/lib/libc/nls/it_IT.ISO8859-15.msg
index da3734d04d50..df376bf7ac6b 100644
--- a/lib/libc/nls/it_IT.ISO8859-15.msg
+++ b/lib/libc/nls/it_IT.ISO8859-15.msg
@@ -1,4 +1,3 @@
-$ $FreeBSD$
$
$ Message catalog for it_IT.ISO8859-15 locale
$
diff --git a/lib/libc/nls/ja_JP.UTF-8.msg b/lib/libc/nls/ja_JP.UTF-8.msg
index 6be65fbb5c0a..e22f834b6669 100644
--- a/lib/libc/nls/ja_JP.UTF-8.msg
+++ b/lib/libc/nls/ja_JP.UTF-8.msg
@@ -1,4 +1,3 @@
-$ $FreeBSD$
$
$ Message catalog for ja_JP.UTF-8 locale
$
diff --git a/lib/libc/nls/ja_JP.eucJP.msg b/lib/libc/nls/ja_JP.eucJP.msg
index e3fac48c6a13..51fb8e22a389 100644
--- a/lib/libc/nls/ja_JP.eucJP.msg
+++ b/lib/libc/nls/ja_JP.eucJP.msg
@@ -1,4 +1,3 @@
-$ $FreeBSD$
$
$ Message catalog for ja_JP.eucJP locale
$
diff --git a/lib/libc/nls/ko_KR.UTF-8.msg b/lib/libc/nls/ko_KR.UTF-8.msg
index 60e8a121dfe4..20d368a226b0 100644
--- a/lib/libc/nls/ko_KR.UTF-8.msg
+++ b/lib/libc/nls/ko_KR.UTF-8.msg
@@ -1,4 +1,3 @@
-$ $FreeBSD$
$
$ Message catalog for ko_KR.UTF-8 locale
$
diff --git a/lib/libc/nls/ko_KR.eucKR.msg b/lib/libc/nls/ko_KR.eucKR.msg
index bb1fa300b164..7cdaddd01f51 100644
--- a/lib/libc/nls/ko_KR.eucKR.msg
+++ b/lib/libc/nls/ko_KR.eucKR.msg
@@ -1,4 +1,3 @@
-$ $FreeBSD$
$
$ Message catalog for ko_KR.eucKR locale
$
diff --git a/lib/libc/nls/mn_MN.UTF-8.msg b/lib/libc/nls/mn_MN.UTF-8.msg
index 29ab4c15f50d..429757367ee0 100644
--- a/lib/libc/nls/mn_MN.UTF-8.msg
+++ b/lib/libc/nls/mn_MN.UTF-8.msg
@@ -1,4 +1,3 @@
-$ $FreeBSD$
$
$ Message catalog for mn_MN.UTF-8 locale
$
diff --git a/lib/libc/nls/msgcat.c b/lib/libc/nls/msgcat.c
index f27bf7918b88..32fa191c4c67 100644
--- a/lib/libc/nls/msgcat.c
+++ b/lib/libc/nls/msgcat.c
@@ -31,9 +31,6 @@ up-to-date. Many thanks.
******************************************************************/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#define _NLS_PRIVATE
#include "namespace.h"
@@ -196,7 +193,7 @@ __catopen_l(const char *name, int type, locale_t locale)
pcode = cptr;
}
- if ((nlspath = getenv("NLSPATH")) == NULL || issetugid())
+ if ((nlspath = secure_getenv("NLSPATH")) == NULL)
nlspath = _DEFAULT_NLS_PATH;
if ((base = cptr = strdup(nlspath)) == NULL) {
diff --git a/lib/libc/nls/nl_NL.ISO8859-1.msg b/lib/libc/nls/nl_NL.ISO8859-1.msg
index 2939116fc97c..0048a2ff35cb 100644
--- a/lib/libc/nls/nl_NL.ISO8859-1.msg
+++ b/lib/libc/nls/nl_NL.ISO8859-1.msg
@@ -1,4 +1,3 @@
-$ $FreeBSD$
$
$ Message catalog for nl_NL.ISO8859-1 locale
$
diff --git a/lib/libc/nls/no_NO.ISO8859-1.msg b/lib/libc/nls/no_NO.ISO8859-1.msg
index 2598f4d9357e..415a01dedfbf 100644
--- a/lib/libc/nls/no_NO.ISO8859-1.msg
+++ b/lib/libc/nls/no_NO.ISO8859-1.msg
@@ -1,4 +1,3 @@
-$ $FreeBSD$
$
$ Message catalog for no_NO.ISO8859-1 locale
$
diff --git a/lib/libc/nls/pl_PL.ISO8859-2.msg b/lib/libc/nls/pl_PL.ISO8859-2.msg
index 1c184b30997d..ea8951aed15c 100644
--- a/lib/libc/nls/pl_PL.ISO8859-2.msg
+++ b/lib/libc/nls/pl_PL.ISO8859-2.msg
@@ -1,4 +1,3 @@
-$ $FreeBSD$
$
$ Message catalog for pl_PL.ISO8859-2 locale
$
diff --git a/lib/libc/nls/pt_BR.ISO8859-1.msg b/lib/libc/nls/pt_BR.ISO8859-1.msg
index fb1c10056ccf..8e15c82916b8 100644
--- a/lib/libc/nls/pt_BR.ISO8859-1.msg
+++ b/lib/libc/nls/pt_BR.ISO8859-1.msg
@@ -1,4 +1,3 @@
-$ $FreeBSD$
$
$ Message catalog for pt_BR.ISO8859-1 locale
$
diff --git a/lib/libc/nls/ru_RU.KOI8-R.msg b/lib/libc/nls/ru_RU.KOI8-R.msg
index 48bc1d400150..0fcd0e9b1225 100644
--- a/lib/libc/nls/ru_RU.KOI8-R.msg
+++ b/lib/libc/nls/ru_RU.KOI8-R.msg
@@ -1,4 +1,3 @@
-$ $FreeBSD$
$
$ Message catalog for ru_RU.KOI8-R locale
$
diff --git a/lib/libc/nls/sk_SK.ISO8859-2.msg b/lib/libc/nls/sk_SK.ISO8859-2.msg
index 8efa17d754a1..ba657382f66d 100644
--- a/lib/libc/nls/sk_SK.ISO8859-2.msg
+++ b/lib/libc/nls/sk_SK.ISO8859-2.msg
@@ -1,4 +1,3 @@
-$ $FreeBSD$
$
$ Message catalog for sk_SK.ISO8859-2 locale
$
diff --git a/lib/libc/nls/sv_SE.ISO8859-1.msg b/lib/libc/nls/sv_SE.ISO8859-1.msg
index 13cdd23f87f7..a1aa781dda7d 100644
--- a/lib/libc/nls/sv_SE.ISO8859-1.msg
+++ b/lib/libc/nls/sv_SE.ISO8859-1.msg
@@ -1,4 +1,3 @@
-$ $FreeBSD$
$
$ Message catalog for sv_SE.ISO8859-1 locale
$
diff --git a/lib/libc/nls/uk_UA.UTF-8.msg b/lib/libc/nls/uk_UA.UTF-8.msg
index af871d942766..f6e4b1781ede 100644
--- a/lib/libc/nls/uk_UA.UTF-8.msg
+++ b/lib/libc/nls/uk_UA.UTF-8.msg
@@ -1,4 +1,3 @@
-$ $FreeBSD$
$
$ Message catalog for uk_UA.UTF-8 locale
$
diff --git a/lib/libc/nls/zh_CN.GB18030.msg b/lib/libc/nls/zh_CN.GB18030.msg
index 0e35d7e9eb73..dbaedd5d0a52 100644
--- a/lib/libc/nls/zh_CN.GB18030.msg
+++ b/lib/libc/nls/zh_CN.GB18030.msg
@@ -1,4 +1,3 @@
-$ $FreeBSD$
$
$ Message catalog for zh_CN.GB18030 locale
$
diff --git a/lib/libc/nls/zh_CN.GB2312.msg b/lib/libc/nls/zh_CN.GB2312.msg
index 46ebb422ff84..27f07d98e3e2 100644
--- a/lib/libc/nls/zh_CN.GB2312.msg
+++ b/lib/libc/nls/zh_CN.GB2312.msg
@@ -1,4 +1,3 @@
-$ $FreeBSD$
$
$ Message catalog for zh_CN.GB2312 locale
$
diff --git a/lib/libc/nls/zh_CN.UTF-8.msg b/lib/libc/nls/zh_CN.UTF-8.msg
index 9475ea8e82da..46e26d6824f5 100644
--- a/lib/libc/nls/zh_CN.UTF-8.msg
+++ b/lib/libc/nls/zh_CN.UTF-8.msg
@@ -1,4 +1,3 @@
-$ $FreeBSD$
$
$ Message catalog for zh_CN.UTF-8 locale
$
diff --git a/lib/libc/posix1e/Makefile.inc b/lib/libc/posix1e/Makefile.inc
index 3bceef2ff7de..0b738ef7e239 100644
--- a/lib/libc/posix1e/Makefile.inc
+++ b/lib/libc/posix1e/Makefile.inc
@@ -1,4 +1,3 @@
-# $FreeBSD$
.PATH: ${LIBC_SRCTOP}/posix1e
@@ -96,23 +95,27 @@ MAN+= acl.3 \
posix1e.3
MLINKS+=acl_create_entry.3 acl_create_entry_np.3\
+ acl_cmp_np.3 acl_cmp.3 \
acl_delete.3 acl_delete_def_file.3 \
- acl_delete.3 acl_delete_file_np.3 \
+ acl_delete.3 acl_delete_def_link_np.3 \
acl_delete.3 acl_delete_fd_np.3 \
+ acl_delete.3 acl_delete_file_np.3 \
+ acl_delete.3 acl_delete_link_np.3 \
acl_delete_entry.3 acl_delete_entry_np.3\
acl_extended_file_np.3 acl_extended_file_nofollow_np.3 \
acl_extended_file_np.3 acl_extended_link_np.3 \
- acl_get.3 acl_get_file.3 \
acl_get.3 acl_get_fd.3 \
acl_get.3 acl_get_fd_np.3 \
+ acl_get.3 acl_get_file.3 \
acl_get.3 acl_get_link_np.3 \
- acl_set.3 acl_set_file.3 \
acl_set.3 acl_set_fd.3 \
acl_set.3 acl_set_fd_np.3 \
+ acl_set.3 acl_set_file.3 \
acl_set.3 acl_set_link_np.3 \
acl_to_text.3 acl_to_text_np.3 \
- acl_valid.3 acl_valid_file_np.3 \
acl_valid.3 acl_valid_fd_np.3 \
+ acl_valid.3 acl_valid_file_np.3 \
+ acl_valid.3 acl_valid_link_np.3 \
extattr.3 extattr_namespace_to_string.3 \
extattr.3 extattr_string_to_namespace.3 \
mac_get.3 mac_get_fd.3 \
diff --git a/lib/libc/posix1e/Symbol.map b/lib/libc/posix1e/Symbol.map
index d78691419c90..92a0bf85cfa2 100644
--- a/lib/libc/posix1e/Symbol.map
+++ b/lib/libc/posix1e/Symbol.map
@@ -1,7 +1,3 @@
-/*
- * $FreeBSD$
- */
-
FBSD_1.0 {
acl_calc_mask;
acl_copy_entry;
diff --git a/lib/libc/posix1e/acl.3 b/lib/libc/posix1e/acl.3
index 2c7ebd63ad4e..4c5f232a2e6a 100644
--- a/lib/libc/posix1e/acl.3
+++ b/lib/libc/posix1e/acl.3
@@ -25,9 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd October 30, 2014
+.Dd September 21, 2023
.Dt ACL 3
.Os
.Sh NAME
@@ -158,6 +156,10 @@ and may be used to retrieve an ACL type from an ACL entry.
This function is described in
.Xr acl_get_flagset_np 3 ,
and may be used to retrieve a flagset from an ACL entry.
+.It Fn acl_get_perm_np
+This function is described in
+.Xr acl_get_perm_np 3 ,
+and may be used to check if a permission is set in a permset.
.It Fn acl_get_permset
This function is described in
.Xr acl_get_permset 3 ,
@@ -257,6 +259,7 @@ library.
.Xr acl_get_brand_np 3 ,
.Xr acl_get_entry_type_np 3 ,
.Xr acl_get_flagset_np 3 ,
+.Xr acl_get_perm_np 3 ,
.Xr acl_get_permset 3 ,
.Xr acl_get_qualifier 3 ,
.Xr acl_get_tag_type 3 ,
@@ -283,11 +286,6 @@ POSIX.2c describes a set of userland utilities for manipulating these
labels.
.Pp
POSIX.1e is described in IEEE POSIX.1e draft 17.
-Discussion of the draft continues on the cross-platform POSIX.1e
-implementation mailing list.
-To join this list, see the
-.Fx
-POSIX.1e implementation page for more information.
.Sh HISTORY
POSIX.1e support was introduced in
.Fx 4.0 ;
diff --git a/lib/libc/posix1e/acl_add_flag_np.3 b/lib/libc/posix1e/acl_add_flag_np.3
index a2ccaa52765f..607018958ebf 100644
--- a/lib/libc/posix1e/acl_add_flag_np.3
+++ b/lib/libc/posix1e/acl_add_flag_np.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd September 4, 2015
.Dt ACL_ADD_FLAG_NP 3
.Os
diff --git a/lib/libc/posix1e/acl_add_perm.3 b/lib/libc/posix1e/acl_add_perm.3
index c59aac8e41fa..79f6291b34a6 100644
--- a/lib/libc/posix1e/acl_add_perm.3
+++ b/lib/libc/posix1e/acl_add_perm.3
@@ -23,8 +23,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd June 25, 2009
.Dt ACL_ADD_PERM 3
.Os
diff --git a/lib/libc/posix1e/acl_branding.c b/lib/libc/posix1e/acl_branding.c
index 3a1254443526..85c0d2b86825 100644
--- a/lib/libc/posix1e/acl_branding.c
+++ b/lib/libc/posix1e/acl_branding.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2008, 2009 Edward Tomasz Napierała <trasz@FreeBSD.org>
*
@@ -25,9 +25,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <assert.h>
#include <errno.h>
#include <sys/acl.h>
diff --git a/lib/libc/posix1e/acl_calc_mask.3 b/lib/libc/posix1e/acl_calc_mask.3
index 1cd3fd7c03c7..e98ede1265f3 100644
--- a/lib/libc/posix1e/acl_calc_mask.3
+++ b/lib/libc/posix1e/acl_calc_mask.3
@@ -23,8 +23,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd March 10, 2001
.Dt ACL_CALC_MASK 3
.Os
diff --git a/lib/libc/posix1e/acl_calc_mask.c b/lib/libc/posix1e/acl_calc_mask.c
index 7089df7d46e0..3e5c5afd06c2 100644
--- a/lib/libc/posix1e/acl_calc_mask.c
+++ b/lib/libc/posix1e/acl_calc_mask.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2001-2002 Chris D. Faulhaber
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include "namespace.h"
#include <sys/acl.h>
diff --git a/lib/libc/posix1e/acl_clear_flags_np.3 b/lib/libc/posix1e/acl_clear_flags_np.3
index 3e557c0184e2..44086916eebd 100644
--- a/lib/libc/posix1e/acl_clear_flags_np.3
+++ b/lib/libc/posix1e/acl_clear_flags_np.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd October 30, 2014
.Dt ACL_CLEAR_FLAGS_NP 3
.Os
diff --git a/lib/libc/posix1e/acl_clear_perms.3 b/lib/libc/posix1e/acl_clear_perms.3
index 4b055fcf5e64..06f02e8d46ae 100644
--- a/lib/libc/posix1e/acl_clear_perms.3
+++ b/lib/libc/posix1e/acl_clear_perms.3
@@ -23,8 +23,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd March 10, 2001
.Dt ACL_CLEAR_PERMS 3
.Os
diff --git a/lib/libc/posix1e/acl_cmp_np.c b/lib/libc/posix1e/acl_cmp_np.c
index 43fe9dcb3f7e..f7ee9c235a04 100644
--- a/lib/libc/posix1e/acl_cmp_np.c
+++ b/lib/libc/posix1e/acl_cmp_np.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2021 Gleb Popov
* All rights reserved.
@@ -29,9 +29,6 @@
* acl_cmp_np: Compare two ACL's.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/acl.h>
#include <sys/errno.h>
diff --git a/lib/libc/posix1e/acl_compat.c b/lib/libc/posix1e/acl_compat.c
index d41503f6787b..836cf3cab500 100644
--- a/lib/libc/posix1e/acl_compat.c
+++ b/lib/libc/posix1e/acl_compat.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2008 Edward Tomasz Napierała <trasz@FreeBSD.org>
*
@@ -25,9 +25,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/acl.h>
int __oldacl_get_perm_np(acl_permset_t, oldacl_perm_t);
diff --git a/lib/libc/posix1e/acl_copy.c b/lib/libc/posix1e/acl_copy.c
index 12af1fa7a449..3f0771b1c257 100644
--- a/lib/libc/posix1e/acl_copy.c
+++ b/lib/libc/posix1e/acl_copy.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2001-2002 Chris D. Faulhaber
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include "namespace.h"
#include <sys/acl.h>
diff --git a/lib/libc/posix1e/acl_copy_entry.3 b/lib/libc/posix1e/acl_copy_entry.3
index 5fd31ed793e6..33a3c07e1e6f 100644
--- a/lib/libc/posix1e/acl_copy_entry.3
+++ b/lib/libc/posix1e/acl_copy_entry.3
@@ -23,8 +23,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd March 10, 2001
.Dt ACL_COPY_ENTRY 3
.Os
diff --git a/lib/libc/posix1e/acl_create_entry.3 b/lib/libc/posix1e/acl_create_entry.3
index 5732672c50a2..5a4cae3c5759 100644
--- a/lib/libc/posix1e/acl_create_entry.3
+++ b/lib/libc/posix1e/acl_create_entry.3
@@ -23,8 +23,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd June 25, 2009
.Dt ACL_CREATE_ENTRY 3
.Os
diff --git a/lib/libc/posix1e/acl_delete.3 b/lib/libc/posix1e/acl_delete.3
index fb2958b73e49..3899158e9196 100644
--- a/lib/libc/posix1e/acl_delete.3
+++ b/lib/libc/posix1e/acl_delete.3
@@ -25,8 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd December 29, 2002
.Dt ACL_DELETE 3
.Os
diff --git a/lib/libc/posix1e/acl_delete.c b/lib/libc/posix1e/acl_delete.c
index 5867196e4373..35303fe87e0f 100644
--- a/lib/libc/posix1e/acl_delete.c
+++ b/lib/libc/posix1e/acl_delete.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1999, 2000, 2001, 2002 Robert N. M. Watson
* All rights reserved.
@@ -31,9 +31,6 @@
* acl_delete_def_file -- remove a default acl from a file
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include "namespace.h"
#include <sys/acl.h>
diff --git a/lib/libc/posix1e/acl_delete_entry.3 b/lib/libc/posix1e/acl_delete_entry.3
index 06bb0ded1ed0..53d689987de2 100644
--- a/lib/libc/posix1e/acl_delete_entry.3
+++ b/lib/libc/posix1e/acl_delete_entry.3
@@ -23,8 +23,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd June 25, 2009
.Dt ACL_DELETE_ENTRY 3
.Os
diff --git a/lib/libc/posix1e/acl_delete_entry.c b/lib/libc/posix1e/acl_delete_entry.c
index 59462c8ae6ab..a787609f3853 100644
--- a/lib/libc/posix1e/acl_delete_entry.c
+++ b/lib/libc/posix1e/acl_delete_entry.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2001-2002 Chris D. Faulhaber
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include "namespace.h"
#include <sys/acl.h>
@@ -76,7 +73,6 @@ _entry_matches(const acl_entry_t a, const acl_entry_t b)
int
acl_delete_entry(acl_t acl, acl_entry_t entry_d)
{
- struct acl *acl_int;
struct acl_entry entry_int;
int i, j, found = 0;
@@ -85,8 +81,6 @@ acl_delete_entry(acl_t acl, acl_entry_t entry_d)
return (-1);
}
- acl_int = &acl->ats_acl;
-
if (_entry_brand(entry_d) != _acl_brand(acl)) {
errno = EINVAL;
return (-1);
diff --git a/lib/libc/posix1e/acl_delete_flag_np.3 b/lib/libc/posix1e/acl_delete_flag_np.3
index 36d8cdd2a4a2..012c742cbac5 100644
--- a/lib/libc/posix1e/acl_delete_flag_np.3
+++ b/lib/libc/posix1e/acl_delete_flag_np.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd October 30, 2014
.Dt ACL_DELETE_FLAG_NP 3
.Os
diff --git a/lib/libc/posix1e/acl_delete_perm.3 b/lib/libc/posix1e/acl_delete_perm.3
index 90f244e147c2..f2750acac43d 100644
--- a/lib/libc/posix1e/acl_delete_perm.3
+++ b/lib/libc/posix1e/acl_delete_perm.3
@@ -23,8 +23,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd March 10, 2001
.Dt ACL_DELETE_PERM 3
.Os
diff --git a/lib/libc/posix1e/acl_dup.3 b/lib/libc/posix1e/acl_dup.3
index ae4ff4f7b474..a85871571d28 100644
--- a/lib/libc/posix1e/acl_dup.3
+++ b/lib/libc/posix1e/acl_dup.3
@@ -25,8 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd January 28, 2000
.Dt ACL_DUP 3
.Os
diff --git a/lib/libc/posix1e/acl_entry.c b/lib/libc/posix1e/acl_entry.c
index 221aa7d24a3e..abba3a0586dc 100644
--- a/lib/libc/posix1e/acl_entry.c
+++ b/lib/libc/posix1e/acl_entry.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2001-2002 Chris D. Faulhaber
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include "namespace.h"
#include <sys/acl.h>
diff --git a/lib/libc/posix1e/acl_equiv_mode_np.c b/lib/libc/posix1e/acl_equiv_mode_np.c
index a6dfb03bfc46..333b010541ee 100644
--- a/lib/libc/posix1e/acl_equiv_mode_np.c
+++ b/lib/libc/posix1e/acl_equiv_mode_np.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2021 Gleb Popov
* All rights reserved.
@@ -29,9 +29,6 @@
* acl_equiv_mode_np: Check if an ACL can be represented as a mode_t.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/param.h>
#include <sys/errno.h>
@@ -52,7 +49,7 @@ acl_equiv_mode_np(acl_t acl, mode_t *mode_p)
/* Linux returns 0 for ACL returned by acl_init() */
if (_acl_brand(acl) == ACL_BRAND_UNKNOWN && acl->ats_acl.acl_cnt == 0)
- return (0);
+ goto done;
// TODO: Do we want to handle ACL_BRAND_NFS4 in this function? */
if (_acl_brand(acl) != ACL_BRAND_POSIX)
@@ -94,6 +91,7 @@ acl_equiv_mode_np(acl_t acl, mode_t *mode_p)
}
}
+done:
if (mode_p != NULL)
*mode_p = ret_mode;
diff --git a/lib/libc/posix1e/acl_extended_file_np.c b/lib/libc/posix1e/acl_extended_file_np.c
index c2980825b6b6..9c1452e96d93 100644
--- a/lib/libc/posix1e/acl_extended_file_np.c
+++ b/lib/libc/posix1e/acl_extended_file_np.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2021 Gleb Popov
* All rights reserved.
@@ -29,9 +29,6 @@
* acl_extended_file_np: Check if the file has extended ACLs set.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/errno.h>
#include <sys/acl.h>
diff --git a/lib/libc/posix1e/acl_flag.c b/lib/libc/posix1e/acl_flag.c
index 007d17e0aa65..eaaaecd9a374 100644
--- a/lib/libc/posix1e/acl_flag.c
+++ b/lib/libc/posix1e/acl_flag.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2008, 2009 Edward Tomasz Napierała <trasz@FreeBSD.org>
*
@@ -25,9 +25,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
#include <errno.h>
#include <sys/acl.h>
diff --git a/lib/libc/posix1e/acl_free.3 b/lib/libc/posix1e/acl_free.3
index d64c72a7c7e2..1a46f7f53ec7 100644
--- a/lib/libc/posix1e/acl_free.3
+++ b/lib/libc/posix1e/acl_free.3
@@ -25,8 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd January 28, 2000
.Dt ACL_FREE 3
.Os
diff --git a/lib/libc/posix1e/acl_free.c b/lib/libc/posix1e/acl_free.c
index 49d6b722d2a9..813ec6a35fb6 100644
--- a/lib/libc/posix1e/acl_free.c
+++ b/lib/libc/posix1e/acl_free.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1999, 2000, 2001 Robert N. M. Watson
* All rights reserved.
@@ -29,9 +29,6 @@
* acl_free -- free ACL objects from user memory
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include "namespace.h"
#include <sys/acl.h>
diff --git a/lib/libc/posix1e/acl_from_mode_np.c b/lib/libc/posix1e/acl_from_mode_np.c
index d78109469720..3d4135770917 100644
--- a/lib/libc/posix1e/acl_from_mode_np.c
+++ b/lib/libc/posix1e/acl_from_mode_np.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2021 Robert N M Watson, Gleb Popov
* All rights reserved.
@@ -29,9 +29,6 @@
* acl_from_mode_np: Create an ACL from a mode_t.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/param.h>
#include <sys/acl.h>
diff --git a/lib/libc/posix1e/acl_from_text.3 b/lib/libc/posix1e/acl_from_text.3
index 8b10784e502b..a7cc45e9e61d 100644
--- a/lib/libc/posix1e/acl_from_text.3
+++ b/lib/libc/posix1e/acl_from_text.3
@@ -25,8 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd January 28, 2000
.Dt ACL_FROM_TEXT 3
.Os
diff --git a/lib/libc/posix1e/acl_from_text.c b/lib/libc/posix1e/acl_from_text.c
index 7cd45a7d6d25..765b58290a04 100644
--- a/lib/libc/posix1e/acl_from_text.c
+++ b/lib/libc/posix1e/acl_from_text.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1999, 2000, 2001 Robert N. M. Watson
* All rights reserved.
@@ -29,9 +29,6 @@
* acl_from_text: Convert a text-form ACL from a string to an acl_t.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include "namespace.h"
#include <sys/acl.h>
diff --git a/lib/libc/posix1e/acl_from_text_nfs4.c b/lib/libc/posix1e/acl_from_text_nfs4.c
index bb170cec74cd..ed82c1093bc4 100644
--- a/lib/libc/posix1e/acl_from_text_nfs4.c
+++ b/lib/libc/posix1e/acl_from_text_nfs4.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2008, 2009 Edward Tomasz Napierała <trasz@FreeBSD.org>
*
@@ -25,9 +25,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
diff --git a/lib/libc/posix1e/acl_get.3 b/lib/libc/posix1e/acl_get.3
index ae0c48d93822..91a3626ada72 100644
--- a/lib/libc/posix1e/acl_get.3
+++ b/lib/libc/posix1e/acl_get.3
@@ -25,9 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd June 25, 2009
+.Dd September 21, 2023
.Dt ACL_GET 3
.Os
.Sh NAME
@@ -153,16 +151,8 @@ The file system does not support ACL retrieval.
.Xr posix1e 3
.Sh STANDARDS
POSIX.1e is described in IEEE POSIX.1e draft 17.
-Discussion
-of the draft continues on the cross-platform POSIX.1e implementation
-mailing list.
-To join this list, see the
-.Fx
-POSIX.1e implementation
-page for more information.
.Sh HISTORY
POSIX.1e support was introduced in
-.Fx 4.0 ,
-and development continues.
+.Fx 4.0 .
.Sh AUTHORS
.An Robert N M Watson
diff --git a/lib/libc/posix1e/acl_get.c b/lib/libc/posix1e/acl_get.c
index 6031199e58e7..a02c2d53085d 100644
--- a/lib/libc/posix1e/acl_get.c
+++ b/lib/libc/posix1e/acl_get.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1999, 2000, 2001, 2002 Robert N. M. Watson
* All rights reserved.
@@ -40,9 +40,6 @@
* acl_get_tag_type() returns the tag type for the ACL entry entry_d
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include "namespace.h"
#include <sys/acl.h>
diff --git a/lib/libc/posix1e/acl_get_brand_np.3 b/lib/libc/posix1e/acl_get_brand_np.3
index 8c3a2876f386..b56786275a2a 100644
--- a/lib/libc/posix1e/acl_get_brand_np.3
+++ b/lib/libc/posix1e/acl_get_brand_np.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd June 25, 2009
.Dt ACL_GET_BRAND_NP 3
.Os
diff --git a/lib/libc/posix1e/acl_get_entry.3 b/lib/libc/posix1e/acl_get_entry.3
index 88c72db2559a..94a95b5412b7 100644
--- a/lib/libc/posix1e/acl_get_entry.3
+++ b/lib/libc/posix1e/acl_get_entry.3
@@ -23,9 +23,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd April 13, 2001
+.Dd September 21, 2023
.Dt ACL_GET_ENTRY 3
.Os
.Sh NAME
@@ -44,7 +42,7 @@ The
function
is a POSIX.1e call that retrieves a descriptor for an ACL entry
specified by the argument
-.Fa entry_d
+.Fa entry_id
within the ACL indicated by the argument
.Fa acl .
.Pp
@@ -102,7 +100,7 @@ will be set to indicate the error.
.Sh ERRORS
The
.Fn acl_get_entry
-fails if:
+function fails if:
.Bl -tag -width Er
.It Bq Er EINVAL
Argument
diff --git a/lib/libc/posix1e/acl_get_entry_type_np.3 b/lib/libc/posix1e/acl_get_entry_type_np.3
index 2d089abf5c99..1616f776bb79 100644
--- a/lib/libc/posix1e/acl_get_entry_type_np.3
+++ b/lib/libc/posix1e/acl_get_entry_type_np.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd June 25, 2009
.Dt ACL_GET_ENTRY_TYPE_NP 3
.Os
diff --git a/lib/libc/posix1e/acl_get_flag_np.3 b/lib/libc/posix1e/acl_get_flag_np.3
index 65bb49aa0eae..1d3711de5fac 100644
--- a/lib/libc/posix1e/acl_get_flag_np.3
+++ b/lib/libc/posix1e/acl_get_flag_np.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd October 30, 2014
.Dt ACL_GET_FLAG_NP 3
.Os
diff --git a/lib/libc/posix1e/acl_get_flagset_np.3 b/lib/libc/posix1e/acl_get_flagset_np.3
index 73865acd8859..ee5a3f78f1e8 100644
--- a/lib/libc/posix1e/acl_get_flagset_np.3
+++ b/lib/libc/posix1e/acl_get_flagset_np.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd October 30, 2014
.Dt ACL_GET_FLAGSET_NP 3
.Os
diff --git a/lib/libc/posix1e/acl_get_perm_np.3 b/lib/libc/posix1e/acl_get_perm_np.3
index 0f4126ecbe64..c8bdfa1eecc6 100644
--- a/lib/libc/posix1e/acl_get_perm_np.3
+++ b/lib/libc/posix1e/acl_get_perm_np.3
@@ -23,8 +23,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd April 10, 2001
.Dt ACL_GET_PERM_NP 3
.Os
diff --git a/lib/libc/posix1e/acl_get_permset.3 b/lib/libc/posix1e/acl_get_permset.3
index 064f71ce45bc..235316aa1c76 100644
--- a/lib/libc/posix1e/acl_get_permset.3
+++ b/lib/libc/posix1e/acl_get_permset.3
@@ -23,9 +23,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd March 10, 2001
+.Dd May 8, 2023
.Dt ACL_GET_PERMSET 3
.Os
.Sh NAME
@@ -65,6 +63,7 @@ is not a valid descriptor for an ACL entry.
.Xr acl_add_perm 3 ,
.Xr acl_clear_perms 3 ,
.Xr acl_delete_perm 3 ,
+.Xr acl_get_perm_np 3 ,
.Xr acl_set_permset 3 ,
.Xr posix1e 3
.Sh STANDARDS
diff --git a/lib/libc/posix1e/acl_get_qualifier.3 b/lib/libc/posix1e/acl_get_qualifier.3
index fcafd2cc3bbb..b6b7dc0f6714 100644
--- a/lib/libc/posix1e/acl_get_qualifier.3
+++ b/lib/libc/posix1e/acl_get_qualifier.3
@@ -23,8 +23,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd March 13, 2001
.Dt ACL_GET_QUALIFIER 3
.Os
diff --git a/lib/libc/posix1e/acl_get_tag_type.3 b/lib/libc/posix1e/acl_get_tag_type.3
index 64c57efed732..95877e87d2dc 100644
--- a/lib/libc/posix1e/acl_get_tag_type.3
+++ b/lib/libc/posix1e/acl_get_tag_type.3
@@ -23,8 +23,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd March 10, 2001
.Dt ACL_GET_TAG_TYPE 3
.Os
diff --git a/lib/libc/posix1e/acl_id_to_name.c b/lib/libc/posix1e/acl_id_to_name.c
index c9a259716f07..78e050a8648a 100644
--- a/lib/libc/posix1e/acl_id_to_name.c
+++ b/lib/libc/posix1e/acl_id_to_name.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1999-2001, 2008 Robert N. M. Watson
* All rights reserved.
@@ -30,9 +30,6 @@
* These calls are intended only to be called within the library.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include "namespace.h"
#include <sys/acl.h>
diff --git a/lib/libc/posix1e/acl_init.3 b/lib/libc/posix1e/acl_init.3
index dba89231c44a..29281a1bc3e2 100644
--- a/lib/libc/posix1e/acl_init.3
+++ b/lib/libc/posix1e/acl_init.3
@@ -25,8 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd January 28, 2000
.Dt ACL_INIT 3
.Os
diff --git a/lib/libc/posix1e/acl_init.c b/lib/libc/posix1e/acl_init.c
index f26ef7e705b7..587817388081 100644
--- a/lib/libc/posix1e/acl_init.c
+++ b/lib/libc/posix1e/acl_init.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1999, 2000, 2001 Robert N. M. Watson
* All rights reserved.
@@ -30,9 +30,6 @@
* acl_dup -- duplicate an acl and return the new copy
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include "namespace.h"
#include <sys/acl.h>
diff --git a/lib/libc/posix1e/acl_is_trivial_np.3 b/lib/libc/posix1e/acl_is_trivial_np.3
index bd00d88191b4..0f3ac2350d78 100644
--- a/lib/libc/posix1e/acl_is_trivial_np.3
+++ b/lib/libc/posix1e/acl_is_trivial_np.3
@@ -24,10 +24,8 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd November 12, 2013
-.Dt ACL_STRIP_NP 3
+.Dd June 19, 2023
+.Dt ACL_IS_TRIVIAL_NP 3
.Os
.Sh NAME
.Nm acl_is_trivial_np
@@ -41,7 +39,7 @@
.Fn acl_is_trivial_np "const acl_t aclp" "int *trivialp"
.Sh DESCRIPTION
The
-.Fn acl_is_trivial
+.Fn acl_is_trivial_np
function determines whether the ACL pointed to by the argument
.Va acl
is trivial.
@@ -56,13 +54,14 @@ any access rules.
For POSIX.1e ACLs, ACL is trivial if it has the three required entries,
one for owner, one for owning group, and one for other.
For NFSv4 ACLs, ACL is trivial if it is identical to the ACL generated by
-.Fn acl_strip_np 3 .
+.Xr acl_strip_np 3 .
Files that have non-trivial ACL have a plus sign appended after mode bits
in "ls -l" output.
.Sh RETURN VALUES
-.Rv -std acl_get_tag_type
+.Rv -std acl_is_trivial_np
.Sh SEE ALSO
.Xr acl 3 ,
+.Xr acl_strip_np 3 ,
.Xr posix1e 3
.Sh STANDARDS
POSIX.1e is described in IEEE POSIX.1e draft 17.
diff --git a/lib/libc/posix1e/acl_perm.c b/lib/libc/posix1e/acl_perm.c
index 0fe28a49e30a..9ad103398646 100644
--- a/lib/libc/posix1e/acl_perm.c
+++ b/lib/libc/posix1e/acl_perm.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2001-2002 Chris D. Faulhaber
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include "namespace.h"
#include <sys/acl.h>
diff --git a/lib/libc/posix1e/acl_set.3 b/lib/libc/posix1e/acl_set.3
index 7450dc93eb9e..ed60eb8e2566 100644
--- a/lib/libc/posix1e/acl_set.3
+++ b/lib/libc/posix1e/acl_set.3
@@ -25,8 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd June 25, 2009
.Dt ACL_SET 3
.Os
diff --git a/lib/libc/posix1e/acl_set.c b/lib/libc/posix1e/acl_set.c
index d064d642838d..359dda2c1619 100644
--- a/lib/libc/posix1e/acl_set.c
+++ b/lib/libc/posix1e/acl_set.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1999, 2000, 2001, 2002 Robert N. M. Watson
* All rights reserved.
@@ -31,9 +31,6 @@
* acl_set_file -- set a file/directory ACL by name
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include "namespace.h"
#include <sys/acl.h>
diff --git a/lib/libc/posix1e/acl_set_entry_type_np.3 b/lib/libc/posix1e/acl_set_entry_type_np.3
index 8a5c4cacdec8..b9f2ea69d3dc 100644
--- a/lib/libc/posix1e/acl_set_entry_type_np.3
+++ b/lib/libc/posix1e/acl_set_entry_type_np.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd October 30, 2014
.Dt ACL_SET_ENTRY_TYPE_NP 3
.Os
diff --git a/lib/libc/posix1e/acl_set_flagset_np.3 b/lib/libc/posix1e/acl_set_flagset_np.3
index 8feeaa1e6f2b..cb0693862f32 100644
--- a/lib/libc/posix1e/acl_set_flagset_np.3
+++ b/lib/libc/posix1e/acl_set_flagset_np.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd October 30, 2014
.Dt ACL_SET_FLAGSET_NP 3
.Os
diff --git a/lib/libc/posix1e/acl_set_permset.3 b/lib/libc/posix1e/acl_set_permset.3
index 259aef6b8458..0c186cd205d7 100644
--- a/lib/libc/posix1e/acl_set_permset.3
+++ b/lib/libc/posix1e/acl_set_permset.3
@@ -23,8 +23,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd March 10, 2001
.Dt ACL_SET_PERMSET 3
.Os
diff --git a/lib/libc/posix1e/acl_set_qualifier.3 b/lib/libc/posix1e/acl_set_qualifier.3
index 26542ce28388..8f4532108ee6 100644
--- a/lib/libc/posix1e/acl_set_qualifier.3
+++ b/lib/libc/posix1e/acl_set_qualifier.3
@@ -23,8 +23,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd March 10, 2001
.Dt ACL_SET_QUALIFIER 3
.Os
diff --git a/lib/libc/posix1e/acl_set_tag_type.3 b/lib/libc/posix1e/acl_set_tag_type.3
index 42834c2657d0..fcb8884d8f1f 100644
--- a/lib/libc/posix1e/acl_set_tag_type.3
+++ b/lib/libc/posix1e/acl_set_tag_type.3
@@ -23,8 +23,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd June 25, 2009
.Dt ACL_SET_TAG_TYPE 3
.Os
diff --git a/lib/libc/posix1e/acl_strip.c b/lib/libc/posix1e/acl_strip.c
index e337530d8b22..9af1ad680036 100644
--- a/lib/libc/posix1e/acl_strip.c
+++ b/lib/libc/posix1e/acl_strip.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2001 Chris D. Faulhaber
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <stdio.h>
#include <assert.h>
diff --git a/lib/libc/posix1e/acl_strip_np.3 b/lib/libc/posix1e/acl_strip_np.3
index bbf7a974defd..792b2e26b4d1 100644
--- a/lib/libc/posix1e/acl_strip_np.3
+++ b/lib/libc/posix1e/acl_strip_np.3
@@ -24,8 +24,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd June 25, 2009
.Dt ACL_STRIP_NP 3
.Os
diff --git a/lib/libc/posix1e/acl_support.c b/lib/libc/posix1e/acl_support.c
index 342d2853ddda..82abeb0273f9 100644
--- a/lib/libc/posix1e/acl_support.c
+++ b/lib/libc/posix1e/acl_support.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1999-2001, 2008 Robert N. M. Watson
* All rights reserved.
@@ -30,9 +30,6 @@
* These calls are intended only to be called within the library.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include "namespace.h"
#include <sys/acl.h>
diff --git a/lib/libc/posix1e/acl_support.h b/lib/libc/posix1e/acl_support.h
index 87692153c4ee..d136bdcf2d00 100644
--- a/lib/libc/posix1e/acl_support.h
+++ b/lib/libc/posix1e/acl_support.h
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1999, 2000, 2001 Robert N. M. Watson
* 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$
*/
/*
* Support functionality for the POSIX.1e ACL interface
diff --git a/lib/libc/posix1e/acl_support_nfs4.c b/lib/libc/posix1e/acl_support_nfs4.c
index 92ec666b2313..08647651933b 100644
--- a/lib/libc/posix1e/acl_support_nfs4.c
+++ b/lib/libc/posix1e/acl_support_nfs4.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2008, 2009 Edward Tomasz Napierała <trasz@FreeBSD.org>
*
@@ -25,9 +25,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/lib/libc/posix1e/acl_to_text.3 b/lib/libc/posix1e/acl_to_text.3
index d6dcae0232e2..865ee4b5ac60 100644
--- a/lib/libc/posix1e/acl_to_text.3
+++ b/lib/libc/posix1e/acl_to_text.3
@@ -25,8 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd June 25, 2009
.Dt ACL_TO_TEXT 3
.Os
diff --git a/lib/libc/posix1e/acl_to_text.c b/lib/libc/posix1e/acl_to_text.c
index 009ceaceabf6..c17253e2cec2 100644
--- a/lib/libc/posix1e/acl_to_text.c
+++ b/lib/libc/posix1e/acl_to_text.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1999-2002 Robert N. M. Watson
* All rights reserved.
@@ -30,11 +30,8 @@
* in it.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
#include "namespace.h"
+#include <sys/param.h>
#include <sys/acl.h>
#include "un-namespace.h"
#include <sys/errno.h>
diff --git a/lib/libc/posix1e/acl_to_text_nfs4.c b/lib/libc/posix1e/acl_to_text_nfs4.c
index 98f5124638d8..157215c9dd52 100644
--- a/lib/libc/posix1e/acl_to_text_nfs4.c
+++ b/lib/libc/posix1e/acl_to_text_nfs4.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2008, 2009 Edward Tomasz Napierała <trasz@FreeBSD.org>
*
@@ -25,9 +25,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -75,6 +72,7 @@ format_who(char *str, size_t size, const acl_entry_t entry, int numeric)
snprintf(str, size, "user:%d", (unsigned int)*id);
else
snprintf(str, size, "user:%s", pwd->pw_name);
+ acl_free(id);
break;
case ACL_GROUP_OBJ:
@@ -94,6 +92,7 @@ format_who(char *str, size_t size, const acl_entry_t entry, int numeric)
snprintf(str, size, "group:%d", (unsigned int)*id);
else
snprintf(str, size, "group:%s", grp->gr_name);
+ acl_free(id);
break;
case ACL_EVERYONE:
@@ -160,6 +159,7 @@ format_additional_id(char *str, size_t size, const acl_entry_t entry)
if (id == NULL)
return (-1);
snprintf(str, size, ":%d", (unsigned int)*id);
+ acl_free(id);
}
return (0);
diff --git a/lib/libc/posix1e/acl_valid.3 b/lib/libc/posix1e/acl_valid.3
index 83f7746774a9..495feb971eb5 100644
--- a/lib/libc/posix1e/acl_valid.3
+++ b/lib/libc/posix1e/acl_valid.3
@@ -25,8 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd December 29, 2002
.Dt ACL_VALID 3
.Os
diff --git a/lib/libc/posix1e/acl_valid.c b/lib/libc/posix1e/acl_valid.c
index 2be16dc5cc0d..c804b0840307 100644
--- a/lib/libc/posix1e/acl_valid.c
+++ b/lib/libc/posix1e/acl_valid.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1999, 2000, 2001, 2002 Robert N. M. Watson
* All rights reserved.
@@ -31,9 +31,6 @@
* acl_valid -- POSIX.1e ACL check routine
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include "namespace.h"
#include <sys/acl.h>
diff --git a/lib/libc/posix1e/extattr.3 b/lib/libc/posix1e/extattr.3
index 5e606861c622..b6391b8fc357 100644
--- a/lib/libc/posix1e/extattr.3
+++ b/lib/libc/posix1e/extattr.3
@@ -23,8 +23,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd June 24, 2001
.Dt EXTATTR 3
.Os
diff --git a/lib/libc/posix1e/extattr.c b/lib/libc/posix1e/extattr.c
index a1be7fcc1b8f..6938c302b8a4 100644
--- a/lib/libc/posix1e/extattr.c
+++ b/lib/libc/posix1e/extattr.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2001 Robert N. M. Watson
* All rights reserved.
@@ -29,9 +29,6 @@
* TrustedBSD: Utility functions for extended attributes.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/extattr.h>
diff --git a/lib/libc/posix1e/mac.3 b/lib/libc/posix1e/mac.3
index 5d2d5c4f49df..d08571966516 100644
--- a/lib/libc/posix1e/mac.3
+++ b/lib/libc/posix1e/mac.3
@@ -29,8 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd July 25, 2015
.Dt MAC 3
.Os
diff --git a/lib/libc/posix1e/mac.c b/lib/libc/posix1e/mac.c
index a8e0abe7afff..8f3a63e40ac5 100644
--- a/lib/libc/posix1e/mac.c
+++ b/lib/libc/posix1e/mac.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1999, 2000, 2001, 2002 Robert N. M. Watson
* Copyright (c) 2002, 2003 Networks Associates Technology, Inc.
@@ -34,9 +34,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/queue.h>
#include <sys/sysctl.h>
@@ -177,9 +174,8 @@ mac_init_internal(int ignore_errors)
LIST_INIT(&label_default_head);
- if (!issetugid() && getenv("MAC_CONFFILE") != NULL)
- filename = getenv("MAC_CONFFILE");
- else
+ filename = secure_getenv("MAC_CONFFILE");
+ if (filename == NULL)
filename = MAC_CONFFILE;
file = fopen(filename, "re");
if (file == NULL)
diff --git a/lib/libc/posix1e/mac.conf b/lib/libc/posix1e/mac.conf
index 36f3a6a57b1f..011143abf073 100644
--- a/lib/libc/posix1e/mac.conf
+++ b/lib/libc/posix1e/mac.conf
@@ -1,5 +1,4 @@
#
-# $FreeBSD$
#
# TrustedBSD MAC userland policy configuration file. Kernel modules
# export label information, and mac.conf indicates to userland
diff --git a/lib/libc/posix1e/mac.conf.5 b/lib/libc/posix1e/mac.conf.5
index 3946be18db16..98aa62dd83a7 100644
--- a/lib/libc/posix1e/mac.conf.5
+++ b/lib/libc/posix1e/mac.conf.5
@@ -27,8 +27,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd July 25, 2015
.Dt MAC.CONF 5
.Os
diff --git a/lib/libc/posix1e/mac_exec.c b/lib/libc/posix1e/mac_exec.c
index 72148eedea4c..3016f21edd0d 100644
--- a/lib/libc/posix1e/mac_exec.c
+++ b/lib/libc/posix1e/mac_exec.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002 Networks Associates Technology, Inc.
* All rights reserved.
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/mac.h>
diff --git a/lib/libc/posix1e/mac_free.3 b/lib/libc/posix1e/mac_free.3
index 78118a1efa5e..4ed68b70f3a3 100644
--- a/lib/libc/posix1e/mac_free.3
+++ b/lib/libc/posix1e/mac_free.3
@@ -31,9 +31,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd December 21, 2001
+.Dd September 21, 2023
.Dt MAC_FREE 3
.Os
.Sh NAME
@@ -69,12 +67,6 @@ function.
.Xr mac 9
.Sh STANDARDS
POSIX.1e is described in IEEE POSIX.1e draft 17.
-Discussion of the draft
-continues on the cross-platform POSIX.1e implementation mailing list.
-To join this list, see the
-.Fx
-POSIX.1e implementation page
-for more information.
.Sh HISTORY
Support for Mandatory Access Control was introduced in
.Fx 5.0
diff --git a/lib/libc/posix1e/mac_get.3 b/lib/libc/posix1e/mac_get.3
index 35fa72b08241..171f7cd91aaf 100644
--- a/lib/libc/posix1e/mac_get.3
+++ b/lib/libc/posix1e/mac_get.3
@@ -28,9 +28,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd December 21, 2001
+.Dd September 21, 2023
.Dt MAC_GET 3
.Os
.Sh NAME
@@ -138,12 +136,6 @@ is not a directory.
.Xr mac 9
.Sh STANDARDS
POSIX.1e is described in IEEE POSIX.1e draft 17.
-Discussion of the draft
-continues on the cross-platform POSIX.1e implementation mailing list.
-To join this list, see the
-.Fx
-POSIX.1e implementation page
-for more information.
.Sh HISTORY
Support for Mandatory Access Control was introduced in
.Fx 5.0
diff --git a/lib/libc/posix1e/mac_get.c b/lib/libc/posix1e/mac_get.c
index d391ba5561d7..5bfc0a549754 100644
--- a/lib/libc/posix1e/mac_get.c
+++ b/lib/libc/posix1e/mac_get.c
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/mac.h>
#include <sys/socket.h>
diff --git a/lib/libc/posix1e/mac_is_present.3 b/lib/libc/posix1e/mac_is_present.3
index 96d8cbfd9b76..0abd3e63ffa3 100644
--- a/lib/libc/posix1e/mac_is_present.3
+++ b/lib/libc/posix1e/mac_is_present.3
@@ -28,8 +28,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd July 7, 2006
.Dt MAC_IS_PRESENT 3
.Os
diff --git a/lib/libc/posix1e/mac_prepare.3 b/lib/libc/posix1e/mac_prepare.3
index e217b7132ef9..50dfa1c28d2d 100644
--- a/lib/libc/posix1e/mac_prepare.3
+++ b/lib/libc/posix1e/mac_prepare.3
@@ -28,9 +28,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd August 22, 2003
+.Dd September 21, 2023
.Dt MAC_PREPARE 3
.Os
.Sh NAME
@@ -110,12 +108,6 @@ respectively.
.Xr maclabel 7
.Sh STANDARDS
POSIX.1e is described in IEEE POSIX.1e draft 17.
-Discussion of the draft
-continues on the cross-platform POSIX.1e implementation mailing list.
-To join this list, see the
-.Fx
-POSIX.1e implementation page
-for more information.
.Sh HISTORY
Support for Mandatory Access Control was introduced in
.Fx 5.0
diff --git a/lib/libc/posix1e/mac_set.3 b/lib/libc/posix1e/mac_set.3
index 0b245a000277..1d61705c8353 100644
--- a/lib/libc/posix1e/mac_set.3
+++ b/lib/libc/posix1e/mac_set.3
@@ -28,8 +28,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd January 14, 2003
.Dt MAC_SET 3
.Os
diff --git a/lib/libc/posix1e/mac_set.c b/lib/libc/posix1e/mac_set.c
index fee9208b915c..8197d4354910 100644
--- a/lib/libc/posix1e/mac_set.c
+++ b/lib/libc/posix1e/mac_set.c
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/mac.h>
diff --git a/lib/libc/posix1e/mac_text.3 b/lib/libc/posix1e/mac_text.3
index dde6ccf5e23c..29c1aacca485 100644
--- a/lib/libc/posix1e/mac_text.3
+++ b/lib/libc/posix1e/mac_text.3
@@ -28,9 +28,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd December 21, 2001
+.Dd September 21, 2023
.Dt MAC_TEXT 3
.Os
.Sh NAME
@@ -103,12 +101,6 @@ to allocate internal storage.
.Xr maclabel 7
.Sh STANDARDS
POSIX.1e is described in IEEE POSIX.1e draft 17.
-Discussion of the draft
-continues on the cross-platform POSIX.1e implementation mailing list.
-To join this list, see the
-.Fx
-POSIX.1e implementation page
-for more information.
.Sh HISTORY
Support for Mandatory Access Control was introduced in
.Fx 5.0
diff --git a/lib/libc/posix1e/posix1e.3 b/lib/libc/posix1e/posix1e.3
index 6cdbc87bc6c1..8eef3bb21724 100644
--- a/lib/libc/posix1e/posix1e.3
+++ b/lib/libc/posix1e/posix1e.3
@@ -23,8 +23,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd February 25, 2016
.Dt POSIX1E 3
.Os
diff --git a/lib/libc/powerpc/Makefile.inc b/lib/libc/powerpc/Makefile.inc
index 4047edd70c37..80ac23a9947c 100644
--- a/lib/libc/powerpc/Makefile.inc
+++ b/lib/libc/powerpc/Makefile.inc
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Long double is 64-bits
SRCS+=machdep_ldisd.c
diff --git a/lib/libc/powerpc/SYS.h b/lib/libc/powerpc/SYS.h
deleted file mode 100644
index 8d019144cdd6..000000000000
--- a/lib/libc/powerpc/SYS.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-3-Clause
- *
- * Copyright (c) 2002 Benno Rice. All rights reserved.
- * Copyright (c) 2002 David E. O'Brien. All rights reserved.
- *
- * 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.
- * 3. Neither the name of the author nor the names of any contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 REGENTS 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.
- *
- * $NetBSD: SYS.h,v 1.8 2002/01/14 00:55:56 thorpej Exp $
- * $FreeBSD$
- */
-
-#include <sys/syscall.h>
-#include <machine/asm.h>
-
-#define _SYSCALL(name) \
- .text; \
- .align 2; \
- li 0,(SYS_##name); \
- sc
-
-#define SYSCALL(name) \
- .text; \
- .align 2; \
-2: b CNAME(HIDENAME(cerror)); \
-ENTRY(__sys_##name); \
- WEAK_REFERENCE(__sys_##name, name); \
- WEAK_REFERENCE(__sys_##name, _##name); \
- _SYSCALL(name); \
- bso 2b
-
-#define PSEUDO(name) \
- .text; \
- .align 2; \
-ENTRY(__sys_##name); \
- WEAK_REFERENCE(__sys_##name, _##name); \
- _SYSCALL(name); \
- bnslr; \
- b CNAME(HIDENAME(cerror)); \
-END(__sys_##name)
-
-#define RSYSCALL(name) \
- .text; \
- .align 2; \
-ENTRY(__sys_##name); \
- WEAK_REFERENCE(__sys_##name, name); \
- WEAK_REFERENCE(__sys_##name, _##name); \
- _SYSCALL(name); \
- bnslr; \
- b CNAME(HIDENAME(cerror)); \
-END(__sys_##name)
diff --git a/lib/libc/powerpc/Symbol.map b/lib/libc/powerpc/Symbol.map
index be6daf5d908e..ccf74c1748e4 100644
--- a/lib/libc/powerpc/Symbol.map
+++ b/lib/libc/powerpc/Symbol.map
@@ -1,40 +1,18 @@
/*
- * $FreeBSD$
- */
-
-/*
* This only needs to contain symbols that are not listed in
* symbol maps from other parts of libc (i.e., not found in
* stdlib/Symbol.map, string/Symbol.map, sys/Symbol.map, ...).
*/
FBSD_1.0 {
- /* PSEUDO syscalls */
- _exit;
-
_mcount;
- _setjmp;
- _longjmp;
- fabs;
__flt_rounds;
+ brk;
fpgetmask;
fpgetround;
fpgetsticky;
fpsetmask;
fpsetround;
- __infinity;
- __nan;
- makecontext;
- setjmp;
- longjmp;
- sigsetjmp;
- siglongjmp;
- htonl;
- htons;
- ntohl;
- ntohs;
- brk;
sbrk;
- vfork;
};
FBSD_1.3 {
@@ -42,12 +20,6 @@ FBSD_1.3 {
};
FBSDprivate_1.0 {
- /* PSEUDO syscalls */
- _getlogin;
-
- _set_tp;
- _fpgetsticky;
- __makecontext;
__longjmp;
signalcontext;
__signalcontext;
diff --git a/lib/libc/powerpc/_fpmath.h b/lib/libc/powerpc/_fpmath.h
index 76eaa1eff089..9bc7450aacaf 100644
--- a/lib/libc/powerpc/_fpmath.h
+++ b/lib/libc/powerpc/_fpmath.h
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2003 David Schultz <das@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$
*/
union IEEEl2bits {
diff --git a/lib/libc/powerpc/arith.h b/lib/libc/powerpc/arith.h
index 8e2c9ec597b3..78138f328f08 100644
--- a/lib/libc/powerpc/arith.h
+++ b/lib/libc/powerpc/arith.h
@@ -1,7 +1,5 @@
/*
* MD header for contrib/gdtoa
- *
- * $FreeBSD$
*/
/*
diff --git a/lib/libc/powerpc/gd_qnan.h b/lib/libc/powerpc/gd_qnan.h
index d70d8c318c4c..83496e8fbae7 100644
--- a/lib/libc/powerpc/gd_qnan.h
+++ b/lib/libc/powerpc/gd_qnan.h
@@ -3,8 +3,6 @@
*
* This file can be generated by compiling and running contrib/gdtoa/qnan.c
* on the target architecture after arith.h has been generated.
- *
- * $FreeBSD$
*/
#define f_QNAN 0x7fc00000
diff --git a/lib/libc/powerpc/gen/Makefile.common b/lib/libc/powerpc/gen/Makefile.common
index b2f898c9faae..d0d78197ca63 100644
--- a/lib/libc/powerpc/gen/Makefile.common
+++ b/lib/libc/powerpc/gen/Makefile.common
@@ -1,8 +1,5 @@
-# $FreeBSD$
.PATH: ${LIBC_SRCTOP}/powerpc/gen
SRCS += _ctx_start.S eabi.S infinity.c ldexp.c makecontext.c \
- signalcontext.c syncicache.c _get_tp.c _set_tp.c trivial-getcontextx.c
-
-CFLAGS._get_tp.c+= ${RTLD_HDRS}
+ signalcontext.c syncicache.c trivial-getcontextx.c
diff --git a/lib/libc/powerpc/gen/Makefile.inc b/lib/libc/powerpc/gen/Makefile.inc
index f96ad9fb0a6f..efdc778e8999 100644
--- a/lib/libc/powerpc/gen/Makefile.inc
+++ b/lib/libc/powerpc/gen/Makefile.inc
@@ -1,4 +1,3 @@
-# $FreeBSD$
.include "${LIBC_SRCTOP}/powerpc/gen/Makefile.common"
diff --git a/lib/libc/powerpc/gen/_ctx_start.S b/lib/libc/powerpc/gen/_ctx_start.S
index d6445941168d..e82bd1dcdb8d 100644
--- a/lib/libc/powerpc/gen/_ctx_start.S
+++ b/lib/libc/powerpc/gen/_ctx_start.S
@@ -25,9 +25,6 @@
*/
#include <machine/asm.h>
-
- __FBSDID("$FreeBSD$");
-
.globl CNAME(_ctx_done)
.globl CNAME(abort)
diff --git a/lib/libc/powerpc/gen/_get_tp.c b/lib/libc/powerpc/gen/_get_tp.c
deleted file mode 100644
index 0d08b707ff1a..000000000000
--- a/lib/libc/powerpc/gen/_get_tp.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 2021 The FreeBSD Foundation
- *
- * This software were developed by Konstantin Belousov
- * under sponsorship from the FreeBSD Foundation.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <string.h>
-#include <stdint.h>
-#include "libc_private.h"
-#include "rtld.h"
-
-void *
-_get_tp(void)
-{
- Elf_Addr tp;
-
- __asm __volatile("mr %0,2" : "=r" (tp));
- return ((void *)(tp - TLS_TP_OFFSET - TLS_TCB_SIZE));
-}
diff --git a/lib/libc/powerpc/gen/_setjmp.S b/lib/libc/powerpc/gen/_setjmp.S
index 663a8b6ed32a..8bbe259cf33b 100644
--- a/lib/libc/powerpc/gen/_setjmp.S
+++ b/lib/libc/powerpc/gen/_setjmp.S
@@ -26,8 +26,6 @@
/* $NetBSD: _setjmp.S,v 1.1 1997/03/29 20:55:53 thorpej Exp $ */
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* C library -- _setjmp, _longjmp
*
diff --git a/lib/libc/powerpc/gen/eabi.S b/lib/libc/powerpc/gen/eabi.S
index 3296af88a4d1..49ea63c82637 100644
--- a/lib/libc/powerpc/gen/eabi.S
+++ b/lib/libc/powerpc/gen/eabi.S
@@ -25,8 +25,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
ENTRY(__eabi)
blr
END(__eabi)
diff --git a/lib/libc/powerpc/gen/fabs.S b/lib/libc/powerpc/gen/fabs.S
index ac083ae636ac..d9dbf9d86fe0 100644
--- a/lib/libc/powerpc/gen/fabs.S
+++ b/lib/libc/powerpc/gen/fabs.S
@@ -25,8 +25,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* double fabs(double)
*/
diff --git a/lib/libc/powerpc/gen/flt_rounds.c b/lib/libc/powerpc/gen/flt_rounds.c
index c6b6178bc07d..77e04694dc69 100644
--- a/lib/libc/powerpc/gen/flt_rounds.c
+++ b/lib/libc/powerpc/gen/flt_rounds.c
@@ -33,9 +33,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <machine/float.h>
diff --git a/lib/libc/powerpc/gen/fpgetmask.c b/lib/libc/powerpc/gen/fpgetmask.c
index b8c813e8bb84..6817a32bdc65 100644
--- a/lib/libc/powerpc/gen/fpgetmask.c
+++ b/lib/libc/powerpc/gen/fpgetmask.c
@@ -1,7 +1,7 @@
/* $NetBSD: fpgetmask.c,v 1.3 2002/01/13 21:45:47 thorpej Exp $ */
/*-
- * SPDX-License-Identifier: BSD-2-Clause-NetBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -32,9 +32,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <ieeefp.h>
diff --git a/lib/libc/powerpc/gen/fpgetround.c b/lib/libc/powerpc/gen/fpgetround.c
index 062a565cc570..b135807b613f 100644
--- a/lib/libc/powerpc/gen/fpgetround.c
+++ b/lib/libc/powerpc/gen/fpgetround.c
@@ -1,7 +1,7 @@
/* $NetBSD: fpgetround.c,v 1.3 2002/01/13 21:45:47 thorpej Exp $ */
/*-
- * SPDX-License-Identifier: BSD-2-Clause-NetBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -32,9 +32,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <ieeefp.h>
diff --git a/lib/libc/powerpc/gen/fpgetsticky.c b/lib/libc/powerpc/gen/fpgetsticky.c
index e556123251ec..3512c97f8cf9 100644
--- a/lib/libc/powerpc/gen/fpgetsticky.c
+++ b/lib/libc/powerpc/gen/fpgetsticky.c
@@ -1,7 +1,7 @@
/* $NetBSD: fpgetsticky.c,v 1.3 2002/01/13 21:45:48 thorpej Exp $ */
/*-
- * SPDX-License-Identifier: BSD-2-Clause-NetBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -29,11 +29,8 @@
* 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/cdefs.h>
#include "namespace.h"
@@ -41,10 +38,6 @@
#include <ieeefp.h>
#ifndef _SOFT_FLOAT
-#ifdef __weak_alias
-__weak_alias(fpgetsticky,_fpgetsticky)
-#endif
-
fp_except_t
fpgetsticky()
{
diff --git a/lib/libc/powerpc/gen/fpsetmask.c b/lib/libc/powerpc/gen/fpsetmask.c
index f5d52eec5482..4170b385e9e4 100644
--- a/lib/libc/powerpc/gen/fpsetmask.c
+++ b/lib/libc/powerpc/gen/fpsetmask.c
@@ -1,7 +1,7 @@
/* $NetBSD: fpsetmask.c,v 1.3 2002/01/13 21:45:48 thorpej Exp $ */
/*-
- * SPDX-License-Identifier: BSD-2-Clause-NetBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -32,9 +32,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <ieeefp.h>
diff --git a/lib/libc/powerpc/gen/fpsetround.c b/lib/libc/powerpc/gen/fpsetround.c
index d1cc134760a5..2a70fd781474 100644
--- a/lib/libc/powerpc/gen/fpsetround.c
+++ b/lib/libc/powerpc/gen/fpsetround.c
@@ -1,7 +1,7 @@
/* $NetBSD: fpsetround.c,v 1.3 2002/01/13 21:45:48 thorpej Exp $ */
/*-
- * SPDX-License-Identifier: BSD-2-Clause-NetBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -32,9 +32,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <ieeefp.h>
diff --git a/lib/libc/powerpc/gen/infinity.c b/lib/libc/powerpc/gen/infinity.c
index f5324389d5b6..6e11371e6eb3 100644
--- a/lib/libc/powerpc/gen/infinity.c
+++ b/lib/libc/powerpc/gen/infinity.c
@@ -4,8 +4,6 @@
__RCSID("$NetBSD: infinity.c,v 1.2 1998/11/14 19:31:02 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
-__FBSDID("$FreeBSD$");
-
/* infinity.c */
#include <math.h>
diff --git a/lib/libc/powerpc/gen/makecontext.c b/lib/libc/powerpc/gen/makecontext.c
index c6625b4c1c90..5fbb0a96f05c 100644
--- a/lib/libc/powerpc/gen/makecontext.c
+++ b/lib/libc/powerpc/gen/makecontext.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2004 Suleiman Souhlal
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <stdarg.h>
diff --git a/lib/libc/powerpc/gen/setjmp.S b/lib/libc/powerpc/gen/setjmp.S
index ef7cb7e7be6e..0db3c4de6641 100644
--- a/lib/libc/powerpc/gen/setjmp.S
+++ b/lib/libc/powerpc/gen/setjmp.S
@@ -26,8 +26,6 @@
/* $NetBSD: setjmp.S,v 1.3 1998/10/03 12:30:38 tsubai Exp $ */
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/syscall.h>
/*
diff --git a/lib/libc/powerpc/gen/signalcontext.c b/lib/libc/powerpc/gen/signalcontext.c
index 88975593db6c..8cc9c1c94918 100644
--- a/lib/libc/powerpc/gen/signalcontext.c
+++ b/lib/libc/powerpc/gen/signalcontext.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2004 Marcel Moolenaar, Peter Grehan
* All rights reserved.
@@ -26,9 +26,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/ucontext.h>
#include <signal.h>
diff --git a/lib/libc/powerpc/gen/sigsetjmp.S b/lib/libc/powerpc/gen/sigsetjmp.S
index 9c75f4f86dd7..b86387204fb9 100644
--- a/lib/libc/powerpc/gen/sigsetjmp.S
+++ b/lib/libc/powerpc/gen/sigsetjmp.S
@@ -26,8 +26,6 @@
/* $NetBSD: sigsetjmp.S,v 1.4 1998/10/03 12:30:38 tsubai Exp $ */
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* C library -- sigsetjmp, siglongjmp
*
diff --git a/lib/libc/powerpc/gen/syncicache.c b/lib/libc/powerpc/gen/syncicache.c
index 5192d1356153..6376cb0e576d 100644
--- a/lib/libc/powerpc/gen/syncicache.c
+++ b/lib/libc/powerpc/gen/syncicache.c
@@ -33,11 +33,6 @@
* $NetBSD: syncicache.c,v 1.2 1999/05/05 12:36:40 tsubai Exp $
*/
-#ifndef lint
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
#include <sys/param.h>
#if defined(_KERNEL) || defined(_STANDALONE)
#include <sys/time.h>
diff --git a/lib/libc/powerpc/softfloat/milieu.h b/lib/libc/powerpc/softfloat/milieu.h
index e2e43b150073..6139aa58b982 100644
--- a/lib/libc/powerpc/softfloat/milieu.h
+++ b/lib/libc/powerpc/softfloat/milieu.h
@@ -1,5 +1,4 @@
/* $NetBSD: milieu.h,v 1.1 2000/12/29 20:13:54 bjh21 Exp $ */
-/* $FreeBSD$ */
/*
===============================================================================
diff --git a/lib/libc/powerpc/softfloat/powerpc-gcc.h b/lib/libc/powerpc/softfloat/powerpc-gcc.h
index 0fbb8006e22d..4520826cc36d 100644
--- a/lib/libc/powerpc/softfloat/powerpc-gcc.h
+++ b/lib/libc/powerpc/softfloat/powerpc-gcc.h
@@ -1,5 +1,4 @@
/* $NetBSD: arm-gcc.h,v 1.2 2001/02/21 18:09:25 bjh21 Exp $ */
-/* $FreeBSD$ */
/*
-------------------------------------------------------------------------------
diff --git a/lib/libc/powerpc/softfloat/softfloat.h b/lib/libc/powerpc/softfloat/softfloat.h
index 6b9c9b06956d..b20cb3e7aa00 100644
--- a/lib/libc/powerpc/softfloat/softfloat.h
+++ b/lib/libc/powerpc/softfloat/softfloat.h
@@ -1,5 +1,4 @@
/* $NetBSD: softfloat.h,v 1.6 2002/05/12 13:12:46 bjh21 Exp $ */
-/* $FreeBSD$ */
/* This is a derivative work. */
diff --git a/lib/libc/powerpc/static_tls.h b/lib/libc/powerpc/static_tls.h
index fd7a80d49234..9ae38c71a515 100644
--- a/lib/libc/powerpc/static_tls.h
+++ b/lib/libc/powerpc/static_tls.h
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2019 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 _LIBC_POWERPC_STATIC_TLS_H
diff --git a/lib/libc/powerpc/sys/Makefile.inc b/lib/libc/powerpc/sys/Makefile.inc
deleted file mode 100644
index 99a141b5cb1e..000000000000
--- a/lib/libc/powerpc/sys/Makefile.inc
+++ /dev/null
@@ -1,4 +0,0 @@
-# $FreeBSD$
-
-SRCS+= __vdso_gettc.c
-MDASM+= cerror.S
diff --git a/lib/libc/powerpc/sys/__vdso_gettc.c b/lib/libc/powerpc/sys/__vdso_gettc.c
deleted file mode 100644
index e54e5c3f54d4..000000000000
--- a/lib/libc/powerpc/sys/__vdso_gettc.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 2020 Brandon Bergren <bdragon@FreeBSD.org>
- *
- * This software was developed by Konstantin Belousov
- * under sponsorship from the FreeBSD Foundation.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <sys/elf.h>
-#include <sys/time.h>
-#include <sys/vdso.h>
-
-#include <machine/cpufunc.h>
-#include <machine/spr.h>
-
-#include <errno.h>
-
-#include "libc_private.h"
-
-#pragma weak __vdso_gettc
-int
-__vdso_gettc(const struct vdso_timehands *th, u_int *tc)
-{
-
- if (__predict_false(th->th_algo != VDSO_TH_ALGO_PPC_TB))
- return (ENOSYS);
- /*
- * While the timebase is a 64 bit quantity, we are only interested
- * in the lower 32 bits of it.
- */
- *tc = mfspr(TBR_TBL);
-
- return (0);
-}
-
-#pragma weak __vdso_gettimekeep
-int
-__vdso_gettimekeep(struct vdso_timekeep **tk)
-{
-
- return (_elf_aux_info(AT_TIMEKEEP, tk, sizeof(*tk)));
-}
diff --git a/lib/libc/powerpc/sys/cerror.S b/lib/libc/powerpc/sys/cerror.S
deleted file mode 100644
index 9ec3cbaf63a2..000000000000
--- a/lib/libc/powerpc/sys/cerror.S
+++ /dev/null
@@ -1,68 +0,0 @@
-/*-
- * Copyright (c) 2002 Peter Grehan.
- * All rights reserved.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-/* $NetBSD: cerror.S,v 1.5 2000/01/27 14:58:48 kleink Exp $ */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#include "SYS.h"
-
- .globl HIDENAME(cerror)
- .globl CNAME(__error)
-
- /*
- * The __error() function is thread aware. For non-threaded
- * programs and the initial thread in threaded programs,
- * it returns a pointer to the global errno variable.
- */
-HIDENAME(cerror):
- mflr %r0
- stwu %r1,-20(%r1) /* allocate new stack frame */
- stw %r0,24(%r1) /* and save lr, r31 */
- stw %r31,12(%r1)
-#ifdef __PIC__
- stw %r30,8(%r1)
- bcl 20,31,1f
-1:
- mflr %r30
- addis %r30,%r30,_GLOBAL_OFFSET_TABLE_-1b@ha
- addi %r30,%r30,_GLOBAL_OFFSET_TABLE_-1b@l
-#endif
- mr %r31,%r3 /* stash errval in callee-saved register */
- bl PIC_PLT(CNAME(__error))
- stw %r31,0(%r3) /* store errval into &errno */
- lwz %r0,24(%r1)
- lwz %r31,12(%r1)
-#ifdef __PIC__
- lwz %r30,8(%r1)
-#endif
- mtlr %r0
- la %r1,20(%r1)
- li %r3,-1
- li %r4,-1
- blr /* return to callers caller */
-
- .section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/powerpc64/Makefile.inc b/lib/libc/powerpc64/Makefile.inc
index 8efaadb6a333..4aac4e3a6e68 100644
--- a/lib/libc/powerpc64/Makefile.inc
+++ b/lib/libc/powerpc64/Makefile.inc
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Long double is 64-bits
SRCS+=machdep_ldisd.c
diff --git a/lib/libc/powerpc64/SYS.h b/lib/libc/powerpc64/SYS.h
deleted file mode 100644
index 9ca5af4b70ed..000000000000
--- a/lib/libc/powerpc64/SYS.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-3-Clause
- *
- * Copyright (c) 2002 Benno Rice. All rights reserved.
- * Copyright (c) 2002 David E. O'Brien. All rights reserved.
- *
- * 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.
- * 3. Neither the name of the author nor the names of any contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 REGENTS 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.
- *
- * $NetBSD: SYS.h,v 1.8 2002/01/14 00:55:56 thorpej Exp $
- * $FreeBSD$
- */
-
-#include <sys/syscall.h>
-#include <machine/asm.h>
-
-#define _SYSCALL(name) \
- .text; \
- .align 2; \
- li 0,(SYS_##name); \
- sc
-
-#define SYSCALL(name) \
- .text; \
- .align 2; \
-2: mflr %r0; \
- std %r0,16(%r1); \
- stdu %r1,-48(%r1); \
- bl CNAME(HIDENAME(cerror)); \
- nop; \
- addi %r1,%r1,48; \
- ld %r0,16(%r1); \
- mtlr %r0; \
- blr; \
-ENTRY(__sys_##name); \
- WEAK_REFERENCE(__sys_##name, name); \
- WEAK_REFERENCE(__sys_##name, _##name); \
- _SYSCALL(name); \
- bso 2b
-
-#define PSEUDO(name) \
- .text; \
- .align 2; \
-ENTRY(__sys_##name); \
- WEAK_REFERENCE(__sys_##name, _##name); \
- _SYSCALL(name); \
- bnslr; \
- mflr %r0; \
- std %r0,16(%r1); \
- stdu %r1,-48(%r1); \
- bl CNAME(HIDENAME(cerror)); \
- nop; \
- addi %r1,%r1,48; \
- ld %r0,16(%r1); \
- mtlr %r0; \
- blr; \
-END(__sys_##name)
-
-#define RSYSCALL(name) \
- .text; \
- .align 2; \
-ENTRY(__sys_##name); \
- WEAK_REFERENCE(__sys_##name, name); \
- WEAK_REFERENCE(__sys_##name, _##name); \
- _SYSCALL(name); \
- bnslr; \
- \
- mflr %r0; \
- std %r0,16(%r1); \
- stdu %r1,-48(%r1); \
- bl CNAME(HIDENAME(cerror)); \
- nop; \
- addi %r1,%r1,48; \
- ld %r0,16(%r1); \
- mtlr %r0; \
- blr; \
-END(__sys_##name)
diff --git a/lib/libc/powerpc64/Symbol.map b/lib/libc/powerpc64/Symbol.map
index 29bd6a544a61..62f20e7f352c 100644
--- a/lib/libc/powerpc64/Symbol.map
+++ b/lib/libc/powerpc64/Symbol.map
@@ -1,51 +1,16 @@
/*
- * $FreeBSD$
- */
-
-/*
* This only needs to contain symbols that are not listed in
* symbol maps from other parts of libc (i.e., not found in
* stdlib/Symbol.map, string/Symbol.map, sys/Symbol.map, ...).
*/
FBSD_1.0 {
- /* PSEUDO syscalls */
- _exit;
-
_mcount;
- _setjmp;
- _longjmp;
- fabs;
__flt_rounds;
+ brk;
fpgetmask;
fpgetround;
fpgetsticky;
fpsetmask;
fpsetround;
- __infinity;
- __nan;
- makecontext;
- setjmp;
- longjmp;
- sigsetjmp;
- siglongjmp;
- htonl;
- htons;
- ntohl;
- ntohs;
- brk;
sbrk;
- vfork;
-};
-
-FBSDprivate_1.0 {
- /* PSEUDO syscalls */
- _getlogin;
-
- _set_tp;
- _fpgetsticky;
- __makecontext;
- __longjmp;
- signalcontext;
- __signalcontext;
- __syncicache;
};
diff --git a/lib/libc/powerpc64/_fpmath.h b/lib/libc/powerpc64/_fpmath.h
index 76eaa1eff089..9bc7450aacaf 100644
--- a/lib/libc/powerpc64/_fpmath.h
+++ b/lib/libc/powerpc64/_fpmath.h
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2003 David Schultz <das@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$
*/
union IEEEl2bits {
diff --git a/lib/libc/powerpc64/arith.h b/lib/libc/powerpc64/arith.h
index 03a162fd035b..8ac7860d6137 100644
--- a/lib/libc/powerpc64/arith.h
+++ b/lib/libc/powerpc64/arith.h
@@ -1,7 +1,5 @@
/*
* MD header for contrib/gdtoa
- *
- * $FreeBSD$
*/
/*
diff --git a/lib/libc/powerpc64/gd_qnan.h b/lib/libc/powerpc64/gd_qnan.h
index d70d8c318c4c..3e78a83adc71 100644
--- a/lib/libc/powerpc64/gd_qnan.h
+++ b/lib/libc/powerpc64/gd_qnan.h
@@ -3,11 +3,22 @@
*
* This file can be generated by compiling and running contrib/gdtoa/qnan.c
* on the target architecture after arith.h has been generated.
- *
- * $FreeBSD$
*/
#define f_QNAN 0x7fc00000
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+#define d_QNAN0 0x0
+#define d_QNAN1 0x7ff80000
+#define ld_QNAN0 0x0
+#define ld_QNAN1 0x7ff80000
+#define ld_QNAN2 0x0
+#define ld_QNAN3 0x0
+#define ldus_QNAN0 0x0
+#define ldus_QNAN1 0x0
+#define ldus_QNAN2 0x0
+#define ldus_QNAN3 0x7ff8
+#define ldus_QNAN4 0x0
+#else
#define d_QNAN0 0x7ff80000
#define d_QNAN1 0x0
#define ld_QNAN0 0x7ff80000
@@ -19,3 +30,4 @@
#define ldus_QNAN2 0x0
#define ldus_QNAN3 0x0
#define ldus_QNAN4 0x0
+#endif
diff --git a/lib/libc/powerpc64/gen/Makefile.inc b/lib/libc/powerpc64/gen/Makefile.inc
index 0e40aee2d11f..26265df5fbd2 100644
--- a/lib/libc/powerpc64/gen/Makefile.inc
+++ b/lib/libc/powerpc64/gen/Makefile.inc
@@ -1,11 +1,7 @@
-# $FreeBSD$
SRCS += _ctx_start.S fabs.S flt_rounds.c fpgetmask.c fpgetround.c \
- fpgetsticky.c fpsetmask.c fpsetround.c _get_tp.c \
+ fpgetsticky.c fpsetmask.c fpsetround.c \
infinity.c ldexp.c makecontext.c _setjmp.S \
setjmp.S sigsetjmp.S signalcontext.c syncicache.c \
- _set_tp.c \
trivial-getcontextx.c
-CFLAGS._get_tp.c+= ${RTLD_HDRS}
-
diff --git a/lib/libc/powerpc64/gen/_ctx_start.S b/lib/libc/powerpc64/gen/_ctx_start.S
index 4d5f106c96cb..c2f8abfd6486 100644
--- a/lib/libc/powerpc64/gen/_ctx_start.S
+++ b/lib/libc/powerpc64/gen/_ctx_start.S
@@ -25,9 +25,6 @@
*/
#include <machine/asm.h>
-
- __FBSDID("$FreeBSD$");
-
.globl CNAME(_ctx_done)
.globl CNAME(abort)
diff --git a/lib/libc/powerpc64/gen/_get_tp.c b/lib/libc/powerpc64/gen/_get_tp.c
deleted file mode 100644
index 16f5c952276e..000000000000
--- a/lib/libc/powerpc64/gen/_get_tp.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 2021 The FreeBSD Foundation
- *
- * This software were developed by Konstantin Belousov
- * under sponsorship from the FreeBSD Foundation.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <string.h>
-#include <stdint.h>
-#include "libc_private.h"
-#include "rtld.h"
-
-void *
-_get_tp(void)
-{
- Elf_Addr tp;
-
- __asm __volatile("mr %0,13" : "=r" (tp));
- return ((void *)(tp - TLS_TP_OFFSET - TLS_TCB_SIZE));
-}
diff --git a/lib/libc/powerpc64/gen/_setjmp.S b/lib/libc/powerpc64/gen/_setjmp.S
index f7689aeba350..94a744b4fa28 100644
--- a/lib/libc/powerpc64/gen/_setjmp.S
+++ b/lib/libc/powerpc64/gen/_setjmp.S
@@ -26,8 +26,6 @@
/* $NetBSD: _setjmp.S,v 1.1 1997/03/29 20:55:53 thorpej Exp $ */
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* C library -- _setjmp, _longjmp
*
diff --git a/lib/libc/powerpc64/gen/fabs.S b/lib/libc/powerpc64/gen/fabs.S
index ac083ae636ac..d9dbf9d86fe0 100644
--- a/lib/libc/powerpc64/gen/fabs.S
+++ b/lib/libc/powerpc64/gen/fabs.S
@@ -25,8 +25,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* double fabs(double)
*/
diff --git a/lib/libc/powerpc64/gen/flt_rounds.c b/lib/libc/powerpc64/gen/flt_rounds.c
index 39af35c77e1c..800ec6944d79 100644
--- a/lib/libc/powerpc64/gen/flt_rounds.c
+++ b/lib/libc/powerpc64/gen/flt_rounds.c
@@ -1,7 +1,7 @@
/* $NetBSD: flt_rounds.c,v 1.4.10.3 2002/03/22 20:41:53 nathanw Exp $ */
/*-
- * SPDX-License-Identifier: BSD-2-Clause-NetBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1996 Mark Brinicombe
* All rights reserved.
@@ -33,9 +33,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <machine/float.h>
diff --git a/lib/libc/powerpc64/gen/fpgetmask.c b/lib/libc/powerpc64/gen/fpgetmask.c
index b8c813e8bb84..6817a32bdc65 100644
--- a/lib/libc/powerpc64/gen/fpgetmask.c
+++ b/lib/libc/powerpc64/gen/fpgetmask.c
@@ -1,7 +1,7 @@
/* $NetBSD: fpgetmask.c,v 1.3 2002/01/13 21:45:47 thorpej Exp $ */
/*-
- * SPDX-License-Identifier: BSD-2-Clause-NetBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -32,9 +32,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <ieeefp.h>
diff --git a/lib/libc/powerpc64/gen/fpgetround.c b/lib/libc/powerpc64/gen/fpgetround.c
index 062a565cc570..b135807b613f 100644
--- a/lib/libc/powerpc64/gen/fpgetround.c
+++ b/lib/libc/powerpc64/gen/fpgetround.c
@@ -1,7 +1,7 @@
/* $NetBSD: fpgetround.c,v 1.3 2002/01/13 21:45:47 thorpej Exp $ */
/*-
- * SPDX-License-Identifier: BSD-2-Clause-NetBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -32,9 +32,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <ieeefp.h>
diff --git a/lib/libc/powerpc64/gen/fpgetsticky.c b/lib/libc/powerpc64/gen/fpgetsticky.c
index e556123251ec..3512c97f8cf9 100644
--- a/lib/libc/powerpc64/gen/fpgetsticky.c
+++ b/lib/libc/powerpc64/gen/fpgetsticky.c
@@ -1,7 +1,7 @@
/* $NetBSD: fpgetsticky.c,v 1.3 2002/01/13 21:45:48 thorpej Exp $ */
/*-
- * SPDX-License-Identifier: BSD-2-Clause-NetBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -29,11 +29,8 @@
* 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/cdefs.h>
#include "namespace.h"
@@ -41,10 +38,6 @@
#include <ieeefp.h>
#ifndef _SOFT_FLOAT
-#ifdef __weak_alias
-__weak_alias(fpgetsticky,_fpgetsticky)
-#endif
-
fp_except_t
fpgetsticky()
{
diff --git a/lib/libc/powerpc64/gen/fpsetmask.c b/lib/libc/powerpc64/gen/fpsetmask.c
index f5d52eec5482..4170b385e9e4 100644
--- a/lib/libc/powerpc64/gen/fpsetmask.c
+++ b/lib/libc/powerpc64/gen/fpsetmask.c
@@ -1,7 +1,7 @@
/* $NetBSD: fpsetmask.c,v 1.3 2002/01/13 21:45:48 thorpej Exp $ */
/*-
- * SPDX-License-Identifier: BSD-2-Clause-NetBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -32,9 +32,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <ieeefp.h>
diff --git a/lib/libc/powerpc64/gen/fpsetround.c b/lib/libc/powerpc64/gen/fpsetround.c
index 2faee6d5bdfd..2a70fd781474 100644
--- a/lib/libc/powerpc64/gen/fpsetround.c
+++ b/lib/libc/powerpc64/gen/fpsetround.c
@@ -1,7 +1,7 @@
/* $NetBSD: fpsetround.c,v 1.3 2002/01/13 21:45:48 thorpej Exp $ */
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1999 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -32,9 +32,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <ieeefp.h>
diff --git a/lib/libc/powerpc64/gen/infinity.c b/lib/libc/powerpc64/gen/infinity.c
index f5324389d5b6..6e11371e6eb3 100644
--- a/lib/libc/powerpc64/gen/infinity.c
+++ b/lib/libc/powerpc64/gen/infinity.c
@@ -4,8 +4,6 @@
__RCSID("$NetBSD: infinity.c,v 1.2 1998/11/14 19:31:02 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
-__FBSDID("$FreeBSD$");
-
/* infinity.c */
#include <math.h>
diff --git a/lib/libc/powerpc64/gen/makecontext.c b/lib/libc/powerpc64/gen/makecontext.c
index 7663b6f82e7d..75c2d40bdd60 100644
--- a/lib/libc/powerpc64/gen/makecontext.c
+++ b/lib/libc/powerpc64/gen/makecontext.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2004 Suleiman Souhlal
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <stdarg.h>
diff --git a/lib/libc/powerpc64/gen/setjmp.S b/lib/libc/powerpc64/gen/setjmp.S
index 5eb395e7c30d..7cf48d63ec82 100644
--- a/lib/libc/powerpc64/gen/setjmp.S
+++ b/lib/libc/powerpc64/gen/setjmp.S
@@ -26,8 +26,6 @@
/* $NetBSD: setjmp.S,v 1.3 1998/10/03 12:30:38 tsubai Exp $ */
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/syscall.h>
/*
diff --git a/lib/libc/powerpc64/gen/signalcontext.c b/lib/libc/powerpc64/gen/signalcontext.c
index 6157f0657f07..de0b2109bba4 100644
--- a/lib/libc/powerpc64/gen/signalcontext.c
+++ b/lib/libc/powerpc64/gen/signalcontext.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2004 Marcel Moolenaar, Peter Grehan
* All rights reserved.
@@ -26,9 +26,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/ucontext.h>
#include <signal.h>
diff --git a/lib/libc/powerpc64/gen/sigsetjmp.S b/lib/libc/powerpc64/gen/sigsetjmp.S
index c0648a632f1e..58fa188daaa4 100644
--- a/lib/libc/powerpc64/gen/sigsetjmp.S
+++ b/lib/libc/powerpc64/gen/sigsetjmp.S
@@ -26,8 +26,6 @@
/* $NetBSD: sigsetjmp.S,v 1.4 1998/10/03 12:30:38 tsubai Exp $ */
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* C library -- sigsetjmp, siglongjmp
*
diff --git a/lib/libc/powerpc64/gen/syncicache.c b/lib/libc/powerpc64/gen/syncicache.c
index d96529bc3833..7885a36bd1d1 100644
--- a/lib/libc/powerpc64/gen/syncicache.c
+++ b/lib/libc/powerpc64/gen/syncicache.c
@@ -33,11 +33,6 @@
* $NetBSD: syncicache.c,v 1.2 1999/05/05 12:36:40 tsubai Exp $
*/
-#ifndef lint
-static const char rcsid[] =
- "$FreeBSD$";
-#endif /* not lint */
-
#include <sys/param.h>
#if defined(_KERNEL) || defined(_STANDALONE)
#include <sys/time.h>
diff --git a/lib/libc/powerpc64/softfloat/milieu.h b/lib/libc/powerpc64/softfloat/milieu.h
index e2e43b150073..6139aa58b982 100644
--- a/lib/libc/powerpc64/softfloat/milieu.h
+++ b/lib/libc/powerpc64/softfloat/milieu.h
@@ -1,5 +1,4 @@
/* $NetBSD: milieu.h,v 1.1 2000/12/29 20:13:54 bjh21 Exp $ */
-/* $FreeBSD$ */
/*
===============================================================================
diff --git a/lib/libc/powerpc64/softfloat/powerpc-gcc.h b/lib/libc/powerpc64/softfloat/powerpc-gcc.h
index e2f8680dd74e..d11198866e39 100644
--- a/lib/libc/powerpc64/softfloat/powerpc-gcc.h
+++ b/lib/libc/powerpc64/softfloat/powerpc-gcc.h
@@ -1,5 +1,4 @@
/* $NetBSD: arm-gcc.h,v 1.2 2001/02/21 18:09:25 bjh21 Exp $ */
-/* $FreeBSD$ */
/*
-------------------------------------------------------------------------------
diff --git a/lib/libc/powerpc64/softfloat/softfloat.h b/lib/libc/powerpc64/softfloat/softfloat.h
index 6b9c9b06956d..b20cb3e7aa00 100644
--- a/lib/libc/powerpc64/softfloat/softfloat.h
+++ b/lib/libc/powerpc64/softfloat/softfloat.h
@@ -1,5 +1,4 @@
/* $NetBSD: softfloat.h,v 1.6 2002/05/12 13:12:46 bjh21 Exp $ */
-/* $FreeBSD$ */
/* This is a derivative work. */
diff --git a/lib/libc/powerpc64/static_tls.h b/lib/libc/powerpc64/static_tls.h
index 63adba39bab1..014b8a931453 100644
--- a/lib/libc/powerpc64/static_tls.h
+++ b/lib/libc/powerpc64/static_tls.h
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2019 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 _LIBC_POWERPC64_STATIC_TLS_H
diff --git a/lib/libc/powerpc64/string/Makefile.inc b/lib/libc/powerpc64/string/Makefile.inc
index 486ca47a44be..d1918ff027c3 100644
--- a/lib/libc/powerpc64/string/Makefile.inc
+++ b/lib/libc/powerpc64/string/Makefile.inc
@@ -1,4 +1,3 @@
-# $FreeBSD$
MDSRCS+= \
bcopy.S \
diff --git a/lib/libc/powerpc64/string/bcopy.S b/lib/libc/powerpc64/string/bcopy.S
index 4dc80c264362..6f6223214e26 100644
--- a/lib/libc/powerpc64/string/bcopy.S
+++ b/lib/libc/powerpc64/string/bcopy.S
@@ -28,8 +28,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
#define BLOCK_SIZE_BITS 6
#define BLOCK_SIZE (1 << BLOCK_SIZE_BITS)
#define BLOCK_SIZE_MASK (BLOCK_SIZE - 1)
diff --git a/lib/libc/powerpc64/string/bcopy_resolver.c b/lib/libc/powerpc64/string/bcopy_resolver.c
index 1991a2998a4d..c99c53b2f9b3 100644
--- a/lib/libc/powerpc64/string/bcopy_resolver.c
+++ b/lib/libc/powerpc64/string/bcopy_resolver.c
@@ -27,9 +27,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <machine/cpu.h>
#include <machine/ifunc.h>
diff --git a/lib/libc/powerpc64/string/bcopy_vsx.S b/lib/libc/powerpc64/string/bcopy_vsx.S
index fca9d3192e39..f1740d3db7b5 100644
--- a/lib/libc/powerpc64/string/bcopy_vsx.S
+++ b/lib/libc/powerpc64/string/bcopy_vsx.S
@@ -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 FN_NAME
diff --git a/lib/libc/powerpc64/string/memcpy.S b/lib/libc/powerpc64/string/memcpy.S
index 0163ea1be2cd..28f3f2bb0ab4 100644
--- a/lib/libc/powerpc64/string/memcpy.S
+++ b/lib/libc/powerpc64/string/memcpy.S
@@ -28,8 +28,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
#ifndef FN_NAME
#define FN_NAME __memcpy
WEAK_REFERENCE(__memcpy, memcpy);
diff --git a/lib/libc/powerpc64/string/memcpy_resolver.c b/lib/libc/powerpc64/string/memcpy_resolver.c
index d5f4303f3069..d1ac75edf5b4 100644
--- a/lib/libc/powerpc64/string/memcpy_resolver.c
+++ b/lib/libc/powerpc64/string/memcpy_resolver.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
#define MEMCOPY
#include "bcopy_resolver.c"
diff --git a/lib/libc/powerpc64/string/memcpy_vsx.S b/lib/libc/powerpc64/string/memcpy_vsx.S
index 83dd84ef7ee0..69554e026f35 100644
--- a/lib/libc/powerpc64/string/memcpy_vsx.S
+++ b/lib/libc/powerpc64/string/memcpy_vsx.S
@@ -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$
*/
#define FN_NAME __memcpy_vsx
diff --git a/lib/libc/powerpc64/string/memmove.S b/lib/libc/powerpc64/string/memmove.S
index e0b8c6c502f1..3d49c57100df 100644
--- a/lib/libc/powerpc64/string/memmove.S
+++ b/lib/libc/powerpc64/string/memmove.S
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
#define MEMMOVE
#include "bcopy.S"
diff --git a/lib/libc/powerpc64/string/memmove_resolver.c b/lib/libc/powerpc64/string/memmove_resolver.c
index 3f5fd973bd0a..fcb11ee0ae43 100644
--- a/lib/libc/powerpc64/string/memmove_resolver.c
+++ b/lib/libc/powerpc64/string/memmove_resolver.c
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
#define MEMMOVE
#include "bcopy_resolver.c"
diff --git a/lib/libc/powerpc64/string/memmove_vsx.S b/lib/libc/powerpc64/string/memmove_vsx.S
index bf8a90da468a..9e7d51ce4683 100644
--- a/lib/libc/powerpc64/string/memmove_vsx.S
+++ b/lib/libc/powerpc64/string/memmove_vsx.S
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
#define MEMMOVE
#define FN_NAME __memmove_vsx
diff --git a/lib/libc/powerpc64/string/strcpy.c b/lib/libc/powerpc64/string/strcpy.c
index 0d01748d865a..d0be3ca468a0 100644
--- a/lib/libc/powerpc64/string/strcpy.c
+++ b/lib/libc/powerpc64/string/strcpy.c
@@ -26,8 +26,5 @@
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#define WEAK_STRCPY
#include "../../string/strcpy.c"
diff --git a/lib/libc/powerpc64/string/strcpy_arch_2_05.S b/lib/libc/powerpc64/string/strcpy_arch_2_05.S
index 7f42fd813395..36728fa0b40f 100644
--- a/lib/libc/powerpc64/string/strcpy_arch_2_05.S
+++ b/lib/libc/powerpc64/string/strcpy_arch_2_05.S
@@ -28,8 +28,6 @@
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
#if 0
RCSID("$NetBSD: strcpy.S,v 1.0 2018/05/08 13:00:49 lbianc Exp $")
#endif
diff --git a/lib/libc/powerpc64/string/strcpy_resolver.c b/lib/libc/powerpc64/string/strcpy_resolver.c
index f44161b33331..7a64ce41c7e4 100644
--- a/lib/libc/powerpc64/string/strcpy_resolver.c
+++ b/lib/libc/powerpc64/string/strcpy_resolver.c
@@ -26,9 +26,6 @@
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <machine/cpu.h>
#include <machine/ifunc.h>
diff --git a/lib/libc/powerpc64/string/strncpy.c b/lib/libc/powerpc64/string/strncpy.c
index 6d53615962b1..aef3fb88724a 100644
--- a/lib/libc/powerpc64/string/strncpy.c
+++ b/lib/libc/powerpc64/string/strncpy.c
@@ -26,8 +26,5 @@
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#define WEAK_STRNCPY
#include "../../string/strncpy.c"
diff --git a/lib/libc/powerpc64/string/strncpy_arch_2_05.S b/lib/libc/powerpc64/string/strncpy_arch_2_05.S
index 98139c35af8c..f78d1c49c62a 100644
--- a/lib/libc/powerpc64/string/strncpy_arch_2_05.S
+++ b/lib/libc/powerpc64/string/strncpy_arch_2_05.S
@@ -27,8 +27,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
ENTRY(__strncpy_arch_2_05)
stdu %r1,-40(%r1)
mflr %r0
diff --git a/lib/libc/powerpc64/string/strncpy_resolver.c b/lib/libc/powerpc64/string/strncpy_resolver.c
index ee4a95b6418b..402b5c5226d0 100644
--- a/lib/libc/powerpc64/string/strncpy_resolver.c
+++ b/lib/libc/powerpc64/string/strncpy_resolver.c
@@ -26,9 +26,6 @@
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <machine/cpu.h>
#include <machine/ifunc.h>
diff --git a/lib/libc/powerpc64/sys/Makefile.inc b/lib/libc/powerpc64/sys/Makefile.inc
deleted file mode 100644
index 99a141b5cb1e..000000000000
--- a/lib/libc/powerpc64/sys/Makefile.inc
+++ /dev/null
@@ -1,4 +0,0 @@
-# $FreeBSD$
-
-SRCS+= __vdso_gettc.c
-MDASM+= cerror.S
diff --git a/lib/libc/powerpc64/sys/cerror.S b/lib/libc/powerpc64/sys/cerror.S
deleted file mode 100644
index 93172fdb822e..000000000000
--- a/lib/libc/powerpc64/sys/cerror.S
+++ /dev/null
@@ -1,61 +0,0 @@
-/*-
- * Copyright (c) 2002 Peter Grehan.
- * All rights reserved.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-/* $NetBSD: cerror.S,v 1.5 2000/01/27 14:58:48 kleink Exp $ */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#include "SYS.h"
-
- .globl HIDENAME(cerror)
- .globl CNAME(__error)
-
- /*
- * The __error() function is thread aware. For non-threaded
- * programs and the initial thread in threaded programs,
- * it returns a pointer to the global errno variable.
- */
-ENTRY_NOPROF(HIDENAME(cerror))
- mflr %r0
- std %r0,16(%r1) /* save lr */
- stdu %r1,-64(%r1) /* allocate new stack frame */
- std %r31,48(%r1)
-
- mr %r31,%r3 /* stash errval in callee-saved register */
- bl CNAME(__error)
- nop
- stw %r31,0(%r3) /* store errval into &errno */
-
- ld %r31,48(%r1)
- ld %r1,0(%r1)
- ld %r0,16(%r1)
- mtlr %r0
- li %r3,-1
- li %r4,-1
- blr
-END(HIDENAME(cerror))
-
- .section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/powerpcspe/Makefile.inc b/lib/libc/powerpcspe/Makefile.inc
index 56f0476f8897..6962e107ed4d 100644
--- a/lib/libc/powerpcspe/Makefile.inc
+++ b/lib/libc/powerpcspe/Makefile.inc
@@ -1,4 +1,3 @@
-# $FreeBSD$
CFLAGS+= -I${LIBC_SRCTOP}/powerpc
diff --git a/lib/libc/mips/_fpmath.h b/lib/libc/powerpcspe/_fpmath.h
index cece2fa81cb6..9bc7450aacaf 100644
--- a/lib/libc/mips/_fpmath.h
+++ b/lib/libc/powerpcspe/_fpmath.h
@@ -1,7 +1,7 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
- * Copyright (c) 2002, 2003 David Schultz <das@FreeBSD.ORG>
+ * Copyright (c) 2003 David Schultz <das@FreeBSD.ORG>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -24,19 +24,17 @@
* 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$
*/
union IEEEl2bits {
long double e;
struct {
-#ifndef __MIPSEB__
+#if _BYTE_ORDER == _LITTLE_ENDIAN
unsigned int manl :32;
unsigned int manh :20;
unsigned int exp :11;
unsigned int sign :1;
-#else
+#else /* _BYTE_ORDER == _LITTLE_ENDIAN */
unsigned int sign :1;
unsigned int exp :11;
unsigned int manh :20;
@@ -45,9 +43,9 @@ union IEEEl2bits {
} bits;
};
-#define LDBL_NBIT 0
#define mask_nbit_l(u) ((void)0)
#define LDBL_IMPLICIT_NBIT
+#define LDBL_NBIT 0
#define LDBL_MANH_SIZE 20
#define LDBL_MANL_SIZE 32
diff --git a/lib/libc/powerpcspe/gen/Makefile.inc b/lib/libc/powerpcspe/gen/Makefile.inc
index f96ad9fb0a6f..efdc778e8999 100644
--- a/lib/libc/powerpcspe/gen/Makefile.inc
+++ b/lib/libc/powerpcspe/gen/Makefile.inc
@@ -1,4 +1,3 @@
-# $FreeBSD$
.include "${LIBC_SRCTOP}/powerpc/gen/Makefile.common"
diff --git a/lib/libc/powerpcspe/gen/_setjmp.S b/lib/libc/powerpcspe/gen/_setjmp.S
index 0dd28fa2deb4..f282e0013f97 100644
--- a/lib/libc/powerpcspe/gen/_setjmp.S
+++ b/lib/libc/powerpcspe/gen/_setjmp.S
@@ -26,8 +26,6 @@
/* $NetBSD: _setjmp.S,v 1.1 1997/03/29 20:55:53 thorpej Exp $ */
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* C library -- _setjmp, _longjmp
*
diff --git a/lib/libc/powerpcspe/gen/fabs.S b/lib/libc/powerpcspe/gen/fabs.S
index 4fb08d63b6f1..df9196c3273d 100644
--- a/lib/libc/powerpcspe/gen/fabs.S
+++ b/lib/libc/powerpcspe/gen/fabs.S
@@ -25,8 +25,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* double fabs(double)
*/
diff --git a/lib/libc/powerpcspe/gen/flt_rounds.c b/lib/libc/powerpcspe/gen/flt_rounds.c
index 1334021fb7fa..26dfca0e0e3a 100644
--- a/lib/libc/powerpcspe/gen/flt_rounds.c
+++ b/lib/libc/powerpcspe/gen/flt_rounds.c
@@ -31,9 +31,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <machine/float.h>
#include <machine/spr.h>
diff --git a/lib/libc/powerpcspe/gen/fpgetmask.c b/lib/libc/powerpcspe/gen/fpgetmask.c
index d2314c652588..f7679be4ca54 100644
--- a/lib/libc/powerpcspe/gen/fpgetmask.c
+++ b/lib/libc/powerpcspe/gen/fpgetmask.c
@@ -30,9 +30,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <machine/spr.h>
#include <ieeefp.h>
diff --git a/lib/libc/powerpcspe/gen/fpgetround.c b/lib/libc/powerpcspe/gen/fpgetround.c
index 7815559f7b5a..9c01bcbaf327 100644
--- a/lib/libc/powerpcspe/gen/fpgetround.c
+++ b/lib/libc/powerpcspe/gen/fpgetround.c
@@ -30,9 +30,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <machine/spr.h>
#include <ieeefp.h>
diff --git a/lib/libc/powerpcspe/gen/fpgetsticky.c b/lib/libc/powerpcspe/gen/fpgetsticky.c
index 87962637bc3c..a97c27296cab 100644
--- a/lib/libc/powerpcspe/gen/fpgetsticky.c
+++ b/lib/libc/powerpcspe/gen/fpgetsticky.c
@@ -27,11 +27,8 @@
* 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/cdefs.h>
#include "namespace.h"
@@ -40,10 +37,6 @@
#include <ieeefp.h>
#ifndef _SOFT_FLOAT
-#ifdef __weak_alias
-__weak_alias(fpgetsticky,_fpgetsticky)
-#endif
-
fp_except_t
fpgetsticky()
{
diff --git a/lib/libc/powerpcspe/gen/fpsetmask.c b/lib/libc/powerpcspe/gen/fpsetmask.c
index 2f48802d9ca3..a7a2569df905 100644
--- a/lib/libc/powerpcspe/gen/fpsetmask.c
+++ b/lib/libc/powerpcspe/gen/fpsetmask.c
@@ -30,9 +30,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <machine/spr.h>
#include <ieeefp.h>
diff --git a/lib/libc/powerpcspe/gen/fpsetround.c b/lib/libc/powerpcspe/gen/fpsetround.c
index 2e2469cdae5e..2280e190b2f9 100644
--- a/lib/libc/powerpcspe/gen/fpsetround.c
+++ b/lib/libc/powerpcspe/gen/fpsetround.c
@@ -30,9 +30,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <machine/spr.h>
#include <ieeefp.h>
diff --git a/lib/libc/powerpcspe/gen/setjmp.S b/lib/libc/powerpcspe/gen/setjmp.S
index 7a93b2f883e8..1bd3edcf5239 100644
--- a/lib/libc/powerpcspe/gen/setjmp.S
+++ b/lib/libc/powerpcspe/gen/setjmp.S
@@ -26,8 +26,6 @@
/* $NetBSD: setjmp.S,v 1.3 1998/10/03 12:30:38 tsubai Exp $ */
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/syscall.h>
/*
diff --git a/lib/libc/powerpcspe/gen/sigsetjmp.S b/lib/libc/powerpcspe/gen/sigsetjmp.S
index 0c12cc3f582b..45c85c3fce23 100644
--- a/lib/libc/powerpcspe/gen/sigsetjmp.S
+++ b/lib/libc/powerpcspe/gen/sigsetjmp.S
@@ -26,8 +26,6 @@
/* $NetBSD: sigsetjmp.S,v 1.4 1998/10/03 12:30:38 tsubai Exp $ */
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
/*
* C library -- sigsetjmp, siglongjmp
*
diff --git a/lib/libc/powerpcspe/softfloat/milieu.h b/lib/libc/powerpcspe/softfloat/milieu.h
index e2e43b150073..6139aa58b982 100644
--- a/lib/libc/powerpcspe/softfloat/milieu.h
+++ b/lib/libc/powerpcspe/softfloat/milieu.h
@@ -1,5 +1,4 @@
/* $NetBSD: milieu.h,v 1.1 2000/12/29 20:13:54 bjh21 Exp $ */
-/* $FreeBSD$ */
/*
===============================================================================
diff --git a/lib/libc/powerpcspe/softfloat/powerpc-gcc.h b/lib/libc/powerpcspe/softfloat/powerpc-gcc.h
index e2f8680dd74e..d11198866e39 100644
--- a/lib/libc/powerpcspe/softfloat/powerpc-gcc.h
+++ b/lib/libc/powerpcspe/softfloat/powerpc-gcc.h
@@ -1,5 +1,4 @@
/* $NetBSD: arm-gcc.h,v 1.2 2001/02/21 18:09:25 bjh21 Exp $ */
-/* $FreeBSD$ */
/*
-------------------------------------------------------------------------------
diff --git a/lib/libc/powerpcspe/softfloat/softfloat.h b/lib/libc/powerpcspe/softfloat/softfloat.h
index 6b9c9b06956d..b20cb3e7aa00 100644
--- a/lib/libc/powerpcspe/softfloat/softfloat.h
+++ b/lib/libc/powerpcspe/softfloat/softfloat.h
@@ -1,5 +1,4 @@
/* $NetBSD: softfloat.h,v 1.6 2002/05/12 13:12:46 bjh21 Exp $ */
-/* $FreeBSD$ */
/* This is a derivative work. */
diff --git a/lib/libc/powerpcspe/sys/Makefile.inc b/lib/libc/powerpcspe/sys/Makefile.inc
deleted file mode 100644
index 7ddf4f89f05b..000000000000
--- a/lib/libc/powerpcspe/sys/Makefile.inc
+++ /dev/null
@@ -1,4 +0,0 @@
-# $FreeBSD$
-
-.PATH: ${LIBC_SRCTOP}/powerpc/sys
-.sinclude "${LIBC_SRCTOP}/powerpc/sys/Makefile.inc"
diff --git a/lib/libc/quad/Makefile.inc b/lib/libc/quad/Makefile.inc
index 94697faf2fdd..d70c2596f3f7 100644
--- a/lib/libc/quad/Makefile.inc
+++ b/lib/libc/quad/Makefile.inc
@@ -1,5 +1,3 @@
-# from @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
-# $FreeBSD$
# Quad support, if needed
.PATH: ${LIBC_SRCTOP}/${LIBC_ARCH}/quad ${LIBC_SRCTOP}/quad
diff --git a/lib/libc/quad/Symbol.map b/lib/libc/quad/Symbol.map
index 82ad9402a9ff..f7dcdebfc7ae 100644
--- a/lib/libc/quad/Symbol.map
+++ b/lib/libc/quad/Symbol.map
@@ -1,7 +1,3 @@
-/*
- * $FreeBSD$
- */
-
FBSD_1.0 {
/*
* These symbols really shouldn't be exported since they should
@@ -9,12 +5,15 @@ FBSD_1.0 {
* broken and they expect to see them in libc. glibc exports
* them, but they do not appear to be exported in Solaris.
*/
+#ifndef __i386__
__adddi3;
__anddi3;
__ashldi3;
__ashrdi3;
+#endif
__cmpdi2;
__divdi3;
+#ifndef __i386__
__fixdfdi;
__fixsfdi;
__fixunsdfdi;
@@ -25,14 +24,21 @@ FBSD_1.0 {
__iordi3;
__lshldi3;
__lshrdi3;
+#endif
__moddi3;
+#ifndef __i386__
__muldi3;
__negdi2;
__one_cmpldi2;
+#endif
__qdivrem;
+#ifndef __i386__
__subdi3;
+#endif
__ucmpdi2;
__udivdi3;
__umoddi3;
+#ifndef __i386__
__xordi3;
+#endif
};
diff --git a/lib/libc/quad/TESTS/Makefile b/lib/libc/quad/TESTS/Makefile
index 5834f21e80d7..7bcbe4655059 100644
--- a/lib/libc/quad/TESTS/Makefile
+++ b/lib/libc/quad/TESTS/Makefile
@@ -1,4 +1,3 @@
-# @(#)Makefile 8.1 (Berkeley) 6/4/93
all: mul divrem
diff --git a/lib/libc/quad/TESTS/divrem.c b/lib/libc/quad/TESTS/divrem.c
index 74011bf55b5e..728c0786f464 100644
--- a/lib/libc/quad/TESTS/divrem.c
+++ b/lib/libc/quad/TESTS/divrem.c
@@ -33,18 +33,6 @@
* SUCH DAMAGE.
*/
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1992, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)divrem.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
main()
diff --git a/lib/libc/quad/TESTS/mul.c b/lib/libc/quad/TESTS/mul.c
index 408764f89885..9306284f3faf 100644
--- a/lib/libc/quad/TESTS/mul.c
+++ b/lib/libc/quad/TESTS/mul.c
@@ -33,18 +33,6 @@
* SUCH DAMAGE.
*/
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1992, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)mul.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
main()
diff --git a/lib/libc/quad/adddi3.c b/lib/libc/quad/adddi3.c
index 6aaaf828ccb6..15aa300455a7 100644
--- a/lib/libc/quad/adddi3.c
+++ b/lib/libc/quad/adddi3.c
@@ -33,12 +33,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)adddi3.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "quad.h"
/*
diff --git a/lib/libc/quad/anddi3.c b/lib/libc/quad/anddi3.c
index c0934571f2d3..3c4e1a320395 100644
--- a/lib/libc/quad/anddi3.c
+++ b/lib/libc/quad/anddi3.c
@@ -33,12 +33,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)anddi3.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "quad.h"
/*
diff --git a/lib/libc/quad/ashldi3.c b/lib/libc/quad/ashldi3.c
index cec1ce7ca136..13607351d302 100644
--- a/lib/libc/quad/ashldi3.c
+++ b/lib/libc/quad/ashldi3.c
@@ -33,12 +33,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)ashldi3.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "quad.h"
/*
diff --git a/lib/libc/quad/ashrdi3.c b/lib/libc/quad/ashrdi3.c
index db471e413cd9..d704b8e68195 100644
--- a/lib/libc/quad/ashrdi3.c
+++ b/lib/libc/quad/ashrdi3.c
@@ -33,12 +33,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)ashrdi3.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "quad.h"
/*
diff --git a/lib/libc/quad/cmpdi2.c b/lib/libc/quad/cmpdi2.c
index 08916702e1eb..7bd89af9f2d3 100644
--- a/lib/libc/quad/cmpdi2.c
+++ b/lib/libc/quad/cmpdi2.c
@@ -33,12 +33,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)cmpdi2.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "quad.h"
/*
diff --git a/lib/libc/quad/divdi3.c b/lib/libc/quad/divdi3.c
index c5b4a376477e..ec3100cf0992 100644
--- a/lib/libc/quad/divdi3.c
+++ b/lib/libc/quad/divdi3.c
@@ -33,12 +33,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)divdi3.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "quad.h"
/*
diff --git a/lib/libc/quad/fixdfdi.c b/lib/libc/quad/fixdfdi.c
index ddb3b23834c1..a30028d39d3d 100644
--- a/lib/libc/quad/fixdfdi.c
+++ b/lib/libc/quad/fixdfdi.c
@@ -33,12 +33,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fixdfdi.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "quad.h"
/*
diff --git a/lib/libc/quad/fixsfdi.c b/lib/libc/quad/fixsfdi.c
index 48cd5a1a6003..f800d3b40f93 100644
--- a/lib/libc/quad/fixsfdi.c
+++ b/lib/libc/quad/fixsfdi.c
@@ -33,12 +33,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fixsfdi.c 5.1 (Berkeley) 7/7/92";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "quad.h"
/*
diff --git a/lib/libc/quad/fixunsdfdi.c b/lib/libc/quad/fixunsdfdi.c
index 5d63d6cb6cbd..250b476385ed 100644
--- a/lib/libc/quad/fixunsdfdi.c
+++ b/lib/libc/quad/fixunsdfdi.c
@@ -33,12 +33,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fixunsdfdi.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "quad.h"
#define ONE_FOURTH (1L << (LONG_BITS - 2))
diff --git a/lib/libc/quad/fixunssfdi.c b/lib/libc/quad/fixunssfdi.c
index de560dd84cb3..114caa9d32a9 100644
--- a/lib/libc/quad/fixunssfdi.c
+++ b/lib/libc/quad/fixunssfdi.c
@@ -33,12 +33,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fixunssfdi.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "quad.h"
#define ONE_FOURTH (1L << (LONG_BITS - 2))
diff --git a/lib/libc/quad/floatdidf.c b/lib/libc/quad/floatdidf.c
index 6c71ee1889d7..d6d155ca3b85 100644
--- a/lib/libc/quad/floatdidf.c
+++ b/lib/libc/quad/floatdidf.c
@@ -33,12 +33,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)floatdidf.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "quad.h"
/*
diff --git a/lib/libc/quad/floatdisf.c b/lib/libc/quad/floatdisf.c
index 411e106ec4f0..ff50508a2038 100644
--- a/lib/libc/quad/floatdisf.c
+++ b/lib/libc/quad/floatdisf.c
@@ -33,12 +33,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)floatdisf.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "quad.h"
/*
diff --git a/lib/libc/quad/floatunsdidf.c b/lib/libc/quad/floatunsdidf.c
index b391b3a759e5..1bb122184134 100644
--- a/lib/libc/quad/floatunsdidf.c
+++ b/lib/libc/quad/floatunsdidf.c
@@ -33,12 +33,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)floatunsdidf.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "quad.h"
/*
diff --git a/lib/libc/quad/iordi3.c b/lib/libc/quad/iordi3.c
index 7d3232645326..3361e1d8764b 100644
--- a/lib/libc/quad/iordi3.c
+++ b/lib/libc/quad/iordi3.c
@@ -33,12 +33,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)iordi3.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "quad.h"
/*
diff --git a/lib/libc/quad/lshldi3.c b/lib/libc/quad/lshldi3.c
index d8c7593d49ec..ae8d2698bf4e 100644
--- a/lib/libc/quad/lshldi3.c
+++ b/lib/libc/quad/lshldi3.c
@@ -33,12 +33,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)lshldi3.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "quad.h"
/*
diff --git a/lib/libc/quad/lshrdi3.c b/lib/libc/quad/lshrdi3.c
index 05a2aa0540b0..13d55bdf2e08 100644
--- a/lib/libc/quad/lshrdi3.c
+++ b/lib/libc/quad/lshrdi3.c
@@ -33,12 +33,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)lshrdi3.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "quad.h"
/*
diff --git a/lib/libc/quad/moddi3.c b/lib/libc/quad/moddi3.c
index fc13b4da4067..919c83575ff2 100644
--- a/lib/libc/quad/moddi3.c
+++ b/lib/libc/quad/moddi3.c
@@ -33,12 +33,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)moddi3.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "quad.h"
/*
diff --git a/lib/libc/quad/muldi3.c b/lib/libc/quad/muldi3.c
index bb11ef798fb0..a39598fdbc97 100644
--- a/lib/libc/quad/muldi3.c
+++ b/lib/libc/quad/muldi3.c
@@ -33,12 +33,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)muldi3.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "quad.h"
/*
diff --git a/lib/libc/quad/negdi2.c b/lib/libc/quad/negdi2.c
index 476c32afb55e..ca716149ea93 100644
--- a/lib/libc/quad/negdi2.c
+++ b/lib/libc/quad/negdi2.c
@@ -33,12 +33,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)negdi2.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "quad.h"
/*
diff --git a/lib/libc/quad/notdi2.c b/lib/libc/quad/notdi2.c
index 18489f91b91f..522ce4a46a56 100644
--- a/lib/libc/quad/notdi2.c
+++ b/lib/libc/quad/notdi2.c
@@ -33,12 +33,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)notdi2.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "quad.h"
/*
diff --git a/lib/libc/quad/qdivrem.c b/lib/libc/quad/qdivrem.c
index ea09e7f43f16..67a0b510bb53 100644
--- a/lib/libc/quad/qdivrem.c
+++ b/lib/libc/quad/qdivrem.c
@@ -33,12 +33,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)qdivrem.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* Multiprecision divide. This algorithm is from Knuth vol. 2 (2nd ed),
* section 4.3.1, pp. 257--259.
@@ -94,7 +88,7 @@ __qdivrem(u_quad_t uq, u_quad_t vq, u_quad_t *arq)
/*
* Take care of special cases: divide by zero, and u < v.
*/
- if (vq == 0) {
+ if (__predict_false(vq == 0)) {
/* divide by zero. */
static volatile const unsigned int zero = 0;
diff --git a/lib/libc/quad/quad.h b/lib/libc/quad/quad.h
index a9f84470876e..12c576d3432c 100644
--- a/lib/libc/quad/quad.h
+++ b/lib/libc/quad/quad.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.
- *
- * @(#)quad.h 8.1 (Berkeley) 6/4/93
- * $FreeBSD$
*/
/*
diff --git a/lib/libc/quad/subdi3.c b/lib/libc/quad/subdi3.c
index 3622c323568c..5953f5fb814a 100644
--- a/lib/libc/quad/subdi3.c
+++ b/lib/libc/quad/subdi3.c
@@ -33,12 +33,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)subdi3.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "quad.h"
/*
diff --git a/lib/libc/quad/ucmpdi2.c b/lib/libc/quad/ucmpdi2.c
index 458f8ed00814..164005fb6616 100644
--- a/lib/libc/quad/ucmpdi2.c
+++ b/lib/libc/quad/ucmpdi2.c
@@ -33,12 +33,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)ucmpdi2.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "quad.h"
/*
diff --git a/lib/libc/quad/udivdi3.c b/lib/libc/quad/udivdi3.c
index 0e6f27edeb61..456de8509560 100644
--- a/lib/libc/quad/udivdi3.c
+++ b/lib/libc/quad/udivdi3.c
@@ -33,12 +33,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)udivdi3.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "quad.h"
/*
diff --git a/lib/libc/quad/umoddi3.c b/lib/libc/quad/umoddi3.c
index 7f45134213ae..3f36bd688040 100644
--- a/lib/libc/quad/umoddi3.c
+++ b/lib/libc/quad/umoddi3.c
@@ -33,12 +33,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)umoddi3.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "quad.h"
/*
diff --git a/lib/libc/quad/xordi3.c b/lib/libc/quad/xordi3.c
index e956ade4607f..b765b223218f 100644
--- a/lib/libc/quad/xordi3.c
+++ b/lib/libc/quad/xordi3.c
@@ -33,12 +33,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)xordi3.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "quad.h"
/*
diff --git a/lib/libc/regex/COPYRIGHT b/lib/libc/regex/COPYRIGHT
index 574f6bcec6c7..9f3893e48f98 100644
--- a/lib/libc/regex/COPYRIGHT
+++ b/lib/libc/regex/COPYRIGHT
@@ -51,6 +51,4 @@ to the following restrictions:
* 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.
- *
- * @(#)COPYRIGHT 8.1 (Berkeley) 3/16/94
*/
diff --git a/lib/libc/regex/Makefile.inc b/lib/libc/regex/Makefile.inc
index 19c2ffcee5ab..9fa541ab4cd0 100644
--- a/lib/libc/regex/Makefile.inc
+++ b/lib/libc/regex/Makefile.inc
@@ -1,5 +1,3 @@
-# from @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
-# $FreeBSD$
# regex sources
.PATH: ${LIBC_SRCTOP}/regex
diff --git a/lib/libc/regex/Symbol.map b/lib/libc/regex/Symbol.map
index 1da7b81ba11b..436398f639c7 100644
--- a/lib/libc/regex/Symbol.map
+++ b/lib/libc/regex/Symbol.map
@@ -1,7 +1,3 @@
-/*
- * $FreeBSD$
- */
-
FBSD_1.0 {
regerror;
regexec;
diff --git a/lib/libc/regex/WHATSNEW b/lib/libc/regex/WHATSNEW
index f4301d300dd3..0bd305c32cb9 100644
--- a/lib/libc/regex/WHATSNEW
+++ b/lib/libc/regex/WHATSNEW
@@ -1,4 +1,3 @@
-# @(#)WHATSNEW 8.3 (Berkeley) 3/18/94
New in alpha3.4: The complex bug alluded to below has been fixed (in a
slightly kludgey temporary way that may hurt efficiency a bit; this is
diff --git a/lib/libc/regex/cname.h b/lib/libc/regex/cname.h
index 3419181aac97..e1b76d36e589 100644
--- a/lib/libc/regex/cname.h
+++ b/lib/libc/regex/cname.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.
- *
- * @(#)cname.h 8.3 (Berkeley) 3/20/94
- * $FreeBSD$
*/
/* character-name table */
diff --git a/lib/libc/regex/engine.c b/lib/libc/regex/engine.c
index bb40018c07e1..9e1935dc4d4a 100644
--- a/lib/libc/regex/engine.c
+++ b/lib/libc/regex/engine.c
@@ -31,13 +31,8 @@
* 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.
- *
- * @(#)engine.c 8.5 (Berkeley) 3/20/94
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdbool.h>
/*
diff --git a/lib/libc/regex/grot/Makefile b/lib/libc/regex/grot/Makefile
index d0123883cd2e..ec6a1b48b1e7 100644
--- a/lib/libc/regex/grot/Makefile
+++ b/lib/libc/regex/grot/Makefile
@@ -1,4 +1,3 @@
-# $FreeBSD$
# You probably want to take -DREDEBUG out of CFLAGS, and put something like
# -O in, *after* testing (-DREDEBUG strengthens testing by enabling a lot of
# internal assertion checking). Take -Dconst= out for an ANSI compiler.
diff --git a/lib/libc/regex/grot/debug.c b/lib/libc/regex/grot/debug.c
index af8e4f5a1d72..f5984366f3c6 100644
--- a/lib/libc/regex/grot/debug.c
+++ b/lib/libc/regex/grot/debug.c
@@ -1,6 +1,3 @@
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
#include <string.h>
#include <ctype.h>
diff --git a/lib/libc/regex/grot/main.c b/lib/libc/regex/grot/main.c
index eee541bac171..e9d57c84e6f4 100644
--- a/lib/libc/regex/grot/main.c
+++ b/lib/libc/regex/grot/main.c
@@ -1,6 +1,3 @@
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <assert.h>
#include <regex.h>
diff --git a/lib/libc/regex/grot/mkh b/lib/libc/regex/grot/mkh
index 1deba7983d5c..252b246c7bd2 100755
--- a/lib/libc/regex/grot/mkh
+++ b/lib/libc/regex/grot/mkh
@@ -1,6 +1,5 @@
#! /bin/sh
# mkh - pull headers out of C source
-# $FreeBSD$
PATH=/bin:/usr/bin ; export PATH
# egrep pattern to pick out marked lines
diff --git a/lib/libc/regex/grot/split.c b/lib/libc/regex/grot/split.c
index c5d5264ab711..37d593e5eb4f 100644
--- a/lib/libc/regex/grot/split.c
+++ b/lib/libc/regex/grot/split.c
@@ -1,6 +1,3 @@
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
#include <string.h>
diff --git a/lib/libc/regex/grot/tests b/lib/libc/regex/grot/tests
index 050e7b25ab14..7bd81706bed4 100644
--- a/lib/libc/regex/grot/tests
+++ b/lib/libc/regex/grot/tests
@@ -1,5 +1,4 @@
# regular expression test set
-# $FreeBSD$
# Lines are at least three fields, separated by one or more tabs. "" stands
# for an empty field. First field is an RE. Second field is flags. If
# C flag given, regcomp() is expected to fail, and the third field is the
diff --git a/lib/libc/regex/re_format.7 b/lib/libc/regex/re_format.7
index 8380fd89e222..ed8572b17e62 100644
--- a/lib/libc/regex/re_format.7
+++ b/lib/libc/regex/re_format.7
@@ -33,9 +33,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)re_format.7 8.3 (Berkeley) 3/20/94
-.\" $FreeBSD$
-.\"
.Dd June 30, 2014
.Dt RE_FORMAT 7
.Os
diff --git a/lib/libc/regex/regcomp.c b/lib/libc/regex/regcomp.c
index 970a448b649a..7481d3ecf240 100644
--- a/lib/libc/regex/regcomp.c
+++ b/lib/libc/regex/regcomp.c
@@ -6,7 +6,7 @@
* The Regents of the University of California. All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -36,16 +36,8 @@
* 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.
- *
- * @(#)regcomp.c 8.5 (Berkeley) 3/20/94
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)regcomp.c 8.5 (Berkeley) 3/20/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <stdio.h>
#include <string.h>
@@ -329,7 +321,7 @@ regcomp_internal(regex_t * __restrict preg,
computejumps(p, g);
computematchjumps(p, g);
if(g->matchjump == NULL && g->charjump != NULL) {
- free(g->charjump);
+ free(&g->charjump[CHAR_MIN]);
g->charjump = NULL;
}
}
@@ -830,10 +822,10 @@ p_simp_re(struct parse *p, struct branchc *bc)
handled = false;
assert(MORE()); /* caller should have ensured this */
- c = GETNEXT();
+ c = (uch)GETNEXT();
if (c == '\\') {
(void)REQUIRE(MORE(), REG_EESCAPE);
- cc = GETNEXT();
+ cc = (uch)GETNEXT();
c = BACKSL | cc;
#ifdef LIBREGEX
if (p->gnuext) {
@@ -994,7 +986,7 @@ p_count(struct parse *p)
int ndigits = 0;
while (MORE() && isdigit((uch)PEEK()) && count <= DUPMAX) {
- count = count*10 + (GETNEXT() - '0');
+ count = count*10 + ((uch)GETNEXT() - '0');
ndigits++;
}
@@ -1304,7 +1296,7 @@ may_escape(struct parse *p, const wint_t ch)
if ((p->pflags & PFLAG_LEGACY_ESC) != 0)
return (true);
- if (isalpha(ch) || ch == '\'' || ch == '`')
+ if (iswalpha(ch) || ch == '\'' || ch == '`')
return (false);
return (true);
#ifdef NOTYET
@@ -1594,17 +1586,32 @@ singleton(cset *cs)
{
wint_t i, s, n;
+ /* Exclude the complicated cases we don't want to deal with */
+ if (cs->nranges != 0 || cs->ntypes != 0 || cs->icase != 0)
+ return (OUT);
+
+ if (cs->nwides > 1)
+ return (OUT);
+
+ /* Count the number of characters present in the bitmap */
for (i = n = 0; i < NC; i++)
if (CHIN(cs, i)) {
n++;
s = i;
}
- if (n == 1)
- return (s);
- if (cs->nwides == 1 && cs->nranges == 0 && cs->ntypes == 0 &&
- cs->icase == 0)
+
+ if (n > 1)
+ return (OUT);
+
+ if (n == 1) {
+ if (cs->nwides == 0)
+ return (s);
+ else
+ return (OUT);
+ }
+ if (cs->nwides == 1)
return (cs->wides[0]);
- /* Don't bother handling the other cases. */
+
return (OUT);
}
diff --git a/lib/libc/regex/regerror.c b/lib/libc/regex/regerror.c
index 0e555784f0dc..b21e7ac3517b 100644
--- a/lib/libc/regex/regerror.c
+++ b/lib/libc/regex/regerror.c
@@ -31,16 +31,8 @@
* 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.
- *
- * @(#)regerror.c 8.4 (Berkeley) 3/20/94
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)regerror.c 8.4 (Berkeley) 3/20/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <stdio.h>
#include <string.h>
diff --git a/lib/libc/regex/regex.3 b/lib/libc/regex/regex.3
index d22dec1e87f7..3c9fb4da4185 100644
--- a/lib/libc/regex/regex.3
+++ b/lib/libc/regex/regex.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)regex.3 8.4 (Berkeley) 3/20/94
-.\" $FreeBSD$
-.\"
.Dd April 15, 2017
.Dt REGEX 3
.Os
diff --git a/lib/libc/regex/regex2.h b/lib/libc/regex/regex2.h
index 38bbed90fd8f..f5854d916a2c 100644
--- a/lib/libc/regex/regex2.h
+++ b/lib/libc/regex/regex2.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.
- *
- * @(#)regex2.h 8.4 (Berkeley) 3/20/94
- * $FreeBSD$
*/
/*
diff --git a/lib/libc/regex/regexec.c b/lib/libc/regex/regexec.c
index bf27d05f86c6..784e596d5f8a 100644
--- a/lib/libc/regex/regexec.c
+++ b/lib/libc/regex/regexec.c
@@ -31,16 +31,8 @@
* 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.
- *
- * @(#)regexec.c 8.3 (Berkeley) 3/20/94
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)regexec.c 8.3 (Berkeley) 3/20/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* the outer shell of regexec()
*
@@ -97,8 +89,8 @@ xmbrtowc_dummy(wint_t *wi,
}
/* macros for manipulating states, small version */
-#define states long
-#define states1 states /* for later use in regexec() decision */
+#define states1 long /* for later use in regexec() decision */
+#define states states1
#define CLEAR(v) ((v) = 0)
#define SET0(v, n) ((v) &= ~((unsigned long)1 << (n)))
#define SET1(v, n) ((v) |= (unsigned long)1 << (n))
diff --git a/lib/libc/regex/regfree.c b/lib/libc/regex/regfree.c
index 859c2a4b37b2..e87314772a6c 100644
--- a/lib/libc/regex/regfree.c
+++ b/lib/libc/regex/regfree.c
@@ -31,16 +31,8 @@
* 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.
- *
- * @(#)regfree.c 8.3 (Berkeley) 3/20/94
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)regfree.c 8.3 (Berkeley) 3/20/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/lib/libc/regex/utils.h b/lib/libc/regex/utils.h
index 72f2286a0260..611decbb3b38 100644
--- a/lib/libc/regex/utils.h
+++ b/lib/libc/regex/utils.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.
- *
- * @(#)utils.h 8.3 (Berkeley) 3/20/94
- * $FreeBSD$
*/
/* utility definitions */
diff --git a/lib/libc/resolv/Makefile.inc b/lib/libc/resolv/Makefile.inc
index 9bb7bbe46d29..ea5e1927a9c2 100644
--- a/lib/libc/resolv/Makefile.inc
+++ b/lib/libc/resolv/Makefile.inc
@@ -1,4 +1,3 @@
-# $FreeBSD$
# resolv sources
.PATH: ${LIBC_SRCTOP}/resolv
diff --git a/lib/libc/resolv/Symbol.map b/lib/libc/resolv/Symbol.map
index 170333343cf0..6b9c43298fb5 100644
--- a/lib/libc/resolv/Symbol.map
+++ b/lib/libc/resolv/Symbol.map
@@ -1,7 +1,3 @@
-/*
- * $FreeBSD$
- */
-
FBSD_1.0 {
/* h_nerr; */ /* Why is this not staticized in net/herror.c? */
h_errlist;
diff --git a/lib/libc/resolv/h_errno.c b/lib/libc/resolv/h_errno.c
index 06ea60390d40..5ac0494ebc06 100644
--- a/lib/libc/resolv/h_errno.c
+++ b/lib/libc/resolv/h_errno.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2006 The FreeBSD Project. All rights reserved.
*
@@ -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$
*/
#include <sys/types.h>
diff --git a/lib/libc/resolv/herror.c b/lib/libc/resolv/herror.c
index aa6d61496621..def4057b3c18 100644
--- a/lib/libc/resolv/herror.c
+++ b/lib/libc/resolv/herror.c
@@ -46,13 +46,6 @@
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char sccsid[] = "@(#)herror.c 8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$Id: herror.c,v 1.4 2005/04/27 04:56:41 sra Exp $";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "port_before.h"
#include "namespace.h"
diff --git a/lib/libc/resolv/mtctxres.c b/lib/libc/resolv/mtctxres.c
index c2aea381761d..beb2b6b3f5dd 100644
--- a/lib/libc/resolv/mtctxres.c
+++ b/lib/libc/resolv/mtctxres.c
@@ -1,6 +1,3 @@
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <port_before.h>
#ifdef DO_PTHREADS
#include <pthread.h>
diff --git a/lib/libc/resolv/res_comp.c b/lib/libc/resolv/res_comp.c
index 1048ef453fe0..55b71266b4ae 100644
--- a/lib/libc/resolv/res_comp.c
+++ b/lib/libc/resolv/res_comp.c
@@ -66,13 +66,6 @@
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char sccsid[] = "@(#)res_comp.c 8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$Id: res_comp.c,v 1.5 2005/07/28 06:51:50 marka Exp $";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "port_before.h"
#include <sys/param.h>
#include <netinet/in.h>
diff --git a/lib/libc/resolv/res_data.c b/lib/libc/resolv/res_data.c
index a04749b9a3f5..b6e3008c4e35 100644
--- a/lib/libc/resolv/res_data.c
+++ b/lib/libc/resolv/res_data.c
@@ -17,12 +17,6 @@
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: res_data.c,v 1.7 2008/12/11 09:59:00 marka Exp $";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "port_before.h"
#include <sys/param.h>
diff --git a/lib/libc/resolv/res_debug.c b/lib/libc/resolv/res_debug.c
index 218056d51f81..520fe4986c80 100644
--- a/lib/libc/resolv/res_debug.c
+++ b/lib/libc/resolv/res_debug.c
@@ -91,13 +91,6 @@
* IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$Id: res_debug.c,v 1.19 2009/02/26 11:20:20 tbox Exp $";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "port_before.h"
#include <sys/param.h>
diff --git a/lib/libc/resolv/res_debug.h b/lib/libc/resolv/res_debug.h
index 088046ad0d5e..dd048116fb49 100644
--- a/lib/libc/resolv/res_debug.h
+++ b/lib/libc/resolv/res_debug.h
@@ -15,8 +15,6 @@
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * $FreeBSD$
*/
#ifndef _RES_DEBUG_H_
diff --git a/lib/libc/resolv/res_findzonecut.c b/lib/libc/resolv/res_findzonecut.c
index d08f6dbe7dbd..a78b08302057 100644
--- a/lib/libc/resolv/res_findzonecut.c
+++ b/lib/libc/resolv/res_findzonecut.c
@@ -1,6 +1,3 @@
-#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: res_findzonecut.c,v 1.10 2005/10/11 00:10:16 marka Exp $";
-#endif /* not lint */
/*-
* SPDX-License-Identifier: ISC
@@ -21,9 +18,6 @@ static const char rcsid[] = "$Id: res_findzonecut.c,v 1.10 2005/10/11 00:10:16 m
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/* Import. */
#include "port_before.h"
diff --git a/lib/libc/resolv/res_init.c b/lib/libc/resolv/res_init.c
index 515c86c2378d..70d6bc6d3bf2 100644
--- a/lib/libc/resolv/res_init.c
+++ b/lib/libc/resolv/res_init.c
@@ -66,13 +66,6 @@
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93";
-static const char rcsid[] = "$Id: res_init.c,v 1.26 2008/12/11 09:59:00 marka Exp $";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "port_before.h"
#include "namespace.h"
@@ -202,11 +195,7 @@ __res_vinit(res_state statp, int preinit) {
statp->id = res_nrandomid(statp);
memset(u, 0, sizeof(u));
-#ifdef USELOOPBACK
- u[nserv].sin.sin_addr = inet_makeaddr(IN_LOOPBACKNET, 1);
-#else
u[nserv].sin.sin_addr.s_addr = INADDR_ANY;
-#endif
u[nserv].sin.sin_family = AF_INET;
u[nserv].sin.sin_port = htons(NAMESERVER_PORT);
#ifdef HAVE_SA_LEN
@@ -214,11 +203,7 @@ __res_vinit(res_state statp, int preinit) {
#endif
nserv++;
#ifdef HAS_INET6_STRUCTS
-#ifdef USELOOPBACK
- u[nserv].sin6.sin6_addr = in6addr_loopback;
-#else
u[nserv].sin6.sin6_addr = in6addr_any;
-#endif
u[nserv].sin6.sin6_family = AF_INET6;
u[nserv].sin6.sin6_port = htons(NAMESERVER_PORT);
#ifdef HAVE_SA_LEN
@@ -285,7 +270,7 @@ __res_vinit(res_state statp, int preinit) {
#endif /* SOLARIS2 */
/* Allow user to override the local domain definition */
- if (issetugid() == 0 && (cp = getenv("LOCALDOMAIN")) != NULL) {
+ if ((cp = secure_getenv("LOCALDOMAIN")) != NULL) {
(void)strncpy(statp->defdname, cp, sizeof(statp->defdname) - 1);
statp->defdname[sizeof(statp->defdname) - 1] = '\0';
haveenv++;
diff --git a/lib/libc/resolv/res_mkquery.c b/lib/libc/resolv/res_mkquery.c
index 3b009085af6c..0c15def5d117 100644
--- a/lib/libc/resolv/res_mkquery.c
+++ b/lib/libc/resolv/res_mkquery.c
@@ -66,13 +66,6 @@
* SOFTWARE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char sccsid[] = "@(#)res_mkquery.c 8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$Id: res_mkquery.c,v 1.10 2008/12/11 09:59:00 marka Exp $";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "port_before.h"
#include <sys/param.h>
#include <netinet/in.h>
@@ -258,7 +251,7 @@ res_nopt(res_state statp,
}
/*
- * Construct variable data (RDATA) block for OPT psuedo-RR, append it
+ * Construct variable data (RDATA) block for OPT pseudo-RR, append it
* to the buffer, then update the RDLEN field (previously set to zero by
* res_nopt()) with the new RDATA length.
*/
diff --git a/lib/libc/resolv/res_mkupdate.c b/lib/libc/resolv/res_mkupdate.c
index 80e8ab2b0e0f..e5a3cb702cda 100644
--- a/lib/libc/resolv/res_mkupdate.c
+++ b/lib/libc/resolv/res_mkupdate.c
@@ -23,12 +23,6 @@
* &lt;viraj_bais@ccm.fm.intel.com>
*/
-#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: res_mkupdate.c,v 1.10 2008/12/11 09:59:00 marka Exp $";
-#endif /* not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "port_before.h"
#include <sys/param.h>
diff --git a/lib/libc/resolv/res_private.h b/lib/libc/resolv/res_private.h
index a986e95ce2eb..0b86f6c742a1 100644
--- a/lib/libc/resolv/res_private.h
+++ b/lib/libc/resolv/res_private.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
#ifndef res_private_h
#define res_private_h
diff --git a/lib/libc/resolv/res_query.c b/lib/libc/resolv/res_query.c
index 8270e26ecdfb..e9c628ad8d47 100644
--- a/lib/libc/resolv/res_query.c
+++ b/lib/libc/resolv/res_query.c
@@ -66,13 +66,6 @@
* SOFTWARE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char sccsid[] = "@(#)res_query.c 8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$Id: res_query.c,v 1.11 2008/11/14 02:36:51 marka Exp $";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "port_before.h"
#include <sys/param.h>
#include <netinet/in.h>
@@ -457,9 +450,7 @@ res_hostalias(const res_state statp, const char *name, char *dst, size_t siz) {
if (statp->options & RES_NOALIASES)
return (NULL);
- if (issetugid())
- return (NULL);
- file = getenv("HOSTALIASES");
+ file = secure_getenv("HOSTALIASES");
if (file == NULL || (fp = fopen(file, "re")) == NULL)
return (NULL);
setbuf(fp, NULL);
diff --git a/lib/libc/resolv/res_send.c b/lib/libc/resolv/res_send.c
index 366ec394a59e..3fb627b83d55 100644
--- a/lib/libc/resolv/res_send.c
+++ b/lib/libc/resolv/res_send.c
@@ -66,13 +66,6 @@
* SOFTWARE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$Id: res_send.c,v 1.22 2009/01/22 23:49:23 tbox Exp $";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*! \file
* \brief
* Send query to name server and wait for reply.
diff --git a/lib/libc/resolv/res_state.c b/lib/libc/resolv/res_state.c
index 976d09c2cbaf..9a0226a05ace 100644
--- a/lib/libc/resolv/res_state.c
+++ b/lib/libc/resolv/res_state.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2006 The FreeBSD Project. All rights reserved.
*
@@ -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$
*/
#include <sys/types.h>
diff --git a/lib/libc/resolv/res_update.c b/lib/libc/resolv/res_update.c
index 388f643996dc..f8f13bf495f9 100644
--- a/lib/libc/resolv/res_update.c
+++ b/lib/libc/resolv/res_update.c
@@ -1,6 +1,3 @@
-#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: res_update.c,v 1.13 2005/04/27 04:56:43 sra Exp $";
-#endif /* not lint */
/*-
* SPDX-License-Identifier: ISC
@@ -27,9 +24,6 @@ static const char rcsid[] = "$Id: res_update.c,v 1.13 2005/04/27 04:56:43 sra Ex
* &lt;viraj_bais@ccm.fm.intel.com>
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "port_before.h"
#include <sys/param.h>
diff --git a/lib/libc/riscv/Makefile.inc b/lib/libc/riscv/Makefile.inc
index 9df72b44a619..be6dbc67a807 100644
--- a/lib/libc/riscv/Makefile.inc
+++ b/lib/libc/riscv/Makefile.inc
@@ -1,4 +1,3 @@
-# $FreeBSD$
#
# Machine dependent definitions for the RISC-V architecture.
#
diff --git a/lib/libc/riscv/SYS.h b/lib/libc/riscv/SYS.h
deleted file mode 100644
index 7339b70ff94e..000000000000
--- a/lib/libc/riscv/SYS.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*-
- * Copyright (c) 2014 Andrew Turner
- * Copyright (c) 2015 Ruslan Bukin <br@bsdpad.com>
- * All rights reserved.
- *
- * Portions of this software were developed by SRI International and the
- * University of Cambridge Computer Laboratory under DARPA/AFRL contract
- * FA8750-10-C-0237 ("CTSRD"), as part of the DARPA CRASH research programme.
- *
- * Portions of this software were developed by the University of Cambridge
- * Computer Laboratory as part of the CTSRD Project, with support from the
- * UK Higher Education Innovation Fund (HEIF).
- *
- * 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 AUTHOR 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 AUTHOR 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.
- *
- * $FreeBSD$
- */
-
-#include <sys/syscall.h>
-#include <machine/asm.h>
-
-#define _SYSCALL(name) \
- li t0, SYS_ ## name; \
- ecall
-
-#define SYSCALL(name) \
-ENTRY(__sys_##name); \
- WEAK_REFERENCE(__sys_##name, name); \
- WEAK_REFERENCE(__sys_##name, _##name); \
- _SYSCALL(name); \
- ret; \
-END(__sys_##name)
-
-#define PSEUDO(name) \
-ENTRY(__sys_##name); \
- WEAK_REFERENCE(__sys_##name, _##name); \
- _SYSCALL(name); \
- bnez t0, 1f; \
- ret; \
-1: la t1, cerror; \
- jr t1; \
-END(__sys_##name)
-
-#define RSYSCALL(name) \
-ENTRY(__sys_##name); \
- WEAK_REFERENCE(__sys_##name, name); \
- WEAK_REFERENCE(__sys_##name, _##name); \
- _SYSCALL(name); \
- bnez t0, 1f; \
- ret; \
-1: la t1, cerror; \
- jr t1; \
-END(__sys_##name)
diff --git a/lib/libc/riscv/Symbol.map b/lib/libc/riscv/Symbol.map
index d9121798140c..bebcecb879f4 100644
--- a/lib/libc/riscv/Symbol.map
+++ b/lib/libc/riscv/Symbol.map
@@ -1,37 +1,10 @@
/*
- * $FreeBSD$
- */
-
-/*
* This only needs to contain symbols that are not listed in
* symbol maps from other parts of libc (i.e., not found in
* stdlib/Symbol.map, string/Symbol.map, sys/Symbol.map, ...).
*/
FBSD_1.0 {
- /* PSEUDO syscalls */
- _exit;
-
- _setjmp;
- _longjmp;
- fabs;
__flt_rounds;
fpgetmask;
fpsetmask;
- __infinity;
- __nan;
- setjmp;
- longjmp;
- sigsetjmp;
- siglongjmp;
- htonl;
- htons;
- ntohl;
- ntohs;
- vfork;
- makecontext;
-};
-
-FBSDprivate_1.0 {
- _set_tp;
- __makecontext;
};
diff --git a/lib/libc/riscv/_fpmath.h b/lib/libc/riscv/_fpmath.h
index be5be56acaa6..3bb741e70350 100644
--- a/lib/libc/riscv/_fpmath.h
+++ b/lib/libc/riscv/_fpmath.h
@@ -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$
*/
union IEEEl2bits {
diff --git a/lib/libc/riscv/arith.h b/lib/libc/riscv/arith.h
index ecb1a33fccb0..9c695c74a33e 100644
--- a/lib/libc/riscv/arith.h
+++ b/lib/libc/riscv/arith.h
@@ -1,7 +1,5 @@
/*
* MD header for contrib/gdtoa
- *
- * $FreeBSD$
*/
/*
diff --git a/lib/libc/riscv/gd_qnan.h b/lib/libc/riscv/gd_qnan.h
index cb375dd87173..66e48706d6bb 100644
--- a/lib/libc/riscv/gd_qnan.h
+++ b/lib/libc/riscv/gd_qnan.h
@@ -3,8 +3,6 @@
*
* This file can be generated by compiling and running contrib/gdtoa/qnan.c
* on the target architecture after arith.h has been generated.
- *
- * $FreeBSD$
*/
#define f_QNAN 0x7fc00000
diff --git a/lib/libc/riscv/gen/Makefile.inc b/lib/libc/riscv/gen/Makefile.inc
index 1c1a90bda730..71bb6a42bbd1 100644
--- a/lib/libc/riscv/gen/Makefile.inc
+++ b/lib/libc/riscv/gen/Makefile.inc
@@ -1,18 +1,13 @@
-# $FreeBSD$
SRCS+= _ctx_start.S \
fabs.S \
flt_rounds.c \
fpgetmask.c \
fpsetmask.c \
- _get_tp.c \
infinity.c \
ldexp.c \
makecontext.c \
_setjmp.S \
- _set_tp.c \
setjmp.S \
sigsetjmp.S \
trivial-getcontextx.c
-
-CFLAGS._get_tp.c+= ${RTLD_HDRS}
diff --git a/lib/libc/riscv/gen/_ctx_start.S b/lib/libc/riscv/gen/_ctx_start.S
index cda5397ac22d..69d19fc9403b 100644
--- a/lib/libc/riscv/gen/_ctx_start.S
+++ b/lib/libc/riscv/gen/_ctx_start.S
@@ -33,8 +33,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
ENTRY(_ctx_start)
jalr s0 /* Call func from makecontext */
mv a0, s1 /* Load ucp saved in makecontext */
diff --git a/lib/libc/riscv/gen/_get_tp.c b/lib/libc/riscv/gen/_get_tp.c
deleted file mode 100644
index 0477e3ab8ca9..000000000000
--- a/lib/libc/riscv/gen/_get_tp.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 2021 The FreeBSD Foundation
- *
- * This software were developed by Konstantin Belousov
- * under sponsorship from the FreeBSD Foundation.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <string.h>
-#include <stdint.h>
-#include "libc_private.h"
-#include "rtld.h"
-
-void *
-_get_tp(void)
-{
- Elf_Addr tp;
-
- __asm __volatile("mv %0, tp" : "=r" (tp));
- return ((void *)(tp - TLS_TP_OFFSET - TLS_TCB_SIZE));
-}
diff --git a/lib/libc/riscv/gen/_set_tp.c b/lib/libc/riscv/gen/_set_tp.c
deleted file mode 100644
index 49295e26857c..000000000000
--- a/lib/libc/riscv/gen/_set_tp.c
+++ /dev/null
@@ -1,51 +0,0 @@
-/*-
- * Copyright (c) 2015 Ruslan Bukin <br@bsdpad.com>
- * All rights reserved.
- *
- * Portions of this software were developed by SRI International and the
- * University of Cambridge Computer Laboratory under DARPA/AFRL contract
- * FA8750-10-C-0237 ("CTSRD"), as part of the DARPA CRASH research programme.
- *
- * Portions of this software were developed by the University of Cambridge
- * Computer Laboratory as part of the CTSRD Project, with support from the
- * UK Higher Education Innovation Fund (HEIF).
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <string.h>
-#include <sys/types.h>
-
-#include <stdlib.h>
-
-/* NB: size of 'struct tcb'. */
-#define TP_OFFSET (sizeof(void *) * 2)
-
-void
-_set_tp(void *tp)
-{
-
- __asm __volatile("addi tp, %0, %1" :: "r" (tp), "I" (TP_OFFSET));
-}
diff --git a/lib/libc/riscv/gen/_setjmp.S b/lib/libc/riscv/gen/_setjmp.S
index ded6705ef7ee..4554f736f72a 100644
--- a/lib/libc/riscv/gen/_setjmp.S
+++ b/lib/libc/riscv/gen/_setjmp.S
@@ -33,8 +33,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
#include <machine/setjmp.h>
ENTRY(_setjmp)
@@ -131,6 +129,9 @@ ENTRY(_longjmp)
/* Load the return value */
mv a0, a1
+ bnez a1, 1f
+ li a0, 1
+1:
ret
botch:
diff --git a/lib/libc/riscv/gen/fabs.S b/lib/libc/riscv/gen/fabs.S
index 036d50eddf90..21304036fc0f 100644
--- a/lib/libc/riscv/gen/fabs.S
+++ b/lib/libc/riscv/gen/fabs.S
@@ -37,8 +37,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
ENTRY(fabs)
#ifdef __riscv_float_abi_double
fabs.d fa0, fa0
diff --git a/lib/libc/riscv/gen/flt_rounds.c b/lib/libc/riscv/gen/flt_rounds.c
index 5dec6e45f400..bccd7d8baa44 100644
--- a/lib/libc/riscv/gen/flt_rounds.c
+++ b/lib/libc/riscv/gen/flt_rounds.c
@@ -32,30 +32,17 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <fenv.h>
#include <float.h>
-#ifdef __riscv_float_abi_soft
-#include "softfloat-for-gcc.h"
-#include "milieu.h"
-#include "softfloat.h"
-#endif
-
int
__flt_rounds(void)
{
uint64_t mode;
-#ifdef __riscv_float_abi_soft
- mode = __softfloat_float_rounding_mode;
-#else
__asm __volatile("csrr %0, fcsr" : "=r" (mode));
-#endif
switch (mode & _ROUND_MASK) {
case FE_TOWARDZERO:
diff --git a/lib/libc/riscv/gen/fpgetmask.c b/lib/libc/riscv/gen/fpgetmask.c
index f461cc2ba10e..7835a17cff60 100644
--- a/lib/libc/riscv/gen/fpgetmask.c
+++ b/lib/libc/riscv/gen/fpgetmask.c
@@ -27,9 +27,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <ieeefp.h>
diff --git a/lib/libc/riscv/gen/fpsetmask.c b/lib/libc/riscv/gen/fpsetmask.c
index 6eeac9de8bef..024f1fd8d8bc 100644
--- a/lib/libc/riscv/gen/fpsetmask.c
+++ b/lib/libc/riscv/gen/fpsetmask.c
@@ -27,9 +27,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <ieeefp.h>
diff --git a/lib/libc/riscv/gen/infinity.c b/lib/libc/riscv/gen/infinity.c
index 115c4702d895..ae44d5195a3b 100644
--- a/lib/libc/riscv/gen/infinity.c
+++ b/lib/libc/riscv/gen/infinity.c
@@ -2,9 +2,6 @@
* infinity.c
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <math.h>
/* bytes for +Infinity on riscv */
diff --git a/lib/libc/riscv/gen/makecontext.c b/lib/libc/riscv/gen/makecontext.c
index 3633a5dd66e1..e5371d082b2c 100644
--- a/lib/libc/riscv/gen/makecontext.c
+++ b/lib/libc/riscv/gen/makecontext.c
@@ -32,9 +32,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <machine/riscvreg.h>
diff --git a/lib/libc/riscv/gen/setjmp.S b/lib/libc/riscv/gen/setjmp.S
index c0458e907ce0..efac05ecc611 100644
--- a/lib/libc/riscv/gen/setjmp.S
+++ b/lib/libc/riscv/gen/setjmp.S
@@ -33,8 +33,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
#include <machine/setjmp.h>
ENTRY(setjmp)
@@ -161,6 +159,9 @@ ENTRY(longjmp)
/* Load the return value */
mv a0, a1
+ bnez a1, 1f
+ li a0, 1
+1:
ret
botch:
diff --git a/lib/libc/riscv/gen/sigsetjmp.S b/lib/libc/riscv/gen/sigsetjmp.S
index 6eca3c1cdd23..4f32d9fb4daf 100644
--- a/lib/libc/riscv/gen/sigsetjmp.S
+++ b/lib/libc/riscv/gen/sigsetjmp.S
@@ -33,8 +33,6 @@
*/
#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
#include <machine/setjmp.h>
ENTRY(sigsetjmp)
diff --git a/lib/libc/riscv/softfloat/milieu.h b/lib/libc/riscv/softfloat/milieu.h
index e97437bdc2d1..0b5fda35de30 100644
--- a/lib/libc/riscv/softfloat/milieu.h
+++ b/lib/libc/riscv/softfloat/milieu.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/*
===============================================================================
diff --git a/lib/libc/riscv/softfloat/riscv-gcc.h b/lib/libc/riscv/softfloat/riscv-gcc.h
index 3fe1767e63cc..945536012289 100644
--- a/lib/libc/riscv/softfloat/riscv-gcc.h
+++ b/lib/libc/riscv/softfloat/riscv-gcc.h
@@ -1,5 +1,4 @@
/* $NetBSD: arm-gcc.h,v 1.2 2001/02/21 18:09:25 bjh21 Exp $ */
-/* $FreeBSD$ */
/*
-------------------------------------------------------------------------------
diff --git a/lib/libc/riscv/softfloat/softfloat.h b/lib/libc/riscv/softfloat/softfloat.h
index 6aef49975a38..d202a1f7f420 100644
--- a/lib/libc/riscv/softfloat/softfloat.h
+++ b/lib/libc/riscv/softfloat/softfloat.h
@@ -1,5 +1,4 @@
/* $NetBSD: softfloat.h,v 1.6 2002/05/12 13:12:46 bjh21 Exp $ */
-/* $FreeBSD$ */
/* This is a derivative work. */
diff --git a/lib/libc/riscv/static_tls.h b/lib/libc/riscv/static_tls.h
index dcdc459b8c19..ce9fa23338a6 100644
--- a/lib/libc/riscv/static_tls.h
+++ b/lib/libc/riscv/static_tls.h
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2019 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 _LIBC_RISCV_STATIC_TLS_H
diff --git a/lib/libc/riscv/sys/Makefile.inc b/lib/libc/riscv/sys/Makefile.inc
deleted file mode 100644
index b322cece382c..000000000000
--- a/lib/libc/riscv/sys/Makefile.inc
+++ /dev/null
@@ -1,10 +0,0 @@
-# $FreeBSD$
-
-SRCS+= __vdso_gettc.c
-
-MDASM= cerror.S \
- syscall.S \
- vfork.S
-
-# Don't generate default code for these syscalls:
-NOASM+= sbrk.o vfork.o
diff --git a/lib/libc/riscv/sys/__vdso_gettc.c b/lib/libc/riscv/sys/__vdso_gettc.c
deleted file mode 100644
index 20e69a791bb5..000000000000
--- a/lib/libc/riscv/sys/__vdso_gettc.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/*-
- * Copyright (c) 2021 Jessica Clarke
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <sys/elf.h>
-#include <sys/time.h>
-#include <sys/vdso.h>
-
-#include <machine/riscvreg.h>
-
-#include <errno.h>
-
-#include "libc_private.h"
-
-#pragma weak __vdso_gettc
-int
-__vdso_gettc(const struct vdso_timehands *th, u_int *tc)
-{
- if (th->th_algo != VDSO_TH_ALGO_RISCV_RDTIME)
- return (ENOSYS);
-
- *tc = csr_read(time);
- return (0);
-}
-
-#pragma weak __vdso_gettimekeep
-int
-__vdso_gettimekeep(struct vdso_timekeep **tk)
-{
- return (_elf_aux_info(AT_TIMEKEEP, tk, sizeof(*tk)));
-}
diff --git a/lib/libc/riscv/sys/cerror.S b/lib/libc/riscv/sys/cerror.S
deleted file mode 100644
index 117080e0b3d9..000000000000
--- a/lib/libc/riscv/sys/cerror.S
+++ /dev/null
@@ -1,50 +0,0 @@
-/*-
- * Copyright (c) 2015 Ruslan Bukin <br@bsdpad.com>
- * All rights reserved.
- *
- * Portions of this software were developed by SRI International and the
- * University of Cambridge Computer Laboratory under DARPA/AFRL contract
- * FA8750-10-C-0237 ("CTSRD"), as part of the DARPA CRASH research programme.
- *
- * Portions of this software were developed by the University of Cambridge
- * Computer Laboratory as part of the CTSRD Project, with support from the
- * UK Higher Education Innovation Fund (HEIF).
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-ENTRY(cerror)
- addi sp, sp, -16
- sd a0, 0(sp)
- sd ra, 8(sp)
- call _C_LABEL(__error)
- ld a1, 0(sp)
- ld ra, 8(sp)
- sw a1, 0(a0)
- li a0, -1
- li a1, -1
- addi sp, sp, 16
- ret
-END(cerror)
diff --git a/lib/libc/riscv/sys/syscall.S b/lib/libc/riscv/sys/syscall.S
deleted file mode 100644
index 8a007f8c7f17..000000000000
--- a/lib/libc/riscv/sys/syscall.S
+++ /dev/null
@@ -1,40 +0,0 @@
-/*-
- * Copyright (c) 2015 Ruslan Bukin <br@bsdpad.com>
- * All rights reserved.
- *
- * Portions of this software were developed by SRI International and the
- * University of Cambridge Computer Laboratory under DARPA/AFRL contract
- * FA8750-10-C-0237 ("CTSRD"), as part of the DARPA CRASH research programme.
- *
- * Portions of this software were developed by the University of Cambridge
- * Computer Laboratory as part of the CTSRD Project, with support from the
- * UK Higher Education Innovation Fund (HEIF).
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#include "SYS.h"
-
-RSYSCALL(syscall)
diff --git a/lib/libc/riscv/sys/vfork.S b/lib/libc/riscv/sys/vfork.S
deleted file mode 100644
index e7a0b82dc21f..000000000000
--- a/lib/libc/riscv/sys/vfork.S
+++ /dev/null
@@ -1,53 +0,0 @@
-/*-
- * Copyright (c) 2015 Ruslan Bukin <br@bsdpad.com>
- * All rights reserved.
- *
- * Portions of this software were developed by SRI International and the
- * University of Cambridge Computer Laboratory under DARPA/AFRL contract
- * FA8750-10-C-0237 ("CTSRD"), as part of the DARPA CRASH research programme.
- *
- * Portions of this software were developed by the University of Cambridge
- * Computer Laboratory as part of the CTSRD Project, with support from the
- * UK Higher Education Innovation Fund (HEIF).
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-#include "SYS.h"
-
-ENTRY(__sys_vfork)
- WEAK_REFERENCE(__sys_vfork, vfork)
- WEAK_REFERENCE(__sys_vfork, _vfork)
- mv a2, ra
-
- _SYSCALL(vfork)
- bnez t0, 1f
- addi a1, a1, -1
- and a0, a0, a1
- mv ra, a2
-
- ret
-1: la t1, cerror
- jr t1
-END(__sys_vfork)
diff --git a/lib/libc/rpc/DISCLAIMER b/lib/libc/rpc/DISCLAIMER
index d8dcb7ffd4a6..8e0763a0e4dd 100644
--- a/lib/libc/rpc/DISCLAIMER
+++ b/lib/libc/rpc/DISCLAIMER
@@ -1,5 +1,4 @@
/* $NetBSD: DISCLAIMER,v 1.2 1998/01/09 04:11:51 perry Exp $ */
-/* $FreeBSD$ */
/*-
* Copyright (c) 2009, Sun Microsystems, Inc.
diff --git a/lib/libc/rpc/Makefile.inc b/lib/libc/rpc/Makefile.inc
index 5ca9bd3757c0..274f780755a7 100644
--- a/lib/libc/rpc/Makefile.inc
+++ b/lib/libc/rpc/Makefile.inc
@@ -1,5 +1,3 @@
-# @(#)Makefile 5.11 (Berkeley) 9/6/90
-# $FreeBSD$
.PATH: ${LIBC_SRCTOP}/rpc ${LIBC_SRCTOP}/.
CONFS+= rpc/netconfig rpc/rpc
@@ -168,6 +166,7 @@ MLINKS+= bindresvport.3 bindresvport_sa.3 \
rpc_soc.3 svc_fds.3 \
rpc_soc.3 svc_fdset.3 \
rpc_soc.3 svc_getcaller.3 \
+ rpc_soc.3 svc_getreq.3 \
rpc_soc.3 svc_register.3 \
rpc_soc.3 svc_unregister.3 \
rpc_soc.3 svcfd_create.3 \
@@ -176,5 +175,6 @@ MLINKS+= bindresvport.3 bindresvport_sa.3 \
rpc_soc.3 svctcp_create.3 \
rpc_soc.3 svcudp_bufcreate.3 \
rpc_soc.3 svcunix_create.3 \
+ rpc_soc.3 xdr_authunix_parms.3 \
rpc_soc.3 xdr_pmap.3 \
rpc_soc.3 xdr_pmaplist.3
diff --git a/lib/libc/rpc/README b/lib/libc/rpc/README
index 129fe0082d6d..60e9f2649bba 100644
--- a/lib/libc/rpc/README
+++ b/lib/libc/rpc/README
@@ -1,4 +1,3 @@
-$FreeBSD$
PLEASE READ THE DISCLAIMER FILE. DO NOT CALL THE SUN MICROSYSTEMS SUPPORT
LINE WITH QUESTIONS ON THIS RELEASE. THEY CANNOT ANSWER QUESTIONS ABOUT THIS
diff --git a/lib/libc/rpc/Symbol.map b/lib/libc/rpc/Symbol.map
index 4f356de99748..5bf364f28d81 100644
--- a/lib/libc/rpc/Symbol.map
+++ b/lib/libc/rpc/Symbol.map
@@ -1,7 +1,3 @@
-/*
- * $FreeBSD$
- */
-
FBSD_1.0 {
/* From crypt_clnt.c (generated by rpcgen - include/rpcsvc/crypt.x) */
des_crypt_1;
diff --git a/lib/libc/rpc/auth_des.c b/lib/libc/rpc/auth_des.c
index f2ad0349a6a8..c9b20de25cda 100644
--- a/lib/libc/rpc/auth_des.c
+++ b/lib/libc/rpc/auth_des.c
@@ -41,7 +41,6 @@
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
-#include <sys/cdefs.h>
#include <rpc/des_crypt.h>
#include <syslog.h>
#include <rpc/types.h>
@@ -55,12 +54,6 @@
#include "un-namespace.h"
#include "mt_misc.h"
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)auth_des.c 2.2 88/07/29 4.0 RPCSRC; from 1.9 88/02/08 SMI";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#define USEC_PER_SEC 1000000
#define RTIME_TIMEOUT 5 /* seconds to wait for sync */
diff --git a/lib/libc/rpc/auth_none.c b/lib/libc/rpc/auth_none.c
index 4422802c4c5c..c116ce242707 100644
--- a/lib/libc/rpc/auth_none.c
+++ b/lib/libc/rpc/auth_none.c
@@ -30,13 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *sccsid2 = "@(#)auth_none.c 1.19 87/08/11 Copyr 1984 Sun Micro";
-static char *sccsid = "@(#)auth_none.c 2.1 88/07/29 4.0 RPCSRC";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* auth_none.c
* Creates a client authentication handle for passing "null"
diff --git a/lib/libc/rpc/auth_time.c b/lib/libc/rpc/auth_time.c
index 4b714468b92e..d8ea585c8ee7 100644
--- a/lib/libc/rpc/auth_time.c
+++ b/lib/libc/rpc/auth_time.c
@@ -1,5 +1,3 @@
-/* #pragma ident "@(#)auth_time.c 1.4 92/11/10 SMI" */
-
/*
* auth_time.c
*
@@ -27,9 +25,6 @@
* needed to deal with TCP connections.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <stdio.h>
#include <syslog.h>
diff --git a/lib/libc/rpc/auth_unix.c b/lib/libc/rpc/auth_unix.c
index 08df14b54491..22c65ddfb8f0 100644
--- a/lib/libc/rpc/auth_unix.c
+++ b/lib/libc/rpc/auth_unix.c
@@ -30,13 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *sccsid2 = "@(#)auth_unix.c 1.19 87/08/11 Copyr 1984 Sun Micro";
-static char *sccsid = "@(#)auth_unix.c 2.2 88/08/01 4.0 RPCSRC";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* auth_unix.c, Implements UNIX style authentication parameters.
*
diff --git a/lib/libc/rpc/authdes_prot.c b/lib/libc/rpc/authdes_prot.c
index 663261d631a9..79a0e5baa084 100644
--- a/lib/libc/rpc/authdes_prot.c
+++ b/lib/libc/rpc/authdes_prot.c
@@ -1,9 +1,3 @@
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)authdes_prot.c 2.1 88/07/29 4.0 RPCSRC; from 1.6 88/02/08 SMI";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*-
* SPDX-License-Identifier: BSD-3-Clause
*
diff --git a/lib/libc/rpc/authunix_prot.c b/lib/libc/rpc/authunix_prot.c
index bb590c350429..777f262f5c33 100644
--- a/lib/libc/rpc/authunix_prot.c
+++ b/lib/libc/rpc/authunix_prot.c
@@ -30,13 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *sccsid2 = "@(#)authunix_prot.c 1.15 87/08/11 Copyr 1984 Sun Micro";
-static char *sccsid = "@(#)authunix_prot.c 2.1 88/07/29 4.0 RPCSRC";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* authunix_prot.c
* XDR for UNIX style authentication parameters for RPC
diff --git a/lib/libc/rpc/bindresvport.3 b/lib/libc/rpc/bindresvport.3
index 28e86e5f2a6f..25483a623e56 100644
--- a/lib/libc/rpc/bindresvport.3
+++ b/lib/libc/rpc/bindresvport.3
@@ -1,6 +1,4 @@
-.\" @(#)bindresvport.3n 2.2 88/08/02 4.0 RPCSRC; from 1.7 88/03/14 SMI
.\" $NetBSD: bindresvport.3,v 1.8 2000/07/05 15:45:33 msaitoh Exp $
-.\" $FreeBSD$
.\"
.Dd November 22, 1987
.Dt BINDRESVPORT 3
diff --git a/lib/libc/rpc/bindresvport.c b/lib/libc/rpc/bindresvport.c
index 44d3b0c1eacd..4cdd037afd1a 100644
--- a/lib/libc/rpc/bindresvport.c
+++ b/lib/libc/rpc/bindresvport.c
@@ -30,14 +30,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *sccsid2 = "from: @(#)bindresvport.c 1.8 88/02/08 SMI";
-static char *sccsid = "from: @(#)bindresvport.c 2.2 88/07/29 4.0 RPCSRC";
-#endif
/* from: $OpenBSD: bindresvport.c,v 1.7 1996/07/30 16:25:47 downsj Exp $ */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* Copyright (c) 1987 by Sun Microsystems, Inc.
*
diff --git a/lib/libc/rpc/clnt_bcast.c b/lib/libc/rpc/clnt_bcast.c
index 649cab05a474..07e6d0a0fa20 100644
--- a/lib/libc/rpc/clnt_bcast.c
+++ b/lib/libc/rpc/clnt_bcast.c
@@ -33,14 +33,6 @@
* Copyright (c) 1986-1991 by Sun Microsystems Inc.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-#ident "@(#)clnt_bcast.c 1.18 94/05/03 SMI"
-static char sccsid[] = "@(#)clnt_bcast.c 1.15 89/04/21 Copyr 1988 Sun Micro";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-
/*
* clnt_bcast.c
* Client interface to broadcast service.
diff --git a/lib/libc/rpc/clnt_dg.c b/lib/libc/rpc/clnt_dg.c
index 26bf34633623..78fc5e47d444 100644
--- a/lib/libc/rpc/clnt_dg.c
+++ b/lib/libc/rpc/clnt_dg.c
@@ -33,13 +33,6 @@
* Copyright (c) 1986-1991 by Sun Microsystems Inc.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-#ident "@(#)clnt_dg.c 1.23 94/04/22 SMI"
-static char sccsid[] = "@(#)clnt_dg.c 1.19 89/03/16 Copyr 1988 Sun Micro";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* Implements a connectionless client side RPC.
*/
@@ -51,13 +44,17 @@ __FBSDID("$FreeBSD$");
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
+#include <sys/tree.h>
#include <arpa/inet.h>
#include <rpc/rpc.h>
#include <rpc/rpcsec_gss.h>
+#include <assert.h>
#include <errno.h>
+#include <pthread.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
+#include <stdbool.h>
#include <unistd.h>
#include <err.h>
#include "un-namespace.h"
@@ -92,28 +89,65 @@ static void clnt_dg_destroy(CLIENT *);
* This machinery implements per-fd locks for MT-safety. It is not
* sufficient to do per-CLIENT handle locks for MT-safety because a
* user may create more than one CLIENT handle with the same fd behind
- * it. Therefore, we allocate an array of flags (dg_fd_locks), protected
- * by the clnt_fd_lock mutex, and an array (dg_cv) of condition variables
- * similarly protected. Dg_fd_lock[fd] == 1 => a call is active on some
- * CLIENT handle created for that fd.
- * The current implementation holds locks across the entire RPC and reply,
- * including retransmissions. Yes, this is silly, and as soon as this
- * code is proven to work, this should be the first thing fixed. One step
- * at a time.
+ * it. Therefore, we allocate an associative array of flags and condition
+ * variables (dg_fd). The flags and the array are protected by the
+ * clnt_fd_lock mutex. dg_fd[fd].lock == 1 => a call is active on some
+ * CLIENT handle created for that fd. The current implementation holds
+ * locks across the entire RPC and reply, including retransmissions. Yes,
+ * this is silly, and as soon as this code is proven to work, this should
+ * be the first thing fixed. One step at a time.
*/
-static int *dg_fd_locks;
-static cond_t *dg_cv;
-#define release_fd_lock(fd, mask) { \
- mutex_lock(&clnt_fd_lock); \
- dg_fd_locks[fd] = 0; \
- mutex_unlock(&clnt_fd_lock); \
- thr_sigsetmask(SIG_SETMASK, &(mask), NULL); \
- cond_signal(&dg_cv[fd]); \
+struct dg_fd {
+ RB_ENTRY(dg_fd) dg_link;
+ int fd;
+ mutex_t mtx;
+};
+static inline int
+cmp_dg_fd(struct dg_fd *a, struct dg_fd *b)
+{
+ if (a->fd > b->fd) {
+ return (1);
+ } else if (a->fd < b->fd) {
+ return (-1);
+ } else {
+ return (0);
+ }
+}
+RB_HEAD(dg_fd_list, dg_fd);
+RB_PROTOTYPE(dg_fd_list, dg_fd, dg_link, cmp_dg_fd);
+RB_GENERATE(dg_fd_list, dg_fd, dg_link, cmp_dg_fd);
+struct dg_fd_list dg_fd_head = RB_INITIALIZER(&dg_fd_head);
+
+/*
+ * Find the lock structure for the given file descriptor, or initialize it if
+ * it does not already exist. The clnt_fd_lock mutex must be held.
+ */
+static struct dg_fd *
+dg_fd_find(int fd)
+{
+ struct dg_fd key, *elem;
+
+ key.fd = fd;
+ elem = RB_FIND(dg_fd_list, &dg_fd_head, &key);
+ if (elem == NULL) {
+ elem = calloc(1, sizeof(*elem));
+ elem->fd = fd;
+ mutex_init(&elem->mtx, NULL);
+ RB_INSERT(dg_fd_list, &dg_fd_head, elem);
+ }
+ return (elem);
+}
+
+static void
+release_fd_lock(struct dg_fd *elem, sigset_t mask)
+{
+ mutex_unlock(&elem->mtx);
+ thr_sigsetmask(SIG_SETMASK, &mask, NULL);
}
static const char mem_err_clnt_dg[] = "clnt_dg_create: out of memory";
-/* VARIABLES PROTECTED BY clnt_fd_lock: dg_fd_locks, dg_cv */
+/* VARIABLES PROTECTED BY clnt_fd_lock: dg_fd */
#define MCALL_MSG_SIZE 24
@@ -171,47 +205,9 @@ clnt_dg_create(int fd, const struct netbuf *svcaddr, rpcprog_t program,
struct cu_data *cu = NULL; /* private data */
struct timeval now;
struct rpc_msg call_msg;
- sigset_t mask;
- sigset_t newmask;
struct __rpc_sockinfo si;
int one = 1;
- sigfillset(&newmask);
- thr_sigsetmask(SIG_SETMASK, &newmask, &mask);
- mutex_lock(&clnt_fd_lock);
- if (dg_fd_locks == (int *) NULL) {
- int cv_allocsz;
- size_t fd_allocsz;
- int dtbsize = __rpc_dtbsize();
-
- fd_allocsz = dtbsize * sizeof (int);
- dg_fd_locks = (int *) mem_alloc(fd_allocsz);
- if (dg_fd_locks == (int *) NULL) {
- mutex_unlock(&clnt_fd_lock);
- thr_sigsetmask(SIG_SETMASK, &(mask), NULL);
- goto err1;
- } else
- memset(dg_fd_locks, '\0', fd_allocsz);
-
- cv_allocsz = dtbsize * sizeof (cond_t);
- dg_cv = (cond_t *) mem_alloc(cv_allocsz);
- if (dg_cv == (cond_t *) NULL) {
- mem_free(dg_fd_locks, fd_allocsz);
- dg_fd_locks = (int *) NULL;
- mutex_unlock(&clnt_fd_lock);
- thr_sigsetmask(SIG_SETMASK, &(mask), NULL);
- goto err1;
- } else {
- int i;
-
- for (i = 0; i < dtbsize; i++)
- cond_init(&dg_cv[i], 0, (void *) 0);
- }
- }
-
- mutex_unlock(&clnt_fd_lock);
- thr_sigsetmask(SIG_SETMASK, &(mask), NULL);
-
if (svcaddr == NULL) {
rpc_createerr.cf_stat = RPC_UNKNOWNADDR;
return (NULL);
@@ -332,25 +328,21 @@ clnt_dg_call(CLIENT *cl, rpcproc_t proc, xdrproc_t xargs, void *argsp,
struct timespec ts;
struct kevent kv;
struct sockaddr *sa;
+ struct dg_fd *elem;
sigset_t mask;
sigset_t newmask;
socklen_t salen;
ssize_t recvlen = 0;
- int kin_len, n, rpc_lock_value;
+ int kin_len, n;
u_int32_t xid;
outlen = 0;
sigfillset(&newmask);
thr_sigsetmask(SIG_SETMASK, &newmask, &mask);
mutex_lock(&clnt_fd_lock);
- while (dg_fd_locks[cu->cu_fd])
- cond_wait(&dg_cv[cu->cu_fd], &clnt_fd_lock);
- if (__isthreaded)
- rpc_lock_value = 1;
- else
- rpc_lock_value = 0;
- dg_fd_locks[cu->cu_fd] = rpc_lock_value;
+ elem = dg_fd_find(cu->cu_fd);
mutex_unlock(&clnt_fd_lock);
+ mutex_lock(&elem->mtx);
if (cu->cu_total.tv_usec == -1) {
timeout = utimeout; /* use supplied timeout */
} else {
@@ -604,7 +596,7 @@ out:
if (cu->cu_kq >= 0)
_close(cu->cu_kq);
cu->cu_kq = -1;
- release_fd_lock(cu->cu_fd, mask);
+ release_fd_lock(elem, mask);
return (cu->cu_error.re_status);
}
@@ -620,6 +612,7 @@ static bool_t
clnt_dg_freeres(CLIENT *cl, xdrproc_t xdr_res, void *res_ptr)
{
struct cu_data *cu = (struct cu_data *)cl->cl_private;
+ struct dg_fd *elem;
XDR *xdrs = &(cu->cu_outxdrs);
bool_t dummy;
sigset_t mask;
@@ -628,13 +621,12 @@ clnt_dg_freeres(CLIENT *cl, xdrproc_t xdr_res, void *res_ptr)
sigfillset(&newmask);
thr_sigsetmask(SIG_SETMASK, &newmask, &mask);
mutex_lock(&clnt_fd_lock);
- while (dg_fd_locks[cu->cu_fd])
- cond_wait(&dg_cv[cu->cu_fd], &clnt_fd_lock);
+ elem = dg_fd_find(cu->cu_fd);
+ mutex_lock(&elem->mtx);
xdrs->x_op = XDR_FREE;
dummy = (*xdr_res)(xdrs, res_ptr);
mutex_unlock(&clnt_fd_lock);
- thr_sigsetmask(SIG_SETMASK, &mask, NULL);
- cond_signal(&dg_cv[cu->cu_fd]);
+ release_fd_lock(elem, mask);
return (dummy);
}
@@ -649,41 +641,36 @@ clnt_dg_control(CLIENT *cl, u_int request, void *info)
{
struct cu_data *cu = (struct cu_data *)cl->cl_private;
struct netbuf *addr;
+ struct dg_fd *elem;
sigset_t mask;
sigset_t newmask;
- int rpc_lock_value;
sigfillset(&newmask);
thr_sigsetmask(SIG_SETMASK, &newmask, &mask);
mutex_lock(&clnt_fd_lock);
- while (dg_fd_locks[cu->cu_fd])
- cond_wait(&dg_cv[cu->cu_fd], &clnt_fd_lock);
- if (__isthreaded)
- rpc_lock_value = 1;
- else
- rpc_lock_value = 0;
- dg_fd_locks[cu->cu_fd] = rpc_lock_value;
+ elem = dg_fd_find(cu->cu_fd);
mutex_unlock(&clnt_fd_lock);
+ mutex_lock(&elem->mtx);
switch (request) {
case CLSET_FD_CLOSE:
cu->cu_closeit = TRUE;
- release_fd_lock(cu->cu_fd, mask);
+ release_fd_lock(elem, mask);
return (TRUE);
case CLSET_FD_NCLOSE:
cu->cu_closeit = FALSE;
- release_fd_lock(cu->cu_fd, mask);
+ release_fd_lock(elem, mask);
return (TRUE);
}
/* for other requests which use info */
if (info == NULL) {
- release_fd_lock(cu->cu_fd, mask);
+ release_fd_lock(elem, mask);
return (FALSE);
}
switch (request) {
case CLSET_TIMEOUT:
if (time_not_ok((struct timeval *)info)) {
- release_fd_lock(cu->cu_fd, mask);
+ release_fd_lock(elem, mask);
return (FALSE);
}
cu->cu_total = *(struct timeval *)info;
@@ -697,7 +684,7 @@ clnt_dg_control(CLIENT *cl, u_int request, void *info)
break;
case CLSET_RETRY_TIMEOUT:
if (time_not_ok((struct timeval *)info)) {
- release_fd_lock(cu->cu_fd, mask);
+ release_fd_lock(elem, mask);
return (FALSE);
}
cu->cu_wait = *(struct timeval *)info;
@@ -717,7 +704,7 @@ clnt_dg_control(CLIENT *cl, u_int request, void *info)
case CLSET_SVC_ADDR: /* set to new address */
addr = (struct netbuf *)info;
if (addr->len < sizeof cu->cu_raddr) {
- release_fd_lock(cu->cu_fd, mask);
+ release_fd_lock(elem, mask);
return (FALSE);
}
(void) memcpy(&cu->cu_raddr, addr->buf, addr->len);
@@ -780,10 +767,10 @@ clnt_dg_control(CLIENT *cl, u_int request, void *info)
cu->cu_connect = *(int *)info;
break;
default:
- release_fd_lock(cu->cu_fd, mask);
+ release_fd_lock(elem, mask);
return (FALSE);
}
- release_fd_lock(cu->cu_fd, mask);
+ release_fd_lock(elem, mask);
return (TRUE);
}
@@ -791,6 +778,7 @@ static void
clnt_dg_destroy(CLIENT *cl)
{
struct cu_data *cu = (struct cu_data *)cl->cl_private;
+ struct dg_fd *elem;
int cu_fd = cu->cu_fd;
sigset_t mask;
sigset_t newmask;
@@ -798,8 +786,8 @@ clnt_dg_destroy(CLIENT *cl)
sigfillset(&newmask);
thr_sigsetmask(SIG_SETMASK, &newmask, &mask);
mutex_lock(&clnt_fd_lock);
- while (dg_fd_locks[cu_fd])
- cond_wait(&dg_cv[cu_fd], &clnt_fd_lock);
+ elem = dg_fd_find(cu_fd);
+ mutex_lock(&elem->mtx);
if (cu->cu_closeit)
(void)_close(cu_fd);
if (cu->cu_kq >= 0)
@@ -812,8 +800,7 @@ clnt_dg_destroy(CLIENT *cl)
mem_free(cl->cl_tp, strlen(cl->cl_tp) +1);
mem_free(cl, sizeof (CLIENT));
mutex_unlock(&clnt_fd_lock);
- thr_sigsetmask(SIG_SETMASK, &mask, NULL);
- cond_signal(&dg_cv[cu_fd]);
+ release_fd_lock(elem, mask);
}
static struct clnt_ops *
diff --git a/lib/libc/rpc/clnt_generic.c b/lib/libc/rpc/clnt_generic.c
index d3cdf1f08fb8..f55fb9d44c9f 100644
--- a/lib/libc/rpc/clnt_generic.c
+++ b/lib/libc/rpc/clnt_generic.c
@@ -30,15 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-/* #ident "@(#)clnt_generic.c 1.40 99/04/21 SMI" */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *sccsid2 = "from: @(#)clnt_generic.c 1.4 87/08/11 (C) 1987 SMI";
-static char *sccsid = "from: @(#)clnt_generic.c 2.2 88/08/01 4.0 RPCSRC";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* Copyright (c) 1986-1996,1998 by Sun Microsystems, Inc.
* All rights reserved.
diff --git a/lib/libc/rpc/clnt_perror.c b/lib/libc/rpc/clnt_perror.c
index b9243ff4d558..83ed2f600452 100644
--- a/lib/libc/rpc/clnt_perror.c
+++ b/lib/libc/rpc/clnt_perror.c
@@ -31,13 +31,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *sccsid2 = "@(#)clnt_perror.c 1.15 87/10/07 Copyr 1984 Sun Micro";
-static char *sccsid = "@(#)clnt_perror.c 2.1 88/07/29 4.0 RPCSRC";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* clnt_perror.c
*
diff --git a/lib/libc/rpc/clnt_raw.c b/lib/libc/rpc/clnt_raw.c
index f6a488be7e8d..b355f827140b 100644
--- a/lib/libc/rpc/clnt_raw.c
+++ b/lib/libc/rpc/clnt_raw.c
@@ -30,13 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *sccsid2 = "@(#)clnt_raw.c 1.22 87/08/11 Copyr 1984 Sun Micro";
-static char *sccsid = "@(#)clnt_raw.c 2.2 88/08/01 4.0 RPCSRC";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* clnt_raw.c
*
diff --git a/lib/libc/rpc/clnt_simple.c b/lib/libc/rpc/clnt_simple.c
index de9ec6543d15..0df3fd8dee09 100644
--- a/lib/libc/rpc/clnt_simple.c
+++ b/lib/libc/rpc/clnt_simple.c
@@ -33,13 +33,6 @@
* Copyright (c) 1986-1991 by Sun Microsystems Inc.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *sccsid2 = "from: @(#)clnt_simple.c 1.35 87/08/11 Copyr 1984 Sun Micro";
-static char *sccsid = "from: @(#)clnt_simple.c 2.2 88/08/01 4.0 RPCSRC";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* clnt_simple.c
* Simplified front end to client rpc.
diff --git a/lib/libc/rpc/clnt_vc.c b/lib/libc/rpc/clnt_vc.c
index ebd4e303916f..60e381168ed3 100644
--- a/lib/libc/rpc/clnt_vc.c
+++ b/lib/libc/rpc/clnt_vc.c
@@ -30,14 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *sccsid2 = "@(#)clnt_tcp.c 1.37 87/10/05 Copyr 1984 Sun Micro";
-static char *sccsid = "@(#)clnt_tcp.c 2.2 88/08/01 4.0 RPCSRC";
-static char sccsid3[] = "@(#)clnt_vc.c 1.19 89/03/16 Copyr 1988 Sun Micro";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* clnt_tcp.c, Implements a TCP/IP based, client side RPC.
*
@@ -63,6 +55,7 @@ __FBSDID("$FreeBSD$");
#include <sys/poll.h>
#include <sys/syslog.h>
#include <sys/socket.h>
+#include <sys/tree.h>
#include <sys/un.h>
#include <sys/uio.h>
@@ -71,7 +64,9 @@ __FBSDID("$FreeBSD$");
#include <err.h>
#include <errno.h>
#include <netdb.h>
+#include <pthread.h>
#include <stdio.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -123,22 +118,60 @@ struct ct_data {
* This machinery implements per-fd locks for MT-safety. It is not
* sufficient to do per-CLIENT handle locks for MT-safety because a
* user may create more than one CLIENT handle with the same fd behind
- * it. Therefore, we allocate an array of flags (vc_fd_locks), protected
- * by the clnt_fd_lock mutex, and an array (vc_cv) of condition variables
- * similarly protected. Vc_fd_lock[fd] == 1 => a call is active on some
- * CLIENT handle created for that fd.
- * The current implementation holds locks across the entire RPC and reply.
- * Yes, this is silly, and as soon as this code is proven to work, this
- * should be the first thing fixed. One step at a time.
+ * it. Therefore, we allocate an associative array of flags and condition
+ * variables (vc_fd). The flags and the array are protected by the
+ * clnt_fd_lock mutex. vc_fd_lock[fd] == 1 => a call is active on some
+ * CLIENT handle created for that fd. The current implementation holds
+ * locks across the entire RPC and reply. Yes, this is silly, and as soon
+ * as this code is proven to work, this should be the first thing fixed.
+ * One step at a time.
+ */
+struct vc_fd {
+ RB_ENTRY(vc_fd) vc_link;
+ int fd;
+ mutex_t mtx;
+};
+static inline int
+cmp_vc_fd(struct vc_fd *a, struct vc_fd *b)
+{
+ if (a->fd > b->fd) {
+ return (1);
+ } else if (a->fd < b->fd) {
+ return (-1);
+ } else {
+ return (0);
+ }
+}
+RB_HEAD(vc_fd_list, vc_fd);
+RB_PROTOTYPE(vc_fd_list, vc_fd, vc_link, cmp_vc_fd);
+RB_GENERATE(vc_fd_list, vc_fd, vc_link, cmp_vc_fd);
+struct vc_fd_list vc_fd_head = RB_INITIALIZER(&vc_fd_head);
+
+/*
+ * Find the lock structure for the given file descriptor, or initialize it if
+ * it does not already exist. The clnt_fd_lock mutex must be held.
*/
-static int *vc_fd_locks;
-static cond_t *vc_cv;
-#define release_fd_lock(fd, mask) { \
- mutex_lock(&clnt_fd_lock); \
- vc_fd_locks[fd] = 0; \
- mutex_unlock(&clnt_fd_lock); \
- thr_sigsetmask(SIG_SETMASK, &(mask), (sigset_t *) NULL); \
- cond_signal(&vc_cv[fd]); \
+static struct vc_fd *
+vc_fd_find(int fd)
+{
+ struct vc_fd key, *elem;
+
+ key.fd = fd;
+ elem = RB_FIND(vc_fd_list, &vc_fd_head, &key);
+ if (elem == NULL) {
+ elem = calloc(1, sizeof(*elem));
+ elem->fd = fd;
+ mutex_init(&elem->mtx, NULL);
+ RB_INSERT(vc_fd_list, &vc_fd_head, elem);
+ }
+ return (elem);
+}
+
+static void
+release_fd_lock(struct vc_fd *elem, sigset_t mask)
+{
+ mutex_unlock(&elem->mtx);
+ thr_sigsetmask(SIG_SETMASK, &mask, NULL);
}
static const char clnt_vc_errstr[] = "%s : %s";
@@ -172,8 +205,6 @@ clnt_vc_create(int fd, const struct netbuf *raddr, const rpcprog_t prog,
struct timeval now;
struct rpc_msg call_msg;
static u_int32_t disrupt;
- sigset_t mask;
- sigset_t newmask;
struct sockaddr_storage ss;
socklen_t slen;
struct __rpc_sockinfo si;
@@ -191,39 +222,6 @@ clnt_vc_create(int fd, const struct netbuf *raddr, const rpcprog_t prog,
goto err;
}
ct->ct_addr.buf = NULL;
- sigfillset(&newmask);
- thr_sigsetmask(SIG_SETMASK, &newmask, &mask);
- mutex_lock(&clnt_fd_lock);
- if (vc_fd_locks == (int *) NULL) {
- int cv_allocsz, fd_allocsz;
- int dtbsize = __rpc_dtbsize();
-
- fd_allocsz = dtbsize * sizeof (int);
- vc_fd_locks = (int *) mem_alloc(fd_allocsz);
- if (vc_fd_locks == (int *) NULL) {
- mutex_unlock(&clnt_fd_lock);
- thr_sigsetmask(SIG_SETMASK, &(mask), NULL);
- goto err;
- } else
- memset(vc_fd_locks, '\0', fd_allocsz);
-
- assert(vc_cv == (cond_t *) NULL);
- cv_allocsz = dtbsize * sizeof (cond_t);
- vc_cv = (cond_t *) mem_alloc(cv_allocsz);
- if (vc_cv == (cond_t *) NULL) {
- mem_free(vc_fd_locks, fd_allocsz);
- vc_fd_locks = (int *) NULL;
- mutex_unlock(&clnt_fd_lock);
- thr_sigsetmask(SIG_SETMASK, &(mask), NULL);
- goto err;
- } else {
- int i;
-
- for (i = 0; i < dtbsize; i++)
- cond_init(&vc_cv[i], 0, (void *) 0);
- }
- } else
- assert(vc_cv != (cond_t *) NULL);
/*
* XXX - fvdl connecting while holding a mutex?
@@ -234,19 +232,16 @@ clnt_vc_create(int fd, const struct netbuf *raddr, const rpcprog_t prog,
rpc_createerr.cf_stat = RPC_SYSTEMERROR;
rpc_createerr.cf_error.re_errno = errno;
mutex_unlock(&clnt_fd_lock);
- thr_sigsetmask(SIG_SETMASK, &(mask), NULL);
goto err;
}
if (_connect(fd, (struct sockaddr *)raddr->buf, raddr->len) < 0){
rpc_createerr.cf_stat = RPC_SYSTEMERROR;
rpc_createerr.cf_error.re_errno = errno;
mutex_unlock(&clnt_fd_lock);
- thr_sigsetmask(SIG_SETMASK, &(mask), NULL);
goto err;
}
}
mutex_unlock(&clnt_fd_lock);
- thr_sigsetmask(SIG_SETMASK, &(mask), NULL);
if (!__rpc_fd2sockinfo(fd, &si))
goto err;
@@ -321,12 +316,12 @@ clnt_vc_call(CLIENT *cl, rpcproc_t proc, xdrproc_t xdr_args, void *args_ptr,
struct ct_data *ct = (struct ct_data *) cl->cl_private;
XDR *xdrs = &(ct->ct_xdrs);
struct rpc_msg reply_msg;
+ struct vc_fd *elem;
u_int32_t x_id;
u_int32_t *msg_x_id = &ct->ct_u.ct_mcalli; /* yuk */
bool_t shipnow;
int refreshes = 2;
sigset_t mask, newmask;
- int rpc_lock_value;
bool_t reply_stat;
assert(cl != NULL);
@@ -334,14 +329,9 @@ clnt_vc_call(CLIENT *cl, rpcproc_t proc, xdrproc_t xdr_args, void *args_ptr,
sigfillset(&newmask);
thr_sigsetmask(SIG_SETMASK, &newmask, &mask);
mutex_lock(&clnt_fd_lock);
- while (vc_fd_locks[ct->ct_fd])
- cond_wait(&vc_cv[ct->ct_fd], &clnt_fd_lock);
- if (__isthreaded)
- rpc_lock_value = 1;
- else
- rpc_lock_value = 0;
- vc_fd_locks[ct->ct_fd] = rpc_lock_value;
+ elem = vc_fd_find(ct->ct_fd);
mutex_unlock(&clnt_fd_lock);
+ mutex_lock(&elem->mtx);
if (!ct->ct_waitset) {
/* If time is not within limits, we ignore it. */
if (time_not_ok(&timeout) == FALSE)
@@ -365,7 +355,7 @@ call_again:
if (ct->ct_error.re_status == RPC_SUCCESS)
ct->ct_error.re_status = RPC_CANTENCODEARGS;
(void)xdrrec_endofrecord(xdrs, TRUE);
- release_fd_lock(ct->ct_fd, mask);
+ release_fd_lock(elem, mask);
return (ct->ct_error.re_status);
}
} else {
@@ -376,23 +366,23 @@ call_again:
if (ct->ct_error.re_status == RPC_SUCCESS)
ct->ct_error.re_status = RPC_CANTENCODEARGS;
(void)xdrrec_endofrecord(xdrs, TRUE);
- release_fd_lock(ct->ct_fd, mask);
+ release_fd_lock(elem, mask);
return (ct->ct_error.re_status);
}
}
if (! xdrrec_endofrecord(xdrs, shipnow)) {
- release_fd_lock(ct->ct_fd, mask);
+ release_fd_lock(elem, mask);
return (ct->ct_error.re_status = RPC_CANTSEND);
}
if (! shipnow) {
- release_fd_lock(ct->ct_fd, mask);
+ release_fd_lock(elem, mask);
return (RPC_SUCCESS);
}
/*
* Hack to provide rpc-based message passing
*/
if (timeout.tv_sec == 0 && timeout.tv_usec == 0) {
- release_fd_lock(ct->ct_fd, mask);
+ release_fd_lock(elem, mask);
return(ct->ct_error.re_status = RPC_TIMEDOUT);
}
@@ -406,14 +396,14 @@ call_again:
reply_msg.acpted_rply.ar_results.where = NULL;
reply_msg.acpted_rply.ar_results.proc = (xdrproc_t)xdr_void;
if (! xdrrec_skiprecord(xdrs)) {
- release_fd_lock(ct->ct_fd, mask);
+ release_fd_lock(elem, mask);
return (ct->ct_error.re_status);
}
/* now decode and validate the response header */
if (! xdr_replymsg(xdrs, &reply_msg)) {
if (ct->ct_error.re_status == RPC_SUCCESS)
continue;
- release_fd_lock(ct->ct_fd, mask);
+ release_fd_lock(elem, mask);
return (ct->ct_error.re_status);
}
if (reply_msg.rm_xid == x_id)
@@ -454,7 +444,7 @@ call_again:
if (refreshes-- && AUTH_REFRESH(cl->cl_auth, &reply_msg))
goto call_again;
} /* end of unsuccessful completion */
- release_fd_lock(ct->ct_fd, mask);
+ release_fd_lock(elem, mask);
return (ct->ct_error.re_status);
}
@@ -474,6 +464,7 @@ static bool_t
clnt_vc_freeres(CLIENT *cl, xdrproc_t xdr_res, void *res_ptr)
{
struct ct_data *ct;
+ struct vc_fd *elem;
XDR *xdrs;
bool_t dummy;
sigset_t mask;
@@ -487,14 +478,13 @@ clnt_vc_freeres(CLIENT *cl, xdrproc_t xdr_res, void *res_ptr)
sigfillset(&newmask);
thr_sigsetmask(SIG_SETMASK, &newmask, &mask);
mutex_lock(&clnt_fd_lock);
- while (vc_fd_locks[ct->ct_fd])
- cond_wait(&vc_cv[ct->ct_fd], &clnt_fd_lock);
+ elem = vc_fd_find(ct->ct_fd);
+ mutex_lock(&elem->mtx);
xdrs->x_op = XDR_FREE;
dummy = (*xdr_res)(xdrs, res_ptr);
- mutex_unlock(&clnt_fd_lock);
- thr_sigsetmask(SIG_SETMASK, &(mask), NULL);
- cond_signal(&vc_cv[ct->ct_fd]);
+ mutex_unlock(&clnt_fd_lock);
+ release_fd_lock(elem, mask);
return dummy;
}
@@ -522,10 +512,10 @@ static bool_t
clnt_vc_control(CLIENT *cl, u_int request, void *info)
{
struct ct_data *ct;
+ struct vc_fd *elem;
void *infop = info;
sigset_t mask;
sigset_t newmask;
- int rpc_lock_value;
assert(cl != NULL);
@@ -534,23 +524,18 @@ clnt_vc_control(CLIENT *cl, u_int request, void *info)
sigfillset(&newmask);
thr_sigsetmask(SIG_SETMASK, &newmask, &mask);
mutex_lock(&clnt_fd_lock);
- while (vc_fd_locks[ct->ct_fd])
- cond_wait(&vc_cv[ct->ct_fd], &clnt_fd_lock);
- if (__isthreaded)
- rpc_lock_value = 1;
- else
- rpc_lock_value = 0;
- vc_fd_locks[ct->ct_fd] = rpc_lock_value;
+ elem = vc_fd_find(ct->ct_fd);
mutex_unlock(&clnt_fd_lock);
+ mutex_lock(&elem->mtx);
switch (request) {
case CLSET_FD_CLOSE:
ct->ct_closeit = TRUE;
- release_fd_lock(ct->ct_fd, mask);
+ release_fd_lock(elem, mask);
return (TRUE);
case CLSET_FD_NCLOSE:
ct->ct_closeit = FALSE;
- release_fd_lock(ct->ct_fd, mask);
+ release_fd_lock(elem, mask);
return (TRUE);
default:
break;
@@ -558,13 +543,13 @@ clnt_vc_control(CLIENT *cl, u_int request, void *info)
/* for other requests which use info */
if (info == NULL) {
- release_fd_lock(ct->ct_fd, mask);
+ release_fd_lock(elem, mask);
return (FALSE);
}
switch (request) {
case CLSET_TIMEOUT:
if (time_not_ok((struct timeval *)info)) {
- release_fd_lock(ct->ct_fd, mask);
+ release_fd_lock(elem, mask);
return (FALSE);
}
ct->ct_wait = *(struct timeval *)infop;
@@ -584,7 +569,7 @@ clnt_vc_control(CLIENT *cl, u_int request, void *info)
*(struct netbuf *)info = ct->ct_addr;
break;
case CLSET_SVC_ADDR: /* set to new address */
- release_fd_lock(ct->ct_fd, mask);
+ release_fd_lock(elem, mask);
return (FALSE);
case CLGET_XID:
/*
@@ -628,10 +613,10 @@ clnt_vc_control(CLIENT *cl, u_int request, void *info)
break;
default:
- release_fd_lock(ct->ct_fd, mask);
+ release_fd_lock(elem, mask);
return (FALSE);
}
- release_fd_lock(ct->ct_fd, mask);
+ release_fd_lock(elem, mask);
return (TRUE);
}
@@ -640,6 +625,7 @@ static void
clnt_vc_destroy(CLIENT *cl)
{
struct ct_data *ct = (struct ct_data *) cl->cl_private;
+ struct vc_fd *elem;
int ct_fd = ct->ct_fd;
sigset_t mask;
sigset_t newmask;
@@ -651,8 +637,8 @@ clnt_vc_destroy(CLIENT *cl)
sigfillset(&newmask);
thr_sigsetmask(SIG_SETMASK, &newmask, &mask);
mutex_lock(&clnt_fd_lock);
- while (vc_fd_locks[ct_fd])
- cond_wait(&vc_cv[ct_fd], &clnt_fd_lock);
+ elem = vc_fd_find(ct_fd);
+ mutex_lock(&elem->mtx);
if (ct->ct_closeit && ct->ct_fd != -1) {
(void)_close(ct->ct_fd);
}
@@ -665,8 +651,7 @@ clnt_vc_destroy(CLIENT *cl)
mem_free(cl->cl_tp, strlen(cl->cl_tp) +1);
mem_free(cl, sizeof(CLIENT));
mutex_unlock(&clnt_fd_lock);
- thr_sigsetmask(SIG_SETMASK, &(mask), NULL);
- cond_signal(&vc_cv[ct_fd]);
+ release_fd_lock(elem, mask);
}
/*
diff --git a/lib/libc/rpc/crypt_client.c b/lib/libc/rpc/crypt_client.c
index c2ed109e10bb..4173a14811f9 100644
--- a/lib/libc/rpc/crypt_client.c
+++ b/lib/libc/rpc/crypt_client.c
@@ -32,9 +32,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <err.h>
#include <sys/types.h>
diff --git a/lib/libc/rpc/des_crypt.3 b/lib/libc/rpc/des_crypt.3
index 1ae637ceded5..063e4bf247f0 100644
--- a/lib/libc/rpc/des_crypt.3
+++ b/lib/libc/rpc/des_crypt.3
@@ -1,5 +1,3 @@
-.\" @(#)des_crypt.3 2.1 88/08/11 4.0 RPCSRC; from 1.16 88/03/02 SMI;
-.\" $FreeBSD$
.\"
.Dd October 6, 1987
.Dt DES_CRYPT 3
diff --git a/lib/libc/rpc/des_crypt.c b/lib/libc/rpc/des_crypt.c
index 589ff7b3b88b..beaa11c5fc15 100644
--- a/lib/libc/rpc/des_crypt.c
+++ b/lib/libc/rpc/des_crypt.c
@@ -36,12 +36,6 @@
#include <rpc/des_crypt.h>
#include <rpc/des.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)des_crypt.c 2.2 88/08/10 4.0 RPCSRC; from 1.13 88/02/08 SMI";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
static int common_crypt( char *, char *, unsigned, unsigned, struct desparams * );
int (*__des_crypt_LOCAL)(char *, unsigned, struct desparams *) = 0;
extern int _des_crypt_call(char *, int, struct desparams *);
diff --git a/lib/libc/rpc/des_soft.c b/lib/libc/rpc/des_soft.c
index 4992c1650b46..426b0a1bc116 100644
--- a/lib/libc/rpc/des_soft.c
+++ b/lib/libc/rpc/des_soft.c
@@ -28,12 +28,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)des_soft.c 2.2 88/08/10 4.0 RPCSRC; from 1.13 88/02/08 SMI";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* Table giving odd parity in the low bit for ASCII characters
*/
diff --git a/lib/libc/rpc/getnetconfig.3 b/lib/libc/rpc/getnetconfig.3
index e67b9bbb75c9..a3b7fd37174f 100644
--- a/lib/libc/rpc/getnetconfig.3
+++ b/lib/libc/rpc/getnetconfig.3
@@ -1,6 +1,4 @@
-.\" @(#)getnetconfig.3n 1.28 93/06/02 SMI; from SVr4
.\" $NetBSD: getnetconfig.3,v 1.1 2000/06/02 23:11:11 fvdl Exp $
-.\" $FreeBSD$
.\" Copyright 1989 AT&T
.Dd April 22, 2000
.Dt GETNETCONFIG 3
diff --git a/lib/libc/rpc/getnetconfig.c b/lib/libc/rpc/getnetconfig.c
index abd5eadf3917..03a4497b21ec 100644
--- a/lib/libc/rpc/getnetconfig.c
+++ b/lib/libc/rpc/getnetconfig.c
@@ -30,12 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getnetconfig.c 1.12 91/12/19 SMI";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* Copyright (c) 1989 by Sun Microsystems, Inc.
*/
diff --git a/lib/libc/rpc/getnetpath.3 b/lib/libc/rpc/getnetpath.3
index 5dfe68ad6ec9..79185c5f50b9 100644
--- a/lib/libc/rpc/getnetpath.3
+++ b/lib/libc/rpc/getnetpath.3
@@ -1,6 +1,4 @@
-.\" @(#)getnetpath.3n 1.26 93/05/07 SMI; from SVr4
.\" $NetBSD: getnetpath.3,v 1.1 2000/06/02 23:11:11 fvdl Exp $
-.\" $FreeBSD$
.\" Copyright 1989 AT&T
.Dd April 22, 2000
.Dt GETNETPATH 3
diff --git a/lib/libc/rpc/getnetpath.c b/lib/libc/rpc/getnetpath.c
index e0758de8ded3..06098af87dc1 100644
--- a/lib/libc/rpc/getnetpath.c
+++ b/lib/libc/rpc/getnetpath.c
@@ -30,12 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getnetpath.c 1.11 91/12/19 SMI";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* Copyright (c) 1989 by Sun Microsystems, Inc.
*/
@@ -135,7 +129,7 @@ failed:
* NULL and sets errno in case of an error (e.g., setnetpath was not called
* previously).
* getnetpath() silently ignores invalid NETPATH components. A NETPATH
- * compnent is invalid if there is no corresponding entry in the netconfig
+ * component is invalid if there is no corresponding entry in the netconfig
* database.
* If the NETPATH variable is unset, getnetpath() behaves as if NETPATH
* were set to the sequence of default or visible networks in the netconfig
diff --git a/lib/libc/rpc/getpublickey.c b/lib/libc/rpc/getpublickey.c
index a0604836d973..2afd5b8c2a8a 100644
--- a/lib/libc/rpc/getpublickey.c
+++ b/lib/libc/rpc/getpublickey.c
@@ -28,12 +28,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)publickey.c 1.10 91/03/11 Copyr 1986 Sun Micro";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* publickey.c
* Copyright (C) 1986, Sun Microsystems, Inc.
diff --git a/lib/libc/rpc/getrpcent.3 b/lib/libc/rpc/getrpcent.3
index e36d31c4a7ba..b2a4f71375a6 100644
--- a/lib/libc/rpc/getrpcent.3
+++ b/lib/libc/rpc/getrpcent.3
@@ -1,6 +1,4 @@
-.\" @(#)getrpcent.3n 2.2 88/08/02 4.0 RPCSRC; from 1.11 88/03/14 SMI
.\" $NetBSD: getrpcent.3,v 1.6 1998/02/05 18:49:06 perry Exp $
-.\" $FreeBSD$
.\"
.Dd February 26, 2016
.Dt GETRPCENT 3
diff --git a/lib/libc/rpc/getrpcent.c b/lib/libc/rpc/getrpcent.c
index 4f3df270de0c..ee36c11b303f 100644
--- a/lib/libc/rpc/getrpcent.c
+++ b/lib/libc/rpc/getrpcent.c
@@ -30,12 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *sccsid = "@(#)getrpcent.c 1.14 91/03/11 Copyr 1984 Sun Micro";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* Copyright (c) 1984 by Sun Microsystems, Inc.
*/
@@ -657,11 +651,11 @@ static int
rpc_marshal_func(char *buffer, size_t *buffer_size, void *retval, va_list ap,
void *cache_mdata)
{
- char *name;
- int num;
+ char *name __unused;
+ int num __unused;
struct rpcent *rpc;
- char *orig_buf;
- size_t orig_buf_size;
+ char *orig_buf __unused;
+ size_t orig_buf_size __unused;
struct rpcent new_rpc;
size_t desired_size, size, aliases_size;
@@ -744,8 +738,8 @@ static int
rpc_unmarshal_func(char *buffer, size_t buffer_size, void *retval, va_list ap,
void *cache_mdata)
{
- char *name;
- int num;
+ char *name __unused;
+ int num __unused;
struct rpcent *rpc;
char *orig_buf;
size_t orig_buf_size;
diff --git a/lib/libc/rpc/getrpcport.3 b/lib/libc/rpc/getrpcport.3
index 6e1f199e7b3c..c4d5a053626e 100644
--- a/lib/libc/rpc/getrpcport.3
+++ b/lib/libc/rpc/getrpcport.3
@@ -1,5 +1,3 @@
-.\" @(#)getrpcport.3r 2.2 88/08/02 4.0 RPCSRC; from 1.12 88/02/26 SMI
-.\" $FreeBSD$
.\"
.Dd October 6, 1987
.Dt GETRPCPORT 3
diff --git a/lib/libc/rpc/getrpcport.c b/lib/libc/rpc/getrpcport.c
index 4abc9a0c16af..5065c37cab7b 100644
--- a/lib/libc/rpc/getrpcport.c
+++ b/lib/libc/rpc/getrpcport.c
@@ -30,13 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *sccsid2 = "@(#)getrpcport.c 1.3 87/08/11 SMI";
-static char *sccsid = "@(#)getrpcport.c 2.1 88/07/29 4.0 RPCSRC";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* Copyright (c) 1985 by Sun Microsystems, Inc.
*/
diff --git a/lib/libc/rpc/key_call.c b/lib/libc/rpc/key_call.c
index 66bd3b4eaaf3..5c87881c815c 100644
--- a/lib/libc/rpc/key_call.c
+++ b/lib/libc/rpc/key_call.c
@@ -31,10 +31,6 @@
* Copyright (c) 1986-1991 by Sun Microsystems Inc.
*/
-#ident "@(#)key_call.c 1.25 94/04/24 SMI"
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* key_call.c, Interface to keyserver
*
diff --git a/lib/libc/rpc/key_prot_xdr.c b/lib/libc/rpc/key_prot_xdr.c
index 5a69bb437e3e..aadde38e39c6 100644
--- a/lib/libc/rpc/key_prot_xdr.c
+++ b/lib/libc/rpc/key_prot_xdr.c
@@ -37,10 +37,6 @@
*/
/* Copyright (c) 1990, 1991 Sun Microsystems, Inc. */
-/* #pragma ident "@(#)key_prot.x 1.7 94/04/29 SMI" */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* Compiled from key_prot.x using rpcgen.
* DO NOT EDIT THIS FILE!
diff --git a/lib/libc/rpc/mt_misc.c b/lib/libc/rpc/mt_misc.c
index a1b8057bef80..1f8bcfc0cb5d 100644
--- a/lib/libc/rpc/mt_misc.c
+++ b/lib/libc/rpc/mt_misc.c
@@ -1,9 +1,5 @@
/* $NetBSD: mt_misc.c,v 1.1 2000/06/02 23:11:11 fvdl Exp $ */
-/* #pragma ident "@(#)mt_misc.c 1.24 93/04/29 SMI" */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include "reentrant.h"
#include <rpc/rpc.h>
diff --git a/lib/libc/rpc/mt_misc.h b/lib/libc/rpc/mt_misc.h
index 7f3ced02c148..f60dc80ce737 100644
--- a/lib/libc/rpc/mt_misc.h
+++ b/lib/libc/rpc/mt_misc.h
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (C) 2006 The FreeBSD Project. All rights reserved.
*
@@ -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 _MT_MISC_H
#define _MT_MISC_H
diff --git a/lib/libc/rpc/netconfig b/lib/libc/rpc/netconfig
index 109f2e36ad43..c6d24a6788b8 100644
--- a/lib/libc/rpc/netconfig
+++ b/lib/libc/rpc/netconfig
@@ -1,4 +1,3 @@
-# $FreeBSD$
#
# The network configuration file. This file is currently only used in
# conjunction with the (TI-) RPC code in the C library, unlike its
diff --git a/lib/libc/rpc/netconfig.5 b/lib/libc/rpc/netconfig.5
index edd2f63a0f53..d1ffe4f6c2e8 100644
--- a/lib/libc/rpc/netconfig.5
+++ b/lib/libc/rpc/netconfig.5
@@ -1,6 +1,5 @@
.\" $NetBSD: netconfig.5,v 1.2 2000/11/08 13:18:28 lukem Exp $
.\" $NetBSD: netconfig.5,v 1.2 2000/11/08 13:18:28 lukem Exp $
-.\" $FreeBSD$
.Dd November 17, 2000
.Dt NETCONFIG 5
.Os
diff --git a/lib/libc/rpc/netname.c b/lib/libc/rpc/netname.c
index a9ccf1d2ef99..6ab016ef968a 100644
--- a/lib/libc/rpc/netname.c
+++ b/lib/libc/rpc/netname.c
@@ -28,12 +28,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)netname.c 1.8 91/03/11 Copyr 1986 Sun Micro";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* netname utility routines
* convert from unix names to network names and vice-versa
diff --git a/lib/libc/rpc/netnamer.c b/lib/libc/rpc/netnamer.c
index 591f6d5c91e5..96ece9cc1885 100644
--- a/lib/libc/rpc/netnamer.c
+++ b/lib/libc/rpc/netnamer.c
@@ -28,12 +28,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)netnamer.c 1.13 91/03/11 Copyr 1986 Sun Micro";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* netname utility routines convert from unix names to network names and
* vice-versa This module is operating system dependent! What we define here
@@ -64,7 +58,7 @@ static char *NETID = "netid.byname";
static char *NETIDFILE = "/etc/netid";
static int getnetid( char *, char * );
-static int _getgroups( char *, gid_t * );
+static int _getgroups( char *, gid_t [NGRPS] );
/*
* Convert network-name into unix credential
diff --git a/lib/libc/rpc/pmap_clnt.c b/lib/libc/rpc/pmap_clnt.c
index f91d33abae23..ad592b8da3de 100644
--- a/lib/libc/rpc/pmap_clnt.c
+++ b/lib/libc/rpc/pmap_clnt.c
@@ -30,13 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *sccsid2 = "@(#)pmap_clnt.c 1.37 87/08/11 Copyr 1984 Sun Micro";
-static char *sccsid = "@(#)pmap_clnt.c 2.2 88/08/01 4.0 RPCSRC";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* pmap_clnt.c
* Client interface to pmap rpc service.
diff --git a/lib/libc/rpc/pmap_getmaps.c b/lib/libc/rpc/pmap_getmaps.c
index 598de6baf8c2..594ea1879ab4 100644
--- a/lib/libc/rpc/pmap_getmaps.c
+++ b/lib/libc/rpc/pmap_getmaps.c
@@ -30,13 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *sccsid2 = "@(#)pmap_getmaps.c 1.10 87/08/11 Copyr 1984 Sun Micro";
-static char *sccsid = "@(#)pmap_getmaps.c 2.2 88/08/01 4.0 RPCSRC";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* pmap_getmap.c
* Client interface to pmap rpc service.
diff --git a/lib/libc/rpc/pmap_getport.c b/lib/libc/rpc/pmap_getport.c
index 03feff190813..065cb73c70c7 100644
--- a/lib/libc/rpc/pmap_getport.c
+++ b/lib/libc/rpc/pmap_getport.c
@@ -30,13 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *sccsid2 = "from: @(#)pmap_getport.c 1.9 87/08/11 Copyr 1984 Sun Micro";
-static char *sccsid = "from: @(#)pmap_getport.c 2.2 88/08/01 4.0 RPCSRC";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* pmap_getport.c
* Client interface to pmap rpc service.
diff --git a/lib/libc/rpc/pmap_prot.c b/lib/libc/rpc/pmap_prot.c
index cfb69d795bea..3f4dba89494c 100644
--- a/lib/libc/rpc/pmap_prot.c
+++ b/lib/libc/rpc/pmap_prot.c
@@ -30,13 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *sccsid2 = "@(#)pmap_prot.c 1.17 87/08/11 Copyr 1984 Sun Micro";
-static char *sccsid = "@(#)pmap_prot.c 2.1 88/07/29 4.0 RPCSRC";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* pmap_prot.c
* Protocol for the local binder service, or pmap.
diff --git a/lib/libc/rpc/pmap_prot2.c b/lib/libc/rpc/pmap_prot2.c
index 20d92250ed9d..98be43a15202 100644
--- a/lib/libc/rpc/pmap_prot2.c
+++ b/lib/libc/rpc/pmap_prot2.c
@@ -30,13 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *sccsid2 = "@(#)pmap_prot2.c 1.3 87/08/11 Copyr 1984 Sun Micro";
-static char *sccsid = "@(#)pmap_prot2.c 2.1 88/07/29 4.0 RPCSRC";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* pmap_prot2.c
* Protocol for the local binder service, or pmap.
diff --git a/lib/libc/rpc/pmap_rmt.c b/lib/libc/rpc/pmap_rmt.c
index 95efae582e57..3bf22a676382 100644
--- a/lib/libc/rpc/pmap_rmt.c
+++ b/lib/libc/rpc/pmap_rmt.c
@@ -30,13 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *sccsid2 = "@(#)pmap_rmt.c 1.21 87/08/27 Copyr 1984 Sun Micro";
-static char *sccsid = "@(#)pmap_rmt.c 2.2 88/08/01 4.0 RPCSRC";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* pmap_rmt.c
* Client interface to pmap rpc service.
diff --git a/lib/libc/rpc/publickey.3 b/lib/libc/rpc/publickey.3
index ff8a615a28df..450fbd037371 100644
--- a/lib/libc/rpc/publickey.3
+++ b/lib/libc/rpc/publickey.3
@@ -1,5 +1,3 @@
-.\" @(#)publickey.3r 2.1 88/08/07 4.0 RPCSRC
-.\" $FreeBSD$
.\"
.Dd October 6, 1987
.Dt PUBLICKEY 3
diff --git a/lib/libc/rpc/publickey.5 b/lib/libc/rpc/publickey.5
index 71f4ef6aca40..db95c4617b50 100644
--- a/lib/libc/rpc/publickey.5
+++ b/lib/libc/rpc/publickey.5
@@ -1,5 +1,3 @@
-.\" $FreeBSD$
-.\" @(#)publickey.5 2.1 88/08/07 4.0 RPCSRC; from 1.6 88/02/29 SMI;
.Dd October 19, 1987
.Dt PUBLICKEY 5
.Os
diff --git a/lib/libc/rpc/rpc b/lib/libc/rpc/rpc
index 935ea2f1b592..686012d061bc 100644
--- a/lib/libc/rpc/rpc
+++ b/lib/libc/rpc/rpc
@@ -1,5 +1,4 @@
#
-# $FreeBSD$
# rpc 88/08/01 4.0 RPCSRC; from 1.12 99/07/25 SMI
#
rpcbind 100000 portmap sunrpc rpcbind
diff --git a/lib/libc/rpc/rpc.3 b/lib/libc/rpc/rpc.3
index 988b5f1ec233..12d19df117ad 100644
--- a/lib/libc/rpc/rpc.3
+++ b/lib/libc/rpc/rpc.3
@@ -1,7 +1,5 @@
-.\" @(#)rpc.3n 1.31 93/08/31 SMI; from SVr4
.\" Copyright 1989 AT&T
.\" $NetBSD: rpc.3,v 1.10 2000/06/02 23:11:12 fvdl Exp $
-.\" $FreeBSD$
.Dd May 7, 1993
.Dt RPC 3
.Os
diff --git a/lib/libc/rpc/rpc.5 b/lib/libc/rpc/rpc.5
index 398d9aa4b420..ac8219fc57fc 100644
--- a/lib/libc/rpc/rpc.5
+++ b/lib/libc/rpc/rpc.5
@@ -1,6 +1,4 @@
.\" $NetBSD: rpc.5,v 1.3 2000/06/15 20:05:54 fvdl Exp $
-.\" $FreeBSD$
-.\" @(#)rpc.4 1.17 93/08/30 SMI; from SVr4
.\" Copyright 1989 AT&T
.Dd December 10, 1991
.Dt RPC 5
diff --git a/lib/libc/rpc/rpc_callmsg.c b/lib/libc/rpc/rpc_callmsg.c
index 05294965c091..a06010cadc2f 100644
--- a/lib/libc/rpc/rpc_callmsg.c
+++ b/lib/libc/rpc/rpc_callmsg.c
@@ -30,13 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *sccsid2 = "@(#)rpc_callmsg.c 1.4 87/08/11 Copyr 1984 Sun Micro";
-static char *sccsid = "@(#)rpc_callmsg.c 2.1 88/07/29 4.0 RPCSRC";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* rpc_callmsg.c
*
diff --git a/lib/libc/rpc/rpc_clnt_auth.3 b/lib/libc/rpc/rpc_clnt_auth.3
index 863707e3da5e..36aafe85c677 100644
--- a/lib/libc/rpc/rpc_clnt_auth.3
+++ b/lib/libc/rpc/rpc_clnt_auth.3
@@ -1,9 +1,6 @@
-.\" @(#)rpc_clnt_auth.3n 1.21 93/05/07 SMI; from SVr4
.\" Copyright 1989 AT&T
-.\" @(#)rpc_clnt_auth 1.4 89/07/20 SMI;
.\" Copyright (c) 1988 Sun Microsystems, Inc. - All Rights Reserved.
.\" $NetBSD: rpc_clnt_auth.3,v 1.1 2000/06/03 09:29:50 fvdl Exp $
-.\" $FreeBSD$
.Dd May 7, 1993
.Dt RPC_CLNT_AUTH 3
.Os
diff --git a/lib/libc/rpc/rpc_clnt_calls.3 b/lib/libc/rpc/rpc_clnt_calls.3
index 213a7d184811..894ed8e92cc4 100644
--- a/lib/libc/rpc/rpc_clnt_calls.3
+++ b/lib/libc/rpc/rpc_clnt_calls.3
@@ -1,8 +1,5 @@
-.\" @(#)rpc_clnt_calls.3n 1.30 93/08/31 SMI; from SVr4
.\" Copyright 1989 AT&T
-.\" @(#)rpc_clnt_calls 1.4 89/07/20 SMI;
.\" Copyright (c) 1988 Sun Microsystems, Inc. - All Rights Reserved.
-.\" $FreeBSD$
.Dd May 7, 1993
.Dt RPC_CLNT_CALLS 3
.Os
diff --git a/lib/libc/rpc/rpc_clnt_create.3 b/lib/libc/rpc/rpc_clnt_create.3
index 079c9eb729bf..75bc3471faaa 100644
--- a/lib/libc/rpc/rpc_clnt_create.3
+++ b/lib/libc/rpc/rpc_clnt_create.3
@@ -1,9 +1,6 @@
-.\" @(#)rpc_clnt_create.3n 1.36 93/08/31 SMI; from SVr4
.\" Copyright 1989 AT&T
-.\" @(#)rpc_clnt_create 1.5 89/07/24 SMI;
.\" Copyright (c) 1988 Sun Microsystems, Inc. - All Rights Reserved.
.\" $NetBSD: rpc_clnt_create.3,v 1.2 2000/06/20 00:53:08 fvdl Exp $
-.\" $FreeBSD$
.Dd May 7, 1993
.Dt RPC_CLNT_CREATE 3
.Os
diff --git a/lib/libc/rpc/rpc_com.h b/lib/libc/rpc/rpc_com.h
index c0c144fc589d..e641e2d3e731 100644
--- a/lib/libc/rpc/rpc_com.h
+++ b/lib/libc/rpc/rpc_com.h
@@ -28,8 +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.
- *
- * $FreeBSD$
*/
/*
* Copyright (c) 1986 - 1991 by Sun Microsystems, Inc.
@@ -46,9 +44,6 @@
#ifndef _RPC_RPCCOM_H
#define _RPC_RPCCOM_H
-#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
@@ -62,7 +57,6 @@
__BEGIN_DECLS
extern u_int __rpc_get_a_size(int);
-extern int __rpc_dtbsize(void);
extern struct netconfig * __rpcgettp(int);
extern int __rpc_get_default_domain(char **);
diff --git a/lib/libc/rpc/rpc_commondata.c b/lib/libc/rpc/rpc_commondata.c
index 4506f3068e95..7b07dff11874 100644
--- a/lib/libc/rpc/rpc_commondata.c
+++ b/lib/libc/rpc/rpc_commondata.c
@@ -30,12 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *sccsid = "@(#)rpc_commondata.c 2.1 88/07/29 4.0 RPCSRC";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <rpc/rpc.h>
#include "un-namespace.h"
diff --git a/lib/libc/rpc/rpc_dtablesize.c b/lib/libc/rpc/rpc_dtablesize.c
index 59036dd23abf..c2cffecec24e 100644
--- a/lib/libc/rpc/rpc_dtablesize.c
+++ b/lib/libc/rpc/rpc_dtablesize.c
@@ -30,13 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *sccsid2 = "@(#)rpc_dtablesize.c 1.2 87/08/11 Copyr 1987 Sun Micro";
-static char *sccsid = "@(#)rpc_dtablesize.c 2.1 88/07/29 4.0 RPCSRC";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <unistd.h>
#include "un-namespace.h"
diff --git a/lib/libc/rpc/rpc_generic.c b/lib/libc/rpc/rpc_generic.c
index 6fbeaf77a7e7..d8b8e2cdf333 100644
--- a/lib/libc/rpc/rpc_generic.c
+++ b/lib/libc/rpc/rpc_generic.c
@@ -33,10 +33,6 @@
* Copyright (c) 1986-1991 by Sun Microsystems Inc.
*/
-/* #pragma ident "@(#)rpc_generic.c 1.17 94/04/24 SMI" */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* rpc_generic.c, Miscl routines for RPC.
*
@@ -107,29 +103,6 @@ static char *strlocase(char *);
#endif
static int getnettype(const char *);
-/*
- * Cache the result of getrlimit(), so we don't have to do an
- * expensive call every time.
- */
-int
-__rpc_dtbsize(void)
-{
- static int tbsize;
- struct rlimit rl;
-
- if (tbsize) {
- return (tbsize);
- }
- if (getrlimit(RLIMIT_NOFILE, &rl) == 0) {
- return (tbsize = (int)rl.rlim_max);
- }
- /*
- * Something wrong. I'll try to save face by returning a
- * pessimistic number.
- */
- return (32);
-}
-
/*
* Find the appropriate buffer size
diff --git a/lib/libc/rpc/rpc_prot.c b/lib/libc/rpc/rpc_prot.c
index a865d43fc185..48671462a52e 100644
--- a/lib/libc/rpc/rpc_prot.c
+++ b/lib/libc/rpc/rpc_prot.c
@@ -30,13 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *sccsid2 = "@(#)rpc_prot.c 1.36 87/08/11 Copyr 1984 Sun Micro";
-static char *sccsid = "@(#)rpc_prot.c 2.3 88/08/07 4.0 RPCSRC";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* rpc_prot.c
*
diff --git a/lib/libc/rpc/rpc_secure.3 b/lib/libc/rpc/rpc_secure.3
index 07c6314c9402..11b871b5c99d 100644
--- a/lib/libc/rpc/rpc_secure.3
+++ b/lib/libc/rpc/rpc_secure.3
@@ -1,5 +1,3 @@
-.\" @(#)rpc_secure.3n 2.1 88/08/08 4.0 RPCSRC; from 1.19 88/06/24 SMI
-.\" $FreeBSD$
.\"
.Dd February 16, 1988
.Dt RPC 3
diff --git a/lib/libc/rpc/rpc_soc.3 b/lib/libc/rpc/rpc_soc.3
index 1af57280916f..4abd4b14c475 100644
--- a/lib/libc/rpc/rpc_soc.3
+++ b/lib/libc/rpc/rpc_soc.3
@@ -1,6 +1,4 @@
-.\" @(#)rpc.3n 2.4 88/08/08 4.0 RPCSRC; from 1.19 88/06/24 SMI
.\" $NetBSD: rpc_soc.3,v 1.2 2000/06/07 13:39:43 simonb Exp $
-.\" $FreeBSD$
.\"
.Dd February 16, 1988
.Dt RPC_SOC 3
diff --git a/lib/libc/rpc/rpc_soc.c b/lib/libc/rpc/rpc_soc.c
index 1e5cd86d7ed4..c63b89594ce6 100644
--- a/lib/libc/rpc/rpc_soc.c
+++ b/lib/libc/rpc/rpc_soc.c
@@ -30,8 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-/* #ident "@(#)rpc_soc.c 1.17 94/04/24 SMI" */
-
/*
* Copyright (c) 1986-1991 by Sun Microsystems Inc.
* In addition, portions of such source code were derived from Berkeley
@@ -39,12 +37,6 @@
* California.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)rpc_soc.c 1.41 89/05/02 Copyr 1988 Sun Micro";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#ifdef PORTMAP
/*
* rpc_soc.c
@@ -120,11 +112,11 @@ clnt_com_create(struct sockaddr_in *raddr, rpcprog_t prog, rpcvers_t vers, int *
proto = strcmp(tp, "udp") == 0 ? IPPROTO_UDP : IPPROTO_TCP;
sport = pmap_getport(raddr, (u_long)prog, (u_long)vers,
proto);
+ mutex_lock(&rpcsoc_lock); /* pmap_getport is recursive */
if (sport == 0) {
goto err;
}
raddr->sin_port = htons(sport);
- mutex_lock(&rpcsoc_lock); /* pmap_getport is recursive */
}
/* Transform sockaddr_in to netbuf */
diff --git a/lib/libc/rpc/rpc_svc_calls.3 b/lib/libc/rpc/rpc_svc_calls.3
index 873296210cb4..503cf6a53b9c 100644
--- a/lib/libc/rpc/rpc_svc_calls.3
+++ b/lib/libc/rpc/rpc_svc_calls.3
@@ -1,9 +1,6 @@
-.\" @(#)rpc_svc_calls.3n 1.28 93/05/10 SMI; from SVr4
.\" Copyright 1989 AT&T
-.\" @(#)rpc_svc_calls 1.5 89/07/25 SMI;
.\" Copyright (c) 1988 Sun Microsystems, Inc. - All Rights Reserved.
.\" $NetBSD: rpc_svc_calls.3,v 1.1 2000/06/02 23:11:13 fvdl Exp $
-.\" $FreeBSD$
.Dd May 3, 1993
.Dt RPC_SVC_CALLS 3
.Os
diff --git a/lib/libc/rpc/rpc_svc_create.3 b/lib/libc/rpc/rpc_svc_create.3
index 4016a6c36b03..4c5dde45aabd 100644
--- a/lib/libc/rpc/rpc_svc_create.3
+++ b/lib/libc/rpc/rpc_svc_create.3
@@ -1,8 +1,5 @@
-.\" @(#)rpc_svc_create.3n 1.26 93/08/26 SMI; from SVr4
.\" Copyright 1989 AT&T
-.\" @(#)rpc_svc_create 1.3 89/06/28 SMI;
.\" Copyright (c) 1988 Sun Microsystems, Inc. - All Rights Reserved.
-.\" $FreeBSD$
.Dd May 3, 1993
.Dt RPC_SVC_CREATE 3
.Os
diff --git a/lib/libc/rpc/rpc_svc_err.3 b/lib/libc/rpc/rpc_svc_err.3
index 7a6b1f132f4c..c2724cefac5a 100644
--- a/lib/libc/rpc/rpc_svc_err.3
+++ b/lib/libc/rpc/rpc_svc_err.3
@@ -1,9 +1,6 @@
-.\" @(#)rpc_svc_err.3n 1.23 93/08/31 SMI; from SVr4
.\" Copyright 1989 AT&T
-.\" @(#)rpc_svc_err 1.4 89/06/28 SMI;
.\" Copyright (c) 1988 Sun Microsystems, Inc. - All Rights Reserved.
.\" $NetBSD: rpc_svc_err.3,v 1.1 2000/06/02 23:11:14 fvdl Exp $
-.\" $FreeBSD$
.Dd May 3, 1993
.Dt RPC_SVC_ERR 3
.Os
diff --git a/lib/libc/rpc/rpc_svc_reg.3 b/lib/libc/rpc/rpc_svc_reg.3
index 81a749a107e4..00c8259f6ef4 100644
--- a/lib/libc/rpc/rpc_svc_reg.3
+++ b/lib/libc/rpc/rpc_svc_reg.3
@@ -1,9 +1,6 @@
-.\" @(#)rpc_svc_reg.3n 1.32 93/08/31 SMI; from SVr4
.\" Copyright 1989 AT&T
-.\" @(#)rpc_svc_call 1.6 89/07/20 SMI;
.\" Copyright (c) 1988 Sun Microsystems, Inc. - All Rights Reserved.
.\" $NetBSD: rpc_svc_reg.3,v 1.1 2000/06/02 23:11:14 fvdl Exp $
-.\" $FreeBSD$
.Dd May 3, 1993
.Dt RPC_SVC_REG 3
.Os
diff --git a/lib/libc/rpc/rpc_xdr.3 b/lib/libc/rpc/rpc_xdr.3
index 62754fe7e285..1918684101c2 100644
--- a/lib/libc/rpc/rpc_xdr.3
+++ b/lib/libc/rpc/rpc_xdr.3
@@ -1,8 +1,5 @@
-.\" @(#)rpc_xdr.3n 1.24 93/08/31 SMI; from SVr4
.\" Copyright 1989 AT&T
-.\" @(#)rpc_xdr.new 1.1 89/04/06 SMI;
.\" Copyright (c) 1988 Sun Microsystems, Inc. - All Rights Reserved.
-.\" $FreeBSD$
.Dd May 3, 1993
.Dt RPC_XDR 3
.Os
diff --git a/lib/libc/rpc/rpcb_clnt.c b/lib/libc/rpc/rpcb_clnt.c
index f39d99bfeee3..a08cd82b4359 100644
--- a/lib/libc/rpc/rpcb_clnt.c
+++ b/lib/libc/rpc/rpcb_clnt.c
@@ -30,15 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-/* #ident "@(#)rpcb_clnt.c 1.27 94/04/24 SMI" */
-
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)rpcb_clnt.c 1.30 89/06/21 Copyr 1988 Sun Micro";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* rpcb_clnt.c
* interface to rpcbind rpc service.
@@ -742,6 +733,16 @@ __rpcb_findaddr_timed(rpcprog_t program, rpcvers_t version,
struct pmap pmapparms;
/*
+ * The comment below is now very old, having
+ * been committed to FreeBSD during an import
+ * from NetBSD in 2001. I do not believe there
+ * will still be any rpcbind servers that do
+ * UDP only and, since Azure requires use of
+ * TCP for NFSv3 mounts, comment this out
+ * so that NFSv3 mounts on Azure can work.
+ */
+#ifdef notnow
+ /*
* Try UDP only - there are some portmappers out
* there that use UDP only.
*/
@@ -754,9 +755,9 @@ __rpcb_findaddr_timed(rpcprog_t program, rpcvers_t version,
}
client = getclnthandle(host, newnconf, &parms.r_addr);
freenetconfigent(newnconf);
- } else {
+ } else
+#endif
client = getclnthandle(host, nconf, &parms.r_addr);
- }
if (client == NULL)
return (NULL);
diff --git a/lib/libc/rpc/rpcb_prot.c b/lib/libc/rpc/rpcb_prot.c
index 6cb7204f1a66..c6de3465898f 100644
--- a/lib/libc/rpc/rpcb_prot.c
+++ b/lib/libc/rpc/rpcb_prot.c
@@ -33,14 +33,6 @@
* Copyright (c) 1986-1991 by Sun Microsystems Inc.
*/
-/* #ident "@(#)rpcb_prot.c 1.13 94/04/24 SMI" */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)rpcb_prot.c 1.9 89/04/21 Copyr 1984 Sun Micro";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* rpcb_prot.c
* XDR routines for the rpcbinder version 3.
diff --git a/lib/libc/rpc/rpcb_st_xdr.c b/lib/libc/rpc/rpcb_st_xdr.c
index 5b0462715aec..ece2f284a980 100644
--- a/lib/libc/rpc/rpcb_st_xdr.c
+++ b/lib/libc/rpc/rpcb_st_xdr.c
@@ -39,9 +39,6 @@
* routines used with the rpcbind stats facility.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <rpc/rpc.h>
#include <rpc/rpc_com.h>
diff --git a/lib/libc/rpc/rpcbind.3 b/lib/libc/rpc/rpcbind.3
index 3bf8be9ffa90..aa5ffe62af7e 100644
--- a/lib/libc/rpc/rpcbind.3
+++ b/lib/libc/rpc/rpcbind.3
@@ -1,8 +1,6 @@
-.\" @(#)rpcbind.3n 1.25 93/05/07 SMI; from SVr4
.\" Copyright 1989 AT&T
.\" Copyright (c) 1988 Sun Microsystem's, Inc. - All Right's Reserved.
.\" $NetBSD: rpcbind.3,v 1.2 2000/06/03 18:47:28 fvdl Exp $
-.\" $FreeBSD$
.Dd May 7, 1993
.Dt RPCBIND 3
.Os
diff --git a/lib/libc/rpc/rpcdname.c b/lib/libc/rpc/rpcdname.c
index 3e7c4a7c2f1a..dff2ca464572 100644
--- a/lib/libc/rpc/rpcdname.c
+++ b/lib/libc/rpc/rpcdname.c
@@ -28,12 +28,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)rpcdname.c 1.7 91/03/11 Copyr 1989 Sun Micro";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* rpcdname.c
* Gets the default domain name
diff --git a/lib/libc/rpc/rpcsec_gss_stub.c b/lib/libc/rpc/rpcsec_gss_stub.c
index a24f250521f7..66f1663de307 100644
--- a/lib/libc/rpc/rpcsec_gss_stub.c
+++ b/lib/libc/rpc/rpcsec_gss_stub.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2006 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$
*/
#include <rpc/rpc.h>
diff --git a/lib/libc/rpc/rtime.3 b/lib/libc/rpc/rtime.3
index e657ca50aa18..3c245ab398ac 100644
--- a/lib/libc/rpc/rtime.3
+++ b/lib/libc/rpc/rtime.3
@@ -1,5 +1,3 @@
-.\" @(#)rtime.3n 2.1 88/08/08 4.0 RPCSRC; from 1.5 88/02/08 SMI
-.\" $FreeBSD$
.\"
.Dd May 13, 2021
.Dt RTIME 3
diff --git a/lib/libc/rpc/rtime.c b/lib/libc/rpc/rtime.c
index 4adca5c5f13d..0d4177142bf2 100644
--- a/lib/libc/rpc/rtime.c
+++ b/lib/libc/rpc/rtime.c
@@ -55,12 +55,6 @@
#include <netdb.h>
#include "un-namespace.h"
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)rtime.c 2.2 88/08/10 4.0 RPCSRC; from 1.8 88/02/08 SMI";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
extern int _rpc_dtablesize( void );
#define NYEARS (unsigned long)(1970 - 1900)
diff --git a/lib/libc/rpc/svc.c b/lib/libc/rpc/svc.c
index 801b32081a26..d3877a95b742 100644
--- a/lib/libc/rpc/svc.c
+++ b/lib/libc/rpc/svc.c
@@ -30,13 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *sccsid2 = "@(#)svc.c 1.44 88/02/08 Copyr 1984 Sun Micro";
-static char *sccsid = "@(#)svc.c 2.4 88/08/11 4.0 RPCSRC";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* svc.c, Server-side remote procedure call interface.
*
diff --git a/lib/libc/rpc/svc_auth.c b/lib/libc/rpc/svc_auth.c
index 20a84c60c18a..eb61171733d6 100644
--- a/lib/libc/rpc/svc_auth.c
+++ b/lib/libc/rpc/svc_auth.c
@@ -33,13 +33,6 @@
* Copyright (c) 1986-1991 by Sun Microsystems Inc.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-#ident "@(#)svc_auth.c 1.16 94/04/24 SMI"
-static char sccsid[] = "@(#)svc_auth.c 1.26 89/02/07 Copyr 1984 Sun Micro";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* svc_auth.c, Server-side rpc authenticator interface.
*
@@ -86,7 +79,7 @@ struct svc_auth_ops svc_auth_null_ops;
* set rqst->rq_xprt->verf to the appropriate response verifier;
* sets rqst->rq_client_cred to the "cooked" form of the credentials.
*
- * NB: rqst->rq_cxprt->verf must be pre-alloctaed;
+ * NB: rqst->rq_cxprt->verf must be pre-allocated;
* its length is set appropriately.
*
* The caller still owns and is responsible for msg->u.cmb.cred and
diff --git a/lib/libc/rpc/svc_auth_des.c b/lib/libc/rpc/svc_auth_des.c
index 8f742c39718a..d4736cc851e8 100644
--- a/lib/libc/rpc/svc_auth_des.c
+++ b/lib/libc/rpc/svc_auth_des.c
@@ -65,12 +65,6 @@
#include <rpc/svc_auth.h>
#include "libc_private.h"
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)svcauth_des.c 2.3 89/07/11 4.0 RPCSRC; from 1.15 88/02/08 SMI";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
extern int key_decryptsession_pk(const char *, netobj *, des_block *);
#define debug(msg) printf("svcauth_des: %s\n", msg)
diff --git a/lib/libc/rpc/svc_auth_unix.c b/lib/libc/rpc/svc_auth_unix.c
index de146b821600..2caab6fe9d9e 100644
--- a/lib/libc/rpc/svc_auth_unix.c
+++ b/lib/libc/rpc/svc_auth_unix.c
@@ -28,13 +28,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *sccsid2 = "@(#)svc_auth_unix.c 1.28 88/02/08 Copyr 1984 Sun Micro";
-static char *sccsid = "@(#)svc_auth_unix.c 2.3 88/08/01 4.0 RPCSRC";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* svc_auth_unix.c
* Handles UNIX flavor authentication parameters on the service side of rpc.
diff --git a/lib/libc/rpc/svc_dg.c b/lib/libc/rpc/svc_dg.c
index c7e0726270b7..892fe5ceaa53 100644
--- a/lib/libc/rpc/svc_dg.c
+++ b/lib/libc/rpc/svc_dg.c
@@ -34,12 +34,6 @@
* Copyright (c) 1986-1991 by Sun Microsystems Inc.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-#ident "@(#)svc_dg.c 1.17 94/04/24 SMI"
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* svc_dg.c, Server side for connectionless RPC.
*
diff --git a/lib/libc/rpc/svc_generic.c b/lib/libc/rpc/svc_generic.c
index 37ad3513c716..ea08811ba1ae 100644
--- a/lib/libc/rpc/svc_generic.c
+++ b/lib/libc/rpc/svc_generic.c
@@ -34,13 +34,6 @@
* Copyright (c) 1986-1991 by Sun Microsystems Inc.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-#ident "@(#)svc_generic.c 1.19 94/04/24 SMI"
-static char sccsid[] = "@(#)svc_generic.c 1.21 89/02/28 Copyr 1988 Sun Micro";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* svc_generic.c, Server side for RPC.
*
diff --git a/lib/libc/rpc/svc_raw.c b/lib/libc/rpc/svc_raw.c
index 05da6231af37..ceedb083eae6 100644
--- a/lib/libc/rpc/svc_raw.c
+++ b/lib/libc/rpc/svc_raw.c
@@ -33,14 +33,6 @@
* Copyright (c) 1986-1991 by Sun Microsystems Inc.
*/
-/* #ident "@(#)svc_raw.c 1.16 94/04/24 SMI" */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)svc_raw.c 1.25 89/01/31 Copyr 1984 Sun Micro";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* svc_raw.c, This a toy for simple testing and timing.
* Interface to create an rpc client and server in the same UNIX process.
diff --git a/lib/libc/rpc/svc_run.c b/lib/libc/rpc/svc_run.c
index a4723c42144f..2c71d2bd082c 100644
--- a/lib/libc/rpc/svc_run.c
+++ b/lib/libc/rpc/svc_run.c
@@ -30,13 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *sccsid2 = "from: @(#)svc_run.c 1.1 87/10/13 Copyr 1984 Sun Micro";
-static char *sccsid = "from: @(#)svc_run.c 2.1 88/07/29 4.0 RPCSRC";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* This is the rpc server side idle loop
* Wait for input, call server program.
diff --git a/lib/libc/rpc/svc_simple.c b/lib/libc/rpc/svc_simple.c
index fcf4199e611e..f4ce90f19bb4 100644
--- a/lib/libc/rpc/svc_simple.c
+++ b/lib/libc/rpc/svc_simple.c
@@ -33,10 +33,6 @@
* Copyright (c) 1986-1991 by Sun Microsystems Inc.
*/
-/* #pragma ident "@(#)svc_simple.c 1.18 94/04/24 SMI" */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* svc_simple.c
* Simplified front end to rpc.
diff --git a/lib/libc/rpc/svc_vc.c b/lib/libc/rpc/svc_vc.c
index a045903c8285..e5826fdb6543 100644
--- a/lib/libc/rpc/svc_vc.c
+++ b/lib/libc/rpc/svc_vc.c
@@ -30,18 +30,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *sccsid2 = "@(#)svc_tcp.c 1.21 87/08/11 Copyr 1984 Sun Micro";
-static char *sccsid = "@(#)svc_tcp.c 2.2 88/08/01 4.0 RPCSRC";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* svc_vc.c, Server side for Connection Oriented based RPC.
*
* Actually implements two flavors of transporter -
- * a tcp rendezvouser (a listner and connection establisher)
+ * a tcp rendezvouser (a listener and connection establisher)
* and a record/tcp stream.
*/
diff --git a/lib/libc/secure/Makefile.inc b/lib/libc/secure/Makefile.inc
index 239cd7b8d1c6..8574c5a05dc5 100644
--- a/lib/libc/secure/Makefile.inc
+++ b/lib/libc/secure/Makefile.inc
@@ -1,4 +1,3 @@
-# $FreeBSD$
#
# libc sources related to security
diff --git a/lib/libc/secure/Symbol.map b/lib/libc/secure/Symbol.map
index aaa76c17291a..641f451b5421 100644
--- a/lib/libc/secure/Symbol.map
+++ b/lib/libc/secure/Symbol.map
@@ -1,7 +1,3 @@
-/*
- * $FreeBSD$
- */
-
FBSD_1.0 {
__chk_fail;
__stack_chk_fail;
diff --git a/lib/libc/secure/stack_protector.c b/lib/libc/secure/stack_protector.c
index 7ddd6338ec55..28673caa3866 100644
--- a/lib/libc/secure/stack_protector.c
+++ b/lib/libc/secure/stack_protector.c
@@ -27,9 +27,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/sysctl.h>
#include <errno.h>
@@ -47,23 +44,15 @@ __FBSDID("$FreeBSD$");
* they're either not usually statically linked or they simply don't do things
* in constructors that would be adversely affected by their positioning with
* respect to this initialization.
- *
- * This conditional should be removed when GCC 4.2 is removed.
*/
-#if __has_attribute(__constructor__) || __GNUC_PREREQ__(4, 3)
-#define _GUARD_SETUP_CTOR_ATTR \
+static void __guard_setup(void)
__attribute__((__constructor__ (200), __used__));
-#else
-#define _GUARD_SETUP_CTOR_ATTR \
- __attribute__((__constructor__, __used__));
-#endif
extern long __stack_chk_guard[8];
extern int __sysctl(const int *name, u_int namelen, void *oldp,
size_t *oldlenp, void *newp, size_t newlen);
long __stack_chk_guard[8] = {0, 0, 0, 0, 0, 0, 0, 0};
-static void __guard_setup(void) _GUARD_SETUP_CTOR_ATTR;
static void __fail(const char *) __dead2;
void __stack_chk_fail(void) __dead2;
void __chk_fail(void) __dead2;
diff --git a/lib/libc/secure/stack_protector_compat.c b/lib/libc/secure/stack_protector_compat.c
index cacb863e75e6..1ca459222abe 100644
--- a/lib/libc/secure/stack_protector_compat.c
+++ b/lib/libc/secure/stack_protector_compat.c
@@ -4,8 +4,6 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
void __stack_chk_fail(void);
#ifdef PIC
diff --git a/lib/libc/softfloat/Makefile.inc b/lib/libc/softfloat/Makefile.inc
index fa0ee9d2977f..29ebd8881d10 100644
--- a/lib/libc/softfloat/Makefile.inc
+++ b/lib/libc/softfloat/Makefile.inc
@@ -1,5 +1,4 @@
# $NetBSD: Makefile.inc,v 1.10 2011/07/04 02:53:15 mrg Exp $
-# $FreeBSD$
SOFTFLOAT_BITS?=64
.PATH: ${LIBC_ARCH}/softfloat \
diff --git a/lib/libc/softfloat/README.NetBSD b/lib/libc/softfloat/README.NetBSD
index c6ca7a8753cc..e486eba748d0 100644
--- a/lib/libc/softfloat/README.NetBSD
+++ b/lib/libc/softfloat/README.NetBSD
@@ -1,5 +1,4 @@
$NetBSD: README.NetBSD,v 1.2 2002/05/21 23:51:05 bjh21 Exp $
-$FreeBSD$
This is a modified version of part of John Hauser's SoftFloat 2a package.
This version has been heavily modified to support its use with GCC to
diff --git a/lib/libc/softfloat/README.txt b/lib/libc/softfloat/README.txt
index fe28ccc294fb..b771b8c8e118 100644
--- a/lib/libc/softfloat/README.txt
+++ b/lib/libc/softfloat/README.txt
@@ -1,5 +1,4 @@
$NetBSD: README.txt,v 1.1 2000/06/06 08:15:02 bjh21 Exp $
-$FreeBSD$
Package Overview for SoftFloat Release 2a
diff --git a/lib/libc/softfloat/Symbol.map b/lib/libc/softfloat/Symbol.map
index c5849d3f1efe..d412eb417765 100644
--- a/lib/libc/softfloat/Symbol.map
+++ b/lib/libc/softfloat/Symbol.map
@@ -1,19 +1,9 @@
-/*
- * $FreeBSD$
- */
-
FBSD_1.0 {
- _fpgetmask;
fpgetmask;
- _fpgetround;
fpgetround;
- _fpgetsticky;
fpgetsticky;
- _fpsetmask;
fpsetmask;
- _fpsetround;
fpsetround;
- _fpsetsticky;
fpsetsticky;
};
diff --git a/lib/libc/softfloat/bits32/softfloat-macros b/lib/libc/softfloat/bits32/softfloat-macros
index db4e038eb0b7..59e6e76fe00d 100644
--- a/lib/libc/softfloat/bits32/softfloat-macros
+++ b/lib/libc/softfloat/bits32/softfloat-macros
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/*
===============================================================================
diff --git a/lib/libc/softfloat/bits32/softfloat.c b/lib/libc/softfloat/bits32/softfloat.c
index ad7c016bf043..91aa190695af 100644
--- a/lib/libc/softfloat/bits32/softfloat.c
+++ b/lib/libc/softfloat/bits32/softfloat.c
@@ -51,9 +51,6 @@ this code that are retained.
===============================================================================
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#ifdef SOFTFLOAT_FOR_GCC
#include "softfloat-for-gcc.h"
#endif
diff --git a/lib/libc/softfloat/bits64/softfloat-macros b/lib/libc/softfloat/bits64/softfloat-macros
index 7fedb0c348d0..22124031855c 100644
--- a/lib/libc/softfloat/bits64/softfloat-macros
+++ b/lib/libc/softfloat/bits64/softfloat-macros
@@ -1,5 +1,4 @@
/* $NetBSD: softfloat-macros,v 1.2 2009/02/16 10:23:35 tron Exp $ */
-/* $FreeBSD$ */
/*
===============================================================================
diff --git a/lib/libc/softfloat/bits64/softfloat.c b/lib/libc/softfloat/bits64/softfloat.c
index 79993fb207f5..b072588b33fb 100644
--- a/lib/libc/softfloat/bits64/softfloat.c
+++ b/lib/libc/softfloat/bits64/softfloat.c
@@ -44,9 +44,6 @@ this code that are retained.
===============================================================================
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#ifdef SOFTFLOAT_FOR_GCC
#include "softfloat-for-gcc.h"
#endif
diff --git a/lib/libc/softfloat/eqdf2.c b/lib/libc/softfloat/eqdf2.c
index 68bb55c30e2c..e642c467aa4a 100644
--- a/lib/libc/softfloat/eqdf2.c
+++ b/lib/libc/softfloat/eqdf2.c
@@ -4,9 +4,6 @@
* Written by Ben Harris, 2000. This file is in the Public Domain.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "softfloat-for-gcc.h"
#include "milieu.h"
#include "softfloat.h"
diff --git a/lib/libc/softfloat/eqsf2.c b/lib/libc/softfloat/eqsf2.c
index d45b806cc9f3..866db81bc5ab 100644
--- a/lib/libc/softfloat/eqsf2.c
+++ b/lib/libc/softfloat/eqsf2.c
@@ -4,9 +4,6 @@
* Written by Ben Harris, 2000. This file is in the Public Domain.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "softfloat-for-gcc.h"
#include "milieu.h"
#include "softfloat.h"
diff --git a/lib/libc/softfloat/eqtf2.c b/lib/libc/softfloat/eqtf2.c
index 1839404e1b1a..b7ae12d265b4 100644
--- a/lib/libc/softfloat/eqtf2.c
+++ b/lib/libc/softfloat/eqtf2.c
@@ -4,9 +4,6 @@
* Written by Matt Thomas, 2011. This file is in the Public Domain.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "softfloat-for-gcc.h"
#include "milieu.h"
#include "softfloat.h"
diff --git a/lib/libc/softfloat/fpgetmask.c b/lib/libc/softfloat/fpgetmask.c
index 2fe4c12c589d..86cf89020668 100644
--- a/lib/libc/softfloat/fpgetmask.c
+++ b/lib/libc/softfloat/fpgetmask.c
@@ -1,7 +1,7 @@
/* $NetBSD: fpgetmask.c,v 1.4 2008/04/28 20:23:00 martin Exp $ */
/*-
- * SPDX-License-Identifier: BSD-2-Clause-NetBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1997 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -31,9 +31,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <ieeefp.h>
@@ -43,13 +40,8 @@ __FBSDID("$FreeBSD$");
#include "milieu.h"
#include "softfloat.h"
-#ifdef __weak_alias
-__weak_alias(fpgetmask,_fpgetmask)
-#endif
-
fp_except
fpgetmask(void)
{
-
return float_exception_mask;
}
diff --git a/lib/libc/softfloat/fpgetround.c b/lib/libc/softfloat/fpgetround.c
index 0f15f2ae4517..2c060d86f5ae 100644
--- a/lib/libc/softfloat/fpgetround.c
+++ b/lib/libc/softfloat/fpgetround.c
@@ -1,7 +1,7 @@
/* $NetBSD: fpgetround.c,v 1.3 2008/04/28 20:23:00 martin Exp $ */
/*-
- * SPDX-License-Identifier: BSD-2-Clause-NetBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1997 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -31,9 +31,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <ieeefp.h>
diff --git a/lib/libc/softfloat/fpgetsticky.c b/lib/libc/softfloat/fpgetsticky.c
index 8ac7b90e9647..f42c348784e1 100644
--- a/lib/libc/softfloat/fpgetsticky.c
+++ b/lib/libc/softfloat/fpgetsticky.c
@@ -1,7 +1,7 @@
/* $NetBSD: fpgetsticky.c,v 1.3 2008/04/28 20:23:00 martin Exp $ */
/*-
- * SPDX-License-Identifier: BSD-2-Clause-NetBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1997 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -31,9 +31,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <ieeefp.h>
@@ -43,13 +40,8 @@ __FBSDID("$FreeBSD$");
#include "milieu.h"
#include "softfloat.h"
-#ifdef __weak_alias
-__weak_alias(fpgetsticky,_fpgetsticky)
-#endif
-
fp_except
fpgetsticky(void)
{
-
return float_exception_flags;
}
diff --git a/lib/libc/softfloat/fpsetmask.c b/lib/libc/softfloat/fpsetmask.c
index afbe64b2ee7f..b65a1e8de350 100644
--- a/lib/libc/softfloat/fpsetmask.c
+++ b/lib/libc/softfloat/fpsetmask.c
@@ -1,7 +1,7 @@
/* $NetBSD: fpsetmask.c,v 1.4 2008/04/28 20:23:00 martin Exp $ */
/*-
- * SPDX-License-Identifier: BSD-2-Clause-NetBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1997 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -31,9 +31,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <ieeefp.h>
diff --git a/lib/libc/softfloat/fpsetround.c b/lib/libc/softfloat/fpsetround.c
index 54df295000a4..f48a683bf6d8 100644
--- a/lib/libc/softfloat/fpsetround.c
+++ b/lib/libc/softfloat/fpsetround.c
@@ -1,7 +1,7 @@
/* $NetBSD: fpsetround.c,v 1.3 2008/04/28 20:23:00 martin Exp $ */
/*-
- * SPDX-License-Identifier: BSD-2-Clause-NetBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1997 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -31,9 +31,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <ieeefp.h>
diff --git a/lib/libc/softfloat/fpsetsticky.c b/lib/libc/softfloat/fpsetsticky.c
index 33c17120d33d..2a056c032645 100644
--- a/lib/libc/softfloat/fpsetsticky.c
+++ b/lib/libc/softfloat/fpsetsticky.c
@@ -1,7 +1,7 @@
/* $NetBSD: fpsetsticky.c,v 1.3 2008/04/28 20:23:00 martin Exp $ */
/*-
- * SPDX-License-Identifier: BSD-2-Clause-NetBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1997 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -31,9 +31,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <ieeefp.h>
diff --git a/lib/libc/softfloat/gedf2.c b/lib/libc/softfloat/gedf2.c
index 76e25de58a64..2d82ef394b54 100644
--- a/lib/libc/softfloat/gedf2.c
+++ b/lib/libc/softfloat/gedf2.c
@@ -8,9 +8,6 @@
#include "milieu.h"
#include "softfloat.h"
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
flag __gedf2(float64, float64);
flag
diff --git a/lib/libc/softfloat/gesf2.c b/lib/libc/softfloat/gesf2.c
index b22e13afb63d..8822ebecd983 100644
--- a/lib/libc/softfloat/gesf2.c
+++ b/lib/libc/softfloat/gesf2.c
@@ -8,9 +8,6 @@
#include "milieu.h"
#include "softfloat.h"
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
flag __gesf2(float32, float32);
flag
diff --git a/lib/libc/softfloat/getf2.c b/lib/libc/softfloat/getf2.c
index 8639c4d3916a..168cd00e2003 100644
--- a/lib/libc/softfloat/getf2.c
+++ b/lib/libc/softfloat/getf2.c
@@ -8,9 +8,6 @@
#include "milieu.h"
#include "softfloat.h"
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#ifdef FLOAT128
flag __getf2(float128, float128);
diff --git a/lib/libc/softfloat/gexf2.c b/lib/libc/softfloat/gexf2.c
index 70cf1c32d7ec..291b1d040409 100644
--- a/lib/libc/softfloat/gexf2.c
+++ b/lib/libc/softfloat/gexf2.c
@@ -8,9 +8,6 @@
#include "milieu.h"
#include "softfloat.h"
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#ifdef FLOATX80
flag __gexf2(floatx80, floatx80);
diff --git a/lib/libc/softfloat/gtdf2.c b/lib/libc/softfloat/gtdf2.c
index ff5764a519c6..c2a7d5d7264a 100644
--- a/lib/libc/softfloat/gtdf2.c
+++ b/lib/libc/softfloat/gtdf2.c
@@ -8,9 +8,6 @@
#include "milieu.h"
#include "softfloat.h"
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
flag __gtdf2(float64, float64);
flag
diff --git a/lib/libc/softfloat/gtsf2.c b/lib/libc/softfloat/gtsf2.c
index 8e7e7a9371c1..48988084f753 100644
--- a/lib/libc/softfloat/gtsf2.c
+++ b/lib/libc/softfloat/gtsf2.c
@@ -8,9 +8,6 @@
#include "milieu.h"
#include "softfloat.h"
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
flag __gtsf2(float32, float32);
flag
diff --git a/lib/libc/softfloat/gttf2.c b/lib/libc/softfloat/gttf2.c
index 519ea845f00c..22ebae560aaa 100644
--- a/lib/libc/softfloat/gttf2.c
+++ b/lib/libc/softfloat/gttf2.c
@@ -8,9 +8,6 @@
#include "milieu.h"
#include "softfloat.h"
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#ifdef FLOAT128
flag __gttf2(float128, float128);
diff --git a/lib/libc/softfloat/gtxf2.c b/lib/libc/softfloat/gtxf2.c
index fe8be52e7e2d..ea883d1fb848 100644
--- a/lib/libc/softfloat/gtxf2.c
+++ b/lib/libc/softfloat/gtxf2.c
@@ -8,9 +8,6 @@
#include "milieu.h"
#include "softfloat.h"
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#ifdef FLOATX80
flag __gtxf2(floatx80, floatx80);
diff --git a/lib/libc/softfloat/ledf2.c b/lib/libc/softfloat/ledf2.c
index 7d3e8fb54855..3be7f5e5fa75 100644
--- a/lib/libc/softfloat/ledf2.c
+++ b/lib/libc/softfloat/ledf2.c
@@ -8,9 +8,6 @@
#include "milieu.h"
#include "softfloat.h"
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
flag __ledf2(float64, float64);
flag
diff --git a/lib/libc/softfloat/lesf2.c b/lib/libc/softfloat/lesf2.c
index 6fa13e5e2467..e8d60d5733e0 100644
--- a/lib/libc/softfloat/lesf2.c
+++ b/lib/libc/softfloat/lesf2.c
@@ -8,9 +8,6 @@
#include "milieu.h"
#include "softfloat.h"
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
flag __lesf2(float32, float32);
flag
diff --git a/lib/libc/softfloat/letf2.c b/lib/libc/softfloat/letf2.c
index e9a18f8d5e5d..a5a25ebe0848 100644
--- a/lib/libc/softfloat/letf2.c
+++ b/lib/libc/softfloat/letf2.c
@@ -8,9 +8,6 @@
#include "milieu.h"
#include "softfloat.h"
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#ifdef FLOAT128
flag __letf2(float128, float128);
diff --git a/lib/libc/softfloat/ltdf2.c b/lib/libc/softfloat/ltdf2.c
index b8c668ccc01d..fa58b55f24f5 100644
--- a/lib/libc/softfloat/ltdf2.c
+++ b/lib/libc/softfloat/ltdf2.c
@@ -8,9 +8,6 @@
#include "milieu.h"
#include "softfloat.h"
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
flag __ltdf2(float64, float64);
flag
diff --git a/lib/libc/softfloat/ltsf2.c b/lib/libc/softfloat/ltsf2.c
index 8a1e8fa9e50b..e19b2f4328cf 100644
--- a/lib/libc/softfloat/ltsf2.c
+++ b/lib/libc/softfloat/ltsf2.c
@@ -8,9 +8,6 @@
#include "milieu.h"
#include "softfloat.h"
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
flag __ltsf2(float32, float32);
flag
diff --git a/lib/libc/softfloat/lttf2.c b/lib/libc/softfloat/lttf2.c
index 13c01b19528d..ce99f6cfee34 100644
--- a/lib/libc/softfloat/lttf2.c
+++ b/lib/libc/softfloat/lttf2.c
@@ -8,9 +8,6 @@
#include "milieu.h"
#include "softfloat.h"
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#ifdef FLOAT128
flag __lttf2(float128, float128);
diff --git a/lib/libc/softfloat/nedf2.c b/lib/libc/softfloat/nedf2.c
index 61f50443c9c5..a7af22a9a9e9 100644
--- a/lib/libc/softfloat/nedf2.c
+++ b/lib/libc/softfloat/nedf2.c
@@ -8,9 +8,6 @@
#include "milieu.h"
#include "softfloat.h"
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
flag __nedf2(float64, float64);
flag
diff --git a/lib/libc/softfloat/negdf2.c b/lib/libc/softfloat/negdf2.c
index 2485d586c475..e42d26d2287b 100644
--- a/lib/libc/softfloat/negdf2.c
+++ b/lib/libc/softfloat/negdf2.c
@@ -8,9 +8,6 @@
#include "milieu.h"
#include "softfloat.h"
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
float64 __negdf2(float64);
float64
diff --git a/lib/libc/softfloat/negsf2.c b/lib/libc/softfloat/negsf2.c
index 78f6c6bd5f1f..e4f33f3a8422 100644
--- a/lib/libc/softfloat/negsf2.c
+++ b/lib/libc/softfloat/negsf2.c
@@ -8,9 +8,6 @@
#include "milieu.h"
#include "softfloat.h"
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
float32 __negsf2(float32);
float32
diff --git a/lib/libc/softfloat/negtf2.c b/lib/libc/softfloat/negtf2.c
index 5be582dd8937..bb757a3d0a3e 100644
--- a/lib/libc/softfloat/negtf2.c
+++ b/lib/libc/softfloat/negtf2.c
@@ -8,9 +8,6 @@
#include "milieu.h"
#include "softfloat.h"
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#ifdef FLOAT128
float128 __negtf2(float128);
diff --git a/lib/libc/softfloat/negxf2.c b/lib/libc/softfloat/negxf2.c
index 0e2d08b25a67..acc59f0755c8 100644
--- a/lib/libc/softfloat/negxf2.c
+++ b/lib/libc/softfloat/negxf2.c
@@ -8,9 +8,6 @@
#include "milieu.h"
#include "softfloat.h"
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#ifdef FLOATX80
floatx80 __negxf2(floatx80);
diff --git a/lib/libc/softfloat/nesf2.c b/lib/libc/softfloat/nesf2.c
index b8317cbf8dd8..8f2d93681b61 100644
--- a/lib/libc/softfloat/nesf2.c
+++ b/lib/libc/softfloat/nesf2.c
@@ -8,9 +8,6 @@
#include "milieu.h"
#include "softfloat.h"
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
flag __nesf2(float32, float32);
flag
diff --git a/lib/libc/softfloat/netf2.c b/lib/libc/softfloat/netf2.c
index 26e17cd1f52d..17b54da01dd9 100644
--- a/lib/libc/softfloat/netf2.c
+++ b/lib/libc/softfloat/netf2.c
@@ -8,9 +8,6 @@
#include "milieu.h"
#include "softfloat.h"
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#ifdef FLOAT128
flag __netf2(float128, float128);
diff --git a/lib/libc/softfloat/nexf2.c b/lib/libc/softfloat/nexf2.c
index 153a70392d16..e48895d3eca2 100644
--- a/lib/libc/softfloat/nexf2.c
+++ b/lib/libc/softfloat/nexf2.c
@@ -8,9 +8,6 @@
#include "milieu.h"
#include "softfloat.h"
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#ifdef FLOATX80
flag __nexf2(floatx80, floatx80);
diff --git a/lib/libc/softfloat/softfloat-for-gcc.h b/lib/libc/softfloat/softfloat-for-gcc.h
index cf17e56768a9..8a62de032879 100644
--- a/lib/libc/softfloat/softfloat-for-gcc.h
+++ b/lib/libc/softfloat/softfloat-for-gcc.h
@@ -1,5 +1,4 @@
/* $NetBSD: softfloat-for-gcc.h,v 1.8 2009/12/14 01:07:42 matt Exp $ */
-/* $FreeBSD$ */
/*
* Move private identifiers with external linkage into implementation
diff --git a/lib/libc/softfloat/softfloat-history.txt b/lib/libc/softfloat/softfloat-history.txt
index d8c98db56ed4..14fe06687950 100644
--- a/lib/libc/softfloat/softfloat-history.txt
+++ b/lib/libc/softfloat/softfloat-history.txt
@@ -1,5 +1,4 @@
$NetBSD: softfloat-history.txt,v 1.1 2000/06/06 08:15:08 bjh21 Exp $
-$FreeBSD$
History of Major Changes to SoftFloat, up to Release 2a
diff --git a/lib/libc/softfloat/softfloat-source.txt b/lib/libc/softfloat/softfloat-source.txt
index 2a15f2add95b..49de2e021f0c 100644
--- a/lib/libc/softfloat/softfloat-source.txt
+++ b/lib/libc/softfloat/softfloat-source.txt
@@ -1,5 +1,4 @@
$NetBSD: softfloat-source.txt,v 1.2 2006/11/24 19:46:58 christos Exp $
-$FreeBSD$
SoftFloat Release 2a Source Documentation
diff --git a/lib/libc/softfloat/softfloat-specialize b/lib/libc/softfloat/softfloat-specialize
index b5eb8c34cdc8..13f2d6fa351a 100644
--- a/lib/libc/softfloat/softfloat-specialize
+++ b/lib/libc/softfloat/softfloat-specialize
@@ -1,5 +1,4 @@
/* $NetBSD: softfloat-specialize,v 1.6 2011/03/06 10:27:37 martin Exp $ */
-/* $FreeBSD$ */
/* This is a derivative work. */
diff --git a/lib/libc/softfloat/softfloat.txt b/lib/libc/softfloat/softfloat.txt
index 414506f7fef2..a3ad43e20401 100644
--- a/lib/libc/softfloat/softfloat.txt
+++ b/lib/libc/softfloat/softfloat.txt
@@ -1,5 +1,4 @@
$NetBSD: softfloat.txt,v 1.2 2006/11/24 19:46:58 christos Exp $
-$FreeBSD$
SoftFloat Release 2a General Documentation
diff --git a/lib/libc/softfloat/templates/milieu.h b/lib/libc/softfloat/templates/milieu.h
index 914efdf4fe7b..8a6414a8c86e 100644
--- a/lib/libc/softfloat/templates/milieu.h
+++ b/lib/libc/softfloat/templates/milieu.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/*
===============================================================================
diff --git a/lib/libc/softfloat/templates/softfloat-specialize b/lib/libc/softfloat/templates/softfloat-specialize
index b1a39021734f..07eea64ddcc3 100644
--- a/lib/libc/softfloat/templates/softfloat-specialize
+++ b/lib/libc/softfloat/templates/softfloat-specialize
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/*
===============================================================================
diff --git a/lib/libc/softfloat/templates/softfloat.h b/lib/libc/softfloat/templates/softfloat.h
index fd83aa43f133..aaf84e6842a0 100644
--- a/lib/libc/softfloat/templates/softfloat.h
+++ b/lib/libc/softfloat/templates/softfloat.h
@@ -1,4 +1,3 @@
-/* $FreeBSD$ */
/*
===============================================================================
diff --git a/lib/libc/softfloat/timesoftfloat.c b/lib/libc/softfloat/timesoftfloat.c
index b97c8b0f0d00..fc6d196f74ab 100644
--- a/lib/libc/softfloat/timesoftfloat.c
+++ b/lib/libc/softfloat/timesoftfloat.c
@@ -30,9 +30,6 @@ this code that are retained.
===============================================================================
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
diff --git a/lib/libc/softfloat/timesoftfloat.txt b/lib/libc/softfloat/timesoftfloat.txt
index addc64740c6d..53dfbf484a19 100644
--- a/lib/libc/softfloat/timesoftfloat.txt
+++ b/lib/libc/softfloat/timesoftfloat.txt
@@ -1,5 +1,4 @@
$NetBSD: timesoftfloat.txt,v 1.1 2000/06/06 08:15:11 bjh21 Exp $
-$FreeBSD$
Documentation for the `timesoftfloat' Program of SoftFloat Release 2a
@@ -60,7 +59,7 @@ of usage is written. It is also possible to evaluate all machine functions
in a single invocation as explained in the section _Function_Sets_ later in
this document.
-Ordinarily, a function's speed will be evaulated separately for each of
+Ordinarily, a function's speed will be evaluated separately for each of
the four rounding modes, one after the other. If the rounding mode is not
supposed to have any affect on the results of a function--for instance,
some operations do not require rounding--only the nearest/even rounding mode
diff --git a/lib/libc/softfloat/unorddf2.c b/lib/libc/softfloat/unorddf2.c
index 2986c8281475..7447b6a83de0 100644
--- a/lib/libc/softfloat/unorddf2.c
+++ b/lib/libc/softfloat/unorddf2.c
@@ -8,9 +8,6 @@
#include "milieu.h"
#include "softfloat.h"
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
flag __unorddf2(float64, float64);
flag
diff --git a/lib/libc/softfloat/unordsf2.c b/lib/libc/softfloat/unordsf2.c
index e2f4c8f0947c..9cc202f7e009 100644
--- a/lib/libc/softfloat/unordsf2.c
+++ b/lib/libc/softfloat/unordsf2.c
@@ -8,9 +8,6 @@
#include "milieu.h"
#include "softfloat.h"
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
flag __unordsf2(float32, float32);
flag
diff --git a/lib/libc/stdio/Makefile.inc b/lib/libc/stdio/Makefile.inc
index dcc8bc77a088..52497254ac86 100644
--- a/lib/libc/stdio/Makefile.inc
+++ b/lib/libc/stdio/Makefile.inc
@@ -1,5 +1,3 @@
-# @(#)Makefile.inc 8.3 (Berkeley) 4/17/94
-# $FreeBSD$
# stdio sources
.PATH: ${LIBC_SRCTOP}/stdio
@@ -43,50 +41,102 @@ MAN+= fclose.3 ferror.3 fflush.3 fgetln.3 fgets.3 fgetwln.3 fgetws.3 \
stdio.3 tmpnam.3 \
ungetc.3 ungetwc.3 wprintf.3 wscanf.3
-MLINKS+=fclose.3 fcloseall.3 fclose.3 fdclose.3
+MLINKS+=fclose.3 fcloseall.3 \
+ fclose.3 fdclose.3
MLINKS+=ferror.3 ferror_unlocked.3 \
- ferror.3 clearerr.3 ferror.3 clearerr_unlocked.3 \
- ferror.3 feof.3 ferror.3 feof_unlocked.3 \
- ferror.3 fileno.3 ferror.3 fileno_unlocked.3
+ ferror.3 clearerr.3 \
+ ferror.3 clearerr_unlocked.3 \
+ ferror.3 feof.3 \
+ ferror.3 feof_unlocked.3 \
+ ferror.3 fileno.3 \
+ ferror.3 fileno_unlocked.3
MLINKS+=fflush.3 fflush_unlocked.3 \
fflush.3 fpurge.3
MLINKS+=fgets.3 gets.3
MLINKS+=fgets.3 gets_s.3
-MLINKS+=flockfile.3 ftrylockfile.3 flockfile.3 funlockfile.3
-MLINKS+=fopen.3 fdopen.3 fopen.3 freopen.3 fopen.3 fmemopen.3
+MLINKS+=flockfile.3 ftrylockfile.3 \
+ flockfile.3 funlockfile.3
+MLINKS+=fopen.3 fdopen.3 \
+ fopen.3 freopen.3 \
+ fopen.3 fmemopen.3
MLINKS+=fputs.3 fputs_unlocked.3 \
fputs.3 puts.3
MLINKS+=fread.3 fread_unlocked.3 \
fread.3 fwrite.3 \
fread.3 fwrite_unlocked.3
-MLINKS+=fseek.3 fgetpos.3 fseek.3 fseeko.3 fseek.3 fsetpos.3 fseek.3 ftell.3 \
- fseek.3 ftello.3 fseek.3 rewind.3
-MLINKS+=funopen.3 fropen.3 funopen.3 fwopen.3
-MLINKS+=getc.3 fgetc.3 getc.3 getc_unlocked.3 getc.3 getchar.3 \
- getc.3 getchar_unlocked.3 getc.3 getw.3
+MLINKS+=fseek.3 fgetpos.3 \
+ fseek.3 fseeko.3 \
+ fseek.3 fsetpos.3 \
+ fseek.3 ftell.3 \
+ fseek.3 ftello.3 \
+ fseek.3 rewind.3
+MLINKS+=funopen.3 fropen.3 \
+ funopen.3 fwopen.3
+MLINKS+=getc.3 fgetc.3 \
+ getc.3 getc_unlocked.3 \
+ getc.3 getchar.3 \
+ getc.3 getchar_unlocked.3 \
+ getc.3 getw.3
MLINKS+=getline.3 getdelim.3
-MLINKS+=getwc.3 fgetwc.3 getwc.3 getwchar.3
-MLINKS+=mktemp.3 mkdtemp.3 mktemp.3 mkstemp.3 mktemp.3 mkstemps.3 \
- mktemp.3 mkostemp.3 mktemp.3 mkostemps.3 mktemp.3 mkostempsat.3
+MLINKS+=getwc.3 fgetwc.3 \
+ getwc.3 getwchar.3
+MLINKS+=mktemp.3 mkdtemp.3 \
+ mktemp.3 mkstemp.3 \
+ mktemp.3 mkstemps.3 \
+ mktemp.3 mkostemp.3 \
+ mktemp.3 mkostemps.3 \
+ mktemp.3 mkostempsat.3
MLINKS+=open_memstream.3 open_wmemstream.3
-MLINKS+=printf.3 asprintf.3 printf.3 dprintf.3 printf.3 fprintf.3 \
- printf.3 snprintf.3 printf.3 sprintf.3 \
- printf.3 vasprintf.3 printf.3 vdprintf.3 \
- printf.3 vfprintf.3 printf.3 vprintf.3 printf.3 vsnprintf.3 \
+MLINKS+=printf.3 asprintf.3 \
+ printf.3 dprintf.3 \
+ printf.3 fprintf.3 \
+ printf.3 snprintf.3 \
+ printf.3 sprintf.3 \
+ printf.3 vasprintf.3 \
+ printf.3 vdprintf.3 \
+ printf.3 vfprintf.3 \
+ printf.3 vprintf.3 \
+ printf.3 vsnprintf.3 \
printf.3 vsprintf.3
-MLINKS+=printf_l.3 asprintf_l.3 printf_l.3 fprintf_l.3 printf_l.3 snprintf_l.3 \
- printf_l.3 sprintf_l.3 printf_l.3 vasprintf_l.3 printf_l.3 vfprintf_l.3 \
- printf_l.3 vprintf_l.3 printf_l.3 vsnprintf_l.3 printf_l.3 vsprintf_l.3
-MLINKS+=putc.3 fputc.3 putc.3 putc_unlocked.3 putc.3 putchar.3 \
- putc.3 putchar_unlocked.3 putc.3 putw.3
-MLINKS+=putwc.3 fputwc.3 putwc.3 putwchar.3
-MLINKS+=scanf.3 fscanf.3 scanf.3 sscanf.3 scanf.3 vfscanf.3 scanf.3 vscanf.3 \
+MLINKS+=printf_l.3 asprintf_l.3 \
+ printf_l.3 fprintf_l.3 \
+ printf_l.3 snprintf_l.3 \
+ printf_l.3 sprintf_l.3 \
+ printf_l.3 vasprintf_l.3 \
+ printf_l.3 vfprintf_l.3 \
+ printf_l.3 vprintf_l.3 \
+ printf_l.3 vsnprintf_l.3 \
+ printf_l.3 vsprintf_l.3
+MLINKS+=putc.3 fputc.3 \
+ putc.3 fputc_unlocked.3 \
+ putc.3 putc_unlocked.3 \
+ putc.3 putchar.3 \
+ putc.3 putchar_unlocked.3 \
+ putc.3 putw.3
+MLINKS+=putwc.3 fputwc.3 \
+ putwc.3 putwchar.3
+MLINKS+=scanf.3 fscanf.3 \
+ scanf.3 sscanf.3 \
+ scanf.3 vfscanf.3 \
+ scanf.3 vscanf.3 \
scanf.3 vsscanf.3
-MLINKS+=scanf_l.3 fscanf_l.3 scanf_l.3 sscanf_l.3 scanf_l.3 vfscanf_l.3 \
- scanf_l.3 vscanf_l.3 scanf_l.3 vsscanf_l.3
-MLINKS+=setbuf.3 setbuffer.3 setbuf.3 setlinebuf.3 setbuf.3 setvbuf.3
-MLINKS+=tmpnam.3 tempnam.3 tmpnam.3 tmpfile.3
-MLINKS+=wprintf.3 fwprintf.3 wprintf.3 swprintf.3 \
- wprintf.3 vwprintf.3 wprintf.3 vfwprintf.3 wprintf.3 vswprintf.3
-MLINKS+=wscanf.3 fwscanf.3 wscanf.3 swscanf.3 wscanf.3 vwscanf.3 \
- wscanf.3 vswscanf.3 wscanf.3 vfwscanf.3
+MLINKS+=scanf_l.3 fscanf_l.3 \
+ scanf_l.3 sscanf_l.3 \
+ scanf_l.3 vfscanf_l.3 \
+ scanf_l.3 vscanf_l.3 \
+ scanf_l.3 vsscanf_l.3
+MLINKS+=setbuf.3 setbuffer.3 \
+ setbuf.3 setlinebuf.3 \
+ setbuf.3 setvbuf.3
+MLINKS+=tmpnam.3 tempnam.3 \
+ tmpnam.3 tmpfile.3
+MLINKS+=wprintf.3 fwprintf.3 \
+ wprintf.3 swprintf.3 \
+ wprintf.3 vwprintf.3 \
+ wprintf.3 vfwprintf.3 \
+ wprintf.3 vswprintf.3
+MLINKS+=wscanf.3 fwscanf.3 \
+ wscanf.3 swscanf.3 \
+ wscanf.3 vwscanf.3 \
+ wscanf.3 vswscanf.3 \
+ wscanf.3 vfwscanf.3
diff --git a/lib/libc/stdio/Symbol.map b/lib/libc/stdio/Symbol.map
index 4926b6f35729..d491b83c11fb 100644
--- a/lib/libc/stdio/Symbol.map
+++ b/lib/libc/stdio/Symbol.map
@@ -1,7 +1,3 @@
-/*
- * $FreeBSD$
- */
-
FBSD_1.0 {
flockfile;
ftrylockfile;
@@ -22,7 +18,6 @@ FBSD_1.0 {
fgetwln;
fgetws;
fileno;
- __sF;
__stdinp;
__stdoutp;
__stderrp;
diff --git a/lib/libc/stdio/_flock_stub.c b/lib/libc/stdio/_flock_stub.c
index 069ed64c4e99..5f81f29ac232 100644
--- a/lib/libc/stdio/_flock_stub.c
+++ b/lib/libc/stdio/_flock_stub.c
@@ -36,9 +36,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <stdio.h>
#include <stdlib.h>
diff --git a/lib/libc/stdio/asprintf.c b/lib/libc/stdio/asprintf.c
index 1d9034b653d5..f0e898c92c0c 100644
--- a/lib/libc/stdio/asprintf.c
+++ b/lib/libc/stdio/asprintf.c
@@ -8,7 +8,7 @@
* Chris Torek.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -37,9 +37,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
#include <stdarg.h>
#include <xlocale.h>
diff --git a/lib/libc/stdio/clrerr.c b/lib/libc/stdio/clrerr.c
index c9208c0c1c46..01ce88654c09 100644
--- a/lib/libc/stdio/clrerr.c
+++ b/lib/libc/stdio/clrerr.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)clrerr.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <stdio.h>
#include "un-namespace.h"
diff --git a/lib/libc/stdio/dprintf.c b/lib/libc/stdio/dprintf.c
index c6f4fbd87e1f..9e976b37379f 100644
--- a/lib/libc/stdio/dprintf.c
+++ b/lib/libc/stdio/dprintf.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2009 David Schultz <das@FreeBSD.org>
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <stdarg.h>
#include <stdio.h>
diff --git a/lib/libc/stdio/fclose.3 b/lib/libc/stdio/fclose.3
index 1b3c6c71f601..524ff9754bb4 100644
--- a/lib/libc/stdio/fclose.3
+++ b/lib/libc/stdio/fclose.3
@@ -30,10 +30,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)fclose.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd July 4, 2015
+.Dd February 13, 2024
.Dt FCLOSE 3
.Os
.Sh NAME
@@ -72,9 +69,6 @@ If
is not
.Dv NULL ,
the file descriptor will be written to it.
-If the
-.Fa fdp
-argument will be different then NULL the file descriptor will be returned in it,
If the stream does not have an associated file descriptor,
.Fa fdp
will be set to -1.
diff --git a/lib/libc/stdio/fclose.c b/lib/libc/stdio/fclose.c
index 84f890e3c38a..ba527f6e7108 100644
--- a/lib/libc/stdio/fclose.c
+++ b/lib/libc/stdio/fclose.c
@@ -33,12 +33,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fclose.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <errno.h>
#include <stdbool.h>
diff --git a/lib/libc/stdio/fcloseall.c b/lib/libc/stdio/fcloseall.c
index 6248c6123d02..ae6bd151ca9c 100644
--- a/lib/libc/stdio/fcloseall.c
+++ b/lib/libc/stdio/fcloseall.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (C) 2006 Daniel M. Eischen. All rights reserved.
*
@@ -25,9 +25,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
#include "local.h"
diff --git a/lib/libc/stdio/fdopen.c b/lib/libc/stdio/fdopen.c
index 64d619963e14..a0d7b71df782 100644
--- a/lib/libc/stdio/fdopen.c
+++ b/lib/libc/stdio/fdopen.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fdopen.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/types.h>
#include <fcntl.h>
diff --git a/lib/libc/stdio/feof.c b/lib/libc/stdio/feof.c
index ef6767fb2b1b..aefffcd36c70 100644
--- a/lib/libc/stdio/feof.c
+++ b/lib/libc/stdio/feof.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)feof.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <stdio.h>
#include "un-namespace.h"
diff --git a/lib/libc/stdio/ferror.3 b/lib/libc/stdio/ferror.3
index 1ff0dc48b8ff..71671f69f247 100644
--- a/lib/libc/stdio/ferror.3
+++ b/lib/libc/stdio/ferror.3
@@ -29,10 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)ferror.3 8.2 (Berkeley) 4/19/94
-.\" $FreeBSD$
-.\"
-.Dd January 28, 2009
+.Dd April 2, 2022
.Dt FERROR 3
.Os
.Sh NAME
@@ -129,3 +126,12 @@ and
.Fn ferror
conform to
.St -isoC .
+.Sh HISTORY
+The functions
+.Fn clearerr ,
+.Fn feof ,
+.Fn ferror ,
+and
+.Fn fileno
+first appeared in
+.At v7 .
diff --git a/lib/libc/stdio/ferror.c b/lib/libc/stdio/ferror.c
index bb29c27e1419..15f6f5a69e25 100644
--- a/lib/libc/stdio/ferror.c
+++ b/lib/libc/stdio/ferror.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)ferror.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <stdio.h>
#include "un-namespace.h"
diff --git a/lib/libc/stdio/fflush.3 b/lib/libc/stdio/fflush.3
index 7c1c7290224c..c311b7f473c5 100644
--- a/lib/libc/stdio/fflush.3
+++ b/lib/libc/stdio/fflush.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)fflush.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd May 1, 2020
.Dt FFLUSH 3
.Os
diff --git a/lib/libc/stdio/fflush.c b/lib/libc/stdio/fflush.c
index f7d2fbdc28e5..84cba7619866 100644
--- a/lib/libc/stdio/fflush.c
+++ b/lib/libc/stdio/fflush.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fflush.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <errno.h>
#include <stdio.h>
@@ -106,10 +100,10 @@ int
__sflush(FILE *fp)
{
unsigned char *p;
- int n, t;
+ int n, f, t;
- t = fp->_flags;
- if ((t & __SWR) == 0)
+ f = fp->_flags;
+ if ((f & __SWR) == 0)
return (0);
if ((p = fp->_bf._base) == NULL)
@@ -122,19 +116,18 @@ __sflush(FILE *fp)
* exchange buffering (via setvbuf) in user write function.
*/
fp->_p = p;
- fp->_w = t & (__SLBF|__SNBF) ? 0 : fp->_bf._size;
+ fp->_w = f & (__SLBF|__SNBF) ? 0 : fp->_bf._size;
for (; n > 0; n -= t, p += t) {
t = _swrite(fp, (char *)p, n);
if (t <= 0) {
- /* Reset _p and _w. */
- if (p > fp->_p) {
+ if (p > fp->_p)
/* Some was written. */
memmove(fp->_p, p, n);
- fp->_p += n;
- if ((fp->_flags & (__SLBF | __SNBF)) == 0)
- fp->_w -= n;
- }
+ /* Reset _p and _w. */
+ fp->_p += n;
+ if ((fp->_flags & __SNBF) == 0)
+ fp->_w -= n;
fp->_flags |= __SERR;
return (EOF);
}
diff --git a/lib/libc/stdio/fgetc.c b/lib/libc/stdio/fgetc.c
index bb94f2ed5559..d05d9de3cc9f 100644
--- a/lib/libc/stdio/fgetc.c
+++ b/lib/libc/stdio/fgetc.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fgetc.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <stdio.h>
#include "un-namespace.h"
diff --git a/lib/libc/stdio/fgetln.3 b/lib/libc/stdio/fgetln.3
index f723ce24791a..09fd014cde00 100644
--- a/lib/libc/stdio/fgetln.3
+++ b/lib/libc/stdio/fgetln.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)fgetln.3 8.3 (Berkeley) 4/19/94
-.\" $FreeBSD$
-.\"
.Dd June 11, 2020
.Dt FGETLN 3
.Os
diff --git a/lib/libc/stdio/fgetln.c b/lib/libc/stdio/fgetln.c
index f3e4a6874a4b..ad37a2e15c61 100644
--- a/lib/libc/stdio/fgetln.c
+++ b/lib/libc/stdio/fgetln.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fgetln.c 8.2 (Berkeley) 1/2/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <errno.h>
#include <limits.h>
diff --git a/lib/libc/stdio/fgetpos.c b/lib/libc/stdio/fgetpos.c
index c592ef0fc224..930e26b762f5 100644
--- a/lib/libc/stdio/fgetpos.c
+++ b/lib/libc/stdio/fgetpos.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fgetpos.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
int
diff --git a/lib/libc/stdio/fgets.3 b/lib/libc/stdio/fgets.3
index 8b4bd388b7e3..0f6c3e41896c 100644
--- a/lib/libc/stdio/fgets.3
+++ b/lib/libc/stdio/fgets.3
@@ -29,10 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)fgets.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd September 1, 2019
+.Dd April 2, 2022
.Dt FGETS 3
.Os
.Sh NAME
@@ -147,3 +144,10 @@ K.3.7.4.1.
.Fn gets
has been removed from
.St -isoC-2011 .
+.Sh HISTORY
+The functions
+.Fn fgets
+and
+.Fn gets
+first appeared in
+.At v7 .
diff --git a/lib/libc/stdio/fgets.c b/lib/libc/stdio/fgets.c
index ceb48562fe30..19f68304efc1 100644
--- a/lib/libc/stdio/fgets.c
+++ b/lib/libc/stdio/fgets.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fgets.c 8.2 (Berkeley) 12/22/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <errno.h>
#include <stdio.h>
diff --git a/lib/libc/stdio/fgetwc.c b/lib/libc/stdio/fgetwc.c
index edad907fe806..53d1f9564fe2 100644
--- a/lib/libc/stdio/fgetwc.c
+++ b/lib/libc/stdio/fgetwc.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002-2004 Tim J. Robbins.
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <errno.h>
#include <stdio.h>
diff --git a/lib/libc/stdio/fgetwln.3 b/lib/libc/stdio/fgetwln.3
index c5fda8631c68..9e863a1bd460 100644
--- a/lib/libc/stdio/fgetwln.3
+++ b/lib/libc/stdio/fgetwln.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)fgetln.3 8.3 (Berkeley) 4/19/94
-.\" $FreeBSD$
-.\"
.Dd July 16, 2004
.Dt FGETWLN 3
.Os
diff --git a/lib/libc/stdio/fgetwln.c b/lib/libc/stdio/fgetwln.c
index b9077d68fc21..3a8e12b30c07 100644
--- a/lib/libc/stdio/fgetwln.c
+++ b/lib/libc/stdio/fgetwln.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002-2004 Tim J. Robbins.
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <stdio.h>
#include <wchar.h>
diff --git a/lib/libc/stdio/fgetws.3 b/lib/libc/stdio/fgetws.3
index 09efa0a31b30..5da940525d24 100644
--- a/lib/libc/stdio/fgetws.3
+++ b/lib/libc/stdio/fgetws.3
@@ -28,10 +28,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.
-.\"
-.\" @(#)fgets.3 8.1 (Berkeley) 6/4/93
.\" FreeBSD: src/lib/libc/stdio/fgets.3,v 1.16 2002/05/31 05:01:17 archie Exp
-.\" $FreeBSD$
.\"
.Dd August 6, 2002
.Dt FGETWS 3
diff --git a/lib/libc/stdio/fgetws.c b/lib/libc/stdio/fgetws.c
index 84fc387ecae4..1aa94e50f186 100644
--- a/lib/libc/stdio/fgetws.c
+++ b/lib/libc/stdio/fgetws.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002-2004 Tim J. Robbins.
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <errno.h>
#include <stdio.h>
diff --git a/lib/libc/stdio/fileno.c b/lib/libc/stdio/fileno.c
index 81673cd89034..66502430dc3d 100644
--- a/lib/libc/stdio/fileno.c
+++ b/lib/libc/stdio/fileno.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fileno.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <stdio.h>
#include "un-namespace.h"
diff --git a/lib/libc/stdio/findfp.c b/lib/libc/stdio/findfp.c
index b30a06ffd9e5..3729adf8d8dc 100644
--- a/lib/libc/stdio/findfp.c
+++ b/lib/libc/stdio/findfp.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)findfp.c 8.2 (Berkeley) 1/4/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <machine/atomic.h>
#include <unistd.h>
diff --git a/lib/libc/stdio/flags.c b/lib/libc/stdio/flags.c
index a034c1674c98..ef7ee38b8e2a 100644
--- a/lib/libc/stdio/flags.c
+++ b/lib/libc/stdio/flags.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)flags.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/file.h>
#include <stdio.h>
diff --git a/lib/libc/stdio/floatio.h b/lib/libc/stdio/floatio.h
index 00af7eaba561..ef8c0fa84528 100644
--- a/lib/libc/stdio/floatio.h
+++ b/lib/libc/stdio/floatio.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.
- *
- * @(#)floatio.h 8.1 (Berkeley) 6/4/93
- * $FreeBSD$
*/
/*
diff --git a/lib/libc/stdio/flockfile.3 b/lib/libc/stdio/flockfile.3
index a895a0aae045..9a76dca8557c 100644
--- a/lib/libc/stdio/flockfile.3
+++ b/lib/libc/stdio/flockfile.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd January 10, 2003
.Dt FLOCKFILE 3
.Os
diff --git a/lib/libc/stdio/fmemopen.c b/lib/libc/stdio/fmemopen.c
index 8faf2fa146db..2f835a34951b 100644
--- a/lib/libc/stdio/fmemopen.c
+++ b/lib/libc/stdio/fmemopen.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (C) 2013 Pietro Cerutti <gahr@FreeBSD.org>
*
@@ -25,9 +25,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <fcntl.h>
#include <stdbool.h>
#include <stdio.h>
diff --git a/lib/libc/stdio/fopen.3 b/lib/libc/stdio/fopen.3
index f984a7f9a27b..3d69dc1fec13 100644
--- a/lib/libc/stdio/fopen.3
+++ b/lib/libc/stdio/fopen.3
@@ -29,10 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)fopen.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd May 1, 2020
+.Dd September 1, 2023
.Dt FOPEN 3
.Os
.Sh NAME
@@ -52,7 +49,7 @@
.Ft FILE *
.Fn freopen "const char *path" "const char *mode" "FILE *stream"
.Ft FILE *
-.Fn fmemopen "void *restrict *buf" "size_t size" "const char * restrict mode"
+.Fn fmemopen "void * restrict buf" "size_t size" "const char * restrict mode"
.Sh DESCRIPTION
The
.Fn fopen
@@ -145,8 +142,10 @@ Reads and writes may be intermixed on read/write streams in any order,
and do not require an intermediate seek as in previous versions of
.Em stdio .
This is not portable to other systems, however;
-.Tn ANSI C
-requires that
+.St -isoC
+and
+.St -p1003.1
+both require that
a file positioning function intervene between output and input, unless
an input operation encounters end-of-file.
.Pp
@@ -247,9 +246,10 @@ byte.
.Sh RETURN VALUES
Upon successful completion
.Fn fopen ,
-.Fn fdopen
-and
+.Fn fdopen ,
.Fn freopen
+and
+.Fn fmemopen
return a
.Tn FILE
pointer.
diff --git a/lib/libc/stdio/fopen.c b/lib/libc/stdio/fopen.c
index cb71387e0f38..f76f0fb09087 100644
--- a/lib/libc/stdio/fopen.c
+++ b/lib/libc/stdio/fopen.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fopen.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/lib/libc/stdio/fopencookie.3 b/lib/libc/stdio/fopencookie.3
index 349b3499b6bb..09a6b6e01c0b 100644
--- a/lib/libc/stdio/fopencookie.3
+++ b/lib/libc/stdio/fopencookie.3
@@ -22,8 +22,6 @@
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd May 9, 2016
.Dt FOPENCOOKIE 3
.Os
diff --git a/lib/libc/stdio/fopencookie.c b/lib/libc/stdio/fopencookie.c
index 6dc39538df86..ef49d3d10f16 100644
--- a/lib/libc/stdio/fopencookie.c
+++ b/lib/libc/stdio/fopencookie.c
@@ -24,9 +24,6 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/fcntl.h>
#include <errno.h>
diff --git a/lib/libc/stdio/fprintf.c b/lib/libc/stdio/fprintf.c
index 95b71cc065c7..9b2cbb0849a7 100644
--- a/lib/libc/stdio/fprintf.c
+++ b/lib/libc/stdio/fprintf.c
@@ -8,7 +8,7 @@
* Chris Torek.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -37,12 +37,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fprintf.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
#include <stdarg.h>
#include "xlocale_private.h"
diff --git a/lib/libc/stdio/fpurge.c b/lib/libc/stdio/fpurge.c
index aa5daf2ca078..0914b977ad49 100644
--- a/lib/libc/stdio/fpurge.c
+++ b/lib/libc/stdio/fpurge.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fpurge.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <errno.h>
#include <stdio.h>
diff --git a/lib/libc/stdio/fputc.c b/lib/libc/stdio/fputc.c
index a2d2d14655bc..3d8409c465b8 100644
--- a/lib/libc/stdio/fputc.c
+++ b/lib/libc/stdio/fputc.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fputc.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <stdio.h>
#include "un-namespace.h"
diff --git a/lib/libc/stdio/fputs.3 b/lib/libc/stdio/fputs.3
index 1e02eb340f5d..dc85113dd791 100644
--- a/lib/libc/stdio/fputs.3
+++ b/lib/libc/stdio/fputs.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)fputs.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd January 23, 2020
.Dt FPUTS 3
.Os
diff --git a/lib/libc/stdio/fputs.c b/lib/libc/stdio/fputs.c
index 1fbae3593223..8bafa23d4131 100644
--- a/lib/libc/stdio/fputs.c
+++ b/lib/libc/stdio/fputs.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fputs.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <limits.h>
#include <stdio.h>
diff --git a/lib/libc/stdio/fputwc.c b/lib/libc/stdio/fputwc.c
index 666dd8bcc9d1..7955a4e811b2 100644
--- a/lib/libc/stdio/fputwc.c
+++ b/lib/libc/stdio/fputwc.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002-2004 Tim J. Robbins.
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <errno.h>
#include <limits.h>
diff --git a/lib/libc/stdio/fputws.3 b/lib/libc/stdio/fputws.3
index 1232e9028d1c..920d0e0cf658 100644
--- a/lib/libc/stdio/fputws.3
+++ b/lib/libc/stdio/fputws.3
@@ -28,10 +28,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.
-.\"
-.\" @(#)fputs.3 8.1 (Berkeley) 6/4/93
.\" FreeBSD: src/lib/libc/stdio/fputs.3,v 1.8 2001/10/01 16:08:59 ru Exp
-.\" $FreeBSD$
.\"
.Dd August 6, 2002
.Dt FPUTWS 3
diff --git a/lib/libc/stdio/fputws.c b/lib/libc/stdio/fputws.c
index 56357b650979..105fc426cb9c 100644
--- a/lib/libc/stdio/fputws.c
+++ b/lib/libc/stdio/fputws.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002-2004 Tim J. Robbins.
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <errno.h>
#include <limits.h>
diff --git a/lib/libc/stdio/fread.3 b/lib/libc/stdio/fread.3
index 925f382939d9..dfa7c8df18a3 100644
--- a/lib/libc/stdio/fread.3
+++ b/lib/libc/stdio/fread.3
@@ -29,10 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)fread.3 8.2 (Berkeley) 3/8/94
-.\" $FreeBSD$
-.\"
-.Dd January 23, 2020
+.Dd April 2, 2022
.Dt FREAD 3
.Os
.Sh NAME
@@ -124,3 +121,10 @@ and
.Fn fwrite
conform to
.St -isoC .
+.Sh HISTORY
+The functions
+.Fn fread
+and
+.Fn fwrite
+first appeared in
+.At v7 .
diff --git a/lib/libc/stdio/fread.c b/lib/libc/stdio/fread.c
index 11f8d13f0caf..bf943fdd1d0d 100644
--- a/lib/libc/stdio/fread.c
+++ b/lib/libc/stdio/fread.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fread.c 8.2 (Berkeley) 12/11/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <errno.h>
#include <stdint.h>
@@ -129,11 +123,13 @@ __fread(void * __restrict buf, size_t size, size_t count, FILE * __restrict fp)
}
while (resid > (r = fp->_r)) {
- (void)memcpy((void *)p, (void *)fp->_p, (size_t)r);
- fp->_p += r;
- /* fp->_r = 0 ... done in __srefill */
- p += r;
- resid -= r;
+ if (r != 0) {
+ (void)memcpy((void *)p, (void *)fp->_p, (size_t)r);
+ fp->_p += r;
+ /* fp->_r = 0 ... done in __srefill */
+ p += r;
+ resid -= r;
+ }
if (__srefill(fp)) {
/* no more input: return partial result */
return ((total - resid) / size);
diff --git a/lib/libc/stdio/freopen.c b/lib/libc/stdio/freopen.c
index fce965089a54..f0732b6d6741 100644
--- a/lib/libc/stdio/freopen.c
+++ b/lib/libc/stdio/freopen.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)freopen.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/lib/libc/stdio/fscanf.c b/lib/libc/stdio/fscanf.c
index 6d2cfe9b5a3f..f2dc9cf6e787 100644
--- a/lib/libc/stdio/fscanf.c
+++ b/lib/libc/stdio/fscanf.c
@@ -8,7 +8,7 @@
* Chris Torek.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -37,12 +37,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fscanf.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <stdio.h>
#include <stdarg.h>
diff --git a/lib/libc/stdio/fseek.3 b/lib/libc/stdio/fseek.3
index 19831f773e4e..521ded3a09d7 100644
--- a/lib/libc/stdio/fseek.3
+++ b/lib/libc/stdio/fseek.3
@@ -29,10 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)fseek.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd March 19, 2004
+.Dd April 2, 2022
.Dt FSEEK 3
.Os
.Sh NAME
@@ -267,3 +264,11 @@ and
.Fn ftello
functions conform to
.St -p1003.1-2001 .
+.Sh HISTORY
+The functions
+.Fn fseek ,
+.Fn ftell ,
+and
+.Fn rewind
+first appeared in
+.At v7 .
diff --git a/lib/libc/stdio/fseek.c b/lib/libc/stdio/fseek.c
index 5fcd49f23c5f..c19d682ec667 100644
--- a/lib/libc/stdio/fseek.c
+++ b/lib/libc/stdio/fseek.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fseek.c 8.3 (Berkeley) 1/2/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/lib/libc/stdio/fsetpos.c b/lib/libc/stdio/fsetpos.c
index 4bb7c112fb06..caca58dad710 100644
--- a/lib/libc/stdio/fsetpos.c
+++ b/lib/libc/stdio/fsetpos.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fsetpos.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <stdio.h>
diff --git a/lib/libc/stdio/ftell.c b/lib/libc/stdio/ftell.c
index df73823c58ce..c74ae03ec7db 100644
--- a/lib/libc/stdio/ftell.c
+++ b/lib/libc/stdio/ftell.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)ftell.c 8.2 (Berkeley) 5/4/95";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/types.h>
#include <errno.h>
diff --git a/lib/libc/stdio/funopen.3 b/lib/libc/stdio/funopen.3
index e6988d0044c5..f3234af229f7 100644
--- a/lib/libc/stdio/funopen.3
+++ b/lib/libc/stdio/funopen.3
@@ -27,9 +27,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)funopen.3 8.1 (Berkeley) 6/9/93
-.\" $FreeBSD$
-.\"
.Dd May 9, 2016
.Dt FUNOPEN 3
.Os
diff --git a/lib/libc/stdio/funopen.c b/lib/libc/stdio/funopen.c
index 4b1a31e2a962..87a3179f5908 100644
--- a/lib/libc/stdio/funopen.c
+++ b/lib/libc/stdio/funopen.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)funopen.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
#include <errno.h>
diff --git a/lib/libc/stdio/fvwrite.c b/lib/libc/stdio/fvwrite.c
index 50b32b8eca6e..2d5aaf3c5dc8 100644
--- a/lib/libc/stdio/fvwrite.c
+++ b/lib/libc/stdio/fvwrite.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fvwrite.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/lib/libc/stdio/fvwrite.h b/lib/libc/stdio/fvwrite.h
index 406f138d7db8..ce6dc67a6ed2 100644
--- a/lib/libc/stdio/fvwrite.h
+++ b/lib/libc/stdio/fvwrite.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.
- *
- * @(#)fvwrite.h 8.1 (Berkeley) 6/4/93
- * $FreeBSD$
*/
/*
diff --git a/lib/libc/stdio/fwalk.c b/lib/libc/stdio/fwalk.c
index 37691a715c53..fc93ee075051 100644
--- a/lib/libc/stdio/fwalk.c
+++ b/lib/libc/stdio/fwalk.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fwalk.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <stdio.h>
#include "local.h"
diff --git a/lib/libc/stdio/fwide.3 b/lib/libc/stdio/fwide.3
index 6ff8d9264995..597e2a5bf3e4 100644
--- a/lib/libc/stdio/fwide.3
+++ b/lib/libc/stdio/fwide.3
@@ -25,7 +25,6 @@
.\" SUCH DAMAGE.
.\"
.\" $Citrus: xpg4dl/FreeBSD/lib/libc/stdio/fwide.3,v 1.2 2001/12/07 04:47:08 yamt Exp $
-.\" $FreeBSD$
.\"
.Dd October 24, 2001
.Dt FWIDE 3
diff --git a/lib/libc/stdio/fwide.c b/lib/libc/stdio/fwide.c
index b7a8b3909196..86eb5b5299f8 100644
--- a/lib/libc/stdio/fwide.c
+++ b/lib/libc/stdio/fwide.c
@@ -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.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <errno.h>
#include <stdio.h>
diff --git a/lib/libc/stdio/fwprintf.c b/lib/libc/stdio/fwprintf.c
index fb00c2e4b20d..f2a28ad4b08a 100644
--- a/lib/libc/stdio/fwprintf.c
+++ b/lib/libc/stdio/fwprintf.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002 Tim J. Robbins
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdarg.h>
#include <stdio.h>
#include <wchar.h>
diff --git a/lib/libc/stdio/fwrite.c b/lib/libc/stdio/fwrite.c
index cb20931f5838..bbe2afb683c3 100644
--- a/lib/libc/stdio/fwrite.c
+++ b/lib/libc/stdio/fwrite.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fwrite.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <errno.h>
#include <stdint.h>
diff --git a/lib/libc/stdio/fwscanf.c b/lib/libc/stdio/fwscanf.c
index df31be7b5bf1..833a31a8f1b9 100644
--- a/lib/libc/stdio/fwscanf.c
+++ b/lib/libc/stdio/fwscanf.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002 Tim J. Robbins
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdarg.h>
#include <stdio.h>
#include <wchar.h>
diff --git a/lib/libc/stdio/getc.3 b/lib/libc/stdio/getc.3
index f97ca6382ad3..02f0f2f06f4a 100644
--- a/lib/libc/stdio/getc.3
+++ b/lib/libc/stdio/getc.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)getc.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd April 4, 2020
.Dt GETC 3
.Os
diff --git a/lib/libc/stdio/getc.c b/lib/libc/stdio/getc.c
index 5329810ca14c..61b184115004 100644
--- a/lib/libc/stdio/getc.c
+++ b/lib/libc/stdio/getc.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getc.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <stdio.h>
#include "un-namespace.h"
diff --git a/lib/libc/stdio/getchar.c b/lib/libc/stdio/getchar.c
index e29dd7136a4c..02ac4893b5e8 100644
--- a/lib/libc/stdio/getchar.c
+++ b/lib/libc/stdio/getchar.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getchar.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* A subroutine version of the macro getchar.
*/
diff --git a/lib/libc/stdio/getdelim.c b/lib/libc/stdio/getdelim.c
index ad1439ed071f..7543fefc3a57 100644
--- a/lib/libc/stdio/getdelim.c
+++ b/lib/libc/stdio/getdelim.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2009 David Schultz <das@FreeBSD.org>
* Copyright (c) 2021 Dell EMC
@@ -27,9 +27,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#include <errno.h>
diff --git a/lib/libc/stdio/getline.3 b/lib/libc/stdio/getline.3
index 0b8bf634a7c8..3c01ef07b597 100644
--- a/lib/libc/stdio/getline.3
+++ b/lib/libc/stdio/getline.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd July 30, 2016
.Dt GETLINE 3
.Os
diff --git a/lib/libc/stdio/getline.c b/lib/libc/stdio/getline.c
index f101f7f1c3ef..371341d6ea8e 100644
--- a/lib/libc/stdio/getline.c
+++ b/lib/libc/stdio/getline.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2009 David Schultz <das@FreeBSD.org>
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
ssize_t
diff --git a/lib/libc/stdio/gets.c b/lib/libc/stdio/gets.c
index c8822e3b8d86..b92ce188e2b5 100644
--- a/lib/libc/stdio/gets.c
+++ b/lib/libc/stdio/gets.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)gets.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <unistd.h>
#include <stdio.h>
diff --git a/lib/libc/stdio/gets_s.c b/lib/libc/stdio/gets_s.c
index fc5774937821..9a8cf34916fb 100644
--- a/lib/libc/stdio/gets_s.c
+++ b/lib/libc/stdio/gets_s.c
@@ -34,9 +34,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <errno.h>
#include <unistd.h>
diff --git a/lib/libc/stdio/getw.c b/lib/libc/stdio/getw.c
index fa18f0183fb5..2986220461e9 100644
--- a/lib/libc/stdio/getw.c
+++ b/lib/libc/stdio/getw.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getw.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
int
diff --git a/lib/libc/stdio/getwc.3 b/lib/libc/stdio/getwc.3
index 7986b01561ca..734e5c0b4259 100644
--- a/lib/libc/stdio/getwc.3
+++ b/lib/libc/stdio/getwc.3
@@ -31,9 +31,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)getc.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd March 3, 2004
.Dt GETWC 3
.Os
diff --git a/lib/libc/stdio/getwc.c b/lib/libc/stdio/getwc.c
index d27988ba3163..ae56ff7d6dd3 100644
--- a/lib/libc/stdio/getwc.c
+++ b/lib/libc/stdio/getwc.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002 Tim J. Robbins.
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <stdio.h>
#include <wchar.h>
diff --git a/lib/libc/stdio/getwchar.c b/lib/libc/stdio/getwchar.c
index 2828075520a6..335a975ba6e8 100644
--- a/lib/libc/stdio/getwchar.c
+++ b/lib/libc/stdio/getwchar.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002 Tim J. Robbins.
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <stdio.h>
#include <wchar.h>
diff --git a/lib/libc/stdio/glue.h b/lib/libc/stdio/glue.h
index 6c805e038327..948ef537e5d6 100644
--- a/lib/libc/stdio/glue.h
+++ b/lib/libc/stdio/glue.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.
- *
- * @(#)glue.h 8.1 (Berkeley) 6/4/93
- * $FreeBSD$
*/
/*
diff --git a/lib/libc/stdio/local.h b/lib/libc/stdio/local.h
index 336d00dfd8cc..4d8212e947d1 100644
--- a/lib/libc/stdio/local.h
+++ b/lib/libc/stdio/local.h
@@ -8,7 +8,7 @@
* Chris Torek.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -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.
- *
- * @(#)local.h 8.3 (Berkeley) 7/3/94
- * $FreeBSD$
*/
#ifndef _STDIO_LOCAL_H
diff --git a/lib/libc/stdio/makebuf.c b/lib/libc/stdio/makebuf.c
index 9bddf89a65b2..036682870cfa 100644
--- a/lib/libc/stdio/makebuf.c
+++ b/lib/libc/stdio/makebuf.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)makebuf.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/lib/libc/stdio/mktemp.3 b/lib/libc/stdio/mktemp.3
index b6a38f23d2e9..d00d3d4f61fb 100644
--- a/lib/libc/stdio/mktemp.3
+++ b/lib/libc/stdio/mktemp.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)mktemp.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd July 29, 2019
.Dt MKTEMP 3
.Os
diff --git a/lib/libc/stdio/mktemp.c b/lib/libc/stdio/mktemp.c
index 0ede3058a3d5..8aff226acf14 100644
--- a/lib/libc/stdio/mktemp.c
+++ b/lib/libc/stdio/mktemp.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)mktemp.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#include <sys/stat.h>
diff --git a/lib/libc/stdio/open_memstream.3 b/lib/libc/stdio/open_memstream.3
index 506b9e229b76..89280a8f7be5 100644
--- a/lib/libc/stdio/open_memstream.3
+++ b/lib/libc/stdio/open_memstream.3
@@ -23,8 +23,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd August 1, 2015
.Dt OPEN_MEMSTREAM 3
.Os
diff --git a/lib/libc/stdio/open_memstream.c b/lib/libc/stdio/open_memstream.c
index 12b7164af98f..371022adf6b3 100644
--- a/lib/libc/stdio/open_memstream.c
+++ b/lib/libc/stdio/open_memstream.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2013 Hudson River Trading LLC
* Written by: John H. Baldwin <jhb@FreeBSD.org>
@@ -27,9 +27,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <assert.h>
#include <errno.h>
diff --git a/lib/libc/stdio/open_wmemstream.c b/lib/libc/stdio/open_wmemstream.c
index 1ea7c82e4aa7..213d61fcd4dd 100644
--- a/lib/libc/stdio/open_wmemstream.c
+++ b/lib/libc/stdio/open_wmemstream.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2013 Hudson River Trading LLC
* Written by: John H. Baldwin <jhb@FreeBSD.org>
@@ -27,9 +27,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <assert.h>
#include <errno.h>
diff --git a/lib/libc/stdio/perror.c b/lib/libc/stdio/perror.c
index 6eeb14893b8c..36052e8a8689 100644
--- a/lib/libc/stdio/perror.c
+++ b/lib/libc/stdio/perror.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)perror.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/types.h>
#include <sys/uio.h>
diff --git a/lib/libc/stdio/printf-pos.c b/lib/libc/stdio/printf-pos.c
index 40f91e8af712..edbd4e379699 100644
--- a/lib/libc/stdio/printf-pos.c
+++ b/lib/libc/stdio/printf-pos.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)vfprintf.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* This is the code responsible for handling positional arguments
* (%m$ and %m$.n$) for vfprintf() and vfwprintf().
diff --git a/lib/libc/stdio/printf.3 b/lib/libc/stdio/printf.3
index dd2360f13eca..f2428740b529 100644
--- a/lib/libc/stdio/printf.3
+++ b/lib/libc/stdio/printf.3
@@ -29,10 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)printf.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd May 22, 2018
+.Dd September 5, 2023
.Dt PRINTF 3
.Os
.Sh NAME
@@ -213,6 +210,17 @@ and
.Cm u
conversions, this option has no effect.
For
+.Cm b
+and
+.Cm B
+conversions, a non-zero result has the string
+.Ql 0b
+(or
+.Ql 0B
+for
+.Cm B
+conversions) prepended to it.
+For
.Cm o
conversions, the precision of the number is increased to force the first
character of the output string to a zero.
@@ -246,7 +254,7 @@ For all conversions except
.Cm n ,
the converted value is padded on the left with zeros rather than blanks.
If a precision is given with a numeric conversion
-.Cm ( d , i , o , u , i , x ,
+.Cm ( b , B , d , i , o , u , i , x ,
and
.Cm X ) ,
the
@@ -302,7 +310,7 @@ followed by an
optional digit string.
If the digit string is omitted, the precision is taken as zero.
This gives the minimum number of digits to appear for
-.Cm d , i , o , u , x ,
+.Cm b , B , d , i , o , u , x ,
and
.Cm X
conversions, the number of digits to appear after the decimal-point for
@@ -320,18 +328,20 @@ conversions.
.It
An optional length modifier, that specifies the size of the argument.
The following length modifiers are valid for the
-.Cm d , i , n , o , u , x ,
+.Cm b , B , d , i , n , o , u , x ,
or
.Cm X
conversion:
.Bl -column ".Cm q Em (deprecated)" ".Vt signed char" ".Vt unsigned long long" ".Vt long long *"
-.It Sy Modifier Ta Cm d , i Ta Cm o , u , x , X Ta Cm n
+.It Sy Modifier Ta Cm d , i Ta Cm b , B , o , u , x , X Ta Cm n
.It Cm hh Ta Vt "signed char" Ta Vt "unsigned char" Ta Vt "signed char *"
.It Cm h Ta Vt short Ta Vt "unsigned short" Ta Vt "short *"
.It Cm l No (ell) Ta Vt long Ta Vt "unsigned long" Ta Vt "long *"
.It Cm ll No (ell ell) Ta Vt "long long" Ta Vt "unsigned long long" Ta Vt "long long *"
.It Cm j Ta Vt intmax_t Ta Vt uintmax_t Ta Vt "intmax_t *"
.It Cm t Ta Vt ptrdiff_t Ta (see note) Ta Vt "ptrdiff_t *"
+.It Cm w Ns Ar N Ta Vt intN_t Ta Vt uintN_t Ta Vt "intN_t *"
+.It Cm wf Ns Ar N Ta Vt int_fastN_t Ta Vt uint_fastN_t Ta Vt "int_fastN_t *"
.It Cm z Ta (see note) Ta Vt size_t Ta (see note)
.It Cm q Em (deprecated) Ta Vt quad_t Ta Vt u_quad_t Ta Vt "quad_t *"
.El
@@ -340,7 +350,7 @@ Note:
the
.Cm t
modifier, when applied to a
-.Cm o , u , x ,
+.Cm b , B , o , u , x ,
or
.Cm X
conversion, indicates that the argument is of an unsigned type
@@ -404,11 +414,16 @@ If a single format directive mixes positional
and non-positional arguments, the results are undefined.
.Pp
The conversion specifiers and their meanings are:
-.Bl -tag -width ".Cm diouxX"
-.It Cm diouxX
+.Bl -tag -width ".Cm bBdiouxX"
+.It Cm bBdiouxX
The
.Vt int
-(or appropriate variant) argument is converted to signed decimal
+(or appropriate variant) argument is converted to
+unsigned binary
+.Cm ( b
+and
+.Cm B ) ,
+signed decimal
.Cm ( d
and
.Cm i ) ,
diff --git a/lib/libc/stdio/printf.c b/lib/libc/stdio/printf.c
index 7e7e5c8c128b..f67e3d51a398 100644
--- a/lib/libc/stdio/printf.c
+++ b/lib/libc/stdio/printf.c
@@ -8,7 +8,7 @@
* Chris Torek.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -37,12 +37,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)printf.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
#include <stdarg.h>
#include <xlocale.h>
diff --git a/lib/libc/stdio/printf_l.3 b/lib/libc/stdio/printf_l.3
index 312d110c2975..433154c66e9c 100644
--- a/lib/libc/stdio/printf_l.3
+++ b/lib/libc/stdio/printf_l.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd April 7, 2012
.Dt PRINTF_L 3
.Os
diff --git a/lib/libc/stdio/printfcommon.h b/lib/libc/stdio/printfcommon.h
index c120f1eba766..411b778dc234 100644
--- a/lib/libc/stdio/printfcommon.h
+++ b/lib/libc/stdio/printfcommon.h
@@ -8,7 +8,7 @@
* Chris Torek.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -35,8 +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.
- *
- * $FreeBSD$
*/
/*
@@ -196,6 +194,13 @@ __ultoa(u_long val, CHAR *endp, int base, int octzero, const char *xdigs)
} while (sval != 0);
break;
+ case 2:
+ do {
+ *--cp = to_char(val & 1);
+ val >>= 1;
+ } while (val);
+ break;
+
case 8:
do {
*--cp = to_char(val & 7);
@@ -246,6 +251,13 @@ __ujtoa(uintmax_t val, CHAR *endp, int base, int octzero, const char *xdigs)
} while (sval != 0);
break;
+ case 2:
+ do {
+ *--cp = to_char(val & 1);
+ val >>= 1;
+ } while (val);
+ break;
+
case 8:
do {
*--cp = to_char(val & 7);
diff --git a/lib/libc/stdio/printflocal.h b/lib/libc/stdio/printflocal.h
index 70131d10fdcb..f3d0d3e9e216 100644
--- a/lib/libc/stdio/printflocal.h
+++ b/lib/libc/stdio/printflocal.h
@@ -30,8 +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.
- *
- * $FreeBSD$
*/
/*
@@ -51,6 +49,7 @@
#define PTRDIFFT 0x800 /* ptrdiff_t */
#define INTMAXT 0x1000 /* intmax_t */
#define CHARINT 0x2000 /* print char using int format */
+#define FASTINT 0x4000 /* int_fastN_t */
/*
* Macros for converting digits to letters and vice versa
diff --git a/lib/libc/stdio/putc.3 b/lib/libc/stdio/putc.3
index 89ee7c7f5efa..7bdf87e31769 100644
--- a/lib/libc/stdio/putc.3
+++ b/lib/libc/stdio/putc.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)putc.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd January 23, 2020
.Dt PUTC 3
.Os
diff --git a/lib/libc/stdio/putc.c b/lib/libc/stdio/putc.c
index 1713792e1909..6942239e0c78 100644
--- a/lib/libc/stdio/putc.c
+++ b/lib/libc/stdio/putc.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)putc.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <stdio.h>
#include "un-namespace.h"
diff --git a/lib/libc/stdio/putchar.c b/lib/libc/stdio/putchar.c
index 12adf86f3c34..87980ca0d052 100644
--- a/lib/libc/stdio/putchar.c
+++ b/lib/libc/stdio/putchar.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)putchar.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <stdio.h>
#include "un-namespace.h"
diff --git a/lib/libc/stdio/puts.c b/lib/libc/stdio/puts.c
index fe80ddbba792..f0cf58fab5b5 100644
--- a/lib/libc/stdio/puts.c
+++ b/lib/libc/stdio/puts.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)puts.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <stdio.h>
#include <string.h>
diff --git a/lib/libc/stdio/putw.c b/lib/libc/stdio/putw.c
index ba9853db9c8a..417030f13360 100644
--- a/lib/libc/stdio/putw.c
+++ b/lib/libc/stdio/putw.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)putw.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <stdio.h>
#include "un-namespace.h"
diff --git a/lib/libc/stdio/putwc.3 b/lib/libc/stdio/putwc.3
index 6f0f55884d20..6d09c575c022 100644
--- a/lib/libc/stdio/putwc.3
+++ b/lib/libc/stdio/putwc.3
@@ -31,9 +31,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)putc.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd March 3, 2004
.Dt PUTWC 3
.Os
diff --git a/lib/libc/stdio/putwc.c b/lib/libc/stdio/putwc.c
index 510a3af70eda..435da69dec6a 100644
--- a/lib/libc/stdio/putwc.c
+++ b/lib/libc/stdio/putwc.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002 Tim J. Robbins.
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <stdio.h>
#include <wchar.h>
diff --git a/lib/libc/stdio/putwchar.c b/lib/libc/stdio/putwchar.c
index a042e449e03a..f109a5f6b1dd 100644
--- a/lib/libc/stdio/putwchar.c
+++ b/lib/libc/stdio/putwchar.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002 Tim J. Robbins.
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <stdio.h>
#include <wchar.h>
diff --git a/lib/libc/stdio/refill.c b/lib/libc/stdio/refill.c
index dbbcb4912aa2..13d85d71af22 100644
--- a/lib/libc/stdio/refill.c
+++ b/lib/libc/stdio/refill.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)refill.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <errno.h>
#include <stdio.h>
diff --git a/lib/libc/stdio/remove.3 b/lib/libc/stdio/remove.3
index a8baf428558b..65ec58bf8b6d 100644
--- a/lib/libc/stdio/remove.3
+++ b/lib/libc/stdio/remove.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)remove.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd June 4, 1993
.Dt REMOVE 3
.Os
diff --git a/lib/libc/stdio/remove.c b/lib/libc/stdio/remove.c
index b92e14ad6c16..2c9ef61b12de 100644
--- a/lib/libc/stdio/remove.c
+++ b/lib/libc/stdio/remove.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)remove.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
diff --git a/lib/libc/stdio/rewind.c b/lib/libc/stdio/rewind.c
index 2449de397160..4bbd06976034 100644
--- a/lib/libc/stdio/rewind.c
+++ b/lib/libc/stdio/rewind.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)rewind.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <errno.h>
#include <stdio.h>
diff --git a/lib/libc/stdio/rget.c b/lib/libc/stdio/rget.c
index 530fb67b0ff1..6f57ad4bc0f3 100644
--- a/lib/libc/stdio/rget.c
+++ b/lib/libc/stdio/rget.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)rget.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
#include "local.h"
diff --git a/lib/libc/stdio/scanf.3 b/lib/libc/stdio/scanf.3
index bcf68205ae78..04664c5f2bbd 100644
--- a/lib/libc/stdio/scanf.3
+++ b/lib/libc/stdio/scanf.3
@@ -29,10 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)scanf.3 8.2 (Berkeley) 12/11/93
-.\" $FreeBSD$
-.\"
-.Dd January 4, 2003
+.Dd September 5, 2023
.Dt SCANF 3
.Os
.Sh NAME
@@ -142,7 +139,7 @@ The conversion that follows occurs as usual, but no pointer is used;
the result of the conversion is simply discarded.
.It Cm hh
Indicates that the conversion will be one of
-.Cm dioux
+.Cm bdioux
or
.Cm n
and the next pointer is a pointer to a
@@ -151,7 +148,7 @@ and the next pointer is a pointer to a
.Vt int ) .
.It Cm h
Indicates that the conversion will be one of
-.Cm dioux
+.Cm bdioux
or
.Cm n
and the next pointer is a pointer to a
@@ -160,7 +157,7 @@ and the next pointer is a pointer to a
.Vt int ) .
.It Cm l No (ell)
Indicates that the conversion will be one of
-.Cm dioux
+.Cm bdioux
or
.Cm n
and the next pointer is a pointer to a
@@ -186,7 +183,7 @@ and the next pointer is a pointer to an array of
.Vt char ) .
.It Cm ll No (ell ell)
Indicates that the conversion will be one of
-.Cm dioux
+.Cm bdioux
or
.Cm n
and the next pointer is a pointer to a
@@ -202,7 +199,7 @@ and the next pointer is a pointer to
.Vt "long double" .
.It Cm j
Indicates that the conversion will be one of
-.Cm dioux
+.Cm bdioux
or
.Cm n
and the next pointer is a pointer to a
@@ -211,16 +208,44 @@ and the next pointer is a pointer to a
.Vt int ) .
.It Cm t
Indicates that the conversion will be one of
-.Cm dioux
+.Cm bdioux
or
.Cm n
and the next pointer is a pointer to a
.Vt ptrdiff_t
(rather than
.Vt int ) .
+.It Cm w Ns Ar N
+.Po
+where
+.Ar N
+is 8, 16, 32, or 64
+.Pc
+Indicates that the conversion will be one of
+.Cm bdioux
+or
+.Cm n
+and the next pointer is a pointer to a
+.Vt intN_t
+(rather than
+.Vt int ) .
+.It Cm wf Ns Ar N
+.Po
+where
+.Ar N
+is 8, 16, 32, or 64
+.Pc
+Indicates that the conversion will be one of
+.Cm bdioux
+or
+.Cm n
+and the next pointer is a pointer to a
+.Vt int_fastN_t
+(rather than
+.Vt int ) .
.It Cm z
Indicates that the conversion will be one of
-.Cm dioux
+.Cm bdioux
or
.Cm n
and the next pointer is a pointer to a
@@ -230,7 +255,7 @@ and the next pointer is a pointer to a
.It Cm q
(deprecated.)
Indicates that the conversion will be one of
-.Cm dioux
+.Cm bdioux
or
.Cm n
and the next pointer is a pointer to a
@@ -274,6 +299,10 @@ matches a single input
.Ql %
character.
No conversion is done, and assignment does not occur.
+.It Cm b , B
+Matches an optionally signed binary integer;
+the next pointer must be a pointer to
+.Vt "unsigned int" .
.It Cm d
Matches an optionally signed decimal integer;
the next pointer must be a pointer to
@@ -282,7 +311,12 @@ the next pointer must be a pointer to
Matches an optionally signed integer;
the next pointer must be a pointer to
.Vt int .
-The integer is read in base 16 if it begins
+The integer is read
+in base 2 if it begins with
+.Ql 0b
+or
+.Ql 0B ,
+in base 16 if it begins
with
.Ql 0x
or
@@ -474,6 +508,21 @@ and
.Fn vsscanf
conform to
.St -isoC-99 .
+.Sh HISTORY
+The functions
+.Fn scanf ,
+.Fn fscanf ,
+and
+.Fn sscanf
+first appeared in
+.At v7 ,
+and
+.Fn vscanf ,
+.Fn vsscanf ,
+and
+.Fn vfscanf
+in
+.Bx 4.3 Reno .
.Sh BUGS
Earlier implementations of
.Nm
diff --git a/lib/libc/stdio/scanf.c b/lib/libc/stdio/scanf.c
index baffba9f9018..c0bd4dfe0c01 100644
--- a/lib/libc/stdio/scanf.c
+++ b/lib/libc/stdio/scanf.c
@@ -8,7 +8,7 @@
* Chris Torek.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -37,12 +37,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)scanf.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <stdio.h>
#include <stdarg.h>
diff --git a/lib/libc/stdio/scanf_l.3 b/lib/libc/stdio/scanf_l.3
index 35a82418ec51..8470fd0cff38 100644
--- a/lib/libc/stdio/scanf_l.3
+++ b/lib/libc/stdio/scanf_l.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd April 8, 2012
.Dt SCANF_L 3
.Os
diff --git a/lib/libc/stdio/setbuf.3 b/lib/libc/stdio/setbuf.3
index 3ca51d50eb8f..027564cadfb4 100644
--- a/lib/libc/stdio/setbuf.3
+++ b/lib/libc/stdio/setbuf.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)setbuf.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd May 1, 2020
.Dt SETBUF 3
.Os
diff --git a/lib/libc/stdio/setbuf.c b/lib/libc/stdio/setbuf.c
index 7c60c77dce9c..ec3c741947d8 100644
--- a/lib/libc/stdio/setbuf.c
+++ b/lib/libc/stdio/setbuf.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)setbuf.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
#include "local.h"
diff --git a/lib/libc/stdio/setbuffer.c b/lib/libc/stdio/setbuffer.c
index b760e1a510f2..1838b84c1653 100644
--- a/lib/libc/stdio/setbuffer.c
+++ b/lib/libc/stdio/setbuffer.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)setbuffer.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
void
diff --git a/lib/libc/stdio/setvbuf.c b/lib/libc/stdio/setvbuf.c
index 03a3c7263125..554d558e73df 100644
--- a/lib/libc/stdio/setvbuf.c
+++ b/lib/libc/stdio/setvbuf.c
@@ -32,13 +32,8 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)setvbuf.c 8.2 (Berkeley) 11/16/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
+#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include "un-namespace.h"
@@ -62,7 +57,7 @@ setvbuf(FILE * __restrict fp, char * __restrict buf, int mode, size_t size)
* when setting _IONBF.
*/
if (mode != _IONBF)
- if ((mode != _IOFBF && mode != _IOLBF) || (int)size < 0)
+ if ((mode != _IOFBF && mode != _IOLBF) || size > INT_MAX)
return (EOF);
FLOCKFILE_CANCELSAFE(fp);
diff --git a/lib/libc/stdio/snprintf.c b/lib/libc/stdio/snprintf.c
index 8ee0b4429340..398f1596d2c5 100644
--- a/lib/libc/stdio/snprintf.c
+++ b/lib/libc/stdio/snprintf.c
@@ -5,7 +5,7 @@
* The Regents of the University of California. All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -37,12 +37,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)snprintf.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <limits.h>
#include <stdio.h>
diff --git a/lib/libc/stdio/sprintf.c b/lib/libc/stdio/sprintf.c
index 8a7611f384a2..3b0e4c061b43 100644
--- a/lib/libc/stdio/sprintf.c
+++ b/lib/libc/stdio/sprintf.c
@@ -8,7 +8,7 @@
* Chris Torek.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -37,12 +37,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)sprintf.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
#include <stdarg.h>
#include <limits.h>
diff --git a/lib/libc/stdio/sscanf.c b/lib/libc/stdio/sscanf.c
index cab6408535a8..5dc9d2b13697 100644
--- a/lib/libc/stdio/sscanf.c
+++ b/lib/libc/stdio/sscanf.c
@@ -8,7 +8,7 @@
* Chris Torek.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -37,12 +37,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)sscanf.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
diff --git a/lib/libc/stdio/stdio.3 b/lib/libc/stdio/stdio.3
index 7b3dd364c79a..794baec5182f 100644
--- a/lib/libc/stdio/stdio.3
+++ b/lib/libc/stdio/stdio.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)stdio.3 8.7 (Berkeley) 4/19/94
-.\" $FreeBSD$
-.\"
.Dd March 3, 2009
.Dt STDIO 3
.Os
diff --git a/lib/libc/stdio/stdio.c b/lib/libc/stdio/stdio.c
index 4f093f12dc80..bffd7b1bfc3c 100644
--- a/lib/libc/stdio/stdio.c
+++ b/lib/libc/stdio/stdio.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)stdio.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <errno.h>
#include <fcntl.h>
diff --git a/lib/libc/stdio/swprintf.c b/lib/libc/stdio/swprintf.c
index 39bb7346099c..278f0e37d117 100644
--- a/lib/libc/stdio/swprintf.c
+++ b/lib/libc/stdio/swprintf.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002 Tim J. Robbins
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdarg.h>
#include <stdio.h>
#include <wchar.h>
diff --git a/lib/libc/stdio/swscanf.c b/lib/libc/stdio/swscanf.c
index e45449c16d53..9b91acf56685 100644
--- a/lib/libc/stdio/swscanf.c
+++ b/lib/libc/stdio/swscanf.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002 Tim J. Robbins
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdarg.h>
#include <stdio.h>
#include <wchar.h>
diff --git a/lib/libc/stdio/tempnam.c b/lib/libc/stdio/tempnam.c
index 2d7bd90e08a4..a3e6c6e3cf01 100644
--- a/lib/libc/stdio/tempnam.c
+++ b/lib/libc/stdio/tempnam.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)tempnam.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <errno.h>
#include <stdio.h>
@@ -60,7 +54,7 @@ tempnam(const char *dir, const char *pfx)
if (!pfx)
pfx = "tmp.";
- if (issetugid() == 0 && (f = getenv("TMPDIR"))) {
+ if ((f = secure_getenv("TMPDIR")) != NULL) {
(void)snprintf(name, MAXPATHLEN, "%s%s%sXXXXXX", f,
*(f + strlen(f) - 1) == '/'? "": "/", pfx);
if ((f = _mktemp(name)))
diff --git a/lib/libc/stdio/tmpfile.c b/lib/libc/stdio/tmpfile.c
index e5ee1be2884e..d3331b8c2c2d 100644
--- a/lib/libc/stdio/tmpfile.c
+++ b/lib/libc/stdio/tmpfile.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)tmpfile.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/types.h>
#include <signal.h>
@@ -60,9 +54,7 @@ tmpfile(void)
char *buf;
const char *tmpdir;
- tmpdir = NULL;
- if (issetugid() == 0)
- tmpdir = getenv("TMPDIR");
+ tmpdir = secure_getenv("TMPDIR");
if (tmpdir == NULL)
tmpdir = _PATH_TMP;
diff --git a/lib/libc/stdio/tmpnam.3 b/lib/libc/stdio/tmpnam.3
index 6300a1725eba..3b9d93280e72 100644
--- a/lib/libc/stdio/tmpnam.3
+++ b/lib/libc/stdio/tmpnam.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)tmpnam.3 8.2 (Berkeley) 11/17/93
-.\" $FreeBSD$
-.\"
.Dd August 7, 2020
.Dt TMPFILE 3
.Os
diff --git a/lib/libc/stdio/tmpnam.c b/lib/libc/stdio/tmpnam.c
index c4d56778027d..d7c436928cd7 100644
--- a/lib/libc/stdio/tmpnam.c
+++ b/lib/libc/stdio/tmpnam.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)tmpnam.c 8.3 (Berkeley) 3/28/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <stdio.h>
diff --git a/lib/libc/stdio/ungetc.3 b/lib/libc/stdio/ungetc.3
index 77878d459bc8..946eceed9428 100644
--- a/lib/libc/stdio/ungetc.3
+++ b/lib/libc/stdio/ungetc.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)ungetc.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd June 4, 1993
.Dt UNGETC 3
.Os
diff --git a/lib/libc/stdio/ungetc.c b/lib/libc/stdio/ungetc.c
index 2e140c965a02..b494d462a19a 100644
--- a/lib/libc/stdio/ungetc.c
+++ b/lib/libc/stdio/ungetc.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)ungetc.c 8.2 (Berkeley) 11/3/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <stdio.h>
#include <stdlib.h>
diff --git a/lib/libc/stdio/ungetwc.3 b/lib/libc/stdio/ungetwc.3
index 96bc4263de8b..e5d5560417a0 100644
--- a/lib/libc/stdio/ungetwc.3
+++ b/lib/libc/stdio/ungetwc.3
@@ -31,9 +31,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)ungetc.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd March 3, 2004
.Dt UNGETWC 3
.Os
diff --git a/lib/libc/stdio/ungetwc.c b/lib/libc/stdio/ungetwc.c
index d7705c8199a2..0a72b6ea1705 100644
--- a/lib/libc/stdio/ungetwc.c
+++ b/lib/libc/stdio/ungetwc.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002-2004 Tim J. Robbins.
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <errno.h>
#include <limits.h>
diff --git a/lib/libc/stdio/vasprintf.c b/lib/libc/stdio/vasprintf.c
index f3545f149a73..c2c6170a2382 100644
--- a/lib/libc/stdio/vasprintf.c
+++ b/lib/libc/stdio/vasprintf.c
@@ -7,7 +7,7 @@
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -34,9 +34,6 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
diff --git a/lib/libc/stdio/vdprintf.c b/lib/libc/stdio/vdprintf.c
index 73f87b0f0cfa..3cff85aa9dc5 100644
--- a/lib/libc/stdio/vdprintf.c
+++ b/lib/libc/stdio/vdprintf.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2009 David Schultz <das@FreeBSD.org>
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <errno.h>
#include <limits.h>
diff --git a/lib/libc/stdio/vfprintf.c b/lib/libc/stdio/vfprintf.c
index 70f5074e2f72..7048315a8d78 100644
--- a/lib/libc/stdio/vfprintf.c
+++ b/lib/libc/stdio/vfprintf.c
@@ -8,7 +8,7 @@
* Chris Torek.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -37,12 +37,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)vfprintf.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* Actual printf innards.
*
@@ -318,6 +312,8 @@ __vfprintf(FILE *fp, locale_t locale, const char *fmt0, va_list ap)
int width; /* width from format (%8d), or 0 */
int prec; /* precision from format; <0 for N/A */
int saved_errno;
+ int error;
+ char errnomsg[NL_TEXTMAX];
char sign; /* sign prefix (' ', '+', '-', or \0) */
struct grouping_state gs; /* thousands' grouping info */
@@ -612,9 +608,65 @@ reswitch: switch (ch) {
case 't':
flags |= PTRDIFFT;
goto rflag;
+ case 'w':
+ /*
+ * Fixed-width integer types. On all platforms we
+ * support, int8_t is equivalent to char, int16_t
+ * is equivalent to short, int32_t is equivalent
+ * to int, int64_t is equivalent to long long int.
+ * Furthermore, int_fast8_t, int_fast16_t and
+ * int_fast32_t are equivalent to int, and
+ * int_fast64_t is equivalent to long long int.
+ */
+ flags &= ~(CHARINT|SHORTINT|LONGINT|LLONGINT|INTMAXT);
+ if (fmt[0] == 'f') {
+ flags |= FASTINT;
+ fmt++;
+ } else {
+ flags &= ~FASTINT;
+ }
+ if (fmt[0] == '8') {
+ if (!(flags & FASTINT))
+ flags |= CHARINT;
+ else
+ /* no flag set = 32 */ ;
+ fmt += 1;
+ } else if (fmt[0] == '1' && fmt[1] == '6') {
+ if (!(flags & FASTINT))
+ flags |= SHORTINT;
+ else
+ /* no flag set = 32 */ ;
+ fmt += 2;
+ } else if (fmt[0] == '3' && fmt[1] == '2') {
+ /* no flag set = 32 */ ;
+ fmt += 2;
+ } else if (fmt[0] == '6' && fmt[1] == '4') {
+ flags |= LLONGINT;
+ fmt += 2;
+ } else {
+ if (flags & FASTINT) {
+ flags &= ~FASTINT;
+ fmt--;
+ }
+ goto invalid;
+ }
+ goto rflag;
case 'z':
flags |= SIZET;
goto rflag;
+ case 'B':
+ case 'b':
+ if (flags & INTMAX_SIZE)
+ ujval = UJARG();
+ else
+ ulval = UARG();
+ base = 2;
+ /* leading 0b/B only if non-zero */
+ if (flags & ALT &&
+ (flags & INTMAX_SIZE ? ujval != 0 : ulval != 0))
+ ox[1] = ch;
+ goto nosign;
+ break;
case 'C':
flags |= LONGINT;
/*FALLTHROUGH*/
@@ -779,7 +831,9 @@ fp_common:
break;
#endif /* !NO_FLOATING_POINT */
case 'm':
- cp = strerror(saved_errno);
+ error = __strerror_rl(saved_errno, errnomsg,
+ sizeof(errnomsg), locale);
+ cp = error == 0 ? errnomsg : "<strerror failure>";
size = (prec >= 0) ? strnlen(cp, prec) : strlen(cp);
sign = '\0';
break;
@@ -921,6 +975,7 @@ number: if ((dprec = prec) >= 0)
default: /* "%?" prints ?, unless ? is NUL */
if (ch == '\0')
goto done;
+invalid:
/* pretend it was %c with argument ch */
cp = buf;
*cp = ch;
diff --git a/lib/libc/stdio/vfscanf.c b/lib/libc/stdio/vfscanf.c
index bd3830c19907..a678710e1ecb 100644
--- a/lib/libc/stdio/vfscanf.c
+++ b/lib/libc/stdio/vfscanf.c
@@ -5,7 +5,9 @@
* The Regents of the University of California. All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
+ * Copyright (c) 2023 Dag-Erling Smørgrav
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -37,12 +39,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)vfscanf.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <ctype.h>
#include <inttypes.h>
@@ -75,6 +71,7 @@ __FBSDID("$FreeBSD$");
#define SUPPRESS 0x08 /* *: suppress assignment */
#define POINTER 0x10 /* p: void * (as hex) */
#define NOSKIP 0x20 /* [ or c: do not skip blanks */
+#define FASTINT 0x200 /* wfN: int_fastN_t */
#define LONGLONG 0x400 /* ll: long long (+ deprecated q: quad) */
#define INTMAXT 0x800 /* j: intmax_t */
#define PTRDIFFT 0x1000 /* t: ptrdiff_t */
@@ -83,16 +80,6 @@ __FBSDID("$FreeBSD$");
#define UNSIGNED 0x8000 /* %[oupxX] conversions */
/*
- * The following are used in integral conversions only:
- * SIGNOK, NDIGITS, PFXOK, and NZDIGITS
- */
-#define SIGNOK 0x40 /* +/- is (still) legal */
-#define NDIGITS 0x80 /* no digits detected */
-#define PFXOK 0x100 /* 0x prefix is (still) legal */
-#define NZDIGITS 0x200 /* no zero digits detected */
-#define HAVESIGN 0x10000 /* sign detected */
-
-/*
* Conversion types.
*/
#define CT_CHAR 0 /* %c conversion */
@@ -309,129 +296,160 @@ convert_wstring(FILE *fp, wchar_t *wcp, int width, locale_t locale)
return (n);
}
+enum parseint_state {
+ begin,
+ havesign,
+ havezero,
+ haveprefix,
+ any,
+};
+
+static __inline int
+parseint_fsm(int c, enum parseint_state *state, int *base)
+{
+ switch (c) {
+ case '+':
+ case '-':
+ if (*state == begin) {
+ *state = havesign;
+ return 1;
+ }
+ break;
+ case '0':
+ if (*state == begin || *state == havesign) {
+ *state = havezero;
+ } else {
+ *state = any;
+ }
+ return 1;
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ if (*state == havezero && *base == 0) {
+ *base = 8;
+ }
+ /* FALL THROUGH */
+ case '8':
+ case '9':
+ if (*state == begin ||
+ *state == havesign) {
+ if (*base == 0) {
+ *base = 10;
+ }
+ }
+ if (*state == begin ||
+ *state == havesign ||
+ *state == havezero ||
+ *state == haveprefix ||
+ *state == any) {
+ if (*base > c - '0') {
+ *state = any;
+ return 1;
+ }
+ }
+ break;
+ case 'b':
+ if (*state == havezero) {
+ if (*base == 0 || *base == 2) {
+ *state = haveprefix;
+ *base = 2;
+ return 1;
+ }
+ }
+ /* FALL THROUGH */
+ case 'a':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ if (*state == begin ||
+ *state == havesign ||
+ *state == havezero ||
+ *state == haveprefix ||
+ *state == any) {
+ if (*base > c - 'a' + 10) {
+ *state = any;
+ return 1;
+ }
+ }
+ break;
+ case 'B':
+ if (*state == havezero) {
+ if (*base == 0 || *base == 2) {
+ *state = haveprefix;
+ *base = 2;
+ return 1;
+ }
+ }
+ /* FALL THROUGH */
+ case 'A':
+ case 'C':
+ case 'D':
+ case 'E':
+ case 'F':
+ if (*state == begin ||
+ *state == havesign ||
+ *state == havezero ||
+ *state == haveprefix ||
+ *state == any) {
+ if (*base > c - 'A' + 10) {
+ *state = any;
+ return 1;
+ }
+ }
+ break;
+ case 'x':
+ case 'X':
+ if (*state == havezero) {
+ if (*base == 0 || *base == 16) {
+ *state = haveprefix;
+ *base = 16;
+ return 1;
+ }
+ }
+ break;
+ }
+ return 0;
+}
+
/*
- * Read an integer, storing it in buf. The only relevant bit in the
- * flags argument is PFXOK.
+ * Read an integer, storing it in buf.
*
* Return 0 on a match failure, and the number of characters read
* otherwise.
*/
static __inline int
-parseint(FILE *fp, char * __restrict buf, int width, int base, int flags)
+parseint(FILE *fp, char * __restrict buf, int width, int base)
{
- /* `basefix' is used to avoid `if' tests */
- static const short basefix[17] =
- { 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
+ enum parseint_state state = begin;
char *p;
int c;
- flags |= SIGNOK | NDIGITS | NZDIGITS;
for (p = buf; width; width--) {
- c = *fp->_p;
- /*
- * Switch on the character; `goto ok' if we accept it
- * as a part of number.
- */
- switch (c) {
-
- /*
- * The digit 0 is always legal, but is special. For
- * %i conversions, if no digits (zero or nonzero) have
- * been scanned (only signs), we will have base==0.
- * In that case, we should set it to 8 and enable 0x
- * prefixing. Also, if we have not scanned zero
- * digits before this, do not turn off prefixing
- * (someone else will turn it off if we have scanned
- * any nonzero digits).
- */
- case '0':
- if (base == 0) {
- base = 8;
- flags |= PFXOK;
- }
- if (flags & NZDIGITS)
- flags &= ~(SIGNOK|NZDIGITS|NDIGITS);
- else
- flags &= ~(SIGNOK|PFXOK|NDIGITS);
- goto ok;
-
- /* 1 through 7 always legal */
- case '1': case '2': case '3':
- case '4': case '5': case '6': case '7':
- base = basefix[base];
- flags &= ~(SIGNOK | PFXOK | NDIGITS);
- goto ok;
-
- /* digits 8 and 9 ok iff decimal or hex */
- case '8': case '9':
- base = basefix[base];
- if (base <= 8)
- break; /* not legal here */
- flags &= ~(SIGNOK | PFXOK | NDIGITS);
- goto ok;
-
- /* letters ok iff hex */
- case 'A': case 'B': case 'C':
- case 'D': case 'E': case 'F':
- case 'a': case 'b': case 'c':
- case 'd': case 'e': case 'f':
- /* no need to fix base here */
- if (base <= 10)
- break; /* not legal here */
- flags &= ~(SIGNOK | PFXOK | NDIGITS);
- goto ok;
-
- /* sign ok only as first character */
- case '+': case '-':
- if (flags & SIGNOK) {
- flags &= ~SIGNOK;
- flags |= HAVESIGN;
- goto ok;
- }
+ c = __sgetc(fp);
+ if (c == EOF)
break;
-
- /*
- * x ok iff flag still set & 2nd char (or 3rd char if
- * we have a sign).
- */
- case 'x': case 'X':
- if (flags & PFXOK && p ==
- buf + 1 + !!(flags & HAVESIGN)) {
- base = 16; /* if %i */
- flags &= ~PFXOK;
- goto ok;
- }
+ if (!parseint_fsm(c, &state, &base))
break;
- }
-
- /*
- * If we got here, c is not a legal character for a
- * number. Stop accumulating digits.
- */
- break;
- ok:
- /*
- * c is legal: store it and look at the next.
- */
*p++ = c;
- if (--fp->_r > 0)
- fp->_p++;
- else if (__srefill(fp))
- break; /* EOF */
}
/*
- * If we had only a sign, it is no good; push back the sign.
- * If the number ends in `x', it was [sign] '0' 'x', so push
- * back the x and treat it as [sign] '0'.
+ * If we only had a sign, push it back. If we only had a 0b or 0x
+ * prefix (possibly preceded by a sign), we view it as "0" and
+ * push back the letter. In all other cases, if we stopped
+ * because we read a non-number character, push it back.
*/
- if (flags & NDIGITS) {
- if (p > buf)
- (void) __ungetc(*(u_char *)--p, fp);
- return (0);
- }
- c = ((u_char *)p)[-1];
- if (c == 'x' || c == 'X') {
- --p;
+ if (state == havesign) {
+ p--;
+ (void) __ungetc(*(u_char *)p, fp);
+ } else if (state == haveprefix) {
+ p--;
+ (void) __ungetc(c, fp);
+ } else if (width && c != EOF) {
(void) __ungetc(c, fp);
}
return (p - buf);
@@ -534,6 +552,45 @@ literal:
case 't':
flags |= PTRDIFFT;
goto again;
+ case 'w':
+ /*
+ * Fixed-width integer types. On all platforms we
+ * support, int8_t is equivalent to char, int16_t
+ * is equivalent to short, int32_t is equivalent
+ * to int, int64_t is equivalent to long long int.
+ * Furthermore, int_fast8_t, int_fast16_t and
+ * int_fast32_t are equivalent to int, and
+ * int_fast64_t is equivalent to long long int.
+ */
+ flags &= ~(SHORTSHORT|SHORT|LONG|LONGLONG|SIZET|INTMAXT|PTRDIFFT);
+ if (fmt[0] == 'f') {
+ flags |= FASTINT;
+ fmt++;
+ } else {
+ flags &= ~FASTINT;
+ }
+ if (fmt[0] == '8') {
+ if (!(flags & FASTINT))
+ flags |= SHORTSHORT;
+ else
+ /* no flag set = 32 */ ;
+ fmt += 1;
+ } else if (fmt[0] == '1' && fmt[1] == '6') {
+ if (!(flags & FASTINT))
+ flags |= SHORT;
+ else
+ /* no flag set = 32 */ ;
+ fmt += 2;
+ } else if (fmt[0] == '3' && fmt[1] == '2') {
+ /* no flag set = 32 */ ;
+ fmt += 2;
+ } else if (fmt[0] == '6' && fmt[1] == '4') {
+ flags |= LONGLONG;
+ fmt += 2;
+ } else {
+ goto match_failure;
+ }
+ goto again;
case 'z':
flags |= SIZET;
goto again;
@@ -556,6 +613,13 @@ literal:
/*
* Conversions.
*/
+ case 'B':
+ case 'b':
+ c = CT_INT;
+ flags |= UNSIGNED;
+ base = 2;
+ break;
+
case 'd':
c = CT_INT;
base = 10;
@@ -580,7 +644,6 @@ literal:
case 'X':
case 'x':
- flags |= PFXOK; /* enable 0x prefixing */
c = CT_INT;
flags |= UNSIGNED;
base = 16;
@@ -615,7 +678,7 @@ literal:
break;
case 'p': /* pointer format is like hex */
- flags |= POINTER | PFXOK;
+ flags |= POINTER;
c = CT_INT; /* assumes sizeof(uintmax_t) */
flags |= UNSIGNED; /* >= sizeof(uintptr_t) */
base = 16;
@@ -740,7 +803,7 @@ literal:
width = sizeof(buf) - 2;
width++;
#endif
- nr = parseint(fp, buf, width, base, flags);
+ nr = parseint(fp, buf, width, base);
if (nr == 0)
goto match_failure;
if ((flags & SUPPRESS) == 0) {
diff --git a/lib/libc/stdio/vfwprintf.c b/lib/libc/stdio/vfwprintf.c
index 91238fed138a..d43b472f7730 100644
--- a/lib/libc/stdio/vfwprintf.c
+++ b/lib/libc/stdio/vfwprintf.c
@@ -8,7 +8,7 @@
* Chris Torek.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -37,14 +37,6 @@
* SUCH DAMAGE.
*/
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)vfprintf.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* Actual wprintf innards.
*
@@ -683,9 +675,65 @@ reswitch: switch (ch) {
case 't':
flags |= PTRDIFFT;
goto rflag;
+ case 'w':
+ /*
+ * Fixed-width integer types. On all platforms we
+ * support, int8_t is equivalent to char, int16_t
+ * is equivalent to short, int32_t is equivalent
+ * to int, int64_t is equivalent to long long int.
+ * Furthermore, int_fast8_t, int_fast16_t and
+ * int_fast32_t are equivalent to int, and
+ * int_fast64_t is equivalent to long long int.
+ */
+ flags &= ~(CHARINT|SHORTINT|LONGINT|LLONGINT|INTMAXT);
+ if (fmt[0] == 'f') {
+ flags |= FASTINT;
+ fmt++;
+ } else {
+ flags &= ~FASTINT;
+ }
+ if (fmt[0] == '8') {
+ if (!(flags & FASTINT))
+ flags |= CHARINT;
+ else
+ /* no flag set = 32 */ ;
+ fmt += 1;
+ } else if (fmt[0] == '1' && fmt[1] == '6') {
+ if (!(flags & FASTINT))
+ flags |= SHORTINT;
+ else
+ /* no flag set = 32 */ ;
+ fmt += 2;
+ } else if (fmt[0] == '3' && fmt[1] == '2') {
+ /* no flag set = 32 */ ;
+ fmt += 2;
+ } else if (fmt[0] == '6' && fmt[1] == '4') {
+ flags |= LLONGINT;
+ fmt += 2;
+ } else {
+ if (flags & FASTINT) {
+ flags &= ~FASTINT;
+ fmt--;
+ }
+ goto invalid;
+ }
+ goto rflag;
case 'z':
flags |= SIZET;
goto rflag;
+ case 'B':
+ case 'b':
+ if (flags & INTMAX_SIZE)
+ ujval = UJARG();
+ else
+ ulval = UARG();
+ base = 2;
+ /* leading 0b/B only if non-zero */
+ if (flags & ALT &&
+ (flags & INTMAX_SIZE ? ujval != 0 : ulval != 0))
+ ox[1] = ch;
+ goto nosign;
+ break;
case 'C':
flags |= LONGINT;
/*FALLTHROUGH*/
@@ -982,6 +1030,7 @@ number: if ((dprec = prec) >= 0)
default: /* "%?" prints ?, unless ? is NUL */
if (ch == '\0')
goto done;
+invalid:
/* pretend it was %c with argument ch */
cp = buf;
*cp = ch;
diff --git a/lib/libc/stdio/vfwscanf.c b/lib/libc/stdio/vfwscanf.c
index fbd3a8ad747a..57206a8407d5 100644
--- a/lib/libc/stdio/vfwscanf.c
+++ b/lib/libc/stdio/vfwscanf.c
@@ -8,7 +8,9 @@
* Chris Torek.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
+ * Copyright (c) 2023 Dag-Erling Smørgrav
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -37,14 +39,6 @@
* SUCH DAMAGE.
*/
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)vfscanf.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <ctype.h>
#include <inttypes.h>
@@ -73,6 +67,7 @@ __FBSDID("$FreeBSD$");
#define SUPPRESS 0x08 /* *: suppress assignment */
#define POINTER 0x10 /* p: void * (as hex) */
#define NOSKIP 0x20 /* [ or c: do not skip blanks */
+#define FASTINT 0x200 /* wfN: int_fastN_t */
#define LONGLONG 0x400 /* ll: long long (+ deprecated q: quad) */
#define INTMAXT 0x800 /* j: intmax_t */
#define PTRDIFFT 0x1000 /* t: ptrdiff_t */
@@ -81,16 +76,6 @@ __FBSDID("$FreeBSD$");
#define UNSIGNED 0x8000 /* %[oupxX] conversions */
/*
- * The following are used in integral conversions only:
- * SIGNOK, NDIGITS, PFXOK, and NZDIGITS
- */
-#define SIGNOK 0x40 /* +/- is (still) legal */
-#define NDIGITS 0x80 /* no digits detected */
-#define PFXOK 0x100 /* 0x prefix is (still) legal */
-#define NZDIGITS 0x200 /* no zero digits detected */
-#define HAVESIGN 0x10000 /* sign detected */
-
-/*
* Conversion types.
*/
#define CT_CHAR 0 /* %c conversion */
@@ -268,7 +253,6 @@ convert_string(FILE *fp, char * mbp, int width, locale_t locale)
static __inline int
convert_wstring(FILE *fp, wchar_t *wcp, int width, locale_t locale)
{
- wchar_t *wcp0;
wint_t wi;
int nread;
@@ -280,7 +264,6 @@ convert_wstring(FILE *fp, wchar_t *wcp, int width, locale_t locale)
if (wi != WEOF)
__ungetwc(wi, fp, locale);
} else {
- wcp0 = wcp;
while ((wi = __fgetwc(fp, locale)) != WEOF &&
width-- != 0 && !iswspace(wi)) {
*wcp++ = (wchar_t)wi;
@@ -293,128 +276,161 @@ convert_wstring(FILE *fp, wchar_t *wcp, int width, locale_t locale)
return (nread);
}
+enum parseint_state {
+ begin,
+ havesign,
+ havezero,
+ haveprefix,
+ any,
+};
+
+static __inline int
+parseint_fsm(wchar_t c, enum parseint_state *state, int *base)
+{
+ switch (c) {
+ case '+':
+ case '-':
+ if (*state == begin) {
+ *state = havesign;
+ return 1;
+ }
+ break;
+ case '0':
+ if (*state == begin || *state == havesign) {
+ *state = havezero;
+ } else {
+ *state = any;
+ }
+ return 1;
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ if (*state == havezero && *base == 0) {
+ *base = 8;
+ }
+ /* FALL THROUGH */
+ case '8':
+ case '9':
+ if (*state == begin ||
+ *state == havesign) {
+ if (*base == 0) {
+ *base = 10;
+ }
+ }
+ if (*state == begin ||
+ *state == havesign ||
+ *state == havezero ||
+ *state == haveprefix ||
+ *state == any) {
+ if (*base > c - '0') {
+ *state = any;
+ return 1;
+ }
+ }
+ break;
+ case 'b':
+ if (*state == havezero) {
+ if (*base == 0 || *base == 2) {
+ *state = haveprefix;
+ *base = 2;
+ return 1;
+ }
+ }
+ /* FALL THROUGH */
+ case 'a':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ if (*state == begin ||
+ *state == havesign ||
+ *state == havezero ||
+ *state == haveprefix ||
+ *state == any) {
+ if (*base > c - 'a' + 10) {
+ *state = any;
+ return 1;
+ }
+ }
+ break;
+ case 'B':
+ if (*state == havezero) {
+ if (*base == 0 || *base == 2) {
+ *state = haveprefix;
+ *base = 2;
+ return 1;
+ }
+ }
+ /* FALL THROUGH */
+ case 'A':
+ case 'C':
+ case 'D':
+ case 'E':
+ case 'F':
+ if (*state == begin ||
+ *state == havesign ||
+ *state == havezero ||
+ *state == haveprefix ||
+ *state == any) {
+ if (*base > c - 'A' + 10) {
+ *state = any;
+ return 1;
+ }
+ }
+ break;
+ case 'x':
+ case 'X':
+ if (*state == havezero) {
+ if (*base == 0 || *base == 16) {
+ *state = haveprefix;
+ *base = 16;
+ return 1;
+ }
+ }
+ break;
+ }
+ return 0;
+}
+
/*
- * Read an integer, storing it in buf. The only relevant bit in the
- * flags argument is PFXOK.
+ * Read an integer, storing it in buf.
*
* Return 0 on a match failure, and the number of characters read
* otherwise.
*/
static __inline int
-parseint(FILE *fp, wchar_t *buf, int width, int base, int flags,
+parseint(FILE *fp, wchar_t * __restrict buf, int width, int base,
locale_t locale)
{
- /* `basefix' is used to avoid `if' tests */
- static const short basefix[17] =
- { 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
+ enum parseint_state state = begin;
wchar_t *wcp;
int c;
- flags |= SIGNOK | NDIGITS | NZDIGITS;
for (wcp = buf; width; width--) {
c = __fgetwc(fp, locale);
- /*
- * Switch on the character; `goto ok' if we accept it
- * as a part of number.
- */
- switch (c) {
-
- /*
- * The digit 0 is always legal, but is special. For
- * %i conversions, if no digits (zero or nonzero) have
- * been scanned (only signs), we will have base==0.
- * In that case, we should set it to 8 and enable 0x
- * prefixing. Also, if we have not scanned zero
- * digits before this, do not turn off prefixing
- * (someone else will turn it off if we have scanned
- * any nonzero digits).
- */
- case '0':
- if (base == 0) {
- base = 8;
- flags |= PFXOK;
- }
- if (flags & NZDIGITS)
- flags &= ~(SIGNOK|NZDIGITS|NDIGITS);
- else
- flags &= ~(SIGNOK|PFXOK|NDIGITS);
- goto ok;
-
- /* 1 through 7 always legal */
- case '1': case '2': case '3':
- case '4': case '5': case '6': case '7':
- base = basefix[base];
- flags &= ~(SIGNOK | PFXOK | NDIGITS);
- goto ok;
-
- /* digits 8 and 9 ok iff decimal or hex */
- case '8': case '9':
- base = basefix[base];
- if (base <= 8)
- break; /* not legal here */
- flags &= ~(SIGNOK | PFXOK | NDIGITS);
- goto ok;
-
- /* letters ok iff hex */
- case 'A': case 'B': case 'C':
- case 'D': case 'E': case 'F':
- case 'a': case 'b': case 'c':
- case 'd': case 'e': case 'f':
- /* no need to fix base here */
- if (base <= 10)
- break; /* not legal here */
- flags &= ~(SIGNOK | PFXOK | NDIGITS);
- goto ok;
-
- /* sign ok only as first character */
- case '+': case '-':
- if (flags & SIGNOK) {
- flags &= ~SIGNOK;
- flags |= HAVESIGN;
- goto ok;
- }
+ if (c == WEOF)
break;
-
- /*
- * x ok iff flag still set & 2nd char (or 3rd char if
- * we have a sign).
- */
- case 'x': case 'X':
- if (flags & PFXOK && wcp ==
- buf + 1 + !!(flags & HAVESIGN)) {
- base = 16; /* if %i */
- flags &= ~PFXOK;
- goto ok;
- }
+ if (!parseint_fsm(c, &state, &base))
break;
- }
-
- /*
- * If we got here, c is not a legal character for a
- * number. Stop accumulating digits.
- */
- if (c != WEOF)
- __ungetwc(c, fp, locale);
- break;
- ok:
- /*
- * c is legal: store it and look at the next.
- */
*wcp++ = (wchar_t)c;
}
/*
- * If we had only a sign, it is no good; push back the sign.
- * If the number ends in `x', it was [sign] '0' 'x', so push
- * back the x and treat it as [sign] '0'.
+ * If we only had a sign, push it back. If we only had a 0b or 0x
+ * prefix (possibly preceded by a sign), we view it as "0" and
+ * push back the letter. In all other cases, if we stopped
+ * because we read a non-number character, push it back.
*/
- if (flags & NDIGITS) {
- if (wcp > buf)
- __ungetwc(*--wcp, fp, locale);
- return (0);
- }
- c = wcp[-1];
- if (c == 'x' || c == 'X') {
- --wcp;
+ if (state == havesign) {
+ wcp--;
+ __ungetwc(*wcp, fp, locale);
+ } else if (state == haveprefix) {
+ wcp--;
+ __ungetwc(c, fp, locale);
+ } else if (width && c != WEOF) {
__ungetwc(c, fp, locale);
}
return (wcp - buf);
@@ -518,6 +534,45 @@ literal:
case 't':
flags |= PTRDIFFT;
goto again;
+ case 'w':
+ /*
+ * Fixed-width integer types. On all platforms we
+ * support, int8_t is equivalent to char, int16_t
+ * is equivalent to short, int32_t is equivalent
+ * to int, int64_t is equivalent to long long int.
+ * Furthermore, int_fast8_t, int_fast16_t and
+ * int_fast32_t are equivalent to int, and
+ * int_fast64_t is equivalent to long long int.
+ */
+ flags &= ~(SHORTSHORT|SHORT|LONG|LONGLONG|SIZET|INTMAXT|PTRDIFFT);
+ if (fmt[0] == 'f') {
+ flags |= FASTINT;
+ fmt++;
+ } else {
+ flags &= ~FASTINT;
+ }
+ if (fmt[0] == '8') {
+ if (!(flags & FASTINT))
+ flags |= SHORTSHORT;
+ else
+ /* no flag set = 32 */ ;
+ fmt += 1;
+ } else if (fmt[0] == '1' && fmt[1] == '6') {
+ if (!(flags & FASTINT))
+ flags |= SHORT;
+ else
+ /* no flag set = 32 */ ;
+ fmt += 2;
+ } else if (fmt[0] == '3' && fmt[1] == '2') {
+ /* no flag set = 32 */ ;
+ fmt += 2;
+ } else if (fmt[0] == '6' && fmt[1] == '4') {
+ flags |= LONGLONG;
+ fmt += 2;
+ } else {
+ goto match_failure;
+ }
+ goto again;
case 'z':
flags |= SIZET;
goto again;
@@ -540,6 +595,13 @@ literal:
/*
* Conversions.
*/
+ case 'B':
+ case 'b':
+ c = CT_INT;
+ flags |= UNSIGNED;
+ base = 2;
+ break;
+
case 'd':
c = CT_INT;
base = 10;
@@ -564,7 +626,6 @@ literal:
case 'X':
case 'x':
- flags |= PFXOK; /* enable 0x prefixing */
c = CT_INT;
flags |= UNSIGNED;
base = 16;
@@ -610,7 +671,7 @@ literal:
break;
case 'p': /* pointer format is like hex */
- flags |= POINTER | PFXOK;
+ flags |= POINTER;
c = CT_INT; /* assumes sizeof(uintmax_t) */
flags |= UNSIGNED; /* >= sizeof(uintptr_t) */
base = 16;
@@ -720,7 +781,7 @@ literal:
sizeof(*buf) - 1)
width = sizeof(buf) / sizeof(*buf) - 1;
- nr = parseint(fp, buf, width, base, flags, locale);
+ nr = parseint(fp, buf, width, base, locale);
if (nr == 0)
goto match_failure;
if ((flags & SUPPRESS) == 0) {
diff --git a/lib/libc/stdio/vprintf.c b/lib/libc/stdio/vprintf.c
index 7a4cc69dec98..f49f3d5daff0 100644
--- a/lib/libc/stdio/vprintf.c
+++ b/lib/libc/stdio/vprintf.c
@@ -8,7 +8,7 @@
* Chris Torek.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -37,12 +37,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)vprintf.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
#include <xlocale.h>
diff --git a/lib/libc/stdio/vscanf.c b/lib/libc/stdio/vscanf.c
index 15024fdfc09c..9011a44c8e25 100644
--- a/lib/libc/stdio/vscanf.c
+++ b/lib/libc/stdio/vscanf.c
@@ -8,7 +8,7 @@
* Donn Seeley at UUNET Technologies, Inc.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -37,12 +37,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)vscanf.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <stdio.h>
#include "un-namespace.h"
diff --git a/lib/libc/stdio/vsnprintf.c b/lib/libc/stdio/vsnprintf.c
index f108a6d7871a..2213b20e3f1e 100644
--- a/lib/libc/stdio/vsnprintf.c
+++ b/lib/libc/stdio/vsnprintf.c
@@ -8,7 +8,7 @@
* Chris Torek.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -37,12 +37,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)vsnprintf.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <limits.h>
#include <stdio.h>
diff --git a/lib/libc/stdio/vsprintf.c b/lib/libc/stdio/vsprintf.c
index 9e03e7126d4a..a478759a2471 100644
--- a/lib/libc/stdio/vsprintf.c
+++ b/lib/libc/stdio/vsprintf.c
@@ -8,7 +8,7 @@
* Chris Torek.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -37,12 +37,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)vsprintf.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
#include <limits.h>
#include "local.h"
diff --git a/lib/libc/stdio/vsscanf.c b/lib/libc/stdio/vsscanf.c
index 771dee0c1c42..f77928725f92 100644
--- a/lib/libc/stdio/vsscanf.c
+++ b/lib/libc/stdio/vsscanf.c
@@ -5,7 +5,7 @@
* The Regents of the University of California. All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -37,12 +37,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)vsscanf.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
#include <string.h>
#include "local.h"
diff --git a/lib/libc/stdio/vswprintf.c b/lib/libc/stdio/vswprintf.c
index 9bd31abe992c..e90a05c4cc14 100644
--- a/lib/libc/stdio/vswprintf.c
+++ b/lib/libc/stdio/vswprintf.c
@@ -7,7 +7,7 @@
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -34,12 +34,6 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-#if 0
-__FBSDID("FreeBSD: src/lib/libc/stdio/vasprintf.c,v 1.16 2002/08/21 16:19:57 mike Exp ");
-#endif
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <limits.h>
#include <stdio.h>
diff --git a/lib/libc/stdio/vswscanf.c b/lib/libc/stdio/vswscanf.c
index d3f96774a71c..be21f4a53f7b 100644
--- a/lib/libc/stdio/vswscanf.c
+++ b/lib/libc/stdio/vswscanf.c
@@ -8,7 +8,7 @@
* Donn Seeley at UUNET Technologies, Inc.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -37,15 +37,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)vsscanf.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-__FBSDID("FreeBSD: src/lib/libc/stdio/vsscanf.c,v 1.11 2002/08/21 16:19:57 mike Exp ");
-#endif
-__FBSDID("$FreeBSD$");
-
#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
diff --git a/lib/libc/stdio/vwprintf.c b/lib/libc/stdio/vwprintf.c
index f0aca08ac65a..0647130f9732 100644
--- a/lib/libc/stdio/vwprintf.c
+++ b/lib/libc/stdio/vwprintf.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002 Tim J. Robbins
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdarg.h>
#include <stdio.h>
#include <wchar.h>
diff --git a/lib/libc/stdio/vwscanf.c b/lib/libc/stdio/vwscanf.c
index 6f80c249d2d5..b4906184e2c0 100644
--- a/lib/libc/stdio/vwscanf.c
+++ b/lib/libc/stdio/vwscanf.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002 Tim J. Robbins
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdarg.h>
#include <stdio.h>
#include <wchar.h>
diff --git a/lib/libc/stdio/wbuf.c b/lib/libc/stdio/wbuf.c
index e1aa70243e94..7993f3e3d38f 100644
--- a/lib/libc/stdio/wbuf.c
+++ b/lib/libc/stdio/wbuf.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)wbuf.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <stdio.h>
#include "local.h"
@@ -81,14 +75,14 @@ __swbuf(int c, FILE *fp)
*/
n = fp->_p - fp->_bf._base;
if (n >= fp->_bf._size) {
- if (__fflush(fp))
+ if (__fflush(fp) != 0)
return (EOF);
n = 0;
}
fp->_w--;
*fp->_p++ = c;
if (++n == fp->_bf._size || (fp->_flags & __SLBF && c == '\n'))
- if (__fflush(fp))
+ if (__fflush(fp) != 0)
return (EOF);
return (c);
}
diff --git a/lib/libc/stdio/wprintf.3 b/lib/libc/stdio/wprintf.3
index 561aec8958f3..d1d2bdfaffd4 100644
--- a/lib/libc/stdio/wprintf.3
+++ b/lib/libc/stdio/wprintf.3
@@ -28,10 +28,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.
-.\"
-.\" @(#)printf.3 8.1 (Berkeley) 6/4/93
.\" FreeBSD: src/lib/libc/stdio/printf.3,v 1.47 2002/09/06 11:23:55 tjr Exp
-.\" $FreeBSD$
.\"
.Dd July 5, 2003
.Dt WPRINTF 3
diff --git a/lib/libc/stdio/wprintf.c b/lib/libc/stdio/wprintf.c
index c1d1f2656b7a..0aa33cc78770 100644
--- a/lib/libc/stdio/wprintf.c
+++ b/lib/libc/stdio/wprintf.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002 Tim J. Robbins
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdarg.h>
#include <stdio.h>
#include <wchar.h>
diff --git a/lib/libc/stdio/wscanf.3 b/lib/libc/stdio/wscanf.3
index e6a568b24087..6b428452e6aa 100644
--- a/lib/libc/stdio/wscanf.3
+++ b/lib/libc/stdio/wscanf.3
@@ -28,10 +28,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.
-.\"
-.\" @(#)scanf.3 8.2 (Berkeley) 12/11/93
.\" FreeBSD: src/lib/libc/stdio/scanf.3,v 1.24 2003/06/28 09:03:25 das Exp
-.\" $FreeBSD$
.\"
.Dd July 5, 2003
.Dt WSCANF 3
diff --git a/lib/libc/stdio/wscanf.c b/lib/libc/stdio/wscanf.c
index 33e0f3805d1c..8e2019c2c490 100644
--- a/lib/libc/stdio/wscanf.c
+++ b/lib/libc/stdio/wscanf.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002 Tim J. Robbins
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -31,9 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdarg.h>
#include <stdio.h>
#include <wchar.h>
diff --git a/lib/libc/stdio/wsetup.c b/lib/libc/stdio/wsetup.c
index 1733d69ee44d..61797b035b33 100644
--- a/lib/libc/stdio/wsetup.c
+++ b/lib/libc/stdio/wsetup.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)wsetup.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/lib/libc/stdio/xprintf.c b/lib/libc/stdio/xprintf.c
index 2c7eb6ce9414..a5671db67f58 100644
--- a/lib/libc/stdio/xprintf.c
+++ b/lib/libc/stdio/xprintf.c
@@ -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$
*/
#include "namespace.h"
diff --git a/lib/libc/stdio/xprintf_errno.c b/lib/libc/stdio/xprintf_errno.c
index 7312ac6e0694..f1e5421f60c8 100644
--- a/lib/libc/stdio/xprintf_errno.c
+++ b/lib/libc/stdio/xprintf_errno.c
@@ -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,11 +24,10 @@
* 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 <namespace.h>
+#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -40,7 +39,8 @@
#include "printf.h"
int
-__printf_arginfo_errno(const struct printf_info *pi __unused, size_t n, int *argt)
+__printf_arginfo_errno(const struct printf_info *pi __unused, size_t n,
+ int *argt)
{
assert(n >= 1);
@@ -49,17 +49,18 @@ __printf_arginfo_errno(const struct printf_info *pi __unused, size_t n, int *arg
}
int
-__printf_render_errno(struct __printf_io *io, const struct printf_info *pi __unused, const void *const *arg)
+__printf_render_errno(struct __printf_io *io, const struct printf_info *pi
+ __unused, const void *const *arg)
{
int ret, error;
char buf[64];
- const char *p;
+ char errnomsg[NL_TEXTMAX];
ret = 0;
error = *((const int *)arg[0]);
if (error >= 0 && error < __hidden_sys_nerr) {
- p = strerror(error);
- return (__printf_out(io, pi, p, strlen(p)));
+ strerror_r(error, errnomsg, sizeof(errnomsg));
+ return (__printf_out(io, pi, errnomsg, strlen(errnomsg)));
}
sprintf(buf, "errno=%d/0x%x", error, error);
ret += __printf_out(io, pi, buf, strlen(buf));
diff --git a/lib/libc/stdio/xprintf_float.c b/lib/libc/stdio/xprintf_float.c
index e07227526792..d87e7309dc9d 100644
--- a/lib/libc/stdio/xprintf_float.c
+++ b/lib/libc/stdio/xprintf_float.c
@@ -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$
*/
#include <namespace.h>
diff --git a/lib/libc/stdio/xprintf_hexdump.c b/lib/libc/stdio/xprintf_hexdump.c
index 0b7dfb3ff221..3cc6ef3d0672 100644
--- a/lib/libc/stdio/xprintf_hexdump.c
+++ b/lib/libc/stdio/xprintf_hexdump.c
@@ -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$
*/
#include <namespace.h>
diff --git a/lib/libc/stdio/xprintf_int.c b/lib/libc/stdio/xprintf_int.c
index 3a5c2d81893a..9bf1bb3cd990 100644
--- a/lib/libc/stdio/xprintf_int.c
+++ b/lib/libc/stdio/xprintf_int.c
@@ -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$
*/
#include <namespace.h>
diff --git a/lib/libc/stdio/xprintf_quote.c b/lib/libc/stdio/xprintf_quote.c
index 5b102b10c632..44bc24a980d2 100644
--- a/lib/libc/stdio/xprintf_quote.c
+++ b/lib/libc/stdio/xprintf_quote.c
@@ -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$
*/
#include <namespace.h>
diff --git a/lib/libc/stdio/xprintf_str.c b/lib/libc/stdio/xprintf_str.c
index 19b37a4c9816..53cfbeb1f930 100644
--- a/lib/libc/stdio/xprintf_str.c
+++ b/lib/libc/stdio/xprintf_str.c
@@ -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$
*/
#include <namespace.h>
diff --git a/lib/libc/stdio/xprintf_time.c b/lib/libc/stdio/xprintf_time.c
index fc86fc56d01b..8e42624d7b8e 100644
--- a/lib/libc/stdio/xprintf_time.c
+++ b/lib/libc/stdio/xprintf_time.c
@@ -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$
*/
#include <namespace.h>
#include <stdio.h>
diff --git a/lib/libc/stdio/xprintf_vis.c b/lib/libc/stdio/xprintf_vis.c
index ab1735b8543d..1ea267543782 100644
--- a/lib/libc/stdio/xprintf_vis.c
+++ b/lib/libc/stdio/xprintf_vis.c
@@ -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$
*/
#include <namespace.h>
diff --git a/lib/libc/stdlib/Makefile.inc b/lib/libc/stdlib/Makefile.inc
index 361761e73fdd..5e273d5d5a21 100644
--- a/lib/libc/stdlib/Makefile.inc
+++ b/lib/libc/stdlib/Makefile.inc
@@ -1,18 +1,16 @@
-# from @(#)Makefile.inc 8.3 (Berkeley) 2/4/95
-# $FreeBSD$
# machine-independent stdlib sources
.PATH: ${LIBC_SRCTOP}/${LIBC_ARCH}/stdlib ${LIBC_SRCTOP}/stdlib
MISRCS+=C99_Exit.c a64l.c abort.c abs.c atexit.c atof.c atoi.c atol.c atoll.c \
- bsearch.c \
+ bsearch.c bsearch_b.c \
cxa_thread_atexit.c cxa_thread_atexit_impl.c \
div.c exit.c getenv.c getopt.c getopt_long.c \
getsubopt.c hcreate.c hcreate_r.c hdestroy_r.c heapsort.c heapsort_b.c \
hsearch_r.c imaxabs.c imaxdiv.c \
insque.c l64a.c labs.c ldiv.c llabs.c lldiv.c lsearch.c \
- merge.c mergesort_b.c ptsname.c qsort.c qsort_r.c qsort_s.c \
- quick_exit.c radixsort.c rand.c \
+ merge.c mergesort_b.c ptsname.c qsort.c qsort_r.c qsort_r_compat.c \
+ qsort_s.c quick_exit.c radixsort.c rand.c \
random.c reallocarray.c reallocf.c realpath.c remque.c \
set_constraint_handler_s.c strfmon.c strtoimax.c \
strtol.c strtold.c strtoll.c strtoq.c strtoul.c strtonum.c strtoull.c \
@@ -29,6 +27,8 @@ C99_Exit.c: ${LIBC_SRCTOP}/stdlib/_Exit.c .NOMETA
SYM_MAPS+= ${LIBC_SRCTOP}/stdlib/Symbol.map
+.include "${LIBC_SRCTOP}/stdlib/malloc/Makefile.inc"
+
# machine-dependent stdlib sources
.sinclude "${LIBC_SRCTOP}/${LIBC_ARCH}/stdlib/Makefile.inc"
@@ -43,26 +43,51 @@ MAN+= a64l.3 abort.3 abs.3 alloca.3 atexit.3 atof.3 \
strfmon.3 strtod.3 strtol.3 strtonum.3 strtoul.3 system.3 \
tsearch.3
-MLINKS+=a64l.3 l64a.3 a64l.3 l64a_r.3
+MLINKS+=a64l.3 l64a.3 \
+ a64l.3 l64a_r.3
MLINKS+=atol.3 atoll.3
MLINKS+=exit.3 _Exit.3
-MLINKS+=getenv.3 putenv.3 getenv.3 setenv.3 getenv.3 unsetenv.3
+MLINKS+=getenv.3 clearenv.3 \
+ getenv.3 putenv.3 \
+ getenv.3 secure_getenv.3 \
+ getenv.3 setenv.3 \
+ getenv.3 unsetenv.3
MLINKS+=getopt_long.3 getopt_long_only.3
-MLINKS+=hcreate.3 hdestroy.3 hcreate.3 hsearch.3
-MLINKS+=hcreate.3 hcreate_r.3 hcreate.3 hdestroy_r.3 hcreate.3 hsearch_r.3
+MLINKS+=hcreate.3 hdestroy.3 \
+ hcreate.3 hsearch.3
+MLINKS+=hcreate.3 hcreate_r.3 \
+ hcreate.3 hdestroy_r.3 \
+ hcreate.3 hsearch_r.3
MLINKS+=insque.3 remque.3
MLINKS+=lsearch.3 lfind.3
-MLINKS+=ptsname.3 grantpt.3 ptsname.3 ptsname_r.3 ptsname.3 unlockpt.3
-MLINKS+=qsort.3 heapsort.3 qsort.3 mergesort.3 qsort.3 qsort_r.3 \
+MLINKS+=ptsname.3 grantpt.3 \
+ ptsname.3 ptsname_r.3 \
+ ptsname.3 unlockpt.3
+MLINKS+=qsort.3 heapsort.3 \
+ qsort.3 heapsort_b.3 \
+ qsort.3 mergesort.3 \
+ qsort.3 mergesort_b.3 \
+ qsort.3 qsort_b.3 \
+ qsort.3 qsort_r.3 \
qsort.3 qsort_s.3
-MLINKS+=rand.3 rand_r.3 rand.3 srand.3
-MLINKS+=random.3 initstate.3 random.3 setstate.3 random.3 srandom.3 \
+MLINKS+=rand.3 rand_r.3 \
+ rand.3 srand.3
+MLINKS+=random.3 initstate.3 \
+ random.3 setstate.3 \
+ random.3 srandom.3 \
random.3 srandomdev.3
MLINKS+=radixsort.3 sradixsort.3
MLINKS+=set_constraint_handler_s.3 abort_handler_s.3
MLINKS+=set_constraint_handler_s.3 ignore_handler_s.3
MLINKS+=strfmon.3 strfmon_l.3
-MLINKS+=strtod.3 strtof.3 strtod.3 strtold.3
-MLINKS+=strtol.3 strtoll.3 strtol.3 strtoq.3 strtol.3 strtoimax.3
-MLINKS+=strtoul.3 strtoull.3 strtoul.3 strtouq.3 strtoul.3 strtoumax.3
-MLINKS+=tsearch.3 tdelete.3 tsearch.3 tfind.3 tsearch.3 twalk.3
+MLINKS+=strtod.3 strtof.3 \
+ strtod.3 strtold.3
+MLINKS+=strtol.3 strtoll.3 \
+ strtol.3 strtoq.3 \
+ strtol.3 strtoimax.3
+MLINKS+=strtoul.3 strtoull.3 \
+ strtoul.3 strtouq.3 \
+ strtoul.3 strtoumax.3
+MLINKS+=tsearch.3 tdelete.3 \
+ tsearch.3 tfind.3 \
+ tsearch.3 twalk.3
diff --git a/lib/libc/stdlib/Symbol.map b/lib/libc/stdlib/Symbol.map
index 2be23390e333..d74df869cf54 100644
--- a/lib/libc/stdlib/Symbol.map
+++ b/lib/libc/stdlib/Symbol.map
@@ -1,7 +1,3 @@
-/*
- * $FreeBSD$
- */
-
FBSD_1.0 {
_Exit;
a64l;
@@ -49,7 +45,6 @@ FBSD_1.0 {
lfind;
mergesort;
putenv;
- qsort_r;
qsort;
radixsort;
sradixsort;
@@ -94,11 +89,9 @@ FBSD_1.3 {
strtol_l;
strtold_l;
strtoll_l;
- strtoq_l;
strtoul_l;
strtoull_l;
strtoumax_l;
- strtouq_l;
};
FBSD_1.4 {
@@ -128,6 +121,12 @@ FBSD_1.6 {
srand;
};
+FBSD_1.7 {
+ clearenv;
+ qsort_r;
+ secure_getenv;
+};
+
FBSDprivate_1.0 {
__system;
_system;
diff --git a/lib/libc/stdlib/_Exit.c b/lib/libc/stdlib/_Exit.c
index e7f0f5104f93..a7af0c9efe80 100644
--- a/lib/libc/stdlib/_Exit.c
+++ b/lib/libc/stdlib/_Exit.c
@@ -1,8 +1,6 @@
/*
* This file is in the public domain. Written by Garrett A. Wollman,
* 2002-09-07.
- *
- * $FreeBSD$
*/
#include <stdlib.h>
diff --git a/lib/libc/stdlib/a64l.3 b/lib/libc/stdlib/a64l.3
index eadc2f393460..517243ddaaed 100644
--- a/lib/libc/stdlib/a64l.3
+++ b/lib/libc/stdlib/a64l.3
@@ -32,8 +32,6 @@
.\" the referee document. The original Standard can be obtained online at
.\" http://www.opengroup.org/unix/online.html.
.\"
-.\" $FreeBSD$
-.\"
.Dd November 20, 2005
.Dt A64L 3
.Os
diff --git a/lib/libc/stdlib/a64l.c b/lib/libc/stdlib/a64l.c
index a130dcb24bf5..71514c502d69 100644
--- a/lib/libc/stdlib/a64l.c
+++ b/lib/libc/stdlib/a64l.c
@@ -10,8 +10,6 @@ __RCSID("$NetBSD: a64l.c,v 1.8 2000/01/22 22:19:19 mycroft Exp $");
#endif
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdlib.h>
#include <inttypes.h>
diff --git a/lib/libc/stdlib/abort.3 b/lib/libc/stdlib/abort.3
index 780e166b0d2b..2a14eb44c5a7 100644
--- a/lib/libc/stdlib/abort.3
+++ b/lib/libc/stdlib/abort.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)abort.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd May 28, 2018
.Dt ABORT 3
.Os
diff --git a/lib/libc/stdlib/abort.c b/lib/libc/stdlib/abort.c
index 72c93a115ec0..02b01cb3db66 100644
--- a/lib/libc/stdlib/abort.c
+++ b/lib/libc/stdlib/abort.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)abort.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <signal.h>
#include <stdlib.h>
diff --git a/lib/libc/stdlib/abs.3 b/lib/libc/stdlib/abs.3
index eca85e1e7a59..d47f83ea0f73 100644
--- a/lib/libc/stdlib/abs.3
+++ b/lib/libc/stdlib/abs.3
@@ -29,10 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)abs.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd November 14, 2001
+.Dd April 3, 2022
.Dt ABS 3
.Os
.Sh NAME
@@ -71,5 +68,10 @@ The
.Fn abs
function conforms to
.St -isoC-99 .
+.Sh HISTORY
+The
+.Fn abs
+function first appeared in
+.At v6 .
.Sh BUGS
The absolute value of the most negative integer remains negative.
diff --git a/lib/libc/stdlib/abs.c b/lib/libc/stdlib/abs.c
index 0e4c94c68286..baed3795bf5e 100644
--- a/lib/libc/stdlib/abs.c
+++ b/lib/libc/stdlib/abs.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)abs.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdlib.h>
int
diff --git a/lib/libc/stdlib/alloca.3 b/lib/libc/stdlib/alloca.3
index 38f5aee3a797..d2111872ae0b 100644
--- a/lib/libc/stdlib/alloca.3
+++ b/lib/libc/stdlib/alloca.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)alloca.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd September 5, 2006
.Dt ALLOCA 3
.Os
diff --git a/lib/libc/stdlib/at_quick_exit.3 b/lib/libc/stdlib/at_quick_exit.3
index c43015402582..d92e58fd0433 100644
--- a/lib/libc/stdlib/at_quick_exit.3
+++ b/lib/libc/stdlib/at_quick_exit.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd December 7, 2011
.Dt AT_QUICK_EXIT 3
.Os
diff --git a/lib/libc/stdlib/atexit.3 b/lib/libc/stdlib/atexit.3
index 3cdc59fed862..4ff384813550 100644
--- a/lib/libc/stdlib/atexit.3
+++ b/lib/libc/stdlib/atexit.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)atexit.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd September 6, 2002
.Dt ATEXIT 3
.Os
diff --git a/lib/libc/stdlib/atexit.c b/lib/libc/stdlib/atexit.c
index 682464407c7f..e5aa66c51f38 100644
--- a/lib/libc/stdlib/atexit.c
+++ b/lib/libc/stdlib/atexit.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)atexit.c 8.2 (Berkeley) 7/3/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <errno.h>
#include <link.h>
diff --git a/lib/libc/stdlib/atexit.h b/lib/libc/stdlib/atexit.h
index fdf2fc158380..3cfe5d3df36d 100644
--- a/lib/libc/stdlib/atexit.h
+++ b/lib/libc/stdlib/atexit.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.
- *
- * @(#)atexit.h 8.2 (Berkeley) 7/3/94
- * $FreeBSD$
*/
/* must be at least 32 to guarantee ANSI conformance */
diff --git a/lib/libc/stdlib/atof.3 b/lib/libc/stdlib/atof.3
index 47e6c8846a1b..8129d4b77c7f 100644
--- a/lib/libc/stdlib/atof.3
+++ b/lib/libc/stdlib/atof.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)atof.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd April 1, 2020
.Dt ATOF 3
.Os
diff --git a/lib/libc/stdlib/atof.c b/lib/libc/stdlib/atof.c
index c7e0676188ea..2376249dc65f 100644
--- a/lib/libc/stdlib/atof.c
+++ b/lib/libc/stdlib/atof.c
@@ -5,7 +5,7 @@
* The Regents of the University of California. All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -34,12 +34,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)atof.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdlib.h>
#include <xlocale.h>
diff --git a/lib/libc/stdlib/atoi.3 b/lib/libc/stdlib/atoi.3
index 628258f50968..da03e91de747 100644
--- a/lib/libc/stdlib/atoi.3
+++ b/lib/libc/stdlib/atoi.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)atoi.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd April 1, 2020
.Dt ATOI 3
.Os
diff --git a/lib/libc/stdlib/atoi.c b/lib/libc/stdlib/atoi.c
index 700c498029d7..7dd888d9b6e7 100644
--- a/lib/libc/stdlib/atoi.c
+++ b/lib/libc/stdlib/atoi.c
@@ -5,7 +5,7 @@
* The Regents of the University of California. All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -34,12 +34,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)atoi.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdlib.h>
#include <xlocale.h>
diff --git a/lib/libc/stdlib/atol.3 b/lib/libc/stdlib/atol.3
index e2ac0e54a35c..714c3ac65cfa 100644
--- a/lib/libc/stdlib/atol.3
+++ b/lib/libc/stdlib/atol.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)atol.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd May 14, 2013
.Dt ATOL 3
.Os
diff --git a/lib/libc/stdlib/atol.c b/lib/libc/stdlib/atol.c
index 35e83fbf6181..356efbc99aef 100644
--- a/lib/libc/stdlib/atol.c
+++ b/lib/libc/stdlib/atol.c
@@ -5,7 +5,7 @@
* The Regents of the University of California. All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -34,12 +34,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)atol.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdlib.h>
#include <xlocale.h>
diff --git a/lib/libc/stdlib/atoll.c b/lib/libc/stdlib/atoll.c
index bfbdb976501a..4819c3f56150 100644
--- a/lib/libc/stdlib/atoll.c
+++ b/lib/libc/stdlib/atoll.c
@@ -5,7 +5,7 @@
* The Regents of the University of California. All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -34,9 +34,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdlib.h>
#include <xlocale.h>
diff --git a/lib/libc/stdlib/bsearch.3 b/lib/libc/stdlib/bsearch.3
index 9b93cb6164ed..712be0f98381 100644
--- a/lib/libc/stdlib/bsearch.3
+++ b/lib/libc/stdlib/bsearch.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)bsearch.3 8.3 (Berkeley) 4/19/94
-.\" $FreeBSD$
-.\"
.Dd July 17, 2019
.Dt BSEARCH 3
.Os
diff --git a/lib/libc/stdlib/bsearch.c b/lib/libc/stdlib/bsearch.c
index b5c342635c01..96c728e1c997 100644
--- a/lib/libc/stdlib/bsearch.c
+++ b/lib/libc/stdlib/bsearch.c
@@ -29,18 +29,13 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)bsearch.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stddef.h>
#include <stdlib.h>
#ifdef I_AM_BSEARCH_B
#include "block_abi.h"
#define COMPAR(x,y) CALL_BLOCK(compar, x, y)
+typedef DECLARE_BLOCK(int, compar_block, const void *, const void *);
#else
#define COMPAR(x,y) compar(x, y)
#endif
@@ -64,7 +59,7 @@ __FBSDID("$FreeBSD$");
#ifdef I_AM_BSEARCH_B
void *
bsearch_b(const void *key, const void *base0, size_t nmemb, size_t size,
- DECLARE_BLOCK(int, compar, const void *, const void *))
+ compar_block compar)
#else
void *
bsearch(const void *key, const void *base0, size_t nmemb, size_t size,
diff --git a/lib/libc/stdlib/bsearch_b.c b/lib/libc/stdlib/bsearch_b.c
index 393feba946ea..c60f8cdc8305 100644
--- a/lib/libc/stdlib/bsearch_b.c
+++ b/lib/libc/stdlib/bsearch_b.c
@@ -22,8 +22,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$
*/
#define I_AM_BSEARCH_B
#include "bsearch.c"
diff --git a/lib/libc/stdlib/cxa_thread_atexit.c b/lib/libc/stdlib/cxa_thread_atexit.c
index 6f03ef0d3235..1715bc6d125c 100644
--- a/lib/libc/stdlib/cxa_thread_atexit.c
+++ b/lib/libc/stdlib/cxa_thread_atexit.c
@@ -1,6 +1,5 @@
/*-
* Copyright (c) 2017 The FreeBSD Foundation
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -27,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "libc_private.h"
int
diff --git a/lib/libc/stdlib/cxa_thread_atexit_impl.c b/lib/libc/stdlib/cxa_thread_atexit_impl.c
index 0f0a7a314fa9..f95384b30347 100644
--- a/lib/libc/stdlib/cxa_thread_atexit_impl.c
+++ b/lib/libc/stdlib/cxa_thread_atexit_impl.c
@@ -28,9 +28,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/queue.h>
#include "namespace.h"
#include <errno.h>
@@ -109,8 +106,9 @@ walk_cb_call(struct cxa_thread_dtor *dtor)
__elf_phdr_match_addr(&phdr_info, dtor->func))
dtor->func(dtor->obj);
else
- fprintf(stderr, "__cxa_thread_call_dtors: dtr %p from "
- "unloaded dso, skipping\n", (void *)(dtor->func));
+ fprintf(stderr,
+ "__cxa_thread_call_dtors: dtr %p from unloaded dso, skipping\n",
+ (void *)(dtor->func));
}
static void
diff --git a/lib/libc/stdlib/div.3 b/lib/libc/stdlib/div.3
index ddd92a008790..55c1bd107cb7 100644
--- a/lib/libc/stdlib/div.3
+++ b/lib/libc/stdlib/div.3
@@ -27,9 +27,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)div.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd November 14, 2001
.Dt DIV 3
.Os
diff --git a/lib/libc/stdlib/div.c b/lib/libc/stdlib/div.c
index b7efb1dfc595..351dca870553 100644
--- a/lib/libc/stdlib/div.c
+++ b/lib/libc/stdlib/div.c
@@ -32,50 +32,15 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)div.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdlib.h> /* div_t */
div_t
-div(num, denom)
- int num, denom;
+div(int num, int denom)
{
div_t r;
r.quot = num / denom;
r.rem = num % denom;
-#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
- /*
- * The ANSI standard says that |r.quot| <= |n/d|, where
- * n/d is to be computed in infinite precision. In other
- * words, we should always truncate the quotient towards
- * 0, never -infinity.
- *
- * Machine division and remainer may work either way when
- * one or both of n or d is negative. If only one is
- * negative and r.quot has been truncated towards -inf,
- * r.rem will have the same sign as denom and the opposite
- * sign of num; if both are negative and r.quot has been
- * truncated towards -inf, r.rem will be positive (will
- * have the opposite sign of num). These are considered
- * `wrong'.
- *
- * If both are num and denom are positive, r will always
- * be positive.
- *
- * This all boils down to:
- * if num >= 0, but r.rem < 0, we got the wrong answer.
- * In that case, to get the right answer, add 1 to r.quot and
- * subtract denom from r.rem.
- */
- if (num >= 0 && r.rem < 0) {
- r.quot++;
- r.rem -= denom;
- }
-#endif
+
return (r);
}
diff --git a/lib/libc/stdlib/exit.3 b/lib/libc/stdlib/exit.3
index ff7a67ffcb85..1ff590bb3ae8 100644
--- a/lib/libc/stdlib/exit.3
+++ b/lib/libc/stdlib/exit.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)exit.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd August 5, 2021
.Dt EXIT 3
.Os
@@ -81,7 +78,7 @@ The
implementation of the
.Fn _Exit
function does not call destructors registered with
-.Xr __cxa_atexit 3,
+.Xr __cxa_atexit 3 ,
does not flush buffers, and does not close streams.
.Pp
Both functions make the low-order eight bits of the
diff --git a/lib/libc/stdlib/exit.c b/lib/libc/stdlib/exit.c
index efd7f55f68c6..bca978428ce3 100644
--- a/lib/libc/stdlib/exit.c
+++ b/lib/libc/stdlib/exit.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)exit.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <stdlib.h>
#include <unistd.h>
diff --git a/lib/libc/stdlib/getenv.3 b/lib/libc/stdlib/getenv.3
index e662b86d214b..ded7bd61f735 100644
--- a/lib/libc/stdlib/getenv.3
+++ b/lib/libc/stdlib/getenv.3
@@ -29,15 +29,14 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)getenv.3 8.2 (Berkeley) 12/11/93
-.\" $FreeBSD$
-.\"
-.Dd June 20, 2007
+.Dd March 14, 2023
.Dt GETENV 3
.Os
.Sh NAME
+.Nm clearenv ,
.Nm getenv ,
.Nm putenv ,
+.Nm secure_getenv ,
.Nm setenv ,
.Nm unsetenv
.Nd environment variable functions
@@ -45,8 +44,12 @@
.Lb libc
.Sh SYNOPSIS
.In stdlib.h
+.Ft int
+.Fn clearenv "void"
.Ft char *
.Fn getenv "const char *name"
+.Ft char *
+.Fn secure_getenv "const char *name"
.Ft int
.Fn setenv "const char *name" "const char *value" "int overwrite"
.Ft int
@@ -59,6 +62,14 @@ host
.Em environment list .
.Pp
The
+.Fn clearenv
+function clears all environment variables.
+New variables can be added using
+.Fn setenv
+and
+.Fn putenv .
+.Pp
+The
.Fn getenv
function obtains the current value of the environment variable,
.Fa name .
@@ -68,6 +79,17 @@ to by the
function.
.Pp
The
+.Fn secure_getenv
+returns
+.Va NULL
+when the environment cannot be trusted, otherwise it acts like
+.Fn getenv .
+The environment currently is not trusted when
+.Xr issetugid 3
+returns a non-zero value, but other conditions may be added
+in the future.
+.Pp
+The
.Fn setenv
function inserts or resets the environment variable
.Fa name
@@ -128,7 +150,14 @@ is not in the current environment,
.Dv NULL
is returned.
.Pp
-.Rv -std setenv putenv unsetenv
+The
+.Fn secure_getenv
+function returns
+.Dv NULL
+if the process is in "secure execution," otherwise it will call
+.Fn getenv .
+.Pp
+.Rv -std clearenv setenv putenv unsetenv
.Sh ERRORS
.Bl -tag -width Er
.It Bq Er EINVAL
@@ -187,6 +216,9 @@ and
.Fn unsetenv
functions conforms to
.St -p1003.1-2001 .
+The
+.Fn secure_getenv
+function is expected to be glibc-compatible.
.Sh HISTORY
The functions
.Fn setenv
@@ -211,6 +243,13 @@ This was changed to use
as the memory location of the ``name=value'' pair to follow the
.Tn POSIX
specification.
+.Pp
+The
+.Fn clearenv
+and
+.Fn secure_getenv
+functions were added in
+.Fx 14 .
.Sh BUGS
Successive calls to
.Fn setenv
diff --git a/lib/libc/stdlib/getenv.c b/lib/libc/stdlib/getenv.c
index 5d445e18d93b..f8f59526421a 100644
--- a/lib/libc/stdlib/getenv.c
+++ b/lib/libc/stdlib/getenv.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2007-2009 Sean C. Farley <scf@FreeBSD.org>
* All rights reserved.
@@ -26,10 +26,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-
#include "namespace.h"
#include <sys/types.h>
#include <errno.h>
@@ -39,7 +35,7 @@ __FBSDID("$FreeBSD$");
#include <string.h>
#include <unistd.h>
#include "un-namespace.h"
-
+#include "libc_private.h"
static const char CorruptEnvFindMsg[] = "environment corrupt; unable to find ";
static const char CorruptEnvValueMsg[] =
@@ -56,7 +52,6 @@ static const char CorruptEnvValueMsg[] =
* intEnviron: Internally-built environ. Exposed via environ during
* (re)builds of the environment.
*/
-extern char **environ;
static char **origEnviron;
static char **intEnviron = NULL;
static int environSize = 0;
@@ -122,7 +117,7 @@ __env_warnx(const char *msg, const char *name, size_t nameLen)
/*
* Inline strlen() for performance. Also, perform check for an equals sign.
- * Cheaper here than peforming a strchr() later.
+ * Cheaper here than performing a strchr() later.
*/
static inline size_t
__strleneq(const char *str)
@@ -449,6 +444,18 @@ getenv(const char *name)
/*
+ * Runs getenv() unless the current process is tainted by uid or gid changes, in
+ * which case it will return NULL.
+ */
+char *
+secure_getenv(const char *name)
+{
+ if (issetugid())
+ return (NULL);
+ return (getenv(name));
+}
+
+/*
* Set the value of a variable. Older settings are labeled as inactive. If an
* older setting has enough room to store the new value, it will be reused. No
* previous variables are ever freed here to avoid causing a segmentation fault
@@ -575,7 +582,7 @@ __merge_environ(void)
/*
- * The exposed setenv() that peforms a few tests before calling the function
+ * The exposed setenv() that performs a few tests before calling the function
* (__setenv()) that does the actual work of inserting a variable into the
* environment.
*/
@@ -691,3 +698,28 @@ unsetenv(const char *name)
return (0);
}
+
+/*
+ * Unset all variable by flagging them as inactive. No variable is
+ * ever freed.
+ */
+int
+clearenv(void)
+{
+ int ndx;
+
+ /* Initialize environment. */
+ if (__merge_environ() == -1 || (envVars == NULL && __build_env() == -1))
+ return (-1);
+
+ /* Remove from the end to not shuffle memory too much. */
+ for (ndx = envVarsTotal - 1; ndx >= 0; ndx--) {
+ envVars[ndx].active = false;
+ if (envVars[ndx].putenv)
+ __remove_putenv(ndx);
+ }
+
+ __rebuild_environ(0);
+
+ return (0);
+}
diff --git a/lib/libc/stdlib/getopt.3 b/lib/libc/stdlib/getopt.3
index 6e04e1704712..a5b5bff9d1a7 100644
--- a/lib/libc/stdlib/getopt.3
+++ b/lib/libc/stdlib/getopt.3
@@ -27,9 +27,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)getopt.3 8.5 (Berkeley) 4/27/95
-.\" $FreeBSD$
-.\"
.Dd June 5, 2014
.Dt GETOPT 3
.Os
diff --git a/lib/libc/stdlib/getopt.c b/lib/libc/stdlib/getopt.c
index b7f2229a2f54..2b5e3fa69032 100644
--- a/lib/libc/stdlib/getopt.c
+++ b/lib/libc/stdlib/getopt.c
@@ -31,12 +31,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <stdio.h>
#include <stdlib.h>
diff --git a/lib/libc/stdlib/getopt_long.3 b/lib/libc/stdlib/getopt_long.3
index ab5da7387a45..f8bb1f1b6b11 100644
--- a/lib/libc/stdlib/getopt_long.3
+++ b/lib/libc/stdlib/getopt_long.3
@@ -28,10 +28,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)getopt.3 8.5 (Berkeley) 4/27/95
-.\" $FreeBSD$
-.\"
-.Dd May 2, 2018
+.Dd December 24, 2022
.Dt GETOPT_LONG 3
.Os
.Sh NAME
@@ -546,3 +543,19 @@ is set).
The implementation can completely replace
.Xr getopt 3 ,
but right now we are using separate code.
+.Pp
+.Nm
+makes the assumption that the first argument should always be skipped because
+it's typically the program name.
+As a result, setting
+.Va optind
+to 0 will indicate that
+.Nm
+should reset, and
+.Va optind
+will be set to 1 in the process.
+This behavior differs from
+.Xr getopt 3 ,
+which will handle an
+.Va optind
+value of 0 as expected and process the first element.
diff --git a/lib/libc/stdlib/getopt_long.c b/lib/libc/stdlib/getopt_long.c
index 1f3548bef9ad..5cf6a55649bd 100644
--- a/lib/libc/stdlib/getopt_long.c
+++ b/lib/libc/stdlib/getopt_long.c
@@ -49,14 +49,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: getopt_long.c,v 1.16 2004/02/04 18:17:25 millert Exp $";
-#endif /* LIBC_SCCS and not lint */
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <err.h>
#include <errno.h>
#include <getopt.h>
diff --git a/lib/libc/stdlib/getsubopt.3 b/lib/libc/stdlib/getsubopt.3
index 43ea2c2a9e2c..cd2845aefdcb 100644
--- a/lib/libc/stdlib/getsubopt.3
+++ b/lib/libc/stdlib/getsubopt.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)getsubopt.3 8.1 (Berkeley) 6/9/93
-.\" $FreeBSD$
-.\"
.Dd December 25, 2011
.Dt GETSUBOPT 3
.Os
diff --git a/lib/libc/stdlib/getsubopt.c b/lib/libc/stdlib/getsubopt.c
index 7ad9ae994444..8ff0f13655e1 100644
--- a/lib/libc/stdlib/getsubopt.c
+++ b/lib/libc/stdlib/getsubopt.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getsubopt.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdlib.h>
#include <string.h>
diff --git a/lib/libc/stdlib/hcreate.3 b/lib/libc/stdlib/hcreate.3
index 260aa91b6c7d..4621850d4661 100644
--- a/lib/libc/stdlib/hcreate.3
+++ b/lib/libc/stdlib/hcreate.3
@@ -26,8 +26,6 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd February 6, 2017
.Dt HCREATE 3
.Os
diff --git a/lib/libc/stdlib/hcreate.c b/lib/libc/stdlib/hcreate.c
index d2b7c1cd8cac..261f55bfec39 100644
--- a/lib/libc/stdlib/hcreate.c
+++ b/lib/libc/stdlib/hcreate.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2015 Nuxi, https://nuxi.nl/
*
@@ -25,9 +25,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <search.h>
#include <stdbool.h>
#include <stddef.h>
diff --git a/lib/libc/stdlib/hcreate_r.c b/lib/libc/stdlib/hcreate_r.c
index 83e322a5621b..90eff3318be9 100644
--- a/lib/libc/stdlib/hcreate_r.c
+++ b/lib/libc/stdlib/hcreate_r.c
@@ -23,9 +23,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <search.h>
#include <stdlib.h>
diff --git a/lib/libc/stdlib/hdestroy_r.c b/lib/libc/stdlib/hdestroy_r.c
index 890bd0858e1d..e9435c43bca1 100644
--- a/lib/libc/stdlib/hdestroy_r.c
+++ b/lib/libc/stdlib/hdestroy_r.c
@@ -23,9 +23,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <search.h>
#include <stdlib.h>
diff --git a/lib/libc/stdlib/heapsort.c b/lib/libc/stdlib/heapsort.c
index c39f67533b9a..7816caf17048 100644
--- a/lib/libc/stdlib/heapsort.c
+++ b/lib/libc/stdlib/heapsort.c
@@ -34,12 +34,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)heapsort.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <stddef.h>
#include <stdlib.h>
diff --git a/lib/libc/stdlib/heapsort_b.c b/lib/libc/stdlib/heapsort_b.c
index b1814bc2e0df..b030fbe6ee6d 100644
--- a/lib/libc/stdlib/heapsort_b.c
+++ b/lib/libc/stdlib/heapsort_b.c
@@ -22,8 +22,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$
*/
#define I_AM_HEAPSORT_B
#include "heapsort.c"
diff --git a/lib/libc/stdlib/hsearch.h b/lib/libc/stdlib/hsearch.h
index 649933d05e67..2d849357e52d 100644
--- a/lib/libc/stdlib/hsearch.h
+++ b/lib/libc/stdlib/hsearch.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 HSEARCH_H
diff --git a/lib/libc/stdlib/hsearch_r.c b/lib/libc/stdlib/hsearch_r.c
index 2fb599186d75..15c2c156fbec 100644
--- a/lib/libc/stdlib/hsearch_r.c
+++ b/lib/libc/stdlib/hsearch_r.c
@@ -23,9 +23,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <limits.h>
#include <search.h>
diff --git a/lib/libc/stdlib/imaxabs.3 b/lib/libc/stdlib/imaxabs.3
index 430f873280f5..fa68216facc1 100644
--- a/lib/libc/stdlib/imaxabs.3
+++ b/lib/libc/stdlib/imaxabs.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd November 14, 2001
.Dt IMAXABS 3
.Os
diff --git a/lib/libc/stdlib/imaxabs.c b/lib/libc/stdlib/imaxabs.c
index 7af863502ee5..08a27ac98da7 100644
--- a/lib/libc/stdlib/imaxabs.c
+++ b/lib/libc/stdlib/imaxabs.c
@@ -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.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <inttypes.h>
intmax_t
diff --git a/lib/libc/stdlib/imaxdiv.3 b/lib/libc/stdlib/imaxdiv.3
index 0ee0971a81be..1553a81edae2 100644
--- a/lib/libc/stdlib/imaxdiv.3
+++ b/lib/libc/stdlib/imaxdiv.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd November 14, 2001
.Dt IMAXDIV 3
.Os
diff --git a/lib/libc/stdlib/imaxdiv.c b/lib/libc/stdlib/imaxdiv.c
index 4d9f77546b9a..bf9737a3c47a 100644
--- a/lib/libc/stdlib/imaxdiv.c
+++ b/lib/libc/stdlib/imaxdiv.c
@@ -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.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <inttypes.h>
/* See comments in div.c for implementation details. */
@@ -39,11 +36,6 @@ imaxdiv(intmax_t numer, intmax_t denom)
retval.quot = numer / denom;
retval.rem = numer % denom;
-#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
- if (numer >= 0 && retval.rem < 0) {
- retval.quot++;
- retval.rem -= denom;
- }
-#endif
+
return (retval);
}
diff --git a/lib/libc/stdlib/insque.3 b/lib/libc/stdlib/insque.3
index a54434c6d316..5ae44273dd00 100644
--- a/lib/libc/stdlib/insque.3
+++ b/lib/libc/stdlib/insque.3
@@ -6,8 +6,6 @@
.\" As long as the above copyright statement and this notice remain
.\" unchanged, you can do what ever you want with this file.
.\"
-.\" $FreeBSD$
-.\"
.Dd October 10, 2002
.Dt INSQUE 3
.Os
diff --git a/lib/libc/stdlib/insque.c b/lib/libc/stdlib/insque.c
index 388e4d592617..3af31eb15554 100644
--- a/lib/libc/stdlib/insque.c
+++ b/lib/libc/stdlib/insque.c
@@ -6,9 +6,6 @@
* As long as the above copyright statement and this notice remain
* unchanged, you can do what ever you want with this file.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#define _SEARCH_PRIVATE
#include <search.h>
#ifdef DEBUG
diff --git a/lib/libc/stdlib/l64a.c b/lib/libc/stdlib/l64a.c
index c281d7d823c3..5be50118d274 100644
--- a/lib/libc/stdlib/l64a.c
+++ b/lib/libc/stdlib/l64a.c
@@ -10,8 +10,6 @@ __RCSID("$NetBSD: l64a.c,v 1.13 2003/07/26 19:24:54 salo Exp $");
#endif
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdint.h>
#include <stdlib.h>
diff --git a/lib/libc/stdlib/labs.3 b/lib/libc/stdlib/labs.3
index bbd32124f476..97f527b7d941 100644
--- a/lib/libc/stdlib/labs.3
+++ b/lib/libc/stdlib/labs.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)labs.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd November 14, 2001
.Dt LABS 3
.Os
diff --git a/lib/libc/stdlib/labs.c b/lib/libc/stdlib/labs.c
index a770b2cf4357..23696f1c0f0c 100644
--- a/lib/libc/stdlib/labs.c
+++ b/lib/libc/stdlib/labs.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)labs.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdlib.h>
long
diff --git a/lib/libc/stdlib/ldiv.3 b/lib/libc/stdlib/ldiv.3
index ce4d01771b11..66abb00d4d6c 100644
--- a/lib/libc/stdlib/ldiv.3
+++ b/lib/libc/stdlib/ldiv.3
@@ -29,10 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)ldiv.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd November 14, 2001
+.Dd April 3, 2022
.Dt LDIV 3
.Os
.Sh NAME
@@ -69,3 +66,9 @@ The
function
conforms to
.St -isoC-99 .
+.Sh HISTORY
+An
+.Fn ldiv
+function with similar functionality, but a different calling convention,
+first appeared in
+.At v4 .
diff --git a/lib/libc/stdlib/ldiv.c b/lib/libc/stdlib/ldiv.c
index f55ad6de4faf..4c73bcc14af4 100644
--- a/lib/libc/stdlib/ldiv.c
+++ b/lib/libc/stdlib/ldiv.c
@@ -32,17 +32,10 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)ldiv.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdlib.h> /* ldiv_t */
ldiv_t
-ldiv(num, denom)
- long num, denom;
+ldiv(long num, long denom)
{
ldiv_t r;
@@ -50,11 +43,6 @@ ldiv(num, denom)
r.quot = num / denom;
r.rem = num % denom;
-#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
- if (num >= 0 && r.rem < 0) {
- r.quot++;
- r.rem -= denom;
- }
-#endif
+
return (r);
}
diff --git a/lib/libc/stdlib/llabs.3 b/lib/libc/stdlib/llabs.3
index 8c031a940d6f..6a12fd539dc6 100644
--- a/lib/libc/stdlib/llabs.3
+++ b/lib/libc/stdlib/llabs.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd November 14, 2001
.Dt LLABS 3
.Os
diff --git a/lib/libc/stdlib/llabs.c b/lib/libc/stdlib/llabs.c
index 6b405f0314d1..ac151e3a5036 100644
--- a/lib/libc/stdlib/llabs.c
+++ b/lib/libc/stdlib/llabs.c
@@ -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.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdlib.h>
long long
diff --git a/lib/libc/stdlib/lldiv.3 b/lib/libc/stdlib/lldiv.3
index 976a997b9cc8..d1de4e9234e3 100644
--- a/lib/libc/stdlib/lldiv.3
+++ b/lib/libc/stdlib/lldiv.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd November 14, 2001
.Dt LLDIV 3
.Os
diff --git a/lib/libc/stdlib/lldiv.c b/lib/libc/stdlib/lldiv.c
index 47c13ee30e11..6feeb74bacd6 100644
--- a/lib/libc/stdlib/lldiv.c
+++ b/lib/libc/stdlib/lldiv.c
@@ -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.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdlib.h>
/* See comments in div.c for implementation details. */
@@ -39,11 +36,6 @@ lldiv(long long numer, long long denom)
retval.quot = numer / denom;
retval.rem = numer % denom;
-#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
- if (numer >= 0 && retval.rem < 0) {
- retval.quot++;
- retval.rem -= denom;
- }
-#endif
+
return (retval);
}
diff --git a/lib/libc/stdlib/lsearch.3 b/lib/libc/stdlib/lsearch.3
index f2f0105d608b..5433acfb9bfb 100644
--- a/lib/libc/stdlib/lsearch.3
+++ b/lib/libc/stdlib/lsearch.3
@@ -6,8 +6,6 @@
.\" As long as the above copyright statement and this notice remain
.\" unchanged, you can do what ever you want with this file.
.\"
-.\" $FreeBSD$
-.\"
.Dd April 17, 2016
.Dt LSEARCH 3
.Os
diff --git a/lib/libc/stdlib/lsearch.c b/lib/libc/stdlib/lsearch.c
index 9e9cdbaf619d..e2b83473411e 100644
--- a/lib/libc/stdlib/lsearch.c
+++ b/lib/libc/stdlib/lsearch.c
@@ -7,9 +7,6 @@
* unchanged, you can do what ever you want with this file.
*/
#include <sys/types.h>
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#define _SEARCH_PRIVATE
#include <search.h>
#include <stdint.h> /* for uint8_t */
diff --git a/lib/libc/stdlib/malloc/Makefile.inc b/lib/libc/stdlib/malloc/Makefile.inc
new file mode 100644
index 000000000000..3bae4ff1505b
--- /dev/null
+++ b/lib/libc/stdlib/malloc/Makefile.inc
@@ -0,0 +1,3 @@
+SYM_MAPS+=${LIBC_SRCTOP}/stdlib/malloc/Symbol.map
+
+.include "${LIBC_SRCTOP}/stdlib/malloc/${OPT_LIBC_MALLOC}/Makefile.inc"
diff --git a/lib/libc/stdlib/jemalloc/Symbol.map b/lib/libc/stdlib/malloc/Symbol.map
index 087ca53ff75f..15e4f9e6c69c 100644
--- a/lib/libc/stdlib/jemalloc/Symbol.map
+++ b/lib/libc/stdlib/malloc/Symbol.map
@@ -1,7 +1,3 @@
-/*
- * $FreeBSD$
- */
-
FBSD_1.0 {
_malloc_options;
_malloc_message;
diff --git a/lib/libc/stdlib/jemalloc/Makefile.inc b/lib/libc/stdlib/malloc/jemalloc/Makefile.inc
index ab731f524fe0..1ba7725fe8a8 100644
--- a/lib/libc/stdlib/jemalloc/Makefile.inc
+++ b/lib/libc/stdlib/malloc/jemalloc/Makefile.inc
@@ -1,15 +1,9 @@
-# $FreeBSD$
-
-.PATH: ${LIBC_SRCTOP}/stdlib/jemalloc
-
JEMALLOCSRCS:= jemalloc.c arena.c background_thread.c base.c bin.c bitmap.c \
ckh.c ctl.c div.c extent.c extent_dss.c extent_mmap.c hash.c hook.c \
large.c log.c malloc_io.c mutex.c mutex_pool.c nstime.c pages.c \
prng.c prof.c rtree.c safety_check.c sc.c stats.c sz.c tcache.c \
test_hooks.c ticker.c tsd.c witness.c
-SYM_MAPS+=${LIBC_SRCTOP}/stdlib/jemalloc/Symbol.map
-
CFLAGS+=-I${SRCTOP}/contrib/jemalloc/include
.for src in ${JEMALLOCSRCS}
diff --git a/lib/libc/stdlib/memory.3 b/lib/libc/stdlib/memory.3
index b78ddae8aab0..3e0d2bf8e304 100644
--- a/lib/libc/stdlib/memory.3
+++ b/lib/libc/stdlib/memory.3
@@ -25,53 +25,79 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)memory.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd June 4, 1993
+.Dd October 18, 2023
.Dt MEMORY 3
.Os
.Sh NAME
-.Nm malloc ,
+.Nm aligned_alloc ,
+.Nm alloca ,
+.Nm calloc ,
.Nm free ,
+.Nm malloc ,
+.Nm posix_memalign ,
.Nm realloc ,
-.Nm calloc ,
-.Nm alloca ,
-.Nm mmap
-.Nd general memory allocation operations
+.Nm reallocf ,
+.Nm valloc ,
+.Nm mmap ,
+.Nm munmap
+.Nd memory management functions
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.In stdlib.h
.Ft void *
-.Fn malloc "size_t size"
+.Fn aligned_alloc "size_t alignment" "size_t size"
+.Ft void *
+.Fn alloca "size_t size"
+.Ft void *
+.Fn calloc "size_t nelem" "size_t elsize"
.Ft void
.Fn free "void *ptr"
.Ft void *
+.Fn malloc "size_t size"
+.Ft int
+.Fn posix_memalign "void **ptr" "size_t alignment" "size_t size"
+.Ft void *
.Fn realloc "void *ptr" "size_t size"
.Ft void *
-.Fn calloc "size_t nelem" "size_t elsize"
+.Fn reallocf "void *ptr" "size_t size"
.Ft void *
-.Fn alloca "size_t size"
+.Fn valloc "size_t size"
.In sys/types.h
.In sys/mman.h
.Ft void *
.Fn mmap "void * addr" "size_t len" "int prot" "int flags" "int fd" "off_t offset"
+.Ft int
+.Fn munmap "void *addr" "size_t len"
.Sh DESCRIPTION
These functions allocate and free memory for the calling process.
They are described in the
individual manual pages.
.Sh SEE ALSO
.Xr mmap 2 ,
+.Xr aligned_alloc 3 ,
.Xr alloca 3 ,
.Xr calloc 3 ,
.Xr free 3 ,
.Xr malloc 3 ,
-.Xr realloc 3
+.Xr posix_memalign 3 ,
+.Xr realloc 3 ,
+.Xr reallocf 3 ,
+.Xr valloc 3 ,
.Sh STANDARDS
-These functions, with the exception of
-.Fn alloca
+The
+.Fn calloc ,
+.Fn free ,
+.Fn malloc ,
and
-.Fn mmap
-conform to
+.Fn realloc
+functions conform to
.St -isoC .
+.Pp
+The
+.Fn mmap ,
+.Fn munmap ,
+and
+.Fn posix_memalign
+functions conform to
+.St -p1003.1-2001 .
diff --git a/lib/libc/stdlib/merge.c b/lib/libc/stdlib/merge.c
index 7d8484ed10b9..e70938088589 100644
--- a/lib/libc/stdlib/merge.c
+++ b/lib/libc/stdlib/merge.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)merge.c 8.2 (Berkeley) 2/14/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* Hybrid exponential search/linear search merge sort with hybrid
* natural/pairwise first pass. Requires about .3% more comparisons
diff --git a/lib/libc/stdlib/mergesort_b.c b/lib/libc/stdlib/mergesort_b.c
index acf5987ddefc..0b9582b37d65 100644
--- a/lib/libc/stdlib/mergesort_b.c
+++ b/lib/libc/stdlib/mergesort_b.c
@@ -22,8 +22,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$
*/
#define I_AM_MERGESORT_B
#include "merge.c"
diff --git a/lib/libc/stdlib/ptsname.3 b/lib/libc/stdlib/ptsname.3
index cbd0a99de58d..df23e9ae6129 100644
--- a/lib/libc/stdlib/ptsname.3
+++ b/lib/libc/stdlib/ptsname.3
@@ -29,9 +29,7 @@
.\" NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
.\" SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd October 17, 2020
+.Dd October 14, 2023
.Dt PTSNAME 3
.Os
.Sh NAME
@@ -106,7 +104,7 @@ function clears the lock held on the pseudo-terminal pair
for the master device specified with
.Fa fildes .
.Sh RETURN VALUES
-.Rv -std grantpt ptsname_r unlockpt
+.Rv -std grantpt unlockpt
.Pp
The
.Fn ptsname
@@ -114,6 +112,19 @@ function returns a pointer to the name
of the slave device on success; otherwise a
.Dv NULL
pointer is returned.
+.Pp
+The
+.Fn ptsname_r
+function returns the value 0 if successful;
+otherwise a nonzero value is returned and the global variable
+.Va errno
+is set to indicate the error.
+Note:
+.Fn ptsname_r
+was previously documented as returning -1 on error.
+In the future it will be changed to return an error number, for POSIX
+compatibility.
+Therefore, callers should not check for -1.
.Sh ERRORS
The
.Fn grantpt ,
diff --git a/lib/libc/stdlib/ptsname.c b/lib/libc/stdlib/ptsname.c
index 6851d3d76555..adbf0e1692a4 100644
--- a/lib/libc/stdlib/ptsname.c
+++ b/lib/libc/stdlib/ptsname.c
@@ -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.
@@ -29,11 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-#ifndef lint
-__FBSDID("$FreeBSD$");
-#endif /* not lint */
-
#include "namespace.h"
#include <sys/param.h>
#include <sys/ioctl.h>
diff --git a/lib/libc/stdlib/qsort.3 b/lib/libc/stdlib/qsort.3
index 606185f9baee..553f83eca8c7 100644
--- a/lib/libc/stdlib/qsort.3
+++ b/lib/libc/stdlib/qsort.3
@@ -29,10 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)qsort.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd January 20, 2020
+.Dd April 19, 2023
.Dt QSORT 3
.Os
.Sh NAME
@@ -67,8 +64,8 @@
.Fa "void *base"
.Fa "size_t nmemb"
.Fa "size_t size"
+.Fa "int \*[lp]*compar\*[rp]\*[lp]const void *, const void *, void *\*[rp]"
.Fa "void *thunk"
-.Fa "int \*[lp]*compar\*[rp]\*[lp]void *, const void *, const void *\*[rp]"
.Fc
.Ft int
.Fo heapsort
@@ -157,7 +154,7 @@ function behaves identically to
.Fn qsort ,
except that it takes an additional argument,
.Fa thunk ,
-which is passed unchanged as the first argument to function pointed to
+which is passed unchanged as the last argument to function pointed to
.Fa compar .
This allows the comparison function to access additional
data without using global variables, and thus
@@ -260,7 +257,7 @@ The order of arguments to
.Fa compar
is different
.It
-if
+If
.Fa nmemb
or
.Fa size
@@ -270,7 +267,11 @@ or
.Fa nmemb
is not zero and
.Fa compar
-is NULL, then the runtime-constraint handler is called, and
+is
+.Dv NULL
+or
+.Fa size
+is zero, then the runtime-constraint handler is called, and
.Fn qsort_s
returns an error.
Note that the handler is called before
@@ -436,3 +437,9 @@ K.3.6.3.2.
The variants of these functions that take blocks as arguments first appeared in
Mac OS X.
This implementation was created by David Chisnall.
+.Pp
+In
+.Fx 14.0 ,
+the prototype of
+.Fn qsort_r
+was updated to match POSIX.
diff --git a/lib/libc/stdlib/qsort.c b/lib/libc/stdlib/qsort.c
index 5016fff7895f..e0b06494cf98 100644
--- a/lib/libc/stdlib/qsort.c
+++ b/lib/libc/stdlib/qsort.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)qsort.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <stdint.h>
#include <stdlib.h>
@@ -42,6 +36,8 @@ __FBSDID("$FreeBSD$");
#include "libc_private.h"
#if defined(I_AM_QSORT_R)
+typedef int cmp_t(const void *, const void *, void *);
+#elif defined(I_AM_QSORT_R_COMPAT)
typedef int cmp_t(void *, const void *, const void *);
#elif defined(I_AM_QSORT_S)
typedef int cmp_t(const void *, const void *, void *);
@@ -72,6 +68,8 @@ swapfunc(char *a, char *b, size_t es)
if ((n) > 0) swapfunc(a, b, n)
#if defined(I_AM_QSORT_R)
+#define CMP(t, x, y) (cmp((x), (y), (t)))
+#elif defined(I_AM_QSORT_R_COMPAT)
#define CMP(t, x, y) (cmp((t), (x), (y)))
#elif defined(I_AM_QSORT_S)
#define CMP(t, x, y) (cmp((x), (y), (t)))
@@ -81,7 +79,7 @@ swapfunc(char *a, char *b, size_t es)
static inline char *
med3(char *a, char *b, char *c, cmp_t *cmp, void *thunk
-#if !defined(I_AM_QSORT_R) && !defined(I_AM_QSORT_S)
+#if !defined(I_AM_QSORT_R) && !defined(I_AM_QSORT_R_COMPAT) && !defined(I_AM_QSORT_S)
__unused
#endif
)
@@ -97,6 +95,8 @@ __unused
*/
#if defined(I_AM_QSORT_R)
#define local_qsort local_qsort_r
+#elif defined(I_AM_QSORT_R_COMPAT)
+#define local_qsort local_qsort_r_compat
#elif defined(I_AM_QSORT_S)
#define local_qsort local_qsort_s
#endif
@@ -108,6 +108,9 @@ local_qsort(void *a, size_t n, size_t es, cmp_t *cmp, void *thunk)
int cmp_result;
int swap_cnt;
+ /* if there are less than 2 elements, then sorting is not needed */
+ if (__predict_false(n < 2))
+ return;
loop:
swap_cnt = 0;
if (n < 7) {
@@ -209,10 +212,16 @@ loop:
#if defined(I_AM_QSORT_R)
void
-qsort_r(void *a, size_t n, size_t es, void *thunk, cmp_t *cmp)
+(qsort_r)(void *a, size_t n, size_t es, cmp_t *cmp, void *thunk)
{
local_qsort_r(a, n, es, cmp, thunk);
}
+#elif defined(I_AM_QSORT_R_COMPAT)
+void
+__qsort_r_compat(void *a, size_t n, size_t es, void *thunk, cmp_t *cmp)
+{
+ local_qsort_r_compat(a, n, es, cmp, thunk);
+}
#elif defined(I_AM_QSORT_S)
errno_t
qsort_s(void *a, rsize_t n, rsize_t es, cmp_t *cmp, void *thunk)
@@ -233,6 +242,10 @@ qsort_s(void *a, rsize_t n, rsize_t es, cmp_t *cmp, void *thunk)
__throw_constraint_handler_s("qsort_s : cmp == NULL",
EINVAL);
return (EINVAL);
+ } else if (es <= 0) {
+ __throw_constraint_handler_s("qsort_s : es <= 0",
+ EINVAL);
+ return (EINVAL);
}
}
diff --git a/lib/libc/stdlib/qsort_r.c b/lib/libc/stdlib/qsort_r.c
index f489d31c2335..b382b40e91f6 100644
--- a/lib/libc/stdlib/qsort_r.c
+++ b/lib/libc/stdlib/qsort_r.c
@@ -1,19 +1,6 @@
/*
* This file is in the public domain. Originally written by Garrett
* A. Wollman.
- *
- * $FreeBSD$
*/
-#include "block_abi.h"
#define I_AM_QSORT_R
#include "qsort.c"
-
-typedef DECLARE_BLOCK(int, qsort_block, const void *, const void *);
-
-void
-qsort_b(void *base, size_t nel, size_t width, qsort_block compar)
-{
- qsort_r(base, nel, width, compar,
- (int (*)(void *, const void *, const void *))
- GET_BLOCK_FUNCTION(compar));
-}
diff --git a/lib/libc/stdlib/qsort_r_compat.c b/lib/libc/stdlib/qsort_r_compat.c
new file mode 100644
index 000000000000..2471c53b068f
--- /dev/null
+++ b/lib/libc/stdlib/qsort_r_compat.c
@@ -0,0 +1,19 @@
+/*
+ * This file is in the public domain. Originally written by Garrett
+ * A. Wollman.
+ */
+#include "block_abi.h"
+#define I_AM_QSORT_R_COMPAT
+#include "qsort.c"
+
+typedef DECLARE_BLOCK(int, qsort_block, const void *, const void *);
+
+void
+qsort_b(void *base, size_t nel, size_t width, qsort_block compar)
+{
+ __qsort_r_compat(base, nel, width, compar,
+ (int (*)(void *, const void *, const void *))
+ GET_BLOCK_FUNCTION(compar));
+}
+
+__sym_compat(qsort_r, __qsort_r_compat, FBSD_1.0);
diff --git a/lib/libc/stdlib/qsort_s.c b/lib/libc/stdlib/qsort_s.c
index a589e837c2cc..af8ec3128031 100644
--- a/lib/libc/stdlib/qsort_s.c
+++ b/lib/libc/stdlib/qsort_s.c
@@ -1,8 +1,6 @@
/*
* This file is in the public domain. Originally written by Garrett
* A. Wollman.
- *
- * $FreeBSD$
*/
#define I_AM_QSORT_S
#include "qsort.c"
diff --git a/lib/libc/stdlib/quick_exit.3 b/lib/libc/stdlib/quick_exit.3
index 9d316c7e46ea..185c1013b0a9 100644
--- a/lib/libc/stdlib/quick_exit.3
+++ b/lib/libc/stdlib/quick_exit.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd November 4, 2017
.Dt QUICK_EXIT 3
.Os
diff --git a/lib/libc/stdlib/quick_exit.c b/lib/libc/stdlib/quick_exit.c
index 676dc287a511..4dee7b20bd2b 100644
--- a/lib/libc/stdlib/quick_exit.c
+++ b/lib/libc/stdlib/quick_exit.c
@@ -1,7 +1,8 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2011 David Chisnall
+ * Copyright (c) 2023 Klara, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -24,49 +25,38 @@
* 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/types.h>
-#include <machine/atomic.h>
+
+#include <stdatomic.h>
#include <stdlib.h>
-#include <pthread.h>
/**
- * Linked list of quick exit handlers. This is simpler than the atexit()
- * version, because it is not required to support C++ destructors or
- * DSO-specific cleanups.
+ * Linked list of quick exit handlers. These will be invoked in reverse
+ * order of insertion when quick_exit() is called. This is simpler than
+ * the atexit() version, because it is not required to support C++
+ * destructors or DSO-specific cleanups.
*/
struct quick_exit_handler {
struct quick_exit_handler *next;
void (*cleanup)(void);
};
-/**
- * Lock protecting the handlers list.
- */
-static pthread_mutex_t atexit_mutex = PTHREAD_MUTEX_INITIALIZER;
-/**
- * Stack of cleanup handlers. These will be invoked in reverse order when
- */
-static struct quick_exit_handler *handlers;
+static _Atomic(struct quick_exit_handler *) handlers;
int
at_quick_exit(void (*func)(void))
{
struct quick_exit_handler *h;
-
- h = malloc(sizeof(*h));
- if (NULL == h)
- return (1);
+ if ((h = calloc(1, sizeof(*h))) == NULL) {
+ return (-1);
+ }
h->cleanup = func;
- pthread_mutex_lock(&atexit_mutex);
- h->next = handlers;
- __compiler_membar();
- handlers = h;
- pthread_mutex_unlock(&atexit_mutex);
+ while (!atomic_compare_exchange_strong(&handlers, &h->next, h)) {
+ /* nothing */ ;
+ }
return (0);
}
@@ -79,8 +69,8 @@ quick_exit(int status)
* XXX: The C++ spec requires us to call std::terminate if there is an
* exception here.
*/
- for (h = handlers; NULL != h; h = h->next) {
- __compiler_membar();
+ for (h = atomic_load_explicit(&handlers, memory_order_acquire);
+ h != NULL; h = h->next) {
h->cleanup();
}
_Exit(status);
diff --git a/lib/libc/stdlib/radixsort.3 b/lib/libc/stdlib/radixsort.3
index 5b85bf85f81c..8ae4008a946e 100644
--- a/lib/libc/stdlib/radixsort.3
+++ b/lib/libc/stdlib/radixsort.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)radixsort.3 8.2 (Berkeley) 1/27/94
-.\" $FreeBSD$
-.\"
.Dd January 27, 1994
.Dt RADIXSORT 3
.Os
diff --git a/lib/libc/stdlib/radixsort.c b/lib/libc/stdlib/radixsort.c
index 4a0a764c81da..4193df4d66d1 100644
--- a/lib/libc/stdlib/radixsort.c
+++ b/lib/libc/stdlib/radixsort.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)radixsort.c 8.2 (Berkeley) 4/28/95";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* Radixsort routines.
*
diff --git a/lib/libc/stdlib/rand.3 b/lib/libc/stdlib/rand.3
index f392a60f78fb..33eaa191b4fe 100644
--- a/lib/libc/stdlib/rand.3
+++ b/lib/libc/stdlib/rand.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)rand.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd February 1, 2020
.Dt RAND 3
.Os
diff --git a/lib/libc/stdlib/rand.c b/lib/libc/stdlib/rand.c
index e448d1b1fd14..31b51b327a0d 100644
--- a/lib/libc/stdlib/rand.c
+++ b/lib/libc/stdlib/rand.c
@@ -31,12 +31,6 @@
* Posix rand_r function added May 1999 by Wes Peters <wes@softweyr.com>.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)rand.c 8.1 (Berkeley) 6/14/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#include <sys/sysctl.h>
diff --git a/lib/libc/stdlib/random.3 b/lib/libc/stdlib/random.3
index 23b015383aea..b29536d4371d 100644
--- a/lib/libc/stdlib/random.3
+++ b/lib/libc/stdlib/random.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)random.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd February 1, 2020
.Dt RANDOM 3
.Os
diff --git a/lib/libc/stdlib/random.c b/lib/libc/stdlib/random.c
index bd533671cc50..6e9702229da8 100644
--- a/lib/libc/stdlib/random.c
+++ b/lib/libc/stdlib/random.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)random.c 8.2 (Berkeley) 5/19/95";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#include <sys/sysctl.h>
diff --git a/lib/libc/stdlib/random.h b/lib/libc/stdlib/random.h
index 01a28319f482..c7d4f2c18b77 100644
--- a/lib/libc/stdlib/random.h
+++ b/lib/libc/stdlib/random.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$
*/
#pragma once
diff --git a/lib/libc/stdlib/reallocarray.3 b/lib/libc/stdlib/reallocarray.3
index 8e714f4daecc..d92be7d3f66b 100644
--- a/lib/libc/stdlib/reallocarray.3
+++ b/lib/libc/stdlib/reallocarray.3
@@ -26,8 +26,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd May 1, 2015
.Dt REALLOCARRAY 3
.Os
diff --git a/lib/libc/stdlib/reallocarray.c b/lib/libc/stdlib/reallocarray.c
index e1e9b7c16fff..0868804486cc 100644
--- a/lib/libc/stdlib/reallocarray.c
+++ b/lib/libc/stdlib/reallocarray.c
@@ -15,9 +15,6 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <errno.h>
#include <stdint.h>
diff --git a/lib/libc/stdlib/reallocf.3 b/lib/libc/stdlib/reallocf.3
index cc9ef3d8f41e..647f213522f1 100644
--- a/lib/libc/stdlib/reallocf.3
+++ b/lib/libc/stdlib/reallocf.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)malloc.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd January 31, 2010
.Dt MALLOC 3
.Os
diff --git a/lib/libc/stdlib/reallocf.c b/lib/libc/stdlib/reallocf.c
index 9cebfd0c9519..3ab90bfdf471 100644
--- a/lib/libc/stdlib/reallocf.c
+++ b/lib/libc/stdlib/reallocf.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1998 M. Warner Losh <imp@FreeBSD.org>
*
@@ -25,9 +25,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdlib.h>
void *
diff --git a/lib/libc/stdlib/realpath.3 b/lib/libc/stdlib/realpath.3
index c0a5770ac83f..065ba312c2ef 100644
--- a/lib/libc/stdlib/realpath.3
+++ b/lib/libc/stdlib/realpath.3
@@ -28,9 +28,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)realpath.3 8.2 (Berkeley) 2/16/94
-.\" $FreeBSD$
-.\"
.Dd May 11, 2012
.Dt REALPATH 3
.Os
diff --git a/lib/libc/stdlib/realpath.c b/lib/libc/stdlib/realpath.c
index 220910a3c610..992d14302fe0 100644
--- a/lib/libc/stdlib/realpath.c
+++ b/lib/libc/stdlib/realpath.c
@@ -28,12 +28,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)realpath.c 8.1 (Berkeley) 2/16/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#include <sys/stat.h>
diff --git a/lib/libc/stdlib/remque.c b/lib/libc/stdlib/remque.c
index 0a2f28f77c7c..1b532ce11ff6 100644
--- a/lib/libc/stdlib/remque.c
+++ b/lib/libc/stdlib/remque.c
@@ -6,9 +6,6 @@
* As long as the above copyright statement and this notice remain
* unchanged, you can do what ever you want with this file.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#define _SEARCH_PRIVATE
#include <search.h>
#include <stdlib.h> /* for NULL */
diff --git a/lib/libc/stdlib/set_constraint_handler_s.3 b/lib/libc/stdlib/set_constraint_handler_s.3
index 85956d2a9997..0860465c1eb6 100644
--- a/lib/libc/stdlib/set_constraint_handler_s.3
+++ b/lib/libc/stdlib/set_constraint_handler_s.3
@@ -21,8 +21,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd August 18, 2018
.Dt SET_CONSTRAINT_HANDLER_S 3
.Os
diff --git a/lib/libc/stdlib/set_constraint_handler_s.c b/lib/libc/stdlib/set_constraint_handler_s.c
index d2d06b809388..298c4d94a4b9 100644
--- a/lib/libc/stdlib/set_constraint_handler_s.c
+++ b/lib/libc/stdlib/set_constraint_handler_s.c
@@ -23,9 +23,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/types.h>
#include <machine/atomic.h>
diff --git a/lib/libc/stdlib/strfmon.3 b/lib/libc/stdlib/strfmon.3
index 47f7131b677c..20cc560d401d 100644
--- a/lib/libc/stdlib/strfmon.3
+++ b/lib/libc/stdlib/strfmon.3
@@ -22,13 +22,12 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd June 25, 2012
+.Dd December 6, 2023
.Dt STRFMON 3
.Os
.Sh NAME
-.Nm strfmon
+.Nm strfmon ,
+.Nm strfmon_l
.Nd convert monetary value to string
.Sh LIBRARY
.Lb libc
@@ -36,13 +35,15 @@
.In monetary.h
.Ft ssize_t
.Fn strfmon "char * restrict s" "size_t maxsize" "const char * restrict format" "..."
+.In monetary.h
+.In xlocale.h
.Ft ssize_t
.Fn strfmon_l "char * restrict s" "size_t maxsize" "locale_t loc" "const char * restrict format" "..."
.Sh DESCRIPTION
The
.Fn strfmon
function places characters into the array pointed to by
-.Fa s
+.Fa s ,
as controlled by the string pointed to by
.Fa format .
No more than
@@ -51,9 +52,9 @@ bytes are placed into the array.
.Pp
The
.Fn strfmon_l
-function does the same as
+function takes an explicit locale argument, whereas the
.Fn strfmon
-but takes an explicit locale rather than using the current locale.
+function uses the current global or per-thread locale.
.Pp
The format string is composed of zero or more directives:
ordinary characters (not
@@ -98,12 +99,18 @@ By default, there is no minimum width.
A
.Sq Cm #
sign followed by a decimal number specifying the maximum
-expected number of digits after the radix character.
+expected number of digits before the radix character.
+When this option is used, values that do not exceed the
+specified number of digits are formatted so they will be
+correctly aligned with other values printed using the same
+format.
+This includes always leaving space for a possible sign
+indicator, even if none is needed for a particular value.
.It
A
.Sq Cm \&.
character followed by a decimal number specifying the number
-the number of digits after the radix character.
+of digits after the radix character.
.It
One of the following conversion specifiers:
.Bl -tag -width "XXX"
@@ -122,12 +129,14 @@ character is written.
.El
.El
.Sh RETURN VALUES
-If the total number of resulting bytes including the terminating
+If the total number of resulting bytes, including the terminating
.Dv NUL
-byte is not more than
+byte, is not more than
.Fa maxsize ,
.Fn strfmon
-returns the number of bytes placed into the array pointed to by
+and
+.Fn strfmon_l
+return the number of bytes placed into the array pointed to by
.Fa s ,
not including the terminating
.Dv NUL
@@ -137,11 +146,33 @@ the contents of the array are indeterminate,
and
.Va errno
is set to indicate the error.
-.Pp
-The
-.Fn strfmon_l
-function returns the same values as
-.Fn strfmon .
+.Sh EXAMPLES
+The following example will format the value
+.Dq Li 1234567.89
+to the string
+.Dq Li $1,234,567.89 :
+.Bd -literal -offset indent
+#include <stdio.h>
+#include <monetary.h>
+#include <locale.h>
+
+int
+main(void)
+{
+ char string[100];
+ double money = 1234567.89;
+
+ if (setlocale(LC_MONETARY, "en_US.UTF-8") == NULL) {
+ fprintf(stderr, "Unable to setlocale().\\n");
+ return (1);
+ }
+
+ strfmon(string, sizeof(string) - 1, "%n", money);
+ printf("%s\\n", string);
+
+ return (0);
+}
+.Ed
.Sh ERRORS
The
.Fn strfmon
@@ -155,7 +186,8 @@ The format string is invalid.
Not enough memory for temporary buffers.
.El
.Sh SEE ALSO
-.Xr localeconv 3
+.Xr localeconv 3 ,
+.Xr xlocale 3
.Sh STANDARDS
The
.Fn strfmon
diff --git a/lib/libc/stdlib/strfmon.c b/lib/libc/stdlib/strfmon.c
index d646ec0b001a..68a36a6d5567 100644
--- a/lib/libc/stdlib/strfmon.c
+++ b/lib/libc/stdlib/strfmon.c
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org>
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -32,10 +32,8 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
+
#include <ctype.h>
#include <errno.h>
#include <limits.h>
@@ -45,6 +43,7 @@ __FBSDID("$FreeBSD$");
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+
#include "xlocale_private.h"
/* internal flags */
@@ -52,27 +51,27 @@ __FBSDID("$FreeBSD$");
#define SIGN_POSN_USED 0x02 /* '+' or '(' usage flag */
#define LOCALE_POSN 0x04 /* use locale defined +/- (default) */
#define PARENTH_POSN 0x08 /* enclose negative amount in () */
-#define SUPRESS_CURR_SYMBOL 0x10 /* suppress the currency from output */
+#define SUPPRESS_CURR_SYMBOL 0x10 /* suppress the currency from output */
#define LEFT_JUSTIFY 0x20 /* left justify */
#define USE_INTL_CURRENCY 0x40 /* use international currency symbol */
-#define IS_NEGATIVE 0x80 /* is argument value negative ? */
+#define IS_NEGATIVE 0x80 /* is argument value negative ? */
/* internal macros */
-#define PRINT(CH) do { \
- if (dst >= s + maxsize) \
+#define PRINT(CH) do { \
+ if (dst >= s + maxsize) \
goto e2big_error; \
*dst++ = CH; \
} while (0)
-#define PRINTS(STR) do { \
+#define PRINTS(STR) do { \
char *tmps = STR; \
while (*tmps != '\0') \
PRINT(*tmps++); \
} while (0)
-#define GET_NUMBER(VAR) do { \
+#define GET_NUMBER(VAR, LOC) do { \
VAR = 0; \
- while (isdigit((unsigned char)*fmt)) { \
+ while (isdigit_l((unsigned char)*fmt, LOC)) { \
if (VAR > INT_MAX / 10) \
goto e2big_error; \
VAR *= 10; \
@@ -83,41 +82,42 @@ __FBSDID("$FreeBSD$");
} \
} while (0)
-#define GRPCPY(howmany) do { \
+#define GRPCPY(howmany) do { \
int i = howmany; \
while (i-- > 0) { \
avalue_size--; \
- *--bufend = *(avalue+avalue_size+padded); \
+ *--bufend = *(avalue + avalue_size + padded); \
} \
} while (0)
-#define GRPSEP do { \
+#define GRPSEP do { \
bufend -= thousands_sep_size; \
memcpy(bufend, thousands_sep, thousands_sep_size); \
groups++; \
} while (0)
-static void __setup_vars(int, char *, char *, char *, char **);
-static int __calc_left_pad(int, char *);
-static char *__format_grouped_double(double, int *, int, int, int);
+static void __setup_vars(int, char *, char *, char *, char **, struct lconv *);
+static int __calc_left_pad(int, char *, struct lconv *);
+static char *__format_grouped_double(double, int *, int, int, int,
+ struct lconv *, locale_t);
static ssize_t
-vstrfmon_l(char * __restrict s, size_t maxsize, locale_t loc,
- const char * __restrict format, va_list ap)
+vstrfmon_l(char *__restrict s, size_t maxsize, locale_t loc,
+ const char *__restrict format, va_list ap)
{
- char *dst; /* output destination pointer */
- const char *fmt; /* current format poistion pointer */
- struct lconv *lc; /* pointer to lconv structure */
+ char *dst; /* output destination pointer */
+ const char *fmt; /* current format poistion pointer */
+ struct lconv *lc; /* pointer to lconv structure */
char *asciivalue; /* formatted double pointer */
- int flags; /* formatting options */
- int pad_char; /* padding character */
- int pad_size; /* pad size */
- int width; /* field width */
- int left_prec; /* left precision */
- int right_prec; /* right precision */
- double value; /* just value */
- char space_char = ' '; /* space after currency */
+ int flags; /* formatting options */
+ int pad_char; /* padding character */
+ int pad_size; /* pad size */
+ int width; /* field width */
+ int left_prec; /* left precision */
+ int right_prec; /* right precision */
+ double value; /* just value */
+ char space_char = ' '; /* space after currency */
char cs_precedes, /* values gathered from struct lconv */
sep_by_space,
@@ -127,17 +127,16 @@ vstrfmon_l(char * __restrict s, size_t maxsize, locale_t loc,
char *tmpptr; /* temporary vars */
int sverrno;
- FIX_LOCALE(loc);
+ FIX_LOCALE(loc);
lc = localeconv_l(loc);
dst = s;
fmt = format;
asciivalue = NULL;
currency_symbol = NULL;
- pad_size = 0;
- while (*fmt) {
+ while (*fmt != 0) {
/* pass nonformating characters AS IS */
if (*fmt != '%')
goto literal;
@@ -145,58 +144,59 @@ vstrfmon_l(char * __restrict s, size_t maxsize, locale_t loc,
/* '%' found ! */
/* "%%" mean just '%' */
- if (*(fmt+1) == '%') {
+ if (*(fmt + 1) == '%') {
fmt++;
- literal:
+literal:
PRINT(*fmt++);
continue;
}
/* set up initial values */
- flags = (NEED_GROUPING|LOCALE_POSN);
+ flags = NEED_GROUPING | LOCALE_POSN;
pad_char = ' '; /* padding character is "space" */
+ pad_size = 0; /* no padding initially */
left_prec = -1; /* no left precision specified */
right_prec = -1; /* no right precision specified */
width = -1; /* no width specified */
- value = 0; /* we have no value to print now */
/* Flags */
while (1) {
switch (*++fmt) {
- case '=': /* fill character */
- pad_char = *++fmt;
- if (pad_char == '\0')
- goto format_error;
- continue;
- case '^': /* not group currency */
- flags &= ~(NEED_GROUPING);
- continue;
- case '+': /* use locale defined signs */
- if (flags & SIGN_POSN_USED)
- goto format_error;
- flags |= (SIGN_POSN_USED|LOCALE_POSN);
- continue;
- case '(': /* enclose negatives with () */
- if (flags & SIGN_POSN_USED)
- goto format_error;
- flags |= (SIGN_POSN_USED|PARENTH_POSN);
- continue;
- case '!': /* suppress currency symbol */
- flags |= SUPRESS_CURR_SYMBOL;
- continue;
- case '-': /* alignment (left) */
- flags |= LEFT_JUSTIFY;
- continue;
- default:
- break;
+ case '=': /* fill character */
+ pad_char = *++fmt;
+ if (pad_char == '\0')
+ goto format_error;
+ continue;
+ case '^': /* not group currency */
+ flags &= ~(NEED_GROUPING);
+ continue;
+ case '+': /* use locale defined signs */
+ if (flags & SIGN_POSN_USED)
+ goto format_error;
+ flags |= (SIGN_POSN_USED | LOCALE_POSN);
+ continue;
+ case '(': /* enclose negatives with () */
+ if (flags & SIGN_POSN_USED)
+ goto format_error;
+ flags |= (SIGN_POSN_USED | PARENTH_POSN);
+ continue;
+ case '!': /* suppress currency symbol */
+ flags |= SUPPRESS_CURR_SYMBOL;
+ continue;
+ case '-': /* alignment (left) */
+ flags |= LEFT_JUSTIFY;
+ continue;
+ default:
+ break;
}
break;
}
/* field Width */
- if (isdigit((unsigned char)*fmt)) {
- GET_NUMBER(width);
- /* Do we have enough space to put number with
+ if (isdigit_l((unsigned char)*fmt, loc)) {
+ GET_NUMBER(width, loc);
+ /*
+ * Do we have enough space to put number with
* required width ?
*/
if ((unsigned int)width >= maxsize - (dst - s))
@@ -205,47 +205,52 @@ vstrfmon_l(char * __restrict s, size_t maxsize, locale_t loc,
/* Left precision */
if (*fmt == '#') {
- if (!isdigit((unsigned char)*++fmt))
+ if (!isdigit_l((unsigned char)*++fmt, loc))
goto format_error;
- GET_NUMBER(left_prec);
+ GET_NUMBER(left_prec, loc);
if ((unsigned int)left_prec >= maxsize - (dst - s))
goto e2big_error;
}
/* Right precision */
if (*fmt == '.') {
- if (!isdigit((unsigned char)*++fmt))
+ if (!isdigit_l((unsigned char)*++fmt, loc))
goto format_error;
- GET_NUMBER(right_prec);
- if ((unsigned int)right_prec >= maxsize - (dst - s) -
- left_prec)
+ GET_NUMBER(right_prec, loc);
+ if ((unsigned int)right_prec >=
+ maxsize - (dst - s) - left_prec)
goto e2big_error;
}
/* Conversion Characters */
switch (*fmt++) {
- case 'i': /* use internaltion currency format */
- flags |= USE_INTL_CURRENCY;
- break;
- case 'n': /* use national currency format */
- flags &= ~(USE_INTL_CURRENCY);
- break;
- default: /* required character is missing or
- premature EOS */
- goto format_error;
+ case 'i': /* use international currency format */
+ flags |= USE_INTL_CURRENCY;
+ break;
+ case 'n': /* use national currency format */
+ flags &= ~(USE_INTL_CURRENCY);
+ break;
+ default: /*
+ * required character is missing or
+ * premature EOS
+ */
+ goto format_error;
}
if (currency_symbol != NULL)
free(currency_symbol);
if (flags & USE_INTL_CURRENCY) {
currency_symbol = strdup(lc->int_curr_symbol);
- if (currency_symbol != NULL)
- space_char = *(currency_symbol+3);
+ if (currency_symbol != NULL &&
+ strlen(currency_symbol) > 3) {
+ space_char = currency_symbol[3];
+ currency_symbol[3] = '\0';
+ }
} else
currency_symbol = strdup(lc->currency_symbol);
if (currency_symbol == NULL)
- goto end_error; /* ENOMEM. */
+ goto end_error; /* ENOMEM. */
/* value itself */
value = va_arg(ap, double);
@@ -259,23 +264,25 @@ vstrfmon_l(char * __restrict s, size_t maxsize, locale_t loc,
/* fill left_prec with amount of padding chars */
if (left_prec >= 0) {
pad_size = __calc_left_pad((flags ^ IS_NEGATIVE),
- currency_symbol) -
- __calc_left_pad(flags, currency_symbol);
+ currency_symbol, lc) -
+ __calc_left_pad(flags, currency_symbol, lc);
if (pad_size < 0)
pad_size = 0;
}
if (asciivalue != NULL)
free(asciivalue);
- asciivalue = __format_grouped_double(value, &flags,
- left_prec, right_prec, pad_char);
+ asciivalue = __format_grouped_double(value, &flags, left_prec,
+ right_prec, pad_char, lc, loc);
if (asciivalue == NULL)
- goto end_error; /* errno already set */
- /* to ENOMEM by malloc() */
+ goto end_error; /*
+ * errno already set to ENOMEM by
+ * malloc()
+ */
/* set some variables for later use */
- __setup_vars(flags, &cs_precedes, &sep_by_space,
- &sign_posn, &signstr);
+ __setup_vars(flags, &cs_precedes, &sep_by_space, &sign_posn,
+ &signstr, lc);
/*
* Description of some LC_MONETARY's values:
@@ -287,25 +294,25 @@ vstrfmon_l(char * __restrict s, size_t maxsize, locale_t loc,
* = 0 - symbol succeeds the value
*
* p_sep_by_space & n_sep_by_space
- *
+ *
* = 0 - no space separates $currency_symbol
* from the value for a monetary quantity with a
- * non-negative value
+ * non-negative value
* = 1 - space separates the symbol from the value
* = 2 - space separates the symbol and the sign string,
- * if adjacent.
- *
+ * if adjacent; otherwise, a space separates
+ * the sign string from the value
+ *
* p_sign_posn & n_sign_posn
- *
+ *
* = 0 - parentheses enclose the quantity and the
- * $currency_symbol
- * = 1 - the sign string precedes the quantity and the
* $currency_symbol
- * = 2 - the sign string succeeds the quantity and the
+ * = 1 - the sign string precedes the quantity and the
+ * $currency_symbol
+ * = 2 - the sign string succeeds the quantity and the
* $currency_symbol
* = 3 - the sign string precedes the $currency_symbol
* = 4 - the sign string succeeds the $currency_symbol
- *
*/
tmpptr = dst;
@@ -319,11 +326,11 @@ vstrfmon_l(char * __restrict s, size_t maxsize, locale_t loc,
if (cs_precedes == 1) {
if (sign_posn == 1 || sign_posn == 3) {
PRINTS(signstr);
- if (sep_by_space == 2) /* XXX: ? */
+ if (sep_by_space == 2)
PRINT(' ');
}
- if (!(flags & SUPRESS_CURR_SYMBOL)) {
+ if (!(flags & SUPPRESS_CURR_SYMBOL)) {
PRINTS(currency_symbol);
if (sign_posn == 4) {
@@ -335,8 +342,11 @@ vstrfmon_l(char * __restrict s, size_t maxsize, locale_t loc,
} else if (sep_by_space == 1)
PRINT(space_char);
}
- } else if (sign_posn == 1)
+ } else if (sign_posn == 1) {
PRINTS(signstr);
+ if (sep_by_space == 2)
+ PRINT(' ');
+ }
PRINTS(asciivalue);
@@ -347,15 +357,13 @@ vstrfmon_l(char * __restrict s, size_t maxsize, locale_t loc,
PRINTS(signstr);
}
- if (!(flags & SUPRESS_CURR_SYMBOL)) {
- if ((sign_posn == 3 && sep_by_space == 2)
- || (sep_by_space == 1
- && (sign_posn == 0
- || sign_posn == 1
- || sign_posn == 2
- || sign_posn == 4)))
+ if (!(flags & SUPPRESS_CURR_SYMBOL)) {
+ if ((sign_posn == 3 && sep_by_space == 2) ||
+ (sep_by_space == 1 &&
+ (sign_posn == 0 || sign_posn == 1 ||
+ sign_posn == 2 || sign_posn == 4)))
PRINT(space_char);
- PRINTS(currency_symbol); /* XXX: len */
+ PRINTS(currency_symbol);
if (sign_posn == 4) {
if (sep_by_space == 2)
PRINT(' ');
@@ -370,19 +378,23 @@ vstrfmon_l(char * __restrict s, size_t maxsize, locale_t loc,
PRINTS(signstr);
}
- if (sign_posn == 0 && (flags & IS_NEGATIVE))
- PRINT(')');
+ if (sign_posn == 0) {
+ if (flags & IS_NEGATIVE)
+ PRINT(')');
+ else if (left_prec >= 0)
+ PRINT(' ');
+ }
if (dst - tmpptr < width) {
if (flags & LEFT_JUSTIFY) {
while (dst - tmpptr < width)
PRINT(' ');
} else {
- pad_size = dst-tmpptr;
- memmove(tmpptr + width-pad_size, tmpptr,
+ pad_size = dst - tmpptr;
+ memmove(tmpptr + width - pad_size, tmpptr,
pad_size);
- memset(tmpptr, ' ', width-pad_size);
- dst += width-pad_size;
+ memset(tmpptr, ' ', width - pad_size);
+ dst += width - pad_size;
}
}
}
@@ -390,7 +402,7 @@ vstrfmon_l(char * __restrict s, size_t maxsize, locale_t loc,
PRINT('\0');
free(asciivalue);
free(currency_symbol);
- return (dst - s - 1); /* return size of put data except trailing '\0' */
+ return (dst - s - 1); /* size of put data except trailing '\0' */
e2big_error:
errno = E2BIG;
@@ -408,43 +420,17 @@ end_error:
errno = sverrno;
return (-1);
}
-ssize_t
-strfmon_l(char * __restrict s, size_t maxsize, locale_t loc, const char * __restrict format,
- ...)
-{
- size_t ret;
- va_list ap;
- va_start(ap, format);
- ret = vstrfmon_l(s, maxsize, loc, format, ap);
- va_end(ap);
- return ret;
-}
-
-ssize_t
-strfmon(char * __restrict s, size_t maxsize, const char * __restrict format,
- ...)
-{
- size_t ret;
- va_list ap;
- va_start(ap, format);
- ret = vstrfmon_l(s, maxsize, __get_locale(), format, ap);
- va_end(ap);
- return ret;
-}
-
static void
-__setup_vars(int flags, char *cs_precedes, char *sep_by_space,
- char *sign_posn, char **signstr) {
-
- struct lconv *lc = localeconv();
-
+__setup_vars(int flags, char *cs_precedes, char *sep_by_space, char *sign_posn,
+ char **signstr, struct lconv *lc)
+{
if ((flags & IS_NEGATIVE) && (flags & USE_INTL_CURRENCY)) {
*cs_precedes = lc->int_n_cs_precedes;
*sep_by_space = lc->int_n_sep_by_space;
*sign_posn = (flags & PARENTH_POSN) ? 0 : lc->int_n_sign_posn;
- *signstr = (lc->negative_sign[0] == '\0') ? "-"
- : lc->negative_sign;
+ *signstr = (lc->negative_sign[0] == '\0') ? "-" :
+ lc->negative_sign;
} else if (flags & USE_INTL_CURRENCY) {
*cs_precedes = lc->int_p_cs_precedes;
*sep_by_space = lc->int_p_sep_by_space;
@@ -454,8 +440,8 @@ __setup_vars(int flags, char *cs_precedes, char *sep_by_space,
*cs_precedes = lc->n_cs_precedes;
*sep_by_space = lc->n_sep_by_space;
*sign_posn = (flags & PARENTH_POSN) ? 0 : lc->n_sign_posn;
- *signstr = (lc->negative_sign[0] == '\0') ? "-"
- : lc->negative_sign;
+ *signstr = (lc->negative_sign[0] == '\0') ? "-" :
+ lc->negative_sign;
} else {
*cs_precedes = lc->p_cs_precedes;
*sep_by_space = lc->p_sep_by_space;
@@ -463,7 +449,7 @@ __setup_vars(int flags, char *cs_precedes, char *sep_by_space,
*signstr = lc->positive_sign;
}
- /* Set defult values for unspecified information. */
+ /* Set default values for unspecified information. */
if (*cs_precedes != 0)
*cs_precedes = 1;
if (*sep_by_space == CHAR_MAX)
@@ -473,12 +459,13 @@ __setup_vars(int flags, char *cs_precedes, char *sep_by_space,
}
static int
-__calc_left_pad(int flags, char *cur_symb) {
-
+__calc_left_pad(int flags, char *cur_symb, struct lconv *lc)
+{
char cs_precedes, sep_by_space, sign_posn, *signstr;
int left_chars = 0;
- __setup_vars(flags, &cs_precedes, &sep_by_space, &sign_posn, &signstr);
+ __setup_vars(flags, &cs_precedes, &sep_by_space, &sign_posn, &signstr,
+ lc);
if (cs_precedes != 0) {
left_chars += strlen(cur_symb);
@@ -487,20 +474,24 @@ __calc_left_pad(int flags, char *cur_symb) {
}
switch (sign_posn) {
- case 1:
+ case 0:
+ if (flags & IS_NEGATIVE)
+ left_chars++;
+ break;
+ case 1:
+ left_chars += strlen(signstr);
+ break;
+ case 3:
+ case 4:
+ if (cs_precedes != 0)
left_chars += strlen(signstr);
- break;
- case 3:
- case 4:
- if (cs_precedes != 0)
- left_chars += strlen(signstr);
}
return (left_chars);
}
static int
-get_groups(int size, char *grouping) {
-
+get_groups(int size, char *grouping)
+{
int chars = 0;
if (*grouping == CHAR_MAX || *grouping <= 0) /* no grouping ? */
@@ -523,8 +514,9 @@ get_groups(int size, char *grouping) {
/* convert double to locale-encoded string */
static char *
-__format_grouped_double(double value, int *flags,
- int left_prec, int right_prec, int pad_char) {
+__format_grouped_double(double value, int *flags, int left_prec, int right_prec,
+ int pad_char, struct lconv *lc, locale_t loc)
+{
char *rslt;
char *avalue;
@@ -535,14 +527,13 @@ __format_grouped_double(double value, int *flags,
int padded;
- struct lconv *lc = localeconv();
char *grouping;
const char *decimal_point;
const char *thousands_sep;
size_t decimal_point_size;
size_t thousands_sep_size;
- int groups = 0;
+ int groups = 0;
grouping = lc->mon_grouping;
decimal_point = lc->mon_decimal_point;
@@ -561,10 +552,10 @@ __format_grouped_double(double value, int *flags,
/* fill right_prec with default value */
if (right_prec == -1) {
- if (*flags & USE_INTL_CURRENCY)
- right_prec = lc->int_frac_digits;
- else
- right_prec = lc->frac_digits;
+ if (*flags & USE_INTL_CURRENCY)
+ right_prec = lc->int_frac_digits;
+ else
+ right_prec = lc->frac_digits;
if (right_prec == CHAR_MAX) /* POSIX locale ? */
right_prec = 2;
@@ -574,8 +565,8 @@ __format_grouped_double(double value, int *flags,
left_prec += get_groups(left_prec, grouping);
/* convert to string */
- avalue_size = asprintf(&avalue, "%*.*f", left_prec + right_prec + 1,
- right_prec, value);
+ avalue_size = asprintf_l(&avalue, loc, "%*.*f",
+ left_prec + right_prec + 1, right_prec, value);
if (avalue_size < 0)
return (NULL);
@@ -598,17 +589,15 @@ __format_grouped_double(double value, int *flags,
if (right_prec > 0) {
bufend -= right_prec;
- memcpy(bufend, avalue + avalue_size+padded-right_prec,
+ memcpy(bufend, avalue + avalue_size + padded - right_prec,
right_prec);
bufend -= decimal_point_size;
memcpy(bufend, decimal_point, decimal_point_size);
avalue_size -= (right_prec + 1);
}
- if ((*flags & NEED_GROUPING) &&
- thousands_sep_size > 0 && /* XXX: need investigation */
- *grouping != CHAR_MAX &&
- *grouping > 0) {
+ if ((*flags & NEED_GROUPING) && thousands_sep_size > 0 &&
+ *grouping != CHAR_MAX && *grouping > 0) {
while (avalue_size > (int)*grouping) {
GRPCPY(*grouping);
GRPSEP;
@@ -630,10 +619,9 @@ __format_grouped_double(double value, int *flags,
if (avalue_size != 0)
GRPCPY(avalue_size);
padded -= groups;
-
} else {
bufend -= avalue_size;
- memcpy(bufend, avalue+padded, avalue_size);
+ memcpy(bufend, avalue + padded, avalue_size);
/* decrease assumed $decimal_point */
if (right_prec == 0)
padded -= decimal_point_size;
@@ -650,3 +638,30 @@ __format_grouped_double(double value, int *flags,
free(avalue);
return (rslt);
}
+
+ssize_t
+strfmon(char *restrict s, size_t maxsize, const char *restrict format, ...)
+{
+ ssize_t ret;
+ va_list ap;
+
+ va_start(ap, format);
+ ret = vstrfmon_l(s, maxsize, __get_locale(), format, ap);
+ va_end(ap);
+
+ return (ret);
+}
+
+ssize_t
+strfmon_l(char *restrict s, size_t maxsize, locale_t loc,
+ const char *restrict format, ...)
+{
+ ssize_t ret;
+ va_list ap;
+
+ va_start(ap, format);
+ ret = vstrfmon_l(s, maxsize, loc, format, ap);
+ va_end(ap);
+
+ return (ret);
+}
diff --git a/lib/libc/stdlib/strtod.3 b/lib/libc/stdlib/strtod.3
index 549c640f8358..018e1e8c3c38 100644
--- a/lib/libc/stdlib/strtod.3
+++ b/lib/libc/stdlib/strtod.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)strtod.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd May 11, 2010
.Dt STRTOD 3
.Os
diff --git a/lib/libc/stdlib/strtoimax.c b/lib/libc/stdlib/strtoimax.c
index b26451232170..fe2a0a237e23 100644
--- a/lib/libc/stdlib/strtoimax.c
+++ b/lib/libc/stdlib/strtoimax.c
@@ -5,7 +5,7 @@
* The Regents of the University of California. All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -34,12 +34,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "from @(#)strtol.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <ctype.h>
#include <errno.h>
#include <stdlib.h>
@@ -89,6 +83,13 @@ strtoimax_l(const char * __restrict nptr, char ** __restrict endptr, int base,
s += 2;
base = 16;
}
+ if ((base == 0 || base == 2) &&
+ c == '0' && (*s == 'b' || *s == 'B') &&
+ (s[1] >= '0' && s[1] <= '1')) {
+ c = s[1];
+ s += 2;
+ base = 2;
+ }
if (base == 0)
base = c == '0' ? 8 : 10;
acc = any = 0;
diff --git a/lib/libc/stdlib/strtol.3 b/lib/libc/stdlib/strtol.3
index 3b7af7d30f01..af8bec579dbf 100644
--- a/lib/libc/stdlib/strtol.3
+++ b/lib/libc/stdlib/strtol.3
@@ -29,10 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)strtol.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd November 28, 2001
+.Dd August 21, 2023
.Dt STRTOL 3
.Os
.Sh NAME
@@ -109,6 +106,8 @@ If
.Fa base
is zero or 16,
the string may then include a
+.Dq Li 0b
+prefix, and the number will be read in base 2; or it may include a
.Dq Li 0x
prefix,
and the number will be read in base 16; otherwise, a zero
diff --git a/lib/libc/stdlib/strtol.c b/lib/libc/stdlib/strtol.c
index 25212d8930ad..54f728893e08 100644
--- a/lib/libc/stdlib/strtol.c
+++ b/lib/libc/stdlib/strtol.c
@@ -5,7 +5,7 @@
* The Regents of the University of California. All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -34,12 +34,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strtol.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <limits.h>
#include <ctype.h>
#include <errno.h>
@@ -89,6 +83,13 @@ strtol_l(const char * __restrict nptr, char ** __restrict endptr, int base,
s += 2;
base = 16;
}
+ if ((base == 0 || base == 2) &&
+ c == '0' && (*s == 'b' || *s == 'B') &&
+ (s[1] >= '0' && s[1] <= '1')) {
+ c = s[1];
+ s += 2;
+ base = 2;
+ }
if (base == 0)
base = c == '0' ? 8 : 10;
acc = any = 0;
diff --git a/lib/libc/stdlib/strtold.c b/lib/libc/stdlib/strtold.c
index 250b8558acb9..fa05f7a63889 100644
--- a/lib/libc/stdlib/strtold.c
+++ b/lib/libc/stdlib/strtold.c
@@ -1,8 +1,7 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (C) 2011 The FreeBSD Foundation
- * All rights reserved.
*
* This software was developed by David Chisnall under sponsorship from the
* FreeBSD Foundation.
@@ -29,9 +28,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdlib.h>
#include "xlocale_private.h"
diff --git a/lib/libc/stdlib/strtoll.c b/lib/libc/stdlib/strtoll.c
index c87aefb1cd22..3ce399277049 100644
--- a/lib/libc/stdlib/strtoll.c
+++ b/lib/libc/stdlib/strtoll.c
@@ -5,7 +5,7 @@
* The Regents of the University of California. All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -34,12 +34,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strtoq.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <limits.h>
#include <errno.h>
#include <ctype.h>
@@ -65,8 +59,9 @@ strtoll_l(const char * __restrict nptr, char ** __restrict endptr, int base,
/*
* Skip white space and pick up leading +/- sign if any.
- * If base is 0, allow 0x for hex and 0 for octal, else
- * assume decimal; if base is already 16, allow 0x.
+ * If base is 0, allow 0b for binary, 0x for hex, and 0 for
+ * octal, else assume decimal; if base is already 2, allow
+ * 0b; if base is already 16, allow 0x.
*/
s = nptr;
do {
@@ -89,6 +84,13 @@ strtoll_l(const char * __restrict nptr, char ** __restrict endptr, int base,
s += 2;
base = 16;
}
+ if ((base == 0 || base == 2) &&
+ c == '0' && (*s == 'b' || *s == 'B') &&
+ (s[1] >= '0' && s[1] <= '1')) {
+ c = s[1];
+ s += 2;
+ base = 2;
+ }
if (base == 0)
base = c == '0' ? 8 : 10;
acc = any = 0;
diff --git a/lib/libc/stdlib/strtonum.3 b/lib/libc/stdlib/strtonum.3
index ed2699559bee..2650d147e7cc 100644
--- a/lib/libc/stdlib/strtonum.3
+++ b/lib/libc/stdlib/strtonum.3
@@ -13,7 +13,6 @@
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.\" $OpenBSD: strtonum.3,v 1.13 2006/04/25 05:15:42 tedu Exp $
-.\" $FreeBSD$
.\"
.Dd April 29, 2004
.Dt STRTONUM 3
diff --git a/lib/libc/stdlib/strtonum.c b/lib/libc/stdlib/strtonum.c
index aa433d835b36..0d0715bf39c1 100644
--- a/lib/libc/stdlib/strtonum.c
+++ b/lib/libc/stdlib/strtonum.c
@@ -17,9 +17,6 @@
* $OpenBSD: strtonum.c,v 1.7 2013/04/17 18:40:58 tedu Exp $
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <limits.h>
#include <stdlib.h>
diff --git a/lib/libc/stdlib/strtoq.c b/lib/libc/stdlib/strtoq.c
index b3fd56186206..2d97df712d37 100644
--- a/lib/libc/stdlib/strtoq.c
+++ b/lib/libc/stdlib/strtoq.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strtoq.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <stdlib.h>
diff --git a/lib/libc/stdlib/strtoul.3 b/lib/libc/stdlib/strtoul.3
index 6d269656ddf6..3e4b6bdc20fb 100644
--- a/lib/libc/stdlib/strtoul.3
+++ b/lib/libc/stdlib/strtoul.3
@@ -29,10 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)strtoul.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd November 28, 2001
+.Dd August 21, 2023
.Dt STRTOUL 3
.Os
.Sh NAME
@@ -109,6 +106,8 @@ If
.Fa base
is zero or 16,
the string may then include a
+.Dq Li 0b
+prefix, and the number will be read in base 2; or it may include a
.Dq Li 0x
prefix,
and the number will be read in base 16; otherwise, a zero
diff --git a/lib/libc/stdlib/strtoul.c b/lib/libc/stdlib/strtoul.c
index 50ce1cbf07a8..dfe31ede0f44 100644
--- a/lib/libc/stdlib/strtoul.c
+++ b/lib/libc/stdlib/strtoul.c
@@ -5,7 +5,7 @@
* The Regents of the University of California. All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -34,12 +34,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strtoul.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <limits.h>
#include <ctype.h>
#include <errno.h>
@@ -86,6 +80,13 @@ strtoul_l(const char * __restrict nptr, char ** __restrict endptr, int base, loc
s += 2;
base = 16;
}
+ if ((base == 0 || base == 2) &&
+ c == '0' && (*s == 'b' || *s == 'B') &&
+ (s[1] >= '0' && s[1] <= '1')) {
+ c = s[1];
+ s += 2;
+ base = 2;
+ }
if (base == 0)
base = c == '0' ? 8 : 10;
acc = any = 0;
diff --git a/lib/libc/stdlib/strtoull.c b/lib/libc/stdlib/strtoull.c
index 58a9b23b566d..be60956a53a6 100644
--- a/lib/libc/stdlib/strtoull.c
+++ b/lib/libc/stdlib/strtoull.c
@@ -5,7 +5,7 @@
* The Regents of the University of California. All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -34,12 +34,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strtouq.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <limits.h>
#include <errno.h>
#include <ctype.h>
@@ -87,6 +81,13 @@ strtoull_l(const char * __restrict nptr, char ** __restrict endptr, int base,
s += 2;
base = 16;
}
+ if ((base == 0 || base == 2) &&
+ c == '0' && (*s == 'b' || *s == 'B') &&
+ (s[1] >= '0' && s[1] <= '1')) {
+ c = s[1];
+ s += 2;
+ base = 2;
+ }
if (base == 0)
base = c == '0' ? 8 : 10;
acc = any = 0;
diff --git a/lib/libc/stdlib/strtoumax.c b/lib/libc/stdlib/strtoumax.c
index 80937036de75..6f4443acece0 100644
--- a/lib/libc/stdlib/strtoumax.c
+++ b/lib/libc/stdlib/strtoumax.c
@@ -5,7 +5,7 @@
* The Regents of the University of California. All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -34,12 +34,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "from @(#)strtoul.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <ctype.h>
#include <errno.h>
#include <stdlib.h>
@@ -87,6 +81,13 @@ strtoumax_l(const char * __restrict nptr, char ** __restrict endptr, int base,
s += 2;
base = 16;
}
+ if ((base == 0 || base == 2) &&
+ c == '0' && (*s == 'b' || *s == 'B') &&
+ (s[1] >= '0' && s[1] <= '1')) {
+ c = s[1];
+ s += 2;
+ base = 2;
+ }
if (base == 0)
base = c == '0' ? 8 : 10;
acc = any = 0;
diff --git a/lib/libc/stdlib/strtouq.c b/lib/libc/stdlib/strtouq.c
index 77a74995afbd..a50e02a2ee0b 100644
--- a/lib/libc/stdlib/strtouq.c
+++ b/lib/libc/stdlib/strtouq.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strtouq.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <stdlib.h>
diff --git a/lib/libc/stdlib/system.3 b/lib/libc/stdlib/system.3
index 718c46874710..119432342f70 100644
--- a/lib/libc/stdlib/system.3
+++ b/lib/libc/stdlib/system.3
@@ -29,10 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)system.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd July 25, 2015
+.Dd January 11, 2024
.Dt SYSTEM 3
.Os
.Sh NAME
@@ -106,6 +103,6 @@ user to run arbitrary command,
because all meta-characters supported by
.Xr sh 1
would be honored.
-User supplied parameters should always be carefully santized
+User supplied parameters should always be carefully sanitized
before they appear in
.Fa string .
diff --git a/lib/libc/stdlib/system.c b/lib/libc/stdlib/system.c
index 343183256718..b581a6ec3b14 100644
--- a/lib/libc/stdlib/system.c
+++ b/lib/libc/stdlib/system.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)system.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/types.h>
#include <sys/wait.h>
diff --git a/lib/libc/stdlib/tdelete.c b/lib/libc/stdlib/tdelete.c
index 38b2bd739170..3b00a6cf0852 100644
--- a/lib/libc/stdlib/tdelete.c
+++ b/lib/libc/stdlib/tdelete.c
@@ -23,9 +23,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#define _SEARCH_PRIVATE
#include <search.h>
#include <stdbool.h>
diff --git a/lib/libc/stdlib/tfind.c b/lib/libc/stdlib/tfind.c
index afcbc16cd2d4..5fa35f1bd85f 100644
--- a/lib/libc/stdlib/tfind.c
+++ b/lib/libc/stdlib/tfind.c
@@ -15,8 +15,6 @@
__RCSID("$NetBSD: tfind.c,v 1.2 1999/09/16 11:45:37 lukem Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
-__FBSDID("$FreeBSD$");
-
#define _SEARCH_PRIVATE
#include <stdlib.h>
#include <search.h>
diff --git a/lib/libc/stdlib/tsearch.3 b/lib/libc/stdlib/tsearch.3
index f1374fd68e40..edee01cafc52 100644
--- a/lib/libc/stdlib/tsearch.3
+++ b/lib/libc/stdlib/tsearch.3
@@ -25,7 +25,6 @@
.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" OpenBSD: tsearch.3,v 1.2 1998/06/21 22:13:49 millert Exp
-.\" $FreeBSD$
.\"
.Dd June 4, 2017
.Dt TSEARCH 3
diff --git a/lib/libc/stdlib/tsearch.c b/lib/libc/stdlib/tsearch.c
index a15c2c20517b..7826c555c065 100644
--- a/lib/libc/stdlib/tsearch.c
+++ b/lib/libc/stdlib/tsearch.c
@@ -23,9 +23,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#define _SEARCH_PRIVATE
#include <search.h>
#include <stdlib.h>
diff --git a/lib/libc/stdlib/tsearch_path.h b/lib/libc/stdlib/tsearch_path.h
index 934c91f73f56..8b575d1ee993 100644
--- a/lib/libc/stdlib/tsearch_path.h
+++ b/lib/libc/stdlib/tsearch_path.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 TSEARCH_PATH_H
diff --git a/lib/libc/stdlib/twalk.c b/lib/libc/stdlib/twalk.c
index 4f999b4c0a48..28529ea00adf 100644
--- a/lib/libc/stdlib/twalk.c
+++ b/lib/libc/stdlib/twalk.c
@@ -15,8 +15,6 @@
__RCSID("$NetBSD: twalk.c,v 1.4 2012/03/20 16:38:45 matt Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
-__FBSDID("$FreeBSD$");
-
#define _SEARCH_PRIVATE
#include <search.h>
#include <stdlib.h>
diff --git a/lib/libc/stdtime/Makefile.inc b/lib/libc/stdtime/Makefile.inc
index 3d483469bc97..5d0ce7765b63 100644
--- a/lib/libc/stdtime/Makefile.inc
+++ b/lib/libc/stdtime/Makefile.inc
@@ -1,22 +1,26 @@
# Makefile.inc,v 1.2 1994/09/13 21:26:01 wollman Exp
-# $FreeBSD$
-.PATH: ${LIBC_SRCTOP}/stdtime ${SRCTOP}/contrib/tzcode/stdtime
+.PATH: ${LIBC_SRCTOP}/stdtime ${SRCTOP}/contrib/tzcode
-SRCS+= asctime.c difftime.c localtime.c strftime.c strptime.c timelocal.c \
- time32.c
+TZCODE_SRCS= asctime.c difftime.c localtime.c
+STDTIME_SRCS= strftime.c strptime.c timelocal.c
+SRCS+= ${TZCODE_SRCS} ${STDTIME_SRCS} time32.c
-SYM_MAPS+= ${LIBC_SRCTOP}/stdtime/Symbol.map
+SYM_MAPS+= ${LIBC_SRCTOP}/stdtime/Symbol.map
-CFLAGS+= -I${SRCTOP}/contrib/tzcode/stdtime -I${LIBC_SRCTOP}/stdtime
-
-CFLAGS.localtime.c= -fwrapv
+.for src in ${TZCODE_SRCS} ${STDTIME_SRCS}
+CFLAGS.${src}+= -I${SRCTOP}/contrib/tzcode -include tzconfig.h
+.endfor
+.for src in ${STDTIME_SRCS}
+CFLAGS.${src}+= -I${LIBC_SRCTOP}/stdtime
+.endfor
+CFLAGS.localtime.c+= -DALL_STATE -DTHREAD_SAFE
.if ${MK_DETECT_TZ_CHANGES} != "no"
-CFLAGS+= -DDETECT_TZ_CHANGES
+CFLAGS.localtime.c+= -DDETECT_TZ_CHANGES
.endif
-MAN+= ctime.3 strftime.3 strptime.3 time2posix.3
+MAN+= ctime.3 strftime.3 strptime.3 time2posix.3 tzset.3
MAN+= tzfile.5
MLINKS+=ctime.3 asctime.3 ctime.3 difftime.3 ctime.3 gmtime.3 \
@@ -26,3 +30,5 @@ MLINKS+=ctime.3 asctime.3 ctime.3 difftime.3 ctime.3 gmtime.3 \
MLINKS+=strftime.3 strftime_l.3
MLINKS+=strptime.3 strptime_l.3
MLINKS+=time2posix.3 posix2time.3
+MLINKS+=tzset.3 daylight.3 \
+ tzset.3 timezone.3
diff --git a/lib/libc/stdtime/Symbol.map b/lib/libc/stdtime/Symbol.map
index 3bee3735f7e6..669d4d47907b 100644
--- a/lib/libc/stdtime/Symbol.map
+++ b/lib/libc/stdtime/Symbol.map
@@ -1,7 +1,3 @@
-/*
- * $FreeBSD$
- */
-
FBSD_1.0 {
_time32_to_time;
_time_to_time32;
@@ -21,6 +17,7 @@ FBSD_1.0 {
gmtime;
gmtime_r;
offtime;
+ offtime_r;
ctime;
ctime_r;
mktime;
@@ -33,3 +30,8 @@ FBSD_1.0 {
asctime_r;
asctime;
};
+
+FBSD_1.8 {
+ daylight;
+ timezone;
+};
diff --git a/lib/libc/stdtime/ctime.3 b/lib/libc/stdtime/ctime.3
new file mode 100644
index 000000000000..96b7f775535a
--- /dev/null
+++ b/lib/libc/stdtime/ctime.3
@@ -0,0 +1,402 @@
+.\" Copyright (c) 1989, 1991, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" Arthur Olson.
+.\" 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.
+.\" 3. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+.\"
+.Dd March 26, 2024
+.Dt CTIME 3
+.Os
+.Sh NAME
+.Nm asctime ,
+.Nm asctime_r ,
+.Nm ctime ,
+.Nm ctime_r ,
+.Nm difftime ,
+.Nm gmtime ,
+.Nm gmtime_r ,
+.Nm localtime ,
+.Nm localtime_r ,
+.Nm mktime ,
+.Nm timegm
+.Nd transform binary date and time values
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In time.h
+.Vt extern char *tzname[2] ;
+.Ft char *
+.Fn asctime "const struct tm *tm"
+.Ft char *
+.Fn asctime_r "const struct tm *tm" "char *buf"
+.Ft char *
+.Fn ctime "const time_t *clock"
+.Ft char *
+.Fn ctime_r "const time_t *clock" "char *buf"
+.Ft double
+.Fn difftime "time_t time1" "time_t time0"
+.Ft struct tm *
+.Fn gmtime "const time_t *clock"
+.Ft struct tm *
+.Fn gmtime_r "const time_t *clock" "struct tm *result"
+.Ft struct tm *
+.Fn localtime "const time_t *clock"
+.Ft struct tm *
+.Fn localtime_r "const time_t *clock" "struct tm *result"
+.Ft time_t
+.Fn mktime "struct tm *tm"
+.Ft time_t
+.Fn timegm "struct tm *tm"
+.Sh DESCRIPTION
+The
+.Fn ctime ,
+.Fn gmtime ,
+and
+.Fn localtime
+functions all take as argument a pointer to a time value representing
+the time in seconds since the Epoch (00:00:00 UTC on January 1, 1970;
+see
+.Xr time 3 ) .
+.Pp
+The
+.Fn localtime
+function converts the time value pointed to by
+.Fa clock ,
+and returns a pointer to a
+.Vt struct tm
+(described below) which contains
+the broken-out time information for the value after adjusting for the current
+time zone (see
+.Xr tzset 3 ) .
+When the specified time translates to a year that will not fit in an
+.Vt int ,
+.Fn localtime
+returns
+.Dv NULL .
+The
+.Fn localtime
+function uses
+.Xr tzset 3
+to initialize time conversion information if
+.Xr tzset 3
+has not already been called by the process.
+.Pp
+After filling in the
+.Vt struct tm ,
+.Fn localtime
+sets the
+.Va tm_isdst Ns 'th
+element of
+.Va tzname
+to a pointer to an ASCII string that is the time zone abbreviation to be
+used with
+.Fn localtime Ns 's
+return value.
+.Pp
+The
+.Fn gmtime
+function similarly converts the time value, but without any time zone
+adjustment, and returns a pointer to a
+.Vt struct tm .
+.Pp
+The
+.Fn ctime
+function
+adjusts the time value for the current time zone in the same manner as
+.Fn localtime ,
+and returns a pointer to a 26-character string of the form:
+.Bd -literal -offset indent
+Thu Nov 24 18:22:48 1986\en\e0
+.Ed
+.Pp
+All the fields have constant width.
+.Pp
+The
+.Fn asctime
+function converts the broken down time in the
+.Vt struct tm
+pointed to by
+.Fa tm
+to the form shown in the example above.
+.Pp
+The
+.Fn ctime_r
+and
+.Fn asctime_r
+functions
+provide the same functionality as
+.Fn ctime
+and
+.Fn asctime
+except the caller must provide the output buffer
+.Fa buf ,
+which must be at least 26 characters long, to store the result in.
+The
+.Fn localtime_r
+and
+.Fn gmtime_r
+functions provide the same functionality as
+.Fn localtime
+and
+.Fn gmtime
+respectively, except the caller must provide the output buffer
+.Fa result .
+.Pp
+The functions
+.Fn mktime
+and
+.Fn timegm
+convert the broken-down time in the
+.Vt struct tm
+pointed to by
+.Fa tm
+into a time value with the same encoding as that of the values
+returned by the
+.Xr time 3
+function (that is, seconds from the Epoch, UTC).
+The
+.Fn mktime
+function interprets the input structure according to the current
+timezone setting (see
+.Xr tzset 3 )
+while the
+.Fn timegm
+function interprets the input structure as representing Universal
+Coordinated Time
+.Pq UTC .
+.Pp
+The original values of the
+.Fa tm_wday
+and
+.Fa tm_yday
+components of the structure are ignored, and the original values of the
+other components are not restricted to their normal ranges, and will be
+normalized if needed.
+For example,
+October 40 is changed into November 9,
+a
+.Fa tm_hour
+of \-1 means 1 hour before midnight,
+.Fa tm_mday
+of 0 means the day preceding the current month, and
+.Fa tm_mon
+of \-2 means 2 months before January of
+.Fa tm_year .
+(A positive or zero value for
+.Fa tm_isdst
+causes
+.Fn mktime
+to presume initially that summer time (for example, Daylight Saving Time)
+is or is not in effect for the specified time, respectively.
+A negative value for
+.Fa tm_isdst
+causes the
+.Fn mktime
+function to attempt to guess whether summer time is in effect for the
+specified time.
+The
+.Fa tm_isdst
+and
+.Fa tm_gmtoff
+members are forced to zero by
+.Fn timegm . )
+.Pp
+On successful completion, the values of the
+.Fa tm_wday
+and
+.Fa tm_yday
+components of the structure are set appropriately, and the other components
+are set to represent the specified calendar time, but with their values
+forced to their normal ranges; the final value of
+.Fa tm_mday
+is not set until
+.Fa tm_mon
+and
+.Fa tm_year
+are determined.
+The
+.Fn mktime
+function
+returns the specified calendar time; if the calendar time cannot be
+represented, it returns \-1 and sets
+.Xr errno 3
+to an appropriate value.
+.Pp
+Note that \-1 is a valid result (representing one second before
+midnight UTC on the evening of 31 December 1969), so this cannot be
+relied upon to indicate success or failure; instead,
+.Fa tm_wday
+and / or
+.Fa tm_yday
+should be set to an out-of-bounds value (e.g. \-1) prior to calling
+.Fn mktime
+or
+.Fn timegm
+and checked after the call.
+.Pp
+The
+.Fn difftime
+function returns the difference in seconds between two time values,
+.Fa time1
+\-
+.Fa time0 .
+.Pp
+External declarations as well as the definition of
+.Vt struct tm
+are in the
+.In time.h
+header.
+The
+.Vt tm
+structure includes at least the following fields:
+.Bd -literal -offset indent
+int tm_sec; /* seconds (0 - 60) */
+int tm_min; /* minutes (0 - 59) */
+int tm_hour; /* hours (0 - 23) */
+int tm_mday; /* day of month (1 - 31) */
+int tm_mon; /* month of year (0 - 11) */
+int tm_year; /* year \- 1900 */
+int tm_wday; /* day of week (Sunday = 0) */
+int tm_yday; /* day of year (0 - 365) */
+int tm_isdst; /* is summer time in effect? */
+char *tm_zone; /* abbreviation of timezone name */
+long tm_gmtoff; /* offset from UTC in seconds */
+.Ed
+.Pp
+The
+.Fa tm_isdst
+field is non-zero if summer time is in effect.
+.Pp
+The
+.Fa tm_gmtoff
+field is the offset in seconds of the time represented from UTC,
+with positive values indicating a time zone ahead of UTC (east of the
+Prime Meridian).
+.Sh SEE ALSO
+.Xr date 1 ,
+.Xr clock_gettime 2 ,
+.Xr gettimeofday 2 ,
+.Xr getenv 3 ,
+.Xr time 3 ,
+.Xr tzset 3 ,
+.Xr tzfile 5
+.Sh STANDARDS
+The
+.Fn asctime ,
+.Fn ctime ,
+.Fn difftime ,
+.Fn gmtime ,
+.Fn localtime ,
+and
+.Fn mktime
+functions conform to
+.St -isoC ,
+and conform to
+.St -p1003.1-96
+provided the selected local timezone does not contain a leap-second table
+(see
+.Xr zic 8 ) .
+.Pp
+The
+.Fn asctime_r ,
+.Fn ctime_r ,
+.Fn gmtime_r ,
+and
+.Fn localtime_r
+functions are expected to conform to
+.St -p1003.1-96
+(again provided the selected local timezone does not contain a leap-second
+table).
+.Pp
+The
+.Fn timegm
+function is not specified by any standard; its function cannot be
+completely emulated using the standard functions described above.
+.Sh HISTORY
+This manual page is derived from
+the time package contributed to Berkeley by
+.An Arthur Olson
+and which appeared in
+.Bx 4.3 .
+.Pp
+The functions
+.Fn asctime ,
+.Fn gmtime ,
+and
+.Fn localtime
+first appeared in
+.At v5 ,
+.Fn difftime
+and
+.Fn mktime
+in
+.Bx 4.3 Reno ,
+and
+.Fn timegm
+and
+.Fn timelocal
+in SunOS 4.0.
+.Pp
+The
+.Fn asctime_r ,
+.Fn ctime_r ,
+.Fn gmtime_r
+and
+.Fn localtime_r
+functions have been available since
+.Fx 8.0 .
+.Sh BUGS
+Except for
+.Fn difftime ,
+.Fn mktime ,
+and the
+.Fn \&_r
+variants of the other functions,
+these functions leave their result in an internal static object and return
+a pointer to that object.
+Subsequent calls to these
+function will modify the same object.
+.Pp
+The C Standard provides no mechanism for a program to modify its current
+local timezone setting, and the POSIX-standard
+method is not reentrant.
+(However, thread-safe implementations are provided
+in the POSIX threaded environment.)
+.Pp
+The
+.Va tm_zone
+field of a returned
+.Vt tm
+structure points to a static array of characters,
+which will also be overwritten by any subsequent calls (as well as by
+subsequent calls to
+.Xr tzset 3 ) .
+.Pp
+Use of the external variable
+.Fa tzname
+is discouraged; the
+.Fa tm_zone
+entry in the tm structure is preferred.
diff --git a/lib/libc/stdtime/strftime.3 b/lib/libc/stdtime/strftime.3
index d78867dd170b..f46eee525900 100644
--- a/lib/libc/stdtime/strftime.3
+++ b/lib/libc/stdtime/strftime.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)strftime.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd June 25, 2012
.Dt STRFTIME 3
.Os
@@ -87,7 +84,7 @@ terminating NUL.
Otherwise, zero is returned and the buffer contents are indeterminate.
.Pp
The conversion specifications are copied to the buffer after expansion
-as follows:-
+as follows:
.Bl -tag -width "xxxx"
.It Cm \&%A
is replaced by national representation of the full weekday name.
@@ -274,7 +271,8 @@ The peculiar week number and year in the replacements of
.Ql %g
and
.Ql \&%V
-are defined in ISO 8601: 1988.
+are defined in
+.St -iso8601 .
The
.Fn strftime_l
function conforms to
diff --git a/lib/libc/stdtime/strftime.c b/lib/libc/stdtime/strftime.c
index 838ebdde3e5b..5943e6387174 100644
--- a/lib/libc/stdtime/strftime.c
+++ b/lib/libc/stdtime/strftime.c
@@ -3,7 +3,7 @@
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -20,28 +20,13 @@
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*/
-#ifndef lint
-#ifndef NOID
-static const char elsieid[] = "@(#)strftime.3 8.3";
-/*
- * Based on the UCB version with the ID appearing below.
- * This is ANSIish only when "multibyte character == plain character".
- */
-#endif /* !defined NOID */
-#endif /* !defined lint */
-
#include "namespace.h"
#include "private.h"
-#if defined(LIBC_SCCS) && !defined(lint)
-static const char sccsid[] = "@(#)strftime.c 5.4 (Berkeley) 3/14/89";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "tzfile.h"
#include <fcntl.h>
#include <sys/stat.h>
+#include <stdio.h>
#include "un-namespace.h"
#include "timelocal.h"
@@ -317,7 +302,7 @@ label:
time_t mkt;
tm = *t;
- mkt = mktime(&tm);
+ mkt = timeoff(&tm, t->tm_gmtoff);
if (TYPE_SIGNED(time_t))
(void) sprintf_l(buf, loc, "%ld",
(long) mkt);
diff --git a/lib/libc/stdtime/strptime.3 b/lib/libc/stdtime/strptime.3
index 2b50f0efd109..0dfa33aa29cb 100644
--- a/lib/libc/stdtime/strptime.3
+++ b/lib/libc/stdtime/strptime.3
@@ -22,8 +22,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$
.\" "
.Dd October 2, 2014
.Dt STRPTIME 3
diff --git a/lib/libc/stdtime/strptime.c b/lib/libc/stdtime/strptime.c
index 1bd7d4e8367d..c988d968d580 100644
--- a/lib/libc/stdtime/strptime.c
+++ b/lib/libc/stdtime/strptime.c
@@ -1,12 +1,12 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2014 Gary Mills
* Copyright 2011, Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 1994 Powerdog Industries. All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -37,16 +37,6 @@
* official policies, either expressed or implied, of Powerdog Industries.
*/
-#include <sys/cdefs.h>
-#ifndef lint
-#ifndef NOID
-static char copyright[] __unused =
-"@(#) Copyright (c) 1994 Powerdog Industries. All rights reserved.";
-static char sccsid[] __unused = "@(#)strptime.c 0.1 (Powerdog) 94/03/27";
-#endif /* !defined NOID */
-#endif /* not lint */
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <time.h>
#include <ctype.h>
@@ -54,6 +44,7 @@ __FBSDID("$FreeBSD$");
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
+#include "private.h"
#include "un-namespace.h"
#include "libc_private.h"
#include "timelocal.h"
diff --git a/lib/libc/stdtime/time32.c b/lib/libc/stdtime/time32.c
index e852a4f279e4..5fb7c95c22de 100644
--- a/lib/libc/stdtime/time32.c
+++ b/lib/libc/stdtime/time32.c
@@ -11,9 +11,6 @@
* base of the source tree.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <timeconv.h>
diff --git a/lib/libc/stdtime/timelocal.c b/lib/libc/stdtime/timelocal.c
index f9d33eb8d927..680270e0f9b1 100644
--- a/lib/libc/stdtime/timelocal.c
+++ b/lib/libc/stdtime/timelocal.c
@@ -1,12 +1,12 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org>
* Copyright (c) 1997 FreeBSD Inc.
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -32,9 +32,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stddef.h>
#include "ldpart.h"
diff --git a/lib/libc/stdtime/timelocal.h b/lib/libc/stdtime/timelocal.h
index f65fb179fc3f..7fe62b41ebfd 100644
--- a/lib/libc/stdtime/timelocal.h
+++ b/lib/libc/stdtime/timelocal.h
@@ -1,11 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1997-2002 FreeBSD Project.
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -29,8 +29,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 _TIMELOCAL_H_
diff --git a/lib/libc/gen/tzset.3 b/lib/libc/stdtime/tzset.3
index ddeb40585f33..94ccbec9aba7 100644
--- a/lib/libc/gen/tzset.3
+++ b/lib/libc/stdtime/tzset.3
@@ -28,24 +28,24 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)tzset.3 8.2 (Berkeley) 11/17/93
-.\" $FreeBSD$
-.\"
-.Dd November 17, 1993
+.Dd December 25, 2023
.Dt TZSET 3
.Os
.Sh NAME
-.Nm tzset ,
-.Nm tzsetwall
+.Nm daylight ,
+.Nm timezone ,
+.Nm tzname ,
+.Nm tzset
.Nd initialize time conversion information
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.In time.h
+.Vt extern int daylight ;
+.Vt extern long timezone ;
+.Vt extern char *tzname[2] ;
.Ft void
.Fn tzset void
-.Ft void
-.Fn tzsetwall void
.Sh DESCRIPTION
The
.Fn tzset
@@ -100,12 +100,20 @@ file and cannot be interpreted as a direct specification,
.Tn UTC
is used.
.Pp
+After the first call to
+.Nm tzset ,
+the
+.Vt timezone
+variable is set to the difference, in seconds, between Coordinated Universal
+Time (UTC) and the local time.
The
-.Fn tzsetwall
-function
-sets things up so that
-.Xr localtime 3
-returns the best available approximation of local wall clock time.
+.Vt daylight
+variable is set to 0 if the local timezone is observing standard time.
+It is set to 1 if the local timezone ever observes an alternate time, such as summer time.
+The first element of the
+.Vt tzname
+array is the timezone name of standard time, while the second element is the
+name of the altnerative time zone.
.Sh SPECIFICATION FORMAT
When
.Ev TZ
@@ -332,7 +340,5 @@ leap seconds are loaded from
.Sh HISTORY
The
.Fn tzset
-and
-.Fn tzsetwall
-functions first appeared in
+function first appeared in
.Bx 4.4 .
diff --git a/lib/libc/string/Makefile.inc b/lib/libc/string/Makefile.inc
index 1df3d40e329f..f32bcde5ba5e 100644
--- a/lib/libc/string/Makefile.inc
+++ b/lib/libc/string/Makefile.inc
@@ -1,7 +1,8 @@
-# @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
-# $FreeBSD$
-.PATH: ${LIBC_SRCTOP}/${LIBC_ARCH}/string ${LIBC_SRCTOP}/string
+.if ${MK_MACHDEP_OPTIMIZATIONS} != "no"
+.PATH: ${LIBC_SRCTOP}/${LIBC_ARCH}/string
+.endif
+.PATH: ${LIBC_SRCTOP}/string
.PATH: ${SRCTOP}/sys/libkern
CFLAGS+= -I${LIBC_SRCTOP}/locale
@@ -16,7 +17,7 @@ MISRCS+=bcmp.c bcopy.c bzero.c explicit_bzero.c \
strcspn.c strdup.c strerror.c strlcat.c strlcpy.c strlen.c strmode.c \
strncat.c strncmp.c strncpy.c strndup.c strnlen.c strnstr.c \
strpbrk.c strrchr.c strsep.c strsignal.c strspn.c strstr.c strtok.c \
- strxfrm.c swab.c \
+ strverscmp.c strxfrm.c swab.c \
timingsafe_bcmp.c \
timingsafe_memcmp.c \
wcpcpy.c wcpncpy.c wcscasecmp.c wcscat.c \
@@ -39,14 +40,16 @@ CFLAGS.memchr.c+= -fno-sanitize=address
.endif
+.if ${MK_MACHDEP_OPTIMIZATIONS} != "no"
# machine-dependent string sources
.sinclude "${LIBC_SRCTOP}/${LIBC_ARCH}/string/Makefile.inc"
+.endif
MAN+= bcmp.3 bcopy.3 bstring.3 bzero.3 ffs.3 index.3 memccpy.3 memchr.3 \
memcmp.3 memcpy.3 memmem.3 memmove.3 memset.3 strcasecmp.3 strcat.3 \
strchr.3 strcmp.3 strcoll.3 strcpy.3 strdup.3 strerror.3 \
string.3 strlcpy.3 strlen.3 strmode.3 strpbrk.3 strsep.3 \
- strspn.3 strstr.3 strtok.3 strxfrm.3 swab.3 \
+ strspn.3 strstr.3 strtok.3 strverscmp.3 strxfrm.3 swab.3 \
timingsafe_bcmp.3 \
wcscoll.3 wcstok.3 \
wcswidth.3 wcsxfrm.3 wmemchr.3
diff --git a/lib/libc/string/Symbol.map b/lib/libc/string/Symbol.map
index ec45d7fd7ddb..fd854d1f9479 100644
--- a/lib/libc/string/Symbol.map
+++ b/lib/libc/string/Symbol.map
@@ -1,7 +1,3 @@
-/*
- * $FreeBSD$
- */
-
FBSD_1.0 {
bcmp;
bcopy;
@@ -116,6 +112,7 @@ FBSD_1.6 {
FBSD_1.7 {
mempcpy;
+ strverscmp;
wmempcpy;
};
diff --git a/lib/libc/string/bcmp.3 b/lib/libc/string/bcmp.3
index e2d4063a1654..954e10bfdeab 100644
--- a/lib/libc/string/bcmp.3
+++ b/lib/libc/string/bcmp.3
@@ -27,9 +27,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)bcmp.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd August 15, 2016
.Dt BCMP 3
.Os
diff --git a/lib/libc/string/bcmp.c b/lib/libc/string/bcmp.c
index 96cd49039eee..cf1e487d391e 100644
--- a/lib/libc/string/bcmp.c
+++ b/lib/libc/string/bcmp.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)bcmp.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <strings.h>
/*
@@ -51,7 +45,7 @@ bcmp(const void *b1, const void *b2, size_t length)
p2 = (char *)b2;
do
if (*p1++ != *p2++)
- break;
+ return (1);
while (--length);
- return (length);
+ return (0);
}
diff --git a/lib/libc/string/bcopy.3 b/lib/libc/string/bcopy.3
index ac480f8ca966..230ca2eea89a 100644
--- a/lib/libc/string/bcopy.3
+++ b/lib/libc/string/bcopy.3
@@ -28,9 +28,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)bcopy.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd August 24, 2015
.Dt BCOPY 3
.Os
diff --git a/lib/libc/string/bcopy.c b/lib/libc/string/bcopy.c
index 84715d0432e3..fdc05f20253c 100644
--- a/lib/libc/string/bcopy.c
+++ b/lib/libc/string/bcopy.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)bcopy.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
typedef intptr_t word; /* "word" used for optimal copy speed */
diff --git a/lib/libc/string/bstring.3 b/lib/libc/string/bstring.3
index b8ed0908c88a..91603fe6dbac 100644
--- a/lib/libc/string/bstring.3
+++ b/lib/libc/string/bstring.3
@@ -27,10 +27,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)bstring.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd June 4, 1993
+.Dd December 5, 2023
.Dt BSTRING 3
.Os
.Sh NAME
@@ -59,7 +56,12 @@
.Ft int
.Fn memcmp "const void *b1" "const void *b2" "size_t len"
.Ft void *
-.Fn memccpy "void *dst" "const void *src" "int c" "size_t len"
+.Fo memccpy
+.Fa "void * restrict dst"
+.Fa "const void * restrict src"
+.Fa "int c"
+.Fa "size_t len"
+.Fc
.Ft void *
.Fn memcpy "void *dst" "const void *src" "size_t len"
.Ft void *
@@ -81,6 +83,7 @@ See the specific manual pages for more information.
.Xr memccpy 3 ,
.Xr memchr 3 ,
.Xr memcmp 3 ,
+.Xr memccpy 3 ,
.Xr memcpy 3 ,
.Xr memmove 3 ,
.Xr memset 3
diff --git a/lib/libc/string/bzero.3 b/lib/libc/string/bzero.3
index 130a652fe849..2c791c497d8c 100644
--- a/lib/libc/string/bzero.3
+++ b/lib/libc/string/bzero.3
@@ -28,9 +28,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)bzero.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd August 24, 2015
.Dt BZERO 3
.Os
diff --git a/lib/libc/string/bzero.c b/lib/libc/string/bzero.c
index 201bd64f808d..7bc2b3a7008a 100644
--- a/lib/libc/string/bzero.c
+++ b/lib/libc/string/bzero.c
@@ -1,5 +1,2 @@
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#define BZERO
#include "memset.c"
diff --git a/lib/libc/string/ffs.3 b/lib/libc/string/ffs.3
index 8d2601d6efc7..2a5adb01c737 100644
--- a/lib/libc/string/ffs.3
+++ b/lib/libc/string/ffs.3
@@ -27,9 +27,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)ffs.3 8.2 (Berkeley) 4/19/94
-.\" $FreeBSD$
-.\"
.Dd October 17, 2015
.Dt FFS 3
.Os
diff --git a/lib/libc/string/ffs.c b/lib/libc/string/ffs.c
index 738ef90ce091..0e137b6bb97e 100644
--- a/lib/libc/string/ffs.c
+++ b/lib/libc/string/ffs.c
@@ -3,6 +3,10 @@
*
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
+ * Copyright (c) 2023 The FreeBSD Foundation
+ *
+ * Portions of this software were developed by Robert Clausecker
+ * <fuz@FreeBSD.org> under sponsorship from the FreeBSD Foundation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,12 +33,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)ffs.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <strings.h>
/*
@@ -43,11 +41,5 @@ __FBSDID("$FreeBSD$");
int
ffs(int mask)
{
- int bit;
-
- if (mask == 0)
- return(0);
- for (bit = 1; !(mask & 1); bit++)
- mask = (unsigned int)mask >> 1;
- return (bit);
+ return (mask == 0 ? 0 : __builtin_ctz(mask) + 1);
}
diff --git a/lib/libc/string/ffsl.c b/lib/libc/string/ffsl.c
index dbd894b9655b..c3a87a902526 100644
--- a/lib/libc/string/ffsl.c
+++ b/lib/libc/string/ffsl.c
@@ -3,6 +3,10 @@
*
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
+ * Copyright (c) 2023 The FreeBSD Foundation
+ *
+ * Portions of this software were developed by Robert Clausecker
+ * <fuz@FreeBSD.org> under sponsorship from the FreeBSD Foundation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,9 +33,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <strings.h>
/*
@@ -40,11 +41,5 @@ __FBSDID("$FreeBSD$");
int
ffsl(long mask)
{
- int bit;
-
- if (mask == 0)
- return (0);
- for (bit = 1; !(mask & 1); bit++)
- mask = (unsigned long)mask >> 1;
- return (bit);
+ return (mask == 0 ? 0 : __builtin_ctzl(mask) + 1);
}
diff --git a/lib/libc/string/ffsll.c b/lib/libc/string/ffsll.c
index 91886de2f127..5c7abc1f7a23 100644
--- a/lib/libc/string/ffsll.c
+++ b/lib/libc/string/ffsll.c
@@ -3,6 +3,10 @@
*
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
+ * Copyright (c) 2023 The FreeBSD Foundation
+ *
+ * Portions of this software were developed by Robert Clausecker
+ * <fuz@FreeBSD.org> under sponsorship from the FreeBSD Foundation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,9 +33,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <strings.h>
/*
@@ -40,11 +41,5 @@ __FBSDID("$FreeBSD$");
int
ffsll(long long mask)
{
- int bit;
-
- if (mask == 0)
- return (0);
- for (bit = 1; !(mask & 1); bit++)
- mask = (unsigned long long)mask >> 1;
- return (bit);
+ return (mask == 0 ? 0 : __builtin_ctzll(mask) + 1);
}
diff --git a/lib/libc/string/fls.c b/lib/libc/string/fls.c
index d9edc41f9599..ac5fb7738722 100644
--- a/lib/libc/string/fls.c
+++ b/lib/libc/string/fls.c
@@ -3,6 +3,10 @@
*
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
+ * Copyright (c) 2023 The FreeBSD Foundation
+ *
+ * Portions of this software were developed by Robert Clausecker
+ * <fuz@FreeBSD.org> under sponsorship from the FreeBSD Foundation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,9 +33,7 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
+#include <limits.h>
#include <strings.h>
/*
@@ -40,11 +42,5 @@ __FBSDID("$FreeBSD$");
int
fls(int mask)
{
- int bit;
-
- if (mask == 0)
- return (0);
- for (bit = 1; mask != 1; bit++)
- mask = (unsigned int)mask >> 1;
- return (bit);
+ return (mask == 0 ? 0 : CHAR_BIT * sizeof(mask) - __builtin_clz(mask));
}
diff --git a/lib/libc/string/flsl.c b/lib/libc/string/flsl.c
index 60370cf7d832..d88c8dfcdc63 100644
--- a/lib/libc/string/flsl.c
+++ b/lib/libc/string/flsl.c
@@ -3,6 +3,11 @@
*
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
+ * Copyright (c) 2023 The FreeBSD Foundation
+
+ *
+ * Portions of this software were developed by Robert Clausecker
+ * <fuz@FreeBSD.org> under sponsorship from the FreeBSD Foundation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,9 +34,7 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
+#include <limits.h>
#include <strings.h>
/*
@@ -40,11 +43,5 @@ __FBSDID("$FreeBSD$");
int
flsl(long mask)
{
- int bit;
-
- if (mask == 0)
- return (0);
- for (bit = 1; mask != 1; bit++)
- mask = (unsigned long)mask >> 1;
- return (bit);
+ return (mask == 0 ? 0 : CHAR_BIT * sizeof(mask) - __builtin_clzl(mask));
}
diff --git a/lib/libc/string/flsll.c b/lib/libc/string/flsll.c
index 275aaa0e2e15..635ebacddf18 100644
--- a/lib/libc/string/flsll.c
+++ b/lib/libc/string/flsll.c
@@ -3,6 +3,10 @@
*
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
+ * Copyright (c) 2023 The FreeBSD Foundation
+ *
+ * Portions of this software were developed by Robert Clausecker
+ * <fuz@FreeBSD.org> under sponsorship from the FreeBSD Foundation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,9 +33,7 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
+#include <limits.h>
#include <strings.h>
/*
@@ -40,11 +42,5 @@ __FBSDID("$FreeBSD$");
int
flsll(long long mask)
{
- int bit;
-
- if (mask == 0)
- return (0);
- for (bit = 1; mask != 1; bit++)
- mask = (unsigned long long)mask >> 1;
- return (bit);
+ return (mask == 0 ? 0 : CHAR_BIT * sizeof(mask) - __builtin_clzll(mask));
}
diff --git a/lib/libc/string/index.3 b/lib/libc/string/index.3
index dcce40031983..efab4e6d42ee 100644
--- a/lib/libc/string/index.3
+++ b/lib/libc/string/index.3
@@ -27,9 +27,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)index.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd March 20, 2011
.Dt INDEX 3
.Os
diff --git a/lib/libc/string/memccpy.3 b/lib/libc/string/memccpy.3
index 5bf323115746..3bdae24354c1 100644
--- a/lib/libc/string/memccpy.3
+++ b/lib/libc/string/memccpy.3
@@ -25,10 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)memccpy.3 8.1 (Berkeley) 6/9/93
-.\" $FreeBSD$
-.\"
-.Dd June 9, 1993
+.Dd December 5, 2023
.Dt MEMCCPY 3
.Os
.Sh NAME
@@ -39,7 +36,12 @@
.Sh SYNOPSIS
.In string.h
.Ft void *
-.Fn memccpy "void *dst" "const void *src" "int c" "size_t len"
+.Fo memccpy
+.Fa "void * restrict dst"
+.Fa "const void * restrict src"
+.Fa "int c"
+.Fa "size_t len"
+.Fc
.Sh DESCRIPTION
The
.Fn memccpy
@@ -62,13 +64,35 @@ is returned.
Otherwise,
.Fa len
bytes are copied, and a NULL pointer is returned.
+If
+.Fa src
+and
+.Fa dst
+overlap, behavior is undefined.
.Sh SEE ALSO
.Xr bcopy 3 ,
.Xr memcpy 3 ,
.Xr memmove 3 ,
.Xr strcpy 3
+.Sh STANDARDS
+The
+.Fn memccpy
+function conforms to
+.St -p1003.1-2004
+and
+.\" St -isoC-2024 .
+ISO/IEC 9899:2024 (\(lqISO\~C23\(rq).
.Sh HISTORY
The
.Fn memccpy
function first appeared in
-.Bx 4.4 .
+.Bx 4.4
+and was first specified in the
+.\" St -svid1 .
+System\~V Interface Definition, First Edition (\(lqSVID1\(rq).
+The
+.Ft restrict
+keyword was added to the prototype in
+.Fx 5.0.0
+in accordance with the updated specification of
+.St -p1003.1-2004 .
diff --git a/lib/libc/string/memccpy.c b/lib/libc/string/memccpy.c
index e4c9d0e17edd..d6a446503eb6 100644
--- a/lib/libc/string/memccpy.c
+++ b/lib/libc/string/memccpy.c
@@ -29,16 +29,10 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)memccpy.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <string.h>
void *
-memccpy(void *t, const void *f, int c, size_t n)
+memccpy(void * restrict t, const void * restrict f, int c, size_t n)
{
if (n) {
diff --git a/lib/libc/string/memchr.3 b/lib/libc/string/memchr.3
index de571ca66e96..f5d1fe5d5c7f 100644
--- a/lib/libc/string/memchr.3
+++ b/lib/libc/string/memchr.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)memchr.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd April 9, 2008
.Dt MEMCHR 3
.Os
diff --git a/lib/libc/string/memchr.c b/lib/libc/string/memchr.c
index 4b5d6f6a4c8a..367eac5108c1 100644
--- a/lib/libc/string/memchr.c
+++ b/lib/libc/string/memchr.c
@@ -22,9 +22,6 @@
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <limits.h>
#include <stdint.h>
#include <string.h>
diff --git a/lib/libc/string/memcmp.3 b/lib/libc/string/memcmp.3
index 245e2abe1d71..e7666fe6d605 100644
--- a/lib/libc/string/memcmp.3
+++ b/lib/libc/string/memcmp.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)memcmp.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd August 15, 2016
.Dt MEMCMP 3
.Os
diff --git a/lib/libc/string/memcmp.c b/lib/libc/string/memcmp.c
index c8d5d92985e2..1117e0565290 100644
--- a/lib/libc/string/memcmp.c
+++ b/lib/libc/string/memcmp.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)memcmp.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <string.h>
/*
diff --git a/lib/libc/string/memcpy.3 b/lib/libc/string/memcpy.3
index 66a91592d90e..c1cf93af1cdc 100644
--- a/lib/libc/string/memcpy.3
+++ b/lib/libc/string/memcpy.3
@@ -29,10 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)memcpy.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd July 14, 2021
+.Dd November 18, 2023
.Dt MEMCPY 3
.Os
.Sh NAME
@@ -78,7 +75,7 @@ function returns a pointer to the byte after the last written byte.
.Xr memccpy 3 ,
.Xr memmove 3 ,
.Xr strcpy 3 ,
-.Xr wmemcpy 3
+.Xr wmemcpy 3 ,
.Xr wmempcpy 3
.Sh STANDARDS
The
@@ -86,3 +83,14 @@ The
function
conforms to
.St -isoC .
+.Sh HISTORY
+The
+.Fn memcpy
+function first appeared in
+.At V
+and was reimplemented for
+.Bx 4.3 Tahoe .
+The
+.Fn mempcpy
+function first appeared in
+.Fx 13.1 .
diff --git a/lib/libc/string/memcpy.c b/lib/libc/string/memcpy.c
index ed03856e54b4..ee1150473aa9 100644
--- a/lib/libc/string/memcpy.c
+++ b/lib/libc/string/memcpy.c
@@ -1,5 +1,2 @@
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#define MEMCOPY
#include "bcopy.c"
diff --git a/lib/libc/string/memmem.3 b/lib/libc/string/memmem.3
index a2a7c2ece623..5d8bcc84e31f 100644
--- a/lib/libc/string/memmem.3
+++ b/lib/libc/string/memmem.3
@@ -24,9 +24,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd March 17, 2017
+.Dd June 29, 2023
.Dt MEMMEM 3
.Os
.Sh NAME
@@ -71,7 +69,8 @@ is returned.
.Xr strstr 3
.Sh CONFORMING TO
.Fn memmem
-is a GNU extension.
+started as a GNU extension but is now available in at least
+the GNU, musl, bionic, OpenBSD, NetBSD, macOS, and illumos C runtime libraries.
.Sh HISTORY
The
.Fn memmem
diff --git a/lib/libc/string/memmem.c b/lib/libc/string/memmem.c
index be52763e2652..4a244b5964ce 100644
--- a/lib/libc/string/memmem.c
+++ b/lib/libc/string/memmem.c
@@ -22,9 +22,6 @@
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdint.h>
#include <string.h>
diff --git a/lib/libc/string/memmove.3 b/lib/libc/string/memmove.3
index 8d1c33cd9d4e..4fd190610388 100644
--- a/lib/libc/string/memmove.3
+++ b/lib/libc/string/memmove.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)memmove.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd June 4, 1993
.Dt MEMMOVE 3
.Os
diff --git a/lib/libc/string/memmove.c b/lib/libc/string/memmove.c
index 05cf75a2ce6a..e9bb2c2ed14c 100644
--- a/lib/libc/string/memmove.c
+++ b/lib/libc/string/memmove.c
@@ -1,5 +1,2 @@
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#define MEMMOVE
#include "bcopy.c"
diff --git a/lib/libc/string/mempcpy.c b/lib/libc/string/mempcpy.c
index 12c0d791e9d3..619371632922 100644
--- a/lib/libc/string/mempcpy.c
+++ b/lib/libc/string/mempcpy.c
@@ -1,8 +1,7 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2021 The FreeBSD Foundation
- * All rights reserved.
*
* This software was developed by Konstantin Belousov <kib@FreeBSD.org>
* under sponsorship from the FreeBSD Foundation.
@@ -29,9 +28,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <string.h>
void *
diff --git a/lib/libc/string/memrchr.c b/lib/libc/string/memrchr.c
index f477bc356491..bd27ebc620e5 100644
--- a/lib/libc/string/memrchr.c
+++ b/lib/libc/string/memrchr.c
@@ -14,8 +14,6 @@
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * $FreeBSD$
*/
#include <string.h>
diff --git a/lib/libc/string/memset.3 b/lib/libc/string/memset.3
index 87635e2a8ac3..3ae485f68a92 100644
--- a/lib/libc/string/memset.3
+++ b/lib/libc/string/memset.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)memset.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd August 19, 2018
.Dt MEMSET 3
.Os
diff --git a/lib/libc/string/memset.c b/lib/libc/string/memset.c
index e2d4027eea0c..a49ce7cea756 100644
--- a/lib/libc/string/memset.c
+++ b/lib/libc/string/memset.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)memset.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <limits.h>
diff --git a/lib/libc/string/memset_s.c b/lib/libc/string/memset_s.c
index 7dcef678ca00..d6da7be8385d 100644
--- a/lib/libc/string/memset_s.c
+++ b/lib/libc/string/memset_s.c
@@ -23,9 +23,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <stddef.h>
#include <stdint.h>
diff --git a/lib/libc/string/stpcpy.c b/lib/libc/string/stpcpy.c
index f31cce131777..c096e81da075 100644
--- a/lib/libc/string/stpcpy.c
+++ b/lib/libc/string/stpcpy.c
@@ -31,12 +31,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strcpy.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <string.h>
char *
diff --git a/lib/libc/string/stpncpy.c b/lib/libc/string/stpncpy.c
index d8267cc812c7..8c7f14ecf8dd 100644
--- a/lib/libc/string/stpncpy.c
+++ b/lib/libc/string/stpncpy.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2009 David Schultz <das@FreeBSD.org>
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <string.h>
char *
diff --git a/lib/libc/string/strcasecmp.3 b/lib/libc/string/strcasecmp.3
index 4a13cc41d934..7297ec328724 100644
--- a/lib/libc/string/strcasecmp.3
+++ b/lib/libc/string/strcasecmp.3
@@ -27,9 +27,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)strcasecmp.3 8.1 (Berkeley) 6/9/93
-.\" $FreeBSD$
-.\"
.Dd May 29, 2014
.Dt STRCASECMP 3
.Os
diff --git a/lib/libc/string/strcasecmp.c b/lib/libc/string/strcasecmp.c
index 60b5bb4f0c4c..69c6d0aa4492 100644
--- a/lib/libc/string/strcasecmp.c
+++ b/lib/libc/string/strcasecmp.c
@@ -5,7 +5,7 @@
* The Regents of the University of California. All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -34,12 +34,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strcasecmp.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <strings.h>
#include <ctype.h>
#include "xlocale_private.h"
diff --git a/lib/libc/string/strcasestr.c b/lib/libc/string/strcasestr.c
index b70c2195a94e..c1be973f01f4 100644
--- a/lib/libc/string/strcasestr.c
+++ b/lib/libc/string/strcasestr.c
@@ -8,7 +8,7 @@
* Chris Torek.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -37,9 +37,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <ctype.h>
#include <string.h>
#include "xlocale_private.h"
diff --git a/lib/libc/string/strcat.3 b/lib/libc/string/strcat.3
index a6d0fcef61f0..a8365b8fbdf8 100644
--- a/lib/libc/string/strcat.3
+++ b/lib/libc/string/strcat.3
@@ -29,10 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)strcat.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd December 1, 2009
+.Dd April 3, 2022
.Dt STRCAT 3
.Os
.Sh NAME
@@ -107,6 +104,15 @@ and
functions
conform to
.St -isoC .
+.Sh HISTORY
+The
+.Fn strcat
+function first appeared in the Programmer's Workbench (PWB/UNIX)
+and was ported to
+.At v7 ;
+.Fn strncat
+first appeared in
+.At v7 .
.Sh SECURITY CONSIDERATIONS
The
.Fn strcat
diff --git a/lib/libc/string/strcat.c b/lib/libc/string/strcat.c
index adaad598ec22..593a1afd7048 100644
--- a/lib/libc/string/strcat.c
+++ b/lib/libc/string/strcat.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strcat.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <string.h>
char *
diff --git a/lib/libc/string/strchr.3 b/lib/libc/string/strchr.3
index a39ea3e79d71..45179a0001fc 100644
--- a/lib/libc/string/strchr.3
+++ b/lib/libc/string/strchr.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)strchr.3 8.2 (Berkeley) 4/19/94
-.\" $FreeBSD$
-.\"
.Dd February 13, 2013
.Dt STRCHR 3
.Os
diff --git a/lib/libc/string/strchr.c b/lib/libc/string/strchr.c
index 4a20ea658252..8f6f947e9983 100644
--- a/lib/libc/string/strchr.c
+++ b/lib/libc/string/strchr.c
@@ -22,9 +22,6 @@
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <string.h>
char *__strchrnul(const char *, int);
diff --git a/lib/libc/string/strchrnul.c b/lib/libc/string/strchrnul.c
index e1fb83886042..3a42c0e7c4c5 100644
--- a/lib/libc/string/strchrnul.c
+++ b/lib/libc/string/strchrnul.c
@@ -22,9 +22,6 @@
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <limits.h>
#include <stdint.h>
#include <string.h>
diff --git a/lib/libc/string/strcmp.3 b/lib/libc/string/strcmp.3
index a79852d2a240..6f39d8d95dd4 100644
--- a/lib/libc/string/strcmp.3
+++ b/lib/libc/string/strcmp.3
@@ -29,10 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)strcmp.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd October 11, 2001
+.Dd April 3, 2022
.Dt STRCMP 3
.Os
.Sh NAME
@@ -99,3 +96,12 @@ and
functions
conform to
.St -isoC .
+.Sh HISTORY
+The
+.Fn strcmp
+function first appeared in the Programmer's Workbench (PWB/UNIX)
+and was ported to
+.At v7 ;
+.Fn strncmp
+first appeared in
+.At v7 .
diff --git a/lib/libc/string/strcmp.c b/lib/libc/string/strcmp.c
index 63cb4468415b..216efd318906 100644
--- a/lib/libc/string/strcmp.c
+++ b/lib/libc/string/strcmp.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strcmp.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <string.h>
/*
diff --git a/lib/libc/string/strcoll.3 b/lib/libc/string/strcoll.3
index d53a23d11b2f..863bc3a43d4e 100644
--- a/lib/libc/string/strcoll.3
+++ b/lib/libc/string/strcoll.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)strcoll.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd June 4, 1993
.Dt STRCOLL 3
.Os
diff --git a/lib/libc/string/strcoll.c b/lib/libc/string/strcoll.c
index 7aa2c2a642c4..77566f0c7cd7 100644
--- a/lib/libc/string/strcoll.c
+++ b/lib/libc/string/strcoll.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright 2010 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 1995 Alex Tatmanjants <alex@elvisti.kiev.ua>
@@ -7,7 +7,7 @@
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -33,9 +33,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdlib.h>
#include <string.h>
#include <errno.h>
diff --git a/lib/libc/string/strcpy.3 b/lib/libc/string/strcpy.3
index ce586f95e5dc..ed32d78826eb 100644
--- a/lib/libc/string/strcpy.3
+++ b/lib/libc/string/strcpy.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)strcpy.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd June 6, 2018
.Dt STRCPY 3
.Os
diff --git a/lib/libc/string/strcpy.c b/lib/libc/string/strcpy.c
index f58cbd9784a2..432bcc0e9d62 100644
--- a/lib/libc/string/strcpy.c
+++ b/lib/libc/string/strcpy.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strcpy.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <string.h>
#ifdef WEAK_STRCPY
diff --git a/lib/libc/string/strcspn.c b/lib/libc/string/strcspn.c
index 6e07c8c920d2..88bf68ff0733 100644
--- a/lib/libc/string/strcspn.c
+++ b/lib/libc/string/strcspn.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2005 David Schultz <das@FreeBSD.ORG>
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <limits.h>
#include <string.h>
diff --git a/lib/libc/string/strdup.3 b/lib/libc/string/strdup.3
index 881dcdb6a9e7..576fa122b8d6 100644
--- a/lib/libc/string/strdup.3
+++ b/lib/libc/string/strdup.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)strdup.3 8.1 (Berkeley) 6/9/93
-.\" $FreeBSD$
-.\"
.Dd May 5, 2020
.Dt STRDUP 3
.Os
diff --git a/lib/libc/string/strdup.c b/lib/libc/string/strdup.c
index 45ed95c2ea9d..2d595e53eb6b 100644
--- a/lib/libc/string/strdup.c
+++ b/lib/libc/string/strdup.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strdup.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
diff --git a/lib/libc/string/strerror.3 b/lib/libc/string/strerror.3
index c877ceb309b5..fa72dcff627b 100644
--- a/lib/libc/string/strerror.3
+++ b/lib/libc/string/strerror.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)strerror.3 8.1 (Berkeley) 6/9/93
-.\" $FreeBSD$
-.\"
.Dd December 17, 2020
.Dt STRERROR 3
.Os
diff --git a/lib/libc/string/strerror.c b/lib/libc/string/strerror.c
index bb685e4f7dc9..ecad55caa673 100644
--- a/lib/libc/string/strerror.c
+++ b/lib/libc/string/strerror.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strerror.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#if defined(NLS)
#include <nl_types.h>
#endif
@@ -80,8 +74,8 @@ errstr(int num, const char *uprefix, char *buf, size_t len)
strlcat(buf, t, len);
}
-static int
-strerror_rl(int errnum, char *strerrbuf, size_t buflen, locale_t locale)
+int
+__strerror_rl(int errnum, char *strerrbuf, size_t buflen, locale_t locale)
{
int retval = 0;
#if defined(NLS)
@@ -122,7 +116,7 @@ strerror_rl(int errnum, char *strerrbuf, size_t buflen, locale_t locale)
int
strerror_r(int errnum, char *strerrbuf, size_t buflen)
{
- return (strerror_rl(errnum, strerrbuf, buflen, __get_locale()));
+ return (__strerror_rl(errnum, strerrbuf, buflen, __get_locale()));
}
char *
@@ -130,7 +124,7 @@ strerror_l(int num, locale_t locale)
{
static _Thread_local char ebuf[NL_TEXTMAX];
- if (strerror_rl(num, ebuf, sizeof(ebuf), locale) != 0)
+ if (__strerror_rl(num, ebuf, sizeof(ebuf), locale) != 0)
errno = EINVAL;
return (ebuf);
}
@@ -140,7 +134,7 @@ strerror(int num)
{
static char ebuf[NL_TEXTMAX];
- if (strerror_rl(num, ebuf, sizeof(ebuf), __get_locale()) != 0)
+ if (__strerror_rl(num, ebuf, sizeof(ebuf), __get_locale()) != 0)
errno = EINVAL;
return (ebuf);
}
diff --git a/lib/libc/string/string.3 b/lib/libc/string/string.3
index e9ef152bb8ee..3ffea6ce0369 100644
--- a/lib/libc/string/string.3
+++ b/lib/libc/string/string.3
@@ -27,10 +27,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)string.3 8.2 (Berkeley) 12/11/93
-.\" $FreeBSD$
-.\"
-.Dd December 11, 1993
+.Dd September 2, 2023
.Dt STRING 3
.Os
.Sh NAME
@@ -133,7 +130,8 @@ for size limitations.
.Xr strsep 3 ,
.Xr strspn 3 ,
.Xr strstr 3 ,
-.Xr strtok 3
+.Xr strtok 3 ,
+.Xr simd 7
.Sh STANDARDS
The
.Fn strcat ,
diff --git a/lib/libc/string/strlcat.c b/lib/libc/string/strlcat.c
index f5ed6c6cf70c..bdb302def7b0 100644
--- a/lib/libc/string/strlcat.c
+++ b/lib/libc/string/strlcat.c
@@ -16,9 +16,6 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <string.h>
diff --git a/lib/libc/string/strlcpy.3 b/lib/libc/string/strlcpy.3
index e659078a6ee0..89c9d62c5a25 100644
--- a/lib/libc/string/strlcpy.3
+++ b/lib/libc/string/strlcpy.3
@@ -25,9 +25,7 @@
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd May 1, 2020
+.Dd October 27, 2023
.Dt STRLCPY 3
.Os
.Sh NAME
@@ -47,9 +45,11 @@ The
.Fn strlcpy
and
.Fn strlcat
-functions copy and concatenate strings with the
-same input parameters and output result as
-.Xr snprintf 3 .
+functions copy and concatenate strings with the same input parameters and output result as
+.Xr strcpy 3
+and
+.Xr strcat 3
+with proper overflow protection.
They are designed to be safer, more consistent, and less error
prone replacements for the easily misused functions
.Xr strncpy 3
@@ -102,22 +102,7 @@ and
.Fa dst
strings overlap, the behavior is undefined.
.Sh RETURN VALUES
-Besides quibbles over the return type
-.Pf ( Va size_t
-versus
-.Va int )
-and signal handler safety
-.Pf ( Xr snprintf 3
-is not entirely safe on some systems), the
-following two are equivalent:
-.Bd -literal -offset indent
-n = strlcpy(dst, src, len);
-n = snprintf(dst, len, "%s", src);
-.Ed
-.Pp
-Like
-.Xr snprintf 3 ,
-the
+The
.Fn strlcpy
and
.Fn strlcat
@@ -196,8 +181,7 @@ As a matter of fact, the first version of this manual page got it wrong.
.%I USENIX Association
.%B Proceedings of the FREENIX Track: 1999 USENIX Annual Technical Conference
.%D June 6-11, 1999
-.%U http://www.usenix.org/publications/library/proceedings/usenix99/
-.%U full_papers/millert/millert.pdf
+.%U http://www.usenix.org/publications/library/proceedings/usenix99/full_papers/millert/millert.pdf
.Re
.Sh HISTORY
The
diff --git a/lib/libc/string/strlcpy.c b/lib/libc/string/strlcpy.c
index 019d2316a046..58a42e321f6a 100644
--- a/lib/libc/string/strlcpy.c
+++ b/lib/libc/string/strlcpy.c
@@ -16,9 +16,6 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <string.h>
diff --git a/lib/libc/string/strlen.3 b/lib/libc/string/strlen.3
index bc9b0f3fc0e4..91b82a085b01 100644
--- a/lib/libc/string/strlen.3
+++ b/lib/libc/string/strlen.3
@@ -29,10 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)strlen.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd February 28, 2009
+.Dd April 3, 2022
.Dt STRLEN 3
.Os
.Sh NAME
@@ -91,3 +88,16 @@ The
.Fn strnlen
function conforms to
.St -p1003.1-2008 .
+.Sh HISTORY
+The
+.Fn strlen
+function first appeared in the Programmer's Workbench (PWB/UNIX)
+and was ported to
+.At v7 .
+The
+.Fn strnlen
+function first appeared in
+.Fx 8.0 ,
+.Ox 4.8 ,
+and
+.Nx 6.0 .
diff --git a/lib/libc/string/strlen.c b/lib/libc/string/strlen.c
index 2d1803b1e078..c33819707dce 100644
--- a/lib/libc/string/strlen.c
+++ b/lib/libc/string/strlen.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2009, 2010 Xin LI <delphij@FreeBSD.org>
*
@@ -25,9 +25,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/limits.h>
#include <sys/types.h>
#include <string.h>
diff --git a/lib/libc/string/strmode.3 b/lib/libc/string/strmode.3
index e963d28b9cde..7c9319979acd 100644
--- a/lib/libc/string/strmode.3
+++ b/lib/libc/string/strmode.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)strmode.3 8.3 (Berkeley) 7/28/94
-.\" $FreeBSD$
-.\"
.Dd July 28, 1994
.Dt STRMODE 3
.Os
diff --git a/lib/libc/string/strmode.c b/lib/libc/string/strmode.c
index d601bd0430e1..ae52c08b0c33 100644
--- a/lib/libc/string/strmode.c
+++ b/lib/libc/string/strmode.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strmode.c 8.3 (Berkeley) 8/15/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
diff --git a/lib/libc/string/strncat.c b/lib/libc/string/strncat.c
index 116fc53f92f4..ee951cdc956a 100644
--- a/lib/libc/string/strncat.c
+++ b/lib/libc/string/strncat.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strncat.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <string.h>
/*
diff --git a/lib/libc/string/strncmp.c b/lib/libc/string/strncmp.c
index c68fe005fcbc..abffdd41588b 100644
--- a/lib/libc/string/strncmp.c
+++ b/lib/libc/string/strncmp.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strncmp.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <string.h>
int
diff --git a/lib/libc/string/strncpy.c b/lib/libc/string/strncpy.c
index 2ffce161c5c5..b1df82a2dbf8 100644
--- a/lib/libc/string/strncpy.c
+++ b/lib/libc/string/strncpy.c
@@ -32,12 +32,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strncpy.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <string.h>
/*
diff --git a/lib/libc/string/strndup.c b/lib/libc/string/strndup.c
index bee944db167a..56034d1732fe 100644
--- a/lib/libc/string/strndup.c
+++ b/lib/libc/string/strndup.c
@@ -16,9 +16,6 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
diff --git a/lib/libc/string/strnlen.c b/lib/libc/string/strnlen.c
index fca7ad260ef8..b44f8ab21947 100644
--- a/lib/libc/string/strnlen.c
+++ b/lib/libc/string/strnlen.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2009 David Schultz <das@FreeBSD.org>
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <string.h>
size_t
diff --git a/lib/libc/string/strnstr.c b/lib/libc/string/strnstr.c
index 756399fea902..71e6b1d0f0a7 100644
--- a/lib/libc/string/strnstr.c
+++ b/lib/libc/string/strnstr.c
@@ -33,12 +33,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strstr.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <string.h>
/*
diff --git a/lib/libc/string/strpbrk.3 b/lib/libc/string/strpbrk.3
index bfa50990a71d..cdccf0da957f 100644
--- a/lib/libc/string/strpbrk.3
+++ b/lib/libc/string/strpbrk.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)strpbrk.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd June 4, 1993
.Dt STRPBRK 3
.Os
diff --git a/lib/libc/string/strpbrk.c b/lib/libc/string/strpbrk.c
index 964379e19074..c7dd6c2cff37 100644
--- a/lib/libc/string/strpbrk.c
+++ b/lib/libc/string/strpbrk.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strpbrk.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <string.h>
/*
diff --git a/lib/libc/string/strrchr.c b/lib/libc/string/strrchr.c
index 6afb8c1a497f..10cb32011cbd 100644
--- a/lib/libc/string/strrchr.c
+++ b/lib/libc/string/strrchr.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)rindex.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stddef.h>
#include <string.h>
diff --git a/lib/libc/string/strsep.3 b/lib/libc/string/strsep.3
index 0dbf1294db27..452f646d96d2 100644
--- a/lib/libc/string/strsep.3
+++ b/lib/libc/string/strsep.3
@@ -28,9 +28,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)strsep.3 8.1 (Berkeley) 6/9/93
-.\" $FreeBSD$
-.\"
.Dd May 28, 2018
.Dt STRSEP 3
.Os
diff --git a/lib/libc/string/strsep.c b/lib/libc/string/strsep.c
index 5de452109df7..bc7510362f62 100644
--- a/lib/libc/string/strsep.c
+++ b/lib/libc/string/strsep.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strsep.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <string.h>
#include <stdio.h>
diff --git a/lib/libc/string/strsignal.c b/lib/libc/string/strsignal.c
index 5f3292d10255..b99da800cee9 100644
--- a/lib/libc/string/strsignal.c
+++ b/lib/libc/string/strsignal.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strerror.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#if defined(NLS)
#include <nl_types.h>
diff --git a/lib/libc/string/strspn.3 b/lib/libc/string/strspn.3
index 4a8e3f40ce59..3c87afaed1d9 100644
--- a/lib/libc/string/strspn.3
+++ b/lib/libc/string/strspn.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)strspn.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd May 24, 2014
.Dt STRSPN 3
.Os
diff --git a/lib/libc/string/strspn.c b/lib/libc/string/strspn.c
index f2e9f2706ba7..5f046cf4e66b 100644
--- a/lib/libc/string/strspn.c
+++ b/lib/libc/string/strspn.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2005 David Schultz <das@FreeBSD.ORG>
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <limits.h>
#include <string.h>
diff --git a/lib/libc/string/strstr.3 b/lib/libc/string/strstr.3
index b1106b3c5759..8957388db535 100644
--- a/lib/libc/string/strstr.3
+++ b/lib/libc/string/strstr.3
@@ -30,9 +30,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)strstr.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd October 11, 2001
.Dt STRSTR 3
.Os
@@ -153,3 +150,9 @@ The
function
conforms to
.St -isoC .
+.Sh HISTORY
+The
+.Fn strnstr
+function was introduced by
+.Fx 4.5
+and is non-standard.
diff --git a/lib/libc/string/strstr.c b/lib/libc/string/strstr.c
index 72f8abb9e200..90f8bc701e0f 100644
--- a/lib/libc/string/strstr.c
+++ b/lib/libc/string/strstr.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-3-Clause
+ * SPDX-License-Identifier: MIT
*
* Copyright (c) 2005-2014 Rich Felker, et al.
*
@@ -22,9 +22,6 @@
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdint.h>
#include <string.h>
@@ -149,7 +146,7 @@ twoway_strstr(const unsigned char *h, const unsigned char *n)
for (;;) {
/* Update incremental end-of-haystack pointer */
if (z - h < l) {
- /* Fast estimate for MIN(l,63) */
+ /* Fast estimate for MAX(l,63) */
size_t grow = l | 63;
const unsigned char *z2 = memchr(z, 0, grow);
if (z2) {
diff --git a/lib/libc/string/strtok.3 b/lib/libc/string/strtok.3
index c8ea7a7bfe7f..e905b655b024 100644
--- a/lib/libc/string/strtok.3
+++ b/lib/libc/string/strtok.3
@@ -41,9 +41,6 @@
.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)strtok.3 8.2 (Berkeley) 2/3/94
-.\" $FreeBSD$
-.\"
.Dd January 22, 2016
.Dt STRTOK 3
.Os
diff --git a/lib/libc/string/strtok.c b/lib/libc/string/strtok.c
index 46e40bfa4a61..fb22913505ba 100644
--- a/lib/libc/string/strtok.c
+++ b/lib/libc/string/strtok.c
@@ -34,12 +34,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strtok.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stddef.h>
#ifdef DEBUG_STRTOK
#include <stdio.h>
diff --git a/lib/libc/string/strverscmp.3 b/lib/libc/string/strverscmp.3
new file mode 100644
index 000000000000..495e5c8780c1
--- /dev/null
+++ b/lib/libc/string/strverscmp.3
@@ -0,0 +1,56 @@
+.\" SPDX-License-Identifier: BSD-2-Clause
+.\" Copyright (c) 2022 Aymeric Wibo <obiwac@gmail.com>
+.Dd August 31, 2023
+.Dt STRVERSCMP 3
+.Os
+.Sh NAME
+.Nm strverscmp
+.Nd compare strings according to natural order
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In string.h
+.Ft int
+.Fn strverscmp "const char *s1" "const char *s2"
+.Sh DESCRIPTION
+The
+.Fn strverscmp
+function
+compares the null-terminated strings
+.Fa s1
+and
+.Fa s2
+according to their natural order
+and returns an integer greater than, equal to, or less than 0,
+depending on whether
+.Fa s1
+is greater than, equal to, or less than
+.Fa s2 .
+.Pp
+More specifically, this natural order is found by iterating over both
+strings until a difference is found.
+If the difference is between non-decimal characters,
+.Fn strverscmp
+acts like
+.Xr strcmp 3
+(thus, the ordering would be "a", "b", "train").
+If a decimal digit is found, the whole number is read and compared
+(thus, the ordering would be "9", "10", "420" which is different to lexicographic order,
+what
+.Xr strcmp 3
+would have done).
+Numbers with leading zeroes are interpreted as fractional parts (even without a decimal point),
+and numbers with more leading zeroes are placed before numbers with fewer leading zeroes
+(thus, the ordering would be "000", "00", "01", "010", "09", "0", "1", "9", "10").
+.Sh SEE ALSO
+.Xr strcmp 3 ,
+.Xr versionsort 3
+.Sh STANDARDS
+The
+.Fn strverscmp
+function is a GNU extension and conforms to no standard.
+.Sh HISTORY
+The
+.Fn strverscmp
+function was added in
+.Fx 13.2 .
diff --git a/lib/libc/string/strverscmp.c b/lib/libc/string/strverscmp.c
new file mode 100644
index 000000000000..6051adb35499
--- /dev/null
+++ b/lib/libc/string/strverscmp.c
@@ -0,0 +1,91 @@
+/*-
+* SPDX-License-Identifier: BSD-2-Clause
+* Copyright (c) 2022 Aymeric Wibo <obiwac@gmail.com>
+*/
+
+#include <ctype.h>
+#include <stddef.h>
+
+int
+strverscmp(const char *s1, const char *s2)
+{
+ size_t digit_count_1, digit_count_2;
+ size_t zeros_count_1, zeros_count_2;
+ const unsigned char *num_1, *num_2;
+ const unsigned char *u1 = __DECONST(const unsigned char *, s1);
+ const unsigned char *u2 = __DECONST(const unsigned char *, s2);
+
+ /*
+ * If pointers are the same, no need to go through to process of
+ * comparing them.
+ */
+ if (s1 == s2)
+ return (0);
+
+ while (*u1 != '\0' && *u2 != '\0') {
+ /* If either character is not a digit, act like strcmp(3). */
+
+ if (!isdigit(*u1) || !isdigit(*u2)) {
+ if (*u1 != *u2)
+ return (*u1 - *u2);
+ u1++;
+ u2++;
+ continue;
+ }
+ if (*u1 == '0' || *u2 == '0') {
+ /*
+ * Treat leading zeros as if they were the fractional
+ * part of a number, i.e. as if they had a decimal point
+ * in front. First, count the leading zeros (more zeros
+ * == smaller number).
+ */
+ zeros_count_1 = 0;
+ zeros_count_2 = 0;
+ for (; *u1 == '0'; u1++)
+ zeros_count_1++;
+ for (; *u2 == '0'; u2++)
+ zeros_count_2++;
+ if (zeros_count_1 != zeros_count_2)
+ return (zeros_count_2 - zeros_count_1);
+
+ /* Handle the case where 0 < 09. */
+ if (!isdigit(*u1) && isdigit(*u2))
+ return (1);
+ if (!isdigit(*u2) && isdigit(*u1))
+ return (-1);
+ } else {
+ /*
+ * No leading zeros; we're simply comparing two numbers.
+ * It is necessary to first count how many digits there
+ * are before going back to compare each digit, so that
+ * e.g. 7 is not considered larger than 60.
+ */
+ num_1 = u1;
+ num_2 = u2;
+
+ /* Count digits (more digits == larger number). */
+ for (; isdigit(*u1); u1++)
+ ;
+ for (; isdigit(*u2); u2++)
+ ;
+ digit_count_1 = u1 - num_1;
+ digit_count_2 = u2 - num_2;
+ if (digit_count_1 != digit_count_2)
+ return (digit_count_1 - digit_count_2);
+
+ /*
+ * If there are the same number of digits, go back to
+ * the start of the number.
+ */
+ u1 = num_1;
+ u2 = num_2;
+ }
+
+ /* Compare each digit until there are none left. */
+ for (; isdigit(*u1) && isdigit(*u2); u1++, u2++) {
+ if (*u1 != *u2)
+ return (*u1 - *u2);
+ }
+ }
+ return (*u1 - *u2);
+}
diff --git a/lib/libc/string/strxfrm.3 b/lib/libc/string/strxfrm.3
index f2750f4a385a..15964c72a04d 100644
--- a/lib/libc/string/strxfrm.3
+++ b/lib/libc/string/strxfrm.3
@@ -29,9 +29,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)strxfrm.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd June 4, 1993
.Dt STRXFRM 3
.Os
diff --git a/lib/libc/string/strxfrm.c b/lib/libc/string/strxfrm.c
index 3252173430f2..e327aaf1c2ff 100644
--- a/lib/libc/string/strxfrm.c
+++ b/lib/libc/string/strxfrm.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright 2010 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 1995 Alex Tatmanjants <alex@elvisti.kiev.ua>
@@ -7,7 +7,7 @@
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -33,9 +33,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdlib.h>
#include <string.h>
#include <errno.h>
diff --git a/lib/libc/string/swab.3 b/lib/libc/string/swab.3
index 204b976ab1f4..050cab6c4dd6 100644
--- a/lib/libc/string/swab.3
+++ b/lib/libc/string/swab.3
@@ -25,9 +25,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)swab.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
.Dd March 4, 2012
.Dt SWAB 3
.Os
diff --git a/lib/libc/string/swab.c b/lib/libc/string/swab.c
index 1a30ce813784..2b044d68ca46 100644
--- a/lib/libc/string/swab.c
+++ b/lib/libc/string/swab.c
@@ -1,63 +1,22 @@
/*-
- * SPDX-License-Identifier: BSD-3-Clause
- *
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Jeffrey Mogul.
- *
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ * SPDX-License-Identifier: BSD-2-Clause
+ * Copyright (c) 2024 rilysh <nightquick@proton.me>
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)swab.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <unistd.h>
void
swab(const void * __restrict from, void * __restrict to, ssize_t len)
{
- unsigned long temp;
- int n;
- char *fp, *tp;
+ const unsigned char *f = from;
+ unsigned char *t = to;
+
+ while (len > 1) {
+ t[0] = f[1];
+ t[1] = f[0];
- if (len <= 0)
- return;
- n = len >> 1;
- fp = (char *)from;
- tp = (char *)to;
-#define STEP temp = *fp++,*tp++ = *fp++,*tp++ = temp
- /* round to multiple of 8 */
- for (; n & 0x7; --n)
- STEP;
- for (n >>= 3; n > 0; --n) {
- STEP; STEP; STEP; STEP;
- STEP; STEP; STEP; STEP;
+ f += 2;
+ t += 2;
+ len -= 2;
}
}
diff --git a/lib/libc/string/timingsafe_bcmp.3 b/lib/libc/string/timingsafe_bcmp.3
index 502e57176806..52c7be7410ef 100644
--- a/lib/libc/string/timingsafe_bcmp.3
+++ b/lib/libc/string/timingsafe_bcmp.3
@@ -13,8 +13,6 @@
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-.\"
-.\" $FreeBSD$
.Dd August 15, 2016
.Dt TIMINGSAFE_BCMP 3
.Os
@@ -89,4 +87,4 @@ function first appeared in
.Ox 5.6 .
.Pp
Both functions first appeared in
-.Fx 12.0 .
+.Fx 11.1 .
diff --git a/lib/libc/string/timingsafe_bcmp.c b/lib/libc/string/timingsafe_bcmp.c
index d098158059f3..c3a595a18695 100644
--- a/lib/libc/string/timingsafe_bcmp.c
+++ b/lib/libc/string/timingsafe_bcmp.c
@@ -15,9 +15,6 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <string.h>
int __timingsafe_bcmp(const void *, const void *, size_t);
diff --git a/lib/libc/string/timingsafe_memcmp.c b/lib/libc/string/timingsafe_memcmp.c
index 7abfb48045f8..97a146e06a2b 100644
--- a/lib/libc/string/timingsafe_memcmp.c
+++ b/lib/libc/string/timingsafe_memcmp.c
@@ -15,9 +15,6 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <limits.h>
#include <string.h>
diff --git a/lib/libc/string/wcpcpy.c b/lib/libc/string/wcpcpy.c
index 41b7c5178269..2d377dab2777 100644
--- a/lib/libc/string/wcpcpy.c
+++ b/lib/libc/string/wcpcpy.c
@@ -31,12 +31,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strcpy.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <wchar.h>
wchar_t *
diff --git a/lib/libc/string/wcpncpy.c b/lib/libc/string/wcpncpy.c
index 58b7d39aa3cf..72c060842e26 100644
--- a/lib/libc/string/wcpncpy.c
+++ b/lib/libc/string/wcpncpy.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2009 David Schultz <das@FreeBSD.org>
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <wchar.h>
wchar_t *
diff --git a/lib/libc/string/wcscasecmp.c b/lib/libc/string/wcscasecmp.c
index 1f75ef93cdd1..0132966fe0cf 100644
--- a/lib/libc/string/wcscasecmp.c
+++ b/lib/libc/string/wcscasecmp.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2009 David Schultz <das@FreeBSD.org>
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <wchar.h>
#include <wctype.h>
diff --git a/lib/libc/string/wcscat.c b/lib/libc/string/wcscat.c
index 7428ba3364f2..3599e562e9b4 100644
--- a/lib/libc/string/wcscat.c
+++ b/lib/libc/string/wcscat.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c)1999 Citrus Project,
* All rights reserved.
@@ -34,8 +34,6 @@
__RCSID("$NetBSD: wcscat.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
-__FBSDID("$FreeBSD$");
-
#include <wchar.h>
wchar_t *
diff --git a/lib/libc/string/wcschr.c b/lib/libc/string/wcschr.c
index 1375ed9181cf..356f8025c317 100644
--- a/lib/libc/string/wcschr.c
+++ b/lib/libc/string/wcschr.c
@@ -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.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <wchar.h>
wchar_t *
diff --git a/lib/libc/string/wcscmp.c b/lib/libc/string/wcscmp.c
index 7205238d5637..66e08ff782a7 100644
--- a/lib/libc/string/wcscmp.c
+++ b/lib/libc/string/wcscmp.c
@@ -32,14 +32,8 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strcmp.c 8.1 (Berkeley) 6/4/93";
-#if 0
-__RCSID("$NetBSD: wcscmp.c,v 1.3 2001/01/05 12:13:12 itojun Exp $");
-#endif
-#endif /* LIBC_SCCS and not lint */
-__FBSDID("$FreeBSD$");
+
+/* $NetBSD: wcscmp.c,v 1.3 2001/01/05 12:13:12 itojun Exp $ */
#include <wchar.h>
diff --git a/lib/libc/string/wcscoll.3 b/lib/libc/string/wcscoll.3
index ba89fb3c268e..620787861f3a 100644
--- a/lib/libc/string/wcscoll.3
+++ b/lib/libc/string/wcscoll.3
@@ -28,10 +28,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.
-.\"
-.\" @(#)strcoll.3 8.1 (Berkeley) 6/4/93
.\" FreeBSD: src/lib/libc/string/strcoll.3,v 1.11 2001/10/01 16:09:00 ru Exp
-.\" $FreeBSD$
.\"
.Dd October 4, 2002
.Dt WCSCOLL 3
diff --git a/lib/libc/string/wcscoll.c b/lib/libc/string/wcscoll.c
index d8ef9320f8df..e9394a83f60c 100644
--- a/lib/libc/string/wcscoll.c
+++ b/lib/libc/string/wcscoll.c
@@ -1,12 +1,12 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright 2017 Nexenta Systems, Inc.
* Copyright (c) 2002 Tim J. Robbins
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -32,9 +32,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <stdlib.h>
#include <string.h>
diff --git a/lib/libc/string/wcscpy.c b/lib/libc/string/wcscpy.c
index b400fae1cb5c..622e4201f84b 100644
--- a/lib/libc/string/wcscpy.c
+++ b/lib/libc/string/wcscpy.c
@@ -34,8 +34,6 @@
__RCSID("$NetBSD: wcscpy.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
-__FBSDID("$FreeBSD$");
-
#include <wchar.h>
wchar_t *
diff --git a/lib/libc/string/wcscspn.c b/lib/libc/string/wcscspn.c
index a0db7157e9e0..2bfd5e9f8604 100644
--- a/lib/libc/string/wcscspn.c
+++ b/lib/libc/string/wcscspn.c
@@ -34,8 +34,6 @@
__RCSID("$NetBSD: wcscspn.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
-__FBSDID("$FreeBSD$");
-
#include <wchar.h>
size_t
diff --git a/lib/libc/string/wcsdup.c b/lib/libc/string/wcsdup.c
index eecc0557d284..517acfa7ec49 100644
--- a/lib/libc/string/wcsdup.c
+++ b/lib/libc/string/wcsdup.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2005 Tim J. Robbins.
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdlib.h>
#include <wchar.h>
diff --git a/lib/libc/string/wcslcat.c b/lib/libc/string/wcslcat.c
index f954b7351fe5..336947e3cd23 100644
--- a/lib/libc/string/wcslcat.c
+++ b/lib/libc/string/wcslcat.c
@@ -35,8 +35,6 @@
__RCSID("$NetBSD: wcslcat.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <wchar.h>
diff --git a/lib/libc/string/wcslcpy.c b/lib/libc/string/wcslcpy.c
index ca60d587004f..920425bb5efc 100644
--- a/lib/libc/string/wcslcpy.c
+++ b/lib/libc/string/wcslcpy.c
@@ -35,8 +35,6 @@
__RCSID("$NetBSD: wcslcpy.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <wchar.h>
diff --git a/lib/libc/string/wcslen.c b/lib/libc/string/wcslen.c
index cfd3aa23cc99..e81d981c799b 100644
--- a/lib/libc/string/wcslen.c
+++ b/lib/libc/string/wcslen.c
@@ -34,8 +34,6 @@
__RCSID("$NetBSD: wcslen.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
-__FBSDID("$FreeBSD$");
-
#include <wchar.h>
size_t
diff --git a/lib/libc/string/wcsncasecmp.c b/lib/libc/string/wcsncasecmp.c
index 34833d185fdf..0cd9f16796fa 100644
--- a/lib/libc/string/wcsncasecmp.c
+++ b/lib/libc/string/wcsncasecmp.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2009 David Schultz <das@FreeBSD.org>
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <wchar.h>
#include <wctype.h>
diff --git a/lib/libc/string/wcsncat.c b/lib/libc/string/wcsncat.c
index eb13fab8de34..004391423f53 100644
--- a/lib/libc/string/wcsncat.c
+++ b/lib/libc/string/wcsncat.c
@@ -34,8 +34,6 @@
__RCSID("$NetBSD: wcsncat.c,v 1.1 2000/12/23 23:14:36 itojun Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
-__FBSDID("$FreeBSD$");
-
#include <wchar.h>
wchar_t *
diff --git a/lib/libc/string/wcsncmp.c b/lib/libc/string/wcsncmp.c
index 55c88f60e6fa..141e42c3087f 100644
--- a/lib/libc/string/wcsncmp.c
+++ b/lib/libc/string/wcsncmp.c
@@ -29,14 +29,7 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strncmp.c 8.1 (Berkeley) 6/4/93";
-__RCSID("$NetBSD: wcsncmp.c,v 1.3 2001/01/05 12:13:13 itojun Exp $");
-#endif /* LIBC_SCCS and not lint */
-#endif
-__FBSDID("$FreeBSD$");
+/* $NetBSD: wcsncmp.c,v 1.3 2001/01/05 12:13:13 itojun Exp $ */
#include <wchar.h>
diff --git a/lib/libc/string/wcsncpy.c b/lib/libc/string/wcsncpy.c
index f86e40fe9536..a02a8292c0d1 100644
--- a/lib/libc/string/wcsncpy.c
+++ b/lib/libc/string/wcsncpy.c
@@ -32,14 +32,6 @@
* SUCH DAMAGE.
*/
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strncpy.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <wchar.h>
/*
diff --git a/lib/libc/string/wcsnlen.c b/lib/libc/string/wcsnlen.c
index f7e30d766c02..1dfc2d5ef913 100644
--- a/lib/libc/string/wcsnlen.c
+++ b/lib/libc/string/wcsnlen.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2009 David Schultz <das@FreeBSD.org>
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <wchar.h>
size_t
diff --git a/lib/libc/string/wcspbrk.c b/lib/libc/string/wcspbrk.c
index 0e9ccf66e312..62ad9a8130a2 100644
--- a/lib/libc/string/wcspbrk.c
+++ b/lib/libc/string/wcspbrk.c
@@ -34,8 +34,6 @@
__RCSID("$NetBSD: wcspbrk.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
-__FBSDID("$FreeBSD$");
-
#include <wchar.h>
wchar_t *
diff --git a/lib/libc/string/wcsrchr.c b/lib/libc/string/wcsrchr.c
index 73a0395fdc41..1679d808be2b 100644
--- a/lib/libc/string/wcsrchr.c
+++ b/lib/libc/string/wcsrchr.c
@@ -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.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <wchar.h>
wchar_t *
diff --git a/lib/libc/string/wcsspn.c b/lib/libc/string/wcsspn.c
index 2b08acbd94f6..487ef6bdf3b4 100644
--- a/lib/libc/string/wcsspn.c
+++ b/lib/libc/string/wcsspn.c
@@ -34,8 +34,6 @@
__RCSID("$NetBSD: wcsspn.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
-__FBSDID("$FreeBSD$");
-
#include <wchar.h>
size_t
diff --git a/lib/libc/string/wcsstr.c b/lib/libc/string/wcsstr.c
index 74921fecf047..beb5e8931742 100644
--- a/lib/libc/string/wcsstr.c
+++ b/lib/libc/string/wcsstr.c
@@ -32,14 +32,6 @@
* SUCH DAMAGE.
*/
-#if 0
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strstr.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <wchar.h>
/*
diff --git a/lib/libc/string/wcstok.3 b/lib/libc/string/wcstok.3
index 0de24d8366c8..136c733f9708 100644
--- a/lib/libc/string/wcstok.3
+++ b/lib/libc/string/wcstok.3
@@ -47,8 +47,6 @@
.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd October 3, 2002
.Dt WCSTOK 3
.Os
diff --git a/lib/libc/string/wcstok.c b/lib/libc/string/wcstok.c
index b4bdc869a2e1..839a650ce316 100644
--- a/lib/libc/string/wcstok.c
+++ b/lib/libc/string/wcstok.c
@@ -34,9 +34,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <wchar.h>
wchar_t *
diff --git a/lib/libc/string/wcswidth.3 b/lib/libc/string/wcswidth.3
index 76d32ad8e4b9..20ba1fa5a3e1 100644
--- a/lib/libc/string/wcswidth.3
+++ b/lib/libc/string/wcswidth.3
@@ -22,8 +22,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd August 20, 2002
.Dt WCSWIDTH 3
.Os
diff --git a/lib/libc/string/wcswidth.c b/lib/libc/string/wcswidth.c
index 3a8805f1b754..b6f3abd761eb 100644
--- a/lib/libc/string/wcswidth.c
+++ b/lib/libc/string/wcswidth.c
@@ -13,7 +13,7 @@
* Paul Borman at Krystal Technologies.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -42,9 +42,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <wchar.h>
#include "xlocale_private.h"
diff --git a/lib/libc/string/wcsxfrm.3 b/lib/libc/string/wcsxfrm.3
index ac30d38e1131..8fca7c1b62df 100644
--- a/lib/libc/string/wcsxfrm.3
+++ b/lib/libc/string/wcsxfrm.3
@@ -28,10 +28,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.
-.\"
-.\" @(#)strxfrm.3 8.1 (Berkeley) 6/4/93
.\" FreeBSD: src/lib/libc/string/strxfrm.3,v 1.16 2002/09/06 11:24:06 tjr Exp
-.\" $FreeBSD$
.\"
.Dd October 4, 2002
.Dt WCSXFRM 3
diff --git a/lib/libc/string/wcsxfrm.c b/lib/libc/string/wcsxfrm.c
index c9603d1881fe..8c6c542c9255 100644
--- a/lib/libc/string/wcsxfrm.c
+++ b/lib/libc/string/wcsxfrm.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright 2010 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 1995 Alex Tatmanjants <alex@elvisti.kiev.ua>
@@ -7,7 +7,7 @@
* All rights reserved.
*
* Copyright (c) 2011 The FreeBSD Foundation
- * All rights reserved.
+ *
* Portions of this software were developed by David Chisnall
* under sponsorship from the FreeBSD Foundation.
*
@@ -33,9 +33,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdlib.h>
#include <string.h>
#include <wchar.h>
diff --git a/lib/libc/string/wmemchr.3 b/lib/libc/string/wmemchr.3
index 8a926eef456a..c1701facb7d5 100644
--- a/lib/libc/string/wmemchr.3
+++ b/lib/libc/string/wmemchr.3
@@ -31,11 +31,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" from: @(#)strcpy.3 8.1 (Berkeley) 6/4/93
-.\"
-.\" $FreeBSD$
-.\"
-.Dd July 14, 2021
+.Dd March 21, 2024
.Dt WMEMCHR 3
.Os
.Sh NAME
@@ -84,9 +80,9 @@
.Ft wchar_t *
.Fn wmemset "wchar_t *s" "wchar_t c" "size_t n"
.Ft wchar_t *
-.Fn wcpcpy "wchar_t *s1" "wchar_t *s2"
+.Fn wcpcpy "wchar_t * restrict s1" "const wchar_t * restrict s2"
.Ft wchar_t *
-.Fn wcpncpy "wchar_t *s1" "wchar_t *s2" "size_t n"
+.Fn wcpncpy "wchar_t * restrict s1" "const wchar_t * restrict s2" "size_t n"
.Ft int
.Fn wcscasecmp "const wchar_t *s1" "const wchar_t *s2"
.Ft wchar_t *
diff --git a/lib/libc/string/wmemchr.c b/lib/libc/string/wmemchr.c
index 42ae286aaec7..8724187ffd63 100644
--- a/lib/libc/string/wmemchr.c
+++ b/lib/libc/string/wmemchr.c
@@ -34,8 +34,6 @@
__RCSID("$NetBSD: wmemchr.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
-__FBSDID("$FreeBSD$");
-
#include <wchar.h>
wchar_t *
diff --git a/lib/libc/string/wmemcmp.c b/lib/libc/string/wmemcmp.c
index f1b1b00eb5da..1abebfd8da95 100644
--- a/lib/libc/string/wmemcmp.c
+++ b/lib/libc/string/wmemcmp.c
@@ -34,8 +34,6 @@
__RCSID("$NetBSD: wmemcmp.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
-__FBSDID("$FreeBSD$");
-
#include <wchar.h>
int
diff --git a/lib/libc/string/wmemcpy.c b/lib/libc/string/wmemcpy.c
index 30956eb4f483..f692a25fc95b 100644
--- a/lib/libc/string/wmemcpy.c
+++ b/lib/libc/string/wmemcpy.c
@@ -34,8 +34,6 @@
__RCSID("$NetBSD: wmemcpy.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
-__FBSDID("$FreeBSD$");
-
#include <string.h>
#include <wchar.h>
diff --git a/lib/libc/string/wmemmove.c b/lib/libc/string/wmemmove.c
index 5e8da9f4004c..cbbdb4afdd6c 100644
--- a/lib/libc/string/wmemmove.c
+++ b/lib/libc/string/wmemmove.c
@@ -34,8 +34,6 @@
__RCSID("$NetBSD: wmemmove.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
-__FBSDID("$FreeBSD$");
-
#include <string.h>
#include <wchar.h>
diff --git a/lib/libc/string/wmempcpy.c b/lib/libc/string/wmempcpy.c
index 208d62a26849..6551787abf65 100644
--- a/lib/libc/string/wmempcpy.c
+++ b/lib/libc/string/wmempcpy.c
@@ -1,8 +1,7 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2021 The FreeBSD Foundation
- * All rights reserved.
*
* This software was developed by Konstantin Belousov <kib@FreeBSD.org>
* under sponsorship from the FreeBSD Foundation.
@@ -29,9 +28,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <string.h>
#include <wchar.h>
diff --git a/lib/libc/string/wmemset.c b/lib/libc/string/wmemset.c
index fcf40efb8e32..4276373399f9 100644
--- a/lib/libc/string/wmemset.c
+++ b/lib/libc/string/wmemset.c
@@ -34,8 +34,6 @@
__RCSID("$NetBSD: wmemset.c,v 1.1 2000/12/23 23:14:37 itojun Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
-__FBSDID("$FreeBSD$");
-
#include <wchar.h>
wchar_t *
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc
index 58ba333080b7..ee761ce5ff55 100644
--- a/lib/libc/sys/Makefile.inc
+++ b/lib/libc/sys/Makefile.inc
@@ -1,512 +1,38 @@
-# @(#)Makefile.inc 8.3 (Berkeley) 10/24/94
-# $FreeBSD$
+# libc-specific portion of the system call interface
-# sys sources
-.PATH: ${LIBC_SRCTOP}/${LIBC_ARCH}/sys ${LIBC_SRCTOP}/sys
+.PATH: ${LIBC_SRCTOP}/sys
-# Include the generated makefile containing the *complete* list
-# of syscall names in MIASM.
-.include "${SRCTOP}/sys/sys/syscall.mk"
+# Most of the implementation is shared with libsys:
+.include "${LIBSYS_SRCTOP}/Makefile.sys"
-# Include machine dependent definitions.
-#
-# MDASM names override the default syscall names in MIASM.
-# NOASM will prevent the default syscall code from being generated.
-# PSEUDO generates _<sys>() and __sys_<sys>() symbols, but not <sys>().
-#
-# While historically machine dependent, all architectures have the following
-# declarations in common:
-#
-NOASM= exit.o \
- getlogin.o \
- sstk.o \
- yield.o
-PSEUDO= _exit.o \
- _getlogin.o
-.sinclude "${LIBC_SRCTOP}/${LIBC_ARCH}/sys/Makefile.inc"
-
-SRCS+= clock_gettime.c gettimeofday.c __vdso_gettimeofday.c
-NOASM+= clock_gettime.o gettimeofday.o
-PSEUDO+= _clock_gettime.o _gettimeofday.o
-
-# Sources common to both syscall interfaces:
-SRCS+= \
- __error.c \
- interposing_table.c
-
-SRCS+= getdents.c lstat.c mknod.c stat.c
-
-SRCS+= fstat.c fstatat.c fstatfs.c getfsstat.c statfs.c
-NOASM+= fstat.o fstatat.o fstatfs.o getfsstat.o statfs.o
-PSEUDO+= _fstat.o _fstatat.o _fstatfs.o _getfsstat.o _statfs.o
-
-SRCS+= getdirentries.c
-NOASM+= getdirentries.o
-PSEUDO+= _getdirentries.o
-
-SRCS+= brk.c
-SRCS+= closefrom.c
-SRCS+= pipe.c
-SRCS+= shm_open.c
-SRCS+= vadvise.c
-SRCS+= POSIX2x_Fork.c
-
-SRCS+= compat-stub.c
-
-INTERPOSED = \
- accept \
- accept4 \
- aio_suspend \
- clock_nanosleep \
- close \
- connect \
- fcntl \
- fdatasync \
- fsync \
- fork \
- kevent \
- msync \
- nanosleep \
- open \
- openat \
- poll \
- ppoll \
- pselect \
- ptrace \
- read \
- readv \
- recvfrom \
- recvmsg \
- select \
- sendmsg \
- sendto \
- setcontext \
- sigaction \
- sigprocmask \
- sigsuspend \
- sigtimedwait \
- sigwait \
- sigwaitinfo \
- swapcontext \
- wait4 \
- wait6 \
- write \
- writev
-
-SRCS+= ${INTERPOSED:S/$/.c/}
-NOASM+= ${INTERPOSED:S/$/.o/}
-PSEUDO+= ${INTERPOSED:C/^.*$/_&.o/}
-
-# Add machine dependent asm sources:
-SRCS+=${MDASM}
-
-# Look though the complete list of syscalls (MIASM) for names that are
-# not defined with machine dependent implementations (MDASM) and are
-# not declared for no generation of default code (NOASM). Add each
-# syscall that satisfies these conditions to the ASM list.
-.for _asm in ${MIASM}
-.if (${MDASM:R:M${_asm:R}} == "")
-.if (${NOASM:R:M${_asm:R}} == "")
-ASM+=$(_asm)
-.endif
-.endif
-.endfor
-
-SASM= ${ASM:S/.o/.S/}
-
-SPSEUDO= ${PSEUDO:S/.o/.S/}
-
-SRCS+= ${SASM} ${SPSEUDO}
+# emit empty assembly stubs for syscalls in dynamic libc
+SHARED_CFLAGS+= -D'_SYSCALL_BODY(name)='
SYM_MAPS+= ${LIBC_SRCTOP}/sys/Symbol.map
-# Generated files
-CLEANFILES+= ${SASM} ${SPSEUDO}
-
-.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" || \
- ${MACHINE_CPUARCH} == "powerpc" || ${MACHINE_ARCH:Marmv[67]*}
-NOTE_GNU_STACK='\t.section .note.GNU-stack,"",%%progbits\n'
-.else
-NOTE_GNU_STACK=''
-.endif
-
-${SASM}:
- printf '/* %sgenerated by libc/sys/Makefile.inc */\n' @ > ${.TARGET}
- printf '#include "compat.h"\n' >> ${.TARGET}
- printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' >> ${.TARGET}
- printf ${NOTE_GNU_STACK} >>${.TARGET}
-
-${SPSEUDO}:
- printf '/* %sgenerated by libc/sys/Makefile.inc */\n' @ > ${.TARGET}
- printf '#include "compat.h"\n' >> ${.TARGET}
- printf '#include "SYS.h"\nPSEUDO(${.PREFIX:S/_//})\n' \
- >> ${.TARGET}
- printf ${NOTE_GNU_STACK} >>${.TARGET}
-
-MAN+= abort2.2 \
- accept.2 \
- access.2 \
- acct.2 \
- adjtime.2 \
- aio_cancel.2 \
- aio_error.2 \
- aio_fsync.2 \
- aio_mlock.2 \
- aio_read.2 \
- aio_return.2 \
- aio_suspend.2 \
- aio_waitcomplete.2 \
- aio_write.2 \
- bind.2 \
- bindat.2 \
- brk.2 \
- cap_enter.2 \
- cap_fcntls_limit.2 \
- cap_ioctls_limit.2 \
- cap_rights_limit.2 \
- chdir.2 \
- chflags.2 \
- chmod.2 \
- chown.2 \
- chroot.2 \
- clock_gettime.2 \
- close.2 \
- closefrom.2 \
- connect.2 \
- connectat.2 \
- copy_file_range.2 \
- cpuset.2 \
- cpuset_getaffinity.2 \
- cpuset_getdomain.2 \
- dup.2 \
- eventfd.2 \
- execve.2 \
- _exit.2 \
- extattr_get_file.2 \
- fcntl.2 \
- ffclock.2 \
- fhlink.2 \
- fhopen.2 \
- fhreadlink.2 \
- flock.2 \
- fork.2 \
- fspacectl.2 \
- fsync.2 \
- getdirentries.2 \
- getdtablesize.2 \
- getfh.2 \
- getfsstat.2 \
- getgid.2 \
- getgroups.2 \
- getitimer.2 \
- getlogin.2 \
- getloginclass.2 \
- getpeername.2 \
- getpgrp.2 \
- getpid.2 \
- getpriority.2 \
- getrandom.2 \
- getrlimit.2 \
- getrusage.2 \
- getsid.2 \
- getsockname.2 \
- getsockopt.2 \
- gettimeofday.2 \
- getuid.2 \
- intro.2 \
- ioctl.2 \
- issetugid.2 \
- jail.2 \
- kenv.2 \
- kill.2 \
- kldfind.2 \
- kldfirstmod.2 \
- kldload.2 \
- kldnext.2 \
- kldstat.2 \
- kldsym.2 \
- kldunload.2 \
- kqueue.2 \
- ktrace.2 \
- link.2 \
- lio_listio.2 \
- listen.2 \
- lseek.2 \
- madvise.2 \
- mincore.2 \
- minherit.2 \
- mkdir.2 \
- mkfifo.2 \
- mknod.2 \
- mlock.2 \
- mlockall.2 \
- mmap.2 \
- modfind.2 \
- modnext.2 \
- modstat.2 \
- mount.2 \
- mprotect.2 \
- mq_close.2 \
- mq_getattr.2 \
- mq_notify.2 \
- mq_open.2 \
- mq_receive.2 \
- mq_send.2 \
- mq_setattr.2 \
- mq_unlink.2 \
- msgctl.2 \
- msgget.2 \
- msgrcv.2 \
- msgsnd.2 \
- msync.2 \
- munmap.2 \
- nanosleep.2 \
- nfssvc.2 \
- ntp_adjtime.2 \
- open.2 \
- pathconf.2 \
- pdfork.2 \
- pipe.2 \
- poll.2 \
- posix_fadvise.2 \
- posix_fallocate.2 \
- posix_openpt.2 \
- procctl.2 \
- profil.2 \
- pselect.2 \
- ptrace.2 \
- quotactl.2 \
- rctl_add_rule.2 \
- read.2 \
- readlink.2 \
- reboot.2 \
- recv.2 \
- rename.2 \
- revoke.2 \
- rfork.2 \
- rmdir.2 \
- rtprio.2
-.if !defined(NO_P1003_1B)
-MAN+= sched_get_priority_max.2 \
- sched_setparam.2 \
- sched_setscheduler.2 \
- sched_yield.2
-.endif
-MAN+= sctp_generic_recvmsg.2 \
- sctp_generic_sendmsg.2 \
- sctp_peeloff.2 \
- select.2 \
- semctl.2 \
- semget.2 \
- semop.2 \
- send.2 \
- setfib.2 \
- sendfile.2 \
- setgroups.2 \
- setpgid.2 \
- setregid.2 \
- setresuid.2 \
- setreuid.2 \
- setsid.2 \
- setuid.2 \
- shmat.2 \
- shmctl.2 \
- shmget.2 \
- shm_open.2 \
- shutdown.2 \
- sigaction.2 \
- sigaltstack.2 \
- sigfastblock.2 \
- sigpending.2 \
- sigprocmask.2 \
- sigqueue.2 \
- sigreturn.2 \
- sigstack.2 \
- sigsuspend.2 \
- sigwait.2 \
- sigwaitinfo.2 \
- socket.2 \
- socketpair.2 \
- stat.2 \
- statfs.2 \
- swapon.2 \
- symlink.2 \
- sync.2 \
- sysarch.2 \
- syscall.2 \
- thr_exit.2 \
- thr_kill.2 \
- thr_new.2 \
- thr_self.2 \
- thr_set_name.2 \
- thr_suspend.2 \
- thr_wake.2 \
- timer_create.2 \
- timer_delete.2 \
- timer_settime.2 \
- truncate.2 \
- umask.2 \
- undelete.2 \
- unlink.2 \
- utimensat.2 \
- utimes.2 \
- utrace.2 \
- uuidgen.2 \
- vfork.2 \
- wait.2 \
- write.2 \
- _umtx_op.2
+# Add the interposer wrappers
+SRCS+= ${INTERPOSED:S/$/.c/}
-MLINKS+=aio_read.2 aio_readv.2
-MLINKS+=aio_write.2 aio_writev.2
-MLINKS+=accept.2 accept4.2
-MLINKS+=access.2 eaccess.2 \
- access.2 faccessat.2
-MLINKS+=brk.2 sbrk.2
-MLINKS+=cap_enter.2 cap_getmode.2
-MLINKS+=cap_fcntls_limit.2 cap_fcntls_get.2
-MLINKS+=cap_ioctls_limit.2 cap_ioctls_get.2
-MLINKS+=chdir.2 fchdir.2
-MLINKS+=chflags.2 chflagsat.2 \
- chflags.2 fchflags.2 \
- chflags.2 lchflags.2
-MLINKS+=chmod.2 fchmod.2 \
- chmod.2 fchmodat.2 \
- chmod.2 lchmod.2
-MLINKS+=chown.2 fchown.2 \
- chown.2 fchownat.2 \
- chown.2 lchown.2
-MLINKS+=clock_gettime.2 clock_getres.2 \
- clock_gettime.2 clock_settime.2
-MLINKS+=closefrom.2 close_range.2
-MLINKS+=nanosleep.2 clock_nanosleep.2
-MLINKS+=cpuset.2 cpuset_getid.2 \
- cpuset.2 cpuset_setid.2
-MLINKS+=cpuset_getaffinity.2 cpuset_setaffinity.2
-MLINKS+=cpuset_getdomain.2 cpuset_setdomain.2
-MLINKS+=dup.2 dup2.2
-MLINKS+=eventfd.2 eventfd_read.3 \
- eventfd.2 eventfd_write.3
-MLINKS+=execve.2 fexecve.2
-MLINKS+=extattr_get_file.2 extattr.2 \
- extattr_get_file.2 extattr_delete_fd.2 \
- extattr_get_file.2 extattr_delete_file.2 \
- extattr_get_file.2 extattr_delete_link.2 \
- extattr_get_file.2 extattr_get_fd.2 \
- extattr_get_file.2 extattr_get_link.2 \
- extattr_get_file.2 extattr_list_fd.2 \
- extattr_get_file.2 extattr_list_file.2 \
- extattr_get_file.2 extattr_list_link.2 \
- extattr_get_file.2 extattr_set_fd.2 \
- extattr_get_file.2 extattr_set_file.2 \
- extattr_get_file.2 extattr_set_link.2
-MLINKS+=ffclock.2 ffclock_getcounter.2 \
- ffclock.2 ffclock_getestimate.2 \
- ffclock.2 ffclock_setestimate.2
-MLINKS+=fhlink.2 fhlinkat.2
-MLINKS+=fhopen.2 fhstat.2 fhopen.2 fhstatfs.2
-MLINKS+=fsync.2 fdatasync.2
-MLINKS+=getdirentries.2 getdents.2
-MLINKS+=getfh.2 lgetfh.2 \
- getfh.2 getfhat.2
-MLINKS+=getgid.2 getegid.2
-MLINKS+=getitimer.2 setitimer.2
-MLINKS+=getlogin.2 getlogin_r.3
-MLINKS+=getlogin.2 setlogin.2
-MLINKS+=getloginclass.2 setloginclass.2
-MLINKS+=getpgrp.2 getpgid.2
-MLINKS+=getpid.2 getppid.2
-MLINKS+=getpriority.2 setpriority.2
-MLINKS+=getrlimit.2 setrlimit.2
-MLINKS+=getsockopt.2 setsockopt.2
-MLINKS+=gettimeofday.2 settimeofday.2
-MLINKS+=getuid.2 geteuid.2
-MLINKS+=intro.2 errno.2
-MLINKS+=jail.2 jail_attach.2 \
- jail.2 jail_get.2 \
- jail.2 jail_remove.2 \
- jail.2 jail_set.2
-MLINKS+=kldunload.2 kldunloadf.2
-MLINKS+=kqueue.2 kevent.2 \
- kqueue.2 EV_SET.3
-MLINKS+=link.2 linkat.2
-MLINKS+=madvise.2 posix_madvise.2
-MLINKS+=mkdir.2 mkdirat.2
-MLINKS+=mkfifo.2 mkfifoat.2
-MLINKS+=mknod.2 mknodat.2
-MLINKS+=mlock.2 munlock.2
-MLINKS+=mlockall.2 munlockall.2
-MLINKS+=modnext.2 modfnext.2
-MLINKS+=mount.2 nmount.2 \
- mount.2 unmount.2
-MLINKS+=mq_receive.2 mq_timedreceive.2
-MLINKS+=mq_send.2 mq_timedsend.2
-MLINKS+=ntp_adjtime.2 ntp_gettime.2
-MLINKS+=open.2 openat.2
-MLINKS+=pathconf.2 fpathconf.2
-MLINKS+=pathconf.2 lpathconf.2
-MLINKS+=pdfork.2 pdgetpid.2\
- pdfork.2 pdkill.2
-MLINKS+=pipe.2 pipe2.2
-MLINKS+=poll.2 ppoll.2
-MLINKS+=rctl_add_rule.2 rctl_get_limits.2 \
- rctl_add_rule.2 rctl_get_racct.2 \
- rctl_add_rule.2 rctl_get_rules.2 \
- rctl_add_rule.2 rctl_remove_rule.2
-MLINKS+=read.2 pread.2 \
- read.2 preadv.2 \
- read.2 readv.2
-MLINKS+=readlink.2 readlinkat.2
-MLINKS+=recv.2 recvfrom.2 \
- recv.2 recvmsg.2
-MLINKS+=rename.2 renameat.2
-MLINKS+=rtprio.2 rtprio_thread.2
-.if !defined(NO_P1003_1B)
-MLINKS+=sched_get_priority_max.2 sched_get_priority_min.2 \
- sched_get_priority_max.2 sched_rr_get_interval.2
-MLINKS+=sched_setparam.2 sched_getparam.2
-MLINKS+=sched_setscheduler.2 sched_getscheduler.2
-.endif
-MLINKS+=select.2 FD_CLR.3 \
- select.2 FD_ISSET.3 \
- select.2 FD_SET.3 \
- select.2 FD_ZERO.3
-MLINKS+=send.2 sendmsg.2 \
- send.2 sendto.2
-MLINKS+=setpgid.2 setpgrp.2
-MLINKS+=setresuid.2 getresgid.2 \
- setresuid.2 getresuid.2 \
- setresuid.2 setresgid.2
-MLINKS+=setuid.2 setegid.2 \
- setuid.2 seteuid.2 \
- setuid.2 setgid.2
-MLINKS+=shmat.2 shmdt.2
-MLINKS+=shm_open.2 memfd_create.3 \
- shm_open.2 shm_unlink.2 \
- shm_open.2 shm_rename.2
-MLINKS+=sigwaitinfo.2 sigtimedwait.2
-MLINKS+=stat.2 fstat.2 \
- stat.2 fstatat.2 \
- stat.2 lstat.2
-MLINKS+=statfs.2 fstatfs.2
-MLINKS+=swapon.2 swapoff.2
-MLINKS+=symlink.2 symlinkat.2
-MLINKS+=syscall.2 __syscall.2
-MLINKS+=timer_settime.2 timer_getoverrun.2 \
- timer_settime.2 timer_gettime.2
-MLINKS+=thr_kill.2 thr_kill2.2
-MLINKS+=truncate.2 ftruncate.2
-MLINKS+=unlink.2 unlinkat.2
-MLINKS+=unlink.2 funlinkat.2
-MLINKS+=utimensat.2 futimens.2
-MLINKS+=utimes.2 futimes.2 \
- utimes.2 futimesat.2 \
- utimes.2 lutimes.2
-MLINKS+=wait.2 wait3.2 \
- wait.2 wait4.2 \
- wait.2 waitpid.2 \
- wait.2 waitid.2 \
- wait.2 wait6.2
-MLINKS+=write.2 pwrite.2 \
- write.2 pwritev.2 \
- write.2 writev.2
+# Pseudo system calls implemented atop other interfaces.
+SRCS+= \
+ POSIX2x_Fork.c \
+ brk.c \
+ closefrom.c \
+ compat-stub.c \
+ creat.c \
+ getdents.c \
+ lockf.c \
+ lstat.c \
+ mknod.c \
+ pipe.c \
+ recv.c \
+ recvmmsg.c \
+ send.c \
+ sendmmsg.c \
+ shm_open.c \
+ stat.c \
+ vadvise.c \
+ wait.c \
+ wait3.c \
+ waitid.c \
+ waitpid.c
diff --git a/lib/libc/sys/POSIX2x_Fork.c b/lib/libc/sys/POSIX2x_Fork.c
index a7aaf82429bb..766bd4000036 100644
--- a/lib/libc/sys/POSIX2x_Fork.c
+++ b/lib/libc/sys/POSIX2x_Fork.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2021 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <unistd.h>
#include "libc_private.h"
diff --git a/lib/libc/sys/Symbol.map b/lib/libc/sys/Symbol.map
index a70d14b51f7c..32b1b0ecee05 100644
--- a/lib/libc/sys/Symbol.map
+++ b/lib/libc/sys/Symbol.map
@@ -1,378 +1,53 @@
-/*
- * $FreeBSD$
- */
-
-/*
- * It'd be nice to automatically generate the syscall symbols, but we
- * don't know to what version they will eventually belong to, so for now
- * it has to be manual.
- */
FBSD_1.0 {
- __acl_aclcheck_fd;
- __acl_aclcheck_file;
- __acl_aclcheck_link;
- __acl_delete_fd;
- __acl_delete_file;
- __acl_delete_link;
- __acl_get_fd;
- __acl_get_file;
- __acl_get_link;
- __acl_set_fd;
- __acl_set_file;
- __acl_set_link;
- __getcwd;
- __mac_execve;
- __mac_get_fd;
- __mac_get_file;
- __mac_get_link;
- __mac_get_pid;
- __mac_get_proc;
- __mac_set_fd;
- __mac_set_file;
- __mac_set_link;
- __mac_set_proc;
- __setugid;
- __syscall;
- __sysctl;
- _umtx_op;
- abort2;
accept;
- access;
- acct;
- adjtime;
- aio_cancel;
- aio_error;
- aio_fsync;
- aio_read;
- aio_return;
aio_suspend;
- aio_waitcomplete;
- aio_write;
- audit;
- auditctl;
- auditon;
- bind;
- chdir;
- chflags;
- chmod;
- chown;
- chroot;
- clock_getres;
- clock_gettime;
- clock_settime;
close;
connect;
- dup;
- dup2;
- eaccess;
- execve;
- extattr_delete_fd;
- extattr_delete_file;
- extattr_delete_link;
- extattr_get_fd;
- extattr_get_file;
- extattr_get_link;
- extattr_list_fd;
- extattr_list_file;
- extattr_list_link;
- extattr_set_fd;
- extattr_set_file;
- extattr_set_link;
- extattrctl;
- fchdir;
- fchflags;
- fchmod;
- fchown;
fcntl;
- fhopen;
- flock;
fork;
- fpathconf;
fsync;
- futimes;
- getaudit;
- getaudit_addr;
- getauid;
- getcontext;
- getdtablesize;
- getegid;
- geteuid;
- getfh;
- getgid;
- getgroups;
- getitimer;
- getpeername;
- getpgid;
- getpgrp;
- getpid;
- getppid;
- getpriority;
- getresgid;
- getresuid;
- getrlimit;
- getrusage;
- getsid;
- getsockname;
- getsockopt;
- gettimeofday;
- getuid;
- ioctl;
- issetugid;
- jail;
- jail_attach;
- kenv;
- kill;
- kldfind;
- kldfirstmod;
- kldload;
- kldnext;
- kldstat;
- kldsym;
- kldunload;
- kldunloadf;
- kqueue;
- kmq_notify; /* Do we want these to be public interfaces? */
- kmq_open; /* librt uses them to provide mq_xxx. */
- kmq_setattr;
- kmq_timedreceive;
- kmq_timedsend;
- kmq_unlink;
- ksem_close;
- ksem_destroy;
- ksem_getvalue;
- ksem_init;
- ksem_open;
- ksem_post;
- ksem_timedwait;
- ksem_trywait;
- ksem_unlink;
- ksem_wait;
- ktrace;
- lchflags;
- lchmod;
- lchown;
- lgetfh;
- link;
- lio_listio;
- listen;
- lutimes;
- mac_syscall;
- madvise;
- mincore;
- minherit;
- mkdir;
- mkfifo;
- mlock;
- mlockall;
- modfind;
- modfnext;
- modnext;
- modstat;
- mount;
- mprotect;
- msgget;
- msgrcv;
- msgsnd;
- msgsys;
msync;
- munlock;
- munlockall;
- munmap;
nanosleep;
- nfssvc;
- nmount;
- ntp_adjtime;
- ntp_gettime;
open;
- pathconf;
pipe;
poll;
- posix_openpt;
- preadv;
- profil;
pselect;
ptrace;
- pwritev;
- quotactl;
read;
- readlink;
readv;
- reboot;
recvfrom;
recvmsg;
- rename;
- revoke;
- rfork;
- rmdir;
- rtprio;
- rtprio_thread;
- sched_get_priority_max;
- sched_get_priority_min;
- sched_getparam;
- sched_getscheduler;
- sched_rr_get_interval;
- sched_setparam;
- sched_setscheduler;
- sched_yield;
select;
- semget;
- semop;
- semsys;
- sendfile;
sendmsg;
sendto;
- setaudit;
- setaudit_addr;
- setauid;
- setegid;
- seteuid;
- setgid;
- setgroups;
- setitimer;
- setlogin;
- setpgid;
- setpriority;
- setregid;
- setresgid;
- setresuid;
- setreuid;
- setrlimit;
- setsid;
- setsockopt;
- settimeofday;
- setuid;
shm_open;
- shm_unlink;
- shmat;
- shmdt;
- shmget;
- shmsys;
- shutdown;
sigaction;
- sigaltstack;
- sigpending;
sigprocmask;
- sigqueue;
- sigreturn;
sigsuspend;
sigtimedwait;
sigwait;
sigwaitinfo;
- socket;
- socketpair;
- swapoff;
- swapon;
- symlink;
- sync;
- sysarch;
- syscall;
- thr_create;
- thr_exit;
- thr_kill;
- thr_kill2;
- thr_new;
- thr_self;
- thr_set_name;
- thr_suspend;
- thr_wake;
- ktimer_create; /* Do we want these to be public interfaces? */
- ktimer_delete; /* librt uses them to provide timer_xxx. */
- ktimer_getoverrun;
- ktimer_gettime;
- ktimer_settime;
- umask;
- undelete;
- unlink;
- unmount;
- utimes;
- utrace;
- uuidgen;
vadvise;
wait4;
write;
writev;
-
- __error;
- ftruncate;
- lseek;
- mmap;
- pread;
- pwrite;
- truncate;
};
FBSD_1.1 {
- __semctl;
closefrom;
- cpuset;
- cpuset_getid;
- cpuset_setid;
- cpuset_getaffinity;
- cpuset_setaffinity;
- faccessat;
- fchmodat;
- fchownat;
- fexecve;
- futimesat;
- jail_get;
- jail_set;
- jail_remove;
- linkat;
- lpathconf;
- mkdirat;
- mkfifoat;
- msgctl;
- readlinkat;
- renameat;
- setfib;
- shmctl;
- symlinkat;
- unlinkat;
};
FBSD_1.2 {
- cap_enter;
- cap_getmode;
- getloginclass;
pdfork;
- pdgetpid;
- pdkill;
- posix_fallocate;
- rctl_get_racct;
- rctl_get_rules;
- rctl_get_limits;
- rctl_add_rule;
- rctl_remove_rule;
- setloginclass;
};
FBSD_1.3 {
accept4;
- aio_mlock;
- bindat;
- cap_fcntls_get;
- cap_fcntls_limit;
- cap_ioctls_get;
- cap_ioctls_limit;
- __cap_rights_get;
- cap_rights_limit;
- cap_sandboxed;
- chflagsat;
- clock_getcpuclockid2;
- connectat;
- ffclock_getcounter;
- ffclock_getestimate;
- ffclock_setestimate;
- pipe2;
- posix_fadvise;
- procctl;
wait6;
};
FBSD_1.4 {
- futimens;
ppoll;
- utimensat;
numa_setaffinity;
numa_getaffinity;
sendmmsg;
@@ -382,670 +57,17 @@ FBSD_1.4 {
FBSD_1.5 {
clock_nanosleep;
fdatasync;
- fhstat;
- fhstatfs;
- fstat;
- fstatat;
- fstatfs;
getdents;
- getdirentries;
- getfsstat;
- getrandom;
kevent;
lstat;
mknod;
- mknodat;
stat;
- statfs;
- cpuset_getdomain;
- cpuset_setdomain;
};
FBSD_1.6 {
- __sysctlbyname;
- aio_readv;
- aio_writev;
- close_range;
- copy_file_range;
- fhlink;
- fhlinkat;
- fhreadlink;
- getfhat;
- funlinkat;
- memfd_create;
shm_create_largepage;
- shm_rename;
};
FBSD_1.7 {
_Fork;
- fspacectl;
-};
-
-FBSDprivate_1.0 {
- ___acl_aclcheck_fd;
- __sys___acl_aclcheck_fd;
- ___acl_aclcheck_file;
- __sys___acl_aclcheck_file;
- ___acl_aclcheck_link;
- __sys___acl_aclcheck_link;
- ___acl_delete_fd;
- __sys___acl_delete_fd;
- ___acl_delete_file;
- __sys___acl_delete_file;
- ___acl_delete_link;
- __sys___acl_delete_link;
- ___acl_get_fd;
- __sys___acl_get_fd;
- ___acl_get_file;
- __sys___acl_get_file;
- ___acl_get_link;
- __sys___acl_get_link;
- ___acl_set_fd;
- __sys___acl_set_fd;
- ___acl_set_file;
- __sys___acl_set_file;
- ___acl_set_link;
- __sys___acl_set_link;
- ___getcwd;
- __sys___getcwd;
- ___mac_execve;
- __sys___mac_execve;
- ___mac_get_fd;
- __sys___mac_get_fd;
- ___mac_get_file;
- __sys___mac_get_file;
- ___mac_get_link;
- __sys___mac_get_link;
- ___mac_get_pid;
- __sys___mac_get_pid;
- ___mac_get_proc;
- __sys___mac_get_proc;
- ___mac_set_fd;
- __sys___mac_set_fd;
- ___mac_set_file;
- __sys___mac_set_file;
- ___mac_set_link;
- __sys___mac_set_link;
- ___mac_set_proc;
- __sys___mac_set_proc;
- ___semctl;
- __sys___semctl;
- ___setugid;
- __sys___setugid;
- ___syscall;
- __sys___syscall;
- ___sysctl;
- __sys___sysctl;
- __umtx_op;
- __sys__umtx_op;
- _abort2;
- __sys_abort2;
- _accept;
- __sys_accept;
- _accept4;
- __sys_accept4;
- _access;
- __sys_access;
- _acct;
- __sys_acct;
- _adjtime;
- __sys_adjtime;
- __sys_aio_cancel;
- __sys_aio_error;
- __sys_aio_fsync;
- __sys_aio_read;
- __sys_aio_readv;
- __sys_aio_return;
- __sys_aio_suspend;
- __sys_aio_waitcomplete;
- __sys_aio_write;
- __sys_aio_writev;
- _audit;
- __sys_audit;
- _auditctl;
- __sys_auditctl;
- _auditon;
- __sys_auditon;
- _bind;
- __sys_bind;
- _chdir;
- __sys_chdir;
- _chflags;
- __sys_chflags;
- _chmod;
- __sys_chmod;
- _chown;
- __sys_chown;
- _chroot;
- __sys_chroot;
- _clock_getcpuclockid2;
- __sys_clock_getcpuclockid2;
- _clock_getres;
- __sys_clock_getres;
- _clock_gettime;
- __sys_clock_gettime;
- __sys_clock_nanosleep;
- _clock_settime;
- __sys_clock_settime;
- _close;
- __sys_close;
- _connect;
- __sys_connect;
- _cpuset;
- __sys_cpuset;
- _cpuset_getid;
- __sys_cpuset_getid;
- _cpuset_setid;
- __sys_cpuset_setid;
- _cpuset_getaffinity;
- __sys_cpuset_getaffinity;
- _cpuset_setaffinity;
- __sys_cpuset_setaffinity;
- _dup;
- __sys_dup;
- _dup2;
- __sys_dup2;
- _eaccess;
- __sys_eaccess;
- _execve;
- __sys_execve;
- _extattr_delete_fd;
- __sys_extattr_delete_fd;
- _extattr_delete_file;
- __sys_extattr_delete_file;
- _extattr_delete_link;
- __sys_extattr_delete_link;
- _extattr_get_fd;
- __sys_extattr_get_fd;
- _extattr_get_file;
- __sys_extattr_get_file;
- _extattr_get_link;
- __sys_extattr_get_link;
- _extattr_list_fd;
- __sys_extattr_list_fd;
- _extattr_list_file;
- __sys_extattr_list_file;
- _extattr_list_link;
- __sys_extattr_list_link;
- _extattr_set_fd;
- __sys_extattr_set_fd;
- _extattr_set_file;
- __sys_extattr_set_file;
- _extattr_set_link;
- __sys_extattr_set_link;
- _extattrctl;
- __sys_extattrctl;
- __sys_sigfastblock;
- _fchdir;
- __sys_fchdir;
- _fchflags;
- __sys_fchflags;
- _fchmod;
- __sys_fchmod;
- _fchown;
- __sys_fchown;
- _fcntl;
- __sys_fcntl;
- __fcntl_compat;
- _fhopen;
- __sys_fhopen;
- _fhstat;
- __sys_fhstat;
- _fhstatfs;
- __sys_fhstatfs;
- _flock;
- __sys_flock;
- _fork;
- __sys_fork;
- _fpathconf;
- __sys_fpathconf;
- _fstat;
- __sys_fstat;
- _fstatfs;
- __sys_fstatfs;
- _fsync;
- __sys_fsync;
- _fdatasync;
- __sys_fdatasync;
- _futimes;
- __sys_futimes;
- _getaudit;
- __sys_getaudit;
- _getaudit_addr;
- __sys_getaudit_addr;
- _getauid;
- __sys_getauid;
- _getcontext;
- __sys_getcontext;
- _getdirentries;
- __sys_getdirentries;
- _getdtablesize;
- __sys_getdtablesize;
- _getegid;
- __sys_getegid;
- _geteuid;
- __sys_geteuid;
- _getfh;
- __sys_getfh;
- _getfsstat;
- __sys_getfsstat;
- _getgid;
- __sys_getgid;
- _getgroups;
- __sys_getgroups;
- _getitimer;
- __sys_getitimer;
- _getpeername;
- __sys_getpeername;
- _getpgid;
- __sys_getpgid;
- _getpgrp;
- __sys_getpgrp;
- _getpid;
- __sys_getpid;
- _getppid;
- __sys_getppid;
- _getpriority;
- __sys_getpriority;
- _getresgid;
- __sys_getresgid;
- _getresuid;
- __sys_getresuid;
- _getrlimit;
- __sys_getrlimit;
- _getrusage;
- __sys_getrusage;
- _getsid;
- __sys_getsid;
- _getsockname;
- __sys_getsockname;
- _getsockopt;
- __sys_getsockopt;
- _gettimeofday;
- __sys_gettimeofday;
- _getuid;
- __sys_getuid;
- _ioctl;
- __sys_ioctl;
- _issetugid;
- __sys_issetugid;
- _jail;
- __sys_jail;
- _jail_attach;
- __sys_jail_attach;
- _kenv;
- __sys_kenv;
- _kevent;
- __sys_kevent;
- _kill;
- __sys_kill;
- _kldfind;
- __sys_kldfind;
- _kldfirstmod;
- __sys_kldfirstmod;
- _kldload;
- __sys_kldload;
- _kldnext;
- __sys_kldnext;
- _kldstat;
- __sys_kldstat;
- _kldsym;
- __sys_kldsym;
- _kldunload;
- __sys_kldunload;
- _kldunloadf;
- __sys_kldunloadf;
- _kmq_notify;
- __sys_kmq_notify;
- _kmq_open;
- __sys_kmq_open;
- _kmq_setattr;
- __sys_kmq_setattr;
- _kmq_timedreceive;
- __sys_kmq_timedreceive;
- _kmq_timedsend;
- __sys_kmq_timedsend;
- _kmq_unlink;
- __sys_kmq_unlink;
- _kqueue;
- __sys_kqueue;
- _ksem_close;
- __sys_ksem_close;
- _ksem_destroy;
- __sys_ksem_destroy;
- _ksem_getvalue;
- __sys_ksem_getvalue;
- _ksem_init;
- __sys_ksem_init;
- _ksem_open;
- __sys_ksem_open;
- _ksem_post;
- __sys_ksem_post;
- _ksem_timedwait;
- __sys_ksem_timedwait;
- _ksem_trywait;
- __sys_ksem_trywait;
- _ksem_unlink;
- __sys_ksem_unlink;
- _ksem_wait;
- __sys_ksem_wait;
- _ktrace;
- __sys_ktrace;
- _lchflags;
- __sys_lchflags;
- _lchmod;
- __sys_lchmod;
- _lchown;
- __sys_lchown;
- _lgetfh;
- __sys_lgetfh;
- _link;
- __sys_link;
- __sys_lio_listio;
- _listen;
- __sys_listen;
- _lutimes;
- __sys_lutimes;
- _mac_syscall;
- __sys_mac_syscall;
- _madvise;
- __sys_madvise;
- _mincore;
- __sys_mincore;
- _minherit;
- __sys_minherit;
- _mkdir;
- __sys_mkdir;
- _mkfifo;
- __sys_mkfifo;
- _mknod;
- __sys_mknod;
- _mlock;
- __sys_mlock;
- _mlockall;
- __sys_mlockall;
- _mmap;
- __sys_mmap;
- _modfind;
- __sys_modfind;
- _modfnext;
- __sys_modfnext;
- _modnext;
- __sys_modnext;
- _modstat;
- __sys_modstat;
- _mount;
- __sys_mount;
- _mprotect;
- __sys_mprotect;
- _msgctl;
- __sys_msgctl;
- _msgget;
- __sys_msgget;
- _msgrcv;
- __sys_msgrcv;
- _msgsnd;
- __sys_msgsnd;
- _msgsys;
- __sys_msgsys;
- _msync;
- __sys_msync;
- _munlock;
- __sys_munlock;
- _munlockall;
- __sys_munlockall;
- _munmap;
- __sys_munmap;
- _nanosleep;
- __sys_nanosleep;
- _nfssvc;
- __sys_nfssvc;
- _nmount;
- __sys_nmount;
- _ntp_adjtime;
- __sys_ntp_adjtime;
- _ntp_gettime;
- __sys_ntp_gettime;
- _open;
- __sys_open;
- _openat;
- __sys_openat;
- _pathconf;
- __sys_pathconf;
- __sys_pdfork;
- _pipe;
- __sys_pipe;
- _poll;
- __sys_poll;
- _ppoll;
- __sys_ppoll;
- _preadv;
- __sys_preadv;
- _procctl;
- __sys_procctl;
- _profil;
- __sys_profil;
- _pselect;
- __sys_pselect;
- _ptrace;
- __sys_ptrace;
- _pwritev;
- __sys_pwritev;
- _quotactl;
- __sys_quotactl;
- _read;
- __sys_read;
- _readlink;
- __sys_readlink;
- _readv;
- __sys_readv;
- _reboot;
- __sys_reboot;
- _recvfrom;
- __sys_recvfrom;
- _recvmsg;
- __sys_recvmsg;
- _rename;
- __sys_rename;
- _revoke;
- __sys_revoke;
- _rfork;
- __sys_rfork;
- _rmdir;
- __sys_rmdir;
- _rtprio;
- __sys_rtprio;
- _rtprio_thread;
- __sys_rtprio_thread;
- _sched_get_priority_max;
- __sys_sched_get_priority_max;
- _sched_get_priority_min;
- __sys_sched_get_priority_min;
- _sched_getparam;
- __sys_sched_getparam;
- _sched_getscheduler;
- __sys_sched_getscheduler;
- _sched_rr_get_interval;
- __sys_sched_rr_get_interval;
- _sched_setparam;
- __sys_sched_setparam;
- _sched_setscheduler;
- __sys_sched_setscheduler;
- _sched_yield;
- __sys_sched_yield;
- _select;
- __sys_select;
- _semget;
- __sys_semget;
- _semop;
- __sys_semop;
- _semsys;
- __sys_semsys;
- _sendfile;
- __sys_sendfile;
- _sendmsg;
- __sys_sendmsg;
- _sendto;
- __sys_sendto;
- _setaudit;
- __sys_setaudit;
- _setaudit_addr;
- __sys_setaudit_addr;
- _setauid;
- __sys_setauid;
- _setcontext;
- __sys_setcontext;
- _setegid;
- __sys_setegid;
- _seteuid;
- __sys_seteuid;
- _setgid;
- __sys_setgid;
- _setgroups;
- __sys_setgroups;
- _setitimer;
- __sys_setitimer;
- _setlogin;
- __sys_setlogin;
- _setpgid;
- __sys_setpgid;
- _setpriority;
- __sys_setpriority;
- _setregid;
- __sys_setregid;
- _setresgid;
- __sys_setresgid;
- _setresuid;
- __sys_setresuid;
- _setreuid;
- __sys_setreuid;
- _setrlimit;
- __sys_setrlimit;
- _setsid;
- __sys_setsid;
- _setsockopt;
- __sys_setsockopt;
- _settimeofday;
- __sys_settimeofday;
- _setuid;
- __sys_setuid;
- _shm_open;
- __sys_shm_open;
- __sys_shm_open2;
- _shm_unlink;
- __sys_shm_unlink;
- _shmat;
- __sys_shmat;
- _shmctl;
- __sys_shmctl;
- _shmdt;
- __sys_shmdt;
- _shmget;
- __sys_shmget;
- _shmsys;
- __sys_shmsys;
- _shutdown;
- __sys_shutdown;
- _sigaction;
- __sys_sigaction;
- _sigaltstack;
- __sys_sigaltstack;
- _sigpending;
- __sys_sigpending;
- _sigprocmask;
- __sys_sigprocmask;
- _sigqueue;
- __sys_sigqueue;
- _sigreturn;
- __sys_sigreturn;
- _sigsuspend;
- __sys_sigsuspend;
- _sigtimedwait;
- __sys_sigtimedwait;
- _sigwait;
- __sigwait;
- __sys_sigwait;
- _sigwaitinfo;
- __sys_sigwaitinfo;
- _socket;
- __sys_socket;
- _socketpair;
- __sys_socketpair;
- _statfs;
- __sys_statfs;
- _swapcontext;
- __sys_swapcontext;
- _swapoff;
- __sys_swapoff;
- _swapon;
- __sys_swapon;
- _symlink;
- __sys_symlink;
- _sync;
- __sys_sync;
- _sysarch;
- __sys_sysarch;
- _syscall;
- __sys_syscall;
- _thr_create;
- __sys_thr_create;
- _thr_exit;
- __sys_thr_exit;
- _thr_kill;
- __sys_thr_kill;
- _thr_kill2;
- __sys_thr_kill2;
- _thr_new;
- __sys_thr_new;
- _thr_self;
- __sys_thr_self;
- _thr_set_name;
- __sys_thr_set_name;
- _thr_suspend;
- __sys_thr_suspend;
- _thr_wake;
- __sys_thr_wake;
- _ktimer_create;
- __sys_ktimer_create;
- _ktimer_delete;
- __sys_ktimer_delete;
- _ktimer_getoverrun;
- __sys_ktimer_getoverrun;
- _ktimer_gettime;
- __sys_ktimer_gettime;
- _ktimer_settime;
- __sys_ktimer_settime;
- _umask;
- __sys_umask;
- _undelete;
- __sys_undelete;
- _unlink;
- __sys_unlink;
- _unmount;
- __sys_unmount;
- _utimes;
- __sys_utimes;
- _utrace;
- __sys_utrace;
- _uuidgen;
- __sys_uuidgen;
- _wait4;
- __sys_wait4;
- _wait6;
- __sys_wait6;
- _write;
- __sys_write;
- _writev;
- __sys_writev;
- __set_error_selector;
- nlm_syscall;
- gssd_syscall;
- __libc_interposing_slot;
- __libc_sigwait;
- _cpuset_getdomain;
- __sys_cpuset_getdomain;
- _cpuset_setdomain;
- __sys_cpuset_setdomain;
- rpctls_syscall;
};
diff --git a/lib/libc/sys/__error.c b/lib/libc/sys/__error.c
deleted file mode 100644
index ff73a6a16fb5..000000000000
--- a/lib/libc/sys/__error.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-3-Clause
- *
- * Copyright (c) 1997 John Birrell <jb@cimlogic.com.au>.
- * All rights reserved.
- *
- * 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.
- * 3. Neither the name of the author nor the names of any co-contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL 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 REGENTS 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "libc_private.h"
-
-extern int errno;
-
-static int *
-__error_unthreaded(void)
-{
-
- return (&errno);
-}
-
-static int *(*__error_selector)(void) = __error_unthreaded;
-
-void
-__set_error_selector(int *(*arg)(void))
-{
-
- __error_selector = arg;
-}
-
-int *
-__error(void)
-{
-
- return (__error_selector());
-}
diff --git a/lib/libc/sys/__vdso_gettimeofday.c b/lib/libc/sys/__vdso_gettimeofday.c
deleted file mode 100644
index c1457a54d37e..000000000000
--- a/lib/libc/sys/__vdso_gettimeofday.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 2012 Konstantin Belousov <kib@FreeBSD.org>
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/elf.h>
-#include <sys/time.h>
-#include <sys/vdso.h>
-#include <errno.h>
-#include <stdbool.h>
-#include <strings.h>
-#include <time.h>
-#include <machine/atomic.h>
-#include "libc_private.h"
-
-static int
-tc_delta(const struct vdso_timehands *th, u_int *delta)
-{
- int error;
- u_int tc;
-
- error = __vdso_gettc(th, &tc);
- if (error == 0)
- *delta = (tc - th->th_offset_count) & th->th_counter_mask;
- return (error);
-}
-
-/*
- * Calculate the absolute or boot-relative time from the
- * machine-specific fast timecounter and the published timehands
- * structure read from the shared page.
- *
- * The lockless reading scheme is similar to the one used to read the
- * in-kernel timehands, see sys/kern/kern_tc.c:binuptime(). This code
- * is based on the kernel implementation.
- */
-static int
-binuptime(struct bintime *bt, struct vdso_timekeep *tk, bool abs)
-{
- struct vdso_timehands *th;
- uint32_t curr, gen;
- uint64_t scale, x;
- u_int delta, scale_bits;
- int error;
-
- do {
- if (!tk->tk_enabled)
- return (ENOSYS);
-
- curr = atomic_load_acq_32(&tk->tk_current);
- th = &tk->tk_th[curr];
- gen = atomic_load_acq_32(&th->th_gen);
- *bt = th->th_offset;
- error = tc_delta(th, &delta);
- if (error == EAGAIN)
- continue;
- if (error != 0)
- return (error);
- scale = th->th_scale;
-#ifdef _LP64
- scale_bits = ffsl(scale);
-#else
- scale_bits = ffsll(scale);
-#endif
- if (__predict_false(scale_bits + fls(delta) > 63)) {
- x = (scale >> 32) * delta;
- scale &= 0xffffffff;
- bt->sec += x >> 32;
- bintime_addx(bt, x << 32);
- }
- bintime_addx(bt, scale * delta);
- if (abs)
- bintime_add(bt, &th->th_boottime);
-
- /*
- * Ensure that the load of th_offset is completed
- * before the load of th_gen.
- */
- atomic_thread_fence_acq();
- } while (curr != tk->tk_current || gen == 0 || gen != th->th_gen);
- return (0);
-}
-
-static int
-getnanouptime(struct bintime *bt, struct vdso_timekeep *tk)
-{
- struct vdso_timehands *th;
- uint32_t curr, gen;
-
- do {
- if (!tk->tk_enabled)
- return (ENOSYS);
-
- curr = atomic_load_acq_32(&tk->tk_current);
- th = &tk->tk_th[curr];
- gen = atomic_load_acq_32(&th->th_gen);
- *bt = th->th_offset;
-
- /*
- * Ensure that the load of th_offset is completed
- * before the load of th_gen.
- */
- atomic_thread_fence_acq();
- } while (curr != tk->tk_current || gen == 0 || gen != th->th_gen);
- return (0);
-}
-
-static struct vdso_timekeep *tk;
-
-#pragma weak __vdso_gettimeofday
-int
-__vdso_gettimeofday(struct timeval *tv, struct timezone *tz)
-{
- struct bintime bt;
- int error;
-
- if (tz != NULL)
- return (ENOSYS);
- if (tk == NULL) {
- error = __vdso_gettimekeep(&tk);
- if (error != 0 || tk == NULL)
- return (ENOSYS);
- }
- if (tk->tk_ver != VDSO_TK_VER_CURR)
- return (ENOSYS);
- error = binuptime(&bt, tk, true);
- if (error != 0)
- return (error);
- bintime2timeval(&bt, tv);
- return (0);
-}
-
-#pragma weak __vdso_clock_gettime
-int
-__vdso_clock_gettime(clockid_t clock_id, struct timespec *ts)
-{
- struct bintime bt;
- int error;
-
- if (tk == NULL) {
- error = _elf_aux_info(AT_TIMEKEEP, &tk, sizeof(tk));
- if (error != 0 || tk == NULL)
- return (ENOSYS);
- }
- if (tk->tk_ver != VDSO_TK_VER_CURR)
- return (ENOSYS);
- switch (clock_id) {
- case CLOCK_REALTIME:
- case CLOCK_REALTIME_PRECISE:
- case CLOCK_REALTIME_FAST:
- case CLOCK_SECOND:
- error = binuptime(&bt, tk, true);
- break;
- case CLOCK_MONOTONIC:
- case CLOCK_MONOTONIC_PRECISE:
- case CLOCK_UPTIME:
- case CLOCK_UPTIME_PRECISE:
- error = binuptime(&bt, tk, false);
- break;
- case CLOCK_MONOTONIC_FAST:
- case CLOCK_UPTIME_FAST:
- error = getnanouptime(&bt, tk);
- break;
- default:
- error = ENOSYS;
- break;
- }
- if (error != 0)
- return (error);
- bintime2timespec(&bt, ts);
- if (clock_id == CLOCK_SECOND)
- ts->tv_nsec = 0;
- return (0);
-}
diff --git a/lib/libc/sys/_exit.2 b/lib/libc/sys/_exit.2
deleted file mode 100644
index 037549cc8c07..000000000000
--- a/lib/libc/sys/_exit.2
+++ /dev/null
@@ -1,125 +0,0 @@
-.\" Copyright (c) 1980, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)_exit.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd September 8, 2016
-.Dt EXIT 2
-.Os
-.Sh NAME
-.Nm _exit
-.Nd terminate the calling process
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft void
-.Fn _exit "int status"
-.Sh DESCRIPTION
-The
-.Fn _exit
-system call
-terminates a process with the following consequences:
-.Bl -bullet
-.It
-All of the descriptors open in the calling process are closed.
-This may entail delays, for example, waiting for output to drain;
-a process in this state may not be killed, as it is already dying.
-.It
-If the parent process of the calling process has an outstanding
-.Xr wait 2
-call
-or catches the
-.Dv SIGCHLD
-signal,
-it is notified of the calling process's termination and
-the
-.Fa status
-is set as defined by
-.Xr wait 2 .
-.It
-The parent process-ID of all of the calling process's existing child
-processes are set to the process-ID of the calling process's reaper;
-the reaper (normally the initialization process)
-inherits each of these processes
-(see
-.Xr procctl 2 ,
-.Xr init 8
-and the
-.Sx DEFINITIONS
-section of
-.Xr intro 2 ) .
-.It
-If the termination of the process causes any process group
-to become orphaned (usually because the parents of all members
-of the group have now exited; see
-.Dq orphaned process group
-in
-.Xr intro 2 ) ,
-and if any member of the orphaned group is stopped,
-the
-.Dv SIGHUP
-signal and the
-.Dv SIGCONT
-signal are sent to all members of the newly-orphaned process group.
-.It
-If the process is a controlling process (see
-.Xr intro 2 ) ,
-the
-.Dv SIGHUP
-signal is sent to the foreground process group of the controlling terminal,
-and all current access to the controlling terminal is revoked.
-.El
-.Pp
-Most C programs call the library routine
-.Xr exit 3 ,
-which flushes buffers, closes streams, unlinks temporary files, etc.,
-before
-calling
-.Fn _exit .
-.Sh RETURN VALUES
-The
-.Fn _exit
-system call
-can never return.
-.Sh SEE ALSO
-.Xr fork 2 ,
-.Xr sigaction 2 ,
-.Xr wait 2 ,
-.Xr exit 3 ,
-.Xr init 8
-.Sh STANDARDS
-The
-.Fn _exit
-system call is expected to conform to
-.St -p1003.1-90 .
-.Sh HISTORY
-The
-.Fn _exit
-function appeared in
-.At v7 .
diff --git a/lib/libc/sys/_umtx_op.2 b/lib/libc/sys/_umtx_op.2
deleted file mode 100644
index ecd46b7d0247..000000000000
--- a/lib/libc/sys/_umtx_op.2
+++ /dev/null
@@ -1,1531 +0,0 @@
-.\" Copyright (c) 2016 The FreeBSD Foundation, Inc.
-.\" All rights reserved.
-.\"
-.\" This documentation was written by
-.\" Konstantin Belousov <kib@FreeBSD.org> under sponsorship
-.\" from the FreeBSD Foundation.
-.\"
-.\" 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 AUTHORS 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 AUTHORS 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd November 23, 2020
-.Dt _UMTX_OP 2
-.Os
-.Sh NAME
-.Nm _umtx_op
-.Nd interface for implementation of userspace threading synchronization primitives
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In sys/umtx.h
-.Ft int
-.Fn _umtx_op "void *obj" "int op" "u_long val" "void *uaddr" "void *uaddr2"
-.Sh DESCRIPTION
-The
-.Fn _umtx_op
-system call provides kernel support for userspace implementation of
-the threading synchronization primitives.
-The
-.Lb libthr
-uses the syscall to implement
-.St -p1003.1-2001
-pthread locks, like mutexes, condition variables and so on.
-.Ss STRUCTURES
-The operations, performed by the
-.Fn _umtx_op
-syscall, operate on userspace objects which are described
-by the following structures.
-Reserved fields and paddings are omitted.
-All objects require ABI-mandated alignment, but this is not currently
-enforced consistently on all architectures.
-.Pp
-The following flags are defined for flag fields of all structures:
-.Bl -tag -width indent
-.It Dv USYNC_PROCESS_SHARED
-Allow selection of the process-shared sleep queue for the thread sleep
-container, when the lock ownership cannot be granted immediately,
-and the operation must sleep.
-The process-shared or process-private sleep queue is selected based on
-the attributes of the memory mapping which contains the first byte of
-the structure, see
-.Xr mmap 2 .
-Otherwise, if the flag is not specified, the process-private sleep queue
-is selected regardless of the memory mapping attributes, as an optimization.
-.Pp
-See the
-.Sx SLEEP QUEUES
-subsection below for more details on sleep queues.
-.El
-.Bl -hang -offset indent
-.It Sy Mutex
-.Bd -literal
-struct umutex {
- volatile lwpid_t m_owner;
- uint32_t m_flags;
- uint32_t m_ceilings[2];
- uintptr_t m_rb_lnk;
-};
-.Ed
-.Pp
-The
-.Dv m_owner
-field is the actual lock.
-It contains either the thread identifier of the lock owner in the
-locked state, or zero when the lock is unowned.
-The highest bit set indicates that there is contention on the lock.
-The constants are defined for special values:
-.Bl -tag -width indent
-.It Dv UMUTEX_UNOWNED
-Zero, the value stored in the unowned lock.
-.It Dv UMUTEX_CONTESTED
-The contention indicator.
-.It Dv UMUTEX_RB_OWNERDEAD
-A thread owning the robust mutex terminated.
-The mutex is in unlocked state.
-.It Dv UMUTEX_RB_NOTRECOV
-The robust mutex is in a non-recoverable state.
-It cannot be locked until reinitialized.
-.El
-.Pp
-The
-.Dv m_flags
-field may contain the following umutex-specific flags, in addition to
-the common flags:
-.Bl -tag -width indent
-.It Dv UMUTEX_PRIO_INHERIT
-Mutex implements
-.Em Priority Inheritance
-protocol.
-.It Dv UMUTEX_PRIO_PROTECT
-Mutex implements
-.Em Priority Protection
-protocol.
-.It Dv UMUTEX_ROBUST
-Mutex is robust, as described in the
-.Sx ROBUST UMUTEXES
-section below.
-.It Dv UMUTEX_NONCONSISTENT
-Robust mutex is in a transient non-consistent state.
-Not used by kernel.
-.El
-.Pp
-In the manual page, mutexes not having
-.Dv UMUTEX_PRIO_INHERIT
-and
-.Dv UMUTEX_PRIO_PROTECT
-flags set, are called normal mutexes.
-Each type of mutex
-.Pq normal, priority-inherited, and priority-protected
-has a separate sleep queue associated
-with the given key.
-.Pp
-For priority protected mutexes, the
-.Dv m_ceilings
-array contains priority ceiling values.
-The
-.Dv m_ceilings[0]
-is the ceiling value for the mutex, as specified by
-.St -p1003.1-2008
-for the
-.Em Priority Protected
-mutex protocol.
-The
-.Dv m_ceilings[1]
-is used only for the unlock of a priority protected mutex, when
-unlock is done in an order other than the reversed lock order.
-In this case,
-.Dv m_ceilings[1]
-must contain the ceiling value for the last locked priority protected
-mutex, for proper priority reassignment.
-If, instead, the unlocking mutex was the last priority propagated
-mutex locked by the thread,
-.Dv m_ceilings[1]
-should contain \-1.
-This is required because kernel does not maintain the ordered lock list.
-.It Sy Condition variable
-.Bd -literal
-struct ucond {
- volatile uint32_t c_has_waiters;
- uint32_t c_flags;
- uint32_t c_clockid;
-};
-.Ed
-.Pp
-A non-zero
-.Dv c_has_waiters
-value indicates that there are in-kernel waiters for the condition,
-executing the
-.Dv UMTX_OP_CV_WAIT
-request.
-.Pp
-The
-.Dv c_flags
-field contains flags.
-Only the common flags
-.Pq Dv USYNC_PROCESS_SHARED
-are defined for ucond.
-.Pp
-The
-.Dv c_clockid
-member provides the clock identifier to use for timeout, when the
-.Dv UMTX_OP_CV_WAIT
-request has both the
-.Dv CVWAIT_CLOCKID
-flag and the timeout specified.
-Valid clock identifiers are a subset of those for
-.Xr clock_gettime 2 :
-.Bl -bullet -compact
-.It
-.Dv CLOCK_MONOTONIC
-.It
-.Dv CLOCK_MONOTONIC_FAST
-.It
-.Dv CLOCK_MONOTONIC_PRECISE
-.It
-.Dv CLOCK_PROF
-.It
-.Dv CLOCK_REALTIME
-.It
-.Dv CLOCK_REALTIME_FAST
-.It
-.Dv CLOCK_REALTIME_PRECISE
-.It
-.Dv CLOCK_SECOND
-.It
-.Dv CLOCK_UPTIME
-.It
-.Dv CLOCK_UPTIME_FAST
-.It
-.Dv CLOCK_UPTIME_PRECISE
-.It
-.Dv CLOCK_VIRTUAL
-.El
-.It Sy Reader/writer lock
-.Bd -literal
-struct urwlock {
- volatile int32_t rw_state;
- uint32_t rw_flags;
- uint32_t rw_blocked_readers;
- uint32_t rw_blocked_writers;
-};
-.Ed
-.Pp
-The
-.Dv rw_state
-field is the actual lock.
-It contains both the flags and counter of the read locks which were
-granted.
-Names of the
-.Dv rw_state
-bits are following:
-.Bl -tag -width indent
-.It Dv URWLOCK_WRITE_OWNER
-Write lock was granted.
-.It Dv URWLOCK_WRITE_WAITERS
-There are write lock waiters.
-.It Dv URWLOCK_READ_WAITERS
-There are read lock waiters.
-.It Dv URWLOCK_READER_COUNT(c)
-Returns the count of currently granted read locks.
-.El
-.Pp
-At any given time there may be only one thread to which the writer lock
-is granted on the
-.Vt struct rwlock ,
-and no threads are granted read lock.
-Or, at the given time, up to
-.Dv URWLOCK_MAX_READERS
-threads may be granted the read lock simultaneously, but write lock is
-not granted to any thread.
-.Pp
-The following flags for the
-.Dv rw_flags
-member of
-.Vt struct urwlock
-are defined, in addition to the common flags:
-.Bl -tag -width indent
-.It Dv URWLOCK_PREFER_READER
-If specified, immediately grant read lock requests when
-.Dv urwlock
-is already read-locked, even in presence of unsatisfied write
-lock requests.
-By default, if there is a write lock waiter, further read requests are
-not granted, to prevent unfair write lock waiter starvation.
-.El
-.Pp
-The
-.Dv rw_blocked_readers
-and
-.Dv rw_blocked_writers
-members contain the count of threads which are sleeping in kernel,
-waiting for the associated request type to be granted.
-The fields are used by kernel to update the
-.Dv URWLOCK_READ_WAITERS
-and
-.Dv URWLOCK_WRITE_WAITERS
-flags of the
-.Dv rw_state
-lock after requesting thread was woken up.
-.It Sy Semaphore
-.Bd -literal
-struct _usem2 {
- volatile uint32_t _count;
- uint32_t _flags;
-};
-.Ed
-.Pp
-The
-.Dv _count
-word represents a counting semaphore.
-A non-zero value indicates an unlocked (posted) semaphore, while zero
-represents the locked state.
-The maximal supported semaphore count is
-.Dv USEM_MAX_COUNT .
-.Pp
-The
-.Dv _count
-word, besides the counter of posts (unlocks), also contains the
-.Dv USEM_HAS_WAITERS
-bit, which indicates that locked semaphore has waiting threads.
-.Pp
-The
-.Dv USEM_COUNT()
-macro, applied to the
-.Dv _count
-word, returns the current semaphore counter, which is the number of posts
-issued on the semaphore.
-.Pp
-The following bits for the
-.Dv _flags
-member of
-.Vt struct _usem2
-are defined, in addition to the common flags:
-.Bl -tag -width indent
-.It Dv USEM_NAMED
-Flag is ignored by kernel.
-.El
-.It Sy Timeout parameter
-.Bd -literal
-struct _umtx_time {
- struct timespec _timeout;
- uint32_t _flags;
- uint32_t _clockid;
-};
-.Ed
-.Pp
-Several
-.Fn _umtx_op
-operations allow the blocking time to be limited, failing the request
-if it cannot be satisfied in the specified time period.
-The timeout is specified by passing either the address of
-.Vt struct timespec ,
-or its extended variant,
-.Vt struct _umtx_time ,
-as the
-.Fa uaddr2
-argument of
-.Fn _umtx_op .
-They are distinguished by the
-.Fa uaddr
-value, which must be equal to the size of the structure pointed to by
-.Fa uaddr2 ,
-casted to
-.Vt uintptr_t .
-.Pp
-The
-.Dv _timeout
-member specifies the time when the timeout should occur.
-Legal values for clock identifier
-.Dv _clockid
-are shared with the
-.Fa clock_id
-argument to the
-.Xr clock_gettime 2
-function,
-and use the same underlying clocks.
-The specified clock is used to obtain the current time value.
-Interval counting is always performed by the monotonic wall clock.
-.Pp
-The
-.Dv _flags
-argument allows the following flags to further define the timeout behaviour:
-.Bl -tag -width indent
-.It Dv UMTX_ABSTIME
-The
-.Dv _timeout
-value is the absolute time.
-The thread will be unblocked and the request failed when specified
-clock value is equal or exceeds the
-.Dv _timeout.
-.Pp
-If the flag is absent, the timeout value is relative, that is the amount
-of time, measured by the monotonic wall clock from the moment of the request
-start.
-.El
-.El
-.Ss SLEEP QUEUES
-When a locking request cannot be immediately satisfied, the thread is
-typically put to
-.Em sleep ,
-which is a non-runnable state terminated by the
-.Em wake
-operation.
-Lock operations include a
-.Em try
-variant which returns an error rather than sleeping if the lock cannot
-be obtained.
-Also,
-.Fn _umtx_op
-provides requests which explicitly put the thread to sleep.
-.Pp
-Wakes need to know which threads to make runnable, so sleeping threads
-are grouped into containers called
-.Em sleep queues .
-A sleep queue is identified by a key, which for
-.Fn _umtx_op
-is defined as the physical address of some variable.
-Note that the
-.Em physical
-address is used, which means that same variable mapped multiple
-times will give one key value.
-This mechanism enables the construction of
-.Em process-shared
-locks.
-.Pp
-A related attribute of the key is shareability.
-Some requests always interpret keys as private for the current process,
-creating sleep queues with the scope of the current process even if
-the memory is shared.
-Others either select the shareability automatically from the
-mapping attributes, or take additional input as the
-.Dv USYNC_PROCESS_SHARED
-common flag.
-This is done as optimization, allowing the lock scope to be limited
-regardless of the kind of backing memory.
-.Pp
-Only the address of the start byte of the variable specified as key is
-important for determining corresponding sleep queue.
-The size of the variable does not matter, so, for example, sleep on the same
-address interpeted as
-.Vt uint32_t
-and
-.Vt long
-on a little-endian 64-bit platform would collide.
-.Pp
-The last attribute of the key is the object type.
-The sleep queue to which a sleeping thread is assigned is an individual
-one for simple wait requests, mutexes, rwlocks, condvars and other
-primitives, even when the physical address of the key is same.
-.Pp
-When waking up a limited number of threads from a given sleep queue,
-the highest priority threads that have been blocked for the longest on
-the queue are selected.
-.Ss ROBUST UMUTEXES
-The
-.Em robust umutexes
-are provided as a substrate for a userspace library to implement
-.Tn POSIX
-robust mutexes.
-A robust umutex must have the
-.Dv UMUTEX_ROBUST
-flag set.
-.Pp
-On thread termination, the kernel walks two lists of mutexes.
-The two lists head addresses must be provided by a prior call to
-.Dv UMTX_OP_ROBUST_LISTS
-request.
-The lists are singly-linked.
-The link to next element is provided by the
-.Dv m_rb_lnk
-member of the
-.Vt struct umutex .
-.Pp
-Robust list processing is aborted if the kernel finds a mutex
-with any of the following conditions:
-.Bl -dash -offset indent -compact
-.It
-the
-.Dv UMUTEX_ROBUST
-flag is not set
-.It
-not owned by the current thread, except when the mutex is pointed to
-by the
-.Dv robust_inactive
-member of the
-.Vt struct umtx_robust_lists_params ,
-registered for the current thread
-.It
-the combination of mutex flags is invalid
-.It
-read of the umutex memory faults
-.It
-the list length limit described in
-.Xr libthr 3
-is reached.
-.El
-.Pp
-Every mutex in both lists is unlocked as if the
-.Dv UMTX_OP_MUTEX_UNLOCK
-request is performed on it, but instead of the
-.Dv UMUTEX_UNOWNED
-value, the
-.Dv m_owner
-field is written with the
-.Dv UMUTEX_RB_OWNERDEAD
-value.
-When a mutex in the
-.Dv UMUTEX_RB_OWNERDEAD
-state is locked by kernel due to the
-.Dv UMTX_OP_MUTEX_TRYLOCK
-and
-.Dv UMTX_OP_MUTEX_LOCK
-requests, the lock is granted and
-.Er EOWNERDEAD
-error is returned.
-.Pp
-Also, the kernel handles the
-.Dv UMUTEX_RB_NOTRECOV
-value of
-.Dv the m_owner
-field specially, always returning the
-.Er ENOTRECOVERABLE
-error for lock attempts, without granting the lock.
-.Ss OPERATIONS
-The following operations, requested by the
-.Fa op
-argument to the function, are implemented:
-.Bl -tag -width indent
-.It Dv UMTX_OP_WAIT
-Wait.
-The arguments for the request are:
-.Bl -tag -width "obj"
-.It Fa obj
-Pointer to a variable of type
-.Vt long .
-.It Fa val
-Current value of the
-.Dv *obj .
-.El
-.Pp
-The current value of the variable pointed to by the
-.Fa obj
-argument is compared with the
-.Fa val .
-If they are equal, the requesting thread is put to interruptible sleep
-until woken up or the optionally specified timeout expires.
-.Pp
-The comparison and sleep are atomic.
-In other words, if another thread writes a new value to
-.Dv *obj
-and then issues
-.Dv UMTX_OP_WAKE ,
-the request is guaranteed to not miss the wakeup,
-which might otherwise happen between comparison and blocking.
-.Pp
-The physical address of memory where the
-.Fa *obj
-variable is located, is used as a key to index sleeping threads.
-.Pp
-The read of the current value of the
-.Dv *obj
-variable is not guarded by barriers.
-In particular, it is the user's duty to ensure the lock acquire
-and release memory semantics, if the
-.Dv UMTX_OP_WAIT
-and
-.Dv UMTX_OP_WAKE
-requests are used as a substrate for implementing a simple lock.
-.Pp
-The request is not restartable.
-An unblocked signal delivered during the wait always results in sleep
-interruption and
-.Er EINTR
-error.
-.Pp
-Optionally, a timeout for the request may be specified.
-.It Dv UMTX_OP_WAKE
-Wake the threads possibly sleeping due to
-.Dv UMTX_OP_WAIT .
-The arguments for the request are:
-.Bl -tag -width "obj"
-.It Fa obj
-Pointer to a variable, used as a key to find sleeping threads.
-.It Fa val
-Up to
-.Fa val
-threads are woken up by this request.
-Specify
-.Dv INT_MAX
-to wake up all waiters.
-.El
-.It Dv UMTX_OP_MUTEX_TRYLOCK
-Try to lock umutex.
-The arguments to the request are:
-.Bl -tag -width "obj"
-.It Fa obj
-Pointer to the umutex.
-.El
-.Pp
-Operates same as the
-.Dv UMTX_OP_MUTEX_LOCK
-request, but returns
-.Er EBUSY
-instead of sleeping if the lock cannot be obtained immediately.
-.It Dv UMTX_OP_MUTEX_LOCK
-Lock umutex.
-The arguments to the request are:
-.Bl -tag -width "obj"
-.It Fa obj
-Pointer to the umutex.
-.El
-.Pp
-Locking is performed by writing the current thread id into the
-.Dv m_owner
-word of the
-.Vt struct umutex .
-The write is atomic, preserves the
-.Dv UMUTEX_CONTESTED
-contention indicator, and provides the acquire barrier for
-lock entrance semantic.
-.Pp
-If the lock cannot be obtained immediately because another thread owns
-the lock, the current thread is put to sleep, with
-.Dv UMUTEX_CONTESTED
-bit set before.
-Upon wake up, the lock conditions are re-tested.
-.Pp
-The request adheres to the priority protection or inheritance protocol
-of the mutex, specified by the
-.Dv UMUTEX_PRIO_PROTECT
-or
-.Dv UMUTEX_PRIO_INHERIT
-flag, respectively.
-.Pp
-Optionally, a timeout for the request may be specified.
-.Pp
-A request with a timeout specified is not restartable.
-An unblocked signal delivered during the wait always results in sleep
-interruption and
-.Er EINTR
-error.
-A request without timeout specified is always restarted after return
-from a signal handler.
-.It Dv UMTX_OP_MUTEX_UNLOCK
-Unlock umutex.
-The arguments to the request are:
-.Bl -tag -width "obj"
-.It Fa obj
-Pointer to the umutex.
-.El
-.Pp
-Unlocks the mutex, by writing
-.Dv UMUTEX_UNOWNED
-(zero) value into
-.Dv m_owner
-word of the
-.Vt struct umutex .
-The write is done with a release barrier, to provide lock leave semantic.
-.Pp
-If there are threads sleeping in the sleep queue associated with the
-umutex, one thread is woken up.
-If more than one thread sleeps in the sleep queue, the
-.Dv UMUTEX_CONTESTED
-bit is set together with the write of the
-.Dv UMUTEX_UNOWNED
-value into
-.Dv m_owner .
-.Pp
-The request adheres to the priority protection or inheritance protocol
-of the mutex, specified by the
-.Dv UMUTEX_PRIO_PROTECT
-or
-.Dv UMUTEX_PRIO_INHERIT
-flag, respectively.
-See description of the
-.Dv m_ceilings
-member of the
-.Vt struct umutex
-structure for additional details of the request operation on the
-priority protected protocol mutex.
-.It Dv UMTX_OP_SET_CEILING
-Set ceiling for the priority protected umutex.
-The arguments to the request are:
-.Bl -tag -width "uaddr"
-.It Fa obj
-Pointer to the umutex.
-.It Fa val
-New ceiling value.
-.It Fa uaddr
-Address of a variable of type
-.Vt uint32_t .
-If not
-.Dv NULL
-and the update was successful, the previous ceiling value is
-written to the location pointed to by
-.Fa uaddr .
-.El
-.Pp
-The request locks the umutex pointed to by the
-.Fa obj
-parameter, waiting for the lock if not immediately available.
-After the lock is obtained, the new ceiling value
-.Fa val
-is written to the
-.Dv m_ceilings[0]
-member of the
-.Vt struct umutex,
-after which the umutex is unlocked.
-.Pp
-The locking does not adhere to the priority protect protocol,
-to conform to the
-.Tn POSIX
-requirements for the
-.Xr pthread_mutex_setprioceiling 3
-interface.
-.It Dv UMTX_OP_CV_WAIT
-Wait for a condition.
-The arguments to the request are:
-.Bl -tag -width "uaddr2"
-.It Fa obj
-Pointer to the
-.Vt struct ucond .
-.It Fa val
-Request flags, see below.
-.It Fa uaddr
-Pointer to the umutex.
-.It Fa uaddr2
-Optional pointer to a
-.Vt struct timespec
-for timeout specification.
-.El
-.Pp
-The request must be issued by the thread owning the mutex pointed to
-by the
-.Fa uaddr
-argument.
-The
-.Dv c_hash_waiters
-member of the
-.Vt struct ucond ,
-pointed to by the
-.Fa obj
-argument, is set to an arbitrary non-zero value, after which the
-.Fa uaddr
-mutex is unlocked (following the appropriate protocol), and
-the current thread is put to sleep on the sleep queue keyed by
-the
-.Fa obj
-argument.
-The operations are performed atomically.
-It is guaranteed to not miss a wakeup from
-.Dv UMTX_OP_CV_SIGNAL
-or
-.Dv UMTX_OP_CV_BROADCAST
-sent between mutex unlock and putting the current thread on the sleep queue.
-.Pp
-Upon wakeup, if the timeout expired and no other threads are sleeping in
-the same sleep queue, the
-.Dv c_hash_waiters
-member is cleared.
-After wakeup, the
-.Fa uaddr
-umutex is not relocked.
-.Pp
-The following flags are defined:
-.Bl -tag -width "CVWAIT_CLOCKID"
-.It Dv CVWAIT_ABSTIME
-Timeout is absolute.
-.It Dv CVWAIT_CLOCKID
-Clockid is provided.
-.El
-.Pp
-Optionally, a timeout for the request may be specified.
-Unlike other requests, the timeout value is specified directly by a
-.Vt struct timespec ,
-pointed to by the
-.Fa uaddr2
-argument.
-If the
-.Dv CVWAIT_CLOCKID
-flag is provided, the timeout uses the clock from the
-.Dv c_clockid
-member of the
-.Vt struct ucond ,
-pointed to by
-.Fa obj
-argument.
-Otherwise,
-.Dv CLOCK_REALTIME
-is used, regardless of the clock identifier possibly specified in the
-.Vt struct _umtx_time .
-If the
-.Dv CVWAIT_ABSTIME
-flag is supplied, the timeout specifies absolute time value, otherwise
-it denotes a relative time interval.
-.Pp
-The request is not restartable.
-An unblocked signal delivered during
-the wait always results in sleep interruption and
-.Er EINTR
-error.
-.It Dv UMTX_OP_CV_SIGNAL
-Wake up one condition waiter.
-The arguments to the request are:
-.Bl -tag -width "obj"
-.It Fa obj
-Pointer to
-.Vt struct ucond .
-.El
-.Pp
-The request wakes up at most one thread sleeping on the sleep queue keyed
-by the
-.Fa obj
-argument.
-If the woken up thread was the last on the sleep queue, the
-.Dv c_has_waiters
-member of the
-.Vt struct ucond
-is cleared.
-.It Dv UMTX_OP_CV_BROADCAST
-Wake up all condition waiters.
-The arguments to the request are:
-.Bl -tag -width "obj"
-.It Fa obj
-Pointer to
-.Vt struct ucond .
-.El
-.Pp
-The request wakes up all threads sleeping on the sleep queue keyed by the
-.Fa obj
-argument.
-The
-.Dv c_has_waiters
-member of the
-.Vt struct ucond
-is cleared.
-.It Dv UMTX_OP_WAIT_UINT
-Same as
-.Dv UMTX_OP_WAIT ,
-but the type of the variable pointed to by
-.Fa obj
-is
-.Vt u_int
-.Pq a 32-bit integer .
-.It Dv UMTX_OP_RW_RDLOCK
-Read-lock a
-.Vt struct rwlock
-lock.
-The arguments to the request are:
-.Bl -tag -width "obj"
-.It Fa obj
-Pointer to the lock (of type
-.Vt struct rwlock )
-to be read-locked.
-.It Fa val
-Additional flags to augment locking behaviour.
-The valid flags in the
-.Fa val
-argument are:
-.Bl -tag -width indent
-.It Dv URWLOCK_PREFER_READER
-.El
-.El
-.Pp
-The request obtains the read lock on the specified
-.Vt struct rwlock
-by incrementing the count of readers in the
-.Dv rw_state
-word of the structure.
-If the
-.Dv URWLOCK_WRITE_OWNER
-bit is set in the word
-.Dv rw_state ,
-the lock was granted to a writer which has not yet relinquished
-its ownership.
-In this case the current thread is put to sleep until it makes sense to
-retry.
-.Pp
-If the
-.Dv URWLOCK_PREFER_READER
-flag is set either in the
-.Dv rw_flags
-word of the structure, or in the
-.Fa val
-argument of the request, the presence of the threads trying to obtain
-the write lock on the same structure does not prevent the current thread
-from trying to obtain the read lock.
-Otherwise, if the flag is not set, and the
-.Dv URWLOCK_WRITE_WAITERS
-flag is set in
-.Dv rw_state ,
-the current thread does not attempt to obtain read-lock.
-Instead it sets the
-.Dv URWLOCK_READ_WAITERS
-in the
-.Dv rw_state
-word and puts itself to sleep on corresponding sleep queue.
-Upon wakeup, the locking conditions are re-evaluated.
-.Pp
-Optionally, a timeout for the request may be specified.
-.Pp
-The request is not restartable.
-An unblocked signal delivered during the wait always results in sleep
-interruption and
-.Er EINTR
-error.
-.It Dv UMTX_OP_RW_WRLOCK
-Write-lock a
-.Vt struct rwlock
-lock.
-The arguments to the request are:
-.Bl -tag -width "obj"
-.It Fa obj
-Pointer to the lock (of type
-.Vt struct rwlock )
-to be write-locked.
-.El
-.Pp
-The request obtains a write lock on the specified
-.Vt struct rwlock ,
-by setting the
-.Dv URWLOCK_WRITE_OWNER
-bit in the
-.Dv rw_state
-word of the structure.
-If there is already a write lock owner, as indicated by the
-.Dv URWLOCK_WRITE_OWNER
-bit being set, or there are read lock owners, as indicated
-by the read-lock counter, the current thread does not attempt to
-obtain the write-lock.
-Instead it sets the
-.Dv URWLOCK_WRITE_WAITERS
-in the
-.Dv rw_state
-word and puts itself to sleep on corresponding sleep queue.
-Upon wakeup, the locking conditions are re-evaluated.
-.Pp
-Optionally, a timeout for the request may be specified.
-.Pp
-The request is not restartable.
-An unblocked signal delivered during the wait always results in sleep
-interruption and
-.Er EINTR
-error.
-.It Dv UMTX_OP_RW_UNLOCK
-Unlock rwlock.
-The arguments to the request are:
-.Bl -tag -width "obj"
-.It Fa obj
-Pointer to the lock (of type
-.Vt struct rwlock )
-to be unlocked.
-.El
-.Pp
-The unlock type (read or write) is determined by the
-current lock state.
-Note that the
-.Vt struct rwlock
-does not save information about the identity of the thread which
-acquired the lock.
-.Pp
-If there are pending writers after the unlock, and the
-.Dv URWLOCK_PREFER_READER
-flag is not set in the
-.Dv rw_flags
-member of the
-.Fa *obj
-structure, one writer is woken up, selected as described in the
-.Sx SLEEP QUEUES
-subsection.
-If the
-.Dv URWLOCK_PREFER_READER
-flag is set, a pending writer is woken up only if there is
-no pending readers.
-.Pp
-If there are no pending writers, or, in the case that the
-.Dv URWLOCK_PREFER_READER
-flag is set, then all pending readers are woken up by unlock.
-.It Dv UMTX_OP_WAIT_UINT_PRIVATE
-Same as
-.Dv UMTX_OP_WAIT_UINT ,
-but unconditionally select the process-private sleep queue.
-.It Dv UMTX_OP_WAKE_PRIVATE
-Same as
-.Dv UMTX_OP_WAKE ,
-but unconditionally select the process-private sleep queue.
-.It Dv UMTX_OP_MUTEX_WAIT
-Wait for mutex availability.
-The arguments to the request are:
-.Bl -tag -width "obj"
-.It Fa obj
-Address of the mutex.
-.El
-.Pp
-Similarly to the
-.Dv UMTX_OP_MUTEX_LOCK ,
-put the requesting thread to sleep if the mutex lock cannot be obtained
-immediately.
-The
-.Dv UMUTEX_CONTESTED
-bit is set in the
-.Dv m_owner
-word of the mutex to indicate that there is a waiter, before the thread
-is added to the sleep queue.
-Unlike the
-.Dv UMTX_OP_MUTEX_LOCK
-request, the lock is not obtained.
-.Pp
-The operation is not implemented for priority protected and
-priority inherited protocol mutexes.
-.Pp
-Optionally, a timeout for the request may be specified.
-.Pp
-A request with a timeout specified is not restartable.
-An unblocked signal delivered during the wait always results in sleep
-interruption and
-.Er EINTR
-error.
-A request without a timeout automatically restarts if the signal disposition
-requested restart via the
-.Dv SA_RESTART
-flag in
-.Vt struct sigaction
-member
-.Dv sa_flags .
-.It Dv UMTX_OP_NWAKE_PRIVATE
-Wake up a batch of sleeping threads.
-The arguments to the request are:
-.Bl -tag -width "obj"
-.It Fa obj
-Pointer to the array of pointers.
-.It Fa val
-Number of elements in the array pointed to by
-.Fa obj .
-.El
-.Pp
-For each element in the array pointed to by
-.Fa obj ,
-wakes up all threads waiting on the
-.Em private
-sleep queue with the key
-being the byte addressed by the array element.
-.It Dv UMTX_OP_MUTEX_WAKE
-Check if a normal umutex is unlocked and wake up a waiter.
-The arguments for the request are:
-.Bl -tag -width "obj"
-.It Fa obj
-Pointer to the umutex.
-.El
-.Pp
-If the
-.Dv m_owner
-word of the mutex pointed to by the
-.Fa obj
-argument indicates unowned mutex, which has its contention indicator bit
-.Dv UMUTEX_CONTESTED
-set, clear the bit and wake up one waiter in the sleep queue associated
-with the byte addressed by the
-.Fa obj ,
-if any.
-Only normal mutexes are supported by the request.
-The sleep queue is always one for a normal mutex type.
-.Pp
-This request is deprecated in favor of
-.Dv UMTX_OP_MUTEX_WAKE2
-since mutexes using it cannot synchronize their own destruction.
-That is, the
-.Dv m_owner
-word has already been set to
-.Dv UMUTEX_UNOWNED
-when this request is made,
-so that another thread can lock, unlock and destroy the mutex
-(if no other thread uses the mutex afterwards).
-Clearing the
-.Dv UMUTEX_CONTESTED
-bit may then modify freed memory.
-.It Dv UMTX_OP_MUTEX_WAKE2
-Check if a umutex is unlocked and wake up a waiter.
-The arguments for the request are:
-.Bl -tag -width "obj"
-.It Fa obj
-Pointer to the umutex.
-.It Fa val
-The umutex flags.
-.El
-.Pp
-The request does not read the
-.Dv m_flags
-member of the
-.Vt struct umutex ;
-instead, the
-.Fa val
-argument supplies flag information, in particular, to determine the
-sleep queue where the waiters are found for wake up.
-.Pp
-If the mutex is unowned, one waiter is woken up.
-.Pp
-If the mutex memory cannot be accessed, all waiters are woken up.
-.Pp
-If there is more than one waiter on the sleep queue, or there is only
-one waiter but the mutex is owned by a thread, the
-.Dv UMUTEX_CONTESTED
-bit is set in the
-.Dv m_owner
-word of the
-.Vt struct umutex .
-.It Dv UMTX_OP_SEM2_WAIT
-Wait until semaphore is available.
-The arguments to the request are:
-.Bl -tag -width "obj"
-.It Fa obj
-Pointer to the semaphore (of type
-.Vt struct _usem2 ) .
-.It Fa uaddr
-Size of the memory passed in via the
-.Fa uaddr2
-argument.
-.It Fa uaddr2
-Optional pointer to a structure of type
-.Vt struct _umtx_time ,
-which may be followed by a structure of type
-.Vt struct timespec .
-.El
-.Pp
-Put the requesting thread onto a sleep queue if the semaphore counter
-is zero.
-If the thread is put to sleep, the
-.Dv USEM_HAS_WAITERS
-bit is set in the
-.Dv _count
-word to indicate waiters.
-The function returns either due to
-.Dv _count
-indicating the semaphore is available (non-zero count due to post),
-or due to a wakeup.
-The return does not guarantee that the semaphore is available,
-nor does it consume the semaphore lock on successful return.
-.Pp
-Optionally, a timeout for the request may be specified.
-.Pp
-A request with non-absolute timeout value is not restartable.
-An unblocked signal delivered during such wait results in sleep
-interruption and
-.Er EINTR
-error.
-.Pp
-If
-.Dv UMTX_ABSTIME
-was not set, and the operation was interrupted and the caller passed in a
-.Fa uaddr2
-large enough to hold a
-.Vt struct timespec
-following the initial
-.Vt struct _umtx_time ,
-then the
-.Vt struct timespec
-is updated to contain the unslept amount.
-.It Dv UMTX_OP_SEM2_WAKE
-Wake up waiters on semaphore lock.
-The arguments to the request are:
-.Bl -tag -width "obj"
-.It Fa obj
-Pointer to the semaphore (of type
-.Vt struct _usem2 ) .
-.El
-.Pp
-The request wakes up one waiter for the semaphore lock.
-The function does not increment the semaphore lock count.
-If the
-.Dv USEM_HAS_WAITERS
-bit was set in the
-.Dv _count
-word, and the last sleeping thread was woken up, the bit is cleared.
-.It Dv UMTX_OP_SHM
-Manage anonymous
-.Tn POSIX
-shared memory objects (see
-.Xr shm_open 2 ) ,
-which can be attached to a byte of physical memory, mapped into the
-process address space.
-The objects are used to implement process-shared locks in
-.Dv libthr .
-.Pp
-The
-.Fa val
-argument specifies the sub-request of the
-.Dv UMTX_OP_SHM
-request:
-.Bl -tag -width indent
-.It Dv UMTX_SHM_CREAT
-Creates the anonymous shared memory object, which can be looked up
-with the specified key
-.Fa uaddr .
-If the object associated with the
-.Fa uaddr
-key already exists, it is returned instead of creating a new object.
-The object's size is one page.
-On success, the file descriptor referencing the object is returned.
-The descriptor can be used for mapping the object using
-.Xr mmap 2 ,
-or for other shared memory operations.
-.It Dv UMTX_SHM_LOOKUP
-Same as
-.Dv UMTX_SHM_CREATE
-request, but if there is no shared memory object associated with
-the specified key
-.Fa uaddr ,
-an error is returned, and no new object is created.
-.It Dv UMTX_SHM_DESTROY
-De-associate the shared object with the specified key
-.Fa uaddr .
-The object is destroyed after the last open file descriptor is closed
-and the last mapping for it is destroyed.
-.It Dv UMTX_SHM_ALIVE
-Checks whether there is a live shared object associated with the
-supplied key
-.Fa uaddr .
-Returns zero if there is, and an error otherwise.
-This request is an optimization of the
-.Dv UMTX_SHM_LOOKUP
-request.
-It is cheaper when only the liveness of the associated object is asked
-for, since no file descriptor is installed in the process fd table
-on success.
-.El
-.Pp
-The
-.Fa uaddr
-argument specifies the virtual address, which backing physical memory
-byte identity is used as a key for the anonymous shared object
-creation or lookup.
-.It Dv UMTX_OP_ROBUST_LISTS
-Register the list heads for the current thread's robust mutex lists.
-The arguments to the request are:
-.Bl -tag -width "uaddr"
-.It Fa val
-Size of the structure passed in the
-.Fa uaddr
-argument.
-.It Fa uaddr
-Pointer to the structure of type
-.Vt struct umtx_robust_lists_params .
-.El
-.Pp
-The structure is defined as
-.Bd -literal
-struct umtx_robust_lists_params {
- uintptr_t robust_list_offset;
- uintptr_t robust_priv_list_offset;
- uintptr_t robust_inact_offset;
-};
-.Ed
-.Pp
-The
-.Dv robust_list_offset
-member contains address of the first element in the list of locked
-robust shared mutexes.
-The
-.Dv robust_priv_list_offset
-member contains address of the first element in the list of locked
-robust private mutexes.
-The private and shared robust locked lists are split to allow fast
-termination of the shared list on fork, in the child.
-.Pp
-The
-.Dv robust_inact_offset
-contains a pointer to the mutex which might be locked in nearby future,
-or might have been just unlocked.
-It is typically set by the lock or unlock mutex implementation code
-around the whole operation, since lists can be only changed race-free
-when the thread owns the mutex.
-The kernel inspects the
-.Dv robust_inact_offset
-in addition to walking the shared and private lists.
-Also, the mutex pointed to by
-.Dv robust_inact_offset
-is handled more loosely at the thread termination time,
-than other mutexes on the list.
-That mutex is allowed to be not owned by the current thread,
-in which case list processing is continued.
-See
-.Sx ROBUST UMUTEXES
-subsection for details.
-.El
-.Pp
-The
-.Fa op
-argument may be a bitwise OR of a single command from above with one or more of
-the following flags:
-.Bl -tag -width indent
-.It Dv UMTX_OP__I386
-Request i386 ABI compatibility from the native
-.Nm
-system call.
-Specifically, this implies that:
-.Bl -hang -offset indent
-.It
-.Fa obj
-arguments that point to a word, point to a 32-bit integer.
-.It
-The
-.Dv UMTX_OP_NWAKE_PRIVATE
-.Fa obj
-argument is a pointer to an array of 32-bit pointers.
-.It
-The
-.Dv m_rb_lnk
-member of
-.Vt struct umutex
-is a 32-bit pointer.
-.It
-.Vt struct timespec
-uses a 32-bit time_t.
-.El
-.Pp
-.Dv UMTX_OP__32BIT
-has no effect if this flag is set.
-This flag is valid for all architectures, but it is ignored on i386.
-.It Dv UMTX_OP__32BIT
-Request non-i386, 32-bit ABI compatibility from the native
-.Nm
-system call.
-Specifically, this implies that:
-.Bl -hang -offset indent
-.It
-.Fa obj
-arguments that point to a word, point to a 32-bit integer.
-.It
-The
-.Dv UMTX_OP_NWAKE_PRIVATE
-.Fa obj
-argument is a pointer to an array of 32-bit pointers.
-.It
-The
-.Dv m_rb_lnk
-member of
-.Vt struct umutex
-is a 32-bit pointer.
-.It
-.Vt struct timespec
-uses a 64-bit time_t.
-.El
-.Pp
-This flag has no effect if
-.Dv UMTX_OP__I386
-is set.
-This flag is valid for all architectures.
-.El
-.Pp
-Note that if any 32-bit ABI compatibility is being requested, then care must be
-taken with robust lists.
-A single thread may not mix 32-bit compatible robust lists with native
-robust lists.
-The first
-.Dv UMTX_OP_ROBUST_LISTS
-call in a given thread determines which ABI that thread will use for robust
-lists going forward.
-.Sh RETURN VALUES
-If successful,
-all requests, except
-.Dv UMTX_SHM_CREAT
-and
-.Dv UMTX_SHM_LOOKUP
-sub-requests of the
-.Dv UMTX_OP_SHM
-request, will return zero.
-The
-.Dv UMTX_SHM_CREAT
-and
-.Dv UMTX_SHM_LOOKUP
-return a shared memory file descriptor on success.
-On error \-1 is returned, and the
-.Va errno
-variable is set to indicate the error.
-.Sh ERRORS
-The
-.Fn _umtx_op
-operations can fail with the following errors:
-.Bl -tag -width "[ETIMEDOUT]"
-.It Bq Er EFAULT
-One of the arguments point to invalid memory.
-.It Bq Er EINVAL
-The clock identifier, specified for the
-.Vt struct _umtx_time
-timeout parameter, or in the
-.Dv c_clockid
-member of
-.Vt struct ucond,
-is invalid.
-.It Bq Er EINVAL
-The type of the mutex, encoded by the
-.Dv m_flags
-member of
-.Vt struct umutex ,
-is invalid.
-.It Bq Er EINVAL
-The
-.Dv m_owner
-member of the
-.Vt struct umutex
-has changed the lock owner thread identifier during unlock.
-.It Bq Er EINVAL
-The
-.Dv timeout.tv_sec
-or
-.Dv timeout.tv_nsec
-member of
-.Vt struct _umtx_time
-is less than zero, or
-.Dv timeout.tv_nsec
-is greater than 1000000000.
-.It Bq Er EINVAL
-The
-.Fa op
-argument specifies invalid operation.
-.It Bq Er EINVAL
-The
-.Fa uaddr
-argument for the
-.Dv UMTX_OP_SHM
-request specifies invalid operation.
-.It Bq Er EINVAL
-The
-.Dv UMTX_OP_SET_CEILING
-request specifies non priority protected mutex.
-.It Bq Er EINVAL
-The new ceiling value for the
-.Dv UMTX_OP_SET_CEILING
-request, or one or more of the values read from the
-.Dv m_ceilings
-array during lock or unlock operations, is greater than
-.Dv RTP_PRIO_MAX .
-.It Bq Er EPERM
-Unlock attempted on an object not owned by the current thread.
-.It Bq Er EOWNERDEAD
-The lock was requested on an umutex where the
-.Dv m_owner
-field was set to the
-.Dv UMUTEX_RB_OWNERDEAD
-value, indicating terminated robust mutex.
-The lock was granted to the caller, so this error in fact
-indicates success with additional conditions.
-.It Bq Er ENOTRECOVERABLE
-The lock was requested on an umutex which
-.Dv m_owner
-field is equal to the
-.Dv UMUTEX_RB_NOTRECOV
-value, indicating abandoned robust mutex after termination.
-The lock was not granted to the caller.
-.It Bq Er ENOTTY
-The shared memory object, associated with the address passed to the
-.Dv UMTX_SHM_ALIVE
-sub-request of
-.Dv UMTX_OP_SHM
-request, was destroyed.
-.It Bq Er ESRCH
-For the
-.Dv UMTX_SHM_LOOKUP ,
-.Dv UMTX_SHM_DESTROY ,
-and
-.Dv UMTX_SHM_ALIVE
-sub-requests of the
-.Dv UMTX_OP_SHM
-request, there is no shared memory object associated with the provided key.
-.It Bq Er ENOMEM
-The
-.Dv UMTX_SHM_CREAT
-sub-request of the
-.Dv UMTX_OP_SHM
-request cannot be satisfied, because allocation of the shared memory object
-would exceed the
-.Dv RLIMIT_UMTXP
-resource limit, see
-.Xr setrlimit 2 .
-.It Bq Er EAGAIN
-The maximum number of readers
-.Dv ( URWLOCK_MAX_READERS )
-were already granted ownership of the given
-.Vt struct rwlock
-for read.
-.It Bq Er EBUSY
-A try mutex lock operation was not able to obtain the lock.
-.It Bq Er ETIMEDOUT
-The request specified a timeout in the
-.Fa uaddr
-and
-.Fa uaddr2
-arguments, and timed out before obtaining the lock or being woken up.
-.It Bq Er EINTR
-A signal was delivered during wait, for a non-restartable operation.
-Operations with timeouts are typically non-restartable, but timeouts
-specified in absolute time may be restartable.
-.It Bq Er ERESTART
-A signal was delivered during wait, for a restartable operation.
-Mutex lock requests without timeout specified are restartable.
-The error is not returned to userspace code since restart
-is handled by usual adjustment of the instruction counter.
-.El
-.Sh SEE ALSO
-.Xr clock_gettime 2 ,
-.Xr mmap 2 ,
-.Xr setrlimit 2 ,
-.Xr shm_open 2 ,
-.Xr sigaction 2 ,
-.Xr thr_exit 2 ,
-.Xr thr_kill 2 ,
-.Xr thr_kill2 2 ,
-.Xr thr_new 2 ,
-.Xr thr_self 2 ,
-.Xr thr_set_name 2 ,
-.Xr signal 3
-.Sh STANDARDS
-The
-.Fn _umtx_op
-system call is non-standard and is used by the
-.Lb libthr
-to implement
-.St -p1003.1-2001
-.Xr pthread 3
-functionality.
-.Sh BUGS
-A window between a unlocking robust mutex and resetting the pointer in the
-.Dv robust_inact_offset
-member of the registered
-.Vt struct umtx_robust_lists_params
-allows another thread to destroy the mutex, thus making the kernel inspect
-freed or reused memory.
-The
-.Li libthr
-implementation is only vulnerable to this race when operating on
-a shared mutex.
-A possible fix for the current implementation is to strengthen the checks
-for shared mutexes before terminating them, in particular, verifying
-that the mutex memory is mapped from a shared memory object allocated
-by the
-.Dv UMTX_OP_SHM
-request.
-This is not done because it is believed that the race is adequately
-covered by other consistency checks, while adding the check would
-prevent alternative implementations of
-.Li libpthread .
diff --git a/lib/libc/sys/abort2.2 b/lib/libc/sys/abort2.2
deleted file mode 100644
index ca31d74267f3..000000000000
--- a/lib/libc/sys/abort2.2
+++ /dev/null
@@ -1,113 +0,0 @@
-.\" Copyright (c) 2005 Wojciech A. Koszek <dunstan@FreeBSD.czest.pl>
-.\" All rights reserved.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd September 30, 2006
-.Dt ABORT2 2
-.Os
-.Sh NAME
-.Nm abort2
-.Nd "abort process with diagnostics"
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdlib.h
-.Ft void
-.Fn abort2 "const char *why" "int nargs" "void **args"
-.Sh DESCRIPTION
-The
-.Fn abort2
-system call causes the process to be killed and the specified diagnostic
-message (with arguments) to be delivered by the kernel to the
-.Xr syslogd 8
-daemon.
-.Pp
-The
-.Fa why
-argument points to a
-.Dv NUL- Ns
-terminated string specifying a reason of the program's termination
-(maximum 128 characters long).
-The
-.Fa args
-array contains pointers which will be logged numerically
-(with the kernel's
-.Ql %p
-.Xr printf 9
-format).
-The
-.Fa nargs
-argument specifies the number of pointers in
-.Fa args
-(maximum 16).
-.Pp
-The
-.Fn abort2
-system call
-is intended for use in situations where continuation of a process
-is impossible or for other definitive reasons is unwanted, and normal
-diagnostic channels cannot be trusted to deliver the message.
-.Sh RETURN VALUES
-The
-.Fn abort2
-function
-never returns.
-.Pp
-The process is killed with
-.Dv SIGABRT
-unless the arguments to
-.Fn abort2
-are invalid, in which case
-.Dv SIGKILL
-is used.
-.Sh EXAMPLES
-.Bd -literal -compact
-#include <stdlib.h>
-
-if (weight_kg > max_load) {
- void *ptrs[3];
-
- ptrs[0] = (void *)(intptr_t)weight_kg;
- ptrs[1] = (void *)(intptr_t)max_load;
- ptrs[2] = haystack;
- abort2("Camel overloaded", 3, ptrs);
-}
-.Ed
-.Sh SEE ALSO
-.Xr abort 3 ,
-.Xr exit 3
-.Sh HISTORY
-The
-.Fn abort2
-system call first appeared in
-.Fx 7.0 .
-.Sh AUTHORS
-.An -nosplit
-The
-.Fn abort2
-system call was designed by
-.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org .
-It was implemented by
-.An Wojciech A. Koszek Aq Mt dunstan@freebsd.czest.pl .
diff --git a/lib/libc/sys/accept.2 b/lib/libc/sys/accept.2
deleted file mode 100644
index b41f8fc43612..000000000000
--- a/lib/libc/sys/accept.2
+++ /dev/null
@@ -1,239 +0,0 @@
-.\" Copyright (c) 1983, 1990, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)accept.2 8.2 (Berkeley) 12/11/93
-.\" $FreeBSD$
-.\"
-.Dd October 9, 2014
-.Dt ACCEPT 2
-.Os
-.Sh NAME
-.Nm accept ,
-.Nm accept4
-.Nd accept a connection on a socket
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In sys/socket.h
-.Ft int
-.Fn accept "int s" "struct sockaddr * restrict addr" "socklen_t * restrict addrlen"
-.Ft int
-.Fn accept4 "int s" "struct sockaddr * restrict addr" "socklen_t * restrict addrlen" "int flags"
-.Sh DESCRIPTION
-The argument
-.Fa s
-is a socket that has been created with
-.Xr socket 2 ,
-bound to an address with
-.Xr bind 2 ,
-and is listening for connections after a
-.Xr listen 2 .
-The
-.Fn accept
-system call extracts the first connection request on the
-queue of pending connections, creates a new socket,
-and allocates a new file descriptor for the socket which
-inherits the state of the
-.Dv O_NONBLOCK
-and
-.Dv O_ASYNC
-properties and the destination of
-.Dv SIGIO
-and
-.Dv SIGURG
-signals from the original socket
-.Fa s .
-.Pp
-The
-.Fn accept4
-system call is similar,
-but the
-.Dv O_NONBLOCK
-property of the new socket is instead determined by the
-.Dv SOCK_NONBLOCK
-flag in the
-.Fa flags
-argument,
-the
-.Dv O_ASYNC
-property is cleared,
-the signal destination is cleared
-and the close-on-exec flag on the new file descriptor can be set via the
-.Dv SOCK_CLOEXEC
-flag in the
-.Fa flags
-argument.
-.Pp
-If no pending connections are
-present on the queue, and the original socket
-is not marked as non-blocking,
-.Fn accept
-blocks the caller until a connection is present.
-If the original socket
-is marked non-blocking and no pending
-connections are present on the queue,
-.Fn accept
-returns an error as described below.
-The accepted socket
-may not be used
-to accept more connections.
-The original socket
-.Fa s
-remains open.
-.Pp
-The argument
-.Fa addr
-is a result argument that is filled-in with
-the address of the connecting entity,
-as known to the communications layer.
-The exact format of the
-.Fa addr
-argument is determined by the domain in which the communication
-is occurring.
-A null pointer may be specified for
-.Fa addr
-if the address information is not desired;
-in this case,
-.Fa addrlen
-is not used and should also be null.
-Otherwise, the
-.Fa addrlen
-argument
-is a value-result argument; it should initially contain the
-amount of space pointed to by
-.Fa addr ;
-on return it will contain the actual length (in bytes) of the
-address returned.
-This call
-is used with connection-based socket types, currently with
-.Dv SOCK_STREAM .
-.Pp
-It is possible to
-.Xr select 2
-a socket for the purposes of doing an
-.Fn accept
-by selecting it for read.
-.Pp
-For certain protocols which require an explicit confirmation,
-such as
-.Tn ISO
-or
-.Tn DATAKIT ,
-.Fn accept
-can be thought of
-as merely dequeueing the next connection
-request and not implying confirmation.
-Confirmation can be implied by a normal read or write on the new
-file descriptor, and rejection can be implied by closing the
-new socket.
-.Pp
-For some applications, performance may be enhanced by using an
-.Xr accept_filter 9
-to pre-process incoming connections.
-.Pp
-When using
-.Fn accept ,
-portable programs should not rely on the
-.Dv O_NONBLOCK
-and
-.Dv O_ASYNC
-properties and the signal destination being inherited,
-but should set them explicitly using
-.Xr fcntl 2 ;
-.Fn accept4
-sets these properties consistently,
-but may not be fully portable across
-.Ux
-platforms.
-.Sh RETURN VALUES
-These calls return \-1 on error.
-If they succeed, they return a non-negative
-integer that is a descriptor for the accepted socket.
-.Sh ERRORS
-The
-.Fn accept
-and
-.Fn accept4
-system calls will fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The descriptor is invalid.
-.It Bq Er EINTR
-The
-.Fn accept
-operation was interrupted.
-.It Bq Er EMFILE
-The per-process descriptor table is full.
-.It Bq Er ENFILE
-The system file table is full.
-.It Bq Er ENOTSOCK
-The descriptor references a file, not a socket.
-.It Bq Er EINVAL
-.Xr listen 2
-has not been called on the socket descriptor.
-.It Bq Er EFAULT
-The
-.Fa addr
-argument is not in a writable part of the
-user address space.
-.It Bo Er EWOULDBLOCK Bc or Bq Er EAGAIN
-The socket is marked non-blocking and no connections
-are present to be accepted.
-.It Bq Er ECONNABORTED
-A connection arrived, but it was closed while waiting
-on the listen queue.
-.El
-.Pp
-The
-.Fn accept4
-system call will also fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Fa flags
-argument is invalid.
-.El
-.Sh SEE ALSO
-.Xr bind 2 ,
-.Xr connect 2 ,
-.Xr getpeername 2 ,
-.Xr getsockname 2 ,
-.Xr listen 2 ,
-.Xr select 2 ,
-.Xr socket 2 ,
-.Xr accept_filter 9
-.Sh HISTORY
-The
-.Fn accept
-system call appeared in
-.Bx 4.2 .
-.Pp
-The
-.Fn accept4
-system call appeared in
-.Fx 10.0 .
diff --git a/lib/libc/sys/accept.c b/lib/libc/sys/accept.c
index 38e32f2c836d..95c8b4a58c74 100644
--- a/lib/libc/sys/accept.c
+++ b/lib/libc/sys/accept.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2014 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/syscall.h>
#include <sys/socket.h>
@@ -44,7 +40,5 @@ __weak_reference(__sys_accept, __accept);
int
accept(int s, struct sockaddr *addr, socklen_t *addrlen)
{
-
- return (((int (*)(int, struct sockaddr *, socklen_t *))
- __libc_interposing[INTERPOS_accept])(s, addr, addrlen));
+ return (INTERPOS_SYS(accept, s, addr, addrlen));
}
diff --git a/lib/libc/sys/accept4.c b/lib/libc/sys/accept4.c
index 2907b047efdc..1a1f75c9f528 100644
--- a/lib/libc/sys/accept4.c
+++ b/lib/libc/sys/accept4.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2014 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/syscall.h>
#include <sys/socket.h>
@@ -44,7 +40,5 @@ __weak_reference(__sys_accept4, __accept4);
int
accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags)
{
-
- return (((int (*)(int, struct sockaddr *, socklen_t *, int))
- __libc_interposing[INTERPOS_accept4])(s, addr, addrlen, flags));
+ return (INTERPOS_SYS(accept4, s, addr, addrlen, flags));
}
diff --git a/lib/libc/sys/access.2 b/lib/libc/sys/access.2
deleted file mode 100644
index 12af63385780..000000000000
--- a/lib/libc/sys/access.2
+++ /dev/null
@@ -1,272 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)access.2 8.2 (Berkeley) 4/1/94
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2021
-.Dt ACCESS 2
-.Os
-.Sh NAME
-.Nm access ,
-.Nm eaccess ,
-.Nm faccessat
-.Nd check accessibility of a file
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn access "const char *path" "int mode"
-.Ft int
-.Fn eaccess "const char *path" "int mode"
-.Ft int
-.Fn faccessat "int fd" "const char *path" "int mode" "int flag"
-.Sh DESCRIPTION
-The
-.Fn access
-and
-.Fn eaccess
-system calls check the accessibility of the
-file named by
-the
-.Fa path
-argument
-for the access permissions indicated by
-the
-.Fa mode
-argument.
-The value of
-.Fa mode
-is either the bitwise-inclusive OR of the access permissions to be
-checked
-.Dv ( R_OK
-for read permission,
-.Dv W_OK
-for write permission, and
-.Dv X_OK
-for execute/search permission),
-or the existence test
-.Pq Dv F_OK .
-.Pp
-For additional information, see the
-.Sx "File Access Permission"
-section of
-.Xr intro 2 .
-.Pp
-The
-.Fn eaccess
-system call uses
-the effective user ID and the group access list
-to authorize the request;
-the
-.Fn access
-system call uses
-the real user ID in place of the effective user ID,
-the real group ID in place of the effective group ID,
-and the rest of the group access list.
-.Pp
-The
-.Fn faccessat
-system call is equivalent to
-.Fn access
-except in the case where
-.Fa path
-specifies a relative path.
-In this case the file whose accessibility is to be determined is
-located relative to the directory associated with the file descriptor
-.Fa fd
-instead of the current working directory.
-If
-.Fn faccessat
-is passed the special value
-.Dv AT_FDCWD
-in the
-.Fa fd
-parameter, the current working directory is used and the behavior is
-identical to a call to
-.Fn access .
-Values for
-.Fa flag
-are constructed by a bitwise-inclusive OR of flags from the following
-list, defined in
-.In fcntl.h :
-.Bl -tag -width indent
-.It Dv AT_EACCESS
-The checks for accessibility are performed using the effective user and group
-IDs instead of the real user and group ID as required in a call to
-.Fn access .
-.It Dv AT_RESOLVE_BENEATH
-Only walk paths below the directory specified by the
-.Ar fd
-descriptor.
-See the description of the
-.Dv O_RESOLVE_BENEATH
-flag in the
-.Xr open 2
-manual page.
-.It Dv AT_EMPTY_PATH
-If the
-.Fa path
-argument is an empty string, operate on the file or directory
-referenced by the descriptor
-.Fa fd .
-If
-.Fa fd
-is equal to
-.Dv AT_FDCWD ,
-operate on the current working directory.
-.El
-.Pp
-Even if a process's real or effective user has appropriate privileges
-and indicates success for
-.Dv X_OK ,
-the file may not actually have execute permission bits set.
-Likewise for
-.Dv R_OK
-and
-.Dv W_OK .
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-.Fn access ,
-.Fn eaccess ,
-or
-.Fn faccessat
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The value of the
-.Fa mode
-argument is invalid.
-.It Bq Er ENOTDIR
-A component of the path prefix is not a directory.
-.It Bq Er ENAMETOOLONG
-A component of a pathname exceeded 255 characters,
-or an entire path name exceeded 1023 characters.
-.It Bq Er ENOENT
-The named file does not exist.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating the pathname.
-.It Bq Er EROFS
-Write access is requested for a file on a read-only file system.
-.It Bq Er ETXTBSY
-Write access is requested for a pure procedure (shared text)
-file presently being executed.
-.It Bq Er EACCES
-Permission bits of the file mode do not permit the requested
-access, or search permission is denied on a component of the
-path prefix.
-.It Bq Er EFAULT
-The
-.Fa path
-argument
-points outside the process's allocated address space.
-.It Bq Er EIO
-An I/O error occurred while reading from or writing to the file system.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.El
-.Pp
-Also, the
-.Fn faccessat
-system call may fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa path
-argument does not specify an absolute path and the
-.Fa fd
-argument is
-neither
-.Dv AT_FDCWD
-nor a valid file descriptor.
-.It Bq Er EINVAL
-The value of the
-.Fa flag
-argument is not valid.
-.It Bq Er ENOTDIR
-The
-.Fa path
-argument is not an absolute path and
-.Fa fd
-is neither
-.Dv AT_FDCWD
-nor a file descriptor associated with a directory.
-.It Bq Er ENOTCAPABLE
-.Fa path
-is an absolute path,
-or contained a ".." component leading to a
-directory outside of the directory hierarchy specified by
-.Fa fd ,
-and the process is in capability mode.
-.El
-.Sh SEE ALSO
-.Xr chmod 2 ,
-.Xr intro 2 ,
-.Xr stat 2
-.Sh STANDARDS
-The
-.Fn access
-system call is expected to conform to
-.St -p1003.1-90 .
-The
-.Fn faccessat
-system call follows The Open Group Extended API Set 2 specification.
-.Sh HISTORY
-The
-.Fn access
-function appeared in
-.At v7 .
-The
-.Fn faccessat
-system call appeared in
-.Fx 8.0 .
-.Sh SECURITY CONSIDERATIONS
-The
-.Fn access
-system call
-is a potential security hole due to race conditions and
-should never be used.
-Set-user-ID and set-group-ID applications should restore the
-effective user or group ID,
-and perform actions directly rather than use
-.Fn access
-to simulate access checks for the real user or group ID.
-The
-.Fn eaccess
-system call
-likewise may be subject to races if used inappropriately.
-.Pp
-.Fn access
-remains useful for providing clues to users as to whether operations
-make sense for particular filesystem objects (e.g. 'delete' menu
-item only highlighted in a writable folder ... avoiding interpretation
-of the st_mode bits that the application might not understand --
-e.g. in the case of AFS).
-It also allows a cheaper file existence test than
-.Xr stat 2 .
diff --git a/lib/libc/sys/acct.2 b/lib/libc/sys/acct.2
deleted file mode 100644
index 43a48972ee8d..000000000000
--- a/lib/libc/sys/acct.2
+++ /dev/null
@@ -1,133 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)acct.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2020
-.Dt ACCT 2
-.Os
-.Sh NAME
-.Nm acct
-.Nd enable or disable process accounting
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn acct "const char *file"
-.Sh DESCRIPTION
-The
-.Fn acct
-system call enables or disables the collection of system accounting
-records.
-If the argument
-.Fa file
-is a null pointer, accounting is disabled.
-If
-.Fa file
-is an
-.Em existing
-pathname (null-terminated), record collection is enabled and for
-every process initiated which terminates under normal
-conditions an accounting record is appended to
-.Fa file .
-Abnormal conditions of termination are reboots
-or other fatal system problems.
-Records for processes which never terminate cannot be
-produced by
-.Fn acct .
-.Pp
-For more information on the record structure used by
-.Fn acct ,
-see
-.In sys/acct.h
-and
-.Xr acct 5 .
-.Pp
-This call is permitted only to the super-user.
-.Sh NOTES
-Accounting is automatically disabled when the file system the
-accounting file resides on runs out of space; it is enabled when
-space once again becomes available.
-The values controlling this behaviour can be modified using the following
-.Xr sysctl 8
-variables:
-.Bl -tag -width ".Va kern.acct_chkfreq"
-.It Va kern.acct_chkfreq
-Specifies the frequency (in seconds) with which free disk
-space should be checked.
-.It Va kern.acct_resume
-The percentage of free disk space above which process
-accounting will resume.
-.It Va kern.acct_suspend
-The percentage of free disk space below which process
-accounting will suspend.
-.El
-.Sh RETURN VALUES
-On error -1 is returned.
-The file must exist and the call may be exercised only by the super-user.
-.Sh ERRORS
-The
-.Fn acct
-system call will fail if one of the following is true:
-.Bl -tag -width Er
-.It Bq Er EPERM
-The caller is not the super-user.
-.It Bq Er ENOTDIR
-A component of the path prefix is not a directory.
-.It Bq Er ENAMETOOLONG
-A component of a pathname exceeded 255 characters,
-or an entire path name exceeded 1023 characters.
-.It Bq Er ENOENT
-The named file does not exist.
-.It Bq Er EACCES
-Search permission is denied for a component of the path prefix,
-or the path name is not a regular file.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating the pathname.
-.It Bq Er EROFS
-The named file resides on a read-only file system.
-.It Bq Er EFAULT
-The
-.Fa file
-argument
-points outside the process's allocated address space.
-.It Bq Er EIO
-An I/O error occurred while reading from or writing to the file system.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.El
-.Sh SEE ALSO
-.Xr acct 5 ,
-.Xr accton 8 ,
-.Xr sa 8
-.Sh HISTORY
-The
-.Fn acct
-function appeared in
-.At v7 .
diff --git a/lib/libc/sys/adjtime.2 b/lib/libc/sys/adjtime.2
deleted file mode 100644
index 18f6f368d140..000000000000
--- a/lib/libc/sys/adjtime.2
+++ /dev/null
@@ -1,109 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)adjtime.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd May 13, 2021
-.Dt ADJTIME 2
-.Os
-.Sh NAME
-.Nm adjtime
-.Nd "correct the time to allow synchronization of the system clock"
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/time.h
-.Ft int
-.Fn adjtime "const struct timeval *delta" "struct timeval *olddelta"
-.Sh DESCRIPTION
-The
-.Fn adjtime
-system call
-makes small adjustments to the system time, as returned by
-.Xr gettimeofday 2 ,
-advancing or retarding it
-by the time specified by the timeval
-.Fa delta .
-If
-.Fa delta
-is negative, the clock is
-slowed down by incrementing it more slowly than normal until
-the correction is complete.
-If
-.Fa delta
-is positive, a larger increment than normal
-is used.
-The skew used to perform the correction is generally a fraction of one percent.
-Thus, the time is always
-a monotonically increasing function.
-A time correction from an earlier call to
-.Fn adjtime
-may not be finished when
-.Fn adjtime
-is called again.
-If
-.Fa olddelta
-is not a null pointer,
-the structure pointed to will contain, upon return, the
-number of microseconds still to be corrected
-from the earlier call.
-.Pp
-This call may be used by time servers that synchronize the clocks
-of computers in a local area network.
-Such time servers would slow down the clocks of some machines
-and speed up the clocks of others to bring them to the average network time.
-.Pp
-The
-.Fn adjtime
-system call
-is restricted to the super-user.
-.Sh RETURN VALUES
-.Rv -std adjtime
-.Sh ERRORS
-The
-.Fn adjtime
-system call will fail if:
-.Bl -tag -width Er
-.It Bq Er EFAULT
-An argument points outside the process's allocated address space.
-.It Bq Er EPERM
-The process's effective user ID is not that of the super-user.
-.El
-.Sh SEE ALSO
-.Xr date 1 ,
-.Xr gettimeofday 2
-.Rs
-.%T "TSP: The Time Synchronization Protocol for UNIX 4.3BSD"
-.%A R. Gusella
-.%A S. Zatti
-.Re
-.Sh HISTORY
-The
-.Fn adjtime
-system call appeared in
-.Bx 4.3 .
diff --git a/lib/libc/sys/aio_cancel.2 b/lib/libc/sys/aio_cancel.2
deleted file mode 100644
index 3d9cbaf2ff4f..000000000000
--- a/lib/libc/sys/aio_cancel.2
+++ /dev/null
@@ -1,117 +0,0 @@
-.\" Copyright (c) 1999 Softweyr LLC.
-.\" All rights reserved.
-.\"
-.\" 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 Softweyr LLC 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 Softweyr LLC 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd January 19, 2000
-.Dt AIO_CANCEL 2
-.Os
-.Sh NAME
-.Nm aio_cancel
-.Nd cancel an outstanding asynchronous I/O operation (REALTIME)
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In aio.h
-.Ft int
-.Fn aio_cancel "int fildes" "struct aiocb *iocb"
-.Sh DESCRIPTION
-The
-.Fn aio_cancel
-system call cancels the outstanding asynchronous
-I/O request for the file descriptor specified in
-.Fa fildes .
-If
-.Fa iocb
-is specified, only that specific asynchronous I/O request is cancelled.
-.Pp
-Normal asynchronous notification occurs for cancelled requests.
-Requests complete with an error result of
-.Er ECANCELED .
-.Sh RESTRICTIONS
-The
-.Fn aio_cancel
-system call does not cancel asynchronous I/O requests for raw disk devices.
-The
-.Fn aio_cancel
-system call will always return
-.Dv AIO_NOTCANCELED
-for file descriptors associated with raw disk devices.
-.Sh RETURN VALUES
-The
-.Fn aio_cancel
-system call returns -1 to indicate an error, or one of the following:
-.Bl -tag -width Dv
-.It Bq Dv AIO_CANCELED
-All outstanding requests meeting the criteria specified were cancelled.
-.It Bq Dv AIO_NOTCANCELED
-Some requests were not cancelled, status for the requests should be
-checked with
-.Xr aio_error 2 .
-.It Bq Dv AIO_ALLDONE
-All of the requests meeting the criteria have finished.
-.El
-.Sh ERRORS
-An error return from
-.Fn aio_cancel
-indicates:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa fildes
-argument
-is an invalid file descriptor.
-.El
-.Sh SEE ALSO
-.Xr aio_error 2 ,
-.Xr aio_read 2 ,
-.Xr aio_return 2 ,
-.Xr aio_suspend 2 ,
-.Xr aio_write 2 ,
-.Xr aio 4
-.Sh STANDARDS
-The
-.Fn aio_cancel
-system call is expected to conform to the
-.St -p1003.1
-standard.
-.Sh HISTORY
-The
-.Fn aio_cancel
-system call first appeared in
-.Fx 3.0 .
-The first functional implementation of
-.Fn aio_cancel
-appeared in
-.Fx 4.0 .
-.Sh AUTHORS
-.An -nosplit
-This
-manual page was originally written by
-.An Wes Peters Aq Mt wes@softweyr.com .
-.An Christopher M Sedore Aq Mt cmsedore@maxwell.syr.edu
-updated it when
-.Fn aio_cancel
-was implemented for
-.Fx 4.0 .
diff --git a/lib/libc/sys/aio_error.2 b/lib/libc/sys/aio_error.2
deleted file mode 100644
index 1ec6505a64aa..000000000000
--- a/lib/libc/sys/aio_error.2
+++ /dev/null
@@ -1,105 +0,0 @@
-.\" Copyright (c) 1999 Softweyr LLC.
-.\" All rights reserved.
-.\"
-.\" 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 Softweyr LLC 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 Softweyr LLC 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd January 2, 2021
-.Dt AIO_ERROR 2
-.Os
-.Sh NAME
-.Nm aio_error
-.Nd retrieve error status of asynchronous I/O operation (REALTIME)
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In aio.h
-.Ft int
-.Fn aio_error "const struct aiocb *iocb"
-.Sh DESCRIPTION
-The
-.Fn aio_error
-system call returns the error status of the asynchronous I/O request
-associated with the structure pointed to by
-.Fa iocb .
-.Sh RETURN VALUES
-If the asynchronous I/O request has completed successfully,
-.Fn aio_error
-returns 0.
-If the request has not yet completed,
-.Er EINPROGRESS
-is returned.
-If the request has completed unsuccessfully the error
-status is returned as described in
-.Xr read 2 ,
-.Xr readv 2 ,
-.Xr write 2 ,
-.Xr writev 2 ,
-or
-.Xr fsync 2 .
-On failure,
-.Fn aio_error
-returns
-.Dv -1
-and sets
-.Dv errno
-to indicate the error condition.
-.Sh ERRORS
-The
-.Fn aio_error
-system call will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Fa iocb
-argument
-does not reference an outstanding asynchronous I/O request.
-.El
-.Sh SEE ALSO
-.Xr aio_cancel 2 ,
-.Xr aio_read 2 ,
-.Xr aio_readv 2 ,
-.Xr aio_return 2 ,
-.Xr aio_suspend 2 ,
-.Xr aio_write 2 ,
-.Xr aio_writev 2 ,
-.Xr fsync 2 ,
-.Xr read 2 ,
-.Xr write 2 ,
-.Xr aio 4
-.Sh STANDARDS
-The
-.Fn aio_error
-system call
-is expected to conform to the
-.St -p1003.1
-standard.
-.Sh HISTORY
-The
-.Fn aio_error
-system call first appeared in
-.Fx 3.0 .
-.Sh AUTHORS
-This
-manual page was written by
-.An Wes Peters Aq Mt wes@softweyr.com .
diff --git a/lib/libc/sys/aio_fsync.2 b/lib/libc/sys/aio_fsync.2
deleted file mode 100644
index 0ce47edfb33f..000000000000
--- a/lib/libc/sys/aio_fsync.2
+++ /dev/null
@@ -1,188 +0,0 @@
-.\" Copyright (c) 2013 Sergey Kandaurov
-.\" All rights reserved.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd January 6, 2021
-.Dt AIO_FSYNC 2
-.Os
-.Sh NAME
-.Nm aio_fsync
-.Nd asynchronous file synchronization (REALTIME)
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In aio.h
-.Ft int
-.Fn aio_fsync "int op" "struct aiocb *iocb"
-.Sh DESCRIPTION
-The
-.Fn aio_fsync
-system call allows the calling process to move all modified data
-associated with the descriptor
-.Fa iocb->aio_fildes
-to a permanent storage device.
-The call returns immediately after the synchronization request has been
-enqueued to the descriptor; the synchronization may or may not have
-completed at the time the call returns.
-.Pp
-The
-.Fa op
-argument can be set to
-.Dv O_SYNC
-to cause all currently queued I/O operations to be completed
-as if by a call to
-.Xr fsync 2 ,
-or
-.Dv O_DSYNC
-for the behavior of
-.Xr fdatasync 2 .
-.Pp
-If _POSIX_PRIORITIZED_IO is defined, and the descriptor supports it,
-then the enqueued operation is submitted at a priority equal to that
-of the calling process minus
-.Fa iocb->aio_reqprio .
-.Pp
-The
-.Fa iocb
-pointer may be subsequently used as an argument to
-.Fn aio_return
-and
-.Fn aio_error
-in order to determine return or error status for the enqueued operation
-while it is in progress.
-.Pp
-If the request could not be enqueued (generally due to invalid arguments),
-the call returns without having enqueued the request.
-.Pp
-The
-.Fa iocb->aio_sigevent
-structure can be used to request notification of the operation's
-completion as described in
-.Xr aio 4 .
-.Sh RESTRICTIONS
-The Asynchronous I/O Control Block structure pointed to by
-.Fa iocb
-must remain valid until the
-operation has completed.
-.Pp
-The asynchronous I/O control buffer
-.Fa iocb
-should be zeroed before the
-.Fn aio_fsync
-call to avoid passing bogus context information to the kernel.
-.Pp
-Modification of the Asynchronous I/O Control Block structure is not allowed
-while the request is queued.
-.Sh RETURN VALUES
-.Rv -std aio_fsync
-.Sh ERRORS
-The
-.Fn aio_fsync
-system call will fail if:
-.Bl -tag -width Er
-.It Bq Er EAGAIN
-The request was not queued because of system resource limitations.
-.It Bq Er EINVAL
-The asynchronous notification method in
-.Fa iocb->aio_sigevent.sigev_notify
-is invalid or not supported.
-.It Bq Er EOPNOTSUPP
-Asynchronous file synchronization operations on the file descriptor
-.Fa iocb->aio_fildes
-are unsafe and unsafe asynchronous I/O operations are disabled.
-.It Bq Er EINVAL
-A value of the
-.Fa op
-argument is not set to
-.Dv O_SYNC
-or
-.Dv O_DSYNC .
-.El
-.Pp
-The following conditions may be synchronously detected when the
-.Fn aio_fsync
-system call is made, or asynchronously, at any time thereafter.
-If they are detected at call time,
-.Fn aio_fsync
-returns -1 and sets
-.Va errno
-appropriately; otherwise the
-.Fn aio_return
-system call must be called, and will return -1, and
-.Fn aio_error
-must be called to determine the actual value that would have been
-returned in
-.Va errno .
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa iocb->aio_fildes
-argument
-is not a valid descriptor.
-.It Bq Er EINVAL
-This implementation does not support synchronized I/O for this file.
-.El
-.Pp
-If the request is successfully enqueued, but subsequently cancelled
-or an error occurs, the value returned by the
-.Fn aio_return
-system call is per the
-.Xr read 2
-and
-.Xr write 2
-system calls, and the value returned by the
-.Fn aio_error
-system call is one of the error returns from the
-.Xr read 2
-or
-.Xr write 2
-system calls.
-.Sh SEE ALSO
-.Xr aio_cancel 2 ,
-.Xr aio_error 2 ,
-.Xr aio_read 2 ,
-.Xr aio_return 2 ,
-.Xr aio_suspend 2 ,
-.Xr aio_waitcomplete 2 ,
-.Xr aio_write 2 ,
-.Xr fsync 2 ,
-.Xr sigevent 3 ,
-.Xr siginfo 3 ,
-.Xr aio 4
-.Sh STANDARDS
-The
-.Fn aio_fsync
-system call is expected to conform to the
-.St -p1003.1
-standard.
-.Sh HISTORY
-The
-.Fn aio_fsync
-system call first appeared in
-.Fx 7.0 .
-The
-.Dv O_DSYNC
-option appeared in
-.Fx 13.0 .
diff --git a/lib/libc/sys/aio_mlock.2 b/lib/libc/sys/aio_mlock.2
deleted file mode 100644
index f7f4a2781a91..000000000000
--- a/lib/libc/sys/aio_mlock.2
+++ /dev/null
@@ -1,138 +0,0 @@
-.\" Copyright (c) 2013 Gleb Smirnoff <glebius@FreeBSD.org>
-.\" All rights reserved.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd August 19, 2016
-.Dt AIO_MLOCK 2
-.Os
-.Sh NAME
-.Nm aio_mlock
-.Nd asynchronous
-.Xr mlock 2
-operation
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In aio.h
-.Ft int
-.Fn aio_mlock "struct aiocb *iocb"
-.Sh DESCRIPTION
-The
-.Fn aio_mlock
-system call allows the calling process to lock into memory the
-physical pages associated with the virtual address range starting at
-.Fa iocb->aio_buf
-for
-.Fa iocb->aio_nbytes
-bytes.
-The call returns immediately after the locking request has
-been enqueued; the operation may or may not have completed at the time
-the call returns.
-.Pp
-The
-.Fa iocb
-pointer may be subsequently used as an argument to
-.Fn aio_return
-and
-.Fn aio_error
-in order to determine return or error status for the enqueued operation
-while it is in progress.
-.Pp
-If the request could not be enqueued (generally due to
-.Xr aio 4
-limits),
-then the call returns without having enqueued the request.
-.Pp
-The
-.Fa iocb->aio_sigevent
-structure can be used to request notification of the operation's
-completion as described in
-.Xr aio 4 .
-.Sh RESTRICTIONS
-The Asynchronous I/O Control Block structure pointed to by
-.Fa iocb
-and the buffer that the
-.Fa iocb->aio_buf
-member of that structure references must remain valid until the
-operation has completed.
-.Pp
-The asynchronous I/O control buffer
-.Fa iocb
-should be zeroed before the
-.Fn aio_mlock
-call to avoid passing bogus context information to the kernel.
-.Pp
-Modifications of the Asynchronous I/O Control Block structure or the
-memory mapping described by the virtual address range are not allowed
-while the request is queued.
-.Sh RETURN VALUES
-.Rv -std aio_mlock
-.Sh ERRORS
-The
-.Fn aio_mlock
-system call will fail if:
-.Bl -tag -width Er
-.It Bq Er EAGAIN
-The request was not queued because of system resource limitations.
-.It Bq Er EINVAL
-The asynchronous notification method in
-.Fa iocb->aio_sigevent.sigev_notify
-is invalid or not supported.
-.El
-.Pp
-If the request is successfully enqueued, but subsequently cancelled
-or an error occurs, the value returned by the
-.Fn aio_return
-system call is per the
-.Xr mlock 2
-system call, and the value returned by the
-.Fn aio_error
-system call is one of the error returns from the
-.Xr mlock 2
-system call, or
-.Er ECANCELED
-if the request was explicitly cancelled via a call to
-.Fn aio_cancel .
-.Sh SEE ALSO
-.Xr aio_cancel 2 ,
-.Xr aio_error 2 ,
-.Xr aio_return 2 ,
-.Xr mlock 2 ,
-.Xr sigevent 3 ,
-.Xr aio 4
-.Sh PORTABILITY
-The
-.Fn aio_mlock
-system call is a
-.Fx
-extension, and should not be used in portable code.
-.Sh HISTORY
-The
-.Fn aio_mlock
-system call first appeared in
-.Fx 10.0 .
-.Sh AUTHORS
-The system call was introduced by
-.An Gleb Smirnoff Aq Mt glebius@FreeBSD.org .
diff --git a/lib/libc/sys/aio_read.2 b/lib/libc/sys/aio_read.2
deleted file mode 100644
index 0327ef1f747b..000000000000
--- a/lib/libc/sys/aio_read.2
+++ /dev/null
@@ -1,263 +0,0 @@
-.\" Copyright (c) 1998 Terry Lambert
-.\" All rights reserved.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd January 2, 2021
-.Dt AIO_READ 2
-.Os
-.Sh NAME
-.Nm aio_read ,
-.Nm aio_readv
-.Nd asynchronous read from a file (REALTIME)
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In aio.h
-.Ft int
-.Fn aio_read "struct aiocb *iocb"
-.In sys/uio.h
-.Ft int
-.Fn aio_readv "struct aiocb *iocb"
-.Sh DESCRIPTION
-The
-.Fn aio_read
-and
-.Fn aio_readv
-system calls allow the calling process to read
-from the descriptor
-.Fa iocb->aio_fildes
-beginning at the offset
-.Fa iocb->aio_offset .
-.Fn aio_read
-will read
-.Fa iocb->aio_nbytes
-from the buffer pointed to by
-.Fa iocb->aio_buf ,
-whereas
-.Fn aio_readv
-reads the data into the
-.Fa iocb->aio_iovcnt
-buffers specified by the members of the
-.Fa iocb->aio_iov
-array.
-Both syscalls return immediately after the read request has
-been enqueued to the descriptor; the read may or may not have
-completed at the time the call returns.
-.Pp
-For
-.Fn aio_readv
-the
-.Fa iovec
-structure is defined in
-.Xr readv 2 .
-.Pp
-If _POSIX_PRIORITIZED_IO is defined, and the descriptor supports it,
-then the enqueued operation is submitted at a priority equal to that
-of the calling process minus
-.Fa iocb->aio_reqprio .
-.Pp
-The
-.Fa iocb->aio_lio_opcode
-argument
-is ignored by the
-.Fn aio_read
-and
-.Fn aio_readv
-system calls.
-.Pp
-The
-.Fa iocb
-pointer may be subsequently used as an argument to
-.Fn aio_return
-and
-.Fn aio_error
-in order to determine return or error status for the enqueued operation
-while it is in progress.
-.Pp
-If the request could not be enqueued (generally due to invalid arguments),
-then the call returns without having enqueued the request.
-.Pp
-If the request is successfully enqueued, the value of
-.Fa iocb->aio_offset
-can be modified during the request as context, so this value must
-not be referenced after the request is enqueued.
-.Pp
-The
-.Fa iocb->aio_sigevent
-structure can be used to request notification of the operation's
-completion as described in
-.Xr aio 4 .
-.Sh RESTRICTIONS
-The Asynchronous I/O Control Block structure pointed to by
-.Fa iocb
-and the buffer that the
-.Fa iocb->aio_buf
-member of that structure references must remain valid until the
-operation has completed.
-.Pp
-The asynchronous I/O control buffer
-.Fa iocb
-should be zeroed before the
-.Fn aio_read
-call to avoid passing bogus context information to the kernel.
-.Pp
-Modifications of the Asynchronous I/O Control Block structure or the
-buffer contents are not allowed while the request is queued.
-.Pp
-If the file offset in
-.Fa iocb->aio_offset
-is past the offset maximum for
-.Fa iocb->aio_fildes ,
-no I/O will occur.
-.Sh RETURN VALUES
-.Rv -std aio_read aio_readv
-.Sh DIAGNOSTICS
-None.
-.Sh ERRORS
-The
-.Fn aio_read
-and
-.Fn aio_readv
-system calls will fail if:
-.Bl -tag -width Er
-.It Bq Er EAGAIN
-The request was not queued because of system resource limitations.
-.It Bq Er EFAULT
-Part of
-.Fa aio_iov
-points outside the process's allocated address space.
-.It Bq Er EINVAL
-The asynchronous notification method in
-.Fa iocb->aio_sigevent.sigev_notify
-is invalid or not supported.
-.It Bq Er EOPNOTSUPP
-Asynchronous read operations on the file descriptor
-.Fa iocb->aio_fildes
-are unsafe and unsafe asynchronous I/O operations are disabled.
-.El
-.Pp
-The following conditions may be synchronously detected when the
-.Fn aio_read
-or
-.Fn aio_readv
-system call is made, or asynchronously, at any time thereafter.
-If they
-are detected at call time,
-.Fn aio_read
-or
-.Fn aio_readv
-returns -1 and sets
-.Va errno
-appropriately; otherwise the
-.Fn aio_return
-system call must be called, and will return -1, and
-.Fn aio_error
-must be called to determine the actual value that would have been
-returned in
-.Va errno .
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa iocb->aio_fildes
-argument
-is invalid.
-.It Bq Er EINVAL
-The offset
-.Fa iocb->aio_offset
-is not valid, the priority specified by
-.Fa iocb->aio_reqprio
-is not a valid priority, or the number of bytes specified by
-.Fa iocb->aio_nbytes
-is not valid.
-.It Bq Er EOVERFLOW
-The file is a regular file,
-.Fa iocb->aio_nbytes
-is greater than zero, the starting offset in
-.Fa iocb->aio_offset
-is before the end of the file, but is at or beyond the
-.Fa iocb->aio_fildes
-offset maximum.
-.El
-.Pp
-If the request is successfully enqueued, but subsequently cancelled
-or an error occurs, the value returned by the
-.Fn aio_return
-system call is per the
-.Xr read 2
-system call, and the value returned by the
-.Fn aio_error
-system call is either one of the error returns from the
-.Xr read 2
-system call, or one of:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa iocb->aio_fildes
-argument
-is invalid for reading.
-.It Bq Er ECANCELED
-The request was explicitly cancelled via a call to
-.Fn aio_cancel .
-.It Bq Er EINVAL
-The offset
-.Fa iocb->aio_offset
-would be invalid.
-.El
-.Sh SEE ALSO
-.Xr aio_cancel 2 ,
-.Xr aio_error 2 ,
-.Xr aio_return 2 ,
-.Xr aio_suspend 2 ,
-.Xr aio_waitcomplete 2 ,
-.Xr aio_write 2 ,
-.Xr sigevent 3 ,
-.Xr siginfo 3 ,
-.Xr aio 4
-.Sh STANDARDS
-The
-.Fn aio_read
-system call is expected to conform to the
-.St -p1003.1
-standard.
-The
-.Fn aio_readv
-system call is a FreeBSD extension, and should not be used in portable code.
-.Sh HISTORY
-The
-.Fn aio_read
-system call first appeared in
-.Fx 3.0 .
-The
-.Fn aio_readv
-system call first appeared in
-.Fx 13.0 .
-.Sh AUTHORS
-This
-manual page was written by
-.An Terry Lambert Aq Mt terry@whistle.com .
-.Sh BUGS
-Invalid information in
-.Fa iocb->_aiocb_private
-may confuse the kernel.
diff --git a/lib/libc/sys/aio_return.2 b/lib/libc/sys/aio_return.2
deleted file mode 100644
index aebe978fe140..000000000000
--- a/lib/libc/sys/aio_return.2
+++ /dev/null
@@ -1,110 +0,0 @@
-.\" Copyright (c) 1999 Softweyr LLC.
-.\" All rights reserved.
-.\"
-.\" 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 Softweyr LLC 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 Softweyr LLC 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd January 11, 2021
-.Dt AIO_RETURN 2
-.Os
-.Sh NAME
-.Nm aio_return
-.Nd retrieve return status of asynchronous I/O operation (REALTIME)
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In aio.h
-.Ft ssize_t
-.Fn aio_return "struct aiocb *iocb"
-.Sh DESCRIPTION
-The
-.Fn aio_return
-system call returns the final status of the asynchronous I/O request
-associated with the structure pointed to by
-.Fa iocb .
-.Pp
-The
-.Fn aio_return
-system call
-should only be called once, to obtain the final status of an asynchronous
-I/O operation once it has completed
-.Xr ( aio_error 2
-returns something other than
-.Er EINPROGRESS ) .
-.Sh RETURN VALUES
-If the asynchronous I/O request has completed, the status is returned
-as described in
-.Xr read 2 ,
-.Xr readv 2 ,
-.Xr write 2 ,
-.Xr writev 2 ,
-or
-.Xr fsync 2 .
-Otherwise,
-.Fn aio_return
-returns \-1 and sets
-.Va errno
-to indicate the error condition.
-.Sh ERRORS
-The
-.Fn aio_return
-system call will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Fa iocb
-argument
-does not reference a completed asynchronous I/O request.
-.It Bq Er EINVAL
-The I/O operation was submitted with
-.Fn lio_listio ,
-and the value of the
-.Fa aio_lio_opcode
-is invalid.
-.El
-.Sh SEE ALSO
-.Xr aio_cancel 2 ,
-.Xr aio_error 2 ,
-.Xr aio_suspend 2 ,
-.Xr aio_waitcomplete 2 ,
-.Xr aio_write 2 ,
-.Xr fsync 2 ,
-.Xr read 2 ,
-.Xr write 2 ,
-.Xr aio 4
-.Sh STANDARDS
-The
-.Fn aio_return
-system call
-is expected to conform to the
-.St -p1003.1
-standard.
-.Sh HISTORY
-The
-.Fn aio_return
-system call first appeared in
-.Fx 3.0 .
-.Sh AUTHORS
-This
-manual page was written by
-.An Wes Peters Aq Mt wes@softweyr.com .
diff --git a/lib/libc/sys/aio_suspend.2 b/lib/libc/sys/aio_suspend.2
deleted file mode 100644
index b92e6866e8a4..000000000000
--- a/lib/libc/sys/aio_suspend.2
+++ /dev/null
@@ -1,117 +0,0 @@
-.\" Copyright (c) 1999 Softweyr LLC.
-.\" All rights reserved.
-.\"
-.\" 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 Softweyr LLC 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 Softweyr LLC 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd October 23, 2017
-.Dt AIO_SUSPEND 2
-.Os
-.Sh NAME
-.Nm aio_suspend
-.Nd suspend until asynchronous I/O operations or timeout complete (REALTIME)
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In aio.h
-.Ft int
-.Fn aio_suspend "const struct aiocb *const iocbs[]" "int niocb" "const struct timespec *timeout"
-.Sh DESCRIPTION
-The
-.Fn aio_suspend
-system call suspends the calling process until at least one of the
-specified asynchronous I/O requests have completed, a signal is
-delivered, or the
-.Fa timeout
-has passed.
-.Pp
-The
-.Fa iocbs
-argument
-is an array of
-.Fa niocb
-pointers to asynchronous I/O requests.
-Array members containing
-null pointers will be silently ignored.
-.Pp
-If
-.Fa timeout
-is not a null pointer, it specifies a maximum interval to suspend.
-If
-.Fa timeout
-is a null pointer, the suspend blocks indefinitely.
-To effect a
-poll, the
-.Fa timeout
-should point to a zero-value timespec structure.
-.Sh RETURN VALUES
-If one or more of the specified asynchronous I/O requests have
-completed,
-.Fn aio_suspend
-returns 0.
-Otherwise it returns -1 and sets
-.Va errno
-to indicate the error, as enumerated below.
-.Sh ERRORS
-The
-.Fn aio_suspend
-system call will fail if:
-.Bl -tag -width Er
-.It Bq Er EAGAIN
-the
-.Fa timeout
-expired before any I/O requests completed.
-.It Bq Er EINVAL
-The
-.Fa iocbs
-argument
-contains more asynchronous I/O requests than the
-.Va vfs.aio.max_aio_queue_per_proc
-.Xr sysctl 8
-variable, or at least one of the requests is not valid.
-.It Bq Er EINTR
-the suspend was interrupted by a signal.
-.El
-.Sh SEE ALSO
-.Xr aio_cancel 2 ,
-.Xr aio_error 2 ,
-.Xr aio_return 2 ,
-.Xr aio_waitcomplete 2 ,
-.Xr aio_write 2 ,
-.Xr aio 4
-.Sh STANDARDS
-The
-.Fn aio_suspend
-system call
-is expected to conform to the
-.St -p1003.1
-standard.
-.Sh HISTORY
-The
-.Fn aio_suspend
-system call first appeared in
-.Fx 3.0 .
-.Sh AUTHORS
-This
-manual page was written by
-.An Wes Peters Aq Mt wes@softweyr.com .
diff --git a/lib/libc/sys/aio_suspend.c b/lib/libc/sys/aio_suspend.c
index 020edf8a74fa..592cb5b0e1d7 100644
--- a/lib/libc/sys/aio_suspend.c
+++ b/lib/libc/sys/aio_suspend.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2014 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/aio.h>
#include "libc_private.h"
@@ -44,8 +40,5 @@ int
aio_suspend(const struct aiocb * const iocbs[], int niocb,
const struct timespec *timeout)
{
-
- return (((int (*)(const struct aiocb * const[], int,
- const struct timespec *))
- __libc_interposing[INTERPOS_aio_suspend])(iocbs, niocb, timeout));
+ return (INTERPOS_SYS(aio_suspend, iocbs, niocb, timeout));
}
diff --git a/lib/libc/sys/aio_waitcomplete.2 b/lib/libc/sys/aio_waitcomplete.2
deleted file mode 100644
index 66e7208d7b48..000000000000
--- a/lib/libc/sys/aio_waitcomplete.2
+++ /dev/null
@@ -1,137 +0,0 @@
-.\" Copyright (c) 1999 Christopher M Sedore.
-.\" All rights reserved.
-.\"
-.\" 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 ``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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd March 21, 2016
-.Dt AIO_WAITCOMPLETE 2
-.Os
-.Sh NAME
-.Nm aio_waitcomplete
-.Nd wait for the next completion of an aio request
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In aio.h
-.Ft ssize_t
-.Fn aio_waitcomplete "struct aiocb **iocbp" "struct timespec *timeout"
-.Sh DESCRIPTION
-The
-.Fn aio_waitcomplete
-system call waits for completion of an asynchronous I/O request.
-Upon completion,
-.Fn aio_waitcomplete
-returns the result of the function and sets
-.Fa iocbp
-to point to the structure associated with the original request.
-If an asynchronous I/O request is completed before
-.Fn aio_waitcomplete
-is called, it returns immediately with the completed request.
-.Pp
-If
-.Fa timeout
-is a non-NULL pointer, it specifies a maximum interval to wait for a
-asynchronous I/O request to complete.
-If
-.Fa timeout
-is a NULL pointer,
-.Fn aio_waitcomplete
-waits indefinitely.
-To effect a poll, the
-.Fa timeout
-argument should be non-NULL, pointing to a zero-valued timeval structure.
-.Pp
-The
-.Fn aio_waitcomplete
-system call also serves the function of
-.Fn aio_return ,
-thus
-.Fn aio_return
-should not be called for the control block returned in
-.Fa iocbp .
-.Sh RETURN VALUES
-If an asynchronous I/O request has completed,
-.Fa iocbp
-is set to point to the control block passed with the original request,
-and the status is returned as described in
-.Xr read 2 ,
-.Xr write 2 ,
-or
-.Xr fsync 2 .
-On failure,
-.Fn aio_waitcomplete
-returns
-.Dv -1 ,
-sets iocbp to
-.Dv NULL
-and sets
-.Va errno
-to indicate the error condition.
-.Sh ERRORS
-The
-.Fn aio_waitcomplete
-system call fails if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The specified time limit is invalid.
-.It Bq Er EAGAIN
-The process has not yet called
-.Fn aio_read
-or
-.Fn aio_write .
-.It Bq Er EINTR
-A signal was delivered before the timeout expired and before any
-asynchronous I/O requests completed.
-.It Bq Er EWOULDBLOCK
-.It Bq Er EINPROGRESS
-The specified time limit expired before any asynchronous I/O requests
-completed.
-.El
-.Sh SEE ALSO
-.Xr aio_cancel 2 ,
-.Xr aio_error 2 ,
-.Xr aio_read 2 ,
-.Xr aio_return 2 ,
-.Xr aio_suspend 2 ,
-.Xr aio_write 2 ,
-.Xr fsync 2 ,
-.Xr read 2 ,
-.Xr write 2 ,
-.Xr aio 4
-.Sh STANDARDS
-The
-.Fn aio_waitcomplete
-system call is a
-.Fx Ns -specific
-extension.
-.Sh HISTORY
-The
-.Fn aio_waitcomplete
-system call first appeared in
-.Fx 4.0 .
-.Sh AUTHORS
-The
-.Fn aio_waitcomplete
-system call and this manual page were written by
-.An Christopher M Sedore Aq Mt cmsedore@maxwell.syr.edu .
diff --git a/lib/libc/sys/aio_write.2 b/lib/libc/sys/aio_write.2
deleted file mode 100644
index 601515b0e7b0..000000000000
--- a/lib/libc/sys/aio_write.2
+++ /dev/null
@@ -1,258 +0,0 @@
-.\" Copyright (c) 1999 Softweyr LLC.
-.\" All rights reserved.
-.\"
-.\" 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 Softweyr LLC 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 Softweyr LLC 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd January 2, 2021
-.Dt AIO_WRITE 2
-.Os
-.Sh NAME
-.Nm aio_write ,
-.Nm aio_writev
-.Nd asynchronous write to a file (REALTIME)
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In aio.h
-.Ft int
-.Fn aio_write "struct aiocb *iocb"
-.In sys/uio.h
-.Ft int
-.Fn aio_writev "struct aiocb *iocb"
-.Sh DESCRIPTION
-The
-.Fn aio_write
-and
-.Fn aio_writev
-system calls allow the calling process to write
-to the descriptor
-.Fa iocb->aio_fildes .
-.Fn aio_write
-will write
-.Fa iocb->aio_nbytes
-from the buffer pointed to by
-.Fa iocb->aio_buf ,
-whereas
-.Fn aio_writev
-gathers the data from the
-.Fa iocb->aio_iovcnt
-buffers specified by the members of the
-.Fa iocb->aio_iov
-array.
-Both syscalls return immediately after the write request has been enqueued
-to the descriptor; the write may or may not have completed at the time
-the call returns.
-If the request could not be enqueued, generally due
-to invalid arguments, the call returns without having enqueued the
-request.
-.Pp
-For
-.Fn aio_writev
-the
-.Fa iovec
-structure is defined in
-.Xr writev 2 .
-.Pp
-If
-.Dv O_APPEND
-is set for
-.Fa iocb->aio_fildes ,
-write operations append to the file in the same order as the calls were
-made.
-If
-.Dv O_APPEND
-is not set for the file descriptor, the write operation will occur at
-the absolute position from the beginning of the file plus
-.Fa iocb->aio_offset .
-.Pp
-If
-.Dv _POSIX_PRIORITIZED_IO
-is defined, and the descriptor supports it, then the enqueued
-operation is submitted at a priority equal to that of the calling
-process minus
-.Fa iocb->aio_reqprio .
-.Pp
-The
-.Fa iocb
-pointer may be subsequently used as an argument to
-.Fn aio_return
-and
-.Fn aio_error
-in order to determine return or error status for the enqueued operation
-while it is in progress.
-.Pp
-If the request is successfully enqueued, the value of
-.Fa iocb->aio_offset
-can be modified during the request as context, so this value must not
-be referenced after the request is enqueued.
-.Pp
-The
-.Fa iocb->aio_sigevent
-structure can be used to request notification of the operation's
-completion as described in
-.Xr aio 4 .
-.Sh RESTRICTIONS
-The Asynchronous I/O Control Block structure pointed to by
-.Fa iocb
-and the buffer that the
-.Fa iocb->aio_buf
-member of that structure references must remain valid until the
-operation has completed.
-.Pp
-The asynchronous I/O control buffer
-.Fa iocb
-should be zeroed before the
-.Fn aio_write
-or
-.Fn aio_writev
-system call to avoid passing bogus context information to the kernel.
-.Pp
-Modifications of the Asynchronous I/O Control Block structure or the
-buffer contents are not allowed while the request is queued.
-.Pp
-If the file offset in
-.Fa iocb->aio_offset
-is past the offset maximum for
-.Fa iocb->aio_fildes ,
-no I/O will occur.
-.Sh RETURN VALUES
-.Rv -std aio_write aio_writev
-.Sh ERRORS
-The
-.Fn aio_write
-and
-.Fn aio_writev
-system calls will fail if:
-.Bl -tag -width Er
-.It Bq Er EAGAIN
-The request was not queued because of system resource limitations.
-.It Bq Er EFAULT
-Part of
-.Fa aio_iov
-points outside the process's allocated address space.
-.It Bq Er EINVAL
-The asynchronous notification method in
-.Fa iocb->aio_sigevent.sigev_notify
-is invalid or not supported.
-.It Bq Er EOPNOTSUPP
-Asynchronous write operations on the file descriptor
-.Fa iocb->aio_fildes
-are unsafe and unsafe asynchronous I/O operations are disabled.
-.El
-.Pp
-The following conditions may be synchronously detected when the
-.Fn aio_write
-or
-.Fn aio_writev
-system call is made, or asynchronously, at any time thereafter.
-If they
-are detected at call time,
-.Fn aio_write
-or
-.Fn aio_writev
-returns -1 and sets
-.Va errno
-appropriately; otherwise the
-.Fn aio_return
-system call must be called, and will return -1, and
-.Fn aio_error
-must be called to determine the actual value that would have been
-returned in
-.Va errno .
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa iocb->aio_fildes
-argument
-is invalid, or is not opened for writing.
-.It Bq Er EINVAL
-The offset
-.Fa iocb->aio_offset
-is not valid, the priority specified by
-.Fa iocb->aio_reqprio
-is not a valid priority, or the number of bytes specified by
-.Fa iocb->aio_nbytes
-is not valid.
-.El
-.Pp
-If the request is successfully enqueued, but subsequently canceled
-or an error occurs, the value returned by the
-.Fn aio_return
-system call is per the
-.Xr write 2
-system call, and the value returned by the
-.Fn aio_error
-system call is either one of the error returns from the
-.Xr write 2
-system call, or one of:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa iocb->aio_fildes
-argument
-is invalid for writing.
-.It Bq Er ECANCELED
-The request was explicitly canceled via a call to
-.Fn aio_cancel .
-.It Bq Er EINVAL
-The offset
-.Fa iocb->aio_offset
-would be invalid.
-.El
-.Sh SEE ALSO
-.Xr aio_cancel 2 ,
-.Xr aio_error 2 ,
-.Xr aio_return 2 ,
-.Xr aio_suspend 2 ,
-.Xr aio_waitcomplete 2 ,
-.Xr sigevent 3 ,
-.Xr siginfo 3 ,
-.Xr aio 4
-.Sh STANDARDS
-The
-.Fn aio_write
-system call
-is expected to conform to the
-.St -p1003.1
-standard.
-.Pp
-The
-.Fn aio_writev
-system call is a FreeBSD extension, and should not be used in portable code.
-.Sh HISTORY
-The
-.Fn aio_write
-system call first appeared in
-.Fx 3.0 .
-The
-.Fn aio_writev
-system call first appeared in
-.Fx 13.0 .
-.Sh AUTHORS
-This manual page was written by
-.An Wes Peters Aq Mt wes@softweyr.com .
-.Sh BUGS
-Invalid information in
-.Fa iocb->_aiocb_private
-may confuse the kernel.
diff --git a/lib/libc/sys/bind.2 b/lib/libc/sys/bind.2
deleted file mode 100644
index 05e462a17462..000000000000
--- a/lib/libc/sys/bind.2
+++ /dev/null
@@ -1,141 +0,0 @@
-.\" Copyright (c) 1983, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)bind.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2020
-.Dt BIND 2
-.Os
-.Sh NAME
-.Nm bind
-.Nd assign a local protocol address to a socket
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/socket.h
-.Ft int
-.Fn bind "int s" "const struct sockaddr *addr" "socklen_t addrlen"
-.Sh DESCRIPTION
-The
-.Fn bind
-system call
-assigns the local protocol address to a socket.
-When a socket is created
-with
-.Xr socket 2
-it exists in an address family space but has no protocol address assigned.
-The
-.Fn bind
-system call requests that
-.Fa addr
-be assigned to the socket.
-.Sh NOTES
-Binding an address in the UNIX domain creates a socket in the file
-system that must be deleted by the caller when it is no longer
-needed (using
-.Xr unlink 2 ) .
-.Pp
-The rules used in address binding vary between communication domains.
-Consult the manual entries in section 4 for detailed information.
-.Pp
-For maximum portability, you should always zero the socket address structure
-before populating it and passing it to
-.Fn bind .
-.Sh RETURN VALUES
-.Rv -std bind
-.Sh ERRORS
-The
-.Fn bind
-system call will fail if:
-.Bl -tag -width Er
-.It Bq Er EAGAIN
-Kernel resources to complete the request are
-temporarily unavailable.
-.It Bq Er EBADF
-The
-.Fa s
-argument
-is not a valid descriptor.
-.It Bq Er EINVAL
-The socket is already bound to an address, and the protocol does not support
-binding to a new address; or the socket has been shut down.
-.It Bq Er EINVAL
-The
-.Fa addrlen
-argument is not a valid length for the address family.
-.It Bq Er ENOTSOCK
-The
-.Fa s
-argument
-is not a socket.
-.It Bq Er EADDRNOTAVAIL
-The specified address is not available from the local machine.
-.It Bq Er EADDRINUSE
-The specified address is already in use.
-.It Bq Er EAFNOSUPPORT
-Addresses in the specified address family cannot be used with this socket.
-.It Bq Er EACCES
-The requested address is protected, and the current user
-has inadequate permission to access it.
-.It Bq Er EFAULT
-The
-.Fa addr
-argument is not in a valid part of the user
-address space.
-.El
-.Pp
-The following errors are specific to binding addresses in the UNIX domain.
-.Bl -tag -width EADDRNOTAVA
-.It Bq Er ENOTDIR
-A component of the path prefix is not a directory.
-.It Bq Er ENAMETOOLONG
-A component of a pathname exceeded 255 characters,
-or an entire path name exceeded 1023 characters.
-.It Bq Er ENOENT
-A prefix component of the path name does not exist.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating the pathname.
-.It Bq Er EIO
-An I/O error occurred while making the directory entry or allocating the inode.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.It Bq Er EROFS
-The name would reside on a read-only file system.
-.It Bq Er EISDIR
-An empty pathname was specified.
-.El
-.Sh SEE ALSO
-.Xr connect 2 ,
-.Xr getsockname 2 ,
-.Xr listen 2 ,
-.Xr socket 2
-.Sh HISTORY
-The
-.Fn bind
-system call appeared in
-.Bx 4.2 .
diff --git a/lib/libc/sys/bindat.2 b/lib/libc/sys/bindat.2
deleted file mode 100644
index 12c9b3767689..000000000000
--- a/lib/libc/sys/bindat.2
+++ /dev/null
@@ -1,108 +0,0 @@
-.\" Copyright (c) 2013 The FreeBSD Foundation
-.\" All rights reserved.
-.\"
-.\" This documentation was written by Pawel Jakub Dawidek under sponsorship from
-.\" the FreeBSD Foundation.
-.\"
-.\" 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 AUTHORS 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 AUTHORS 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd February 13, 2013
-.Dt BINDAT 2
-.Os
-.Sh NAME
-.Nm bindat
-.Nd assign a local protocol address to a socket
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In sys/socket.h
-.Pp
-.In fcntl.h
-.Ft int
-.Fn bindat "int fd" "int s" "const struct sockaddr *addr" "socklen_t addrlen"
-.Sh DESCRIPTION
-The
-.Fn bindat
-system call assigns the local protocol address to a socket.
-When passed the special value
-.Dv AT_FDCWD
-in the
-.Fa fd
-parameter, the behavior is identical to a call to
-.Xr bind 2 .
-Otherwise,
-.Fn bindat
-works like the
-.Xr bind 2
-system call with two exceptions:
-.Pp
-.Bl -enum -offset indent -compact
-.It
-It is limited to sockets in the PF_LOCAL domain.
-.Pp
-.It
-If the file path stored in the
-.Fa sun_path
-field of the sockaddr_un structure is a relative path, it is located relative
-to the directory associated with the file descriptor
-.Fa fd .
-.El
-.Sh RETURN VALUES
-.Rv -std bindat
-.Sh ERRORS
-The
-.Fn bindat
-system call may fail with the same errors as the
-.Xr bind 2
-system call or with the following errors:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa sun_path
-field does not specify an absolute path and the
-.Fa fd
-argument is neither
-.Dv AT_FDCWD
-nor a valid file descriptor.
-.It Bq Er ENOTDIR
-The
-.Fa sun_path
-field is not an absolute path and
-.Fa fd
-is neither
-.Dv AT_FDCWD
-nor a file descriptor associated with a directory.
-.El
-.Sh SEE ALSO
-.Xr bind 2 ,
-.Xr connectat 2 ,
-.Xr socket 2 ,
-.Xr unix 4
-.Sh AUTHORS
-The
-.Nm
-was developed by
-.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net
-under sponsorship from the FreeBSD Foundation.
diff --git a/lib/libc/sys/brk.2 b/lib/libc/sys/brk.2
deleted file mode 100644
index fc10e2ccf65a..000000000000
--- a/lib/libc/sys/brk.2
+++ /dev/null
@@ -1,190 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)brk.2 8.4 (Berkeley) 5/1/95
-.\" $FreeBSD$
-.\"
-.Dd June 2, 2018
-.Dt BRK 2
-.Os
-.Sh NAME
-.Nm brk ,
-.Nm sbrk
-.Nd change data segment size
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn brk "const void *addr"
-.Ft void *
-.Fn sbrk "intptr_t incr"
-.Sh DESCRIPTION
-.Bf -symbolic
-The
-.Fn brk
-and
-.Fn sbrk
-functions are legacy interfaces from before the
-advent of modern virtual memory management.
-They are deprecated and not present on the arm64 or riscv architectures.
-The
-.Xr mmap 2
-interface should be used to allocate pages instead.
-.Ef
-.Pp
-The
-.Fn brk
-and
-.Fn sbrk
-functions are used to change the amount of memory allocated in a
-process's data segment.
-They do this by moving the location of the
-.Dq break .
-The break is the first address after the end of the process's
-uninitialized data segment (also known as the
-.Dq BSS ) .
-.Pp
-The
-.Fn brk
-function
-sets the break to
-.Fa addr .
-.Pp
-The
-.Fn sbrk
-function raises the break by
-.Fa incr
-bytes, thus allocating at least
-.Fa incr
-bytes of new memory in the data segment.
-If
-.Fa incr
-is negative,
-the break is lowered by
-.Fa incr
-bytes.
-.Sh NOTES
-While the actual process data segment size maintained by the kernel will only
-grow or shrink in page sizes, these functions allow setting the break
-to unaligned values (i.e., it may point to any address inside the last
-page of the data segment).
-.Pp
-The current value of the program break may be determined by calling
-.Fn sbrk 0 .
-See also
-.Xr end 3 .
-.Pp
-The
-.Xr getrlimit 2
-system call may be used to determine
-the maximum permissible size of the
-data segment.
-It will not be possible to set the break
-beyond
-.Dq Va etext No + Va rlim.rlim_max
-where the
-.Va rlim.rlim_max
-value is returned from a call to
-.Fn getrlimit RLIMIT_DATA &rlim .
-(See
-.Xr end 3
-for the definition of
-.Va etext ) .
-.Sh RETURN VALUES
-.Rv -std brk
-.Pp
-The
-.Fn sbrk
-function returns the prior break value if successful;
-otherwise the value
-.Po Vt "void *" Pc Ns \-1
-is returned and the global variable
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-The
-.Fn brk
-and
-.Fn sbrk
-functions
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The requested break value was beyond the beginning of the data segment.
-.It Bq Er ENOMEM
-The data segment size limit, as set by
-.Xr setrlimit 2 ,
-was exceeded.
-.It Bq Er ENOMEM
-Insufficient space existed in the swap area
-to support the expansion of the data segment.
-.El
-.Sh SEE ALSO
-.Xr execve 2 ,
-.Xr getrlimit 2 ,
-.Xr mmap 2 ,
-.Xr end 3 ,
-.Xr free 3 ,
-.Xr malloc 3
-.Sh HISTORY
-The
-.Fn brk
-function appeared in
-.At v7 .
-.Fx 11.0
-introduced the arm64 and riscv architectures which do not support
-.Fn brk
-or
-.Fn sbrk .
-.Sh BUGS
-Mixing
-.Fn brk
-or
-.Fn sbrk
-with
-.Xr malloc 3 ,
-.Xr free 3 ,
-or similar functions will result in non-portable program behavior.
-.Pp
-Setting the break may fail due to a temporary lack of
-swap space.
-It is not possible to distinguish this
-from a failure caused by exceeding the maximum size of
-the data segment without consulting
-.Xr getrlimit 2 .
-.Pp
-.Fn sbrk
-is sometimes used to monitor heap use by calling with an argument of 0.
-The result is unlikely to reflect actual utilization in combination with an
-.Xr mmap 2
-based malloc.
-.Pp
-.Fn brk
-and
-.Fn sbrk
-are not thread-safe.
diff --git a/lib/libc/sys/brk.c b/lib/libc/sys/brk.c
index 7e50737d3e18..b3e6abdac981 100644
--- a/lib/libc/sys/brk.c
+++ b/lib/libc/sys/brk.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018 Mark Johnston <markj@FreeBSD.org>
*
@@ -25,9 +25,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/syscall.h>
#include <errno.h>
diff --git a/lib/libc/sys/cap_enter.2 b/lib/libc/sys/cap_enter.2
deleted file mode 100644
index 428e0b0bcd09..000000000000
--- a/lib/libc/sys/cap_enter.2
+++ /dev/null
@@ -1,164 +0,0 @@
-.\"
-.\" Copyright (c) 2008-2009 Robert N. M. Watson
-.\" All rights reserved.
-.\"
-.\" This software was developed at the University of Cambridge Computer
-.\" Laboratory with support from a grant from Google, 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd May 5, 2020
-.Dt CAP_ENTER 2
-.Os
-.Sh NAME
-.Nm cap_enter ,
-.Nm cap_getmode
-.Nd Capability mode system calls
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/capsicum.h
-.Ft int
-.Fn cap_enter "void"
-.Ft int
-.Fn cap_getmode "u_int *modep"
-.Sh DESCRIPTION
-.Fn cap_enter
-places the current process into capability mode, a mode of execution in which
-processes may only issue system calls operating on file descriptors or
-reading limited global system state.
-Access to global name spaces, such as file system or IPC name spaces, is
-prevented.
-If the process is already in a capability mode sandbox, the system call is a
-no-op.
-Future process descendants created with
-.Xr fork 2
-or
-.Xr pdfork 2
-will be placed in capability mode from inception.
-.Pp
-When combined with
-.Xr cap_rights_limit 2 ,
-.Xr cap_ioctls_limit 2 ,
-.Xr cap_fcntls_limit 2 ,
-.Fn cap_enter
-may be used to create kernel-enforced sandboxes in which
-appropriately-crafted applications or application components may be run.
-.Pp
-.Fn cap_getmode
-returns a flag indicating whether or not the process is in a capability mode
-sandbox.
-.Sh RUN-TIME SETTINGS
-If the
-.Dv kern.trap_enotcap
-sysctl MIB is set to a non-zero value, then for any process executing in a
-capability mode sandbox, any syscall which results in either an
-.Er ENOTCAPABLE
-or
-.Er ECAPMODE
-error also generates the synchronous
-.Dv SIGTRAP
-signal to the thread on the syscall return.
-On signal delivery, the
-.Va si_errno
-member of the
-.Fa siginfo
-signal handler parameter is set to the syscall error value,
-and the
-.Va si_code
-member is set to
-.Dv TRAP_CAP .
-.Pp
-See also the
-.Dv PROC_TRAPCAP_CTL
-and
-.Dv PROC_TRAPCAP_STATUS
-operations of the
-.Xr procctl 2
-function for similar per-process functionality.
-.Sh RETURN VALUES
-.Rv -std cap_enter cap_getmode
-.Pp
-When the process is in capability mode,
-.Fn cap_getmode
-sets the flag to a non-zero value.
-A zero value means the process is not in capability mode.
-.Sh ERRORS
-The
-.Fn cap_enter
-and
-.Fn cap_getmode
-system calls
-will fail if:
-.Bl -tag -width Er
-.It Bq Er ENOSYS
-The kernel is compiled without:
-.Pp
-.Cd "options CAPABILITY_MODE"
-.El
-.Pp
-The
-.Fn cap_getmode
-system call may also return the following error:
-.Bl -tag -width Er
-.It Bq Er EFAULT
-Pointer
-.Fa modep
-points outside the process's allocated address space.
-.El
-.Sh SEE ALSO
-.Xr cap_fcntls_limit 2 ,
-.Xr cap_ioctls_limit 2 ,
-.Xr cap_rights_limit 2 ,
-.Xr fexecve 2 ,
-.Xr procctl 2 ,
-.Xr cap_sandboxed 3 ,
-.Xr capsicum 4 ,
-.Xr sysctl 9
-.Sh HISTORY
-The
-.Fn cap_getmode
-system call first appeared in
-.Fx 8.3 .
-Support for capabilities and capabilities mode was developed as part of the
-.Tn TrustedBSD
-Project.
-.Sh AUTHORS
-These functions and the capability facility were created by
-.An "Robert N. M. Watson"
-at the University of Cambridge Computer Laboratory with support from a grant
-from Google, Inc.
-.Sh CAVEATS
-Creating effective process sandboxes is a tricky process that involves
-identifying the least possible rights required by the process and then
-passing those rights into the process in a safe manner.
-Consumers of
-.Fn cap_enter
-should also be aware of other inherited rights, such as access to VM
-resources, memory contents, and other process properties that should be
-considered.
-It is advisable to use
-.Xr fexecve 2
-to create a runtime environment inside the sandbox that has as few implicitly
-acquired rights as possible.
diff --git a/lib/libc/sys/cap_fcntls_limit.2 b/lib/libc/sys/cap_fcntls_limit.2
deleted file mode 100644
index b09aebbe78f0..000000000000
--- a/lib/libc/sys/cap_fcntls_limit.2
+++ /dev/null
@@ -1,132 +0,0 @@
-.\"
-.\" Copyright (c) 2012 The FreeBSD Foundation
-.\" All rights reserved.
-.\"
-.\" This documentation was written by Pawel Jakub Dawidek under sponsorship
-.\" the FreeBSD Foundation.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd May 5, 2020
-.Dt CAP_FCNTLS_LIMIT 2
-.Os
-.Sh NAME
-.Nm cap_fcntls_limit ,
-.Nm cap_fcntls_get
-.Nd manage allowed fcntl commands
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/capsicum.h
-.Ft int
-.Fn cap_fcntls_limit "int fd" "uint32_t fcntlrights"
-.Ft int
-.Fn cap_fcntls_get "int fd" "uint32_t *fcntlrightsp"
-.Sh DESCRIPTION
-If a file descriptor is granted the
-.Dv CAP_FCNTL
-capability right, the list of allowed
-.Xr fcntl 2
-commands can be selectively reduced (but never expanded) with the
-.Fn cap_fcntls_limit
-system call.
-.Pp
-A bitmask of allowed fcntls commands for a given file descriptor can be obtained
-with the
-.Fn cap_fcntls_get
-system call.
-.Sh FLAGS
-The following flags may be specified in the
-.Fa fcntlrights
-argument or returned in the
-.Fa fcntlrightsp
-argument:
-.Bl -tag -width CAP_FCNTL_GETOWN
-.It Dv CAP_FCNTL_GETFL
-Permit
-.Dv F_GETFL
-command.
-.It Dv CAP_FCNTL_SETFL
-Permit
-.Dv F_SETFL
-command.
-.It Dv CAP_FCNTL_GETOWN
-Permit
-.Dv F_GETOWN
-command.
-.It Dv CAP_FCNTL_SETOWN
-Permit
-.Dv F_SETOWN
-command.
-.El
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-.Fn cap_fcntls_limit
-succeeds unless:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa fd
-argument is not a valid descriptor.
-.It Bq Er EINVAL
-An invalid flag has been passed in
-.Fa fcntlrights .
-.It Bq Er ENOTCAPABLE
-.Fa fcntlrights
-would expand the list of allowed
-.Xr fcntl 2
-commands.
-.El
-.Pp
-.Fn cap_fcntls_get
-succeeds unless:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa fd
-argument is not a valid descriptor.
-.It Bq Er EFAULT
-The
-.Fa fcntlrightsp
-argument points at an invalid address.
-.El
-.Sh SEE ALSO
-.Xr cap_ioctls_limit 2 ,
-.Xr cap_rights_limit 2 ,
-.Xr fcntl 2
-.Sh HISTORY
-The
-.Fn cap_fcntls_get
-and
-.Fn cap_fcntls_limit
-system calls first appeared in
-.Fx 8.3 .
-Support for capabilities and capabilities mode was developed as part of the
-.Tn TrustedBSD
-Project.
-.Sh AUTHORS
-This function was created by
-.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net
-under sponsorship of the FreeBSD Foundation.
diff --git a/lib/libc/sys/cap_ioctls_limit.2 b/lib/libc/sys/cap_ioctls_limit.2
deleted file mode 100644
index 0cf5ea8ca038..000000000000
--- a/lib/libc/sys/cap_ioctls_limit.2
+++ /dev/null
@@ -1,165 +0,0 @@
-.\"
-.\" Copyright (c) 2012 The FreeBSD Foundation
-.\" All rights reserved.
-.\"
-.\" This documentation was written by Pawel Jakub Dawidek under sponsorship
-.\" the FreeBSD Foundation.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd May 5, 2020
-.Dt CAP_IOCTLS_LIMIT 2
-.Os
-.Sh NAME
-.Nm cap_ioctls_limit ,
-.Nm cap_ioctls_get
-.Nd manage allowed ioctl commands
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/capsicum.h
-.Ft int
-.Fn cap_ioctls_limit "int fd" "const unsigned long *cmds" "size_t ncmds"
-.Ft ssize_t
-.Fn cap_ioctls_get "int fd" "unsigned long *cmds" "size_t maxcmds"
-.Sh DESCRIPTION
-If a file descriptor is granted the
-.Dv CAP_IOCTL
-capability right, the list of allowed
-.Xr ioctl 2
-commands can be selectively reduced (but never expanded) with the
-.Fn cap_ioctls_limit
-system call.
-The
-.Fa cmds
-argument is an array of
-.Xr ioctl 2
-commands and the
-.Fa ncmds
-argument specifies the number of elements in the array.
-There can be up to
-.Va 256
-elements in the array.
-Including an element that has been previously revoked will generate an error.
-After a successful call only those listed in the array may be used.
-.Pp
-The list of allowed ioctl commands for a given file descriptor can be obtained
-with the
-.Fn cap_ioctls_get
-system call.
-The
-.Fa cmds
-argument points at memory that can hold up to
-.Fa maxcmds
-values.
-The function populates the provided buffer with up to
-.Fa maxcmds
-elements, but always returns the total number of ioctl commands allowed for the
-given file descriptor.
-The total number of ioctls commands for the given file descriptor can be
-obtained by passing
-.Dv NULL as the
-.Fa cmds
-argument and
-.Va 0
-as the
-.Fa maxcmds
-argument.
-If all ioctl commands are allowed
-.Dv ( CAP_IOCTL
-capability right is assigned to the file descriptor and the
-.Fn cap_ioctls_limit
-system call was never called for this file descriptor), the
-.Fn cap_ioctls_get
-system call will return
-.Dv CAP_IOCTLS_ALL
-and will not modify the buffer pointed to by the
-.Fa cmds
-argument.
-.Sh RETURN VALUES
-.Rv -std cap_ioctls_limit
-.Pp
-The
-.Fn cap_ioctls_get
-function, if successful, returns the total number of allowed ioctl commands or
-the value
-.Dv CAP_IOCTLS_ALL
-if all ioctls commands are allowed.
-On failure the value
-.Va -1
-is returned and the global variable errno is set to indicate the error.
-.Sh ERRORS
-.Fn cap_ioctls_limit
-succeeds unless:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa fd
-argument is not a valid descriptor.
-.It Bq Er EFAULT
-The
-.Fa cmds
-argument points at an invalid address.
-.It Bq Er EINVAL
-The
-.Fa ncmds
-argument is greater than
-.Va 256 .
-.It Bq Er ENOTCAPABLE
-.Fa cmds
-would expand the list of allowed
-.Xr ioctl 2
-commands.
-.El
-.Pp
-.Fn cap_ioctls_get
-succeeds unless:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa fd
-argument is not a valid descriptor.
-.It Bq Er EFAULT
-The
-.Fa cmds
-argument points at invalid address.
-.El
-.Sh SEE ALSO
-.Xr cap_fcntls_limit 2 ,
-.Xr cap_rights_limit 2 ,
-.Xr ioctl 2
-.Sh HISTORY
-The
-.Fn cap_ioctls_get
-and
-.Fn cap_ioctls_limit
-system calls first appeared in
-.Fx 8.3 .
-Support for capabilities and capabilities mode was developed as part of the
-.Tn TrustedBSD
-Project.
-.Sh AUTHORS
-This function was created by
-.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net
-under sponsorship of the FreeBSD Foundation.
diff --git a/lib/libc/sys/cap_rights_limit.2 b/lib/libc/sys/cap_rights_limit.2
deleted file mode 100644
index 37f311143a28..000000000000
--- a/lib/libc/sys/cap_rights_limit.2
+++ /dev/null
@@ -1,161 +0,0 @@
-.\"
-.\" Copyright (c) 2008-2010 Robert N. M. Watson
-.\" Copyright (c) 2012-2013 The FreeBSD Foundation
-.\" All rights reserved.
-.\"
-.\" This software was developed at the University of Cambridge Computer
-.\" Laboratory with support from a grant from Google, Inc.
-.\"
-.\" Portions of this documentation were written by Pawel Jakub Dawidek
-.\" under sponsorship from the FreeBSD Foundation.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd May 5, 2020
-.Dt CAP_RIGHTS_LIMIT 2
-.Os
-.Sh NAME
-.Nm cap_rights_limit
-.Nd limit capability rights
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/capsicum.h
-.Ft int
-.Fn cap_rights_limit "int fd" "const cap_rights_t *rights"
-.Sh DESCRIPTION
-When a file descriptor is created by a function such as
-.Xr accept 2 ,
-.Xr accept4 2 ,
-.Xr fhopen 2 ,
-.Xr kqueue 2 ,
-.Xr mq_open 2 ,
-.Xr open 2 ,
-.Xr openat 2 ,
-.Xr pdfork 2 ,
-.Xr pipe 2 ,
-.Xr shm_open 2 ,
-.Xr socket 2
-or
-.Xr socketpair 2 ,
-it is assigned all capability rights.
-Those rights can be reduced (but never expanded) by using the
-.Fn cap_rights_limit
-system call.
-Once capability rights are reduced, operations on the file descriptor will be
-limited to those permitted by
-.Fa rights .
-.Pp
-The
-.Fa rights
-argument should be prepared using
-.Xr cap_rights_init 3
-family of functions.
-.Pp
-Capability rights assigned to a file descriptor can be obtained with the
-.Xr cap_rights_get 3
-function.
-.Pp
-The complete list of the capability rights can be found in the
-.Xr rights 4
-manual page.
-.Sh RETURN VALUES
-.Rv -std
-.Sh EXAMPLES
-The following example demonstrates how to limit file descriptor capability
-rights to allow reading only.
-.Bd -literal
-cap_rights_t setrights;
-char buf[1];
-int fd;
-
-fd = open("/tmp/foo", O_RDWR);
-if (fd < 0)
- err(1, "open() failed");
-
-if (cap_enter() < 0)
- err(1, "cap_enter() failed");
-
-cap_rights_init(&setrights, CAP_READ);
-if (cap_rights_limit(fd, &setrights) < 0)
- err(1, "cap_rights_limit() failed");
-
-buf[0] = 'X';
-
-if (write(fd, buf, sizeof(buf)) > 0)
- errx(1, "write() succeeded!");
-
-if (read(fd, buf, sizeof(buf)) < 0)
- err(1, "read() failed");
-.Ed
-.Sh ERRORS
-.Fn cap_rights_limit
-succeeds unless:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa fd
-argument is not a valid active descriptor.
-.It Bq Er EINVAL
-An invalid right has been requested in
-.Fa rights .
-.It Bq Er ENOTCAPABLE
-The
-.Fa rights
-argument contains capability rights not present for the given file descriptor.
-Capability rights list can only be reduced, never expanded.
-.El
-.Sh SEE ALSO
-.Xr accept 2 ,
-.Xr accept4 2 ,
-.Xr cap_enter 2 ,
-.Xr fhopen 2 ,
-.Xr kqueue 2 ,
-.Xr mq_open 2 ,
-.Xr open 2 ,
-.Xr openat 2 ,
-.Xr pdfork 2 ,
-.Xr pipe 2 ,
-.Xr read 2 ,
-.Xr shm_open 2 ,
-.Xr socket 2 ,
-.Xr socketpair 2 ,
-.Xr write 2 ,
-.Xr cap_rights_get 3 ,
-.Xr cap_rights_init 3 ,
-.Xr err 3 ,
-.Xr capsicum 4 ,
-.Xr rights 4
-.Sh HISTORY
-The
-.Fn cap_rights_limit
-function first appeared in
-.Fx 8.3 .
-Support for capabilities and capabilities mode was developed as part of the
-.Tn TrustedBSD
-Project.
-.Sh AUTHORS
-This function was created by
-.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net
-under sponsorship of the FreeBSD Foundation.
diff --git a/lib/libc/sys/chdir.2 b/lib/libc/sys/chdir.2
deleted file mode 100644
index acc3b601f009..000000000000
--- a/lib/libc/sys/chdir.2
+++ /dev/null
@@ -1,134 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)chdir.2 8.2 (Berkeley) 12/11/93
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2020
-.Dt CHDIR 2
-.Os
-.Sh NAME
-.Nm chdir ,
-.Nm fchdir
-.Nd change current working directory
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn chdir "const char *path"
-.Ft int
-.Fn fchdir "int fd"
-.Sh DESCRIPTION
-The
-.Fa path
-argument points to the pathname of a directory.
-The
-.Fn chdir
-system call
-causes the named directory
-to become the current working directory, that is,
-the starting point for path searches of pathnames not beginning with
-a slash,
-.Ql / .
-.Pp
-The
-.Fn fchdir
-system call
-causes the directory referenced by
-.Fa fd
-to become the current working directory,
-the starting point for path searches of pathnames not beginning with
-a slash,
-.Ql / .
-.Pp
-In order for a directory to become the current directory,
-a process must have execute (search) access to the directory.
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-The
-.Fn chdir
-system call
-will fail and the current working directory will be unchanged if
-one or more of the following are true:
-.Bl -tag -width Er
-.It Bq Er ENOTDIR
-A component of the path prefix is not a directory.
-.It Bq Er ENAMETOOLONG
-A component of a pathname exceeded 255 characters,
-or an entire path name exceeded 1023 characters.
-.It Bq Er ENOENT
-The named directory does not exist.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating the pathname.
-.It Bq Er EACCES
-Search permission is denied for any component of
-the path name.
-.It Bq Er EFAULT
-The
-.Fa path
-argument
-points outside the process's allocated address space.
-.It Bq Er EIO
-An I/O error occurred while reading from or writing to the file system.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.El
-.Pp
-The
-.Fn fchdir
-system call
-will fail and the current working directory will be unchanged if
-one or more of the following are true:
-.Bl -tag -width Er
-.It Bq Er EACCES
-Search permission is denied for the directory referenced by the
-file descriptor.
-.It Bq Er ENOTDIR
-The file descriptor does not reference a directory.
-.It Bq Er EBADF
-The argument
-.Fa fd
-is not a valid file descriptor.
-.El
-.Sh SEE ALSO
-.Xr chroot 2
-.Sh STANDARDS
-The
-.Fn chdir
-system call is expected to conform to
-.St -p1003.1-90 .
-.Sh HISTORY
-The
-.Fn chdir
-system call appeared in
-.At v1 .
-The
-.Fn fchdir
-system call appeared in
-.Bx 4.2 .
diff --git a/lib/libc/sys/chflags.2 b/lib/libc/sys/chflags.2
deleted file mode 100644
index f8dfd59c39d3..000000000000
--- a/lib/libc/sys/chflags.2
+++ /dev/null
@@ -1,359 +0,0 @@
-.\" Copyright (c) 1989, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)chflags.2 8.3 (Berkeley) 5/2/95
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2021
-.Dt CHFLAGS 2
-.Os
-.Sh NAME
-.Nm chflags ,
-.Nm lchflags ,
-.Nm fchflags ,
-.Nm chflagsat
-.Nd set file flags
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/stat.h
-.In unistd.h
-.Ft int
-.Fn chflags "const char *path" "unsigned long flags"
-.Ft int
-.Fn lchflags "const char *path" "unsigned long flags"
-.Ft int
-.Fn fchflags "int fd" "unsigned long flags"
-.Ft int
-.Fn chflagsat "int fd" "const char *path" "unsigned long flags" "int atflag"
-.Sh DESCRIPTION
-The file whose name
-is given by
-.Fa path
-or referenced by the descriptor
-.Fa fd
-has its flags changed to
-.Fa flags .
-.Pp
-The
-.Fn lchflags
-system call is like
-.Fn chflags
-except in the case where the named file is a symbolic link,
-in which case
-.Fn lchflags
-will change the flags of the link itself,
-rather than the file it points to.
-.Pp
-The
-.Fn chflagsat
-is equivalent to either
-.Fn chflags
-or
-.Fn lchflags
-depending on the
-.Fa atflag
-except in the case where
-.Fa path
-specifies a relative path.
-In this case the file to be changed is determined relative to the directory
-associated with the file descriptor
-.Fa fd
-instead of the current working directory.
-The values for the
-.Fa atflag
-are constructed by a bitwise-inclusive OR of flags from the following list,
-defined in
-.In fcntl.h :
-.Bl -tag -width indent
-.It Dv AT_SYMLINK_NOFOLLOW
-If
-.Fa path
-names a symbolic link, then the flags of the symbolic link are changed.
-.It Dv AT_RESOLVE_BENEATH
-Only walk paths below the directory specified by the
-.Ar fd
-descriptor.
-See the description of the
-.Dv O_RESOLVE_BENEATH
-flag in the
-.Xr open 2
-manual page.
-.It Dv AT_EMPTY_PATH
-If the
-.Fa path
-argument is an empty string, operate on the file or directory
-referenced by the descriptor
-.Fa fd .
-If
-.Fa fd
-is equal to
-.Dv AT_FDCWD ,
-operate on the current working directory.
-.El
-.Pp
-If
-.Fn chflagsat
-is passed the special value
-.Dv AT_FDCWD
-in the
-.Fa fd
-parameter, the current working directory is used.
-If also
-.Fa atflag
-is zero, the behavior is identical to a call to
-.Fn chflags .
-.Pp
-The flags specified are formed by
-.Em or Ns 'ing
-the following values
-.Pp
-.Bl -tag -width ".Dv SF_IMMUTABLE" -compact -offset indent
-.It Dv SF_APPEND
-The file may only be appended to.
-.It Dv SF_ARCHIVED
-The file has been archived.
-This flag means the opposite of the DOS, Windows and CIFS
-FILE_ATTRIBUTE_ARCHIVE attribute.
-This flag has been deprecated, and may be removed in a future release.
-.It Dv SF_IMMUTABLE
-The file may not be changed.
-.It Dv SF_NOUNLINK
-The file may not be renamed or deleted.
-.It Dv SF_SNAPSHOT
-The file is a snapshot file.
-.It Dv UF_APPEND
-The file may only be appended to.
-.It Dv UF_ARCHIVE
-The file needs to be archived.
-This flag has the same meaning as the DOS, Windows and CIFS
-FILE_ATTRIBUTE_ARCHIVE attribute.
-Filesystems in FreeBSD may or may not have special handling for this flag.
-For instance, ZFS tracks changes to files and will set this bit when a
-file is updated.
-UFS only stores the flag, and relies on the application to change it when
-needed.
-.It Dv UF_HIDDEN
-The file may be hidden from directory listings at the application's
-discretion.
-The file has the DOS, Windows and CIFS FILE_ATTRIBUTE_HIDDEN attribute.
-.It Dv UF_IMMUTABLE
-The file may not be changed.
-.It Dv UF_NODUMP
-Do not dump the file.
-.It Dv UF_NOUNLINK
-The file may not be renamed or deleted.
-.It Dv UF_OFFLINE
-The file is offline, or has the Windows and CIFS FILE_ATTRIBUTE_OFFLINE
-attribute.
-Filesystems in FreeBSD store and display this flag, but do not provide any
-special handling when it is set.
-.It Dv UF_OPAQUE
-The directory is opaque when viewed through a union stack.
-.It Dv UF_READONLY
-The file is read only, and may not be written or appended.
-Filesystems may use this flag to maintain compatibility with the DOS, Windows
-and CIFS FILE_ATTRIBUTE_READONLY attribute.
-.It Dv UF_REPARSE
-The file contains a Windows reparse point and has the Windows and CIFS
-FILE_ATTRIBUTE_REPARSE_POINT attribute.
-.It Dv UF_SPARSE
-The file has the Windows FILE_ATTRIBUTE_SPARSE_FILE attribute.
-This may also be used by a filesystem to indicate a sparse file.
-.It Dv UF_SYSTEM
-The file has the DOS, Windows and CIFS FILE_ATTRIBUTE_SYSTEM attribute.
-Filesystems in FreeBSD may store and display this flag, but do not provide
-any special handling when it is set.
-.El
-.Pp
-If one of
-.Dv SF_IMMUTABLE , SF_APPEND ,
-or
-.Dv SF_NOUNLINK
-is set a non-super-user cannot change any flags and even the super-user
-can change flags only if securelevel is 0.
-(See
-.Xr init 8
-for details.)
-.Pp
-The
-.Dv UF_IMMUTABLE , UF_APPEND , UF_NOUNLINK , UF_NODUMP ,
-and
-.Dv UF_OPAQUE
-flags may be set or unset by either the owner of a file or the super-user.
-.Pp
-The
-.Dv SF_IMMUTABLE , SF_APPEND , SF_NOUNLINK ,
-and
-.Dv SF_ARCHIVED
-flags may only be set or unset by the super-user.
-Attempts to toggle these flags by non-super-users are rejected.
-These flags may be set at any time, but normally may only be unset when
-the system is in single-user mode.
-(See
-.Xr init 8
-for details.)
-.Pp
-The implementation of all flags is filesystem-dependent.
-See the description of the
-.Dv UF_ARCHIVE
-flag above for one example of the differences in behavior.
-Care should be exercised when writing applications to account for
-support or lack of support of these flags in various filesystems.
-.Pp
-The
-.Dv SF_SNAPSHOT
-flag is maintained by the system and cannot be toggled.
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-The
-.Fn chflags
-system call will fail if:
-.Bl -tag -width Er
-.It Bq Er ENOTDIR
-A component of the path prefix is not a directory.
-.It Bq Er ENAMETOOLONG
-A component of a pathname exceeded 255 characters,
-or an entire path name exceeded 1023 characters.
-.It Bq Er ENOENT
-The named file does not exist.
-.It Bq Er EACCES
-Search permission is denied for a component of the path prefix.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating the pathname.
-.It Bq Er EPERM
-The effective user ID does not match the owner of the file and
-the effective user ID is not the super-user.
-.It Bq Er EPERM
-One of
-.Dv SF_IMMUTABLE , SF_APPEND ,
-or
-.Dv SF_NOUNLINK
-is set and the user is either not the super-user or
-securelevel is greater than 0.
-.It Bq Er EPERM
-A non-super-user attempted to toggle one of
-.Dv SF_ARCHIVED , SF_IMMUTABLE , SF_APPEND ,
-or
-.Dv SF_NOUNLINK .
-.It Bq Er EPERM
-An attempt was made to toggle the
-.Dv SF_SNAPSHOT
-flag.
-.It Bq Er EROFS
-The named file resides on a read-only file system.
-.It Bq Er EFAULT
-The
-.Fa path
-argument
-points outside the process's allocated address space.
-.It Bq Er EIO
-An
-.Tn I/O
-error occurred while reading from or writing to the file system.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.It Bq Er EOPNOTSUPP
-The underlying file system does not support file flags, or
-does not support all of the flags set in
-.Fa flags .
-.El
-.Pp
-The
-.Fn fchflags
-system call will fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The descriptor is not valid.
-.It Bq Er EINVAL
-The
-.Fa fd
-argument
-refers to a socket, not to a file.
-.It Bq Er EPERM
-The effective user ID does not match the owner of the file and
-the effective user ID is not the super-user.
-.It Bq Er EPERM
-One of
-.Dv SF_IMMUTABLE , SF_APPEND ,
-or
-.Dv SF_NOUNLINK
-is set and the user is either not the super-user or
-securelevel is greater than 0.
-.It Bq Er EPERM
-A non-super-user attempted to toggle one of
-.Dv SF_ARCHIVED , SF_IMMUTABLE , SF_APPEND ,
-or
-.Dv SF_NOUNLINK .
-.It Bq Er EPERM
-An attempt was made to toggle the
-.Dv SF_SNAPSHOT
-flag.
-.It Bq Er EROFS
-The file resides on a read-only file system.
-.It Bq Er EIO
-An
-.Tn I/O
-error occurred while reading from or writing to the file system.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.It Bq Er EOPNOTSUPP
-The underlying file system does not support file flags, or
-does not support all of the flags set in
-.Fa flags .
-.It Bq Er ENOTCAPABLE
-.Fa path
-is an absolute path,
-or contained a ".." component leading to a
-directory outside of the directory hierarchy specified by
-.Fa fd ,
-and the process is in capability mode or the
-.Dv AT_RESOLVE_BENEATH
-flag was specified.
-.El
-.Sh SEE ALSO
-.Xr chflags 1 ,
-.Xr fflagstostr 3 ,
-.Xr strtofflags 3 ,
-.Xr init 8 ,
-.Xr mount_unionfs 8
-.Sh HISTORY
-The
-.Fn chflags
-and
-.Fn fchflags
-system calls first appeared in
-.Bx 4.4 .
-The
-.Fn lchflags
-system call first appeared in
-.Fx 5.0 .
-The
-.Fn chflagsat
-system call first appeared in
-.Fx 10.0 .
diff --git a/lib/libc/sys/chmod.2 b/lib/libc/sys/chmod.2
deleted file mode 100644
index 44a1b18718f1..000000000000
--- a/lib/libc/sys/chmod.2
+++ /dev/null
@@ -1,360 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)chmod.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2021
-.Dt CHMOD 2
-.Os
-.Sh NAME
-.Nm chmod ,
-.Nm fchmod ,
-.Nm lchmod ,
-.Nm fchmodat
-.Nd change mode of file
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/stat.h
-.Ft int
-.Fn chmod "const char *path" "mode_t mode"
-.Ft int
-.Fn fchmod "int fd" "mode_t mode"
-.Ft int
-.Fn lchmod "const char *path" "mode_t mode"
-.Ft int
-.Fn fchmodat "int fd" "const char *path" "mode_t mode" "int flag"
-.Sh DESCRIPTION
-The file permission bits of the file named specified by
-.Fa path
-or referenced by the file descriptor
-.Fa fd
-are changed to
-.Fa mode .
-The
-.Fn chmod
-system call verifies that the process owner (user) either owns
-the file specified by
-.Fa path
-(or
-.Fa fd ) ,
-or
-is the super-user.
-The
-.Fn chmod
-system call follows symbolic links to operate on the target of the link
-rather than the link itself.
-.Pp
-The
-.Fn lchmod
-system call is similar to
-.Fn chmod
-but does not follow symbolic links.
-.Pp
-The
-.Fn fchmodat
-is equivalent to either
-.Fn chmod
-or
-.Fn lchmod
-depending on the
-.Fa flag
-except in the case where
-.Fa path
-specifies a relative path.
-In this case the file to be changed is determined relative to the directory
-associated with the file descriptor
-.Fa fd
-instead of the current working directory.
-The values for the
-.Fa flag
-are constructed by a bitwise-inclusive OR of flags from the following list, defined
-in
-.In fcntl.h :
-.Bl -tag -width indent
-.It Dv AT_SYMLINK_NOFOLLOW
-If
-.Fa path
-names a symbolic link, then the mode of the symbolic link is changed.
-.It Dv AT_RESOLVE_BENEATH
-Only walk paths below the directory specified by the
-.Ar fd
-descriptor.
-See the description of the
-.Dv O_RESOLVE_BENEATH
-flag in the
-.Xr open 2
-manual page.
-.It Dv AT_EMPTY_PATH
-If the
-.Fa path
-argument is an empty string, operate on the file or directory
-referenced by the descriptor
-.Fa fd .
-If
-.Fa fd
-is equal to
-.Dv AT_FDCWD ,
-operate on the current working directory.
-.El
-.Pp
-If
-.Fn fchmodat
-is passed the special value
-.Dv AT_FDCWD
-in the
-.Fa fd
-parameter, the current working directory is used.
-If also
-.Fa flag
-is zero, the behavior is identical to a call to
-.Fn chmod .
-.Pp
-A mode is created from
-.Em or'd
-permission bit masks
-defined in
-.In sys/stat.h :
-.Pp
-.Bd -literal -offset indent -compact
-#define S_IRWXU 0000700 /* RWX mask for owner */
-#define S_IRUSR 0000400 /* R for owner */
-#define S_IWUSR 0000200 /* W for owner */
-#define S_IXUSR 0000100 /* X for owner */
-
-#define S_IRWXG 0000070 /* RWX mask for group */
-#define S_IRGRP 0000040 /* R for group */
-#define S_IWGRP 0000020 /* W for group */
-#define S_IXGRP 0000010 /* X for group */
-
-#define S_IRWXO 0000007 /* RWX mask for other */
-#define S_IROTH 0000004 /* R for other */
-#define S_IWOTH 0000002 /* W for other */
-#define S_IXOTH 0000001 /* X for other */
-
-#define S_ISUID 0004000 /* set user id on execution */
-#define S_ISGID 0002000 /* set group id on execution */
-#define S_ISVTX 0001000 /* sticky bit */
-.Ed
-.Pp
-The non-standard
-.Dv S_ISTXT
-is a synonym for
-.Dv S_ISVTX .
-.Pp
-The
-.Fx
-VM system totally ignores the sticky bit
-.Pq Dv S_ISVTX
-for executables.
-On UFS-based file systems (FFS, LFS) the sticky
-bit may only be set upon directories.
-.Pp
-If mode
-.Dv S_ISVTX
-(the `sticky bit') is set on a directory,
-an unprivileged user may not delete or rename
-files of other users in that directory.
-The sticky bit may be
-set by any user on a directory which the user owns or has appropriate
-permissions.
-For more details of the properties of the sticky bit, see
-.Xr sticky 7 .
-.Pp
-If mode ISUID (set UID) is set on a directory,
-and the MNT_SUIDDIR option was used in the mount of the file system,
-then the owner of any new files and sub-directories
-created within this directory are set
-to be the same as the owner of that directory.
-If this function is enabled, new directories will inherit
-the bit from their parents.
-Execute bits are removed from
-the file, and it will not be given to root.
-This behavior does not change the
-requirements for the user to be allowed to write the file, but only the eventual
-owner after it has been created.
-Group inheritance is not affected.
-.Pp
-This feature is designed for use on fileservers serving PC users via
-ftp, SAMBA, or netatalk.
-It provides security holes for shell users and as
-such should not be used on shell machines, especially on home directories.
-This option requires the SUIDDIR
-option in the kernel to work.
-Only UFS file systems support this option.
-For more details of the suiddir mount option, see
-.Xr mount 8 .
-.Pp
-Writing or changing the owner of a file
-turns off the set-user-id and set-group-id bits
-unless the user is the super-user.
-This makes the system somewhat more secure
-by protecting set-user-id (set-group-id) files
-from remaining set-user-id (set-group-id) if they are modified,
-at the expense of a degree of compatibility.
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-The
-.Fn chmod
-system call
-will fail and the file mode will be unchanged if:
-.Bl -tag -width Er
-.It Bq Er ENOTDIR
-A component of the path prefix is not a directory.
-.It Bq Er ENAMETOOLONG
-A component of a pathname exceeded 255 characters,
-or an entire path name exceeded 1023 characters.
-.It Bq Er ENOENT
-The named file does not exist.
-.It Bq Er EACCES
-Search permission is denied for a component of the path prefix.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating the pathname.
-.It Bq Er EPERM
-The effective user ID does not match the owner of the file and
-the effective user ID is not the super-user.
-.It Bq Er EPERM
-The effective user ID is not the super-user, the effective user ID do match the
-owner of the file, but the group ID of the file does not match the effective
-group ID nor one of the supplementary group IDs.
-.It Bq Er EPERM
-The named file has its immutable or append-only flag set, see the
-.Xr chflags 2
-manual page for more information.
-.It Bq Er EROFS
-The named file resides on a read-only file system.
-.It Bq Er EFAULT
-The
-.Fa path
-argument
-points outside the process's allocated address space.
-.It Bq Er EIO
-An I/O error occurred while reading from or writing to the file system.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.It Bq Er EFTYPE
-The effective user ID is not the super-user, the mode includes the sticky bit
-.Dv ( S_ISVTX ) ,
-and path does not refer to a directory.
-.El
-.Pp
-The
-.Fn fchmod
-system call will fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The descriptor is not valid.
-.It Bq Er EINVAL
-The
-.Fa fd
-argument
-refers to a socket, not to a file.
-.It Bq Er EROFS
-The file resides on a read-only file system.
-.It Bq Er EIO
-An I/O error occurred while reading from or writing to the file system.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.El
-.Pp
-In addition to the
-.Fn chmod
-errors,
-.Fn fchmodat
-fails if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa path
-argument does not specify an absolute path and the
-.Fa fd
-argument is neither
-.Fa AT_FDCWD
-nor a valid file descriptor open for searching.
-.It Bq Er EINVAL
-The value of the
-.Fa flag
-argument is not valid.
-.It Bq Er ENOTDIR
-The
-.Fa path
-argument is not an absolute path and
-.Fa fd
-is neither
-.Dv AT_FDCWD
-nor a file descriptor associated with a directory.
-.It Bq Er ENOTCAPABLE
-.Fa path
-is an absolute path,
-or contained a ".." component leading to a
-directory outside of the directory hierarchy specified by
-.Fa fd ,
-and the process is in capability mode or the
-.Dv AT_RESOLVE_BENEATH
-flag was specified.
-.El
-.Sh SEE ALSO
-.Xr chmod 1 ,
-.Xr chflags 2 ,
-.Xr chown 2 ,
-.Xr open 2 ,
-.Xr stat 2 ,
-.Xr sticky 7
-.Sh STANDARDS
-The
-.Fn chmod
-system call is expected to conform to
-.St -p1003.1-90 ,
-except for the return of
-.Er EFTYPE .
-The
-.Dv S_ISVTX
-bit on directories is expected to conform to
-.St -susv3 .
-The
-.Fn fchmodat
-system call is expected to conform to
-.St -p1003.1-2008 .
-.Sh HISTORY
-The
-.Fn chmod
-function appeared in
-.At v1 .
-The
-.Fn fchmod
-system call appeared in
-.Bx 4.2 .
-The
-.Fn lchmod
-system call appeared in
-.Fx 3.0 .
-The
-.Fn fchmodat
-system call appeared in
-.Fx 8.0 .
diff --git a/lib/libc/sys/chown.2 b/lib/libc/sys/chown.2
deleted file mode 100644
index 467ff8a87e55..000000000000
--- a/lib/libc/sys/chown.2
+++ /dev/null
@@ -1,301 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993, 1994
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)chown.2 8.4 (Berkeley) 4/19/94
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2021
-.Dt CHOWN 2
-.Os
-.Sh NAME
-.Nm chown ,
-.Nm fchown ,
-.Nm lchown ,
-.Nm fchownat
-.Nd change owner and group of a file
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn chown "const char *path" "uid_t owner" "gid_t group"
-.Ft int
-.Fn fchown "int fd" "uid_t owner" "gid_t group"
-.Ft int
-.Fn lchown "const char *path" "uid_t owner" "gid_t group"
-.Ft int
-.Fn fchownat "int fd" "const char *path" "uid_t owner" "gid_t group" "int flag"
-.Sh DESCRIPTION
-The owner ID and group ID of the file
-named by
-.Fa path
-or referenced by
-.Fa fd
-is changed as specified by the arguments
-.Fa owner
-and
-.Fa group .
-The owner of a file may change the
-.Fa group
-to a group of which
-he or she is a member,
-but the change
-.Fa owner
-capability is restricted to the super-user.
-.Pp
-The
-.Fn chown
-system call
-clears the set-user-id and set-group-id bits
-on the file
-to prevent accidental or mischievous creation of
-set-user-id and set-group-id programs if not executed
-by the super-user.
-The
-.Fn chown
-system call
-follows symbolic links to operate on the target of the link
-rather than the link itself.
-.Pp
-The
-.Fn fchown
-system call
-is particularly useful when used in conjunction
-with the file locking primitives (see
-.Xr flock 2 ) .
-.Pp
-The
-.Fn lchown
-system call is similar to
-.Fn chown
-but does not follow symbolic links.
-.Pp
-The
-.Fn fchownat
-system call is equivalent to the
-.Fn chown
-and
-.Fn lchown
-except in the case where
-.Fa path
-specifies a relative path.
-In this case the file to be changed is determined relative to the directory
-associated with the file descriptor
-.Fa fd
-instead of the current working directory.
-.Pp
-Values for
-.Fa flag
-are constructed by a bitwise-inclusive OR of flags from the following
-list, defined in
-.In fcntl.h :
-.Bl -tag -width indent
-.It Dv AT_SYMLINK_NOFOLLOW
-If
-.Fa path
-names a symbolic link, ownership of the symbolic link is changed.
-.It Dv AT_RESOLVE_BENEATH
-Only walk paths below the directory specified by the
-.Ar fd
-descriptor.
-See the description of the
-.Dv O_RESOLVE_BENEATH
-flag in the
-.Xr open 2
-manual page.
-.It Dv AT_EMPTY_PATH
-If the
-.Fa path
-argument is an empty string, operate on the file or directory
-referenced by the descriptor
-.Fa fd .
-If
-.Fa fd
-is equal to
-.Dv AT_FDCWD ,
-operate on the current working directory.
-.El
-.Pp
-If
-.Fn fchownat
-is passed the special value
-.Dv AT_FDCWD
-in the
-.Fa fd
-parameter, the current working directory is used and the behavior is identical
-to a call to
-.Fn chown
-or
-.Fn lchown
-respectively, depending on whether or not the
-.Dv AT_SYMLINK_NOFOLLOW
-bit is set in the
-.Fa flag
-argument.
-.Pp
-One of the owner or group id's
-may be left unchanged by specifying it as -1.
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-The
-.Fn chown
-and
-.Fn lchown
-will fail and the file will be unchanged if:
-.Bl -tag -width Er
-.It Bq Er ENOTDIR
-A component of the path prefix is not a directory.
-.It Bq Er ENAMETOOLONG
-A component of a pathname exceeded 255 characters,
-or an entire path name exceeded 1023 characters.
-.It Bq Er ENOENT
-The named file does not exist.
-.It Bq Er EACCES
-Search permission is denied for a component of the path prefix.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating the pathname.
-.It Bq Er EPERM
-The operation would change the ownership, but the effective user ID is not the
-super-user.
-.It Bq Er EPERM
-The named file has its immutable or append-only flag set, see the
-.Xr chflags 2
-manual page for more information.
-.It Bq Er EROFS
-The named file resides on a read-only file system.
-.It Bq Er EFAULT
-The
-.Fa path
-argument
-points outside the process's allocated address space.
-.It Bq Er EIO
-An I/O error occurred while reading from or writing to the file system.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.El
-.Pp
-The
-.Fn fchown
-system call will fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa fd
-argument
-does not refer to a valid descriptor.
-.It Bq Er EINVAL
-The
-.Fa fd
-argument
-refers to a socket, not a file.
-.It Bq Er EPERM
-The effective user ID is not the super-user.
-.It Bq Er EROFS
-The named file resides on a read-only file system.
-.It Bq Er EIO
-An I/O error occurred while reading from or writing to the file system.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.El
-.Pp
-In addition to the errors specified for
-.Fn chown
-and
-.Fn lchown ,
-the
-.Fn fchownat
-system call may fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa path
-argument does not specify an absolute path and the
-.Fa fd
-argument is neither
-.Dv AT_FDCWD
-nor a valid file descriptor open for searching.
-.It Bq Er EINVAL
-The value of the
-.Fa flag
-argument is not valid.
-.It Bq Er ENOTDIR
-The
-.Fa path
-argument is not an absolute path and
-.Fa fd
-is neither
-.Dv AT_FDCWD
-nor a file descriptor associated with a directory.
-.It Bq Er ENOTCAPABLE
-.Fa path
-is an absolute path,
-or contained a ".." component leading to a
-directory outside of the directory hierarchy specified by
-.Fa fd ,
-and the process is in capability mode or the
-.Dv AT_RESOLVE_BENEATH
-flag was specified.
-.El
-.Sh SEE ALSO
-.Xr chgrp 1 ,
-.Xr chflags 2 ,
-.Xr chmod 2 ,
-.Xr flock 2 ,
-.Xr chown 8
-.Sh STANDARDS
-The
-.Fn chown
-system call is expected to conform to
-.St -p1003.1-90 .
-The
-.Fn fchownat
-system call follows The Open Group Extended API Set 2 specification.
-.Sh HISTORY
-The
-.Fn chown
-function appeared in
-.At v1 .
-The
-.Fn fchown
-system call appeared in
-.Bx 4.2 .
-.Pp
-The
-.Fn chown
-system call was changed to follow symbolic links in
-.Bx 4.4 .
-The
-.Fn lchown
-system call was added in
-.Fx 3.0
-to compensate for the loss of functionality.
-.Pp
-The
-.Fn fchownat
-system call appeared in
-.Fx 8.0 .
diff --git a/lib/libc/sys/chroot.2 b/lib/libc/sys/chroot.2
deleted file mode 100644
index 69ee3743d9d3..000000000000
--- a/lib/libc/sys/chroot.2
+++ /dev/null
@@ -1,165 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)chroot.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd September 29, 2020
-.Dt CHROOT 2
-.Os
-.Sh NAME
-.Nm chroot
-.Nd change root directory
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn chroot "const char *dirname"
-.Sh DESCRIPTION
-The
-.Fa dirname
-argument
-is the address of the pathname of a directory, terminated by an ASCII NUL.
-The
-.Fn chroot
-system call causes
-.Fa dirname
-to become the root directory,
-that is, the starting point for path searches of pathnames
-beginning with
-.Ql / .
-.Pp
-In order for a directory to become the root directory
-a process must have execute (search) access for that directory.
-.Pp
-It should be noted that
-.Fn chroot
-has no effect on the process's current directory.
-.Pp
-This call is restricted to the super-user.
-.Pp
-Depending on the setting of the
-.Ql kern.chroot_allow_open_directories
-sysctl variable, open filedescriptors which reference directories
-will make the
-.Fn chroot
-fail as follows:
-.Pp
-If
-.Ql kern.chroot_allow_open_directories
-is set to zero,
-.Fn chroot
-will always fail with
-.Er EPERM
-if there are any directories open.
-.Pp
-If
-.Ql kern.chroot_allow_open_directories
-is set to one (the default),
-.Fn chroot
-will fail with
-.Er EPERM
-if there are any directories open and the
-process is already subject to the
-.Fn chroot
-system call.
-.Pp
-Any other value for
-.Ql kern.chroot_allow_open_directories
-will bypass the check for open directories,
-mimicking the historic insecure behavior of
-.Fn chroot
-still present on other systems.
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-The
-.Fn chroot
-system call
-will fail and the root directory will be unchanged if:
-.Bl -tag -width Er
-.It Bq Er ENOTDIR
-A component of the path name is not a directory.
-.It Bq Er EPERM
-The effective user ID is not the super-user, or one or more
-filedescriptors are open directories.
-.It Bq Er ENAMETOOLONG
-A component of a pathname exceeded 255 characters,
-or an entire path name exceeded 1023 characters.
-.It Bq Er ENOENT
-The named directory does not exist.
-.It Bq Er EACCES
-Search permission is denied for any component of the path name.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating the pathname.
-.It Bq Er EFAULT
-The
-.Fa dirname
-argument
-points outside the process's allocated address space.
-.It Bq Er EIO
-An I/O error occurred while reading from or writing to the file system.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.El
-.Sh SEE ALSO
-.Xr chdir 2 ,
-.Xr jail 2
-.Sh HISTORY
-The
-.Fn chroot
-system call appeared in
-.At v7 .
-It was marked as
-.Dq legacy
-in
-.St -susv2 ,
-and was removed in subsequent standards.
-.Sh BUGS
-If the process is able to change its working directory to the target
-directory, but another access control check fails (such as a check for
-open directories, or a MAC check), it is possible that this system
-call may return an error, with the working directory of the process
-left changed.
-.Sh SECURITY CONSIDERATIONS
-The system have many hardcoded paths to files where it may load after
-the process starts.
-It is generally recommended to drop privileges immediately after a
-successful
-.Nm
-call,
-and restrict write access to a limited subtree of the
-.Nm
-root,
-for instance,
-setup the sandbox so that the sandboxed user will have no write
-access to any well-known system directories.
-.Pp
-For complete isolation from the rest of the system, use
-.Xr jail 2
-instead.
diff --git a/lib/libc/sys/clock_gettime.2 b/lib/libc/sys/clock_gettime.2
deleted file mode 100644
index d620ed0f03f2..000000000000
--- a/lib/libc/sys/clock_gettime.2
+++ /dev/null
@@ -1,196 +0,0 @@
-.\" $OpenBSD: clock_gettime.2,v 1.4 1997/05/08 20:21:16 kstailey Exp $
-.\"
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd July 1, 2021
-.Dt CLOCK_GETTIME 2
-.Os
-.Sh NAME
-.Nm clock_gettime ,
-.Nm clock_settime ,
-.Nm clock_getres
-.Nd get/set/calibrate date and time
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In time.h
-.Ft int
-.Fn clock_gettime "clockid_t clock_id" "struct timespec *tp"
-.Ft int
-.Fn clock_settime "clockid_t clock_id" "const struct timespec *tp"
-.Ft int
-.Fn clock_getres "clockid_t clock_id" "struct timespec *tp"
-.Sh DESCRIPTION
-The
-.Fn clock_gettime
-and
-.Fn clock_settime
-system calls allow the calling process to retrieve or set the value
-used by a clock which is specified by
-.Fa clock_id .
-.Pp
-The
-.Fa clock_id
-argument can be a value obtained from
-.Xr clock_getcpuclockid 3
-or
-.Xr pthread_getcpuclockid 3
-as well as the following values:
-.Pp
-.Bl -tag -width indent -compact
-.It Dv CLOCK_REALTIME
-.It Dv CLOCK_REALTIME_PRECISE
-.It Dv CLOCK_REALTIME_FAST
-.It Dv CLOCK_REALTIME_COARSE
-Increments as a wall clock should.
-.It Dv CLOCK_MONOTONIC
-.It Dv CLOCK_MONOTONIC_PRECISE
-.It Dv CLOCK_MONOTONIC_FAST
-.It Dv CLOCK_MONOTONIC_COARSE
-Increments in SI seconds.
-.It Dv CLOCK_UPTIME
-.It Dv CLOCK_UPTIME_PRECISE
-.It Dv CLOCK_UPTIME_FAST
-.It Dv CLOCK_BOOTTIME
-Starts at zero when the kernel boots and increments
-monotonically in SI seconds while the machine is running.
-.It Dv CLOCK_VIRTUAL
-Increments only when
-the CPU is running in user mode on behalf of the calling process.
-.It Dv CLOCK_PROF
-Increments when the CPU is running in user or kernel mode.
-.It Dv CLOCK_SECOND
-Returns the current second without performing a full time counter
-query, using an in-kernel cached value of the current second.
-.It Dv CLOCK_PROCESS_CPUTIME_ID
-Returns the execution time of the calling process.
-.It Dv CLOCK_THREAD_CPUTIME_ID
-Returns the execution time of the calling thread.
-.El
-.Pp
-The clock IDs
-.Fa CLOCK_REALTIME_FAST ,
-.Fa CLOCK_MONOTONIC_FAST ,
-.Fa CLOCK_UPTIME_FAST
-are analogs of corresponding IDs without _FAST suffix but do not perform
-a full time counter query, so their accuracy is one timer tick.
-Similarly,
-.Fa CLOCK_REALTIME_PRECISE ,
-.Fa CLOCK_MONOTONIC_PRECISE ,
-.Fa CLOCK_UPTIME_PRECISE
-are used to get the most exact value as possible, at the expense of
-execution time.
-The clock IDs
-.Fa CLOCK_REALTIME_COARSE ,
-.Fa CLOCK_MONOTONIC_COARSE
-are aliases of corresponding IDs with _FAST suffix for compatibility with other
-systems.
-Finally,
-.Dv CLOCK_BOOTTIME
-is an alias for
-.Dv CLOCK_UPTIME
-for compatibility with other systems.
-.Pp
-The structure pointed to by
-.Fa tp
-is defined in
-.In sys/timespec.h
-as:
-.Bd -literal
-struct timespec {
- time_t tv_sec; /* seconds */
- long tv_nsec; /* and nanoseconds */
-};
-.Ed
-.Pp
-Only the super-user may set the time of day, using only
-.Fa CLOCK_REALTIME .
-If the system securelevel is greater than 1 (see
-.Xr init 8 ) ,
-the time may only be advanced.
-This limitation is imposed to prevent a malicious super-user
-from setting arbitrary time stamps on files.
-The system time can still be adjusted backwards using the
-.Xr adjtime 2
-system call even when the system is secure.
-.Pp
-The resolution (granularity) of a clock is returned by the
-.Fn clock_getres
-system call.
-This value is placed in a (non-NULL)
-.Fa *tp .
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-The following error codes may be set in
-.Va errno :
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Fa clock_id
-or
-.Fa timespec
-argument
-was not a valid value.
-.It Bq Er EPERM
-A user other than the super-user attempted to set the time.
-.El
-.Sh SEE ALSO
-.Xr date 1 ,
-.Xr adjtime 2 ,
-.Xr clock_getcpuclockid 3 ,
-.Xr ctime 3 ,
-.Xr pthread_getcpuclockid 3
-.Sh STANDARDS
-The
-.Fn clock_gettime ,
-.Fn clock_settime ,
-and
-.Fn clock_getres
-system calls conform to
-.St -p1003.1b-93 .
-The clock IDs
-.Fa CLOCK_REALTIME_FAST ,
-.Fa CLOCK_REALTIME_PRECISE ,
-.Fa CLOCK_MONOTONIC_FAST ,
-.Fa CLOCK_MONOTONIC_PRECISE ,
-.Fa CLOCK_UPTIME ,
-.Fa CLOCK_UPTIME_FAST ,
-.Fa CLOCK_UPTIME_PRECISE ,
-.Fa CLOCK_SECOND
-are FreeBSD extensions to the POSIX interface.
-.Sh HISTORY
-The
-.Fn clock_gettime ,
-.Fn clock_settime ,
-and
-.Fn clock_getres
-system calls first appeared in
-.Fx 3.0 .
diff --git a/lib/libc/sys/clock_gettime.c b/lib/libc/sys/clock_gettime.c
deleted file mode 100644
index cf95986973e2..000000000000
--- a/lib/libc/sys/clock_gettime.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 2012 Konstantin Belousov <kib@FreeBSD.org>
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/syscall.h>
-#include <sys/time.h>
-#include <sys/vdso.h>
-#include <errno.h>
-#include <time.h>
-#include "libc_private.h"
-
-int __clock_gettime(clockid_t, struct timespec *ts);
-
-__weak_reference(__clock_gettime, clock_gettime);
-
-int
-__clock_gettime(clockid_t clock_id, struct timespec *ts)
-{
- int error;
-
- if (__vdso_clock_gettime != NULL && __vdso_gettc != NULL)
- error = __vdso_clock_gettime(clock_id, ts);
- else
- error = ENOSYS;
- if (error == ENOSYS)
- error = __sys_clock_gettime(clock_id, ts);
- return (error);
-}
diff --git a/lib/libc/sys/clock_nanosleep.c b/lib/libc/sys/clock_nanosleep.c
index e6afea809943..a50af30e1fb3 100644
--- a/lib/libc/sys/clock_nanosleep.c
+++ b/lib/libc/sys/clock_nanosleep.c
@@ -30,9 +30,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <time.h>
#include "libc_private.h"
@@ -44,9 +41,5 @@ int
clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *rqtp,
struct timespec *rmtp)
{
-
- return (((int (*)(clockid_t, int, const struct timespec *,
- struct timespec *))
- __libc_interposing[INTERPOS_clock_nanosleep])(clock_id, flags,
- rqtp, rmtp));
+ return (INTERPOS_SYS(clock_nanosleep, clock_id, flags, rqtp, rmtp));
}
diff --git a/lib/libc/sys/close.2 b/lib/libc/sys/close.2
deleted file mode 100644
index 92815aa3a859..000000000000
--- a/lib/libc/sys/close.2
+++ /dev/null
@@ -1,144 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993, 1994
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)close.2 8.2 (Berkeley) 4/19/94
-.\" $FreeBSD$
-.\"
-.Dd December 1, 2017
-.Dt CLOSE 2
-.Os
-.Sh NAME
-.Nm close
-.Nd delete a descriptor
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn close "int fd"
-.Sh DESCRIPTION
-The
-.Fn close
-system call deletes a descriptor from the per-process object
-reference table.
-If this is the last reference to the underlying object, the
-object will be deactivated.
-For example, on the last close of a file
-the current
-.Em seek
-pointer associated with the file is lost;
-on the last close of a
-.Xr socket 2
-associated naming information and queued data are discarded;
-on the last close of a file holding an advisory lock
-the lock is released (see further
-.Xr flock 2 ) .
-However, the semantics of System V and
-.St -p1003.1-88
-dictate that all
-.Xr fcntl 2
-advisory record locks associated with a file for a given process
-are removed when
-.Em any
-file descriptor for that file is closed by that process.
-.Pp
-When a process exits,
-all associated file descriptors are freed, but since there is
-a limit on active descriptors per processes, the
-.Fn close
-system call
-is useful when a large quantity of file descriptors are being handled.
-.Pp
-When a process forks (see
-.Xr fork 2 ) ,
-all descriptors for the new child process reference the same
-objects as they did in the parent before the fork.
-If a new process is then to be run using
-.Xr execve 2 ,
-the process would normally inherit these descriptors.
-Most
-of the descriptors can be rearranged with
-.Xr dup2 2
-or deleted with
-.Fn close
-before the
-.Xr execve 2
-is attempted, but if some of these descriptors will still
-be needed if the execve fails, it is necessary to arrange for them
-to be closed if the execve succeeds.
-For this reason, the call
-.Dq Li fcntl(d, F_SETFD, FD_CLOEXEC)
-is provided,
-which arranges that a descriptor will be closed after a successful
-execve; the call
-.Dq Li fcntl(d, F_SETFD, 0)
-restores the default,
-which is to not close the descriptor.
-.Sh RETURN VALUES
-.Rv -std close
-.Sh ERRORS
-The
-.Fn close
-system call will fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa fd
-argument
-is not an active descriptor.
-.It Bq Er EINTR
-An interrupt was received.
-.It Bq Er ENOSPC
-The underlying object did not fit, cached data was lost.
-.It Bq Er ECONNRESET
-The underlying object was a stream socket that was shut down by the peer
-before all pending data was delivered.
-.El
-.Pp
-In case of any error except
-.Er EBADF ,
-the supplied file descriptor is deallocated and therefore is no longer valid.
-.Sh SEE ALSO
-.Xr accept 2 ,
-.Xr closefrom 2 ,
-.Xr execve 2 ,
-.Xr fcntl 2 ,
-.Xr flock 2 ,
-.Xr open 2 ,
-.Xr pipe 2 ,
-.Xr socket 2 ,
-.Xr socketpair 2
-.Sh STANDARDS
-The
-.Fn close
-system call is expected to conform to
-.St -p1003.1-90 .
-.Sh HISTORY
-The
-.Fn close
-function appeared in
-.At v1 .
diff --git a/lib/libc/sys/close.c b/lib/libc/sys/close.c
index f7b36f85ddd5..08a5419361a9 100644
--- a/lib/libc/sys/close.c
+++ b/lib/libc/sys/close.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2014 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/fcntl.h>
#include <unistd.h>
@@ -44,6 +40,5 @@ __weak_reference(__sys_close, __close);
int
close(int fd)
{
-
- return (((int (*)(int))__libc_interposing[INTERPOS_close])(fd));
+ return (INTERPOS_SYS(close, fd));
}
diff --git a/lib/libc/sys/closefrom.2 b/lib/libc/sys/closefrom.2
deleted file mode 100644
index db41c617dc7f..000000000000
--- a/lib/libc/sys/closefrom.2
+++ /dev/null
@@ -1,90 +0,0 @@
-.\" Copyright (c) 2009 Hudson River Trading LLC
-.\" Written by: John H. Baldwin <jhb@FreeBSD.org>
-.\" All rights reserved.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd April 12, 2020
-.Dt CLOSEFROM 2
-.Os
-.Sh NAME
-.Nm closefrom ,
-.Nm close_range
-.Nd delete open file descriptors
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft void
-.Fn closefrom "int lowfd"
-.Ft int
-.Fn close_range "u_int lowfd" "u_int highfd" "int flags"
-.Sh DESCRIPTION
-The
-.Fn closefrom
-system call deletes all open file descriptors greater than or equal to
-.Fa lowfd
-from the per-process object reference table.
-Any errors encountered while closing file descriptors are ignored.
-.Pp
-The
-.Fn close_range
-system call deletes all open file descriptors between
-.Fa lowfd
-and
-.Fa highfd
-inclusive, clamped to the range of open file descriptors.
-Any errors encountered while closing file descriptors are ignored.
-There are currently no defined
-.Fa flags .
-.Sh RETURN VALUES
-Upon successful completion,
-.Fn close_range
-returns a value
-of 0.
-Otherwise, a value of -1 is returned and the global variable
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-The
-.Fn close_range
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Fa highfd
-argument is lower than the
-.Fa lowfd
-argument.
-.It Bq Er EINVAL
-An invalid flag was set.
-.El
-.Sh SEE ALSO
-.Xr close 2
-.Sh HISTORY
-The
-.Fn closefrom
-function first appeared in
-.Fx 8.0 .
diff --git a/lib/libc/sys/closefrom.c b/lib/libc/sys/closefrom.c
index 8ff2f9e96e4a..292702fad38c 100644
--- a/lib/libc/sys/closefrom.c
+++ b/lib/libc/sys/closefrom.c
@@ -1,5 +1,5 @@
/*
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2020 Kyle Evans <kevans@FreeBSD.org>
*
@@ -25,9 +25,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/syscall.h>
#include <unistd.h>
diff --git a/lib/libc/sys/compat-ino64.h b/lib/libc/sys/compat-ino64.h
deleted file mode 100644
index 009efd63c590..000000000000
--- a/lib/libc/sys/compat-ino64.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*-
- * Copyright (c) 2017 M. Warner Losh <imp@FreeBSD.org>
- *
- * 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 AUTHOR 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 AUTHOR 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.
- *
- * $FreeBSD$
- */
-
-/*
- * Forward compatibility shim to convert old stat buffer to
- * new so we can call the old system call, but return data in
- * the new system call's format.
- */
-#define _WANT_FREEBSD11_STATFS
-#include <sys/fcntl.h>
-#include <sys/mount.h>
-
-#define _WANT_FREEBSD11_STAT
-#include <sys/stat.h>
-
-#include <string.h>
-
-#define INO64_FIRST 1200031
-
-static __inline void
-__stat11_to_stat(const struct freebsd11_stat *sb11, struct stat *sb)
-{
-
- sb->st_dev = sb11->st_dev;
- sb->st_ino = sb11->st_ino;
- sb->st_nlink = sb11->st_nlink;
- sb->st_mode = sb11->st_mode;
- sb->st_uid = sb11->st_uid;
- sb->st_gid = sb11->st_gid;
- sb->st_rdev = sb11->st_rdev;
- sb->st_atim = sb11->st_atim;
- sb->st_mtim = sb11->st_mtim;
- sb->st_ctim = sb11->st_ctim;
-#ifdef __STAT_TIME_T_EXT
- sb->st_atim_ext = 0;
- sb->st_mtim_ext = 0;
- sb->st_ctim_ext = 0;
- sb->st_btim_ext = 0;
-#endif
- sb->st_birthtim = sb11->st_birthtim;
- sb->st_size = sb11->st_size;
- sb->st_blocks = sb11->st_blocks;
- sb->st_blksize = sb11->st_blksize;
- sb->st_flags = sb11->st_flags;
- sb->st_gen = sb11->st_gen;
- sb->st_padding0 = 0;
- sb->st_padding1 = 0;
- memset(sb->st_spare, 0, sizeof(sb->st_spare));
-}
-
-static __inline void
-__statfs11_to_statfs(const struct freebsd11_statfs *sf11, struct statfs *sf)
-{
-
- sf->f_version = STATFS_VERSION;
- sf->f_type = sf11->f_type;
- sf->f_flags = sf11->f_flags;
- sf->f_bsize = sf11->f_bsize;
- sf->f_iosize = sf11->f_iosize;
- sf->f_blocks = sf11->f_blocks;
- sf->f_bfree = sf11->f_bfree;
- sf->f_bavail = sf11->f_bavail;
- sf->f_files = sf11->f_files;
- sf->f_ffree = sf11->f_ffree;
- sf->f_syncwrites = sf11->f_syncwrites;
- sf->f_asyncwrites = sf11->f_asyncwrites;
- sf->f_syncreads = sf11->f_syncreads;
- sf->f_asyncreads = sf11->f_asyncreads;
- sf->f_namemax = sf11->f_namemax;
- sf->f_owner = sf11->f_owner;
- sf->f_fsid = sf11->f_fsid;
- memset(sf->f_spare, 0, sizeof(sf->f_spare));
- memset(sf->f_charspare, 0, sizeof(sf->f_charspare));
- strlcpy(sf->f_fstypename, sf11->f_fstypename, sizeof(sf->f_fstypename));
- strlcpy(sf->f_mntfromname, sf11->f_mntfromname, sizeof(sf->f_mntfromname));
- strlcpy(sf->f_mntonname, sf11->f_mntonname, sizeof(sf->f_mntonname));
-}
diff --git a/lib/libc/sys/compat-stub.c b/lib/libc/sys/compat-stub.c
index 2031b7dc4c20..d23eaf3f89b8 100644
--- a/lib/libc/sys/compat-stub.c
+++ b/lib/libc/sys/compat-stub.c
@@ -29,11 +29,8 @@
* 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/cdefs.h>
#include <sys/types.h>
#include <sys/errno.h>
diff --git a/lib/libc/sys/connect.2 b/lib/libc/sys/connect.2
deleted file mode 100644
index 33c7cf3bc01f..000000000000
--- a/lib/libc/sys/connect.2
+++ /dev/null
@@ -1,185 +0,0 @@
-.\" Copyright (c) 1983, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)connect.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd August 18, 2016
-.Dt CONNECT 2
-.Os
-.Sh NAME
-.Nm connect
-.Nd initiate a connection on a socket
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/socket.h
-.Ft int
-.Fn connect "int s" "const struct sockaddr *name" "socklen_t namelen"
-.Sh DESCRIPTION
-The
-.Fa s
-argument
-is a socket.
-If it is of type
-.Dv SOCK_DGRAM ,
-this call specifies the peer with which the socket is to be associated;
-this address is that to which datagrams are to be sent,
-and the only address from which datagrams are to be received.
-If the socket is of type
-.Dv SOCK_STREAM ,
-this call attempts to make a connection to
-another socket.
-The other socket is specified by
-.Fa name ,
-which is an address in the communications space of the socket.
-.Fa namelen
-indicates the amount of space pointed to by
-.Fa name ,
-in bytes; the
-.Fa sa_len
-member of
-.Fa name
-is ignored.
-Each communications space interprets the
-.Fa name
-argument in its own way.
-Generally, stream sockets may successfully
-.Fn connect
-only once; datagram sockets may use
-.Fn connect
-multiple times to change their association.
-Datagram sockets may dissolve the association
-by connecting to an invalid address, such as a null address.
-.Sh RETURN VALUES
-.Rv -std connect
-.Sh ERRORS
-The
-.Fn connect
-system call fails if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa s
-argument
-is not a valid descriptor.
-.It Bq Er EINVAL
-The
-.Fa namelen
-argument is not a valid length for the address family.
-.It Bq Er ENOTSOCK
-The
-.Fa s
-argument
-is a descriptor for a file, not a socket.
-.It Bq Er EADDRNOTAVAIL
-The specified address is not available on this machine.
-.It Bq Er EAFNOSUPPORT
-Addresses in the specified address family cannot be used with this socket.
-.It Bq Er EISCONN
-The socket is already connected.
-.It Bq Er ETIMEDOUT
-Connection establishment timed out without establishing a connection.
-.It Bq Er ECONNREFUSED
-The attempt to connect was forcefully rejected.
-.It Bq Er ECONNRESET
-The connection was reset by the remote host.
-.It Bq Er ENETUNREACH
-The network is not reachable from this host.
-.It Bq Er EHOSTUNREACH
-The remote host is not reachable from this host.
-.It Bq Er EADDRINUSE
-The address is already in use.
-.It Bq Er EFAULT
-The
-.Fa name
-argument specifies an area outside
-the process address space.
-.It Bq Er EINPROGRESS
-The socket is non-blocking
-and the connection cannot
-be completed immediately.
-It is possible to
-.Xr select 2
-for completion by selecting the socket for writing.
-.It Bq Er EINTR
-The connection attempt was interrupted by the delivery of a signal.
-The connection will be established in the background,
-as in the case of
-.Er EINPROGRESS .
-.It Bq Er EALREADY
-A previous connection attempt has not yet been completed.
-.It Bq Er EACCES
-An attempt is made to connect to a broadcast address (obtained through the
-.Dv INADDR_BROADCAST
-constant or the
-.Dv INADDR_NONE
-return value) through a socket that does not provide broadcast functionality.
-.It Bq Er EAGAIN
-An auto-assigned port number was requested but no auto-assigned ports
-are available.
-Increasing the port range specified by
-.Xr sysctl 3
-MIB variables
-.Va net.inet.ip.portrange.first
-and
-.Va net.inet.ip.portrange.last
-may alleviate the problem.
-.El
-.Pp
-The following errors are specific to connecting names in the UNIX domain.
-These errors may not apply in future versions of the UNIX IPC domain.
-.Bl -tag -width Er
-.It Bq Er ENOTDIR
-A component of the path prefix is not a directory.
-.It Bq Er ENAMETOOLONG
-A component of a pathname exceeded 255 characters,
-or an entire path name exceeded 1023 characters.
-.It Bq Er ENOENT
-The named socket does not exist.
-.It Bq Er EACCES
-Search permission is denied for a component of the path prefix.
-.It Bq Er EACCES
-Write access to the named socket is denied.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating the pathname.
-.It Bq Er EPERM
-Write access to the named socket is denied.
-.El
-.Sh SEE ALSO
-.Xr accept 2 ,
-.Xr getpeername 2 ,
-.Xr getsockname 2 ,
-.Xr select 2 ,
-.Xr socket 2 ,
-.Xr sysctl 3 ,
-.Xr sysctl 8
-.Sh HISTORY
-The
-.Fn connect
-system call appeared in
-.Bx 4.2 .
diff --git a/lib/libc/sys/connect.c b/lib/libc/sys/connect.c
index 7969142ad072..e64451683abc 100644
--- a/lib/libc/sys/connect.c
+++ b/lib/libc/sys/connect.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2014 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/syscall.h>
#include <sys/socket.h>
@@ -44,7 +40,5 @@ __weak_reference(__sys_connect, __connect);
int
connect(int s, const struct sockaddr *addr, socklen_t addrlen)
{
-
- return (((int (*)(int, const struct sockaddr *, socklen_t))
- __libc_interposing[INTERPOS_connect])(s, addr, addrlen));
+ return (INTERPOS_SYS(connect, s, addr, addrlen));
}
diff --git a/lib/libc/sys/connectat.2 b/lib/libc/sys/connectat.2
deleted file mode 100644
index 3b90baa0b6f2..000000000000
--- a/lib/libc/sys/connectat.2
+++ /dev/null
@@ -1,109 +0,0 @@
-.\" Copyright (c) 2013 The FreeBSD Foundation
-.\" All rights reserved.
-.\"
-.\" This documentation was written by Pawel Jakub Dawidek under sponsorship from
-.\" the FreeBSD Foundation.
-.\"
-.\" 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 AUTHORS 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 AUTHORS 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd February 13, 2013
-.Dt CONNECTAT 2
-.Os
-.Sh NAME
-.Nm connectat
-.Nd initiate a connection on a socket
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In sys/socket.h
-.Pp
-.In fcntl.h
-.Ft int
-.Fn connectat "int fd" "int s" "const struct sockaddr *name" "socklen_t namelen"
-.Sh DESCRIPTION
-The
-.Fn connectat
-system call initiates a connection on the socket
-.Fa s .
-When passed the special value
-.Dv AT_FDCWD
-in the
-.Fa fd
-parameter, the behavior is identical to a call to
-.Xr connect 2 .
-Otherwise,
-.Fn connectat
-works like the
-.Xr connect 2
-system call with two exceptions:
-.Pp
-.Bl -enum -offset indent -compact
-.It
-It is limited to sockets in the PF_LOCAL domain.
-.Pp
-.It
-If the file path stored in the
-.Fa sun_path
-field of the sockaddr_un structure is a relative path, it is located relative
-to the directory associated with the file descriptor
-.Fa fd .
-.El
-.Sh RETURN VALUES
-.Rv -std connectat
-.Sh ERRORS
-The
-.Fn connectat
-system call may fail with the same errors as the
-.Xr connect 2
-system call or with the following errors:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa sun_path
-field does not specify an absolute path and the
-.Fa fd
-argument is neither
-.Dv AT_FDCWD
-nor a valid file descriptor.
-.It Bq Er ENOTDIR
-The
-.Fa sun_path
-field is not an absolute path and
-.Fa fd
-is neither
-.Dv AT_FDCWD
-nor a file descriptor associated with a directory.
-.El
-.Sh SEE ALSO
-.Xr bindat 2 ,
-.Xr connect 2 ,
-.Xr socket 2 ,
-.Xr unix 4
-.Sh AUTHORS
-The
-.Nm
-was developed by
-.An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net
-under sponsorship from the FreeBSD Foundation.
diff --git a/lib/libc/sys/copy_file_range.2 b/lib/libc/sys/copy_file_range.2
deleted file mode 100644
index 22106b397ef2..000000000000
--- a/lib/libc/sys/copy_file_range.2
+++ /dev/null
@@ -1,212 +0,0 @@
-.\" SPDX-License-Identifier: BSD-2-Clause
-.\"
-.\" Copyright (c) 2019 Rick Macklem
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd January 2, 2021
-.Dt COPY_FILE_RANGE 2
-.Os
-.Sh NAME
-.Nm copy_file_range
-.Nd kernel copy of a byte range from one file to another
-or within one file
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In unistd.h
-.Ft ssize_t
-.Fo copy_file_range
-.Fa "int infd"
-.Fa "off_t *inoffp"
-.Fa "int outfd"
-.Fa "off_t *outoffp"
-.Fa "size_t len"
-.Fa "unsigned int flags"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn copy_file_range
-system call
-copies up to
-.Fa len
-bytes from
-.Fa infd
-to
-.Fa outfd
-in the kernel.
-It may do this using a file system specific technique if
-.Fa infd
-and
-.Fa outfd
-are on the same file system.
-If
-.Fa infd
-and
-.Fa outfd
-refer to the same file, the byte ranges defined by
-the input file offset, output file offset and
-.Fa len
-cannot overlap.
-The
-.Fa infd
-argument must be opened for reading and the
-.Fa outfd
-argument must be opened for writing, but not
-.Dv O_APPEND .
-If
-.Fa inoffp
-or
-.Fa outoffp
-is
-.Dv NULL ,
-the file offset for
-.Fa infd
-or
-.Fa outfd
-respectively will be used and updated by
-the number of bytes copied.
-If
-.Fa inoffp
-or
-.Fa outoffp
-is not
-.Dv NULL ,
-the byte offset pointed to by
-.Fa inoffp
-or
-.Fa outoffp
-respectively will be used/updated and the file offset for
-.Fa infd
-or
-.Fa outfd
-respectively will not be affected.
-The
-.Fa flags
-argument must be 0.
-.Pp
-This system call attempts to maintain holes in the output file for
-the byte range being copied.
-However, this does not always work well.
-It is recommended that sparse files be copied in a loop using
-.Xr lseek 2
-with
-.Dv SEEK_HOLE ,
-.Dv SEEK_DATA
-arguments and this system call for the
-data ranges found.
-.Pp
-For best performance, call
-.Fn copy_file_range
-with the largest
-.Fa len
-value possible.
-It is interruptible on most file systems,
-so there is no penalty for using very large len values, even SSIZE_MAX.
-.Pp
-.Sh RETURN VALUES
-If it succeeds, the call returns the number of bytes copied, which can be fewer
-than
-.Fa len .
-Returning fewer bytes than
-.Fa len
-does not necessarily indicate that EOF was reached.
-However, a return of zero for a non-zero
-.Fa len
-argument indicates that the offset for
-.Fa infd
-is at or beyond EOF.
-.Fn copy_file_range
-should be used in a loop until copying of the desired byte range has been
-completed.
-If an error has occurred, a \-1 is returned and the error code is placed in
-the global variable
-.Va errno .
-.Sh ERRORS
-The
-.Fn copy_file_range
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-If
-.Fa infd
-is not open for reading or
-.Fa outfd
-is not open for writing, or opened for writing with
-.Dv O_APPEND ,
-or if
-.Fa infd
-and
-.Fa outfd
-refer to the same file.
-.It Bq Er EFBIG
-If the copy exceeds the process's file size limit or the maximum file size
-for the file system
-.Fa outfd
-resides on.
-.It Bq Er EINTR
-A signal interrupted the system call
-before it could be completed.
-This may happen for files on some NFS mounts.
-When this happens, the values pointed to by
-.Fa inoffp
-and
-.Fa outoffp
-are reset to the initial values for the system call.
-.It Bq Er EINVAL
-.Fa infd
-and
-.Fa outfd
-refer to the same file and the byte ranges overlap or
-.Fa flags
-is not zero.
-.It Bq Er EIO
-An I/O error occurred while reading/writing the files.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from a file system.
-.It Bq Er EISDIR
-If either
-.Fa infd
-or
-.Fa outfd
-refers to a directory.
-.It Bq Er ENOSPC
-File system that stores
-.Fa outfd
-is full.
-.El
-.Sh SEE ALSO
-.Xr lseek 2
-.Sh STANDARDS
-The
-.Fn copy_file_range
-system call is expected to be compatible with the Linux system call of
-the same name.
-.Sh HISTORY
-The
-.Fn copy_file_range
-function appeared in
-.Fx 13.0 .
diff --git a/lib/libc/sys/cpuset.2 b/lib/libc/sys/cpuset.2
deleted file mode 100644
index 8b17f537e7fa..000000000000
--- a/lib/libc/sys/cpuset.2
+++ /dev/null
@@ -1,302 +0,0 @@
-.\" Copyright (c) 2008 Christian Brueffer
-.\" Copyright (c) 2008 Jeffrey Roberson
-.\" Copyright (c) 2021 Robert N. M. Watson
-.\" All rights reserved.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd May 3, 2017
-.Dt CPUSET 2
-.Os
-.Sh NAME
-.Nm cpuset ,
-.Nm cpuset_getid ,
-.Nm cpuset_setid
-.Nd manage CPU affinity sets
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/param.h
-.In sys/cpuset.h
-.Ft int
-.Fn cpuset "cpusetid_t *setid"
-.Ft int
-.Fn cpuset_setid "cpuwhich_t which" "id_t id" "cpusetid_t setid"
-.Ft int
-.Fn cpuset_getid "cpulevel_t level" "cpuwhich_t which" "id_t id" "cpusetid_t *setid"
-.Sh DESCRIPTION
-The
-.Nm
-family of system calls allow applications to control sets of processors and
-memory domains and assign processes and threads to these sets.
-Processor sets contain lists of CPUs and domains that members may run on
-and exist only as long as some process is a member of the set.
-All processes in the system have an assigned set.
-The default set for all processes in the system is the set numbered 1.
-Threads belong to the same set as the process which contains them,
-however, they may further restrict their set with the anonymous
-per-thread mask to bind to a specific CPU or subset of CPUs and memory domains.
-.Pp
-Sets are referenced by a number of type
-.Ft cpuset_id_t .
-Each thread has a root set, an assigned set, and an anonymous mask.
-Only the root and assigned sets are numbered.
-The root set is the set of all CPUs and memory domains available in the system
-or in the system partition the thread is running in.
-The assigned set is a subset of the root set and is administratively
-assignable on a per-process basis.
-Many processes and threads may be members of a numbered set.
-.Pp
-The anonymous set is a further thread-specific refinement on the assigned
-set.
-It is intended that administrators will manipulate numbered sets using
-.Xr cpuset 1
-while application developers will manipulate anonymous sets using
-.Xr cpuset_setaffinity 2 and
-.Xr cpuset_setdomain 2 .
-.Pp
-To select the correct set a value of type
-.Ft cpulevel_t
-is used.
-The following values for
-.Fa level
-are supported:
-.Bl -column CPU_LEVEL_CPUSET -offset indent
-.It Dv CPU_LEVEL_ROOT Ta "Root set"
-.It Dv CPU_LEVEL_CPUSET Ta "Assigned set"
-.It Dv CPU_LEVEL_WHICH Ta "Set specified by which argument"
-.El
-.Pp
-The
-.Fa which
-argument determines how the value of
-.Fa id
-is interpreted and is of type
-.Ft cpuwhich_t .
-The
-.Fa which
-argument may have the following values:
-.Bl -column CPU_WHICH_INTRHANDLER -offset indent
-.It Dv CPU_WHICH_TID Ta "id is lwpid_t (thread id)"
-.It Dv CPU_WHICH_PID Ta "id is pid_t (process id)"
-.It Dv CPU_WHICH_JAIL Ta "id is jid (jail id)"
-.It Dv CPU_WHICH_CPUSET Ta "id is a cpusetid_t (cpuset id)"
-.It Dv CPU_WHICH_IRQ Ta "id is an irq number"
-.It Dv CPU_WHICH_INTRHANDLER Ta "id is an irq number for an interrupt handler"
-.It Dv CPU_WHICH_ITHREAD Ta "id is an irq number for an ithread"
-.It Dv CPU_WHICH_DOMAIN Ta "id is a NUMA domain"
-.El
-.Pp
-An
-.Fa id
-of '-1' may be used with a
-.Fa which
-of
-.Dv CPU_WHICH_TID ,
-.Dv CPU_WHICH_PID ,
-or
-.Dv CPU_WHICH_CPUSET
-to mean the current thread, process, or current thread's
-cpuset.
-All cpuset syscalls allow this usage.
-.Pp
-A
-.Fa level
-argument of
-.Dv CPU_LEVEL_WHICH
-combined with a
-.Fa which
-argument other than
-.Dv CPU_WHICH_CPUSET
-refers to the anonymous mask of the object.
-This mask does not have an id and may only be manipulated with
-.Xr cpuset_setaffinity 2 .
-.Pp
-.Fn cpuset
-creates a new set containing the same CPUs as the root set of the current
-process and stores its id in the space provided by
-.Fa setid .
-On successful completion the calling process joins the set and is the
-only member.
-Children inherit this set after a call to
-.Xr fork 2 .
-.Pp
-.Fn cpuset_setid
-attempts to set the id of the object specified by the
-.Fa which
-argument.
-Currently
-.Dv CPU_WHICH_PID
-is the only acceptable value for which as
-threads do not have an id distinct from their process and the API does
-not permit changing the id of an existing set.
-Upon successful completion all of the threads in the target process will
-be running on CPUs permitted by the set.
-.Pp
-.Fn cpuset_getid
-retrieves a set id from the object indicated by
-.Fa which
-and stores it in the space pointed to by
-.Fa setid .
-The retrieved id may be that of either the root or assigned set
-depending on the value of
-.Fa level .
-.Fa level
-should be
-.Dv CPU_LEVEL_CPUSET
-or
-.Dv CPU_LEVEL_ROOT
-to get the set id from
-the process or thread specified by the
-.Fa id
-argument.
-Specifying
-.Dv CPU_LEVEL_WHICH
-with a process or thread is unsupported since
-this references the unnumbered anonymous mask.
-.Pp
-The actual contents of the sets may be retrieved or manipulated using
-.Xr cpuset_getaffinity 2 ,
-.Xr cpuset_setaffinity 2 ,
-.Xr cpuset_getdomain 2 , and
-.Xr cpuset_setdomain 2 .
-The
-.Xr cpuset 9
-macros may be used to manipulate masks of type
-.Ft cpuset_t
-get and set using those APIs.
-See those manual pages for more detail.
-.Sh RETURN VALUES
-.Rv -std
-.Sh EXAMPLES
-In this example, a CPU set mask is configured to limit execution to the first
-CPU using
-.Xr CPU_ZERO 9
-and
-.Xr CPU_SET 9 ,
-members of the
-.Xr cpuset 9
-programming interface.
-Then, the mask is applied to a new anonymous CPU set associated with the
-current process using
-.Xr cpuset_setaffinity 2 .
-This mask will be used by the current process, and inherited by any new
-child processes.
-.Bd -literal -offset indent
-#include <sys/param.h>
-#include <sys/cpuset.h>
-
-#include <sysexits.h>
-
-cpuset_t cpuset_mask;
-
-/* Initialize a CPU mask and enable CPU 0. */
-CPU_ZERO(&cpuset_mask);
-CPU_SET(0, &cpuset_mask);
-
-/* Set affinity for the CPU set for the current process. */
-if (cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1,
- sizeof(cpuset_mask), &cpuset_mask) < 0)
- err(EX_OSERR, "cpuset_setaffinity");
-.Ed
-.Pp
-In the next example, a named CPU set is created containing the current
-process, and its affinity similarly configured.
-The resulting CPU set ID can then be used for further external management of
-the affinity of the set.
-.Bd -literal -offset indent
-#include <sys/param.h>
-#include <sys/cpuset.h>
-
-#include <sysexits.h>
-
-cpusetid_t cpuset_id;
-cpuset_t cpuset_mask;
-
-/* Create new cpuset for the current process. */
-if (cpuset(&cpuset_id) < 0)
- err(EX_OSERR, "cpuset");
-
-/* Initialize a CPU mask and enable CPU 0. */
-CPU_ZERO(&cpuset_mask);
-CPU_SET(0, &cpuset_mask);
-
-/* Set affinity for the CPU set for the current process. */
-if (cpuset_setaffinity(CPU_LEVEL_SET, CPU_WHICH_CPUSET, cpuset_id,
- sizeof(cpuset_mask), &cpuset_mask) < 0)
- err(EX_OSERR, "cpuset_setaffinity");
-.Ed
-.Sh ERRORS
-The following error codes may be set in
-.Va errno :
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Fa which
-or
-.Fa level
-argument was not a valid value.
-.It Bq Er EDEADLK
-The
-.Fn cpuset_setid
-call would leave a thread without a valid CPU to run on because the set
-does not overlap with the thread's anonymous mask.
-.It Bq Er EFAULT
-The setid pointer passed to
-.Fn cpuset_getid
-or
-.Fn cpuset
-was invalid.
-.It Bq Er ESRCH
-The object specified by the
-.Fa id
-and
-.Fa which
-arguments could not be found.
-.It Bq Er EPERM
-The calling process did not have the credentials required to complete the
-operation.
-.It Bq Er ENFILE
-There was no free
-.Ft cpusetid_t
-for allocation.
-.El
-.Sh SEE ALSO
-.Xr cpuset 1 ,
-.Xr cpuset_getaffinity 2 ,
-.Xr cpuset_getdomain 2 ,
-.Xr cpuset_setaffinity 2 ,
-.Xr cpuset_setdomain 2 ,
-.Xr pthread_affinity_np 3 ,
-.Xr pthread_attr_affinity_np 3 ,
-.Xr CPU_SET 9 ,
-.Xr CPU_ZERO 9 ,
-.Xr cpuset 9
-.Sh HISTORY
-The
-.Nm
-family of system calls first appeared in
-.Fx 7.1 .
-.Sh AUTHORS
-.An Jeffrey Roberson Aq Mt jeff@FreeBSD.org
diff --git a/lib/libc/sys/cpuset_getaffinity.2 b/lib/libc/sys/cpuset_getaffinity.2
deleted file mode 100644
index bce9161a1880..000000000000
--- a/lib/libc/sys/cpuset_getaffinity.2
+++ /dev/null
@@ -1,174 +0,0 @@
-.\" Copyright (c) 2008 Christian Brueffer
-.\" Copyright (c) 2008 Jeffrey Roberson
-.\" All rights reserved.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd May 23, 2017
-.Dt CPUSET_GETAFFINITY 2
-.Os
-.Sh NAME
-.Nm cpuset_getaffinity ,
-.Nm cpuset_setaffinity
-.Nd manage CPU affinity
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/param.h
-.In sys/cpuset.h
-.Ft int
-.Fn cpuset_getaffinity "cpulevel_t level" "cpuwhich_t which" "id_t id" "size_t setsize" "cpuset_t *mask"
-.Ft int
-.Fn cpuset_setaffinity "cpulevel_t level" "cpuwhich_t which" "id_t id" "size_t setsize" "const cpuset_t *mask"
-.Sh DESCRIPTION
-.Fn cpuset_getaffinity
-and
-.Fn cpuset_setaffinity
-allow the manipulation of sets of CPUs available to processes, threads,
-interrupts, jails and other resources.
-These functions may manipulate sets of CPUs that contain many processes
-or per-object anonymous masks that effect only a single object.
-.Pp
-The valid values for the
-.Fa level
-and
-.Fa which
-arguments are documented in
-.Xr cpuset 2 .
-These arguments specify which object and which set of the object we are
-referring to.
-Not all possible combinations are valid.
-For example, only processes may belong to a numbered set accessed by a
-.Fa level
-argument of
-.Dv CPU_LEVEL_CPUSET .
-All resources, however, have a mask which may be manipulated with
-.Dv CPU_LEVEL_WHICH .
-.Pp
-Masks of type
-.Ft cpuset_t
-are composed using the
-.Dv CPU_SET
-macros.
-The kernel tolerates large sets as long as all CPUs specified
-in the set exist.
-Sets smaller than the kernel uses generate an error on calls to
-.Fn cpuset_getaffinity
-even if the result set would fit within the user supplied set.
-Calls to
-.Fn cpuset_setaffinity
-tolerate small sets with no restrictions.
-.Pp
-The supplied mask should have a size of
-.Fa setsize
-bytes.
-This size is usually provided by calling
-.Li sizeof(mask)
-which is ultimately determined by the value of
-.Dv CPU_SETSIZE
-as defined in
-.In sys/cpuset.h .
-.Pp
-.Fn cpuset_getaffinity
-retrieves the
-mask from the object specified by
-.Fa level ,
-.Fa which
-and
-.Fa id
-and stores it in the space provided by
-.Fa mask .
-.Pp
-.Fn cpuset_setaffinity
-attempts to set the mask for the object specified by
-.Fa level ,
-.Fa which
-and
-.Fa id
-to the value in
-.Fa mask .
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-The following error codes may be set in
-.Va errno :
-.Bl -tag -width Er
-.\" When changing this list, consider updating share/man/man3/pthread_create.3,
-.\" since that function can return any of these errors.
-.It Bq Er EINVAL
-The
-.Fa level
-or
-.Fa which
-argument was not a valid value.
-.It Bq Er EINVAL
-The
-.Fa mask
-argument specified when calling
-.Fn cpuset_setaffinity
-was not a valid value.
-.It Bq Er EDEADLK
-The
-.Fn cpuset_setaffinity
-call would leave a thread without a valid CPU to run on because the set
-does not overlap with the thread's anonymous mask.
-.It Bq Er EFAULT
-The mask pointer passed was invalid.
-.It Bq Er ESRCH
-The object specified by the
-.Fa id
-and
-.Fa which
-arguments could not be found.
-.It Bq Er ERANGE
-The
-.Fa cpusetsize
-was either preposterously large or smaller than the kernel set size.
-.It Bq Er EPERM
-The calling process did not have the credentials required to complete the
-operation.
-.It Bq Er ECAPMODE
-The calling process attempted to act on a process other than itself, while
-in capability mode.
-See
-.Xr capsicum 4 .
-.El
-.Sh SEE ALSO
-.Xr cpuset 1 ,
-.Xr cpuset 2 ,
-.Xr cpuset_getdomain 2 ,
-.Xr cpuset_getid 2 ,
-.Xr cpuset_setdomain 2 ,
-.Xr cpuset_setid 2 ,
-.Xr pthread_affinity_np 3 ,
-.Xr pthread_attr_affinity_np 3 ,
-.Xr capsicum 4 ,
-.Xr cpuset 9
-.Sh HISTORY
-The
-.Nm
-family of system calls first appeared in
-.Fx 7.1 .
-.Sh AUTHORS
-.An Jeffrey Roberson Aq Mt jeff@FreeBSD.org
diff --git a/lib/libc/sys/cpuset_getdomain.2 b/lib/libc/sys/cpuset_getdomain.2
deleted file mode 100644
index 6d969b051155..000000000000
--- a/lib/libc/sys/cpuset_getdomain.2
+++ /dev/null
@@ -1,191 +0,0 @@
-.\" Copyright (c) 2018 Jeffrey Roberson
-.\" All rights reserved.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd June 18, 2020
-.Dt CPUSET_GETDOMAIN 2
-.Os
-.Sh NAME
-.Nm cpuset_getdomain ,
-.Nm cpuset_setdomain
-.Nd manage memory domain policy
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/param.h
-.In sys/domainset.h
-.Ft int
-.Fn cpuset_getdomain "cpulevel_t level" "cpuwhich_t which" "id_t id" "size_t setsize" "domainset_t *mask" "int *policy"
-.Ft int
-.Fn cpuset_setdomain "cpulevel_t level" "cpuwhich_t which" "id_t id" "size_t setsize" "const domainset_t *mask" "int policy"
-.Sh DESCRIPTION
-.Fn cpuset_getdomain
-and
-.Fn cpuset_setdomain
-allow the manipulation of sets of memory domains and allocation policy available
-to processes, threads, jails and other resources.
-These functions may manipulate sets of memory domains that contain many processes
-or per-object anonymous masks that affect only a single object.
-.Pp
-The valid values for the
-.Fa level
-and
-.Fa which
-arguments are documented in
-.Xr cpuset 2 .
-These arguments specify which object and which set of the object we are
-referring to.
-Not all possible combinations are valid.
-For example, only processes may belong to a numbered set accessed by a
-.Fa level
-argument of
-.Dv CPU_LEVEL_CPUSET .
-All resources, however, have a mask which may be manipulated with
-.Dv CPU_LEVEL_WHICH .
-.Pp
-Masks of type
-.Ft domainset_t
-are composed using the
-.Dv DOMAINSET
-macros.
-The kernel tolerates large sets as long as all domains specified
-in the set exist.
-Sets smaller than the kernel uses generate an error on calls to
-.Fn cpuset_getdomain
-even if the result set would fit within the user supplied set.
-Calls to
-.Fn cpuset_setdomain
-tolerate small sets with no restrictions.
-.Pp
-The supplied mask should have a size of
-.Fa setsize
-bytes.
-This size is usually provided by calling
-.Li sizeof(mask)
-which is ultimately determined by the value of
-.Dv DOMAINSET_SETSIZE
-as defined in
-.In sys/domainset.h .
-.Pp
-.Fn cpuset_getdomain
-retrieves the
-mask and policy from the object specified by
-.Fa level ,
-.Fa which
-and
-.Fa id
-and stores it in the space provided by
-.Fa mask
-and
-.Fa policy .
-.Pp
-.Fn cpuset_setdomain
-attempts to set the mask and policy for the object specified by
-.Fa level ,
-.Fa which
-and
-.Fa id
-to the values in
-.Fa mask
-and
-.Fa policy .
-.Sh ALLOCATION POLICIES
-Valid policy values are as follows:
-.Bl -tag -width "foo"
-.It Dv DOMAINSET_POLICY_ROUNDROBIN
-Memory is allocated on a round-robin basis by cycling through each domain in
-.Fa mask .
-.It Dv DOMAINSET_POLICY_FIRSTTOUCH
-Memory is allocated on the domain local to the CPU the requesting thread is
-running on.
-Failure to allocate from this domain will fallback to round-robin.
-.It Dv DOMAINSET_POLICY_PREFER
-Memory is allocated preferentially from the single domain specified in the mask.
-If memory is unavailable the domains listed in the parent cpuset will be
-visited in a round-robin order.
-.El
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-The following error codes may be set in
-.Va errno :
-.Bl -tag -width Er
-.\" When changing this list, consider updating share/man/man3/pthread_create.3,
-.\" since that function can return any of these errors.
-.It Bq Er EINVAL
-The
-.Fa level
-or
-.Fa which
-argument was not a valid value.
-.It Bq Er EINVAL
-The
-.Fa mask or
-.Fa policy
-argument specified when calling
-.Fn cpuset_setdomain
-was not a valid value.
-.It Bq Er EDEADLK
-The
-.Fn cpuset_setdomain
-call would leave a thread without a valid CPU to run on because the set
-does not overlap with the thread's anonymous mask.
-.It Bq Er EFAULT
-The mask pointer passed was invalid.
-.It Bq Er ESRCH
-The object specified by the
-.Fa id
-and
-.Fa which
-arguments could not be found.
-.It Bq Er ERANGE
-The
-.Fa domainsetsize
-was either preposterously large or smaller than the kernel set size.
-.It Bq Er EPERM
-The calling process did not have the credentials required to complete the
-operation.
-.It Bq Er ECAPMODE
-The calling process attempted to act on a process other than itself, while
-in capability mode.
-See
-.Xr capsicum 4 .
-.El
-.Sh SEE ALSO
-.Xr cpuset 1 ,
-.Xr cpuset 2 ,
-.Xr cpuset_getaffinity 2 ,
-.Xr cpuset_getid 2 ,
-.Xr cpuset_setaffinity 2 ,
-.Xr cpuset_setid 2 ,
-.Xr capsicum 4 ,
-.Xr cpuset 9
-.Sh HISTORY
-The
-.Nm
-family of system calls first appeared in
-.Fx 12.0 .
-.Sh AUTHORS
-.An Jeffrey Roberson Aq Mt jeff@FreeBSD.org
diff --git a/lib/libc/compat-43/creat.c b/lib/libc/sys/creat.c
index 5546fb1014a6..afd626e928bb 100644
--- a/lib/libc/compat-43/creat.c
+++ b/lib/libc/sys/creat.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)creat.c 8.1 (Berkeley) 6/2/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <fcntl.h>
#include "un-namespace.h"
@@ -49,9 +43,7 @@ int __creat(const char *path, mode_t mode);
int
__creat(const char *path, mode_t mode)
{
-
- return (((int (*)(int, const char *, int, ...))
- __libc_interposing[INTERPOS_openat])(AT_FDCWD, path, O_WRONLY |
- O_CREAT | O_TRUNC, mode));
+ return (INTERPOS_SYS(openat, AT_FDCWD, path,
+ O_WRONLY | O_CREAT | O_TRUNC, mode));
}
diff --git a/lib/libc/sys/dup.2 b/lib/libc/sys/dup.2
deleted file mode 100644
index a617ab0da9e6..000000000000
--- a/lib/libc/sys/dup.2
+++ /dev/null
@@ -1,171 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)dup.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd December 1, 2017
-.Dt DUP 2
-.Os
-.Sh NAME
-.Nm dup ,
-.Nm dup2
-.Nd duplicate an existing file descriptor
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn dup "int oldd"
-.Ft int
-.Fn dup2 "int oldd" "int newd"
-.Sh DESCRIPTION
-The
-.Fn dup
-system call
-duplicates an existing object descriptor and returns its value to
-the calling process
-.Fa ( newd
-=
-.Fn dup oldd ) .
-The argument
-.Fa oldd
-is a small non-negative integer index in
-the per-process descriptor table.
-The new descriptor returned by the call
-is the lowest numbered descriptor
-currently not in use by the process.
-.Pp
-The object referenced by the descriptor does not distinguish
-between
-.Fa oldd
-and
-.Fa newd
-in any way.
-Thus if
-.Fa newd
-and
-.Fa oldd
-are duplicate references to an open
-file,
-.Xr read 2 ,
-.Xr write 2
-and
-.Xr lseek 2
-calls all move a single pointer into the file,
-and append mode, non-blocking I/O and asynchronous I/O options
-are shared between the references.
-If a separate pointer into the file is desired, a different
-object reference to the file must be obtained by issuing an
-additional
-.Xr open 2
-system call.
-The close-on-exec flag on the new file descriptor is unset.
-.Pp
-In
-.Fn dup2 ,
-the value of the new descriptor
-.Fa newd
-is specified.
-If this descriptor is already in use and
-.Fa oldd
-\*(Ne
-.Fa newd ,
-the descriptor is first deallocated as if the
-.Xr close 2
-system call had been used.
-If
-.Fa oldd
-is not a valid descriptor, then
-.Fa newd
-is not closed.
-If
-.Fa oldd
-==
-.Fa newd
-and
-.Fa oldd
-is a valid descriptor, then
-.Fn dup2
-is successful, and does nothing.
-.Sh RETURN VALUES
-These calls return the new file descriptor if successful;
-otherwise the value -1 is returned and
-the external variable
-.Va errno
-is set to indicate the cause of the error.
-.Sh ERRORS
-The
-.Fn dup
-system call fails if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa oldd
-argument
-is not a valid active descriptor
-.It Bq Er EMFILE
-Too many descriptors are active.
-.El
-.Pp
-The
-.Fn dup2
-system call fails if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa oldd
-argument is not a valid active descriptor or the
-.Fa newd
-argument is negative or exceeds the maximum allowable descriptor number
-.El
-.Sh SEE ALSO
-.Xr accept 2 ,
-.Xr close 2 ,
-.Xr fcntl 2 ,
-.Xr getdtablesize 2 ,
-.Xr open 2 ,
-.Xr pipe 2 ,
-.Xr socket 2 ,
-.Xr socketpair 2 ,
-.Xr dup3 3
-.Sh STANDARDS
-The
-.Fn dup
-and
-.Fn dup2
-system calls are expected to conform to
-.St -p1003.1-90 .
-.Sh HISTORY
-The
-.Fn dup
-function appeared in
-.At v3 .
-The
-.Fn dup2
-function appeared in
-.At v7 .
diff --git a/lib/libc/sys/eventfd.2 b/lib/libc/sys/eventfd.2
deleted file mode 100644
index ae9e44efc853..000000000000
--- a/lib/libc/sys/eventfd.2
+++ /dev/null
@@ -1,208 +0,0 @@
-.\" SPDX-License-Identifier: BSD-2-Clause
-.\"
-.\" Copyright (c) 2020 Greg V <greg@unrelenting.technology>
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd October 8, 2020
-.Dt EVENTFD 2
-.Os
-.Sh NAME
-.Nm eventfd
-.Nd create a file descriptor for event notification
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/eventfd.h
-.Ft int
-.Fn eventfd "unsigned int initval" "int flags"
-.Ft int
-.Fn eventfd_read "int fd" "eventfd_t *value"
-.Ft int
-.Fn eventfd_write "int fd" "eventfd_t value"
-.Sh DESCRIPTION
-.Fn eventfd
-creates a special file descriptor with event counter or semaphore semantics,
-designed for interprocess communication.
-The returned file descriptor refers to a kernel object containing an
-unsigned 64-bit integer counter, which is initialized with the value of the
-.Fa initval
-argument.
-.Pp
-The
-.Fa flags
-argument may contain the result of
-.Em or Ns 'ing
-the following values:
-.Pp
-.Bl -tag -width "EFD_SEMAPHORE" -compact
-.It Dv EFD_CLOEXEC
-set FD_CLOEXEC on the file descriptor
-.It Dv EFD_NONBLOCK
-do not block on read/write operations
-.It Dv EFD_SEMAPHORE
-use semaphore semantics
-.El
-.Pp
-File operations have the following semantics:
-.Bl -tag -width EFD_SEMAPHORE
-.It Xr read 2
-If the counter is zero, the call blocks until the counter becomes non-zero, unless
-.Dv EFD_NONBLOCK
-was set, in which case it would fail with
-.Dv EAGAIN
-instead.
-.Pp
-If the counter is non-zero:
-.Bl -bullet
-.It
-If
-.Dv EFD_SEMAPHORE
-is not set, the current value of the counter is returned,
-and the value is reset to zero.
-.It
-If
-.Dv EFD_SEMAPHORE
-is set, the constant 1 is returned, and the value is decremented by 1.
-.El
-.Pp
-The numeric value is encoded as 64-bit (8 bytes) in host byte order.
-The
-.Xr read 2
-call fails with
-.Dv EINVAL
-if there is less than 8 bytes available in the supplied buffer.
-.It Xr write 2
-Adds the given value to the counter.
-The maximum value that can be stored in the counter is the
-maximum unsigned 64-bit integer value minus one (0xfffffffffffffffe).
-.Pp
-If the resulting value exceeds the maximum, the call would block
-until the value is reduced by
-.Xr read 2 ,
-unless
-.Dv EFD_NONBLOCK
-was set, in which case it would fail with
-.Dv EAGAIN
-instead.
-.Pp
-The numeric value is encoded as 64-bit (8 bytes) in host byte order.
-The
-.Xr write 2
-call fails with
-.Dv EINVAL
-if there is less than 8 bytes available in the supplied buffer,
-or if the value 0xffffffffffffffff is given.
-.It Xr poll 2
-When receiving notifications via
-.Xr poll 2 /
-.Xr ppoll 2 /
-.Xr select 2 /
-.Xr pselect 2 /
-.Xr kqueue 2 ,
-the following semantics apply:
-.Bl -bullet
-.It
-The file descriptor is readable when the counter is greater than zero.
-.It
-The file descriptor is writable when the counter is less than the maximum value.
-.El
-.El
-.Pp
-File descriptors created by
-.Fn eventfd
-are passable to other processes via
-.Xr sendmsg 2
-and are preserved across
-.Xr fork 2 ;
-in both cases the descriptors refer to the same counter from both processes.
-Unless
-.Dv O_CLOEXEC
-flag was specified,
-the created file descriptor will remain open across
-.Xr execve 2
-system calls; see
-.Xr close 2 ,
-.Xr fcntl 2
-and
-.Dv O_CLOEXEC
-description.
-.Pp
-.Fn eventfd_read
-and
-.Fn eventfd_write
-are thin wrappers around
-.Xr read 2
-and
-.Xr write 2
-system calls,
-provided for compatibility with glibc.
-.Sh RETURN VALUES
-If successful,
-.Fn eventfd
-returns a non-negative integer, termed a file descriptor.
-It returns \-1 on failure, and sets
-.Va errno
-to indicate the error.
-.Pp
-The
-.Fn eventfd_read
-and
-.Fn eventfd_write
-functions return 0 if the operation succeeded, -1 otherwise.
-.Sh ERRORS
-.Fn eventfd
-may fail with:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Fa flags
-argument given to
-.Fn eventfd
-has unknown bits set.
-.It Bq Er EMFILE
-The process has already reached its limit for open
-file descriptors.
-.It Bq Er ENFILE
-The system file table is full.
-.It Bq Er ENOMEM
-No memory was available to create the kernel object.
-.El
-.Sh SEE ALSO
-.Xr close 2 ,
-.Xr kqueue 2 ,
-.Xr poll 2 ,
-.Xr read 2 ,
-.Xr select 2 ,
-.Xr write 2
-.Sh STANDARDS
-The
-.Fn eventfd
-system call is non-standard.
-It is present in Linux.
-.Sh HISTORY
-The
-.Fn eventfd
-system call first appeared in
-.Fx 13.0 .
diff --git a/lib/libc/sys/execve.2 b/lib/libc/sys/execve.2
deleted file mode 100644
index a8f5aa14854b..000000000000
--- a/lib/libc/sys/execve.2
+++ /dev/null
@@ -1,379 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)execve.2 8.5 (Berkeley) 6/1/94
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2020
-.Dt EXECVE 2
-.Os
-.Sh NAME
-.Nm execve ,
-.Nm fexecve
-.Nd execute a file
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn execve "const char *path" "char *const argv[]" "char *const envp[]"
-.Ft int
-.Fn fexecve "int fd" "char *const argv[]" "char *const envp[]"
-.Sh DESCRIPTION
-The
-.Fn execve
-system call
-transforms the calling process into a new process.
-The new process is constructed from an ordinary file,
-whose name is pointed to by
-.Fa path ,
-called the
-.Em new process file .
-The
-.Fn fexecve
-system call is equivalent to
-.Fn execve
-except that the file to be executed is determined by the file
-descriptor
-.Fa fd
-instead of a
-.Fa path .
-This file is either an executable object file,
-or a file of data for an interpreter.
-An executable object file consists of an identifying header,
-followed by pages of data representing the initial program (text)
-and initialized data pages.
-Additional pages may be specified
-by the header to be initialized with zero data; see
-.Xr elf 5
-and
-.Xr a.out 5 .
-.Pp
-An interpreter file begins with a line of the form:
-.Pp
-.Bd -ragged -offset indent -compact
-.Sy \&#!
-.Em interpreter
-.Bq Em arg
-.Ed
-.Pp
-When an interpreter file is
-.Sy execve Ap d ,
-the system actually
-.Sy execve Ap s
-the specified
-.Em interpreter .
-If the optional
-.Em arg
-is specified, it becomes the first argument to the
-.Em interpreter ,
-and the name of the originally
-.Sy execve Ap d
-file becomes the second argument;
-otherwise, the name of the originally
-.Sy execve Ap d
-file becomes the first argument.
-The original arguments are shifted over to
-become the subsequent arguments.
-The zeroth argument is set to the specified
-.Em interpreter .
-.Pp
-The argument
-.Fa argv
-is a pointer to a null-terminated array of
-character pointers to null-terminated character strings.
-These strings construct the argument list to be made available to the new
-process.
-At least one argument must be present in
-the array; by custom, the first element should be
-the name of the executed program (for example, the last component of
-.Fa path ) .
-.Pp
-The argument
-.Fa envp
-is also a pointer to a null-terminated array of
-character pointers to null-terminated strings.
-A pointer to this array is normally stored in the global variable
-.Va environ .
-These strings pass information to the
-new process that is not directly an argument to the command (see
-.Xr environ 7 ) .
-.Pp
-File descriptors open in the calling process image remain open in
-the new process image, except for those for which the close-on-exec
-flag is set (see
-.Xr close 2
-and
-.Xr fcntl 2 ) .
-Descriptors that remain open are unaffected by
-.Fn execve .
-If any of the standard descriptors (0, 1, and/or 2) are closed at the
-time
-.Fn execve
-is called, and the process will gain privilege as a result of set-id
-semantics, those descriptors will be re-opened automatically.
-No programs, whether privileged or not, should assume that these descriptors
-will remain closed across a call to
-.Fn execve .
-.Pp
-Signals set to be ignored in the calling process are set to be ignored in
-the
-new process.
-Signals which are set to be caught in the calling process image
-are set to default action in the new process image.
-Blocked signals remain blocked regardless of changes to the signal action.
-The signal stack is reset to be undefined (see
-.Xr sigaction 2
-for more information).
-.Pp
-If the set-user-ID mode bit of the new process image file is set
-(see
-.Xr chmod 2 ) ,
-the effective user ID of the new process image is set to the owner ID
-of the new process image file.
-If the set-group-ID mode bit of the new process image file is set,
-the effective group ID of the new process image is set to the group ID
-of the new process image file.
-(The effective group ID is the first element of the group list.)
-The real user ID, real group ID and
-other group IDs of the new process image remain the same as the calling
-process image.
-After any set-user-ID and set-group-ID processing,
-the effective user ID is recorded as the saved set-user-ID,
-and the effective group ID is recorded as the saved set-group-ID.
-These values may be used in changing the effective IDs later (see
-.Xr setuid 2 ) .
-.Pp
-The set-ID bits are not honored if the respective file system has the
-.Cm nosuid
-option enabled or if the new process file is an interpreter file.
-Syscall
-tracing is disabled if effective IDs are changed.
-.Pp
-The new process also inherits the following attributes from
-the calling process:
-.Pp
-.Bl -column parent_process_ID -offset indent -compact
-.It process ID Ta see Xr getpid 2
-.It parent process ID Ta see Xr getppid 2
-.It process group ID Ta see Xr getpgrp 2
-.It access groups Ta see Xr getgroups 2
-.It working directory Ta see Xr chdir 2
-.It root directory Ta see Xr chroot 2
-.It control terminal Ta see Xr termios 4
-.It resource usages Ta see Xr getrusage 2
-.It interval timers Ta see Xr getitimer 2
-.It resource limits Ta see Xr getrlimit 2
-.It file mode mask Ta see Xr umask 2
-.It signal mask Ta see Xr sigaction 2 ,
-.Xr sigprocmask 2
-.El
-.Pp
-When a program is executed as a result of an
-.Fn execve
-system call, it is entered as follows:
-.Bd -literal -offset indent
-main(argc, argv, envp)
-int argc;
-char **argv, **envp;
-.Ed
-.Pp
-where
-.Fa argc
-is the number of elements in
-.Fa argv
-(the ``arg count'')
-and
-.Fa argv
-points to the array of character pointers
-to the arguments themselves.
-.Pp
-The
-.Fn fexecve
-ignores the file offset of
-.Fa fd .
-Since execute permission is checked by
-.Fn fexecve ,
-the file descriptor
-.Fa fd
-need not have been opened with the
-.Dv O_EXEC
-flag.
-However, if the file to be executed denies read permission for the process
-preparing to do the exec, the only way to provide the
-.Fa fd
-to
-.Fn fexecve
-is to use the
-.Dv O_EXEC
-flag when opening
-.Fa fd .
-Note that the file to be executed can not be open for writing.
-.Sh RETURN VALUES
-As the
-.Fn execve
-system call overlays the current process image
-with a new process image the successful call
-has no process to return to.
-If
-.Fn execve
-does return to the calling process an error has occurred; the
-return value will be -1 and the global variable
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-The
-.Fn execve
-system call
-will fail and return to the calling process if:
-.Bl -tag -width Er
-.It Bq Er ENOTDIR
-A component of the path prefix is not a directory.
-.It Bq Er ENAMETOOLONG
-A component of a pathname exceeded 255 characters,
-or an entire path name exceeded 1023 characters.
-.It Bq Er ENOEXEC
-When invoking an interpreted script, the length of the first line,
-inclusive of the
-.Sy \&#!
-prefix and terminating newline, exceeds
-.Dv MAXSHELLCMDLEN
-characters.
-.It Bq Er ENOENT
-The new process file does not exist.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating the pathname.
-.It Bq Er EACCES
-Search permission is denied for a component of the path prefix.
-.It Bq Er EACCES
-The new process file is not an ordinary file.
-.It Bq Er EACCES
-The new process file mode denies execute permission.
-.It Bq Er ENOEXEC
-The new process file has the appropriate access
-permission, but has an invalid magic number in its header.
-.It Bq Er ETXTBSY
-The new process file is a pure procedure (shared text)
-file that is currently open for writing by some process.
-.It Bq Er ENOMEM
-The new process requires more virtual memory than
-is allowed by the imposed maximum
-.Pq Xr getrlimit 2 .
-.It Bq Er E2BIG
-The number of bytes in the new process' argument list
-is larger than the system-imposed limit.
-This limit is specified by the
-.Xr sysctl 3
-MIB variable
-.Dv KERN_ARGMAX .
-.It Bq Er EFAULT
-The new process file is not as long as indicated by
-the size values in its header.
-.It Bq Er EFAULT
-The
-.Fa path ,
-.Fa argv ,
-or
-.Fa envp
-arguments
-point
-to an illegal address.
-.It Bq Er EIO
-An I/O error occurred while reading from the file system.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.El
-.Pp
-In addition, the
-.Fn fexecve
-will fail and return to the calling process if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa fd
-argument is not a valid file descriptor open for executing.
-.El
-.Sh SEE ALSO
-.Xr ktrace 1 ,
-.Xr _exit 2 ,
-.Xr fork 2 ,
-.Xr open 2 ,
-.Xr execl 3 ,
-.Xr exit 3 ,
-.Xr sysctl 3 ,
-.Xr a.out 5 ,
-.Xr elf 5 ,
-.Xr fdescfs 5 ,
-.Xr environ 7 ,
-.Xr mount 8
-.Sh STANDARDS
-The
-.Fn execve
-system call conforms to
-.St -p1003.1-2001 ,
-with the exception of reopening descriptors 0, 1, and/or 2 in certain
-circumstances.
-A future update of the Standard is expected to require this behavior,
-and it may become the default for non-privileged processes as well.
-.\" NB: update this caveat when TC1 is blessed.
-The support for executing interpreted programs is an extension.
-The
-.Fn fexecve
-system call conforms to The Open Group Extended API Set 2 specification.
-.Sh HISTORY
-The
-.Fn execve
-system call appeared in
-.At v7 .
-The
-.Fn fexecve
-system call appeared in
-.Fx 8.0 .
-.Sh CAVEATS
-If a program is
-.Em setuid
-to a non-super-user, but is executed when
-the real
-.Em uid
-is ``root'', then the program has some of the powers
-of a super-user as well.
-.Pp
-When executing an interpreted program through
-.Fn fexecve ,
-kernel supplies
-.Pa /dev/fd/n
-as a second argument to the interpreter,
-where
-.Ar n
-is the file descriptor passed in the
-.Fa fd
-argument to
-.Fn fexecve .
-For this construction to work correctly, the
-.Xr fdescfs 5
-filesystem shall be mounted on
-.Pa /dev/fd .
diff --git a/lib/libc/sys/extattr_get_file.2 b/lib/libc/sys/extattr_get_file.2
deleted file mode 100644
index c38b27e17423..000000000000
--- a/lib/libc/sys/extattr_get_file.2
+++ /dev/null
@@ -1,292 +0,0 @@
-.\"
-.\" Copyright (c) 2001 Dima Dorfman <dima@unixfreak.org>
-.\" Copyright (c) 2003 Robert Watson <rwatson@FreeBSD.org>
-.\" All rights reserved.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd October 11, 2021
-.Dt EXTATTR 2
-.Os
-.Sh NAME
-.Nm extattr_delete_fd ,
-.Nm extattr_delete_file ,
-.Nm extattr_delete_link ,
-.Nm extattr_get_fd ,
-.Nm extattr_get_file ,
-.Nm extattr_get_link ,
-.Nm extattr_list_fd ,
-.Nm extattr_list_file ,
-.Nm extattr_list_link ,
-.Nm extattr_set_fd ,
-.Nm extattr_set_file ,
-.Nm extattr_set_link
-.Nd system calls to manipulate VFS extended attributes
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In sys/extattr.h
-.Ft int
-.Fn extattr_delete_fd "int fd" "int attrnamespace" "const char *attrname"
-.Ft int
-.Fn extattr_delete_file "const char *path" "int attrnamespace" "const char *attrname"
-.Ft int
-.Fn extattr_delete_link "const char *path" "int attrnamespace" "const char *attrname"
-.Ft ssize_t
-.Fn extattr_get_fd "int fd" "int attrnamespace" "const char *attrname" "void *data" "size_t nbytes"
-.Ft ssize_t
-.Fn extattr_get_file "const char *path" "int attrnamespace" "const char *attrname" "void *data" "size_t nbytes"
-.Ft ssize_t
-.Fn extattr_get_link "const char *path" "int attrnamespace" "const char *attrname" "void *data" "size_t nbytes"
-.Ft ssize_t
-.Fn extattr_list_fd "int fd" "int attrnamespace" "void *data" "size_t nbytes"
-.Ft ssize_t
-.Fn extattr_list_file "const char *path" "int attrnamespace" "void *data" "size_t nbytes"
-.Ft ssize_t
-.Fn extattr_list_link "const char *path" "int attrnamespace" "void *data" "size_t nbytes"
-.Ft ssize_t
-.Fn extattr_set_fd "int fd" "int attrnamespace" "const char *attrname" "const void *data" "size_t nbytes"
-.Ft ssize_t
-.Fn extattr_set_file "const char *path" "int attrnamespace" "const char *attrname" "const void *data" "size_t nbytes"
-.Ft ssize_t
-.Fn extattr_set_link "const char *path" "int attrnamespace" "const char *attrname" "const void *data" "size_t nbytes"
-.Sh DESCRIPTION
-Named extended attributes are meta-data associated with vnodes
-representing files and directories.
-They exist as
-.Qq Li name=value
-pairs within a set of namespaces.
-.Pp
-The
-.Fn extattr_get_file
-system call retrieves the value of the specified extended attribute into
-a buffer pointed to by
-.Fa data
-of size
-.Fa nbytes .
-The
-.Fn extattr_set_file
-system call sets the value of the specified extended attribute to the data
-described by
-.Fa data .
-The
-.Fn extattr_delete_file
-system call deletes the extended attribute specified.
-The
-.Fn extattr_list_file
-returns a list of attributes present in the requested namespace.
-Each list entry consists of a single byte containing the length
-of the attribute name, followed by the attribute name.
-The attribute name is not terminated by ASCII 0 (nul).
-The
-.Fn extattr_get_file
-and
-.Fn extattr_list_file
-calls consume the
-.Fa data
-and
-.Fa nbytes
-arguments in the style of
-.Xr read 2 ;
-.Fn extattr_set_file
-consumes these arguments in the style of
-.Xr write 2 .
-.Pp
-If
-.Fa data
-is
-.Dv NULL
-in a call to
-.Fn extattr_get_file
-and
-.Fn extattr_list_file
-then the size of defined extended attribute data will be returned, rather
-than the quantity read, permitting applications to test the size of the
-data without performing a read.
-The
-.Fn extattr_delete_link ,
-.Fn extattr_get_link ,
-and
-.Fn extattr_set_link
-system calls behave in the same way as their _file counterparts, except that
-they do not follow symlinks.
-.Pp
-The
-.Fn extattr_get_fd ,
-.Fn extattr_delete_fd ,
-.Fn extattr_list_fd ,
-and
-.Fn extattr_set_fd
-calls are identical to their
-.Qq Li _file
-counterparts except for the first argument.
-The
-.Qq Li _fd
-functions take a file descriptor, while the
-.Qq Li _file
-functions take a path.
-Both arguments describe a file associated with the extended attribute
-that should be manipulated.
-The
-.Qq Li _fd
-functions can be used with file descriptors opened with the
-.Dv O_PATH
-flag.
-.Pp
-The following arguments are common to all the system calls described here:
-.Bl -tag -width attrnamespace
-.It Fa attrnamespace
-the namespace in which the extended attribute resides; see
-.Xr extattr 9
-.It Fa attrname
-the name of the extended attribute
-.El
-.Pp
-Named extended attribute semantics vary by file system implementing the call.
-Not all operations may be supported for a particular attribute.
-Additionally, the format of the data in
-.Fa data
-is attribute-specific.
-.Pp
-For more information on named extended attributes, please see
-.Xr extattr 9 .
-.Sh RETURN VALUES
-If successful, the
-.Fn extattr_get_fd ,
-.Fn extattr_get_file ,
-.Fn extattr_get_link ,
-.Fn extattr_list_fd ,
-.Fn extattr_list_file ,
-.Fn extattr_list_link ,
-.Fn extattr_set_fd ,
-.Fn extattr_set_file ,
-and
-.Fn extattr_set_link
-calls return the number of bytes
-that were read or written from the
-.Fa data ,
-respectively.
-If
-.Fa data
-was
-.Dv NULL ,
-then
-.Fn extattr_get_fd ,
-.Fn extattr_get_file ,
-.Fn extattr_get_link ,
-.Fn extattr_list_fd ,
-.Fn extattr_list_file ,
-and
-.Fn extattr_list_link
-return the number of bytes available to read.
-If any of the calls are unsuccessful, the value \-1 is returned
-and the global variable
-.Va errno
-is set to indicate the error.
-.Pp
-.Rv -std extattr_delete_file
-.Sh ERRORS
-The following errors may be returned by the system calls themselves.
-Additionally, the file system implementing the call may return any
-other errors it desires.
-.Bl -tag -width Er
-.It Bq Er EFAULT
-The
-.Fa attrnamespace
-and
-.Fa attrname
-arguments,
-or the memory range defined by
-.Fa data
-and
-.Fa nbytes
-point outside the process's allocated address space.
-.It Bq Er ENAMETOOLONG
-The attribute name was longer than
-.Dv EXTATTR_MAXNAMELEN .
-.El
-.Pp
-The
-.Fn extattr_get_fd ,
-.Fn extattr_set_fd ,
-.Fn extattr_delete_fd ,
-and
-.Fn extattr_list_fd
-system calls may also fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The file descriptor referenced by
-.Fa fd
-was invalid.
-.El
-.Pp
-Additionally, the
-.Fn extattr_get_file ,
-.Fn extattr_set_file ,
-and
-.Fn extattr_delete_file
-calls may also fail due to the following errors:
-.Bl -tag -width Er
-.It Bq Er ENOATTR
-The requested attribute was not defined for this file.
-.It Bq Er ENOTDIR
-A component of the path prefix is not a directory.
-.It Bq Er ENAMETOOLONG
-A component of a pathname exceeded 255 characters,
-or an entire path name exceeded 1023 characters.
-.It Bq Er ENOENT
-A component of the path name that must exist does not exist.
-.It Bq Er EACCES
-Search permission is denied for a component of the path prefix.
-.\" XXX are any missing?
-.El
-.Sh SEE ALSO
-.Xr extattr 3 ,
-.Xr getextattr 8 ,
-.Xr setextattr 8 ,
-.Xr extattr 9 ,
-.Xr VOP_GETEXTATTR 9 ,
-.Xr VOP_SETEXTATTR 9
-.Sh HISTORY
-Extended attribute support was developed as part of the
-.Tn TrustedBSD
-Project, and introduced in
-.Fx 5.0 .
-It was developed to support security extensions requiring additional labels
-to be associated with each file or directory.
-.Sh CAVEATS
-This interface is under active development, and as such is subject to
-change as applications are adapted to use it.
-Developers are discouraged from relying on its stability.
-.Sh BUGS
-In earlier versions of this API, passing an empty string for the
-attribute name to
-.Fn extattr_get_fd ,
-.Fn extattr_get_file ,
-or
-.Fn extattr_get_link
-would return the list of attributes defined for the target object.
-This interface has been deprecated in preference to using the explicit
-list API, and should not be used.
diff --git a/lib/libc/sys/fcntl.2 b/lib/libc/sys/fcntl.2
deleted file mode 100644
index 33ad7a5673e1..000000000000
--- a/lib/libc/sys/fcntl.2
+++ /dev/null
@@ -1,772 +0,0 @@
-.\" Copyright (c) 1983, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)fcntl.2 8.2 (Berkeley) 1/12/94
-.\" $FreeBSD$
-.\"
-.Dd January 6, 2021
-.Dt FCNTL 2
-.Os
-.Sh NAME
-.Nm fcntl
-.Nd file control
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In fcntl.h
-.Ft int
-.Fn fcntl "int fd" "int cmd" "..."
-.Sh DESCRIPTION
-The
-.Fn fcntl
-system call provides for control over descriptors.
-The argument
-.Fa fd
-is a descriptor to be operated on by
-.Fa cmd
-as described below.
-Depending on the value of
-.Fa cmd ,
-.Fn fcntl
-can take an additional third argument
-.Fa "int arg" .
-.Bl -tag -width F_DUP2FD_CLOEXEC
-.It Dv F_DUPFD
-Return a new descriptor as follows:
-.Pp
-.Bl -bullet -compact -offset 4n
-.It
-Lowest numbered available descriptor greater than or equal to
-.Fa arg .
-.It
-Same object references as the original descriptor.
-.It
-New descriptor shares the same file offset if the object
-was a file.
-.It
-Same access mode (read, write or read/write).
-.It
-Same file status flags (i.e., both file descriptors
-share the same file status flags).
-.It
-The close-on-exec flag
-.Dv FD_CLOEXEC
-associated with the new file descriptor is cleared, so the file descriptor is
-to remain open across
-.Xr execve 2
-system calls.
-.El
-.It Dv F_DUPFD_CLOEXEC
-Like
-.Dv F_DUPFD ,
-but the
-.Dv FD_CLOEXEC
-flag associated with the new file descriptor is set, so the file descriptor
-is closed when
-.Xr execve 2
-system call executes.
-.It Dv F_DUP2FD
-It is functionally equivalent to
-.Bd -literal -offset indent
-dup2(fd, arg)
-.Ed
-.It Dv F_DUP2FD_CLOEXEC
-Like
-.Dv F_DUP2FD ,
-but the
-.Dv FD_CLOEXEC
-flag associated with the new file descriptor is set.
-.Pp
-The
-.Dv F_DUP2FD
-and
-.Dv F_DUP2FD_CLOEXEC
-constants are not portable, so they should not be used if
-portability is needed.
-Use
-.Fn dup2
-instead of
-.Dv F_DUP2FD .
-.It Dv F_GETFD
-Get the close-on-exec flag associated with the file descriptor
-.Fa fd
-as
-.Dv FD_CLOEXEC .
-If the returned value ANDed with
-.Dv FD_CLOEXEC
-is 0,
-the file will remain open across
-.Fn exec ,
-otherwise the file will be closed upon execution of
-.Fn exec
-.Fa ( arg
-is ignored).
-.It Dv F_SETFD
-Set the close-on-exec flag associated with
-.Fa fd
-to
-.Fa arg ,
-where
-.Fa arg
-is either 0 or
-.Dv FD_CLOEXEC ,
-as described above.
-.It Dv F_GETFL
-Get descriptor status flags, as described below
-.Fa ( arg
-is ignored).
-.It Dv F_SETFL
-Set descriptor status flags to
-.Fa arg .
-.It Dv F_GETOWN
-Get the process ID or process group
-currently receiving
-.Dv SIGIO
-and
-.Dv SIGURG
-signals; process groups are returned
-as negative values
-.Fa ( arg
-is ignored).
-.It Dv F_SETOWN
-Set the process or process group
-to receive
-.Dv SIGIO
-and
-.Dv SIGURG
-signals;
-process groups are specified by supplying
-.Fa arg
-as negative, otherwise
-.Fa arg
-is interpreted as a process ID.
-.It Dv F_READAHEAD
-Set or clear the read ahead amount for sequential access to the third
-argument,
-.Fa arg ,
-which is rounded up to the nearest block size.
-A zero value in
-.Fa arg
-turns off read ahead, a negative value restores the system default.
-.It Dv F_RDAHEAD
-Equivalent to Darwin counterpart which sets read ahead amount of 128KB
-when the third argument,
-.Fa arg
-is non-zero.
-A zero value in
-.Fa arg
-turns off read ahead.
-.It Dv F_ADD_SEALS
-Add seals to the file as described below, if the underlying filesystem supports
-seals.
-.It Dv F_GET_SEALS
-Get seals associated with the file, if the underlying filesystem supports seals.
-.It Dv F_ISUNIONSTACK
-Check if the vnode is part of a union stack (either the "union" flag from
-.Xr mount 2
-or unionfs).
-This is a hack not intended to be used outside of libc.
-.El
-.Pp
-The flags for the
-.Dv F_GETFL
-and
-.Dv F_SETFL
-commands are as follows:
-.Bl -tag -width O_NONBLOCKX
-.It Dv O_NONBLOCK
-Non-blocking I/O; if no data is available to a
-.Xr read 2
-system call, or if a
-.Xr write 2
-operation would block,
-the read or write call returns -1 with the error
-.Er EAGAIN .
-.It Dv O_APPEND
-Force each write to append at the end of file;
-corresponds to the
-.Dv O_APPEND
-flag of
-.Xr open 2 .
-.It Dv O_DIRECT
-Minimize or eliminate the cache effects of reading and writing.
-The system
-will attempt to avoid caching the data you read or write.
-If it cannot
-avoid caching the data, it will minimize the impact the data has on the cache.
-Use of this flag can drastically reduce performance if not used with care.
-.It Dv O_ASYNC
-Enable the
-.Dv SIGIO
-signal to be sent to the process group
-when I/O is possible, e.g.,
-upon availability of data to be read.
-.It Dv O_SYNC
-Enable synchronous writes.
-Corresponds to the
-.Dv O_SYNC
-flag of
-.Xr open 2 .
-.Dv O_FSYNC
-is an historical synonym for
-.Dv O_SYNC .
-.It Dv O_DSYNC
-Enable synchronous data writes.
-Corresponds to the
-.Dv O_DSYNC
-flag of
-.Xr open 2 .
-.El
-.Pp
-The seals that may be applied with
-.Dv F_ADD_SEALS
-are as follows:
-.Bl -tag -width F_SEAL_SHRINK
-.It Dv F_SEAL_SEAL
-Prevent any further seals from being applied to the file.
-.It Dv F_SEAL_SHRINK
-Prevent the file from being shrunk with
-.Xr ftruncate 2 .
-.It Dv F_SEAL_GROW
-Prevent the file from being enlarged with
-.Xr ftruncate 2 .
-.It Dv F_SEAL_WRITE
-Prevent any further
-.Xr write 2
-calls to the file.
-Any writes in progress will finish before
-.Fn fcntl
-returns.
-If any writeable mappings exist, F_ADD_SEALS will fail and return
-.Dv EBUSY .
-.El
-.Pp
-Seals are on a per-inode basis and require support by the underlying filesystem.
-If the underlying filesystem does not support seals,
-.Dv F_ADD_SEALS
-and
-.Dv F_GET_SEALS
-will fail and return
-.Dv EINVAL .
-.Pp
-Several commands are available for doing advisory file locking;
-they all operate on the following structure:
-.Bd -literal
-struct flock {
- off_t l_start; /* starting offset */
- off_t l_len; /* len = 0 means until end of file */
- pid_t l_pid; /* lock owner */
- short l_type; /* lock type: read/write, etc. */
- short l_whence; /* type of l_start */
- int l_sysid; /* remote system id or zero for local */
-};
-.Ed
-The commands available for advisory record locking are as follows:
-.Bl -tag -width F_SETLKWX
-.It Dv F_GETLK
-Get the first lock that blocks the lock description pointed to by the
-third argument,
-.Fa arg ,
-taken as a pointer to a
-.Fa "struct flock"
-(see above).
-The information retrieved overwrites the information passed to
-.Fn fcntl
-in the
-.Fa flock
-structure.
-If no lock is found that would prevent this lock from being created,
-the structure is left unchanged by this system call except for the
-lock type which is set to
-.Dv F_UNLCK .
-.It Dv F_SETLK
-Set or clear a file segment lock according to the lock description
-pointed to by the third argument,
-.Fa arg ,
-taken as a pointer to a
-.Fa "struct flock"
-(see above).
-.Dv F_SETLK
-is used to establish shared (or read) locks
-.Pq Dv F_RDLCK
-or exclusive (or write) locks,
-.Pq Dv F_WRLCK ,
-as well as remove either type of lock
-.Pq Dv F_UNLCK .
-If a shared or exclusive lock cannot be set,
-.Fn fcntl
-returns immediately with
-.Er EAGAIN .
-.It Dv F_SETLKW
-This command is the same as
-.Dv F_SETLK
-except that if a shared or exclusive lock is blocked by other locks,
-the process waits until the request can be satisfied.
-If a signal that is to be caught is received while
-.Fn fcntl
-is waiting for a region, the
-.Fn fcntl
-will be interrupted if the signal handler has not specified the
-.Dv SA_RESTART
-(see
-.Xr sigaction 2 ) .
-.El
-.Pp
-When a shared lock has been set on a segment of a file,
-other processes can set shared locks on that segment
-or a portion of it.
-A shared lock prevents any other process from setting an exclusive
-lock on any portion of the protected area.
-A request for a shared lock fails if the file descriptor was not
-opened with read access.
-.Pp
-An exclusive lock prevents any other process from setting a shared lock or
-an exclusive lock on any portion of the protected area.
-A request for an exclusive lock fails if the file was not
-opened with write access.
-.Pp
-The value of
-.Fa l_whence
-is
-.Dv SEEK_SET ,
-.Dv SEEK_CUR ,
-or
-.Dv SEEK_END
-to indicate that the relative offset,
-.Fa l_start
-bytes, will be measured from the start of the file,
-current position, or end of the file, respectively.
-The value of
-.Fa l_len
-is the number of consecutive bytes to be locked.
-If
-.Fa l_len
-is negative,
-.Fa l_start
-means end edge of the region.
-The
-.Fa l_pid
-and
-.Fa l_sysid
-fields are only used with
-.Dv F_GETLK
-to return the process ID of the process holding a blocking lock and
-the system ID of the system that owns that process.
-Locks created by the local system will have a system ID of zero.
-After a successful
-.Dv F_GETLK
-request, the value of
-.Fa l_whence
-is
-.Dv SEEK_SET .
-.Pp
-Locks may start and extend beyond the current end of a file,
-but may not start or extend before the beginning of the file.
-A lock is set to extend to the largest possible value of the
-file offset for that file if
-.Fa l_len
-is set to zero.
-If
-.Fa l_whence
-and
-.Fa l_start
-point to the beginning of the file, and
-.Fa l_len
-is zero, the entire file is locked.
-If an application wishes only to do entire file locking, the
-.Xr flock 2
-system call is much more efficient.
-.Pp
-There is at most one type of lock set for each byte in the file.
-Before a successful return from an
-.Dv F_SETLK
-or an
-.Dv F_SETLKW
-request when the calling process has previously existing locks
-on bytes in the region specified by the request,
-the previous lock type for each byte in the specified
-region is replaced by the new lock type.
-As specified above under the descriptions
-of shared locks and exclusive locks, an
-.Dv F_SETLK
-or an
-.Dv F_SETLKW
-request fails or blocks respectively when another process has existing
-locks on bytes in the specified region and the type of any of those
-locks conflicts with the type specified in the request.
-.Pp
-The queuing for
-.Dv F_SETLKW
-requests on local files is fair;
-that is, while the thread is blocked,
-subsequent requests conflicting with its requests will not be granted,
-even if these requests do not conflict with existing locks.
-.Pp
-This interface follows the completely stupid semantics of System V and
-.St -p1003.1-88
-that require that all locks associated with a file for a given process are
-removed when
-.Em any
-file descriptor for that file is closed by that process.
-This semantic means that applications must be aware of any files that
-a subroutine library may access.
-For example if an application for updating the password file locks the
-password file database while making the update, and then calls
-.Xr getpwnam 3
-to retrieve a record,
-the lock will be lost because
-.Xr getpwnam 3
-opens, reads, and closes the password database.
-The database close will release all locks that the process has
-associated with the database, even if the library routine never
-requested a lock on the database.
-Another minor semantic problem with this interface is that
-locks are not inherited by a child process created using the
-.Xr fork 2
-system call.
-The
-.Xr flock 2
-interface has much more rational last close semantics and
-allows locks to be inherited by child processes.
-The
-.Xr flock 2
-system call is recommended for applications that want to ensure the integrity
-of their locks when using library routines or wish to pass locks
-to their children.
-.Pp
-The
-.Fn fcntl ,
-.Xr flock 2 ,
-and
-.Xr lockf 3
-locks are compatible.
-Processes using different locking interfaces can cooperate
-over the same file safely.
-However, only one of such interfaces should be used within
-the same process.
-If a file is locked by a process through
-.Xr flock 2 ,
-any record within the file will be seen as locked
-from the viewpoint of another process using
-.Fn fcntl
-or
-.Xr lockf 3 ,
-and vice versa.
-Note that
-.Fn fcntl F_GETLK
-returns \-1 in
-.Fa l_pid
-if the process holding a blocking lock previously locked the
-file descriptor by
-.Xr flock 2 .
-.Pp
-All locks associated with a file for a given process are
-removed when the process terminates.
-.Pp
-All locks obtained before a call to
-.Xr execve 2
-remain in effect until the new program releases them.
-If the new program does not know about the locks, they will not be
-released until the program exits.
-.Pp
-A potential for deadlock occurs if a process controlling a locked region
-is put to sleep by attempting to lock the locked region of another process.
-This implementation detects that sleeping until a locked region is unlocked
-would cause a deadlock and fails with an
-.Er EDEADLK
-error.
-.Sh RETURN VALUES
-Upon successful completion, the value returned depends on
-.Fa cmd
-as follows:
-.Bl -tag -width F_GETOWNX -offset indent
-.It Dv F_DUPFD
-A new file descriptor.
-.It Dv F_DUP2FD
-A file descriptor equal to
-.Fa arg .
-.It Dv F_GETFD
-Value of flag (only the low-order bit is defined).
-.It Dv F_GETFL
-Value of flags.
-.It Dv F_GETOWN
-Value of file descriptor owner.
-.It other
-Value other than -1.
-.El
-.Pp
-Otherwise, a value of -1 is returned and
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-The
-.Fn fcntl
-system call will fail if:
-.Bl -tag -width Er
-.It Bq Er EAGAIN
-The argument
-.Fa cmd
-is
-.Dv F_SETLK ,
-the type of lock
-.Pq Fa l_type
-is a shared lock
-.Pq Dv F_RDLCK
-or exclusive lock
-.Pq Dv F_WRLCK ,
-and the segment of a file to be locked is already
-exclusive-locked by another process;
-or the type is an exclusive lock and some portion of the
-segment of a file to be locked is already shared-locked or
-exclusive-locked by another process.
-.It Bq Er EBADF
-The
-.Fa fd
-argument
-is not a valid open file descriptor.
-.Pp
-The argument
-.Fa cmd
-is
-.Dv F_DUP2FD ,
-and
-.Fa arg
-is not a valid file descriptor.
-.Pp
-The argument
-.Fa cmd
-is
-.Dv F_SETLK
-or
-.Dv F_SETLKW ,
-the type of lock
-.Pq Fa l_type
-is a shared lock
-.Pq Dv F_RDLCK ,
-and
-.Fa fd
-is not a valid file descriptor open for reading.
-.Pp
-The argument
-.Fa cmd
-is
-.Dv F_SETLK
-or
-.Dv F_SETLKW ,
-the type of lock
-.Pq Fa l_type
-is an exclusive lock
-.Pq Dv F_WRLCK ,
-and
-.Fa fd
-is not a valid file descriptor open for writing.
-.It Bq Er EBUSY
-The argument
-.Fa cmd
-is
-.Dv F_ADD_SEALS ,
-attempting to set
-.Dv F_SEAL_WRITE ,
-and writeable mappings of the file exist.
-.It Bq Er EDEADLK
-The argument
-.Fa cmd
-is
-.Dv F_SETLKW ,
-and a deadlock condition was detected.
-.It Bq Er EINTR
-The argument
-.Fa cmd
-is
-.Dv F_SETLKW ,
-and the system call was interrupted by a signal.
-.It Bq Er EINVAL
-The
-.Fa cmd
-argument
-is
-.Dv F_DUPFD
-and
-.Fa arg
-is negative or greater than the maximum allowable number
-(see
-.Xr getdtablesize 2 ) .
-.Pp
-The argument
-.Fa cmd
-is
-.Dv F_GETLK ,
-.Dv F_SETLK
-or
-.Dv F_SETLKW
-and the data to which
-.Fa arg
-points is not valid.
-.Pp
-The argument
-.Fa cmd
-is
-.Dv F_ADD_SEALS
-or
-.Dv F_GET_SEALS ,
-and the underlying filesystem does not support sealing.
-.Pp
-The argument
-.Fa cmd
-is invalid.
-.It Bq Er EMFILE
-The argument
-.Fa cmd
-is
-.Dv F_DUPFD
-and the maximum number of file descriptors permitted for the
-process are already in use,
-or no file descriptors greater than or equal to
-.Fa arg
-are available.
-.It Bq Er ENOTTY
-The
-.Fa fd
-argument is not a valid file descriptor for the requested operation.
-This may be the case if
-.Fa fd
-is a device node, or a descriptor returned by
-.Xr kqueue 2 .
-.It Bq Er ENOLCK
-The argument
-.Fa cmd
-is
-.Dv F_SETLK
-or
-.Dv F_SETLKW ,
-and satisfying the lock or unlock request would result in the
-number of locked regions in the system exceeding a system-imposed limit.
-.It Bq Er EOPNOTSUPP
-The argument
-.Fa cmd
-is
-.Dv F_GETLK ,
-.Dv F_SETLK
-or
-.Dv F_SETLKW
-and
-.Fa fd
-refers to a file for which locking is not supported.
-.It Bq Er EOVERFLOW
-The argument
-.Fa cmd
-is
-.Dv F_GETLK ,
-.Dv F_SETLK
-or
-.Dv F_SETLKW
-and an
-.Fa off_t
-calculation overflowed.
-.It Bq Er EPERM
-The
-.Fa cmd
-argument
-is
-.Dv F_SETOWN
-and
-the process ID or process group given as an argument is in a
-different session than the caller.
-.Pp
-The
-.Fa cmd
-argument
-is
-.Dv F_ADD_SEALS
-and the
-.Dv F_SEAL_SEAL
-seal has already been set.
-.It Bq Er ESRCH
-The
-.Fa cmd
-argument
-is
-.Dv F_SETOWN
-and
-the process ID given as argument is not in use.
-.El
-.Pp
-In addition, if
-.Fa fd
-refers to a descriptor open on a terminal device (as opposed to a
-descriptor open on a socket), a
-.Fa cmd
-of
-.Dv F_SETOWN
-can fail for the same reasons as in
-.Xr tcsetpgrp 3 ,
-and a
-.Fa cmd
-of
-.Dv F_GETOWN
-for the reasons as stated in
-.Xr tcgetpgrp 3 .
-.Sh SEE ALSO
-.Xr close 2 ,
-.Xr dup2 2 ,
-.Xr execve 2 ,
-.Xr flock 2 ,
-.Xr getdtablesize 2 ,
-.Xr open 2 ,
-.Xr sigaction 2 ,
-.Xr lockf 3 ,
-.Xr tcgetpgrp 3 ,
-.Xr tcsetpgrp 3
-.Sh STANDARDS
-The
-.Dv F_DUP2FD
-constant is non portable.
-It is provided for compatibility with AIX and Solaris.
-.Pp
-Per
-.St -susv4 ,
-a call with
-.Dv F_SETLKW
-should fail with
-.Bq Er EINTR
-after any caught signal
-and should continue waiting during thread suspension such as a stop signal.
-However, in this implementation a call with
-.Dv F_SETLKW
-is restarted after catching a signal with a
-.Dv SA_RESTART
-handler or a thread suspension such as a stop signal.
-.Sh HISTORY
-The
-.Fn fcntl
-system call appeared in
-.Bx 4.2 .
-.Pp
-The
-.Dv F_DUP2FD
-constant first appeared in
-.Fx 7.1 .
diff --git a/lib/libc/sys/fcntl.c b/lib/libc/sys/fcntl.c
index f61cf426cc30..fc225fdeb379 100644
--- a/lib/libc/sys/fcntl.c
+++ b/lib/libc/sys/fcntl.c
@@ -1,12 +1,11 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2008 Isilon Inc http://www.isilon.com/
* Authors: Doug Rabson <dfr@rabson.org>
* Developed with Red Inc: Alfred Perlstein <alfred@freebsd.org>
*
* Copyright (c) 2014-2015 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -33,9 +32,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <fcntl.h>
#include <stdarg.h>
#include <sys/types.h>
@@ -53,6 +49,5 @@ fcntl(int fd, int cmd, ...)
arg = va_arg(args, long);
va_end(args);
- return (((int (*)(int, int, ...))
- __libc_interposing[INTERPOS_fcntl])(fd, cmd, arg));
+ return (INTERPOS_SYS(fcntl, fd, cmd, arg));
}
diff --git a/lib/libc/sys/fdatasync.c b/lib/libc/sys/fdatasync.c
index fed97913d31e..15cef821dc1e 100644
--- a/lib/libc/sys/fdatasync.c
+++ b/lib/libc/sys/fdatasync.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2016 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/fcntl.h>
#include <unistd.h>
@@ -41,6 +37,5 @@ __FBSDID("$FreeBSD$");
int
fdatasync(int fd)
{
-
- return (((int (*)(int))__libc_interposing[INTERPOS_fdatasync])(fd));
+ return (INTERPOS_SYS(fdatasync, fd));
}
diff --git a/lib/libc/sys/ffclock.2 b/lib/libc/sys/ffclock.2
deleted file mode 100644
index 78fed527b148..000000000000
--- a/lib/libc/sys/ffclock.2
+++ /dev/null
@@ -1,177 +0,0 @@
-.\" Copyright (c) 2011 The University of Melbourne
-.\" All rights reserved.
-.\"
-.\" This documentation was written by Julien Ridoux at the University of
-.\" Melbourne under sponsorship from the FreeBSD Foundation.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd November 21, 2011
-.Dt FFCLOCK 2
-.Os
-.Sh NAME
-.Nm ffclock_getcounter ,
-.Nm ffclock_getestimate ,
-.Nm ffclock_setestimate
-.Nd Retrieve feed-forward counter, get and set feed-forward clock estimates
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/timeffc.h
-.Ft int
-.Fn ffclock_getcounter "ffcounter *ffcount"
-.Ft int
-.Fn ffclock_getestimate "struct ffclock_estimate *cest"
-.Ft int
-.Fn ffclock_setestimate "struct ffclock_estimate *cest"
-.Sh DESCRIPTION
-The ffclock is an alternative method to synchronise the system clock.
-The ffclock implements a feed-forward paradigm and decouples the timestamping
-and timekeeping kernel functions.
-This ensures that past clock errors do not affect current timekeeping, an
-approach radically different from the feedback alternative implemented by the
-ntpd daemon when adjusting the system clock.
-The feed-forward approach has demonstrated better performance and higher
-robustness than a feedback approach when synchronising over the network.
-.Pp
-In the feed-forward context, a
-.Em timestamp
-is a cumulative value of the ticks of the timecounter, which can be converted
-into seconds by using the feed-forward
-.Em clock estimates .
-.Pp
-The
-.Fn ffclock_getcounter
-system call allows the calling process to retrieve the current value of the
-feed-forward counter maintained by the kernel.
-.Pp
-The
-.Fn ffclock_getestimate
-and
-.Fn ffclock_setestimate
-system calls allow the caller to get and set the kernel's feed-forward clock
-parameter estimates respectively.
-The
-.Fn ffclock_setestimate
-system call should be invoked by a single instance of a feed-forward
-synchronisation daemon.
-The
-.Fn ffclock_getestimate
-system call can be called by any process to retrieve the feed-forward clock
-estimates.
-.Pp
-The feed-forward approach does not require that the clock estimates be retrieved
-every time a timestamp is to be converted into seconds.
-The number of system calls can therefore be greatly reduced if the calling
-process retrieves the clock estimates from the clock synchronisation daemon
-instead.
-The
-.Fn ffclock_getestimate
-must be used when the feed-forward synchronisation daemon is not running
-.Po see
-.Sx USAGE
-below
-.Pc .
-.Pp
-The clock parameter estimates structure pointed to by
-.Fa cest
-is defined in
-.In sys/timeffc.h
-as:
-.Bd -literal
-struct ffclock_estimate {
- struct bintime update_time; /* Time of last estimates update. */
- ffcounter update_ffcount; /* Counter value at last update. */
- ffcounter leapsec_next; /* Counter value of next leap second. */
- uint64_t period; /* Estimate of counter period. */
- uint32_t errb_abs; /* Bound on absolute clock error [ns]. */
- uint32_t errb_rate; /* Bound on counter rate error [ps/s]. */
- uint32_t status; /* Clock status. */
- int16_t leapsec_total; /* All leap seconds seen so far. */
- int8_t leapsec; /* Next leap second (in {-1,0,1}). */
-};
-.Ed
-.Pp
-Only the super-user may set the feed-forward clock estimates.
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-The following error codes may be set in
-.Va errno :
-.Bl -tag -width Er
-.It Bq Er EFAULT
-The
-.Fa ffcount
-or
-.Fa cest
-pointer referenced invalid memory.
-.It Bq Er EPERM
-A user other than the super-user attempted to set the feed-forward clock
-parameter estimates.
-.El
-.Sh USAGE
-The feed-forward paradigm enables the definition of specialised clock functions.
-.Pp
-In its simplest form,
-.Fn ffclock_getcounter
-can be used to establish strict order between events or to measure small time
-intervals very accurately with a minimum performance cost.
-.Pp
-Different methods exist to access absolute time
-.Po or
-.Qq wall-clock time
-.Pc tracked by the ffclock.
-The simplest method uses the ffclock sysctl interface
-.Va kern.ffclock
-to make the system clock return the ffclock time.
-The
-.Xr clock_gettime 2
-system call can then be used to retrieve the current time seen by the
-feed-forward clock.
-Note that this setting affects the entire system and that a feed-forward
-synchronisation daemon should be running.
-.Pp
-A less automated method consists of retrieving the feed-forward counter
-timestamp from the kernel and using the feed-forward clock parameter estimates
-to convert the timestamp into seconds.
-The feed-forward clock parameter estimates can be retrieved from the kernel or
-from the synchronisation daemon directly (preferred).
-This method allows converting timestamps using different clock models as needed
-by the application, while collecting meaningful upper bounds on current clock
-error.
-.Sh SEE ALSO
-.Xr date 1 ,
-.Xr adjtime 2 ,
-.Xr clock_gettime 2 ,
-.Xr ctime 3
-.Sh HISTORY
-Feed-forward clock support first appeared in
-.Fx 10.0 .
-.Sh AUTHORS
-.An -nosplit
-The feed-forward clock support was written by
-.An Julien Ridoux Aq Mt jridoux@unimelb.edu.au
-in collaboration with
-.An Darryl Veitch Aq Mt dveitch@unimelb.edu.au
-at the University of Melbourne under sponsorship from the FreeBSD Foundation.
diff --git a/lib/libc/sys/fhlink.2 b/lib/libc/sys/fhlink.2
deleted file mode 100644
index 029ec8d7c2eb..000000000000
--- a/lib/libc/sys/fhlink.2
+++ /dev/null
@@ -1,250 +0,0 @@
-.\" SPDX-License-Identifier: BSD-2-Clause
-.\"
-.\" Copyright (c) 2018 Gandi
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd February 23, 2021
-.Dt FHLINK 2
-.Os
-.Sh NAME
-.Nm fhlink ,
-.Nm fhlinkat
-.Nd make a hard file link
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn fhlink "fhandle_t *fhp" "const char *to"
-.Ft int
-.Fn fhlinkat "fhandle_t *fhp" "int tofd" "const char *to"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn fhlink
-system call
-atomically creates the specified directory entry (hard link)
-.Fa to
-with the attributes of the underlying object pointed at by
-.Fa fhp .
-If the link is successful: the link count of the underlying object
-is incremented;
-.Fa fhp
-and
-.Fa to
-share equal access and rights
-to the
-underlying object.
-.Pp
-If
-.Fa fhp
-is removed, the file
-.Fa to
-is not deleted and the link count of the
-underlying object is
-decremented.
-.Pp
-The object pointed at by the
-.Fa fhp
-argument
-must exist for the hard link to
-succeed and
-both
-.Fa fhp
-and
-.Fa to
-must be in the same file system.
-The
-.Fa fhp
-argument
-may not be a directory.
-.Pp
-The
-.Fn fhlinkat
-system call is equivalent to
-.Fa fhlink
-except in the case where
-.Fa to
-is a relative paths.
-In this case a relative path
-.Fa to
-is interpreted relative to
-the directory associated with the file descriptor
-.Fa tofd
-instead of the current working directory.
-.Pp
-If
-.Fn fhlinkat
-is passed the special value
-.Dv AT_FDCWD
-in the
-.Fa tofd
-parameter, the current working directory is used for the
-.Fa to
-argument.
-If
-.Fa tofd
-has value
-.Dv AT_FDCWD ,
-the behavior is identical to a call to
-.Fn link .
-Unless
-.Fa flag
-contains the
-.Dv AT_SYMLINK_FOLLOW
-flag, if
-.Fa fhp
-names a symbolic link, a new link is created for the symbolic link
-.Fa fhp
-and not its target.
-.Sh RETURN VALUES
-.Rv -std link
-.Sh ERRORS
-The
-.Fn fhlink
-system call
-will fail and no link will be created if:
-.Bl -tag -width Er
-.It Bq Er ENOTDIR
-A component of
-.Fa to
-prefix is not a directory.
-.It Bq Er ENAMETOOLONG
-A component of
-.Fa to
-exceeded 255 characters,
-or entire length of
-.Fa to
-name exceeded 1023 characters.
-.It Bq Er ENOENT
-A component of
-.Fa to
-prefix does not exist.
-.It Bq Er EOPNOTSUPP
-The file system containing the file pointed at by
-.Fa fhp
-does not support links.
-.It Bq Er EMLINK
-The link count of the file pointed at by
-.Fa fhp
-would exceed 32767.
-.It Bq Er EACCES
-A component of
-.Fa to
-prefix denies search permission.
-.It Bq Er EACCES
-The requested link requires writing in a directory with a mode
-that denies write permission.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating one of the pathnames.
-.It Bq Er ENOENT
-The file pointed at by
-.Fa fhp
-does not exist.
-.It Bq Er EEXIST
-The link named by
-.Fa to
-does exist.
-.It Bq Er EPERM
-The file pointed at by
-.Fa fhp
-is a directory.
-.It Bq Er EPERM
-The file pointed at by
-.Fa fhp
-has its immutable or append-only flag set, see the
-.Xr chflags 2
-manual page for more information.
-.It Bq Er EPERM
-The parent directory of the file named by
-.Fa to
-has its immutable flag set.
-.It Bq Er EXDEV
-The link named by
-.Fa to
-and the file pointed at by
-.Fa fhp
-are on different file systems.
-.It Bq Er ENOSPC
-The directory in which the entry for the new link is being placed
-cannot be extended because there is no space left on the file
-system containing the directory.
-.It Bq Er EDQUOT
-The directory in which the entry for the new link
-is being placed cannot be extended because the
-user's quota of disk blocks on the file system
-containing the directory has been exhausted.
-.It Bq Er EIO
-An I/O error occurred while reading from or writing to
-the file system to make the directory entry.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.It Bq Er EROFS
-The requested link requires writing in a directory on a read-only file
-system.
-.It Bq Er EFAULT
-One of the pathnames specified
-is outside the process's allocated address space.
-.It Bq Er ESTALE
-The file handle
-.Fa fhp
-is no longer valid
-.El
-.Pp
-In addition to the errors returned by the
-.Fn fhlink ,
-the
-.Fn fhlinkat
-system call may fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa fhp
-or
-.Fa to
-argument does not specify an absolute path and the
-.Fa tofd
-argument, is not
-.Dv AT_FDCWD
-nor a valid file descriptor open for searching.
-.It Bq Er EINVAL
-The value of the
-.Fa flag
-argument is not valid.
-.It Bq Er ENOTDIR
-The
-.Fa fhp
-or
-.Fa to
-argument is not an absolute path and
-.Fa tofd
-is not
-.Dv AT_FDCWD
-nor a file descriptor associated with a directory.
-.El
-.Sh SEE ALSO
-.Xr fhopen 2 ,
-.Xr fhreadlink 2 ,
-.Xr fhstat 2
diff --git a/lib/libc/sys/fhopen.2 b/lib/libc/sys/fhopen.2
deleted file mode 100644
index 2a609c1c2cd2..000000000000
--- a/lib/libc/sys/fhopen.2
+++ /dev/null
@@ -1,147 +0,0 @@
-.\" $NetBSD: fhopen.2,v 1.1 1999/06/30 01:32:15 wrstuden Exp $
-.\"
-.\" Copyright (c) 1999 National Aeronautics & Space Administration
-.\" All rights reserved.
-.\"
-.\" This software was written by William Studenmund of the
-.\" Numerical Aerospace Simulation Facility, NASA Ames Research Center.
-.\"
-.\" 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.
-.\" 3. Neither the name of the National Aeronautics & Space Administration
-.\" nor the names of its contributors may be used to endorse or promote
-.\" products derived from this software without specific prior written
-.\" permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE NATIONAL AERONAUTICS & SPACE ADMINISTRATION
-.\" ``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 ADMINISTRATION OR CONTRIB-
-.\" UTORS 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd June 29, 1999
-.Dt FHOPEN 2
-.Os
-.Sh NAME
-.Nm fhopen ,
-.Nm fhstat ,
-.Nm fhstatfs
-.Nd access file via file handle
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/param.h
-.In sys/mount.h
-.In sys/stat.h
-.Ft int
-.Fn fhopen "const fhandle_t *fhp" "int flags"
-.Ft int
-.Fn fhstat "const fhandle_t *fhp" "struct stat *sb"
-.Ft int
-.Fn fhstatfs "const fhandle_t *fhp" "struct statfs *buf"
-.Sh DESCRIPTION
-These system calls provide a means to access a file given the file handle
-.Fa fhp .
-As this method bypasses directory access restrictions, these calls are
-restricted to the superuser.
-.Pp
-The
-.Fn fhopen
-system call
-opens the file referenced by
-.Fa fhp
-for reading and/or writing as specified by the argument
-.Fa flags
-and returns the file descriptor to the calling process.
-The
-.Fa flags
-argument
-is specified by
-.Em or Ns 'ing
-together the flags used for the
-.Xr open 2
-system call.
-All said flags are valid except for
-.Dv O_CREAT .
-.Pp
-The
-.Fn fhstat
-and
-.Fn fhstatfs
-system calls
-provide the functionality of the
-.Xr fstat 2
-and
-.Xr fstatfs 2
-calls except that they return information for the file referred to by
-.Fa fhp
-rather than an open file.
-.Sh RETURN VALUES
-Upon successful completion,
-.Fn fhopen
-returns the file descriptor for the opened file;
-otherwise the value \-1 is returned and the global variable
-.Va errno
-is set to indicate the error.
-.Pp
-.Rv -std fhstat fhstatfs
-.Sh ERRORS
-In addition to the errors returned by
-.Xr open 2 ,
-.Xr fstat 2 ,
-and
-.Xr fstatfs 2
-respectively,
-.Fn fhopen ,
-.Fn fhstat ,
-and
-.Fn fhstatfs
-will return
-.Bl -tag -width Er
-.It Bq Er EINVAL
-Calling
-.Fn fhopen
-with
-.Dv O_CREAT
-set.
-.It Bq Er ESTALE
-The file handle
-.Fa fhp
-is no longer valid.
-.El
-.Sh SEE ALSO
-.Xr fstat 2 ,
-.Xr fstatfs 2 ,
-.Xr getfh 2 ,
-.Xr open 2
-.Sh HISTORY
-The
-.Fn fhopen ,
-.Fn fhstat ,
-and
-.Fn fhstatfs
-system calls first appeared in
-.Nx 1.5
-and were adapted to
-.Fx 4.0
-by
-.An Alfred Perlstein .
-.Sh AUTHORS
-This manual page was written by
-.An William Studenmund
-for
-.Nx .
diff --git a/lib/libc/sys/fhreadlink.2 b/lib/libc/sys/fhreadlink.2
deleted file mode 100644
index 2837fd593d84..000000000000
--- a/lib/libc/sys/fhreadlink.2
+++ /dev/null
@@ -1,94 +0,0 @@
-.\" SPDX-License-Identifier: BSD-2-Clause
-.\"
-.\" Copyright (c) 2018 Gandi
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2020
-.Dt FHREADLINK 2
-.Os
-.Sh NAME
-.Nm fhreadlink
-.Nd read value of a symbolic link
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/param.h
-.In sys/mount.h
-.Ft int
-.Fn fhreadlink "fhandle_t *fhp" "char *buf" "size_t bufsize"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn fhreadlink
-system call
-places the contents of the symbolic link
-.Fa fhp
-in the buffer
-.Fa buf ,
-which has size
-.Fa bufsiz .
-The
-.Fn fhreadlink
-system call does not append a
-.Dv NUL
-character to
-.Fa buf .
-.Pp
-.Sh RETURN VALUES
-The call returns the count of characters placed in the buffer
-if it succeeds, or a \-1 if an error occurs, placing the error
-code in the global variable
-.Va errno .
-.Sh ERRORS
-The
-.Fn readlink
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er ENOENT
-The named file does not exist.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating the file handle
-.Fa fhp .
-.It Bq Er EINVAL
-The named file is not a symbolic link.
-.It Bq Er EIO
-An I/O error occurred while reading from the file system.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.It Bq Er EFAULT
-The
-.Fa buf
-argument
-extends outside the process's allocated address space.
-.It Bq Er ESTALE
-The file handle
-.Fa fhp
-is no longer valid
-.El
-.El
-.Sh SEE ALSO
-.Xr fhstat 2 ,
-.Xr fhlink 2 ,
diff --git a/lib/libc/sys/flock.2 b/lib/libc/sys/flock.2
deleted file mode 100644
index a13320895f40..000000000000
--- a/lib/libc/sys/flock.2
+++ /dev/null
@@ -1,173 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)flock.2 8.2 (Berkeley) 12/11/93
-.\" $FreeBSD$
-.\"
-.Dd November 9, 2011
-.Dt FLOCK 2
-.Os
-.Sh NAME
-.Nm flock
-.Nd "apply or remove an advisory lock on an open file"
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/file.h
-.Fd "#define LOCK_SH 0x01 /* shared file lock */"
-.Fd "#define LOCK_EX 0x02 /* exclusive file lock */"
-.Fd "#define LOCK_NB 0x04 /* do not block when locking */"
-.Fd "#define LOCK_UN 0x08 /* unlock file */"
-.Ft int
-.Fn flock "int fd" "int operation"
-.Sh DESCRIPTION
-The
-.Fn flock
-system call applies or removes an
-.Em advisory
-lock on the file associated with the file descriptor
-.Fa fd .
-A lock is applied by specifying an
-.Fa operation
-argument that is one of
-.Dv LOCK_SH
-or
-.Dv LOCK_EX
-with the optional addition of
-.Dv LOCK_NB .
-To unlock
-an existing lock
-.Dv operation
-should be
-.Dv LOCK_UN .
-.Pp
-Advisory locks allow cooperating processes to perform
-consistent operations on files, but do not guarantee
-consistency (i.e., processes may still access files
-without using advisory locks possibly resulting in
-inconsistencies).
-.Pp
-The locking mechanism allows two types of locks:
-.Em shared
-locks and
-.Em exclusive
-locks.
-At any time multiple shared locks may be applied to a file,
-but at no time are multiple exclusive, or both shared and exclusive,
-locks allowed simultaneously on a file.
-.Pp
-A shared lock may be
-.Em upgraded
-to an exclusive lock, and vice versa, simply by specifying
-the appropriate lock type; this results in the previous
-lock being released and the new lock applied (possibly
-after other processes have gained and released the lock).
-.Pp
-Requesting a lock on an object that is already locked
-normally causes the caller to be blocked until the lock may be
-acquired.
-If
-.Dv LOCK_NB
-is included in
-.Fa operation ,
-then this will not happen; instead the call will fail and
-the error
-.Er EWOULDBLOCK
-will be returned.
-.Sh NOTES
-Locks are on files, not file descriptors.
-That is, file descriptors
-duplicated through
-.Xr dup 2
-or
-.Xr fork 2
-do not result in multiple instances of a lock, but rather multiple
-references to a single lock.
-If a process holding a lock on a file
-forks and the child explicitly unlocks the file, the parent will
-lose its lock.
-.Pp
-The
-.Fn flock ,
-.Xr fcntl 2 ,
-and
-.Xr lockf 3
-locks are compatible.
-Processes using different locking interfaces can cooperate
-over the same file safely.
-However, only one of such interfaces should be used within
-the same process.
-If a file is locked by a process through
-.Fn flock ,
-any record within the file will be seen as locked
-from the viewpoint of another process using
-.Xr fcntl 2
-or
-.Xr lockf 3 ,
-and vice versa.
-.Pp
-Processes blocked awaiting a lock may be awakened by signals.
-.Sh RETURN VALUES
-.Rv -std flock
-.Sh ERRORS
-The
-.Fn flock
-system call fails if:
-.Bl -tag -width Er
-.It Bq Er EWOULDBLOCK
-The file is locked and the
-.Dv LOCK_NB
-option was specified.
-.It Bq Er EBADF
-The argument
-.Fa fd
-is an invalid descriptor.
-.It Bq Er EINVAL
-The argument
-.Fa fd
-refers to an object other than a file.
-.It Bq Er EOPNOTSUPP
-The argument
-.Fa fd
-refers to an object that does not support file locking.
-.It Bq Er ENOLCK
-A lock was requested, but no locks are available.
-.El
-.Sh SEE ALSO
-.Xr close 2 ,
-.Xr dup 2 ,
-.Xr execve 2 ,
-.Xr fcntl 2 ,
-.Xr fork 2 ,
-.Xr open 2 ,
-.Xr flopen 3 ,
-.Xr lockf 3
-.Sh HISTORY
-The
-.Fn flock
-system call appeared in
-.Bx 4.2 .
diff --git a/lib/libc/sys/fork.2 b/lib/libc/sys/fork.2
deleted file mode 100644
index dbde8f5275aa..000000000000
--- a/lib/libc/sys/fork.2
+++ /dev/null
@@ -1,271 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)fork.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd August 5, 2021
-.Dt FORK 2
-.Os
-.Sh NAME
-.Nm fork
-.Nd create a new process
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft pid_t
-.Fn fork void
-.Ft pid_t
-.Fn _Fork void
-.Sh DESCRIPTION
-The
-.Fn fork
-function causes creation of a new process.
-The new process (child process) is an exact copy of the
-calling process (parent process) except for the following:
-.Bl -bullet -offset indent
-.It
-The child process has a unique process ID.
-.It
-The child process has a different parent
-process ID (i.e., the process ID of the parent process).
-.It
-The child process has its own copy of the parent's descriptors,
-except for descriptors returned by
-.Xr kqueue 2 ,
-which are not inherited from the parent process.
-These descriptors reference the same underlying objects, so that,
-for instance, file pointers in file objects are shared between
-the child and the parent, so that an
-.Xr lseek 2
-on a descriptor in the child process can affect a subsequent
-.Xr read 2
-or
-.Xr write 2
-by the parent.
-This descriptor copying is also used by the shell to
-establish standard input and output for newly created processes
-as well as to set up pipes.
-.It
-The child process' resource utilizations
-are set to 0; see
-.Xr setrlimit 2 .
-.It
-All interval timers are cleared; see
-.Xr setitimer 2 .
-.It
-The robust mutexes list (see
-.Xr pthread_mutexattr_setrobust 3 )
-is cleared for the child.
-.It
-The atfork handlers established with the
-.Xr pthread_atfork 3
-function are called as appropriate before fork in the parent process,
-and after the child is created, in parent and child.
-.It
-The child process has only one thread,
-corresponding to the calling thread in the parent process.
-If the process has more than one thread,
-locks and other resources held by the other threads are not released
-and therefore only async-signal-safe functions
-(see
-.Xr sigaction 2 )
-are guaranteed to work in the child process until a call to
-.Xr execve 2
-or a similar function.
-The
-.Fx
-implementation of
-.Fn fork
-provides a usable
-.Xr malloc 3 ,
-and
-.Xr rtld 1
-services in the child process.
-.El
-.Pp
-The
-.Fn fork
-function is not async-signal safe and creates a cancellation point
-in the parent process.
-It cannot be safely used from signal handlers, and the atfork handlers
-established by
-.Xr pthread_atfork 3
-do not need to be async-signal safe either.
-.Pp
-The
-.Fn _Fork
-function creates a new process, similarly to
-.Fn fork ,
-but it is async-signal safe.
-.Fn _Fork
-does not call atfork handlers, and does not create a cancellation point.
-It can be used safely from signal handlers, but then no userspace
-services (
-.Xr malloc 3
-or
-.Xr rtld 1 )
-are available in the child if forked from multi-threaded parent.
-In particular, if using dynamic linking, all dynamic symbols used by the
-child after
-.Fn _Fork
-must be pre-resolved.
-Note: resolving can be done globally by specifying the
-.Ev LD_BIND_NOW
-environment variable to the dynamic linker, or per-binary by passing the
-.Fl z Ar now
-option to the static linker
-.Xr ld 1 ,
-or by using each symbol before the
-.Fn _Fork
-call to force the binding.
-.Sh RETURN VALUES
-Upon successful completion,
-.Fn fork
-and
-.Fn _Fork
-return a value
-of 0 to the child process and return the process ID of the child
-process to the parent process.
-Otherwise, a value of -1 is returned
-to the parent process, no child process is created, and the global
-variable
-.Va errno
-is set to indicate the error.
-.Sh EXAMPLES
-The following example shows a common pattern of how
-.Fn fork
-is used in practice.
-.Bd -literal -offset indent
-#include <err.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-int
-main(void)
-{
- pid_t pid;
-
- /*
- * If child is expected to use stdio(3), state of
- * the reused io streams must be synchronized between
- * parent and child, to avoid double output and other
- * possible issues.
- */
- fflush(stdout);
-
- switch (pid = fork()) {
- case -1:
- err(1, "Failed to fork");
- case 0:
- printf("Hello from child process!\en");
-
- /*
- * Since we wrote into stdout, child needs to use
- * exit(3) and not _exit(2). This causes handlers
- * registered with atexit(3) to be called twice,
- * once in parent, and once in the child. If such
- * behavior is undesirable, consider
- * terminating child with _exit(2) or _Exit(3).
- */
- exit(0);
- default:
- break;
- }
-
- printf("Hello from parent process (child's PID: %d)!\en", pid);
-
- return (0);
-}
-.Ed
-.Pp
-The output of such a program is along the lines of:
-.Bd -literal -offset indent
-Hello from parent process (child's PID: 27804)!
-Hello from child process!
-.Ed
-.Sh ERRORS
-The
-.Fn fork
-system call will fail and no child process will be created if:
-.Bl -tag -width Er
-.It Bq Er EAGAIN
-The system-imposed limit on the total
-number of processes under execution would be exceeded.
-The limit is given by the
-.Xr sysctl 3
-MIB variable
-.Dv KERN_MAXPROC .
-(The limit is actually ten less than this
-except for the super user).
-.It Bq Er EAGAIN
-The user is not the super user, and
-the system-imposed limit
-on the total number of
-processes under execution by a single user would be exceeded.
-The limit is given by the
-.Xr sysctl 3
-MIB variable
-.Dv KERN_MAXPROCPERUID .
-.It Bq Er EAGAIN
-The user is not the super user, and
-the soft resource limit corresponding to the
-.Fa resource
-argument
-.Dv RLIMIT_NPROC
-would be exceeded (see
-.Xr getrlimit 2 ) .
-.It Bq Er ENOMEM
-There is insufficient swap space for the new process.
-.El
-.Sh SEE ALSO
-.Xr execve 2 ,
-.Xr rfork 2 ,
-.Xr setitimer 2 ,
-.Xr setrlimit 2 ,
-.Xr sigaction 2 ,
-.Xr vfork 2 ,
-.Xr wait 2 ,
-.Xr pthread_atfork 3
-.Sh HISTORY
-The
-.Fn fork
-function appeared in
-.At v1 .
-.Pp
-The
-.Fn _Fork
-function was defined by Austin Group together with the removal
-of a requirement that the
-.Fn fork
-implementation must be async-signal safe.
-The
-.Fn _Fork
-function appeared in
-.Fx 14.0 .
diff --git a/lib/libc/sys/fork.c b/lib/libc/sys/fork.c
index 695540a7264f..e907c51b5cee 100644
--- a/lib/libc/sys/fork.c
+++ b/lib/libc/sys/fork.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2014 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <unistd.h>
#include "libc_private.h"
@@ -43,6 +39,5 @@ __weak_reference(__sys_fork, __fork);
pid_t
fork(void)
{
-
- return (((pid_t (*)(void))__libc_interposing[INTERPOS_fork])());
+ return (INTERPOS_SYS(fork));
}
diff --git a/lib/libc/sys/fspacectl.2 b/lib/libc/sys/fspacectl.2
deleted file mode 100644
index 430f3de950df..000000000000
--- a/lib/libc/sys/fspacectl.2
+++ /dev/null
@@ -1,205 +0,0 @@
-.\"
-.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD
-.\"
-.\" Copyright (c) 2021 The FreeBSD Foundation
-.\"
-.\" This manual page was written by Ka Ho Ng under sponsorship from
-.\" the FreeBSD Foundation.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.Dd August 25, 2021
-.Dt FSPACECTL 2
-.Os
-.Sh NAME
-.Nm fspacectl
-.Nd space management in a file
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In fcntl.h
-.Ft int
-.Fo fspacectl
-.Fa "int fd"
-.Fa "int cmd"
-.Fa "const struct spacectl_range *rqsr"
-.Fa "int flags"
-.Fa "struct spacectl_range *rmsr"
-.Fc
-.Sh DESCRIPTION
-.Nm
-is a system call performing space management over a file.
-The
-.Fa fd
-argument specifies the file descriptor to be operated on by the
-.Fa cmd
-argument.
-The
-.Fa rqsr
-argument points to a
-.Fa spacectl_range
-structure that contains the requested operation range.
-The
-.Fa flags
-argument controls the behavior of the operation to take place.
-If the
-.Fa rmsr
-argument is non-NULL, the
-.Fa spacectl_range
-structure it points to is updated to contain the unprocessed operation range
-after the system call returns.
-.Pp
-For a successful completion without an unprocessed part in the requested
-operation range,
-.Fa "rmsr->r_len"
-is updated to be the value 0, and
-.Fa "rmsr->r_offset"
-is updated to be
-.Fa "rqsr->r_offset"
-plus the number of bytes zeroed before the end-of-file.
-The file descriptor's file offset is not used or modified by the system call.
-Both
-.Fa rqsr
-and
-.Fa rmsr
-arguments can point to the same structure.
-.Pp
-The
-.Fa spacectl_range
-structure is defined as:
-.Bd -literal
-struct spacectl_range {
- off_t r_offset;
- off_t r_len;
-};
-.Ed
-.Pp
-The operation specified by the
-.Fa cmd
-argument may be one of:
-.Bl -tag -width SPACECTL_DEALLOC
-.It Dv SPACECTL_DEALLOC
-Zero a region in the file specified by the
-.Fa rqsr
-argument.
-The
-.Fa "rqsr->r_offset"
-has to be a value greater than or equal to 0, and the
-.Fa "rqsr->r_len"
-has to be a value greater than 0.
-.Pp
-If the file system supports hole-punching,
-file system space deallocation may be performed in the given region.
-.El
-.Pp
-The
-.Fa flags
-argument needs to be the value 0 currently.
-.Sh RETURN VALUES
-Upon successful completion, the value 0 is returned;
-otherwise the value -1 is returned and
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-Possible failure conditions:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa fd
-argument is not a valid file descriptor.
-.It Bq Er EBADF
-The
-.Fa fd
-argument references a file that was opened without write permission.
-.It Bq Er EINTR
-A signal was caught during execution.
-.It Bq Er EINVAL
-The
-.Fa cmd
-argument is not valid.
-.It Bq Er EINVAL
-If the
-.Fa cmd
-argument is
-.Dv SPACECTL_DEALLOC ,
-either the
-.Fa "rqsr->r_offset"
-argument was less than zero, or the
-.Fa "rqsr->r_len"
-argument was less than or equal to zero.
-.It Bq Er EINVAL
-The value of
-.Fa "rqsr->r_offset" +
-.Fa "rqsr->r_len"
-is greater than
-.Dv OFF_MAX .
-.It Bq Er EINVAL
-An invalid or unsupported flag is included in
-.Fa flags .
-.It Bq Er EINVAL
-A flag included in
-.Fa flags
-is not supported by the operation specified by the
-.Fa cmd
-argument.
-.It Bq Er EFAULT
-The
-.Fa rqsr
-or a non-NULL
-.Fa rmsr
-argument point outside the process' allocated address space.
-.It Bq Er EIO
-An I/O error occurred while reading from or writing to a file system.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.It Bq Er ENODEV
-The
-.Fa fd
-argument does not refer to a file that supports
-.Nm .
-.It Bq Er ENOSPC
-There is insufficient free space remaining on the file system storage
-media.
-.It Bq Er ENOTCAPABLE
-The file descriptor
-.Fa fd
-has insufficient rights.
-.It Bq Er ESPIPE
-The
-.Fa fd
-argument is associated with a pipe or FIFO.
-.El
-.Sh SEE ALSO
-.Xr creat 2 ,
-.Xr ftruncate 2 ,
-.Xr open 2 ,
-.Xr unlink 2
-.Sh HISTORY
-The
-.Nm
-system call appeared in
-.Fx 14.0 .
-.Sh AUTHORS
-.Nm
-and this manual page were written by
-.An Ka Ho Ng Aq Mt khng@FreeBSD.org
-under sponsorship from the FreeBSD Foundation.
diff --git a/lib/libc/sys/fstat.c b/lib/libc/sys/fstat.c
deleted file mode 100644
index d31b1f54bb11..000000000000
--- a/lib/libc/sys/fstat.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*-
- * Copyright (c) 2017 M. Warner Losh <imp@FreeBSD.org>
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "namespace.h"
-#include <sys/param.h>
-#include <sys/syscall.h>
-#include "compat-ino64.h"
-#include <unistd.h>
-
-#include "libc_private.h"
-
-#undef fstat
-__weak_reference(_fstat, fstat);
-
-#pragma weak _fstat
-int
-_fstat(int fd, struct stat *sb)
-{
- struct freebsd11_stat stat11;
- int rv;
-
- if (__getosreldate() >= INO64_FIRST)
- return (__sys_fstat(fd, sb));
- rv = syscall(SYS_freebsd11_fstat, fd, &stat11);
- if (rv == 0)
- __stat11_to_stat(&stat11, sb);
- return (rv);
-}
diff --git a/lib/libc/sys/fstatat.c b/lib/libc/sys/fstatat.c
deleted file mode 100644
index 104f22ee16bd..000000000000
--- a/lib/libc/sys/fstatat.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*-
- * Copyright (c) 2017 M. Warner Losh <imp@FreeBSD.org>
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "namespace.h"
-#include <sys/param.h>
-#include <sys/syscall.h>
-#include "compat-ino64.h"
-#include <unistd.h>
-
-#include "libc_private.h"
-
-int
-fstatat(int fd, const char *path, struct stat *sb, int flag)
-{
- struct freebsd11_stat stat11;
- int rv;
-
- if (__getosreldate() >= INO64_FIRST)
- return (__sys_fstatat(fd, path, sb, flag));
- rv = syscall(SYS_freebsd11_fstatat, fd, path, &stat11, flag);
- if (rv == 0)
- __stat11_to_stat(&stat11, sb);
- return (rv);
-}
diff --git a/lib/libc/sys/fstatfs.c b/lib/libc/sys/fstatfs.c
deleted file mode 100644
index 836127842c4a..000000000000
--- a/lib/libc/sys/fstatfs.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*-
- * Copyright (c) 2017 M. Warner Losh <imp@FreeBSD.org>
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "namespace.h"
-#include <sys/param.h>
-#include <sys/syscall.h>
-#include "compat-ino64.h"
-#include <unistd.h>
-
-#include "libc_private.h"
-
-#undef fstatfs
-__weak_reference(_fstatfs, fstatfs);
-
-#pragma weak _fstatfs
-int
-_fstatfs(int fd, struct statfs *buf)
-{
- struct freebsd11_statfs statfs11;
- int rv;
-
- if (__getosreldate() >= INO64_FIRST)
- return (__sys_fstatfs(fd, buf));
- rv = syscall(SYS_freebsd11_fstatfs, fd, &statfs11);
- if (rv == 0)
- __statfs11_to_statfs(&statfs11, buf);
- return (rv);
-}
diff --git a/lib/libc/sys/fsync.2 b/lib/libc/sys/fsync.2
deleted file mode 100644
index 540e02b78493..000000000000
--- a/lib/libc/sys/fsync.2
+++ /dev/null
@@ -1,134 +0,0 @@
-.\" Copyright (c) 1983, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\" Copyright (c) 2016 The FreeBSD Foundation, Inc.
-.\" All rights reserved.
-.\"
-.\" Parts of this documentation were written by
-.\" Konstantin Belousov <kib@FreeBSD.org> under sponsorship
-.\" from the FreeBSD Foundation.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)fsync.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2020
-.Dt FSYNC 2
-.Os
-.Sh NAME
-.Nm fdatasync ,
-.Nm fsync
-.Nd "synchronise changes to a file"
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn fdatasync "int fd"
-.Ft int
-.Fn fsync "int fd"
-.Sh DESCRIPTION
-The
-.Fn fsync
-system call
-causes all modified data and attributes of the file referenced by
-the file descriptor
-.Fa fd
-to be moved to a permanent storage device.
-This normally results in all in-core modified copies
-of buffers for the associated file to be written to a disk.
-.Pp
-The
-.Fn fdatasync
-system call causes all modified data of
-.Fa fd
-to be moved to a permanent storage device.
-Unlike
-.Fn fsync ,
-the system call does not guarantee that file attributes or
-metadata necessary to access the file are committed to the permanent storage.
-.Pp
-The
-.Fn fsync
-system call
-should be used by programs that require a file to be
-in a known state, for example, in building a simple transaction
-facility.
-If the file metadata has already been committed, using
-.Fn fdatasync
-can be more efficient than
-.Fn fsync .
-.Pp
-Both
-.Fn fdatasync
-and
-.Fn fsync
-calls are cancellation points.
-.Sh RETURN VALUES
-.Rv -std fsync
-.Sh ERRORS
-The
-.Fn fsync
-and
-.Fn fdatasync
-calls fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa fd
-argument
-is not a valid descriptor.
-.It Bq Er EINVAL
-The
-.Fa fd
-argument
-refers to a socket, not to a file.
-.It Bq Er EIO
-An I/O error occurred while reading from or writing to the file system.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.El
-.Sh SEE ALSO
-.Xr fsync 1 ,
-.Xr sync 2 ,
-.Xr syncer 4 ,
-.Xr sync 8
-.Sh HISTORY
-The
-.Fn fsync
-system call appeared in
-.Bx 4.2 .
-The
-.Fn fdatasync
-system call appeared in
-.Fx 11.1 .
-.Sh BUGS
-The
-.Fn fdatasync
-system call currently does not guarantee that enqueued
-.Xr aio 4
-requests for the file referenced by
-.Fa fd
-are completed before the syscall returns.
diff --git a/lib/libc/sys/fsync.c b/lib/libc/sys/fsync.c
index 5f1512932baa..e542c8cdea48 100644
--- a/lib/libc/sys/fsync.c
+++ b/lib/libc/sys/fsync.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2014 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/fcntl.h>
#include <unistd.h>
@@ -43,6 +39,5 @@ __weak_reference(__sys_fsync, __fsync);
int
fsync(int fd)
{
-
- return (((int (*)(int))__libc_interposing[INTERPOS_fsync])(fd));
+ return (INTERPOS_SYS(fsync, fd));
}
diff --git a/lib/libc/sys/getdents.c b/lib/libc/sys/getdents.c
index 480fbf265fb9..df8993a7b0f9 100644
--- a/lib/libc/sys/getdents.c
+++ b/lib/libc/sys/getdents.c
@@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#include <sys/syscall.h>
@@ -36,11 +33,6 @@ __FBSDID("$FreeBSD$");
ssize_t
getdents(int fd, char *buf, size_t nbytes)
{
- /*
- * _getdirentries knows how to call the right thing and
- * return it in the new format. It assumes that the entire
- * libc expecting the new format.
- */
- return (_getdirentries(fd, buf, nbytes, NULL));
+ return (__sys_getdirentries(fd, buf, nbytes, NULL));
}
diff --git a/lib/libc/sys/getdirentries.2 b/lib/libc/sys/getdirentries.2
deleted file mode 100644
index 4185fb84f0f9..000000000000
--- a/lib/libc/sys/getdirentries.2
+++ /dev/null
@@ -1,208 +0,0 @@
-.\" Copyright (c) 1989, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)getdirentries.2 8.2 (Berkeley) 5/3/95
-.\" $FreeBSD$
-.\"
-.Dd February 14, 2021
-.Dt GETDIRENTRIES 2
-.Os
-.Sh NAME
-.Nm getdirentries ,
-.Nm getdents
-.Nd "get directory entries in a file system independent format"
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In dirent.h
-.Ft ssize_t
-.Fn getdirentries "int fd" "char *buf" "size_t nbytes" "off_t *basep"
-.Ft ssize_t
-.Fn getdents "int fd" "char *buf" "size_t nbytes"
-.Sh DESCRIPTION
-The
-.Fn getdirentries
-and
-.Fn getdents
-system calls read directory entries from the directory
-referenced by the file descriptor
-.Fa fd
-into the buffer pointed to by
-.Fa buf ,
-in a file system independent format.
-Up to
-.Fa nbytes
-of data will be transferred.
-The
-.Fa nbytes
-argument must be greater than or equal to the
-block size associated with the file,
-see
-.Xr stat 2 .
-Some file systems may not support these system calls
-with buffers smaller than this size.
-.Pp
-The data in the buffer is a series of
-.Vt dirent
-structures each containing the following entries:
-.Bd -literal -offset indent
-ino_t d_fileno;
-off_t d_off;
-uint16_t d_reclen;
-uint8_t d_type;
-uint16_t d_namlen;
-char d_name[MAXNAMLEN + 1]; /* see below */
-.Ed
-.Pp
-The
-.Fa d_fileno
-entry is a number which is unique for each
-distinct file in the file system.
-Files that are linked by hard links (see
-.Xr link 2 )
-have the same
-.Fa d_fileno .
-The
-.Fa d_off
-field returns a cookie which, if non-zero, can be used with
-.Xr lseek 2
-to position the directory descriptor to the next entry.
-The
-.Fa d_reclen
-entry is the length, in bytes, of the directory record.
-The
-.Fa d_type
-entry is the type of the file pointed to by the directory record.
-The file type values are defined in
-.Fa <sys/dirent.h> .
-The
-.Fa d_name
-entry contains a null terminated file name.
-The
-.Fa d_namlen
-entry specifies the length of the file name excluding the null byte.
-Thus the actual size of
-.Fa d_name
-may vary from 1 to
-.Dv MAXNAMLEN
-\&+ 1.
-.Pp
-Entries may be separated by extra space.
-The
-.Fa d_reclen
-entry may be used as an offset from the start of a
-.Fa dirent
-structure to the next structure, if any.
-.Pp
-The actual number of bytes transferred is returned.
-The current position pointer associated with
-.Fa fd
-is set to point to the next block of entries.
-The pointer may not advance by the number of bytes returned by
-.Fn getdirentries
-or
-.Fn getdents .
-A value of zero is returned when
-the end of the directory has been reached.
-.Pp
-If the
-.Fa basep
-pointer value is non-NULL,
-the
-.Fn getdirentries
-system call writes the position of the block read into the location pointed to by
-.Fa basep .
-Alternatively, the current position pointer may be set and retrieved by
-.Xr lseek 2 .
-The current position pointer should only be set to a value returned by
-.Xr lseek 2 ,
-a value returned in the location pointed to by
-.Fa basep
-.Po Fn getdirentries
-only
-.Pc ,
-a value returned in the
-.Fa d_off
-field if it is non-zero,
-or zero.
-.Sh IMPLEMENTATION NOTES
-The
-.Fa d_off
-field is currently set to 0 by the NFS client, since the
-directory offset cookies returned by an NFS server cannot
-be used by
-.Xr lseek 2
-at this time.
-.Sh RETURN VALUES
-If successful, the number of bytes actually transferred is returned.
-Otherwise, -1 is returned and the global variable
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-The
-.Fn getdirentries
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa fd
-argument
-is not a valid file descriptor open for reading.
-.It Bq Er EFAULT
-Either
-.Fa buf
-or non-NULL
-.Fa basep
-point outside the allocated address space.
-.It Bq Er EINVAL
-The file referenced by
-.Fa fd
-is not a directory, or
-.Fa nbytes
-is too small for returning a directory entry or block of entries,
-or the current position pointer is invalid.
-.It Bq Er EIO
-An
-.Tn I/O
-error occurred while reading from or writing to the file system.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.El
-.Sh SEE ALSO
-.Xr lseek 2 ,
-.Xr open 2
-.Sh HISTORY
-The
-.Fn getdirentries
-system call first appeared in
-.Bx 4.4 .
-The
-.Fn getdents
-system call first appeared in
-.Fx 3.0 .
diff --git a/lib/libc/sys/getdirentries.c b/lib/libc/sys/getdirentries.c
deleted file mode 100644
index 5a94c6096d59..000000000000
--- a/lib/libc/sys/getdirentries.c
+++ /dev/null
@@ -1,116 +0,0 @@
-/*-
- * Copyright (c) 2017 M. Warner Losh <imp@FreeBSD.org>
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#define _WANT_FREEBSD11_DIRENT
-
-#include "namespace.h"
-#include <sys/param.h>
-#include <sys/syscall.h>
-#include "compat-ino64.h"
-#include <dirent.h>
-#include <errno.h>
-#include <stddef.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include "libc_private.h"
-
-static ssize_t
-__cvt_dirents_from11(const char *de11, ssize_t len11, char *de, ssize_t len)
-{
- struct dirent *dst;
- const struct freebsd11_dirent *src;
- const char *edst, *esrc;
- ssize_t rlen;
-
- src = (const struct freebsd11_dirent *)de11;
- dst = (struct dirent *)de;
- esrc = de11 + len11;
- edst = de + len;
- while ((const char *)src < esrc && (const char *)dst < edst) {
- rlen = roundup(offsetof(struct dirent, d_name) + src->d_namlen + 1, 8);
- if ((const char *)dst + rlen >= edst)
- break;
- dst->d_fileno = src->d_fileno;
- dst->d_off = 0; /* nothing uses it yet, so safe for now */
- dst->d_reclen = rlen;
- dst->d_type = src->d_type;
- dst->d_pad0 = 0;
- dst->d_namlen = src->d_namlen;
- dst->d_pad1 = 0;
- memset(dst->d_name, 0, roundup(src->d_namlen + 1, 8));
- memcpy(dst->d_name, src->d_name, src->d_namlen);
- dst = (struct dirent *)((char *)dst + rlen);
- src = (const struct freebsd11_dirent *)((const char *)src + src->d_reclen);
- }
- return ((char *)dst - de);
-}
-
-#undef getdirentries
-__weak_reference(_getdirentries, getdirentries);
-
-#pragma weak _getdirentries
-ssize_t
-_getdirentries(int fd, char *buf, size_t nbytes, off_t *basep)
-{
- char *oldbuf;
- size_t len;
- ssize_t rv;
-
- if (__getosreldate() >= INO64_FIRST)
- return (__sys_getdirentries(fd, buf, nbytes, basep));
-
- /*
- * Because the old system call returns entries that are smaller than the
- * new, we could wind up in a situation where we have too many to fit in
- * the buffer with the new encoding. So sacrifice a small bit of
- * efficiency to ensure that never happens. We pick 1/4 the size round
- * up to the next DIRBLKSIZ. This will guarnatee enough room exists in
- * the dst buffer due to changes in efficiency in packing dirent
- * entries. We don't check against minimum block size to avoid a lot of
- * stat calls, we'll see if that's wise or not.
- * TBD: Will this difference matter to lseek?
- */
- len = roundup(nbytes / 4, DIRBLKSIZ);
- oldbuf = malloc(len);
- if (oldbuf == NULL) {
- errno = EINVAL; /* ENOMEM not in possible list */
- return (-1);
- }
- rv = syscall(SYS_freebsd11_getdirentries, fd, oldbuf, len, basep);
- if (rv == -1) {
- free(oldbuf);
- return (rv);
- }
- if (rv > 0)
- rv = __cvt_dirents_from11(oldbuf, rv, buf, nbytes);
- free(oldbuf);
-
- return (rv);
-}
diff --git a/lib/libc/sys/getdtablesize.2 b/lib/libc/sys/getdtablesize.2
deleted file mode 100644
index ef99a6020082..000000000000
--- a/lib/libc/sys/getdtablesize.2
+++ /dev/null
@@ -1,62 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)getdtablesize.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd April 24, 2013
-.Dt GETDTABLESIZE 2
-.Os
-.Sh NAME
-.Nm getdtablesize
-.Nd get file descriptor limit
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn getdtablesize void
-.Sh DESCRIPTION
-The
-.Fn getdtablesize
-system call returns the maximum number of file descriptors
-that the current process may open.
-The maximum file descriptor number that the system may assign
-is the return value minus one.
-Existing file descriptor numbers may be higher
-if the limit was lowered after they were opened.
-.Sh SEE ALSO
-.Xr close 2 ,
-.Xr closefrom 2 ,
-.Xr dup 2 ,
-.Xr getrlimit 2 ,
-.Xr sysconf 3
-.Sh HISTORY
-The
-.Fn getdtablesize
-system call appeared in
-.Bx 4.2 .
diff --git a/lib/libc/sys/getfh.2 b/lib/libc/sys/getfh.2
deleted file mode 100644
index cd3d54f54d7f..000000000000
--- a/lib/libc/sys/getfh.2
+++ /dev/null
@@ -1,223 +0,0 @@
-.\" Copyright (c) 1989, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\" Copyright (c) 2018 Gandi
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)getfh.2 8.1 (Berkeley) 6/9/93
-.\" $FreeBSD$
-.\"
-.Dd February 23, 2021
-.Dt GETFH 2
-.Os
-.Sh NAME
-.Nm getfh ,
-.Nm lgetfh ,
-.Nm getfhat
-.Nd get file handle
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/param.h
-.In sys/mount.h
-.Ft int
-.Fn getfh "const char *path" "fhandle_t *fhp"
-.Ft int
-.Fn lgetfh "const char *path" "fhandle_t *fhp"
-.Ft int
-.Fn getfhat "int fd" "const char *path" "fhandle_t *fhp" "int flag"
-.Sh DESCRIPTION
-The
-.Fn getfh
-system call
-returns a file handle for the specified file or directory
-in the file handle pointed to by
-.Fa fhp .
-.Pp
-The
-.Fn lgetfh
-system call is like
-.Fn getfh
-except in the case where the named file is a symbolic link,
-in which case
-.Fn lgetfh
-returns information about the link,
-while
-.Fn getfh
-returns information about the file the link references.
-.Pp
-The
-.Fn getfhat
-system call is equivalent to
-.Fn getfh
-and
-.Fn lgetfh
-except when the
-.Fa path
-specifies a relative path.
-For
-.Fn getfhat
-and relative
-.Fa path ,
-the status is retrieved from a file relative to
-the directory associated with the file descriptor
-.Fa fd
-instead of the current working directory.
-.Pp
-The values for the
-.Fa flag
-are constructed by a bitwise-inclusive OR of flags from this list,
-defined in
-.In fcntl.h :
-.Bl -tag -width indent
-.It Dv AT_SYMLINK_NOFOLLOW
-If
-.Fa path
-names a symbolic link, the status of the symbolic link is returned.
-.It Dv AT_RESOLVE_BENEATH
-Only walk paths below the directory specified by the
-.Ar fd
-descriptor.
-See the description of the
-.Dv O_RESOLVE_BENEATH
-flag in the
-.Xr open 2
-manual page.
-.El
-.Pp
-If
-.Fn getfhat
-is passed the special value
-.Dv AT_FDCWD
-in the
-.Fa fd
-parameter, the current working directory is used and the behavior is
-identical to a call to
-.Fn getfth
-or
-.Fn lgetfh
-respectively, depending on whether or not the
-.Dv AT_SYMLINK_NOFOLLOW
-bit is set in
-.Fa flag .
-.Pp
-When
-.Fn getfhat
-is called with an absolute
-.Fa path ,
-it ignores the
-.Fa fd
-argument.
-These system calls are restricted to the superuser.
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-The
-.Fn getfh
-and
-.Fn lgetfh
-system calls
-fail if one or more of the following are true:
-.Bl -tag -width Er
-.It Bq Er ENOTDIR
-A component of the path prefix of
-.Fa path
-is not a directory.
-.It Bq Er ENAMETOOLONG
-The length of a component of
-.Fa path
-exceeds 255 characters,
-or the length of
-.Fa path
-exceeds 1023 characters.
-.It Bq Er ENOENT
-The file referred to by
-.Fa path
-does not exist.
-.It Bq Er EACCES
-Search permission is denied for a component of the path prefix of
-.Fa path .
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating
-.Fa path .
-.It Bq Er EFAULT
-The
-.Fa fhp
-argument
-points to an invalid address.
-.It Bq Er EFAULT
-The
-.Fa path
-argument
-points to an invalid address.
-.It Bq Er EIO
-An
-.Tn I/O
-error occurred while reading from or writing to the file system.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.It Bq Er ESTALE
-The file handle
-.Fa fhp
-is no longer valid.
-.El
-.Pp
-In addition to the errors returned by
-.Fn getfh ,
-and
-.Fn lgetfh ,
-the
-.Fn getfhat
-system call may fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa path
-argument does not specify an absolute path and the
-.Fa fd
-argument, is neither
-.Dv AT_FDCWD
-nor a valid file descriptor open for searching.
-.It Bq Er EINVAL
-The value of the
-.Fa flag
-argument is not valid.
-.It Bq Er ENOTDIR
-The
-.Fa path
-argument is not an absolute path and
-.Fa fd
-is neither
-.Dv AT_FDCWD
-nor a file descriptor associated with a directory.
-.Sh SEE ALSO
-.Xr fhopen 2 ,
-.Xr open 2 ,
-.Xr stat 2
-.Sh HISTORY
-The
-.Fn getfh
-system call first appeared in
-.Bx 4.4 .
diff --git a/lib/libc/sys/getfsstat.2 b/lib/libc/sys/getfsstat.2
deleted file mode 100644
index 1f5b52b69916..000000000000
--- a/lib/libc/sys/getfsstat.2
+++ /dev/null
@@ -1,132 +0,0 @@
-.\" Copyright (c) 1989, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)getfsstat.2 8.3 (Berkeley) 5/25/95
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2020
-.Dt GETFSSTAT 2
-.Os
-.Sh NAME
-.Nm getfsstat
-.Nd get list of all mounted file systems
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/param.h
-.In sys/ucred.h
-.In sys/mount.h
-.Ft int
-.Fn getfsstat "struct statfs *buf" "long bufsize" "int mode"
-.Sh DESCRIPTION
-The
-.Fn getfsstat
-system call
-returns information about all mounted file systems.
-The
-.Fa buf
-argument
-is a pointer to
-.Vt statfs
-structures, as described in
-.Xr statfs 2 .
-.Pp
-Fields that are undefined for a particular file system are set to -1.
-The buffer is filled with an array of
-.Fa statfs
-structures, one for each mounted file system
-up to the byte count specified by
-.Fa bufsize .
-Note, the
-.Fa bufsize
-argument is the number of bytes that
-.Fa buf
-can hold, not the count of statfs structures it will hold.
-.Pp
-If
-.Fa buf
-is given as NULL,
-.Fn getfsstat
-returns just the number of mounted file systems.
-.Pp
-Normally
-.Fa mode
-should be specified as
-.Dv MNT_WAIT .
-If
-.Fa mode
-is set to
-.Dv MNT_NOWAIT ,
-.Fn getfsstat
-will return the information it has available without requesting
-an update from each file system.
-Thus, some of the information will be out of date, but
-.Fn getfsstat
-will not block waiting for information from a file system that is
-unable to respond.
-It will also skip any file system that is in the process of being
-unmounted, even if the unmount would eventually fail.
-.Sh RETURN VALUES
-Upon successful completion, the number of
-.Fa statfs
-structures is returned.
-Otherwise, -1 is returned and the global variable
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-The
-.Fn getfsstat
-system call
-fails if one or more of the following are true:
-.Bl -tag -width Er
-.It Bq Er EFAULT
-The
-.Fa buf
-argument
-points to an invalid address.
-.It Bq Er EINVAL
-.Fa mode
-is set to a value other than
-.Dv MNT_WAIT
-or
-.Dv MNT_NOWAIT .
-.It Bq Er EIO
-An
-.Tn I/O
-error occurred while reading from or writing to the file system.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.El
-.Sh SEE ALSO
-.Xr statfs 2 ,
-.Xr fstab 5 ,
-.Xr mount 8
-.Sh HISTORY
-The
-.Fn getfsstat
-system call first appeared in
-.Bx 4.4 .
diff --git a/lib/libc/sys/getfsstat.c b/lib/libc/sys/getfsstat.c
deleted file mode 100644
index edbfaa989b5a..000000000000
--- a/lib/libc/sys/getfsstat.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/*-
- * Copyright (c) 2017 M. Warner Losh <imp@FreeBSD.org>
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "namespace.h"
-#include <sys/param.h>
-#include "compat-ino64.h"
-#include <sys/errno.h>
-#include <sys/syscall.h>
-#include <stdlib.h>
-#include <unistd.h>
-
-#include "libc_private.h"
-
-int
-getfsstat(struct statfs *buf, long bufsize, int flags)
-{
- struct freebsd11_statfs *statfs11 = NULL;
- ssize_t len = 0;
- int rv, i;
-
- if (__getosreldate() >= INO64_FIRST)
- return (__sys_getfsstat(buf, bufsize, flags));
- if (buf != NULL) {
- len = sizeof(struct freebsd11_statfs) * /* Round down on purpose to avoid */
- (bufsize / sizeof(struct statfs)); /* overflow on translation. */
- statfs11 = malloc(len);
- if (statfs11 == NULL) {
- errno = ENOMEM;
- return (-1);
- }
- }
- rv = syscall(SYS_freebsd11_getfsstat, statfs11, len, flags);
- if (rv != -1 && buf != NULL) {
- for (i = 0; i < rv; i++)
- __statfs11_to_statfs(&statfs11[i], &buf[i]);
- }
- free(statfs11);
- return (rv);
-}
diff --git a/lib/libc/sys/getgid.2 b/lib/libc/sys/getgid.2
deleted file mode 100644
index 272d1ea8b031..000000000000
--- a/lib/libc/sys/getgid.2
+++ /dev/null
@@ -1,85 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)getgid.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd May 1, 2020
-.Dt GETGID 2
-.Os
-.Sh NAME
-.Nm getgid ,
-.Nm getegid
-.Nd get group process identification
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft gid_t
-.Fn getgid void
-.Ft gid_t
-.Fn getegid void
-.Sh DESCRIPTION
-The
-.Fn getgid
-system call returns the real group ID of the calling process,
-.Fn getegid
-returns the effective group ID of the calling process.
-.Pp
-The real group ID is specified at login time.
-.Pp
-The real group ID is the group of the user who invoked the program.
-As the effective group ID gives the process additional permissions
-during the execution of
-.Dq Em set-group-ID
-mode processes,
-.Fn getgid
-is used to determine the real-user-id of the calling process.
-.Sh ERRORS
-The
-.Fn getgid
-and
-.Fn getegid
-system calls are always successful, and no return value is reserved to
-indicate an error.
-.Sh SEE ALSO
-.Xr getuid 2 ,
-.Xr issetugid 2 ,
-.Xr setgid 2 ,
-.Xr setregid 2
-.Sh STANDARDS
-The
-.Fn getgid
-and
-.Fn getegid
-system calls are expected to conform to
-.St -p1003.1-90 .
-.Sh HISTORY
-The
-.Fn getgid
-function appeared in
-.At v4 .
diff --git a/lib/libc/sys/getgroups.2 b/lib/libc/sys/getgroups.2
deleted file mode 100644
index 47913f4b01cb..000000000000
--- a/lib/libc/sys/getgroups.2
+++ /dev/null
@@ -1,107 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)getgroups.2 8.2 (Berkeley) 4/16/94
-.\" $FreeBSD$
-.\"
-.Dd January 21, 2011
-.Dt GETGROUPS 2
-.Os
-.Sh NAME
-.Nm getgroups
-.Nd get group access list
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn getgroups "int gidsetlen" "gid_t *gidset"
-.Sh DESCRIPTION
-The
-.Fn getgroups
-system call
-gets the current group access list of the user process
-and stores it in the array
-.Fa gidset .
-The
-.Fa gidsetlen
-argument
-indicates the number of entries that may be placed in
-.Fa gidset .
-The
-.Fn getgroups
-system call
-returns the actual number of groups returned in
-.Fa gidset .
-At least one and as many as {NGROUPS_MAX}+1 values may be returned.
-If
-.Fa gidsetlen
-is zero,
-.Fn getgroups
-returns the number of supplementary group IDs associated with
-the calling process without modifying the array pointed to by
-.Fa gidset .
-.Pp
-The value of
-.Dv {NGROUPS_MAX}
-should be obtained using
-.Xr sysconf 3
-to avoid hard-coding it into the executable.
-.Sh RETURN VALUES
-A successful call returns the number of groups in the group set.
-A value of -1 indicates that an error occurred, and the error
-code is stored in the global variable
-.Va errno .
-.Sh ERRORS
-The possible errors for
-.Fn getgroups
-are:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The argument
-.Fa gidsetlen
-is smaller than the number of groups in the group set.
-.It Bq Er EFAULT
-The argument
-.Fa gidset
-specifies
-an invalid address.
-.El
-.Sh SEE ALSO
-.Xr setgroups 2 ,
-.Xr initgroups 3 ,
-.Xr sysconf 3
-.Sh STANDARDS
-The
-.Fn getgroups
-system call conforms to
-.St -p1003.1-2008 .
-.Sh HISTORY
-The
-.Fn getgroups
-system call appeared in
-.Bx 4.2 .
diff --git a/lib/libc/sys/getitimer.2 b/lib/libc/sys/getitimer.2
deleted file mode 100644
index 1cb3d5e6a6b2..000000000000
--- a/lib/libc/sys/getitimer.2
+++ /dev/null
@@ -1,195 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)getitimer.2 8.3 (Berkeley) 5/16/95
-.\" $FreeBSD$
-.\"
-.Dd May 1, 2020
-.Dt GETITIMER 2
-.Os
-.Sh NAME
-.Nm getitimer ,
-.Nm setitimer
-.Nd get/set value of interval timer
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/time.h
-.Fd "#define ITIMER_REAL 0"
-.Fd "#define ITIMER_VIRTUAL 1"
-.Fd "#define ITIMER_PROF 2"
-.Ft int
-.Fn getitimer "int which" "struct itimerval *value"
-.Ft int
-.Fn setitimer "int which" "const struct itimerval *value" "struct itimerval *ovalue"
-.Sh DESCRIPTION
-The system provides each process with three interval timers,
-defined in
-.In sys/time.h .
-The
-.Fn getitimer
-system call returns the current value for the timer specified in
-.Fa which
-in the structure at
-.Fa value .
-The
-.Fn setitimer
-system call sets a timer to the specified
-.Fa value
-(returning the previous value of the timer if
-.Fa ovalue
-is not a null pointer).
-.Pp
-A timer value is defined by the
-.Fa itimerval
-structure:
-.Bd -literal -offset indent
-struct itimerval {
- struct timeval it_interval; /* timer interval */
- struct timeval it_value; /* current value */
-};
-.Ed
-.Pp
-If
-.Fa it_value
-is non-zero, it indicates the time to the next timer expiration.
-If
-.Fa it_interval
-is non-zero, it specifies a value to be used in reloading
-.Fa it_value
-when the timer expires.
-Setting
-.Fa it_value
-to 0 disables a timer, regardless of the value of
-.Fa it_interval .
-Setting
-.Fa it_interval
-to 0 causes a timer to be disabled after its next expiration (assuming
-.Fa it_value
-is non-zero).
-.Pp
-Time values smaller than the resolution of the
-system clock are rounded up to this resolution
-(typically 10 milliseconds).
-.Pp
-The
-.Dv ITIMER_REAL
-timer decrements in real time.
-A
-.Dv SIGALRM
-signal is
-delivered when this timer expires.
-.Pp
-The
-.Dv ITIMER_VIRTUAL
-timer decrements in process virtual time.
-It runs only when the process is executing.
-A
-.Dv SIGVTALRM
-signal
-is delivered when it expires.
-.Pp
-The
-.Dv ITIMER_PROF
-timer decrements both in process virtual time and
-when the system is running on behalf of the process.
-It is designed
-to be used by interpreters in statistically profiling the execution
-of interpreted programs.
-Each time the
-.Dv ITIMER_PROF
-timer expires, the
-.Dv SIGPROF
-signal is
-delivered.
-Because this signal may interrupt in-progress
-system calls, programs using this timer must be prepared to
-restart interrupted system calls.
-.Pp
-The maximum number of seconds allowed for
-.Fa it_interval
-and
-.Fa it_value
-in
-.Fn setitimer
-is 100000000.
-.Sh NOTES
-Three macros for manipulating time values are defined in
-.In sys/time.h .
-The
-.Fn timerclear
-macro
-sets a time value to zero,
-.Fn timerisset
-tests if a time value is non-zero, and
-.Fn timercmp
-compares two time values.
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-The
-.Fn getitimer
-and
-.Fn setitimer
-system calls
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EFAULT
-The
-.Fa value
-argument specified a bad address.
-.It Bq Er EINVAL
-The
-.Fa value
-argument specified a time that was too large
-to be handled.
-.El
-.Sh SEE ALSO
-.Xr gettimeofday 2 ,
-.Xr select 2 ,
-.Xr sigaction 2 ,
-.Xr clocks 7
-.Sh STANDARDS
-The
-.Fn getitimer
-and
-.Fn setitimer
-functions conform to
-.St -p1003.1-2001 .
-The later
-.St -p1003.1-2008
-revision however marked both functions as obsolescent,
-recommending the use of
-.Xr timer_gettime 2
-and
-.Xr timer_settime 2
-instead.
-.Sh HISTORY
-The
-.Fn getitimer
-system call appeared in
-.Bx 4.2 .
diff --git a/lib/libc/sys/getlogin.2 b/lib/libc/sys/getlogin.2
deleted file mode 100644
index 2d82aea92aa5..000000000000
--- a/lib/libc/sys/getlogin.2
+++ /dev/null
@@ -1,204 +0,0 @@
-.\" Copyright (c) 1989, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)getlogin.2 8.1 (Berkeley) 6/9/93
-.\" $FreeBSD$
-.\"
-.Dd September 9, 2020
-.Dt GETLOGIN 2
-.Os
-.Sh NAME
-.Nm getlogin ,
-.Nm getlogin_r ,
-.Nm setlogin
-.Nd get/set login name
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft char *
-.Fn getlogin void
-.In sys/param.h
-.Ft int
-.Fn getlogin_r "char *name" "size_t len"
-.Ft int
-.Fn setlogin "const char *name"
-.Sh DESCRIPTION
-The
-.Fn getlogin
-routine
-returns the login name of the user associated with the current session,
-as previously set by
-.Fn setlogin .
-The name is normally associated with a login shell
-at the time a session is created,
-and is inherited by all processes descended from the login shell.
-(This is true even if some of those processes assume another user ID,
-for example when
-.Xr su 1
-is used).
-.Pp
-The
-.Fn getlogin_r
-function
-provides the same service as
-.Fn getlogin
-except the caller must provide the buffer
-.Fa name
-with length
-.Fa len
-bytes
-to hold the result.
-The buffer should be at least
-.Dv MAXLOGNAME
-bytes in length.
-.Pp
-The
-.Fn setlogin
-system call
-sets the login name of the user associated with the current session to
-.Fa name .
-This system call is restricted to the super-user, and
-is normally used only when a new session is being created on behalf
-of the named user
-(for example, at login time, or when a remote shell is invoked).
-.Pp
-.Em NOTE :
-There is only one login name per session.
-.Pp
-It is
-.Em CRITICALLY
-important to ensure that
-.Fn setlogin
-is only ever called after the process has taken adequate steps to ensure
-that it is detached from its parent's session.
-Making a
-.Fn setsid
-system call is the
-.Em ONLY
-way to do this.
-The
-.Xr daemon 3
-function calls
-.Fn setsid
-which is an ideal way of detaching from a controlling terminal and
-forking into the background.
-.Pp
-In particular, doing a
-.Fn ioctl ttyfd TIOCNOTTY ...\&
-or
-.Fn setpgrp ...\&
-is
-.Em NOT
-sufficient.
-.Pp
-Once a parent process does a
-.Fn setsid
-system call, it is acceptable for some child of that process to then do a
-.Fn setlogin
-even though it is not the session leader, but beware that ALL processes
-in the session will change their login name at the same time, even the
-parent.
-.Pp
-This is not the same as the traditional UNIX behavior of inheriting privilege.
-.Pp
-Since the
-.Fn setlogin
-system call is restricted to the super-user, it is assumed that (like
-all other privileged programs) the programmer has taken adequate
-precautions to prevent security violations.
-.Sh RETURN VALUES
-If a call to
-.Fn getlogin
-succeeds, it returns a pointer to a null-terminated string in a static buffer,
-or
-.Dv NULL
-if the name has not been set.
-The
-.Fn getlogin_r
-function
-returns zero if successful, or the error number upon failure.
-.Pp
-.Rv -std setlogin
-.Sh ERRORS
-The following errors may be returned by these calls:
-.Bl -tag -width Er
-.It Bq Er EFAULT
-The
-.Fa name
-argument gave an
-invalid address.
-.It Bq Er EINVAL
-The
-.Fa name
-argument
-pointed to a string that was too long.
-Login names are limited to
-.Dv MAXLOGNAME
-(from
-.In sys/param.h )
-characters, currently 33 including null.
-.It Bq Er EPERM
-The caller tried to set the login name and was not the super-user.
-.It Bq Er ERANGE
-The size of the buffer is smaller than the result to be returned.
-.El
-.Sh SEE ALSO
-.Xr setsid 2 ,
-.Xr daemon 3
-.Sh STANDARDS
-The
-.Fn getlogin
-system call
-and
-the
-.Fn getlogin_r
-function
-conform to
-.St -p1003.1-96 .
-.Sh HISTORY
-The
-.Fn getlogin
-system call first appeared in
-.Bx 4.4 .
-The return value of
-.Fn getlogin_r
-was changed from earlier versions of
-.Fx
-to be conformant with
-.St -p1003.1-96 .
-.Sh BUGS
-In earlier versions of the system,
-.Fn getlogin
-failed unless the process was associated with a login terminal.
-The current implementation (using
-.Fn setlogin )
-allows getlogin to succeed even when the process has no controlling terminal.
-In earlier versions of the system, the value returned by
-.Fn getlogin
-could not be trusted without checking the user ID.
-Portable programs should probably still make this check.
diff --git a/lib/libc/sys/getloginclass.2 b/lib/libc/sys/getloginclass.2
deleted file mode 100644
index e35cad0098f7..000000000000
--- a/lib/libc/sys/getloginclass.2
+++ /dev/null
@@ -1,99 +0,0 @@
-.\"-
-.\" Copyright (c) 2011 Edward Tomasz Napierala
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd July 12, 2016
-.Dt GETLOGINCLASS 2
-.Os
-.Sh NAME
-.Nm getloginclass ,
-.Nm setloginclass
-.Nd get/set login class
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn getloginclass "char *name" "size_t len"
-.Ft int
-.Fn setloginclass "const char *name"
-.Sh DESCRIPTION
-The
-.Fn getloginclass
-routine returns the login class name associated with the calling process,
-as previously set by
-.Fn setloginclass .
-The caller must provide the buffer
-.Fa name
-with length
-.Fa len
-bytes to hold the result.
-The buffer should be at least
-.Dv MAXLOGNAME
-bytes in length.
-.Pp
-The
-.Fn setloginclass
-system call sets the login class of the calling process to
-.Fa name .
-This system call is restricted to the super-user, and is normally used
-only when a new session is being created on behalf of the named user
-(for example, at login time, or when a remote shell is invoked).
-Processes inherit login class from their parents.
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-The following errors may be returned by these calls:
-.Bl -tag -width Er
-.It Bq Er EFAULT
-The
-.Fa name
-argument gave an invalid address.
-.It Bq Er EINVAL
-The
-.Fa name
-argument pointed to a string that was too long.
-Login class names are limited to
-.Dv MAXLOGNAME
-(from
-.In sys/param.h )
-characters, currently 33 including null.
-.It Bq Er EPERM
-The caller tried to set the login class and was not the super-user.
-.It Bq Er ENAMETOOLONG
-The size of the buffer is smaller than the result to be returned.
-.El
-.Sh SEE ALSO
-.Xr ps 1 ,
-.Xr setusercontext 3 ,
-.Xr login.conf 5 ,
-.Xr rctl 8
-.Sh HISTORY
-The
-.Fn getloginclass
-and
-.Fn setloginclass
-system calls first appeared in
-.Fx 9.0 .
diff --git a/lib/libc/sys/getpeername.2 b/lib/libc/sys/getpeername.2
deleted file mode 100644
index 368fd2b02596..000000000000
--- a/lib/libc/sys/getpeername.2
+++ /dev/null
@@ -1,98 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)getpeername.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd June 4, 1993
-.Dt GETPEERNAME 2
-.Os
-.Sh NAME
-.Nm getpeername
-.Nd get name of connected peer
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In sys/socket.h
-.Ft int
-.Fn getpeername "int s" "struct sockaddr * restrict name" "socklen_t * restrict namelen"
-.Sh DESCRIPTION
-The
-.Fn getpeername
-system call
-returns the name of the peer connected to
-socket
-.Fa s .
-The
-.Fa namelen
-argument should be initialized to indicate
-the amount of space pointed to by
-.Fa name .
-On return it contains the actual size of the name
-returned (in bytes).
-The name is truncated if the buffer provided is too small.
-.Sh RETURN VALUES
-.Rv -std getpeername
-.Sh ERRORS
-The call succeeds unless:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The argument
-.Fa s
-is not a valid descriptor.
-.It Bq Er ECONNRESET
-The connection has been reset by the peer.
-.It Bq Er EINVAL
-The value of the
-.Fa namelen
-argument is not valid.
-.It Bq Er ENOTSOCK
-The argument
-.Fa s
-is a file, not a socket.
-.It Bq Er ENOTCONN
-The socket is not connected.
-.It Bq Er ENOBUFS
-Insufficient resources were available in the system
-to perform the operation.
-.It Bq Er EFAULT
-The
-.Fa name
-argument points to memory not in a valid part of the
-process address space.
-.El
-.Sh SEE ALSO
-.Xr accept 2 ,
-.Xr bind 2 ,
-.Xr getsockname 2 ,
-.Xr socket 2
-.Sh HISTORY
-The
-.Fn getpeername
-system call appeared in
-.Bx 4.2 .
diff --git a/lib/libc/sys/getpgrp.2 b/lib/libc/sys/getpgrp.2
deleted file mode 100644
index db6132324ee2..000000000000
--- a/lib/libc/sys/getpgrp.2
+++ /dev/null
@@ -1,142 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)getpgrp.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd June 4, 1993
-.Dt GETPGRP 2
-.Os
-.Sh NAME
-.Nm getpgrp
-.Nd get process group
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft pid_t
-.Fn getpgrp void
-.Ft pid_t
-.Fn getpgid "pid_t pid"
-.Sh DESCRIPTION
-The process group of the current process is returned by
-.Fn getpgrp .
-The process group of the process identified by
-.Fa pid
-is returned by
-.Fn getpgid .
-If
-.Fa pid
-is zero,
-.Fn getpgid
-returns the process group of the current process.
-.Pp
-Process groups are used for distribution of signals, and
-by terminals to arbitrate requests for their input: processes
-that have the same process group as the terminal are foreground
-and may read, while others will block with a signal if they attempt
-to read.
-.Pp
-This system call is thus used by programs such as
-.Xr csh 1
-to create
-process groups
-in implementing job control.
-The
-.Fn tcgetpgrp
-and
-.Fn tcsetpgrp
-calls
-are used to get/set the process group of the control terminal.
-.Sh RETURN VALUES
-The
-.Fn getpgrp
-system call always succeeds.
-Upon successful completion, the
-.Fn getpgid
-system call returns the process group of the specified process;
-otherwise, it returns a value of \-1 and sets
-.Va errno
-to indicate the error.
-.Sh COMPATIBILITY
-This version of
-.Fn getpgrp
-differs from past Berkeley versions by not taking a
-.Fa "pid_t pid"
-argument.
-This incompatibility is required by
-.St -p1003.1-90 .
-.Pp
-From the
-.St -p1003.1-90
-Rationale:
-.Pp
-.Bx 4.3
-provides a
-.Fn getpgrp
-system call that returns the process group ID for a specified process.
-Although this function is used to support job control, all known
-job-control shells always specify the calling process with this
-function.
-Thus, the simpler
-.At V
-.Fn getpgrp
-suffices, and the added complexity of the
-.Bx 4.3
-.Fn getpgrp
-has been omitted from POSIX.1.
-The old functionality is available from the
-.Fn getpgid
-system call.
-.Sh ERRORS
-The
-.Fn getpgid
-system call
-will succeed unless:
-.Bl -tag -width Er
-.It Bq Er ESRCH
-there is no process whose process ID equals
-.Fa pid
-.El
-.Sh SEE ALSO
-.Xr getsid 2 ,
-.Xr setpgid 2 ,
-.Xr termios 4
-.Sh STANDARDS
-The
-.Fn getpgrp
-system call is expected to conform to
-.St -p1003.1-90 .
-.Sh HISTORY
-The
-.Fn getpgrp
-system call appeared in
-.Bx 4.0 .
-The
-.Fn getpgid
-system call is derived from its usage in
-.At V.4 .
diff --git a/lib/libc/sys/getpid.2 b/lib/libc/sys/getpid.2
deleted file mode 100644
index eb56b39667c0..000000000000
--- a/lib/libc/sys/getpid.2
+++ /dev/null
@@ -1,90 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)getpid.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd December 15, 2015
-.Dt GETPID 2
-.Os
-.Sh NAME
-.Nm getpid ,
-.Nm getppid
-.Nd get parent or calling process identification
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft pid_t
-.Fn getpid void
-.Ft pid_t
-.Fn getppid void
-.Sh DESCRIPTION
-The
-.Fn getpid
-system call
-returns
-the process ID of
-the calling process.
-Though the ID is guaranteed to be unique, it should
-.Em NOT
-be used for constructing temporary file names, for
-security reasons; see
-.Xr mkstemp 3
-instead.
-.Pp
-The
-.Fn getppid
-system call
-returns the process ID of the parent
-of the calling process.
-.Sh ERRORS
-The
-.Fn getpid
-and
-.Fn getppid
-system calls are always successful, and no return value is reserved to
-indicate an error.
-.Sh SEE ALSO
-.Xr fork 2 ,
-.Xr getpgrp 2 ,
-.Xr kill 2 ,
-.Xr setpgid 2 ,
-.Xr setsid 2 ,
-.Xr exec 3
-.Sh STANDARDS
-The
-.Fn getpid
-and
-.Fn getppid
-system calls are expected to conform to
-.St -p1003.1-90 .
-.Sh HISTORY
-The
-.Fn getpid
-function appeared in
-.At v7 .
diff --git a/lib/libc/sys/getpriority.2 b/lib/libc/sys/getpriority.2
deleted file mode 100644
index 7cdbb26b243b..000000000000
--- a/lib/libc/sys/getpriority.2
+++ /dev/null
@@ -1,150 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)getpriority.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd June 4, 1993
-.Dt GETPRIORITY 2
-.Os
-.Sh NAME
-.Nm getpriority ,
-.Nm setpriority
-.Nd get/set program scheduling priority
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/time.h
-.In sys/resource.h
-.Ft int
-.Fn getpriority "int which" "int who"
-.Ft int
-.Fn setpriority "int which" "int who" "int prio"
-.Sh DESCRIPTION
-The scheduling
-priority of the process, process group, or user, as indicated by
-.Fa which
-and
-.Fa who
-is obtained with the
-.Fn getpriority
-system call and set with the
-.Fn setpriority
-system call.
-The
-.Fa which
-argument
-is one of
-.Dv PRIO_PROCESS ,
-.Dv PRIO_PGRP ,
-or
-.Dv PRIO_USER ,
-and
-.Fa who
-is interpreted relative to
-.Fa which
-(a process identifier for
-.Dv PRIO_PROCESS ,
-process group
-identifier for
-.Dv PRIO_PGRP ,
-and a user ID for
-.Dv PRIO_USER ) .
-A zero value of
-.Fa who
-denotes the current process, process group, or user.
-The
-.Fa prio
-argument
-is a value in the range -20 to 20.
-The default priority is 0;
-lower priorities cause more favorable scheduling.
-.Pp
-The
-.Fn getpriority
-system call returns the highest priority (lowest numerical value)
-enjoyed by any of the specified processes.
-The
-.Fn setpriority
-system call sets the priorities of all of the specified processes
-to the specified value.
-Only the super-user may lower priorities.
-.Sh RETURN VALUES
-Since
-.Fn getpriority
-can legitimately return the value -1, it is necessary
-to clear the external variable
-.Va errno
-prior to the
-call, then check it afterward to determine
-if a -1 is an error or a legitimate value.
-.Pp
-.Rv -std setpriority
-.Sh ERRORS
-The
-.Fn getpriority
-and
-.Fn setpriority
-system calls
-will fail if:
-.Bl -tag -width Er
-.It Bq Er ESRCH
-No process was located using the
-.Fa which
-and
-.Fa who
-values specified.
-.It Bq Er EINVAL
-The
-.Fa which
-argument
-was not one of
-.Dv PRIO_PROCESS ,
-.Dv PRIO_PGRP ,
-or
-.Dv PRIO_USER .
-.El
-.Pp
-In addition to the errors indicated above,
-.Fn setpriority
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EPERM
-A process was located, but neither its effective nor real user
-ID matched the effective user ID of the caller.
-.It Bq Er EACCES
-A non super-user attempted to lower a process priority.
-.El
-.Sh SEE ALSO
-.Xr nice 1 ,
-.Xr fork 2 ,
-.Xr renice 8
-.Sh HISTORY
-The
-.Fn getpriority
-system call appeared in
-.Bx 4.2 .
diff --git a/lib/libc/sys/getrandom.2 b/lib/libc/sys/getrandom.2
deleted file mode 100644
index b6f3ef1c44a0..000000000000
--- a/lib/libc/sys/getrandom.2
+++ /dev/null
@@ -1,133 +0,0 @@
-.\" Copyright 2020, 2018 Conrad Meyer <cem@FreeBSD.org>. All rights reserved.
-.\"
-.\" 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 AUTHORS 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 AUTHORS 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd January 12, 2020
-.Dt GETRANDOM 2
-.Os
-.Sh NAME
-.Nm getrandom
-.Nd get random data
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/random.h
-.Ft ssize_t
-.Fn getrandom "void *buf" "size_t buflen" "unsigned int flags"
-.Sh DESCRIPTION
-.Fn getrandom
-fills
-.Fa buf
-with up to
-.Fa buflen
-bytes of random data.
-.Pp
-The
-.Fa flags
-argument may include zero or more of the following:
-.Bl -tag -width _GRND_NONBLOCK_
-.It Ql GRND_NONBLOCK
-Return
-.Er EAGAIN
-instead of blocking, if the
-.Xr random 4
-device has not yet been seeded.
-By default,
-.Fn getrandom
-will block until the device is seeded.
-.It Ql GRND_RANDOM
-This flag does nothing on
-.Fx .
-.Pa /dev/random
-and
-.Pa /dev/urandom
-are identical.
-.It Ql GRND_INSECURE
-This flag is treated as an alternative name for
-.Dv GRND_NONBLOCK .
-It is provided solely for API compatibility with Linux.
-.El
-.Pp
-If the
-.Xr random 4
-device has been seeded, reads of up to 256 bytes will always return as many
-bytes as requested and will not be interrupted by signals.
-.Sh RETURN VALUES
-Upon successful completion, the number of bytes which were actually read is
-returned.
-For requests larger than 256 bytes, this can be fewer bytes than were
-requested.
-Otherwise, -1 is returned and the global variable
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-The
-.Fn getrandom
-operation returns the following errors:
-.Bl -tag -width Er
-.It Bq Er EAGAIN
-The
-.Ql GRND_NONBLOCK
-(or
-.Ql GRND_INSECURE )
-flag was set and the
-.Xr random 4
-device was not yet seeded.
-.It Bq Er EFAULT
-The
-.Fa buf
-parameter points to an invalid address.
-.It Bq Er EINTR
-The sleep was interrupted by a signal.
-.It Bq Er EINVAL
-An invalid
-.Fa flags
-was specified.
-.It Bq Er EINVAL
-The requested
-.Fa buflen
-was larger than
-.Dv IOSIZE_MAX .
-.El
-.Sh SEE ALSO
-.Xr arc4random 3 ,
-.Xr getentropy 3 ,
-.Xr random 4
-.Sh STANDARDS
-.Fn getrandom
-is non-standard.
-It is present in Linux.
-.Sh HISTORY
-The
-.Fn getrandom
-system call first appeared in
-.Fx 12.0 .
-.Sh CAVEATS
-Unlike Linux, the
-.Dv GRND_INSECURE
-flag on
-.Fx
-does not produce any output before the
-.Xr random 4
-device is seeded.
diff --git a/lib/libc/sys/getrlimit.2 b/lib/libc/sys/getrlimit.2
deleted file mode 100644
index 090376d4e0f6..000000000000
--- a/lib/libc/sys/getrlimit.2
+++ /dev/null
@@ -1,238 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)getrlimit.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd September 30, 2016
-.Dt GETRLIMIT 2
-.Os
-.Sh NAME
-.Nm getrlimit ,
-.Nm setrlimit
-.Nd control maximum system resource consumption
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In sys/time.h
-.In sys/resource.h
-.Ft int
-.Fn getrlimit "int resource" "struct rlimit *rlp"
-.Ft int
-.Fn setrlimit "int resource" "const struct rlimit *rlp"
-.Sh DESCRIPTION
-Limits on the consumption of system resources by the current process
-and each process it creates may be obtained with the
-.Fn getrlimit
-system call, and set with the
-.Fn setrlimit
-system call.
-.Pp
-The
-.Fa resource
-argument is one of the following:
-.Bl -tag -width RLIMIT_FSIZEAA
-.It Dv RLIMIT_AS
-The maximum amount (in bytes) of virtual memory the process is
-allowed to map.
-.It Dv RLIMIT_CORE
-The largest size (in bytes)
-.Xr core 5
-file that may be created.
-.It Dv RLIMIT_CPU
-The maximum amount of cpu time (in seconds) to be used by
-each process.
-.It Dv RLIMIT_DATA
-The maximum size (in bytes) of the data segment for a process;
-this defines how far a program may extend its break with the
-.Xr sbrk 2
-function.
-.It Dv RLIMIT_FSIZE
-The largest size (in bytes) file that may be created.
-.It Dv RLIMIT_KQUEUES
-The maximum number of kqueues this user id is allowed to create.
-.It Dv RLIMIT_MEMLOCK
-The maximum size (in bytes) which a process may lock into memory
-using the
-.Xr mlock 2
-system call.
-.It Dv RLIMIT_NOFILE
-The maximum number of open files for this process.
-.It Dv RLIMIT_NPROC
-The maximum number of simultaneous processes for this user id.
-.It Dv RLIMIT_NPTS
-The maximum number of pseudo-terminals this user id is allowed to create.
-.It Dv RLIMIT_RSS
-When there is memory pressure and swap is available, prioritize eviction of
-a process' resident pages beyond this amount (in bytes).
-When memory is not under pressure, this rlimit is effectively ignored.
-Even when there is memory pressure, the amount of available swap space and some
-sysctl settings like
-.Xr vm.swap_enabled
-and
-.Xr vm.swap_idle_enabled
-can affect what happens to processes that have exceeded this size.
-.Pp
-Processes that exceed their set
-.Dv RLIMIT_RSS
-are not signalled or halted.
-The limit is merely a hint to the VM daemon to prefer to deactivate pages from
-processes that have exceeded their set
-.Dv RLIMIT_RSS .
-.It Dv RLIMIT_SBSIZE
-The maximum size (in bytes) of socket buffer usage for this user.
-This limits the amount of network memory, and hence the amount of
-mbufs, that this user may hold at any time.
-.It Dv RLIMIT_STACK
-The maximum size (in bytes) of the stack segment for a process;
-this defines how far a program's stack segment may be extended.
-Stack extension is performed automatically by the system.
-.It Dv RLIMIT_SWAP
-The maximum size (in bytes) of the swap space that may be reserved or
-used by all of this user id's processes.
-This limit is enforced only if bit 1 of the
-.Va vm.overcommit
-sysctl is set.
-Please see
-.Xr tuning 7
-for a complete description of this sysctl.
-.It Dv RLIMIT_VMEM
-An alias for
-.Dv RLIMIT_AS .
-.El
-.Pp
-A resource limit is specified as a soft limit and a hard limit.
-When a soft limit is exceeded, a process might or might not receive a signal.
-For example, signals are generated when the cpu time or file size is exceeded,
-but not if the address space or RSS limit is exceeded.
-A program that exceeds the soft limit is allowed to continue execution until it
-reaches the hard limit, or modifies its own resource limit.
-Even reaching the hard limit does not necessarily halt a process.
-For example, if the RSS hard limit is exceeded, nothing happens.
-.Pp
-The
-.Vt rlimit
-structure is used to specify the hard and soft limits on a resource.
-.Bd -literal -offset indent
-struct rlimit {
- rlim_t rlim_cur; /* current (soft) limit */
- rlim_t rlim_max; /* maximum value for rlim_cur */
-};
-.Ed
-.Pp
-Only the super-user may raise the maximum limits.
-Other users
-may only alter
-.Fa rlim_cur
-within the range from 0 to
-.Fa rlim_max
-or (irreversibly) lower
-.Fa rlim_max .
-.Pp
-An
-.Dq infinite
-value for a limit is defined as
-.Dv RLIM_INFINITY .
-.Pp
-Because this information is stored in the per-process information,
-this system call must be executed directly by the shell if it
-is to affect all future processes created by the shell;
-.Ic limit
-is thus a built-in command to
-.Xr csh 1 .
-.Pp
-The system refuses to extend the data or stack space when the limits
-would be exceeded in the normal way: a
-.Xr brk 2
-function fails if the data space limit is reached.
-When the stack limit is reached, the process receives
-a segmentation fault
-.Pq Dv SIGSEGV ;
-if this signal is not
-caught by a handler using the signal stack, this signal
-will kill the process.
-.Pp
-A file I/O operation that would create a file larger that the process'
-soft limit will cause the write to fail and a signal
-.Dv SIGXFSZ
-to be
-generated; this normally terminates the process, but may be caught.
-When
-the soft cpu time limit is exceeded, a
-.Dv SIGXCPU
-signal is sent to the
-offending process.
-.Pp
-When most operations would allocate more virtual memory than allowed by the
-soft limit of
-.Dv RLIMIT_AS ,
-the operation fails with
-.Dv ENOMEM
-and no signal is raised.
-A notable exception is stack extension, described above.
-If stack extension would allocate more virtual memory than allowed by the soft
-limit of
-.Dv RLIMIT_AS ,
-a
-.Dv SIGSEGV
-signal will be delivered.
-The caller is free to raise the soft address space limit up to the hard limit
-and retry the allocation.
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-The
-.Fn getrlimit
-and
-.Fn setrlimit
-system calls
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EFAULT
-The address specified for
-.Fa rlp
-is invalid.
-.It Bq Er EPERM
-The limit specified to
-.Fn setrlimit
-would have
-raised the maximum limit value, and the caller is not the super-user.
-.El
-.Sh SEE ALSO
-.Xr csh 1 ,
-.Xr quota 1 ,
-.Xr quotactl 2 ,
-.Xr sigaction 2 ,
-.Xr sigaltstack 2 ,
-.Xr sysctl 3 ,
-.Xr ulimit 3
-.Sh HISTORY
-The
-.Fn getrlimit
-system call appeared in
-.Bx 4.2 .
diff --git a/lib/libc/sys/getrusage.2 b/lib/libc/sys/getrusage.2
deleted file mode 100644
index 84a0eb20f242..000000000000
--- a/lib/libc/sys/getrusage.2
+++ /dev/null
@@ -1,186 +0,0 @@
-.\" Copyright (c) 1985, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)getrusage.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd May 1, 2010
-.Dt GETRUSAGE 2
-.Os
-.Sh NAME
-.Nm getrusage
-.Nd get information about resource utilization
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In sys/time.h
-.In sys/resource.h
-.Fd "#define RUSAGE_SELF 0"
-.Fd "#define RUSAGE_CHILDREN -1"
-.Fd "#define RUSAGE_THREAD 1"
-.Ft int
-.Fn getrusage "int who" "struct rusage *rusage"
-.Sh DESCRIPTION
-The
-.Fn getrusage
-system call
-returns information describing the resources utilized by the current
-thread, the current process, or all its terminated child processes.
-The
-.Fa who
-argument is either
-.Dv RUSAGE_THREAD ,
-.Dv RUSAGE_SELF ,
-or
-.Dv RUSAGE_CHILDREN .
-The buffer to which
-.Fa rusage
-points will be filled in with
-the following structure:
-.Bd -literal
-struct rusage {
- struct timeval ru_utime; /* user time used */
- struct timeval ru_stime; /* system time used */
- long ru_maxrss; /* max resident set size */
- long ru_ixrss; /* integral shared text memory size */
- long ru_idrss; /* integral unshared data size */
- long ru_isrss; /* integral unshared stack size */
- long ru_minflt; /* page reclaims */
- long ru_majflt; /* page faults */
- long ru_nswap; /* swaps */
- long ru_inblock; /* block input operations */
- long ru_oublock; /* block output operations */
- long ru_msgsnd; /* messages sent */
- long ru_msgrcv; /* messages received */
- long ru_nsignals; /* signals received */
- long ru_nvcsw; /* voluntary context switches */
- long ru_nivcsw; /* involuntary context switches */
-};
-.Ed
-.Pp
-The fields are interpreted as follows:
-.Bl -tag -width ru_minfltaa
-.It Fa ru_utime
-the total amount of time spent executing in user mode.
-.It Fa ru_stime
-the total amount of time spent in the system executing on behalf
-of the process(es).
-.It Fa ru_maxrss
-the maximum resident set size utilized (in kilobytes).
-.It Fa ru_ixrss
-an
-.Dq integral
-value indicating the amount of memory used
-by the text segment
-that was also shared among other processes.
-This value is expressed
-in units of kilobytes * ticks-of-execution.
-Ticks are statistics clock ticks.
-The statistics clock has a frequency of
-.Fn sysconf _SC_CLK_TCK
-ticks per second.
-.It Fa ru_idrss
-an integral value of the amount of unshared memory residing in the
-data segment of a process (expressed in units of
-kilobytes * ticks-of-execution).
-.It Fa ru_isrss
-an integral value of the amount of unshared memory residing in the
-stack segment of a process (expressed in units of
-kilobytes * ticks-of-execution).
-.It Fa ru_minflt
-the number of page faults serviced without any I/O activity; here
-I/O activity is avoided by
-.Dq reclaiming
-a page frame from
-the list of pages awaiting reallocation.
-.It Fa ru_majflt
-the number of page faults serviced that required I/O activity.
-.It Fa ru_nswap
-the number of times a process was
-.Dq swapped
-out of main
-memory.
-.It Fa ru_inblock
-the number of times the file system had to perform input.
-.It Fa ru_oublock
-the number of times the file system had to perform output.
-.It Fa ru_msgsnd
-the number of IPC messages sent.
-.It Fa ru_msgrcv
-the number of IPC messages received.
-.It Fa ru_nsignals
-the number of signals delivered.
-.It Fa ru_nvcsw
-the number of times a context switch resulted due to a process
-voluntarily giving up the processor before its time slice was
-completed (usually to await availability of a resource).
-.It Fa ru_nivcsw
-the number of times a context switch resulted due to a higher
-priority process becoming runnable or because the current process
-exceeded its time slice.
-.El
-.Sh NOTES
-The numbers
-.Fa ru_inblock
-and
-.Fa ru_oublock
-account only for real
-I/O; data supplied by the caching mechanism is charged only
-to the first process to read or write the data.
-.Sh RETURN VALUES
-.Rv -std getrusage
-.Sh ERRORS
-The
-.Fn getrusage
-system call will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Fa who
-argument is not a valid value.
-.It Bq Er EFAULT
-The address specified by the
-.Fa rusage
-argument is not in a valid part of the process address space.
-.El
-.Sh SEE ALSO
-.Xr gettimeofday 2 ,
-.Xr wait 2 ,
-.Xr clocks 7
-.Sh HISTORY
-The
-.Fn getrusage
-system call appeared in
-.Bx 4.2 .
-The
-.Dv RUSAGE_THREAD
-facility first appeared in
-.Fx 8.1 .
-.Sh BUGS
-There is no way to obtain information about a child process
-that has not yet terminated.
diff --git a/lib/libc/sys/getsid.2 b/lib/libc/sys/getsid.2
deleted file mode 100644
index 8d3107439601..000000000000
--- a/lib/libc/sys/getsid.2
+++ /dev/null
@@ -1,82 +0,0 @@
-.\" Copyright (c) 1997 Peter Wemm <peter@FreeBSD.org>
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd August 19, 1997
-.Dt GETSID 2
-.Os
-.Sh NAME
-.Nm getsid
-.Nd get process session
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft pid_t
-.Fn getsid "pid_t pid"
-.Sh DESCRIPTION
-The session ID of the process identified by
-.Fa pid
-is returned by
-.Fn getsid .
-If
-.Fa pid
-is zero,
-.Fn getsid
-returns the session ID of the current process.
-.Sh RETURN VALUES
-Upon successful completion, the
-.Fn getsid
-system call
-returns the session ID of
-the specified process; otherwise, it returns a value of -1 and
-sets errno to indicate an error.
-.Sh ERRORS
-The
-.Fn getsid
-system call
-will succeed unless:
-.Bl -tag -width Er
-.It Bq Er ESRCH
-if there is no process with a process ID equal to
-.Fa pid .
-.El
-.Pp
-Note that an implementation may restrict this system call to
-processes within the same session ID as the calling process.
-.Sh SEE ALSO
-.Xr getpgid 2 ,
-.Xr getpgrp 2 ,
-.Xr setpgid 2 ,
-.Xr setsid 2 ,
-.Xr termios 4
-.Sh HISTORY
-The
-.Fn getsid
-system call appeared in
-.Fx 3.0 .
-The
-.Fn getsid
-system call is derived from its usage in
-.At V .
diff --git a/lib/libc/sys/getsockname.2 b/lib/libc/sys/getsockname.2
deleted file mode 100644
index e11fbdd0954d..000000000000
--- a/lib/libc/sys/getsockname.2
+++ /dev/null
@@ -1,98 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)getsockname.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd June 4, 1993
-.Dt GETSOCKNAME 2
-.Os
-.Sh NAME
-.Nm getsockname
-.Nd get socket name
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In sys/socket.h
-.Ft int
-.Fn getsockname "int s" "struct sockaddr * restrict name" "socklen_t * restrict namelen"
-.Sh DESCRIPTION
-The
-.Fn getsockname
-system call
-returns the current
-.Fa name
-for the specified socket.
-The
-.Fa namelen
-argument should be initialized to indicate
-the amount of space pointed to by
-.Fa name .
-On return it contains the actual size of the name
-returned (in bytes).
-.Sh RETURN VALUES
-.Rv -std getsockname
-.Sh ERRORS
-The call succeeds unless:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The argument
-.Fa s
-is not a valid descriptor.
-.It Bq Er ECONNRESET
-The connection has been reset by the peer.
-.It Bq Er EINVAL
-The value of the
-.Fa namelen
-argument is not valid.
-.It Bq Er ENOTSOCK
-The argument
-.Fa s
-is a file, not a socket.
-.It Bq Er ENOBUFS
-Insufficient resources were available in the system
-to perform the operation.
-.It Bq Er EFAULT
-The
-.Fa name
-argument points to memory not in a valid part of the
-process address space.
-.El
-.Sh SEE ALSO
-.Xr bind 2 ,
-.Xr getpeername 2 ,
-.Xr socket 2
-.Sh HISTORY
-The
-.Fn getsockname
-system call appeared in
-.Bx 4.2 .
-.Sh BUGS
-Names bound to sockets in the UNIX domain are inaccessible;
-.Fn getsockname
-returns a zero length name.
diff --git a/lib/libc/sys/getsockopt.2 b/lib/libc/sys/getsockopt.2
deleted file mode 100644
index 3ff971a0e5db..000000000000
--- a/lib/libc/sys/getsockopt.2
+++ /dev/null
@@ -1,625 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)getsockopt.2 8.4 (Berkeley) 5/2/95
-.\" $FreeBSD$
-.\"
-.Dd February 8, 2021
-.Dt GETSOCKOPT 2
-.Os
-.Sh NAME
-.Nm getsockopt ,
-.Nm setsockopt
-.Nd get and set options on sockets
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In sys/socket.h
-.Ft int
-.Fn getsockopt "int s" "int level" "int optname" "void * restrict optval" "socklen_t * restrict optlen"
-.Ft int
-.Fn setsockopt "int s" "int level" "int optname" "const void *optval" "socklen_t optlen"
-.Sh DESCRIPTION
-The
-.Fn getsockopt
-and
-.Fn setsockopt
-system calls
-manipulate the
-.Em options
-associated with a socket.
-Options may exist at multiple
-protocol levels; they are always present at the uppermost
-.Dq socket
-level.
-.Pp
-When manipulating socket options the level at which the
-option resides and the name of the option must be specified.
-To manipulate options at the socket level,
-.Fa level
-is specified as
-.Dv SOL_SOCKET .
-To manipulate options at any
-other level the protocol number of the appropriate protocol
-controlling the option is supplied.
-For example,
-to indicate that an option is to be interpreted by the
-.Tn TCP
-protocol,
-.Fa level
-should be set to the protocol number of
-.Tn TCP ;
-see
-.Xr getprotoent 3 .
-.Pp
-The
-.Fa optval
-and
-.Fa optlen
-arguments
-are used to access option values for
-.Fn setsockopt .
-For
-.Fn getsockopt
-they identify a buffer in which the value for the
-requested option(s) are to be returned.
-For
-.Fn getsockopt ,
-.Fa optlen
-is a value-result argument, initially containing the
-size of the buffer pointed to by
-.Fa optval ,
-and modified on return to indicate the actual size of
-the value returned.
-If no option value is
-to be supplied or returned,
-.Fa optval
-may be NULL.
-.Pp
-The
-.Fa optname
-argument
-and any specified options are passed uninterpreted to the appropriate
-protocol module for interpretation.
-The include file
-.In sys/socket.h
-contains definitions for
-socket level options, described below.
-Options at other protocol levels vary in format and
-name; consult the appropriate entries in
-section
-4 of the manual.
-.Pp
-Most socket-level options utilize an
-.Vt int
-argument for
-.Fa optval .
-For
-.Fn setsockopt ,
-the argument should be non-zero to enable a boolean option,
-or zero if the option is to be disabled.
-.Dv SO_LINGER
-uses a
-.Vt "struct linger"
-argument, defined in
-.In sys/socket.h ,
-which specifies the desired state of the option and the
-linger interval (see below).
-.Dv SO_SNDTIMEO
-and
-.Dv SO_RCVTIMEO
-use a
-.Vt "struct timeval"
-argument, defined in
-.In sys/time.h .
-.Pp
-The following options are recognized at the socket level.
-For protocol-specific options, see protocol manual pages,
-e.g.
-.Xr ip 4
-or
-.Xr tcp 4 .
-Except as noted, each may be examined with
-.Fn getsockopt
-and set with
-.Fn setsockopt .
-.Bl -column SO_ACCEPTFILTER -offset indent
-.It Dv SO_DEBUG Ta "enables recording of debugging information"
-.It Dv SO_REUSEADDR Ta "enables local address reuse"
-.It Dv SO_REUSEPORT Ta "enables duplicate address and port bindings"
-.It Dv SO_REUSEPORT_LB Ta "enables duplicate address and port bindings with load balancing"
-.It Dv SO_KEEPALIVE Ta "enables keep connections alive"
-.It Dv SO_DONTROUTE Ta "enables routing bypass for outgoing messages"
-.It Dv SO_LINGER Ta "linger on close if data present"
-.It Dv SO_BROADCAST Ta "enables permission to transmit broadcast messages"
-.It Dv SO_OOBINLINE Ta "enables reception of out-of-band data in band"
-.It Dv SO_SNDBUF Ta "set buffer size for output"
-.It Dv SO_RCVBUF Ta "set buffer size for input"
-.It Dv SO_SNDLOWAT Ta "set minimum count for output"
-.It Dv SO_RCVLOWAT Ta "set minimum count for input"
-.It Dv SO_SNDTIMEO Ta "set timeout value for output"
-.It Dv SO_RCVTIMEO Ta "set timeout value for input"
-.It Dv SO_ACCEPTFILTER Ta "set accept filter on listening socket"
-.It Dv SO_NOSIGPIPE Ta
-controls generation of
-.Dv SIGPIPE
-for the socket
-.It Dv SO_TIMESTAMP Ta "enables reception of a timestamp with datagrams"
-.It Dv SO_BINTIME Ta "enables reception of a timestamp with datagrams"
-.It Dv SO_ACCEPTCONN Ta "get listening status of the socket (get only)"
-.It Dv SO_DOMAIN Ta "get the domain of the socket (get only)"
-.It Dv SO_TYPE Ta "get the type of the socket (get only)"
-.It Dv SO_PROTOCOL Ta "get the protocol number for the socket (get only)"
-.It Dv SO_PROTOTYPE Ta "SunOS alias for the Linux SO_PROTOCOL (get only)"
-.It Dv SO_ERROR Ta "get and clear error on the socket (get only)"
-.It Dv SO_RERROR Ta "enables receive error reporting"
-.It Dv SO_SETFIB Ta "set the associated FIB (routing table) for the socket (set only)"
-.El
-.Pp
-The following options are recognized in
-.Fx :
-.Bl -column SO_LISTENINCQLEN -offset indent
-.It Dv SO_LABEL Ta "get MAC label of the socket (get only)"
-.It Dv SO_PEERLABEL Ta "get socket's peer's MAC label (get only)"
-.It Dv SO_LISTENQLIMIT Ta "get backlog limit of the socket (get only)"
-.It Dv SO_LISTENQLEN Ta "get complete queue length of the socket (get only)"
-.It Dv SO_LISTENINCQLEN Ta "get incomplete queue length of the socket (get only)"
-.It Dv SO_USER_COOKIE Ta "set the 'so_user_cookie' value for the socket (uint32_t, set only)"
-.It Dv SO_TS_CLOCK Ta "set specific format of timestamp returned by SO_TIMESTAMP"
-.It Dv SO_MAX_PACING_RATE Ta "set the maximum transmit rate in bytes per second for the socket"
-.It Dv SO_NO_OFFLOAD Ta "disables protocol offloads"
-.It Dv SO_NO_DDP Ta "disables direct data placement offload"
-.El
-.Pp
-.Dv SO_DEBUG
-enables debugging in the underlying protocol modules.
-.Pp
-.Dv SO_REUSEADDR
-indicates that the rules used in validating addresses supplied
-in a
-.Xr bind 2
-system call should allow reuse of local addresses.
-.Pp
-.Dv SO_REUSEPORT
-allows completely duplicate bindings by multiple processes
-if they all set
-.Dv SO_REUSEPORT
-before binding the port.
-This option permits multiple instances of a program to each
-receive UDP/IP multicast or broadcast datagrams destined for the bound port.
-.Pp
-.Dv SO_REUSEPORT_LB
-allows completely duplicate bindings by multiple processes
-if they all set
-.Dv SO_REUSEPORT_LB
-before binding the port.
-Incoming TCP and UDP connections are distributed among the sharing
-processes based on a hash function of local port number, foreign IP
-address and port number.
-A maximum of 256 processes can share one socket.
-.Pp
-.Dv SO_KEEPALIVE
-enables the
-periodic transmission of messages on a connected socket.
-Should the
-connected party fail to respond to these messages, the connection is
-considered broken and processes using the socket are notified via a
-.Dv SIGPIPE
-signal when attempting to send data.
-.Pp
-.Dv SO_DONTROUTE
-indicates that outgoing messages should
-bypass the standard routing facilities.
-Instead, messages are directed
-to the appropriate network interface according to the network portion
-of the destination address.
-.Pp
-.Dv SO_LINGER
-controls the action taken when unsent messages
-are queued on socket and a
-.Xr close 2
-is performed.
-If the socket promises reliable delivery of data and
-.Dv SO_LINGER
-is set,
-the system will block the process on the
-.Xr close 2
-attempt until it is able to transmit the data or until it decides it
-is unable to deliver the information (a timeout period, termed the
-linger interval, is specified in seconds in the
-.Fn setsockopt
-system call when
-.Dv SO_LINGER
-is requested).
-If
-.Dv SO_LINGER
-is disabled and a
-.Xr close 2
-is issued, the system will process the close in a manner that allows
-the process to continue as quickly as possible.
-.Pp
-The option
-.Dv SO_BROADCAST
-requests permission to send broadcast datagrams
-on the socket.
-Broadcast was a privileged operation in earlier versions of the system.
-.Pp
-With protocols that support out-of-band data, the
-.Dv SO_OOBINLINE
-option
-requests that out-of-band data be placed in the normal data input queue
-as received; it will then be accessible with
-.Xr recv 2
-or
-.Xr read 2
-calls without the
-.Dv MSG_OOB
-flag.
-Some protocols always behave as if this option is set.
-.Pp
-.Dv SO_SNDBUF
-and
-.Dv SO_RCVBUF
-are options to adjust the normal
-buffer sizes allocated for output and input buffers, respectively.
-The buffer size may be increased for high-volume connections,
-or may be decreased to limit the possible backlog of incoming data.
-The system places an absolute maximum on these values, which is accessible
-through the
-.Xr sysctl 3
-MIB variable
-.Dq Li kern.ipc.maxsockbuf .
-.Pp
-.Dv SO_SNDLOWAT
-is an option to set the minimum count for output operations.
-Most output operations process all of the data supplied
-by the call, delivering data to the protocol for transmission
-and blocking as necessary for flow control.
-Nonblocking output operations will process as much data as permitted
-subject to flow control without blocking, but will process no data
-if flow control does not allow the smaller of the low water mark value
-or the entire request to be processed.
-A
-.Xr select 2
-operation testing the ability to write to a socket will return true
-only if the low water mark amount could be processed.
-The default value for
-.Dv SO_SNDLOWAT
-is set to a convenient size for network efficiency, often 1024.
-.Pp
-.Dv SO_RCVLOWAT
-is an option to set the minimum count for input operations.
-In general, receive calls will block until any (non-zero) amount of data
-is received, then return with the smaller of the amount available or the amount
-requested.
-The default value for
-.Dv SO_RCVLOWAT
-is 1.
-If
-.Dv SO_RCVLOWAT
-is set to a larger value, blocking receive calls normally
-wait until they have received the smaller of the low water mark value
-or the requested amount.
-Receive calls may still return less than the low water mark if an error
-occurs, a signal is caught, or the type of data next in the receive queue
-is different from that which was returned.
-.Pp
-.Dv SO_SNDTIMEO
-is an option to set a timeout value for output operations.
-It accepts a
-.Vt "struct timeval"
-argument with the number of seconds and microseconds
-used to limit waits for output operations to complete.
-If a send operation has blocked for this much time,
-it returns with a partial count
-or with the error
-.Er EWOULDBLOCK
-if no data were sent.
-In the current implementation, this timer is restarted each time additional
-data are delivered to the protocol,
-implying that the limit applies to output portions ranging in size
-from the low water mark to the high water mark for output.
-.Pp
-.Dv SO_RCVTIMEO
-is an option to set a timeout value for input operations.
-It accepts a
-.Vt "struct timeval"
-argument with the number of seconds and microseconds
-used to limit waits for input operations to complete.
-In the current implementation, this timer is restarted each time additional
-data are received by the protocol,
-and thus the limit is in effect an inactivity timer.
-If a receive operation has been blocked for this much time without
-receiving additional data, it returns with a short count
-or with the error
-.Er EWOULDBLOCK
-if no data were received.
-.Pp
-.Dv SO_SETFIB
-can be used to over-ride the default FIB (routing table) for the given socket.
-The value must be from 0 to one less than the number returned from
-the sysctl
-.Em net.fibs .
-.Pp
-.Dv SO_USER_COOKIE
-can be used to set the uint32_t so_user_cookie field in the socket.
-The value is an uint32_t, and can be used in the kernel code that
-manipulates traffic related to the socket.
-The default value for the field is 0.
-As an example, the value can be used as the skipto target or
-pipe number in
-.Nm ipfw/dummynet .
-.Pp
-.Dv SO_ACCEPTFILTER
-places an
-.Xr accept_filter 9
-on the socket,
-which will filter incoming connections
-on a listening stream socket before being presented for
-.Xr accept 2 .
-Once more,
-.Xr listen 2
-must be called on the socket before
-trying to install the filter on it,
-or else the
-.Fn setsockopt
-system call will fail.
-.Bd -literal
-struct accept_filter_arg {
- char af_name[16];
- char af_arg[256-16];
-};
-.Ed
-.Pp
-The
-.Fa optval
-argument
-should point to a
-.Fa struct accept_filter_arg
-that will select and configure the
-.Xr accept_filter 9 .
-The
-.Fa af_name
-argument
-should be filled with the name of the accept filter
-that the application wishes to place on the listening socket.
-The optional argument
-.Fa af_arg
-can be passed to the accept
-filter specified by
-.Fa af_name
-to provide additional configuration options at attach time.
-Passing in an
-.Fa optval
-of NULL will remove the filter.
-.Pp
-The
-.Dv SO_NOSIGPIPE
-option controls generation of the
-.Dv SIGPIPE
-signal normally sent
-when writing to a connected socket where the other end has been
-closed returns with the error
-.Er EPIPE .
-.Pp
-If the
-.Dv SO_TIMESTAMP
-or
-.Dv SO_BINTIME
-option is enabled on a
-.Dv SOCK_DGRAM
-socket, the
-.Xr recvmsg 2
-call may return a timestamp corresponding to when the datagram was received.
-However, it may not, for example due to a resource shortage.
-The
-.Va msg_control
-field in the
-.Vt msghdr
-structure points to a buffer that contains a
-.Vt cmsghdr
-structure followed by a
-.Vt "struct timeval"
-for
-.Dv SO_TIMESTAMP
-and
-.Vt "struct bintime"
-for
-.Dv SO_BINTIME .
-The
-.Vt cmsghdr
-fields have the following values for TIMESTAMP by default:
-.Bd -literal
- cmsg_len = CMSG_LEN(sizeof(struct timeval));
- cmsg_level = SOL_SOCKET;
- cmsg_type = SCM_TIMESTAMP;
-.Ed
-.Pp
-and for
-.Dv SO_BINTIME :
-.Bd -literal
- cmsg_len = CMSG_LEN(sizeof(struct bintime));
- cmsg_level = SOL_SOCKET;
- cmsg_type = SCM_BINTIME;
-.Ed
-.Pp
-Additional timestamp types are available by following
-.Dv SO_TIMESTAMP
-with
-.Dv SO_TS_CLOCK ,
-which requests a specific timestamp format to be returned instead of
-.Dv SCM_TIMESTAMP when
-.Dv SO_TIMESTAMP is enabled.
-These
-.Dv SO_TS_CLOCK
-values are recognized in
-.Fx :
-.Bl -column SO_TS_CLOCK -offset indent
-.It Dv SO_TS_REALTIME_MICRO Ta "realtime (SCM_TIMESTAMP, struct timeval), default"
-.It Dv SO_TS_BINTIME Ta "realtime (SCM_BINTIME, struct bintime)"
-.It Dv SO_TS_REALTIME Ta "realtime (SCM_REALTIME, struct timespec)"
-.It Dv SO_TS_MONOTONIC Ta "monotonic time (SCM_MONOTONIC, struct timespec)"
-.El
-.Pp
-.Dv SO_ACCEPTCONN ,
-.Dv SO_TYPE ,
-.Dv SO_PROTOCOL
-(and its alias
-.Dv SO_PROTOTYPE )
-and
-.Dv SO_ERROR
-are options used only with
-.Fn getsockopt .
-.Dv SO_ACCEPTCONN
-returns whether the socket is currently accepting connections,
-that is, whether or not the
-.Xr listen 2
-system call was invoked on the socket.
-.Dv SO_TYPE
-returns the type of the socket, such as
-.Dv SOCK_STREAM ;
-it is useful for servers that inherit sockets on startup.
-.Dv SO_PROTOCOL
-returns the protocol number for the socket, for
-.Dv AF_INET
-and
-.Dv AF_INET6
-address families.
-.Dv SO_ERROR
-returns any pending error on the socket and clears
-the error status.
-It may be used to check for asynchronous errors on connected
-datagram sockets or for other asynchronous errors.
-.Dv SO_RERROR
-indicates that receive buffer overflows should be handled as errors.
-Historically receive buffer overflows have been ignored and programs
-could not tell if they missed messages or messages had been truncated
-because of overflows.
-Since programs historically do not expect to get receive overflow errors,
-this behavior is not the default.
-.Pp
-.Dv SO_LABEL
-returns the MAC label of the socket.
-.Dv SO_PEERLABEL
-returns the MAC label of the socket's peer.
-Note that your kernel must be compiled with MAC support.
-See
-.Xr mac 3
-for more information.
-.Pp
-.Dv SO_LISTENQLIMIT
-returns the maximal number of queued connections, as set by
-.Xr listen 2 .
-.Dv SO_LISTENQLEN
-returns the number of unaccepted complete connections.
-.Dv SO_LISTENINCQLEN
-returns the number of unaccepted incomplete connections.
-.Pp
-.Dv SO_MAX_PACING_RATE
-instruct the socket and underlying network adapter layers to limit the
-transfer rate to the given unsigned 32-bit value in bytes per second.
-.Pp
-.Dv SO_NO_OFFLOAD
-disables support for protocol offloads.
-At present, this prevents TCP sockets from using TCP offload engines.
-.Dv SO_NO_DDP
-disables support for a specific TCP offload known as direct data
-placement (DDP).
-DDP is an offload supported by Chelsio network adapters that permits
-reassembled TCP data streams to be received via zero-copy in
-user-supplied buffers using
-.Xr aio_read 2 .
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-The
-.Fn getsockopt
-and
-.Fn setsockopt
-system calls succeed unless:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The argument
-.Fa s
-is not a valid descriptor.
-.It Bq Er ENOTSOCK
-The argument
-.Fa s
-is a file, not a socket.
-.It Bq Er ENOPROTOOPT
-The option is unknown at the level indicated.
-.It Bq Er EFAULT
-The address pointed to by
-.Fa optval
-is not in a valid part of the process address space.
-For
-.Fn getsockopt ,
-this error may also be returned if
-.Fa optlen
-is not in a valid part of the process address space.
-.It Bq Er EINVAL
-Installing an
-.Xr accept_filter 9
-on a non-listening socket was attempted.
-.It Bq Er ENOMEM
-A memory allocation failed that was required to service the request.
-.El
-.Pp
-The
-.Fn setsockopt
-system call may also return the following error:
-.Bl -tag -width Er
-.It Bq Er ENOBUFS
-Insufficient resources were available in the system
-to perform the operation.
-.El
-.Sh SEE ALSO
-.Xr ioctl 2 ,
-.Xr listen 2 ,
-.Xr recvmsg 2 ,
-.Xr socket 2 ,
-.Xr getprotoent 3 ,
-.Xr mac 3 ,
-.Xr sysctl 3 ,
-.Xr ip 4 ,
-.Xr ip6 4 ,
-.Xr sctp 4 ,
-.Xr tcp 4 ,
-.Xr protocols 5 ,
-.Xr sysctl 8 ,
-.Xr accept_filter 9 ,
-.Xr bintime 9
-.Sh HISTORY
-The
-.Fn getsockopt
-and
-.Fn setsockopt
-system calls appeared in
-.Bx 4.2 .
-.Sh BUGS
-Several of the socket options should be handled at lower levels of the system.
diff --git a/lib/libc/sys/gettimeofday.2 b/lib/libc/sys/gettimeofday.2
deleted file mode 100644
index 08e3979149e7..000000000000
--- a/lib/libc/sys/gettimeofday.2
+++ /dev/null
@@ -1,131 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)gettimeofday.2 8.2 (Berkeley) 5/26/95
-.\" $FreeBSD$
-.\"
-.Dd May 13, 2021
-.Dt GETTIMEOFDAY 2
-.Os
-.Sh NAME
-.Nm gettimeofday ,
-.Nm settimeofday
-.Nd get/set date and time
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/time.h
-.Ft int
-.Fn gettimeofday "struct timeval *tp" "struct timezone *tzp"
-.Ft int
-.Fn settimeofday "const struct timeval *tp" "const struct timezone *tzp"
-.Sh DESCRIPTION
-The system's notion of the current Greenwich time and the current time
-zone is obtained with the
-.Fn gettimeofday
-system call, and set with the
-.Fn settimeofday
-system call.
-The time is expressed in seconds and microseconds
-since midnight (0 hour), January 1, 1970.
-The resolution of the system
-clock is hardware dependent, and the time may be updated continuously or
-in
-.Dq ticks .
-If
-.Fa tp
-or
-.Fa tzp
-is NULL, the associated time
-information will not be returned or set.
-.Pp
-The structures pointed to by
-.Fa tp
-and
-.Fa tzp
-are defined in
-.In sys/time.h
-as:
-.Bd -literal
-struct timeval {
- time_t tv_sec; /* seconds */
- suseconds_t tv_usec; /* and microseconds */
-};
-
-struct timezone {
- int tz_minuteswest; /* minutes west of Greenwich */
- int tz_dsttime; /* type of dst correction */
-};
-.Ed
-.Pp
-The
-.Vt timezone
-structure indicates the local time zone
-(measured in minutes of time westward from Greenwich),
-and a flag that, if nonzero, indicates that
-Daylight Saving time applies locally during
-the appropriate part of the year.
-The kernel generally does not track these values and they
-are usually returned as zero.
-Use
-.Xr localtime 3
-to find the offset for the currently active timezone.
-.Pp
-Only the super-user may set the time of day or time zone.
-If the system is running at securelevel >= 2 (see
-.Xr init 8 ) ,
-the time may only be advanced or retarded by a maximum of one second.
-This limitation is imposed to prevent a malicious super-user
-from setting arbitrary time stamps on files.
-The system time can be adjusted backwards without restriction using the
-.Xr adjtime 2
-system call even when the system is secure.
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-The following error codes may be set in
-.Va errno :
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The supplied
-.Fa timeval
-value is invalid.
-.It Bq Er EPERM
-A user other than the super-user attempted to set the time.
-.El
-.Sh SEE ALSO
-.Xr date 1 ,
-.Xr adjtime 2 ,
-.Xr clock_gettime 2 ,
-.Xr ctime 3 ,
-.Xr timeradd 3 ,
-.Xr clocks 7
-.Sh HISTORY
-The
-.Fn gettimeofday
-system call appeared in
-.Bx 4.2 .
diff --git a/lib/libc/sys/gettimeofday.c b/lib/libc/sys/gettimeofday.c
deleted file mode 100644
index f24cd41269db..000000000000
--- a/lib/libc/sys/gettimeofday.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 2012 Konstantin Belousov <kib@FreeBSD.org>
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/syscall.h>
-#include <sys/time.h>
-#include <sys/vdso.h>
-#include <errno.h>
-#include "libc_private.h"
-
-int __gettimeofday(struct timeval *tv, struct timezone *tz);
-
-__weak_reference(__gettimeofday, gettimeofday);
-
-int
-__gettimeofday(struct timeval *tv, struct timezone *tz)
-{
- int error;
-
- error = __vdso_gettimeofday(tv, tz);
- if (error == ENOSYS)
- error = __sys_gettimeofday(tv, tz);
- return (error);
-}
diff --git a/lib/libc/sys/getuid.2 b/lib/libc/sys/getuid.2
deleted file mode 100644
index c0b06db21afd..000000000000
--- a/lib/libc/sys/getuid.2
+++ /dev/null
@@ -1,91 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)getuid.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd December 1, 2017
-.Dt GETUID 2
-.Os
-.Sh NAME
-.Nm getuid ,
-.Nm geteuid
-.Nd get user identification
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft uid_t
-.Fn getuid void
-.Ft uid_t
-.Fn geteuid void
-.Sh DESCRIPTION
-The
-.Fn getuid
-system call returns the real user ID of the calling process.
-The
-.Fn geteuid
-system call
-returns the effective user ID of the calling process.
-.Pp
-The real user ID is that of the user who has invoked the program.
-As the effective user ID
-gives the process additional permissions during
-execution of
-.Dq Em set-user-ID
-mode processes,
-.Fn getuid
-is used to determine the real-user-id of the calling process.
-.Sh ERRORS
-The
-.Fn getuid
-and
-.Fn geteuid
-system calls are always successful, and no return value is reserved to
-indicate an error.
-.Sh SEE ALSO
-.Xr getgid 2 ,
-.Xr issetugid 2 ,
-.Xr setgid 2 ,
-.Xr setreuid 2 ,
-.Xr setuid 2
-.Sh STANDARDS
-The
-.Fn geteuid
-and
-.Fn getuid
-system calls are expected to conform to
-.St -p1003.1-90 .
-.Sh HISTORY
-The
-.Fn getuid
-function appeared in
-.At v1 .
-The
-.Fn geteuid
-function appeared in
-.At v4 .
diff --git a/lib/libc/sys/interposing_table.c b/lib/libc/sys/interposing_table.c
deleted file mode 100644
index b2cfb3250cd9..000000000000
--- a/lib/libc/sys/interposing_table.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2014 The FreeBSD Foundation.
- * All rights reserved.
- *
- * Portions of this software were developed by Konstantin Belousov
- * under sponsorship from the FreeBSD Foundation.
- *
- * 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(s), this list of conditions and the following disclaimer as
- * the first lines of this file unmodified other than the possible
- * addition of one or more copyright notices.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice(s), 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 HOLDER(S) ``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(S) 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include "libc_private.h"
-
-#define SLOT(a, b) \
- [INTERPOS_##a] = (interpos_func_t)b
-interpos_func_t __libc_interposing[INTERPOS_MAX] = {
- SLOT(accept, __sys_accept),
- SLOT(accept4, __sys_accept4),
- SLOT(aio_suspend, __sys_aio_suspend),
- SLOT(close, __sys_close),
- SLOT(connect, __sys_connect),
- SLOT(fcntl, __sys_fcntl),
- SLOT(fsync, __sys_fsync),
- SLOT(fork, __sys_fork),
- SLOT(msync, __sys_msync),
- SLOT(nanosleep, __sys_nanosleep),
- SLOT(openat, __sys_openat),
- SLOT(poll, __sys_poll),
- SLOT(pselect, __sys_pselect),
- SLOT(read, __sys_read),
- SLOT(readv, __sys_readv),
- SLOT(recvfrom, __sys_recvfrom),
- SLOT(recvmsg, __sys_recvmsg),
- SLOT(select, __sys_select),
- SLOT(sendmsg, __sys_sendmsg),
- SLOT(sendto, __sys_sendto),
- SLOT(setcontext, __sys_setcontext),
- SLOT(sigaction, __sys_sigaction),
- SLOT(sigprocmask, __sys_sigprocmask),
- SLOT(sigsuspend, __sys_sigsuspend),
- SLOT(sigwait, __libc_sigwait),
- SLOT(sigtimedwait, __sys_sigtimedwait),
- SLOT(sigwaitinfo, __sys_sigwaitinfo),
- SLOT(swapcontext, __sys_swapcontext),
- SLOT(system, __libc_system),
- SLOT(tcdrain, __libc_tcdrain),
- SLOT(wait4, __sys_wait4),
- SLOT(write, __sys_write),
- SLOT(writev, __sys_writev),
- SLOT(_pthread_mutex_init_calloc_cb, _pthread_mutex_init_calloc_cb_stub),
- SLOT(spinlock, __libc_spinlock_stub),
- SLOT(spinunlock, __libc_spinunlock_stub),
- SLOT(kevent, __sys_kevent),
- SLOT(wait6, __sys_wait6),
- SLOT(ppoll, __sys_ppoll),
- SLOT(map_stacks_exec, __libc_map_stacks_exec),
- SLOT(fdatasync, __sys_fdatasync),
- SLOT(clock_nanosleep, __sys_clock_nanosleep),
- SLOT(distribute_static_tls, __libc_distribute_static_tls),
- SLOT(pdfork, __sys_pdfork),
-};
-#undef SLOT
-
-interpos_func_t *
-__libc_interposing_slot(int interposno)
-{
-
- return (&__libc_interposing[interposno]);
-}
diff --git a/lib/libc/sys/intro.2 b/lib/libc/sys/intro.2
deleted file mode 100644
index 7ae16728c4a9..000000000000
--- a/lib/libc/sys/intro.2
+++ /dev/null
@@ -1,768 +0,0 @@
-.\" Copyright (c) 1980, 1983, 1986, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)intro.2 8.5 (Berkeley) 2/27/95
-.\" $FreeBSD$
-.\"
-.Dd September 8, 2016
-.Dt INTRO 2
-.Os
-.Sh NAME
-.Nm intro
-.Nd introduction to system calls and error numbers
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In errno.h
-.Sh DESCRIPTION
-This section provides an overview of the system calls,
-their error returns, and other common definitions and concepts.
-.\".Pp
-.\".Sy System call restart
-.\".Pp
-.\"(more later...)
-.Sh RETURN VALUES
-Nearly all of the system calls provide an error number referenced via
-the external identifier errno.
-This identifier is defined in
-.In sys/errno.h
-as
-.Pp
-.Dl extern int * __error();
-.Dl #define errno (* __error())
-.Pp
-The
-.Va __error()
-function returns a pointer to a field in the thread specific structure for
-threads other than the initial thread.
-For the initial thread and
-non-threaded processes,
-.Va __error()
-returns a pointer to a global
-.Va errno
-variable that is compatible with the previous definition.
-.Pp
-When a system call detects an error,
-it returns an integer value
-indicating failure (usually -1)
-and sets the variable
-.Va errno
-accordingly.
-(This allows interpretation of the failure on receiving
-a -1 and to take action accordingly.)
-Successful calls never set
-.Va errno ;
-once set, it remains until another error occurs.
-It should only be examined after an error.
-Note that a number of system calls overload the meanings of these
-error numbers, and that the meanings must be interpreted according
-to the type and circumstances of the call.
-.Pp
-The following is a complete list of the errors and their
-names as given in
-.In sys/errno.h .
-.Bl -hang -width Ds
-.It Er 0 Em "Undefined error: 0" .
-Not used.
-.It Er 1 EPERM Em "Operation not permitted" .
-An attempt was made to perform an operation limited to processes
-with appropriate privileges or to the owner of a file or other
-resources.
-.It Er 2 ENOENT Em "No such file or directory" .
-A component of a specified pathname did not exist, or the
-pathname was an empty string.
-.It Er 3 ESRCH Em "No such process" .
-No process could be found corresponding to that specified by the given
-process ID.
-.It Er 4 EINTR Em "Interrupted system call" .
-An asynchronous signal (such as
-.Dv SIGINT
-or
-.Dv SIGQUIT )
-was caught by the process during the execution of an interruptible
-function.
-If the signal handler performs a normal return, the
-interrupted system call will seem to have returned the error condition.
-.It Er 5 EIO Em "Input/output error" .
-Some physical input or output error occurred.
-This error will not be reported until a subsequent operation on the same file
-descriptor and may be lost (over written) by any subsequent errors.
-.It Er 6 ENXIO Em "Device not configured" .
-Input or output on a special file referred to a device that did not
-exist, or
-made a request beyond the limits of the device.
-This error may also occur when, for example,
-a tape drive is not online or no disk pack is
-loaded on a drive.
-.It Er 7 E2BIG Em "Argument list too long" .
-The number of bytes used for the argument and environment
-list of the new process exceeded the current limit
-.Dv ( NCARGS
-in
-.In sys/param.h ) .
-.It Er 8 ENOEXEC Em "Exec format error" .
-A request was made to execute a file
-that, although it has the appropriate permissions,
-was not in the format required for an
-executable file.
-.It Er 9 EBADF Em "Bad file descriptor" .
-A file descriptor argument was out of range, referred to no open file,
-or a read (write) request was made to a file that was only open for
-writing (reading).
-.It Er 10 ECHILD Em "\&No child processes" .
-A
-.Xr wait 2
-or
-.Xr waitpid 2
-function was executed by a process that had no existing or unwaited-for
-child processes.
-.It Er 11 EDEADLK Em "Resource deadlock avoided" .
-An attempt was made to lock a system resource that
-would have resulted in a deadlock situation.
-.It Er 12 ENOMEM Em "Cannot allocate memory" .
-The new process image required more memory than was allowed by the hardware
-or by system-imposed memory management constraints.
-A lack of swap space is normally temporary; however,
-a lack of core is not.
-Soft limits may be increased to their corresponding hard limits.
-.It Er 13 EACCES Em "Permission denied" .
-An attempt was made to access a file in a way forbidden
-by its file access permissions.
-.It Er 14 EFAULT Em "Bad address" .
-The system detected an invalid address in attempting to
-use an argument of a call.
-.It Er 15 ENOTBLK Em "Block device required" .
-A block device operation was attempted on a non-block device or file.
-.It Er 16 EBUSY Em "Device busy" .
-An attempt to use a system resource which was in use at the time
-in a manner which would have conflicted with the request.
-.It Er 17 EEXIST Em "File exists" .
-An existing file was mentioned in an inappropriate context,
-for instance, as the new link name in a
-.Xr link 2
-system call.
-.It Er 18 EXDEV Em "Cross-device link" .
-A hard link to a file on another file system
-was attempted.
-.It Er 19 ENODEV Em "Operation not supported by device" .
-An attempt was made to apply an inappropriate
-function to a device,
-for example,
-trying to read a write-only device such as a printer.
-.It Er 20 ENOTDIR Em "Not a directory" .
-A component of the specified pathname existed, but it was
-not a directory, when a directory was expected.
-.It Er 21 EISDIR Em "Is a directory" .
-An attempt was made to open a directory with write mode specified.
-.It Er 22 EINVAL Em "Invalid argument" .
-Some invalid argument was supplied.
-(For example,
-specifying an undefined signal to a
-.Xr signal 3
-function
-or a
-.Xr kill 2
-system call).
-.It Er 23 ENFILE Em "Too many open files in system" .
-Maximum number of open files allowable on the system
-has been reached and requests for an open cannot be satisfied
-until at least one has been closed.
-.It Er 24 EMFILE Em "Too many open files" .
-Maximum number of file descriptors allowable in the process
-has been reached and requests for an open cannot be satisfied
-until at least one has been closed.
-The
-.Xr getdtablesize 2
-system call will obtain the current limit.
-.It Er 25 ENOTTY Em "Inappropriate ioctl for device" .
-A control function (see
-.Xr ioctl 2 )
-was attempted for a file or
-special device for which the operation was inappropriate.
-.It Er 26 ETXTBSY Em "Text file busy" .
-The new process was a pure procedure (shared text) file
-which was open for writing by another process, or
-while the pure procedure file was being executed an
-.Xr open 2
-call requested write access.
-.It Er 27 EFBIG Em "File too large" .
-The size of a file exceeded the maximum.
-.It Er 28 ENOSPC Em "No space left on device" .
-A
-.Xr write 2
-to an ordinary file, the creation of a
-directory or symbolic link, or the creation of a directory
-entry failed because no more disk blocks were available
-on the file system, or the allocation of an inode for a newly
-created file failed because no more inodes were available
-on the file system.
-.It Er 29 ESPIPE Em "Illegal seek" .
-An
-.Xr lseek 2
-system call was issued on a socket, pipe or
-.Tn FIFO .
-.It Er 30 EROFS Em "Read-only file system" .
-An attempt was made to modify a file or directory
-on a file system that was read-only at the time.
-.It Er 31 EMLINK Em "Too many links" .
-Maximum allowable hard links to a single file has been exceeded (limit
-of 32767 hard links per file).
-.It Er 32 EPIPE Em "Broken pipe" .
-A write on a pipe, socket or
-.Tn FIFO
-for which there is no process
-to read the data.
-.It Er 33 EDOM Em "Numerical argument out of domain" .
-A numerical input argument was outside the defined domain of the mathematical
-function.
-.It Er 34 ERANGE Em "Result too large" .
-A numerical result of the function was too large to fit in the
-available space (perhaps exceeded precision).
-.It Er 35 EAGAIN Em "Resource temporarily unavailable" .
-This is a temporary condition and later calls to the
-same routine may complete normally.
-.It Er 36 EINPROGRESS Em "Operation now in progress" .
-An operation that takes a long time to complete (such as
-a
-.Xr connect 2 )
-was attempted on a non-blocking object (see
-.Xr fcntl 2 ) .
-.It Er 37 EALREADY Em "Operation already in progress" .
-An operation was attempted on a non-blocking object that already
-had an operation in progress.
-.It Er 38 ENOTSOCK Em "Socket operation on non-socket" .
-Self-explanatory.
-.It Er 39 EDESTADDRREQ Em "Destination address required" .
-A required address was omitted from an operation on a socket.
-.It Er 40 EMSGSIZE Em "Message too long" .
-A message sent on a socket was larger than the internal message buffer
-or some other network limit.
-.It Er 41 EPROTOTYPE Em "Protocol wrong type for socket" .
-A protocol was specified that does not support the semantics of the
-socket type requested.
-For example, you cannot use the
-.Tn ARPA
-Internet
-.Tn UDP
-protocol with type
-.Dv SOCK_STREAM .
-.It Er 42 ENOPROTOOPT Em "Protocol not available" .
-A bad option or level was specified in a
-.Xr getsockopt 2
-or
-.Xr setsockopt 2
-call.
-.It Er 43 EPROTONOSUPPORT Em "Protocol not supported" .
-The protocol has not been configured into the
-system or no implementation for it exists.
-.It Er 44 ESOCKTNOSUPPORT Em "Socket type not supported" .
-The support for the socket type has not been configured into the
-system or no implementation for it exists.
-.It Er 45 EOPNOTSUPP Em "Operation not supported" .
-The attempted operation is not supported for the type of object referenced.
-Usually this occurs when a file descriptor refers to a file or socket
-that cannot support this operation,
-for example, trying to
-.Em accept
-a connection on a datagram socket.
-.It Er 46 EPFNOSUPPORT Em "Protocol family not supported" .
-The protocol family has not been configured into the
-system or no implementation for it exists.
-.It Er 47 EAFNOSUPPORT Em "Address family not supported by protocol family" .
-An address incompatible with the requested protocol was used.
-For example, you should not necessarily expect to be able to use
-.Tn NS
-addresses with
-.Tn ARPA
-Internet protocols.
-.It Er 48 EADDRINUSE Em "Address already in use" .
-Only one usage of each address is normally permitted.
-.It Er 49 EADDRNOTAVAIL Em "Can't assign requested address" .
-Normally results from an attempt to create a socket with an
-address not on this machine.
-.It Er 50 ENETDOWN Em "Network is down" .
-A socket operation encountered a dead network.
-.It Er 51 ENETUNREACH Em "Network is unreachable" .
-A socket operation was attempted to an unreachable network.
-.It Er 52 ENETRESET Em "Network dropped connection on reset" .
-The host you were connected to crashed and rebooted.
-.It Er 53 ECONNABORTED Em "Software caused connection abort" .
-A connection abort was caused internal to your host machine.
-.It Er 54 ECONNRESET Em "Connection reset by peer" .
-A connection was forcibly closed by a peer.
-This normally
-results from a loss of the connection on the remote socket
-due to a timeout or a reboot.
-.It Er 55 ENOBUFS Em "\&No buffer space available" .
-An operation on a socket or pipe was not performed because
-the system lacked sufficient buffer space or because a queue was full.
-.It Er 56 EISCONN Em "Socket is already connected" .
-A
-.Xr connect 2
-request was made on an already connected socket; or,
-a
-.Xr sendto 2
-or
-.Xr sendmsg 2
-request on a connected socket specified a destination
-when already connected.
-.It Er 57 ENOTCONN Em "Socket is not connected" .
-An request to send or receive data was disallowed because
-the socket was not connected and (when sending on a datagram socket)
-no address was supplied.
-.It Er 58 ESHUTDOWN Em "Can't send after socket shutdown" .
-A request to send data was disallowed because the socket
-had already been shut down with a previous
-.Xr shutdown 2
-call.
-.It Er 60 ETIMEDOUT Em "Operation timed out" .
-A
-.Xr connect 2
-or
-.Xr send 2
-request failed because the connected party did not
-properly respond after a period of time.
-(The timeout
-period is dependent on the communication protocol.)
-.It Er 61 ECONNREFUSED Em "Connection refused" .
-No connection could be made because the target machine actively
-refused it.
-This usually results from trying to connect
-to a service that is inactive on the foreign host.
-.It Er 62 ELOOP Em "Too many levels of symbolic links" .
-A path name lookup involved more than 32
-.Pq Dv MAXSYMLINKS
-symbolic links.
-.It Er 63 ENAMETOOLONG Em "File name too long" .
-A component of a path name exceeded
-.Brq Dv NAME_MAX
-characters, or an entire
-path name exceeded
-.Brq Dv PATH_MAX
-characters.
-(See also the description of
-.Dv _PC_NO_TRUNC
-in
-.Xr pathconf 2 . )
-.It Er 64 EHOSTDOWN Em "Host is down" .
-A socket operation failed because the destination host was down.
-.It Er 65 EHOSTUNREACH Em "No route to host" .
-A socket operation was attempted to an unreachable host.
-.It Er 66 ENOTEMPTY Em "Directory not empty" .
-A directory with entries other than
-.Ql .\&
-and
-.Ql ..\&
-was supplied to a remove directory or rename call.
-.It Er 67 EPROCLIM Em "Too many processes" .
-.It Er 68 EUSERS Em "Too many users" .
-The quota system ran out of table entries.
-.It Er 69 EDQUOT Em "Disc quota exceeded" .
-A
-.Xr write 2
-to an ordinary file, the creation of a
-directory or symbolic link, or the creation of a directory
-entry failed because the user's quota of disk blocks was
-exhausted, or the allocation of an inode for a newly
-created file failed because the user's quota of inodes
-was exhausted.
-.It Er 70 ESTALE Em "Stale NFS file handle" .
-An attempt was made to access an open file (on an
-.Tn NFS
-file system)
-which is now unavailable as referenced by the file descriptor.
-This may indicate the file was deleted on the
-.Tn NFS
-server or some
-other catastrophic event occurred.
-.It Er 72 EBADRPC Em "RPC struct is bad" .
-Exchange of
-.Tn RPC
-information was unsuccessful.
-.It Er 73 ERPCMISMATCH Em "RPC version wrong" .
-The version of
-.Tn RPC
-on the remote peer is not compatible with
-the local version.
-.It Er 74 EPROGUNAVAIL Em "RPC prog. not avail" .
-The requested program is not registered on the remote host.
-.It Er 75 EPROGMISMATCH Em "Program version wrong" .
-The requested version of the program is not available
-on the remote host
-.Pq Tn RPC .
-.It Er 76 EPROCUNAVAIL Em "Bad procedure for program" .
-An
-.Tn RPC
-call was attempted for a procedure which does not exist
-in the remote program.
-.It Er 77 ENOLCK Em "No locks available" .
-A system-imposed limit on the number of simultaneous file
-locks was reached.
-.It Er 78 ENOSYS Em "Function not implemented" .
-Attempted a system call that is not available on this
-system.
-.It Er 79 EFTYPE Em "Inappropriate file type or format" .
-The file was the wrong type for the operation, or a data file had
-the wrong format.
-.It Er 80 EAUTH Em "Authentication error" .
-Attempted to use an invalid authentication ticket to mount a
-.Tn NFS
-file system.
-.It Er 81 ENEEDAUTH Em "Need authenticator" .
-An authentication ticket must be obtained before the given
-.Tn NFS
-file system may be mounted.
-.It Er 82 EIDRM Em "Identifier removed" .
-An IPC identifier was removed while the current process was waiting on it.
-.It Er 83 ENOMSG Em "No message of desired type" .
-An IPC message queue does not contain a message of the desired type, or a
-message catalog does not contain the requested message.
-.It Er 84 EOVERFLOW Em "Value too large to be stored in data type" .
-A numerical result of the function was too large to be stored in the caller
-provided space.
-.It Er 85 ECANCELED Em "Operation canceled" .
-The scheduled operation was canceled.
-.It Er 86 EILSEQ Em "Illegal byte sequence" .
-While decoding a multibyte character the function came along an
-invalid or an incomplete sequence of bytes or the given wide
-character is invalid.
-.It Er 87 ENOATTR Em "Attribute not found" .
-The specified extended attribute does not exist.
-.It Er 88 EDOOFUS Em "Programming error" .
-A function or API is being abused in a way which could only be detected
-at run-time.
-.It Er 89 EBADMSG Em "Bad message" .
-A corrupted message was detected.
-.It Er 90 EMULTIHOP Em "Multihop attempted" .
-This error code is unused, but present for compatibility with other systems.
-.It Er 91 ENOLINK Em "Link has been severed" .
-This error code is unused, but present for compatibility with other systems.
-.It Er 92 EPROTO Em "Protocol error" .
-A device or socket encountered an unrecoverable protocol error.
-.It Er 93 ENOTCAPABLE Em "Capabilities insufficient" .
-An operation on a capability file descriptor requires greater privilege than
-the capability allows.
-.It Er 94 ECAPMODE Em "Not permitted in capability mode" .
-The system call or operation is not permitted for capability mode processes.
-.It Er 95 ENOTRECOVERABLE Em "State not recoverable" .
-The state protected by a robust mutex is not recoverable.
-.It Er 96 EOWNERDEAD Em "Previous owner died" .
-The owner of a robust mutex terminated while holding the mutex lock.
-.It Er 97 EINTEGRITY Em "Integrity check failed" .
-An integrity check such as a check-hash or a cross-correlation failed.
-The integrity error falls between
-.Er EINVAL
-that identifies errors in parameters to a system call and
-.Er EIO
-that identifies errors with the underlying storage media.
-It is typically raised by intermediate kernel layers such as a
-filesystem or an in-kernel GEOM subsystem when they detect inconsistencies.
-Uses include allowing the
-.Xr mount 8
-command to return a different exit value to automate the running of
-.Xr fsck 8
-during a system boot.
-.El
-.Sh DEFINITIONS
-.Bl -tag -width Ds
-.It Process ID .
-Each active process in the system is uniquely identified by a non-negative
-integer called a process ID.
-The range of this ID is from 0 to 99999.
-.It Parent process ID
-A new process is created by a currently active process (see
-.Xr fork 2 ) .
-The parent process ID of a process is initially the process ID of its creator.
-If the creating process exits,
-the parent process ID of each child is set to the ID of the calling process's
-reaper (see
-.Xr procctl 2 ) ,
-normally
-.Xr init 8 .
-.It Process Group
-Each active process is a member of a process group that is identified by
-a non-negative integer called the process group ID.
-This is the process
-ID of the group leader.
-This grouping permits the signaling of related
-processes (see
-.Xr termios 4 )
-and the job control mechanisms of
-.Xr csh 1 .
-.It Session
-A session is a set of one or more process groups.
-A session is created by a successful call to
-.Xr setsid 2 ,
-which causes the caller to become the only member of the only process
-group in the new session.
-.It Session leader
-A process that has created a new session by a successful call to
-.Xr setsid 2 ,
-is known as a session leader.
-Only a session leader may acquire a terminal as its controlling terminal (see
-.Xr termios 4 ) .
-.It Controlling process
-A session leader with a controlling terminal is a controlling process.
-.It Controlling terminal
-A terminal that is associated with a session is known as the controlling
-terminal for that session and its members.
-.It "Terminal Process Group ID"
-A terminal may be acquired by a session leader as its controlling terminal.
-Once a terminal is associated with a session, any of the process groups
-within the session may be placed into the foreground by setting
-the terminal process group ID to the ID of the process group.
-This facility is used
-to arbitrate between multiple jobs contending for the same terminal;
-(see
-.Xr csh 1
-and
-.Xr tty 4 ) .
-.It "Orphaned Process Group"
-A process group is considered to be
-.Em orphaned
-if it is not under the control of a job control shell.
-More precisely, a process group is orphaned
-when none of its members has a parent process that is in the same session
-as the group,
-but is in a different process group.
-Note that when a process exits, the parent process for its children
-is normally changed to be
-.Xr init 8 ,
-which is in a separate session.
-Not all members of an orphaned process group are necessarily orphaned
-processes (those whose creating process has exited).
-The process group of a session leader is orphaned by definition.
-.It "Real User ID and Real Group ID"
-Each user on the system is identified by a positive integer
-termed the real user ID.
-.Pp
-Each user is also a member of one or more groups.
-One of these groups is distinguished from others and
-used in implementing accounting facilities.
-The positive
-integer corresponding to this distinguished group is termed
-the real group ID.
-.Pp
-All processes have a real user ID and real group ID.
-These are initialized from the equivalent attributes
-of the process that created it.
-.It "Effective User Id, Effective Group Id, and Group Access List"
-Access to system resources is governed by two values:
-the effective user ID, and the group access list.
-The first member of the group access list is also known as the
-effective group ID.
-(In POSIX.1, the group access list is known as the set of supplementary
-group IDs, and it is unspecified whether the effective group ID is
-a member of the list.)
-.Pp
-The effective user ID and effective group ID are initially the
-process's real user ID and real group ID respectively.
-Either
-may be modified through execution of a set-user-ID or set-group-ID
-file (possibly by one its ancestors) (see
-.Xr execve 2 ) .
-By convention, the effective group ID (the first member of the group access
-list) is duplicated, so that the execution of a set-group-ID program
-does not result in the loss of the original (real) group ID.
-.Pp
-The group access list is a set of group IDs
-used only in determining resource accessibility.
-Access checks
-are performed as described below in ``File Access Permissions''.
-.It "Saved Set User ID and Saved Set Group ID"
-When a process executes a new file, the effective user ID is set
-to the owner of the file if the file is set-user-ID, and the effective
-group ID (first element of the group access list) is set to the group
-of the file if the file is set-group-ID.
-The effective user ID of the process is then recorded as the saved set-user-ID,
-and the effective group ID of the process is recorded as the saved set-group-ID.
-These values may be used to regain those values as the effective user
-or group ID after reverting to the real ID (see
-.Xr setuid 2 ) .
-(In POSIX.1, the saved set-user-ID and saved set-group-ID are optional,
-and are used in setuid and setgid, but this does not work as desired
-for the super-user.)
-.It Super-user
-A process is recognized as a
-.Em super-user
-process and is granted special privileges if its effective user ID is 0.
-.It Descriptor
-An integer assigned by the system when a file is referenced
-by
-.Xr open 2
-or
-.Xr dup 2 ,
-or when a socket is created by
-.Xr pipe 2 ,
-.Xr socket 2
-or
-.Xr socketpair 2 ,
-which uniquely identifies an access path to that file or socket from
-a given process or any of its children.
-.It File Name
-Names consisting of up to
-.Brq Dv NAME_MAX
-characters may be used to name
-an ordinary file, special file, or directory.
-.Pp
-These characters may be arbitrary eight-bit values,
-excluding
-.Dv NUL
-.Tn ( ASCII
-0) and the
-.Ql \&/
-character (slash,
-.Tn ASCII
-47).
-.Pp
-Note that it is generally unwise to use
-.Ql \&* ,
-.Ql \&? ,
-.Ql \&[
-or
-.Ql \&]
-as part of
-file names because of the special meaning attached to these characters
-by the shell.
-.It Path Name
-A path name is a
-.Dv NUL Ns -terminated
-character string starting with an
-optional slash
-.Ql \&/ ,
-followed by zero or more directory names separated
-by slashes, optionally followed by a file name.
-The total length of a path name must be less than
-.Brq Dv PATH_MAX
-characters.
-(On some systems, this limit may be infinite.)
-.Pp
-If a path name begins with a slash, the path search begins at the
-.Em root
-directory.
-Otherwise, the search begins from the current working directory.
-A slash by itself names the root directory.
-An empty
-pathname refers to the current directory.
-.It Directory
-A directory is a special type of file that contains entries
-that are references to other files.
-Directory entries are called links.
-By convention, a directory
-contains at least two links,
-.Ql .\&
-and
-.Ql \&.. ,
-referred to as
-.Em dot
-and
-.Em dot-dot
-respectively.
-Dot refers to the directory itself and
-dot-dot refers to its parent directory.
-.It "Root Directory and Current Working Directory"
-Each process has associated with it a concept of a root directory
-and a current working directory for the purpose of resolving path
-name searches.
-A process's root directory need not be the root
-directory of the root file system.
-.It File Access Permissions
-Every file in the file system has a set of access permissions.
-These permissions are used in determining whether a process
-may perform a requested operation on the file (such as opening
-a file for writing).
-Access permissions are established at the
-time a file is created.
-They may be changed at some later time
-through the
-.Xr chmod 2
-call.
-.Pp
-File access is broken down according to whether a file may be: read,
-written, or executed.
-Directory files use the execute
-permission to control if the directory may be searched.
-.Pp
-File access permissions are interpreted by the system as
-they apply to three different classes of users: the owner
-of the file, those users in the file's group, anyone else.
-Every file has an independent set of access permissions for
-each of these classes.
-When an access check is made, the system
-decides if permission should be granted by checking the access
-information applicable to the caller.
-.Pp
-Read, write, and execute/search permissions on
-a file are granted to a process if:
-.Pp
-The process's effective user ID is that of the super-user.
-(Note:
-even the super-user cannot execute a non-executable file.)
-.Pp
-The process's effective user ID matches the user ID of the owner
-of the file and the owner permissions allow the access.
-.Pp
-The process's effective user ID does not match the user ID of the
-owner of the file, and either the process's effective
-group ID matches the group ID
-of the file, or the group ID of the file is in
-the process's group access list,
-and the group permissions allow the access.
-.Pp
-Neither the effective user ID nor effective group ID
-and group access list of the process
-match the corresponding user ID and group ID of the file,
-but the permissions for ``other users'' allow access.
-.Pp
-Otherwise, permission is denied.
-.It Sockets and Address Families
-A socket is an endpoint for communication between processes.
-Each socket has queues for sending and receiving data.
-.Pp
-Sockets are typed according to their communications properties.
-These properties include whether messages sent and received
-at a socket require the name of the partner, whether communication
-is reliable, the format used in naming message recipients, etc.
-.Pp
-Each instance of the system supports some
-collection of socket types; consult
-.Xr socket 2
-for more information about the types available and
-their properties.
-.Pp
-Each instance of the system supports some number of sets of
-communications protocols.
-Each protocol set supports addresses
-of a certain format.
-An Address Family is the set of addresses
-for a specific group of protocols.
-Each socket has an address
-chosen from the address family in which the socket was created.
-.El
-.Sh SEE ALSO
-.Xr intro 3 ,
-.Xr perror 3
diff --git a/lib/libc/sys/ioctl.2 b/lib/libc/sys/ioctl.2
deleted file mode 100644
index e0c34bd9318b..000000000000
--- a/lib/libc/sys/ioctl.2
+++ /dev/null
@@ -1,155 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)ioctl.2 8.2 (Berkeley) 12/11/93
-.\"
-.\" $FreeBSD$
-.\"
-.Dd September 11, 2013
-.Dt IOCTL 2
-.Os
-.Sh NAME
-.Nm ioctl
-.Nd control device
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/ioctl.h
-.Ft int
-.Fn ioctl "int fd" "unsigned long request" ...
-.Sh DESCRIPTION
-The
-.Fn ioctl
-system call manipulates the underlying device parameters of special files.
-In particular, many operating
-characteristics of character special files (e.g.\& terminals)
-may be controlled with
-.Fn ioctl
-requests.
-The argument
-.Fa fd
-must be an open file descriptor.
-.Pp
-The third argument to
-.Fn ioctl
-is traditionally named
-.Va "char *argp" .
-Most uses of
-.Fn ioctl ,
-however, require the third argument to be a
-.Vt caddr_t
-or an
-.Vt int .
-.Pp
-An
-.Fn ioctl
-.Fa request
-has encoded in it whether the argument is an
-.Dq in
-argument
-or
-.Dq out
-argument, and the size of the argument
-.Fa argp
-in bytes.
-Macros and defines used in specifying an ioctl
-.Fa request
-are located in the file
-.In sys/ioctl.h .
-.Sh GENERIC IOCTLS
-Some generic ioctls are not implemented for all types of file
-descriptors.
-These include:
-.Bl -tag -width "xxxxxx"
-.It Dv FIONREAD int
-Get the number of bytes that are immediately available for reading.
-.It Dv FIONWRITE int
-Get the number of bytes in the descriptor's send queue.
-These bytes are data which has been written to the descriptor but
-which are being held by the kernel for further processing.
-The nature of the required processing depends on the underlying device.
-For TCP sockets, these bytes have not yet been acknowledged by the
-other side of the connection.
-.It Dv FIONSPACE int
-Get the free space in the descriptor's send queue.
-This value is the size of the send queue minus the number of bytes
-being held in the queue.
-Note: while this value represents the number of bytes that may be
-added to the queue, other resource limitations may cause a write
-not larger than the send queue's space to be blocked.
-One such limitation would be a lack of network buffers for a write
-to a network connection.
-.El
-.Sh RETURN VALUES
-If an error has occurred, a value of -1 is returned and
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-The
-.Fn ioctl
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa fd
-argument
-is not a valid descriptor.
-.It Bq Er ENOTTY
-The
-.Fa fd
-argument
-is not associated with a character
-special device.
-.It Bq Er ENOTTY
-The specified request does not apply to the kind
-of object that the descriptor
-.Fa fd
-references.
-.It Bq Er EINVAL
-The
-.Fa request
-or
-.Fa argp
-argument
-is not valid.
-.It Bq Er EFAULT
-The
-.Fa argp
-argument
-points outside the process's allocated address space.
-.El
-.Sh SEE ALSO
-.Xr execve 2 ,
-.Xr fcntl 2 ,
-.Xr intro 4 ,
-.Xr tty 4
-.Sh HISTORY
-The
-.Fn ioctl
-function appeared in
-.At v7 .
diff --git a/lib/libc/sys/issetugid.2 b/lib/libc/sys/issetugid.2
deleted file mode 100644
index 48f6a4b19d49..000000000000
--- a/lib/libc/sys/issetugid.2
+++ /dev/null
@@ -1,98 +0,0 @@
-.\" $OpenBSD: issetugid.2,v 1.7 1997/02/18 00:16:09 deraadt Exp $
-.\"
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd August 25, 1996
-.Dt ISSETUGID 2
-.Os
-.Sh NAME
-.Nm issetugid
-.Nd is current process tainted by uid or gid changes
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn issetugid void
-.Sh DESCRIPTION
-The
-.Fn issetugid
-system call returns 1 if the process environment or memory address space
-is considered
-.Dq tainted ,
-and returns 0 otherwise.
-.Pp
-A process is tainted if it was created as a result of an
-.Xr execve 2
-system call which had either of the setuid or setgid bits set (and extra
-privileges were given as a result) or if it has changed any of its real,
-effective or saved user or group ID's since it began execution.
-.Pp
-This system call exists so that library routines (eg: libc, libtermcap)
-can reliably determine if it is safe to use information
-that was obtained from the user, in particular the results from
-.Xr getenv 3
-should be viewed with suspicion if it is used to control operation.
-.Pp
-A
-.Dq tainted
-status is inherited by child processes as a result of the
-.Xr fork 2
-system call (or other library code that calls fork, such as
-.Xr popen 3 ) .
-.Pp
-It is assumed that a program that clears all privileges as it prepares
-to execute another will also reset the environment, hence the
-.Dq tainted
-status will not be passed on.
-This is important for programs such as
-.Xr su 1
-which begin setuid but need to be able to create an untainted process.
-.Sh ERRORS
-The
-.Fn issetugid
-system call is always successful, and no return value is reserved to
-indicate an error.
-.Sh SEE ALSO
-.Xr execve 2 ,
-.Xr fork 2 ,
-.Xr setegid 2 ,
-.Xr seteuid 2 ,
-.Xr setgid 2 ,
-.Xr setregid 2 ,
-.Xr setreuid 2 ,
-.Xr setuid 2
-.Sh HISTORY
-The
-.Fn issetugid
-system call first appeared in
-.Ox 2.0
-and was also implemented in
-.Fx 3.0 .
diff --git a/lib/libc/sys/jail.2 b/lib/libc/sys/jail.2
deleted file mode 100644
index 82c2e97d4a7b..000000000000
--- a/lib/libc/sys/jail.2
+++ /dev/null
@@ -1,414 +0,0 @@
-.\" Copyright (c) 1999 Poul-Henning Kamp.
-.\" Copyright (c) 2009 James Gritton.
-.\" All rights reserved.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd February 19, 2021
-.Dt JAIL 2
-.Os
-.Sh NAME
-.Nm jail ,
-.Nm jail_get ,
-.Nm jail_set ,
-.Nm jail_remove ,
-.Nm jail_attach
-.Nd create and manage system jails
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/param.h
-.In sys/jail.h
-.Ft int
-.Fn jail "struct jail *jail"
-.Ft int
-.Fn jail_attach "int jid"
-.Ft int
-.Fn jail_remove "int jid"
-.In sys/uio.h
-.Ft int
-.Fn jail_get "struct iovec *iov" "u_int niov" "int flags"
-.Ft int
-.Fn jail_set "struct iovec *iov" "u_int niov" "int flags"
-.Sh DESCRIPTION
-The
-.Fn jail
-system call sets up a jail and locks the current process in it.
-.Pp
-The argument is a pointer to a structure describing the prison:
-.Bd -literal -offset indent
-struct jail {
- uint32_t version;
- char *path;
- char *hostname;
- char *jailname;
- unsigned int ip4s;
- unsigned int ip6s;
- struct in_addr *ip4;
- struct in6_addr *ip6;
-};
-.Ed
-.Pp
-.Dq Li version
-defines the version of the API in use.
-.Dv JAIL_API_VERSION
-is defined for the current version.
-.Pp
-The
-.Dq Li path
-pointer should be set to the directory which is to be the root of the
-prison.
-.Pp
-The
-.Dq Li hostname
-pointer can be set to the hostname of the prison.
-This can be changed
-from the inside of the prison.
-.Pp
-The
-.Dq Li jailname
-pointer is an optional name that can be assigned to the jail
-for example for management purposes.
-.Pp
-The
-.Dq Li ip4s
-and
-.Dq Li ip6s
-give the numbers of IPv4 and IPv6 addresses that will be passed
-via their respective pointers.
-.Pp
-The
-.Dq Li ip4
-and
-.Dq Li ip6
-pointers can be set to an arrays of IPv4 and IPv6 addresses to be assigned to
-the prison, or NULL if none.
-IPv4 addresses must be in network byte order.
-.Pp
-This is equivalent to, and deprecated in favor of, the
-.Fn jail_set
-system call (see below), with the parameters
-.Va path ,
-.Va host.hostname ,
-.Va name ,
-.Va ip4.addr ,
-and
-.Va ip6.addr ,
-and with the
-.Dv JAIL_ATTACH
-flag.
-.Pp
-The
-.Fn jail_set
-system call creates a new jail, or modifies an existing one, and optionally
-locks the current process in it.
-Jail parameters are passed as an array of name-value pairs in the array
-.Fa iov ,
-containing
-.Fa niov
-elements.
-Parameter names are a null-terminated string, and values may be strings,
-integers, or other arbitrary data.
-Some parameters are boolean, and do not have a value (their length is zero)
-but are set by the name alone with or without a
-.Dq no
-prefix, e.g.
-.Va persist
-or
-.Va nopersist .
-Any parameters not set will be given default values, generally based on
-the current environment.
-.Pp
-Jails have a set of core parameters, and modules can add their own jail
-parameters.
-The current set of available parameters, and their formats, can be
-retrieved via the
-.Va security.jail.param
-sysctl MIB entry.
-Notable parameters include those mentioned in the
-.Fn jail
-description above, as well as
-.Va jid
-and
-.Va name ,
-which identify the jail being created or modified.
-See
-.Xr jail 8
-for more information on the core jail parameters.
-.Pp
-The
-.Fa flags
-arguments consists of one or more of the following flags:
-.Bl -tag -width indent
-.It Dv JAIL_CREATE
-Create a new jail.
-If a
-.Va jid
-or
-.Va name
-parameters exists, they must not refer to an existing jail.
-.It Dv JAIL_UPDATE
-Modify an existing jail.
-One of the
-.Va jid
-or
-.Va name
-parameters must exist, and must refer to an existing jail.
-If both
-.Dv JAIL_CREATE
-and
-.Dv JAIL_UPDATE
-are set, a jail will be created if it does not yet exist, and modified if it
-does exist.
-.It Dv JAIL_ATTACH
-In addition to creating or modifying the jail, attach the current process to
-it, as with the
-.Fn jail_attach
-system call.
-.It Dv JAIL_DYING
-Allow setting a jail that is in the process of being removed.
-.El
-.Pp
-The
-.Fn jail_get
-system call retrieves jail parameters, using the same name-value list as
-.Fn jail_set
-in the
-.Fa iov
-and
-.Fa niov
-arguments.
-The jail to read can be specified by either
-.Va jid
-or
-.Va name
-by including those parameters in the list.
-If they are included but are not intended to be the search key, they
-should be cleared (zero and the empty string respectively).
-.Pp
-The special parameter
-.Va lastjid
-can be used to retrieve a list of all jails.
-It will fetch the jail with the jid above and closest to the passed value.
-The first jail (usually but not always jid 1) can be found by passing a
-.Va lastjid
-of zero.
-.Pp
-The
-.Fa flags
-arguments consists of one or more following flags:
-.Bl -tag -width indent
-.It Dv JAIL_DYING
-Allow getting a jail that is in the process of being removed.
-.El
-.Pp
-The
-.Fn jail_attach
-system call attaches the current process to an existing jail,
-identified by
-.Fa jid .
-It changes the process's root and current directories to the jail's
-.Va path
-directory.
-.Pp
-The
-.Fn jail_remove
-system call removes the jail identified by
-.Fa jid .
-It will kill all processes belonging to the jail, and remove any children
-of that jail.
-.Sh RETURN VALUES
-If successful,
-.Fn jail ,
-.Fn jail_set ,
-and
-.Fn jail_get
-return a non-negative integer, termed the jail identifier (JID).
-They return \-1 on failure, and set
-.Va errno
-to indicate the error.
-.Pp
-.Rv -std jail_attach jail_remove
-.Sh ERRORS
-The
-.Fn jail
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EPERM
-This process is not allowed to create a jail, either because it is not
-the super-user, or because it would exceed the jail's
-.Va children.max
-limit.
-.It Bq Er EFAULT
-.Fa jail
-points to an address outside the allocated address space of the process.
-.It Bq Er EINVAL
-The version number of the argument is not correct.
-.It Bq Er EAGAIN
-No free JID could be found.
-.El
-.Pp
-The
-.Fn jail_set
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EPERM
-This process is not allowed to create a jail, either because it is not
-the super-user, or because it would exceed the jail's
-.Va children.max
-limit.
-.It Bq Er EPERM
-A jail parameter was set to a less restrictive value then the current
-environment.
-.It Bq Er EFAULT
-.Fa Iov ,
-or one of the addresses contained within it,
-points to an address outside the allocated address space of the process.
-.It Bq Er ENOENT
-The jail referred to by a
-.Va jid
-or
-.Va name
-parameter does not exist, and the
-.Dv JAIL_CREATE
-flag is not set.
-.It Bq Er ENOENT
-The jail referred to by a
-.Va jid
-is not accessible by the process, because the process is in a different
-jail.
-.It Bq Er EEXIST
-The jail referred to by a
-.Va jid
-or
-.Va name
-parameter exists, and the
-.Dv JAIL_UPDATE
-flag is not set.
-.It Bq Er EINVAL
-A supplied parameter is the wrong size.
-.It Bq Er EINVAL
-A supplied parameter is out of range.
-.It Bq Er EINVAL
-A supplied string parameter is not null-terminated.
-.It Bq Er EINVAL
-A supplied parameter name does not match any known parameters.
-.It Bq Er EINVAL
-One of the
-.Dv JAIL_CREATE
-or
-.Dv JAIL_UPDATE
-flags is not set.
-.It Bq Er ENAMETOOLONG
-A supplied string parameter is longer than allowed.
-.It Bq Er EAGAIN
-There are no jail IDs left.
-.El
-.Pp
-The
-.Fn jail_get
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EFAULT
-.Fa Iov ,
-or one of the addresses contained within it,
-points to an address outside the allocated address space of the process.
-.It Bq Er ENOENT
-The jail referred to by a
-.Va jid
-or
-.Va name
-parameter does not exist.
-.It Bq Er ENOENT
-The jail referred to by a
-.Va jid
-is not accessible by the process, because the process is in a different
-jail.
-.It Bq Er ENOENT
-The
-.Va lastjid
-parameter is greater than the highest current jail ID.
-.It Bq Er EINVAL
-A supplied parameter is the wrong size.
-.It Bq Er EINVAL
-A supplied parameter name does not match any known parameters.
-.El
-.Pp
-The
-.Fn jail_attach
-and
-.Fn jail_remove
-system calls
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EPERM
-A user other than the super-user attempted to attach to or remove a jail.
-.It Bq Er EINVAL
-The jail specified by
-.Fa jid
-does not exist.
-.El
-.Pp
-Further
-.Fn jail ,
-.Fn jail_set ,
-and
-.Fn jail_attach
-call
-.Xr chroot 2
-internally, so they can fail for all the same reasons.
-Please consult the
-.Xr chroot 2
-manual page for details.
-.Sh SEE ALSO
-.Xr chdir 2 ,
-.Xr chroot 2 ,
-.Xr jail 8
-.Sh HISTORY
-The
-.Fn jail
-system call appeared in
-.Fx 4.0 .
-The
-.Fn jail_attach
-system call appeared in
-.Fx 5.1 .
-The
-.Fn jail_set ,
-.Fn jail_get ,
-and
-.Fn jail_remove
-system calls appeared in
-.Fx 8.0 .
-.Sh AUTHORS
-The jail feature was written by
-.An Poul-Henning Kamp
-for R&D Associates
-who contributed it to
-.Fx .
-.An James Gritton
-added the extensible jail parameters and hierarchical jails.
diff --git a/lib/libc/sys/kenv.2 b/lib/libc/sys/kenv.2
deleted file mode 100644
index a1f994569111..000000000000
--- a/lib/libc/sys/kenv.2
+++ /dev/null
@@ -1,193 +0,0 @@
-.\"
-.\" Copyright (C) 2002 Chad David <davidc@FreeBSD.org>. All rights reserved.
-.\"
-.\" 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(s), this list of conditions and the following disclaimer as
-.\" the first lines of this file unmodified other than the possible
-.\" addition of one or more copyright notices.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice(s), 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 HOLDER(S) ``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(S) 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd June 20, 2021
-.Dt KENV 2
-.Os
-.Sh NAME
-.Nm kenv
-.Nd kernel environment
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In kenv.h
-.Ft int
-.Fn kenv "int action" "const char *name" "char *value" "int len"
-.Sh DESCRIPTION
-The
-.Fn kenv
-system call manipulates kernel environment variables.
-It supports the well known userland actions of getting, setting and unsetting
-environment variables, as well as the ability to dump all of the entries in
-the kernel environment.
-.Pp
-The
-.Fa action
-argument can be one of the following:
-.Bl -tag -width ".Dv KENV_DUMP_LOADER"
-.It Dv KENV_GET
-Get the
-.Fa value
-of the variable with the given
-.Fa name .
-The size of the
-.Fa value
-buffer is given by
-.Fa len ,
-which should be at least
-.Dv KENV_MVALLEN
-+ 1 bytes to avoid truncation and to ensure NUL termination.
-.It Dv KENV_SET
-Set or add a variable.
-The
-.Fa name
-and
-.Fa value
-are limited to
-.Dv KENV_MNAMELEN
-and
-.Dv KENV_MVALLEN
-characters, respectively
-.Pq not including the NUL terminator.
-The
-.Fa len
-argument indicates the length of the
-.Fa value
-and must include the NUL terminator.
-This option is only available to the superuser.
-.It Dv KENV_UNSET
-Unset the variable with the given
-.Fa name .
-The
-.Fa value
-and
-.Fa len
-arguments are ignored.
-This option is only available to the superuser.
-.It Dv KENV_DUMP
-Dump as much of the dynamic kernel environment as will fit in
-.Fa value ,
-whose size is given in
-.Fa len .
-If
-.Fa value
-is
-.Dv NULL ,
-.Fn kenv
-will return the number of bytes required to copy out the entire environment.
-The
-.Fa name
-is ignored.
-.It Dv KENV_DUMP_LOADER
-Dump the static environment provided by
-.Xr loader 8 ,
-with semantics identical to
-.Dv KENV_DUMP .
-Duplicate and malformed variables originally present in this environment are
-discarded by the kernel and will not appear in the output.
-.It Dv KENV_DUMP_STATIC
-Dump the static environment defined by the kernel
-.Xr config 5 .
-The semantics are identical to
-.Dv KENV_DUMP_LOADER .
-.El
-.Sh RETURN VALUES
-The
-.Fn kenv
-system call returns 0 if successful in the case of
-.Dv KENV_SET
-and
-.Dv KENV_UNSET ,
-and the number of bytes copied into
-.Fa value
-in the case of
-.Dv KENV_DUMP
-and
-.Dv KENV_GET .
-If an error occurs, a value of \-1 is returned and
-the global variable
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-The
-.Fn kenv
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Fa action
-argument
-is not a valid option, or the length of the
-.Fa value
-is less than 1 for a
-.Dv KENV_SET .
-.It Bq Er ENOENT
-No value could be found for
-.Fa name
-for a
-.Dv KENV_GET
-or
-.Dv KENV_UNSET .
-.It Bq Er ENOENT
-The requested environment is not available for a
-.Dv KENV_DUMP_LOADER
-or
-.Dv KENV_DUMP_STATIC .
-The kernel is configured to destroy these environments by default.
-.It Bq Er EPERM
-A user other than the superuser attempted to set or unset a kernel
-environment variable.
-.It Bq Er EFAULT
-A bad address was encountered while attempting to copy in user arguments
-or copy out value(s).
-.It Bq Er ENAMETOOLONG
-The
-.Fa name
-or the
-.Fa value
-is longer than
-.Dv KENV_MNAMELEN
-or
-.Dv KENV_MVALLEN
-characters, respectively, or
-.Fa len
-did not include the NUL terminator for a
-.Dv KENV_SET .
-.El
-.Sh SEE ALSO
-.Xr kenv 1
-.Sh AUTHORS
-.An -nosplit
-This manual page was written by
-.An Chad David Aq Mt davidc@FreeBSD.org .
-.Pp
-The
-.Fn kenv
-system call was written by
-.An Maxime Henrion Aq Mt mux@FreeBSD.org .
diff --git a/lib/libc/sys/kevent.c b/lib/libc/sys/kevent.c
index 5f84ef8b10a6..f16ac89a36c6 100644
--- a/lib/libc/sys/kevent.c
+++ b/lib/libc/sys/kevent.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2015 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/event.h>
#include <sys/time.h>
@@ -45,9 +41,6 @@ int
kevent(int kq, const struct kevent *changelist, int nchanges,
struct kevent *eventlist, int nevents, const struct timespec *timeout)
{
-
- return (((int (*)(int, const struct kevent *, int,
- struct kevent *, int, const struct timespec *))
- __libc_interposing[INTERPOS_kevent])(kq, changelist, nchanges,
- eventlist, nevents, timeout));
+ return (INTERPOS_SYS(kevent, kq, changelist, nchanges, eventlist,
+ nevents, timeout));
}
diff --git a/lib/libc/sys/kill.2 b/lib/libc/sys/kill.2
deleted file mode 100644
index 2a2b548ef476..000000000000
--- a/lib/libc/sys/kill.2
+++ /dev/null
@@ -1,159 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)kill.2 8.3 (Berkeley) 4/19/94
-.\" $FreeBSD$
-.\"
-.Dd December 1, 2019
-.Dt KILL 2
-.Os
-.Sh NAME
-.Nm kill
-.Nd send signal to a process
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In signal.h
-.Ft int
-.Fn kill "pid_t pid" "int sig"
-.Sh DESCRIPTION
-The
-.Fn kill
-system call sends the signal given by
-.Fa sig
-to
-.Fa pid ,
-a
-process or a group of processes.
-The
-.Fa sig
-argument
-may be one of the signals specified in
-.Xr sigaction 2
-or it may be 0, in which case
-error checking is performed but no
-signal is actually sent.
-This can be used to check the validity of
-.Fa pid .
-.Pp
-For a process to have permission to send a signal to a process designated
-by
-.Fa pid ,
-the user must be the super-user, or
-the real or saved user ID of the receiving process must match
-the real or effective user ID of the sending process.
-A single exception is the signal SIGCONT, which may always be sent
-to any process with the same session ID as the sender.
-In addition, if the
-.Va security.bsd.conservative_signals
-.Xr sysctl 9
-is set to 1, the user is not a super-user, and
-the receiver is set-uid, then
-only job control and terminal control signals may
-be sent (in particular, only SIGKILL, SIGINT, SIGTERM, SIGALRM,
-SIGSTOP, SIGTTIN, SIGTTOU, SIGTSTP, SIGHUP, SIGUSR1, SIGUSR2).
-.Bl -tag -width Ds
-.It \&If Fa pid No \&is greater than zero :
-The
-.Fa sig
-signal
-is sent to the process whose ID is equal to
-.Fa pid .
-.It \&If Fa pid No \&is zero :
-The
-.Fa sig
-signal
-is sent to all processes whose group ID is equal
-to the process group ID of the sender, and for which the
-process has permission;
-this is a variant of
-.Xr killpg 2 .
-.It \&If Fa pid No \&is -1 :
-If the user has super-user privileges,
-the signal is sent to all processes excluding
-system processes
-(with
-.Dv P_SYSTEM
-flag set),
-process with ID 1
-(usually
-.Xr init 8 ) ,
-and the process sending the signal.
-If the user is not the super user, the signal is sent to all processes
-which the caller has permissions to, excluding the process sending the signal.
-No error is returned if any process could be signaled.
-.El
-.Pp
-If the process number is negative but not -1,
-the signal is sent to all processes whose process group ID
-is equal to the absolute value of the process number.
-This is a variant of
-.Xr killpg 2 .
-.Sh RETURN VALUES
-.Rv -std kill
-.Sh ERRORS
-The
-.Fn kill
-system call
-will fail and no signal will be sent if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Fa sig
-argument
-is not a valid signal number.
-.It Bq Er ESRCH
-No process or process group can be found corresponding to that specified by
-.Fa pid .
-.It Bq Er EPERM
-The sending process does not have permission to send
-.Va sig
-to any receiving process.
-.El
-.Sh SEE ALSO
-.Xr getpgrp 2 ,
-.Xr getpid 2 ,
-.Xr killpg 2 ,
-.Xr sigaction 2 ,
-.Xr sigqueue 2 ,
-.Xr raise 3 ,
-.Xr init 8
-.Sh STANDARDS
-The
-.Fn kill
-system call is expected to conform to
-.St -p1003.1-90 .
-.Sh HISTORY
-A version of the
-.Fn kill
-function appeared in
-.At v3 .
-The signal number was added to the
-.Fn kill
-function in
-.At v4 .
diff --git a/lib/libc/sys/kldfind.2 b/lib/libc/sys/kldfind.2
deleted file mode 100644
index a8892ed00650..000000000000
--- a/lib/libc/sys/kldfind.2
+++ /dev/null
@@ -1,86 +0,0 @@
-.\"
-.\" Copyright (c) 1999 Chris Costello
-.\" All rights reserved.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd March 3, 1999
-.Dt KLDFIND 2
-.Os
-.Sh NAME
-.Nm kldfind
-.Nd returns the fileid of a kld file
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/param.h
-.In sys/linker.h
-.Ft int
-.Fn kldfind "const char *file"
-.Sh DESCRIPTION
-The
-.Fn kldfind
-system call
-returns the fileid of the kld file referenced by
-.Fa file .
-.Sh RETURN VALUES
-The
-.Fn kldfind
-system call
-returns the fileid of the kld file referenced by
-.Fa file .
-Upon error,
-.Fn kldfind
-returns -1 and sets
-.Va errno
-to indicate the error.
-.Sh ERRORS
-.Va errno
-is set to the following if
-.Fn kldfind
-fails:
-.Bl -tag -width Er
-.It Bq Er EFAULT
-The data required for this operation could not be read from the kernel space.
-.It Bq Er ENOENT
-The file specified is not loaded in the kernel.
-.El
-.Sh SEE ALSO
-.Xr kldfirstmod 2 ,
-.Xr kldload 2 ,
-.Xr kldnext 2 ,
-.Xr kldstat 2 ,
-.Xr kldsym 2 ,
-.Xr kldunload 2 ,
-.Xr modfind 2 ,
-.Xr modfnext 2 ,
-.Xr modnext 2 ,
-.Xr modstat 2 ,
-.Xr kld 4 ,
-.Xr kldstat 8
-.Sh HISTORY
-The
-.Nm kld
-interface first appeared in
-.Fx 3.0 .
diff --git a/lib/libc/sys/kldfirstmod.2 b/lib/libc/sys/kldfirstmod.2
deleted file mode 100644
index d9967ccd779c..000000000000
--- a/lib/libc/sys/kldfirstmod.2
+++ /dev/null
@@ -1,76 +0,0 @@
-.\"
-.\" Copyright (c) 1999 Chris Costello
-.\" All rights reserved.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd March 3, 1999
-.Dt KLDFIRSTMOD 2
-.Os
-.Sh NAME
-.Nm kldfirstmod
-.Nd "return first module id from the kld file specified"
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/param.h
-.In sys/linker.h
-.Ft int
-.Fn kldfirstmod "int fileid"
-.Sh DESCRIPTION
-The
-.Fn kldfirstmod
-system call returns the module id pertaining to the first module referenced by
-.Fa fileid .
-.Sh RETURN VALUES
-The
-.Fn kldfirstmod
-will return the id of the first module referenced by
-.Fa fileid
-or 0 if there are no references.
-.Sh ERRORS
-.Bl -tag -width Er
-.It Bq Er ENOENT
-The kld file referenced by
-.Fa fileid
-was not found.
-.El
-.Sh SEE ALSO
-.Xr kldfind 2 ,
-.Xr kldload 2 ,
-.Xr kldnext 2 ,
-.Xr kldstat 2 ,
-.Xr kldsym 2 ,
-.Xr kldunload 2 ,
-.Xr modfind 2 ,
-.Xr modfnext 2 ,
-.Xr modnext 2 ,
-.Xr modstat 2 ,
-.Xr kld 4 ,
-.Xr kldstat 8
-.Sh HISTORY
-The
-.Nm kld
-interface first appeared in
-.Fx 3.0 .
diff --git a/lib/libc/sys/kldload.2 b/lib/libc/sys/kldload.2
deleted file mode 100644
index d31cc086e2f9..000000000000
--- a/lib/libc/sys/kldload.2
+++ /dev/null
@@ -1,96 +0,0 @@
-.\"
-.\" Copyright (c) 1999 Chris Costello
-.\" All rights reserved.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd March 3, 1999
-.Dt KLDLOAD 2
-.Os
-.Sh NAME
-.Nm kldload
-.Nd load KLD files into the kernel
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/param.h
-.In sys/linker.h
-.Ft int
-.Fn kldload "const char *file"
-.Sh DESCRIPTION
-The
-.Fn kldload
-system call
-loads a kld file into the kernel using the kernel linker.
-.Sh RETURN VALUES
-The
-.Fn kldload
-system call
-returns the fileid of the kld file which was loaded into the kernel.
-If an error occurs,
-.Fn kldload
-will return -1 and set
-.Va errno
-to indicate the error.
-.Sh ERRORS
-The named file is loaded unless:
-.Bl -tag -width Er
-.It Bq Er EPERM
-You do not have access to read the file or link it with the kernel.
-You should be the root user to be able to use the
-.Nm kld
-system calls.
-.It Bq Er EFAULT
-Bad address encountered when adding kld info into the kernel space.
-.It Bq Er ENOMEM
-There is no memory to load the file into the kernel.
-.It Bq Er ENOENT
-The file was not found.
-.It Bq Er ENOEXEC
-The file format of
-.Fa file
-was unrecognized.
-.It Bq Er EEXIST
-The supplied
-.Fa file
-has already been loaded.
-.El
-.Sh SEE ALSO
-.Xr kldfind 2 ,
-.Xr kldfirstmod 2 ,
-.Xr kldnext 2 ,
-.Xr kldstat 2 ,
-.Xr kldsym 2 ,
-.Xr kldunload 2 ,
-.Xr modfind 2 ,
-.Xr modfnext 2 ,
-.Xr modnext 2 ,
-.Xr modstat 2 ,
-.Xr kld 4 ,
-.Xr kldload 8
-.Sh HISTORY
-The
-.Nm kld
-interface first appeared in
-.Fx 3.0 .
diff --git a/lib/libc/sys/kldnext.2 b/lib/libc/sys/kldnext.2
deleted file mode 100644
index c856a2e671f8..000000000000
--- a/lib/libc/sys/kldnext.2
+++ /dev/null
@@ -1,89 +0,0 @@
-.\"
-.\" Copyright (c) 1999 Chris Costello
-.\" All rights reserved.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd February 22, 2006
-.Dt KLDNEXT 2
-.Os
-.Sh NAME
-.Nm kldnext
-.Nd return the fileid of the next kld file
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/param.h
-.In sys/linker.h
-.Ft int
-.Fn kldnext "int fileid"
-.Sh DESCRIPTION
-The
-.Fn kldnext
-system call
-returns the fileid of the next kld file (that is, the one after
-.Fa fileid )
-or 0 if
-.Fa fileid
-is the last file loaded.
-To get the fileid of the first kld file, pass
-.Fa fileid
-of 0 to
-.Fn kldnext .
-.Sh RETURN VALUES
-The
-.Fn kldnext
-system call
-returns the fileid of the next kld file or 0 if successful.
-Otherwise
-.Fn kldnext
-returns the value \-1 and sets the global variable
-.Va errno
-to indicate the error.
-.Sh ERRORS
-The only error set by
-.Fn kldnext
-is
-.Er ENOENT ,
-which is set when
-.Fa fileid
-refers to a kld file that does not exist (is not loaded).
-.Sh SEE ALSO
-.Xr kldfind 2 ,
-.Xr kldfirstmod 2 ,
-.Xr kldload 2 ,
-.Xr kldstat 2 ,
-.Xr kldsym 2 ,
-.Xr kldunload 2 ,
-.Xr modfind 2 ,
-.Xr modfnext 2 ,
-.Xr modnext 2 ,
-.Xr modstat 2 ,
-.Xr kld 4 ,
-.Xr kldstat 8
-.Sh HISTORY
-The
-.Nm kld
-interface first appeared in
-.Fx 3.0 .
diff --git a/lib/libc/sys/kldstat.2 b/lib/libc/sys/kldstat.2
deleted file mode 100644
index 8b4e5320dd75..000000000000
--- a/lib/libc/sys/kldstat.2
+++ /dev/null
@@ -1,133 +0,0 @@
-.\"
-.\" Copyright (c) 1999 Chris Costello
-.\" All rights reserved.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd March 28, 2012
-.Dt KLDSTAT 2
-.Os
-.Sh NAME
-.Nm kldstat
-.Nd get status of kld file
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/param.h
-.In sys/linker.h
-.Ft int
-.Fn kldstat "int fileid" "struct kld_file_stat *stat"
-.Sh DESCRIPTION
-The
-.Fn kldstat
-system call writes the info for the file referred to by
-.Fa fileid
-into
-.Fa stat .
-.Bd -literal
-struct kld_file_stat {
- int version; /* set to sizeof(struct kld_file_stat) */
- char name[MAXPATHLEN];
- int refs;
- int id;
- caddr_t address;
- size_t size;
- char pathname[MAXPATHLEN];
-};
-.Ed
-.Bl -tag -width XXXaddress
-.It version
-This field is set to the size of the structure mentioned above by the code
-calling
-.Fn kldstat ,
-and not
-.Fn kldstat
-itself.
-.It name
-The name of the file referred to by
-.Fa fileid .
-.It refs
-The number of modules referenced by
-.Fa fileid .
-.It id
-The id of the file specified in
-.Fa fileid .
-.It address
-The load address of the kld file.
-.It size
-The amount of memory in bytes allocated by the file.
-.It pathname
-The full name of the file referred to by
-.Fa fileid ,
-including the path.
-.El
-.Sh RETURN VALUES
-.Rv -std kldstat
-.Sh ERRORS
-The information for the file referred to by
-.Fa fileid
-is filled into the structure pointed to by
-.Fa stat
-unless:
-.Bl -tag -width Er
-.It Bq Er ENOENT
-The file was not found (probably not loaded).
-.It Bq Er EINVAL
-The version specified in the
-.Fa version
-field of stat is not the proper version.
-You would need to rebuild world, the
-kernel, or your application, if this error occurs, given that you did properly
-fill in the
-.Fa version
-field.
-.It Bq Er EFAULT
-There was a problem copying one, some, or all of the fields into
-.Fa stat
-in the
-.Xr copyout 9
-function.
-.El
-.Sh SEE ALSO
-.Xr kldfind 2 ,
-.Xr kldfirstmod 2 ,
-.Xr kldload 2 ,
-.Xr kldnext 2 ,
-.Xr kldsym 2 ,
-.Xr kldunload 2 ,
-.Xr modfind 2 ,
-.Xr modfnext 2 ,
-.Xr modnext 2 ,
-.Xr modstat 2 ,
-.Xr kld 4 ,
-.Xr kldstat 8
-.Sh HISTORY
-The
-.Nm kld
-interface first appeared in
-.Fx 3.0 .
-.Sh BUGS
-The pathname may not be accurate if the file system mounts have
-changed since the module was loaded, or if this function is called
-within a chrooted environment.
diff --git a/lib/libc/sys/kldsym.2 b/lib/libc/sys/kldsym.2
deleted file mode 100644
index 422feaa268fd..000000000000
--- a/lib/libc/sys/kldsym.2
+++ /dev/null
@@ -1,121 +0,0 @@
-.\" Copyright (c) 2001 Chris Costello <chris@FreeBSD.org>
-.\" All rights reserved.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd October 17, 2016
-.Dt KLDSYM 2
-.Os
-.Sh NAME
-.Nm kldsym
-.Nd look up address by symbol name in a KLD
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/param.h
-.In sys/linker.h
-.Ft int
-.Fn kldsym "int fileid" "int cmd" "void *data"
-.Sh DESCRIPTION
-The
-.Fn kldsym
-system call returns the address of the symbol specified in
-.Fa data
-in the module specified by
-.Fa fileid .
-If
-.Fa fileid
-is 0, all loaded modules are searched.
-Currently, the only
-.Fa cmd
-implemented is
-.Dv KLDSYM_LOOKUP .
-.Pp
-The
-.Fa data
-argument is of the following structure:
-.Bd -literal -offset indent
-struct kld_sym_lookup {
- int version; /* sizeof(struct kld_sym_lookup) */
- char *symname; /* Symbol name we are looking up */
- u_long symvalue;
- size_t symsize;
-};
-.Ed
-.Pp
-The
-.Va version
-member is to be set
-by the code calling
-.Fn kldsym
-to
-.Fn sizeof "struct kld_sym_lookup" .
-The next two members,
-.Va version
-and
-.Va symname ,
-are specified by the user.
-The last two,
-.Va symvalue
-and
-.Va symsize ,
-are filled in by
-.Fn kldsym
-and contain the address associated with
-.Va symname
-and the size of the data it points to, respectively.
-.Sh RETURN VALUES
-.Rv -std kldsym
-.Sh ERRORS
-The
-.Fn kldsym
-system call will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-Invalid value in
-.Fa data->version
-or
-.Fa cmd .
-.It Bq Er ENOENT
-The
-.Fa fileid
-argument
-is invalid,
-or the specified symbol could not be found.
-.El
-.Sh SEE ALSO
-.Xr kldfind 2 ,
-.Xr kldfirstmod 2 ,
-.Xr kldload 2 ,
-.Xr kldnext 2 ,
-.Xr kldunload 2 ,
-.Xr modfind 2 ,
-.Xr modnext 2 ,
-.Xr modstat 2 ,
-.Xr kld 4
-.Sh HISTORY
-The
-.Fn kldsym
-system call first appeared in
-.Fx 3.0 .
diff --git a/lib/libc/sys/kldunload.2 b/lib/libc/sys/kldunload.2
deleted file mode 100644
index d1c259b51461..000000000000
--- a/lib/libc/sys/kldunload.2
+++ /dev/null
@@ -1,94 +0,0 @@
-.\"
-.\" Copyright (c) 1999 Chris Costello
-.\" All rights reserved.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd December 25, 2008
-.Dt KLDUNLOAD 2
-.Os
-.Sh NAME
-.Nm kldunload , kldunloadf
-.Nd unload kld files
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/param.h
-.In sys/linker.h
-.Ft int
-.Fn kldunload "int fileid"
-.Ft int
-.Fn kldunloadf "int fileid" "int flags"
-.Sh DESCRIPTION
-The
-.Fn kldunload
-system call
-unloads a kld file from the kernel that was previously linked via
-.Xr kldload 2 .
-.Pp
-The
-.Fn kldunloadf
-system call accepts an additional flags argument, which may be one of
-.Dv LINKER_UNLOAD_NORMAL ,
-giving the same behavior as
-.Fn kldunload ,
-or
-.Dv LINKER_UNLOAD_FORCE ,
-which causes the unload to ignore a failure to quiesce the module.
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-The file referred to by
-.Fa fileid
-is unloaded unless:
-.Bl -tag -width Er
-.It Bq Er EPERM
-You do not have access to unlink the file from the kernel.
-.It Bq Er ENOENT
-The file was not found.
-.It Bq Er EBUSY
-You attempted to unload a file linked by the kernel.
-.It Bq Er EINVAL
-The
-.Fn kldunloadf
-system call was passed invalid flags.
-.El
-.Sh SEE ALSO
-.Xr kldfind 2 ,
-.Xr kldfirstmod 2 ,
-.Xr kldload 2 ,
-.Xr kldnext 2 ,
-.Xr kldstat 2 ,
-.Xr kldsym 2 ,
-.Xr modfind 2 ,
-.Xr modfnext 2 ,
-.Xr modnext 2 ,
-.Xr modstat 2 ,
-.Xr kld 4 ,
-.Xr kldunload 8
-.Sh HISTORY
-The
-.Nm kld
-interface first appeared in
-.Fx 3.0 .
diff --git a/lib/libc/sys/kqueue.2 b/lib/libc/sys/kqueue.2
deleted file mode 100644
index 68929e973dc0..000000000000
--- a/lib/libc/sys/kqueue.2
+++ /dev/null
@@ -1,860 +0,0 @@
-.\" Copyright (c) 2000 Jonathan Lemon
-.\" All rights reserved.
-.\"
-.\" 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 ``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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd October 12, 2021
-.Dt KQUEUE 2
-.Os
-.Sh NAME
-.Nm kqueue ,
-.Nm kevent
-.Nd kernel event notification mechanism
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/event.h
-.Ft int
-.Fn kqueue "void"
-.Ft int
-.Fo kevent
-.Fa "int kq"
-.Fa "const struct kevent *changelist"
-.Fa "int nchanges"
-.Fa "struct kevent *eventlist"
-.Fa "int nevents"
-.Fa "const struct timespec *timeout"
-.Fc
-.Fn EV_SET "kev" ident filter flags fflags data udata
-.Sh DESCRIPTION
-The
-.Fn kqueue
-system call
-provides a generic method of notifying the user when an event
-happens or a condition holds, based on the results of small
-pieces of kernel code termed filters.
-A kevent is identified by the (ident, filter) pair; there may only
-be one unique kevent per kqueue.
-.Pp
-The filter is executed upon the initial registration of a kevent
-in order to detect whether a preexisting condition is present, and is also
-executed whenever an event is passed to the filter for evaluation.
-If the filter determines that the condition should be reported,
-then the kevent is placed on the kqueue for the user to retrieve.
-.Pp
-The filter is also run when the user attempts to retrieve the kevent
-from the kqueue.
-If the filter indicates that the condition that triggered
-the event no longer holds, the kevent is removed from the kqueue and
-is not returned.
-.Pp
-Multiple events which trigger the filter do not result in multiple
-kevents being placed on the kqueue; instead, the filter will aggregate
-the events into a single struct kevent.
-Calling
-.Fn close
-on a file descriptor will remove any kevents that reference the descriptor.
-.Pp
-The
-.Fn kqueue
-system call
-creates a new kernel event queue and returns a descriptor.
-The queue is not inherited by a child created with
-.Xr fork 2 .
-However, if
-.Xr rfork 2
-is called without the
-.Dv RFFDG
-flag, then the descriptor table is shared,
-which will allow sharing of the kqueue between two processes.
-.Pp
-The
-.Fn kevent
-system call
-is used to register events with the queue, and return any pending
-events to the user.
-The
-.Fa changelist
-argument
-is a pointer to an array of
-.Va kevent
-structures, as defined in
-.In sys/event.h .
-All changes contained in the
-.Fa changelist
-are applied before any pending events are read from the queue.
-The
-.Fa nchanges
-argument
-gives the size of
-.Fa changelist .
-The
-.Fa eventlist
-argument
-is a pointer to an array of kevent structures.
-The
-.Fa nevents
-argument
-determines the size of
-.Fa eventlist .
-When
-.Fa nevents
-is zero,
-.Fn kevent
-will return immediately even if there is a
-.Fa timeout
-specified unlike
-.Xr select 2 .
-If
-.Fa timeout
-is a non-NULL pointer, it specifies a maximum interval to wait
-for an event, which will be interpreted as a struct timespec.
-If
-.Fa timeout
-is a NULL pointer,
-.Fn kevent
-waits indefinitely.
-To effect a poll, the
-.Fa timeout
-argument should be non-NULL, pointing to a zero-valued
-.Va timespec
-structure.
-The same array may be used for the
-.Fa changelist
-and
-.Fa eventlist .
-.Pp
-The
-.Fn EV_SET
-macro is provided for ease of initializing a
-kevent structure.
-.Pp
-The
-.Va kevent
-structure is defined as:
-.Bd -literal
-struct kevent {
- uintptr_t ident; /* identifier for this event */
- short filter; /* filter for event */
- u_short flags; /* action flags for kqueue */
- u_int fflags; /* filter flag value */
- int64_t data; /* filter data value */
- void *udata; /* opaque user data identifier */
- uint64_t ext[4]; /* extensions */
-};
-.Ed
-.Pp
-The fields of
-.Fa struct kevent
-are:
-.Bl -tag -width "Fa filter"
-.It Fa ident
-Value used to identify this event.
-The exact interpretation is determined by the attached filter,
-but often is a file descriptor.
-.It Fa filter
-Identifies the kernel filter used to process this event.
-The pre-defined
-system filters are described below.
-.It Fa flags
-Actions to perform on the event.
-.It Fa fflags
-Filter-specific flags.
-.It Fa data
-Filter-specific data value.
-.It Fa udata
-Opaque user-defined value passed through the kernel unchanged.
-.It Fa ext
-Extended data passed to and from kernel.
-The
-.Fa ext[0]
-and
-.Fa ext[1]
-members use is defined by the filter.
-If the filter does not use them, the members are copied unchanged.
-The
-.Fa ext[2]
-and
-.Fa ext[3]
-members are always passed through the kernel as-is,
-making additional context available to application.
-.El
-.Pp
-The
-.Va flags
-field can contain the following values:
-.Bl -tag -width EV_DISPATCH
-.It Dv EV_ADD
-Adds the event to the kqueue.
-Re-adding an existing event
-will modify the parameters of the original event, and not result
-in a duplicate entry.
-Adding an event automatically enables it,
-unless overridden by the EV_DISABLE flag.
-.It Dv EV_ENABLE
-Permit
-.Fn kevent
-to return the event if it is triggered.
-.It Dv EV_DISABLE
-Disable the event so
-.Fn kevent
-will not return it.
-The filter itself is not disabled.
-.It Dv EV_DISPATCH
-Disable the event source immediately after delivery of an event.
-See
-.Dv EV_DISABLE
-above.
-.It Dv EV_DELETE
-Removes the event from the kqueue.
-Events which are attached to
-file descriptors are automatically deleted on the last close of
-the descriptor.
-.It Dv EV_RECEIPT
-This flag is useful for making bulk changes to a kqueue without draining
-any pending events.
-When passed as input, it forces
-.Dv EV_ERROR
-to always be returned.
-When a filter is successfully added the
-.Va data
-field will be zero.
-Note that if this flag is encountered and there is no remaining space in
-.Fa eventlist
-to hold the
-.Dv EV_ERROR
-event, then subsequent changes will not get processed.
-.It Dv EV_ONESHOT
-Causes the event to return only the first occurrence of the filter
-being triggered.
-After the user retrieves the event from the kqueue,
-it is deleted.
-.It Dv EV_CLEAR
-After the event is retrieved by the user, its state is reset.
-This is useful for filters which report state transitions
-instead of the current state.
-Note that some filters may automatically
-set this flag internally.
-.It Dv EV_EOF
-Filters may set this flag to indicate filter-specific EOF condition.
-.It Dv EV_ERROR
-See
-.Sx RETURN VALUES
-below.
-.It Dv EV_KEEPUDATA
-Causes
-.Fn kevent
-to leave unchanged any
-.Fa udata
-associated with an existing event.
-This allows other aspects of the event to be modified without requiring the
-caller to know the
-.Fa udata
-value presently associated.
-This is especially useful with
-.Dv NOTE_TRIGGER
-or flags like
-.Dv EV_ENABLE .
-This flag may not be used with
-.Dv EV_ADD .
-.El
-.Pp
-The predefined system filters are listed below.
-Arguments may be passed to and from the filter via the
-.Va fflags
-and
-.Va data
-fields in the kevent structure.
-.Bl -tag -width "Dv EVFILT_PROCDESC"
-.It Dv EVFILT_READ
-Takes a descriptor as the identifier, and returns whenever
-there is data available to read.
-The behavior of the filter is slightly different depending
-on the descriptor type.
-.Bl -tag -width 2n
-.It Sockets
-Sockets which have previously been passed to
-.Fn listen
-return when there is an incoming connection pending.
-.Va data
-contains the size of the listen backlog.
-.Pp
-Other socket descriptors return when there is data to be read,
-subject to the
-.Dv SO_RCVLOWAT
-value of the socket buffer.
-This may be overridden with a per-filter low water mark at the
-time the filter is added by setting the
-.Dv NOTE_LOWAT
-flag in
-.Va fflags ,
-and specifying the new low water mark in
-.Va data .
-On return,
-.Va data
-contains the number of bytes of protocol data available to read.
-.Pp
-If the read direction of the socket has shutdown, then the filter
-also sets
-.Dv EV_EOF
-in
-.Va flags ,
-and returns the socket error (if any) in
-.Va fflags .
-It is possible for EOF to be returned (indicating the connection is gone)
-while there is still data pending in the socket buffer.
-.It Vnodes
-Returns when the file pointer is not at the end of file.
-.Va data
-contains the offset from current position to end of file,
-and may be negative.
-.Pp
-This behavior is different from
-.Xr poll 2 ,
-where read events are triggered for regular files unconditionally.
-This event can be triggered unconditionally by setting the
-.Dv NOTE_FILE_POLL
-flag in
-.Va fflags .
-.It "Fifos, Pipes"
-Returns when the there is data to read;
-.Va data
-contains the number of bytes available.
-.Pp
-When the last writer disconnects, the filter will set
-.Dv EV_EOF
-in
-.Va flags .
-This will be cleared by the filter when a new writer connects,
-at which point the
-filter will resume waiting for data to become available before
-returning.
-.It "BPF devices"
-Returns when the BPF buffer is full, the BPF timeout has expired, or
-when the BPF has
-.Dq immediate mode
-enabled and there is any data to read;
-.Va data
-contains the number of bytes available.
-.It Eventfds
-Returns when the counter is greater than 0;
-.Va data
-contains the counter value, which must be cast to
-.Vt uint64_t .
-.It Kqueues
-Returns when pending events are present on the queue;
-.Va data
-contains the number of events available.
-.El
-.It Dv EVFILT_WRITE
-Takes a descriptor as the identifier, and returns whenever
-it is possible to write to the descriptor.
-For sockets, pipes
-and fifos,
-.Va data
-will contain the amount of space remaining in the write buffer.
-The filter will set
-.Dv EV_EOF
-when the reader disconnects, and for the fifo case, this will be cleared
-when a new reader connects.
-Note that this filter is not supported for vnodes.
-.Pp
-For sockets, the low water mark and socket error handling is
-identical to the
-.Dv EVFILT_READ
-case.
-.Pp
-For eventfds,
-.Va data
-will contain the maximum value that can be added to the counter
-without blocking.
-.Pp
-For BPF devices, the filter always indicates that it is possible to
-write and
-.Va data
-will contain the MTU size of the underlying interface.
-.It Dv EVFILT_EMPTY
-Takes a descriptor as the identifier, and returns whenever
-there is no remaining data in the write buffer.
-.It Dv EVFILT_AIO
-Events for this filter are not registered with
-.Fn kevent
-directly but are registered via the
-.Va aio_sigevent
-member of an asynchronous I/O request when it is scheduled via an
-asynchronous I/O system call such as
-.Fn aio_read .
-The filter returns under the same conditions as
-.Fn aio_error .
-For more details on this filter see
-.Xr sigevent 3 and
-.Xr aio 4 .
-.It Dv EVFILT_VNODE
-Takes a file descriptor as the identifier and the events to watch for in
-.Va fflags ,
-and returns when one or more of the requested events occurs on the descriptor.
-The events to monitor are:
-.Bl -tag -width "Dv NOTE_CLOSE_WRITE"
-.It Dv NOTE_ATTRIB
-The file referenced by the descriptor had its attributes changed.
-.It Dv NOTE_CLOSE
-A file descriptor referencing the monitored file, was closed.
-The closed file descriptor did not have write access.
-.It Dv NOTE_CLOSE_WRITE
-A file descriptor referencing the monitored file, was closed.
-The closed file descriptor had write access.
-.Pp
-This note, as well as
-.Dv NOTE_CLOSE ,
-are not activated when files are closed forcibly by
-.Xr unmount 2 or
-.Xr revoke 2 .
-Instead,
-.Dv NOTE_REVOKE
-is sent for such events.
-.It Dv NOTE_DELETE
-The
-.Fn unlink
-system call was called on the file referenced by the descriptor.
-.It Dv NOTE_EXTEND
-For regular file, the file referenced by the descriptor was extended.
-.Pp
-For directory, reports that a directory entry was added or removed,
-as the result of rename operation.
-The
-.Dv NOTE_EXTEND
-event is not reported when a name is changed inside the directory.
-.It Dv NOTE_LINK
-The link count on the file changed.
-In particular, the
-.Dv NOTE_LINK
-event is reported if a subdirectory was created or deleted inside
-the directory referenced by the descriptor.
-.It Dv NOTE_OPEN
-The file referenced by the descriptor was opened.
-.It Dv NOTE_READ
-A read occurred on the file referenced by the descriptor.
-.It Dv NOTE_RENAME
-The file referenced by the descriptor was renamed.
-.It Dv NOTE_REVOKE
-Access to the file was revoked via
-.Xr revoke 2
-or the underlying file system was unmounted.
-.It Dv NOTE_WRITE
-A write occurred on the file referenced by the descriptor.
-.El
-.Pp
-On return,
-.Va fflags
-contains the events which triggered the filter.
-.It Dv EVFILT_PROC
-Takes the process ID to monitor as the identifier and the events to watch for
-in
-.Va fflags ,
-and returns when the process performs one or more of the requested events.
-If a process can normally see another process, it can attach an event to it.
-The events to monitor are:
-.Bl -tag -width "Dv NOTE_TRACKERR"
-.It Dv NOTE_EXIT
-The process has exited.
-The exit status will be stored in
-.Va data .
-.It Dv NOTE_FORK
-The process has called
-.Fn fork .
-.It Dv NOTE_EXEC
-The process has executed a new process via
-.Xr execve 2
-or a similar call.
-.It Dv NOTE_TRACK
-Follow a process across
-.Fn fork
-calls.
-The parent process registers a new kevent to monitor the child process
-using the same
-.Va fflags
-as the original event.
-The child process will signal an event with
-.Dv NOTE_CHILD
-set in
-.Va fflags
-and the parent PID in
-.Va data .
-.Pp
-If the parent process fails to register a new kevent
-.Pq usually due to resource limitations ,
-it will signal an event with
-.Dv NOTE_TRACKERR
-set in
-.Va fflags ,
-and the child process will not signal a
-.Dv NOTE_CHILD
-event.
-.El
-.Pp
-On return,
-.Va fflags
-contains the events which triggered the filter.
-.It Dv EVFILT_PROCDESC
-Takes the process descriptor created by
-.Xr pdfork 2
-to monitor as the identifier and the events to watch for in
-.Va fflags ,
-and returns when the associated process performs one or more of the
-requested events.
-The events to monitor are:
-.Bl -tag -width "Dv NOTE_EXIT"
-.It Dv NOTE_EXIT
-The process has exited.
-The exit status will be stored in
-.Va data .
-.El
-.Pp
-On return,
-.Va fflags
-contains the events which triggered the filter.
-.It Dv EVFILT_SIGNAL
-Takes the signal number to monitor as the identifier and returns
-when the given signal is delivered to the process.
-This coexists with the
-.Fn signal
-and
-.Fn sigaction
-facilities, and has a lower precedence.
-The filter will record
-all attempts to deliver a signal to a process, even if the signal has
-been marked as
-.Dv SIG_IGN ,
-except for the
-.Dv SIGCHLD
-signal, which, if ignored, will not be recorded by the filter.
-Event notification happens after normal
-signal delivery processing.
-.Va data
-returns the number of times the signal has occurred since the last call to
-.Fn kevent .
-This filter automatically sets the
-.Dv EV_CLEAR
-flag internally.
-.It Dv EVFILT_TIMER
-Establishes an arbitrary timer identified by
-.Va ident .
-When adding a timer,
-.Va data
-specifies the moment to fire the timer (for
-.Dv NOTE_ABSTIME )
-or the timeout period.
-The timer will be periodic unless
-.Dv EV_ONESHOT
-or
-.Dv NOTE_ABSTIME
-is specified.
-On return,
-.Va data
-contains the number of times the timeout has expired since the last call to
-.Fn kevent .
-For non-monotonic timers, this filter automatically sets the
-.Dv EV_CLEAR
-flag internally.
-.Pp
-The filter accepts the following flags in the
-.Va fflags
-argument:
-.Bl -tag -width "Dv NOTE_MSECONDS"
-.It Dv NOTE_SECONDS
-.Va data
-is in seconds.
-.It Dv NOTE_MSECONDS
-.Va data
-is in milliseconds.
-.It Dv NOTE_USECONDS
-.Va data
-is in microseconds.
-.It Dv NOTE_NSECONDS
-.Va data
-is in nanoseconds.
-.It Dv NOTE_ABSTIME
-The specified expiration time is absolute.
-.El
-.Pp
-If
-.Va fflags
-is not set, the default is milliseconds.
-On return,
-.Va fflags
-contains the events which triggered the filter.
-.Pp
-Periodic timers with a specified timeout of 0 will be silently adjusted to
-timeout after 1 of the time units specified by the requested precision in
-.Va fflags .
-If an absolute time is specified that has already passed, then it is treated as
-if the current time were specified and the event will fire as soon as possible.
-.Pp
-If an existing timer is re-added, the existing timer will be
-effectively canceled (throwing away any undelivered record of previous
-timer expiration) and re-started using the new parameters contained in
-.Va data
-and
-.Va fflags .
-.Pp
-There is a system wide limit on the number of timers
-which is controlled by the
-.Va kern.kq_calloutmax
-sysctl.
-.It Dv EVFILT_USER
-Establishes a user event identified by
-.Va ident
-which is not associated with any kernel mechanism but is triggered by
-user level code.
-The lower 24 bits of the
-.Va fflags
-may be used for user defined flags and manipulated using the following:
-.Bl -tag -width "Dv NOTE_FFLAGSMASK"
-.It Dv NOTE_FFNOP
-Ignore the input
-.Va fflags .
-.It Dv NOTE_FFAND
-Bitwise AND
-.Va fflags .
-.It Dv NOTE_FFOR
-Bitwise OR
-.Va fflags .
-.It Dv NOTE_FFCOPY
-Copy
-.Va fflags .
-.It Dv NOTE_FFCTRLMASK
-Control mask for
-.Va fflags .
-.It Dv NOTE_FFLAGSMASK
-User defined flag mask for
-.Va fflags .
-.El
-.Pp
-A user event is triggered for output with the following:
-.Bl -tag -width "Dv NOTE_FFLAGSMASK"
-.It Dv NOTE_TRIGGER
-Cause the event to be triggered.
-.El
-.Pp
-On return,
-.Va fflags
-contains the users defined flags in the lower 24 bits.
-.El
-.Sh CANCELLATION BEHAVIOUR
-If
-.Fa nevents
-is non-zero, i.e., the function is potentially blocking, the call
-is a cancellation point.
-Otherwise, i.e., if
-.Fa nevents
-is zero, the call is not cancellable.
-Cancellation can only occur before any changes are made to the kqueue,
-or when the call was blocked and no changes to the queue were requested.
-.Sh RETURN VALUES
-The
-.Fn kqueue
-system call
-creates a new kernel event queue and returns a file descriptor.
-If there was an error creating the kernel event queue, a value of -1 is
-returned and errno set.
-.Pp
-The
-.Fn kevent
-system call
-returns the number of events placed in the
-.Fa eventlist ,
-up to the value given by
-.Fa nevents .
-If an error occurs while processing an element of the
-.Fa changelist
-and there is enough room in the
-.Fa eventlist ,
-then the event will be placed in the
-.Fa eventlist
-with
-.Dv EV_ERROR
-set in
-.Va flags
-and the system error in
-.Va data .
-Otherwise,
-.Dv -1
-will be returned, and
-.Dv errno
-will be set to indicate the error condition.
-If the time limit expires, then
-.Fn kevent
-returns 0.
-.Sh EXAMPLES
-.Bd -literal -compact
-#include <sys/event.h>
-#include <err.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-int
-main(int argc, char **argv)
-{
- struct kevent event; /* Event we want to monitor */
- struct kevent tevent; /* Event triggered */
- int kq, fd, ret;
-
- if (argc != 2)
- err(EXIT_FAILURE, "Usage: %s path\en", argv[0]);
- fd = open(argv[1], O_RDONLY);
- if (fd == -1)
- err(EXIT_FAILURE, "Failed to open '%s'", argv[1]);
-
- /* Create kqueue. */
- kq = kqueue();
- if (kq == -1)
- err(EXIT_FAILURE, "kqueue() failed");
-
- /* Initialize kevent structure. */
- EV_SET(&event, fd, EVFILT_VNODE, EV_ADD | EV_CLEAR, NOTE_WRITE,
- 0, NULL);
- /* Attach event to the kqueue. */
- ret = kevent(kq, &event, 1, NULL, 0, NULL);
- if (ret == -1)
- err(EXIT_FAILURE, "kevent register");
- if (event.flags & EV_ERROR)
- errx(EXIT_FAILURE, "Event error: %s", strerror(event.data));
-
- for (;;) {
- /* Sleep until something happens. */
- ret = kevent(kq, NULL, 0, &tevent, 1, NULL);
- if (ret == -1) {
- err(EXIT_FAILURE, "kevent wait");
- } else if (ret > 0) {
- printf("Something was written in '%s'\en", argv[1]);
- }
- }
-}
-.Ed
-.Sh ERRORS
-The
-.Fn kqueue
-system call fails if:
-.Bl -tag -width Er
-.It Bq Er ENOMEM
-The kernel failed to allocate enough memory for the kernel queue.
-.It Bq Er ENOMEM
-The
-.Dv RLIMIT_KQUEUES
-rlimit
-(see
-.Xr getrlimit 2 )
-for the current user would be exceeded.
-.It Bq Er EMFILE
-The per-process descriptor table is full.
-.It Bq Er ENFILE
-The system file table is full.
-.El
-.Pp
-The
-.Fn kevent
-system call fails if:
-.Bl -tag -width Er
-.It Bq Er EACCES
-The process does not have permission to register a filter.
-.It Bq Er EFAULT
-There was an error reading or writing the
-.Va kevent
-structure.
-.It Bq Er EBADF
-The specified descriptor is invalid.
-.It Bq Er EINTR
-A signal was delivered before the timeout expired and before any
-events were placed on the kqueue for return.
-.It Bq Er EINTR
-A cancellation request was delivered to the thread, but not yet handled.
-.It Bq Er EINVAL
-The specified time limit or filter is invalid.
-.It Bq Er EINVAL
-The specified length of the event or change lists is negative.
-.It Bq Er ENOENT
-The event could not be found to be modified or deleted.
-.It Bq Er ENOMEM
-No memory was available to register the event
-or, in the special case of a timer, the maximum number of
-timers has been exceeded.
-This maximum is configurable via the
-.Va kern.kq_calloutmax
-sysctl.
-.It Bq Er ESRCH
-The specified process to attach to does not exist.
-.El
-.Pp
-When
-.Fn kevent
-call fails with
-.Er EINTR
-error, all changes in the
-.Fa changelist
-have been applied.
-.Sh SEE ALSO
-.Xr aio_error 2 ,
-.Xr aio_read 2 ,
-.Xr aio_return 2 ,
-.Xr poll 2 ,
-.Xr read 2 ,
-.Xr select 2 ,
-.Xr sigaction 2 ,
-.Xr write 2 ,
-.Xr pthread_setcancelstate 3 ,
-.Xr signal 3
-.Rs
-.%A Jonathan Lemon
-.%T "Kqueue: A Generic and Scalable Event Notification Facility"
-.%I USENIX Association
-.%B Proceedings of the FREENIX Track: 2001 USENIX Annual Technical Conference
-.%D June 25-30, 2001
-.\".http://www.usenix.org/event/usenix01/freenix01/full_papers/lemon/lemon.pdf
-.Re
-.Sh HISTORY
-The
-.Fn kqueue
-and
-.Fn kevent
-system calls first appeared in
-.Fx 4.1 .
-.Sh AUTHORS
-The
-.Fn kqueue
-system and this manual page were written by
-.An Jonathan Lemon Aq Mt jlemon@FreeBSD.org .
-.Sh BUGS
-The
-.Fa timeout
-value is limited to 24 hours; longer timeouts will be silently
-reinterpreted as 24 hours.
-.Pp
-In versions older than
-.Fx 12.0 ,
-.In sys/event.h
-failed to parse without including
-.In sys/types.h
-manually.
diff --git a/lib/libc/sys/ktrace.2 b/lib/libc/sys/ktrace.2
deleted file mode 100644
index ffe967e35ed8..000000000000
--- a/lib/libc/sys/ktrace.2
+++ /dev/null
@@ -1,206 +0,0 @@
-.\" Copyright (c) 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)ktrace.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2020
-.Dt KTRACE 2
-.Os
-.Sh NAME
-.Nm ktrace
-.Nd process tracing
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/param.h
-.In sys/time.h
-.In sys/uio.h
-.In sys/ktrace.h
-.Ft int
-.Fn ktrace "const char *tracefile" "int ops" "int trpoints" "int pid"
-.Sh DESCRIPTION
-The
-.Fn ktrace
-system call enables or disables tracing of one or more processes.
-Users may only trace their own processes.
-Only the super-user can trace setuid or setgid programs.
-.Pp
-The
-.Fa tracefile
-argument
-gives the pathname of the file to be used for tracing.
-The file must exist and be a regular file writable by the calling process.
-All trace records are always appended to the file,
-so the file must be truncated to zero length to discard
-previous trace data.
-If tracing points are being disabled (see KTROP_CLEAR below),
-.Fa tracefile
-may be NULL.
-.Pp
-The
-.Fa ops
-argument specifies the requested ktrace operation.
-The defined operations are:
-.Bl -column KTRFLAG_DESCENDXXX -offset indent
-.It KTROP_SET Ta "Enable trace points specified in"
-.Fa trpoints .
-.It KTROP_CLEAR Ta "Disable trace points specified in"
-.Fa trpoints .
-.It KTROP_CLEARFILE Ta "Stop all tracing."
-.It KTRFLAG_DESCEND Ta "The tracing change should apply to the"
-specified process and all its current children.
-.El
-.Pp
-The
-.Fa trpoints
-argument specifies the trace points of interest.
-The defined trace points are:
-.Bl -column KTRFAC_PROCCTORXXX -offset indent
-.It KTRFAC_SYSCALL Ta "Trace system calls."
-.It KTRFAC_SYSRET Ta "Trace return values from system calls."
-.It KTRFAC_NAMEI Ta "Trace name lookup operations."
-.It KTRFAC_GENIO Ta "Trace all I/O (note that this option can"
-generate much output).
-.It KTRFAC_PSIG Ta "Trace posted signals."
-.It KTRFAC_CSW Ta "Trace context switch points."
-.It KTRFAC_USER Ta "Trace application-specific events."
-.It KTRFAC_STRUCT Ta "Trace certain data structures."
-.It KTRFAC_SYSCTL Ta "Trace sysctls."
-.It KTRFAC_PROCCTOR Ta "Trace process construction."
-.It KTRFAC_PROCDTOR Ta "Trace process destruction."
-.It KTRFAC_CAPFAIL Ta "Trace capability failures."
-.It KTRFAC_FAULT Ta "Trace page faults."
-.It KTRFAC_FAULTEND Ta "Trace the end of page faults."
-.It KTRFAC_INHERIT Ta "Inherit tracing to future children."
-.El
-.Pp
-Each tracing event outputs a record composed of a generic header
-followed by a trace point specific structure.
-The generic header is:
-.Bd -literal
-struct ktr_header {
- int ktr_len; /* length of buf */
- short ktr_type; /* trace record type */
- pid_t ktr_pid; /* process id */
- char ktr_comm[MAXCOMLEN+1]; /* command name */
- struct timeval ktr_time; /* timestamp */
- intptr_t ktr_tid; /* was ktr_buffer */
-};
-.Ed
-.Pp
-The
-.Va ktr_len
-field specifies the length of the
-.Va ktr_type
-data that follows this header.
-The
-.Va ktr_pid
-and
-.Va ktr_comm
-fields specify the process and command generating the record.
-The
-.Va ktr_time
-field gives the time (with microsecond resolution)
-that the record was generated.
-The
-.Va ktr_tid
-field holds a thread id.
-.Pp
-The generic header is followed by
-.Va ktr_len
-bytes of a
-.Va ktr_type
-record.
-The type specific records are defined in the
-.In sys/ktrace.h
-include file.
-.Sh SYSCTL TUNABLES
-The following
-.Xr sysctl 8
-tunables influence the behaviour of
-.Fn ktrace :
-.Bl -tag -width indent
-.It Va kern.ktrace.geniosize
-bounds the amount of data a traced I/O request will log
-to the trace file.
-.It Va kern.ktrace.request_pool
-bounds the number of trace events being logged at a time.
-.El
-.Pp
-Sysctl tunables that control process debuggability (as determined by
-.Xr p_candebug 9 )
-also affect the operation of
-.Fn ktrace .
-.Sh RETURN VALUES
-.Rv -std ktrace
-.Sh ERRORS
-The
-.Fn ktrace
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er ENOTDIR
-A component of the path prefix is not a directory.
-.It Bq Er ENAMETOOLONG
-A component of a pathname exceeded 255 characters,
-or an entire path name exceeded 1023 characters.
-.It Bq Er ENOENT
-The named tracefile does not exist.
-.It Bq Er EACCES
-Search permission is denied for a component of the path prefix.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating the pathname.
-.It Bq Er EIO
-An I/O error occurred while reading from or writing to the file system.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.It Bq Er ENOSYS
-The kernel was not compiled with
-.Nm
-support.
-.El
-.Pp
-A thread may be unable to log one or more tracing events due to a
-temporary shortage of resources.
-This condition is remembered by the kernel, and the next tracing request
-that succeeds will have the flag
-.Li KTR_DROP
-set in its
-.Va ktr_type
-field.
-.Sh SEE ALSO
-.Xr kdump 1 ,
-.Xr ktrace 1 ,
-.Xr utrace 2 ,
-.Xr sysctl 8 ,
-.Xr p_candebug 9
-.Sh HISTORY
-The
-.Fn ktrace
-system call first appeared in
-.Bx 4.4 .
diff --git a/lib/libc/sys/link.2 b/lib/libc/sys/link.2
deleted file mode 100644
index ab686266cd21..000000000000
--- a/lib/libc/sys/link.2
+++ /dev/null
@@ -1,319 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)link.2 8.3 (Berkeley) 1/12/94
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2021
-.Dt LINK 2
-.Os
-.Sh NAME
-.Nm link ,
-.Nm linkat
-.Nd make a hard file link
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn link "const char *name1" "const char *name2"
-.Ft int
-.Fo linkat
-.Fa "int fd1" "const char *name1" "int fd2" "const char *name2" "int flag"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn link
-system call
-atomically creates the specified directory entry (hard link)
-.Fa name2
-with the attributes of the underlying object pointed at by
-.Fa name1 .
-If the link is successful: the link count of the underlying object
-is incremented;
-.Fa name1
-and
-.Fa name2
-share equal access and rights
-to the
-underlying object.
-.Pp
-If
-.Fa name1
-is removed, the file
-.Fa name2
-is not deleted and the link count of the
-underlying object is
-decremented.
-.Pp
-The object pointed at by the
-.Fa name1
-argument
-must exist for the hard link to
-succeed and
-both
-.Fa name1
-and
-.Fa name2
-must be in the same file system.
-The
-.Fa name1
-argument
-may not be a directory.
-.Pp
-The
-.Fn linkat
-system call is equivalent to
-.Fa link
-except in the case where either
-.Fa name1
-or
-.Fa name2
-or both are relative paths.
-In this case a relative path
-.Fa name1
-is interpreted relative to
-the directory associated with the file descriptor
-.Fa fd1
-instead of the current working directory and similarly for
-.Fa name2
-and the file descriptor
-.Fa fd2 .
-.Pp
-Values for
-.Fa flag
-are constructed by a bitwise-inclusive OR of flags from the following
-list, defined in
-.In fcntl.h :
-.Bl -tag -width indent
-.It Dv AT_SYMLINK_FOLLOW
-If
-.Fa name1
-names a symbolic link, a new link for the target of the symbolic link is
-created.
-.It Dv AT_RESOLVE_BENEATH
-Only walk paths below the directory specified by the
-.Ar fd1
-descriptor.
-See the description of the
-.Dv O_RESOLVE_BENEATH
-flag in the
-.Xr open 2
-manual page.
-.It Dv AT_EMPTY_PATH
-If the
-.Fa name1
-argument is an empty string, link the file referenced by the descriptor
-.Fa fd1 .
-The operation requires that the calling process has the
-.Dv PRIV_VFS_FHOPEN
-privilege, effectively being executed with effective user
-.Dv root .
-.El
-.Pp
-If
-.Fn linkat
-is passed the special value
-.Dv AT_FDCWD
-in the
-.Fa fd1
-or
-.Fa fd2
-parameter, the current working directory is used for the respective
-.Fa name
-argument.
-If both
-.Fa fd1
-and
-.Fa fd2
-have value
-.Dv AT_FDCWD ,
-the behavior is identical to a call to
-.Fn link .
-Unless
-.Fa flag
-contains the
-.Dv AT_SYMLINK_FOLLOW
-flag, if
-.Fa name1
-names a symbolic link, a new link is created for the symbolic link
-.Fa name1
-and not its target.
-.Sh RETURN VALUES
-.Rv -std link
-.Sh ERRORS
-The
-.Fn link
-system call
-will fail and no link will be created if:
-.Bl -tag -width Er
-.It Bq Er ENOTDIR
-A component of either path prefix is not a directory.
-.It Bq Er ENAMETOOLONG
-A component of either pathname exceeded 255 characters,
-or entire length of either path name exceeded 1023 characters.
-.It Bq Er ENOENT
-A component of either path prefix does not exist.
-.It Bq Er EOPNOTSUPP
-The file system containing the file named by
-.Fa name1
-does not support links.
-.It Bq Er EMLINK
-The link count of the file named by
-.Fa name1
-would exceed 32767.
-.It Bq Er EACCES
-A component of either path prefix denies search permission.
-.It Bq Er EACCES
-The requested link requires writing in a directory with a mode
-that denies write permission.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating one of the pathnames.
-.It Bq Er ENOENT
-The file named by
-.Fa name1
-does not exist.
-.It Bq Er EEXIST
-The link named by
-.Fa name2
-does exist.
-.It Bq Er EPERM
-The file named by
-.Fa name1
-is a directory.
-.It Bq Er EPERM
-The file named by
-.Fa name1
-has its immutable or append-only flag set, see the
-.Xr chflags 2
-manual page for more information.
-.It Bq Er EPERM
-The parent directory of the file named by
-.Fa name2
-has its immutable flag set.
-.It Bq Er EXDEV
-The link named by
-.Fa name2
-and the file named by
-.Fa name1
-are on different file systems.
-.It Bq Er ENOSPC
-The directory in which the entry for the new link is being placed
-cannot be extended because there is no space left on the file
-system containing the directory.
-.It Bq Er EDQUOT
-The directory in which the entry for the new link
-is being placed cannot be extended because the
-user's quota of disk blocks on the file system
-containing the directory has been exhausted.
-.It Bq Er EIO
-An I/O error occurred while reading from or writing to
-the file system to make the directory entry.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.It Bq Er EROFS
-The requested link requires writing in a directory on a read-only file
-system.
-.It Bq Er EFAULT
-One of the pathnames specified
-is outside the process's allocated address space.
-.El
-.Pp
-In addition to the errors returned by the
-.Fn link ,
-the
-.Fn linkat
-system call may fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa name1
-or
-.Fa name2
-argument does not specify an absolute path and the
-.Fa fd1
-or
-.Fa fd2
-argument, respectively, is neither
-.Dv AT_FDCWD
-nor a valid file descriptor open for searching.
-.It Bq Er EINVAL
-The value of the
-.Fa flag
-argument is not valid.
-.It Bq Er ENOTDIR
-The
-.Fa name1
-or
-.Fa name2
-argument is not an absolute path and
-.Fa fd1
-or
-.Fa fd2 ,
-respectively, is neither
-.Dv AT_FDCWD
-nor a file descriptor associated with a directory.
-.It Bq Er ENOTCAPABLE
-.Fa name1
-is not strictly relative to the starting directory.
-For example,
-.Fa name1
-is absolute or includes a ".." component that escapes
-the directory hierarchy specified by
-.Fa fd ,
-and the process is in capability mode or the
-.Dv AT_RESOLVE_BENEATH
-flag was specified.
-.El
-.Sh SEE ALSO
-.Xr chflags 2 ,
-.Xr readlink 2 ,
-.Xr symlink 2 ,
-.Xr unlink 2
-.Sh STANDARDS
-The
-.Fn link
-system call is expected to conform to
-.St -p1003.1-90 .
-The
-.Fn linkat
-system call follows The Open Group Extended API Set 2 specification.
-.Sh HISTORY
-The
-.Fn link
-function appeared in
-.At v1 .
-The
-.Fn linkat
-system call appeared in
-.Fx 8.0 .
-.Pp
-The
-.Fn link
-system call traditionally allows the super-user to link directories which
-corrupts the file system coherency.
-This implementation no longer permits it.
diff --git a/lib/libc/sys/lio_listio.2 b/lib/libc/sys/lio_listio.2
deleted file mode 100644
index ef1b1add3376..000000000000
--- a/lib/libc/sys/lio_listio.2
+++ /dev/null
@@ -1,237 +0,0 @@
-.\" Copyright (c) 2003 Tim J. Robbins
-.\" All rights reserved.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd August 22, 2021
-.Dt LIO_LISTIO 2
-.Os
-.Sh NAME
-.Nm lio_listio
-.Nd "list directed I/O (REALTIME)"
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In aio.h
-.Ft int
-.Fo lio_listio
-.Fa "int mode"
-.Fa "struct aiocb * const list[]"
-.Fa "int nent"
-.Fa "struct sigevent *sig"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn lio_listio
-function initiates a list of I/O requests with a single function call.
-The
-.Fa list
-argument is an array of pointers to
-.Vt aiocb
-structures describing each operation to perform,
-with
-.Fa nent
-elements.
-.Dv NULL
-elements are ignored.
-.Pp
-The
-.Va aio_lio_opcode
-field of each
-.Vt aiocb
-specifies the operation to be performed.
-The following operations are supported:
-.Bl -tag -width ".Dv LIO_WRITE"
-.It Dv LIO_READ
-Read data as if by a call to
-.Xr aio_read 2 .
-.It Dv LIO_READV
-Read data as if by a call to
-.Xr aio_readv 2 .
-.It Dv LIO_NOP
-No operation.
-.It Dv LIO_WRITE
-Write data as if by a call to
-.Xr aio_write 2 .
-.It Dv LIO_WRITEV
-Write data as if by a call to
-.Xr aio_writev 2 .
-.El
-.Pp
-If the
-.Fa mode
-argument is
-.Dv LIO_WAIT ,
-.Fn lio_listio
-does not return until all the requested operations have been completed.
-If
-.Fa mode
-is
-.Dv LIO_NOWAIT ,
-.Fa sig
-can be used to request asynchronous notification when all operations have
-completed.
-If
-.Fa sig
-is
-.Dv NULL ,
-no notification is sent.
-.Pp
-For
-.Dv SIGEV_KEVENT
-notifications,
-the posted kevent will contain:
-.Bl -column ".Va filter"
-.It Sy Member Ta Sy Value
-.It Va ident Ta Fa list
-.It Va filter Ta Dv EVFILT_LIO
-.It Va udata Ta
-value stored in
-.Fa sig->sigev_value
-.El
-.Pp
-For
-.Dv SIGEV_SIGNO
-and
-.Dv SIGEV_THREAD_ID
-notifications,
-the information for the queued signal will include
-.Dv SI_ASYNCIO
-in the
-.Va si_code
-field and the value stored in
-.Fa sig->sigev_value
-in the
-.Va si_value
-field.
-.Pp
-For
-.Dv SIGEV_THREAD
-notifications,
-the value stored in
-.Fa sig->sigev_value
-is passed to the
-.Fa sig->sigev_notify_function
-as described in
-.Xr sigevent 3 .
-.Pp
-The order in which the requests are carried out is not specified;
-in particular, there is no guarantee that they will be executed in
-the order 0, 1, ...,
-.Fa nent Ns \-1 .
-.Sh RETURN VALUES
-If
-.Fa mode
-is
-.Dv LIO_WAIT ,
-the
-.Fn lio_listio
-function returns 0 if the operations completed successfully,
-otherwise \-1.
-.Pp
-If
-.Fa mode
-is
-.Dv LIO_NOWAIT ,
-the
-.Fn lio_listio
-function returns 0 if the operations are successfully queued,
-otherwise \-1.
-.Sh ERRORS
-The
-.Fn lio_listio
-function will fail if:
-.Bl -tag -width Er
-.It Bq Er EAGAIN
-There are not enough resources to enqueue the requests.
-.It Bq Er EAGAIN
-The request would cause the system-wide limit
-.Dv {AIO_MAX}
-to be exceeded.
-.It Bq Er EINVAL
-The
-.Fa mode
-argument is neither
-.Dv LIO_WAIT
-nor
-.Dv LIO_NOWAIT ,
-or
-.Fa nent
-is greater than
-.Dv {AIO_LISTIO_MAX} .
-.It Bq Er EINVAL
-The asynchronous notification method in
-.Fa sig->sigev_notify
-is invalid or not supported.
-.It Bq Er EINTR
-A signal interrupted the system call before it could be completed.
-.It Bq Er EIO
-One or more requests failed.
-.El
-.Pp
-In addition, the
-.Fn lio_listio
-function may fail for any of the reasons listed for
-.Xr aio_read 2
-and
-.Xr aio_write 2 .
-.Pp
-If
-.Fn lio_listio
-succeeds, or fails with an error code of
-.Er EAGAIN , EINTR ,
-or
-.Er EIO ,
-some of the requests may have been initiated.
-The caller should check the error status of each
-.Vt aiocb
-structure individually by calling
-.Xr aio_error 2 .
-.Sh SEE ALSO
-.Xr aio_error 2 ,
-.Xr aio_read 2 ,
-.Xr aio_readv 2 ,
-.Xr aio_write 2 ,
-.Xr aio_writev 2 ,
-.Xr read 2 ,
-.Xr write 2 ,
-.Xr sigevent 3 ,
-.Xr siginfo 3 ,
-.Xr aio 4
-.Sh STANDARDS
-The
-.Fn lio_listio
-function is expected to conform to
-.St -p1003.1-2001 .
-The
-.Dv LIO_READV
-and
-.Dv LIO_WRITEV
-operations are
-.Fx extensions, and should not be used in portable code.
-.Sh HISTORY
-The
-.Fn lio_listio
-system call first appeared in
-.Fx 3.0 .
diff --git a/lib/libc/sys/listen.2 b/lib/libc/sys/listen.2
deleted file mode 100644
index 4d0962fd412c..000000000000
--- a/lib/libc/sys/listen.2
+++ /dev/null
@@ -1,193 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" From: @(#)listen.2 8.2 (Berkeley) 12/11/93
-.\" $FreeBSD$
-.\"
-.Dd April 14, 2020
-.Dt LISTEN 2
-.Os
-.Sh NAME
-.Nm listen
-.Nd listen for connections on a socket
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/socket.h
-.Ft int
-.Fn listen "int s" "int backlog"
-.Sh DESCRIPTION
-To accept connections, a socket
-is first created with
-.Xr socket 2 ,
-a willingness to accept incoming connections and
-a queue limit for incoming connections are specified with
-.Fn listen ,
-and then the connections are
-accepted with
-.Xr accept 2 .
-The
-.Fn listen
-system call applies only to sockets of type
-.Dv SOCK_STREAM
-or
-.Dv SOCK_SEQPACKET .
-.Pp
-The
-.Fa backlog
-argument defines the maximum length the queue of
-pending connections may grow to.
-The real maximum queue length will be 1.5 times more than the value
-specified in the
-.Fa backlog
-argument.
-A subsequent
-.Fn listen
-system call on the listening socket allows the caller to change the maximum
-queue length using a new
-.Fa backlog
-argument.
-If a connection
-request arrives with the queue full the client may
-receive an error with an indication of
-.Er ECONNREFUSED ,
-or, in the case of TCP, the connection will be
-silently dropped.
-.Pp
-Current queue lengths of listening sockets can be queried using
-.Xr netstat 1
-command.
-.Pp
-Note that before
-.Fx 4.5
-and the introduction of the syncache,
-the
-.Fa backlog
-argument also determined the length of the incomplete
-connection queue, which held TCP sockets in the process
-of completing TCP's 3-way handshake.
-These incomplete connections
-are now held entirely in the syncache, which is unaffected by
-queue lengths.
-Inflated
-.Fa backlog
-values to help handle denial
-of service attacks are no longer necessary.
-.Pp
-The
-.Xr sysctl 3
-MIB variable
-.Va kern.ipc.soacceptqueue
-specifies a hard limit on
-.Fa backlog ;
-if a value greater than
-.Va kern.ipc.soacceptqueue
-or less than zero is specified,
-.Fa backlog
-is silently forced to
-.Va kern.ipc.soacceptqueue .
-.Pp
-If the listen queue overflows, the kernel will emit a LOG_DEBUG syslog message.
-The
-.Xr sysctl 3
-MIB variable
-.Va kern.ipc.sooverinterval
-specifies a per-socket limit on how often the kernel will emit these messages.
-.Sh INTERACTION WITH ACCEPT FILTERS
-When accept filtering is used on a socket, a second queue will
-be used to hold sockets that have connected, but have not yet
-met their accept filtering criteria.
-Once the criteria has been
-met, these sockets will be moved over into the completed connection
-queue to be
-.Xr accept 2 Ns ed .
-If this secondary queue is full and a
-new connection comes in, the oldest socket which has not yet met
-its accept filter criteria will be terminated.
-.Pp
-This secondary queue, like the primary listen queue, is sized
-according to the
-.Fa backlog
-argument.
-.Sh RETURN VALUES
-.Rv -std listen
-.Sh ERRORS
-The
-.Fn listen
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The argument
-.Fa s
-is not a valid descriptor.
-.It Bq Er EDESTADDRREQ
-The socket is not bound to a local address, and the protocol does not
-support listening on an unbound socket.
-.It Bq Er EINVAL
-The socket is already connected, or in the process of being connected.
-.It Bq Er ENOTSOCK
-The argument
-.Fa s
-is not a socket.
-.It Bq Er EOPNOTSUPP
-The socket is not of a type that supports the operation
-.Fn listen .
-.El
-.Sh SEE ALSO
-.Xr netstat 1 ,
-.Xr accept 2 ,
-.Xr connect 2 ,
-.Xr socket 2 ,
-.Xr sysctl 3 ,
-.Xr sysctl 8 ,
-.Xr accept_filter 9
-.Sh HISTORY
-The
-.Fn listen
-system call appeared in
-.Bx 4.2 .
-The ability to configure the maximum
-.Fa backlog
-at run-time, and to use a negative
-.Fa backlog
-to request the maximum allowable value, was introduced in
-.Fx 2.2 .
-The
-.Va kern.ipc.somaxconn
-.Xr sysctl 3
-has been replaced with
-.Va kern.ipc.soacceptqueue
-in
-.Fx 10.0
-to prevent confusion about its actual functionality.
-The original
-.Xr sysctl 3
-.Va kern.ipc.somaxconn
-is still available but hidden from a
-.Xr sysctl 3
--a output so that existing applications and scripts continue to work.
diff --git a/lib/libc/gen/lockf.c b/lib/libc/sys/lockf.c
index 20f016dd1694..6211275e5f16 100644
--- a/lib/libc/gen/lockf.c
+++ b/lib/libc/sys/lockf.c
@@ -1,6 +1,6 @@
/* $NetBSD: lockf.c,v 1.3 2008/04/28 20:22:59 martin Exp $ */
/*-
- * SPDX-License-Identifier: BSD-2-Clause-NetBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 1997 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -30,9 +30,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <errno.h>
#include <fcntl.h>
@@ -66,8 +63,8 @@ lockf(int filedes, int function, off_t size)
case F_TEST:
fl.l_type = F_WRLCK;
if (((int (*)(int, int, ...))
- __libc_interposing[INTERPOS_fcntl])(filedes, F_GETLK, &fl)
- == -1)
+ *(__libc_interposing_slot(INTERPOS_fcntl)))
+ (filedes, F_GETLK, &fl) == -1)
return (-1);
if (fl.l_type == F_UNLCK || (fl.l_sysid == 0 &&
fl.l_pid == getpid()))
@@ -81,6 +78,5 @@ lockf(int filedes, int function, off_t size)
/* NOTREACHED */
}
- return (((int (*)(int, int, ...))
- __libc_interposing[INTERPOS_fcntl])(filedes, cmd, &fl));
+ return (INTERPOS_SYS(fcntl, filedes, cmd, (intptr_t)&fl));
}
diff --git a/lib/libc/sys/lseek.2 b/lib/libc/sys/lseek.2
deleted file mode 100644
index 57cb11af2e79..000000000000
--- a/lib/libc/sys/lseek.2
+++ /dev/null
@@ -1,246 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)lseek.2 8.3 (Berkeley) 4/19/94
-.\" $FreeBSD$
-.\"
-.Dd July 13, 2020
-.Dt LSEEK 2
-.Os
-.Sh NAME
-.Nm lseek
-.Nd reposition read/write file offset
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft off_t
-.Fn lseek "int fildes" "off_t offset" "int whence"
-.Sh DESCRIPTION
-The
-.Fn lseek
-system call repositions the offset of the file descriptor
-.Fa fildes
-to the
-argument
-.Fa offset
-according to the directive
-.Fa whence .
-The argument
-.Fa fildes
-must be an open
-file descriptor.
-The
-.Fn lseek
-system call
-repositions the file position pointer associated with the file
-descriptor
-.Fa fildes
-as follows:
-.Bl -item -offset indent
-.It
-If
-.Fa whence
-is
-.Dv SEEK_SET ,
-the offset is set to
-.Fa offset
-bytes.
-.It
-If
-.Fa whence
-is
-.Dv SEEK_CUR ,
-the offset is set to its current location plus
-.Fa offset
-bytes.
-.It
-If
-.Fa whence
-is
-.Dv SEEK_END ,
-the offset is set to the size of the
-file plus
-.Fa offset
-bytes.
-.It
-If
-.Fa whence
-is
-.Dv SEEK_HOLE ,
-the offset is set to the start of the next hole greater than or equal
-to the supplied
-.Fa offset .
-The definition of a hole is provided below.
-.It
-If
-.Fa whence
-is
-.Dv SEEK_DATA ,
-the offset is set to the start of the next non-hole file region greater
-than or equal to the supplied
-.Fa offset .
-.El
-.Pp
-The
-.Fn lseek
-system call allows the file offset to be set beyond the end
-of the existing end-of-file of the file.
-If data is later written
-at this point, subsequent reads of the data in the gap return
-bytes of zeros (until data is actually written into the gap).
-However, the
-.Fn lseek
-system call does not, by itself, extend the size of a file.
-.Pp
-A
-.Qq hole
-is defined as a contiguous range of bytes in a file, all having the value of
-zero, but not all zeros in a file are guaranteed to be represented as holes
-returned with
-.Dv SEEK_HOLE .
-File systems are allowed to expose ranges of zeros with
-.Dv SEEK_HOLE ,
-but not required to.
-Applications can use
-.Dv SEEK_HOLE
-to optimise their behavior for ranges of zeros, but must not depend on it to
-find all such ranges in a file.
-Each file is presented as having a zero-size virtual hole at the very
-end of the file.
-The existence of a hole at the end of every data region allows for easy
-programming and also provides compatibility to the original implementation
-in Solaris.
-It also causes the current file size (i.e., end-of-file offset) to be returned
-to indicate that there are no more holes past the supplied
-.Fa offset .
-Applications should use
-.Fn fpathconf _PC_MIN_HOLE_SIZE
-or
-.Fn pathconf _PC_MIN_HOLE_SIZE
-to determine if a file system supports
-.Dv SEEK_HOLE .
-See
-.Xr pathconf 2 .
-.Pp
-For file systems that do not supply information about holes, the file will be
-represented as one entire data region.
-.Sh RETURN VALUES
-Upon successful completion,
-.Fn lseek
-returns the resulting offset location as measured in bytes from the
-beginning of the file.
-Otherwise,
-a value of -1 is returned and
-.Va errno
-is set to indicate
-the error.
-.Sh ERRORS
-The
-.Fn lseek
-system call
-will fail and the file position pointer will remain unchanged if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa fildes
-argument
-is not an open file descriptor.
-.It Bq Er EINVAL
-The
-.Fa whence
-argument
-is not a proper value
-or the resulting file offset would
-be negative for a non-character special file.
-.It Bq Er ENXIO
-For
-.Dv SEEK_DATA ,
-there are no more data regions past the supplied offset.
-Due to existence of the hole at the end of the file, for
-.Dv SEEK_HOLE
-this error is only returned when the
-.Fa offset
-already points to the end-of-file position.
-.It Bq Er EOVERFLOW
-The resulting file offset would be a value which cannot be represented
-correctly in an object of type
-.Fa off_t .
-.It Bq Er ESPIPE
-The
-.Fa fildes
-argument
-is associated with a pipe, socket, or FIFO.
-.El
-.Sh SEE ALSO
-.Xr dup 2 ,
-.Xr open 2 ,
-.Xr pathconf 2
-.Sh STANDARDS
-The
-.Fn lseek
-system call is expected to conform to
-.St -p1003.1-2008 .
-.Pp
-The
-.Dv SEEK_HOLE
-and
-.Dv SEEK_DATA
-directives, along with the
-.Er ENXIO
-error, are extensions to that specification.
-.Sh HISTORY
-The
-.Fn lseek
-function appeared in
-.At v7 .
-.Sh BUGS
-If the
-.Fn lseek
-system call is operating on a device which is incapable of seeking,
-it will request the seek operation and return successfully,
-even though no seek was performed.
-Because the
-.Ar offset
-argument will be stored unconditionally in the file descriptor of that device,
-there is no way to confirm if the seek operation succeeded or not
-(e.g. using the
-.Fn ftell
-function).
-Device types which are known to be incapable of seeking include
-tape drives.
-.Pp
-The
-.Fn lseek
-system call will not detect whether media are present in changeable
-media devices such as DVD or Blu-ray devices.
-A requested seek operation will therefore return sucessfully when no
-medium is present.
-.Pp
-This document's use of
-.Fa whence
-is incorrect English, but is maintained for historical reasons.
diff --git a/lib/libc/sys/lstat.c b/lib/libc/sys/lstat.c
index 4b7e0b1bf2b8..3a6421120434 100644
--- a/lib/libc/sys/lstat.c
+++ b/lib/libc/sys/lstat.c
@@ -24,27 +24,17 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
+#include <sys/fcntl.h>
#include <sys/syscall.h>
-#include "compat-ino64.h"
+#include <sys/stat.h>
#include <unistd.h>
-
#include "libc_private.h"
int
lstat(const char *path, struct stat *sb)
{
- struct freebsd11_stat stat11;
- int rv;
- if (__getosreldate() >= INO64_FIRST)
- return (__sys_fstatat(AT_FDCWD, path, sb, AT_SYMLINK_NOFOLLOW));
- rv = syscall(SYS_freebsd11_lstat, path, &stat11);
- if (rv == 0)
- __stat11_to_stat(&stat11, sb);
- return (rv);
+ return (__sys_fstatat(AT_FDCWD, path, sb, AT_SYMLINK_NOFOLLOW));
}
diff --git a/lib/libc/sys/madvise.2 b/lib/libc/sys/madvise.2
deleted file mode 100644
index 6d0d3d2575a6..000000000000
--- a/lib/libc/sys/madvise.2
+++ /dev/null
@@ -1,186 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)madvise.2 8.1 (Berkeley) 6/9/93
-.\" $FreeBSD$
-.\"
-.Dd July 12, 2015
-.Dt MADVISE 2
-.Os
-.Sh NAME
-.Nm madvise , posix_madvise
-.Nd give advice about use of memory
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/mman.h
-.Ft int
-.Fn madvise "void *addr" "size_t len" "int behav"
-.Ft int
-.Fn posix_madvise "void *addr" "size_t len" "int behav"
-.Sh DESCRIPTION
-The
-.Fn madvise
-system call
-allows a process that has knowledge of its memory behavior
-to describe it to the system.
-The
-.Fn posix_madvise
-interface is identical, except it returns an error number on error and does
-not modify
-.Va errno ,
-and is provided for standards conformance.
-.Pp
-The known behaviors are:
-.Bl -tag -width MADV_SEQUENTIAL
-.It Dv MADV_NORMAL
-Tells the system to revert to the default paging
-behavior.
-.It Dv MADV_RANDOM
-Is a hint that pages will be accessed randomly, and prefetching
-is likely not advantageous.
-.It Dv MADV_SEQUENTIAL
-Causes the VM system to depress the priority of
-pages immediately preceding a given page when it is faulted in.
-.It Dv MADV_WILLNEED
-Causes pages that are in a given virtual address range
-to temporarily have higher priority, and if they are in
-memory, decrease the likelihood of them being freed.
-Additionally,
-the pages that are already in memory will be immediately mapped into
-the process, thereby eliminating unnecessary overhead of going through
-the entire process of faulting the pages in.
-This WILL NOT fault
-pages in from backing store, but quickly map the pages already in memory
-into the calling process.
-.It Dv MADV_DONTNEED
-Allows the VM system to decrease the in-memory priority
-of pages in the specified address range.
-Consequently, future references to this address range are more likely
-to incur a page fault.
-.It Dv MADV_FREE
-Gives the VM system the freedom to free pages,
-and tells the system that information in the specified page range
-is no longer important.
-This is an efficient way of allowing
-.Xr malloc 3
-to free pages anywhere in the address space, while keeping the address space
-valid.
-The next time that the page is referenced, the page might be demand
-zeroed, or might contain the data that was there before the
-.Dv MADV_FREE
-call.
-References made to that address space range will not make the VM system
-page the information back in from backing store until the page is
-modified again.
-.It Dv MADV_NOSYNC
-Request that the system not flush the data associated with this map to
-physical backing store unless it needs to.
-Typically this prevents the
-file system update daemon from gratuitously writing pages dirtied
-by the VM system to physical disk.
-Note that VM/file system coherency is
-always maintained, this feature simply ensures that the mapped data is
-only flush when it needs to be, usually by the system pager.
-.Pp
-This feature is typically used when you want to use a file-backed shared
-memory area to communicate between processes (IPC) and do not particularly
-need the data being stored in that area to be physically written to disk.
-With this feature you get the equivalent performance with mmap that you
-would expect to get with SysV shared memory calls, but in a more controllable
-and less restrictive manner.
-However, note that this feature is not portable
-across UNIX platforms (though some may do the right thing by default).
-For more information see the MAP_NOSYNC section of
-.Xr mmap 2
-.It Dv MADV_AUTOSYNC
-Undoes the effects of MADV_NOSYNC for any future pages dirtied within the
-address range.
-The effect on pages already dirtied is indeterminate - they
-may or may not be reverted.
-You can guarantee reversion by using the
-.Xr msync 2
-or
-.Xr fsync 2
-system calls.
-.It Dv MADV_NOCORE
-Region is not included in a core file.
-.It Dv MADV_CORE
-Include region in a core file.
-.It Dv MADV_PROTECT
-Informs the VM system this process should not be killed when the
-swap space is exhausted.
-The process must have superuser privileges.
-This should be used judiciously in processes that must remain running
-for the system to properly function.
-.El
-.Pp
-Portable programs that call the
-.Fn posix_madvise
-interface should use the aliases
-.Dv POSIX_MADV_NORMAL , POSIX_MADV_SEQUENTIAL ,
-.Dv POSIX_MADV_RANDOM , POSIX_MADV_WILLNEED ,
-and
-.Dv POSIX_MADV_DONTNEED
-rather than the flags described above.
-.Sh RETURN VALUES
-.Rv -std madvise
-.Sh ERRORS
-The
-.Fn madvise
-system call will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Fa behav
-argument is not valid.
-.It Bq Er ENOMEM
-The virtual address range specified by the
-.Fa addr
-and
-.Fa len
-arguments is not valid.
-.It Bq Er EPERM
-.Dv MADV_PROTECT
-was specified and the process does not have superuser privileges.
-.El
-.Sh SEE ALSO
-.Xr mincore 2 ,
-.Xr mprotect 2 ,
-.Xr msync 2 ,
-.Xr munmap 2 ,
-.Xr posix_fadvise 2
-.Sh STANDARDS
-The
-.Fn posix_madvise
-interface conforms to
-.St -p1003.1-2001 .
-.Sh HISTORY
-The
-.Fn madvise
-system call first appeared in
-.Bx 4.4 .
diff --git a/lib/libc/sys/mincore.2 b/lib/libc/sys/mincore.2
deleted file mode 100644
index 3b248e77816b..000000000000
--- a/lib/libc/sys/mincore.2
+++ /dev/null
@@ -1,152 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)mincore.2 8.1 (Berkeley) 6/9/93
-.\" $FreeBSD$
-.\"
-.Dd August 23, 2020
-.Dt MINCORE 2
-.Os
-.Sh NAME
-.Nm mincore
-.Nd determine residency of memory pages
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/mman.h
-.Ft int
-.Fn mincore "const void *addr" "size_t len" "char *vec"
-.Sh DESCRIPTION
-The
-.Fn mincore
-system call determines whether each of the pages in the region beginning at
-.Fa addr
-and continuing for
-.Fa len
-bytes is resident or mapped, depending on the value of sysctl
-.Va vm.mincore_mapped .
-.\"The beginning address,
-.\".Fa addr ,
-.\"is first rounded down to a multiple of the page size (see
-.\".Xr getpagesize 3 ) .
-.\"The end address,
-.\".Fa addr No + Fa len ,
-.\"is rounded up to a multiple of the page size.
-The status is returned in the
-.Fa vec
-array, one character per page.
-Each character is either 0 if the page is not resident, or a combination of
-the following flags (defined in
-.In sys/mman.h ) :
-.Bl -tag -width ".Dv MINCORE_REFERENCED_OTHER"
-.It Dv MINCORE_INCORE
-Page is in core (resident).
-.It Dv MINCORE_REFERENCED
-Page has been referenced by us.
-.It Dv MINCORE_MODIFIED
-Page has been modified by us.
-.It Dv MINCORE_REFERENCED_OTHER
-Page has been referenced.
-.It Dv MINCORE_MODIFIED_OTHER
-Page has been modified.
-.It Dv MINCORE_PSIND(i)
-Page is part of a large
-.Pq Dq super
-page with size given by index
-.Dv i
-in the array returned by
-.Xr getpagesizes 3 .
-.It Dv MINCORE_SUPER
-A mask of the valid
-.Dv MINCORE_PSIND()
-values.
-If any bits in this mask are set, the page is part of a large
-.Pq Dq super
-page.
-.El
-.Pp
-The information returned by
-.Fn mincore
-may be out of date by the time the system call returns.
-The only way to ensure that a page is resident is to lock it into memory
-with the
-.Xr mlock 2
-system call.
-.Pp
-If the
-.Va vm.mincore_mapped
-sysctl is set to a non-zero value (default), only the current process'
-mappings of the pages in the specified virtual address range are examined.
-This does not preclude the system from returning
-.Dv MINCORE_REFERENCED_OTHER
-and
-.Dv MINCORE_MODIFIED_OTHER
-statuses.
-Otherwise, if the sysctl value is zero, all resident pages backing the
-specified address range are examined, regardless of the mapping state.
-.Sh IMPLEMENTATION NOTES
-Prior to the introduction of
-.Dv MINCORE_PSIND()
-in
-.Fx 13.0 ,
-.Dv MINCORE_SUPER
-consisted of a single bit equal to
-.Dv MINCORE_PSIND(1) .
-In particular, applications compiled using the old value of
-.Dv MINCORE_SUPER
-will not identify large pages with size index 2 as being large pages.
-.Sh RETURN VALUES
-.Rv -std mincore
-.Sh ERRORS
-The
-.Fn mincore
-system call will fail if:
-.Bl -tag -width Er
-.It Bq Er ENOMEM
-The virtual address range specified by the
-.Fa addr
-and
-.Fa len
-arguments is not fully mapped.
-.It Bq Er EFAULT
-The
-.Fa vec
-argument points to an illegal address.
-.El
-.Sh SEE ALSO
-.Xr madvise 2 ,
-.Xr mlock 2 ,
-.Xr mprotect 2 ,
-.Xr msync 2 ,
-.Xr munmap 2 ,
-.Xr getpagesize 3 ,
-.Xr getpagesizes 3
-.Sh HISTORY
-The
-.Fn mincore
-system call first appeared in
-.Bx 4.4 .
diff --git a/lib/libc/sys/minherit.2 b/lib/libc/sys/minherit.2
deleted file mode 100644
index 8980a5149893..000000000000
--- a/lib/libc/sys/minherit.2
+++ /dev/null
@@ -1,151 +0,0 @@
-.\" $FreeBSD$
-.\"
-.\" Copyright (c) 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)minherit.2 8.1 (Berkeley) 6/9/93
-.\"
-.Dd March 15, 2017
-.Dt MINHERIT 2
-.Os
-.Sh NAME
-.Nm minherit
-.Nd control the inheritance of pages
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/mman.h
-.Ft int
-.Fn minherit "void *addr" "size_t len" "int inherit"
-.Sh DESCRIPTION
-The
-.Fn minherit
-system call
-changes the specified pages to have the inheritance characteristic
-.Fa inherit .
-Not all implementations will guarantee that the inheritance characteristic
-can be set on a page basis;
-the granularity of changes may be as large as an entire region.
-.Fx
-is capable of adjusting inheritance characteristics on a page basis.
-Inheritance only effects children created by
-.Fn fork .
-It has no effect on
-.Fn exec .
-exec'd processes replace their address space entirely.
-This system call also
-has no effect on the parent's address space (other than to potentially
-share the address space with its children).
-.Pp
-Inheritance is a rather esoteric feature largely superseded by the
-.Dv MAP_SHARED
-feature of
-.Fn mmap .
-However, it is possible to use
-.Fn minherit
-to share a block of memory between parent and child that has been mapped
-.Dv MAP_PRIVATE .
-That is, modifications made by parent or child are shared but
-the original underlying file is left untouched.
-.Bl -tag -width ".Dv INHERIT_SHARE"
-.It Dv INHERIT_SHARE
-This option causes the address space in question to be shared between
-parent and child.
-It has no effect on how the original underlying backing
-store was mapped.
-.It Dv INHERIT_NONE
-This option prevents the address space in question from being inherited
-at all.
-The address space will be unmapped in the child.
-.It Dv INHERIT_COPY
-This option causes the child to inherit the address space as copy-on-write.
-This option also has an unfortunate side effect of causing the parent
-address space to become copy-on-write when the parent forks.
-If the original mapping was
-.Dv MAP_SHARED ,
-it will no longer be shared in the parent
-after the parent forks and there is no way to get the previous
-shared-backing-store mapping without unmapping and remapping the address
-space in the parent.
-.It Dv INHERIT_ZERO
-This option causes the address space in question to be mapped as new
-anonymous pages,
-which would be initialized to all zero bytes,
-in the child process.
-.El
-.Sh RETURN VALUES
-.Rv -std minherit
-.Sh ERRORS
-The
-.Fn minherit
-system call will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The virtual address range specified by the
-.Fa addr
-and
-.Fa len
-arguments is not valid.
-.It Bq Er EACCES
-The flags specified by the
-.Fa inherit
-argument were not valid for the pages specified
-by the
-.Fa addr
-and
-.Fa len
-arguments.
-.El
-.Sh SEE ALSO
-.Xr fork 2 ,
-.Xr madvise 2 ,
-.Xr mincore 2 ,
-.Xr mprotect 2 ,
-.Xr msync 2 ,
-.Xr munmap 2 ,
-.Xr rfork 2
-.Sh HISTORY
-The
-.Fn minherit
-system call first appeared in
-.Ox
-and then in
-.Fx 2.2 .
-.Pp
-The
-.Dv INHERIT_ZERO
-support first appeared in
-.Ox 5.6
-and then in
-.Fx 12.0 .
-.Sh BUGS
-Once you set inheritance to
-.Dv MAP_PRIVATE
-or
-.Dv MAP_SHARED ,
-there is no way to recover the original copy-on-write semantics
-short of unmapping and remapping the area.
diff --git a/lib/libc/sys/mkdir.2 b/lib/libc/sys/mkdir.2
deleted file mode 100644
index b926705c2f17..000000000000
--- a/lib/libc/sys/mkdir.2
+++ /dev/null
@@ -1,182 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)mkdir.2 8.2 (Berkeley) 12/11/93
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2020
-.Dt MKDIR 2
-.Os
-.Sh NAME
-.Nm mkdir ,
-.Nm mkdirat
-.Nd make a directory file
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/stat.h
-.Ft int
-.Fn mkdir "const char *path" "mode_t mode"
-.Ft int
-.Fn mkdirat "int fd" "const char *path" "mode_t mode"
-.Sh DESCRIPTION
-The directory
-.Fa path
-is created with the access permissions specified by
-.Fa mode
-and restricted by the
-.Xr umask 2
-of the calling process.
-.Pp
-The directory's owner ID is set to the process's effective user ID.
-The directory's group ID is set to that of the parent directory in
-which it is created.
-.Pp
-The
-.Fn mkdirat
-system call is equivalent to
-.Fn mkdir
-except in the case where
-.Fa path
-specifies a relative path.
-In this case the newly created directory is created relative to the
-directory associated with the file descriptor
-.Fa fd
-instead of the current working directory.
-If
-.Fn mkdirat
-is passed the special value
-.Dv AT_FDCWD
-in the
-.Fa fd
-parameter, the current working directory is used and the behavior is
-identical to a call to
-.Fn mkdir .
-.Sh RETURN VALUES
-.Rv -std mkdir
-.Sh ERRORS
-The
-.Fn mkdir
-system call
-will fail and no directory will be created if:
-.Bl -tag -width Er
-.It Bq Er ENOTDIR
-A component of the path prefix is not a directory.
-.It Bq Er ENAMETOOLONG
-A component of a pathname exceeded 255 characters,
-or an entire path name exceeded 1023 characters.
-.It Bq Er ENOENT
-A component of the path prefix does not exist.
-.It Bq Er EACCES
-Search permission is denied for a component of the path prefix,
-or write permission is denied
-on the parent directory of the directory to be created.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating the pathname.
-.It Bq Er EPERM
-The parent directory of the directory to be created has its immutable flag set,
-see the
-.Xr chflags 2
-manual page for more information.
-.It Bq Er EROFS
-The named directory would reside on a read-only file system.
-.It Bq Er EMLINK
-The new directory cannot be created because the parent directory contains
-too many subdirectories.
-.It Bq Er EEXIST
-The named file exists.
-.It Bq Er ENOSPC
-The new directory cannot be created because there is no space left
-on the file system that will contain the directory.
-.It Bq Er ENOSPC
-There are no free inodes on the file system on which the
-directory is being created.
-.It Bq Er EDQUOT
-The new directory cannot be created because the user's
-quota of disk blocks on the file system that will
-contain the directory has been exhausted.
-.It Bq Er EDQUOT
-The user's quota of inodes on the file system on
-which the directory is being created has been exhausted.
-.It Bq Er EIO
-An I/O error occurred while making the directory entry or allocating the inode.
-.It Bq Er EIO
-An I/O error occurred while reading from or writing to the file system.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.It Bq Er EFAULT
-The
-.Fa path
-argument
-points outside the process's allocated address space.
-.El
-.Pp
-In addition to the errors returned by the
-.Fn mkdir ,
-the
-.Fn mkdirat
-may fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa path
-argument does not specify an absolute path and the
-.Fa fd
-argument is neither
-.Dv AT_FDCWD
-nor a valid file descriptor open for searching.
-.It Bq Er ENOTDIR
-The
-.Fa path
-argument is not an absolute path and
-.Fa fd
-is neither
-.Dv AT_FDCWD
-nor a file descriptor associated with a directory.
-.El
-.Sh SEE ALSO
-.Xr chflags 2 ,
-.Xr chmod 2 ,
-.Xr stat 2 ,
-.Xr umask 2
-.Sh STANDARDS
-The
-.Fn mkdir
-system call is expected to conform to
-.St -p1003.1-90 .
-The
-.Fn mkdirat
-system call follows The Open Group Extended API Set 2 specification.
-.Sh HISTORY
-The
-.Fn mkdirat
-system call appeared in
-.Fx 8.0 .
-The
-.Fn mkdir
-system call appeared in
-.At v1 .
diff --git a/lib/libc/sys/mkfifo.2 b/lib/libc/sys/mkfifo.2
deleted file mode 100644
index 60b3b943b3d5..000000000000
--- a/lib/libc/sys/mkfifo.2
+++ /dev/null
@@ -1,183 +0,0 @@
-.\" Copyright (c) 1990, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)mkfifo.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2020
-.Dt MKFIFO 2
-.Os
-.Sh NAME
-.Nm mkfifo ,
-.Nm mkfifoat
-.Nd make a fifo file
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In sys/stat.h
-.Ft int
-.Fn mkfifo "const char *path" "mode_t mode"
-.Ft int
-.Fn mkfifoat "int fd" "const char *path" "mode_t mode"
-.Sh DESCRIPTION
-The
-.Fn mkfifo
-system call
-creates a new fifo file with name
-.Fa path .
-The access permissions are
-specified by
-.Fa mode
-and restricted by the
-.Xr umask 2
-of the calling process.
-.Pp
-The fifo's owner ID is set to the process's effective user ID.
-The fifo's group ID is set to that of the parent directory in
-which it is created.
-.Pp
-The
-.Fn mkfifoat
-system call is equivalent to
-.Fn mkfifo
-except in the case where
-.Fa path
-specifies a relative path.
-In this case the newly created FIFO is created relative to the
-directory associated with the file descriptor
-.Fa fd
-instead of the current working directory.
-If
-.Fn mkfifoat
-is passed the special value
-.Dv AT_FDCWD
-in the
-.Fa fd
-parameter, the current working directory is used and the behavior is
-identical to a call to
-.Fn mkfifo .
-.Sh RETURN VALUES
-.Rv -std mkfifo
-.Sh ERRORS
-The
-.Fn mkfifo
-system call
-will fail and no fifo will be created if:
-.Bl -tag -width Er
-.It Bq Er ENOTSUP
-The kernel has not been configured to support fifo's.
-.It Bq Er ENOTDIR
-A component of the path prefix is not a directory.
-.It Bq Er ENAMETOOLONG
-A component of a pathname exceeded 255 characters,
-or an entire path name exceeded 1023 characters.
-.It Bq Er ENOENT
-A component of the path prefix does not exist.
-.It Bq Er EACCES
-A component of the path prefix denies search permission, or write permission
-is denied on the parent directory of the fifo to be created.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating the pathname.
-.It Bq Er EROFS
-The named file would reside on a read-only file system.
-.It Bq Er EEXIST
-The named file exists.
-.It Bq Er EPERM
-The parent directory of the named file has its immutable flag set, see the
-.Xr chflags 2
-manual page for more information.
-.It Bq Er ENOSPC
-The directory in which the entry for the new fifo is being placed
-cannot be extended because there is no space left on the file
-system containing the directory.
-.It Bq Er ENOSPC
-There are no free inodes on the file system on which the
-fifo is being created.
-.It Bq Er EDQUOT
-The directory in which the entry for the new fifo
-is being placed cannot be extended because the
-user's quota of disk blocks on the file system
-containing the directory has been exhausted.
-.It Bq Er EDQUOT
-The user's quota of inodes on the file system on
-which the fifo is being created has been exhausted.
-.It Bq Er EIO
-An
-.Tn I/O
-error occurred while making the directory entry or allocating the inode.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.It Bq Er EFAULT
-The
-.Fa path
-argument
-points outside the process's allocated address space.
-.El
-.Pp
-In addition to the errors returned by the
-.Fn mkfifo ,
-the
-.Fn mkfifoat
-may fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa path
-argument does not specify an absolute path and the
-.Fa fd
-argument is neither
-.Dv AT_FDCWD
-nor a valid file descriptor open for searching.
-.It Bq Er ENOTDIR
-The
-.Fa path
-argument is not an absolute path and
-.Fa fd
-is neither
-.Dv AT_FDCWD
-nor a file descriptor associated with a directory.
-.El
-.Sh SEE ALSO
-.Xr chflags 2 ,
-.Xr chmod 2 ,
-.Xr mknod 2 ,
-.Xr stat 2 ,
-.Xr umask 2
-.Sh STANDARDS
-The
-.Fn mkfifo
-system call is expected to conform to
-.St -p1003.1-90 .
-The
-.Fn mkfifoat
-system call follows The Open Group Extended API Set 2 specification.
-.Sh HISTORY
-The
-.Fn mkfifoat
-system call appeared in
-.Fx 8.0 .
diff --git a/lib/libc/sys/mknod.2 b/lib/libc/sys/mknod.2
deleted file mode 100644
index 08117c511936..000000000000
--- a/lib/libc/sys/mknod.2
+++ /dev/null
@@ -1,184 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)mknod.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2020
-.Dt MKNOD 2
-.Os
-.Sh NAME
-.Nm mknod ,
-.Nm mknodat
-.Nd make a special file node
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/stat.h
-.Ft int
-.Fn mknod "const char *path" "mode_t mode" "dev_t dev"
-.Ft int
-.Fn mknodat "int fd" "const char *path" "mode_t mode" "dev_t dev"
-.Sh DESCRIPTION
-The file system node
-.Fa path
-is created with the file type and access permissions specified in
-.Fa mode .
-The access permissions are modified by the process's umask value.
-.Pp
-If
-.Fa mode
-indicates a block or character special file,
-.Fa dev
-is a configuration dependent specification denoting a particular device
-on the system.
-Otherwise,
-.Fa dev
-is ignored.
-.Pp
-The
-.Fn mknod
-system call
-requires super-user privileges.
-.Pp
-The
-.Fn mknodat
-system call is equivalent to
-.Fn mknod
-except in the case where
-.Fa path
-specifies a relative path.
-In this case the newly created device node is created relative to the
-directory associated with the file descriptor
-.Fa fd
-instead of the current working directory.
-If
-.Fn mknodat
-is passed the special value
-.Dv AT_FDCWD
-in the
-.Fa fd
-parameter, the current working directory is used and the behavior is
-identical to a call to
-.Fn mknod .
-.Sh RETURN VALUES
-.Rv -std mknod
-.Sh ERRORS
-The
-.Fn mknod
-system call
-will fail and the file will be not created if:
-.Bl -tag -width Er
-.It Bq Er ENOTDIR
-A component of the path prefix is not a directory.
-.It Bq Er ENAMETOOLONG
-A component of a pathname exceeded 255 characters,
-or an entire path name exceeded 1023 characters.
-.It Bq Er ENOENT
-A component of the path prefix does not exist.
-.It Bq Er EACCES
-Search permission is denied for a component of the path prefix.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating the pathname.
-.It Bq Er EPERM
-The process's effective user ID is not super-user.
-.It Bq Er EIO
-An I/O error occurred while making the directory entry or allocating the inode.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.It Bq Er ENOSPC
-The directory in which the entry for the new node is being placed
-cannot be extended because there is no space left on the file
-system containing the directory.
-.It Bq Er ENOSPC
-There are no free inodes on the file system on which the
-node is being created.
-.It Bq Er EDQUOT
-The directory in which the entry for the new node
-is being placed cannot be extended because the
-user's quota of disk blocks on the file system
-containing the directory has been exhausted.
-.It Bq Er EDQUOT
-The user's quota of inodes on the file system on
-which the node is being created has been exhausted.
-.It Bq Er EROFS
-The named file resides on a read-only file system.
-.It Bq Er EEXIST
-The named file exists.
-.It Bq Er EFAULT
-The
-.Fa path
-argument
-points outside the process's allocated address space.
-.It Bq Er EINVAL
-Creating anything else than a block or character special
-file (or a
-.Em whiteout )
-is not supported.
-.El
-.Pp
-In addition to the errors returned by the
-.Fn mknod ,
-the
-.Fn mknodat
-may fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa path
-argument does not specify an absolute path and the
-.Fa fd
-argument is neither
-.Dv AT_FDCWD
-nor a valid file descriptor open for searching.
-.It Bq Er ENOTDIR
-The
-.Fa path
-argument is not an absolute path and
-.Fa fd
-is neither
-.Dv AT_FDCWD
-nor a file descriptor associated with a directory.
-.El
-.Sh SEE ALSO
-.Xr chmod 2 ,
-.Xr mkfifo 2 ,
-.Xr stat 2 ,
-.Xr umask 2
-.Sh STANDARDS
-The
-.Fn mknodat
-system call follows The Open Group Extended API Set 2 specification.
-.Sh HISTORY
-The
-.Fn mknod
-function appeared in
-.At v4 .
-The
-.Fn mknodat
-system call appeared in
-.Fx 8.0 .
diff --git a/lib/libc/sys/mknod.c b/lib/libc/sys/mknod.c
index 3bb3853b5849..fd224058b5fb 100644
--- a/lib/libc/sys/mknod.c
+++ b/lib/libc/sys/mknod.c
@@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
#include <sys/fcntl.h>
diff --git a/lib/libc/sys/mlock.2 b/lib/libc/sys/mlock.2
deleted file mode 100644
index 040a8f8eaf9e..000000000000
--- a/lib/libc/sys/mlock.2
+++ /dev/null
@@ -1,179 +0,0 @@
-.\" Copyright (c) 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)mlock.2 8.2 (Berkeley) 12/11/93
-.\" $FreeBSD$
-.\"
-.Dd May 13, 2019
-.Dt MLOCK 2
-.Os
-.Sh NAME
-.Nm mlock ,
-.Nm munlock
-.Nd lock (unlock) physical pages in memory
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/mman.h
-.Ft int
-.Fn mlock "const void *addr" "size_t len"
-.Ft int
-.Fn munlock "const void *addr" "size_t len"
-.Sh DESCRIPTION
-The
-.Fn mlock
-system call
-locks into memory the physical pages associated with the virtual address
-range starting at
-.Fa addr
-for
-.Fa len
-bytes.
-The
-.Fn munlock
-system call unlocks pages previously locked by one or more
-.Fn mlock
-calls.
-For both, the
-.Fa addr
-argument should be aligned to a multiple of the page size.
-If the
-.Fa len
-argument is not a multiple of the page size, it will be rounded up
-to be so.
-The entire range must be allocated.
-.Pp
-After an
-.Fn mlock
-system call, the indicated pages will cause neither a non-resident page
-nor address-translation fault until they are unlocked.
-They may still cause protection-violation faults or TLB-miss faults on
-architectures with software-managed TLBs.
-The physical pages remain in memory until all locked mappings for the pages
-are removed.
-Multiple processes may have the same physical pages locked via their own
-virtual address mappings.
-A single process may likewise have pages multiply-locked via different virtual
-mappings of the same physical pages.
-Unlocking is performed explicitly by
-.Fn munlock
-or implicitly by a call to
-.Fn munmap
-which deallocates the unmapped address range.
-Locked mappings are not inherited by the child process after a
-.Xr fork 2 .
-.Pp
-Since physical memory is a potentially scarce resource, processes are
-limited in how much they can lock down.
-The amount of memory that a single process can
-.Fn mlock
-is limited by both the per-process
-.Dv RLIMIT_MEMLOCK
-resource limit and the
-system-wide
-.Dq wired pages
-limit
-.Va vm.max_user_wired .
-.Va vm.max_user_wired
-applies to the system as a whole, so the amount available to a single
-process at any given time is the difference between
-.Va vm.max_user_wired
-and
-.Va vm.stats.vm.v_user_wire_count .
-.Pp
-If
-.Va security.bsd.unprivileged_mlock
-is set to 0 these calls are only available to the super-user.
-.Sh RETURN VALUES
-.Rv -std
-.Pp
-If the call succeeds, all pages in the range become locked (unlocked);
-otherwise the locked status of all pages in the range remains unchanged.
-.Sh ERRORS
-The
-.Fn mlock
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EPERM
-.Va security.bsd.unprivileged_mlock
-is set to 0 and the caller is not the super-user.
-.It Bq Er EINVAL
-The address range given wraps around zero.
-.It Bq Er ENOMEM
-Some portion of the indicated address range is not allocated.
-There was an error faulting/mapping a page.
-Locking the indicated range would exceed the per-process or system-wide limits
-for locked memory.
-.El
-The
-.Fn munlock
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EPERM
-.Va security.bsd.unprivileged_mlock
-is set to 0 and the caller is not the super-user.
-.It Bq Er EINVAL
-The address range given wraps around zero.
-.It Bq Er ENOMEM
-Some or all of the address range specified by the addr and len
-arguments does not correspond to valid mapped pages in the address space
-of the process.
-.It Bq Er ENOMEM
-Locking the pages mapped by the specified range would exceed a limit on
-the amount of memory that the process may lock.
-.El
-.Sh "SEE ALSO"
-.Xr fork 2 ,
-.Xr mincore 2 ,
-.Xr minherit 2 ,
-.Xr mlockall 2 ,
-.Xr mmap 2 ,
-.Xr munlockall 2 ,
-.Xr munmap 2 ,
-.Xr setrlimit 2 ,
-.Xr getpagesize 3
-.Sh HISTORY
-The
-.Fn mlock
-and
-.Fn munlock
-system calls first appeared in
-.Bx 4.4 .
-.Sh BUGS
-Allocating too much wired memory can lead to a memory-allocation deadlock
-which requires a reboot to recover from.
-.Pp
-The per-process and system-wide resource limits of locked memory apply
-to the amount of virtual memory locked, not the amount of locked physical
-pages.
-Hence two distinct locked mappings of the same physical page counts as
-2 pages aginst the system limit, and also against the per-process limit
-if both mappings belong to the same physical map.
-.Pp
-The per-process resource limit is not currently supported.
diff --git a/lib/libc/sys/mlockall.2 b/lib/libc/sys/mlockall.2
deleted file mode 100644
index 341099ee758f..000000000000
--- a/lib/libc/sys/mlockall.2
+++ /dev/null
@@ -1,146 +0,0 @@
-.\" $NetBSD: mlockall.2,v 1.11 2003/04/16 13:34:54 wiz Exp $
-.\"
-.\" Copyright (c) 1999 The NetBSD Foundation, Inc.
-.\" All rights reserved.
-.\"
-.\" This code is derived from software contributed to The NetBSD Foundation
-.\" by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
-.\" NASA Ames Research Center.
-.\"
-.\" 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd May 13, 2019
-.Dt MLOCKALL 2
-.Os
-.Sh NAME
-.Nm mlockall ,
-.Nm munlockall
-.Nd lock (unlock) the address space of a process
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/mman.h
-.Ft int
-.Fn mlockall "int flags"
-.Ft int
-.Fn munlockall "void"
-.Sh DESCRIPTION
-The
-.Fn mlockall
-system call locks into memory the physical pages associated with the
-address space of a process until the address space is unlocked, the
-process exits, or execs another program image.
-.Pp
-The following flags affect the behavior of
-.Fn mlockall :
-.Bl -tag -width ".Dv MCL_CURRENT"
-.It Dv MCL_CURRENT
-Lock all pages currently mapped into the process's address space.
-.It Dv MCL_FUTURE
-Lock all pages mapped into the process's address space in the future,
-at the time the mapping is established.
-Note that this may cause future mappings to fail if those mappings
-cause resource limits to be exceeded.
-.El
-.Pp
-Since physical memory is a potentially scarce resource, processes are
-limited in how much they can lock down.
-A single process can lock the minimum of a system-wide
-.Dq wired pages
-limit
-.Va vm.max_user_wired
-and the per-process
-.Dv RLIMIT_MEMLOCK
-resource limit.
-.Pp
-If
-.Va security.bsd.unprivileged_mlock
-is set to 0 these calls are only available to the super-user.
-If
-.Va vm.old_mlock
-is set to 1 the per-process
-.Dv RLIMIT_MEMLOCK
-resource limit will not be applied for
-.Fn mlockall
-calls.
-.Pp
-The
-.Fn munlockall
-call unlocks any locked memory regions in the process address space.
-Any regions mapped after an
-.Fn munlockall
-call will not be locked.
-.Sh RETURN VALUES
-A return value of 0 indicates that the call
-succeeded and all pages in the range have either been locked or unlocked.
-A return value of \-1 indicates an error occurred and the locked
-status of all pages in the range remains unchanged.
-In this case, the global location
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-.Fn mlockall
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Fa flags
-argument is zero, or includes unimplemented flags.
-.It Bq Er ENOMEM
-Locking the indicated range would exceed either the system or per-process
-limit for locked memory.
-.It Bq Er EAGAIN
-Some or all of the memory mapped into the process's address space
-could not be locked when the call was made.
-.It Bq Er EPERM
-The calling process does not have the appropriate privilege to perform
-the requested operation.
-.El
-.Sh SEE ALSO
-.Xr mincore 2 ,
-.Xr mlock 2 ,
-.Xr mmap 2 ,
-.Xr munmap 2 ,
-.Xr setrlimit 2
-.Sh STANDARDS
-The
-.Fn mlockall
-and
-.Fn munlockall
-functions are believed to conform to
-.St -p1003.1-2001 .
-.Sh HISTORY
-The
-.Fn mlockall
-and
-.Fn munlockall
-functions first appeared in
-.Fx 5.1 .
-.Sh BUGS
-The per-process and system-wide resource limits of locked memory apply
-to the amount of virtual memory locked, not the amount of locked physical
-pages.
-Hence two distinct locked mappings of the same physical page counts as
-2 pages aginst the system limit, and also against the per-process limit
-if both mappings belong to the same physical map.
diff --git a/lib/libc/sys/mmap.2 b/lib/libc/sys/mmap.2
deleted file mode 100644
index 5a3c6eb5d06e..000000000000
--- a/lib/libc/sys/mmap.2
+++ /dev/null
@@ -1,568 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)mmap.2 8.4 (Berkeley) 5/11/95
-.\" $FreeBSD$
-.\"
-.Dd December 24, 2020
-.Dt MMAP 2
-.Os
-.Sh NAME
-.Nm mmap
-.Nd allocate memory, or map files or devices into memory
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/mman.h
-.Ft void *
-.Fn mmap "void *addr" "size_t len" "int prot" "int flags" "int fd" "off_t offset"
-.Sh DESCRIPTION
-The
-.Fn mmap
-system call causes the pages starting at
-.Fa addr
-and continuing for at most
-.Fa len
-bytes to be mapped from the object described by
-.Fa fd ,
-starting at byte offset
-.Fa offset .
-If
-.Fa len
-is not a multiple of the page size, the mapped region may extend past the
-specified range.
-Any such extension beyond the end of the mapped object will be zero-filled.
-.Pp
-If
-.Fa fd
-references a regular file or a shared memory object, the range of
-bytes starting at
-.Fa offset
-and continuing for
-.Fa len
-bytes must be legitimate for the possible (not necessarily
-current) offsets in the object.
-In particular, the
-.Fa offset
-value cannot be negative.
-If the object is truncated and the process later accesses a page that
-is wholly within the truncated region, the access is aborted and a
-.Dv SIGBUS
-signal is delivered to the process.
-.Pp
-If
-.Fa fd
-references a device file, the interpretation of the
-.Fa offset
-value is device specific and defined by the device driver.
-The virtual memory subsystem does not impose any restrictions on the
-.Fa offset
-value in this case, passing it unchanged to the driver.
-.Pp
-If
-.Fa addr
-is non-zero, it is used as a hint to the system.
-(As a convenience to the system, the actual address of the region may differ
-from the address supplied.)
-If
-.Fa addr
-is zero, an address will be selected by the system.
-The actual starting address of the region is returned.
-A successful
-.Fa mmap
-deletes any previous mapping in the allocated address range.
-.Pp
-The protections (region accessibility) are specified in the
-.Fa prot
-argument by
-.Em or Ns 'ing
-the following values:
-.Pp
-.Bl -tag -width PROT_WRITE -compact
-.It Dv PROT_NONE
-Pages may not be accessed.
-.It Dv PROT_READ
-Pages may be read.
-.It Dv PROT_WRITE
-Pages may be written.
-.It Dv PROT_EXEC
-Pages may be executed.
-.El
-.Pp
-In addition to these protection flags,
-.Fx
-provides the ability to set the maximum protection of a region allocated by
-.Nm
-and later altered by
-.Xr mprotect 2 .
-This is accomplished by
-.Em or Ns 'ing
-one or more
-.Dv PROT_
-values wrapped in the
-.Dv PROT_MAX()
-macro into the
-.Fa prot
-argument.
-.Pp
-The
-.Fa flags
-argument specifies the type of the mapped object, mapping options and
-whether modifications made to the mapped copy of the page are private
-to the process or are to be shared with other references.
-Sharing, mapping type and options are specified in the
-.Fa flags
-argument by
-.Em or Ns 'ing
-the following values:
-.Bl -tag -width MAP_PREFAULT_READ
-.It Dv MAP_32BIT
-Request a region in the first 2GB of the current process's address space.
-If a suitable region cannot be found,
-.Fn mmap
-will fail.
-This flag is only available on 64-bit platforms.
-.It Dv MAP_ALIGNED Ns Pq Fa n
-Align the region on a requested boundary.
-If a suitable region cannot be found,
-.Fn mmap
-will fail.
-The
-.Fa n
-argument specifies the binary logarithm of the desired alignment.
-.It Dv MAP_ALIGNED_SUPER
-Align the region to maximize the potential use of large
-.Pq Dq super
-pages.
-If a suitable region cannot be found,
-.Fn mmap
-will fail.
-The system will choose a suitable page size based on the size of
-mapping.
-The page size used as well as the alignment of the region may both be
-affected by properties of the file being mapped.
-In particular,
-the physical address of existing pages of a file may require a specific
-alignment.
-The region is not guaranteed to be aligned on any specific boundary.
-.It Dv MAP_ANON
-Map anonymous memory not associated with any specific file.
-The file descriptor used for creating
-.Dv MAP_ANON
-must be \-1.
-The
-.Fa offset
-argument must be 0.
-.\".It Dv MAP_FILE
-.\"Mapped from a regular file or character-special device memory.
-.It Dv MAP_ANONYMOUS
-This flag is identical to
-.Dv MAP_ANON
-and is provided for compatibility.
-.It Dv MAP_EXCL
-This flag can only be used in combination with
-.Dv MAP_FIXED .
-Please see the definition of
-.Dv MAP_FIXED
-for the description of its effect.
-.It Dv MAP_FIXED
-Do not permit the system to select a different address than the one
-specified.
-If the specified address cannot be used,
-.Fn mmap
-will fail.
-If
-.Dv MAP_FIXED
-is specified,
-.Fa addr
-must be a multiple of the page size.
-If
-.Dv MAP_EXCL
-is not specified, a successful
-.Dv MAP_FIXED
-request replaces any previous mappings for the process'
-pages in the range from
-.Fa addr
-to
-.Fa addr
-+
-.Fa len .
-In contrast, if
-.Dv MAP_EXCL
-is specified, the request will fail if a mapping
-already exists within the range.
-.It Dv MAP_GUARD
-Instead of a mapping, create a guard of the specified size.
-Guards allow a process to create reservations in its address space,
-which can later be replaced by actual mappings.
-.Pp
-.Fa mmap
-will not create mappings in the address range of a guard unless
-the request specifies
-.Dv MAP_FIXED .
-Guards can be destroyed with
-.Xr munmap 2 .
-Any memory access by a thread to the guarded range results
-in the delivery of a
-.Dv SIGSEGV
-signal to that thread.
-.It Dv MAP_NOCORE
-Region is not included in a core file.
-.It Dv MAP_NOSYNC
-Causes data dirtied via this VM map to be flushed to physical media
-only when necessary (usually by the pager) rather than gratuitously.
-Typically this prevents the update daemons from flushing pages dirtied
-through such maps and thus allows efficient sharing of memory across
-unassociated processes using a file-backed shared memory map.
-Without
-this option any VM pages you dirty may be flushed to disk every so often
-(every 30-60 seconds usually) which can create performance problems if you
-do not need that to occur (such as when you are using shared file-backed
-mmap regions for IPC purposes).
-Dirty data will be flushed automatically when all mappings of an object are
-removed and all descriptors referencing the object are closed.
-Note that VM/file system coherency is
-maintained whether you use
-.Dv MAP_NOSYNC
-or not.
-This option is not portable
-across
-.Ux
-platforms (yet), though some may implement the same behavior
-by default.
-.Pp
-.Em WARNING !
-Extending a file with
-.Xr ftruncate 2 ,
-thus creating a big hole, and then filling the hole by modifying a shared
-.Fn mmap
-can lead to severe file fragmentation.
-In order to avoid such fragmentation you should always pre-allocate the
-file's backing store by
-.Fn write Ns ing
-zero's into the newly extended area prior to modifying the area via your
-.Fn mmap .
-The fragmentation problem is especially sensitive to
-.Dv MAP_NOSYNC
-pages, because pages may be flushed to disk in a totally random order.
-.Pp
-The same applies when using
-.Dv MAP_NOSYNC
-to implement a file-based shared memory store.
-It is recommended that you create the backing store by
-.Fn write Ns ing
-zero's to the backing file rather than
-.Fn ftruncate Ns ing
-it.
-You can test file fragmentation by observing the KB/t (kilobytes per
-transfer) results from an
-.Dq Li iostat 1
-while reading a large file sequentially, e.g.,\& using
-.Dq Li dd if=filename of=/dev/null bs=32k .
-.Pp
-The
-.Xr fsync 2
-system call will flush all dirty data and metadata associated with a file,
-including dirty NOSYNC VM data, to physical media.
-The
-.Xr sync 8
-command and
-.Xr sync 2
-system call generally do not flush dirty NOSYNC VM data.
-The
-.Xr msync 2
-system call is usually not needed since
-.Bx
-implements a coherent file system buffer cache.
-However, it may be
-used to associate dirty VM pages with file system buffers and thus cause
-them to be flushed to physical media sooner rather than later.
-.It Dv MAP_PREFAULT_READ
-Immediately update the calling process's lowest-level virtual address
-translation structures, such as its page table, so that every memory
-resident page within the region is mapped for read access.
-Ordinarily these structures are updated lazily.
-The effect of this option is to eliminate any soft faults that would
-otherwise occur on the initial read accesses to the region.
-Although this option does not preclude
-.Fa prot
-from including
-.Dv PROT_WRITE ,
-it does not eliminate soft faults on the initial write accesses to the
-region.
-.It Dv MAP_PRIVATE
-Modifications are private.
-.It Dv MAP_SHARED
-Modifications are shared.
-.It Dv MAP_STACK
-Creates both a mapped region that grows downward on demand and an
-adjoining guard that both reserves address space for the mapped region
-to grow into and limits the mapped region's growth.
-Together, the mapped region and the guard occupy
-.Fa len
-bytes of the address space.
-The guard starts at the returned address, and the mapped region ends at
-the returned address plus
-.Fa len
-bytes.
-Upon access to the guard, the mapped region automatically grows in size,
-and the guard shrinks by an equal amount.
-Essentially, the boundary between the guard and the mapped region moves
-downward so that the access falls within the enlarged mapped region.
-However, the guard will never shrink to less than the number of pages
-specified by the sysctl
-.Dv security.bsd.stack_guard_page ,
-thereby ensuring that a gap for detecting stack overflow always exists
-between the downward growing mapped region and the closest mapped region
-beneath it.
-.Pp
-.Dv MAP_STACK
-implies
-.Dv MAP_ANON
-and
-.Fa offset
-of 0.
-The
-.Fa fd
-argument
-must be -1 and
-.Fa prot
-must include at least
-.Dv PROT_READ
-and
-.Dv PROT_WRITE .
-The size of the guard, in pages, is specified by sysctl
-.Dv security.bsd.stack_guard_page .
-.El
-.Pp
-The
-.Xr close 2
-system call does not unmap pages, see
-.Xr munmap 2
-for further information.
-.Sh NOTES
-Although this implementation does not impose any alignment restrictions on
-the
-.Fa offset
-argument, a portable program must only use page-aligned values.
-.Pp
-Large page mappings require that the pages backing an object be
-aligned in matching blocks in both the virtual address space and RAM.
-The system will automatically attempt to use large page mappings when
-mapping an object that is already backed by large pages in RAM by
-aligning the mapping request in the virtual address space to match the
-alignment of the large physical pages.
-The system may also use large page mappings when mapping portions of an
-object that are not yet backed by pages in RAM.
-The
-.Dv MAP_ALIGNED_SUPER
-flag is an optimization that will align the mapping request to the
-size of a large page similar to
-.Dv MAP_ALIGNED ,
-except that the system will override this alignment if an object already
-uses large pages so that the mapping will be consistent with the existing
-large pages.
-This flag is mostly useful for maximizing the use of large pages on the
-first mapping of objects that do not yet have pages present in RAM.
-.Sh RETURN VALUES
-Upon successful completion,
-.Fn mmap
-returns a pointer to the mapped region.
-Otherwise, a value of
-.Dv MAP_FAILED
-is returned and
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-The
-.Fn mmap
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EACCES
-The flag
-.Dv PROT_READ
-was specified as part of the
-.Fa prot
-argument and
-.Fa fd
-was not open for reading.
-The flags
-.Dv MAP_SHARED
-and
-.Dv PROT_WRITE
-were specified as part of the
-.Fa flags
-and
-.Fa prot
-argument and
-.Fa fd
-was not open for writing.
-.It Bq Er EBADF
-The
-.Fa fd
-argument
-is not a valid open file descriptor.
-.It Bq Er EINVAL
-An invalid (negative) value was passed in the
-.Fa offset
-argument, when
-.Fa fd
-referenced a regular file or shared memory.
-.It Bq Er EINVAL
-An invalid value was passed in the
-.Fa prot
-argument.
-.It Bq Er EINVAL
-An undefined option was set in the
-.Fa flags
-argument.
-.It Bq Er EINVAL
-Both
-.Dv MAP_PRIVATE
-and
-.Dv MAP_SHARED
-were specified.
-.It Bq Er EINVAL
-None of
-.Dv MAP_ANON ,
-.Dv MAP_GUARD ,
-.Dv MAP_PRIVATE ,
-.Dv MAP_SHARED ,
-or
-.Dv MAP_STACK
-was specified.
-At least one of these flags must be included.
-.It Bq Er EINVAL
-.Dv MAP_STACK
-was specified and
-.Va len
-is less than or equal to the guard size.
-.It Bq Er EINVAL
-.Dv MAP_FIXED
-was specified and the
-.Fa addr
-argument was not page aligned, or part of the desired address space
-resides out of the valid address space for a user process.
-.It Bq Er EINVAL
-Both
-.Dv MAP_FIXED
-and
-.Dv MAP_32BIT
-were specified and part of the desired address space resides outside
-of the first 2GB of user address space.
-.It Bq Er EINVAL
-The
-.Fa len
-argument
-was equal to zero.
-.It Bq Er EINVAL
-.Dv MAP_ALIGNED
-was specified and the desired alignment was either larger than the
-virtual address size of the machine or smaller than a page.
-.It Bq Er EINVAL
-.Dv MAP_ANON
-was specified and the
-.Fa fd
-argument was not -1.
-.It Bq Er EINVAL
-.Dv MAP_ANON
-was specified and the
-.Fa offset
-argument was not 0.
-.It Bq Er EINVAL
-Both
-.Dv MAP_FIXED
-and
-.Dv MAP_EXCL
-were specified, but the requested region is already used by a mapping.
-.It Bq Er EINVAL
-.Dv MAP_EXCL
-was specified, but
-.Dv MAP_FIXED
-was not.
-.It Bq Er EINVAL
-.Dv MAP_GUARD
-was specified, but the
-.Fa offset
-argument was not zero, the
-.Fa fd
-argument was not -1, or the
-.Fa prot
-argument was not
-.Dv PROT_NONE .
-.It Bq Er EINVAL
-.Dv MAP_GUARD
-was specified together with one of the flags
-.Dv MAP_ANON ,
-.Dv MAP_PREFAULT ,
-.Dv MAP_PREFAULT_READ ,
-.Dv MAP_PRIVATE ,
-.Dv MAP_SHARED ,
-.Dv MAP_STACK .
-.It Bq Er ENODEV
-.Dv MAP_ANON
-has not been specified and
-.Fa fd
-did not reference a regular or character special file.
-.It Bq Er ENOMEM
-.Dv MAP_FIXED
-was specified and the
-.Fa addr
-argument was not available.
-.Dv MAP_ANON
-was specified and insufficient memory was available.
-.It Bq Er ENOTSUP
-The
-.Fa prot
-argument contains protections which are not a subset of the specified
-maximum protections.
-.El
-.Sh SEE ALSO
-.Xr madvise 2 ,
-.Xr mincore 2 ,
-.Xr minherit 2 ,
-.Xr mlock 2 ,
-.Xr mprotect 2 ,
-.Xr msync 2 ,
-.Xr munlock 2 ,
-.Xr munmap 2 ,
-.Xr getpagesize 3 ,
-.Xr getpagesizes 3
-.Sh HISTORY
-The
-.Nm
-system call was first documented in
-.Bx 4.2
-and implemented in
-.Bx 4.4 .
-.\" XXX: lots of missing history of FreeBSD additions.
-.Pp
-The
-.Dv PROT_MAX
-functionality was introduced in
-.Fx 13 .
diff --git a/lib/libc/sys/modfind.2 b/lib/libc/sys/modfind.2
deleted file mode 100644
index 38d09c4ee9f3..000000000000
--- a/lib/libc/sys/modfind.2
+++ /dev/null
@@ -1,86 +0,0 @@
-.\"
-.\" Copyright (c) 1999 Chris Costello
-.\" All rights reserved.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd September 28, 2000
-.Dt MODFIND 2
-.Os
-.Sh NAME
-.Nm modfind
-.Nd returns the modid of a kernel module
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/param.h
-.In sys/module.h
-.Ft int
-.Fn modfind "const char *modname"
-.Sh DESCRIPTION
-The
-.Fn modfind
-system call
-returns the modid of the kernel module referenced by
-.Fa modname .
-.Sh RETURN VALUES
-The
-.Fn modfind
-system call
-returns the modid of the kernel module referenced by
-.Fa modname .
-Upon error,
-.Fn modfind
-returns -1 and sets
-.Va errno
-to indicate the error.
-.Sh ERRORS
-.Va errno
-is set to the following if
-.Fn modfind
-fails:
-.Bl -tag -width Er
-.It Bq Er EFAULT
-The data required for this operation could not be read from the kernel space.
-.It Bq Er ENOENT
-The file specified is not loaded in the kernel.
-.El
-.Sh SEE ALSO
-.Xr kldfind 2 ,
-.Xr kldfirstmod 2 ,
-.Xr kldload 2 ,
-.Xr kldnext 2 ,
-.Xr kldstat 2 ,
-.Xr kldsym 2 ,
-.Xr kldunload 2 ,
-.Xr modfnext 2 ,
-.Xr modnext 2 ,
-.Xr modstat 2 ,
-.Xr kld 4 ,
-.Xr kldstat 8
-.Sh HISTORY
-The
-.Nm kld
-interface first appeared in
-.Fx 3.0 .
diff --git a/lib/libc/sys/modnext.2 b/lib/libc/sys/modnext.2
deleted file mode 100644
index c0c0a0d3a223..000000000000
--- a/lib/libc/sys/modnext.2
+++ /dev/null
@@ -1,97 +0,0 @@
-.\"
-.\" Copyright (c) 1999 Chris Costello
-.\" All rights reserved.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd September 28, 2000
-.Dt MODNEXT 2
-.Os
-.Sh NAME
-.Nm modnext
-.Nd return the modid of the next kernel module
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/param.h
-.In sys/module.h
-.Ft int
-.Fn modnext "int modid"
-.Ft int
-.Fn modfnext "int modid"
-.Sh DESCRIPTION
-The
-.Fn modnext
-system call
-returns the modid of the next kernel module (that is, the one after
-.Va modid )
-or 0 if
-.Va modid
-is the last module in the list.
-.Pp
-If the
-.Va modid
-value is 0, then
-.Fn modnext
-will return the modid of the first module.
-The
-.Fn modfnext
-system call
-must always be given a valid modid.
-.Sh RETURN VALUES
-The
-.Fn modnext
-system call
-returns the modid of the next module (see
-.Sx DESCRIPTION )
-or 0.
-If an error
-occurs,
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-The only error set by
-.Fn modnext
-is
-.Er ENOENT ,
-which is set when
-.Va modid
-refers to a kernel module that does not exist (is not loaded).
-.Sh SEE ALSO
-.Xr kldfind 2 ,
-.Xr kldfirstmod 2 ,
-.Xr kldload 2 ,
-.Xr kldnext 2 ,
-.Xr kldstat 2 ,
-.Xr kldsym 2 ,
-.Xr kldunload 2 ,
-.Xr modfind 2 ,
-.Xr modstat 2 ,
-.Xr kld 4 ,
-.Xr kldstat 8
-.Sh HISTORY
-The
-.Nm kld
-interface first appeared in
-.Fx 3.0 .
diff --git a/lib/libc/sys/modstat.2 b/lib/libc/sys/modstat.2
deleted file mode 100644
index 5f106b4b1af3..000000000000
--- a/lib/libc/sys/modstat.2
+++ /dev/null
@@ -1,127 +0,0 @@
-.\"
-.\" Copyright (c) 1999 Chris Costello
-.\" All rights reserved.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd July 15, 2008
-.Dt MODSTAT 2
-.Os
-.Sh NAME
-.Nm modstat
-.Nd get status of kernel module
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/param.h
-.In sys/module.h
-.Ft int
-.Fn modstat "int modid" "struct module_stat *stat"
-.Sh DESCRIPTION
-The
-.Fn modstat
-system call writes the info for the kernel module referred to by
-.Fa modid
-into
-.Fa stat .
-.Bd -literal
-struct module_stat {
- int version; /* set to sizeof(module_stat) */
- char name[MAXMODNAME];
- int refs;
- int id;
- modspecific_t data;
-};
-typedef union modspecific {
- int intval;
- u_int uintval;
- long longval;
- u_long ulongval;
-} modspecific_t;
-.Ed
-.Bl -tag -width XXXaddress
-.It version
-This field is set to the size of the structure mentioned above by the code
-calling
-.Fn modstat ,
-and not
-.Fn modstat
-itself.
-.It name
-The name of the module referred to by
-.Fa modid .
-.It refs
-The number of modules referenced by
-.Fa modid .
-.It id
-The id of the module specified in
-.Fa modid .
-.It data
-Module specific data.
-.El
-.Sh RETURN VALUES
-.Rv -std modstat
-.Sh ERRORS
-The information for the module referred to by
-.Fa modid
-is filled into the structure pointed to by
-.Fa stat
-unless:
-.Bl -tag -width Er
-.It Bq Er ENOENT
-The module was not found (probably not loaded).
-.It Bq Er EINVAL
-The version specified in the
-.Fa version
-field of stat is not the proper version.
-You would need to rebuild world, the
-kernel, or your application, if this error occurs, given that you did properly
-fill in the
-.Fa version
-field.
-.It Bq Er EFAULT
-There was a problem copying one, some, or all of the fields into
-.Fa stat
-in the
-.Xr copyout 9
-function.
-.El
-.Sh SEE ALSO
-.Xr kldfind 2 ,
-.Xr kldfirstmod 2 ,
-.Xr kldload 2 ,
-.Xr kldnext 2 ,
-.Xr kldstat 2 ,
-.Xr kldsym 2 ,
-.Xr kldunload 2 ,
-.Xr modfind 2 ,
-.Xr modfnext 2 ,
-.Xr modnext 2 ,
-.Xr kld 4 ,
-.Xr kldstat 8
-.Sh HISTORY
-The
-.Nm kld
-interface first appeared in
-.Fx 3.0 .
diff --git a/lib/libc/sys/mount.2 b/lib/libc/sys/mount.2
deleted file mode 100644
index 0d25cca3f10f..000000000000
--- a/lib/libc/sys/mount.2
+++ /dev/null
@@ -1,403 +0,0 @@
-.\" Copyright (c) 1980, 1989, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)mount.2 8.3 (Berkeley) 5/24/95
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2020
-.Dt MOUNT 2
-.Os
-.Sh NAME
-.Nm mount ,
-.Nm nmount ,
-.Nm unmount
-.Nd mount or dismount a file system
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/param.h
-.In sys/mount.h
-.Ft int
-.Fn mount "const char *type" "const char *dir" "int flags" "void *data"
-.Ft int
-.Fn unmount "const char *dir" "int flags"
-.In sys/uio.h
-.Ft int
-.Fn nmount "struct iovec *iov" "u_int niov" "int flags"
-.Sh DESCRIPTION
-The
-.Fn mount
-system call grafts
-a file system object onto the system file tree
-at the point
-.Fa dir .
-The argument
-.Fa data
-describes the file system object to be mounted.
-The argument
-.Fa type
-tells the kernel how to interpret
-.Fa data
-(See
-.Fa type
-below).
-The contents of the file system
-become available through the new mount point
-.Fa dir .
-Any files in
-.Fa dir
-at the time
-of a successful mount are swept under the carpet so to speak, and
-are unavailable until the file system is unmounted.
-.Pp
-The
-.Fn nmount
-system call behaves similarly to
-.Fn mount ,
-except that the mount options (file system type name, device to mount,
-mount-point name, etc.) are passed as an array of name-value pairs
-in the array
-.Fa iov ,
-containing
-.Fa niov
-elements.
-The following options are required by all file systems:
-.Bl -column fstype -offset indent
-.It
-.Li fstype Ta file system type name (e.g., Dq Li procfs )
-.It
-.Li fspath Ta mount point pathname (e.g., Dq Li /proc )
-.El
-.Pp
-Depending on the file system type, other options may be
-recognized or required;
-for example, most disk-based file systems require a
-.Dq Li from
-option containing the pathname of a special device
-in addition to the options listed above.
-.Pp
-By default only the super-user may call the
-.Fn mount
-system call.
-This restriction can be removed by setting the
-.Va vfs.usermount
-.Xr sysctl 8
-variable
-to a non-zero value; see the BUGS section for more information.
-.Pp
-The following
-.Fa flags
-may be specified to
-suppress default semantics which affect file system access.
-.Bl -tag -width MNT_SYNCHRONOUS
-.It Dv MNT_RDONLY
-The file system should be treated as read-only;
-even the super-user may not write on it.
-Specifying MNT_UPDATE without this option will upgrade
-a read-only file system to read/write.
-.It Dv MNT_NOEXEC
-Do not allow files to be executed from the file system.
-.It Dv MNT_NOSUID
-Do not honor setuid or setgid bits on files when executing them.
-This flag is set automatically when the caller is not the super-user.
-.It Dv MNT_NOATIME
-Disable update of file access times.
-.It Dv MNT_SNAPSHOT
-Create a snapshot of the file system.
-This is currently only supported on UFS2 file systems, see
-.Xr mksnap_ffs 8
-for more information.
-.It Dv MNT_SUIDDIR
-Directories with the SUID bit set chown new files to their own owner.
-This flag requires the SUIDDIR option to have been compiled into the kernel
-to have any effect.
-See the
-.Xr mount 8
-and
-.Xr chmod 2
-pages for more information.
-.It Dv MNT_SYNCHRONOUS
-All I/O to the file system should be done synchronously.
-.It Dv MNT_ASYNC
-All I/O to the file system should be done asynchronously.
-.It Dv MNT_FORCE
-Force a read-write mount even if the file system appears to be unclean.
-Dangerous.
-Together with
-.Dv MNT_UPDATE
-and
-.Dv MNT_RDONLY ,
-specify that the file system is to be forcibly downgraded to a read-only
-mount even if some files are open for writing.
-.It Dv MNT_NOCLUSTERR
-Disable read clustering.
-.It Dv MNT_NOCLUSTERW
-Disable write clustering.
-.It Dv MNT_NOCOVER
-Do not mount over the root of another mount point.
-.It Dv MNT_EMPTYDIR
-Require an empty directory for the mount point directory.
-.El
-.Pp
-The flag
-.Dv MNT_UPDATE
-indicates that the mount command is being applied
-to an already mounted file system.
-This allows the mount flags to be changed without requiring
-that the file system be unmounted and remounted.
-Some file systems may not allow all flags to be changed.
-For example,
-many file systems will not allow a change from read-write to read-only.
-.Pp
-The flag
-.Dv MNT_RELOAD
-causes the vfs subsystem to update its data structures pertaining to
-the specified already mounted file system.
-.Pp
-The
-.Fa type
-argument names the file system.
-The types of file systems known to the system can be obtained with
-.Xr lsvfs 1 .
-.Pp
-The
-.Fa data
-argument
-is a pointer to a structure that contains the type
-specific arguments to mount.
-The format for these argument structures is described in the
-manual page for each file system.
-By convention file system manual pages are named
-by prefixing ``mount_'' to the name of the file system as returned by
-.Xr lsvfs 1 .
-Thus the
-.Tn NFS
-file system is described by the
-.Xr mount_nfs 8
-manual page.
-It should be noted that a manual page for default
-file systems, known as UFS and UFS2, does not exist.
-.Pp
-The
-.Fn unmount
-system call disassociates the file system from the specified
-mount point
-.Fa dir .
-.Pp
-The
-.Fa flags
-argument may include
-.Dv MNT_FORCE
-to specify that the file system should be forcibly unmounted
-even if files are still active.
-Active special devices continue to work,
-but any further accesses to any other active files result in errors
-even if the file system is later remounted.
-.Pp
-If the
-.Dv MNT_BYFSID
-flag is specified,
-.Fa dir
-should instead be a file system ID encoded as
-.Dq Li FSID : Ns Ar val0 : Ns Ar val1 ,
-where
-.Ar val0
-and
-.Ar val1
-are the contents of the
-.Vt fsid_t
-.Va val[]
-array in decimal.
-The file system that has the specified file system ID will be unmounted.
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-The
-.Fn mount
-and
-.Fn nmount
-system calls will fail when one of the following occurs:
-.Bl -tag -width Er
-.It Bq Er EPERM
-The caller is neither the super-user nor the owner of
-.Fa dir .
-.It Bq Er ENAMETOOLONG
-A component of a pathname exceeded 255 characters,
-or the entire length of a path name exceeded 1023 characters.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating a pathname.
-.It Bq Er ENOENT
-A component of
-.Fa dir
-does not exist.
-.It Bq Er ENOTDIR
-A component of
-.Fa name
-is not a directory,
-or a path prefix of
-.Fa special
-is not a directory.
-.It Bq Er EBUSY
-Another process currently holds a reference to
-.Fa dir .
-.It Bq Er EBUSY
-The
-.Dv MNT_NOCOVER
-option was given, and the requested mount point
-is already the root of another mount point.
-.It Bq Er EFAULT
-The
-.Fa dir
-argument
-points outside the process's allocated address space.
-.It Bq Er EIO
-An I/O error occurred while reading data from
-.Fa special .
-.It Bq Er EINTEGRITY
-The backing store for
-.Fa special
-detected corrupted data while reading.
-.El
-.Pp
-The following errors can occur for a
-.Em ufs
-file system mount:
-.Bl -tag -width Er
-.It Bq Er ENODEV
-A component of ufs_args
-.Fa fspec
-does not exist.
-.It Bq Er ENOTBLK
-The
-.Fa fspec
-argument
-is not a block device.
-.It Bq Er ENOTEMPTY
-The
-.Dv MNT_EMPTYDIR
-option was specified, and the requested mount point
-is not an empty directory.
-.It Bq Er ENXIO
-The major device number of
-.Fa fspec
-is out of range (this indicates no device driver exists
-for the associated hardware).
-.It Bq Er EBUSY
-.Fa fspec
-is already mounted.
-.It Bq Er EMFILE
-No space remains in the mount table.
-.It Bq Er EINVAL
-The super block for the file system had a bad magic
-number or an out of range block size.
-.It Bq Er EINTEGRITY
-The super block for the file system had a bad check hash.
-The check hash can usually be corrected by running
-.Xr fsck 8 .
-.It Bq Er ENOMEM
-Not enough memory was available to read the cylinder
-group information for the file system.
-.It Bq Er EIO
-An I/O error occurred while reading the super block or
-cylinder group information.
-.It Bq Er EFAULT
-The
-.Fa fspec
-argument
-points outside the process's allocated address space.
-.El
-.Pp
-The following errors can occur for a
-.Em nfs
-file system mount:
-.Bl -tag -width Er
-.It Bq Er ETIMEDOUT
-.Em Nfs
-timed out trying to contact the server.
-.It Bq Er EFAULT
-Some part of the information described by nfs_args
-points outside the process's allocated address space.
-.El
-.Pp
-The
-.Fn unmount
-system call may fail with one of the following errors:
-.Bl -tag -width Er
-.It Bq Er EPERM
-The caller is neither the super-user nor the user who issued the corresponding
-.Fn mount
-call.
-.It Bq Er ENAMETOOLONG
-The length of the path name exceeded 1023 characters.
-.It Bq Er EINVAL
-The requested directory is not in the mount table.
-.It Bq Er ENOENT
-The file system ID specified using
-.Dv MNT_BYFSID
-was not found in the mount table.
-.It Bq Er EINVAL
-The file system ID specified using
-.Dv MNT_BYFSID
-could not be decoded.
-.It Bq Er EINVAL
-The specified file system is the root file system.
-.It Bq Er EBUSY
-A process is holding a reference to a file located
-on the file system.
-.It Bq Er EIO
-An I/O error occurred while writing cached file system information.
-.It Bq Er EFAULT
-The
-.Fa dir
-argument
-points outside the process's allocated address space.
-.El
-.Sh SEE ALSO
-.Xr lsvfs 1 ,
-.Xr mksnap_ffs 8 ,
-.Xr mount 8 ,
-.Xr umount 8
-.Sh HISTORY
-The
-.Fn mount
-and
-.Fn unmount
-functions appeared in
-.At v1 .
-The
-.Fn nmount
-system call first appeared in
-.Fx 5.0 .
-.Sh BUGS
-Some of the error codes need translation to more obvious messages.
-.Pp
-Allowing untrusted users to mount arbitrary media, e.g. by enabling
-.Va vfs.usermount ,
-should not be considered safe.
-Most file systems in
-.Fx
-were not built to safeguard against malicious devices.
diff --git a/lib/libc/sys/mprotect.2 b/lib/libc/sys/mprotect.2
deleted file mode 100644
index c2c7701d624e..000000000000
--- a/lib/libc/sys/mprotect.2
+++ /dev/null
@@ -1,131 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)mprotect.2 8.1 (Berkeley) 6/9/93
-.\" $FreeBSD$
-.\"
-.Dd September 7, 2021
-.Dt MPROTECT 2
-.Os
-.Sh NAME
-.Nm mprotect
-.Nd control the protection of pages
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/mman.h
-.Ft int
-.Fn mprotect "void *addr" "size_t len" "int prot"
-.Sh DESCRIPTION
-The
-.Fn mprotect
-system call
-changes the specified pages to have protection
-.Fa prot .
-.Pp
-The
-.Fa prot
-argument shall be
-.Dv PROT_NONE
-(no permissions at all)
-or the bitwise
-.Em or
-of one or more of the following values:
-.Pp
-.Bl -tag -width ".Dv PROT_WRITE" -compact
-.It Dv PROT_READ
-The pages can be read.
-.It Dv PROT_WRITE
-The pages can be written.
-.It Dv PROT_EXEC
-The pages can be executed.
-.El
-.Pp
-In addition to these standard protection flags,
-the
-.Fx
-implementation of
-.Fn mprotect
-provides the ability to set the maximum protection of a region
-(which prevents
-.Nm
-from adding to the permissions later).
-This is accomplished by bitwise
-.Em or Ns 'ing
-one or more
-.Dv PROT_
-values wrapped in the
-.Dv PROT_MAX()
-macro into the
-.Fa prot
-argument.
-.Sh RETURN VALUES
-.Rv -std mprotect
-.Sh ERRORS
-The
-.Fn mprotect
-system call will fail if:
-.Bl -tag -width Er
-.It Bq Er EACCES
-The calling process was not allowed to change
-the protection to the value specified by
-the
-.Fa prot
-argument.
-.It Bq Er EINVAL
-The virtual address range specified by the
-.Fa addr
-and
-.Fa len
-arguments is not valid.
-.It Bq Er EINVAL
-The
-.Fa prot
-argument contains unhandled bits.
-.It Bq Er ENOTSUP
-The
-.Fa prot
-argument contains permissions which are not a subset of the specified
-maximum permissions.
-.El
-.Sh SEE ALSO
-.Xr madvise 2 ,
-.Xr mincore 2 ,
-.Xr msync 2 ,
-.Xr munmap 2
-.Sh HISTORY
-The
-.Fn mprotect
-system call was first documented in
-.Bx 4.2
-and first appeared in
-.Bx 4.4 .
-.Pp
-The
-.Dv PROT_MAX
-functionality was introduced in
-.Fx 13 .
diff --git a/lib/libc/sys/mq_close.2 b/lib/libc/sys/mq_close.2
deleted file mode 100644
index f9ec06239c48..000000000000
--- a/lib/libc/sys/mq_close.2
+++ /dev/null
@@ -1,105 +0,0 @@
-.\" Copyright (c) 2005 David Xu <davidxu@FreeBSD.org>
-.\" All rights reserved.
-.\"
-.\" 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(s), this list of conditions and the following disclaimer as
-.\" the first lines of this file unmodified other than the possible
-.\" addition of one or more copyright notices.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice(s), 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 HOLDER(S) ``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(S) 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.
-.\"
-.\" Portions of this text are reprinted and reproduced in electronic form
-.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
-.\" Portable Operating System Interface (POSIX), The Open Group Base
-.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
-.\" Electrical and Electronics Engineers, Inc and The Open Group. In the
-.\" event of any discrepancy between this version and the original IEEE and
-.\" The Open Group Standard, the original IEEE and The Open Group Standard is
-.\" the referee document. The original Standard can be obtained online at
-.\" http://www.opengroup.org/unix/online.html.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd November 29, 2005
-.Dt MQ_CLOSE 2
-.Os
-.Sh NAME
-.Nm mq_close
-.Nd "close a message queue (REALTIME)"
-.Sh LIBRARY
-.Lb librt
-.Sh SYNOPSIS
-.In mqueue.h
-.Ft int
-.Fn mq_close "mqd_t mqdes"
-.Sh DESCRIPTION
-The
-.Fn mq_close
-system call removes the association between the message queue descriptor,
-.Fa mqdes ,
-and its message queue.
-The results of using this message queue descriptor
-after successful return from this
-.Fn mq_close ,
-and until the return of this message queue descriptor from a subsequent
-.Fn mq_open ,
-are undefined.
-.Pp
-If the process has successfully attached a notification request to the
-message queue via this
-.Fa mqdes ,
-this attachment will be removed, and the message queue is available for
-another process to attach for notification.
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-The
-.Fn mq_close
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa mqdes
-argument is not a valid message queue descriptor.
-.El
-.Sh SEE ALSO
-.Xr mq_open 2 ,
-.Xr mq_unlink 2
-.Sh STANDARDS
-The
-.Fn mq_close
-system call conforms to
-.St -p1003.1-2004 .
-.Sh HISTORY
-Support for
-.Tn POSIX
-message queues first appeared in
-.Fx 7.0 .
-.Sh COPYRIGHT
-Portions of this text are reprinted and reproduced in electronic form
-from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
-Portable Operating System Interface (POSIX), The Open Group Base
-Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
-Electrical and Electronics Engineers, Inc and The Open Group. In the
-event of any discrepancy between this version and the original IEEE and
-The Open Group Standard, the original IEEE and The Open Group Standard is
-the referee document. The original Standard can be obtained online at
-http://www.opengroup.org/unix/online.html.
diff --git a/lib/libc/sys/mq_getattr.2 b/lib/libc/sys/mq_getattr.2
deleted file mode 100644
index fc42d5914d04..000000000000
--- a/lib/libc/sys/mq_getattr.2
+++ /dev/null
@@ -1,127 +0,0 @@
-.\" Copyright (c) 2005 David Xu <davidxu@FreeBSD.org>
-.\" All rights reserved.
-.\"
-.\" 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(s), this list of conditions and the following disclaimer as
-.\" the first lines of this file unmodified other than the possible
-.\" addition of one or more copyright notices.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice(s), 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 HOLDER(S) ``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(S) 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.
-.\"
-.\" Portions of this text are reprinted and reproduced in electronic form
-.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
-.\" Portable Operating System Interface (POSIX), The Open Group Base
-.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
-.\" Electrical and Electronics Engineers, Inc and The Open Group. In the
-.\" event of any discrepancy between this version and the original IEEE and
-.\" The Open Group Standard, the original IEEE and The Open Group Standard is
-.\" the referee document. The original Standard can be obtained online at
-.\" http://www.opengroup.org/unix/online.html.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd February 21, 2014
-.Dt MQ_GETATTR 2
-.Os
-.Sh NAME
-.Nm mq_getattr
-.Nd "get message queue attributes (REALTIME)"
-.Sh LIBRARY
-.Lb librt
-.Sh SYNOPSIS
-.In mqueue.h
-.Ft int
-.Fn mq_getattr "mqd_t mqdes" "struct mq_attr *mqstat"
-.Sh DESCRIPTION
-The
-.Fn mq_getattr
-system call obtains status information and attributes of the message queue and
-the open message queue description associated with the message queue
-descriptor.
-.Pp
-The
-.Fa mqdes
-argument specifies a message queue descriptor.
-.Pp
-The results are returned in the
-.Vt mq_attr
-structure referenced by the
-.Fa mqstat
-argument.
-.Pp
-Upon return, the following members will have the values associated with the
-open message queue description as set when the message queue was opened and
-as modified by subsequent
-.Fn mq_setattr
-calls:
-.Va mq_flags .
-.Pp
-The following attributes of the message queue will be returned as set at
-message queue creation:
-.Va mq_maxmsg , mq_msgsize .
-.Pp
-Upon return, the following members within the
-.Vt mq_attr
-structure referenced by the
-.Fa mqstat
-argument will be set to the current state
-of the message queue:
-.Bl -tag -width ".Va mq_curmsgs"
-.It Va mq_curmsgs
-The number of messages currently on the queue.
-.El
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-The
-.Fn mq_getattr
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa mqdes
-argument is not a valid message queue descriptor.
-.El
-.Sh SEE ALSO
-.Xr mq_open 2 ,
-.Xr mq_send 2 ,
-.Xr mq_setattr 2 ,
-.Xr mq_timedsend 2
-.Sh STANDARDS
-The
-.Fn mq_getattr
-system call conforms to
-.St -p1003.1-2004 .
-.Sh HISTORY
-Support for
-.Tn POSIX
-message queues first appeared in
-.Fx 7.0 .
-.Sh COPYRIGHT
-Portions of this text are reprinted and reproduced in electronic form
-from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
-Portable Operating System Interface (POSIX), The Open Group Base
-Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
-Electrical and Electronics Engineers, Inc and The Open Group. In the
-event of any discrepancy between this version and the original IEEE and
-The Open Group Standard, the original IEEE and The Open Group Standard is
-the referee document. The original Standard can be obtained online at
-http://www.opengroup.org/unix/online.html.
diff --git a/lib/libc/sys/mq_notify.2 b/lib/libc/sys/mq_notify.2
deleted file mode 100644
index 4418c60449d9..000000000000
--- a/lib/libc/sys/mq_notify.2
+++ /dev/null
@@ -1,165 +0,0 @@
-.\" Copyright (c) 2005 David Xu <davidxu@FreeBSD.org>
-.\" All rights reserved.
-.\"
-.\" 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(s), this list of conditions and the following disclaimer as
-.\" the first lines of this file unmodified other than the possible
-.\" addition of one or more copyright notices.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice(s), 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 HOLDER(S) ``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(S) 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.
-.\"
-.\" Portions of this text are reprinted and reproduced in electronic form
-.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
-.\" Portable Operating System Interface (POSIX), The Open Group Base
-.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
-.\" Electrical and Electronics Engineers, Inc and The Open Group. In the
-.\" event of any discrepancy between this version and the original IEEE and
-.\" The Open Group Standard, the original IEEE and The Open Group Standard is
-.\" the referee document. The original Standard can be obtained online at
-.\" http://www.opengroup.org/unix/online.html.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd July 15, 2016
-.Dt MQ_NOTIFY 2
-.Os
-.Sh NAME
-.Nm mq_notify
-.Nd "notify process that a message is available (REALTIME)"
-.Sh LIBRARY
-.Lb librt
-.Sh SYNOPSIS
-.In mqueue.h
-.Ft int
-.Fn mq_notify "mqd_t mqdes" "const struct sigevent *notification"
-.Sh DESCRIPTION
-If the argument notification is not
-.Dv NULL ,
-this system call will register the calling process to be notified of message
-arrival at an empty message queue associated with the specified message
-queue descriptor,
-.Fa mqdes .
-The notification specified by the
-.Fa notification
-argument will be sent to
-the process when the message queue transitions from empty to non-empty.
-At any time, only one process may be registered for notification by a
-message queue.
-If the calling process or any other process has already
-registered for notification of message arrival at the specified message
-queue, subsequent attempts to register for that message queue will fail.
-.Pp
-The
-.Fa notification
-argument points to a
-.Vt sigevent
-structure that defines how the calling process will be notified.
-If
-.Fa notification->sigev_notify
-is
-.Dv SIGEV_NONE ,
-then no signal will be posted, but the error status and the return status
-for the operation will be set appropriately.
-For
-.Dv SIGEV_SIGNO
-and
-.Dv SIGEV_THREAD_ID
-notifications,
-the signal specified in
-.Fa notification->sigev_signo
-will be sent to the calling process
-.Pq Dv SIGEV_SIGNO
-or to the thread whose LWP ID is
-.Fa notification->sigev_notify_thread_id
-.Pq Dv SIGEV_THREAD_ID .
-The information for the queued signal will include:
-.Bl -column ".Va si_value"
-.It Sy Member Ta Sy Value
-.It Va si_code Ta Dv SI_MESGQ
-.It Va si_value Ta
-the value stored in
-.Fa notification->sigev_value
-.It Va si_mqd Ta Fa mqdes
-.El
-.Pp
-If
-.Fa notification
-is
-.Dv NULL
-and the process is currently registered for notification by the specified
-message queue, the existing registration will be removed.
-.Pp
-When the notification is sent to the registered process, its registration
-is removed.
-The message queue then is available for registration.
-.Pp
-If a process has registered for notification of message arrival at a
-message queue and some thread is blocked in
-.Fn mq_receive
-waiting to receive a message when a message arrives at the queue, the
-arriving message will satisfy the appropriate
-.Fn mq_receive .
-The resulting behavior is as if the message queue remains empty, and no
-notification will be sent.
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-The
-.Fn mq_notify
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa mqdes
-argument is not a valid message queue descriptor.
-.It Bq Er EBUSY
-Process is already registered for notification by the message queue.
-.It Bq Er EINVAL
-The asynchronous notification method in
-.Fa notification->sigev_notify
-is invalid or not supported.
-.El
-.Sh SEE ALSO
-.Xr mq_open 2 ,
-.Xr mq_send 2 ,
-.Xr mq_timedsend 2 ,
-.Xr sigevent 3 ,
-.Xr siginfo 3
-.Sh STANDARDS
-The
-.Fn mq_notify
-system call conforms to
-.St -p1003.1-2004 .
-.Sh HISTORY
-Support for
-.Tn POSIX
-message queues first appeared in
-.Fx 7.0 .
-.Sh COPYRIGHT
-Portions of this text are reprinted and reproduced in electronic form
-from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
-Portable Operating System Interface (POSIX), The Open Group Base
-Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
-Electrical and Electronics Engineers, Inc and The Open Group. In the
-event of any discrepancy between this version and the original IEEE and
-The Open Group Standard, the original IEEE and The Open Group Standard is
-the referee document. The original Standard can be obtained online at
-http://www.opengroup.org/unix/online.html.
diff --git a/lib/libc/sys/mq_open.2 b/lib/libc/sys/mq_open.2
deleted file mode 100644
index 4f1f98e010a5..000000000000
--- a/lib/libc/sys/mq_open.2
+++ /dev/null
@@ -1,334 +0,0 @@
-.\" Copyright (c) 2005 David Xu <davidxu@FreeBSD.org>
-.\" All rights reserved.
-.\"
-.\" 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(s), this list of conditions and the following disclaimer as
-.\" the first lines of this file unmodified other than the possible
-.\" addition of one or more copyright notices.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice(s), 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 HOLDER(S) ``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(S) 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.
-.\"
-.\" Portions of this text are reprinted and reproduced in electronic form
-.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
-.\" Portable Operating System Interface (POSIX), The Open Group Base
-.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
-.\" Electrical and Electronics Engineers, Inc and The Open Group. In the
-.\" event of any discrepancy between this version and the original IEEE and
-.\" The Open Group Standard, the original IEEE and The Open Group Standard is
-.\" the referee document. The original Standard can be obtained online at
-.\" http://www.opengroup.org/unix/online.html.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd September 28, 2019
-.Dt MQ_OPEN 2
-.Os
-.Sh NAME
-.Nm mq_open
-.Nd "open a message queue (REALTIME)"
-.Sh LIBRARY
-.Lb librt
-.Sh SYNOPSIS
-.In mqueue.h
-.Ft mqd_t
-.Fn mq_open "const char *name" "int oflag" "..."
-.Sh DESCRIPTION
-The
-.Fn mq_open
-system call establishes the connection between a process and a message queue
-with a message queue descriptor.
-It creates an open message queue
-description that refers to the message queue, and a message queue descriptor
-that refers to that open message queue description.
-The message queue
-descriptor is used by other functions to refer to that message queue.
-The
-.Fa name
-argument points to a string naming a message queue.
-The
-.Fa name
-argument should conform to the construction rules for a pathname.
-The
-.Fa name
-should begin with a slash character.
-Processes calling
-.Fn mq_open
-with the same value of
-.Fa name
-refers to the same message queue object, as long as that name has not been
-removed.
-If the
-.Fa name
-argument is not the name of an existing message queue and creation is not
-requested,
-.Fn mq_open
-will fail and return an error.
-.Pp
-The
-.Fa oflag
-argument requests the desired receive and/or send access to the message
-queue.
-The requested access permission to receive messages or send messages
-would be granted if the calling process would be granted read or write access,
-respectively, to an equivalently protected file.
-.Pp
-The value of
-.Fa oflag
-is the bitwise-inclusive OR of values from the following list.
-Applications should specify exactly one of the first three values (access
-modes) below in the value of
-.Fa oflag :
-.Bl -tag -width ".Dv O_NONBLOCK"
-.It Dv O_RDONLY
-Open the message queue for receiving messages.
-The process can use the
-returned message queue descriptor with
-.Fn mq_receive ,
-but not
-.Fn mq_send .
-A message queue may be open multiple times in the same or different processes
-for receiving messages.
-.It Dv O_WRONLY
-Open the queue for sending messages.
-The process can use the returned
-message queue descriptor with
-.Fn mq_send
-but not
-.Fn mq_receive .
-A message queue may be open multiple times in the same or different processes
-for sending messages.
-.It Dv O_RDWR
-Open the queue for both receiving and sending messages.
-The process can use
-any of the functions allowed for
-.Dv O_RDONLY
-and
-.Dv O_WRONLY .
-A message queue may be open multiple times in the same or different processes
-for sending messages.
-.El
-.Pp
-Any combination of the remaining flags may be specified in the value of
-.Fa oflag :
-.Bl -tag -width ".Dv O_NONBLOCK"
-.It Dv O_CREAT
-Create a message queue.
-It requires two additional arguments:
-.Fa mode ,
-which is of type
-.Vt mode_t ,
-and
-.Fa attr ,
-which is a pointer to an
-.Vt mq_attr
-structure.
-If the pathname
-.Fa name
-has already been used to create a message queue that still exists, then
-this flag has no effect, except as noted under
-.Dv O_EXCL .
-Otherwise, a message queue will be created without any messages
-in it.
-The user ID of the message queue will be set to the effective user ID
-of the process, and the group ID of the message queue will be set to the
-effective group ID of the process.
-The permission bits of the message queue
-will be set to the value of the
-.Fa mode
-argument, except those set in the file mode creation mask of the process.
-When bits in
-.Fa mode
-other than the file permission bits are specified, the effect is
-unspecified.
-If
-.Fa attr
-is
-.Dv NULL ,
-the message queue is created with implementation-defined default message
-queue attributes.
-If attr is
-.Pf non- Dv NULL
-and the calling process has the
-appropriate privilege on name, the message queue
-.Va mq_maxmsg
-and
-.Va mq_msgsize
-attributes will be set to the values of the corresponding members in the
-.Vt mq_attr
-structure referred to by
-.Fa attr .
-If
-.Fa attr
-is
-.Pf non- Dv NULL ,
-but the calling process does not have the appropriate privilege
-on name, the
-.Fn mq_open
-function will fail and return an error without creating the message queue.
-.It Dv O_EXCL
-If
-.Dv O_EXCL
-and
-.Dv O_CREAT
-are set,
-.Fn mq_open
-will fail if the message queue name exists.
-.It Dv O_NONBLOCK
-Determines whether an
-.Fn mq_send
-or
-.Fn mq_receive
-waits for resources or messages that are not currently available, or fails
-with
-.Va errno
-set to
-.Er EAGAIN ;
-see
-.Xr mq_send 2
-and
-.Xr mq_receive 2
-for details.
-.El
-.Pp
-The
-.Fn mq_open
-system call does not add or remove messages from the queue.
-.Sh NOTES
-.Fx
-implements message queue based on file descriptor.
-The descriptor
-is inherited by child after
-.Xr fork 2 .
-The descriptor is closed in a new image after
-.Xr exec 3 .
-The
-.Xr select 2
-and
-.Xr kevent 2
-system calls are supported for message queue descriptor.
-.Pp
-Please see the
-.Xr mqueuefs 5
-man page for instructions on loading the module or compiling the service into
-the kernel.
-.Sh RETURN VALUES
-Upon successful completion, the function returns a message queue
-descriptor; otherwise, the function returns
-.Po Vt mqd_t Pc Ns \-1
-and sets the global variable
-.Va errno
-to indicate the error.
-.Sh ERRORS
-The
-.Fn mq_open
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EACCES
-The message queue exists and the permissions specified by
-.Fa oflag
-are denied, or the message queue does not exist and permission to create the
-message queue is denied.
-.It Bq Er EEXIST
-.Dv O_CREAT
-and
-.Dv O_EXCL
-are set and the named message queue already exists.
-.It Bq Er EINTR
-The
-.Fn mq_open
-function was interrupted by a signal.
-.It Bq Er EINVAL
-The
-.Fn mq_open
-function is not supported for the given name.
-.It Bq Er EINVAL
-.Dv O_CREAT
-was specified in
-.Fa oflag ,
-the value of
-.Fa attr
-is not
-.Dv NULL ,
-and either
-.Va mq_maxmsg
-or
-.Va mq_msgsize
-was less than or equal to zero.
-.It Bq Er EMFILE
-Too many message queue descriptors or file descriptors are currently in use
-by this process.
-.It Bq Er ENAMETOOLONG
-The length of the
-.Fa name
-argument exceeds
-.Brq Dv PATH_MAX
-or a pathname component
-is longer than
-.Brq Dv NAME_MAX .
-.It Bq Er ENFILE
-Too many message queues are currently open in the system.
-.It Bq Er ENOENT
-.Dv O_CREAT
-is not set and the named message queue does not exist.
-.It Bq Er ENOSPC
-There is insufficient space for the creation of the new message queue.
-.El
-.Sh SEE ALSO
-.Xr mq_close 2 ,
-.Xr mq_getattr 2 ,
-.Xr mq_receive 2 ,
-.Xr mq_send 2 ,
-.Xr mq_setattr 2 ,
-.Xr mq_unlink 2 ,
-.Xr mq_timedreceive 3 ,
-.Xr mq_timedsend 3 ,
-.Xr mqueuefs 5
-.Sh STANDARDS
-The
-.Fn mq_open
-system call conforms to
-.St -p1003.1-2004 .
-.Sh HISTORY
-Support for POSIX message queues first appeared in
-.Fx 7.0 .
-.Sh BUGS
-This implementation places strict requirements on the value of
-.Fa name :
-it must begin with a slash
-.Pq Ql /
-and contain no other slash characters.
-.Pp
-The
-.Fa mode
-and
-.Fa attr
-arguments are variadic and may result in different calling conventions
-than might otherwise be expected.
-.Sh COPYRIGHT
-Portions of this text are reprinted and reproduced in electronic form
-from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
-Portable Operating System Interface (POSIX), The Open Group Base
-Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
-Electrical and Electronics Engineers, Inc and The Open Group. In the
-event of any discrepancy between this version and the original IEEE and
-The Open Group Standard, the original IEEE and The Open Group Standard is
-the referee document. The original Standard can be obtained online at
-http://www.opengroup.org/unix/online.html.
diff --git a/lib/libc/sys/mq_receive.2 b/lib/libc/sys/mq_receive.2
deleted file mode 100644
index 730636bf31ee..000000000000
--- a/lib/libc/sys/mq_receive.2
+++ /dev/null
@@ -1,217 +0,0 @@
-.\" Copyright (c) 2005 David Xu <davidxu@FreeBSD.org>
-.\" All rights reserved.
-.\"
-.\" 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(s), this list of conditions and the following disclaimer as
-.\" the first lines of this file unmodified other than the possible
-.\" addition of one or more copyright notices.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice(s), 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 HOLDER(S) ``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(S) 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.
-.\"
-.\" Portions of this text are reprinted and reproduced in electronic form
-.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
-.\" Portable Operating System Interface (POSIX), The Open Group Base
-.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
-.\" Electrical and Electronics Engineers, Inc and The Open Group. In the
-.\" event of any discrepancy between this version and the original IEEE and
-.\" The Open Group Standard, the original IEEE and The Open Group Standard is
-.\" the referee document. The original Standard can be obtained online at
-.\" http://www.opengroup.org/unix/online.html.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd November 29, 2005
-.Dt MQ_RECEIVE 2
-.Os
-.Sh NAME
-.Nm mq_receive , mq_timedreceive
-.Nd "receive a message from message queue (REALTIME)"
-.Sh LIBRARY
-.Lb librt
-.Sh SYNOPSIS
-.In mqueue.h
-.Ft ssize_t
-.Fo mq_receive
-.Fa "mqd_t mqdes"
-.Fa "char *msg_ptr"
-.Fa "size_t msg_len"
-.Fa "unsigned *msg_prio"
-.Fc
-.Ft ssize_t
-.Fo mq_timedreceive
-.Fa "mqd_t mqdes"
-.Fa "char *msg_ptr"
-.Fa "size_t msg_len"
-.Fa "unsigned *msg_prio"
-.Fa "const struct timespec *abs_timeout"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn mq_receive
-system call receives oldest of the highest priority message(s) from the
-message queue specified by
-.Fa mqdes .
-If the size of the buffer in bytes, specified by the
-.Fa msg_len
-argument, is less than the
-.Va mq_msgsize
-attribute of the message queue, the system call will fail and return an
-error.
-Otherwise, the selected message will be removed from the queue
-and copied to the buffer pointed to by the
-.Fa msg_ptr
-argument.
-.Pp
-If the argument
-.Fa msg_prio
-is not
-.Dv NULL ,
-the priority of the selected message will be stored in the
-location referenced by
-.Fa msg_prio .
-If the specified message queue is empty and
-.Dv O_NONBLOCK
-is not set in the message queue description associated with
-.Fa mqdes ,
-.Fn mq_receive
-will block until a message is enqueued on the message queue or until
-.Fn mq_receive
-is interrupted by a signal.
-If more than one thread is waiting to receive
-a message when a message arrives at an empty queue and the Priority
-Scheduling option is supported, then the thread of highest priority that
-has been waiting the longest will be selected to receive the message.
-Otherwise, it is unspecified which waiting thread receives the message.
-If the specified message queue is empty and
-.Dv O_NONBLOCK
-is set in the message queue description associated with
-.Fa mqdes ,
-no message
-will be removed from the queue, and
-.Fn mq_receive
-will return an error.
-.Pp
-The
-.Fn mq_timedreceive
-system call will receive the oldest of the highest priority messages from the
-message queue specified by
-.Fa mqdes
-as described for the
-.Fn mq_receive
-system call.
-However, if
-.Dv O_NONBLOCK
-was not specified when the message queue was opened via the
-.Fn mq_open
-system call, and no message exists on the queue to satisfy the receive, the wait
-for such a message will be terminated when the specified timeout expires.
-If
-.Dv O_NONBLOCK
-is set, this system call is equivalent to
-.Fn mq_receive .
-.Pp
-The timeout expires when the absolute time specified by
-.Fa abs_timeout
-passes, as measured by the clock on which timeouts are based (that is, when
-the value of that clock equals or exceeds
-.Fa abs_timeout ) ,
-or if the absolute time specified by
-.Fa abs_timeout
-has already been passed at the time of the call.
-.Pp
-The timeout is based on the
-.Dv CLOCK_REALTIME
-clock.
-.Sh RETURN VALUES
-Upon successful completion, the
-.Fn mq_receive
-and
-.Fn mq_timedreceive
-system calls return the length of the selected message in bytes and the
-message is removed from the queue.
-Otherwise, no message is removed
-from the queue, the system call returns a value of \-1,
-and the global variable
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-The
-.Fn mq_receive
-and
-.Fn mq_timedreceive
-system calls
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EAGAIN
-.Dv O_NONBLOCK
-flag is set in the message queue description associated with
-.Fa mqdes ,
-and the specified message queue is empty.
-.It Bq Er EBADF
-The
-.Fa mqdes
-argument is not a valid message queue descriptor open for reading.
-.It Bq Er EMSGSIZE
-The specified message buffer size,
-.Fa msg_len ,
-is less than the message size attribute of the message queue.
-.It Bq Er EINTR
-The
-.Fn mq_receive
-or
-.Fn mq_timedreceive
-operation was interrupted by a signal.
-.It Bq Er EINVAL
-The process or thread would have blocked, and the
-.Fa abs_timeout
-parameter specified a nanoseconds field value less than zero or greater
-than or equal to 1000 million.
-.It Bq Er ETIMEDOUT
-The
-.Dv O_NONBLOCK
-flag was not set when the message queue was opened, but no message arrived
-on the queue before the specified timeout expired.
-.El
-.Sh SEE ALSO
-.Xr mq_open 2 ,
-.Xr mq_send 2 ,
-.Xr mq_timedsend 2
-.Sh STANDARDS
-The
-.Fn mq_receive
-and
-.Fn mq_timedreceive
-system calls conform to
-.St -p1003.1-2004 .
-.Sh HISTORY
-Support for
-.Tn POSIX
-message queues first appeared in
-.Fx 7.0 .
-.Sh COPYRIGHT
-Portions of this text are reprinted and reproduced in electronic form
-from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
-Portable Operating System Interface (POSIX), The Open Group Base
-Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
-Electrical and Electronics Engineers, Inc and The Open Group. In the
-event of any discrepancy between this version and the original IEEE and
-The Open Group Standard, the original IEEE and The Open Group Standard is
-the referee document. The original Standard can be obtained online at
-http://www.opengroup.org/unix/online.html.
diff --git a/lib/libc/sys/mq_send.2 b/lib/libc/sys/mq_send.2
deleted file mode 100644
index 6f18b90c14bc..000000000000
--- a/lib/libc/sys/mq_send.2
+++ /dev/null
@@ -1,236 +0,0 @@
-.\" Copyright (c) 2005 David Xu <davidxu@FreeBSD.org>
-.\" All rights reserved.
-.\"
-.\" 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(s), this list of conditions and the following disclaimer as
-.\" the first lines of this file unmodified other than the possible
-.\" addition of one or more copyright notices.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice(s), 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 HOLDER(S) ``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(S) 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.
-.\"
-.\" Portions of this text are reprinted and reproduced in electronic form
-.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
-.\" Portable Operating System Interface (POSIX), The Open Group Base
-.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
-.\" Electrical and Electronics Engineers, Inc and The Open Group. In the
-.\" event of any discrepancy between this version and the original IEEE and
-.\" The Open Group Standard, the original IEEE and The Open Group Standard is
-.\" the referee document. The original Standard can be obtained online at
-.\" http://www.opengroup.org/unix/online.html.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd November 29, 2005
-.Dt MQ_SEND 2
-.Os
-.Sh NAME
-.Nm mq_send , mq_timedsend
-.Nd "send a message to message queue (REALTIME)"
-.Sh LIBRARY
-.Lb librt
-.Sh SYNOPSIS
-.In mqueue.h
-.Ft int
-.Fo mq_send
-.Fa "mqd_t mqdes"
-.Fa "const char *msg_ptr"
-.Fa "size_t msg_len"
-.Fa "unsigned msg_prio"
-.Fc
-.Ft int
-.Fo mq_timedsend
-.Fa "mqd_t mqdes"
-.Fa "const char *msg_ptr"
-.Fa "size_t msg_len"
-.Fa "unsigned msg_prio"
-.Fa "const struct timespec *abs_timeout"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn mq_send
-system call adds the message pointed to by the argument
-.Fa msg_ptr
-to the message queue specified by
-.Fa mqdes .
-The
-.Fa msg_len
-argument specifies the length of the message, in bytes, pointed to by
-.Fa msg_ptr .
-The value of
-.Fa msg_len
-should be less than or equal to the
-.Va mq_msgsize
-attribute of the message queue, or
-.Fn mq_send
-will fail.
-.Pp
-If the specified message queue is not full,
-.Fn mq_send
-will behave as if the message is inserted into the message queue at
-the position indicated by the
-.Fa msg_prio
-argument.
-A message with a larger numeric value of
-.Fa msg_prio
-will be inserted before messages with lower values of
-.Fa msg_prio .
-A message will be inserted after other messages in the queue, if any,
-with equal
-.Fa msg_prio .
-The value of
-.Fa msg_prio
-should be less than
-.Brq Dv MQ_PRIO_MAX .
-.Pp
-If the specified message queue is full and
-.Dv O_NONBLOCK
-is not set in the message queue description associated with
-.Fa mqdes ,
-.Fn mq_send
-will block until space becomes available to enqueue the
-message, or until
-.Fn mq_send
-is interrupted by a signal.
-If more than one thread is
-waiting to send when space becomes available in the message queue and
-the Priority Scheduling option is supported, then the thread of the
-highest priority that has been waiting the longest will be unblocked
-to send its message.
-Otherwise, it is unspecified which waiting thread
-is unblocked.
-If the specified message queue is full and
-.Dv O_NONBLOCK
-is set in the message queue description associated with
-.Fa mqdes ,
-the message will not be queued and
-.Fn mq_send
-will return an error.
-.Pp
-The
-.Fn mq_timedsend
-system call will add a message to the message queue specified by
-.Fa mqdes
-in the manner defined for the
-.Fn mq_send
-system call.
-However, if the specified message queue is full and
-.Dv O_NONBLOCK
-is not set in the message queue description associated with
-.Fa mqdes ,
-the wait for sufficient room in the queue will be terminated when
-the specified timeout expires.
-If
-.Dv O_NONBLOCK
-is set in the message queue description, this system call is
-equivalent to
-.Fn mq_send .
-.Pp
-The timeout will expire when the absolute time specified by
-.Fa abs_timeout
-passes, as measured by the clock on which timeouts are based (that is,
-when the value of that clock equals or exceeds
-.Fa abs_timeout ) ,
-or if the absolute time specified by
-.Fa abs_timeout
-has already been passed at the time of the call.
-.Pp
-The timeout is based on the
-.Dv CLOCK_REALTIME
-clock.
-.Sh RETURN VALUES
-Upon successful completion, the
-.Fn mq_send
-and
-.Fn mq_timedsend
-system calls return a value of zero.
-Otherwise, no message will be
-enqueued, the system calls return \-1, and
-the global variable
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-The
-.Fn mq_send
-and
-.Fn mq_timedsend
-system calls
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EAGAIN
-The
-.Dv O_NONBLOCK
-flag is set in the message queue description associated with
-.Fa mqdes ,
-and the specified message queue is full.
-.It Bq Er EBADF
-The
-.Fa mqdes
-argument is not a valid message queue descriptor open for writing.
-.It Bq Er EINTR
-A signal interrupted the call to
-.Fn mq_send
-or
-.Fn mq_timedsend .
-.It Bq Er EINVAL
-The value of
-.Fa msg_prio
-was outside the valid range.
-.It Bq Er EINVAL
-The process or thread would have blocked, and the
-.Fa abs_timeout
-parameter specified a nanoseconds field value less than zero or greater
-than or equal to 1000 million.
-.It Bq Er EMSGSIZE
-The specified message length,
-.Fa msg_len ,
-exceeds the message size attribute of the message queue.
-.It Bq Er ETIMEDOUT
-The
-.Dv O_NONBLOCK
-flag was not set when the message queue was opened, but the timeout
-expired before the message could be added to the queue.
-.El
-.Sh SEE ALSO
-.Xr mq_open 2 ,
-.Xr mq_receive 2 ,
-.Xr mq_setattr 2 ,
-.Xr mq_timedreceive 2
-.Sh STANDARDS
-The
-.Fn mq_send
-and
-.Fn mq_timedsend
-system calls conform to
-.St -p1003.1-2004 .
-.Sh HISTORY
-Support for
-.Tn POSIX
-message queues first appeared in
-.Fx 7.0 .
-.Sh COPYRIGHT
-Portions of this text are reprinted and reproduced in electronic form
-from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
-Portable Operating System Interface (POSIX), The Open Group Base
-Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
-Electrical and Electronics Engineers, Inc and The Open Group. In the
-event of any discrepancy between this version and the original IEEE and
-The Open Group Standard, the original IEEE and The Open Group Standard is
-the referee document. The original Standard can be obtained online at
-http://www.opengroup.org/unix/online.html.
diff --git a/lib/libc/sys/mq_setattr.2 b/lib/libc/sys/mq_setattr.2
deleted file mode 100644
index 79e523d6dd75..000000000000
--- a/lib/libc/sys/mq_setattr.2
+++ /dev/null
@@ -1,123 +0,0 @@
-.\" Copyright (c) 2005 David Xu <davidxu@FreeBSD.org>
-.\" All rights reserved.
-.\"
-.\" 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(s), this list of conditions and the following disclaimer as
-.\" the first lines of this file unmodified other than the possible
-.\" addition of one or more copyright notices.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice(s), 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 HOLDER(S) ``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(S) 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.
-.\"
-.\" Portions of this text are reprinted and reproduced in electronic form
-.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
-.\" Portable Operating System Interface (POSIX), The Open Group Base
-.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
-.\" Electrical and Electronics Engineers, Inc and The Open Group. In the
-.\" event of any discrepancy between this version and the original IEEE and
-.\" The Open Group Standard, the original IEEE and The Open Group Standard is
-.\" the referee document. The original Standard can be obtained online at
-.\" http://www.opengroup.org/unix/online.html.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd May 17, 2011
-.Dt MQ_SETATTR 2
-.Os
-.Sh NAME
-.Nm mq_setattr
-.Nd "set message queue attributes (REALTIME)"
-.Sh LIBRARY
-.Lb librt
-.Sh SYNOPSIS
-.In mqueue.h
-.Ft int
-.Fo mq_setattr
-.Fa "mqd_t mqdes"
-.Fa "const struct mq_attr *restrict mqstat"
-.Fa "struct mq_attr *restrict omqstat"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn mq_setattr
-system call sets attributes associated with the open message queue description
-referenced by the message queue descriptor specified by
-.Fa mqdes .
-The message queue attributes corresponding to the following members defined
-in the
-.Vt mq_attr
-structure will be set to the specified values upon successful completion of
-.Fn mq_setattr :
-.Bl -tag -width ".Va mq_flags"
-.It Va mq_flags
-The value of this member is zero or
-.Dv O_NONBLOCK .
-.El
-.Pp
-The values of the
-.Va mq_maxmsg , mq_msgsize ,
-and
-.Va mq_curmsgs
-members of the
-.Vt mq_attr
-structure are ignored by
-.Fn mq_setattr .
-.Sh RETURN VALUES
-Upon successful completion, the function returns a value of zero and the
-attributes of the message queue will have been changed as specified.
-.Pp
-Otherwise, the message queue attributes are unchanged, and the function
-returns a value of \-1 and sets the global variable
-.Va errno
-to indicate the error.
-.Sh ERRORS
-The
-.Fn mq_setattr
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa mqdes
-argument is not a valid message queue descriptor.
-.El
-.Sh SEE ALSO
-.Xr mq_open 2 ,
-.Xr mq_send 2 ,
-.Xr mq_timedsend 2
-.Sh STANDARDS
-The
-.Fn mq_setattr
-system call conforms to
-.St -p1003.1-2004 .
-.Sh HISTORY
-Support for
-.Tn POSIX
-message queues first appeared in
-.Fx 7.0 .
-.Sh COPYRIGHT
-Portions of this text are reprinted and reproduced in electronic form
-from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
-Portable Operating System Interface (POSIX), The Open Group Base
-Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
-Electrical and Electronics Engineers, Inc and The Open Group. In the
-event of any discrepancy between this version and the original IEEE and
-The Open Group Standard, the original IEEE and The Open Group Standard is
-the referee document. The original Standard can be obtained online at
-http://www.opengroup.org/unix/online.html.
diff --git a/lib/libc/sys/mq_unlink.2 b/lib/libc/sys/mq_unlink.2
deleted file mode 100644
index 15b7018ae368..000000000000
--- a/lib/libc/sys/mq_unlink.2
+++ /dev/null
@@ -1,121 +0,0 @@
-.\" Copyright (c) 2021 Fernando Apesteguia <fernape@FreeBSD.org>
-.\"
-.\" 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(s), this list of conditions and the following disclaimer as
-.\" the first lines of this file unmodified other than the possible
-.\" addition of one or more copyright notices.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice(s), 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 HOLDER(S) ``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(S) 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.
-.\"
-.\" Portions of this text are reprinted and reproduced in electronic form
-.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
-.\" Portable Operating System Interface (POSIX), The Open Group Base
-.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
-.\" Electrical and Electronics Engineers, Inc and The Open Group. In the
-.\" event of any discrepancy between this version and the original IEEE and
-.\" The Open Group Standard, the original IEEE and The Open Group Standard is
-.\" the referee document. The original Standard can be obtained online at
-.\" http://www.opengroup.org/unix/online.html.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd February 15, 2021
-.Dt MQ_UNLINK 2
-.Os
-.Sh NAME
-.Nm mq_unlink
-.Nd "mq_unlink - remove a message queue (REALTIME)"
-.Sh LIBRARY
-.Lb librt
-.Sh SYNOPSIS
-.In mqueue.h
-.Ft int
-.Fn mq_unlink "const char *name"
-.Sh DESCRIPTION
-The
-.Fn mq_unlink
-function removes the message queue named by the string
-.Fa name .
-If one or more processes have the message queue open when
-.Fn mq_unlink
-is called, destruction of the message queue will be postponed
-until all references to the message queue have been closed.
-However, the
-.Fn mq_unlink
-call need not block until all references have been closed; it may return
-immediately.
-.Pp
-After a successful call to
-.Fn mq_unlink ,
-reuse of the name will subsequently cause
-.Xr mq_open 2
-to behave as if no message queue of this name exists.
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-The
-.Fn mq_unlink
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EACCESS
-Permission is denied to unlink the message queue represented by
-.Fa name .
-.It Bq Er EINVAL
-.Fa name
-is invalid.
-.It Bq Er ENAMETOOLONG
-The length of the
-.Fa name
-argument exceeds
-.Brq Dv PATH_MAX
-or
-a pathname component is longer than
-.Brq Dv NAME_MAX .
-.It Bq Er ENOENT
-The message queue does not exist.
-.It Bq Er ENOSYS
-.Xr mqueuefs 5
-module is neither loaded nor included in the kernel.
-.El
-.Sh SEE ALSO
-.Xr mq_open 2
-.Sh STANDARDS
-The
-.Fn mq_unlink
-system call conforms to
-.St -p1003.1-2004 .
-The
-.Bq Er EACCESS
-error code is an extension to the standard.
-.Sh HISTORY
-Support for POSIX message queues first appeared in
-.Fx 7.0 .
-.Sh COPYRIGHT
-Portions of this text are reprinted and reproduced in electronic form
-from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
-Portable Operating System Interface (POSIX), The Open Group Base
-Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
-Electrical and Electronics Engineers, Inc and The Open Group.
-In the event of any discrepancy between this version and the original IEEE and
-The Open Group Standard, the original IEEE and The Open Group Standard is
-the referee document.
-The original Standard can be obtained online at
-http://www.opengroup.org/unix/online.html.
diff --git a/lib/libc/sys/msgctl.2 b/lib/libc/sys/msgctl.2
deleted file mode 100644
index 745b365c4d93..000000000000
--- a/lib/libc/sys/msgctl.2
+++ /dev/null
@@ -1,208 +0,0 @@
-.\" $NetBSD: msgctl.2,v 1.1 1995/10/16 23:49:15 jtc Exp $
-.\"
-.\" Copyright (c) 1995 Frank van der Linden
-.\" All rights reserved.
-.\"
-.\" 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.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed for the NetBSD Project
-.\" by Frank van der Linden
-.\" 4. The name of the author may not be used to endorse or promote products
-.\" derived from this software without specific prior written permission
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"/
-.Dd July 9, 2020
-.Dt MSGCTL 2
-.Os
-.Sh NAME
-.Nm msgctl
-.Nd message control operations
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In sys/ipc.h
-.In sys/msg.h
-.Ft int
-.Fn msgctl "int msqid" "int cmd" "struct msqid_ds *buf"
-.Sh DESCRIPTION
-The
-.Fn msgctl
-system call performs some control operations on the message queue specified
-by
-.Fa msqid .
-.Pp
-Each message queue has a data structure associated with it, parts of which
-may be altered by
-.Fn msgctl
-and parts of which determine the actions of
-.Fn msgctl .
-The data structure is defined in
-.In sys/msg.h
-and contains (amongst others) the following members:
-.Bd -literal
-struct msqid_ds {
- struct ipc_perm msg_perm; /* msg queue permission bits */
- msglen_t msg_cbytes; /* number of bytes in use on the queue */
- msgqnum_t msg_qnum; /* number of msgs in the queue */
- msglen_t msg_qbytes; /* max # of bytes on the queue */
- pid_t msg_lspid; /* pid of last msgsnd() */
- pid_t msg_lrpid; /* pid of last msgrcv() */
- time_t msg_stime; /* time of last msgsnd() */
- time_t msg_rtime; /* time of last msgrcv() */
- time_t msg_ctime; /* time of last msgctl() */
-};
-.Ed
-.Pp
-The
-.Vt ipc_perm
-structure used inside the
-.Vt msqid_ds
-structure is defined in
-.In sys/ipc.h
-and looks like this:
-.Bd -literal
-struct ipc_perm {
- uid_t cuid; /* creator user id */
- gid_t cgid; /* creator group id */
- uid_t uid; /* user id */
- gid_t gid; /* group id */
- mode_t mode; /* r/w permission */
- unsigned short seq; /* sequence # (to generate unique ipcid) */
- key_t key; /* user specified msg/sem/shm key */
-};
-.Ed
-.Pp
-The operation to be performed by
-.Fn msgctl
-is specified in
-.Fa cmd
-and is one of:
-.Bl -tag -width IPC_RMIDX
-.It Dv IPC_STAT
-Gather information about the message queue and place it in the
-structure pointed to by
-.Fa buf .
-.It Dv IPC_SET
-Set the value of the
-.Va msg_perm.uid ,
-.Va msg_perm.gid ,
-.Va msg_perm.mode
-and
-.Va msg_qbytes
-fields in the structure associated with
-.Fa msqid .
-The values are taken from the corresponding fields in the structure
-pointed to by
-.Fa buf .
-This operation can only be executed by the super-user, or a process that
-has an effective user id equal to either
-.Va msg_perm.cuid
-or
-.Va msg_perm.uid
-in the data structure associated with the message queue.
-The value of
-.Va msg_qbytes
-can only be increased by the super-user.
-Values for
-.Va msg_qbytes
-that exceed the system limit (MSGMNB from
-.In sys/msg.h )
-are silently truncated to that limit.
-.It Dv IPC_RMID
-Remove the message queue specified by
-.Fa msqid
-and destroy the data associated with it.
-Only the super-user or a process
-with an effective uid equal to the
-.Va msg_perm.cuid
-or
-.Va msg_perm.uid
-values in the data structure associated with the queue can do this.
-.El
-.Pp
-The permission to read from or write to a message queue (see
-.Xr msgsnd 2
-and
-.Xr msgrcv 2 )
-is determined by the
-.Va msg_perm.mode
-field in the same way as is
-done with files (see
-.Xr chmod 2 ) ,
-but the effective uid can match either the
-.Va msg_perm.cuid
-field or the
-.Va msg_perm.uid
-field, and the
-effective gid can match either
-.Va msg_perm.cgid
-or
-.Va msg_perm.gid .
-.Sh RETURN VALUES
-.Rv -std msgctl
-.Sh ERRORS
-The
-.Fn msgctl
-function
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EPERM
-The
-.Fa cmd
-argument
-is equal to IPC_SET or IPC_RMID and the caller is not the super-user, nor does
-the effective uid match either the
-.Va msg_perm.uid
-or
-.Va msg_perm.cuid
-fields of the data structure associated with the message queue.
-.Pp
-An attempt is made to increase the value of
-.Va msg_qbytes
-through IPC_SET
-but the caller is not the super-user.
-.It Bq Er EACCES
-The command is IPC_STAT
-and the caller has no read permission for this message queue.
-.It Bq Er EINVAL
-The
-.Fa msqid
-argument
-is not a valid message queue identifier.
-.Pp
-.Va cmd
-is not a valid command.
-.It Bq Er EFAULT
-The
-.Fa buf
-argument
-specifies an invalid address.
-.El
-.Sh SEE ALSO
-.Xr msgget 2 ,
-.Xr msgrcv 2 ,
-.Xr msgsnd 2
-.Sh HISTORY
-Message queues appeared in the first release of
-.At V .
diff --git a/lib/libc/sys/msgget.2 b/lib/libc/sys/msgget.2
deleted file mode 100644
index fb1a486fc2ec..000000000000
--- a/lib/libc/sys/msgget.2
+++ /dev/null
@@ -1,154 +0,0 @@
-.\" $NetBSD: msgget.2,v 1.1 1995/10/16 23:49:19 jtc Exp $
-.\"
-.\" Copyright (c) 1995 Frank van der Linden
-.\" All rights reserved.
-.\"
-.\" 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.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed for the NetBSD Project
-.\" by Frank van der Linden
-.\" 4. The name of the author may not be used to endorse or promote products
-.\" derived from this software without specific prior written permission
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
-.\" $FreeBSD$
-.\"
-.\"/
-.Dd March 4, 2018
-.Dt MSGGET 2
-.Os
-.Sh NAME
-.Nm msgget
-.Nd get message queue
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/msg.h
-.Ft int
-.Fn msgget "key_t key" "int msgflg"
-.Sh DESCRIPTION
-The
-.Fn msgget
-function
-returns the message queue identifier associated with
-.Fa key .
-A message queue identifier is a unique integer greater than zero.
-.Pp
-A message queue is created if either
-.Fa key
-is equal to
-.Dv IPC_PRIVATE ,
-or
-.Fa key
-does not have a message queue identifier associated with it, and the
-.Dv IPC_CREAT
-bit is set in
-.Fa msgflg .
-.Pp
-If a new message queue is created, the data structure associated with it (the
-.Va msqid_ds
-structure, see
-.Xr msgctl 2 )
-is initialized as follows:
-.Bl -bullet
-.It
-.Va msg_perm.cuid
-and
-.Va msg_perm.uid
-are set to the effective uid of the calling process.
-.It
-.Va msg_perm.gid
-and
-.Va msg_perm.cgid
-are set to the effective gid of the calling process.
-.It
-.Va msg_perm.mode
-is set to the lower 9 bits of
-.Fa msgflg
-which are set by ORing these constants:
-.Bl -tag -width 0000
-.It Dv 0400
-Read access for user.
-.It Dv 0200
-Write access for user.
-.It Dv 0040
-Read access for group.
-.It Dv 0020
-Write access for group.
-.It Dv 0004
-Read access for other.
-.It Dv 0002
-Write access for other.
-.El
-.It
-.Va msg_cbytes ,
-.Va msg_qnum ,
-.Va msg_lspid ,
-.Va msg_lrpid ,
-.Va msg_rtime ,
-and
-.Va msg_stime
-are set to 0.
-.It
-.Va msg_qbytes
-is set to the system wide maximum value for the number of bytes in a queue
-.Pf ( Dv MSGMNB ) .
-.It
-.Va msg_ctime
-is set to the current time.
-.El
-.Sh RETURN VALUES
-Upon successful completion a positive message queue identifier is returned.
-Otherwise, -1 is returned and the global variable
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-.Bl -tag -width Er
-.It Bq Er EACCES
-A message queue is already associated with
-.Fa key
-and the caller has no permission to access it.
-.It Bq Er EEXIST
-Both
-.Dv IPC_CREAT
-and
-.Dv IPC_EXCL
-are set in
-.Fa msgflg ,
-and a message queue is already associated with
-.Fa key .
-.It Bq Er ENOSPC
-A new message queue could not be created because the system limit for
-the number of message queues has been reached.
-.It Bq Er ENOENT
-.Dv IPC_CREAT
-was not set in
-.Fa msgflg
-and no message queue associated with
-.Fa key
-was found.
-.El
-.Sh SEE ALSO
-.Xr msgctl 2 ,
-.Xr msgrcv 2 ,
-.Xr msgsnd 2
-.Sh HISTORY
-Message queues appeared in the first release of
-.At V .
diff --git a/lib/libc/sys/msgrcv.2 b/lib/libc/sys/msgrcv.2
deleted file mode 100644
index 59eeec42f2d5..000000000000
--- a/lib/libc/sys/msgrcv.2
+++ /dev/null
@@ -1,222 +0,0 @@
-.\" $NetBSD: msgrcv.2,v 1.1 1995/10/16 23:49:20 jtc Exp $
-.\"
-.\" Copyright (c) 1995 Frank van der Linden
-.\" All rights reserved.
-.\"
-.\" 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.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed for the NetBSD Project
-.\" by Frank van der Linden
-.\" 4. The name of the author may not be used to endorse or promote products
-.\" derived from this software without specific prior written permission
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
-.\" $FreeBSD$
-.\"
-.\"/
-.Dd July 28, 2016
-.Dt MSGRCV 2
-.Os
-.Sh NAME
-.Nm msgrcv
-.Nd receive a message from a message queue
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In sys/ipc.h
-.In sys/msg.h
-.Ft ssize_t
-.Fn msgrcv "int msqid" "void *msgp" "size_t msgsz" "long msgtyp" "int msgflg"
-.Sh DESCRIPTION
-The
-.Fn msgrcv
-function receives a message from the message queue specified in
-.Fa msqid ,
-and places it into the structure pointed to by
-.Fa msgp .
-This structure should consist of the following members:
-.Bd -literal
- long mtype; /* message type */
- char mtext[1]; /* body of message */
-.Ed
-.Pp
-.Va mtype
-is an integer greater than 0 that can be used for selecting messages,
-.Va mtext
-is an array of bytes, with a size up to that of the system limit
-.Pf ( Dv MSGMAX ) .
-.Pp
-The value of
-.Fa msgtyp
-has one of the following meanings:
-.Bl -bullet
-.It
-The
-.Fa msgtyp
-argument
-is greater than 0.
-The first message of type
-.Fa msgtyp
-will be received.
-.It
-The
-.Fa msgtyp
-argument
-is equal to 0.
-The first message on the queue will be received.
-.It
-The
-.Fa msgtyp
-argument
-is less than 0.
-The first message of the lowest message type that is
-less than or equal to the absolute value of
-.Fa msgtyp
-will be received.
-.El
-.Pp
-The
-.Fa msgsz
-argument
-specifies the maximum length of the requested message.
-If the received
-message has a length greater than
-.Fa msgsz
-it will be silently truncated if the
-.Dv MSG_NOERROR
-flag is set in
-.Fa msgflg ,
-otherwise an error will be returned.
-.Pp
-If no matching message is present on the message queue specified by
-.Fa msqid ,
-the behavior of
-.Fn msgrcv
-depends on whether the
-.Dv IPC_NOWAIT
-flag is set in
-.Fa msgflg
-or not.
-If
-.Dv IPC_NOWAIT
-is set,
-.Fn msgrcv
-will immediately return a value of -1, and set
-.Va errno
-to
-.Er ENOMSG .
-If
-.Dv IPC_NOWAIT
-is not set, the calling process will be blocked
-until:
-.Bl -bullet
-.It
-A message of the requested type becomes available on the message queue.
-.It
-The message queue is removed, in which case -1 will be returned, and
-.Va errno
-set to
-.Er EINVAL .
-.It
-A signal is received and caught.
--1 is returned, and
-.Va errno
-set to
-.Er EINTR .
-.El
-.Pp
-If a message is successfully received, the data structure associated with
-.Fa msqid
-is updated as follows:
-.Bl -bullet
-.It
-.Va msg_cbytes
-is decremented by the size of the message.
-.It
-.Va msg_lrpid
-is set to the pid of the caller.
-.It
-.Va msg_lrtime
-is set to the current time.
-.It
-.Va msg_qnum
-is decremented by 1.
-.El
-.Sh RETURN VALUES
-Upon successful completion,
-.Fn msgrcv
-returns the number of bytes received into the
-.Va mtext
-field of the structure pointed to by
-.Fa msgp .
-Otherwise, -1 is returned, and
-.Va errno
-set to indicate the error.
-.Sh ERRORS
-The
-.Fn msgrcv
-function
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Fa msqid
-argument
-is not a valid message queue identifier.
-.Pp
-The message queue was removed while
-.Fn msgrcv
-was waiting for a message of the requested type to become available on it.
-.Pp
-The
-.Fa msgsz
-argument
-is less than 0.
-.It Bq Er E2BIG
-A matching message was received, but its size was greater than
-.Fa msgsz
-and the
-.Dv MSG_NOERROR
-flag was not set in
-.Fa msgflg .
-.It Bq Er EACCES
-The calling process does not have read access to the message queue.
-.It Bq Er EFAULT
-The
-.Fa msgp
-argument
-points to an invalid address.
-.It Bq Er EINTR
-The system call was interrupted by the delivery of a signal.
-.It Bq Er ENOMSG
-There is no message of the requested type available on the message queue,
-and
-.Dv IPC_NOWAIT
-is set in
-.Fa msgflg .
-.El
-.Sh SEE ALSO
-.Xr msgctl 2 ,
-.Xr msgget 2 ,
-.Xr msgsnd 2
-.Sh HISTORY
-Message queues appeared in the first release of
-.At V .
diff --git a/lib/libc/sys/msgsnd.2 b/lib/libc/sys/msgsnd.2
deleted file mode 100644
index 051c9922e58c..000000000000
--- a/lib/libc/sys/msgsnd.2
+++ /dev/null
@@ -1,184 +0,0 @@
-.\" $NetBSD: msgsnd.2,v 1.1 1995/10/16 23:49:24 jtc Exp $
-.\"
-.\" Copyright (c) 1995 Frank van der Linden
-.\" All rights reserved.
-.\"
-.\" 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.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed for the NetBSD Project
-.\" by Frank van der Linden
-.\" 4. The name of the author may not be used to endorse or promote products
-.\" derived from this software without specific prior written permission
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd July 9, 2009
-.Dt MSGSND 2
-.Os
-.Sh NAME
-.Nm msgsnd
-.Nd send a message to a message queue
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In sys/ipc.h
-.In sys/msg.h
-.Ft int
-.Fn msgsnd "int msqid" "const void *msgp" "size_t msgsz" "int msgflg"
-.Sh DESCRIPTION
-The
-.Fn msgsnd
-function sends a message to the message queue specified in
-.Fa msqid .
-The
-.Fa msgp
-argument
-points to a structure containing the message.
-This structure should
-consist of the following members:
-.Bd -literal
- long mtype; /* message type */
- char mtext[1]; /* body of message */
-.Ed
-.Pp
-.Va mtype
-is an integer greater than 0 that can be used for selecting messages (see
-.Xr msgrcv 2 ) ,
-.Va mtext
-is an array of
-.Fa msgsz
-bytes.
-The argument
-.Fa msgsz
-can range from 0 to a system-imposed maximum,
-.Dv MSGMAX .
-.Pp
-If the number of bytes already on the message queue plus
-.Fa msgsz
-is bigger than the maximum number of bytes on the message queue
-.Pf ( Va msg_qbytes ,
-see
-.Xr msgctl 2 ) ,
-or the number of messages on all queues system-wide is already equal to
-the system limit,
-.Fa msgflg
-determines the action of
-.Fn msgsnd .
-If
-.Fa msgflg
-has
-.Dv IPC_NOWAIT
-mask set in it, the call will return immediately.
-If
-.Fa msgflg
-does not have
-.Dv IPC_NOWAIT
-set in it, the call will block until:
-.Bl -bullet
-.It
-The condition which caused the call to block does no longer exist.
-The message will be sent.
-.It
-The message queue is removed, in which case -1 will be returned, and
-.Va errno
-is set to
-.Er EINVAL .
-.It
-The caller catches a signal.
-The call returns with
-.Va errno
-set to
-.Er EINTR .
-.El
-.Pp
-After a successful call, the data structure associated with the message
-queue is updated in the following way:
-.Bl -bullet
-.It
-.Va msg_cbytes
-is incremented by the size of the message.
-.It
-.Va msg_qnum
-is incremented by 1.
-.It
-.Va msg_lspid
-is set to the pid of the calling process.
-.It
-.Va msg_stime
-is set to the current time.
-.El
-.Sh RETURN VALUES
-.Rv -std msgsnd
-.Sh ERRORS
-The
-.Fn msgsnd
-function
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Fa msqid
-argument
-is not a valid message queue identifier.
-.Pp
-The message queue was removed while
-.Fn msgsnd
-was waiting for a resource to become available in order to deliver the
-message.
-.Pp
-The
-.Fa msgsz
-argument
-is greater than
-.Va msg_qbytes .
-.Pp
-The
-.Fa mtype
-argument
-is not greater than 0.
-.It Bq Er EACCES
-The calling process does not have write access to the message queue.
-.It Bq Er EAGAIN
-There was no space for this message either on the queue, or in the whole
-system, and
-.Dv IPC_NOWAIT
-was set in
-.Fa msgflg .
-.It Bq Er EFAULT
-The
-.Fa msgp
-argument
-points to an invalid address.
-.It Bq Er EINTR
-The system call was interrupted by the delivery of a signal.
-.El
-.Sh HISTORY
-Message queues appeared in the first release of AT&T Unix System V.
-.Sh BUGS
-.Nx
-and
-.Fx
-do not define the
-.Er EIDRM
-error value, which should be used
-in the case of a removed message queue.
diff --git a/lib/libc/sys/msync.2 b/lib/libc/sys/msync.2
deleted file mode 100644
index 94eb50f8c813..000000000000
--- a/lib/libc/sys/msync.2
+++ /dev/null
@@ -1,126 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)msync.2 8.2 (Berkeley) 6/21/94
-.\" $FreeBSD$
-.\"
-.Dd March 18, 2012
-.Dt MSYNC 2
-.Os
-.Sh NAME
-.Nm msync
-.Nd synchronize a mapped region
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/mman.h
-.Ft int
-.Fn msync "void *addr" "size_t len" "int flags"
-.Sh DESCRIPTION
-The
-.Fn msync
-system call
-writes any modified pages back to the file system and updates
-the file modification time.
-If
-.Fa len
-is 0, all modified pages within the region containing
-.Fa addr
-will be flushed;
-if
-.Fa len
-is non-zero, only those pages containing
-.Fa addr
-and
-.Fa len-1
-succeeding locations will be examined.
-The
-.Fa flags
-argument may be specified as follows:
-.Pp
-.Bl -tag -width ".Dv MS_INVALIDATE" -compact
-.It Dv MS_ASYNC
-Return immediately
-.It Dv MS_SYNC
-Perform synchronous writes
-.It Dv MS_INVALIDATE
-Invalidate all cached data
-.El
-.Sh RETURN VALUES
-.Rv -std msync
-.Sh ERRORS
-The
-.Fn msync
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EBUSY
-Some or all of the pages in the specified region are locked and
-.Dv MS_INVALIDATE
-is specified.
-.It Bq Er EINVAL
-The
-.Fa addr
-argument
-is not a multiple of the hardware page size.
-.It Bq Er ENOMEM
-The addresses in the range starting at
-.Fa addr
-and continuing for
-.Fa len
-bytes are outside the range allowed for the address space of a
-process or specify one or more pages that are not mapped.
-.It Bq Er EINVAL
-The
-.Fa flags
-argument
-was both MS_ASYNC and MS_INVALIDATE.
-Only one of these flags is allowed.
-.It Bq Er EIO
-An error occurred while writing at least one of the pages in
-the specified region.
-.El
-.Sh SEE ALSO
-.Xr madvise 2 ,
-.Xr mincore 2 ,
-.Xr mlock 2 ,
-.Xr mprotect 2 ,
-.Xr munmap 2
-.Sh HISTORY
-The
-.Fn msync
-system call first appeared in
-.Bx 4.4 .
-.Sh BUGS
-The
-.Fn msync
-system call is usually not needed since
-.Bx
-implements a coherent file system buffer cache.
-However, it may be used to associate dirty VM pages with file system
-buffers and thus cause them to be flushed to physical media sooner
-rather than later.
diff --git a/lib/libc/sys/msync.c b/lib/libc/sys/msync.c
index d86cc0462dd8..f825db97b947 100644
--- a/lib/libc/sys/msync.c
+++ b/lib/libc/sys/msync.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2014 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/fcntl.h>
#include <sys/mman.h>
@@ -44,7 +40,5 @@ __weak_reference(__sys_msync, __msync);
int
msync(void *addr, size_t len, int flags)
{
-
- return (((int (*)(void *, size_t, int))
- __libc_interposing[INTERPOS_msync])(addr, len, flags));
+ return (INTERPOS_SYS(msync, addr, len, flags));
}
diff --git a/lib/libc/sys/munmap.2 b/lib/libc/sys/munmap.2
deleted file mode 100644
index d050db0f3fac..000000000000
--- a/lib/libc/sys/munmap.2
+++ /dev/null
@@ -1,78 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)munmap.2 8.3 (Berkeley) 5/27/94
-.\" $FreeBSD$
-.\"
-.Dd June 22, 2017
-.Dt MUNMAP 2
-.Os
-.Sh NAME
-.Nm munmap
-.Nd remove a mapping
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/mman.h
-.Ft int
-.Fn munmap "void *addr" "size_t len"
-.Sh DESCRIPTION
-The
-.Fn munmap
-system call
-deletes the mappings and guards for the specified address range,
-and causes further references to addresses within the range
-to generate invalid memory references.
-.Sh RETURN VALUES
-.Rv -std munmap
-.Sh ERRORS
-The
-.Fn munmap
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Fa addr
-argument was not page aligned, the
-.Fa len
-argument was zero or negative, or
-some part of the region being unmapped is outside the
-valid address range for a process.
-.El
-.Sh "SEE ALSO"
-.Xr madvise 2 ,
-.Xr mincore 2 ,
-.Xr mmap 2 ,
-.Xr mprotect 2 ,
-.Xr msync 2 ,
-.Xr getpagesize 3
-.Sh HISTORY
-The
-.Fn munmap
-system call first appeared in
-.Bx 4.4 .
diff --git a/lib/libc/sys/nanosleep.2 b/lib/libc/sys/nanosleep.2
deleted file mode 100644
index eb75c4b1043b..000000000000
--- a/lib/libc/sys/nanosleep.2
+++ /dev/null
@@ -1,205 +0,0 @@
-.\" $NetBSD: nanosleep.2,v 1.23 2016/11/14 10:40:59 wiz Exp $
-.\"
-.\" Copyright (c) 1986, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)sleep.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd October 7, 2021
-.Dt NANOSLEEP 2
-.Os
-.Sh NAME
-.Nm nanosleep
-.Nd high resolution sleep
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In time.h
-.Ft int
-.Fo clock_nanosleep
-.Fa "clockid_t clock_id"
-.Fa "int flags"
-.Fa "const struct timespec *rqtp"
-.Fa "struct timespec *rmtp"
-.Fc
-.Ft int
-.Fo nanosleep
-.Fa "const struct timespec *rqtp"
-.Fa "struct timespec *rmtp"
-.Fc
-.Sh DESCRIPTION
-If the
-.Dv TIMER_ABSTIME
-flag is not set in the
-.Fa flags
-argument, then
-.Fn clock_nanosleep
-suspends execution of the calling thread until either the
-time interval specified by the
-.Fa rqtp
-argument has elapsed,
-or a signal is delivered to the calling process and its
-action is to invoke a signal-catching function or to terminate the
-process.
-The clock used to measure the time is specified by the
-.Fa clock_id
-argument.
-.Pp
-If the
-.Dv TIMER_ABSTIME
-flag is set in the
-.Fa flags
-argument, then
-.Fn clock_nanosleep
-suspends execution of the calling thread until either the value
-of the clock specified by the
-.Fa clock_id
-argument reaches the absolute time specified by the
-.Fa rqtp
-argument,
-or a signal is delivered to the calling process and its
-action is to invoke a signal-catching function or to terminate the
-process.
-If, at the time of the call, the time value specified by
-.Fa rqtp
-is less than or equal to the time value of the specified clock, then
-.Fn clock_nanosleep
-returns immediately and the calling thread is not suspended.
-.Pp
-The suspension time may be longer than requested due to the
-scheduling of other activity by the system.
-It is also subject to the allowed time interval deviation
-specified by the
-.Va kern.timecounter.alloweddeviation
-.Xr sysctl 8
-variable.
-An unmasked signal will terminate the sleep early, regardless of the
-.Dv SA_RESTART
-value on the interrupting signal.
-The
-.Fa rqtp
-and
-.Fa rmtp
-arguments can point to the same object.
-.Pp
-The following
-.Fa clock_id
-values are supported:
-.Pp
-.Bl -item -compact -offset indent
-.It
-CLOCK_MONOTONIC
-.It
-CLOCK_MONOTONIC_FAST
-.It
-CLOCK_MONOTONIC_PRECISE
-.It
-CLOCK_REALTIME
-.It
-CLOCK_REALTIME_FAST
-.It
-CLOCK_REALTIME_PRECISE
-.It
-CLOCK_SECOND
-.It
-CLOCK_UPTIME
-.It
-CLOCK_UPTIME_FAST
-.It
-CLOCK_UPTIME_PRECISE
-.El
-.Pp
-The
-.Fn nanosleep
-function behaves like
-.Fn clock_nanosleep
-with a
-.Fa clock_id
-argument of
-.Dv CLOCK_REALTIME
-and without the
-.Dv TIMER_ABSTIME
-flag in the
-.Fa flags
-argument.
-.Sh RETURN VALUES
-These functions return zero when the requested time has elapsed.
-.Pp
-If these functions return for any other reason, then
-.Fn clock_nanosleep
-will directly return the error number, and
-.Fn nanosleep
-will return \-1 with the global variable
-.Va errno
-set to indicate the error.
-If a relative sleep is interrupted by a signal and
-.Fa rmtp
-is
-.Pf non- Dv NULL ,
-the timespec structure it references is updated to contain the
-unslept amount (the request time minus the time actually slept).
-.Sh ERRORS
-These functions can fail with the following errors.
-.Bl -tag -width Er
-.It Bq Er EFAULT
-Either
-.Fa rqtp
-or
-.Fa rmtp
-points to memory that is not a valid part of the process
-address space.
-.It Bq Er EINTR
-The function was interrupted by the delivery of a signal.
-.It Bq Er EINVAL
-The
-.Fa rqtp
-argument specified a nanosecond value less than zero
-or greater than or equal to 1000 million.
-.It Bq Er EINVAL
-The
-.Fa flags
-argument contained an invalid flag.
-.It Bq Er EINVAL
-The
-.Fa clock_id
-argument was
-.Dv CLOCK_THREAD_CPUTIME_ID
-or an unrecognized value.
-.It Bq Er ENOTSUP
-The
-.Fa clock_id
-argument was valid but not supported by this implementation of
-.Fn clock_nanosleep .
-.El
-.Sh SEE ALSO
-.Xr clock_gettime 2 ,
-.Xr sigaction 2 ,
-.Xr sleep 3
-.Sh STANDARDS
-These functions conform to
-.St -p1003.1-2008 .
diff --git a/lib/libc/sys/nanosleep.c b/lib/libc/sys/nanosleep.c
index 412b05e778b0..bd0794c3af8e 100644
--- a/lib/libc/sys/nanosleep.c
+++ b/lib/libc/sys/nanosleep.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2014 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <time.h>
#include "libc_private.h"
@@ -43,7 +39,5 @@ __weak_reference(__sys_nanosleep, __nanosleep);
int
nanosleep(const struct timespec *rqtp, struct timespec *rmtp)
{
-
- return (((int (*)(const struct timespec *, struct timespec *))
- __libc_interposing[INTERPOS_nanosleep])(rqtp, rmtp));
+ return (INTERPOS_SYS(nanosleep, rqtp, rmtp));
}
diff --git a/lib/libc/sys/nfssvc.2 b/lib/libc/sys/nfssvc.2
deleted file mode 100644
index ef7f6f64c51e..000000000000
--- a/lib/libc/sys/nfssvc.2
+++ /dev/null
@@ -1,258 +0,0 @@
-.\" Copyright (c) 1989, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)nfssvc.2 8.1 (Berkeley) 6/9/93
-.\" $FreeBSD$
-.\"
-.Dd June 9, 1993
-.Dt NFSSVC 2
-.Os
-.Sh NAME
-.Nm nfssvc
-.Nd NFS services
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/param.h
-.In sys/mount.h
-.In sys/time.h
-.In nfs/rpcv2.h
-.In nfsserver/nfs.h
-.In unistd.h
-.Ft int
-.Fn nfssvc "int flags" "void *argstructp"
-.Sh DESCRIPTION
-The
-.Fn nfssvc
-system call is used by the NFS daemons to pass information into and out
-of the kernel and also to enter the kernel as a server daemon.
-The
-.Fa flags
-argument consists of several bits that show what action is to be taken
-once in the kernel and the
-.Fa argstructp
-points to one of three structures depending on which bits are set in
-flags.
-.Pp
-On the client side,
-.Xr nfsiod 8
-calls
-.Fn nfssvc
-with the
-.Fa flags
-argument set to
-.Dv NFSSVC_BIOD
-and
-.Fa argstructp
-set to
-.Dv NULL
-to enter the kernel as a block I/O server daemon.
-For
-.Tn NQNFS ,
-.Xr mount_nfs 8
-calls
-.Fn nfssvc
-with the
-.Dv NFSSVC_MNTD
-flag, optionally or'd with the flags
-.Dv NFSSVC_GOTAUTH
-and
-.Dv NFSSVC_AUTHINFAIL
-along with a pointer to a
-.Bd -literal
-struct nfsd_cargs {
- char *ncd_dirp; /* Mount dir path */
- uid_t ncd_authuid; /* Effective uid */
- int ncd_authtype; /* Type of authenticator */
- int ncd_authlen; /* Length of authenticator string */
- u_char *ncd_authstr; /* Authenticator string */
- int ncd_verflen; /* and the verifier */
- u_char *ncd_verfstr;
- NFSKERBKEY_T ncd_key; /* Session key */
-};
-.Ed
-.Pp
-structure.
-The initial call has only the
-.Dv NFSSVC_MNTD
-flag set to specify service for the mount point.
-If the mount point is using Kerberos, then the
-.Xr mount_nfs 8
-utility will return from
-.Fn nfssvc
-with
-.Va errno
-==
-.Er ENEEDAUTH
-whenever the client side requires an ``rcmd''
-authentication ticket for the user.
-The
-.Xr mount_nfs 8
-utility will attempt to get the Kerberos ticket, and if successful will call
-.Fn nfssvc
-with the flags
-.Dv NFSSVC_MNTD
-and
-.Dv NFSSVC_GOTAUTH
-after filling the ticket into the
-ncd_authstr field
-and
-setting the ncd_authlen and ncd_authtype
-fields of the nfsd_cargs structure.
-If
-.Xr mount_nfs 8
-failed to get the ticket,
-.Fn nfssvc
-will be called with the flags
-.Dv NFSSVC_MNTD ,
-.Dv NFSSVC_GOTAUTH
-and
-.Dv NFSSVC_AUTHINFAIL
-to denote a failed authentication attempt.
-.Pp
-On the server side,
-.Fn nfssvc
-is called with the flag
-.Dv NFSSVC_NFSD
-and a pointer to a
-.Bd -literal
-struct nfsd_srvargs {
- struct nfsd *nsd_nfsd; /* Pointer to in kernel nfsd struct */
- uid_t nsd_uid; /* Effective uid mapped to cred */
- uint32_t nsd_haddr; /* Ip address of client */
- struct ucred nsd_cr; /* Cred. uid maps to */
- int nsd_authlen; /* Length of auth string (ret) */
- u_char *nsd_authstr; /* Auth string (ret) */
- int nsd_verflen; /* and the verifier */
- u_char *nsd_verfstr;
- struct timeval nsd_timestamp; /* timestamp from verifier */
- uint32_t nsd_ttl; /* credential ttl (sec) */
- NFSKERBKEY_T nsd_key; /* Session key */
-};
-.Ed
-.Pp
-to enter the kernel as an
-.Xr nfsd 8
-daemon.
-Whenever an
-.Xr nfsd 8
-daemon receives a Kerberos authentication ticket, it will return from
-.Fn nfssvc
-with
-.Va errno
-==
-.Er ENEEDAUTH .
-The
-.Xr nfsd 8
-utility will attempt to authenticate the ticket and generate a set of credentials
-on the server for the ``user id'' specified in the field nsd_uid.
-This is done by first authenticating the Kerberos ticket and then mapping
-the Kerberos principal to a local name and getting a set of credentials for
-that user via
-.Xr getpwnam 3
-and
-.Xr getgrouplist 3 .
-If successful, the
-.Xr nfsd 8
-utility will call
-.Fn nfssvc
-with the
-.Dv NFSSVC_NFSD
-and
-.Dv NFSSVC_AUTHIN
-flags set to pass the credential mapping in nsd_cr into the
-kernel to be cached on the server socket for that client.
-If the authentication failed,
-.Xr nfsd 8
-calls
-.Fn nfssvc
-with the flags
-.Dv NFSSVC_NFSD
-and
-.Dv NFSSVC_AUTHINFAIL
-to denote an authentication failure.
-.Pp
-The master
-.Xr nfsd 8
-server daemon calls
-.Fn nfssvc
-with the flag
-.Dv NFSSVC_ADDSOCK
-and a pointer to a
-.Bd -literal
-struct nfsd_args {
- int sock; /* Socket to serve */
- caddr_t name; /* Client address for connection based sockets */
- int namelen;/* Length of name */
-};
-.Ed
-.Pp
-to pass a server side
-.Tn NFS
-socket into the kernel for servicing by the
-.Xr nfsd 8
-daemons.
-.Sh RETURN VALUES
-Normally
-.Fn nfssvc
-does not return unless the server
-is terminated by a signal when a value of 0 is returned.
-Otherwise, -1 is returned and the global variable
-.Va errno
-is set to specify the error.
-.Sh ERRORS
-.Bl -tag -width Er
-.It Bq Er ENEEDAUTH
-This special error value
-is really used for authentication support, particularly Kerberos,
-as explained above.
-.It Bq Er EPERM
-The caller is not the super-user.
-.El
-.Sh SEE ALSO
-.Xr mount_nfs 8 ,
-.Xr nfsd 8 ,
-.Xr nfsiod 8
-.Sh HISTORY
-The
-.Fn nfssvc
-system call first appeared in
-.Bx 4.4 .
-.Sh BUGS
-The
-.Fn nfssvc
-system call is designed specifically for the
-.Tn NFS
-support daemons and as such is specific to their requirements.
-It should really return values to indicate the need for authentication
-support, since
-.Er ENEEDAUTH
-is not really an error.
-Several fields of the argument structures are assumed to be valid and
-sometimes to be unchanged from a previous call, such that
-.Fn nfssvc
-must be used with extreme care.
diff --git a/lib/libc/sys/ntp_adjtime.2 b/lib/libc/sys/ntp_adjtime.2
deleted file mode 100644
index 8ce78e7fb86e..000000000000
--- a/lib/libc/sys/ntp_adjtime.2
+++ /dev/null
@@ -1,315 +0,0 @@
-.\" $NetBSD: ntp_adjtime.2,v 1.6 2003/04/16 13:34:55 wiz Exp $
-.\"
-.\" Copyright (c) 2001 The NetBSD Foundation, Inc.
-.\" All rights reserved.
-.\"
-.\" This code is derived from software contributed to The NetBSD Foundation
-.\" by Thomas Klausner.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd July 13, 2005
-.Dt NTP_ADJTIME 2
-.Os
-.Sh NAME
-.Nm ntp_adjtime ,
-.Nm ntp_gettime
-.Nd Network Time Protocol (NTP) daemon interface system calls
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/timex.h
-.Ft int
-.Fn ntp_adjtime "struct timex *"
-.Ft int
-.Fn ntp_gettime "struct ntptimeval *"
-.Sh DESCRIPTION
-The two system calls
-.Fn ntp_adjtime
-and
-.Fn ntp_gettime
-are the kernel interface to the Network Time Protocol (NTP) daemon
-.Xr ntpd 8 .
-.Pp
-The
-.Fn ntp_adjtime
-function is used by the NTP daemon to adjust the system clock to an
-externally derived time.
-The time offset and related variables which are set by
-.Fn ntp_adjtime
-are used by
-.Fn hardclock
-to adjust the phase and frequency of the phase- or frequency-lock loop
-(PLL resp. FLL) which controls the system clock.
-.Pp
-The
-.Fn ntp_gettime
-function provides the time, maximum error (sync distance) and
-estimated error (dispersion) to client user application programs.
-.Pp
-In the following, all variables that refer PPS are only relevant if
-the
-.Em PPS_SYNC
-option is enabled in the kernel.
-.Pp
-.Fn ntp_adjtime
-has as argument a
-.Va struct timex *
-of the following form:
-.Bd -literal
-struct timex {
- unsigned int modes; /* clock mode bits (wo) */
- long offset; /* time offset (us) (rw) */
- long freq; /* frequency offset (scaled ppm) (rw) */
- long maxerror; /* maximum error (us) (rw) */
- long esterror; /* estimated error (us) (rw) */
- int status; /* clock status bits (rw) */
- long constant; /* pll time constant (rw) */
- long precision; /* clock precision (us) (ro) */
- long tolerance; /* clock frequency tolerance (scaled
- * ppm) (ro) */
- /*
- * The following read-only structure members are implemented
- * only if the PPS signal discipline is configured in the
- * kernel.
- */
- long ppsfreq; /* pps frequency (scaled ppm) (ro) */
- long jitter; /* pps jitter (us) (ro) */
- int shift; /* interval duration (s) (shift) (ro) */
- long stabil; /* pps stability (scaled ppm) (ro) */
- long jitcnt; /* jitter limit exceeded (ro) */
- long calcnt; /* calibration intervals (ro) */
- long errcnt; /* calibration errors (ro) */
- long stbcnt; /* stability limit exceeded (ro) */
-};
-.Ed
-.Pp
-The members of this struct have the following meanings when used as
-argument for
-.Fn ntp_adjtime :
-.Bl -tag -width tolerance -compact
-.It Fa modes
-Defines what settings should be changed with the current
-.Fn ntp_adjtime
-call (write-only).
-Bitwise OR of the following:
-.Bl -tag -width MOD_TIMECONST -compact -offset indent
-.It MOD_OFFSET
-set time offset
-.It MOD_FREQUENCY
-set frequency offset
-.It MOD_MAXERROR
-set maximum time error
-.It MOD_ESTERROR
-set estimated time error
-.It MOD_STATUS
-set clock status bits
-.It MOD_TIMECONST
-set PLL time constant
-.It MOD_CLKA
-set clock A
-.It MOD_CLKB
-set clock B
-.El
-.It Fa offset
-Time offset (in microseconds), used by the PLL/FLL to adjust the
-system time in small increments (read-write).
-.It Fa freq
-Frequency offset (scaled ppm) (read-write).
-.It Fa maxerror
-Maximum error (in microseconds).
-Initialized by an
-.Fn ntp_adjtime
-call, and increased by the kernel once each second to reflect the maximum
-error bound growth (read-write).
-.It Fa esterror
-Estimated error (in microseconds).
-Set and read by
-.Fn ntp_adjtime ,
-but unused by the kernel (read-write).
-.It Fa status
-System clock status bits (read-write).
-Bitwise OR of the following:
-.Bl -tag -width STA_PPSJITTER -compact -offset indent
-.It STA_PLL
-Enable PLL updates (read-write).
-.It STA_PPSFREQ
-Enable PPS freq discipline (read-write).
-.It STA_PPSTIME
-Enable PPS time discipline (read-write).
-.It STA_FLL
-Select frequency-lock mode (read-write).
-.It STA_INS
-Insert leap (read-write).
-.It STA_DEL
-Delete leap (read-write).
-.It STA_UNSYNC
-Clock unsynchronized (read-write).
-.It STA_FREQHOLD
-Hold frequency (read-write).
-.It STA_PPSSIGNAL
-PPS signal present (read-only).
-.It STA_PPSJITTER
-PPS signal jitter exceeded (read-only).
-.It STA_PPSWANDER
-PPS signal wander exceeded (read-only).
-.It STA_PPSERROR
-PPS signal calibration error (read-only).
-.It STA_CLOCKERR
-Clock hardware fault (read-only).
-.El
-.It Fa constant
-PLL time constant, determines the bandwidth, or
-.Dq stiffness ,
-of the PLL (read-write).
-.It Fa precision
-Clock precision (in microseconds).
-In most cases the same as the kernel tick variable (see
-.Xr hz 9 ) .
-If a precision clock counter or external time-keeping signal is available,
-it could be much lower (and depend on the state of the signal)
-(read-only).
-.It Fa tolerance
-Maximum frequency error, or tolerance of the CPU clock oscillator (scaled
-ppm).
-Ordinarily a property of the architecture, but could change under
-the influence of external time-keeping signals (read-only).
-.It Fa ppsfreq
-PPS frequency offset produced by the frequency median filter (scaled
-ppm) (read-only).
-.It Fa jitter
-PPS jitter measured by the time median filter in microseconds
-(read-only).
-.It Fa shift
-Logarithm to base 2 of the interval duration in seconds (PPS,
-read-only).
-.It Fa stabil
-PPS stability (scaled ppm); dispersion (wander) measured by the
-frequency median filter (read-only).
-.It Fa jitcnt
-Number of seconds that have been discarded because the jitter measured
-by the time median filter exceeded the limit
-.Em MAXTIME
-(PPS, read-only).
-.It Fa calcnt
-Count of calibration intervals (PPS, read-only).
-.It Fa errcnt
-Number of calibration intervals that have been discarded because the
-wander exceeded the limit
-.Em MAXFREQ
-or where the calibration interval jitter exceeded two ticks (PPS,
-read-only).
-.It Fa stbcnt
-Number of calibration intervals that have been discarded because the
-frequency wander exceeded the limit
-.Em MAXFREQ Ns /4
-(PPS, read-only).
-.El
-After the
-.Fn ntp_adjtime
-call, the
-.Va struct timex *
-structure contains the current values of the corresponding variables.
-.Pp
-.Fn ntp_gettime
-has as argument a
-.Va struct ntptimeval *
-with the following members:
-.Bd -literal
-struct ntptimeval {
- struct timeval time; /* current time (ro) */
- long maxerror; /* maximum error (us) (ro) */
- long esterror; /* estimated error (us) (ro) */
-};
-.Ed
-.Pp
-These have the following meaning:
-.Bl -tag -width tolerance -compact
-.It Fa time
-Current time (read-only).
-.It Fa maxerror
-Maximum error in microseconds (read-only).
-.It Fa esterror
-Estimated error in microseconds (read-only).
-.El
-.Sh RETURN VALUES
-.Fn ntp_adjtime
-and
-.Fn ntp_gettime
-return the current state of the clock on success, or any of the errors
-of
-.Xr copyin 9
-and
-.Xr copyout 9 .
-.Fn ntp_adjtime
-may additionally return
-.Er EPERM
-if the user calling
-.Fn ntp_adjtime
-does not have sufficient permissions.
-.Pp
-Possible states of the clock are:
-.Bl -tag -width TIME_ERROR -compact -offset indent
-.It TIME_OK
-Everything okay, no leap second warning.
-.It TIME_INS
-.Dq insert leap second
-warning.
-At the end of the day, a leap second will be inserted after 23:59:59.
-.It TIME_DEL
-.Dq delete leap second
-warning.
-At the end of the day, second 23:59:59 will be skipped.
-.It TIME_OOP
-Leap second in progress.
-.It TIME_WAIT
-Leap second has occurred within the last few seconds.
-.It TIME_ERROR
-Clock not synchronized.
-.El
-.Sh ERRORS
-The
-.Fn ntp_adjtime
-system call may return
-.Er EPERM
-if the caller
-does not have sufficient permissions.
-.Sh SEE ALSO
-.Xr options 4 ,
-.Xr ntpd 8 ,
-.Xr hardclock 9 ,
-.Xr hz 9
-.Bl -tag -width indent
-.It Pa http://www.bipm.fr/enus/5_Scientific/c_time/time_1.html
-.It Pa http://www.boulder.nist.gov/timefreq/general/faq.htm
-.It Pa ftp://time.nist.gov/pub/leap-seconds.list
-.El
-.Sh BUGS
-Take note that this
-.Tn API
-is extremely complex and stateful.
-Users should not attempt modification without first
-reviewing the
-.Xr ntpd 8
-sources in depth.
diff --git a/lib/libc/sys/open.2 b/lib/libc/sys/open.2
deleted file mode 100644
index da42c238a151..000000000000
--- a/lib/libc/sys/open.2
+++ /dev/null
@@ -1,686 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)open.2 8.2 (Berkeley) 11/16/93
-.\" $FreeBSD$
-.\"
-.Dd October 9, 2021
-.Dt OPEN 2
-.Os
-.Sh NAME
-.Nm open , openat
-.Nd open or create a file for reading, writing or executing
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In fcntl.h
-.Ft int
-.Fn open "const char *path" "int flags" "..."
-.Ft int
-.Fn openat "int fd" "const char *path" "int flags" "..."
-.Sh DESCRIPTION
-The file name specified by
-.Fa path
-is opened
-for either execution or reading and/or writing as specified by the
-argument
-.Fa flags
-and the file descriptor returned to the calling process.
-The
-.Fa flags
-argument may indicate the file is to be
-created if it does not exist (by specifying the
-.Dv O_CREAT
-flag).
-In this case
-.Fn open
-and
-.Fn openat
-require an additional argument
-.Fa "mode_t mode" ,
-and the file is created with mode
-.Fa mode
-as described in
-.Xr chmod 2
-and modified by the process' umask value (see
-.Xr umask 2 ) .
-.Pp
-The
-.Fn openat
-function is equivalent to the
-.Fn open
-function except in the case where the
-.Fa path
-specifies a relative path.
-For
-.Fn openat
-and relative
-.Fa path ,
-the file to be opened is determined relative to the directory
-associated with the file descriptor
-.Fa fd
-instead of the current working directory.
-The
-.Fa flag
-parameter and the optional fourth parameter correspond exactly to
-the parameters of
-.Fn open .
-If
-.Fn openat
-is passed the special value
-.Dv AT_FDCWD
-in the
-.Fa fd
-parameter, the current working directory is used
-and the behavior is identical to a call to
-.Fn open .
-.Pp
-When
-.Fn openat
-is called with an absolute
-.Fa path ,
-it ignores the
-.Fa fd
-argument.
-.Pp
-In
-.Xr capsicum 4
-capability mode,
-.Fn open
-is not permitted.
-The
-.Fa path
-argument to
-.Fn openat
-must be strictly relative to a file descriptor
-.Fa fd .
-.Fa path
-must not be an absolute path and must not contain ".." components
-which cause the path resolution to escape the directory hierarchy
-starting at
-.Fa fd .
-Additionally, no symbolic link in
-.Fa path
-may target absolute path or contain escaping ".." components.
-.Fa fd
-must not be
-.Dv AT_FDCWD .
-.Pp
-If the
-.Dv vfs.lookup_cap_dotdot
-.Xr sysctl 3
-MIB is set to zero, ".." components in the paths,
-used in capability mode,
-are completely disabled.
-If the
-.Dv vfs.lookup_cap_dotdot_nonlocal
-MIB is set to zero, ".." is not allowed if found on non-local filesystem.
-.Pp
-The flags specified are formed by
-.Em or Ns 'ing
-the following values
-.Pp
-.Bd -literal -offset indent -compact
-O_RDONLY open for reading only
-O_WRONLY open for writing only
-O_RDWR open for reading and writing
-O_EXEC open for execute only
-O_SEARCH open for search only, an alias for O_EXEC
-O_NONBLOCK do not block on open
-O_APPEND append on each write
-O_CREAT create file if it does not exist
-O_TRUNC truncate size to 0
-O_EXCL error if create and file exists
-O_SHLOCK atomically obtain a shared lock
-O_EXLOCK atomically obtain an exclusive lock
-O_DIRECT eliminate or reduce cache effects
-O_FSYNC synchronous writes (historical synonym for O_SYNC)
-O_SYNC synchronous writes
-O_DSYNC synchronous data writes
-O_NOFOLLOW do not follow symlinks
-O_NOCTTY ignored
-O_TTY_INIT ignored
-O_DIRECTORY error if file is not a directory
-O_CLOEXEC set FD_CLOEXEC upon open
-O_VERIFY verify the contents of the file
-O_RESOLVE_BENEATH path resolution must not cross the fd directory
-O_PATH record only the target path in the opened descriptor
-O_EMPTY_PATH openat, open file referenced by fd if path is empty
-.Ed
-.Pp
-Opening a file with
-.Dv O_APPEND
-set causes each write on the file
-to be appended to the end.
-If
-.Dv O_TRUNC
-is specified and the
-file exists, the file is truncated to zero length.
-If
-.Dv O_EXCL
-is set with
-.Dv O_CREAT
-and the file already
-exists,
-.Fn open
-returns an error.
-This may be used to
-implement a simple exclusive access locking mechanism.
-If
-.Dv O_EXCL
-is set and the last component of the pathname is
-a symbolic link,
-.Fn open
-will fail even if the symbolic
-link points to a non-existent name.
-If the
-.Dv O_NONBLOCK
-flag is specified and the
-.Fn open
-system call would result
-in the process being blocked for some reason (e.g., waiting for
-carrier on a dialup line),
-.Fn open
-returns immediately.
-The descriptor remains in non-blocking mode for subsequent operations.
-.Pp
-If
-.Dv O_SYNC
-is used in the mask, all writes will
-immediately and synchronously be written to disk.
-.Dv O_FSYNC
-is an historical synonym for
-.Dv O_SYNC .
-.Pp
-If
-.Dv O_DSYNC
-is used in the mask, all data and metadata required to read the data will be
-synchronously written to disk, but changes to metadata such as file access and
-modification timestamps may be written later.
-.Pp
-If
-.Dv O_NOFOLLOW
-is used in the mask and the target file passed to
-.Fn open
-is a symbolic link then the
-.Fn open
-will fail.
-.Pp
-When opening a file, a lock with
-.Xr flock 2
-semantics can be obtained by setting
-.Dv O_SHLOCK
-for a shared lock, or
-.Dv O_EXLOCK
-for an exclusive lock.
-If creating a file with
-.Dv O_CREAT ,
-the request for the lock will never fail
-(provided that the underlying file system supports locking).
-.Pp
-.Dv O_DIRECT
-may be used to minimize or eliminate the cache effects of reading and writing.
-The system will attempt to avoid caching the data you read or write.
-If it cannot avoid caching the data,
-it will minimize the impact the data has on the cache.
-Use of this flag can drastically reduce performance if not used with care.
-.Pp
-.Dv O_NOCTTY
-may be used to ensure the OS does not assign this file as the
-controlling terminal when it opens a tty device.
-This is the default on
-.Fx ,
-but is present for
-.Tn POSIX
-compatibility.
-The
-.Fn open
-system call will not assign controlling terminals on
-.Fx .
-.Pp
-.Dv O_TTY_INIT
-may be used to ensure the OS restores the terminal attributes when
-initially opening a TTY.
-This is the default on
-.Fx ,
-but is present for
-.Tn POSIX
-compatibility.
-The initial call to
-.Fn open
-on a TTY will always restore default terminal attributes on
-.Fx .
-.Pp
-.Dv O_DIRECTORY
-may be used to ensure the resulting file descriptor refers to a
-directory.
-This flag can be used to prevent applications with elevated privileges
-from opening files which are even unsafe to open with
-.Dv O_RDONLY ,
-such as device nodes.
-.Pp
-.Dv O_CLOEXEC
-may be used to set
-.Dv FD_CLOEXEC
-flag for the newly returned file descriptor.
-.Pp
-.Dv O_VERIFY
-may be used to indicate to the kernel that the contents of the file should
-be verified before allowing the open to proceed.
-The details of what
-.Dq verified
-means is implementation specific.
-The run-time linker (rtld) uses this flag to ensure shared objects have
-been verified before operating on them.
-.Pp
-.Dv O_RESOLVE_BENEATH
-returns
-.Er ENOTCAPABLE
-if any intermediate component of the specified relative path does not
-reside in the directory hierarchy beneath the starting directory.
-Absolute paths or even the temporal escape from beneath of the starting
-directory is not allowed.
-.Pp
-When
-.Fa fd
-is opened with
-.Dv O_SEARCH ,
-execute permissions are checked at open time.
-The
-.Fa fd
-may not be used for any read operations like
-.Xr getdirentries 2 .
-The primary use for this descriptor will be as the lookup descriptor for the
-.Fn *at
-family of functions.
-.Pp
-.Dv O_PATH
-returns a file descriptor that can be used as a directory file descriptor for
-.Xr openat 2
-and other system calls taking a file descriptor argument, like
-.Xr fstatat 2
-and others.
-The other functionality of the returned file descriptor is limited to
-the descriptor-level operations.
-It can be used for
-.Bl -tag -width readlinkat(2) -offset indent -compact
-.It Xr fcntl 2
-but advisory locking is not allowed
-.It Xr dup 2
-.It Xr close 2
-.It Xr fstat 2
-.It Xr fexecve 2
-requires that
-.Dv O_EXEC
-was also specified at open time
-.It Dv SCM_RIGHTS
-can be passed over a
-.Xr unix 4
-socket using a
-.Dv SCM_RIGHTS
-message
-.It Xr kqueue 2
-using for
-.Dv EVFILT_VNODE
-.It Xr readlinkat 2
-.El
-But operations like
-.Xr read 2 ,
-.Xr ftruncate 2 ,
-and any other that operate on file and not on file descriptor (except
-.Xr fstat 2 ),
-are not allowed.
-File opened with the
-.Dv O_PATH
-flag does not prevent non-forced unmount of the volume it belongs to.
-.Pp
-A file descriptor created with the
-.Dv O_PATH
-flag can be opened into normal (operable) file descriptor by
-specifying it as the
-.Fa fd
-argument to
-.Fn openat
-with empty
-.Fa path
-and flag
-.Dv O_EMPTY_PATH .
-Such an open behaves as if the current path of the file referenced by
-.Fa fd
-is passed, except that the path walk permissions are not checked.
-See also the description of
-.Dv AT_EMPTY_PATH
-flag for
-.Xr fstatat 2
-and related syscalls.
-.Pp
-If successful,
-.Fn open
-returns a non-negative integer, termed a file descriptor.
-It returns \-1 on failure.
-The file pointer used to mark the current position within the
-file is set to the beginning of the file.
-.Pp
-If a sleeping open of a device node from
-.Xr devfs 5
-is interrupted by a signal, the call always fails with
-.Er EINTR ,
-even if the
-.Dv SA_RESTART
-flag is set for the signal.
-A sleeping open of a fifo (see
-.Xr mkfifo 2 )
-is restarted as normal.
-.Pp
-When a new file is created it is given the group of the directory
-which contains it.
-.Pp
-Unless
-.Dv O_CLOEXEC
-flag was specified,
-the new descriptor is set to remain open across
-.Xr execve 2
-system calls; see
-.Xr close 2 ,
-.Xr fcntl 2
-and
-.Dv O_CLOEXEC
-description.
-.Pp
-The system imposes a limit on the number of file descriptors
-open simultaneously by one process.
-The
-.Xr getdtablesize 2
-system call returns the current system limit.
-.Sh RETURN VALUES
-If successful,
-.Fn open
-and
-.Fn openat
-return a non-negative integer, termed a file descriptor.
-They return \-1 on failure, and set
-.Va errno
-to indicate the error.
-.Sh ERRORS
-The named file is opened unless:
-.Bl -tag -width Er
-.It Bq Er ENOTDIR
-A component of the path prefix is not a directory.
-.It Bq Er ENAMETOOLONG
-A component of a pathname exceeded 255 characters,
-or an entire path name exceeded 1023 characters.
-.It Bq Er ENOENT
-.Dv O_CREAT
-is not set and the named file does not exist.
-.It Bq Er ENOENT
-A component of the path name that must exist does not exist.
-.It Bq Er EACCES
-Search permission is denied for a component of the path prefix.
-.It Bq Er EACCES
-The required permissions (for reading and/or writing)
-are denied for the given flags.
-.It Bq Er EACCES
-.Dv O_TRUNC
-is specified and write permission is denied.
-.It Bq Er EACCES
-.Dv O_CREAT
-is specified,
-the file does not exist,
-and the directory in which it is to be created
-does not permit writing.
-.It Bq Er EPERM
-.Dv O_CREAT
-is specified, the file does not exist, and the directory in which it is to be
-created has its immutable flag set, see the
-.Xr chflags 2
-manual page for more information.
-.It Bq Er EPERM
-The named file has its immutable flag set and the file is to be modified.
-.It Bq Er EPERM
-The named file has its append-only flag set, the file is to be modified, and
-.Dv O_TRUNC
-is specified or
-.Dv O_APPEND
-is not specified.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating the pathname.
-.It Bq Er EISDIR
-The named file is a directory, and the arguments specify
-it is to be modified.
-.It Bq Er EISDIR
-The named file is a directory, and the flags specified
-.Dv O_CREAT
-without
-.Dv O_DIRECTORY .
-.It Bq Er EROFS
-The named file resides on a read-only file system,
-and the file is to be modified.
-.It Bq Er EROFS
-.Dv O_CREAT
-is specified and the named file would reside on a read-only file system.
-.It Bq Er EMFILE
-The process has already reached its limit for open file descriptors.
-.It Bq Er ENFILE
-The system file table is full.
-.It Bq Er EMLINK
-.Dv O_NOFOLLOW
-was specified and the target is a symbolic link.
-.It Bq Er ENXIO
-The named file is a character special or block
-special file, and the device associated with this special file
-does not exist.
-.It Bq Er ENXIO
-.Dv O_NONBLOCK
-is set, the named file is a fifo,
-.Dv O_WRONLY
-is set, and no process has the file open for reading.
-.It Bq Er EINTR
-The
-.Fn open
-operation was interrupted by a signal.
-.It Bq Er EOPNOTSUPP
-.Dv O_SHLOCK
-or
-.Dv O_EXLOCK
-is specified but the underlying file system does not support locking.
-.It Bq Er EOPNOTSUPP
-The named file is a special file mounted through a file system that
-does not support access to it (e.g.\& NFS).
-.It Bq Er EWOULDBLOCK
-.Dv O_NONBLOCK
-and one of
-.Dv O_SHLOCK
-or
-.Dv O_EXLOCK
-is specified and the file is locked.
-.It Bq Er ENOSPC
-.Dv O_CREAT
-is specified,
-the file does not exist,
-and the directory in which the entry for the new file is being placed
-cannot be extended because there is no space left on the file
-system containing the directory.
-.It Bq Er ENOSPC
-.Dv O_CREAT
-is specified,
-the file does not exist,
-and there are no free inodes on the file system on which the
-file is being created.
-.It Bq Er EDQUOT
-.Dv O_CREAT
-is specified,
-the file does not exist,
-and the directory in which the entry for the new file
-is being placed cannot be extended because the
-user's quota of disk blocks on the file system
-containing the directory has been exhausted.
-.It Bq Er EDQUOT
-.Dv O_CREAT
-is specified,
-the file does not exist,
-and the user's quota of inodes on the file system on
-which the file is being created has been exhausted.
-.It Bq Er EIO
-An I/O error occurred while making the directory entry or
-allocating the inode for
-.Dv O_CREAT .
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.It Bq Er ETXTBSY
-The file is a pure procedure (shared text) file that is being
-executed and the
-.Fn open
-system call requests write access.
-.It Bq Er EFAULT
-The
-.Fa path
-argument
-points outside the process's allocated address space.
-.It Bq Er EEXIST
-.Dv O_CREAT
-and
-.Dv O_EXCL
-were specified and the file exists.
-.It Bq Er EOPNOTSUPP
-An attempt was made to open a socket (not currently implemented).
-.It Bq Er EINVAL
-An attempt was made to open a descriptor with an illegal combination
-of
-.Dv O_RDONLY ,
-.Dv O_WRONLY ,
-or
-.Dv O_RDWR ,
-and
-.Dv O_EXEC
-or
-.Dv O_SEARCH .
-.It Bq Er EINVAL
-The
-.Dv O_RESOLVE_BENEATH
-flag is specified and
-.Dv path
-is absolute.
-.It Bq Er EBADF
-The
-.Fa path
-argument does not specify an absolute path and the
-.Fa fd
-argument is
-neither
-.Dv AT_FDCWD
-nor a valid file descriptor open for searching.
-.It Bq Er ENOTDIR
-The
-.Fa path
-argument is not an absolute path and
-.Fa fd
-is neither
-.Dv AT_FDCWD
-nor a file descriptor associated with a directory.
-.It Bq Er ENOTDIR
-.Dv O_DIRECTORY
-is specified and the file is not a directory.
-.It Bq Er ECAPMODE
-.Dv AT_FDCWD
-is specified and the process is in capability mode.
-.It Bq Er ECAPMODE
-.Fn open
-was called and the process is in capability mode.
-.It Bq Er ENOTCAPABLE
-.Fa path
-is an absolute path,
-or contained a ".." component leading to a
-directory outside of the directory hierarchy specified by
-.Fa fd ,
-and the process is in capability mode.
-.It Bq Er ENOTCAPABLE
-The
-.Dv O_RESOLVE_BENEATH
-flag was provided, and the relative
-.Fa path
-escapes the
-.Ar fd
-directory.
-.El
-.Sh SEE ALSO
-.Xr chmod 2 ,
-.Xr close 2 ,
-.Xr dup 2 ,
-.Xr fexecve 2 ,
-.Xr fhopen 2 ,
-.Xr getdtablesize 2 ,
-.Xr getfh 2 ,
-.Xr lgetfh 2 ,
-.Xr lseek 2 ,
-.Xr read 2 ,
-.Xr umask 2 ,
-.Xr write 2 ,
-.Xr fopen 3 ,
-.Xr capsicum 4
-.Sh STANDARDS
-These functions are specified by
-.St -p1003.1-2008 .
-.Fx
-sets
-.Va errno
-to
-.Er EMLINK instead of
-.Er ELOOP
-as specified by
-.Tn POSIX
-when
-.Dv O_NOFOLLOW
-is set in flags and the final component of pathname is a symbolic link
-to distinguish it from the case of too many symbolic link traversals
-in one of its non-final components.
-.Sh HISTORY
-The
-.Fn open
-function appeared in
-.At v1 .
-The
-.Fn openat
-function was introduced in
-.Fx 8.0 .
-.Dv O_DSYNC
-appeared in 13.0.
-.Sh BUGS
-The Open Group Extended API Set 2 specification requires that the test
-for whether
-.Fa fd
-is searchable is based on whether
-.Fa fd
-is open for searching, not whether the underlying directory currently
-permits searches.
-The present implementation of the
-.Fa openat
-checks the current permissions of directory instead.
-.Pp
-The
-.Fa mode
-argument is variadic and may result in different calling conventions
-than might otherwise be expected.
diff --git a/lib/libc/sys/open.c b/lib/libc/sys/open.c
index e0273c68a34c..57c07637d2aa 100644
--- a/lib/libc/sys/open.c
+++ b/lib/libc/sys/open.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2014 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/fcntl.h>
#include <stdarg.h>
@@ -54,6 +50,5 @@ open(const char *path, int flags, ...)
} else {
mode = 0;
}
- return (((int (*)(int, const char *, int, ...))
- __libc_interposing[INTERPOS_openat])(AT_FDCWD, path, flags, mode));
+ return (INTERPOS_SYS(openat, AT_FDCWD, path, flags, mode));
}
diff --git a/lib/libc/sys/openat.c b/lib/libc/sys/openat.c
index 1bd12ea2a8d8..1cd8e7d90745 100644
--- a/lib/libc/sys/openat.c
+++ b/lib/libc/sys/openat.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2014 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/fcntl.h>
#include <stdarg.h>
@@ -57,6 +53,5 @@ openat(int fd, const char *path, int flags, ...)
} else {
mode = 0;
}
- return (((int (*)(int, const char *, int, ...))
- __libc_interposing[INTERPOS_openat])(fd, path, flags, mode));
+ return (INTERPOS_SYS(openat, fd, path, flags, mode));
}
diff --git a/lib/libc/sys/pathconf.2 b/lib/libc/sys/pathconf.2
deleted file mode 100644
index 5586e460185b..000000000000
--- a/lib/libc/sys/pathconf.2
+++ /dev/null
@@ -1,269 +0,0 @@
-.\" Copyright (c) 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)pathconf.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd August 6, 2021
-.Dt PATHCONF 2
-.Os
-.Sh NAME
-.Nm pathconf ,
-.Nm lpathconf ,
-.Nm fpathconf
-.Nd get configurable pathname variables
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft long
-.Fn pathconf "const char *path" "int name"
-.Ft long
-.Fn lpathconf "const char *path" "int name"
-.Ft long
-.Fn fpathconf "int fd" "int name"
-.Sh DESCRIPTION
-The
-.Fn pathconf ,
-.Fn lpathconf
-and
-.Fn fpathconf
-system calls provide a method for applications to determine the current
-value of a configurable system limit or option variable associated
-with a pathname or file descriptor.
-.Pp
-For
-.Fn pathconf
-and
-.Fn lpathconf ,
-the
-.Fa path
-argument is the name of a file or directory.
-For
-.Fn fpathconf ,
-the
-.Fa fd
-argument is an open file descriptor.
-The
-.Fa name
-argument specifies the system variable to be queried.
-Symbolic constants for each name value are found in the include file
-.Li <unistd.h> .
-.Pp
-The
-.Fn lpathconf
-system call is like
-.Fn pathconf
-except in the case where the named file is a symbolic link,
-in which case
-.Fn lpathconf
-returns information about the link,
-while
-.Fn pathconf
-returns information about the file the link references.
-.Pp
-The available values are as follows:
-.Bl -tag -width 6n
-.It Li _PC_LINK_MAX
-The maximum file link count.
-.It Li _PC_MAX_CANON
-The maximum number of bytes in terminal canonical input line.
-.It Li _PC_MAX_INPUT
-The minimum maximum number of bytes for which space is available in
-a terminal input queue.
-.It Li _PC_NAME_MAX
-The maximum number of bytes in a file name.
-.It Li _PC_PATH_MAX
-The maximum number of bytes in a pathname.
-.It Li _PC_PIPE_BUF
-The maximum number of bytes which will be written atomically to a pipe.
-.It Li _PC_CHOWN_RESTRICTED
-Return 1 if appropriate privilege is required for the
-.Xr chown 2
-system call, otherwise 0.
-.St -p1003.1-2001
-requires appropriate privilege in all cases, but this behavior was optional
-in prior editions of the standard.
-.It Li _PC_NO_TRUNC
-Return greater than zero if attempts to use pathname components longer than
-.Brq Dv NAME_MAX
-will result in an
-.Bq Er ENAMETOOLONG
-error; otherwise, such components will be truncated to
-.Brq Dv NAME_MAX .
-.St -p1003.1-2001
-requires the error in all cases, but this behavior was optional in prior
-editions of the standard, and some
-.No non- Ns Tn POSIX Ns -compliant
-file systems do not support this behavior.
-.It Li _PC_VDISABLE
-Returns the terminal character disabling value.
-.It Li _PC_ASYNC_IO
-Return 1 if asynchronous I/O is supported, otherwise 0.
-.It Li _PC_PRIO_IO
-Returns 1 if prioritised I/O is supported for this file,
-otherwise 0.
-.It Li _PC_SYNC_IO
-Returns 1 if synchronised I/O is supported for this file, otherwise 0.
-.It Li _PC_ALLOC_SIZE_MIN
-Minimum number of bytes of storage allocated for any portion of a file.
-.It Li _PC_FILESIZEBITS
-Number of bits needed to represent the maximum file size.
-.It Li _PC_REC_INCR_XFER_SIZE
-Recommended increment for file transfer sizes between
-.Dv _PC_REC_MIN_XFER_SIZE
-and
-.Dv _PC_REC_MAX_XFER_SIZE .
-.It Li _PC_REC_MAX_XFER_SIZE
-Maximum recommended file transfer size.
-.It Li _PC_REC_MIN_XFER_SIZE
-Minimum recommended file transfer size.
-.It Li _PC_REC_XFER_ALIGN
-Recommended file transfer buffer alignment.
-.It Li _PC_SYMLINK_MAX
-Maximum number of bytes in a symbolic link.
-.It Li _PC_ACL_EXTENDED
-Returns 1 if an Access Control List (ACL) can be set on the specified
-file, otherwise 0.
-.It Li _PC_ACL_NFS4
-Returns 1 if an NFSv4 ACLs can be set on the specified
-file, otherwise 0.
-.It Li _PC_ACL_PATH_MAX
-Maximum number of ACL entries per file.
-.It Li _PC_CAP_PRESENT
-Returns 1 if a capability state can be set on the specified file,
-otherwise 0.
-.It Li _PC_INF_PRESENT
-Returns 1 if an information label can be set on the specified file,
-otherwise 0.
-.It Li _PC_MAC_PRESENT
-Returns 1 if a Mandatory Access Control (MAC) label can be set on the
-specified file, otherwise 0.
-.It Li _PC_MIN_HOLE_SIZE
-If a file system supports the reporting of holes (see
-.Xr lseek 2 ) ,
-.Fn pathconf
-and
-.Fn fpathconf
-return a positive number that represents the minimum hole size returned in
-bytes.
-The offsets of holes returned will be aligned to this same value.
-A special value of 1 is returned if the file system does not specify the minimum
-hole size but still reports holes.
-.It Li _PC_DEALLOC_PRESENT
-Return 1 if a file system supports hole-punching (see
-.Xr fspacectl 2 ) ,
-otherwise 0.
-.El
-.Sh RETURN VALUES
-If the call to
-.Fn pathconf
-or
-.Fn fpathconf
-is not successful, \-1 is returned and
-.Va errno
-is set appropriately.
-Otherwise, if the variable is associated with functionality that does
-not have a limit in the system, \-1 is returned and
-.Va errno
-is not modified.
-Otherwise, the current variable value is returned.
-.Sh ERRORS
-If any of the following conditions occur, the
-.Fn pathconf
-and
-.Fn fpathconf
-system calls shall return -1 and set
-.Va errno
-to the corresponding value.
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The value of the
-.Fa name
-argument is invalid.
-.It Bq Er EINVAL
-The implementation does not support an association of the variable
-name with the associated file.
-.El
-.Pp
-The
-.Fn pathconf
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er ENOTDIR
-A component of the path prefix is not a directory.
-.It Bq Er ENAMETOOLONG
-A component of a pathname exceeded
-.Brq Dv NAME_MAX
-characters (but see
-.Dv _PC_NO_TRUNC
-above),
-or an entire path name exceeded
-.Brq Dv PATH_MAX
-characters.
-.It Bq Er ENOENT
-The named file does not exist.
-.It Bq Er EACCES
-Search permission is denied for a component of the path prefix.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating the pathname.
-.It Bq Er EIO
-An I/O error occurred while reading from or writing to the file system.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.El
-.Pp
-The
-.Fn fpathconf
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa fd
-argument
-is not a valid open file descriptor.
-.It Bq Er EIO
-An I/O error occurred while reading from or writing to the file system.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.El
-.Sh SEE ALSO
-.Xr lseek 2 ,
-.Xr sysctl 3
-.Sh HISTORY
-The
-.Fn pathconf
-and
-.Fn fpathconf
-system calls first appeared in
-.Bx 4.4 .
-The
-.Fn lpathconf
-system call first appeared in
-.Fx 8.0 .
diff --git a/lib/libc/sys/pdfork.2 b/lib/libc/sys/pdfork.2
deleted file mode 100644
index b96e876a84e3..000000000000
--- a/lib/libc/sys/pdfork.2
+++ /dev/null
@@ -1,188 +0,0 @@
-.\"
-.\" Copyright (c) 2009-2010, 2012-2013 Robert N. M. Watson
-.\" All rights reserved.
-.\"
-.\" This software was developed at the University of Cambridge Computer
-.\" Laboratory with support from a grant from Google, Inc.
-.\"
-.\" This software was developed by SRI International and the University of
-.\" Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
-.\" ("CTSRD"), as part of the DARPA CRASH research programme.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd October 14, 2018
-.Dt PDFORK 2
-.Os
-.Sh NAME
-.Nm pdfork ,
-.Nm pdgetpid ,
-.Nm pdkill
-.Nd System calls to manage process descriptors
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/procdesc.h
-.Ft pid_t
-.Fn pdfork "int *fdp" "int flags"
-.Ft int
-.Fn pdgetpid "int fd" "pid_t *pidp"
-.Ft int
-.Fn pdkill "int fd" "int signum"
-.Sh DESCRIPTION
-Process descriptors are special file descriptors that represent processes,
-and are created using
-.Fn pdfork ,
-a variant of
-.Xr fork 2 ,
-which, if successful, returns a process descriptor in the integer pointed to
-by
-.Fa fdp .
-Processes created via
-.Fn pdfork
-will not cause
-.Dv SIGCHLD
-on termination.
-.Fn pdfork
-can accept the flags:
-.Bl -tag -width ".Dv PD_DAEMON"
-.It Dv PD_DAEMON
-Instead of the default terminate-on-close behaviour, allow the process to
-live until it is explicitly killed with
-.Xr kill 2 .
-.Pp
-This option is not permitted in
-.Xr capsicum 4
-capability mode (see
-.Xr cap_enter 2 ) .
-.El
-.Bl -tag -width ".Dv PD_DAEMON"
-.It Dv PD_CLOEXEC
-Set close-on-exec on process descriptor.
-.El
-.Pp
-.Fn pdgetpid
-queries the process ID (PID) in the process descriptor
-.Fa fd .
-.Pp
-.Fn pdkill
-is functionally identical to
-.Xr kill 2 ,
-except that it accepts a process descriptor,
-.Fa fd ,
-rather than a PID.
-.Pp
-The following system calls also have effects specific to process descriptors:
-.Pp
-.Xr fstat 2
-queries status of a process descriptor; currently only the
-.Fa st_mode ,
-.Fa st_birthtime ,
-.Fa st_atime ,
-.Fa st_ctime
-and
-.Fa st_mtime
-fields are defined.
-If the owner read, write, and execute bits are set then the
-process represented by the process descriptor is still alive.
-.Pp
-.Xr poll 2
-and
-.Xr select 2
-allow waiting for process state transitions; currently only
-.Dv POLLHUP
-is defined, and will be raised when the process dies.
-Process state transitions can also be monitored using
-.Xr kqueue 2
-filter
-.Dv EVFILT_PROCDESC ;
-currently only
-.Dv NOTE_EXIT
-is implemented.
-.Pp
-.Xr close 2
-will close the process descriptor unless
-.Dv PD_DAEMON
-is set; if the process is still alive and this is
-the last reference to the process descriptor, the process will be terminated
-with the signal
-.Dv SIGKILL .
-.Sh RETURN VALUES
-.Fn pdfork
-returns a PID, 0 or -1, as
-.Xr fork 2
-does.
-.Pp
-.Fn pdgetpid
-and
-.Fn pdkill
-return 0 on success and -1 on failure.
-.Sh ERRORS
-These functions may return the same error numbers as their PID-based equivalents
-(e.g.
-.Fn pdfork
-may return the same error numbers as
-.Xr fork 2 ) ,
-with the following additions:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The signal number given to
-.Fn pdkill
-is invalid.
-.It Bq Er ENOTCAPABLE
-The process descriptor being operated on has insufficient rights (e.g.
-.Dv CAP_PDKILL
-for
-.Fn pdkill ) .
-.El
-.Sh SEE ALSO
-.Xr close 2 ,
-.Xr fork 2 ,
-.Xr fstat 2 ,
-.Xr kill 2 ,
-.Xr kqueue 2 ,
-.Xr poll 2 ,
-.Xr wait4 2 ,
-.Xr capsicum 4 ,
-.Xr procdesc 4
-.Sh HISTORY
-The
-.Fn pdfork ,
-.Fn pdgetpid ,
-and
-.Fn pdkill
-system calls first appeared in
-.Fx 9.0 .
-.Pp
-Support for process descriptors mode was developed as part of the
-.Tn TrustedBSD
-Project.
-.Sh AUTHORS
-.An -nosplit
-These functions and the capability facility were created by
-.An Robert N. M. Watson Aq Mt rwatson@FreeBSD.org
-and
-.An Jonathan Anderson Aq Mt jonathan@FreeBSD.org
-at the University of Cambridge Computer Laboratory with support from a grant
-from Google, Inc.
diff --git a/lib/libc/sys/pdfork.c b/lib/libc/sys/pdfork.c
index 003262d1237d..f25f081ec174 100644
--- a/lib/libc/sys/pdfork.c
+++ b/lib/libc/sys/pdfork.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2021 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,17 +29,13 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
-#include <unistd.h>
+#include <sys/procdesc.h>
#include "libc_private.h"
#pragma weak pdfork
pid_t
pdfork(int *fdp, int flags)
{
- return (((pid_t (*)(int *, int))__libc_interposing[
- INTERPOS_pdfork])(fdp, flags));
+ return (INTERPOS_SYS(pdfork, fdp, flags));
}
diff --git a/lib/libc/sys/pipe.2 b/lib/libc/sys/pipe.2
deleted file mode 100644
index 0bfb8cf4ffb9..000000000000
--- a/lib/libc/sys/pipe.2
+++ /dev/null
@@ -1,178 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)pipe.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd December 1, 2017
-.Dt PIPE 2
-.Os
-.Sh NAME
-.Nm pipe ,
-.Nm pipe2
-.Nd create descriptor pair for interprocess communication
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn pipe "int fildes[2]"
-.Ft int
-.Fn pipe2 "int fildes[2]" "int flags"
-.Sh DESCRIPTION
-The
-.Fn pipe
-function
-creates a
-.Em pipe ,
-which is an object allowing
-bidirectional data flow,
-and allocates a pair of file descriptors.
-.Pp
-The
-.Fn pipe2
-system call allows control over the attributes of the file descriptors
-via the
-.Fa flags
-argument.
-Values for
-.Fa flags
-are constructed by a bitwise-inclusive OR of flags from the following
-list, defined in
-.In fcntl.h :
-.Bl -tag -width ".Dv O_NONBLOCK"
-.It Dv O_CLOEXEC
-Set the close-on-exec flag for the new file descriptors.
-.It Dv O_NONBLOCK
-Set the non-blocking flag for the ends of the pipe.
-.El
-.Pp
-If the
-.Fa flags
-argument is 0, the behavior is identical to a call to
-.Fn pipe .
-.Pp
-By convention, the first descriptor is normally used as the
-.Em read end
-of the pipe,
-and the second is normally the
-.Em write end ,
-so that data written to
-.Fa fildes[1]
-appears on (i.e., can be read from)
-.Fa fildes[0] .
-This allows the output of one program to be
-sent
-to another program:
-the source's standard output is set up to be
-the write end of the pipe,
-and the sink's standard input is set up to be
-the read end of the pipe.
-The pipe itself persists until all its associated descriptors are
-closed.
-.Pp
-A pipe that has had an end closed is considered
-.Em widowed .
-Writing on such a pipe causes the writing process to receive
-a
-.Dv SIGPIPE
-signal.
-Widowing a pipe is the only way to deliver end-of-file to a reader:
-after the reader consumes any buffered data, reading a widowed pipe
-returns a zero count.
-.Pp
-The bidirectional nature of this implementation of pipes is not
-portable to older systems, so it is recommended to use the convention
-for using the endpoints in the traditional manner when using a
-pipe in one direction.
-.Sh IMPLEMENTATION NOTES
-The
-.Fn pipe
-function calls the
-.Fn pipe2
-system call.
-As a result, system call traces such as those captured by
-.Xr dtrace 1
-or
-.Xr ktrace 1
-will show calls to
-.Fn pipe2 .
-.Sh RETURN VALUES
-.Rv -std pipe
-.Sh ERRORS
-The
-.Fn pipe
-and
-.Fn pipe2
-system calls will fail if:
-.Bl -tag -width Er
-.It Bq Er EFAULT
-.Ar fildes
-argument points to an invalid memory location.
-.It Bq Er EMFILE
-Too many descriptors are active.
-.It Bq Er ENFILE
-The system file table is full.
-.It Bq Er ENOMEM
-Not enough kernel memory to establish a pipe.
-.El
-.Pp
-The
-.Fn pipe2
-system call will also fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Fa flags
-argument is invalid.
-.El
-.Sh SEE ALSO
-.Xr sh 1 ,
-.Xr fork 2 ,
-.Xr read 2 ,
-.Xr socketpair 2 ,
-.Xr write 2
-.Sh HISTORY
-The
-.Fn pipe
-function appeared in
-.At v3 .
-.Pp
-Bidirectional pipes were first used on
-.At V.4 .
-.Pp
-The
-.Fn pipe2
-function appeared in
-.Fx 10.0 .
-.Pp
-The
-.Fn pipe
-function became a wrapper around
-.Fn pipe2
-in
-.Fx 11.0 .
diff --git a/lib/libc/sys/pipe.c b/lib/libc/sys/pipe.c
index f5ade0eb914b..370895166ad0 100644
--- a/lib/libc/sys/pipe.c
+++ b/lib/libc/sys/pipe.c
@@ -26,11 +26,8 @@
* 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/cdefs.h>
#include <unistd.h>
diff --git a/lib/libc/sys/poll.2 b/lib/libc/sys/poll.2
deleted file mode 100644
index fec82db08944..000000000000
--- a/lib/libc/sys/poll.2
+++ /dev/null
@@ -1,294 +0,0 @@
-.\" $NetBSD: poll.2,v 1.3 1996/09/07 21:53:08 mycroft Exp $
-.\" $FreeBSD$
-.\"
-.\" Copyright (c) 1996 Charles M. Hannum. All rights reserved.
-.\"
-.\" 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.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by Charles M. Hannum.
-.\" 4. The name of the author may not be used to endorse or promote products
-.\" derived from this software without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
-.\"
-.Dd April 27, 2021
-.Dt POLL 2
-.Os
-.Sh NAME
-.Nm poll
-.Nd synchronous I/O multiplexing
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In poll.h
-.Ft int
-.Fn poll "struct pollfd fds[]" "nfds_t nfds" "int timeout"
-.Ft int
-.Fo ppoll
-.Fa "struct pollfd fds[]"
-.Fa "nfds_t nfds"
-.Fa "const struct timespec * restrict timeout"
-.Fa "const sigset_t * restrict newsigmask"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn poll
-system call
-examines a set of file descriptors to see if some of them are ready for
-I/O.
-The
-.Fa fds
-argument is a pointer to an array of pollfd structures as defined in
-.In poll.h
-(shown below).
-The
-.Fa nfds
-argument determines the size of the
-.Fa fds
-array.
-.Bd -literal
-struct pollfd {
- int fd; /* file descriptor */
- short events; /* events to look for */
- short revents; /* events returned */
-};
-.Ed
-.Pp
-The fields of
-.Fa struct pollfd
-are as follows:
-.Bl -tag -width XXXrevents
-.It fd
-File descriptor to poll.
-If fd is equal to -1 then
-.Fa revents
-is cleared (set to zero), and that pollfd is not checked.
-.It events
-Events to poll for.
-(See below.)
-.It revents
-Events which may occur.
-(See below.)
-.El
-.Pp
-The event bitmasks in
-.Fa events
-and
-.Fa revents
-have the following bits:
-.Bl -tag -width XXXPOLLWRNORM
-.It POLLIN
-Data other than high priority data may be read without blocking.
-.It POLLRDNORM
-Normal data may be read without blocking.
-.It POLLRDBAND
-Data with a non-zero priority may be read without blocking.
-.It POLLPRI
-High priority data may be read without blocking.
-.It POLLOUT
-.It POLLWRNORM
-Normal data may be written without blocking.
-.It POLLWRBAND
-Data with a non-zero priority may be written without blocking.
-.It POLLERR
-An exceptional condition has occurred on the device or socket.
-This
-flag is always checked, even if not present in the
-.Fa events
-bitmask.
-.It POLLHUP
-The device or socket has been disconnected.
-This flag is always
-checked, even if not present in the
-.Fa events
-bitmask.
-Note that
-POLLHUP
-and
-POLLOUT
-should never be present in the
-.Fa revents
-bitmask at the same time.
-.It POLLRDHUP
-Remote peer closed connection, or shut down writing.
-Unlike
-POLLHUP,
-POLLRDHUP
-must be present in the
-.Fa events
-bitmask to be reported.
-Applies only to stream sockets.
-.It POLLNVAL
-The file descriptor is not open,
-or in capability mode the file descriptor has insufficient rights.
-This flag is always checked, even
-if not present in the
-.Fa events
-bitmask.
-.El
-.Pp
-If
-.Fa timeout
-is neither zero nor INFTIM (-1), it specifies a maximum interval to
-wait for any file descriptor to become ready, in milliseconds.
-If
-.Fa timeout
-is INFTIM (-1), the poll blocks indefinitely.
-If
-.Fa timeout
-is zero, then
-.Fn poll
-will return without blocking.
-.Pp
-The
-.Fn ppoll
-system call, unlike
-.Fn poll ,
-is used to safely wait until either a set of file descriptors becomes
-ready or until a signal is caught.
-The
-.Fa fds
-and
-.Fa nfds
-arguments are identical to the analogous arguments of
-.Fn poll .
-The
-.Fa timeout
-argument in
-.Fn ppoll
-points to a
-.Vt "const struct timespec"
-which is defined in
-.In sys/timespec.h
-(shown below) rather than the
-.Vt "int timeout"
-used by
-.Fn poll .
-A null pointer may be passed to indicate that
-.Fn ppoll
-should wait indefinitely.
-Finally,
-.Fa newsigmask
-specifies a signal mask which is set while waiting for input.
-When
-.Fn ppoll
-returns, the original signal mask is restored.
-.Bd -literal
-struct timespec {
- time_t tv_sec; /* seconds */
- long tv_nsec; /* and nanoseconds */
-};
-.Ed
-.Sh RETURN VALUES
-The
-.Fn poll
-system call
-returns the number of descriptors that are ready for I/O, or -1 if an
-error occurred.
-If the time limit expires,
-.Fn poll
-returns 0.
-If
-.Fn poll
-returns with an error,
-including one due to an interrupted system call,
-the
-.Fa fds
-array will be unmodified.
-.Sh COMPATIBILITY
-This implementation differs from the historical one in that a given
-file descriptor may not cause
-.Fn poll
-to return with an error.
-In cases where this would have happened in
-the historical implementation (e.g.\& trying to poll a
-.Xr revoke 2 Ns ed
-descriptor), this implementation instead copies the
-.Fa events
-bitmask to the
-.Fa revents
-bitmask.
-Attempting to perform I/O on this descriptor will then
-return an error.
-This behaviour is believed to be more useful.
-.Sh ERRORS
-An error return from
-.Fn poll
-indicates:
-.Bl -tag -width Er
-.It Bq Er EFAULT
-The
-.Fa fds
-argument
-points outside the process's allocated address space.
-.It Bq Er EINTR
-A signal was delivered before the time limit expired and
-before any of the selected events occurred.
-.It Bq Er EINVAL
-The specified time limit is invalid.
-One of its components is negative or too large.
-.It Bq Er EINVAL
-The number of pollfd structures specified by
-.Fa nfds
-exceeds the system tunable
-.Va kern.maxfilesperproc
-and
-.Dv FD_SETSIZE .
-.El
-.Sh SEE ALSO
-.Xr accept 2 ,
-.Xr connect 2 ,
-.Xr kqueue 2 ,
-.Xr pselect 2 ,
-.Xr read 2 ,
-.Xr recv 2 ,
-.Xr select 2 ,
-.Xr send 2 ,
-.Xr write 2
-.Sh STANDARDS
-The
-.Fn poll
-function conforms to
-.St -p1003.1-2001 .
-The
-.Fn ppoll
-is not specified by POSIX.
-The
-POLLRDHUP
-flag is not specified by POSIX, but is compatible with Linux and illumos.
-.Sh HISTORY
-The
-.Fn poll
-function appeared in
-.At V .
-This manual page and the core of the implementation was taken from
-.Nx .
-The
-.Fn ppoll
-function first appeared in
-.Fx 11.0
-.Sh BUGS
-The distinction between some of the fields in the
-.Fa events
-and
-.Fa revents
-bitmasks is really not useful without STREAMS.
-The fields are
-defined for compatibility with existing software.
diff --git a/lib/libc/sys/poll.c b/lib/libc/sys/poll.c
index 43c17d2f65ce..6528603e7603 100644
--- a/lib/libc/sys/poll.c
+++ b/lib/libc/sys/poll.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2014 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/poll.h>
#include "libc_private.h"
@@ -43,7 +39,5 @@ __weak_reference(__sys_poll, __poll);
int
poll(struct pollfd pfd[], nfds_t nfds, int timeout)
{
-
- return (((int (*)(struct pollfd *, nfds_t, int))
- __libc_interposing[INTERPOS_poll])(pfd, nfds, timeout));
+ return (INTERPOS_SYS(poll, pfd, nfds, timeout));
}
diff --git a/lib/libc/sys/posix_fadvise.2 b/lib/libc/sys/posix_fadvise.2
deleted file mode 100644
index 0e4d25ac4c55..000000000000
--- a/lib/libc/sys/posix_fadvise.2
+++ /dev/null
@@ -1,143 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)madvise.2 8.1 (Berkeley) 6/9/93
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2020
-.Dt POSIX_FADVISE 2
-.Os
-.Sh NAME
-.Nm posix_fadvise
-.Nd give advice about use of file data
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In fcntl.h
-.Ft int
-.Fn posix_fadvise "int fd" "off_t offset" "off_t len" "int advice"
-.Sh DESCRIPTION
-The
-.Fn posix_fadvise
-system call
-allows a process to describe to the system its data access behavior for an
-open file descriptor
-.Fa fd .
-The advice covers the data starting at offset
-.Fa offset
-and continuing for
-.Fa len
-bytes.
-If
-.Fa len
-is zero,
-all data from
-.Fa offset
-to the end of the file is covered.
-.Pp
-The behavior is specified by the
-.Fa advice
-parameter and may be one of:
-.Bl -tag -width POSIX_FADV_SEQUENTIAL
-.It Dv POSIX_FADV_NORMAL
-Tells the system to revert to the default data access behavior.
-.It Dv POSIX_FADV_RANDOM
-Is a hint that file data will be accessed randomly,
-and prefetching is likely not advantageous.
-.It Dv POSIX_FADV_SEQUENTIAL
-Tells the system that file data will be accessed sequentially.
-This currently does nothing as the default behavior uses heuristics to
-detect sequential behavior.
-.It Dv POSIX_FADV_WILLNEED
-Tells the system that the specified data will be accessed in the near future.
-The system may initiate an asynchronous read of the data if it is not already
-present in memory.
-.It Dv POSIX_FADV_DONTNEED
-Tells the system that the specified data will not be accessed in the near
-future.
-The system may decrease the in-memory priority of clean data within the
-specified range and future access to this data may require a read operation.
-.It Dv POSIX_FADV_NOREUSE
-Tells the system that the specified data will only be accessed once and
-then not reused.
-The system may decrease the in-memory priority of data once it has been
-read or written.
-Future access to this data may require a read operation.
-.El
-.Sh RETURN VALUES
-If successful,
-.Fn posix_fadvise
-returns zero.
-It returns an error on failure, without setting
-.Va errno .
-.Sh ERRORS
-Possible failure conditions:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa fd
-argument is not a valid file descriptor.
-.It Bq Er EINVAL
-The
-.Fa advice
-argument is not valid.
-.It Bq Er EINVAL
-The
-.Fa offset
-or
-.Fa len
-arguments are negative,
-or
-.Fa offset
-+
-.Fa len
-is greater than the maximum file size.
-.It Bq Er ENODEV
-The
-.Fa fd
-argument does not refer to a regular file.
-.It Bq Er ESPIPE
-The
-.Fa fd
-argument is associated with a pipe or FIFO.
-.It Bq Er EIO
-An I/O error occurred while reading from or writing to a file system.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.El
-.Sh SEE ALSO
-.Xr madvise 2
-.Sh STANDARDS
-The
-.Fn posix_fadvise
-interface conforms to
-.St -p1003.1-2001 .
-.Sh HISTORY
-The
-.Fn posix_fadvise
-system call first appeared in
-.Fx 9.1 .
diff --git a/lib/libc/sys/posix_fallocate.2 b/lib/libc/sys/posix_fallocate.2
deleted file mode 100644
index ddf8aeb750fb..000000000000
--- a/lib/libc/sys/posix_fallocate.2
+++ /dev/null
@@ -1,152 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)open.2 8.2 (Berkeley) 11/16/93
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2020
-.Dt POSIX_FALLOCATE 2
-.Os
-.Sh NAME
-.Nm posix_fallocate
-.Nd pre-allocate storage for a range in a file
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In fcntl.h
-.Ft int
-.Fn posix_fallocate "int fd" "off_t offset" "off_t len"
-.Sh DESCRIPTION
-Required storage for the range
-.Fa offset
-to
-.Fa offset +
-.Fa len
-in the file referenced by
-.Fa fd
-is guaranteed to be allocated upon successful return.
-That is, if
-.Fn posix_fallocate
-returns successfully, subsequent writes to the specified file data
-will not fail due to lack of free space on the file system storage
-media.
-Any existing file data in the specified range is unmodified.
-If
-.Fa offset +
-.Fa len
-is beyond the current file size, then
-.Fn posix_fallocate
-will adjust the file size to
-.Fa offset +
-.Fa len .
-Otherwise, the file size will not be changed.
-.Pp
-Space allocated by
-.Fn posix_fallocate
-will be freed by a successful call to
-.Xr creat 2
-or
-.Xr open 2
-that truncates the size of the file.
-Space allocated via
-.Fn posix_fallocate
-may be freed by a successful call to
-.Xr ftruncate 2
-that reduces the file size to a size smaller than
-.Fa offset +
-.Fa len .
-.Sh RETURN VALUES
-If successful,
-.Fn posix_fallocate
-returns zero.
-It returns an error on failure, without setting
-.Va errno .
-.Sh ERRORS
-Possible failure conditions:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa fd
-argument is not a valid file descriptor.
-.It Bq Er EBADF
-The
-.Fa fd
-argument references a file that was opened without write permission.
-.It Bq Er EFBIG
-The value of
-.Fa offset +
-.Fa len
-is greater than the maximum file size.
-.It Bq Er EINTR
-A signal was caught during execution.
-.It Bq Er EINVAL
-The
-.Fa len
-argument was less than or equal to zero, the
-.Fa offset
-argument was less than zero,
-or the operation is not supported by the file system.
-.It Bq Er EIO
-An I/O error occurred while reading from or writing to a file system.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.It Bq Er ENODEV
-The
-.Fa fd
-argument does not refer to a file that supports
-.Nm .
-.It Bq Er ENOSPC
-There is insufficient free space remaining on the file system storage
-media.
-.It Bq Er ENOTCAPABLE
-The file descriptor
-.Fa fd
-has insufficient rights.
-.It Bq Er ESPIPE
-The
-.Fa fd
-argument is associated with a pipe or FIFO.
-.El
-.Sh SEE ALSO
-.Xr creat 2 ,
-.Xr ftruncate 2 ,
-.Xr open 2 ,
-.Xr unlink 2
-.Sh STANDARDS
-The
-.Fn posix_fallocate
-system call conforms to
-.St -p1003.1-2004 .
-.Sh HISTORY
-The
-.Fn posix_fallocate
-function appeared in
-.Fx 9.0 .
-.Sh AUTHORS
-.Fn posix_fallocate
-and this manual page were initially written by
-.An Matthew Fleming Aq Mt mdf@FreeBSD.org .
diff --git a/lib/libc/sys/posix_openpt.2 b/lib/libc/sys/posix_openpt.2
deleted file mode 100644
index 01a372931af8..000000000000
--- a/lib/libc/sys/posix_openpt.2
+++ /dev/null
@@ -1,140 +0,0 @@
-.\" Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>
-.\" All rights reserved.
-.\"
-.\" Portions of this software were developed under sponsorship from Snow
-.\" B.V., the Netherlands.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" Portions of this text are reprinted and reproduced in electronic form
-.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
-.\" Portable Operating System Interface (POSIX), The Open Group Base
-.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
-.\" Electrical and Electronics Engineers, Inc and The Open Group. In the
-.\" event of any discrepancy between this version and the original IEEE and
-.\" The Open Group Standard, the original IEEE and The Open Group Standard is
-.\" the referee document. The original Standard can be obtained online at
-.\" http://www.opengroup.org/unix/online.html.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd September 21, 2016
-.Dt POSIX_OPENPT 2
-.Os
-.Sh NAME
-.Nm posix_openpt
-.Nd "open a pseudo-terminal device"
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In fcntl.h
-.In stdlib.h
-.Ft int
-.Fn posix_openpt "int oflag"
-.Sh DESCRIPTION
-The
-.Fn posix_openpt
-function allocates a new pseudo-terminal and establishes a connection
-with its master device.
-A slave device shall be created in
-.Pa /dev/pts .
-After the pseudo-terminal has been allocated, the slave device should
-have the proper permissions before it can be used (see
-.Xr grantpt 3 ) .
-The name of the slave device can be determined by calling
-.Xr ptsname 3 .
-.Pp
-The file status flags and file access modes of the open file description
-shall be set according to the value of
-.Fa oflag .
-Values for
-.Fa oflag
-are constructed by a bitwise-inclusive OR of flags from the following
-list, defined in
-.In fcntl.h :
-.Bl -tag -width ".Dv O_CLOEXEC"
-.It Dv O_RDWR
-Open for reading and writing.
-.It Dv O_NOCTTY
-If set
-.Fn posix_openpt
-shall not cause the terminal device to become the controlling terminal
-for the process.
-.It Dv O_CLOEXEC
-Set the close-on-exec flag for the new file descriptor.
-.El
-.Pp
-The
-.Fn posix_openpt
-function shall fail when
-.Fa oflag
-contains other values.
-.Sh RETURN VALUES
-Upon successful completion, the
-.Fn posix_openpt
-function shall allocate a new pseudo-terminal device and return a
-non-negative integer representing a file descriptor, which is connected
-to its master device.
-Otherwise, -1 shall be returned and errno set to indicate the error.
-.Sh ERRORS
-The
-.Fn posix_openpt
-function shall fail if:
-.Bl -tag -width Er
-.It Bq Er ENFILE
-The system file table is full.
-.It Bq Er EINVAL
-The value of
-.Fa oflag
-is not valid.
-.It Bq Er EAGAIN
-Out of pseudo-terminal resources.
-.El
-.Sh SEE ALSO
-.Xr ptsname 3 ,
-.Xr pts 4 ,
-.Xr tty 4
-.Sh STANDARDS
-The
-.Fn posix_openpt
-function conforms to
-.St -p1003.1-2001 .
-The ability to use
-.Dv O_CLOEXEC
-is an extension to the standard.
-.Sh HISTORY
-The
-.Fn posix_openpt
-function appeared in
-.Fx 5.0 .
-In
-.Fx 8.0 ,
-this function was changed to a system call.
-.Sh NOTES
-The flag
-.Dv O_NOCTTY
-is included for compatibility; in
-.Fx ,
-opening a terminal does not cause it to become a process's controlling
-terminal.
-.Sh AUTHORS
-.An \&Ed Schouten Aq Mt ed@FreeBSD.org
diff --git a/lib/libc/sys/ppoll.c b/lib/libc/sys/ppoll.c
index f62fd19cafe1..52c4c177cf0a 100644
--- a/lib/libc/sys/ppoll.c
+++ b/lib/libc/sys/ppoll.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2015 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/poll.h>
#include "libc_private.h"
@@ -44,8 +40,5 @@ int
ppoll(struct pollfd pfd[], nfds_t nfds, const struct timespec *__restrict
timeout, const sigset_t *__restrict newsigmask)
{
-
- return (((int (*)(struct pollfd *, nfds_t, const struct timespec *,
- const sigset_t *)) __libc_interposing[INTERPOS_ppoll])(pfd, nfds,
- timeout, newsigmask));
+ return (INTERPOS_SYS(ppoll, pfd, nfds, timeout, newsigmask));
}
diff --git a/lib/libc/sys/procctl.2 b/lib/libc/sys/procctl.2
deleted file mode 100644
index 97509d0fbf06..000000000000
--- a/lib/libc/sys/procctl.2
+++ /dev/null
@@ -1,853 +0,0 @@
-.\" Copyright (c) 2013 Hudson River Trading LLC
-.\" Written by: John H. Baldwin <jhb@FreeBSD.org>
-.\" All rights reserved.
-.\"
-.\" Copyright (c) 2014 The FreeBSD Foundation
-.\" Portions of this documentation were written by Konstantin Belousov
-.\" under sponsorship from the FreeBSD Foundation.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd September 2, 2021
-.Dt PROCCTL 2
-.Os
-.Sh NAME
-.Nm procctl
-.Nd control processes
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/procctl.h
-.Ft int
-.Fn procctl "idtype_t idtype" "id_t id" "int cmd" "void *data"
-.Sh DESCRIPTION
-The
-.Fn procctl
-system call provides for control over processes.
-The
-.Fa idtype
-and
-.Fa id
-arguments specify the set of processes to control.
-If multiple processes match the identifier,
-.Nm
-will make a
-.Dq best effort
-to control as many of the selected processes as possible.
-An error is only returned if no selected processes successfully complete
-the request.
-The following identifier types are supported:
-.Bl -tag -width P_PGID
-.It Dv P_PID
-Control the process with the process ID
-.Fa id .
-.Fa id
-zero is a shortcut for the calling process ID.
-.It Dv P_PGID
-Control processes belonging to the process group with the ID
-.Fa id .
-.El
-.Pp
-The control request to perform is specified by the
-.Fa cmd
-argument.
-.Pp
-All status changing requests
-.Dv *_CTL
-require the caller to have the right to debug the target.
-All status query requests
-.DV *_STATUS
-require the caller to have the right to observe the target.
-.Pp
-The following commands are supported:
-.Bl -tag -width PROC_TRAPCAP_STATUS
-.It Dv PROC_ASLR_CTL
-Controls the Address Space Layout Randomization (ASLR) in the program
-images created
-by
-.Xr execve 2
-in the specified process or its descendants that did not changed
-the control nor modified it by other means.
-The
-.Fa data
-parameter must point to the integer variable holding one of the following
-values:
-.Bl -tag -width PROC_ASLR_FORCE_DISABLE
-.It Dv PROC_ASLR_FORCE_ENABLE
-Request that ASLR is enabled after execution, even if it is disabled
-system-wide.
-The image flag and set-uid might prevent ASLR enablement still.
-.It Dv PROC_ASLR_FORCE_DISABLE
-Request that ASLR is disabled after execution.
-Same notes as for
-.Dv PROC_ASLR_FORCE_ENABLE
-apply.
-.It Dv PROC_ASLR_NOFORCE
-Use the system-wide configured policy for ASLR.
-.El
-.It Dv PROC_ASLR_STATUS
-Returns the current status of ASLR enablement for the target process.
-The
-.Fa data
-parameter must point to the integer variable, where one of the
-following values is written:
-.Bl -tag -width PROC_ASLR_FORCE_DISABLE
-.It Dv PROC_ASLR_FORCE_ENABLE
-.It Dv PROC_ASLR_FORCE_DISABLE
-.It Dv PROC_ASLR_NOFORCE
-.El
-.Pp
-If the currently executed image in the process itself has ASLR enabled,
-the
-.Dv PROC_ASLR_ACTIVE
-flag is or-ed with the value listed above.
-.It Dv PROC_PROTMAX_CTL
-Controls implicit application of PROT_MAX protection equal to the
-.Fa prot
-argument of the
-.Xr mmap 2
-syscall, in the target process.
-The
-.Fa data
-parameter must point to the integer variable holding one of the following
-values:
-.Bl -tag -width PROC_PROTMAX_FORCE_DISABLE
-.It Dv PROC_PROTMAX_FORCE_ENABLE
-Enables implicit PROT_MAX application,
-even if it is disabled system-wide by the sysctl
-.Va vm.imply_prot_max .
-The image flag might still prevent the enablement.
-.It Dv PROC_PROTMAX_FORCE_DISABLE
-Request that implicit application of PROT_MAX be disabled.
-Same notes as for
-.Dv PROC_PROTMAX_FORCE_ENABLE
-apply.
-.It Dv PROC_PROTMAX_NOFORCE
-Use the system-wide configured policy for PROT_MAX.
-.El
-.It Dv PROC_PROTMAX_STATUS
-Returns the current status of implicit PROT_MAX enablement for the
-target process.
-The
-.Fa data
-parameter must point to the integer variable, where one of the
-following values is written:
-.Bl -tag -width PROC_PROTMAX_FORCE_DISABLE
-.It Dv PROC_PROTMAX_FORCE_ENABLE
-.It Dv PROC_PROTMAX_FORCE_DISABLE
-.It Dv PROC_PROTMAX_NOFORCE
-.El
-.Pp
-If the currently executed image in the process itself has implicit PROT_MAX
-application enabled, the
-.Dv PROC_PROTMAX_ACTIVE
-flag is or-ed with the value listed above.
-.It Dv PROC_SPROTECT
-Set process protection state.
-This is used to mark a process as protected from being killed if the system
-exhausts the available memory and swap.
-The
-.Fa data
-parameter must point to an integer containing an operation and zero or more
-optional flags.
-The following operations are supported:
-.Bl -tag -width PPROT_CLEAR
-.It Dv PPROT_SET
-Mark the selected processes as protected.
-.It Dv PPROT_CLEAR
-Clear the protected state of selected processes.
-.El
-.Pp
-The following optional flags are supported:
-.Bl -tag -width PPROT_DESCEND
-.It Dv PPROT_DESCEND
-Apply the requested operation to all child processes of each selected process
-in addition to each selected process.
-.It Dv PPROT_INHERIT
-When used with
-.Dv PPROT_SET ,
-mark all future child processes of each selected process as protected.
-Future child processes will also mark all of their future child processes.
-.El
-.It Dv PROC_REAP_ACQUIRE
-Acquires the reaper status for the current process.
-Reaper status means that children orphaned by the reaper's descendants
-that were forked after the acquisition of reaper status are reparented to the
-reaper process.
-After system initialization,
-.Xr init 8
-is the default reaper.
-.It Dv PROC_REAP_RELEASE
-Release the reaper state for the current process.
-The reaper of the current process becomes the new reaper of the
-current process's descendants.
-.It Dv PROC_REAP_STATUS
-Provides information about the reaper of the specified process,
-or the process itself when it is a reaper.
-The
-.Fa data
-argument must point to a
-.Vt procctl_reaper_status
-structure which is filled in by the syscall on successful return.
-.Bd -literal
-struct procctl_reaper_status {
- u_int rs_flags;
- u_int rs_children;
- u_int rs_descendants;
- pid_t rs_reaper;
- pid_t rs_pid;
-};
-.Ed
-The
-.Fa rs_flags
-may have the following flags returned:
-.Bl -tag -width REAPER_STATUS_REALINIT
-.It Dv REAPER_STATUS_OWNED
-The specified process has acquired reaper status and has not
-released it.
-When the flag is returned, the specified process
-.Fa id ,
-pid, identifies the reaper, otherwise the
-.Fa rs_reaper
-field of the structure is set to the pid of the reaper
-for the specified process id.
-.It Dv REAPER_STATUS_REALINIT
-The specified process is the root of the reaper tree, i.e.,
-.Xr init 8 .
-.El
-.Pp
-The
-.Fa rs_children
-field returns the number of children of the reaper among the descendants.
-It is possible to have a child whose reaper is not the specified process,
-since the reaper for any existing children is not reset on the
-.Dv PROC_REAP_ACQUIRE
-operation.
-The
-.Fa rs_descendants
-field returns the total number of descendants of the reaper(s),
-not counting descendants of the reaper in the subtree.
-The
-.Fa rs_reaper
-field returns the reaper pid.
-The
-.Fa rs_pid
-returns the pid of one reaper child if there are any descendants.
-.It Dv PROC_REAP_GETPIDS
-Queries the list of descendants of the reaper of the specified process.
-The request takes a pointer to a
-.Vt procctl_reaper_pids
-structure in the
-.Fa data
-parameter.
-.Bd -literal
-struct procctl_reaper_pids {
- u_int rp_count;
- struct procctl_reaper_pidinfo *rp_pids;
-};
-.Ed
-When called, the
-.Fa rp_pids
-field must point to an array of
-.Vt procctl_reaper_pidinfo
-structures, to be filled in on return,
-and the
-.Fa rp_count
-field must specify the size of the array,
-into which no more than
-.Fa rp_count
-elements will be filled in by the kernel.
-.Pp
-The
-.Vt "struct procctl_reaper_pidinfo"
-structure provides some information about one of the reaper's descendants.
-Note that for a descendant that is not a child, it may be incorrectly
-identified because of a race in which the original child process exited
-and the exited process's pid was reused for an unrelated process.
-.Bd -literal
-struct procctl_reaper_pidinfo {
- pid_t pi_pid;
- pid_t pi_subtree;
- u_int pi_flags;
-};
-.Ed
-The
-.Fa pi_pid
-field is the process id of the descendant.
-The
-.Fa pi_subtree
-field provides the pid of the child of the reaper, which is the (grand-)parent
-of the process.
-The
-.Fa pi_flags
-field returns the following flags, further describing the descendant:
-.Bl -tag -width REAPER_PIDINFO_REAPER
-.It Dv REAPER_PIDINFO_VALID
-Set to indicate that the
-.Vt procctl_reaper_pidinfo
-structure was filled in by the kernel.
-Zero-filling the
-.Fa rp_pids
-array and testing the
-.Dv REAPER_PIDINFO_VALID
-flag allows the caller to detect the end
-of the returned array.
-.It Dv REAPER_PIDINFO_CHILD
-The
-.Fa pi_pid
-field identifies the direct child of the reaper.
-.It Dv REAPER_PIDINFO_REAPER
-The reported process is itself a reaper.
-The descendants of the subordinate reaper are not reported.
-.El
-.It Dv PROC_REAP_KILL
-Request to deliver a signal to some subset of the descendants of the reaper.
-The
-.Fa data
-parameter must point to a
-.Vt procctl_reaper_kill
-structure, which is used both for parameters and status return.
-.Bd -literal
-struct procctl_reaper_kill {
- int rk_sig;
- u_int rk_flags;
- pid_t rk_subtree;
- u_int rk_killed;
- pid_t rk_fpid;
-};
-.Ed
-The
-.Fa rk_sig
-field specifies the signal to be delivered.
-Zero is not a valid signal number, unlike for
-.Xr kill 2 .
-The
-.Fa rk_flags
-field further directs the operation.
-It is or-ed from the following flags:
-.Bl -tag -width REAPER_KILL_CHILDREN
-.It Dv REAPER_KILL_CHILDREN
-Deliver the specified signal only to direct children of the reaper.
-.It Dv REAPER_KILL_SUBTREE
-Deliver the specified signal only to descendants that were forked by
-the direct child with pid specified in the
-.Fa rk_subtree
-field.
-.El
-If neither the
-.Dv REAPER_KILL_CHILDREN
-nor the
-.Dv REAPER_KILL_SUBTREE
-flags are specified, all current descendants of the reaper are signalled.
-.Pp
-If a signal was delivered to any process, the return value from the request
-is zero.
-In this case, the
-.Fa rk_killed
-field identifies the number of processes signalled.
-The
-.Fa rk_fpid
-field is set to the pid of the first process for which signal
-delivery failed, e.g., due to permission problems.
-If no such process exists, the
-.Fa rk_fpid
-field is set to -1.
-.It Dv PROC_TRACE_CTL
-Enable or disable tracing of the specified process(es), according to the
-value of the integer argument.
-Tracing includes attachment to the process using the
-.Xr ptrace 2
-and
-.Xr ktrace 2 ,
-debugging sysctls,
-.Xr hwpmc 4 ,
-.Xr dtrace 1 ,
-and core dumping.
-Possible values for the
-.Fa data
-argument are:
-.Bl -tag -width PROC_TRACE_CTL_DISABLE_EXEC
-.It Dv PROC_TRACE_CTL_ENABLE
-Enable tracing, after it was disabled by
-.Dv PROC_TRACE_CTL_DISABLE .
-Only allowed for self.
-.It Dv PROC_TRACE_CTL_DISABLE
-Disable tracing for the specified process.
-Tracing is re-enabled when the process changes the executing
-program with the
-.Xr execve 2
-syscall.
-A child inherits the trace settings from the parent on
-.Xr fork 2 .
-.It Dv PROC_TRACE_CTL_DISABLE_EXEC
-Same as
-.Dv PROC_TRACE_CTL_DISABLE ,
-but the setting persists for the process even after
-.Xr execve 2 .
-.El
-.It Dv PROC_TRACE_STATUS
-Returns the current tracing status for the specified process in
-the integer variable pointed to by
-.Fa data .
-If tracing is disabled,
-.Fa data
-is set to -1.
-If tracing is enabled, but no debugger is attached by the
-.Xr ptrace 2
-syscall,
-.Fa data
-is set to 0.
-If a debugger is attached,
-.Fa data
-is set to the pid of the debugger process.
-.It Dv PROC_TRAPCAP_CTL
-Controls the capability mode sandbox actions for the specified
-sandboxed processes,
-on a return from any syscall which gives either a
-.Er ENOTCAPABLE
-or
-.Er ECAPMODE
-error.
-If the control is enabled, such errors from the syscalls cause
-delivery of the synchronous
-.Dv SIGTRAP
-signal to the thread immediately before returning from the syscalls.
-.Pp
-Possible values for the
-.Fa data
-argument are:
-.Bl -tag -width PROC_TRAPCAP_CTL_DISABLE
-.It Dv PROC_TRAPCAP_CTL_ENABLE
-Enable the
-.Dv SIGTRAP
-signal delivery on capability mode access violations.
-The enabled mode is inherited by the children of the process,
-and is kept after
-.Xr fexecve 2
-calls.
-.It Dv PROC_TRAPCAP_CTL_DISABLE
-Disable the signal delivery on capability mode access violations.
-Note that the global sysctl
-.Dv kern.trap_enotcap
-might still cause the signal to be delivered.
-See
-.Xr capsicum 4 .
-.El
-.Pp
-On signal delivery, the
-.Va si_errno
-member of the
-.Fa siginfo
-signal handler parameter is set to the syscall error value,
-and the
-.Va si_code
-member is set to
-.Dv TRAP_CAP .
-The system call number is stored in the
-.Va si_syscall
-field of the
-.Fa siginfo
-signal handler parameter.
-The other system call parameters can be read from the
-.Fa ucontext_t
-but the system call number is typically stored in the register
-that also contains the return value and so is unavailable in the
-signal handler.
-.Pp
-See
-.Xr capsicum 4
-for more information about the capability mode.
-.It Dv PROC_TRAPCAP_STATUS
-Return the current status of signalling capability mode access
-violations for the specified process.
-The integer value pointed to by the
-.Fa data
-argument is set to the
-.Dv PROC_TRAPCAP_CTL_ENABLE
-value if the process control enables signal delivery, and to
-.Dv PROC_TRAPCAP_CTL_DISABLE
-otherwise.
-.Pp
-See the note about sysctl
-.Dv kern.trap_enotcap
-above, which gives independent global control of signal delivery.
-.It Dv PROC_PDEATHSIG_CTL
-Request the delivery of a signal when the parent of the calling
-process exits.
-.Fa idtype
-must be
-.Dv P_PID
-and
-.Fa id
-must be the either caller's pid or zero, with no difference in effect.
-The value is cleared for child processes
-and when executing set-user-ID or set-group-ID binaries.
-.Fa data
-must point to a value of type
-.Vt int
-indicating the signal
-that should be delivered to the caller.
-Use zero to cancel a previously requested signal delivery.
-.It Dv PROC_PDEATHSIG_STATUS
-Query the current signal number that will be delivered when the parent
-of the calling process exits.
-.Fa idtype
-must be
-.Dv P_PID
-and
-.Fa id
-must be the either caller's pid or zero, with no difference in effect.
-.Fa data
-must point to a memory location that can hold a value of type
-.Vt int .
-If signal delivery has not been requested, it will contain zero
-on return.
-.It Dv PROC_STACKGAP_CTL
-Controls the stack gaps in the specified process.
-A stack gap is the part of the growth area for a
-.Dv MAP_STACK
-mapped region that is reserved and never filled by memory.
-Instead, the process is guaranteed to receive a
-.Dv SIGSEGV
-signal on accessing pages in the gap.
-Gaps protect against stack overflow corrupting memory adjacent
-to the stack.
-.Pp
-The
-.Fa data
-argument must point to an integer variable containing flags.
-The following flags are allowed:
-.Bl -tag -width PROC_STACKGAP_DISABLE_EXEC
-.It Dv PROC_STACKGAP_ENABLE
-This flag is only accepted for consistency with
-.Dv PROC_STACKGAP_STATUS .
-If stack gaps are enabled, the flag is ignored.
-If disabled, the flag causes an
-.Ev EINVAL
-error to be returned.
-After gaps are disabled in a process, they can only be re-enabled when an
-.Xr execve 2
-is performed.
-.It Dv PROC_STACKGAP_DISABLE
-Disable stack gaps for the process.
-For existing stacks, the gap is no longer a reserved part of the growth
-area and can be filled by memory on access.
-.It Dv PROC_STACKGAP_ENABLE_EXEC
-Enable stack gaps for programs started after an
-.Xr execve 2
-by the specified process.
-.It Dv PROC_STACKGAP_DISABLE_EXEC
-Inherit disabled stack gaps state after
-.Xr execve 2 .
-In other words, if the currently executing program has stack gaps disabled,
-they are kept disabled on exec.
-If gaps were enabled, they are kept enabled after exec.
-.El
-.Pp
-The stack gap state is inherited from the parent on
-.Xr fork 2 .
-.It Dv PROC_STACKGAP_STATUS
-Returns the current stack gap state for the specified process.
-.Fa data
-must point to an integer variable, which is used to return a bitmask
-consisting of the following flags:
-.Bl -tag -width PROC_STACKGAP_DISABLE_EXEC
-.It Dv PROC_STACKGAP_ENABLE
-Stack gaps are enabled.
-.It Dv PROC_STACKGAP_DISABLE
-Stack gaps are disabled.
-.It Dv PROC_STACKGAP_ENABLE_EXEC
-Stack gaps are enabled in the process after
-.Xr execve 2 .
-.It Dv PROC_STACKGAP_DISABLE_EXEC
-Stack gaps are disabled in the process after
-.Xr execve 2 .
-.El
-.It Dv PROC_NO_NEW_PRIVS_CTL
-Allows one to ignore the SUID and SGID bits on the program
-images activated by
-.Xr execve 2
-in the specified process and its future descendants.
-The
-.Fa data
-parameter must point to the integer variable holding the following
-value:
-.Bl -tag -width PROC_NO_NEW_PRIVS_ENABLE
-.It Dv PROC_NO_NEW_PRIVS_ENABLE
-Request SUID and SGID bits to be ignored.
-.El
-.Pp
-It is not possible to disable it once it has been enabled.
-.It Dv PROC_NO_NEW_PRIVS_STATUS
-Returns the current status of SUID/SGID enablement for the target process.
-The
-.Fa data
-parameter must point to the integer variable, where one of the
-following values is written:
-.Bl -tag -width PROC_NO_NEW_PRIVS_DISABLE
-.It Dv PROC_NO_NEW_PRIVS_ENABLE
-.It Dv PROC_NO_NEW_PRIVS_DISABLE
-.El
-.It Dv PROC_WXMAP_CTL
-Controls the 'write exclusive against execution' permissions for the
-mappings in the process address space.
-It overrides the global settings established by the
-.Dv kern.elf{32/64}.allow_wx
-sysctl,
-and the corresponding bit in the ELF control note, see
-.Xr elfctl 1 .
-.Pp
-The
-.Fa data
-parameter must point to the integer variable holding one of the
-following values:
-.Bl -tag -width PROC_WX_MAPPINGS_DISALLOW_EXEC
-.It Dv PROC_WX_MAPPINGS_PERMIT
-Enable creation of mappings that have both write and execute
-protection attributes, in the specified process' address space.
-.It Dv PROC_WX_MAPPINGS_DISALLOW_EXEC
-In the new address space created by
-.Xr execve 2 ,
-disallow creation of mappings that have both write and execute
-permissions.
-.El
-.Pp
-Once creation of writeable and executable mappings is allowed,
-it is impossible (and pointless) to disallow it.
-The only way to ensure the absence of such mappings after they
-were enabled in a given process, is to set the
-.Dv PROC_WX_MAPPINGS_DISALLOW_EXEC
-flag and
-.Xr execve 2
-an image.
-.It Dv PROC_WXMAP_STATUS
-Returns the current status of the 'write exclusive against execution'
-enforcement for the specified process.
-The
-.Dv data
-parameter must point to the integer variable, where one of the
-following values is written:
-.Bl -tag -width PROC_WX_MAPPINGS_DISALLOW_EXEC
-.It Dv PROC_WX_MAPPINGS_PERMIT
-Creation of simultaneously writable and executable mapping is permitted,
-otherwise the process cannot create such mappings.
-.It Dv PROC_WX_MAPPINGS_DISALLOW_EXEC
-After
-.Xr execve 2 ,
-the new address space should disallow creation of simultaneously
-writable and executable mappings.
-.El
-.Pp
-Additionally, if the address space of the process disallows
-creation of simultaneously writable and executable mappings and
-it is guaranteed that no such mapping was created since address space
-creation, the
-.Dv PROC_WXORX_ENFORCE
-flag is set in the returned value.
-.El
-.Sh x86 MACHINE-SPECIFIC REQUESTS
-.Bl -tag -width PROC_KPTI_STATUS
-.It Dv PROC_KPTI_CTL
-AMD64 only.
-Controls the Kernel Page Table Isolation (KPTI) option for the children
-of the specified process.
-For the command to work, the
-.Va vm.pmap.kpti
-tunable must be enabled on boot.
-It is not possible to change the KPTI setting for a running process,
-except at the
-.Xr execve 2 ,
-where the address space is reinitialized.
-.Pp
-The
-.Fa data
-parameter must point to an integer variable containing one of the
-following commands:
-.Bl -tag -width PROC_KPTI_CTL_DISABLE_ON_EXEC
-.It Dv PROC_KPTI_CTL_ENABLE_ON_EXEC
-Enable KPTI after
-.Xr execve 2 .
-.It Dv PROC_KPTI_CTL_DISABLE_ON_EXEC
-Disable KPTI after
-.Xr execve 2 .
-Only root or a process having the
-.Va PRIV_IO
-privilege might use this option.
-.El
-.It Dv PROC_KPTI_STATUS
-Returns the current KPTI status for the specified process.
-.Fa data
-must point to the integer variable, which returns the
-following statuses:
-.Bl -tag -width PROC_KPTI_CTL_DISABLE_ON_EXEC
-.It Dv PROC_KPTI_CTL_ENABLE_ON_EXEC
-.It Dv PROC_KPTI_CTL_DISABLE_ON_EXEC
-.El
-.Pp
-The status is or-ed with the
-.Va PROC_KPTI_STATUS_ACTIVE
-in case KPTI is active for the current address space of the process.
-.Sh NOTES
-Disabling tracing on a process should not be considered a security
-feature, as it is bypassable both by the kernel and privileged processes,
-and via other system mechanisms.
-As such, it should not be utilized to reliably protect cryptographic
-keying material or other confidential data.
-.Pp
-Note that processes can trivially bypass the 'no simultaneously
-writable and executable mappings' policy by first marking some mapping
-as writeable and write code to it, then removing write and adding
-execute permission.
-This may be legitimately required by some programs, such as JIT compilers.
-.Sh RETURN VALUES
-If an error occurs, a value of -1 is returned and
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-The
-.Fn procctl
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EFAULT
-The
-.Fa data
-parameter points outside the process's allocated address space.
-.It Bq Er EINVAL
-The
-.Fa cmd
-argument specifies an unsupported command.
-.Pp
-The
-.Fa idtype
-argument specifies an unsupported identifier type.
-.It Bq Er EPERM
-The calling process does not have permission to perform the requested
-operation on any of the selected processes.
-.It Bq Er ESRCH
-No processes matched the requested
-.Fa idtype
-and
-.Fa id .
-.It Bq Er EINVAL
-An invalid operation or flag was passed in
-.Fa data
-for a
-.Dv PROC_SPROTECT
-command.
-.It Bq Er EPERM
-The
-.Fa idtype
-argument is not equal to
-.Dv P_PID ,
-or
-.Fa id
-is not equal to the pid of the calling process, for
-.Dv PROC_REAP_ACQUIRE
-or
-.Dv PROC_REAP_RELEASE
-requests.
-.It Bq Er EINVAL
-Invalid or undefined flags were passed to a
-.Dv PROC_REAP_KILL
-request.
-.It Bq Er EINVAL
-An invalid or zero signal number was requested for a
-.Dv PROC_REAP_KILL
-request.
-.It Bq Er EINVAL
-The
-.Dv PROC_REAP_RELEASE
-request was issued by the
-.Xr init 8
-process.
-.It Bq Er EBUSY
-The
-.Dv PROC_REAP_ACQUIRE
-request was issued by a process that had already acquired reaper status
-and has not yet released it.
-.It Bq Er EBUSY
-The
-.Dv PROC_TRACE_CTL
-request was issued for a process already being traced.
-.It Bq Er EPERM
-The
-.Dv PROC_TRACE_CTL
-request to re-enable tracing of the process
-.Po Dv PROC_TRACE_CTL_ENABLE Pc ,
-or to disable persistence of
-.Dv PROC_TRACE_CTL_DISABLE
-on
-.Xr execve 2
-was issued for a non-current process.
-.It Bq Er EINVAL
-The value of the integer
-.Fa data
-parameter for the
-.Dv PROC_TRACE_CTL
-or
-.Dv PROC_TRAPCAP_CTL
-request is invalid.
-.It Bq Er EINVAL
-The
-.Dv PROC_PDEATHSIG_CTL
-or
-.Dv PROC_PDEATHSIG_STATUS
-request referenced an unsupported
-.Fa id ,
-.Fa idtype
-or invalid signal number.
-.El
-.Sh SEE ALSO
-.Xr dtrace 1 ,
-.Xr proccontrol 1 ,
-.Xr protect 1 ,
-.Xr cap_enter 2 ,
-.Xr kill 2 ,
-.Xr ktrace 2 ,
-.Xr mmap 2 ,
-.Xr mprotect 2 ,
-.Xr ptrace 2 ,
-.Xr wait 2 ,
-.Xr capsicum 4 ,
-.Xr hwpmc 4 ,
-.Xr init 8
-.Sh HISTORY
-The
-.Fn procctl
-function appeared in
-.Fx 10.0 .
-.Pp
-The reaper facility is based on a similar feature of Linux and
-DragonflyBSD, and first appeared in
-.Fx 10.2 .
-.Pp
-The
-.Dv PROC_PDEATHSIG_CTL
-facility is based on the prctl(PR_SET_PDEATHSIG, ...) feature of Linux,
-and first appeared in
-.Fx 11.2 .
-.Pp
-The ASLR support was added to system for the checklists compliance in
-.Fx 13.0 .
diff --git a/lib/libc/sys/profil.2 b/lib/libc/sys/profil.2
deleted file mode 100644
index cdaa32a7f939..000000000000
--- a/lib/libc/sys/profil.2
+++ /dev/null
@@ -1,122 +0,0 @@
-.\" Copyright (c) 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Donn Seeley of BSDI.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)profil.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd December 1, 2017
-.Dt PROFIL 2
-.Os
-.Sh NAME
-.Nm profil
-.Nd control process profiling
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn profil "char *samples" "size_t size" "vm_offset_t offset" "int scale"
-.Sh DESCRIPTION
-The
-.Fn profil
-system call enables or disables
-program counter profiling of the current process.
-If profiling is enabled,
-then at every profiling clock tick,
-the kernel updates an appropriate count in the
-.Fa samples
-buffer.
-The frequency of the profiling clock is recorded
-in the header in the profiling output file.
-.Pp
-The buffer
-.Fa samples
-contains
-.Fa size
-bytes and is divided into
-a series of 16-bit bins.
-Each bin counts the number of times the program counter
-was in a particular address range in the process
-when a profiling clock tick occurred while profiling was enabled.
-For a given program counter address,
-the number of the corresponding bin is given
-by the relation:
-.Bd -literal -offset indent
-[(pc - offset) / 2] * scale / 65536
-.Ed
-.Pp
-The
-.Fa offset
-argument is the lowest address at which
-the kernel takes program counter samples.
-The
-.Fa scale
-argument ranges from 1 to 65536 and
-can be used to change the span of the bins.
-A scale of 65536 maps each bin to 2 bytes of address range;
-a scale of 32768 gives 4 bytes, 16384 gives 8 bytes and so on.
-Intermediate values provide approximate intermediate ranges.
-A
-.Fa scale
-value of 0 disables profiling.
-.Sh RETURN VALUES
-.Rv -std profil
-.Sh FILES
-.Bl -tag -width /usr/lib/gcrt0.o -compact
-.It Pa /usr/lib/gcrt0.o
-profiling C run-time startup file
-.It Pa gmon.out
-conventional name for profiling output file
-.El
-.Sh ERRORS
-The following error may be reported:
-.Bl -tag -width Er
-.It Bq Er EFAULT
-The buffer
-.Fa samples
-contains an invalid address.
-.El
-.Sh SEE ALSO
-.Xr gprof 1
-.Sh HISTORY
-The
-.Fn profil
-function appeared in
-.At v6 .
-.Sh BUGS
-This routine should be named
-.Fn profile .
-.Pp
-The
-.Fa samples
-argument should really be a vector of type
-.Fa "unsigned short" .
-.Pp
-The format of the gmon.out file is undocumented.
diff --git a/lib/libc/sys/pselect.2 b/lib/libc/sys/pselect.2
deleted file mode 100644
index 6221c473e7d7..000000000000
--- a/lib/libc/sys/pselect.2
+++ /dev/null
@@ -1,123 +0,0 @@
-.\"
-.\" Copyright 2002 Massachusetts Institute of Technology
-.\"
-.\" Permission to use, copy, modify, and distribute this software and
-.\" its documentation for any purpose and without fee is hereby
-.\" granted, provided that both the above copyright notice and this
-.\" permission notice appear in all copies, that both the above
-.\" copyright notice and this permission notice appear in all
-.\" supporting documentation, and that the name of M.I.T. not be used
-.\" in advertising or publicity pertaining to distribution of the
-.\" software without specific, written prior permission. M.I.T. makes
-.\" no representations about the suitability of this software for any
-.\" purpose. It is provided "as is" without express or implied
-.\" warranty.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
-.\" ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
-.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
-.\" SHALL M.I.T. 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd August 16, 2013
-.Dt PSELECT 2
-.Os
-.Sh NAME
-.Nm pselect
-.Nd synchronous I/O multiplexing a la POSIX.1g
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/select.h
-.Ft int
-.Fo pselect
-.Fa "int nfds"
-.Fa "fd_set * restrict readfds"
-.Fa "fd_set * restrict writefds"
-.Fa "fd_set * restrict exceptfds"
-.Fa "const struct timespec * restrict timeout"
-.Fa "const sigset_t * restrict newsigmask"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn pselect
-function was introduced by
-.St -p1003.1g-2000
-as a slightly stronger version of
-.Xr select 2 .
-The
-.Fa nfds , readfds , writefds ,
-and
-.Fa exceptfds
-arguments are all identical to the analogous arguments of
-.Fn select .
-The
-.Fa timeout
-argument in
-.Fn pselect
-points to a
-.Vt "const struct timespec"
-rather than the (modifiable)
-.Vt "struct timeval"
-used by
-.Fn select ;
-as in
-.Fn select ,
-a null pointer may be passed to indicate that
-.Fn pselect
-should wait indefinitely.
-Finally,
-.Fa newsigmask
-specifies a signal mask which is set while waiting for input.
-When
-.Fn pselect
-returns, the original signal mask is restored.
-.Pp
-See
-.Xr select 2
-for a more detailed discussion of the semantics of this interface, and
-for macros used to manipulate the
-.Vt "fd_set"
-data type.
-.Sh RETURN VALUES
-The
-.Fn pselect
-function returns the same values and under the same conditions as
-.Fn select .
-.Sh ERRORS
-The
-.Fn pselect
-function may fail for any of the reasons documented for
-.Xr select 2
-and (if a signal mask is provided)
-.Xr sigprocmask 2 .
-.Sh SEE ALSO
-.Xr kqueue 2 ,
-.Xr poll 2 ,
-.Xr select 2 ,
-.Xr sigprocmask 2 ,
-.Xr sigsuspend 2
-.Sh STANDARDS
-The
-.Fn pselect
-function conforms to
-.St -p1003.1-2001 .
-.Sh HISTORY
-The
-.Fn pselect
-function first appeared in
-.Fx 5.0 .
-.Sh AUTHORS
-The first implementation of
-.Fn pselect
-function and this manual page were written by
-.An Garrett Wollman Aq Mt wollman@FreeBSD.org .
diff --git a/lib/libc/sys/pselect.c b/lib/libc/sys/pselect.c
index a623a7d5cc74..38477e39af44 100644
--- a/lib/libc/sys/pselect.c
+++ b/lib/libc/sys/pselect.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2014 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/select.h>
#include "libc_private.h"
@@ -44,8 +40,5 @@ int
pselect(int n, fd_set *rs, fd_set *ws, fd_set *es, const struct timespec *t,
const sigset_t *s)
{
-
- return (((int (*)(int, fd_set *, fd_set *, fd_set *,
- const struct timespec *, const sigset_t *))
- __libc_interposing[INTERPOS_pselect])(n, rs, ws, es, t, s));
+ return (INTERPOS_SYS(pselect, n, rs, ws, es, t, s));
}
diff --git a/lib/libc/sys/ptrace.2 b/lib/libc/sys/ptrace.2
deleted file mode 100644
index 504891597dab..000000000000
--- a/lib/libc/sys/ptrace.2
+++ /dev/null
@@ -1,1271 +0,0 @@
-.\" $FreeBSD$
-.\" $NetBSD: ptrace.2,v 1.2 1995/02/27 12:35:37 cgd Exp $
-.\"
-.\" This file is in the public domain.
-.Dd May 20, 2021
-.Dt PTRACE 2
-.Os
-.Sh NAME
-.Nm ptrace
-.Nd process tracing and debugging
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In sys/ptrace.h
-.Ft int
-.Fn ptrace "int request" "pid_t pid" "caddr_t addr" "int data"
-.Sh DESCRIPTION
-The
-.Fn ptrace
-system call
-provides tracing and debugging facilities.
-It allows one process
-(the
-.Em tracing
-process)
-to control another
-(the
-.Em traced
-process).
-The tracing process must first attach to the traced process, and then
-issue a series of
-.Fn ptrace
-system calls to control the execution of the process, as well as access
-process memory and register state.
-For the duration of the tracing session, the traced process will be
-.Dq re-parented ,
-with its parent process ID (and resulting behavior)
-changed to the tracing process.
-It is permissible for a tracing process to attach to more than one
-other process at a time.
-When the tracing process has completed its work, it must detach the
-traced process; if a tracing process exits without first detaching all
-processes it has attached, those processes will be killed.
-.Pp
-Most of the time, the traced process runs normally, but when it
-receives a signal
-(see
-.Xr sigaction 2 ) ,
-it stops.
-The tracing process is expected to notice this via
-.Xr wait 2
-or the delivery of a
-.Dv SIGCHLD
-signal, examine the state of the stopped process, and cause it to
-terminate or continue as appropriate.
-The signal may be a normal process signal, generated as a result of
-traced process behavior, or use of the
-.Xr kill 2
-system call; alternatively, it may be generated by the tracing facility
-as a result of attaching, stepping by the tracing
-process,
-or an event in the traced process.
-The tracing process may choose to intercept the signal, using it to
-observe process behavior (such as
-.Dv SIGTRAP ) ,
-or forward the signal to the process if appropriate.
-The
-.Fn ptrace
-system call
-is the mechanism by which all this happens.
-.Pp
-A traced process may report additional signal stops corresponding to
-events in the traced process.
-These additional signal stops are reported as
-.Dv SIGTRAP
-or
-.Dv SIGSTOP
-signals.
-The tracing process can use the
-.Dv PT_LWPINFO
-request to determine which events are associated with a
-.Dv SIGTRAP
-or
-.Dv SIGSTOP
-signal.
-Note that multiple events may be associated with a single signal.
-For example, events indicated by the
-.Dv PL_FLAG_BORN ,
-.Dv PL_FLAG_FORKED ,
-and
-.Dv PL_FLAG_EXEC
-flags are also reported as a system call exit event
-.Pq Dv PL_FLAG_SCX .
-The signal stop for a new child process enabled via
-.Dv PTRACE_FORK
-will report a
-.Dv SIGSTOP
-signal.
-All other additional signal stops use
-.Dv SIGTRAP .
-.Sh DETACH AND TERMINATION
-.Pp
-Normally, exiting tracing process should wait for all pending
-debugging events and then detach from all alive traced processes
-before exiting using
-.Dv PT_DETACH
-request.
-If tracing process exits without detaching, for instance due to abnormal
-termination, the destiny of the traced children processes is determined
-by the
-.Dv kern.kill_on_debugger_exit
-sysctl control.
-.Pp
-If the control is set to the default value 1, such traced processes
-are terminated.
-If set to zero, kernel implicitly detaches traced processes.
-Traced processes are un-stopped if needed, and then continue the execution
-without tracing.
-Kernel drops any
-.Dv SIGTRAP
-signals queued to the traced children, which could be either generated by
-not yet consumed debug events, or sent by other means, the later should
-not be done anyway.
-.Sh TRACING EVENTS
-.Pp
-Each traced process has a tracing event mask.
-An event in the traced process only reports a
-signal stop if the corresponding flag is set in the tracing event mask.
-The current set of tracing event flags include:
-.Bl -tag -width "Dv PTRACE_SYSCALL"
-.It Dv PTRACE_EXEC
-Report a stop for a successful invocation of
-.Xr execve 2 .
-This event is indicated by the
-.Dv PL_FLAG_EXEC
-flag in the
-.Va pl_flags
-member of
-.Vt "struct ptrace_lwpinfo" .
-.It Dv PTRACE_SCE
-Report a stop on each system call entry.
-This event is indicated by the
-.Dv PL_FLAG_SCE
-flag in the
-.Va pl_flags
-member of
-.Vt "struct ptrace_lwpinfo" .
-.It Dv PTRACE_SCX
-Report a stop on each system call exit.
-This event is indicated by the
-.Dv PL_FLAG_SCX
-flag in the
-.Va pl_flags
-member of
-.Vt "struct ptrace_lwpinfo" .
-.It Dv PTRACE_SYSCALL
-Report stops for both system call entry and exit.
-.It Dv PTRACE_FORK
-This event flag controls tracing for new child processes of a traced process.
-.Pp
-When this event flag is enabled,
-new child processes will enable tracing and stop before executing their
-first instruction.
-The new child process will include the
-.Dv PL_FLAG_CHILD
-flag in the
-.Va pl_flags
-member of
-.Vt "struct ptrace_lwpinfo" .
-The traced process will report a stop that includes the
-.Dv PL_FLAG_FORKED
-flag.
-The process ID of the new child process will also be present in the
-.Va pl_child_pid
-member of
-.Vt "struct ptrace_lwpinfo" .
-If the new child process was created via
-.Xr vfork 2 ,
-the traced process's stop will also include the
-.Dv PL_FLAG_VFORKED
-flag.
-Note that new child processes will be attached with the default
-tracing event mask;
-they do not inherit the event mask of the traced process.
-.Pp
-When this event flag is not enabled,
-new child processes will execute without tracing enabled.
-.It Dv PTRACE_LWP
-This event flag controls tracing of LWP
-.Pq kernel thread
-creation and destruction.
-When this event is enabled,
-new LWPs will stop and report an event with
-.Dv PL_FLAG_BORN
-set before executing their first instruction,
-and exiting LWPs will stop and report an event with
-.Dv PL_FLAG_EXITED
-set before completing their termination.
-.Pp
-Note that new processes do not report an event for the creation of their
-initial thread,
-and exiting processes do not report an event for the termination of the
-last thread.
-.It Dv PTRACE_VFORK
-Report a stop event when a parent process resumes after a
-.Xr vfork 2 .
-.Pp
-When a thread in the traced process creates a new child process via
-.Xr vfork 2 ,
-the stop that reports
-.Dv PL_FLAG_FORKED
-and
-.Dv PL_FLAG_SCX
-occurs just after the child process is created,
-but before the thread waits for the child process to stop sharing process
-memory.
-If a debugger is not tracing the new child process,
-it must ensure that no breakpoints are enabled in the shared process
-memory before detaching from the new child process.
-This means that no breakpoints are enabled in the parent process either.
-.Pp
-The
-.Dv PTRACE_VFORK
-flag enables a new stop that indicates when the new child process stops
-sharing the process memory of the parent process.
-A debugger can reinsert breakpoints in the parent process and resume it
-in response to this event.
-This event is indicated by setting the
-.Dv PL_FLAG_VFORK_DONE
-flag.
-.El
-.Pp
-The default tracing event mask when attaching to a process via
-.Dv PT_ATTACH ,
-.Dv PT_TRACE_ME ,
-or
-.Dv PTRACE_FORK
-includes only
-.Dv PTRACE_EXEC
-events.
-All other event flags are disabled.
-.Sh PTRACE REQUESTS
-.Pp
-The
-.Fa request
-argument specifies what operation is being performed; the meaning of
-the rest of the arguments depends on the operation, but except for one
-special case noted below, all
-.Fn ptrace
-calls are made by the tracing process, and the
-.Fa pid
-argument specifies the process ID of the traced process
-or a corresponding thread ID.
-The
-.Fa request
-argument
-can be:
-.Bl -tag -width "Dv PT_GET_EVENT_MASK"
-.It Dv PT_TRACE_ME
-This request is the only one used by the traced process; it declares
-that the process expects to be traced by its parent.
-All the other arguments are ignored.
-(If the parent process does not expect to trace the child, it will
-probably be rather confused by the results; once the traced process
-stops, it cannot be made to continue except via
-.Fn ptrace . )
-When a process has used this request and calls
-.Xr execve 2
-or any of the routines built on it
-(such as
-.Xr execv 3 ) ,
-it will stop before executing the first instruction of the new image.
-Also, any setuid or setgid bits on the executable being executed will
-be ignored.
-If the child was created by
-.Xr vfork 2
-system call or
-.Xr rfork 2
-call with the
-.Dv RFMEM
-flag specified, the debugging events are reported to the parent
-only after the
-.Xr execve 2
-is executed.
-.It Dv PT_READ_I , Dv PT_READ_D
-These requests read a single
-.Vt int
-of data from the traced process's address space.
-Traditionally,
-.Fn ptrace
-has allowed for machines with distinct address spaces for instruction
-and data, which is why there are two requests: conceptually,
-.Dv PT_READ_I
-reads from the instruction space and
-.Dv PT_READ_D
-reads from the data space.
-In the current
-.Fx
-implementation, these two requests are completely identical.
-The
-.Fa addr
-argument specifies the address
-(in the traced process's virtual address space)
-at which the read is to be done.
-This address does not have to meet any alignment constraints.
-The value read is returned as the return value from
-.Fn ptrace .
-.It Dv PT_WRITE_I , Dv PT_WRITE_D
-These requests parallel
-.Dv PT_READ_I
-and
-.Dv PT_READ_D ,
-except that they write rather than read.
-The
-.Fa data
-argument supplies the value to be written.
-.It Dv PT_IO
-This request allows reading and writing arbitrary amounts of data in
-the traced process's address space.
-The
-.Fa addr
-argument specifies a pointer to a
-.Vt "struct ptrace_io_desc" ,
-which is defined as follows:
-.Bd -literal
-struct ptrace_io_desc {
- int piod_op; /* I/O operation */
- void *piod_offs; /* child offset */
- void *piod_addr; /* parent offset */
- size_t piod_len; /* request length */
-};
-
-/*
- * Operations in piod_op.
- */
-#define PIOD_READ_D 1 /* Read from D space */
-#define PIOD_WRITE_D 2 /* Write to D space */
-#define PIOD_READ_I 3 /* Read from I space */
-#define PIOD_WRITE_I 4 /* Write to I space */
-.Ed
-.Pp
-The
-.Fa data
-argument is ignored.
-The actual number of bytes read or written is stored in
-.Va piod_len
-upon return.
-.It Dv PT_CONTINUE
-The traced process continues execution.
-The
-.Fa addr
-argument
-is an address specifying the place where execution is to be resumed
-(a new value for the program counter),
-or
-.Po Vt caddr_t Pc Ns 1
-to indicate that execution is to pick up where it left off.
-The
-.Fa data
-argument
-provides a signal number to be delivered to the traced process as it
-resumes execution, or 0 if no signal is to be sent.
-.It Dv PT_STEP
-The traced process is single stepped one instruction.
-The
-.Fa addr
-argument
-should be passed
-.Po Vt caddr_t Pc Ns 1 .
-The
-.Fa data
-argument
-provides a signal number to be delivered to the traced process as it
-resumes execution, or 0 if no signal is to be sent.
-.It Dv PT_KILL
-The traced process terminates, as if
-.Dv PT_CONTINUE
-had been used with
-.Dv SIGKILL
-given as the signal to be delivered.
-.It Dv PT_ATTACH
-This request allows a process to gain control of an otherwise
-unrelated process and begin tracing it.
-It does not need any cooperation from the to-be-traced process.
-In
-this case,
-.Fa pid
-specifies the process ID of the to-be-traced process, and the other
-two arguments are ignored.
-This request requires that the target process must have the same real
-UID as the tracing process, and that it must not be executing a setuid
-or setgid executable.
-(If the tracing process is running as root, these restrictions do not
-apply.)
-The tracing process will see the newly-traced process stop and may
-then control it as if it had been traced all along.
-.It Dv PT_DETACH
-This request is like PT_CONTINUE, except that it does not allow
-specifying an alternate place to continue execution, and after it
-succeeds, the traced process is no longer traced and continues
-execution normally.
-.It Dv PT_GETREGS
-This request reads the traced process's machine registers into the
-.Do
-.Vt "struct reg"
-.Dc
-(defined in
-.In machine/reg.h )
-pointed to by
-.Fa addr .
-.It Dv PT_SETREGS
-This request is the converse of
-.Dv PT_GETREGS ;
-it loads the traced process's machine registers from the
-.Do
-.Vt "struct reg"
-.Dc
-(defined in
-.In machine/reg.h )
-pointed to by
-.Fa addr .
-.It Dv PT_GETFPREGS
-This request reads the traced process's floating-point registers into
-the
-.Do
-.Vt "struct fpreg"
-.Dc
-(defined in
-.In machine/reg.h )
-pointed to by
-.Fa addr .
-.It Dv PT_SETFPREGS
-This request is the converse of
-.Dv PT_GETFPREGS ;
-it loads the traced process's floating-point registers from the
-.Do
-.Vt "struct fpreg"
-.Dc
-(defined in
-.In machine/reg.h )
-pointed to by
-.Fa addr .
-.It Dv PT_GETDBREGS
-This request reads the traced process's debug registers into
-the
-.Do
-.Vt "struct dbreg"
-.Dc
-(defined in
-.In machine/reg.h )
-pointed to by
-.Fa addr .
-.It Dv PT_SETDBREGS
-This request is the converse of
-.Dv PT_GETDBREGS ;
-it loads the traced process's debug registers from the
-.Do
-.Vt "struct dbreg"
-.Dc
-(defined in
-.In machine/reg.h )
-pointed to by
-.Fa addr .
-.It Dv PT_LWPINFO
-This request can be used to obtain information about the kernel thread,
-also known as light-weight process, that caused the traced process to stop.
-The
-.Fa addr
-argument specifies a pointer to a
-.Vt "struct ptrace_lwpinfo" ,
-which is defined as follows:
-.Bd -literal
-struct ptrace_lwpinfo {
- lwpid_t pl_lwpid;
- int pl_event;
- int pl_flags;
- sigset_t pl_sigmask;
- sigset_t pl_siglist;
- siginfo_t pl_siginfo;
- char pl_tdname[MAXCOMLEN + 1];
- pid_t pl_child_pid;
- u_int pl_syscall_code;
- u_int pl_syscall_narg;
-};
-.Ed
-.Pp
-The
-.Fa data
-argument is to be set to the size of the structure known to the caller.
-This allows the structure to grow without affecting older programs.
-.Pp
-The fields in the
-.Vt "struct ptrace_lwpinfo"
-have the following meaning:
-.Bl -tag -width indent -compact
-.It Va pl_lwpid
-LWP id of the thread
-.It Va pl_event
-Event that caused the stop.
-Currently defined events are:
-.Bl -tag -width "Dv PL_EVENT_SIGNAL" -compact
-.It Dv PL_EVENT_NONE
-No reason given
-.It Dv PL_EVENT_SIGNAL
-Thread stopped due to the pending signal
-.El
-.It Va pl_flags
-Flags that specify additional details about observed stop.
-Currently defined flags are:
-.Bl -tag -width indent -compact
-.It Dv PL_FLAG_SCE
-The thread stopped due to system call entry, right after the kernel is entered.
-The debugger may examine syscall arguments that are stored in memory and
-registers according to the ABI of the current process, and modify them,
-if needed.
-.It Dv PL_FLAG_SCX
-The thread is stopped immediately before syscall is returning to the usermode.
-The debugger may examine system call return values in the ABI-defined registers
-and/or memory.
-.It Dv PL_FLAG_EXEC
-When
-.Dv PL_FLAG_SCX
-is set, this flag may be additionally specified to inform that the
-program being executed by debuggee process has been changed by successful
-execution of a system call from the
-.Fn execve 2
-family.
-.It Dv PL_FLAG_SI
-Indicates that
-.Va pl_siginfo
-member of
-.Vt "struct ptrace_lwpinfo"
-contains valid information.
-.It Dv PL_FLAG_FORKED
-Indicates that the process is returning from a call to
-.Fn fork 2
-that created a new child process.
-The process identifier of the new process is available in the
-.Va pl_child_pid
-member of
-.Vt "struct ptrace_lwpinfo" .
-.It Dv PL_FLAG_CHILD
-The flag is set for first event reported from a new child which is
-automatically attached when
-.Dv PTRACE_FORK
-is enabled.
-.It Dv PL_FLAG_BORN
-This flag is set for the first event reported from a new LWP when
-.Dv PTRACE_LWP
-is enabled.
-It is reported along with
-.Dv PL_FLAG_SCX .
-.It Dv PL_FLAG_EXITED
-This flag is set for the last event reported by an exiting LWP when
-.Dv PTRACE_LWP
-is enabled.
-Note that this event is not reported when the last LWP in a process exits.
-The termination of the last thread is reported via a normal process exit
-event.
-.It Dv PL_FLAG_VFORKED
-Indicates that the thread is returning from a call to
-.Xr vfork 2
-that created a new child process.
-This flag is set in addition to
-.Dv PL_FLAG_FORKED .
-.It Dv PL_FLAG_VFORK_DONE
-Indicates that the thread has resumed after a child process created via
-.Xr vfork 2
-has stopped sharing its address space with the traced process.
-.El
-.It Va pl_sigmask
-The current signal mask of the LWP
-.It Va pl_siglist
-The current pending set of signals for the LWP.
-Note that signals that are delivered to the process would not appear
-on an LWP siglist until the thread is selected for delivery.
-.It Va pl_siginfo
-The siginfo that accompanies the signal pending.
-Only valid for
-.Dv PL_EVENT_SIGNAL
-stop when
-.Dv PL_FLAG_SI
-is set in
-.Va pl_flags .
-.It Va pl_tdname
-The name of the thread.
-.It Va pl_child_pid
-The process identifier of the new child process.
-Only valid for a
-.Dv PL_EVENT_SIGNAL
-stop when
-.Dv PL_FLAG_FORKED
-is set in
-.Va pl_flags .
-.It Va pl_syscall_code
-The ABI-specific identifier of the current system call.
-Note that for indirect system calls this field reports the indirected
-system call.
-Only valid when
-.Dv PL_FLAG_SCE
-or
-.Dv PL_FLAG_SCX
-is set in
-.Va pl_flags .
-.It Va pl_syscall_narg
-The number of arguments passed to the current system call not counting
-the system call identifier.
-Note that for indirect system calls this field reports the arguments
-passed to the indirected system call.
-Only valid when
-.Dv PL_FLAG_SCE
-or
-.Dv PL_FLAG_SCX
-is set in
-.Va pl_flags .
-.El
-.It Dv PT_GETNUMLWPS
-This request returns the number of kernel threads associated with the
-traced process.
-.It Dv PT_GETLWPLIST
-This request can be used to get the current thread list.
-A pointer to an array of type
-.Vt lwpid_t
-should be passed in
-.Fa addr ,
-with the array size specified by
-.Fa data .
-The return value from
-.Fn ptrace
-is the count of array entries filled in.
-.It Dv PT_SETSTEP
-This request will turn on single stepping of the specified process.
-Stepping is automatically disabled when a single step trap is caught.
-.It Dv PT_CLEARSTEP
-This request will turn off single stepping of the specified process.
-.It Dv PT_SUSPEND
-This request will suspend the specified thread.
-.It Dv PT_RESUME
-This request will resume the specified thread.
-.It Dv PT_TO_SCE
-This request will set the
-.Dv PTRACE_SCE
-event flag to trace all future system call entries and continue the process.
-The
-.Fa addr
-and
-.Fa data
-arguments are used the same as for
-.Dv PT_CONTINUE .
-.It Dv PT_TO_SCX
-This request will set the
-.Dv PTRACE_SCX
-event flag to trace all future system call exits and continue the process.
-The
-.Fa addr
-and
-.Fa data
-arguments are used the same as for
-.Dv PT_CONTINUE .
-.It Dv PT_SYSCALL
-This request will set the
-.Dv PTRACE_SYSCALL
-event flag to trace all future system call entries and exits and continue
-the process.
-The
-.Fa addr
-and
-.Fa data
-arguments are used the same as for
-.Dv PT_CONTINUE .
-.It Dv PT_GET_SC_ARGS
-For the thread which is stopped in either
-.Dv PL_FLAG_SCE
-or
-.Dv PL_FLAG_SCX
-state, that is, on entry or exit to a syscall,
-this request fetches the syscall arguments.
-.Pp
-The arguments are copied out into the buffer pointed to by the
-.Fa addr
-pointer, sequentially.
-Each syscall argument is stored as the machine word.
-Kernel copies out as many arguments as the syscall accepts,
-see the
-.Va pl_syscall_narg
-member of the
-.Vt struct ptrace_lwpinfo ,
-but not more than the
-.Fa data
-bytes in total are copied.
-.It Dv PT_GET_SC_RET
-Fetch the system call return values on exit from a syscall.
-This request is only valid for threads stopped in a syscall
-exit (the
-.Dv PL_FLAG_SCX
-state).
-The
-.Fa addr
-argument specifies a pointer to a
-.Vt "struct ptrace_sc_ret" ,
-which is defined as follows:
-.Bd -literal
-struct ptrace_sc_ret {
- register_t sr_retval[2];
- int sr_error;
-};
-.Ed
-.Pp
-The
-.Fa data
-argument is set to the size of the structure.
-.Pp
-If the system call completed successfully,
-.Va sr_error
-is set to zero and the return values of the system call are saved in
-.Va sr_retval .
-If the system call failed to execute,
-.Va sr_error
-field is set to a positive
-.Xr errno 2
-value.
-If the system call completed in an unusual fashion,
-.Va sr_error
-is set to a negative value:
-.Bl -tag -width Dv EJUSTRETURN -compact
-.It Dv ERESTART
-System call will be restarted.
-.It Dv EJUSTRETURN
-System call completed sucessfully but did not set a return value
-.Po for example,
-.Xr setcontext 2
-and
-.Xr sigreturn 2
-.Pc .
-.El
-.It Dv PT_FOLLOW_FORK
-This request controls tracing for new child processes of a traced process.
-If
-.Fa data
-is non-zero,
-.Dv PTRACE_FORK
-is set in the traced process's event tracing mask.
-If
-.Fa data
-is zero,
-.Dv PTRACE_FORK
-is cleared from the traced process's event tracing mask.
-.It Dv PT_LWP_EVENTS
-This request controls tracing of LWP creation and destruction.
-If
-.Fa data
-is non-zero,
-.Dv PTRACE_LWP
-is set in the traced process's event tracing mask.
-If
-.Fa data
-is zero,
-.Dv PTRACE_LWP
-is cleared from the traced process's event tracing mask.
-.It Dv PT_GET_EVENT_MASK
-This request reads the traced process's event tracing mask into the
-integer pointed to by
-.Fa addr .
-The size of the integer must be passed in
-.Fa data .
-.It Dv PT_SET_EVENT_MASK
-This request sets the traced process's event tracing mask from the
-integer pointed to by
-.Fa addr .
-The size of the integer must be passed in
-.Fa data .
-.It Dv PT_VM_TIMESTAMP
-This request returns the generation number or timestamp of the memory map of
-the traced process as the return value from
-.Fn ptrace .
-This provides a low-cost way for the tracing process to determine if the
-VM map changed since the last time this request was made.
-.It Dv PT_VM_ENTRY
-This request is used to iterate over the entries of the VM map of the traced
-process.
-The
-.Fa addr
-argument specifies a pointer to a
-.Vt "struct ptrace_vm_entry" ,
-which is defined as follows:
-.Bd -literal
-struct ptrace_vm_entry {
- int pve_entry;
- int pve_timestamp;
- u_long pve_start;
- u_long pve_end;
- u_long pve_offset;
- u_int pve_prot;
- u_int pve_pathlen;
- long pve_fileid;
- uint32_t pve_fsid;
- char *pve_path;
-};
-.Ed
-.Pp
-The first entry is returned by setting
-.Va pve_entry
-to zero.
-Subsequent entries are returned by leaving
-.Va pve_entry
-unmodified from the value returned by previous requests.
-The
-.Va pve_timestamp
-field can be used to detect changes to the VM map while iterating over the
-entries.
-The tracing process can then take appropriate action, such as restarting.
-By setting
-.Va pve_pathlen
-to a non-zero value on entry, the pathname of the backing object is returned
-in the buffer pointed to by
-.Va pve_path ,
-provided the entry is backed by a vnode.
-The
-.Va pve_pathlen
-field is updated with the actual length of the pathname (including the
-terminating null character).
-The
-.Va pve_offset
-field is the offset within the backing object at which the range starts.
-The range is located in the VM space at
-.Va pve_start
-and extends up to
-.Va pve_end
-(inclusive).
-.Pp
-The
-.Fa data
-argument is ignored.
-.It Dv PT_COREDUMP
-This request creates a coredump for the stopped program.
-The
-.Fa addr
-argument specifies a pointer to a
-.Vt "struct ptrace_coredump" ,
-which is defined as follows:
-.Bd -literal
-struct ptrace_coredump {
- int pc_fd;
- uint32_t pc_flags;
- off_t pc_limit;
-};
-.Ed
-The fields of the structure are:
-.Bl -tag -width pc_flags
-.It Dv pc_fd
-File descriptor to write the dump to.
-It must refer to a regular file, opened for writing.
-.It Dv pc_flags
-Flags.
-The following flags are defined:
-.Bl -tag -width PC_COMPRESS
-.It Dv PC_COMPRESS
-Request compression of the dump.
-.It Dv PC_ALL
-Include non-dumpable entries into the dump.
-The dumper ignores
-.Dv MAP_NOCORE
-flag of the process map entry, but device mappings are not dumped even with
-.Dv PC_ALL
-set.
-.El
-.It Dv pc_limit
-Maximum size of the coredump.
-Specify zero for no limit.
-.El
-.Pp
-The size of
-.Vt "struct ptrace_coredump"
-must be passed in
-.Fa data .
-.Pp
-The process must be stopped before dumping core.
-A single thread in the target process is temporarily unsuspended
-in kernel to write the dump.
-If the
-.Nm
-call fails before a thread is unsuspended, there is no event to
-.Xr waitpid 2
-for.
-If a thread was unsuspended, it will stop again before the
-.Nm
-call returns, and the process must be waited upon using
-.Xr waitpid 2
-to consume the new stop event.
-Since it is hard to deduce whether a thread was unsuspended before
-an error occurred, it is recommended to unconditionally perform
-.Xr waitpid 2
-with
-.Dv WNOHANG
-flag after
-.Dv PT_COREDUMP ,
-and silently accept zero result from it.
-.El
-.Sh ARM MACHINE-SPECIFIC REQUESTS
-.Bl -tag -width "Dv PT_SETVFPREGS"
-.It Dv PT_GETVFPREGS
-Return the thread's
-.Dv VFP
-machine state in the buffer pointed to by
-.Fa addr .
-.Pp
-The
-.Fa data
-argument is ignored.
-.It Dv PT_SETVFPREGS
-Set the thread's
-.Dv VFP
-machine state from the buffer pointed to by
-.Fa addr .
-.Pp
-The
-.Fa data
-argument is ignored.
-.El
-.Sh x86 MACHINE-SPECIFIC REQUESTS
-.Bl -tag -width "Dv PT_GETXSTATE_INFO"
-.It Dv PT_GETXMMREGS
-Copy the XMM FPU state into the buffer pointed to by the
-argument
-.Fa addr .
-The buffer has the same layout as the 32-bit save buffer for the
-machine instruction
-.Dv FXSAVE .
-.Pp
-This request is only valid for i386 programs, both on native 32-bit
-systems and on amd64 kernels.
-For 64-bit amd64 programs, the XMM state is reported as part of
-the FPU state returned by the
-.Dv PT_GETFPREGS
-request.
-.Pp
-The
-.Fa data
-argument is ignored.
-.It Dv PT_SETXMMREGS
-Load the XMM FPU state for the thread from the buffer pointed to
-by the argument
-.Fa addr .
-The buffer has the same layout as the 32-bit load buffer for the
-machine instruction
-.Dv FXRSTOR .
-.Pp
-As with
-.Dv PT_GETXMMREGS ,
-this request is only valid for i386 programs.
-.Pp
-The
-.Fa data
-argument is ignored.
-.It Dv PT_GETXSTATE_INFO
-Report which XSAVE FPU extensions are supported by the CPU
-and allowed in userspace programs.
-The
-.Fa addr
-argument must point to a variable of type
-.Vt struct ptrace_xstate_info ,
-which contains the information on the request return.
-.Vt struct ptrace_xstate_info
-is defined as follows:
-.Bd -literal
-struct ptrace_xstate_info {
- uint64_t xsave_mask;
- uint32_t xsave_len;
-};
-.Ed
-The
-.Dv xsave_mask
-field is a bitmask of the currently enabled extensions.
-The meaning of the bits is defined in the Intel and AMD
-processor documentation.
-The
-.Dv xsave_len
-field reports the length of the XSAVE area for storing the hardware
-state for currently enabled extensions in the format defined by the x86
-.Dv XSAVE
-machine instruction.
-.Pp
-The
-.Fa data
-argument value must be equal to the size of the
-.Vt struct ptrace_xstate_info .
-.It Dv PT_GETXSTATE
-Return the content of the XSAVE area for the thread.
-The
-.Fa addr
-argument points to the buffer where the content is copied, and the
-.Fa data
-argument specifies the size of the buffer.
-The kernel copies out as much content as allowed by the buffer size.
-The buffer layout is specified by the layout of the save area for the
-.Dv XSAVE
-machine instruction.
-.It Dv PT_SETXSTATE
-Load the XSAVE state for the thread from the buffer specified by the
-.Fa addr
-pointer.
-The buffer size is passed in the
-.Fa data
-argument.
-The buffer must be at least as large as the
-.Vt struct savefpu
-(defined in
-.Pa x86/fpu.h )
-to allow the complete x87 FPU and XMM state load.
-It must not be larger than the XSAVE state length, as reported by the
-.Dv xsave_len
-field from the
-.Vt struct ptrace_xstate_info
-of the
-.Dv PT_GETXSTATE_INFO
-request.
-Layout of the buffer is identical to the layout of the load area for the
-.Dv XRSTOR
-machine instruction.
-.It Dv PT_GETFSBASE
-Return the value of the base used when doing segmented
-memory addressing using the %fs segment register.
-The
-.Fa addr
-argument points to an
-.Vt unsigned long
-variable where the base value is stored.
-.Pp
-The
-.Fa data
-argument is ignored.
-.It Dv PT_GETGSBASE
-Like the
-.Dv PT_GETFSBASE
-request, but returns the base for the %gs segment register.
-.It Dv PT_SETFSBASE
-Set the base for the %fs segment register to the value pointed to
-by the
-.Fa addr
-argument.
-.Fa addr
-must point to the
-.Vt unsigned long
-variable containing the new base.
-.Pp
-The
-.Fa data
-argument is ignored.
-.It Dv PT_SETGSBASE
-Like the
-.Dv PT_SETFSBASE
-request, but sets the base for the %gs segment register.
-.El
-.Sh PowerPC MACHINE-SPECIFIC REQUESTS
-.Bl -tag -width "Dv PT_SETVRREGS"
-.It Dv PT_GETVRREGS
-Return the thread's
-.Dv ALTIVEC
-machine state in the buffer pointed to by
-.Fa addr .
-.Pp
-The
-.Fa data
-argument is ignored.
-.It Dv PT_SETVRREGS
-Set the thread's
-.Dv ALTIVEC
-machine state from the buffer pointed to by
-.Fa addr .
-.Pp
-The
-.Fa data
-argument is ignored.
-.It Dv PT_GETVSRREGS
-Return doubleword 1 of the thread's
-.Dv VSX
-registers VSR0-VSR31 in the buffer pointed to by
-.Fa addr .
-.Pp
-The
-.Fa data
-argument is ignored.
-.It Dv PT_SETVSRREGS
-Set doubleword 1 of the thread's
-.Dv VSX
-registers VSR0-VSR31 from the buffer pointed to by
-.Fa addr .
-.Pp
-The
-.Fa data
-argument is ignored.
-.El
-.Pp
-Additionally, other machine-specific requests can exist.
-.Sh RETURN VALUES
-Most requests return 0 on success and \-1 on error.
-Some requests can cause
-.Fn ptrace
-to return
-\-1
-as a non-error value, among them are
-.Dv PT_READ_I
-and
-.Dv PT_READ_D ,
-which return the value read from the process memory on success.
-To disambiguate,
-.Va errno
-can be set to 0 before the call and checked afterwards.
-.Pp
-The current
-.Fn ptrace
-implementation always sets
-.Va errno
-to 0 before calling into the kernel, both for historic reasons and for
-consistency with other operating systems.
-It is recommended to assign zero to
-.Va errno
-explicitly for forward compatibility.
-.Sh ERRORS
-The
-.Fn ptrace
-system call may fail if:
-.Bl -tag -width Er
-.It Bq Er ESRCH
-.Bl -bullet -compact
-.It
-No process having the specified process ID exists.
-.El
-.It Bq Er EINVAL
-.Bl -bullet -compact
-.It
-A process attempted to use
-.Dv PT_ATTACH
-on itself.
-.It
-The
-.Fa request
-argument
-was not one of the legal requests.
-.It
-The signal number
-(in
-.Fa data )
-to
-.Dv PT_CONTINUE
-was neither 0 nor a legal signal number.
-.It
-.Dv PT_GETREGS ,
-.Dv PT_SETREGS ,
-.Dv PT_GETFPREGS ,
-.Dv PT_SETFPREGS ,
-.Dv PT_GETDBREGS ,
-or
-.Dv PT_SETDBREGS
-was attempted on a process with no valid register set.
-(This is normally true only of system processes.)
-.It
-.Dv PT_VM_ENTRY
-was given an invalid value for
-.Fa pve_entry .
-This can also be caused by changes to the VM map of the process.
-.It
-The size (in
-.Fa data )
-provided to
-.Dv PT_LWPINFO
-was less than or equal to zero, or larger than the
-.Vt ptrace_lwpinfo
-structure known to the kernel.
-.It
-The size (in
-.Fa data )
-provided to the x86-specific
-.Dv PT_GETXSTATE_INFO
-request was not equal to the size of the
-.Vt struct ptrace_xstate_info .
-.It
-The size (in
-.Fa data )
-provided to the x86-specific
-.Dv PT_SETXSTATE
-request was less than the size of the x87 plus the XMM save area.
-.It
-The size (in
-.Fa data )
-provided to the x86-specific
-.Dv PT_SETXSTATE
-request was larger than returned in the
-.Dv xsave_len
-member of the
-.Vt struct ptrace_xstate_info
-from the
-.Dv PT_GETXSTATE_INFO
-request.
-.It
-The base value, provided to the amd64-specific requests
-.Dv PT_SETFSBASE
-or
-.Dv PT_SETGSBASE ,
-pointed outside of the valid user address space.
-This error will not occur in 32-bit programs.
-.El
-.It Bq Er EBUSY
-.Bl -bullet -compact
-.It
-.Dv PT_ATTACH
-was attempted on a process that was already being traced.
-.It
-A request attempted to manipulate a process that was being traced by
-some process other than the one making the request.
-.It
-A request
-(other than
-.Dv PT_ATTACH )
-specified a process that was not stopped.
-.El
-.It Bq Er EPERM
-.Bl -bullet -compact
-.It
-A request
-(other than
-.Dv PT_ATTACH )
-attempted to manipulate a process that was not being traced at all.
-.It
-An attempt was made to use
-.Dv PT_ATTACH
-on a process in violation of the requirements listed under
-.Dv PT_ATTACH
-above.
-.El
-.It Bq Er ENOENT
-.Bl -bullet -compact
-.It
-.Dv PT_VM_ENTRY
-previously returned the last entry of the memory map.
-No more entries exist.
-.El
-.It Bq Er ENOMEM
-.Bl -bullet -compact
-.It
-A
-.Dv PT_READ_I,
-.Dv PT_READ_D,
-.Dv PT_WRITE_I, or
-.Dv PT_WRITE_D
-request attempted to access an invalid address, or a memory allocation failure
-occurred when accessing process memory.
-.El
-.It Bq Er ENAMETOOLONG
-.Bl -bullet -compact
-.It
-.Dv PT_VM_ENTRY
-cannot return the pathname of the backing object because the buffer is not big
-enough.
-.Fa pve_pathlen
-holds the minimum buffer size required on return.
-.El
-.El
-.Sh SEE ALSO
-.Xr execve 2 ,
-.Xr sigaction 2 ,
-.Xr wait 2 ,
-.Xr execv 3 ,
-.Xr i386_clr_watch 3 ,
-.Xr i386_set_watch 3
-.Sh HISTORY
-The
-.Fn ptrace
-function appeared in
-.At v6 .
diff --git a/lib/libc/sys/quotactl.2 b/lib/libc/sys/quotactl.2
deleted file mode 100644
index 0ab87324575d..000000000000
--- a/lib/libc/sys/quotactl.2
+++ /dev/null
@@ -1,263 +0,0 @@
-.\" Copyright (c) 1983, 1990, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Robert Elz at The University of Melbourne.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)quotactl.2 8.2 (Berkeley) 3/10/95
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2020
-.Dt QUOTACTL 2
-.Os
-.Sh NAME
-.Nm quotactl
-.Nd manipulate file system quotas
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In ufs/ufs/quota.h
-.Ft int
-.Fn quotactl "const char *path" "int cmd" "int id" "void *addr"
-.Sh DESCRIPTION
-The
-.Fn quotactl
-system call enables, disables and
-manipulates file system quotas.
-A quota control command
-given by
-.Fa cmd
-operates on the given filename
-.Fa path
-for the given user or group
-.Fa id .
-(NOTE: One should use the QCMD macro defined in
-.In ufs/ufs/quota.h
-to formulate the value for
-.Fa cmd . )
-The address of an optional command specific data structure,
-.Fa addr ,
-may be given; its interpretation
-is discussed below with each command.
-.Pp
-For commands that use the
-.Fa id
-identifier, it must be either -1 or any positive value.
-The value of -1 indicates that the current UID or GID should be used.
-Any other negative value will return an error.
-.Pp
-Currently quotas are supported only for the
-.Dq ufs
-file system.
-For
-.Dq ufs ,
-a command is composed of a primary command (see below)
-and a command type used to interpret the
-.Fa id .
-Types are supported for interpretation of user identifiers (USRQUOTA)
-and group identifiers (GRPQUOTA).
-The
-.Dq ufs
-specific commands are:
-.Bl -tag -width Q_GETQUOTASIZEx
-.It Dv Q_QUOTAON
-Enable disk quotas for the file system specified by
-.Fa path .
-The command type specifies the type of the quotas being enabled.
-The
-.Fa addr
-argument specifies a file from which to take the quotas.
-The quota file must exist;
-it is normally created with the
-.Xr quotacheck 8
-program.
-The
-.Fa id
-argument is unused.
-Only the super-user may turn quotas on.
-.It Dv Q_QUOTAOFF
-Disable disk quotas for the file system specified by
-.Fa path .
-The command type specifies the type of the quotas being disabled.
-The
-.Fa addr
-and
-.Fa id
-arguments are unused.
-Only the super-user may turn quotas off.
-.It Dv Q_GETQUOTASIZE
-Get the wordsize used to represent the quotas for the user or group
-(as determined by the command type).
-Possible values are 32 for the old-style quota file
-and 64 for the new-style quota file.
-The
-.Fa addr
-argument is a pointer to an integer into which the size is stored.
-The identifier
-.Fa id
-is not used.
-.It Dv Q_GETQUOTA
-Get disk quota limits and current usage for the user or group
-(as determined by the command type) with identifier
-.Fa id .
-The
-.Fa addr
-argument
-is a pointer to a
-.Fa struct dqblk
-structure (defined in
-.In ufs/ufs/quota.h ) .
-.It Dv Q_SETQUOTA
-Set disk quota limits for the user or group
-(as determined by the command type) with identifier
-.Fa id .
-The
-.Fa addr
-argument
-is a pointer to a
-.Fa struct dqblk
-structure (defined in
-.In ufs/ufs/quota.h ) .
-The usage fields of the
-.Fa dqblk
-structure are ignored.
-This system call is restricted to the super-user.
-.It Dv Q_SETUSE
-Set disk usage limits for the user or group
-(as determined by the command type) with identifier
-.Fa id .
-The
-.Fa addr
-argument
-is a pointer to a
-.Fa struct dqblk
-structure (defined in
-.In ufs/ufs/quota.h ) .
-Only the usage fields are used.
-This system call is restricted to the super-user.
-.It Dv Q_SYNC
-Update the on-disk copy of quota usages.
-The command type specifies which type of quotas are to be updated.
-The
-.Fa id
-and
-.Fa addr
-arguments are ignored.
-.El
-.Sh RETURN VALUES
-.Rv -std quotactl
-.Sh ERRORS
-The
-.Fn quotactl
-system call will fail if:
-.Bl -tag -width Er
-.It Bq Er EOPNOTSUPP
-The kernel has not been compiled with the
-.Dv QUOTA
-option.
-.It Bq Er EUSERS
-The quota table cannot be expanded.
-.It Bq Er EINVAL
-The
-.Fa cmd
-argument
-or the command type is invalid.
-In
-.Dv Q_GETQUOTASIZE ,
-.Dv Q_GETQUOTA ,
-.Dv Q_SETQUOTA ,
-and
-.Dv Q_SETUSE ,
-quotas are not currently enabled for this file system.
-.Pp
-The
-.Fa id
-argument to
-.Dv Q_GETQUOTA ,
-.Dv Q_SETQUOTA
-or
-.Dv Q_SETUSE
-is a negative value.
-.It Bq Er EACCES
-In
-.Dv Q_QUOTAON ,
-the quota file is not a plain file.
-.It Bq Er EACCES
-Search permission is denied for a component of a path prefix.
-.It Bq Er ENOTDIR
-A component of a path prefix was not a directory.
-.It Bq Er ENAMETOOLONG
-A component of either pathname exceeded 255 characters,
-or the entire length of either path name exceeded 1023 characters.
-.It Bq Er ENOENT
-A filename does not exist.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating a pathname.
-.It Bq Er EROFS
-In
-.Dv Q_QUOTAON ,
-either the file system on which quotas are to be enabled is mounted read-only
-or the quota file resides on a read-only file system.
-.It Bq Er EIO
-An
-.Tn I/O
-error occurred while reading from or writing
-to a file containing quotas.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.It Bq Er EFAULT
-An invalid
-.Fa addr
-was supplied; the associated structure could not be copied in or out
-of the kernel.
-.It Bq Er EFAULT
-The
-.Fa path
-argument
-points outside the process's allocated address space.
-.It Bq Er EPERM
-The call was privileged and the caller was not the super-user.
-.El
-.Sh SEE ALSO
-.Xr quota 1 ,
-.Xr fstab 5 ,
-.Xr edquota 8 ,
-.Xr quotacheck 8 ,
-.Xr quotaon 8 ,
-.Xr repquota 8
-.Sh HISTORY
-The
-.Fn quotactl
-system call appeared in
-.Bx 4.3 Reno .
-.Sh BUGS
-There should be some way to integrate this call with the resource
-limit interface provided by
-.Xr setrlimit 2
-and
-.Xr getrlimit 2 .
diff --git a/lib/libc/sys/rctl_add_rule.2 b/lib/libc/sys/rctl_add_rule.2
deleted file mode 100644
index b1d807baa80c..000000000000
--- a/lib/libc/sys/rctl_add_rule.2
+++ /dev/null
@@ -1,220 +0,0 @@
-.\" Copyright (c) 2016 Eric Badger
-.\" All rights reserved.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd September 14, 2016
-.Dt RCTL_ADD_RULE 2
-.Os
-.Sh NAME
-.Nm rctl_add_rule ,
-.Nm rctl_get_limits ,
-.Nm rctl_get_racct ,
-.Nm rctl_get_rules ,
-.Nm rctl_remove_rule
-.Nd manipulate and query the resource limits database
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/rctl.h
-.Ft int
-.Fo rctl_add_rule
-.Fa "const char *inbufp" "size_t inbuflen" "char *outbufp" "size_t outbuflen"
-.Fc
-.Ft int
-.Fo rctl_get_limits
-.Fa "const char *inbufp" "size_t inbuflen" "char *outbufp" "size_t outbuflen"
-.Fc
-.Ft int
-.Fo rctl_get_racct
-.Fa "const char *inbufp" "size_t inbuflen" "char *outbufp" "size_t outbuflen"
-.Fc
-.Ft int
-.Fo rctl_get_rules
-.Fa "const char *inbufp" "size_t inbuflen" "char *outbufp" "size_t outbuflen"
-.Fc
-.Ft int
-.Fo rctl_remove_rule
-.Fa "const char *inbufp" "size_t inbuflen" "char *outbufp" "size_t outbuflen"
-.Fc
-.Sh DESCRIPTION
-These system calls are used to manipulate and query the resource limits
-database.
-For all functions,
-.Fa inbuflen
-refers to the length of the buffer pointed to by
-.Fa inbufp
-and
-.Fa outbuflen
-refers to the length of the buffer pointed to by
-.Fa outbufp .
-.Pp
-The
-.Fn rctl_add_rule
-function adds the rule pointed to by
-.Fa inbufp
-to the resource limits database.
-The
-.Fa outbufp
-and
-.Fa outbuflen
-arguments are unused.
-Rule format is as described in
-.Xr rctl 8 ,
-with exceptions noted in the
-.Sx RULES AND FILTERS
-section.
-.Pp
-The
-.Fn rctl_get_limits
-function returns in
-.Fa outbufp
-a comma-separated list of rules that apply to the process that
-matches the filter specified in
-.Fa inbufp .
-This includes rules with a subject of the process itself as well as rules
-with a different subject (such as user or loginclass) that apply to the
-process.
-.Pp
-The
-.Fn rctl_get_racct
-function returns resource usage information for a given subject.
-The subject is specified by passing a filter in
-.Fa inbufp .
-Filter syntax is as described in
-.Xr rctl 8 ,
-with exceptions noted in the
-.Sx RULES AND FILTERS
-section.
-A comma-separated list of resources and the amount used of each by the
-specified subject is returned in
-.Fa outbufp .
-The resource and amount is formatted as
-.Qq resource=amount .
-.Pp
-The
-.Fn rctl_get_rules
-function returns in
-.Fa outbufp
-a comma-separated list of rules from the resource limits database that
-match the filter passed in
-.Fa inbufp .
-Filter syntax is as described in
-.Xr rctl 8 ,
-with exceptions noted in the
-.Sx RULES AND FILTERS
-section.
-A filter of
-.Va ::
-may be passed to return all rules.
-.Pp
-The
-.Fn rctl_remove_rule
-function removes all rules matching the filter passed in
-.Fa inbufp
-from the resource limits database.
-Filter syntax is as described in
-.Xr rctl 8 ,
-with exceptions noted in the
-.Sx RULES AND FILTERS
-section.
-.Fa outbufp
-and
-.Fa outbuflen
-are unused.
-.Sh RULES AND FILTERS
-This section explains how the rule and filter format described in
-.Xr rctl 8
-differs from the format passed to the system calls themselves.
-The rctl tool provides several conveniences that the system calls do not.
-When using the system call:
-.Bl -dash -offset indent
-.It
-The subject must be fully specified.
-For example, abbreviating
-.Ql user
-to
-.Ql u
-is not acceptable.
-.It
-User and group IDs must be numeric.
-For example,
-.Ql root
-must be expressed as
-.Ql 0 .
-.It
-Units are not permitted on resource amounts.
-For example, a quantity of 1024 bytes must be expressed as
-.Ql 1024
-and not
-.Ql 1k .
-.El
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-The rctl system calls may fail if:
-.Bl -tag -width Er
-.It Bq Er ENOSYS
-RACCT/RCTL support is not present in the kernel or the
-.Va kern.racct.enable
-sysctl is 0.
-.It Bq Er EINVAL
-The rule or filter passed in
-.Fa inbufp
-is invalid.
-.It Bq Er EPERM
-User has insufficient privileges to carry out the requested operation.
-.It Bq Er E2BIG
-.Fa inbufp
-or
-.Fa outbufp
-are too large.
-.It Bq Er ESRCH
-No process matched the provided rule or filter.
-.It Bq Er ENAMETOOLONG
-The loginclass or jail name specified is too long.
-.It Bq Er ERANGE
-The rule amount is outside of the allowable range or
-.Fa outbufp
-is too small.
-.It Bq Er EOPNOTSUPP
-The requested operation is not supported for the given rule or filter.
-.It Bq Er EFAULT
-.Fa inbufp
-or
-.Fa outbufp
-refer to invalid addresses.
-.El
-.Sh SEE ALSO
-.Xr rctl 8
-.Sh HISTORY
-The rctl family of system calls appeared in
-.Fx 9.0 .
-.Sh AUTHORS
-.An -nosplit
-The rctl system calls were developed by
-.An Edward Tomasz Napierala Aq Mt trasz@FreeBSD.org
-under sponsorship from the FreeBSD Foundation.
-This manual page was written by
-.An Eric Badger Aq Mt badger@FreeBSD.org .
diff --git a/lib/libc/sys/read.2 b/lib/libc/sys/read.2
deleted file mode 100644
index 8b58debd3fbb..000000000000
--- a/lib/libc/sys/read.2
+++ /dev/null
@@ -1,310 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)read.2 8.4 (Berkeley) 2/26/94
-.\" $FreeBSD$
-.\"
-.Dd June 4, 2020
-.Dt READ 2
-.Os
-.Sh NAME
-.Nm read ,
-.Nm readv ,
-.Nm pread ,
-.Nm preadv
-.Nd read input
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft ssize_t
-.Fn read "int fd" "void *buf" "size_t nbytes"
-.Ft ssize_t
-.Fn pread "int fd" "void *buf" "size_t nbytes" "off_t offset"
-.In sys/uio.h
-.Ft ssize_t
-.Fn readv "int fd" "const struct iovec *iov" "int iovcnt"
-.Ft ssize_t
-.Fn preadv "int fd" "const struct iovec *iov" "int iovcnt" "off_t offset"
-.Sh DESCRIPTION
-The
-.Fn read
-system call
-attempts to read
-.Fa nbytes
-of data from the object referenced by the descriptor
-.Fa fd
-into the buffer pointed to by
-.Fa buf .
-The
-.Fn readv
-system call
-performs the same action, but scatters the input data
-into the
-.Fa iovcnt
-buffers specified by the members of the
-.Fa iov
-array: iov[0], iov[1], ..., iov[iovcnt\|\-\|1].
-The
-.Fn pread
-and
-.Fn preadv
-system calls
-perform the same functions, but read from the specified position in
-the file without modifying the file pointer.
-.Pp
-For
-.Fn readv
-and
-.Fn preadv ,
-the
-.Fa iovec
-structure is defined as:
-.Pp
-.Bd -literal -offset indent -compact
-struct iovec {
- void *iov_base; /* Base address. */
- size_t iov_len; /* Length. */
-};
-.Ed
-.Pp
-Each
-.Fa iovec
-entry specifies the base address and length of an area
-in memory where data should be placed.
-The
-.Fn readv
-system call
-will always fill an area completely before proceeding
-to the next.
-.Pp
-On objects capable of seeking, the
-.Fn read
-starts at a position
-given by the pointer associated with
-.Fa fd
-(see
-.Xr lseek 2 ) .
-Upon return from
-.Fn read ,
-the pointer is incremented by the number of bytes actually read.
-.Pp
-Objects that are not capable of seeking always read from the current
-position.
-The value of the pointer associated with such an
-object is undefined.
-.Pp
-Upon successful completion,
-.Fn read ,
-.Fn readv ,
-.Fn pread
-and
-.Fn preadv
-return the number of bytes actually read and placed in the buffer.
-The system guarantees to read the number of bytes requested if
-the descriptor references a normal file that has that many bytes left
-before the end-of-file, but in no other case.
-.Pp
-In accordance with
-.St -p1003.1-2004 ,
-both
-.Xr read 2
-and
-.Xr write 2
-syscalls are atomic with respect to each other in the effects on file
-content, when they operate on regular files.
-If two threads each call one of the
-.Xr read 2
-or
-.Xr write 2 ,
-syscalls, each call will see either all of the changes of the other call,
-or none of them.
-The
-.Fx
-kernel implements this guarantee by locking the file ranges affected by
-the calls.
-.Sh RETURN VALUES
-If successful, the
-number of bytes actually read is returned.
-Upon reading end-of-file,
-zero is returned.
-Otherwise, a -1 is returned and the global variable
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-The
-.Fn read ,
-.Fn readv ,
-.Fn pread
-and
-.Fn preadv
-system calls
-will succeed unless:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa fd
-argument
-is not a valid file or socket descriptor open for reading.
-.It Bq Er ECONNRESET
-The
-.Fa fd
-argument refers to a socket, and the remote socket end is
-forcibly closed.
-.It Bq Er EFAULT
-The
-.Fa buf
-argument
-points outside the allocated address space.
-.It Bq Er EIO
-An I/O error occurred while reading from the file system.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.It Bq Er EBUSY
-Failed to read from a file, e.g. /proc/<pid>/regs while <pid> is not stopped
-.It Bq Er EINTR
-A read from a slow device
-(i.e.\& one that might block for an arbitrary amount of time)
-was interrupted by the delivery of a signal
-before any data arrived.
-.It Bq Er EINVAL
-The pointer associated with
-.Fa fd
-was negative.
-.It Bq Er EAGAIN
-The file was marked for non-blocking I/O,
-and no data were ready to be read.
-.It Bq Er EISDIR
-The file descriptor is associated with a directory.
-Directories may only be read directly by root if the filesystem supports it and
-the
-.Dv security.bsd.allow_read_dir
-sysctl MIB is set to a non-zero value.
-For most scenarios, the
-.Xr readdir 3
-function should be used instead.
-.It Bq Er EOPNOTSUPP
-The file descriptor is associated with a file system and file type that
-do not allow regular read operations on it.
-.It Bq Er EOVERFLOW
-The file descriptor is associated with a regular file,
-.Fa nbytes
-is greater than 0,
-.Fa offset
-is before the end-of-file, and
-.Fa offset
-is greater than or equal to the offset maximum established
-for this file system.
-.It Bq Er EINVAL
-The value
-.Fa nbytes
-is greater than
-.Dv INT_MAX .
-.El
-.Pp
-In addition,
-.Fn readv
-and
-.Fn preadv
-may return one of the following errors:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Fa iovcnt
-argument
-was less than or equal to 0, or greater than
-.Dv IOV_MAX .
-.It Bq Er EINVAL
-One of the
-.Fa iov_len
-values in the
-.Fa iov
-array was negative.
-.It Bq Er EINVAL
-The sum of the
-.Fa iov_len
-values in the
-.Fa iov
-array overflowed a 32-bit integer.
-.It Bq Er EFAULT
-Part of the
-.Fa iov
-array points outside the process's allocated address space.
-.El
-.Pp
-The
-.Fn pread
-and
-.Fn preadv
-system calls may also return the following errors:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Fa offset
-value was negative.
-.It Bq Er ESPIPE
-The file descriptor is associated with a pipe, socket, or FIFO.
-.El
-.Sh SEE ALSO
-.Xr dup 2 ,
-.Xr fcntl 2 ,
-.Xr getdirentries 2 ,
-.Xr open 2 ,
-.Xr pipe 2 ,
-.Xr select 2 ,
-.Xr socket 2 ,
-.Xr socketpair 2 ,
-.Xr fread 3 ,
-.Xr readdir 3
-.Sh STANDARDS
-The
-.Fn read
-system call is expected to conform to
-.St -p1003.1-90 .
-The
-.Fn readv
-and
-.Fn pread
-system calls are expected to conform to
-.St -xpg4.2 .
-.Sh HISTORY
-The
-.Fn preadv
-system call appeared in
-.Fx 6.0 .
-The
-.Fn pread
-function appeared in
-.At V.4 .
-The
-.Fn readv
-system call appeared in
-.Bx 4.2 .
-The
-.Fn read
-function appeared in
-.At v1 .
diff --git a/lib/libc/sys/read.c b/lib/libc/sys/read.c
index ab30189026e3..b4610e0c38c3 100644
--- a/lib/libc/sys/read.c
+++ b/lib/libc/sys/read.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2014 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/syscall.h>
#include <unistd.h>
@@ -44,7 +40,5 @@ __weak_reference(__sys_read, __read);
ssize_t
read(int fd, void *buf, size_t nbytes)
{
-
- return (((ssize_t (*)(int, void *, size_t))
- __libc_interposing[INTERPOS_read])(fd, buf, nbytes));
+ return (INTERPOS_SYS(read, fd, buf, nbytes));
}
diff --git a/lib/libc/sys/readlink.2 b/lib/libc/sys/readlink.2
deleted file mode 100644
index 72aadef37cc6..000000000000
--- a/lib/libc/sys/readlink.2
+++ /dev/null
@@ -1,160 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)readlink.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2020
-.Dt READLINK 2
-.Os
-.Sh NAME
-.Nm readlink ,
-.Nm readlinkat
-.Nd read value of a symbolic link
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft ssize_t
-.Fn readlink "const char *restrict path" "char *restrict buf" "size_t bufsiz"
-.Ft ssize_t
-.Fo readlinkat
-.Fa "int fd" "const char *restrict path" "char *restrict buf" "size_t bufsize"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn readlink
-system call
-places the contents of the symbolic link
-.Fa path
-in the buffer
-.Fa buf ,
-which has size
-.Fa bufsiz .
-The
-.Fn readlink
-system call does not append a
-.Dv NUL
-character to
-.Fa buf .
-.Pp
-The
-.Fn readlinkat
-system call is equivalent to
-.Fn readlink
-except in the case where
-.Fa path
-specifies a relative path.
-In this case the symbolic link whose content is read relative to the
-directory associated with the file descriptor
-.Fa fd
-instead of the current working directory.
-If
-.Fn readlinkat
-is passed the special value
-.Dv AT_FDCWD
-in the
-.Fa fd
-parameter, the current working directory is used and the behavior is
-identical to a call to
-.Fn readlink .
-.Sh RETURN VALUES
-The call returns the count of characters placed in the buffer
-if it succeeds, or a \-1 if an error occurs, placing the error
-code in the global variable
-.Va errno .
-.Sh ERRORS
-The
-.Fn readlink
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er ENOTDIR
-A component of the path prefix is not a directory.
-.It Bq Er ENAMETOOLONG
-A component of a pathname exceeded 255 characters,
-or an entire path name exceeded 1023 characters.
-.It Bq Er ENOENT
-The named file does not exist.
-.It Bq Er EACCES
-Search permission is denied for a component of the path prefix.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating the pathname.
-.It Bq Er EINVAL
-The named file is not a symbolic link.
-.It Bq Er EIO
-An I/O error occurred while reading from the file system.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.It Bq Er EFAULT
-The
-.Fa buf
-argument
-extends outside the process's allocated address space.
-.El
-.Pp
-In addition to the errors returned by the
-.Fn readlink ,
-the
-.Fn readlinkat
-may fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa path
-argument does not specify an absolute path and the
-.Fa fd
-argument is neither
-.Dv AT_FDCWD
-nor a valid file descriptor open for searching.
-.It Bq Er ENOTDIR
-The
-.Fa path
-argument is not an absolute path and
-.Fa fd
-is neither
-.Dv AT_FDCWD
-nor a file descriptor associated with a directory.
-.El
-.Sh SEE ALSO
-.Xr lstat 2 ,
-.Xr stat 2 ,
-.Xr symlink 2 ,
-.Xr symlink 7
-.Sh STANDARDS
-The
-.Fn readlinkat
-system call follows The Open Group Extended API Set 2 specification.
-.Sh HISTORY
-The
-.Fn readlink
-system call appeared in
-.Bx 4.2 .
-The
-.Fn readlinkat
-system call appeared in
-.Fx 8.0 .
diff --git a/lib/libc/sys/readv.c b/lib/libc/sys/readv.c
index 567292750da0..78a529254fa0 100644
--- a/lib/libc/sys/readv.c
+++ b/lib/libc/sys/readv.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2014 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/syscall.h>
#include <sys/uio.h>
@@ -45,7 +41,5 @@ __weak_reference(__sys_readv, __readv);
ssize_t
readv(int fd, const struct iovec *iov, int iovcnt)
{
-
- return (((ssize_t (*)(int, const struct iovec *, int))
- __libc_interposing[INTERPOS_readv])(fd, iov, iovcnt));
+ return (INTERPOS_SYS(readv, fd, iov, iovcnt));
}
diff --git a/lib/libc/sys/reboot.2 b/lib/libc/sys/reboot.2
deleted file mode 100644
index 99d5dcc42808..000000000000
--- a/lib/libc/sys/reboot.2
+++ /dev/null
@@ -1,164 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)reboot.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd July 10, 2018
-.Dt REBOOT 2
-.Os
-.Sh NAME
-.Nm reboot
-.Nd reboot system or halt processor
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.In sys/reboot.h
-.Ft int
-.Fn reboot "int howto"
-.Sh DESCRIPTION
-The
-.Fn reboot
-system call
-reboots the system.
-Only the super-user may reboot a machine on demand.
-However, a reboot is invoked
-automatically in the event of unrecoverable system failures.
-.Pp
-The
-.Fa howto
-argument
-is a mask of options; the system call interface allows the following
-options, defined in the include file
-.In sys/reboot.h ,
-to be passed
-to the new kernel or the new bootstrap and init programs.
-.Bl -tag -width RB_POWERCYCLE
-.It Dv RB_AUTOBOOT
-The default, causing the system to reboot in its usual fashion.
-.It Dv RB_ASKNAME
-Normally the system only prompts the user if the loader specified root
-file system has an error.
-This flag forces it to always prompt the user for the root partition.
-.It Dv RB_DFLTROOT
-Use the compiled in root device.
-Normally, the system uses the device from which it was booted
-as the root device if possible.
-(The default behavior is dependent on the ability of the bootstrap program
-to determine the drive from which it was loaded, which is not possible
-on all systems.)
-.It Dv RB_DUMP
-Dump kernel memory before rebooting; see
-.Xr savecore 8
-for more information.
-.It Dv RB_HALT
-The processor is simply halted; no reboot takes place.
-This option should be used with caution.
-.It Dv RB_POWERCYCLE
-After halting, the shutdown code will do what it can to turn
-off the power and then turn the power back on.
-This requires hardware support, usually an auxiliary microprocessor
-that can sequence the power supply.
-At present only the
-.Xr ipmi 4
-driver implements this feature.
-.It Dv RB_POWEROFF
-After halting, the shutdown code will do what it can to turn
-off the power.
-This requires hardware support.
-.It Dv RB_KDB
-Load the symbol table and enable a built-in debugger in the system.
-This option will have no useful function if the kernel is not configured
-for debugging.
-Several other options have different meaning if combined
-with this option, although their use may not be possible
-via the
-.Fn reboot
-system call.
-See
-.Xr ddb 4
-for more information.
-.It Dv RB_NOSYNC
-Normally, the disks are sync'd (see
-.Xr sync 8 )
-before the processor is halted or rebooted.
-This option may be useful if file system changes have been made manually
-or if the processor is on fire.
-.It Dv RB_REROOT
-Instead of rebooting, unmount all filesystems except the one containing
-currently-running executable, and mount root filesystem using the same
-mechanism which is used during normal boot, based on
-vfs.root.mountfrom
-.Xr kenv 1
-variable.
-.It Dv RB_RDONLY
-Initially mount the root file system read-only.
-This is currently the default, and this option has been deprecated.
-.It Dv RB_SINGLE
-Normally, the reboot procedure involves an automatic disk consistency
-check and then multi-user operations.
-.Dv RB_SINGLE
-prevents this, booting the system with a single-user shell
-on the console.
-.Dv RB_SINGLE
-is actually interpreted by the
-.Xr init 8
-program in the newly booted system.
-.El
-.Pp
-When no options are given (i.e.,
-.Dv RB_AUTOBOOT
-is used), the system is
-rebooted from file
-.Dq kernel
-in the root file system of unit 0
-of a disk chosen in a processor specific way.
-An automatic consistency check of the disks is normally performed
-(see
-.Xr fsck 8 ) .
-.Sh RETURN VALUES
-If successful, this call never returns.
-Otherwise, a -1 is returned and an error is returned in the global
-variable
-.Va errno .
-.Sh ERRORS
-.Bl -tag -width Er
-.It Bq Er EPERM
-The caller is not the super-user.
-.El
-.Sh SEE ALSO
-.Xr crash 8 ,
-.Xr halt 8 ,
-.Xr init 8 ,
-.Xr reboot 8 ,
-.Xr savecore 8
-.Sh HISTORY
-The
-.Fn reboot
-system call appeared in
-.Bx 4.0 .
diff --git a/lib/libc/sys/recv.2 b/lib/libc/sys/recv.2
deleted file mode 100644
index 46e0cf8163dd..000000000000
--- a/lib/libc/sys/recv.2
+++ /dev/null
@@ -1,374 +0,0 @@
-.\" Copyright (c) 1983, 1990, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)recv.2 8.3 (Berkeley) 2/21/94
-.\" $FreeBSD$
-.\"
-.Dd August 19, 2018
-.Dt RECV 2
-.Os
-.Sh NAME
-.Nm recv ,
-.Nm recvfrom ,
-.Nm recvmsg ,
-.Nm recvmmsg
-.Nd receive message(s) from a socket
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/socket.h
-.Ft ssize_t
-.Fn recv "int s" "void *buf" "size_t len" "int flags"
-.Ft ssize_t
-.Fn recvfrom "int s" "void *buf" "size_t len" "int flags" "struct sockaddr * restrict from" "socklen_t * restrict fromlen"
-.Ft ssize_t
-.Fn recvmsg "int s" "struct msghdr *msg" "int flags"
-.Ft ssize_t
-.Fn recvmmsg "int s" "struct mmsghdr * restrict msgvec" "size_t vlen" "int flags" "const struct timespec * restrict timeout"
-.Sh DESCRIPTION
-The
-.Fn recvfrom ,
-.Fn recvmsg ,
-and
-.Fn recvmmsg
-system calls
-are used to receive messages from a socket,
-and may be used to receive data on a socket whether or not
-it is connection-oriented.
-.Pp
-If
-.Fa from
-is not a null pointer
-and the socket is not connection-oriented,
-the source address of the message is filled in.
-The
-.Fa fromlen
-argument
-is a value-result argument, initialized to the size of
-the buffer associated with
-.Fa from ,
-and modified on return to indicate the actual size of the
-address stored there.
-.Pp
-The
-.Fn recv
-function is normally used only on a
-.Em connected
-socket (see
-.Xr connect 2 )
-and is identical to
-.Fn recvfrom
-with a
-null pointer passed as its
-.Fa from
-argument.
-.Pp
-The
-.Fn recvmmsg
-function is used to receive multiple
-messages at a call.
-Their number is supplied by
-.Fa vlen .
-The messages are placed in the buffers described by
-.Fa msgvec
-vector, after reception.
-The size of each received message is placed in the
-.Fa msg_len
-field of each element of the vector.
-If
-.Fa timeout
-is NULL the call blocks until the data is available for each
-supplied message buffer.
-Otherwise it waits for data for the specified amount of time.
-If the timeout expired and there is no data received,
-a value 0 is returned.
-The
-.Xr ppoll 2
-system call is used to implement the timeout mechanism,
-before first receive is performed.
-.Pp
-The
-.Fn recv ,
-.Fn recvfrom
-and
-.Fn recvmsg
-return the length of the message on successful
-completion, whereas
-.Fn recvmmsg
-returns the number of received messages.
-If a message is too long to fit in the supplied buffer,
-excess bytes may be discarded depending on the type of socket
-the message is received from (see
-.Xr socket 2 ) .
-.Pp
-If no messages are available at the socket, the
-receive call waits for a message to arrive, unless
-the socket is non-blocking (see
-.Xr fcntl 2 )
-in which case the value
-\-1 is returned and the global variable
-.Va errno
-is set to
-.Er EAGAIN .
-The receive calls except
-.Fn recvmmsg
-normally return any data available,
-up to the requested amount,
-rather than waiting for receipt of the full amount requested;
-this behavior is affected by the socket-level options
-.Dv SO_RCVLOWAT
-and
-.Dv SO_RCVTIMEO
-described in
-.Xr getsockopt 2 .
-The
-.Fn recvmmsg
-function implements this behaviour for each message in the vector.
-.Pp
-The
-.Xr select 2
-system call may be used to determine when more data arrives.
-.Pp
-The
-.Fa flags
-argument to a
-.Fn recv
-function is formed by
-.Em or Ap ing
-one or more of the values:
-.Bl -column ".Dv MSG_CMSG_CLOEXEC" -offset indent
-.It Dv MSG_OOB Ta process out-of-band data
-.It Dv MSG_PEEK Ta peek at incoming message
-.It Dv MSG_WAITALL Ta wait for full request or error
-.It Dv MSG_DONTWAIT Ta do not block
-.It Dv MSG_CMSG_CLOEXEC Ta set received fds close-on-exec
-.It Dv MSG_WAITFORONE Ta do not block after receiving the first message
-(only for
-.Fn recvmmsg
-)
-.El
-.Pp
-The
-.Dv MSG_OOB
-flag requests receipt of out-of-band data
-that would not be received in the normal data stream.
-Some protocols place expedited data at the head of the normal
-data queue, and thus this flag cannot be used with such protocols.
-The
-.Dv MSG_PEEK
-flag causes the receive operation to return data
-from the beginning of the receive queue without removing that
-data from the queue.
-Thus, a subsequent receive call will return the same data.
-The
-.Dv MSG_WAITALL
-flag requests that the operation block until
-the full request is satisfied.
-However, the call may still return less data than requested
-if a signal is caught, an error or disconnect occurs,
-or the next data to be received is of a different type than that returned.
-The
-.Dv MSG_DONTWAIT
-flag requests the call to return when it would block otherwise.
-If no data is available,
-.Va errno
-is set to
-.Er EAGAIN .
-This flag is not available in
-.St -ansiC
-or
-.St -isoC-99
-compilation mode.
-The
-.Dv MSG_WAITFORONE
-flag sets MSG_DONTWAIT after the first message has been received.
-This flag is only relevant for
-.Fn recvmmsg .
-.Pp
-The
-.Fn recvmsg
-system call uses a
-.Fa msghdr
-structure to minimize the number of directly supplied arguments.
-This structure has the following form, as defined in
-.In sys/socket.h :
-.Bd -literal
-struct msghdr {
- void *msg_name; /* optional address */
- socklen_t msg_namelen; /* size of address */
- struct iovec *msg_iov; /* scatter/gather array */
- int msg_iovlen; /* # elements in msg_iov */
- void *msg_control; /* ancillary data, see below */
- socklen_t msg_controllen;/* ancillary data buffer len */
- int msg_flags; /* flags on received message */
-};
-.Ed
-.Pp
-Here
-.Fa msg_name
-and
-.Fa msg_namelen
-specify the source address if the socket is unconnected;
-.Fa msg_name
-may be given as a null pointer if no names are desired or required.
-The
-.Fa msg_iov
-and
-.Fa msg_iovlen
-arguments
-describe scatter gather locations, as discussed in
-.Xr read 2 .
-The
-.Fa msg_control
-argument,
-which has length
-.Fa msg_controllen ,
-points to a buffer for other protocol control related messages
-or other miscellaneous ancillary data.
-The messages are of the form:
-.Bd -literal
-struct cmsghdr {
- socklen_t cmsg_len; /* data byte count, including hdr */
- int cmsg_level; /* originating protocol */
- int cmsg_type; /* protocol-specific type */
-/* followed by
- u_char cmsg_data[]; */
-};
-.Ed
-.Pp
-As an example, the SO_TIMESTAMP socket option returns a reception
-timestamp for UDP packets.
-.Pp
-With
-.Dv AF_UNIX
-domain sockets, ancillary data can be used to pass file descriptors and
-process credentials.
-See
-.Xr unix 4
-for details.
-.Pp
-The
-.Fa msg_flags
-field is set on return according to the message received.
-.Dv MSG_EOR
-indicates end-of-record;
-the data returned completed a record (generally used with sockets of type
-.Dv SOCK_SEQPACKET ) .
-.Dv MSG_TRUNC
-indicates that
-the trailing portion of a datagram was discarded because the datagram
-was larger than the buffer supplied.
-.Dv MSG_CTRUNC
-indicates that some
-control data were discarded due to lack of space in the buffer
-for ancillary data.
-.Dv MSG_OOB
-is returned to indicate that expedited or out-of-band data were received.
-.Pp
-The
-.Fn recvmmsg
-system call uses the
-.Fa mmsghdr
-structure, defined as follows in the
-.In sys/socket.h
-header:
-.Bd -literal
-struct mmsghdr {
- struct msghdr msg_hdr; /* message header */
- ssize_t msg_len; /* message length */
-};
-.Ed
-.Pp
-On data reception the
-.Fa msg_len
-field is updated to the length of the received message.
-.Sh RETURN VALUES
-These calls except
-.Fn recvmmsg
-return the number of bytes received.
-.Fn recvmmsg
-returns the number of messages received.
-A value of -1 is returned if an error occurred.
-.Sh ERRORS
-The calls fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The argument
-.Fa s
-is an invalid descriptor.
-.It Bq Er ECONNRESET
-The remote socket end is forcibly closed.
-.It Bq Er ENOTCONN
-The socket is associated with a connection-oriented protocol
-and has not been connected (see
-.Xr connect 2
-and
-.Xr accept 2 ) .
-.It Bq Er ENOTSOCK
-The argument
-.Fa s
-does not refer to a socket.
-.It Bq Er EMSGSIZE
-The
-.Fn recvmsg
-system call
-was used to receive rights (file descriptors) that were in flight on the
-connection.
-However, the receiving program did not have enough free file
-descriptor slots to accept them.
-In this case the descriptors are
-closed, any pending data can be returned by another call to
-.Fn recvmsg .
-.It Bq Er EAGAIN
-The socket is marked non-blocking and the receive operation
-would block, or
-a receive timeout had been set
-and the timeout expired before data were received.
-.It Bq Er EINTR
-The receive was interrupted by delivery of a signal before
-any data were available.
-.It Bq Er EFAULT
-The receive buffer pointer(s) point outside the process's
-address space.
-.El
-.Sh SEE ALSO
-.Xr fcntl 2 ,
-.Xr getsockopt 2 ,
-.Xr read 2 ,
-.Xr select 2 ,
-.Xr socket 2 ,
-.Xr CMSG_DATA 3 ,
-.Xr unix 4
-.Sh HISTORY
-The
-.Fn recv
-function appeared in
-.Bx 4.2 .
-The
-.Fn recvmmsg
-function appeared in
-.Fx 11.0 .
diff --git a/lib/libc/net/recv.c b/lib/libc/sys/recv.c
index 5304745848a7..9afb1dee0654 100644
--- a/lib/libc/net/recv.c
+++ b/lib/libc/sys/recv.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)recv.c 8.2 (Berkeley) 2/21/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/socket.h>
#include "libc_private.h"
@@ -48,8 +42,5 @@ recv(int s, void *buf, size_t len, int flags)
* POSIX says recv() shall be a cancellation point, so call the
* cancellation-enabled recvfrom() and not _recvfrom().
*/
- return (((ssize_t (*)(int, void *, size_t, int,
- struct sockaddr *, socklen_t *))
- __libc_interposing[INTERPOS_recvfrom])(s, buf, len, flags,
- NULL, NULL));
+ return (INTERPOS_SYS(recvfrom, s, buf, len, flags, NULL, NULL));
}
diff --git a/lib/libc/sys/recvfrom.c b/lib/libc/sys/recvfrom.c
index aa6ef3fb7be2..04738d06a71c 100644
--- a/lib/libc/sys/recvfrom.c
+++ b/lib/libc/sys/recvfrom.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2014 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/syscall.h>
#include <sys/socket.h>
@@ -45,9 +41,5 @@ ssize_t
recvfrom(int s, void *buf, size_t len, int flags,
struct sockaddr * __restrict from, socklen_t * __restrict fromlen)
{
-
- return (((ssize_t (*)(int, void *, size_t, int,
- struct sockaddr *, socklen_t *))
- __libc_interposing[INTERPOS_recvfrom])(s, buf, len, flags,
- from, fromlen));
+ return (INTERPOS_SYS(recvfrom, s, buf, len, flags, from, fromlen));
}
diff --git a/lib/libc/sys/recvmsg.c b/lib/libc/sys/recvmsg.c
index 282ede9995ff..c7e34b9beeb4 100644
--- a/lib/libc/sys/recvmsg.c
+++ b/lib/libc/sys/recvmsg.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2014 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/syscall.h>
#include <sys/socket.h>
@@ -44,7 +40,5 @@ __weak_reference(__sys_recvmsg, __recvmsg);
ssize_t
recvmsg(int s, struct msghdr *msg, int flags)
{
-
- return (((int (*)(int, struct msghdr *, int))
- __libc_interposing[INTERPOS_recvmsg])(s, msg, flags));
+ return (INTERPOS_SYS(recvmsg, s, msg, flags));
}
diff --git a/lib/libc/sys/rename.2 b/lib/libc/sys/rename.2
deleted file mode 100644
index c67f6ebdc19a..000000000000
--- a/lib/libc/sys/rename.2
+++ /dev/null
@@ -1,342 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)rename.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2020
-.Dt RENAME 2
-.Os
-.Sh NAME
-.Nm rename
-.Nd change the name of a file
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In stdio.h
-.Ft int
-.Fn rename "const char *from" "const char *to"
-.Ft int
-.Fn renameat "int fromfd" "const char *from" "int tofd" "const char *to"
-.Sh DESCRIPTION
-The
-.Fn rename
-system call
-causes the link named
-.Fa from
-to be renamed as
-.Fa to .
-If
-.Fa to
-exists, it is first removed.
-Both
-.Fa from
-and
-.Fa to
-must be of the same type (that is, both directories or both
-non-directories), and must reside on the same file system.
-.Pp
-The
-.Fn rename
-system call
-guarantees that if
-.Fa to
-already exists, an instance of
-.Fa to
-will always exist, even if the system should crash in
-the middle of the operation.
-.Pp
-If the final component of
-.Fa from
-is a symbolic link,
-the symbolic link is renamed,
-not the file or directory to which it points.
-.Pp
-If
-.Fa from
-and
-.Fa to
-resolve to the same directory entry, or to different directory
-entries for the same existing file,
-.Fn rename
-returns success without taking any further action.
-.Pp
-The
-.Fn renameat
-system call is equivalent to
-.Fn rename
-except in the case where either
-.Fa from
-or
-.Fa to
-specifies a relative path.
-If
-.Fa from
-is a relative path, the file to be renamed is located
-relative to the directory associated with the file descriptor
-.Fa fromfd
-instead of the current working directory.
-If the
-.Fa to
-is a relative path, the same happens only relative to the directory associated
-with
-.Fa tofd .
-If the
-.Fn renameat
-is passed the special value
-.Dv AT_FDCWD
-in the
-.Fa fromfd
-or
-.Fa tofd
-parameter, the current working directory is used in the determination
-of the file for the respective path parameter.
-.\".Sh CAVEAT
-.\"The system can deadlock if a loop in the file system graph is present.
-.\"This loop takes the form of an entry in directory
-.\".Pa a ,
-.\"say
-.\".Pa a/foo ,
-.\"being a hard link to directory
-.\".Pa b ,
-.\"and an entry in
-.\"directory
-.\".Pa b ,
-.\"say
-.\".Pa b/bar ,
-.\"being a hard link
-.\"to directory
-.\".Pa a .
-.\"When such a loop exists and two separate processes attempt to
-.\"perform
-.\".Ql rename a/foo b/bar
-.\"and
-.\".Ql rename b/bar a/foo ,
-.\"respectively,
-.\"the system may deadlock attempting to lock
-.\"both directories for modification.
-.\"Hard links to directories should be
-.\"replaced by symbolic links by the system administrator.
-.Sh RETURN VALUES
-.Rv -std rename
-.Sh ERRORS
-The
-.Fn rename
-system call
-will fail and neither of the argument files will be
-affected if:
-.Bl -tag -width Er
-.It Bq Er ENAMETOOLONG
-A component of either pathname exceeded 255 characters,
-or the entire length of either path name exceeded 1023 characters.
-.It Bq Er ENOENT
-A component of the
-.Fa from
-path does not exist,
-or a path prefix of
-.Fa to
-does not exist.
-.It Bq Er EACCES
-A component of either path prefix denies search permission.
-.It Bq Er EACCES
-The requested link requires writing in a directory with a mode
-that denies write permission.
-.It Bq Er EACCES
-The directory pointed at by the
-.Fa from
-argument denies write permission, and the operation would move
-it to another parent directory.
-.It Bq Er EPERM
-The file pointed at by the
-.Fa from
-argument has its immutable, undeletable or append-only flag set, see the
-.Xr chflags 2
-manual page for more information.
-.It Bq Er EPERM
-The parent directory of the file pointed at by the
-.Fa from
-argument has its immutable or append-only flag set.
-.It Bq Er EPERM
-The parent directory of the file pointed at by the
-.Fa to
-argument has its immutable flag set.
-.It Bq Er EPERM
-The directory containing
-.Fa from
-is marked sticky,
-and neither the containing directory nor
-.Fa from
-are owned by the effective user ID.
-.It Bq Er EPERM
-The file pointed at by the
-.Fa to
-argument
-exists,
-the directory containing
-.Fa to
-is marked sticky,
-and neither the containing directory nor
-.Fa to
-are owned by the effective user ID.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating either pathname.
-.It Bq Er ENOTDIR
-A component of either path prefix is not a directory.
-.It Bq Er ENOTDIR
-The
-.Fa from
-argument
-is a directory, but
-.Fa to
-is not a directory.
-.It Bq Er EISDIR
-The
-.Fa to
-argument
-is a directory, but
-.Fa from
-is not a directory.
-.It Bq Er EXDEV
-The link named by
-.Fa to
-and the file named by
-.Fa from
-are on different logical devices (file systems).
-Note that this error
-code will not be returned if the implementation permits cross-device
-links.
-.It Bq Er ENOSPC
-The directory in which the entry for the new name is being placed
-cannot be extended because there is no space left on the file
-system containing the directory.
-.It Bq Er EDQUOT
-The directory in which the entry for the new name
-is being placed cannot be extended because the
-user's quota of disk blocks on the file system
-containing the directory has been exhausted.
-.It Bq Er EIO
-An I/O error occurred while making or updating a directory entry.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.It Bq Er EROFS
-The requested link requires writing in a directory on a read-only file
-system.
-.It Bq Er EFAULT
-Path
-points outside the process's allocated address space.
-.It Bq Er EINVAL
-The
-.Fa from
-argument
-is a parent directory of
-.Fa to ,
-or an attempt is made to rename
-.Ql .\&
-or
-.Ql \&.. .
-.It Bq Er ENOTEMPTY
-The
-.Fa to
-argument
-is a directory and is not empty.
-.It Bq Er ECAPMODE
-.Fn rename
-was called and the process is in capability mode.
-.El
-.Pp
-In addition to the errors returned by the
-.Fn rename ,
-the
-.Fn renameat
-may fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa from
-argument does not specify an absolute path and the
-.Fa fromfd
-argument is neither
-.Dv AT_FDCWD
-nor a valid file descriptor open for searching, or the
-.Fa to
-argument does not specify an absolute path and the
-.Fa tofd
-argument is neither
-.Dv AT_FDCWD
-nor a valid file descriptor open for searching.
-.It Bq Er ENOTDIR
-The
-.Fa from
-argument is not an absolute path and
-.Fa fromfd
-is neither
-.Dv AT_FDCWD
-nor a file descriptor associated with a directory, or the
-.Fa to
-argument is not an absolute path and
-.Fa tofd
-is neither
-.Dv AT_FDCWD
-nor a file descriptor associated with a directory.
-.It Bq Er ECAPMODE
-.Dv AT_FDCWD
-is specified and the process is in capability mode.
-.It Bq Er ENOTCAPABLE
-.Fa path
-is an absolute path or contained a ".." component leading to a directory
-outside of the directory hierarchy specified by
-.Fa fromfd
-or
-.Fa tofd .
-.It Bq Er ENOTCAPABLE
-The
-.Fa fromfd
-file descriptor lacks the
-.Dv CAP_RENAMEAT_SOURCE
-right, or the
-.Fa tofd
-file descriptor lacks the
-.Dv CAP_RENAMEAT_TARGET
-right.
-.El
-.Sh SEE ALSO
-.Xr chflags 2 ,
-.Xr open 2 ,
-.Xr symlink 7
-.Sh STANDARDS
-The
-.Fn rename
-system call is expected to conform to
-.St -p1003.1-96 .
-The
-.Fn renameat
-system call follows The Open Group Extended API Set 2 specification.
-.Sh HISTORY
-The
-.Fn renameat
-system call appeared in
-.Fx 8.0 .
diff --git a/lib/libc/sys/revoke.2 b/lib/libc/sys/revoke.2
deleted file mode 100644
index bb232d9d0488..000000000000
--- a/lib/libc/sys/revoke.2
+++ /dev/null
@@ -1,110 +0,0 @@
-.\" Copyright (c) 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Berkeley Software Design, 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)revoke.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd January 25, 2016
-.Dt REVOKE 2
-.Os
-.Sh NAME
-.Nm revoke
-.Nd revoke file access
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn revoke "const char *path"
-.Sh DESCRIPTION
-The
-.Fn revoke
-system call invalidates all current open file descriptors in the system
-for the file named by
-.Fa path .
-Subsequent operations on any such descriptors
-fail, with the exceptions that a
-.Fn read
-from a character device file which has been revoked
-returns a count of zero (end of file),
-and a
-.Fn close
-system call will succeed.
-If the file is a special file for a device which is open,
-the device close function
-is called as if all open references to the file had been closed
-using a special close method which does not block.
-.Pp
-Access to a file may be revoked only by its owner or the super user.
-The
-.Fn revoke
-system call is currently supported only for block and character special
-device files.
-It is normally used to prepare a terminal device for a new login session,
-preventing any access by a previous user of the terminal.
-.Sh RETURN VALUES
-.Rv -std revoke
-.Sh ERRORS
-Access to the named file is revoked unless one of the following:
-.Bl -tag -width Er
-.It Bq Er ENOTDIR
-A component of the path prefix is not a directory.
-.It Bq Er ENAMETOOLONG
-A component of a pathname exceeded 255 characters,
-or an entire path name exceeded 1024 characters.
-.It Bq Er ENOENT
-The named file or a component of the path name does not exist.
-.It Bq Er EACCES
-Search permission is denied for a component of the path prefix.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating the pathname.
-.It Bq Er EFAULT
-The
-.Fa path
-argument
-points outside the process's allocated address space.
-.It Bq Er EINVAL
-The implementation does not support the
-.Fn revoke
-operation on the named file.
-.It Bq Er EPERM
-The caller is neither the owner of the file nor the super user.
-.El
-.Sh SEE ALSO
-.Xr revoke 1 ,
-.Xr close 2
-.Sh HISTORY
-The
-.Fn revoke
-system call first appeared in
-.Bx 4.3 Reno .
-.Sh BUGS
-The non-blocking close method is only correctly implemented for
-terminal devices.
diff --git a/lib/libc/sys/rfork.2 b/lib/libc/sys/rfork.2
deleted file mode 100644
index f7fc99d2174b..000000000000
--- a/lib/libc/sys/rfork.2
+++ /dev/null
@@ -1,205 +0,0 @@
-.\"
-.\" This manual page is taken directly from Plan9, and modified to
-.\" describe the actual BSD implementation. Permission for
-.\" use of this page comes from Rob Pike <rob@plan9.att.com>.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd September 25, 2019
-.Dt RFORK 2
-.Os
-.Sh NAME
-.Nm rfork
-.Nd manipulate process resources
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft pid_t
-.Fn rfork "int flags"
-.Sh DESCRIPTION
-Forking, vforking or rforking are the only ways new processes are created.
-The
-.Fa flags
-argument to
-.Fn rfork
-selects which resources of the
-invoking process (parent) are shared
-by the new process (child) or initialized to
-their default values.
-The resources include
-the open file descriptor table (which, when shared, permits processes
-to open and close files for other processes),
-and open files.
-The
-.Fa flags
-argument
-is either
-.Dv RFSPAWN
-or the logical OR of some subset of:
-.Bl -tag -width ".Dv RFLINUXTHPN"
-.It Dv RFPROC
-If set a new process is created; otherwise changes affect the
-current process.
-.It Dv RFNOWAIT
-If set, the child process will be dissociated from the parent.
-Upon
-exit the child will not leave a status for the parent to collect.
-See
-.Xr wait 2 .
-.It Dv RFFDG
-If set, the invoker's file descriptor table (see
-.Xr intro 2 )
-is copied; otherwise the two processes share a
-single table.
-.It Dv RFCFDG
-If set, the new process starts with a clean file descriptor table.
-Is mutually exclusive with
-.Dv RFFDG .
-.It Dv RFTHREAD
-If set, the new process shares file descriptor to process leaders table
-with its parent.
-Only applies when neither
-.Dv RFFDG
-nor
-.Dv RFCFDG
-are set.
-.It Dv RFMEM
-If set, the kernel will force sharing of the entire address space,
-typically by sharing the hardware page table directly.
-The child
-will thus inherit and share all the segments the parent process owns,
-whether they are normally shareable or not.
-The stack segment is
-not split (both the parent and child return on the same stack) and thus
-.Fn rfork
-with the RFMEM flag may not generally be called directly from high level
-languages including C.
-May be set only with
-.Dv RFPROC .
-A helper function is provided to assist with this problem and will cause
-the new process to run on the provided stack.
-See
-.Xr rfork_thread 3
-for information.
-Note that a lot of code will not run correctly in such an environment.
-.It Dv RFSIGSHARE
-If set, the kernel will force sharing the sigacts structure between the
-child and the parent.
-.It Dv RFTSIGZMB
-If set, the kernel will deliver a specified signal to the parent
-upon the child exit, instead of default SIGCHLD.
-The signal number
-.Dv signum
-is specified by oring the
-.Dv RFTSIGFLAGS(signum)
-expression into
-.Fa flags .
-Specifying signal number 0 disables signal delivery upon the child exit.
-.It Dv RFLINUXTHPN
-If set, the kernel will deliver SIGUSR1 instead of SIGCHLD upon thread
-exit for the child.
-This is intended to mimic certain Linux clone behaviour.
-.El
-.Pp
-File descriptors in a shared file descriptor table are kept
-open until either they are explicitly closed
-or all processes sharing the table exit.
-.Pp
-If
-.Dv RFSPAWN
-is passed,
-.Nm
-will use
-.Xr vfork 2
-semantics but reset all signal actions in the child to default.
-This flag is used by the
-.Xr posix_spawn 3
-implementation in libc.
-.Pp
-If
-.Dv RFPROC
-is set, the
-value returned in the parent process
-is the process id
-of the child process; the value returned in the child is zero.
-Without
-.Dv RFPROC ,
-the return value is zero.
-Process id's range from 1 to the maximum integer
-.Ft ( int )
-value.
-The
-.Fn rfork
-system call
-will sleep, if necessary, until required process resources are available.
-.Pp
-The
-.Fn fork
-system call
-can be implemented as a call to
-.Fn rfork "RFFDG | RFPROC"
-but is not for backwards compatibility.
-.Sh RETURN VALUES
-Upon successful completion,
-.Fn rfork
-returns a value
-of 0 to the child process and returns the process ID of the child
-process to the parent process.
-Otherwise, a value of -1 is returned
-to the parent process, no child process is created, and the global
-variable
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-The
-.Fn rfork
-system call
-will fail and no child process will be created if:
-.Bl -tag -width Er
-.It Bq Er EAGAIN
-The system-imposed limit on the total
-number of processes under execution would be exceeded.
-The limit is given by the
-.Xr sysctl 3
-MIB variable
-.Dv KERN_MAXPROC .
-(The limit is actually ten less than this
-except for the super user).
-.It Bq Er EAGAIN
-The user is not the super user, and
-the system-imposed limit
-on the total number of
-processes under execution by a single user would be exceeded.
-The limit is given by the
-.Xr sysctl 3
-MIB variable
-.Dv KERN_MAXPROCPERUID .
-.It Bq Er EAGAIN
-The user is not the super user, and
-the soft resource limit corresponding to the
-.Fa resource
-argument
-.Dv RLIMIT_NOFILE
-would be exceeded (see
-.Xr getrlimit 2 ) .
-.It Bq Er EINVAL
-Both the RFFDG and the RFCFDG flags were specified.
-.It Bq Er EINVAL
-Any flags not listed above were specified.
-.It Bq Er EINVAL
-An invalid signal number was specified.
-.It Bq Er ENOMEM
-There is insufficient swap space for the new process.
-.El
-.Sh SEE ALSO
-.Xr fork 2 ,
-.Xr intro 2 ,
-.Xr minherit 2 ,
-.Xr vfork 2 ,
-.Xr pthread_create 3 ,
-.Xr rfork_thread 3
-.Sh HISTORY
-The
-.Fn rfork
-function first appeared in Plan9.
diff --git a/lib/libc/sys/rmdir.2 b/lib/libc/sys/rmdir.2
deleted file mode 100644
index de7331acdc3d..000000000000
--- a/lib/libc/sys/rmdir.2
+++ /dev/null
@@ -1,120 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)rmdir.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2020
-.Dt RMDIR 2
-.Os
-.Sh NAME
-.Nm rmdir
-.Nd remove a directory file
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn rmdir "const char *path"
-.Sh DESCRIPTION
-The
-.Fn rmdir
-system call
-removes a directory file
-whose name is given by
-.Fa path .
-The directory must not have any entries other
-than
-.Ql .\&
-and
-.Ql \&.. .
-.Sh RETURN VALUES
-.Rv -std rmdir
-.Sh ERRORS
-The named file is removed unless:
-.Bl -tag -width Er
-.It Bq Er ENOTDIR
-A component of the path is not a directory.
-.It Bq Er ENAMETOOLONG
-A component of a pathname exceeded 255 characters,
-or an entire path name exceeded 1023 characters.
-.It Bq Er ENOENT
-The named directory does not exist.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating the pathname.
-.It Bq Er ENOTEMPTY
-The named directory contains files other than
-.Ql .\&
-and
-.Ql ..\&
-in it.
-.It Bq Er EACCES
-Search permission is denied for a component of the path prefix.
-.It Bq Er EACCES
-Write permission is denied on the directory containing the link
-to be removed.
-.It Bq Er EPERM
-The directory to be removed has its immutable, undeletable or append-only flag
-set, see the
-.Xr chflags 2
-manual page for more information.
-.It Bq Er EPERM
-The parent directory of the directory to be removed has its immutable or
-append-only flag set.
-.It Bq Er EPERM
-The directory containing the directory to be removed is marked sticky,
-and neither the containing directory nor the directory to be removed
-are owned by the effective user ID.
-.It Bq Er EINVAL
-The last component of the path is
-.Ql .\&
-or
-.Ql .. .
-.It Bq Er EBUSY
-The directory to be removed is the mount point
-for a mounted file system.
-.It Bq Er EIO
-An I/O error occurred while deleting the directory entry
-or deallocating the inode.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.It Bq Er EROFS
-The directory entry to be removed resides on a read-only file system.
-.It Bq Er EFAULT
-The
-.Fa path
-argument
-points outside the process's allocated address space.
-.El
-.Sh SEE ALSO
-.Xr mkdir 2 ,
-.Xr unlink 2
-.Sh HISTORY
-The
-.Fn rmdir
-system call appeared in
-.Bx 4.2 .
diff --git a/lib/libc/sys/rtprio.2 b/lib/libc/sys/rtprio.2
deleted file mode 100644
index 3c11d25d94bb..000000000000
--- a/lib/libc/sys/rtprio.2
+++ /dev/null
@@ -1,201 +0,0 @@
-.\"-
-.\" Copyright (c) 1994, Henrik Vestergaard Draboel
-.\" All rights reserved.
-.\"
-.\" 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.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by Henrik Vestergaard Draboel.
-.\" 4. The name of the author may not be used to endorse or promote products
-.\" derived from this software without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
-.\"-
-.\" Copyright (c) 2011 Xin LI <delphij@FreeBSD.org>
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd December 27, 2011
-.Dt RTPRIO 2
-.Os
-.Sh NAME
-.Nm rtprio ,
-.Nm rtprio_thread
-.Nd examine or modify realtime or idle priority
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In sys/rtprio.h
-.Ft int
-.Fn rtprio "int function" "pid_t pid" "struct rtprio *rtp"
-.Ft int
-.Fn rtprio_thread "int function" "lwpid_t lwpid" "struct rtprio *rtp"
-.Sh DESCRIPTION
-The
-.Fn rtprio
-system call
-is used to lookup or change the realtime or idle priority of a process,
-or the calling thread.
-The
-.Fn rtprio_thread
-system call
-is used to lookup or change the realtime or idle priority of a thread.
-.Pp
-The
-.Fa function
-argument
-specifies the operation to be performed.
-RTP_LOOKUP to lookup the current priority,
-and RTP_SET to set the priority.
-.Pp
-For the
-.Fn rtprio
-system call,
-the
-.Fa pid
-argument
-specifies the process to operate on,
-0 for the calling thread.
-When
-.Fa pid
-is non-zero,
-the system call reports the highest priority in the process,
-or sets all threads' priority in the process,
-depending on value of the
-.Fa function
-argument.
-.Pp
-For the
-.Fn rtprio_thread
-system call,
-the
-.Fa lwpid
-specifies the thread to operate on,
-0 for the calling thread.
-.Pp
-The
-.Fa *rtp
-argument
-is a pointer to a struct rtprio which is used to specify the priority and priority type.
-This structure has the following form:
-.Bd -literal
-struct rtprio {
- u_short type;
- u_short prio;
-};
-.Ed
-.Pp
-The value of the
-.Va type
-field may be RTP_PRIO_REALTIME for realtime priorities,
-RTP_PRIO_NORMAL for normal priorities, and RTP_PRIO_IDLE for idle priorities.
-The priority specified by the
-.Va prio
-field ranges between 0 and
-.Dv RTP_PRIO_MAX
-.Pq usually 31 .
-0 is the highest possible priority.
-.Pp
-Realtime and idle priority is inherited through
-.Fn fork
-and
-.Fn exec .
-.Pp
-A realtime thread can only be preempted by a thread of equal or
-higher priority, or by an interrupt; idle priority threads will run only
-when no other real/normal priority thread is runnable.
-Higher real/idle priority threads
-preempt lower real/idle priority threads.
-Threads of equal real/idle priority are run round-robin.
-.Sh RETURN VALUES
-.Rv -std rtprio rtprio_thread
-.Sh ERRORS
-The
-.Fn rtprio
-and
-.Fn rtprio_thread
-system calls
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EFAULT
-The rtp pointer passed to
-.Fn rtprio
-or
-.Fn rtprio_thread
-was invalid.
-.It Bq Er EINVAL
-The specified
-.Fa prio
-was out of range.
-.It Bq Er EPERM
-The calling thread is not allowed to set the realtime priority.
-Only
-root is allowed to change the realtime priority of any thread, and non-root
-may only change the idle priority of threads the user owns,
-when the
-.Xr sysctl 8
-variable
-.Va security.bsd.unprivileged_idprio
-is set to non-zero.
-.It Bq Er ESRCH
-The specified process or thread was not found or visible.
-.El
-.Sh SEE ALSO
-.Xr nice 1 ,
-.Xr ps 1 ,
-.Xr rtprio 1 ,
-.Xr setpriority 2 ,
-.Xr nice 3 ,
-.Xr renice 8 ,
-.Xr p_cansee 9
-.Sh AUTHORS
-.An -nosplit
-The original author was
-.An Henrik Vestergaard Draboel Aq Mt hvd@terry.ping.dk .
-This implementation in
-.Fx
-was substantially rewritten by
-.An David Greenman .
-The
-.Fn rtprio_thread
-system call was implemented by
-.An David Xu .
diff --git a/lib/libc/sys/sched_get_priority_max.2 b/lib/libc/sys/sched_get_priority_max.2
deleted file mode 100644
index 88d1d6d1460d..000000000000
--- a/lib/libc/sys/sched_get_priority_max.2
+++ /dev/null
@@ -1,123 +0,0 @@
-.\" Copyright (c) 1998 HD Associates, Inc.
-.\" All rights reserved.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd March 12, 1998
-.Dt SCHED_GET_PRIORITY_MAX 2
-.Os
-.Sh NAME
-.Nm sched_get_priority_max ,
-.Nm sched_get_priority_min ,
-.Nm sched_rr_get_interval
-.Nd get scheduling parameter limits
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sched.h
-.Ft int
-.Fn sched_get_priority_max "int policy"
-.Ft int
-.Fn sched_get_priority_min "int policy"
-.Ft int
-.Fn sched_rr_get_interval "pid_t pid" "struct timespec *interval"
-.Sh DESCRIPTION
-The
-.Fn sched_get_priority_max
-and
-.Fn sched_get_priority_min
-system calls return the appropriate maximum or minimum, respectively,
-for the scheduling policy specified by
-.Fa policy .
-The
-.Fn sched_rr_get_interval
-system call updates the
-.Fa timespec
-structure referenced by the
-.Fa interval
-argument to contain the current execution time limit (i.e., time
-quantum) for the process specified by
-.Fa pid .
-If
-.Fa pid
-is zero, the current execution time limit for the calling process is
-returned.
-.Pp
-The value of
-.Fa policy
-should be one of the scheduling policy values defined in
-.Fa <sched.h> :
-.Bl -tag -width [SCHED_OTHER]
-.It Bq Er SCHED_FIFO
-First-in-first-out fixed priority scheduling with no round robin scheduling;
-.It Bq Er SCHED_OTHER
-The standard time sharing scheduler;
-.It Bq Er SCHED_RR
-Round-robin scheduling across same priority processes.
-.El
-.Sh RETURN VALUES
-If successful, the
-.Fn sched_get_priority_max
-and
-.Fn sched_get_priority_min
-system calls shall return the appropriate maximum or minimum values,
-respectively.
-If unsuccessful, they shall return a value of -1 and set
-.Fa errno
-to indicate the error.
-.Pp
-.Rv -std sched_rr_get_interval
-.Sh ERRORS
-On failure
-.Va errno
-will be set to the corresponding value:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The value of the
-.Fa policy
-argument does not represent a defined scheduling policy.
-.It Bq Er ENOSYS
-The
-.Fn sched_get_priority_max ,
-.Fn sched_get_priority_min ,
-and
-.Fn sched_rr_get_interval
-system calls are not supported by the implementation.
-.It Bq Er ESRCH
-No process can be found corresponding to that specified by
-.Fa pid .
-.El
-.Sh SEE ALSO
-.Xr sched_getparam 2 ,
-.Xr sched_getscheduler 2 ,
-.Xr sched_setparam 2 ,
-.Xr sched_setscheduler 2
-.Sh STANDARDS
-The
-.Fn sched_get_priority_max ,
-.Fn sched_get_priority_min ,
-and
-.Fn sched_rr_get_interval
-system calls conform to
-.St -p1003.1b-93 .
diff --git a/lib/libc/sys/sched_setparam.2 b/lib/libc/sys/sched_setparam.2
deleted file mode 100644
index 315fd826cc7d..000000000000
--- a/lib/libc/sys/sched_setparam.2
+++ /dev/null
@@ -1,174 +0,0 @@
-.\" $FreeBSD$
-.\" Copyright (c) 1998 HD Associates, Inc.
-.\" All rights reserved.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.Dd March 12, 1998
-.Dt SCHED_SETPARAM 2
-.Os
-.Sh NAME
-.Nm sched_setparam ,
-.Nm sched_getparam
-.Nd set/get scheduling parameters
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sched.h
-.Ft int
-.Fn sched_setparam "pid_t pid" "const struct sched_param *param"
-.Ft int
-.Fn sched_getparam "pid_t pid" "struct sched_param *param"
-.Sh DESCRIPTION
-The
-.Fn sched_setparam
-system call sets the scheduling parameters of the process specified by
-.Fa pid
-to the values specified by the
-.Fa sched_param
-structure pointed to by
-.Fa param .
-The value of the
-.Fa sched_priority
-member in the
-.Fa param
-structure must be any integer within the inclusive priority range for
-the current scheduling policy of the process specified by
-.Fa pid .
-Higher numerical values for the priority represent higher priorities.
-.Pp
-In this implementation, if the value of
-.Fa pid
-is negative the system call will fail.
-.Pp
-If a process specified by
-.Fa pid
-exists and if the calling process has permission, the scheduling
-parameters are set for the process whose process ID is equal to
-.Fa pid .
-.Pp
-If
-.Fa pid
-is zero, the scheduling parameters are set for the calling process.
-.Pp
-In this implementation, the policy of when a process can affect
-the scheduling parameters of another process is specified in
-.St -p1003.1b-93
-as a write-style operation.
-.Pp
-The target process, whether it is running or not running, will resume
-execution after all other runnable processes of equal or greater
-priority have been scheduled to run.
-.Pp
-If the priority of the process specified by the
-.Fa pid
-argument is set higher than that of the lowest priority running process
-and if the specified process is ready to run, the process specified by
-the
-.Fa pid
-argument will preempt a lowest priority running process.
-Similarly, if
-the process calling
-.Fn sched_setparam
-sets its own priority lower than that of one or more other nonempty
-process lists, then the process that is the head of the highest priority
-list will also preempt the calling process.
-Thus, in either case, the
-originating process might not receive notification of the completion of
-the requested priority change until the higher priority process has
-executed.
-.Pp
-In this implementation, when the current scheduling policy for the
-process specified by
-.Fa pid
-is normal timesharing (SCHED_OTHER, aka SCHED_NORMAL when not POSIX-source)
-or the idle policy (SCHED_IDLE when not POSIX-source) then the behavior
-is as if the process had been running under SCHED_RR with a priority
-lower than any actual realtime priority.
-.Pp
-The
-.Fn sched_getparam
-system call will return the scheduling parameters of a process specified
-by
-.Fa pid
-in the
-.Fa sched_param
-structure pointed to by
-.Fa param .
-.Pp
-If a process specified by
-.Fa pid
-exists and if the calling process has permission,
-the scheduling parameters for the process whose process ID is equal to
-.Fa pid
-are returned.
-.Pp
-In this implementation, the policy of when a process can obtain the
-scheduling parameters of another process are detailed in
-.St -p1003.1b-93
-as a read-style operation.
-.Pp
-If
-.Fa pid
-is zero, the scheduling parameters for the calling process will be
-returned.
-In this implementation, the
-.Fa sched_getparam
-system call will fail if
-.Fa pid
-is negative.
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-On failure
-.Va errno
-will be set to the corresponding value:
-.Bl -tag -width Er
-.It Bq Er ENOSYS
-The system is not configured to support this functionality.
-.It Bq Er EPERM
-The requesting process doesn not have permission as detailed in
-.St -p1003.1b-93 .
-.It Bq Er ESRCH
-No process can be found corresponding to that specified by
-.Fa pid .
-.It Bq Er EINVAL
-For
-.Fn sched_setparam :
-one or more of the requested scheduling parameters
-is outside the range defined for the scheduling policy of the specified
-.Fa pid .
-.El
-.Sh SEE ALSO
-.Xr sched_get_priority_max 2 ,
-.Xr sched_get_priority_min 2 ,
-.Xr sched_getscheduler 2 ,
-.Xr sched_rr_get_interval 2 ,
-.Xr sched_setscheduler 2 ,
-.Xr sched_yield 2
-.Sh STANDARDS
-The
-.Fn sched_setparam
-and
-.Fn sched_getparam
-system calls conform to
-.St -p1003.1b-93 .
diff --git a/lib/libc/sys/sched_setscheduler.2 b/lib/libc/sys/sched_setscheduler.2
deleted file mode 100644
index b84c1a1c9e35..000000000000
--- a/lib/libc/sys/sched_setscheduler.2
+++ /dev/null
@@ -1,166 +0,0 @@
-.\" $FreeBSD$
-.\" Copyright (c) 1998 HD Associates, Inc.
-.\" All rights reserved.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.Dd March 12, 1998
-.Dt SCHED_SETSCHEDULER 2
-.Os
-.Sh NAME
-.Nm sched_setscheduler ,
-.Nm sched_getscheduler
-.Nd set/get scheduling policy and scheduler parameters
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sched.h
-.Ft int
-.Fn sched_setscheduler "pid_t pid" "int policy" "const struct sched_param *param"
-.Ft int
-.Fn sched_getscheduler "pid_t pid"
-.Sh DESCRIPTION
-The
-.Fn sched_setscheduler
-system call sets the scheduling policy and scheduling parameters
-of the process specified by
-.Fa pid
-to
-.Fa policy
-and the parameters specified in the
-.Vt sched_param
-structure pointed to by
-.Fa param ,
-respectively.
-The value of the
-.Fa sched_priority
-member in the
-.Fa param
-structure must be any integer within the inclusive priority range for
-the scheduling policy specified by
-.Fa policy .
-.Pp
-In this implementation, if the value of
-.Fa pid
-is negative the system call will fail.
-.Pp
-If a process specified by
-.Fa pid
-exists and if the calling process has permission, the scheduling
-policy and scheduling parameters will be set for the process
-whose process ID is equal to
-.Fa pid .
-.Pp
-If
-.Fa pid
-is zero, the scheduling policy and scheduling
-parameters are set for the calling process.
-.Pp
-In this implementation, the policy of when a process can affect
-the scheduling parameters of another process is specified in
-.St -p1003.1b-93
-as a write-style operation.
-.Pp
-The scheduling policies are in
-.Fa <sched.h> :
-.Bl -tag -width [SCHED_OTHER]
-.It Bq Er SCHED_FIFO
-First-in-first-out fixed priority scheduling with no round robin scheduling;
-.It Bq Er SCHED_OTHER
-The standard time sharing scheduler;
-.It Bq Er SCHED_RR
-Round-robin scheduling across same priority processes.
-.El
-.Pp
-The
-.Vt sched_param
-structure is defined in
-.Fa <sched.h> :
-.Bd -literal -offset indent
-struct sched_param {
- int sched_priority; /* scheduling priority */
-};
-.Ed
-.Pp
-The
-.Fn sched_getscheduler
-system call returns the scheduling policy of the process specified
-by
-.Fa pid .
-.Pp
-If a process specified by
-.Fa pid
-exists and if the calling process has permission,
-the scheduling parameters for the process whose process ID is equal to
-.Fa pid
-are returned.
-.Pp
-In this implementation, the policy of when a process can obtain the
-scheduling parameters of another process are detailed in
-.St -p1003.1b-93
-as a read-style operation.
-.Pp
-If
-.Fa pid
-is zero, the scheduling parameters for the calling process will be
-returned.
-In this implementation, the
-.Fa sched_getscheduler
-system call will fail if
-.Fa pid
-is negative.
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-On failure
-.Va errno
-will be set to the corresponding value:
-.Bl -tag -width Er
-.It Bq Er ENOSYS
-The system is not configured to support this functionality.
-.It Bq Er EPERM
-The requesting process doesn not have permission as detailed in
-.St -p1003.1b-93 .
-.It Bq Er ESRCH
-No process can be found corresponding to that specified by
-.Fa pid .
-.It Bq Er EINVAL
-The value of the
-.Fa policy
-argument is invalid, or one or more of the parameters contained in
-.Fa param
-is outside the valid range for the specified scheduling policy.
-.El
-.Sh SEE ALSO
-.Xr sched_get_priority_max 2 ,
-.Xr sched_get_priority_min 2 ,
-.Xr sched_getparam 2 ,
-.Xr sched_rr_get_interval 2 ,
-.Xr sched_setparam 2 ,
-.Xr sched_yield 2
-.Sh STANDARDS
-The
-.Fn sched_setscheduler
-and
-.Fn sched_getscheduler
-system calls conform to
-.St -p1003.1b-93 .
diff --git a/lib/libc/sys/sched_yield.2 b/lib/libc/sys/sched_yield.2
deleted file mode 100644
index 9db8942249e2..000000000000
--- a/lib/libc/sys/sched_yield.2
+++ /dev/null
@@ -1,58 +0,0 @@
-.\" $FreeBSD$
-.\" Copyright (c) 1998 HD Associates, Inc.
-.\" All rights reserved.
-.\"
-.\" 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 AUTHOR 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 AUTHOR 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.
-.\"
-.Dd March 12, 1998
-.Dt SCHED_YIELD 2
-.Os
-.Sh NAME
-.Nm sched_yield
-.Nd yield processor
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sched.h
-.Ft int
-.Fn sched_yield void
-.Sh DESCRIPTION
-The
-.Fn sched_yield
-system call forces the running process to relinquish the processor until it
-again becomes the head of its process list.
-It takes no arguments.
-.Sh RETURN VALUES
-.Rv -std sched_yield
-.Sh ERRORS
-On failure
-.Va errno
-will be set to the corresponding value:
-.Bl -tag -width Er
-.It Bq Er ENOSYS
-The system is not configured to support this functionality.
-.El
-.Sh STANDARDS
-The
-.Fn sched_yield
-system call conforms to
-.St -p1003.1b-93 .
diff --git a/lib/libc/sys/sctp_generic_recvmsg.2 b/lib/libc/sys/sctp_generic_recvmsg.2
deleted file mode 100644
index 8ee3d36f90e9..000000000000
--- a/lib/libc/sys/sctp_generic_recvmsg.2
+++ /dev/null
@@ -1,74 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd October 30, 2007
-.Dt SCTP_GENERIC_RECVMSG 2
-.Os
-.Sh NAME
-.Nm sctp_generic_recvmsg
-.Nd receive data from a peer
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In sys/socket.h
-.In netinet/sctp.h
-.Ft int
-.Fn sctp_generic_recvmsg "int s" "struct iovec *iov" "int iovlen" "struct sockaddr *from" "socklen_t *fromlen" "struct sctp_sndrcvinfo *sinfo" "int *msgflags"
-.Sh DESCRIPTION
-.Fn sctp_generic_recvmsg
-is the true system call used by the
-.Xr sctp_recvmsg 3
-function call.
-This call is more efficient since it is a
-true system call but it is specific to
-.Fx
-and can be expected
-.Em not
-to be present on any other operating
-system.
-For detailed usage please see the
-.Xr sctp_recvmsg 3
-function call.
-.Sh RETURN VALUES
-The call returns the number of bytes read on success and -1 upon failure.
-.Sh ERRORS
-.Bl -tag -width Er
-.It Bq Er EBADF
-The argument
-.Fa s
-is not a valid descriptor.
-.It Bq Er ENOTSOCK
-The argument
-.Fa s
-is not a socket.
-.El
-.Sh SEE ALSO
-.Xr sctp_recvmsg 3 ,
-.Xr sctp 4
diff --git a/lib/libc/sys/sctp_generic_sendmsg.2 b/lib/libc/sys/sctp_generic_sendmsg.2
deleted file mode 100644
index bf54e95473d5..000000000000
--- a/lib/libc/sys/sctp_generic_sendmsg.2
+++ /dev/null
@@ -1,86 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd October 30, 2007
-.Dt SCTP_GENERIC_SENDMSG 2
-.Os
-.Sh NAME
-.Nm sctp_generic_sendmsg
-.Nm sctp_generic_sendmsg_iov
-.Nd send data to a peer
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In sys/socket.h
-.In netinet/sctp.h
-.Ft int
-.Fn sctp_generic_sendmsg "int s" "void *msg" "int msglen" "struct sockaddr *to" "socklen_t len" "struct sctp_sndrcvinfo *sinfo" "int flags"
-.Ft int
-.Fn sctp_generic_sendmsg_iov "int s" "struct iovec *iov" "int iovlen" "struct sockaddr *to" "struct sctp_sndrcvinfo *sinfo" "int flags"
-.Sh DESCRIPTION
-.Fn sctp_generic_sendmsg
-and
-.Fn sctp_generic_sendmsg_iov
-are the true system calls used by the
-.Xr sctp_sendmsg 3
-and
-.Xr sctp_send 3
-function calls.
-These are more efficient since they are
-true system calls but they are specific to
-.Fx
-and can be expected
-.Em not
-to be present on any other operating
-system.
-For detailed usage please see either the
-.Xr sctp_send 3
-or
-.Xr sctp_sendmsg 3
-function calls.
-.Sh RETURN VALUES
-The call returns the number of bytes written on success and -1 upon failure.
-.Sh ERRORS
-.Bl -tag -width Er
-.It Bq Er EBADF
-The argument
-.Fa s
-is not a valid descriptor.
-.It Bq Er ENOTSOCK
-The argument
-.Fa s
-is not a socket.
-.El
-.Sh SEE ALSO
-.Xr sctp_send 3 ,
-.Xr sctp_sendmsg 3 ,
-.Xr sctp_sendmsgx 3 ,
-.Xr sctp_sendx 3 ,
-.Xr sctp 4
diff --git a/lib/libc/sys/sctp_peeloff.2 b/lib/libc/sys/sctp_peeloff.2
deleted file mode 100644
index 9964586c9e9e..000000000000
--- a/lib/libc/sys/sctp_peeloff.2
+++ /dev/null
@@ -1,76 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd October 30, 2007
-.Dt SCTP_PEELOFF 2
-.Os
-.Sh NAME
-.Nm sctp_peeloff
-.Nd detach an association from a one-to-many socket to its own fd
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In sys/socket.h
-.In netinet/sctp.h
-.Ft int
-.Fn sctp_peeloff "int s" "sctp_assoc_t id"
-.Sh DESCRIPTION
-The
-.Fn sctp_peeloff
-system call attempts detach the association specified by
-.Fa id
-into its own separate socket.
-.Sh RETURN VALUES
-The call returns -1 on failure and the new socket descriptor
-upon success.
-.Sh ERRORS
-The
-.Fn sctp_peeloff
-system call can return the following errors:
-.Bl -tag -width Er
-.It Bq Er ENOTCONN
-The
-.Fa id
-given to the call does not map to a valid
-association.
-.It Bq Er E2BIG
-The size of the address list exceeds the amount of
-data provided.
-.It Bq Er EBADF
-The argument
-.Fa s
-is not a valid descriptor.
-.It Bq Er ENOTSOCK
-The argument
-.Fa s
-is not a socket.
-.El
-.Sh SEE ALSO
-.Xr sctp 4
diff --git a/lib/libc/sys/select.2 b/lib/libc/sys/select.2
deleted file mode 100644
index 695b60937657..000000000000
--- a/lib/libc/sys/select.2
+++ /dev/null
@@ -1,228 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)select.2 8.2 (Berkeley) 3/25/94
-.\" $FreeBSD$
-.\"
-.Dd June 25, 2020
-.Dt SELECT 2
-.Os
-.Sh NAME
-.Nm select
-.Nd synchronous I/O multiplexing
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/select.h
-.Ft int
-.Fn select "int nfds" "fd_set *readfds" "fd_set *writefds" "fd_set *exceptfds" "struct timeval *timeout"
-.Fn FD_SET fd &fdset
-.Fn FD_CLR fd &fdset
-.Fn FD_ISSET fd &fdset
-.Fn FD_ZERO &fdset
-.Sh DESCRIPTION
-The
-.Fn select
-system call
-examines the I/O descriptor sets whose addresses are passed in
-.Fa readfds ,
-.Fa writefds ,
-and
-.Fa exceptfds
-to see if some of their descriptors
-are ready for reading, are ready for writing, or have an exceptional
-condition pending, respectively.
-The only exceptional condition detectable is out-of-band
-data received on a socket.
-The first
-.Fa nfds
-descriptors are checked in each set;
-i.e., the descriptors from 0 through
-.Fa nfds Ns No -1
-in the descriptor sets are examined.
-On return,
-.Fn select
-replaces the given descriptor sets
-with subsets consisting of those descriptors that are ready
-for the requested operation.
-The
-.Fn select
-system call
-returns the total number of ready descriptors in all the sets.
-.Pp
-The descriptor sets are stored as bit fields in arrays of integers.
-The following macros are provided for manipulating such descriptor sets:
-.Fn FD_ZERO &fdset
-initializes a descriptor set
-.Fa fdset
-to the null set.
-.Fn FD_SET fd &fdset
-includes a particular descriptor
-.Fa fd
-in
-.Fa fdset .
-.Fn FD_CLR fd &fdset
-removes
-.Fa fd
-from
-.Fa fdset .
-.Fn FD_ISSET fd &fdset
-is non-zero if
-.Fa fd
-is a member of
-.Fa fdset ,
-zero otherwise.
-The behavior of these macros is undefined if
-a descriptor value is less than zero or greater than or equal to
-.Dv FD_SETSIZE ,
-which is normally at least equal
-to the maximum number of descriptors supported by the system.
-.Pp
-If
-.Fa timeout
-is not a null pointer, it specifies the maximum interval to wait for the
-selection to complete.
-System activity can lengthen the interval by
-an indeterminate amount.
-.Pp
-If
-.Fa timeout
-is a null pointer, the select blocks indefinitely.
-.Pp
-To effect a poll, the
-.Fa timeout
-argument should not be a null pointer,
-but it should point to a zero-valued timeval structure.
-.Pp
-Any of
-.Fa readfds ,
-.Fa writefds ,
-and
-.Fa exceptfds
-may be given as null pointers if no descriptors are of interest.
-.Sh RETURN VALUES
-The
-.Fn select
-system call
-returns the number of ready descriptors that are contained in
-the descriptor sets,
-or -1 if an error occurred.
-If the time limit expires,
-.Fn select
-returns 0.
-If
-.Fn select
-returns with an error,
-including one due to an interrupted system call,
-the descriptor sets will be unmodified.
-.Sh ERRORS
-An error return from
-.Fn select
-indicates:
-.Bl -tag -width Er
-.It Bq Er EBADF
-One of the descriptor sets specified an invalid descriptor.
-.It Bq Er EFAULT
-One of the arguments
-.Fa readfds , writefds , exceptfds ,
-or
-.Fa timeout
-points to an invalid address.
-.It Bq Er EINTR
-A signal was delivered before the time limit expired and
-before any of the selected events occurred.
-.It Bq Er EINVAL
-The specified time limit is invalid.
-One of its components is
-negative or too large.
-.It Bq Er EINVAL
-The
-.Fa nfds
-argument
-was invalid.
-.El
-.Sh SEE ALSO
-.Xr accept 2 ,
-.Xr connect 2 ,
-.Xr getdtablesize 2 ,
-.Xr gettimeofday 2 ,
-.Xr kqueue 2 ,
-.Xr poll 2 ,
-.Xr pselect 2 ,
-.Xr read 2 ,
-.Xr recv 2 ,
-.Xr send 2 ,
-.Xr write 2 ,
-.Xr clocks 7
-.Sh NOTES
-The default size of
-.Dv FD_SETSIZE
-is currently 1024.
-In order to accommodate programs which might potentially
-use a larger number of open files with
-.Fn select ,
-it is possible
-to increase this size by having the program define
-.Dv FD_SETSIZE
-before the inclusion of any header which includes
-.In sys/types.h .
-.Pp
-If
-.Fa nfds
-is greater than the number of open files,
-.Fn select
-is not guaranteed to examine the unused file descriptors.
-For historical
-reasons,
-.Fn select
-will always examine the first 256 descriptors.
-.Sh STANDARDS
-The
-.Fn select
-system call and
-.Fn FD_CLR ,
-.Fn FD_ISSET ,
-.Fn FD_SET ,
-and
-.Fn FD_ZERO
-macros conform with
-.St -p1003.1-2001 .
-.Sh HISTORY
-The
-.Fn select
-system call appeared in
-.Bx 4.2 .
-.Sh BUGS
-.St -susv2
-allows systems to modify the original timeout in place.
-Thus, it is unwise to assume that the timeout value will be unmodified
-by the
-.Fn select
-system call.
-.Fx
-does not modify the return value, which can cause problems for applications
-ported from other systems.
diff --git a/lib/libc/sys/select.c b/lib/libc/sys/select.c
index 3990496ec412..bbbcfc8bf1e0 100644
--- a/lib/libc/sys/select.c
+++ b/lib/libc/sys/select.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2014 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/select.h>
#include "libc_private.h"
@@ -43,7 +39,5 @@ __weak_reference(__sys_select, __select);
int
select(int n, fd_set *rs, fd_set *ws, fd_set *es, struct timeval *t)
{
-
- return (((int (*)(int, fd_set *, fd_set *, fd_set *, struct timeval *))
- __libc_interposing[INTERPOS_select])(n, rs, ws, es, t));
+ return (INTERPOS_SYS(select, n, rs, ws, es, t));
}
diff --git a/lib/libc/sys/semctl.2 b/lib/libc/sys/semctl.2
deleted file mode 100644
index 27e7618bce92..000000000000
--- a/lib/libc/sys/semctl.2
+++ /dev/null
@@ -1,202 +0,0 @@
-.\"
-.\" Copyright (c) 1995 David Hovemeyer <daveho@infocom.com>
-.\"
-.\" All rights reserved.
-.\"
-.\" 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 DEVELOPERS ``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 DEVELOPERS 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd July 9, 2020
-.Dt SEMCTL 2
-.Os
-.Sh NAME
-.Nm semctl
-.Nd control operations on a semaphore set
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In sys/ipc.h
-.In sys/sem.h
-.Ft int
-.Fn semctl "int semid" "int semnum" "int cmd" ...
-.Sh DESCRIPTION
-The
-.Fn semctl
-system call
-performs the operation indicated by
-.Fa cmd
-on the semaphore set indicated by
-.Fa semid .
-A fourth argument, a
-.Fa "union semun arg" ,
-is required for certain values of
-.Fa cmd .
-For the commands that use the
-.Fa arg
-argument,
-.Fa "union semun"
-must be defined as follows:
-.Bd -literal
-union semun {
- int val; /* value for SETVAL */
- struct semid_ds *buf; /* buffer for IPC_STAT & IPC_SET */
- u_short *array; /* array for GETALL & SETALL */
-};
-.Ed
-Non-portable software may define
-.Dv _WANT_SEMUN
-before including
-.Pa sys/sem.h
-to use the system definition of
-.Fa "union semun" .
-.Pp
-Commands are performed as follows:
-.\"
-.\" This section based on Stevens, _Advanced Programming in the UNIX
-.\" Environment_.
-.\"
-.Bl -tag -width IPC_RMIDXXX
-.It Dv IPC_STAT
-Fetch the semaphore set's
-.Fa "struct semid_ds" ,
-storing it in the memory pointed to by
-.Fa arg.buf .
-.It Dv IPC_SET
-Changes the
-.Fa sem_perm.uid ,
-.Fa sem_perm.gid ,
-and
-.Fa sem_perm.mode
-members of the semaphore set's
-.Fa "struct semid_ds"
-to match those of the struct pointed to by
-.Fa arg.buf .
-The calling process's effective uid must
-match either
-.Fa sem_perm.uid
-or
-.Fa sem_perm.cuid ,
-or it must have superuser privileges.
-.It IPC_RMID
-Immediately removes the semaphore set from the system.
-The calling
-process's effective uid must equal the semaphore set's
-.Fa sem_perm.uid
-or
-.Fa sem_perm.cuid ,
-or the process must have superuser privileges.
-.It Dv GETVAL
-Return the value of semaphore number
-.Fa semnum .
-.It Dv SETVAL
-Set the value of semaphore number
-.Fa semnum
-to
-.Fa arg.val .
-Outstanding adjust on exit values for this semaphore in any process
-are cleared.
-.It Dv GETPID
-Return the pid of the last process to perform an operation on
-semaphore number
-.Fa semnum .
-.It Dv GETNCNT
-Return the number of processes waiting for semaphore number
-.Fa semnum Ns 's
-value to become greater than its current value.
-.It Dv GETZCNT
-Return the number of processes waiting for semaphore number
-.Fa semnum Ns 's
-value to become 0.
-.It Dv GETALL
-Fetch the value of all of the semaphores in the set into the
-array pointed to by
-.Fa arg.array .
-.It Dv SETALL
-Set the values of all of the semaphores in the set to the values
-in the array pointed to by
-.Fa arg.array .
-Outstanding adjust on exit values for all semaphores in this set,
-in any process are cleared.
-.El
-.Pp
-The
-.Vt "struct semid_ds"
-is defined as follows:
-.\"
-.\" Taken straight from <sys/sem.h>.
-.\"
-.Bd -literal
-struct semid_ds {
- struct ipc_perm sem_perm; /* operation permission struct */
- u_short sem_nsems; /* number of sems in set */
- time_t sem_otime; /* last operation time */
- time_t sem_ctime; /* last change time */
- /* Times measured in secs since */
- /* 00:00:00 GMT, Jan. 1, 1970 */
-};
-.Ed
-.Sh RETURN VALUES
-On success, when
-.Fa cmd
-is one of
-.Dv GETVAL , GETPID , GETNCNT
-or
-.Dv GETZCNT ,
-.Fn semctl
-returns the corresponding value; otherwise, 0 is returned.
-On failure, -1 is returned, and
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-The
-.Fn semctl
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-No semaphore set corresponds to
-.Fa semid .
-.It Bq Er EINVAL
-The
-.Fa semnum
-argument
-is not in the range of valid semaphores for given semaphore set.
-.It Bq Er EPERM
-The calling process's effective uid does not match the uid of
-the semaphore set's owner or creator.
-.It Bq Er EACCES
-Permission denied due to mismatch between operation and mode of
-semaphore set.
-.It Bq Er ERANGE
-.Dv SETVAL
-or
-.Dv SETALL
-attempted to set a semaphore outside the allowable range
-.Bq 0 .. Dv SEMVMX .
-.El
-.Sh SEE ALSO
-.Xr semget 2 ,
-.Xr semop 2
-.Sh BUGS
-.Dv SETALL
-may update some semaphore elements before returning an error.
diff --git a/lib/libc/sys/semget.2 b/lib/libc/sys/semget.2
deleted file mode 100644
index 9da6975b363d..000000000000
--- a/lib/libc/sys/semget.2
+++ /dev/null
@@ -1,156 +0,0 @@
-.\"
-.\" Copyright (c) 1995 David Hovemeyer <daveho@infocom.com>
-.\"
-.\" All rights reserved.
-.\"
-.\" 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 DEVELOPERS ``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 DEVELOPERS 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd March 4, 2018
-.Dt SEMGET 2
-.Os
-.Sh NAME
-.Nm semget
-.Nd obtain a semaphore id
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/sem.h
-.Ft int
-.Fn semget "key_t key" "int nsems" "int flag"
-.Sh DESCRIPTION
-Based on the values of
-.Fa key
-and
-.Fa flag ,
-.Fn semget
-returns the identifier of a newly created or previously existing
-set of semaphores.
-.\"
-.\" This is copied verbatim from the shmget manpage. Perhaps
-.\" it should go in a common manpage, such as .Xr ipc 2
-.\"
-The key
-is analogous to a filename: it provides a handle that names an
-IPC object.
-There are three ways to specify a key:
-.Bl -bullet
-.It
-IPC_PRIVATE may be specified, in which case a new IPC object
-will be created.
-.It
-An integer constant may be specified.
-If no IPC object corresponding
-to
-.Fa key
-is specified and the IPC_CREAT bit is set in
-.Fa flag ,
-a new one will be created.
-.It
-The
-.Xr ftok 3
-function
-may be used to generate a key from a pathname.
-.El
-.\"
-.\" Likewise for this section, except SHM_* becomes SEM_*.
-.\"
-.Pp
-The mode of a newly created IPC object is determined by ORing these constants
-into the
-.Fa flag
-argument:
-.Bl -tag -width 0000
-.It Dv 0400
-Read access for user.
-.It Dv 0200
-Alter access for user.
-.It Dv 0040
-Read access for group.
-.It Dv 0020
-Alter access for group.
-.It Dv 0004
-Read access for other.
-.It Dv 0002
-Alter access for other.
-.El
-.Pp
-If a new set of semaphores is being created,
-.Fa nsems
-is used to indicate the number of semaphores the set should contain.
-Otherwise,
-.Fa nsems
-may be specified as 0.
-.Sh RETURN VALUES
-The
-.Fn semget
-system call
-returns the id of a semaphore set if successful; otherwise, -1
-is returned and
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-The
-.Fn semget
-system call
-will fail if:
-.Bl -tag -width Er
-.\" ipcperm could fail (we are opening to read and write, as it were)
-.It Bq Er EACCES
-Access permission failure.
-.\"
-.\" sysv_sem.c is quite explicit about these, so I'm pretty sure
-.\" this is accurate
-.\"
-.It Bq Er EEXIST
-IPC_CREAT and IPC_EXCL were specified, and a semaphore set
-corresponding to
-.Fa key
-already exists.
-.It Bq Er EINVAL
-The number of semaphores requested exceeds the system imposed maximum
-per set.
-.It Bq Er EINVAL
-A semaphore set corresponding to
-.Fa key
-already exists and contains fewer semaphores than
-.Fa nsems .
-.It Bq Er EINVAL
-A semaphore set corresponding to
-.Fa key
-does not exist and
-.Fa nsems
-is 0 or negative.
-.It Bq Er ENOSPC
-Insufficiently many semaphores are available.
-.It Bq Er ENOSPC
-The kernel could not allocate a
-.Fa "struct semid_ds" .
-.It Bq Er ENOENT
-No semaphore set was found corresponding to
-.Fa key ,
-and IPC_CREAT was not specified.
-.El
-.Sh SEE ALSO
-.Xr semctl 2 ,
-.Xr semop 2 ,
-.Xr ftok 3
diff --git a/lib/libc/sys/semop.2 b/lib/libc/sys/semop.2
deleted file mode 100644
index a08f65e8e8bd..000000000000
--- a/lib/libc/sys/semop.2
+++ /dev/null
@@ -1,289 +0,0 @@
-.\"
-.\" Copyright (c) 1995 David Hovemeyer <daveho@infocom.com>
-.\"
-.\" All rights reserved.
-.\"
-.\" 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 DEVELOPERS ``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 DEVELOPERS 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd September 22, 1995
-.Dt SEMOP 2
-.Os
-.Sh NAME
-.Nm semop
-.Nd atomic array of operations on a semaphore set
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In sys/ipc.h
-.In sys/sem.h
-.Ft int
-.Fn semop "int semid" "struct sembuf *array" "size_t nops"
-.Sh DESCRIPTION
-The
-.Fn semop
-system call
-atomically performs the array of operations indicated by
-.Fa array
-on the semaphore set indicated by
-.Fa semid .
-The length of
-.Fa array
-is indicated by
-.Fa nops .
-Each operation is encoded in a
-.Vt "struct sembuf" ,
-which is defined as follows:
-.\"
-.\" From <sys/sem.h>
-.\"
-.Bd -literal
-struct sembuf {
- u_short sem_num; /* semaphore # */
- short sem_op; /* semaphore operation */
- short sem_flg; /* operation flags */
-};
-.Ed
-.Pp
-For each element in
-.Fa array ,
-.Va sem_op
-and
-.Va sem_flg
-determine an operation to be performed on semaphore number
-.Va sem_num
-in the set.
-The values
-.Dv SEM_UNDO
-and
-.Dv IPC_NOWAIT
-may be
-.Em OR Ns 'ed
-into the
-.Va sem_flg
-member in order to modify the behavior of the given operation.
-.Pp
-The operation performed depends as follows on the value of
-.Va sem_op :
-.\"
-.\" This section is based on the description of semop() in
-.\" Stevens, _Advanced Programming in the UNIX Environment_,
-.\" and the semop(2) description in The Open Group Unix2 specification.
-.\"
-.Bl -bullet
-.It
-When
-.Va sem_op
-is positive and the process has alter permission,
-the semaphore's value is incremented by
-.Va sem_op Ns 's
-value.
-If
-.Dv SEM_UNDO
-is specified, the semaphore's adjust on exit value is decremented by
-.Va sem_op Ns 's
-value.
-A positive value for
-.Va sem_op
-generally corresponds to a process releasing a resource
-associated with the semaphore.
-.It
-The behavior when
-.Va sem_op
-is negative and the process has alter permission,
-depends on the current value of the semaphore:
-.Bl -bullet
-.It
-If the current value of the semaphore is greater than or equal to
-the absolute value of
-.Va sem_op ,
-then the value is decremented by the absolute value of
-.Va sem_op .
-If
-.Dv SEM_UNDO
-is specified, the semaphore's adjust on exit
-value is incremented by the absolute value of
-.Va sem_op .
-.It
-If the current value of the semaphore is less than the absolute value of
-.Va sem_op ,
-one of the following happens:
-.\" XXX a *second* sublist?
-.Bl -bullet
-.It
-If
-.Dv IPC_NOWAIT
-was specified, then
-.Fn semop
-returns immediately with a return value of
-.Er EAGAIN .
-.It
-Otherwise, the calling process is put to sleep until one of the following
-conditions is satisfied:
-.\" XXX We already have two sublists, why not a third?
-.Bl -bullet
-.It
-Some other process removes the semaphore with the
-.Dv IPC_RMID
-option of
-.Xr semctl 2 .
-In this case,
-.Fn semop
-returns immediately with a return value of
-.Er EIDRM .
-.It
-The process receives a signal that is to be caught.
-In this case, the process will resume execution as defined by
-.Xr sigaction 2 .
-.It
-The semaphore's
-value is greater than or equal to the absolute value of
-.Va sem_op .
-When this condition becomes true, the semaphore's value is decremented
-by the absolute value of
-.Va sem_op ,
-the semaphore's adjust on exit value is incremented by the
-absolute value of
-.Va sem_op .
-.El
-.El
-.El
-.Pp
-A negative value for
-.Va sem_op
-generally means that a process is waiting for a resource to become
-available.
-.It
-When
-.Va sem_op
-is zero and the process has read permission,
-one of the following will occur:
-.Bl -bullet
-.It
-If the current value of the semaphore is equal to zero
-then
-.Fn semop
-can return immediately.
-.It
-If
-.Dv IPC_NOWAIT
-was specified, then
-.Fn semop
-returns immediately with a return value of
-.Er EAGAIN .
-.It
-Otherwise, the calling process is put to sleep until one of the following
-conditions is satisfied:
-.\" XXX Another nested sublists
-.Bl -bullet
-.It
-Some other process removes the semaphore with the
-.Dv IPC_RMID
-option of
-.Xr semctl 2 .
-In this case,
-.Fn semop
-returns immediately with a return value of
-.Er EIDRM .
-.It
-The process receives a signal that is to be caught.
-In this case, the process will resume execution as defined by
-.Xr sigaction 2 .
-.It
-The semaphore's value becomes zero.
-.El
-.El
-.El
-.Pp
-For each semaphore a process has in use, the kernel maintains an
-.Dq "adjust on exit"
-value, as alluded to earlier.
-When a process
-exits, either voluntarily or involuntarily, the adjust on exit value
-for each semaphore is added to the semaphore's value.
-This can
-be used to ensure that a resource is released if a process terminates
-unexpectedly.
-.Sh RETURN VALUES
-.Rv -std semop
-.Sh ERRORS
-The
-.Fn semop
-system call will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-No semaphore set corresponds to
-.Fa semid ,
-or the process would exceed the system-defined limit for the number of
-per-process
-.Dv SEM_UNDO
-structures.
-.It Bq Er EACCES
-Permission denied due to mismatch between operation and mode of
-semaphore set.
-.It Bq Er EAGAIN
-The semaphore's value would have resulted in the process being put to sleep
-and
-.Dv IPC_NOWAIT
-was specified.
-.It Bq Er E2BIG
-Too many operations were specified.
-.Bq Dv SEMOPM
-.It Bq Er EFBIG
-.\"
-.\" I'd have thought this would be EINVAL, but the source says
-.\" EFBIG.
-.\"
-.Va sem_num
-was not in the range of valid semaphores for the set.
-.It Bq Er EIDRM
-The semaphore set was removed from the system.
-.It Bq Er EINTR
-The
-.Fn semop
-system call was interrupted by a signal.
-.It Bq Er ENOSPC
-The system
-.Dv SEM_UNDO
-pool
-.Bq Dv SEMMNU
-is full.
-.It Bq Er ERANGE
-The requested operation would cause either
-the semaphore's current value
-.Bq Dv SEMVMX
-or its adjust on exit value
-.Bq Dv SEMAEM
-to exceed the system-imposed limits.
-.El
-.Sh SEE ALSO
-.Xr semctl 2 ,
-.Xr semget 2 ,
-.Xr sigaction 2
-.Sh BUGS
-The
-.Fn semop
-system call
-may block waiting for memory even if
-.Dv IPC_NOWAIT
-was specified.
diff --git a/lib/libc/sys/send.2 b/lib/libc/sys/send.2
deleted file mode 100644
index dd6406fc6832..000000000000
--- a/lib/libc/sys/send.2
+++ /dev/null
@@ -1,295 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" From: @(#)send.2 8.2 (Berkeley) 2/21/94
-.\" $FreeBSD$
-.\"
-.Dd April 27, 2020
-.Dt SEND 2
-.Os
-.Sh NAME
-.Nm send ,
-.Nm sendto ,
-.Nm sendmsg ,
-.Nm sendmmsg
-.Nd send message(s) from a socket
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/socket.h
-.Ft ssize_t
-.Fn send "int s" "const void *msg" "size_t len" "int flags"
-.Ft ssize_t
-.Fn sendto "int s" "const void *msg" "size_t len" "int flags" "const struct sockaddr *to" "socklen_t tolen"
-.Ft ssize_t
-.Fn sendmsg "int s" "const struct msghdr *msg" "int flags"
-.Ft ssize_t
-.Fn sendmmsg "int s" "struct mmsghdr * restrict msgvec" "size_t vlen" "int flags"
-.Sh DESCRIPTION
-The
-.Fn send
-and
-.Fn sendmmsg
-functions,
-and
-.Fn sendto
-and
-.Fn sendmsg
-system calls
-are used to transmit one or more messages (with the
-.Fn sendmmsg
-call) to
-another socket.
-The
-.Fn send
-function
-may be used only when the socket is in a
-.Em connected
-state.
-The functions
-.Fn sendto ,
-.Fn sendmsg
-and
-.Fn sendmmsg
-may be used at any time if the socket is connectionless-mode.
-If the socket is connection-mode, the protocol
-must support implied connect (currently
-.Xr tcp 4
-is the only protocol with support) or the socket must be in a
-connected state before use.
-.Pp
-The address of the target is given by
-.Fa to
-with
-.Fa tolen
-specifying its size, or the equivalent
-.Fa msg_name
-and
-.Fa msg_namelen
-in
-.Fa struct msghdr .
-If the socket is in a connected state, the target address passed to
-.Fn sendto ,
-.Fn sendmsg
-or
-.Fn sendmmsg
-is ignored.
-The length of the message is given by
-.Fa len .
-If the message is too long to pass atomically through the
-underlying protocol, the error
-.Er EMSGSIZE
-is returned, and
-the message is not transmitted.
-.Pp
-The
-.Fn sendmmsg
-function sends multiple messages at a call.
-They are given by the
-.Fa msgvec
-vector along with
-.Fa vlen
-specifying the vector size.
-The number of octets sent per each message is placed in the
-.Fa msg_len
-field of each processed element of the vector after transmission.
-.Pp
-No indication of failure to deliver is implicit in a
-.Fn send .
-Locally detected errors are indicated by a return value of -1.
-.Pp
-If no messages space is available at the socket to hold
-the message to be transmitted, then
-.Fn send
-normally blocks, unless the socket has been placed in
-non-blocking I/O mode.
-The
-.Xr select 2
-system call may be used to determine when it is possible to
-send more data.
-.Pp
-The
-.Fa flags
-argument may include one or more of the following:
-.Bd -literal
-#define MSG_OOB 0x00001 /* process out-of-band data */
-#define MSG_DONTROUTE 0x00004 /* bypass routing, use direct interface */
-#define MSG_EOR 0x00008 /* data completes record */
-#define MSG_DONTWAIT 0x00080 /* do not block */
-#define MSG_EOF 0x00100 /* data completes transaction */
-#define MSG_NOSIGNAL 0x20000 /* do not generate SIGPIPE on EOF */
-.Ed
-.Pp
-The flag
-.Dv MSG_OOB
-is used to send
-.Dq out-of-band
-data on sockets that support this notion (e.g.\&
-.Dv SOCK_STREAM ) ;
-the underlying protocol must also support
-.Dq out-of-band
-data.
-.Dv MSG_EOR
-is used to indicate a record mark for protocols which support the
-concept.
-The
-.Dv MSG_DONTWAIT
-flag request the call to return when it would block otherwise.
-.Dv MSG_EOF
-requests that the sender side of a socket be shut down, and that an
-appropriate indication be sent at the end of the specified data;
-this flag is only implemented for
-.Dv SOCK_STREAM
-sockets in the
-.Dv PF_INET
-protocol family.
-.Dv MSG_DONTROUTE
-is usually used only by diagnostic or routing programs.
-.Dv MSG_NOSIGNAL
-is used to prevent
-.Dv SIGPIPE
-generation when writing a socket that
-may be closed.
-.Pp
-See
-.Xr recv 2
-for a description of the
-.Fa msghdr
-structure and the
-.Fa mmsghdr
-structure.
-.Sh RETURN VALUES
-The
-.Fn send ,
-.Fn sendto
-and
-.Fn sendmsg
-calls
-return the number of octets sent.
-The
-.Fn sendmmsg
-call returns the number of messages sent.
-If an error occurred a value of -1 is returned.
-.Sh ERRORS
-The
-.Fn send
-and
-.Fn sendmmsg
-functions and
-.Fn sendto
-and
-.Fn sendmsg
-system calls
-fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-An invalid descriptor was specified.
-.It Bq Er EACCES
-The destination address is a broadcast address, and
-.Dv SO_BROADCAST
-has not been set on the socket.
-.It Bq Er ENOTCONN
-The socket is connection-mode but is not connected.
-.It Bq Er ENOTSOCK
-The argument
-.Fa s
-is not a socket.
-.It Bq Er EFAULT
-An invalid user space address was specified for an argument.
-.It Bq Er EMSGSIZE
-The socket requires that message be sent atomically,
-and the size of the message to be sent made this impossible.
-.It Bq Er EAGAIN
-The socket is marked non-blocking, or
-.Dv MSG_DONTWAIT
-is specified, and the requested operation would block.
-.It Bq Er ENOBUFS
-The system was unable to allocate an internal buffer.
-The operation may succeed when buffers become available.
-.It Bq Er ENOBUFS
-The output queue for a network interface was full.
-This generally indicates that the interface has stopped sending,
-but may be caused by transient congestion.
-.It Bq Er EHOSTUNREACH
-The remote host was unreachable.
-.It Bq Er EISCONN
-A destination address was specified and the socket is already connected.
-.It Bq Er ECONNREFUSED
-The socket received an ICMP destination unreachable message
-from the last message sent.
-This typically means that the
-receiver is not listening on the remote port.
-.It Bq Er EHOSTDOWN
-The remote host was down.
-.It Bq Er ENETDOWN
-The remote network was down.
-.It Bq Er EADDRNOTAVAIL
-The process using a
-.Dv SOCK_RAW
-socket was jailed and the source
-address specified in the IP header did not match the IP
-address bound to the prison.
-.It Bq Er EPIPE
-The socket is unable to send anymore data
-.Dv ( SBS_CANTSENDMORE
-has been set on the socket).
-This typically means that the socket
-is not connected.
-.El
-.Sh SEE ALSO
-.Xr connect 2 ,
-.Xr fcntl 2 ,
-.Xr getsockopt 2 ,
-.Xr recv 2 ,
-.Xr select 2 ,
-.Xr socket 2 ,
-.Xr write 2 ,
-.Xr CMSG_DATA 3
-.Sh HISTORY
-The
-.Fn send
-function appeared in
-.Bx 4.2 .
-The
-.Fn sendmmsg
-function appeared in
-.Fx 11.0 .
-.Sh BUGS
-Because
-.Fn sendmsg
-does not necessarily block until the data has been transferred, it
-is possible to transfer an open file descriptor across an
-.Dv AF_UNIX
-domain socket
-(see
-.Xr recv 2 ) ,
-then
-.Fn close
-it before it has actually been sent, the result being that the receiver
-gets a closed file descriptor.
-It is left to the application to
-implement an acknowledgment mechanism to prevent this from happening.
diff --git a/lib/libc/net/send.c b/lib/libc/sys/send.c
index b0c179c2e6b4..82715c1b880b 100644
--- a/lib/libc/net/send.c
+++ b/lib/libc/sys/send.c
@@ -29,12 +29,6 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)send.c 8.2 (Berkeley) 2/21/94";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/socket.h>
#include "libc_private.h"
@@ -48,8 +42,5 @@ send(int s, const void *msg, size_t len, int flags)
* POSIX says send() shall be a cancellation point, so call the
* cancellation-enabled sendto() and not _sendto().
*/
- return (((ssize_t (*)(int, const void *, size_t, int,
- const struct sockaddr *, socklen_t))
- __libc_interposing[INTERPOS_sendto])(s, msg, len, flags,
- NULL, 0));
+ return (INTERPOS_SYS(sendto, s, msg, len, flags, NULL, 0));
}
diff --git a/lib/libc/sys/sendfile.2 b/lib/libc/sys/sendfile.2
deleted file mode 100644
index 63e9b707f53a..000000000000
--- a/lib/libc/sys/sendfile.2
+++ /dev/null
@@ -1,445 +0,0 @@
-.\" Copyright (c) 2003, David G. Lawrence
-.\" All rights reserved.
-.\"
-.\" 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 unmodified, 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 AUTHOR 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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2020
-.Dt SENDFILE 2
-.Os
-.Sh NAME
-.Nm sendfile
-.Nd send a file to a socket
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In sys/socket.h
-.In sys/uio.h
-.Ft int
-.Fo sendfile
-.Fa "int fd" "int s" "off_t offset" "size_t nbytes"
-.Fa "struct sf_hdtr *hdtr" "off_t *sbytes" "int flags"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn sendfile
-system call
-sends a regular file or shared memory object specified by descriptor
-.Fa fd
-out a stream socket specified by descriptor
-.Fa s .
-.Pp
-The
-.Fa offset
-argument specifies where to begin in the file.
-Should
-.Fa offset
-fall beyond the end of file, the system will return
-success and report 0 bytes sent as described below.
-The
-.Fa nbytes
-argument specifies how many bytes of the file should be sent, with 0 having the special
-meaning of send until the end of file has been reached.
-.Pp
-An optional header and/or trailer can be sent before and after the file data by specifying
-a pointer to a
-.Vt "struct sf_hdtr" ,
-which has the following structure:
-.Pp
-.Bd -literal -offset indent -compact
-struct sf_hdtr {
- struct iovec *headers; /* pointer to header iovecs */
- int hdr_cnt; /* number of header iovecs */
- struct iovec *trailers; /* pointer to trailer iovecs */
- int trl_cnt; /* number of trailer iovecs */
-};
-.Ed
-.Pp
-The
-.Fa headers
-and
-.Fa trailers
-pointers, if
-.Pf non- Dv NULL ,
-point to arrays of
-.Vt "struct iovec"
-structures.
-See the
-.Fn writev
-system call for information on the iovec structure.
-The number of iovecs in these
-arrays is specified by
-.Fa hdr_cnt
-and
-.Fa trl_cnt .
-.Pp
-If
-.Pf non- Dv NULL ,
-the system will write the total number of bytes sent on the socket to the
-variable pointed to by
-.Fa sbytes .
-.Pp
-The least significant 16 bits of
-.Fa flags
-argument is a bitmap of these values:
-.Bl -tag -offset indent -width "SF_USER_READAHEAD"
-.It Dv SF_NODISKIO
-This flag causes
-.Nm
-to return
-.Er EBUSY
-instead of blocking when a busy page is encountered.
-This rare situation can happen if some other process is now working
-with the same region of the file.
-It is advised to retry the operation after a short period.
-.Pp
-Note that in older
-.Fx
-versions the
-.Dv SF_NODISKIO
-had slightly different notion.
-The flag prevented
-.Nm
-to run I/O operations in case if an invalid (not cached) page is encountered,
-thus avoiding blocking on I/O.
-Starting with
-.Fx 11
-.Nm
-sending files off the
-.Xr ffs 7
-filesystem does not block on I/O
-(see
-.Sx IMPLEMENTATION NOTES
-), so the condition no longer applies.
-However, it is safe if an application utilizes
-.Dv SF_NODISKIO
-and on
-.Er EBUSY
-performs the same action as it did in
-older
-.Fx
-versions, e.g.,
-.Xr aio_read 2 ,
-.Xr read 2
-or
-.Nm
-in a different context.
-.It Dv SF_NOCACHE
-The data sent to socket will not be cached by the virtual memory system,
-and will be freed directly to the pool of free pages.
-.It Dv SF_SYNC
-.Nm
-sleeps until the network stack no longer references the VM pages
-of the file, making subsequent modifications to it safe.
-Please note that this is not a guarantee that the data has actually
-been sent.
-.It Dv SF_USER_READAHEAD
-.Nm
-has some internal heuristics to do readahead when sending data.
-This flag forces
-.Nm
-to override any heuristically calculated readahead and use exactly the
-application specified readahead.
-See
-.Sx SETTING READAHEAD
-for more details on readahead.
-.El
-.Pp
-When using a socket marked for non-blocking I/O,
-.Fn sendfile
-may send fewer bytes than requested.
-In this case, the number of bytes successfully
-written is returned in
-.Fa *sbytes
-(if specified),
-and the error
-.Er EAGAIN
-is returned.
-.Sh SETTING READAHEAD
-.Nm
-uses internal heuristics based on request size and file system layout
-to do readahead.
-Additionally application may request extra readahead.
-The most significant 16 bits of
-.Fa flags
-specify amount of pages that
-.Nm
-may read ahead when reading the file.
-A macro
-.Fn SF_FLAGS
-is provided to combine readahead amount and flags.
-An example showing specifying readahead of 16 pages and
-.Dv SF_NOCACHE
-flag:
-.Pp
-.Bd -literal -offset indent -compact
- SF_FLAGS(16, SF_NOCACHE)
-.Ed
-.Pp
-.Nm
-will use either application specified readahead or internally calculated,
-whichever is bigger.
-Setting flag
-.Dv SF_USER_READAHEAD
-would turn off any heuristics and set maximum possible readahead length to
-the number of pages specified via flags.
-.Sh IMPLEMENTATION NOTES
-The
-.Fx
-implementation of
-.Fn sendfile
-does not block on disk I/O when it sends a file off the
-.Xr ffs 7
-filesystem.
-The syscall returns success before the actual I/O completes, and data
-is put into the socket later unattended.
-However, the order of data in the socket is preserved, so it is safe
-to do further writes to the socket.
-.Pp
-The
-.Fx
-implementation of
-.Fn sendfile
-is "zero-copy", meaning that it has been optimized so that copying of the file data is avoided.
-.Sh TUNING
-.Ss physical paging buffers
-.Fn sendfile
-uses vnode pager to read file pages into memory.
-The pager uses a pool of physical buffers to run its I/O operations.
-When system runs out of pbufs, sendfile will block and report state
-.Dq Li zonelimit .
-Size of the pool can be tuned with
-.Va vm.vnode_pbufs
-.Xr loader.conf 5
-tunable and can be checked with
-.Xr sysctl 8
-OID of the same name at runtime.
-.Ss sendfile(2) buffers
-On some architectures, this system call internally uses a special
-.Fn sendfile
-buffer
-.Pq Vt "struct sf_buf"
-to handle sending file data to the client.
-If the sending socket is
-blocking, and there are not enough
-.Fn sendfile
-buffers available,
-.Fn sendfile
-will block and report a state of
-.Dq Li sfbufa .
-If the sending socket is non-blocking and there are not enough
-.Fn sendfile
-buffers available, the call will block and wait for the
-necessary buffers to become available before finishing the call.
-.Pp
-The number of
-.Vt sf_buf Ns 's
-allocated should be proportional to the number of nmbclusters used to
-send data to a client via
-.Fn sendfile .
-Tune accordingly to avoid blocking!
-Busy installations that make extensive use of
-.Fn sendfile
-may want to increase these values to be inline with their
-.Va kern.ipc.nmbclusters
-(see
-.Xr tuning 7
-for details).
-.Pp
-The number of
-.Fn sendfile
-buffers available is determined at boot time by either the
-.Va kern.ipc.nsfbufs
-.Xr loader.conf 5
-variable or the
-.Dv NSFBUFS
-kernel configuration tunable.
-The number of
-.Fn sendfile
-buffers scales with
-.Va kern.maxusers .
-The
-.Va kern.ipc.nsfbufsused
-and
-.Va kern.ipc.nsfbufspeak
-read-only
-.Xr sysctl 8
-variables show current and peak
-.Fn sendfile
-buffers usage respectively.
-These values may also be viewed through
-.Nm netstat Fl m .
-.Pp
-If
-.Xr sysctl 8
-OID
-.Va kern.ipc.nsfbufs
-doesn't exist, your architecture does not need to use
-.Fn sendfile
-buffers because their task can be efficiently performed
-by the generic virtual memory structures.
-.Sh RETURN VALUES
-.Rv -std sendfile
-.Sh ERRORS
-.Bl -tag -width Er
-.It Bq Er EAGAIN
-The socket is marked for non-blocking I/O and not all data was sent due to
-the socket buffer being filled.
-If specified, the number of bytes successfully sent will be returned in
-.Fa *sbytes .
-.It Bq Er EBADF
-The
-.Fa fd
-argument
-is not a valid file descriptor.
-.It Bq Er EBADF
-The
-.Fa s
-argument
-is not a valid socket descriptor.
-.It Bq Er EBUSY
-A busy page was encountered and
-.Dv SF_NODISKIO
-had been specified.
-Partial data may have been sent.
-.It Bq Er EFAULT
-An invalid address was specified for an argument.
-.It Bq Er EINTR
-A signal interrupted
-.Fn sendfile
-before it could be completed.
-If specified, the number
-of bytes successfully sent will be returned in
-.Fa *sbytes .
-.It Bq Er EINVAL
-The
-.Fa fd
-argument
-is not a regular file.
-.It Bq Er EINVAL
-The
-.Fa s
-argument
-is not a SOCK_STREAM type socket.
-.It Bq Er EINVAL
-The
-.Fa offset
-argument
-is negative.
-.It Bq Er EIO
-An error occurred while reading from
-.Fa fd .
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from
-.Fa fd .
-.It Bq Er ENOTCAPABLE
-The
-.Fa fd
-or the
-.Fa s
-argument has insufficient rights.
-.It Bq Er ENOBUFS
-The system was unable to allocate an internal buffer.
-.It Bq Er ENOTCONN
-The
-.Fa s
-argument
-points to an unconnected socket.
-.It Bq Er ENOTSOCK
-The
-.Fa s
-argument
-is not a socket.
-.It Bq Er EOPNOTSUPP
-The file system for descriptor
-.Fa fd
-does not support
-.Fn sendfile .
-.It Bq Er EPIPE
-The socket peer has closed the connection.
-.El
-.Sh SEE ALSO
-.Xr netstat 1 ,
-.Xr open 2 ,
-.Xr send 2 ,
-.Xr socket 2 ,
-.Xr writev 2 ,
-.Xr loader.conf 5 ,
-.Xr tuning 7 ,
-.Xr sysctl 8
-.Rs
-.%A K. Elmeleegy
-.%A A. Chanda
-.%A A. L. Cox
-.%A W. Zwaenepoel
-.%T A Portable Kernel Abstraction for Low-Overhead Ephemeral Mapping Management
-.%J The Proceedings of the 2005 USENIX Annual Technical Conference
-.%P pp 223-236
-.%D 2005
-.Re
-.Sh HISTORY
-The
-.Fn sendfile
-system call
-first appeared in
-.Fx 3.0 .
-This manual page first appeared in
-.Fx 3.1 .
-In
-.Fx 10
-support for sending shared memory descriptors had been introduced.
-In
-.Fx 11
-a non-blocking implementation had been introduced.
-.Sh AUTHORS
-The initial implementation of
-.Fn sendfile
-system call
-and this manual page were written by
-.An David G. Lawrence Aq Mt dg@dglawrence.com .
-The
-.Fx 11
-implementation was written by
-.An Gleb Smirnoff Aq Mt glebius@FreeBSD.org .
-.Sh BUGS
-The
-.Fn sendfile
-system call will not fail, i.e., return
-.Dv -1
-and set
-.Va errno
-to
-.Er EFAULT ,
-if provided an invalid address for
-.Fa sbytes .
-The
-.Fn sendfile
-system call does not support SCTP sockets,
-it will return
-.Dv -1
-and set
-.Va errno
-to
-.Er EINVAL .
diff --git a/lib/libc/sys/sendmsg.c b/lib/libc/sys/sendmsg.c
index 794464339043..fd4e41837c48 100644
--- a/lib/libc/sys/sendmsg.c
+++ b/lib/libc/sys/sendmsg.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2014 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/syscall.h>
#include <sys/socket.h>
@@ -44,7 +40,5 @@ __weak_reference(__sys_sendmsg, __sendmsg);
ssize_t
sendmsg(int s, const struct msghdr *msg, int flags)
{
-
- return (((int (*)(int, const struct msghdr *, int))
- __libc_interposing[INTERPOS_sendmsg])(s, msg, flags));
+ return (INTERPOS_SYS(sendmsg, s, msg, flags));
}
diff --git a/lib/libc/sys/sendto.c b/lib/libc/sys/sendto.c
index ecf98ee05b19..708fc6ec9368 100644
--- a/lib/libc/sys/sendto.c
+++ b/lib/libc/sys/sendto.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2014 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/syscall.h>
#include <sys/socket.h>
@@ -45,9 +41,5 @@ ssize_t
sendto(int s, const void *msg, size_t len, int flags,
const struct sockaddr *to, socklen_t tolen)
{
-
- return (((ssize_t (*)(int, const void *, size_t, int,
- const struct sockaddr *, socklen_t))
- __libc_interposing[INTERPOS_sendto])(s, msg, len, flags,
- to, tolen));
+ return (INTERPOS_SYS(sendto, s, msg, len, flags, to, tolen));
}
diff --git a/lib/libc/sys/setcontext.c b/lib/libc/sys/setcontext.c
index 31b888f2bcff..96b5dc115067 100644
--- a/lib/libc/sys/setcontext.c
+++ b/lib/libc/sys/setcontext.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2014 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <ucontext.h>
#include "libc_private.h"
@@ -46,7 +42,5 @@ __sym_default(setcontext, setcontext, FBSD_1.2);
int
setcontext(const ucontext_t *uc)
{
-
- return (((int (*)(const ucontext_t *))
- __libc_interposing[INTERPOS_setcontext])(uc));
+ return (INTERPOS_SYS(setcontext, uc));
}
diff --git a/lib/libc/sys/setfib.2 b/lib/libc/sys/setfib.2
deleted file mode 100644
index 83cc7376de39..000000000000
--- a/lib/libc/sys/setfib.2
+++ /dev/null
@@ -1,107 +0,0 @@
-.\" Copyright (c) 2008 Cisco Systems. All rights reserved.
-.\" Author: Julian Elischer
-.\"
-.\" 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. Neither the name of the Cisco Systems nor the names of its employees
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd March 19, 2012
-.Dt SETFIB 2
-.Os
-.Sh NAME
-.Nm setfib
-.Nd set the default FIB (routing table) for the calling process
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/socket.h
-.Ft int
-.Fn setfib "int fib"
-.Sh DESCRIPTION
-The
-.Fn setfib
-system call sets the associated fib for all sockets opened
-subsequent to the call, to be that of the argument
-.Fa fib .
-The
-.Fa fib
-argument
-must be greater than or equal to 0
-and less than the current system maximum which
-may be retrieved by the
-.Va net.fibs
-sysctl.
-The system maximum is set in the kernel configuration file with
-.Bd -ragged -offset indent
-.Cd "options ROUTETABLES=" Ns Em N
-.Ed
-.Pp
-or in
-.Pa /boot/loader.conf
-with
-.Pp
-.Dl net.fibs= Ns Qq Em N
-.Pp
-where
-.Em N
-is an integer.
-This maximum is capped at 65536 due to the implementation storing
-the fib number in a 16-bit field in the
-.Xr mbuf 9
-packet header, however it is not suggested that one use such a large number
-as memory is allocated for every FIB regardless of whether it is used, and
-there are places where all FIBs are iterated over.
-.Pp
-The default fib of the process will be applied to all protocol families
-that support multiple fibs, and ignored by those that do not.
-The default fib for a process may be overridden for a socket with the use
-of the
-.Dv SO_SETFIB
-socket option.
-.Sh RETURN VALUES
-.Rv -std setfib
-.Sh ERRORS
-The
-.Fn setfib
-system call
-will fail and no action will be taken and return
-.Er EINVAL
-if the
-.Fa fib
-argument is greater than the current system maximum.
-.Sh SEE ALSO
-.Xr setfib 1 ,
-.Xr setsockopt 2
-.Sh STANDARDS
-The
-.Fn setfib
-system call is a
-.Fx
-extension however similar extensions
-have been added to many other
-.Ux
-style kernels.
-.Sh HISTORY
-The
-.Fn setfib
-function appeared in
-.Fx 7.1 .
diff --git a/lib/libc/sys/setgroups.2 b/lib/libc/sys/setgroups.2
deleted file mode 100644
index b08a7b3ae747..000000000000
--- a/lib/libc/sys/setgroups.2
+++ /dev/null
@@ -1,104 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993, 1994
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)setgroups.2 8.2 (Berkeley) 4/16/94
-.\" $FreeBSD$
-.\"
-.Dd January 19, 2018
-.Dt SETGROUPS 2
-.Os
-.Sh NAME
-.Nm setgroups
-.Nd set group access list
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/param.h
-.In unistd.h
-.Ft int
-.Fn setgroups "int ngroups" "const gid_t *gidset"
-.Sh DESCRIPTION
-The
-.Fn setgroups
-system call
-sets the group access list of the current user process
-according to the array
-.Fa gidset .
-The
-.Fa ngroups
-argument
-indicates the number of entries in the array and must be no
-more than
-.Dv {NGROUPS_MAX}+1 .
-.Pp
-Only the super-user may set a new group list.
-.Pp
-The first entry of the group array
-.Pq Va gidset[0]
-is used as the effective group-ID for the process.
-This entry is over-written when a setgid program is run.
-To avoid losing access to the privileges of the
-.Va gidset[0]
-entry, it should be duplicated later in the group array.
-By convention,
-this happens because the group value indicated
-in the password file also appears in
-.Pa /etc/group .
-The group value in the password file is placed in
-.Va gidset[0]
-and that value then gets added a second time when the
-.Pa /etc/group
-file is scanned to create the group set.
-.Sh RETURN VALUES
-.Rv -std setgroups
-.Sh ERRORS
-The
-.Fn setgroups
-system call will fail if:
-.Bl -tag -width Er
-.It Bq Er EPERM
-The caller is not the super-user.
-.It Bq Er EINVAL
-The number specified in the
-.Fa ngroups
-argument is larger than the
-.Dv {NGROUPS_MAX}+1
-limit.
-.It Bq Er EFAULT
-The address specified for
-.Fa gidset
-is outside the process
-address space.
-.El
-.Sh SEE ALSO
-.Xr getgroups 2 ,
-.Xr initgroups 3
-.Sh HISTORY
-The
-.Fn setgroups
-system call appeared in
-.Bx 4.2 .
diff --git a/lib/libc/sys/setpgid.2 b/lib/libc/sys/setpgid.2
deleted file mode 100644
index 18e5964763d2..000000000000
--- a/lib/libc/sys/setpgid.2
+++ /dev/null
@@ -1,110 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)setpgid.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd February 8, 2004
-.Dt SETPGID 2
-.Os
-.Sh NAME
-.Nm setpgid ,
-.Nm setpgrp
-.Nd set process group
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn setpgid "pid_t pid" "pid_t pgrp"
-.Ft int
-.Fn setpgrp "pid_t pid" "pid_t pgrp"
-.Sh DESCRIPTION
-The
-.Fn setpgid
-system call
-sets the process group of the specified process
-.Fa pid
-to the specified
-.Fa pgrp .
-If
-.Fa pid
-is zero, then the call applies to the current process.
-If
-.Fa pgrp
-is zero, then the process id of the process specified by
-.Fa pid
-is used instead.
-.Pp
-If the affected process is not the invoking process, then it must be a
-child of the invoking process, it must not have performed an
-.Xr exec 3
-operation, and both processes must be in the same session.
-The requested process group ID must already exist in the session of
-the caller, or it must be equal to the target process ID.
-.Sh RETURN VALUES
-.Rv -std setpgid
-.Sh COMPATIBILITY
-The
-.Fn setpgrp
-system call
-is identical to
-.Fn setpgid ,
-and is retained for calling convention compatibility with historical
-versions of
-.Bx .
-.Sh ERRORS
-The
-.Fn setpgid
-system call
-will fail and the process group will not be altered if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The requested process group ID is not legal.
-.It Bq Er ESRCH
-The requested process does not exist.
-.It Bq Er ESRCH
-The target process is not the calling process or
-a child of the calling process.
-.It Bq Er EACCES
-The requested process is a child of the calling process,
-but it has performed an
-.Xr exec 3
-operation.
-.It Bq Er EPERM
-The target process is a session leader.
-.It Bq Er EPERM
-The requested process group ID is not in the session of the caller,
-and it is not equal to the process ID of the target process.
-.El
-.Sh SEE ALSO
-.Xr getpgrp 2
-.Sh STANDARDS
-The
-.Fn setpgid
-system call is expected to conform to
-.St -p1003.1-90 .
diff --git a/lib/libc/sys/setregid.2 b/lib/libc/sys/setregid.2
deleted file mode 100644
index 03d34cadd42c..000000000000
--- a/lib/libc/sys/setregid.2
+++ /dev/null
@@ -1,90 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993, 1994
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)setregid.2 8.2 (Berkeley) 4/16/94
-.\" $FreeBSD$
-.\"
-.Dd April 16, 1994
-.Dt SETREGID 2
-.Os
-.Sh NAME
-.Nm setregid
-.Nd set real and effective group ID
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn setregid "gid_t rgid" "gid_t egid"
-.Sh DESCRIPTION
-The real and effective group ID's of the current process
-are set to the arguments.
-If the real group ID is changed, the saved group ID is changed to the
-new value of the effective group ID.
-.Pp
-Unprivileged users may change the real group
-ID to the effective group ID and vice-versa; only the super-user may
-make other changes.
-.Pp
-Supplying a value of -1 for either the real or effective
-group ID forces the system to substitute the current
-ID in place of the -1 argument.
-.Pp
-The
-.Fn setregid
-system call was intended to allow swapping
-the real and effective group IDs
-in set-group-ID programs to temporarily relinquish the set-group-ID value.
-This system call did not work correctly,
-and its purpose is now better served by the use of the
-.Xr setegid 2
-system call.
-.Pp
-When setting the real and effective group IDs to the same value,
-the standard
-.Fn setgid
-system call is preferred.
-.Sh RETURN VALUES
-.Rv -std setregid
-.Sh ERRORS
-.Bl -tag -width Er
-.It Bq Er EPERM
-The current process is not the super-user and a change
-other than changing the effective group-id to the real group-id
-was specified.
-.El
-.Sh SEE ALSO
-.Xr getgid 2 ,
-.Xr issetugid 2 ,
-.Xr setegid 2 ,
-.Xr setgid 2 ,
-.Xr setuid 2
-.Sh HISTORY
-The
-.Fn setregid
-system call appeared in
-.Bx 4.2 .
diff --git a/lib/libc/sys/setresuid.2 b/lib/libc/sys/setresuid.2
deleted file mode 100644
index 602166f80c38..000000000000
--- a/lib/libc/sys/setresuid.2
+++ /dev/null
@@ -1,94 +0,0 @@
-.\" Copyright (c) 2000
-.\" Sheldon Hearn. All rights reserved.
-.\"
-.\" 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 AUTHOR 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 AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES
-.\"
-.\" $FreeBSD$
-.\"
-.Dd February 7, 2015
-.Dt SETRESUID 2
-.Os
-.Sh NAME
-.Nm getresgid ,
-.Nm getresuid ,
-.Nm setresgid ,
-.Nm setresuid
-.Nd "get or set real, effective and saved user or group ID"
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In unistd.h
-.Ft int
-.Fn getresgid "gid_t *rgid" "gid_t *egid" "gid_t *sgid"
-.Ft int
-.Fn getresuid "uid_t *ruid" "uid_t *euid" "uid_t *suid"
-.Ft int
-.Fn setresgid "gid_t rgid" "gid_t egid" "gid_t sgid"
-.Ft int
-.Fn setresuid "uid_t ruid" "uid_t euid" "uid_t suid"
-.Sh DESCRIPTION
-The
-.Fn setresuid
-system call sets the real,
-effective and saved user IDs of the current process.
-The analogous
-.Fn setresgid
-sets the real, effective and saved group IDs.
-.Pp
-Privileged processes may set these IDs
-to arbitrary values.
-Unprivileged processes are restricted
-in that each of the new IDs must match one of the current IDs.
-.Pp
-Passing -1 as an argument causes the corresponding value
-to remain unchanged.
-.Pp
-The
-.Fn getresgid
-and
-.Fn getresuid
-calls retrieve the real, effective, and saved group and user IDs of
-the current process, respectively.
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-.Bl -tag -width Er
-.It Bq Er EPERM
-The calling process was not privileged
-and tried to change one or more IDs to a value
-which was not the current real ID, the current effective ID
-nor the current saved ID.
-.It Bq Er EFAULT
-An address passed to
-.Fn getresgid
-or
-.Fn getresuid
-was invalid.
-.El
-.Sh SEE ALSO
-.Xr getegid 2 ,
-.Xr geteuid 2 ,
-.Xr getgid 2 ,
-.Xr getuid 2 ,
-.Xr issetugid 2 ,
-.Xr setgid 2 ,
-.Xr setregid 2 ,
-.Xr setreuid 2 ,
-.Xr setuid 2
-.Sh HISTORY
-These functions first appeared in HP-UX.
diff --git a/lib/libc/sys/setreuid.2 b/lib/libc/sys/setreuid.2
deleted file mode 100644
index 31597777605f..000000000000
--- a/lib/libc/sys/setreuid.2
+++ /dev/null
@@ -1,90 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993, 1994
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)setreuid.2 8.2 (Berkeley) 4/16/94
-.\" $FreeBSD$
-.\"
-.Dd February 8, 2001
-.Dt SETREUID 2
-.Os
-.Sh NAME
-.Nm setreuid
-.Nd set real and effective user ID's
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn setreuid "uid_t ruid" "uid_t euid"
-.Sh DESCRIPTION
-The real and effective user IDs of the
-current process are set according to the arguments.
-If
-.Fa ruid
-or
-.Fa euid
-is -1, the current uid is filled in by the system.
-Unprivileged users may change the real user
-ID to the effective user ID and vice-versa; only the super-user may
-make other changes.
-.Pp
-If the real user ID is changed (i.e.\&
-.Fa ruid
-is not -1) or the effective user ID is changed to something other than
-the real user ID, then the saved user ID will be set to the effective user ID.
-.Pp
-The
-.Fn setreuid
-system call has been used to swap the real and effective user IDs
-in set-user-ID programs to temporarily relinquish the set-user-ID value.
-This purpose is now better served by the use of the
-.Xr seteuid 2
-system call.
-.Pp
-When setting the real and effective user IDs to the same value,
-the standard
-.Fn setuid
-system call is preferred.
-.Sh RETURN VALUES
-.Rv -std setreuid
-.Sh ERRORS
-.Bl -tag -width Er
-.It Bq Er EPERM
-The current process is not the super-user and a change
-other than changing the effective user-id to the real user-id
-was specified.
-.El
-.Sh SEE ALSO
-.Xr getuid 2 ,
-.Xr issetugid 2 ,
-.Xr seteuid 2 ,
-.Xr setuid 2
-.Sh HISTORY
-The
-.Fn setreuid
-system call appeared in
-.Bx 4.2 .
diff --git a/lib/libc/sys/setsid.2 b/lib/libc/sys/setsid.2
deleted file mode 100644
index 7c147753743d..000000000000
--- a/lib/libc/sys/setsid.2
+++ /dev/null
@@ -1,81 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)setsid.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd June 4, 1993
-.Dt SETSID 2
-.Os
-.Sh NAME
-.Nm setsid
-.Nd create session and set process group ID
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft pid_t
-.Fn setsid void
-.Sh DESCRIPTION
-The
-.Fn setsid
-system call creates a new session.
-The calling process is the session leader of the new session, is the
-process group leader of a new process group and has no controlling
-terminal.
-The calling process is the only process in either the session or the
-process group.
-.Sh RETURN VALUES
-Upon successful completion, the
-.Fn setsid
-system call returns the value of the process group ID of the new process
-group, which is the same as the process ID of the calling process.
-If an error occurs,
-.Fn setsid
-returns -1 and the global variable
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-The
-.Fn setsid
-system call will fail if:
-.Bl -tag -width Er
-.It Bq Er EPERM
-The calling process is already a process group leader, or the process
-group ID of a process other than the calling process matches the process
-ID of the calling process.
-.El
-.Sh SEE ALSO
-.Xr setpgid 2 ,
-.Xr tcgetpgrp 3 ,
-.Xr tcsetpgrp 3
-.Sh STANDARDS
-The
-.Fn setsid
-system call is expected to be compliant with the
-.St -p1003.1-90
-specification.
diff --git a/lib/libc/sys/setuid.2 b/lib/libc/sys/setuid.2
deleted file mode 100644
index 691bc24976b3..000000000000
--- a/lib/libc/sys/setuid.2
+++ /dev/null
@@ -1,189 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)setuid.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd December 15, 2015
-.Dt SETUID 2
-.Os
-.Sh NAME
-.Nm setuid ,
-.Nm seteuid ,
-.Nm setgid ,
-.Nm setegid
-.Nd set user and group ID
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn setuid "uid_t uid"
-.Ft int
-.Fn seteuid "uid_t euid"
-.Ft int
-.Fn setgid "gid_t gid"
-.Ft int
-.Fn setegid "gid_t egid"
-.Sh DESCRIPTION
-The
-.Fn setuid
-system call
-sets the real and effective
-user IDs and the saved set-user-ID of the current process
-to the specified value.
-.\" Comment out next block for !_POSIX_SAVED_IDS
-.\" The real user ID and the saved set-user-ID are changed only if the
-.\" effective user ID is that of the super user.
-.\" I.e.
-.\" .Fn setuid
-.\" system call is equal to
-.\" .Fn seteuid
-.\" system call if the effective user ID is not that of the super user.
-.\" End of block
-The
-.Fn setuid
-system call is permitted if the specified ID is equal to the real user ID
-.\" Comment out next line for !_POSIX_SAVED_IDS
-.\" or the saved set-user-ID
-.\" Next line is for Appendix B.4.2.2 case.
-or the effective user ID
-of the process, or if the effective user ID is that of the super user.
-.Pp
-The
-.Fn setgid
-system call
-sets the real and effective
-group IDs and the saved set-group-ID of the current process
-to the specified value.
-.\" Comment out next block for !_POSIX_SAVED_IDS
-.\" The real group ID and the saved set-group-ID are changed only if the
-.\" effective user ID is that of the super user.
-.\" I.e.
-.\" .Fn setgid
-.\" system call is equal to
-.\" .Fn setegid
-.\" system call if the effective user ID is not that of the super user.
-.\" End of block
-The
-.Fn setgid
-system call is permitted if the specified ID is equal to the real group ID
-.\" Comment out next line for !_POSIX_SAVED_IDS
-.\" or the saved set-group-ID
-.\" Next line is for Appendix B.4.2.2 case.
-or the effective group ID
-of the process, or if the effective user ID is that of the super user.
-.Pp
-The
-.Fn seteuid
-system call
-.Pq Fn setegid
-sets the effective user ID (group ID) of the
-current process.
-The effective user ID may be set to the value
-of the real user ID or the saved set-user-ID (see
-.Xr intro 2
-and
-.Xr execve 2 ) ;
-in this way, the effective user ID of a set-user-ID executable
-may be toggled by switching to the real user ID, then re-enabled
-by reverting to the set-user-ID value.
-Similarly, the effective group ID may be set to the value
-of the real group ID or the saved set-group-ID.
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-The system calls will fail if:
-.Bl -tag -width Er
-.It Bq Er EPERM
-The user is not the super user and the ID
-specified is not the real, effective ID, or saved ID.
-.El
-.Sh SEE ALSO
-.Xr getgid 2 ,
-.Xr getuid 2 ,
-.Xr issetugid 2 ,
-.Xr setregid 2 ,
-.Xr setreuid 2
-.Sh STANDARDS
-The
-.Fn setuid
-and
-.Fn setgid
-system calls are compliant with the
-.St -p1003.1-90
-specification with
-.Li _POSIX_SAVED_IDS
-.\" Uncomment next line for !_POSIX_SAVED_IDS
-not
-defined with the permitted extensions from Appendix B.4.2.2.
-The
-.Fn seteuid
-and
-.Fn setegid
-system calls are extensions based on the
-.Tn POSIX
-concept of
-.Li _POSIX_SAVED_IDS ,
-and have been proposed for a future revision of the standard.
-.Sh HISTORY
-The
-.Fn setuid
-function appeared in
-.At v1 .
-The
-.Fn setgid
-function appeared in
-.At v4 .
-.Sh SECURITY CONSIDERATIONS
-Read and write permissions to files are determined upon a call to
-.Xr open 2 .
-Once a file descriptor is open, dropping privilege does not affect
-the process's read/write permissions, even if the user ID specified
-has no read or write permissions to the file.
-These files normally remain open in any new process executed,
-resulting in a user being able to read or modify
-potentially sensitive data.
-.Pp
-To prevent these files from remaining open after an
-.Xr exec 3
-call, be sure to set the close-on-exec flag:
-.Bd -literal
-void
-pseudocode(void)
-{
- int fd;
- /* ... */
-
- fd = open("/path/to/sensitive/data", O_RDWR | O_CLOEXEC);
- if (fd == -1)
- err(1, "open");
-
- /* ... */
- execve(path, argv, environ);
-}
-.Ed
diff --git a/lib/libc/sys/shm_open.2 b/lib/libc/sys/shm_open.2
deleted file mode 100644
index 4c03288b6bbe..000000000000
--- a/lib/libc/sys/shm_open.2
+++ /dev/null
@@ -1,473 +0,0 @@
-.\"
-.\" Copyright 2000 Massachusetts Institute of Technology
-.\"
-.\" Permission to use, copy, modify, and distribute this software and
-.\" its documentation for any purpose and without fee is hereby
-.\" granted, provided that both the above copyright notice and this
-.\" permission notice appear in all copies, that both the above
-.\" copyright notice and this permission notice appear in all
-.\" supporting documentation, and that the name of M.I.T. not be used
-.\" in advertising or publicity pertaining to distribution of the
-.\" software without specific, written prior permission. M.I.T. makes
-.\" no representations about the suitability of this software for any
-.\" purpose. It is provided "as is" without express or implied
-.\" warranty.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
-.\" ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
-.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
-.\" SHALL M.I.T. 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd June 25, 2021
-.Dt SHM_OPEN 2
-.Os
-.Sh NAME
-.Nm memfd_create , shm_open , shm_rename, shm_unlink
-.Nd "shared memory object operations"
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In sys/mman.h
-.In fcntl.h
-.Ft int
-.Fn memfd_create "const char *name" "unsigned int flags"
-.Ft int
-.Fn shm_open "const char *path" "int flags" "mode_t mode"
-.Ft int
-.Fn shm_rename "const char *path_from" "const char *path_to" "int flags"
-.Ft int
-.Fn shm_unlink "const char *path"
-.Sh DESCRIPTION
-The
-.Fn shm_open
-system call opens (or optionally creates) a
-POSIX
-shared memory object named
-.Fa path .
-The
-.Fa flags
-argument contains a subset of the flags used by
-.Xr open 2 .
-An access mode of either
-.Dv O_RDONLY
-or
-.Dv O_RDWR
-must be included in
-.Fa flags .
-The optional flags
-.Dv O_CREAT ,
-.Dv O_EXCL ,
-and
-.Dv O_TRUNC
-may also be specified.
-.Pp
-If
-.Dv O_CREAT
-is specified,
-then a new shared memory object named
-.Fa path
-will be created if it does not exist.
-In this case,
-the shared memory object is created with mode
-.Fa mode
-subject to the process' umask value.
-If both the
-.Dv O_CREAT
-and
-.Dv O_EXCL
-flags are specified and a shared memory object named
-.Fa path
-already exists,
-then
-.Fn shm_open
-will fail with
-.Er EEXIST .
-.Pp
-Newly created objects start off with a size of zero.
-If an existing shared memory object is opened with
-.Dv O_RDWR
-and the
-.Dv O_TRUNC
-flag is specified,
-then the shared memory object will be truncated to a size of zero.
-The size of the object can be adjusted via
-.Xr ftruncate 2
-and queried via
-.Xr fstat 2 .
-.Pp
-The new descriptor is set to close during
-.Xr execve 2
-system calls;
-see
-.Xr close 2
-and
-.Xr fcntl 2 .
-.Pp
-As a
-.Fx
-extension, the constant
-.Dv SHM_ANON
-may be used for the
-.Fa path
-argument to
-.Fn shm_open .
-In this case, an anonymous, unnamed shared memory object is created.
-Since the object has no name,
-it cannot be removed via a subsequent call to
-.Fn shm_unlink ,
-or moved with a call to
-.Fn shm_rename .
-Instead,
-the shared memory object will be garbage collected when the last reference to
-the shared memory object is removed.
-The shared memory object may be shared with other processes by sharing the
-file descriptor via
-.Xr fork 2
-or
-.Xr sendmsg 2 .
-Attempting to open an anonymous shared memory object with
-.Dv O_RDONLY
-will fail with
-.Er EINVAL .
-All other flags are ignored.
-.Pp
-The
-.Fn shm_rename
-system call atomically removes a shared memory object named
-.Fa path_from
-and relinks it at
-.Fa path_to .
-If another object is already linked at
-.Fa path_to ,
-that object will be unlinked, unless one of the following flags are provided:
-.Bl -tag -offset indent -width Er
-.It Er SHM_RENAME_EXCHANGE
-Atomically exchange the shms at
-.Fa path_from
-and
-.Fa path_to .
-.It Er SHM_RENAME_NOREPLACE
-Return an error if an shm exists at
-.Fa path_to ,
-rather than unlinking it.
-.El
-.Fn shm_rename
-is also a
-.Fx
-extension.
-.Pp
-The
-.Fn shm_unlink
-system call removes a shared memory object named
-.Fa path .
-.Pp
-The
-.Fn memfd_create
-function creates an anonymous shared memory object, identical to that created
-by
-.Fn shm_open
-when
-.Dv SHM_ANON
-is specified.
-Newly created objects start off with a size of zero.
-The size of the new object must be adjusted via
-.Xr ftruncate 2 .
-.Pp
-The
-.Fa name
-argument must not be
-.Dv NULL ,
-but it may be an empty string.
-The length of the
-.Fa name
-argument may not exceed
-.Dv NAME_MAX
-minus six characters for the prefix
-.Dq memfd: ,
-which will be prepended.
-The
-.Fa name
-argument is intended solely for debugging purposes and will never be used by the
-kernel to identify a memfd.
-Names are therefore not required to be unique.
-.Pp
-The following
-.Fa flags
-may be specified to
-.Fn memfd_create :
-.Bl -tag -width MFD_ALLOW_SEALING
-.It Dv MFD_CLOEXEC
-Set
-.Dv FD_CLOEXEC
-on the resulting file descriptor.
-.It Dv MFD_ALLOW_SEALING
-Allow adding seals to the resulting file descriptor using the
-.Dv F_ADD_SEALS
-.Xr fcntl 2
-command.
-.It Dv MFD_HUGETLB
-This flag is currently unsupported.
-.El
-.Sh RETURN VALUES
-If successful,
-.Fn memfd_create
-and
-.Fn shm_open
-both return a non-negative integer,
-and
-.Fn shm_rename
-and
-.Fn shm_unlink
-return zero.
-All functions return -1 on failure, and set
-.Va errno
-to indicate the error.
-.Sh COMPATIBILITY
-The
-.Fa path ,
-.Fa path_from ,
-and
-.Fa path_to
-arguments do not necessarily represent a pathname (although they do in
-most other implementations).
-Two processes opening the same
-.Fa path
-are guaranteed to access the same shared memory object if and only if
-.Fa path
-begins with a slash
-.Pq Ql \&/
-character.
-.Pp
-Only the
-.Dv O_RDONLY ,
-.Dv O_RDWR ,
-.Dv O_CREAT ,
-.Dv O_EXCL ,
-and
-.Dv O_TRUNC
-flags may be used in portable programs.
-.Pp
-POSIX
-specifications state that the result of using
-.Xr open 2 ,
-.Xr read 2 ,
-or
-.Xr write 2
-on a shared memory object, or on the descriptor returned by
-.Fn shm_open ,
-is undefined.
-However, the
-.Fx
-kernel implementation explicitly includes support for
-.Xr read 2
-and
-.Xr write 2 .
-.Pp
-.Fx
-also supports zero-copy transmission of data from shared memory
-objects with
-.Xr sendfile 2 .
-.Pp
-Neither shared memory objects nor their contents persist across reboots.
-.Pp
-Writes do not extend shared memory objects, so
-.Xr ftruncate 2
-must be called before any data can be written.
-See
-.Sx EXAMPLES .
-.Sh EXAMPLES
-This example fails without the call to
-.Xr ftruncate 2 :
-.Bd -literal -compact
-
- uint8_t buffer[getpagesize()];
- ssize_t len;
- int fd;
-
- fd = shm_open(SHM_ANON, O_RDWR | O_CREAT, 0600);
- if (fd < 0)
- err(EX_OSERR, "%s: shm_open", __func__);
- if (ftruncate(fd, getpagesize()) < 0)
- err(EX_IOERR, "%s: ftruncate", __func__);
- len = pwrite(fd, buffer, getpagesize(), 0);
- if (len < 0)
- err(EX_IOERR, "%s: pwrite", __func__);
- if (len != getpagesize())
- errx(EX_IOERR, "%s: pwrite length mismatch", __func__);
-.Ed
-.Sh ERRORS
-.Fn memfd_create
-fails with these error codes for these conditions:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa name
-argument was NULL.
-.It Bq Er EINVAL
-The
-.Fa name
-argument was too long.
-.Pp
-An invalid or unsupported flag was included in
-.Fa flags .
-.It Bq Er EMFILE
-The process has already reached its limit for open file descriptors.
-.It Bq Er ENFILE
-The system file table is full.
-.It Bq Er ENOSYS
-In
-.Fa memfd_create ,
-.Dv MFD_HUGETLB
-was specified in
-.Fa flags ,
-and this system does not support forced hugetlb mappings.
-.El
-.Pp
-.Fn shm_open
-fails with these error codes for these conditions:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-A flag other than
-.Dv O_RDONLY ,
-.Dv O_RDWR ,
-.Dv O_CREAT ,
-.Dv O_EXCL ,
-or
-.Dv O_TRUNC
-was included in
-.Fa flags .
-.It Bq Er EMFILE
-The process has already reached its limit for open file descriptors.
-.It Bq Er ENFILE
-The system file table is full.
-.It Bq Er EINVAL
-.Dv O_RDONLY
-was specified while creating an anonymous shared memory object via
-.Dv SHM_ANON .
-.It Bq Er EFAULT
-The
-.Fa path
-argument points outside the process' allocated address space.
-.It Bq Er ENAMETOOLONG
-The entire pathname exceeds 1023 characters.
-.It Bq Er EINVAL
-The
-.Fa path
-does not begin with a slash
-.Pq Ql \&/
-character.
-.It Bq Er ENOENT
-.Dv O_CREAT
-is not specified and the named shared memory object does not exist.
-.It Bq Er EEXIST
-.Dv O_CREAT
-and
-.Dv O_EXCL
-are specified and the named shared memory object does exist.
-.It Bq Er EACCES
-The required permissions (for reading or reading and writing) are denied.
-.El
-.Pp
-The following errors are defined for
-.Fn shm_rename :
-.Bl -tag -width Er
-.It Bq Er EFAULT
-The
-.Fa path_from
-or
-.Fa path_to
-argument points outside the process' allocated address space.
-.It Bq Er ENAMETOOLONG
-The entire pathname exceeds 1023 characters.
-.It Bq Er ENOENT
-The shared memory object at
-.Fa path_from
-does not exist.
-.It Bq Er EACCES
-The required permissions are denied.
-.It Bq Er EEXIST
-An shm exists at
-.Fa path_to ,
-and the
-.Dv SHM_RENAME_NOREPLACE
-flag was provided.
-.El
-.Pp
-.Fn shm_unlink
-fails with these error codes for these conditions:
-.Bl -tag -width Er
-.It Bq Er EFAULT
-The
-.Fa path
-argument points outside the process' allocated address space.
-.It Bq Er ENAMETOOLONG
-The entire pathname exceeds 1023 characters.
-.It Bq Er ENOENT
-The named shared memory object does not exist.
-.It Bq Er EACCES
-The required permissions are denied.
-.Fn shm_unlink
-requires write permission to the shared memory object.
-.El
-.Sh SEE ALSO
-.Xr posixshmcontrol 1 ,
-.Xr close 2 ,
-.Xr fstat 2 ,
-.Xr ftruncate 2 ,
-.Xr mmap 2 ,
-.Xr munmap 2 ,
-.Xr sendfile 2
-.Sh STANDARDS
-The
-.Fn memfd_create
-function is expected to be compatible with the Linux system call of the same
-name.
-.Pp
-The
-.Fn shm_open
-and
-.Fn shm_unlink
-functions are believed to conform to
-.St -p1003.1b-93 .
-.Sh HISTORY
-The
-.Fn memfd_create
-function appeared in
-.Fx 13.0 .
-.Pp
-The
-.Fn shm_open
-and
-.Fn shm_unlink
-functions first appeared in
-.Fx 4.3 .
-The functions were reimplemented as system calls using shared memory objects
-directly rather than files in
-.Fx 8.0 .
-.Pp
-.Fn shm_rename
-first appeared in
-.Fx 13.0
-as a
-.Fx
-extension.
-.Sh AUTHORS
-.An Garrett A. Wollman Aq Mt wollman@FreeBSD.org
-(C library support and this manual page)
-.Pp
-.An Matthew Dillon Aq Mt dillon@FreeBSD.org
-.Pq Dv MAP_NOSYNC
-.Pp
-.An Matthew Bryan Aq Mt matthew.bryan@isilon.com
-.Pq Dv shm_rename implementation
diff --git a/lib/libc/sys/shm_open.c b/lib/libc/sys/shm_open.c
index e5666a3558e9..eb3022c857b1 100644
--- a/lib/libc/sys/shm_open.c
+++ b/lib/libc/sys/shm_open.c
@@ -1,5 +1,5 @@
/*
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2019 Kyle Evans <kevans@FreeBSD.org>
*
@@ -28,18 +28,12 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/filio.h>
#include <sys/mman.h>
#include <errno.h>
#include <fcntl.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <stdio.h>
#include <string.h>
#include <unistd.h>
@@ -48,12 +42,9 @@ __FBSDID("$FreeBSD$");
__weak_reference(shm_open, _shm_open);
__weak_reference(shm_open, __sys_shm_open);
-#define MEMFD_NAME_PREFIX "memfd:"
-
int
shm_open(const char *path, int flags, mode_t mode)
{
-
return (__sys_shm_open2(path, flags | O_CLOEXEC, mode, 0, NULL));
}
@@ -80,90 +71,3 @@ shm_create_largepage(const char *path, int flags, int psind, int alloc_policy,
}
return (fd);
}
-
-/*
- * The path argument is passed to the kernel, but the kernel doesn't currently
- * do anything with it. Linux exposes it in linprocfs for debugging purposes
- * only, but our kernel currently will not do the same.
- */
-int
-memfd_create(const char *name, unsigned int flags)
-{
- char memfd_name[NAME_MAX + 1];
- size_t namelen, *pgs, pgsize;
- struct shm_largepage_conf slc;
- int error, fd, npgs, oflags, pgidx, saved_errno, shmflags;
-
- if (name == NULL) {
- errno = EBADF;
- return (-1);
- }
- namelen = strlen(name);
- if (namelen + sizeof(MEMFD_NAME_PREFIX) - 1 > NAME_MAX) {
- errno = EINVAL;
- return (-1);
- }
- if ((flags & ~(MFD_CLOEXEC | MFD_ALLOW_SEALING | MFD_HUGETLB |
- MFD_HUGE_MASK)) != 0) {
- errno = EINVAL;
- return (-1);
- }
- /* Size specified but no HUGETLB. */
- if ((flags & MFD_HUGE_MASK) != 0 && (flags & MFD_HUGETLB) == 0) {
- errno = EINVAL;
- return (-1);
- }
-
- /* We've already validated that we're sufficiently sized. */
- snprintf(memfd_name, NAME_MAX + 1, "%s%s", MEMFD_NAME_PREFIX, name);
- oflags = O_RDWR;
- shmflags = 0;
- if ((flags & MFD_CLOEXEC) != 0)
- oflags |= O_CLOEXEC;
- if ((flags & MFD_ALLOW_SEALING) != 0)
- shmflags |= SHM_ALLOW_SEALING;
- if ((flags & MFD_HUGETLB) != 0)
- shmflags |= SHM_LARGEPAGE;
- else
- shmflags |= SHM_GROW_ON_WRITE;
- fd = __sys_shm_open2(SHM_ANON, oflags, 0, shmflags, memfd_name);
- if (fd == -1 || (flags & MFD_HUGETLB) == 0)
- return (fd);
-
- pgs = NULL;
- npgs = getpagesizes(NULL, 0);
- if (npgs == -1)
- goto clean;
- pgs = calloc(npgs, sizeof(size_t));
- if (pgs == NULL)
- goto clean;
- error = getpagesizes(pgs, npgs);
- if (error == -1)
- goto clean;
- pgsize = (size_t)1 << ((flags & MFD_HUGE_MASK) >> MFD_HUGE_SHIFT);
- for (pgidx = 0; pgidx < npgs; pgidx++) {
- if (pgsize == pgs[pgidx])
- break;
- }
- if (pgidx == npgs) {
- errno = EOPNOTSUPP;
- goto clean;
- }
- free(pgs);
- pgs = NULL;
-
- memset(&slc, 0, sizeof(slc));
- slc.psind = pgidx;
- slc.alloc_policy = SHM_LARGEPAGE_ALLOC_DEFAULT;
- error = ioctl(fd, FIOSSHMLPGCNF, &slc);
- if (error == -1)
- goto clean;
- return (fd);
-
-clean:
- saved_errno = errno;
- close(fd);
- free(pgs);
- errno = saved_errno;
- return (-1);
-}
diff --git a/lib/libc/sys/shmat.2 b/lib/libc/sys/shmat.2
deleted file mode 100644
index 4aea27c0d872..000000000000
--- a/lib/libc/sys/shmat.2
+++ /dev/null
@@ -1,156 +0,0 @@
-.\"
-.\" Copyright (c) 1995 David Hovemeyer <daveho@infocom.com>
-.\"
-.\" All rights reserved.
-.\"
-.\" 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 DEVELOPERS ``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 DEVELOPERS 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd January 14, 2019
-.Dt SHMAT 2
-.Os
-.Sh NAME
-.Nm shmat ,
-.Nm shmdt
-.Nd attach or detach shared memory
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In sys/ipc.h
-.In sys/shm.h
-.Ft void *
-.Fn shmat "int shmid" "const void *addr" "int flag"
-.Ft int
-.Fn shmdt "const void *addr"
-.Sh DESCRIPTION
-The
-.Fn shmat
-system call
-attaches the shared memory segment identified by
-.Fa shmid
-to the calling process's address space.
-The address where the segment
-is attached is determined as follows:
-.\"
-.\" These are cribbed almost exactly from Stevens, _Advanced Programming in
-.\" the UNIX Environment_.
-.\"
-.Bl -bullet
-.It
-If
-.Fa addr
-is 0, the segment is attached at an address selected by the
-kernel.
-.It
-If
-.Fa addr
-is nonzero and
-.Va SHM_RND
-is not specified in
-.Fa flag ,
-the segment is attached the specified address.
-.It
-If
-.Fa addr
-is specified and
-.Va SHM_RND
-is specified,
-.Fa addr
-is rounded down to the nearest multiple of SHMLBA.
-.El
-.Pp
-If the
-.Va SHM_REMAP
-flag is specified and the passed
-.Fa addr
-is not
-.Dv NULL ,
-any existing mappings in the virtual addresses range are
-cleared before the segment is attached.
-If the flag is not specified,
-.Fa addr
-is not
-.Dv NULL ,
-and the virtual address range contains
-some pre-existing mappings, the
-.Fn shmat
-call fails.
-.Pp
-The
-.Fn shmdt
-system call
-detaches the shared memory segment at the address specified by
-.Fa addr
-from the calling process's address space.
-.Sh RETURN VALUES
-Upon success,
-.Fn shmat
-returns the address where the segment is attached; otherwise, -1
-is returned and
-.Va errno
-is set to indicate the error.
-.Pp
-.Rv -std shmdt
-.Sh ERRORS
-The
-.Fn shmat
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-No shared memory segment was found corresponding to
-.Fa shmid .
-.It Bq Er EINVAL
-The
-.Fa addr
-argument
-was not an acceptable address.
-.It Bq Er ENOMEM
-The specified
-.Fa addr
-cannot be used for mapping, for instance due to the amount of available
-space being smaller than the segment size,
-or because pre-existing mappings are in the range and no
-.Va SHM_REMAP
-flag was provided.
-.It Bq Er EMFILE
-Failed to attach the shared memory segment because the per-process
-.Va kern.ipc.shmseg
-.Xr sysctl 3
-limit was reached.
-.El
-.Pp
-The
-.Fn shmdt
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Fa addr
-argument
-does not point to a shared memory segment.
-.El
-.Sh "SEE ALSO"
-.Xr shmctl 2 ,
-.Xr shmget 2
diff --git a/lib/libc/sys/shmctl.2 b/lib/libc/sys/shmctl.2
deleted file mode 100644
index 788e79f1900d..000000000000
--- a/lib/libc/sys/shmctl.2
+++ /dev/null
@@ -1,141 +0,0 @@
-.\"
-.\" Copyright (c) 1995 David Hovemeyer <daveho@infocom.com>
-.\"
-.\" All rights reserved.
-.\"
-.\" 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 DEVELOPERS ``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 DEVELOPERS 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd October 10, 2015
-.Dt SHMCTL 2
-.Os
-.Sh NAME
-.Nm shmctl
-.Nd shared memory control
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In sys/ipc.h
-.In sys/shm.h
-.Ft int
-.Fn shmctl "int shmid" "int cmd" "struct shmid_ds *buf"
-.Sh DESCRIPTION
-Performs the action specified by
-.Fa cmd
-on the shared memory segment identified by
-.Fa shmid :
-.Bl -tag -width SHM_UNLOCKX
-.It Dv IPC_STAT
-Fetch the segment's
-.Fa "struct shmid_ds" ,
-storing it in the memory pointed to by
-.Fa buf .
-.\"
-.\" XXX need to make sure that this is correct for FreeBSD
-.\"
-.It Dv IPC_SET
-Changes the
-.Fa shm_perm.uid ,
-.Fa shm_perm.gid ,
-and
-.Fa shm_perm.mode
-members of the segment's
-.Fa "struct shmid_ds"
-to match those of the struct pointed to by
-.Fa buf .
-The calling process's effective uid must
-match either
-.Fa shm_perm.uid
-or
-.Fa shm_perm.cuid ,
-or it must have superuser privileges.
-.It Dv IPC_RMID
-Removes the segment from the system.
-The removal will not take
-effect until all processes having attached the segment have exited.
-For the operation
-to succeed, the calling process's effective uid must match
-.Fa shm_perm.uid
-or
-.Fa shm_perm.cuid ,
-or the process must have superuser privileges.
-If the
-.Va kern.ipc.shm_allow_removed
-.Xr sysctl 3
-variable is set to 0, once the IPC_RMID operation has taken place,
-no further processes will be allowed to attach the segment.
-.\" .It Dv SHM_LOCK
-.\" Locks the segment in memory. The calling process must have
-.\" superuser privileges. Not implemented in FreeBSD.
-.\" .It Dv SHM_UNLOCK
-.\" Unlocks the segment from memory. The calling process must
-.\" have superuser privileges. Not implemented in FreeBSD.
-.El
-.Pp
-The
-.Vt shmid_ds
-structure is defined as follows:
-.\"
-.\" I fiddled with the spaces a bit to make it fit well when viewed
-.\" with nroff, but otherwise it is straight from sys/shm.h
-.\"
-.Bd -literal
-struct shmid_ds {
- struct ipc_perm shm_perm; /* operation permission structure */
- size_t shm_segsz; /* size of segment in bytes */
- pid_t shm_lpid; /* process ID of last shared memory op */
- pid_t shm_cpid; /* process ID of creator */
- int shm_nattch; /* number of current attaches */
- time_t shm_atime; /* time of last shmat() */
- time_t shm_dtime; /* time of last shmdt() */
- time_t shm_ctime; /* time of last change by shmctl() */
-};
-.Ed
-.Sh RETURN VALUES
-.Rv -std shmctl
-.Sh ERRORS
-The
-.Fn shmctl
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-Invalid operation, or
-no shared memory segment was found corresponding to
-.Fa shmid .
-.\"
-.\" XXX I think the following is right: ipcperm() only returns EPERM
-.\" when an attempt is made to modify (IPC_M) by a non-creator
-.\" non-owner
-.It Bq Er EPERM
-The calling process's effective uid does not match the uid of
-the shared memory segment's owner or creator.
-.It Bq Er EACCES
-Permission denied due to mismatch between operation and mode of
-shared memory segment.
-.El
-.Sh "SEE ALSO"
-.Xr shmat 2 ,
-.Xr shmdt 2 ,
-.Xr shmget 2 ,
-.Xr ftok 3
diff --git a/lib/libc/sys/shmget.2 b/lib/libc/sys/shmget.2
deleted file mode 100644
index 2613619420ed..000000000000
--- a/lib/libc/sys/shmget.2
+++ /dev/null
@@ -1,142 +0,0 @@
-.\"
-.\" Copyright (c) 1995 David Hovemeyer <daveho@infocom.com>
-.\"
-.\" All rights reserved.
-.\"
-.\" 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 DEVELOPERS ``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 DEVELOPERS 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd March 4, 2018
-.Dt SHMGET 2
-.Os
-.Sh NAME
-.Nm shmget
-.Nd obtain a shared memory identifier
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/shm.h
-.Ft int
-.Fn shmget "key_t key" "size_t size" "int flag"
-.Sh DESCRIPTION
-Based on the values of
-.Fa key
-and
-.Fa flag ,
-.Fn shmget
-returns the identifier of a newly created or previously existing shared
-memory segment.
-.\"
-.\" The following bit about keys and modes also applies to semaphores
-.\" and message queues.
-.\"
-The key
-is analogous to a filename: it provides a handle that names an
-IPC object.
-There are three ways to specify a key:
-.Bl -bullet
-.It
-IPC_PRIVATE may be specified, in which case a new IPC object
-will be created.
-.It
-An integer constant may be specified.
-If no IPC object corresponding
-to
-.Fa key
-is specified and the IPC_CREAT bit is set in
-.Fa flag ,
-a new one will be created.
-.It
-The
-.Xr ftok 3
-may be used to generate a key from a pathname.
-.El
-.Pp
-The mode of a newly created IPC object is determined by
-which are set by ORing these constants into the
-.Fa flag
-argument:
-.Bl -tag -width 0000
-.It Dv 0400
-Read access for owner.
-.It Dv 0200
-Write access for owner.
-.It Dv 0040
-Read access for group.
-.It Dv 0020
-Write access for group.
-.It Dv 0004
-Read access for other.
-.It Dv 0002
-Write access for other.
-.El
-.\"
-.\" XXX - we should also mention how uid, euid, and gid affect ownership
-.\" and use
-.\"
-.\" end section about keys and modes
-.\"
-.Pp
-When creating a new shared memory segment,
-.Fa size
-indicates the desired size of the new segment in bytes.
-The size
-of the segment may be rounded up to a multiple convenient to the
-kernel (i.e., the page size).
-.Sh RETURN VALUES
-Upon successful completion,
-.Fn shmget
-returns the positive integer identifier of a shared memory segment.
-Otherwise, -1 is returned and
-.Va errno
-set to indicate the error.
-.Sh ERRORS
-The
-.Fn shmget
-system call
-will fail if:
-.Bl -tag -width Er
-.\"
-.\" XXX What about ipcperm failing?
-.\"
-.It Bq Er EINVAL
-Size specified is greater than the size of the previously existing segment.
-Size specified is less than the system imposed minimum, or greater than
-the system imposed maximum.
-.It Bq Er ENOENT
-No shared memory segment was found matching
-.Fa key ,
-and IPC_CREAT was not specified.
-.It Bq Er ENOSPC
-The kernel was unable to allocate enough memory to
-satisfy the request.
-.It Bq Er EEXIST
-IPC_CREAT and IPC_EXCL were specified, and a shared memory segment
-corresponding to
-.Fa key
-already exists.
-.El
-.Sh "SEE ALSO"
-.Xr shmat 2 ,
-.Xr shmctl 2 ,
-.Xr shmdt 2 ,
-.Xr ftok 3
diff --git a/lib/libc/sys/shutdown.2 b/lib/libc/sys/shutdown.2
deleted file mode 100644
index 4752fb0ffc84..000000000000
--- a/lib/libc/sys/shutdown.2
+++ /dev/null
@@ -1,171 +0,0 @@
-.\" Copyright (c) 2007 Bruce M. Simpson.
-.\" Copyright (c) 1983, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)shutdown.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd July 27, 2015
-.Dt SHUTDOWN 2
-.Os
-.Sh NAME
-.Nm shutdown
-.Nd disable sends and/or receives on a socket
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In sys/socket.h
-.Ft int
-.Fn shutdown "int s" "int how"
-.Sh DESCRIPTION
-The
-.Fn shutdown
-system call disables sends or receives on a socket.
-The
-.Fa how
-argument specifies the type of shutdown.
-Possible values are:
-.Bl -tag -width ".Dv SHUT_RDWR"
-.It Dv SHUT_RD
-Further receives will be disallowed.
-.It Dv SHUT_WR
-Further sends will be disallowed.
-This may cause actions specific to the protocol family of the socket
-.Fa s
-to happen; see
-.Sx IMPLEMENTATION NOTES .
-.It Dv SHUT_RDWR
-Further sends and receives will be disallowed.
-Implies
-.Dv SHUT_WR .
-.El
-.Pp
-If the file descriptor
-.Fa s
-is associated with a
-.Dv SOCK_STREAM
-socket, all or part of the full-duplex connection will be shut down.
-.\"
-.Sh IMPLEMENTATION NOTES
-The following protocol specific actions apply to the use of
-.Dv SHUT_WR
-(and potentially also
-.Dv SHUT_RDWR ) ,
-based on the properties of the socket associated with the file descriptor
-.Fa s .
-.Bl -column ".Dv PF_INET6" ".Dv SOCK_STREAM" ".Dv IPPROTO_SCTP"
-.It Sy Domain Ta Sy Type Ta Sy Protocol Ta Sy Action
-.It Dv PF_INET Ta Dv SOCK_DGRAM Ta Dv IPPROTO_SCTP Ta
-Failure,
-as socket is not connected.
-.It Dv PF_INET Ta Dv SOCK_DGRAM Ta Dv IPPROTO_UDP Ta
-Failure,
-as socket is not connected.
-.It Dv PF_INET Ta Dv SOCK_STREAM Ta Dv IPPROTO_SCTP Ta
-Send queued data and tear down association.
-.It Dv PF_INET Ta Dv SOCK_STREAM Ta Dv IPPROTO_TCP Ta
-Send queued data, wait for ACK, then send FIN.
-.It Dv PF_INET6 Ta Dv SOCK_DGRAM Ta Dv IPPROTO_SCTP Ta
-Failure,
-as socket is not connected.
-.It Dv PF_INET6 Ta Dv SOCK_DGRAM Ta Dv IPPROTO_UDP Ta
-Failure,
-as socket is not connected.
-.It Dv PF_INET6 Ta Dv SOCK_STREAM Ta Dv IPPROTO_SCTP Ta
-Send queued data and tear down association.
-.It Dv PF_INET6 Ta Dv SOCK_STREAM Ta Dv IPPROTO_TCP Ta
-Send queued data, wait for ACK, then send FIN.
-.El
-.\"
-.Sh RETURN VALUES
-.Rv -std shutdown
-.Sh ERRORS
-The
-.Fn shutdown
-system call fails if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa s
-argument is not a valid file descriptor.
-.It Bq Er EINVAL
-The
-.Fa how
-argument is invalid.
-.It Bq Er ENOTCONN
-The
-.Fa s
-argument specifies a socket which is not connected.
-.It Bq Er ENOTSOCK
-The
-.Fa s
-argument does not refer to a socket.
-.El
-.Sh SEE ALSO
-.Xr connect 2 ,
-.Xr socket 2 ,
-.Xr inet 4 ,
-.Xr inet6 4
-.Sh STANDARDS
-The
-.Fn shutdown
-system call is expected to comply with
-.St -p1003.1g-2000 ,
-when finalized.
-.Sh HISTORY
-The
-.Fn shutdown
-system call appeared in
-.Bx 4.2 .
-The
-.Dv SHUT_RD , SHUT_WR ,
-and
-.Dv SHUT_RDWR
-constants appeared in
-.St -p1003.1g-2000 .
-.Sh AUTHORS
-.An -nosplit
-This manual page was updated by
-.An Bruce M. Simpson Aq Mt bms@FreeBSD.org
-to reflect how
-.Fn shutdown
-behaves with
-.Dv PF_INET
-and
-.Dv PF_INET6
-sockets.
-.Sh BUGS
-The ICMP
-.Dq Li "port unreachable"
-message should be generated in response to
-datagrams received on a local port to which
-.Fa s
-is bound
-after
-.Fn shutdown
-is called.
diff --git a/lib/libc/sys/sigaction.2 b/lib/libc/sys/sigaction.2
deleted file mode 100644
index e36ef385c848..000000000000
--- a/lib/libc/sys/sigaction.2
+++ /dev/null
@@ -1,795 +0,0 @@
-.\" Copyright (c) 1980, 1990, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" From: @(#)sigaction.2 8.2 (Berkeley) 4/3/94
-.\" $FreeBSD$
-.\"
-.Dd June 29, 2020
-.Dt SIGACTION 2
-.Os
-.Sh NAME
-.Nm sigaction
-.Nd software signal facilities
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In signal.h
-.Bd -literal
-struct sigaction {
- void (*sa_handler)(int);
- void (*sa_sigaction)(int, siginfo_t *, void *);
- int sa_flags; /* see signal options below */
- sigset_t sa_mask; /* signal mask to apply */
-};
-.Ed
-.Pp
-.Ft int
-.Fo sigaction
-.Fa "int sig"
-.Fa "const struct sigaction * restrict act"
-.Fa "struct sigaction * restrict oact"
-.Fc
-.Sh DESCRIPTION
-The system defines a set of signals that may be delivered to a process.
-Signal delivery resembles the occurrence of a hardware interrupt:
-the signal is normally blocked from further occurrence, the current thread
-context is saved, and a new one is built.
-A process may specify a
-.Em handler
-to which a signal is delivered, or specify that a signal is to be
-.Em ignored .
-A process may also specify that a default action is to be taken
-by the system when a signal occurs.
-A signal may also be
-.Em blocked
-for a thread,
-in which case it will not be delivered to that thread until it is
-.Em unblocked .
-The action to be taken on delivery is determined at the time
-of delivery.
-Normally, signal handlers execute on the current stack
-of the thread.
-This may be changed, on a per-handler basis,
-so that signals are taken on a special
-.Em "signal stack" .
-.Pp
-Signal routines normally execute with the signal that caused their
-invocation
-.Em blocked ,
-but other signals may yet occur.
-A global
-.Em "signal mask"
-defines the set of signals currently blocked from delivery
-to a thread.
-The signal mask for a thread is initialized
-from that of its parent (normally empty).
-It may be changed with a
-.Xr sigprocmask 2
-or
-.Xr pthread_sigmask 3
-call, or when a signal is delivered to the thread.
-.Pp
-When a signal
-condition arises for a process or thread, the signal is added to a set of
-signals pending for the process or thread.
-Whether the signal is directed at the process in general or at a specific
-thread depends on how it is generated.
-For signals directed at a specific thread,
-if the signal is not currently
-.Em blocked
-by the thread then it is delivered to the thread.
-For signals directed at the process,
-if the signal is not currently
-.Em blocked
-by all threads then it is delivered to one thread that does not have it blocked
-(the selection of which is unspecified).
-Signals may be delivered any time a thread enters the operating system
-(e.g., during a system call, page fault or trap, or clock interrupt).
-If multiple signals are ready to be delivered at the same time,
-any signals that could be caused by traps are delivered first.
-Additional signals may be processed at the same time, with each
-appearing to interrupt the handlers for the previous signals
-before their first instructions.
-The set of pending signals is returned by the
-.Xr sigpending 2
-system call.
-When a caught signal
-is delivered, the current state of the thread is saved,
-a new signal mask is calculated (as described below),
-and the signal handler is invoked.
-The call to the handler
-is arranged so that if the signal handling routine returns
-normally the thread will resume execution in the context
-from before the signal's delivery.
-If the thread wishes to resume in a different context, then it
-must arrange to restore the previous context itself.
-.Pp
-When a signal is delivered to a thread a new signal mask is
-installed for the duration of the process' signal handler
-(or until a
-.Xr sigprocmask 2
-system call is made).
-This mask is formed by taking the union of the current signal mask set,
-the signal to be delivered, and
-the signal mask associated with the handler to be invoked.
-.Pp
-The
-.Fn sigaction
-system call
-assigns an action for a signal specified by
-.Fa sig .
-If
-.Fa act
-is non-NULL, it specifies an action
-.Dv ( SIG_DFL ,
-.Dv SIG_IGN ,
-or a handler routine) and mask to be used when delivering the specified signal.
-If
-.Fa oact
-is non-NULL, the previous handling information for the signal
-is returned to the user.
-.Pp
-The above declaration of
-.Vt "struct sigaction"
-is not literal.
-It is provided only to list the accessible members.
-See
-.In sys/signal.h
-for the actual definition.
-In particular, the storage occupied by
-.Va sa_handler
-and
-.Va sa_sigaction
-overlaps, and it is nonsensical for an application to attempt to use both
-simultaneously.
-.Pp
-Once a signal handler is installed, it normally remains installed
-until another
-.Fn sigaction
-system call is made, or an
-.Xr execve 2
-is performed.
-A signal-specific default action may be reset by
-setting
-.Va sa_handler
-to
-.Dv SIG_DFL .
-The defaults are process termination, possibly with core dump;
-no action; stopping the process; or continuing the process.
-See the signal list below for each signal's default action.
-If
-.Va sa_handler
-is
-.Dv SIG_DFL ,
-the default action for the signal is to discard the signal,
-and if a signal is pending,
-the pending signal is discarded even if the signal is masked.
-If
-.Va sa_handler
-is set to
-.Dv SIG_IGN
-current and pending instances
-of the signal are ignored and discarded.
-.Pp
-Options may be specified by setting
-.Va sa_flags .
-The meaning of the various bits is as follows:
-.Bl -tag -offset indent -width SA_RESETHANDXX
-.It Dv SA_NOCLDSTOP
-If this bit is set when installing a catching function
-for the
-.Dv SIGCHLD
-signal,
-the
-.Dv SIGCHLD
-signal will be generated only when a child process exits,
-not when a child process stops.
-.It Dv SA_NOCLDWAIT
-If this bit is set when calling
-.Fn sigaction
-for the
-.Dv SIGCHLD
-signal, the system will not create zombie processes when children of
-the calling process exit.
-If the calling process subsequently issues a
-.Xr wait 2
-(or equivalent), it blocks until all of the calling process's child
-processes terminate, and then returns a value of \-1 with
-.Va errno
-set to
-.Er ECHILD .
-The same effect of avoiding zombie creation can also be achieved by setting
-.Va sa_handler
-for
-.Dv SIGCHLD
-to
-.Dv SIG_IGN .
-.It Dv SA_ONSTACK
-If this bit is set, the system will deliver the signal to the process
-on a
-.Em "signal stack" ,
-specified by each thread with
-.Xr sigaltstack 2 .
-.It Dv SA_NODEFER
-If this bit is set, further occurrences of the delivered signal are
-not masked during the execution of the handler.
-.It Dv SA_RESETHAND
-If this bit is set, the handler is reset back to
-.Dv SIG_DFL
-at the moment the signal is delivered.
-.It Dv SA_RESTART
-See paragraph below.
-.It Dv SA_SIGINFO
-If this bit is set, the handler function is assumed to be pointed to by the
-.Va sa_sigaction
-member of
-.Vt "struct sigaction"
-and should match the prototype shown above or as below in
-.Sx EXAMPLES .
-This bit should not be set when assigning
-.Dv SIG_DFL
-or
-.Dv SIG_IGN .
-.El
-.Pp
-If a signal is caught during the system calls listed below,
-the call may be forced to terminate
-with the error
-.Er EINTR ,
-the call may return with a data transfer shorter than requested,
-or the call may be restarted.
-Restart of pending calls is requested
-by setting the
-.Dv SA_RESTART
-bit in
-.Va sa_flags .
-The affected system calls include
-.Xr open 2 ,
-.Xr read 2 ,
-.Xr write 2 ,
-.Xr sendto 2 ,
-.Xr recvfrom 2 ,
-.Xr sendmsg 2
-and
-.Xr recvmsg 2
-on a communications channel or a slow device (such as a terminal,
-but not a regular file)
-and during a
-.Xr wait 2
-or
-.Xr ioctl 2 .
-However, calls that have already committed are not restarted,
-but instead return a partial success (for example, a short read count).
-.Pp
-After a
-.Xr pthread_create 3
-the signal mask is inherited by the new thread and
-the set of pending signals and the signal stack for the new thread are empty.
-.Pp
-After a
-.Xr fork 2
-or
-.Xr vfork 2
-all signals, the signal mask, the signal stack,
-and the restart/interrupt flags are inherited by the child.
-.Pp
-The
-.Xr execve 2
-system call reinstates the default
-action for all signals which were caught and
-resets all signals to be caught on the user stack.
-Ignored signals remain ignored;
-the signal mask remains the same;
-signals that restart pending system calls continue to do so.
-.Pp
-The following is a list of all signals
-with names as in the include file
-.In signal.h :
-.Bl -column SIGVTALARMXX "create core imagexxx"
-.It Sy NAME Ta Sy Default Action Ta Sy Description
-.It Dv SIGHUP Ta terminate process Ta terminal line hangup
-.It Dv SIGINT Ta terminate process Ta interrupt program
-.It Dv SIGQUIT Ta create core image Ta quit program
-.It Dv SIGILL Ta create core image Ta illegal instruction
-.It Dv SIGTRAP Ta create core image Ta trace trap
-.It Dv SIGABRT Ta create core image Ta Xr abort 3 call (formerly Dv SIGIOT )
-.It Dv SIGEMT Ta create core image Ta emulate instruction executed
-.It Dv SIGFPE Ta create core image Ta floating-point exception
-.It Dv SIGKILL Ta terminate process Ta kill program
-.It Dv SIGBUS Ta create core image Ta bus error
-.It Dv SIGSEGV Ta create core image Ta segmentation violation
-.It Dv SIGSYS Ta create core image Ta non-existent system call invoked
-.It Dv SIGPIPE Ta terminate process Ta write on a pipe with no reader
-.It Dv SIGALRM Ta terminate process Ta real-time timer expired
-.It Dv SIGTERM Ta terminate process Ta software termination signal
-.It Dv SIGURG Ta discard signal Ta urgent condition present on socket
-.It Dv SIGSTOP Ta stop process Ta stop (cannot be caught or ignored)
-.It Dv SIGTSTP Ta stop process Ta stop signal generated from keyboard
-.It Dv SIGCONT Ta discard signal Ta continue after stop
-.It Dv SIGCHLD Ta discard signal Ta child status has changed
-.It Dv SIGTTIN Ta stop process Ta background read attempted from control terminal
-.It Dv SIGTTOU Ta stop process Ta background write attempted to control terminal
-.It Dv SIGIO Ta discard signal Ta I/O is possible on a descriptor (see Xr fcntl 2 )
-.It Dv SIGXCPU Ta terminate process Ta cpu time limit exceeded (see Xr setrlimit 2 )
-.It Dv SIGXFSZ Ta terminate process Ta file size limit exceeded (see Xr setrlimit 2 )
-.It Dv SIGVTALRM Ta terminate process Ta virtual time alarm (see Xr setitimer 2 )
-.It Dv SIGPROF Ta terminate process Ta profiling timer alarm (see Xr setitimer 2 )
-.It Dv SIGWINCH Ta discard signal Ta window size change
-.It Dv SIGINFO Ta discard signal Ta status request from keyboard
-.It Dv SIGUSR1 Ta terminate process Ta user defined signal 1
-.It Dv SIGUSR2 Ta terminate process Ta user defined signal 2
-.El
-.Sh NOTE
-The
-.Va sa_mask
-field specified in
-.Fa act
-is not allowed to block
-.Dv SIGKILL
-or
-.Dv SIGSTOP .
-Any attempt to do so will be silently ignored.
-.Pp
-The following functions are either reentrant or not interruptible
-by signals and are async-signal safe.
-Therefore applications may
-invoke them, without restriction, from signal-catching functions
-or from a child process after calling
-.Xr fork 2
-in a multi-threaded process:
-.Pp
-Base Interfaces:
-.Pp
-.Fn _Exit ,
-.Fn _exit ,
-.Fn accept ,
-.Fn access ,
-.Fn alarm ,
-.Fn bind ,
-.Fn cfgetispeed ,
-.Fn cfgetospeed ,
-.Fn cfsetispeed ,
-.Fn cfsetospeed ,
-.Fn chdir ,
-.Fn chmod ,
-.Fn chown ,
-.Fn close ,
-.Fn connect ,
-.Fn creat ,
-.Fn dup ,
-.Fn dup2 ,
-.Fn execl ,
-.Fn execle ,
-.Fn execv ,
-.Fn execve ,
-.Fn faccessat ,
-.Fn fchdir ,
-.Fn fchmod ,
-.Fn fchmodat ,
-.Fn fchown ,
-.Fn fchownat ,
-.Fn fcntl ,
-.Fn fork ,
-.Fn fstat ,
-.Fn fstatat ,
-.Fn fsync ,
-.Fn ftruncate ,
-.Fn getegid ,
-.Fn geteuid ,
-.Fn getgid ,
-.Fn getgroups ,
-.Fn getpeername ,
-.Fn getpgrp ,
-.Fn getpid ,
-.Fn getppid ,
-.Fn getsockname ,
-.Fn getsockopt ,
-.Fn getuid ,
-.Fn kill ,
-.Fn link ,
-.Fn linkat ,
-.Fn listen ,
-.Fn lseek ,
-.Fn lstat ,
-.Fn mkdir ,
-.Fn mkdirat ,
-.Fn mkfifo ,
-.Fn mkfifoat ,
-.Fn mknod ,
-.Fn mknodat ,
-.Fn open ,
-.Fn openat ,
-.Fn pause ,
-.Fn pipe ,
-.Fn poll ,
-.Fn pselect ,
-.Fn pthread_sigmask ,
-.Fn raise ,
-.Fn read ,
-.Fn readlink ,
-.Fn readlinkat ,
-.Fn recv ,
-.Fn recvfrom ,
-.Fn recvmsg ,
-.Fn rename ,
-.Fn renameat ,
-.Fn rmdir ,
-.Fn select ,
-.Fn send ,
-.Fn sendmsg ,
-.Fn sendto ,
-.Fn setgid ,
-.Fn setpgid ,
-.Fn setsid ,
-.Fn setsockopt ,
-.Fn setuid ,
-.Fn shutdown ,
-.Fn sigaction ,
-.Fn sigaddset ,
-.Fn sigdelset ,
-.Fn sigemptyset ,
-.Fn sigfillset ,
-.Fn sigismember ,
-.Fn signal ,
-.Fn sigpending ,
-.Fn sigprocmask ,
-.Fn sigsuspend ,
-.Fn sleep ,
-.Fn sockatmark ,
-.Fn socket ,
-.Fn socketpair ,
-.Fn stat ,
-.Fn symlink ,
-.Fn symlinkat ,
-.Fn tcdrain ,
-.Fn tcflow ,
-.Fn tcflush ,
-.Fn tcgetattr ,
-.Fn tcgetpgrp ,
-.Fn tcsendbreak ,
-.Fn tcsetattr ,
-.Fn tcsetpgrp ,
-.Fn time ,
-.Fn times ,
-.Fn umask ,
-.Fn uname ,
-.Fn unlink ,
-.Fn unlinkat ,
-.Fn utime ,
-.Fn wait ,
-.Fn waitpid ,
-.Fn write .
-.Pp
-X/Open Systems Interfaces:
-.Pp
-.Fn sigpause ,
-.Fn sigset ,
-.Fn utimes .
-.Pp
-Realtime Interfaces:
-.Pp
-.Fn aio_error ,
-.Fn clock_gettime ,
-.Fn timer_getoverrun ,
-.Fn aio_return ,
-.Fn fdatasync ,
-.Fn sigqueue ,
-.Fn timer_gettime ,
-.Fn aio_suspend ,
-.Fn sem_post ,
-.Fn timer_settime .
-.Pp
-Base Interfaces not specified as async-signal safe by
-.Tn POSIX :
-.Pp
-.Fn fpathconf ,
-.Fn pathconf ,
-.Fn sysconf .
-.Pp
-Base Interfaces not specified as async-signal safe by
-.Tn POSIX ,
-but planned to be:
-.Pp
-.Fn ffs ,
-.Fn htonl ,
-.Fn htons ,
-.Fn memccpy ,
-.Fn memchr ,
-.Fn memcmp ,
-.Fn memcpy ,
-.Fn memmove ,
-.Fn memset ,
-.Fn ntohl ,
-.Fn ntohs ,
-.Fn stpcpy ,
-.Fn stpncpy ,
-.Fn strcat ,
-.Fn strchr ,
-.Fn strcmp ,
-.Fn strcpy ,
-.Fn strcspn ,
-.Fn strlen ,
-.Fn strncat ,
-.Fn strncmp ,
-.Fn strncpy ,
-.Fn strnlen ,
-.Fn strpbrk ,
-.Fn strrchr ,
-.Fn strspn ,
-.Fn strstr ,
-.Fn strtok_r ,
-.Fn wcpcpy ,
-.Fn wcpncpy ,
-.Fn wcscat ,
-.Fn wcschr ,
-.Fn wcscmp ,
-.Fn wcscpy ,
-.Fn wcscspn ,
-.Fn wcslen ,
-.Fn wcsncat ,
-.Fn wcsncmp ,
-.Fn wcsncpy ,
-.Fn wcsnlen ,
-.Fn wcspbrk ,
-.Fn wcsrchr ,
-.Fn wcsspn ,
-.Fn wcsstr ,
-.Fn wcstok ,
-.Fn wmemchr ,
-.Fn wmemcmp ,
-.Fn wmemcpy ,
-.Fn wmemmove ,
-.Fn wmemset .
-.Pp
-Extension Interfaces:
-.Pp
-.Fn accept4 ,
-.Fn bindat ,
-.Fn close_range ,
-.Fn closefrom ,
-.Fn connectat ,
-.Fn eaccess ,
-.Fn ffsl ,
-.Fn ffsll ,
-.Fn flock ,
-.Fn fls ,
-.Fn flsl ,
-.Fn flsll ,
-.Fn futimesat ,
-.Fn pipe2 ,
-.Fn strlcat .
-.Fn strlcpy ,
-.Fn strsep .
-.Pp
-In addition, reading or writing
-.Va errno
-is async-signal safe.
-.Pp
-All functions not in the above lists are considered to be unsafe
-with respect to signals.
-That is to say, the behaviour of such
-functions is undefined when they are called from a signal handler
-that interrupted an unsafe function.
-In general though, signal handlers should do little more than set a
-flag; most other actions are not safe.
-.Pp
-Also, it is good practice to make a copy of the global variable
-.Va errno
-and restore it before returning from the signal handler.
-This protects against the side effect of
-.Va errno
-being set by functions called from inside the signal handler.
-.Sh RETURN VALUES
-.Rv -std sigaction
-.Sh EXAMPLES
-There are three possible prototypes the handler may match:
-.Bl -tag -offset indent -width short
-.It Tn ANSI C :
-.Ft void
-.Fn handler int ;
-.It Traditional BSD style:
-.Ft void
-.Fn handler int "int code" "struct sigcontext *scp" ;
-.It Tn POSIX Dv SA_SIGINFO :
-.Ft void
-.Fn handler int "siginfo_t *info" "ucontext_t *uap" ;
-.El
-.Pp
-The handler function should match the
-.Dv SA_SIGINFO
-prototype if the
-.Dv SA_SIGINFO
-bit is set in
-.Va sa_flags .
-It then should be pointed to by the
-.Va sa_sigaction
-member of
-.Vt "struct sigaction" .
-Note that you should not assign
-.Dv SIG_DFL
-or
-.Dv SIG_IGN
-this way.
-.Pp
-If the
-.Dv SA_SIGINFO
-flag is not set, the handler function should match
-either the
-.Tn ANSI C
-or traditional
-.Bx
-prototype and be pointed to by
-the
-.Va sa_handler
-member of
-.Vt "struct sigaction" .
-In practice,
-.Fx
-always sends the three arguments of the latter and since the
-.Tn ANSI C
-prototype is a subset, both will work.
-The
-.Va sa_handler
-member declaration in
-.Fx
-include files is that of
-.Tn ANSI C
-(as required by
-.Tn POSIX ) ,
-so a function pointer of a
-.Bx Ns -style
-function needs to be casted to
-compile without warning.
-The traditional
-.Bx
-style is not portable and since its capabilities
-are a full subset of a
-.Dv SA_SIGINFO
-handler,
-its use is deprecated.
-.Pp
-The
-.Fa sig
-argument is the signal number, one of the
-.Dv SIG...
-values from
-.In signal.h .
-.Pp
-The
-.Fa code
-argument of the
-.Bx Ns -style
-handler and the
-.Va si_code
-member of the
-.Fa info
-argument to a
-.Dv SA_SIGINFO
-handler contain a numeric code explaining the
-cause of the signal, usually one of the
-.Dv SI_...
-values from
-.In sys/signal.h
-or codes specific to a signal, i.e., one of the
-.Dv FPE_...
-values for
-.Dv SIGFPE .
-.Pp
-The
-.Fa scp
-argument to a
-.Bx Ns -style
-handler points to an instance of
-.Vt "struct sigcontext" .
-.Pp
-The
-.Fa uap
-argument to a
-.Tn POSIX
-.Dv SA_SIGINFO
-handler points to an instance of
-ucontext_t.
-.Sh ERRORS
-The
-.Fn sigaction
-system call
-will fail and no new signal handler will be installed if one
-of the following occurs:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Fa sig
-argument
-is not a valid signal number.
-.It Bq Er EINVAL
-An attempt is made to ignore or supply a handler for
-.Dv SIGKILL
-or
-.Dv SIGSTOP .
-.El
-.Sh SEE ALSO
-.Xr kill 1 ,
-.Xr kill 2 ,
-.Xr ptrace 2 ,
-.Xr setitimer 2 ,
-.Xr setrlimit 2 ,
-.Xr sigaltstack 2 ,
-.Xr sigpending 2 ,
-.Xr sigprocmask 2 ,
-.Xr sigsuspend 2 ,
-.Xr wait 2 ,
-.Xr fpsetmask 3 ,
-.Xr setjmp 3 ,
-.Xr siginfo 3 ,
-.Xr siginterrupt 3 ,
-.Xr sigsetops 3 ,
-.Xr ucontext 3 ,
-.Xr tty 4
-.Sh STANDARDS
-The
-.Fn sigaction
-system call is expected to conform to
-.St -p1003.1-90 .
-The
-.Dv SA_ONSTACK
-and
-.Dv SA_RESTART
-flags are Berkeley extensions,
-as are the signals,
-.Dv SIGTRAP ,
-.Dv SIGEMT ,
-.Dv SIGBUS ,
-.Dv SIGSYS ,
-.Dv SIGURG ,
-.Dv SIGIO ,
-.Dv SIGXCPU ,
-.Dv SIGXFSZ ,
-.Dv SIGVTALRM ,
-.Dv SIGPROF ,
-.Dv SIGWINCH ,
-and
-.Dv SIGINFO .
-Those signals are available on most
-.Bx Ns \-derived
-systems.
-The
-.Dv SA_NODEFER
-and
-.Dv SA_RESETHAND
-flags are intended for backwards compatibility with other operating
-systems.
-The
-.Dv SA_NOCLDSTOP ,
-and
-.Dv SA_NOCLDWAIT
-.\" and
-.\" SA_SIGINFO
-flags are featuring options commonly found in other operating systems.
-The flags are approved by
-.St -susv2 ,
-along with the option to avoid zombie creation by ignoring
-.Dv SIGCHLD .
diff --git a/lib/libc/sys/sigaction.c b/lib/libc/sys/sigaction.c
index b4d65639b816..809881ca4d3f 100644
--- a/lib/libc/sys/sigaction.c
+++ b/lib/libc/sys/sigaction.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2014 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <signal.h>
#include "libc_private.h"
@@ -44,7 +40,5 @@ __weak_reference(sigaction, __libc_sigaction);
int
sigaction(int sig, const struct sigaction *act, struct sigaction *oact)
{
-
- return (((int (*)(int, const struct sigaction *, struct sigaction *))
- __libc_interposing[INTERPOS_sigaction])(sig, act, oact));
+ return (INTERPOS_SYS(sigaction, sig, act, oact));
}
diff --git a/lib/libc/sys/sigaltstack.2 b/lib/libc/sys/sigaltstack.2
deleted file mode 100644
index df35ff0c3bf4..000000000000
--- a/lib/libc/sys/sigaltstack.2
+++ /dev/null
@@ -1,162 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1992, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)sigaltstack.2 8.2 (Berkeley) 5/1/95
-.\" $FreeBSD$
-.\"
-.Dd May 6, 2010
-.Dt SIGALTSTACK 2
-.Os
-.Sh NAME
-.Nm sigaltstack
-.Nd set and/or get signal stack context
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In signal.h
-.Bd -literal
-typedef struct {
- char *ss_sp;
- size_t ss_size;
- int ss_flags;
-} stack_t;
-.Ed
-.Ft int
-.Fn sigaltstack "const stack_t * restrict ss" "stack_t * restrict oss"
-.Sh DESCRIPTION
-The
-.Fn sigaltstack
-system call
-allows defining an alternate stack on which signals
-are to be processed for the current thread.
-If
-.Fa ss
-is non-zero,
-it specifies a pointer to and the size of a
-.Em "signal stack"
-on which to deliver signals.
-When a signal's action indicates its handler
-should execute on the signal stack (specified with a
-.Xr sigaction 2
-system call), the system checks to see
-if the thread is currently executing on that stack.
-If the thread is not currently executing on the signal stack,
-the system arranges a switch to the signal stack for the
-duration of the signal handler's execution.
-.Pp
-An active stack cannot be modified.
-.Pp
-If
-.Dv SS_DISABLE
-is set in
-.Fa ss_flags ,
-.Fa ss_sp
-and
-.Fa ss_size
-are ignored and the signal stack will be disabled.
-A disabled stack will cause all signals to be
-taken on the regular user stack.
-If the stack is later re-enabled then all signals that were specified
-to be processed on an alternate stack will resume doing so.
-.Pp
-If
-.Fa oss
-is non-zero, the current signal stack state is returned.
-The
-.Fa ss_flags
-field will contain the value
-.Dv SS_ONSTACK
-if the thread is currently on a signal stack and
-.Dv SS_DISABLE
-if the signal stack is currently disabled.
-.Sh NOTES
-The value
-.Dv SIGSTKSZ
-is defined to be the number of bytes/chars that would be used to cover
-the usual case when allocating an alternate stack area.
-The following code fragment is typically used to allocate an alternate stack.
-.Bd -literal -offset indent
-if ((sigstk.ss_sp = malloc(SIGSTKSZ)) == NULL)
- /* error return */
-sigstk.ss_size = SIGSTKSZ;
-sigstk.ss_flags = 0;
-if (sigaltstack(&sigstk, NULL) < 0)
- perror("sigaltstack");
-.Ed
-An alternative approach is provided for programs with signal handlers
-that require a specific amount of stack space other than the default size.
-The value
-.Dv MINSIGSTKSZ
-is defined to be the number of bytes/chars that is required by
-the operating system to implement the alternate stack feature.
-In computing an alternate stack size,
-programs should add
-.Dv MINSIGSTKSZ
-to their stack requirements to allow for the operating system overhead.
-.Pp
-Signal stacks are automatically adjusted for the direction of stack
-growth and alignment requirements.
-Signal stacks may or may not be protected by the hardware and
-are not ``grown'' automatically as is done for the normal stack.
-If the stack overflows and this space is not protected
-unpredictable results may occur.
-.Sh RETURN VALUES
-.Rv -std sigaltstack
-.Sh ERRORS
-The
-.Fn sigaltstack
-system call
-will fail and the signal stack context will remain unchanged
-if one of the following occurs.
-.Bl -tag -width Er
-.It Bq Er EFAULT
-Either
-.Fa ss
-or
-.Fa oss
-points to memory that is not a valid part of the process
-address space.
-.It Bq Er EPERM
-An attempt was made to modify an active stack.
-.It Bq Er EINVAL
-The
-.Fa ss_flags
-field was invalid.
-.It Bq Er ENOMEM
-Size of alternate stack area is less than or equal to
-.Dv MINSIGSTKSZ .
-.El
-.Sh SEE ALSO
-.Xr sigaction 2 ,
-.Xr setjmp 3
-.Sh HISTORY
-The predecessor to
-.Fn sigaltstack ,
-the
-.Fn sigstack
-system call, appeared in
-.Bx 4.2 .
diff --git a/lib/libc/sys/sigfastblock.2 b/lib/libc/sys/sigfastblock.2
deleted file mode 100644
index da835abdf9aa..000000000000
--- a/lib/libc/sys/sigfastblock.2
+++ /dev/null
@@ -1,166 +0,0 @@
-.\" Copyright (c) 2016 The FreeBSD Foundation, Inc.
-.\"
-.\" This documentation was written by
-.\" Konstantin Belousov <kib@FreeBSD.org> under sponsorship
-.\" from the FreeBSD Foundation.
-.\"
-.\" 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 AUTHORS 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 AUTHORS 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd December 13, 2019
-.Dt SIGFASTBLOCK 2
-.Os
-.Sh NAME
-.Nm sigfastblock
-.Nd controls signals blocking with a simple memory write
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/signalvar.h
-.Ft int
-.Fn sigfastblock "int cmd" "void *ptr"
-.Sh DESCRIPTION
-.Bf -symbolic
-This function is not intended for a direct usage by applications.
-The functionality is provided for implementing some optimizations in
-.Xr ld-elf.so.1 8
-and
-.Lb libthr .
-.Ef
-.Pp
-The function configures the kernel facility that allows a thread to
-block asynchronous signals delivery with a single write to userspace
-memory, avoiding overhead of system calls like
-.Xr sigprocmask 2
-for establishing critical sections.
-The C runtime uses it to optimize implementation of async-signal-safe
-functionality.
-.Pp
-A thread might register a
-.Dv sigblock
-variable of type
-.Vt int
-as a location which is consulted by kernel when calculating the
-blocked signal mask for delivery of asynchronous signals.
-If the variable indicates that blocking is requested, then the kernel
-effectively operates as if the mask containing all blockable signals was
-supplied to
-.Xr sigprocmask 2 .
-.Pp
-The variable is supposed to be modified only from the owning thread,
-there is no way to guarantee visibility of update from other thread
-to kernel when signals are delivered.
-.Pp
-Lower bits of the sigblock variable are reserved as flags,
-which might be set or cleared by kernel at arbitrary moments.
-Userspace code should use
-.Xr atomic 9
-operations of incrementing and decrementing by
-.Dv SIGFASTBLOCK_INC
-quantity to recursively block or unblock signals delivery.
-.Pp
-If a signal would be delivered when unmasked, kernel might set the
-.Dv SIGFASTBLOCK_PEND
-.Dq pending signal
-flag in the sigblock variable.
-Userspace should perform
-.Dv SIGFASTBLOCK_UNBLOCK
-operation when clearing the variable if it notes the pending signal
-bit is set, which would deliver the pending signals immediately.
-Otherwise, signals delivery might be postponed.
-.Pp
-The
-.Fa cmd
-argument specifies one of the following operations:
-.Bl -tag -width SIGFASTBLOCK_UNSETPTR
-.It Dv SIGFASTBLOCK_SETPTR
-Register the variable of type
-.Vt int
-at location pointed to by the
-.Fa ptr
-argument as sigblock variable for the calling thread.
-.It Dv SIGFASTBLOCK_UNSETPTR
-Unregister the currently registered sigblock location.
-Kernel stops inferring the blocked mask from non-zero value of its
-blocked count.
-New location can be registered after previous one is deregistered.
-.It Dv SIGFASTBLOCK_UNBLOCK
-If there are pending signals which should be delivered to the calling
-thread, they are delivered before returning from the call.
-The sigblock variable should have zero blocking count, and indicate
-that the pending signal exists.
-Effectively this means that the variable should have the value
-.Dv SIGFASTBLOCK_PEND .
-.El
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-The operation may fail with the following errors:
-.Bl -tag -width Er
-.It Bq Er EBUSY
-The
-.Dv SIGFASTBLOCK_SETPTR
-attempted while the sigblock address was already registered.
-The
-.Dv SIGFASTBLOCK_UNBLOCK
-was called while sigblock variable value is not equal to
-.Dv SIGFASTBLOCK_PEND .
-.It Bq Er EINVAL
-The variable address passed to
-.Dv SIGFASTBLOCK_SETPTR
-is not aligned naturally.
-The
-.Dv SIGFASTBLOCK_UNSETPTR
-operation was attempted without prior successfull call to
-.Dv SIGFASTBLOCK_SETPTR .
-.It Bq Er EFAULT
-Attempt to read or write to the sigblock variable failed.
-Note that kernel generates the
-.Dv SIGSEGV
-signal if an attempt to read from the sigblock variable faulted
-during implicit accesses from syscall entry.
-.El
-.Sh SEE ALSO
-.Xr kill 2 ,
-.Xr signal 2 ,
-.Xr sigprocmask 2 ,
-.Xr libthr 3 ,
-.Xr ld-elf.so.1 8
-.Sh STANDARDS
-The
-.Nm
-function is non-standard, although a similar functionality is a common
-optimization provided by several other systems.
-.Sh HISTORY
-The
-.Nm
-function was introduced in
-.Fx 13.0 .
-.Sh BUGS
-The
-.Nm
-symbol is currently not exported by libc, on purpose.
-Consumers should either use the
-.Dv __sys_fast_sigblock
-symbol from the private libc namespace, or utilize
-.Xr syscall 2 .
diff --git a/lib/libc/sys/sigpending.2 b/lib/libc/sys/sigpending.2
deleted file mode 100644
index d7d227cc455f..000000000000
--- a/lib/libc/sys/sigpending.2
+++ /dev/null
@@ -1,77 +0,0 @@
-.\" Copyright (c) 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" This code is derived from software contributed to Berkeley by
-.\" Berkeley Software Design, 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)sigpending.2 8.3 (Berkeley) 1/12/94
-.\" $FreeBSD$
-.\"
-.Dd September 6, 2013
-.Dt SIGPENDING 2
-.Os
-.Sh NAME
-.Nm sigpending
-.Nd get pending signals
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In signal.h
-.Ft int
-.Fn sigpending "sigset_t *set"
-.Sh DESCRIPTION
-The
-.Fn sigpending
-system call returns a mask of the signals pending for delivery
-to the calling thread or the calling process in the location indicated by
-.Fa set .
-Signals may be pending because they are currently masked,
-or transiently before delivery (although the latter case is not
-normally detectable).
-.Sh RETURN VALUES
-.Rv -std sigpending
-.Sh ERRORS
-The
-.Fn sigpending
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EFAULT
-The
-.Fa set
-argument specified an invalid address.
-.El
-.Sh SEE ALSO
-.Xr sigaction 2 ,
-.Xr sigprocmask 2 ,
-.Xr sigsuspend 2 ,
-.Xr sigsetops 3
-.Sh STANDARDS
-The
-.Fn sigpending
-system call is expected to conform to
-.St -p1003.1-90 .
diff --git a/lib/libc/sys/sigprocmask.2 b/lib/libc/sys/sigprocmask.2
deleted file mode 100644
index 1d28187a21dd..000000000000
--- a/lib/libc/sys/sigprocmask.2
+++ /dev/null
@@ -1,131 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)sigprocmask.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd May 7, 2010
-.Dt SIGPROCMASK 2
-.Os
-.Sh NAME
-.Nm sigprocmask
-.Nd manipulate current signal mask
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In signal.h
-.Ft int
-.Fo sigprocmask
-.Fa "int how"
-.Fa "const sigset_t * restrict set"
-.Fa "sigset_t * restrict oset"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn sigprocmask
-system call examines and/or changes the current signal mask (those signals
-that are blocked from delivery).
-Signals are blocked if they are members of the current signal mask set.
-.Pp
-If
-.Fa set
-is not null, the action of
-.Fn sigprocmask
-depends on the value of the
-.Fa how
-argument.
-The signal mask is changed as a function of the specified
-.Fa set
-and the current mask.
-The function is specified by
-.Fa how
-using one of the following values from
-.In signal.h :
-.Bl -tag -width SIG_UNBLOCK
-.It Dv SIG_BLOCK
-The new mask is the union of the current mask and the specified
-.Fa set .
-.It Dv SIG_UNBLOCK
-The new mask is the intersection of the current mask
-and the complement of the specified
-.Fa set .
-.It Dv SIG_SETMASK
-The current mask is replaced by the specified
-.Fa set .
-.El
-.Pp
-If
-.Fa oset
-is not null, it is set to
-the previous value of the signal mask.
-When
-.Fa set
-is null,
-the value of
-.Fa how
-is insignificant and the mask remains unset
-providing a way to examine the signal mask without modification.
-.Pp
-The system
-quietly disallows
-.Dv SIGKILL
-or
-.Dv SIGSTOP
-to be blocked.
-.Pp
-In threaded applications,
-.Xr pthread_sigmask 3
-must be used instead of
-.Fn sigprocmask .
-.Sh RETURN VALUES
-.Rv -std sigprocmask
-.Sh ERRORS
-The
-.Fn sigprocmask
-system call will fail and the signal mask will be unchanged if one
-of the following occurs:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Fa how
-argument
-has a value other than those listed here.
-.El
-.Sh SEE ALSO
-.Xr kill 2 ,
-.Xr sigaction 2 ,
-.Xr sigpending 2 ,
-.Xr sigsuspend 2 ,
-.Xr fpsetmask 3 ,
-.Xr pthread_sigmask 3 ,
-.Xr sigsetops 3
-.Sh STANDARDS
-The
-.Fn sigprocmask
-system call is expected to
-conform to
-.St -p1003.1-90 .
diff --git a/lib/libc/sys/sigprocmask.c b/lib/libc/sys/sigprocmask.c
index d24bb89c1f79..96cb9586509b 100644
--- a/lib/libc/sys/sigprocmask.c
+++ b/lib/libc/sys/sigprocmask.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2014 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <signal.h>
#include "libc_private.h"
@@ -44,7 +40,5 @@ __weak_reference(sigprocmask, __libc_sigprocmask);
int
sigprocmask(int how, const sigset_t *set, sigset_t *oset)
{
-
- return (((int (*)(int, const sigset_t *, sigset_t *))
- __libc_interposing[INTERPOS_sigprocmask])(how, set, oset));
+ return (INTERPOS_SYS(sigprocmask, how, set, oset));
}
diff --git a/lib/libc/sys/sigqueue.2 b/lib/libc/sys/sigqueue.2
deleted file mode 100644
index 8377c67295b0..000000000000
--- a/lib/libc/sys/sigqueue.2
+++ /dev/null
@@ -1,163 +0,0 @@
-.\" Copyright (c) 2005 David Xu <davidxu@FreeBSD.org>
-.\" All rights reserved.
-.\"
-.\" 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(s), this list of conditions and the following disclaimer as
-.\" the first lines of this file unmodified other than the possible
-.\" addition of one or more copyright notices.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice(s), 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 HOLDER(S) ``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(S) 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd May 5, 2017
-.Dt SIGQUEUE 2
-.Os
-.Sh NAME
-.Nm sigqueue
-.Nd "queue a signal to a process (REALTIME)"
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In signal.h
-.Ft int
-.Fn sigqueue "pid_t pid" "int signo" "const union sigval value"
-.Sh DESCRIPTION
-The
-.Fn sigqueue
-system call causes the signal specified by
-.Fa signo
-to be sent with the value specified by
-.Fa value
-to the process specified by
-.Fa pid .
-If
-.Fa signo
-is zero (the null signal), error checking is performed but
-no signal is actually sent.
-The null signal can be used to check the
-validity of PID.
-.Pp
-The conditions required for a process to have permission to queue a
-signal to another process are the same as for the
-.Xr kill 2
-system call.
-The
-.Fn sigqueue
-system call queues a signal to a single process specified by the
-.Fa pid
-argument.
-.Pp
-The
-.Fn sigqueue
-system call returns immediately.
-If the resources were
-available to queue the signal, the signal will be queued and sent to
-the receiving process.
-.Pp
-If the value of
-.Fa pid
-causes
-.Fa signo
-to be generated for the sending process, and if
-.Fa signo
-is not blocked for the calling thread and if no other thread has
-.Fa signo
-unblocked or is waiting in a
-.Fn sigwait
-system call for
-.Fa signo ,
-either
-.Fa signo
-or at least the pending, unblocked signal will be delivered to the
-calling thread before
-.Fn sigqueue
-returns.
-Should any multiple pending signals in the range
-.Dv SIGRTMIN
-to
-.Dv SIGRTMAX
-be selected for delivery, it is the lowest numbered
-one.
-The selection order between realtime and non-realtime signals, or
-between multiple pending non-realtime signals, is unspecified.
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-The
-.Fn sigqueue
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EAGAIN
-No resources are available to queue the signal.
-The process has already
-queued
-.Brq Dv SIGQUEUE_MAX
-signals that are still pending at the receiver(s),
-or a system-wide resource limit has been exceeded.
-.It Bq Er EINVAL
-The value of the
-.Fa signo
-argument is an invalid or unsupported signal number.
-.It Bq Er EPERM
-The process does not have the appropriate privilege to send the signal
-to the receiving process.
-.It Bq Er ESRCH
-The process
-.Fa pid
-does not exist.
-.El
-.Sh SEE ALSO
-.Xr kill 2 ,
-.Xr sigaction 2 ,
-.Xr sigpending 2 ,
-.Xr sigsuspend 2 ,
-.Xr sigtimedwait 2 ,
-.Xr sigwait 2 ,
-.Xr sigwaitinfo 2 ,
-.Xr pause 3 ,
-.Xr pthread_sigmask 3 ,
-.Xr siginfo 3
-.Sh STANDARDS
-The
-.Fn sigqueue
-system call conforms to
-.St -p1003.1-2004 .
-.Sh HISTORY
-Support for
-.Tn POSIX
-realtime signal queue first appeared in
-.Fx 7.0 .
-.Sh CAVEATS
-When using
-.Nm
-to send signals to a process which might have a different ABI
-(for instance, one is 32-bit and the other 64-bit),
-the
-.Va sival_int
-member of
-.Fa value
-can be delivered reliably, but the
-.Va sival_ptr
-may be truncated in endian dependent ways and must not be relied on.
-Further, many pointer integrity schemes disallow sending pointers to other
-processes, and this technique should not be used in programs intended to
-be portable.
diff --git a/lib/libc/sys/sigreturn.2 b/lib/libc/sys/sigreturn.2
deleted file mode 100644
index 9b9320c50c59..000000000000
--- a/lib/libc/sys/sigreturn.2
+++ /dev/null
@@ -1,89 +0,0 @@
-.\" Copyright (c) 1985, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)sigreturn.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd September 6, 2013
-.Dt SIGRETURN 2
-.Os
-.Sh NAME
-.Nm sigreturn
-.Nd return from signal
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In signal.h
-.Ft int
-.Fn sigreturn "const ucontext_t *scp"
-.Sh DESCRIPTION
-The
-.Fn sigreturn
-system call
-allows users to atomically unmask, switch stacks,
-and return from a signal context.
-The thread's signal mask and stack status are
-restored from the context structure pointed to by
-.Fa scp .
-The system call does not return;
-the users stack pointer, frame pointer, argument pointer,
-and processor status longword are restored from the context.
-Execution resumes at the specified pc.
-This system call is used by the trampoline code and
-.Xr longjmp 3
-when returning from a signal to the previously executing program.
-.Sh RETURN VALUES
-If successful, the system call does not return.
-Otherwise, a value of -1 is returned and
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-The
-.Fn sigreturn
-system call
-will fail and the thread context will remain unchanged
-if one of the following occurs.
-.Bl -tag -width Er
-.It Bq Er EFAULT
-The
-.Fa scp
-argument
-points to memory that is not a valid part of the process
-address space.
-.It Bq Er EINVAL
-The process status longword is invalid or would improperly
-raise the privilege level of the process.
-.El
-.Sh SEE ALSO
-.Xr sigaction 2 ,
-.Xr setjmp 3 ,
-.Xr ucontext 3
-.Sh HISTORY
-The
-.Fn sigreturn
-system call appeared in
-.Bx 4.3 .
diff --git a/lib/libc/sys/sigstack.2 b/lib/libc/sys/sigstack.2
deleted file mode 100644
index 823f25fa4ee1..000000000000
--- a/lib/libc/sys/sigstack.2
+++ /dev/null
@@ -1,50 +0,0 @@
-.\" Copyright (c) 1983, 1992, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)sigstack.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd June 4, 1993
-.Dt SIGSTACK 2
-.Os
-.Sh NAME
-.Nm sigstack
-.Nd set and/or get signal stack context
-.Sh LIBRARY
-.Lb libc
-.Sh DESCRIPTION
-The
-.Fn sigstack
-function has been deprecated in favor of the interface described in
-.Xr sigaltstack 2 .
-.Sh SEE ALSO
-.Xr sigaltstack 2
-.Sh HISTORY
-The
-.Fn sigstack
-system call appeared in
-.Bx 4.2 .
diff --git a/lib/libc/sys/sigsuspend.2 b/lib/libc/sys/sigsuspend.2
deleted file mode 100644
index 3f5d9d2a1a61..000000000000
--- a/lib/libc/sys/sigsuspend.2
+++ /dev/null
@@ -1,85 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)sigsuspend.2 8.2 (Berkeley) 5/16/95
-.\" $FreeBSD$
-.\"
-.Dd August 16, 2013
-.Dt SIGSUSPEND 2
-.Os
-.Sh NAME
-.Nm sigsuspend
-.Nd atomically release blocked signals and wait for interrupt
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In signal.h
-.Ft int
-.Fn sigsuspend "const sigset_t *sigmask"
-.Sh DESCRIPTION
-The
-.Fn sigsuspend
-system call
-temporarily changes the blocked signal mask to the set to which
-.Fa sigmask
-points,
-and then waits for a signal to arrive;
-on return the previous set of masked signals is restored.
-The signal mask set
-is usually empty to indicate that all
-signals are to be unblocked for the duration of the call.
-.Pp
-In normal usage, a signal is blocked using
-.Xr sigprocmask 2
-to begin a critical section, variables modified on the occurrence
-of the signal are examined to determine that there is no work
-to be done, and the process pauses awaiting work by using
-.Fn sigsuspend
-with the previous mask returned by
-.Xr sigprocmask 2 .
-.Sh RETURN VALUES
-The
-.Fn sigsuspend
-system call
-always terminates by being interrupted, returning -1 with
-.Va errno
-set to
-.Er EINTR .
-.Sh SEE ALSO
-.Xr pselect 2 ,
-.Xr sigaction 2 ,
-.Xr sigpending 2 ,
-.Xr sigprocmask 2 ,
-.Xr sigtimedwait 2 ,
-.Xr sigwait 2 ,
-.Xr sigwaitinfo 2 ,
-.Xr sigsetops 3
-.Sh STANDARDS
-The
-.Fn sigsuspend
-system call is expected to conform to
-.St -p1003.1-90 .
diff --git a/lib/libc/sys/sigsuspend.c b/lib/libc/sys/sigsuspend.c
index 1f980a117a1b..e5a9495f9f39 100644
--- a/lib/libc/sys/sigsuspend.c
+++ b/lib/libc/sys/sigsuspend.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2014 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <signal.h>
#include "libc_private.h"
@@ -44,7 +40,5 @@ __weak_reference(sigsuspend, __libc_sigsuspend);
int
sigsuspend(const sigset_t *set)
{
-
- return (((int (*)(const sigset_t *))
- __libc_interposing[INTERPOS_sigsuspend])(set));
+ return (INTERPOS_SYS(sigsuspend, set));
}
diff --git a/lib/libc/sys/sigtimedwait.c b/lib/libc/sys/sigtimedwait.c
index 4e067192ca4b..839e5fe4d992 100644
--- a/lib/libc/sys/sigtimedwait.c
+++ b/lib/libc/sys/sigtimedwait.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2014 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <signal.h>
#include "libc_private.h"
@@ -44,8 +40,5 @@ int
sigtimedwait(const sigset_t * __restrict set, siginfo_t * __restrict info,
const struct timespec * __restrict t)
{
-
- return (((int (*)(const sigset_t *, siginfo_t *,
- const struct timespec *))
- __libc_interposing[INTERPOS_sigtimedwait])(set, info, t));
+ return (INTERPOS_SYS(sigtimedwait, set, info, t));
}
diff --git a/lib/libc/sys/sigwait.2 b/lib/libc/sys/sigwait.2
deleted file mode 100644
index 4da64a99dddd..000000000000
--- a/lib/libc/sys/sigwait.2
+++ /dev/null
@@ -1,124 +0,0 @@
-.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>.
-.\" All rights reserved.
-.\"
-.\" 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(s), this list of conditions and the following disclaimer as
-.\" the first lines of this file unmodified other than the possible
-.\" addition of one or more copyright notices.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice(s), 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 HOLDER(S) ``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(S) 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd September 6, 2013
-.Dt SIGWAIT 2
-.Os
-.Sh NAME
-.Nm sigwait
-.Nd select a set of signals
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In signal.h
-.Ft int
-.Fn sigwait "const sigset_t * restrict set" "int * restrict sig"
-.Sh DESCRIPTION
-The
-.Fn sigwait
-system call selects a set of signals, specified by
-.Fa set .
-If none of the selected signals are pending,
-.Fn sigwait
-waits until one or more of the selected signals has been generated.
-Then
-.Fn sigwait
-atomically clears one of the selected signals from the set of pending signals
-(for the process or for the current thread) and sets the location pointed to by
-.Fa sig
-to the signal number that was cleared.
-.Pp
-The signals specified by
-.Fa set
-should be blocked at the time of the call to
-.Fn sigwait .
-.Pp
-If more than one thread is using
-.Fn sigwait
-to wait for the same signal, no more than one of these threads will return from
-.Fn sigwait
-with the signal number.
-If more than a single thread is blocked in
-.Fn sigwait
-for a signal when that signal is generated for the process, it is unspecified
-which of the waiting threads returns from
-.Fn sigwait .
-If the signal is generated for a specific thread, as by
-.Fn pthread_kill ,
-only that thread will return.
-.Pp
-Should any of the multiple pending signals in the range
-.Dv SIGRTMIN
-to
-.Dv SIGRTMAX
-be
-selected, it will be the lowest numbered one.
-The selection order between realtime
-and non-realtime signals, or between multiple pending non-realtime signals,
-is unspecified.
-.Sh IMPLEMENTATION NOTES
-The
-.Fn sigwait
-function is implemented as a wrapper around the
-.Fn __sys_sigwait
-system call, which retries the call on
-.Er EINTR
-error.
-.Sh RETURN VALUES
-If successful,
-.Fn sigwait
-returns 0 and sets the location pointed to by
-.Fa sig
-to the cleared signal number.
-Otherwise, an error number is returned.
-.Sh ERRORS
-The
-.Fn sigwait
-system call will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Fa set
-argument
-specifies one or more invalid signal numbers.
-.El
-.Sh SEE ALSO
-.Xr sigaction 2 ,
-.Xr sigpending 2 ,
-.Xr sigqueue 2 ,
-.Xr sigsuspend 2 ,
-.Xr sigtimedwait 2 ,
-.Xr sigwaitinfo 2 ,
-.Xr pause 3 ,
-.Xr pthread_sigmask 3
-.Sh STANDARDS
-The
-.Fn sigwait
-function conforms to
-.St -p1003.1-96 .
diff --git a/lib/libc/sys/sigwait.c b/lib/libc/sys/sigwait.c
index ad485d0c5241..5a7d71bf3ed9 100644
--- a/lib/libc/sys/sigwait.c
+++ b/lib/libc/sys/sigwait.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2010 davidxu@freebsd.org
*
@@ -25,32 +25,12 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <errno.h>
#include <signal.h>
#include "libc_private.h"
-__weak_reference(__libc_sigwait, __sigwait);
-
#pragma weak sigwait
int
sigwait(const sigset_t *set, int *sig)
{
-
- return (((int (*)(const sigset_t *, int *))
- __libc_interposing[INTERPOS_sigwait])(set, sig));
-}
-
-int
-__libc_sigwait(const sigset_t *set, int *sig)
-{
- int ret;
-
- /* POSIX does not allow EINTR to be returned */
- do {
- ret = __sys_sigwait(set, sig);
- } while (ret == EINTR);
- return (ret);
+ return (INTERPOS_SYS(sigwait, set, sig));
}
diff --git a/lib/libc/sys/sigwaitinfo.2 b/lib/libc/sys/sigwaitinfo.2
deleted file mode 100644
index b497592ed1f3..000000000000
--- a/lib/libc/sys/sigwaitinfo.2
+++ /dev/null
@@ -1,206 +0,0 @@
-.\" Copyright (c) 2005 David Xu <davidxu@FreeBSD.org>
-.\" All rights reserved.
-.\"
-.\" 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(s), this list of conditions and the following disclaimer as
-.\" the first lines of this file unmodified other than the possible
-.\" addition of one or more copyright notices.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice(s), 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 HOLDER(S) ``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(S) 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd September 27, 2012
-.Dt SIGTIMEDWAIT 2
-.Os
-.Sh NAME
-.Nm sigtimedwait , sigwaitinfo
-.Nd "wait for queued signals (REALTIME)"
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In signal.h
-.Ft int
-.Fo sigtimedwait
-.Fa "const sigset_t *restrict set" "siginfo_t *restrict info"
-.Fa "const struct timespec *restrict timeout"
-.Fc
-.Ft int
-.Fn sigwaitinfo "const sigset_t * restrict set" "siginfo_t * restrict info"
-.Sh DESCRIPTION
-The
-.Fn sigtimedwait
-system call is equivalent to
-.Fn sigwaitinfo
-except that if none of the signals specified by
-.Fa set
-are pending,
-.Fn sigtimedwait
-waits for the time interval specified in the
-.Vt timespec
-structure referenced by
-.Fa timeout .
-If the
-.Vt timespec
-structure pointed to by
-.Fa timeout
-is zero-valued and if none of the signals specified by
-.Fa set
-are pending, then
-.Fn sigtimedwait
-returns immediately with an error.
-If
-.Fa timeout
-is the
-.Dv NULL
-pointer, the behavior is unspecified.
-.Dv CLOCK_MONOTONIC
-clock is used to measure the time interval specified by the
-.Fa timeout
-argument.
-.Pp
-The
-.Fn sigwaitinfo
-system call selects the pending signal from the set specified by
-.Fa set .
-Should any of multiple pending signals in the range
-.Dv SIGRTMIN
-to
-.Dv SIGRTMAX
-be selected, it shall be the lowest numbered one.
-The
-selection order between realtime and non-realtime signals, or
-between multiple pending non-realtime signals, is unspecified.
-If no signal in
-.Fa set
-is pending at the time of the call, the calling thread
-is suspended until one or more signals in
-.Fa set
-become pending or until it is interrupted by an unblocked, caught signal.
-.Pp
-The
-.Fn sigwaitinfo
-system call is equivalent to the
-.Fn sigwait
-system call if the
-.Fa info
-argument is
-.Dv NULL .
-If the
-.Fa info
-argument is
-.Pf non- Dv NULL ,
-the
-.Fn sigwaitinfo
-function is equivalent to
-.Fn sigwait ,
-except that the selected signal number shall be stored in the
-.Va si_signo
-member, and the cause of the signal shall be stored in the
-.Va si_code
-member.
-Besides this, the
-.Fn sigwaitinfo
-and
-.Fn sigtimedwait
-system calls may return
-.Er EINTR
-if interrupted by signal, which is not allowed for the
-.Fn sigwait
-function.
-.Pp
-If any value is queued to the selected signal, the first such queued
-value is dequeued and, if the info argument is
-.Pf non- Dv NULL ,
-the value is stored in the
-.Va si_value
-member of
-.Fa info .
-The system resource used to queue the signal
-is released and returned to the system for other use.
-If no value is queued,
-the content of the
-.Va si_value
-member is zero-valued.
-If no further signals are
-queued for the selected signal, the pending indication for that signal
-is reset.
-.Sh RETURN VALUES
-Upon successful completion (that is, one of the signals specified by
-.Fa set
-is pending or is generated)
-.Fn sigwaitinfo
-and
-.Fn sigtimedwait
-return the selected signal number.
-Otherwise, the functions return a value of \-1
-and set the global variable
-.Va errno
-to indicate the error.
-.Sh ERRORS
-The
-.Fn sigtimedwait
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EAGAIN
-No signal specified by set was generated within the specified timeout period.
-.El
-.Pp
-The
-.Fn sigtimedwait
-and
-.Fn sigwaitinfo
-system calls fail if:
-.Bl -tag -width Er
-.It Bq Er EINTR
-The wait was interrupted by an unblocked, caught signal.
-.El
-.Pp
-The
-.Fn sigtimedwait
-system call may also fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Fa timeout
-argument specified a
-.Va tv_nsec
-value less than zero or greater than or equal
-to 1000 million.
-Kernel only checks for this error if no signal is pending in set and it
-is necessary to wait.
-.El
-.Sh SEE ALSO
-.Xr sigaction 2 ,
-.Xr sigpending 2 ,
-.Xr sigqueue 2 ,
-.Xr sigsuspend 2 ,
-.Xr sigwait 2 ,
-.Xr pause 3 ,
-.Xr pthread_sigmask 3 ,
-.Xr siginfo 3
-.Sh STANDARDS
-The
-.Fn sigtimedwait
-and
-.Fn sigwaitinfo
-system calls conform to
-.St -p1003.1-96 .
diff --git a/lib/libc/sys/sigwaitinfo.c b/lib/libc/sys/sigwaitinfo.c
index b9cdc79bc224..611d09c3c221 100644
--- a/lib/libc/sys/sigwaitinfo.c
+++ b/lib/libc/sys/sigwaitinfo.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2014 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <signal.h>
#include "libc_private.h"
@@ -43,7 +39,5 @@ __weak_reference(__sys_sigwaitinfo, __sigwaitinfo);
int
sigwaitinfo(const sigset_t * __restrict set, siginfo_t * __restrict info)
{
-
- return (((int (*)(const sigset_t *, siginfo_t *))
- __libc_interposing[INTERPOS_sigwaitinfo])(set, info));
+ return (INTERPOS_SYS(sigwaitinfo, set, info));
}
diff --git a/lib/libc/sys/socket.2 b/lib/libc/sys/socket.2
deleted file mode 100644
index b23d207c9730..000000000000
--- a/lib/libc/sys/socket.2
+++ /dev/null
@@ -1,351 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" From: @(#)socket.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd August 19, 2018
-.Dt SOCKET 2
-.Os
-.Sh NAME
-.Nm socket
-.Nd create an endpoint for communication
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/socket.h
-.Ft int
-.Fn socket "int domain" "int type" "int protocol"
-.Sh DESCRIPTION
-The
-.Fn socket
-system call
-creates an endpoint for communication and returns a descriptor.
-.Pp
-The
-.Fa domain
-argument specifies a communications domain within which
-communication will take place; this selects the protocol family
-which should be used.
-These families are defined in the include file
-.In sys/socket.h .
-The currently understood formats are:
-.Pp
-.Bd -literal -offset indent -compact
-PF_LOCAL Host-internal protocols (alias for PF_UNIX),
-PF_UNIX Host-internal protocols,
-PF_INET Internet version 4 protocols,
-PF_INET6 Internet version 6 protocols,
-PF_ROUTE Internal routing protocol,
-PF_LINK Link layer interface,
-PF_KEY Internal key-management function,
-PF_NATM Asynchronous transfer mode protocols,
-PF_NETGRAPH Netgraph sockets,
-PF_IEEE80211 IEEE 802.11 wireless link-layer protocols (WiFi),
-PF_BLUETOOTH Bluetooth protocols,
-PF_INET_SDP OFED socket direct protocol (IPv4),
-PF_INET6_SDP OFED socket direct protocol (IPv6)
-.Ed
-.Pp
-Each protocol family is connected to an address family, which has the
-same name except that the prefix is
-.Dq Dv AF_
-in place of
-.Dq Dv PF_ .
-Other protocol families may be also defined, beginning with
-.Dq Dv PF_ ,
-with corresponding address families.
-.Pp
-The socket has the indicated
-.Fa type ,
-which specifies the semantics of communication.
-Currently
-defined types are:
-.Pp
-.Bd -literal -offset indent -compact
-SOCK_STREAM Stream socket,
-SOCK_DGRAM Datagram socket,
-SOCK_RAW Raw-protocol interface,
-SOCK_RDM Reliably-delivered packet,
-SOCK_SEQPACKET Sequenced packet stream
-.Ed
-.Pp
-A
-.Dv SOCK_STREAM
-type provides sequenced, reliable,
-two-way connection based byte streams.
-An out-of-band data transmission mechanism may be supported.
-A
-.Dv SOCK_DGRAM
-socket supports
-datagrams (connectionless, unreliable messages of
-a fixed (typically small) maximum length).
-A
-.Dv SOCK_SEQPACKET
-socket may provide a sequenced, reliable,
-two-way connection-based data transmission path for datagrams
-of fixed maximum length; a consumer may be required to read
-an entire packet with each read system call.
-This facility may have protocol-specific properties.
-.Dv SOCK_RAW
-sockets provide access to internal network protocols and interfaces.
-The types
-.Dv SOCK_RAW ,
-which is available only to the super-user, and
-.Dv SOCK_RDM ,
-which is planned,
-but not yet implemented, are not described here.
-.Pp
-Additionally, the following flags are allowed in the
-.Fa type
-argument:
-.Pp
-.Bd -literal -offset indent -compact
-SOCK_CLOEXEC Set close-on-exec on the new descriptor,
-SOCK_NONBLOCK Set non-blocking mode on the new socket
-.Ed
-.Pp
-The
-.Fa protocol
-argument
-specifies a particular protocol to be used with the socket.
-Normally only a single protocol exists to support a particular
-socket type within a given protocol family.
-However, it is possible
-that many protocols may exist, in which case a particular protocol
-must be specified in this manner.
-The protocol number to use is
-particular to the
-.Dq "communication domain"
-in which communication
-is to take place; see
-.Xr protocols 5 .
-.Pp
-The
-.Fa protocol
-argument may be set to zero (0) to request the default
-implementation of a socket type for the protocol, if any.
-.Pp
-Sockets of type
-.Dv SOCK_STREAM
-are full-duplex byte streams, similar
-to pipes.
-A stream socket must be in a
-.Em connected
-state before any data may be sent or received
-on it.
-A connection to another socket is created with a
-.Xr connect 2
-system call.
-Once connected, data may be transferred using
-.Xr read 2
-and
-.Xr write 2
-calls or some variant of the
-.Xr send 2
-and
-.Xr recv 2
-functions.
-(Some protocol families, such as the Internet family,
-support the notion of an
-.Dq implied connect ,
-which permits data to be sent piggybacked onto a connect operation by
-using the
-.Xr sendto 2
-system call.)
-When a session has been completed a
-.Xr close 2
-may be performed.
-Out-of-band data may also be transmitted as described in
-.Xr send 2
-and received as described in
-.Xr recv 2 .
-.Pp
-The communications protocols used to implement a
-.Dv SOCK_STREAM
-ensure that data
-is not lost or duplicated.
-If a piece of data for which the
-peer protocol has buffer space cannot be successfully transmitted
-within a reasonable length of time, then
-the connection is considered broken and calls
-will indicate an error with
--1 returns and with
-.Er ETIMEDOUT
-as the specific code
-in the global variable
-.Va errno .
-The protocols optionally keep sockets
-.Dq warm
-by forcing transmissions
-roughly every minute in the absence of other activity.
-An error is then indicated if no response can be
-elicited on an otherwise
-idle connection for an extended period (e.g.\& 5 minutes).
-By default, a
-.Dv SIGPIPE
-signal is raised if a process sends
-on a broken stream, but this behavior may be inhibited via
-.Xr setsockopt 2 .
-.Pp
-.Dv SOCK_SEQPACKET
-sockets employ the same system calls
-as
-.Dv SOCK_STREAM
-sockets.
-The only difference
-is that
-.Xr read 2
-calls will return only the amount of data requested,
-and any remaining in the arriving packet will be discarded.
-.Pp
-.Dv SOCK_DGRAM
-and
-.Dv SOCK_RAW
-sockets allow sending of datagrams to correspondents
-named in
-.Xr send 2
-calls.
-Datagrams are generally received with
-.Xr recvfrom 2 ,
-which returns the next datagram with its return address.
-.Pp
-An
-.Xr fcntl 2
-system call can be used to specify a process group to receive
-a
-.Dv SIGURG
-signal when the out-of-band data arrives.
-It may also enable non-blocking I/O
-and asynchronous notification of I/O events
-via
-.Dv SIGIO .
-.Pp
-The operation of sockets is controlled by socket level
-.Em options .
-These options are defined in the file
-.In sys/socket.h .
-The
-.Xr setsockopt 2
-and
-.Xr getsockopt 2
-system calls are used to set and get options, respectively.
-.Sh RETURN VALUES
-A -1 is returned if an error occurs, otherwise the return
-value is a descriptor referencing the socket.
-.Sh ERRORS
-The
-.Fn socket
-system call fails if:
-.Bl -tag -width Er
-.It Bq Er EACCES
-Permission to create a socket of the specified type and/or protocol
-is denied.
-.It Bq Er EAFNOSUPPORT
-The address family (domain) is not supported or the
-specified domain is not supported by this protocol family.
-.It Bq Er EMFILE
-The per-process descriptor table is full.
-.It Bq Er ENFILE
-The system file table is full.
-.It Bq Er ENOBUFS
-Insufficient buffer space is available.
-The socket cannot be created until sufficient resources are freed.
-.It Bq Er EPERM
-User has insufficient privileges to carry out the requested operation.
-.It Bq Er EPROTONOSUPPORT
-The protocol type or the specified protocol is not supported
-within this domain.
-.It Bq Er EPROTOTYPE
-The socket type is not supported by the protocol.
-.El
-.Sh SEE ALSO
-.Xr accept 2 ,
-.Xr bind 2 ,
-.Xr connect 2 ,
-.Xr getpeername 2 ,
-.Xr getsockname 2 ,
-.Xr getsockopt 2 ,
-.Xr ioctl 2 ,
-.Xr listen 2 ,
-.Xr read 2 ,
-.Xr recv 2 ,
-.Xr select 2 ,
-.Xr send 2 ,
-.Xr shutdown 2 ,
-.Xr socketpair 2 ,
-.Xr write 2 ,
-.Xr CMSG_DATA 3 ,
-.Xr getprotoent 3 ,
-.Xr netgraph 4 ,
-.Xr protocols 5
-.Rs
-.%T "An Introductory 4.3 BSD Interprocess Communication Tutorial"
-.%B PS1
-.%N 7
-.Re
-.Rs
-.%T "BSD Interprocess Communication Tutorial"
-.%B PS1
-.%N 8
-.Re
-.Sh STANDARDS
-The
-.Fn socket
-function conforms to
-.St -p1003.1-2008 .
-The
-.Tn POSIX
-standard specifies only the
-.Dv AF_INET ,
-.Dv AF_INET6 ,
-and
-.Dv AF_UNIX
-constants for address families, and requires the use of
-.Dv AF_*
-constants for the
-.Fa domain
-argument of
-.Fn socket .
-The
-.Dv SOCK_CLOEXEC
-flag is expected to conform to the next revision of the
-.Tn POSIX
-standard.
-The
-.Dv SOCK_RDM
-.Fa type ,
-the
-.Dv PF_*
-constants, and other address families are
-.Fx
-extensions.
-.Sh HISTORY
-The
-.Fn socket
-system call appeared in
-.Bx 4.2 .
diff --git a/lib/libc/sys/socketpair.2 b/lib/libc/sys/socketpair.2
deleted file mode 100644
index 80148c0dfbf6..000000000000
--- a/lib/libc/sys/socketpair.2
+++ /dev/null
@@ -1,107 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)socketpair.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd February 10, 2018
-.Dt SOCKETPAIR 2
-.Os
-.Sh NAME
-.Nm socketpair
-.Nd create a pair of connected sockets
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In sys/socket.h
-.Ft int
-.Fn socketpair "int domain" "int type" "int protocol" "int *sv"
-.Sh DESCRIPTION
-The
-.Fn socketpair
-system call creates an unnamed pair of connected sockets in
-the specified communications
-.Fa domain ,
-of the specified
-.Fa type ,
-and using the optionally specified
-.Fa protocol .
-The descriptors used in referencing the new sockets
-are returned in
-.Fa sv Ns [0]
-and
-.Fa sv Ns [1] .
-The two sockets are indistinguishable.
-.Pp
-The
-.Dv SOCK_CLOEXEC
-and
-.Dv SOCK_NONBLOCK
-flags in the
-.Fa type
-argument apply to both descriptors.
-.Sh RETURN VALUES
-.Rv -std socketpair
-.Sh ERRORS
-The call succeeds unless:
-.Bl -tag -width Er
-.It Bq Er EMFILE
-Too many descriptors are in use by this process.
-.It Bq Er EAFNOSUPPORT
-The specified address family is not supported on this machine.
-.It Bq Er EPROTONOSUPPORT
-The specified protocol is not supported on this machine.
-.It Bq Er EOPNOTSUPP
-The specified protocol does not support creation of socket pairs.
-.It Bq Er EFAULT
-The address
-.Fa sv
-does not specify a valid part of the
-process address space.
-.El
-.Sh SEE ALSO
-.Xr pipe 2 ,
-.Xr read 2 ,
-.Xr socket 2 ,
-.Xr write 2
-.Sh STANDARDS
-The
-.Fn socketpair
-system call conforms to
-.St -p1003.1-2001
-and
-.St -p1003.1-2008 .
-.Sh HISTORY
-The
-.Fn socketpair
-system call appeared in
-.Bx 4.2 .
-.Sh BUGS
-This call is currently implemented only for the
-.Ux
-domain.
diff --git a/lib/libc/sys/stat.2 b/lib/libc/sys/stat.2
deleted file mode 100644
index 55221d05a60e..000000000000
--- a/lib/libc/sys/stat.2
+++ /dev/null
@@ -1,492 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993, 1994
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)stat.2 8.4 (Berkeley) 5/1/95
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2021
-.Dt STAT 2
-.Os
-.Sh NAME
-.Nm stat ,
-.Nm lstat ,
-.Nm fstat ,
-.Nm fstatat
-.Nd get file status
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/stat.h
-.Ft int
-.Fn stat "const char * restrict path" "struct stat * restrict sb"
-.Ft int
-.Fn lstat "const char * restrict path" "struct stat * restrict sb"
-.Ft int
-.Fn fstat "int fd" "struct stat *sb"
-.Ft int
-.Fn fstatat "int fd" "const char *path" "struct stat *sb" "int flag"
-.Sh DESCRIPTION
-The
-.Fn stat
-system call obtains information about the file pointed to by
-.Fa path .
-Read, write or execute
-permission of the named file is not required, but all directories
-listed in the path name leading to the file must be searchable.
-.Pp
-The
-.Fn lstat
-system call is like
-.Fn stat
-except when the named file is a symbolic link,
-in which case
-.Fn lstat
-returns information about the link,
-while
-.Fn stat
-returns information about the file the link references.
-.Pp
-The
-.Fn fstat
-system call obtains the same information about an open file
-known by the file descriptor
-.Fa fd .
-.Pp
-The
-.Fn fstatat
-system call is equivalent to
-.Fn stat
-and
-.Fn lstat
-except when the
-.Fa path
-specifies a relative path.
-For
-.Fn fstatat
-and relative
-.Fa path ,
-the status is retrieved from a file relative to
-the directory associated with the file descriptor
-.Fa fd
-instead of the current working directory.
-.Pp
-The values for the
-.Fa flag
-are constructed by a bitwise-inclusive OR of flags from this list,
-defined in
-.In fcntl.h :
-.Bl -tag -width indent
-.It Dv AT_SYMLINK_NOFOLLOW
-If
-.Fa path
-names a symbolic link, the status of the symbolic link is returned.
-.It Dv AT_RESOLVE_BENEATH
-Only walk paths below the starting directory.
-See the description of the
-.Dv O_RESOLVE_BENEATH
-flag in the
-.Xr open 2
-manual page.
-.It Dv AT_EMPTY_PATH
-If the
-.Fa path
-argument is an empty string, operate on the file or directory
-referenced by the descriptor
-.Fa fd .
-If
-.Fa fd
-is equal to
-.Dv AT_FDCWD ,
-operate on the current working directory.
-.El
-.Pp
-If
-.Fn fstatat
-is passed the special value
-.Dv AT_FDCWD
-in the
-.Fa fd
-parameter, the current working directory is used and the behavior is
-identical to a call to
-.Fn stat
-or
-.Fn lstat
-respectively, depending on whether or not the
-.Dv AT_SYMLINK_NOFOLLOW
-bit is set in
-.Fa flag .
-.Pp
-When
-.Fn fstatat
-is called with an absolute
-.Fa path ,
-it ignores the
-.Fa fd
-argument.
-.Pp
-The
-.Fa sb
-argument is a pointer to a
-.Vt stat
-structure
-as defined by
-.In sys/stat.h
-and into which information is placed concerning the file.
-.Pp
-The fields of
-.Vt "struct stat"
-related to the file system are:
-.Bl -tag -width ".Va st_nlink"
-.It Va st_dev
-Numeric ID of the device containing the file.
-.It Va st_ino
-The file's inode number.
-.It Va st_nlink
-Number of hard links to the file.
-.It Va st_flags
-Flags enabled for the file.
-See
-.Xr chflags 2
-for the list of flags and their description.
-.El
-.Pp
-The
-.Va st_dev
-and
-.Va st_ino
-fields together identify the file uniquely within the system.
-.Pp
-The time-related fields of
-.Vt "struct stat"
-are:
-.Bl -tag -width ".Va st_birthtim"
-.It Va st_atim
-Time when file data was last accessed.
-Changed implicitly by syscalls such as
-.Xr read 2
-and
-.Xr readv 2 ,
-and explicitly by
-.Xr utimes 2 .
-.It Va st_mtim
-Time when file data was last modified.
-Changed implicitly by syscalls such as
-.Xr truncate 2 ,
-.Xr write 2 ,
-and
-.Xr writev 2 ,
-and explicitly by
-.Xr utimes 2 .
-Also, any syscall which modifies directory content changes the
-.Va st_mtim
-for the affected directory.
-For instance,
-.Xr creat 2 ,
-.Xr mkdir 2 ,
-.Xr rename 2 ,
-.Xr link 2 ,
-and
-.Xr unlink 2 .
-.It Va st_ctim
-Time when file status was last changed (inode data modification).
-Changed implicitly by any syscall that affects file metadata, including
-.Va st_mtim ,
-such as
-.Xr chflags 2 ,
-.Xr chmod 2 ,
-.Xr chown 2 ,
-.Xr truncate 2 ,
-.Xr utimes 2 ,
-and
-.Xr write 2 .
-Also, any syscall which modifies directory content changes the
-.Va st_ctim
-for the affected directory.
-For instance,
-.Xr creat 2 ,
-.Xr mkdir 2 ,
-.Xr rename 2 ,
-.Xr link 2 ,
-and
-.Xr unlink 2 .
-.It Va st_birthtim
-Time when the inode was created.
-.El
-.Pp
-These time-related macros are defined for compatibility:
-.Bd -literal
-#define st_atime st_atim.tv_sec
-#define st_mtime st_mtim.tv_sec
-#define st_ctime st_ctim.tv_sec
-#ifndef _POSIX_SOURCE
-#define st_birthtime st_birthtim.tv_sec
-#endif
-
-#ifndef _POSIX_SOURCE
-#define st_atimespec st_atim
-#define st_mtimespec st_mtim
-#define st_ctimespec st_ctim
-#define st_birthtimespec st_birthtim
-#endif
-.Ed
-.Pp
-Size-related fields of the
-.Vt "struct stat"
-are:
-.Bl -tag -width ".Va st_blksize"
-.It Va st_size
-File size in bytes.
-.It Va st_blksize
-Optimal I/O block size for the file.
-.It Va st_blocks
-Actual number of blocks allocated for the file in 512-byte units.
-As short symbolic links are stored in the inode, this number may
-be zero.
-.El
-.Pp
-The access-related fields of
-.Vt "struct stat"
-are:
-.Bl -tag -width ".Va st_mode"
-.It Va st_uid
-User ID of the file's owner.
-.It Va st_gid
-Group ID of the file.
-.It Va st_mode
-Status of the file (see below).
-.El
-.Pp
-The status information word
-.Fa st_mode
-has these bits:
-.Bd -literal
-#define S_IFMT 0170000 /* type of file mask */
-#define S_IFIFO 0010000 /* named pipe (fifo) */
-#define S_IFCHR 0020000 /* character special */
-#define S_IFDIR 0040000 /* directory */
-#define S_IFBLK 0060000 /* block special */
-#define S_IFREG 0100000 /* regular */
-#define S_IFLNK 0120000 /* symbolic link */
-#define S_IFSOCK 0140000 /* socket */
-#define S_IFWHT 0160000 /* whiteout */
-#define S_ISUID 0004000 /* set user id on execution */
-#define S_ISGID 0002000 /* set group id on execution */
-#define S_ISVTX 0001000 /* save swapped text even after use */
-#define S_IRWXU 0000700 /* RWX mask for owner */
-#define S_IRUSR 0000400 /* read permission, owner */
-#define S_IWUSR 0000200 /* write permission, owner */
-#define S_IXUSR 0000100 /* execute/search permission, owner */
-#define S_IRWXG 0000070 /* RWX mask for group */
-#define S_IRGRP 0000040 /* read permission, group */
-#define S_IWGRP 0000020 /* write permission, group */
-#define S_IXGRP 0000010 /* execute/search permission, group */
-#define S_IRWXO 0000007 /* RWX mask for other */
-#define S_IROTH 0000004 /* read permission, other */
-#define S_IWOTH 0000002 /* write permission, other */
-#define S_IXOTH 0000001 /* execute/search permission, other */
-.Ed
-.Pp
-For a list of access modes, see
-.In sys/stat.h ,
-.Xr access 2
-and
-.Xr chmod 2 .
-These macros are available to test whether a
-.Va st_mode
-value passed in the
-.Fa m
-argument corresponds to a file of the specified type:
-.Bl -tag -width ".Fn S_ISFIFO m"
-.It Fn S_ISBLK m
-Test for a block special file.
-.It Fn S_ISCHR m
-Test for a character special file.
-.It Fn S_ISDIR m
-Test for a directory.
-.It Fn S_ISFIFO m
-Test for a pipe or FIFO special file.
-.It Fn S_ISLNK m
-Test for a symbolic link.
-.It Fn S_ISREG m
-Test for a regular file.
-.It Fn S_ISSOCK m
-Test for a socket.
-.It Fn S_ISWHT m
-Test for a whiteout.
-.El
-.Pp
-The macros evaluate to a non-zero value if the test is true
-or to the value 0 if the test is false.
-.Sh RETURN VALUES
-.Rv -std
-.Sh COMPATIBILITY
-Previous versions of the system used different types for the
-.Va st_dev ,
-.Va st_uid ,
-.Va st_gid ,
-.Va st_rdev ,
-.Va st_size ,
-.Va st_blksize
-and
-.Va st_blocks
-fields.
-.Sh ERRORS
-The
-.Fn stat
-and
-.Fn lstat
-system calls will fail if:
-.Bl -tag -width Er
-.It Bq Er EACCES
-Search permission is denied for a component of the path prefix.
-.It Bq Er EFAULT
-The
-.Fa sb
-or
-.Fa path
-argument
-points to an invalid address.
-.It Bq Er EIO
-An I/O error occurred while reading from or writing to the file system.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating the pathname.
-.It Bq Er ENAMETOOLONG
-A component of a pathname exceeded 255 characters,
-or an entire path name exceeded 1023 characters.
-.It Bq Er ENOENT
-The named file does not exist.
-.It Bq Er ENOTDIR
-A component of the path prefix is not a directory.
-.It Bq Er EOVERFLOW
-The file size in bytes cannot be
-represented correctly in the structure pointed to by
-.Fa sb .
-.El
-.Pp
-The
-.Fn fstat
-system call will fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa fd
-argument
-is not a valid open file descriptor.
-.It Bq Er EFAULT
-The
-.Fa sb
-argument
-points to an invalid address.
-.It Bq Er EIO
-An I/O error occurred while reading from or writing to the file system.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.It Bq Er EOVERFLOW
-The file size in bytes cannot be
-represented correctly in the structure pointed to by
-.Fa sb .
-.El
-.Pp
-In addition to the errors returned by the
-.Fn lstat ,
-the
-.Fn fstatat
-may fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa path
-argument does not specify an absolute path and the
-.Fa fd
-argument is neither
-.Dv AT_FDCWD
-nor a valid file descriptor open for searching.
-.It Bq Er EINVAL
-The value of the
-.Fa flag
-argument is not valid.
-.It Bq Er ENOTDIR
-The
-.Fa path
-argument is not an absolute path and
-.Fa fd
-is neither
-.Dv AT_FDCWD
-nor a file descriptor associated with a directory.
-.It Bq Er ENOTCAPABLE
-.Fa path
-is an absolute path,
-or contained a ".." component leading to a
-directory outside of the directory hierarchy specified by
-.Fa fd ,
-and the process is in capability mode or the
-.Dv AT_RESOLVE_BENEATH
-flag was specified.
-.El
-.Sh SEE ALSO
-.Xr access 2 ,
-.Xr chmod 2 ,
-.Xr chown 2 ,
-.Xr fhstat 2 ,
-.Xr statfs 2 ,
-.Xr utimes 2 ,
-.Xr sticky 7 ,
-.Xr symlink 7
-.Sh STANDARDS
-The
-.Fn stat
-and
-.Fn fstat
-system calls are expected to conform to
-.St -p1003.1-90 .
-The
-.Fn fstatat
-system call follows The Open Group Extended API Set 2 specification.
-.Sh HISTORY
-The
-.Fn stat
-and
-.Fn fstat
-system calls appeared in
-.At v1 .
-The
-.Fn lstat
-system call appeared in
-.Bx 4.2 .
-The
-.Fn fstatat
-system call appeared in
-.Fx 8.0 .
-.Sh BUGS
-Applying
-.Fn fstat
-to a socket
-returns a zeroed buffer,
-except for the blocksize field,
-and a unique device and inode number.
diff --git a/lib/libc/sys/stat.c b/lib/libc/sys/stat.c
index f4f0289b2bd6..262c265d09c9 100644
--- a/lib/libc/sys/stat.c
+++ b/lib/libc/sys/stat.c
@@ -24,27 +24,17 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/param.h>
+#include <sys/fcntl.h>
#include <sys/syscall.h>
-#include "compat-ino64.h"
+#include <sys/stat.h>
#include <unistd.h>
-
#include "libc_private.h"
int
stat(const char *path, struct stat *sb)
{
- struct freebsd11_stat stat11;
- int rv;
- if (__getosreldate() >= INO64_FIRST)
- return (__sys_fstatat(AT_FDCWD, path, sb, 0));
- rv = syscall(SYS_freebsd11_stat, path, &stat11);
- if (rv == 0)
- __stat11_to_stat(&stat11, sb);
- return (rv);
+ return (__sys_fstatat(AT_FDCWD, path, sb, 0));
}
diff --git a/lib/libc/sys/statfs.2 b/lib/libc/sys/statfs.2
deleted file mode 100644
index a865652022bd..000000000000
--- a/lib/libc/sys/statfs.2
+++ /dev/null
@@ -1,240 +0,0 @@
-.\" Copyright (c) 1989, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)statfs.2 8.5 (Berkeley) 5/24/95
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2020
-.Dt STATFS 2
-.Os
-.Sh NAME
-.Nm statfs
-.Nd get file system statistics
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/param.h
-.In sys/mount.h
-.Ft int
-.Fn statfs "const char *path" "struct statfs *buf"
-.Ft int
-.Fn fstatfs "int fd" "struct statfs *buf"
-.Sh DESCRIPTION
-The
-.Fn statfs
-system call
-returns information about a mounted file system.
-The
-.Fa path
-argument
-is the path name of any file within the mounted file system.
-The
-.Fa buf
-argument
-is a pointer to a
-.Vt statfs
-structure defined as follows:
-.Bd -literal
-typedef struct fsid { int32_t val[2]; } fsid_t; /* file system id type */
-
-/*
- * filesystem statistics
- */
-
-#define MFSNAMELEN 16 /* length of type name including null */
-#define MNAMELEN 1024 /* size of on/from name bufs */
-#define STATFS_VERSION 0x20140518 /* current version number */
-
-struct statfs {
-uint32_t f_version; /* structure version number */
-uint32_t f_type; /* type of filesystem */
-uint64_t f_flags; /* copy of mount exported flags */
-uint64_t f_bsize; /* filesystem fragment size */
-uint64_t f_iosize; /* optimal transfer block size */
-uint64_t f_blocks; /* total data blocks in filesystem */
-uint64_t f_bfree; /* free blocks in filesystem */
-int64_t f_bavail; /* free blocks avail to non-superuser */
-uint64_t f_files; /* total file nodes in filesystem */
-int64_t f_ffree; /* free nodes avail to non-superuser */
-uint64_t f_syncwrites; /* count of sync writes since mount */
-uint64_t f_asyncwrites; /* count of async writes since mount */
-uint64_t f_syncreads; /* count of sync reads since mount */
-uint64_t f_asyncreads; /* count of async reads since mount */
-uint64_t f_spare[10]; /* unused spare */
-uint32_t f_namemax; /* maximum filename length */
-uid_t f_owner; /* user that mounted the filesystem */
-fsid_t f_fsid; /* filesystem id */
-char f_charspare[80]; /* spare string space */
-char f_fstypename[MFSNAMELEN]; /* filesystem type name */
-char f_mntfromname[MNAMELEN]; /* mounted filesystem */
-char f_mntonname[MNAMELEN]; /* directory on which mounted */
-};
-.Ed
-.Pp
-The flags that may be returned include:
-.Bl -tag -width MNT_SYNCHRONOUS
-.It Dv MNT_RDONLY
-The file system is mounted read-only;
-Even the super-user may not write on it.
-.It Dv MNT_NOEXEC
-Files may not be executed from the file system.
-.It Dv MNT_NOSUID
-Setuid and setgid bits on files are not honored when they are executed.
-.It Dv MNT_SYNCHRONOUS
-All I/O to the file system is done synchronously.
-.It Dv MNT_ASYNC
-No file system I/O is done synchronously.
-.It Dv MNT_SOFTDEP
-Soft updates being done (see
-.Xr ffs 7 ) .
-.It Dv MNT_GJOURNAL
-Journaling with gjournal is enabled (see
-.Xr gjournal 8 ) .
-.It Dv MNT_SUIDDIR
-Special handling of SUID bit on directories.
-.It Dv MNT_UNION
-Union with underlying file system.
-.It Dv MNT_NOSYMFOLLOW
-Symbolic links are not followed.
-.It Dv MNT_NOCLUSTERR
-Read clustering is disabled.
-.It Dv MNT_NOCLUSTERW
-Write clustering is disabled.
-.\".It Dv MNT_JAILDEVFS
-.\"XXX
-.It Dv MNT_MULTILABEL
-Mandatory Access Control (MAC) support for individual objects
-(see
-.Xr mac 4 ) .
-.It Dv MNT_ACLS
-Access Control List (ACL) support enabled.
-.It Dv MNT_LOCAL
-The file system resides locally.
-.It Dv MNT_QUOTA
-The file system has quotas enabled on it.
-.It Dv MNT_ROOTFS
-Identifies the root file system.
-.It Dv MNT_EXRDONLY
-The file system is exported read-only.
-.It Dv MNT_NOATIME
-Updating of file access times is disabled.
-.It Dv MNT_USER
-The file system has been mounted by a user.
-.\".It Dv MNT_IGNORE
-.\"XXX
-.It Dv MNT_EXPORTED
-The file system is exported for both reading and writing.
-.It Dv MNT_DEFEXPORTED
-The file system is exported for both reading and writing to any Internet host.
-.It Dv MNT_EXPORTANON
-The file system maps all remote accesses to the anonymous user.
-.It Dv MNT_EXKERB
-The file system is exported with Kerberos uid mapping.
-.It Dv MNT_EXPUBLIC
-The file system is exported publicly (WebNFS).
-.El
-.Pp
-Fields that are undefined for a particular file system are set to -1.
-The
-.Fn fstatfs
-system call
-returns the same information about an open file referenced by descriptor
-.Fa fd .
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-The
-.Fn statfs
-system call
-fails if one or more of the following are true:
-.Bl -tag -width Er
-.It Bq Er ENOTDIR
-A component of the path prefix of
-.Fa path
-is not a directory.
-.It Bq Er ENAMETOOLONG
-The length of a component of
-.Fa path
-exceeds 255 characters,
-or the length of
-.Fa path
-exceeds 1023 characters.
-.It Bq Er ENOENT
-The file referred to by
-.Fa path
-does not exist.
-.It Bq Er EACCES
-Search permission is denied for a component of the path prefix of
-.Fa path .
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating
-.Fa path .
-.It Bq Er EFAULT
-The
-.Fa buf
-or
-.Fa path
-argument
-points to an invalid address.
-.It Bq Er EIO
-An
-.Tn I/O
-error occurred while reading from or writing to the file system.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.El
-.Pp
-The
-.Fn fstatfs
-system call
-fails if one or more of the following are true:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa fd
-argument
-is not a valid open file descriptor.
-.It Bq Er EFAULT
-The
-.Fa buf
-argument
-points to an invalid address.
-.It Bq Er EIO
-An
-.Tn I/O
-error occurred while reading from or writing to the file system.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.El
-.Sh SEE ALSO
-.Xr fhstatfs 2 ,
-.Xr getfsstat 2
-.Sh HISTORY
-The
-.Fn statfs
-system call first appeared in
-.Bx 4.4 .
diff --git a/lib/libc/sys/statfs.c b/lib/libc/sys/statfs.c
deleted file mode 100644
index f7d4d7752c4a..000000000000
--- a/lib/libc/sys/statfs.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/*-
- * Copyright (c) 2017 M. Warner Losh <imp@FreeBSD.org>
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include "namespace.h"
-#include <sys/param.h>
-#include <sys/syscall.h>
-#include "compat-ino64.h"
-#include <unistd.h>
-
-#include "libc_private.h"
-
-int
-statfs(const char *path, struct statfs *buf)
-{
- struct freebsd11_statfs statfs11;
- int rv;
-
- if (__getosreldate() >= INO64_FIRST)
- return (__sys_statfs(path, buf));
- rv = syscall(SYS_freebsd11_statfs, path, &statfs11);
- if (rv == 0)
- __statfs11_to_statfs(&statfs11, buf);
- return (rv);
-}
diff --git a/lib/libc/sys/swapcontext.c b/lib/libc/sys/swapcontext.c
index 0a8125eeabb5..b69a5b19e698 100644
--- a/lib/libc/sys/swapcontext.c
+++ b/lib/libc/sys/swapcontext.c
@@ -28,9 +28,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/signal.h>
#include <sys/ucontext.h>
@@ -47,7 +44,5 @@ __sym_default(swapcontext, swapcontext, FBSD_1.2);
int
swapcontext(ucontext_t *oucp, const ucontext_t *ucp)
{
-
- return (((int (*)(ucontext_t *, const ucontext_t *))
- __libc_interposing[INTERPOS_swapcontext])(oucp, ucp));
+ return (INTERPOS_SYS(swapcontext, oucp, ucp));
}
diff --git a/lib/libc/sys/swapon.2 b/lib/libc/sys/swapon.2
deleted file mode 100644
index 47acbc2dc178..000000000000
--- a/lib/libc/sys/swapon.2
+++ /dev/null
@@ -1,146 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)swapon.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2020
-.Dt SWAPON 2
-.Os
-.Sh NAME
-.Nm swapon , swapoff
-.Nd control devices for interleaved paging/swapping
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn swapon "const char *special"
-.Ft int
-.Fn swapoff "const char *special"
-.Sh DESCRIPTION
-The
-.Fn swapon
-system call
-makes the block device
-.Fa special
-available to the system for
-allocation for paging and swapping.
-The names of potentially
-available devices are known to the system and defined at system
-configuration time.
-The size of the swap area on
-.Fa special
-is calculated at the time the device is first made available
-for swapping.
-.Pp
-The
-.Fn swapoff
-system call disables paging and swapping on the given device.
-All associated swap metadata are deallocated, and the device
-is made available for other purposes.
-.Sh RETURN VALUES
-If an error has occurred, a value of -1 is returned and
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-Both
-.Fn swapon
-and
-.Fn swapoff
-can fail if:
-.Bl -tag -width Er
-.It Bq Er ENOTDIR
-A component of the path prefix is not a directory.
-.It Bq Er ENAMETOOLONG
-A component of a pathname exceeded 255 characters,
-or an entire path name exceeded 1023 characters.
-.It Bq Er ENOENT
-The named device does not exist.
-.It Bq Er EACCES
-Search permission is denied for a component of the path prefix.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating the pathname.
-.It Bq Er EPERM
-The caller is not the super-user.
-.It Bq Er EFAULT
-The
-.Fa special
-argument
-points outside the process's allocated address space.
-.El
-.Pp
-Additionally,
-.Fn swapon
-can fail for the following reasons:
-.Bl -tag -width Er
-.It Bq Er ENOTBLK
-The
-.Fa special
-argument
-is not a block device.
-.It Bq Er EBUSY
-The device specified by
-.Fa special
-has already
-been made available for swapping
-.It Bq Er ENXIO
-The major device number of
-.Fa special
-is out of range (this indicates no device driver exists
-for the associated hardware).
-.It Bq Er EIO
-An I/O error occurred while opening the swap device.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system to open the
-swap device.
-.El
-.Pp
-Lastly,
-.Fn swapoff
-can fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The system is not currently swapping to
-.Fa special .
-.It Bq Er ENOMEM
-Not enough virtual memory is available to safely disable
-paging and swapping to the given device.
-.El
-.Sh SEE ALSO
-.Xr config 8 ,
-.Xr swapon 8 ,
-.Xr sysctl 8
-.Sh HISTORY
-The
-.Fn swapon
-system call appeared in
-.Bx 4.0 .
-The
-.Fn swapoff
-system call appeared in
-.Fx 5.0 .
diff --git a/lib/libc/sys/symlink.2 b/lib/libc/sys/symlink.2
deleted file mode 100644
index 3fd0a4653ad6..000000000000
--- a/lib/libc/sys/symlink.2
+++ /dev/null
@@ -1,206 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)symlink.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2020
-.Dt SYMLINK 2
-.Os
-.Sh NAME
-.Nm symlink ,
-.Nm symlinkat
-.Nd make symbolic link to a file
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn symlink "const char *name1" "const char *name2"
-.Ft int
-.Fn symlinkat "const char *name1" "int fd" "const char *name2"
-.Sh DESCRIPTION
-A symbolic link
-.Fa name2
-is created to
-.Fa name1
-.Fa ( name2
-is the name of the
-file created,
-.Fa name1
-is the string
-used in creating the symbolic link).
-Either name may be an arbitrary path name; the files need not
-be on the same file system.
-.Pp
-The
-.Fn symlinkat
-system call is equivalent to
-.Fn symlink
-except in the case where
-.Fa name2
-specifies a relative path.
-In this case the symbolic link is created relative to the directory
-associated with the file descriptor
-.Fa fd
-instead of the current working directory.
-If
-.Fn symlinkat
-is passed the special value
-.Dv AT_FDCWD
-in the
-.Fa fd
-parameter, the current working directory is used and the behavior is
-identical to a call to
-.Fn symlink .
-.Sh RETURN VALUES
-.Rv -std symlink
-.Sh ERRORS
-The symbolic link succeeds unless:
-.Bl -tag -width Er
-.It Bq Er ENOTDIR
-A component of the
-.Fa name2
-path prefix is not a directory.
-.It Bq Er ENAMETOOLONG
-A component of the
-.Fa name2
-pathname exceeded 255 characters,
-or the entire length of either path name exceeded 1023 characters.
-.It Bq Er ENOENT
-A component of the
-.Fa name2
-path prefix does not exist.
-.It Bq Er EACCES
-A component of the
-.Fa name2
-path prefix denies search permission, or write permission is denied on the
-parent directory of the file to be created.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating the
-.Fa name2
-path name.
-.It Bq Er EEXIST
-The path name pointed at by the
-.Fa name2
-argument
-already exists.
-.It Bq Er EPERM
-The parent directory of the file named by
-.Fa name2
-has its immutable flag set, see the
-.Xr chflags 2
-manual page for more information.
-.It Bq Er EIO
-An I/O error occurred while making the directory entry for
-.Fa name2 ,
-allocating the inode for
-.Fa name2 ,
-or writing out the link contents of
-.Fa name2 .
-.It Bq Er EROFS
-The file
-.Fa name2
-would reside on a read-only file system.
-.It Bq Er ENOSPC
-The directory in which the entry for the new symbolic link is being placed
-cannot be extended because there is no space left on the file
-system containing the directory.
-.It Bq Er ENOSPC
-The new symbolic link cannot be created because
-there is no space left on the file
-system that will contain the symbolic link.
-.It Bq Er ENOSPC
-There are no free inodes on the file system on which the
-symbolic link is being created.
-.It Bq Er EDQUOT
-The directory in which the entry for the new symbolic link
-is being placed cannot be extended because the
-user's quota of disk blocks on the file system
-containing the directory has been exhausted.
-.It Bq Er EDQUOT
-The new symbolic link cannot be created because the user's
-quota of disk blocks on the file system that will
-contain the symbolic link has been exhausted.
-.It Bq Er EDQUOT
-The user's quota of inodes on the file system on
-which the symbolic link is being created has been exhausted.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.It Bq Er EFAULT
-The
-.Fa name1
-or
-.Fa name2
-argument
-points outside the process's allocated address space.
-.El
-.Pp
-In addition to the errors returned by the
-.Fn symlink ,
-the
-.Fn symlinkat
-may fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa name2
-argument does not specify an absolute path and the
-.Fa fd
-argument is neither
-.Dv AT_FDCWD
-nor a valid file descriptor open for searching.
-.It Bq Er ENOTDIR
-The
-.Fa name2
-argument is not an absolute path and
-.Fa fd
-is neither
-.Dv AT_FDCWD
-nor a file descriptor associated with a directory.
-.El
-.Sh SEE ALSO
-.Xr ln 1 ,
-.Xr chflags 2 ,
-.Xr link 2 ,
-.Xr lstat 2 ,
-.Xr readlink 2 ,
-.Xr unlink 2 ,
-.Xr symlink 7
-.Sh STANDARDS
-The
-.Fn symlinkat
-system call follows The Open Group Extended API Set 2 specification.
-.Sh HISTORY
-The
-.Fn symlink
-system call appeared in
-.Bx 4.2 .
-The
-.Fn symlinkat
-system call appeared in
-.Fx 8.0 .
diff --git a/lib/libc/sys/sync.2 b/lib/libc/sys/sync.2
deleted file mode 100644
index 9e806c3ef9e9..000000000000
--- a/lib/libc/sys/sync.2
+++ /dev/null
@@ -1,77 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)sync.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd December 1, 2017
-.Dt SYNC 2
-.Os
-.Sh NAME
-.Nm sync
-.Nd "schedule file system updates"
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft void
-.Fn sync void
-.Sh DESCRIPTION
-The
-.Fn sync
-system call forces a write of dirty (modified) buffers
-in the block buffer cache out
-to disk.
-The kernel keeps this information in core to reduce
-the number of disk I/O transfers required by the system.
-As information in the cache is lost after a system crash, a
-.Fn sync
-system call is issued
-frequently
-by the kernel process
-.Xr syncer 4
-(about every 30 seconds).
-.Pp
-The
-.Xr fsync 2
-system call
-may be used to synchronize individual file descriptor
-attributes.
-.Sh SEE ALSO
-.Xr fsync 2 ,
-.Xr syncer 4 ,
-.Xr sync 8
-.Sh HISTORY
-The
-.Fn sync
-function appeared in
-.At v3 .
-.Sh BUGS
-The
-.Fn sync
-system call
-may return before the buffers are completely flushed.
diff --git a/lib/libc/sys/sysarch.2 b/lib/libc/sys/sysarch.2
deleted file mode 100644
index 73d2e468267a..000000000000
--- a/lib/libc/sys/sysarch.2
+++ /dev/null
@@ -1,81 +0,0 @@
-.\" $NetBSD: sysarch.2,v 1.6 1998/02/25 21:24:57 perry Exp $
-.\" $FreeBSD$
-.\"
-.\" Copyright (c) 1980, 1991 Regents of the University of California.
-.\" All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" from: @(#)syscall.2 6.3 (Berkeley) 3/10/91
-.\"
-.Dd October 11, 1993
-.Dt SYSARCH 2
-.Os
-.Sh NAME
-.Nm sysarch
-.Nd architecture-dependent system call
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In machine/sysarch.h
-.Ft int
-.Fn sysarch "int number" "void *args"
-.Sh DESCRIPTION
-The
-.Fn sysarch
-system call
-performs the architecture-dependent function
-specified by
-.Fa number
-with the arguments specified by the
-.Fa args
-pointer.
-The
-.Fa args
-argument
-is a pointer to a structure defining the actual
-arguments of the function.
-Symbolic constants and argument structures
-for the architecture-dependent
-functions can be found in the header file
-.In machine/sysarch.h .
-.Pp
-The
-.Fn sysarch
-system call should never be called directly by
-user programs.
-Instead, they should access
-its functions using the architecture-dependent
-library.
-.Sh RETURN VALUES
-See the manual pages for specific architecture-dependent system calls
-for information about their return values.
-.Sh SEE ALSO
-.Xr i386_get_ioperm 2 ,
-.Xr i386_get_ldt 2 ,
-.Xr i386_vm86 2
-.Sh HISTORY
-This manual page was taken from
-.Nx .
diff --git a/lib/libc/sys/syscall.2 b/lib/libc/sys/syscall.2
deleted file mode 100644
index fed410db55ce..000000000000
--- a/lib/libc/sys/syscall.2
+++ /dev/null
@@ -1,77 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)syscall.2 8.1 (Berkeley) 6/16/93
-.\" $FreeBSD$
-.\"
-.Dd June 16, 1993
-.Dt SYSCALL 2
-.Os
-.Sh NAME
-.Nm syscall ,
-.Nm __syscall
-.Nd indirect system call
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/syscall.h
-.In unistd.h
-.Ft int
-.Fn syscall "int number" ...
-.Ft off_t
-.Fn __syscall "quad_t number" ...
-.Sh DESCRIPTION
-The
-.Fn syscall
-function
-performs the system call whose assembly language
-interface has the specified
-.Fa number
-with the specified arguments.
-Symbolic constants for system calls can be found in the header file
-.In sys/syscall.h .
-The
-.Fn __syscall
-form should be used when one or more of the arguments is a
-64-bit argument to ensure that argument alignment is correct.
-This system call is useful for testing new system calls that
-do not have entries in the C library.
-.Sh RETURN VALUES
-The return values are defined by the system call being invoked.
-In general, a 0 return value indicates success.
-A -1 return value indicates an error,
-and an error code is stored in
-.Va errno .
-.Sh HISTORY
-The
-.Fn syscall
-function appeared in
-.Bx 4.0 .
-.Sh BUGS
-There is no way to simulate system calls that have multiple return values
-such as
-.Xr pipe 2 .
diff --git a/lib/libc/sys/thr_exit.2 b/lib/libc/sys/thr_exit.2
deleted file mode 100644
index 8040e0ccbf63..000000000000
--- a/lib/libc/sys/thr_exit.2
+++ /dev/null
@@ -1,95 +0,0 @@
-.\" Copyright (c) 2016 The FreeBSD Foundation, Inc.
-.\" All rights reserved.
-.\"
-.\" This documentation was written by
-.\" Konstantin Belousov <kib@FreeBSD.org> under sponsorship
-.\" from the FreeBSD Foundation.
-.\"
-.\" 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 AUTHORS 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 AUTHORS 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd May 5, 2020
-.Dt THR_EXIT 2
-.Os
-.Sh NAME
-.Nm thr_exit
-.Nd terminate current thread
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/thr.h
-.Ft void
-.Fn thr_exit "long *state"
-.Sh DESCRIPTION
-.Bf -symbolic
-This function is intended for implementing threading.
-Normal applications should call
-.Xr pthread_exit 3
-instead.
-.Ef
-.Pp
-The
-.Fn thr_exit
-system call terminates the current kernel-scheduled thread.
-.Pp
-If the
-.Fa state
-argument is not
-.Dv NULL ,
-the location pointed to by the argument is
-updated with an arbitrary non-zero value, and an
-.Xr _umtx_op 2
-.Dv UMTX_OP_WAKE
-operation is consequently performed on the location.
-.Pp
-Attempts to terminate the last thread in the process are silently ignored.
-Use
-.Xr _exit 2
-syscall to terminate the process.
-.Sh RETURN VALUES
-The function does not return a value.
-A return from the function indicates that the calling thread was the
-last one in the process.
-.Sh SEE ALSO
-.Xr _exit 2 ,
-.Xr _umtx_op 2 ,
-.Xr thr_kill 2 ,
-.Xr thr_kill2 2 ,
-.Xr thr_new 2 ,
-.Xr thr_self 2 ,
-.Xr thr_set_name 2 ,
-.Xr pthread_exit 3
-.Sh STANDARDS
-The
-.Fn thr_exit
-system call is non-standard and is used by
-.Lb libthr
-to implement
-.St -p1003.1-2001
-.Xr pthread 3
-functionality.
-.Sh HISTORY
-The
-.Fn thr_exit
-system call first appeared in
-.Fx 5.2 .
diff --git a/lib/libc/sys/thr_kill.2 b/lib/libc/sys/thr_kill.2
deleted file mode 100644
index 2378cb60fc88..000000000000
--- a/lib/libc/sys/thr_kill.2
+++ /dev/null
@@ -1,140 +0,0 @@
-.\" Copyright (c) 2016 The FreeBSD Foundation, Inc.
-.\" All rights reserved.
-.\"
-.\" This documentation was written by
-.\" Konstantin Belousov <kib@FreeBSD.org> under sponsorship
-.\" from the FreeBSD Foundation.
-.\"
-.\" 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 AUTHORS 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 AUTHORS 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd May 5, 2020
-.Dt THR_kill 2
-.Os
-.Sh NAME
-.Nm thr_kill
-.Nd send signal to thread
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/thr.h
-.Ft int
-.Fn thr_kill "long id" "int sig"
-.Ft int
-.Fn thr_kill2 "pid_t pid" "long id" "int sig"
-.Sh DESCRIPTION
-The
-.Fn thr_kill
-and
-.Fn thr_kill2
-system calls allow sending a signal, specified by the
-.Fa sig
-argument, to some threads in a process.
-For the
-.Fn thr_kill
-function, signalled threads are always limited to the current process.
-For the
-.Fn thr_kill2
-function, the
-.Fa pid
-argument specifies the process with threads to be signalled.
-.Pp
-The
-.Fa id
-argument specifies which threads get the signal.
-If
-.Fa id
-is equal to \-1, all threads in the specified process are signalled.
-Otherwise, only the thread with the thread identifier equal to the
-argument is signalled.
-.Pp
-The
-.Fa sig
-argument defines the delivered signal.
-It must be a valid signal number or zero.
-In the latter case no signal is actually sent, and the call is used to
-verify the liveness of the thread.
-.Pp
-The signal is delivered with
-.Dv siginfo
-.Dv si_code
-set to
-.Dv SI_LWP .
-.Sh RETURN VALUES
-If successful,
-.Fn thr_kill
-and
-.Fn thr_kill2
-will return zero, otherwise \-1 is returned, and
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-The
-.Fn thr_kill
-and
-.Fn thr_kill2
-operations return the following errors:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Fa sig
-argument is not zero and does not specify valid signal.
-.It Bq Er ESRCH
-The specified process or thread was not found.
-.El
-.Pp
-Additionally, the
-.Fn thr_kill2
-may return the following errors:
-.Bl -tag -width Er
-.It Bq Er EPERM
-The current process does not have sufficient privilege to check existence or
-send a signal to the specified process.
-.El
-.Sh SEE ALSO
-.Xr kill 2 ,
-.Xr thr_exit 2 ,
-.Xr thr_new 2 ,
-.Xr thr_self 2 ,
-.Xr thr_set_name 2 ,
-.Xr _umtx_op 2 ,
-.Xr pthread_kill 3 ,
-.Xr signal 3
-.Sh STANDARDS
-The
-.Fn thr_kill
-and
-.Fn thr_kill2
-system calls are non-standard and are used by the
-.Lb libthr
-to implement
-.St -p1003.1-2001
-.Xr pthread 3
-functionality.
-.Sh HISTORY
-The
-.Fn thr_kill
-and
-.Fn thr_kill2
-system calls first appeared in
-.Fx 5.2 .
diff --git a/lib/libc/sys/thr_new.2 b/lib/libc/sys/thr_new.2
deleted file mode 100644
index 408ec2a27747..000000000000
--- a/lib/libc/sys/thr_new.2
+++ /dev/null
@@ -1,250 +0,0 @@
-.\" Copyright (c) 2016 The FreeBSD Foundation, Inc.
-.\" All rights reserved.
-.\"
-.\" This documentation was written by
-.\" Konstantin Belousov <kib@FreeBSD.org> under sponsorship
-.\" from the FreeBSD Foundation.
-.\"
-.\" 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 AUTHORS 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 AUTHORS 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd May 5, 2020
-.Dt THR_NEW 2
-.Os
-.Sh NAME
-.Nm thr_new
-.Nd create new thread of execution
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/thr.h
-.Ft int
-.Fn thr_new "struct thr_param *param" "int param_size"
-.Sh DESCRIPTION
-.Bf -symbolic
-This function is intended for implementing threading.
-Normal applications should call
-.Xr pthread_create 3
-instead.
-.Ef
-.Pp
-The
-.Fn thr_new
-system call creates a new kernel-scheduled thread of execution in the context
-of the current process.
-The newly created thread shares all attributes of the process with the
-existing kernel-scheduled threads in the process, but has private processor
-execution state.
-The machine context for the new thread is copied from the creating thread's
-context, including coprocessor state.
-FPU state and specific machine registers are excluded from the copy.
-These are set according to ABI requirements and syscall parameters.
-The FPU state for the new thread is reinitialized to clean.
-.Pp
-The
-.Fa param
-structure supplies parameters affecting the thread creation.
-The structure is defined in the
-.In sys/thr.h
-header as follows
-.Bd -literal
-struct thr_param {
- void (*start_func)(void *);
- void *arg;
- char *stack_base;
- size_t stack_size;
- char *tls_base;
- size_t tls_size;
- long *child_tid;
- long *parent_tid;
- int flags;
- struct rtprio *rtp;
-};
-.Ed
-and contains the following fields:
-.Bl -tag -width ".Va parent_tid"
-.It Va start_func
-Pointer to the thread entry function.
-The kernel arranges for the new thread to start executing the function
-upon the first return to userspace.
-.It Va arg
-Opaque argument supplied to the entry function.
-.It Va stack_base
-Stack base address.
-The stack must be allocated by the caller.
-On some architectures, the ABI might require that the system put information
-on the stack to ensure the execution environment for
-.Va start_func .
-.It Va stack_size
-Stack size.
-.It Va tls_base
-TLS base address.
-The value of TLS base is loaded into the ABI-defined machine register
-in the new thread context.
-.It Va tls_size
-TLS size.
-.It Va child_tid
-Address to store the new thread identifier, for the child's use.
-.It Va parent_tid
-Address to store the new thread identifier, for the parent's use.
-.Pp
-Both
-.Va child_tid
-and
-.Va parent_tid
-are provided, with the intent that
-.Va child_tid
-is used by the new thread to get its thread identifier without
-issuing the
-.Xr thr_self 2
-syscall, while
-.Va parent_tid
-is used by the thread creator.
-The latter is separate from
-.Va child_tid
-because the new thread might exit and free its thread data before the parent
-has a chance to execute far enough to access it.
-.It Va flags
-Thread creation flags.
-The
-.Va flags
-member may specify the following flags:
-.Bl -tag -width ".Dv THR_SYSTEM_SCOPE"
-.It Dv THR_SUSPENDED
-Create the new thread in the suspended state.
-The flag is not currently implemented.
-.It Dv THR_SYSTEM_SCOPE
-Create the system scope thread.
-The flag is not currently implemented.
-.El
-.It Va rtp
-Real-time scheduling priority for the new thread.
-May be
-.Dv NULL
-to inherit the priority from the
-creating thread.
-.El
-.Pp
-The
-.Fa param_size
-argument should be set to the size of the
-.Fa param
-structure.
-.Pp
-After the first successful creation of an additional thread,
-the process is marked by the kernel as multi-threaded.
-In particular, the
-.Dv P_HADTHREADS
-flag is set in the process'
-.Dv p_flag
-(visible in the
-.Xr ps 1
-output), and several operations are executed in multi-threaded mode.
-For instance, the
-.Xr execve 2
-system call terminates all threads but the calling one on successful
-execution.
-.Sh RETURN VALUES
-If successful,
-.Fn thr_new
-will return zero, otherwise \-1 is returned, and
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-The
-.Fn thr_new
-operation returns the following errors:
-.Bl -tag -width Er
-.\" When changing this list, consider updating share/man/man3/pthread_create.3,
-.\" since that function can return any of these errors.
-.It Bq Er EFAULT
-The memory pointed to by the
-.Fa param
-argument is not valid.
-.It Bq Er EFAULT
-The memory pointed to by the
-.Fa param
-structure
-.Fa child_tid , parent_tid
-or
-.Fa rtp
-arguments is not valid.
-.It Bq Er EFAULT
-The specified stack base is invalid, or the kernel was unable to put required
-initial data on the stack.
-.It Bq Er EINVAL
-The
-.Fa param_size
-argument specifies a negative value, or the value is greater than the
-largest
-.Fa struct param
-size the kernel can interpret.
-.It Bq Er EINVAL
-The
-.Fa rtp
-member is not
-.Dv NULL
-and specifies invalid scheduling parameters.
-.It Bq Er EINVAL
-The specified TLS base is invalid.
-.It Bq Er EPERM
-The caller does not have permission to set the scheduling parameters or
-scheduling policy.
-.It Bq Er EPROCLIM
-Creation of the new thread would exceed the
-.Dv RACCT_NTHR
-limit, see
-.Xr racct 2 .
-.It Bq Er EPROCLIM
-Creation of the new thread would exceed the
-.Dv kern.threads.max_threads_per_proc
-.Xr sysctl 2
-limit.
-.It Bq Er ENOMEM
-There was not enough kernel memory to allocate the new thread structures.
-.El
-.Sh SEE ALSO
-.Xr ps 1 ,
-.Xr _umtx_op 2 ,
-.Xr execve 2 ,
-.Xr racct 2 ,
-.Xr thr_exit 2 ,
-.Xr thr_kill 2 ,
-.Xr thr_kill2 2 ,
-.Xr thr_self 2 ,
-.Xr thr_set_name 2 ,
-.Xr pthread_create 3
-.Sh STANDARDS
-The
-.Fn thr_new
-system call is non-standard and is used by the
-.Lb libthr
-to implement
-.St -p1003.1-2001
-.Xr pthread 3
-functionality.
-.Sh HISTORY
-The
-.Fn thr_new
-system call first appeared in
-.Fx 5.2 .
diff --git a/lib/libc/sys/thr_self.2 b/lib/libc/sys/thr_self.2
deleted file mode 100644
index 423efa4beca1..000000000000
--- a/lib/libc/sys/thr_self.2
+++ /dev/null
@@ -1,95 +0,0 @@
-.\" Copyright (c) 2016 The FreeBSD Foundation, Inc.
-.\" All rights reserved.
-.\"
-.\" This documentation was written by
-.\" Konstantin Belousov <kib@FreeBSD.org> under sponsorship
-.\" from the FreeBSD Foundation.
-.\"
-.\" 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 AUTHORS 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 AUTHORS 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd May 5, 2020
-.Dt THR_SELF 2
-.Os
-.Sh NAME
-.Nm thr_self
-.Nd return thread identifier for the calling thread
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/thr.h
-.Ft int
-.Fn thr_self "long *id"
-.Sh DESCRIPTION
-The
-.Fn thr_self
-system call stores the system-wide thread identifier for the current
-kernel-scheduled thread in the variable pointed by the argument
-.Va id .
-.Pp
-The thread identifier is an integer in the range from
-.Dv PID_MAX + 2
-(100001) to
-.Dv INT_MAX .
-The thread identifier is guaranteed to be unique at any given time,
-for each running thread in the system.
-After the thread exits, the identifier may be reused.
-.Sh RETURN VALUES
-If successful,
-.Fn thr_self
-will return zero, otherwise \-1 is returned, and
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-The
-.Fn thr_self
-operation may return the following errors:
-.Bl -tag -width Er
-.It Bq Er EFAULT
-The memory pointed to by the
-.Fa id
-argument is not valid.
-.El
-.Sh SEE ALSO
-.Xr _umtx_op 2 ,
-.Xr thr_exit 2 ,
-.Xr thr_kill 2 ,
-.Xr thr_kill2 2 ,
-.Xr thr_new 2 ,
-.Xr thr_set_name 2 ,
-.Xr pthread_getthreadid_np 3 ,
-.Xr pthread_self 3
-.Sh STANDARDS
-The
-.Fn thr_self
-system call is non-standard and is used by
-.Lb libthr
-to implement
-.St -p1003.1-2001
-.Xr pthread 3
-functionality.
-.Sh HISTORY
-The
-.Fn thr_self
-system call first appeared in
-.Fx 5.2 .
diff --git a/lib/libc/sys/thr_set_name.2 b/lib/libc/sys/thr_set_name.2
deleted file mode 100644
index f63cc4d467ed..000000000000
--- a/lib/libc/sys/thr_set_name.2
+++ /dev/null
@@ -1,99 +0,0 @@
-.\" Copyright (c) 2016 The FreeBSD Foundation, Inc.
-.\" All rights reserved.
-.\"
-.\" This documentation was written by
-.\" Konstantin Belousov <kib@FreeBSD.org> under sponsorship
-.\" from the FreeBSD Foundation.
-.\"
-.\" 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 AUTHORS 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 AUTHORS 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd May 5, 2020
-.Dt THR_SET_NAME 2
-.Os
-.Sh NAME
-.Nm thr_set_name
-.Nd set user-visible thread name
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/thr.h
-.Ft int
-.Fn thr_set_name "long id" "const char *name"
-.Sh DESCRIPTION
-The
-.Fn thr_set_name
-system call sets the user-visible name for the thread with the identifier
-.Va id
-in the current process to the NUL-terminated string
-.Va name .
-The name will be silently truncated to fit into a buffer of
-.Dv MAXCOMLEN + 1
-bytes.
-The thread name can be seen in the output of the
-.Xr ps 1
-and
-.Xr top 1
-commands, in the kernel debuggers and kernel tracing facility outputs,
-and in userland debuggers and program core files, as notes.
-.Sh RETURN VALUES
-If successful,
-.Fn thr_set_name
-returns zero; otherwise, \-1 is returned, and
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-The
-.Fn thr_set_name
-system call may return the following errors:
-.Bl -tag -width Er
-.It Bq Er EFAULT
-The memory pointed to by the
-.Fa name
-argument is not valid.
-.It Bq Er ESRCH
-The thread with the identifier
-.Fa id
-does not exist in the current process.
-.El
-.Sh SEE ALSO
-.Xr ps 1 ,
-.Xr _umtx_op 2 ,
-.Xr thr_exit 2 ,
-.Xr thr_kill 2 ,
-.Xr thr_kill2 2 ,
-.Xr thr_new 2 ,
-.Xr thr_self 2 ,
-.Xr pthread_set_name_np 3 ,
-.Xr ddb 4 ,
-.Xr ktr 9
-.Sh STANDARDS
-The
-.Fn thr_set_name
-system call is non-standard and is used by the
-.Lb libthr .
-.Sh HISTORY
-The
-.Fn thr_set_name
-system call first appeared in
-.Fx 5.2 .
diff --git a/lib/libc/sys/thr_suspend.2 b/lib/libc/sys/thr_suspend.2
deleted file mode 100644
index da981bcb36ef..000000000000
--- a/lib/libc/sys/thr_suspend.2
+++ /dev/null
@@ -1,134 +0,0 @@
-.\" Copyright (c) 2016 The FreeBSD Foundation, Inc.
-.\" All rights reserved.
-.\"
-.\" This documentation was written by
-.\" Konstantin Belousov <kib@FreeBSD.org> under sponsorship
-.\" from the FreeBSD Foundation.
-.\"
-.\" 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 AUTHORS 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 AUTHORS 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd May 5, 2020
-.Dt THR_SUSPEND 2
-.Os
-.Sh NAME
-.Nm thr_suspend
-.Nd suspend the calling thread
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/thr.h
-.Ft int
-.Fn thr_suspend "struct timespec *timeout"
-.Sh DESCRIPTION
-.Bf -symbolic
-This function is intended for implementing threading.
-Normal applications should use
-.Xr pthread_cond_timedwait 3
-together with
-.Xr pthread_cond_broadcast 3
-for typical safe suspension with cooperation of the thread
-being suspended, or
-.Xr pthread_suspend_np 3
-and
-.Xr pthread_resume_np 3
-in some specific situations, instead.
-.Ef
-.Pp
-The
-.Fn thr_suspend
-system call puts the calling thread in a suspended state, where it is
-not eligible for CPU time.
-This state is exited by another thread calling
-.Xr thr_wake 2 ,
-when the time interval specified by
-.Fa timeout
-has elapsed,
-or by the delivery of a signal to the suspended thread.
-.Pp
-If the
-.Fa timeout
-argument is
-.Dv NULL ,
-the suspended state can be only terminated by explicit
-.Fn thr_wake
-or signal.
-.Pp
-If a wake from
-.Xr thr_wake 2
-was delivered before the
-.Nm
-call, the thread is not put into a suspended state.
-Instead, the call
-returns immediately without an error.
-.Pp
-If a thread previously called
-.Xr thr_wake 2
-with its own thread identifier, which resulted in setting the internal kernel
-flag to immediately abort interruptible sleeps with an
-.Er EINTR
-error
-.Po
-see
-.Xr thr_wake 2
-.Pc ,
-the flag is cleared.
-As with
-.Xr thr_wake 2
-called from another thread, the next
-.Nm
-call does not result in suspension.
-.Sh RETURN VALUES
-.Rv -std thr_suspend
-.Sh ERRORS
-The
-.Fn thr_suspend
-operation returns the following errors:
-.Bl -tag -width Er
-.It Bq Er EFAULT
-The memory pointed to by the
-.Fa timeout
-argument is not valid.
-.It Bq Er ETIMEDOUT
-The specified timeout expired.
-.It Bq Er ETIMEDOUT
-The
-.Fa timeout
-argument specified a zero time interval.
-.It Bq Er EINTR
-The sleep was interrupted by a signal.
-.El
-.Sh SEE ALSO
-.Xr ps 1 ,
-.Xr thr_wake 2 ,
-.Xr pthread_resume_np 3 ,
-.Xr pthread_suspend_np 3
-.Sh STANDARDS
-The
-.Fn thr_suspend
-system call is non-standard.
-.Sh HISTORY
-The
-.Fn thr_suspend
-system call first appeared in
-.Fx 5.2 .
diff --git a/lib/libc/sys/thr_wake.2 b/lib/libc/sys/thr_wake.2
deleted file mode 100644
index b8862b4a3f9c..000000000000
--- a/lib/libc/sys/thr_wake.2
+++ /dev/null
@@ -1,117 +0,0 @@
-.\" Copyright (c) 2016 The FreeBSD Foundation, Inc.
-.\" All rights reserved.
-.\"
-.\" This documentation was written by
-.\" Konstantin Belousov <kib@FreeBSD.org> under sponsorship
-.\" from the FreeBSD Foundation.
-.\"
-.\" 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 AUTHORS 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 AUTHORS 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd May 5, 2020
-.Dt THR_WAKE 2
-.Os
-.Sh NAME
-.Nm thr_wake
-.Nd wake up the suspended thread
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/thr.h
-.Ft int
-.Fn thr_wake "long id"
-.Sh DESCRIPTION
-.Bf -symbolic
-This function is intended for implementing threading.
-Normal applications should use
-.Xr pthread_cond_timedwait 3
-together with
-.Xr pthread_cond_broadcast 3
-for typical safe suspension with cooperation of the thread
-being suspended, or
-.Xr pthread_suspend_np 3
-and
-.Xr pthread_resume_np 3
-in some specific situations, instead.
-.Ef
-.Pp
-Passing the thread identifier of the calling thread
-.Po
-see
-.Xr thr_self 2
-.Pc
-to
-.Fn thr_wake
-sets a thread's flag to cause the next signal-interruptible sleep
-of that thread in the kernel to fail immediately with the
-.Er EINTR
-error.
-The flag is cleared by an interruptible sleep attempt or by a call to
-.Xr thr_suspend 2 .
-This is used by the system threading library to implement cancellation.
-.Pp
-If
-.Fa id
-is not equal to the current thread identifier, the specified thread is
-woken up if suspended by the
-.Xr thr_suspend 2
-system call.
-If the thread is not suspended at the time of the
-.Nm
-call, the wake is remembered and the next attempt of the thread to
-suspend itself with the
-.Xr thr_suspend 2
-results in immediate return with success.
-Only one wake is remembered.
-.Sh RETURN VALUES
-.Rv -std thr_wake
-.Sh ERRORS
-The
-.Fn thr_wake
-operation returns these errors:
-.Bl -tag -width Er
-.It Bq Er ESRCH
-The specified thread was not found or does not belong to the process
-of the calling thread.
-.El
-.Sh SEE ALSO
-.Xr ps 1 ,
-.Xr thr_self 2 ,
-.Xr thr_suspend 2 ,
-.Xr pthread_cancel 3 ,
-.Xr pthread_resume_np 3 ,
-.Xr pthread_suspend_np 3
-.Sh STANDARDS
-The
-.Fn thr_suspend
-system call is non-standard and is used by
-.Lb libthr
-to implement
-.St -p1003.1-2001
-.Xr pthread 3
-functionality.
-.Sh HISTORY
-The
-.Fn thr_suspend
-system call first appeared in
-.Fx 5.2 .
diff --git a/lib/libc/sys/timer_create.2 b/lib/libc/sys/timer_create.2
deleted file mode 100644
index 1dd0cd5d1fac..000000000000
--- a/lib/libc/sys/timer_create.2
+++ /dev/null
@@ -1,200 +0,0 @@
-.\" Copyright (c) 2005 David Xu <davidxu@FreeBSD.org>
-.\" All rights reserved.
-.\"
-.\" 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(s), this list of conditions and the following disclaimer as
-.\" the first lines of this file unmodified other than the possible
-.\" addition of one or more copyright notices.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice(s), 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 HOLDER(S) ``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(S) 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd July 15, 2016
-.Dt TIMER_CREATE 2
-.Os
-.Sh NAME
-.Nm timer_create
-.Nd "create a per-process timer (REALTIME)"
-.Sh LIBRARY
-.Lb librt
-.Sh SYNOPSIS
-.In time.h
-.In signal.h
-.Ft int
-.Fo timer_create
-.Fa "clockid_t clockid" "struct sigevent *restrict evp"
-.Fa "timer_t *restrict timerid"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn timer_create
-system call creates a per-process timer using the specified clock,
-.Fa clock_id ,
-as the timing base.
-The
-.Fn timer_create
-system call returns, in the location referenced by
-.Fa timerid ,
-a timer ID of type
-.Vt timer_t
-used to identify the timer in timer requests.
-This timer ID is unique within the calling process until the timer is deleted.
-The particular clock,
-.Fa clock_id ,
-is defined in
-.In time.h .
-The timer whose ID is returned is in a disarmed state upon return from
-.Fn timer_create .
-.Pp
-The
-.Fa evp
-argument, if
-.Pf non- Dv NULL ,
-points to a
-.Vt sigevent
-structure.
-This structure,
-allocated by the application, defines the asynchronous notification to occur
-when the timer expires.
-.Pp
-If
-.Fa evp->sigev_notify
-is
-.Dv SIGEV_SIGNO
-or
-.Dv SIGEV_THREAD_ID ,
-the signal specified in
-.Fa evp->sigev_signo
-will be sent to the calling process
-.Pq Dv SIGEV_SIGNO
-or to the thread whose LWP ID is
-.Fa evp->sigev_notify_thread_id
-.Pq Dv SIGEV_THREAD_ID .
-The information for the queued signal will include:
-.Bl -column ".Va si_value"
-.It Sy Member Ta Sy Value
-.It Va si_code Ta Dv SI_TIMER
-.It Va si_value Ta
-the value stored in
-.Fa evp->sigev_value
-.It Va si_timerid Ta timer ID
-.It Va si_overrun Ta timer overrun count
-.It Va si_errno Ta
-If timer overrun is
-.Brq Dv DELAYTIMER_MAX ,
-an error code defined in
-.In errno.h
-.El
-.Pp
-If the
-.Fa evp
-argument is
-.Dv NULL ,
-the effect is as if the
-.Fa evp
-argument pointed to a
-.Vt sigevent
-structure with the
-.Va sigev_notify
-member having the value
-.Dv SIGEV_SIGNAL ,
-the
-.Va sigev_signo
-having a default signal number
-.Pq Dv SIGALRM ,
-and the
-.Va sigev_value
-member having
-the value of the timer ID.
-.Pp
-This implementation supports a
-.Fa clock_id
-of
-.Dv CLOCK_REALTIME
-or
-.Dv CLOCK_MONOTONIC .
-.Pp
-If
-.Fa evp->sigev_notify
-is
-.Dv SIGEV_THREAD
-and
-.Fa sev->sigev_notify_attributes
-is not
-.Dv NULL ,
-if the attribute pointed to by
-.Fa sev->sigev_notify_attributes
-has
-a thread stack address specified by a call to
-.Fn pthread_attr_setstack
-or
-.Fn pthread_attr_setstackaddr ,
-the results are unspecified if the signal is generated more than once.
-.Sh RETURN VALUES
-If the call succeeds,
-.Fn timer_create
-returns zero and updates the location referenced by
-.Fa timerid
-to a
-.Vt timer_t ,
-which can be passed to the per-process timer calls.
-If an error
-occurs, the system call returns a value of \-1
-and the global variable
-.Va errno
-is set to indicate the
-error.
-The value of
-.Fa timerid
-is undefined if an error occurs.
-.Sh ERRORS
-The
-.Fn timer_create
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EAGAIN
-The calling process has already created all of the timers it is allowed by
-this implementation.
-.It Bq Er EINVAL
-The specified clock ID is not supported.
-.It Bq Er EINVAL
-The specified asynchronous notification method is not supported.
-.It Bq Er EFAULT
-Any arguments point outside the allocated address space or there is a
-memory protection fault.
-.El
-.Sh SEE ALSO
-.Xr clock_getres 2 ,
-.Xr timer_delete 2 ,
-.Xr timer_getoverrun 2 ,
-.Xr sigevent 3 ,
-.Xr siginfo 3
-.Sh STANDARDS
-The
-.Fn timer_create
-system call conforms to
-.St -p1003.1-2004 .
-.Sh HISTORY
-Support for
-.Tn POSIX
-per-process timer first appeared in
-.Fx 7.0 .
diff --git a/lib/libc/sys/timer_delete.2 b/lib/libc/sys/timer_delete.2
deleted file mode 100644
index a7f5ada0eb51..000000000000
--- a/lib/libc/sys/timer_delete.2
+++ /dev/null
@@ -1,80 +0,0 @@
-.\" Copyright (c) 2005 David Xu <davidxu@FreeBSD.org>
-.\" All rights reserved.
-.\"
-.\" 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(s), this list of conditions and the following disclaimer as
-.\" the first lines of this file unmodified other than the possible
-.\" addition of one or more copyright notices.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice(s), 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 HOLDER(S) ``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(S) 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd September 11, 2000
-.Dt TIMER_DELETE 2
-.Os
-.Sh NAME
-.Nm timer_delete
-.Nd "delete a per-process timer (REALTIME)"
-.Sh LIBRARY
-.Lb librt
-.Sh SYNOPSIS
-.In time.h
-.Ft int
-.Fn timer_delete "timer_t timerid"
-.Sh DESCRIPTION
-The
-.Fn timer_delete
-system call
-deletes the specified timer,
-.Fa timerid ,
-previously created by the
-.Xr timer_create 2
-system call.
-If the timer is armed when
-.Fn timer_delete
-is called, the behavior is as if the timer is automatically disarmed before
-removal.
-Pending signals for the deleted timer are cleared.
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-The
-.Fn timer_delete
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The timer ID specified by
-.Fa timerid
-is not a valid timer ID.
-.El
-.Sh SEE ALSO
-.Xr timer_create 2
-.Sh STANDARDS
-The
-.Fn timer_delete
-system call conforms to
-.St -p1003.1-2004 .
-.Sh HISTORY
-Support for
-.Tn POSIX
-per-process timer first appeared in
-.Fx 7.0 .
diff --git a/lib/libc/sys/timer_settime.2 b/lib/libc/sys/timer_settime.2
deleted file mode 100644
index 3f7be18c217d..000000000000
--- a/lib/libc/sys/timer_settime.2
+++ /dev/null
@@ -1,265 +0,0 @@
-.\" Copyright (c) 2005 David Xu <davidxu@FreeBSD.org>
-.\" All rights reserved.
-.\"
-.\" 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(s), this list of conditions and the following disclaimer as
-.\" the first lines of this file unmodified other than the possible
-.\" addition of one or more copyright notices.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice(s), 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 HOLDER(S) ``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(S) 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd September 11, 2000
-.Dt TIMER_SETTIME 2
-.Os
-.Sh NAME
-.Nm timer_getoverrun ,
-.Nm timer_gettime ,
-.Nm timer_settime
-.Nd "per-process timers (REALTIME)"
-.Sh LIBRARY
-.Lb librt
-.Sh SYNOPSIS
-.In time.h
-.Ft int
-.Fn timer_getoverrun "timer_t timerid"
-.Ft int
-.Fn timer_gettime "timer_t timerid" "struct itimerspec *value"
-.Ft int
-.Fo timer_settime
-.Fa "timer_t timerid" "int flags" "const struct itimerspec *restrict value"
-.Fa "struct itimerspec *restrict ovalue"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn timer_gettime
-system call stores the amount of time until the specified timer,
-.Fa timerid ,
-expires and the reload value of the timer into the space pointed to by the
-.Fa value
-argument.
-The
-.Va it_value
-member of this structure contains the amount of time
-before the timer expires, or zero if the timer is disarmed.
-This value is
-returned as the interval until timer expiration, even if the timer was armed
-with absolute time.
-The
-.Va it_interval
-member of
-.Fa value
-contains the reload
-value last set by
-.Fn timer_settime .
-.Pp
-The
-.Fn timer_settime
-system call sets the time until the next expiration of the timer specified
-by
-.Fa timerid
-from the
-.Va it_value
-member of the
-.Fa value
-argument and arms the timer if the
-.Va it_value
-member of
-.Fa value
-is non-zero.
-If the specified timer was already
-armed when
-.Fn timer_settime
-is called, this call resets the time until next expiration to the value
-specified.
-If the
-.Va it_value
-member of
-.Fa value
-is zero, the timer is disarmed.
-If the timer is disarmed, then pending signal is removed.
-.Pp
-If the flag
-.Dv TIMER_ABSTIME
-is not set in the argument
-.Fa flags ,
-.Fn timer_settime
-behaves as if the time until next expiration is set to
-be equal to the interval specified by the
-.Va it_value
-member of
-.Fa value .
-That is,
-the timer expires in
-.Va it_value
-nanoseconds from when the call is made.
-If the flag
-.Dv TIMER_ABSTIME
-is set in the argument
-.Fa flags ,
-.Fn timer_settime
-behaves as if the time until next expiration is set to be equal to the
-difference between the absolute time specified by the it_value member of
-value and the current value of the clock associated with
-.Fa timerid .
-That is, the timer expires when the clock reaches the value specified by the
-.Va it_value
-member of
-.Fa value .
-If the specified time has already passed, the
-system call succeeds and the expiration notification is made.
-.Pp
-The reload value of the timer is set to the value specified by the
-.Va it_interval
-member of
-.Fa value .
-When a timer is armed with a non-zero
-.Va it_interval ,
-a periodic
-(or repetitive) timer is specified.
-.Pp
-Time values that are between two consecutive non-negative integer multiples of
-the resolution of the specified timer are rounded up to the larger multiple of
-the resolution.
-Quantization error will not cause the timer to expire earlier
-than the rounded time value.
-.Pp
-If the argument
-.Fa ovalue
-is not
-.Dv NULL ,
-the
-.Fn timer_settime
-system call stores, in the location referenced by
-.Fa ovalue ,
-a value representing
-the previous amount of time before the timer would have expired, or zero if the
-timer was disarmed, together with the previous timer reload value.
-Timers do not
-expire before their scheduled time.
-.Pp
-Only a single signal is queued to the process for a given timer at any point in
-time.
-When a timer for which a signal is still pending expires, no signal is
-queued, and a timer overrun will occur.
-When a timer expiration signal is
-accepted by a process, the
-.Fn timer_getoverrun
-system call returns the timer expiration overrun count for the specified timer.
-The overrun count returned contains the number of extra timer expirations that
-occurred between the time the signal was generated (queued) and when it was
-accepted, up to but not including an maximum of
-.Brq Dv DELAYTIMER_MAX .
-If the number of
-such extra expirations is greater than or equal to
-.Brq Dv DELAYTIMER_MAX ,
-then the overrun count is set to
-.Brq Dv DELAYTIMER_MAX .
-The value returned by
-.Fn timer_getoverrun
-applies to the most recent expiration signal acceptance for the timer.
-If no
-expiration signal has been delivered for the timer, the return value of
-.Fn timer_getoverrun
-is unspecified.
-.Sh RETURN VALUES
-If the
-.Fn timer_getoverrun
-system call succeeds, it returns the timer expiration overrun count as explained
-above.
-Otherwise the value \-1 is returned, and the global variable
-.Va errno
-is set to indicate the error.
-.Pp
-.Rv -std timer_gettime timer_settime
-.Sh ERRORS
-The
-.Fn timer_settime
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-A
-.Fa value
-structure specified a nanosecond value less than zero or greater than
-or equal to 1000 million, and the
-.Va it_value
-member of that structure did not
-specify zero seconds and nanoseconds.
-.El
-.Pp
-These system calls may fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Fa timerid
-argument does not correspond to an ID returned by
-.Fn timer_create
-but not yet deleted by
-.Fn timer_delete .
-.El
-.Pp
-The
-.Fn timer_settime
-system call may fail if:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Va it_interval
-member of
-.Fa value
-is not zero and the timer was created with
-notification by creation of a new thread
-.Va ( sigev_sigev_notify
-was
-.Dv SIGEV_THREAD )
-and a fixed stack address has been set in the thread attribute pointed to by
-.Va sigev_notify_attributes .
-.El
-.Pp
-The
-.Fn timer_gettime
-and
-.Fn timer_settime
-system calls
-may fail if:
-.Bl -tag -width Er
-.It Bq Er EFAULT
-Any arguments point outside the allocated address space or there is a
-memory protection fault.
-.El
-.Sh SEE ALSO
-.Xr clock_getres 2 ,
-.Xr timer_create 2 ,
-.Xr siginfo 3
-.Sh STANDARDS
-The
-.Fn timer_getoverrun ,
-.Fn timer_gettime ,
-and
-.Fn timer_settime
-system calls conform to
-.St -p1003.1-2004 .
-.Sh HISTORY
-Support for
-.Tn POSIX
-per-process timer first appeared in
-.Fx 7.0 .
diff --git a/lib/libc/sys/trivial-vdso_tc.c b/lib/libc/sys/trivial-vdso_tc.c
deleted file mode 100644
index ce0c1444f318..000000000000
--- a/lib/libc/sys/trivial-vdso_tc.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/*-
- * Copyright (c) 2013 Konstantin Belousov <kib@FreeBSD.org>
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/vdso.h>
-#include <errno.h>
-
-#pragma weak __vdso_gettc
-int
-__vdso_gettc(const struct vdso_timehands *th, u_int *tc)
-{
-
- return (ENOSYS);
-}
-
-#pragma weak __vdso_gettimekeep
-int
-__vdso_gettimekeep(struct vdso_timekeep **tk)
-{
-
- return (ENOSYS);
-}
diff --git a/lib/libc/sys/truncate.2 b/lib/libc/sys/truncate.2
deleted file mode 100644
index 9bab04005220..000000000000
--- a/lib/libc/sys/truncate.2
+++ /dev/null
@@ -1,170 +0,0 @@
-.\" Copyright (c) 1983, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)truncate.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2020
-.Dt TRUNCATE 2
-.Os
-.Sh NAME
-.Nm truncate ,
-.Nm ftruncate
-.Nd truncate or extend a file to a specified length
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn truncate "const char *path" "off_t length"
-.Ft int
-.Fn ftruncate "int fd" "off_t length"
-.Sh DESCRIPTION
-The
-.Fn truncate
-system call
-causes the file named by
-.Fa path
-or referenced by
-.Fa fd
-to be truncated or extended to
-.Fa length
-bytes in size.
-If the file
-was larger than this size, the extra data
-is lost.
-If the file was smaller than this size,
-it will be extended as if by writing bytes
-with the value zero.
-.Pp
-The
-.Fn ftruncate
-system call causes the file or shared memory object backing the file descriptor
-.Fa fd
-to be truncated or extended to
-.Fa length
-bytes in size.
-The file descriptor must be a valid file descriptor open for writing.
-The file position pointer associated with the file descriptor
-.Fa fd
-will not be modified.
-.Sh RETURN VALUES
-.Rv -std
-If the file to be modified is not a directory or
-a regular file, the
-.Fn truncate
-call has no effect and returns the value 0.
-.Sh ERRORS
-The
-.Fn truncate
-system call
-succeeds unless:
-.Bl -tag -width Er
-.It Bq Er ENOTDIR
-A component of the path prefix is not a directory.
-.It Bq Er ENAMETOOLONG
-A component of a pathname exceeded 255 characters,
-or an entire path name exceeded 1023 characters.
-.It Bq Er ENOENT
-The named file does not exist.
-.It Bq Er EACCES
-Search permission is denied for a component of the path prefix.
-.It Bq Er EACCES
-The named file is not writable by the user.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating the pathname.
-.It Bq Er EPERM
-The named file has its immutable or append-only flag set, see the
-.Xr chflags 2
-manual page for more information.
-.It Bq Er EISDIR
-The named file is a directory.
-.It Bq Er EROFS
-The named file resides on a read-only file system.
-.It Bq Er ETXTBSY
-The file is a pure procedure (shared text) file that is being executed.
-.It Bq Er EFBIG
-The
-.Fa length
-argument was greater than the maximum file size.
-.It Bq Er EINVAL
-The
-.Fa length
-argument was less than 0.
-.It Bq Er EIO
-An I/O error occurred updating the inode.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.It Bq Er EFAULT
-The
-.Fa path
-argument
-points outside the process's allocated address space.
-.El
-.Pp
-The
-.Fn ftruncate
-system call
-succeeds unless:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa fd
-argument
-is not a valid descriptor.
-.It Bq Er EINVAL
-The
-.Fa fd
-argument
-references a file descriptor that is not a regular file or shared memory object.
-.It Bq Er EINVAL
-The
-.Fa fd
-descriptor
-is not open for writing.
-.El
-.Sh SEE ALSO
-.Xr chflags 2 ,
-.Xr open 2 ,
-.Xr shm_open 2
-.Sh HISTORY
-The
-.Fn truncate
-and
-.Fn ftruncate
-system calls appeared in
-.Bx 4.2 .
-.Sh BUGS
-These calls should be generalized to allow ranges
-of bytes in a file to be discarded.
-.Pp
-Historically, the use of
-.Fn truncate
-or
-.Fn ftruncate
-to extend a file was not portable, but this behavior became required in
-.St -p1003.1-2008 .
diff --git a/lib/libc/sys/umask.2 b/lib/libc/sys/umask.2
deleted file mode 100644
index 87e7e1fe59b9..000000000000
--- a/lib/libc/sys/umask.2
+++ /dev/null
@@ -1,88 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)umask.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd June 4, 1993
-.Dt UMASK 2
-.Os
-.Sh NAME
-.Nm umask
-.Nd set file creation mode mask
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/stat.h
-.Ft mode_t
-.Fn umask "mode_t numask"
-.Sh DESCRIPTION
-The
-.Fn umask
-routine sets the process's file mode creation mask to
-.Fa numask
-and returns the previous value of the mask.
-The 9 low-order
-access permission
-bits of
-.Fa numask
-are used by system calls, including
-.Xr open 2 ,
-.Xr mkdir 2 ,
-and
-.Xr mkfifo 2 ,
-to turn off corresponding bits
-requested in file mode.
-(See
-.Xr chmod 2 ) .
-This clearing allows each user to restrict the default access
-to his files.
-.Pp
-The default mask value is S_IWGRP|S_IWOTH (022, write access for the
-owner only).
-Child processes inherit the mask of the calling process.
-.Sh RETURN VALUES
-The previous value of the file mode mask is returned by the call.
-.Sh ERRORS
-The
-.Fn umask
-system call is always successful.
-.Sh SEE ALSO
-.Xr chmod 2 ,
-.Xr mkfifo 2 ,
-.Xr mknod 2 ,
-.Xr open 2
-.Sh STANDARDS
-The
-.Fn umask
-system call is expected to conform to
-.St -p1003.1-90 .
-.Sh HISTORY
-The
-.Fn umask
-function appeared in
-.At v7 .
diff --git a/lib/libc/sys/undelete.2 b/lib/libc/sys/undelete.2
deleted file mode 100644
index cd1e9f17f66f..000000000000
--- a/lib/libc/sys/undelete.2
+++ /dev/null
@@ -1,107 +0,0 @@
-.\" Copyright (c) 1994
-.\" Jan-Simon Pendry
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)undelete.2 8.4 (Berkeley) 10/18/94
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2020
-.Dt UNDELETE 2
-.Os
-.Sh NAME
-.Nm undelete
-.Nd attempt to recover a deleted file
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn undelete "const char *path"
-.Sh DESCRIPTION
-The
-.Fn undelete
-system call attempts to recover the deleted file named by
-.Fa path .
-Currently, this works only when the named object
-is a whiteout in a union file system.
-The system call removes the whiteout causing
-any objects in a lower layer of the
-union stack to become visible once more.
-.Pp
-Eventually, the
-.Fn undelete
-functionality may be expanded to other file systems able to recover
-deleted files such as the log-structured file system.
-.Sh RETURN VALUES
-.Rv -std undelete
-.Sh ERRORS
-The
-.Fn undelete
-succeeds unless:
-.Bl -tag -width Er
-.It Bq Er ENOTDIR
-A component of the path prefix is not a directory.
-.It Bq Er ENAMETOOLONG
-A component of a pathname exceeded 255 characters,
-or an entire path name exceeded 1023 characters.
-.It Bq Er EEXIST
-The path does not reference a whiteout.
-.It Bq Er ENOENT
-The named whiteout does not exist.
-.It Bq Er EACCES
-Search permission is denied for a component of the path prefix.
-.It Bq Er EACCES
-Write permission is denied on the directory containing the name
-to be undeleted.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating the pathname.
-.It Bq Er EPERM
-The directory containing the name is marked sticky,
-and the containing directory is not owned by the effective user ID.
-.It Bq Er EINVAL
-The last component of the path is
-.Ql .. .
-.It Bq Er EIO
-An I/O error occurred while updating the directory entry.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.It Bq Er EROFS
-The name resides on a read-only file system.
-.It Bq Er EFAULT
-The
-.Fa path
-argument
-points outside the process's allocated address space.
-.El
-.Sh SEE ALSO
-.Xr unlink 2 ,
-.Xr mount_unionfs 8
-.Sh HISTORY
-The
-.Fn undelete
-system call first appeared in
-.Bx 4.4 Lite .
diff --git a/lib/libc/sys/unlink.2 b/lib/libc/sys/unlink.2
deleted file mode 100644
index 11fff875abad..000000000000
--- a/lib/libc/sys/unlink.2
+++ /dev/null
@@ -1,284 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)unlink.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd February 23, 2021
-.Dt UNLINK 2
-.Os
-.Sh NAME
-.Nm unlink ,
-.Nm unlinkat ,
-.Nm funlinkat
-.Nd remove directory entry
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft int
-.Fn unlink "const char *path"
-.Ft int
-.Fn unlinkat "int dfd" "const char *path" "int flag"
-.Ft int
-.Fn funlinkat "int dfd" "const char *path" "int fd" "int flag"
-.Sh DESCRIPTION
-The
-.Fn unlink
-system call
-removes the link named by
-.Fa path
-from its directory and decrements the link count of the
-file which was referenced by the link.
-If that decrement reduces the link count of the file
-to zero,
-and no process has the file open, then
-all resources associated with the file are reclaimed.
-If one or more process have the file open when the last link is removed,
-the link is removed, but the removal of the file is delayed until
-all references to it have been closed.
-The
-.Fa path
-argument
-may not be a directory.
-.Pp
-The
-.Fn unlinkat
-system call is equivalent to
-.Fn unlink
-or
-.Fn rmdir
-except in the case where
-.Fa path
-specifies a relative path.
-In this case the directory entry to be removed is determined
-relative to the directory associated with the file descriptor
-.Fa dfd
-instead of the current working directory.
-.Pp
-The values for
-.Fa flag
-are constructed by a bitwise-inclusive OR of flags from the following list,
-defined in
-.In fcntl.h :
-.Bl -tag -width indent
-.It Dv AT_REMOVEDIR
-Remove the directory entry specified by
-.Fa fd
-and
-.Fa path
-as a directory, not a normal file.
-.It Dv AT_RESOLVE_BENEATH
-Only walk paths below the directory specified by the
-.Ar fd
-descriptor.
-See the description of the
-.Dv O_RESOLVE_BENEATH
-flag in the
-.Xr open 2
-manual page.
-.El
-.Pp
-If
-.Fn unlinkat
-is passed the special value
-.Dv AT_FDCWD
-in the
-.Fa fd
-parameter, the current working directory is used and the behavior is
-identical to a call to
-.Fa unlink
-or
-.Fa rmdir
-respectively, depending on whether or not the
-.Dv AT_REMOVEDIR
-bit is set in flag.
-.Pp
-The
-.Fn funlinkat
-system call can be used to unlink an already-opened file, unless that
-file has been replaced since it was opened.
-It is equivalent to
-.Fn unlinkat
-in the case where
-.Fa path
-is already open as the file descriptor
-.Fa fd .
-Otherwise, the path will not be removed and an error will be returned.
-The
-.Fa fd
-can be set the
-.Dv FD_NONE .
-In that case
-.Fn funlinkat
-behaves exactly like
-.Fn unlinkat .
-.Sh RETURN VALUES
-.Rv -std unlink
-.Sh ERRORS
-The
-.Fn unlink
-succeeds unless:
-.Bl -tag -width Er
-.It Bq Er ENOTDIR
-A component of the path prefix is not a directory.
-.It Bq Er EISDIR
-The named file is a directory.
-.It Bq Er ENAMETOOLONG
-A component of a pathname exceeded 255 characters,
-or an entire path name exceeded 1023 characters.
-.It Bq Er ENOENT
-The named file does not exist.
-.It Bq Er EACCES
-Search permission is denied for a component of the path prefix.
-.It Bq Er EACCES
-Write permission is denied on the directory containing the link
-to be removed.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating the pathname.
-.It Bq Er EPERM
-The named file is a directory.
-.It Bq Er EPERM
-The named file has its immutable, undeletable or append-only flag set, see the
-.Xr chflags 2
-manual page for more information.
-.It Bq Er EPERM
-The parent directory of the named file has its immutable or append-only flag
-set.
-.It Bq Er EPERM
-The directory containing the file is marked sticky,
-and neither the containing directory nor the file to be removed
-are owned by the effective user ID.
-.It Bq Er EIO
-An I/O error occurred while deleting the directory entry
-or deallocating the inode.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.It Bq Er EROFS
-The named file resides on a read-only file system.
-.It Bq Er EFAULT
-The
-.Fa path
-argument
-points outside the process's allocated address space.
-.It Bq Er ENOSPC
-On file systems supporting copy-on-write or snapshots, there was not enough
-free space to record metadata for the delete operation of the file.
-.El
-.Pp
-In addition to the errors returned by the
-.Fn unlink ,
-the
-.Fn unlinkat
-may fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa path
-argument does not specify an absolute path and the
-.Fa fd
-argument is neither
-.Dv AT_FDCWD
-nor a valid file descriptor open for searching.
-.It Bq Er ENOTEMPTY
-The
-.Fa flag
-parameter has the
-.Dv AT_REMOVEDIR
-bit set and the
-.Fa path
-argument names a directory that is not an empty directory,
-or there are hard links to the directory other than dot or
-a single entry in dot-dot.
-.It Bq Er ENOTDIR
-The
-.Fa flag
-parameter has the
-.Dv AT_REMOVEDIR
-bit set and
-.Fa path
-does not name a directory.
-.It Bq Er EINVAL
-The value of the
-.Fa flag
-argument is not valid.
-.It Bq Er ENOTDIR
-The
-.Fa path
-argument is not an absolute path and
-.Fa fd
-is neither
-.Dv AT_FDCWD
-nor a file descriptor associated with a directory.
-.It Bq Er ENOTCAPABLE
-.Fa path
-is an absolute path,
-or contained a ".." component leading to a
-directory outside of the directory hierarchy specified by
-.Fa fd ,
-and the process is in capability mode or the
-.Dv AT_RESOLVE_BENEATH
-flag was specified.
-.El
-.Pp
-In addition to the errors returned by
-.Fn unlinkat ,
-.Fn funlinkat
-may fail if:
-.Bl -tag -width Er
-.It Bq Er EDEADLK
-The file descriptor is not associated with the path.
-.El
-.Sh SEE ALSO
-.Xr chflags 2 ,
-.Xr close 2 ,
-.Xr link 2 ,
-.Xr rmdir 2 ,
-.Xr symlink 7
-.Sh STANDARDS
-The
-.Fn unlinkat
-system call follows The Open Group Extended API Set 2 specification.
-.Sh HISTORY
-The
-.Fn unlink
-function appeared in
-.At v1 .
-The
-.Fn unlinkat
-system call appeared in
-.Fx 8.0 .
-The
-.Fn funlinkat
-system call appeared in
-.Fx 13.0 .
-.Pp
-The
-.Fn unlink
-system call traditionally allows the super-user to unlink directories which
-can damage the file system integrity.
-This implementation no longer permits it.
diff --git a/lib/libc/sys/utimensat.2 b/lib/libc/sys/utimensat.2
deleted file mode 100644
index 2af452898c9d..000000000000
--- a/lib/libc/sys/utimensat.2
+++ /dev/null
@@ -1,322 +0,0 @@
-.\" $NetBSD: utimes.2,v 1.13 1999/03/22 19:45:11 garbled Exp $
-.\"
-.\" Copyright (c) 1990, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\" Copyright (c) 2012, Jilles Tjoelker
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)utimes.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2021
-.Dt UTIMENSAT 2
-.Os
-.Sh NAME
-.Nm futimens ,
-.Nm utimensat
-.Nd set file access and modification times
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/stat.h
-.Ft int
-.Fn futimens "int fd" "const struct timespec times[2]"
-.Ft int
-.Fo utimensat
-.Fa "int fd"
-.Fa "const char *path"
-.Fa "const struct timespec times[2]"
-.Fa "int flag"
-.Fc
-.Sh DESCRIPTION
-The access and modification times of the file named by
-.Fa path
-or referenced by
-.Fa fd
-are changed as specified by the argument
-.Fa times .
-The inode-change-time of the file is set to the current time.
-.Pp
-If
-.Fa path
-specifies a relative path,
-it is relative to the current working directory if
-.Fa fd
-is
-.Dv AT_FDCWD
-and otherwise relative to the directory associated with the file descriptor
-.Fa fd .
-.Pp
-The
-.Va tv_nsec
-field of a
-.Vt timespec
-structure
-can be set to the special value
-.Dv UTIME_NOW
-to set the current time, or to
-.Dv UTIME_OMIT
-to leave the time unchanged.
-In either case, the
-.Va tv_sec
-field is ignored.
-.Pp
-If
-.Fa times
-is
-.No non- Ns Dv NULL ,
-it is assumed to point to an array of two timespec structures.
-The access time is set to the value of the first element, and the
-modification time is set to the value of the second element.
-For file systems that support file birth (creation) times (such as
-.Dv UFS2 ) ,
-the birth time will be set to the value of the second element
-if the second element is older than the currently set birth time.
-To set both a birth time and a modification time,
-two calls are required; the first to set the birth time
-and the second to set the (presumably newer) modification time.
-Ideally a new system call will be added that allows the setting
-of all three times at once.
-If
-.Fa times
-is
-.Dv NULL ,
-this is equivalent to passing
-a pointer to an array of two timespec structures
-with both
-.Va tv_nsec
-fields set to
-.Dv UTIME_NOW .
-.Pp
-If both
-.Va tv_nsec
-fields are
-.Dv UTIME_OMIT ,
-the timestamps remain unchanged and
-no permissions are needed for the file itself,
-although search permissions may be required for the path prefix.
-The call may or may not succeed if the named file does not exist.
-.Pp
-If both
-.Va tv_nsec
-fields are
-.Dv UTIME_NOW ,
-the caller must be the owner of the file, have permission to
-write the file, or be the super-user.
-.Pp
-For all other values of the timestamps,
-the caller must be the owner of the file or be the super-user.
-.Pp
-The values for the
-.Fa flag
-argument of the
-.Fn utimensat
-system call
-are constructed by a bitwise-inclusive OR of flags from the following list,
-defined in
-.In fcntl.h :
-.Bl -tag -width indent
-.It Dv AT_SYMLINK_NOFOLLOW
-If
-.Fa path
-names a symbolic link, the symbolic link's times are changed.
-By default,
-.Fn utimensat
-changes the times of the file referenced by the symbolic link.
-.It Dv AT_RESOLVE_BENEATH
-Only walk paths below the directory specified by the
-.Ar fd
-descriptor.
-See the description of the
-.Dv O_RESOLVE_BENEATH
-flag in the
-.Xr open 2
-manual page.
-.It Dv AT_EMPTY_PATH
-If the
-.Fa path
-argument is an empty string, operate on the file or directory
-referenced by the descriptor
-.Fa fd .
-If
-.Fa fd
-is equal to
-.Dv AT_FDCWD ,
-operate on the current working directory.
-.El
-.Sh RETURN VALUES
-.Rv -std
-.Sh COMPATIBILITY
-If the running kernel does not support this system call,
-a wrapper emulates it using
-.Xr fstatat 2 ,
-.Xr futimesat 2
-and
-.Xr lutimes 2 .
-As a result, timestamps will be rounded down to the nearest microsecond,
-.Dv UTIME_OMIT
-is not atomic and
-.Dv AT_SYMLINK_NOFOLLOW
-is not available with a path relative to a file descriptor.
-.Sh ERRORS
-These system calls will fail if:
-.Bl -tag -width Er
-.It Bq Er EACCES
-The
-.Fa times
-argument is
-.Dv NULL ,
-or both
-.Va tv_nsec
-values are
-.Dv UTIME_NOW ,
-and the effective user ID of the process does not
-match the owner of the file, and is not the super-user, and write
-access is denied.
-.It Bq Er EFAULT
-The
-.Fa times
-argument
-points outside the process's allocated address space.
-.It Bq Er EINVAL
-The
-.Va tv_nsec
-component of at least one of the values specified by the
-.Fa times
-argument has a value less than 0 or greater than 999999999 and is not equal to
-.Dv UTIME_NOW
-or
-.Dv UTIME_OMIT .
-.It Bq Er EIO
-An I/O error occurred while reading or writing the affected inode.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.It Bq Er EPERM
-The
-.Fa times
-argument is not
-.Dv NULL
-nor are both
-.Va tv_nsec
-values
-.Dv UTIME_NOW ,
-nor are both
-.Va tv_nsec
-values
-.Dv UTIME_OMIT
-and the calling process's effective user ID
-does not match the owner of the file and is not the super-user.
-.It Bq Er EPERM
-The named file has its immutable or append-only flag set, see the
-.Xr chflags 2
-manual page for more information.
-.It Bq Er EROFS
-The file system containing the file is mounted read-only.
-.El
-.Pp
-The
-.Fn futimens
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa fd
-argument
-does not refer to a valid descriptor.
-.El
-.Pp
-The
-.Fn utimensat
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EACCES
-Search permission is denied for a component of the path prefix.
-.It Bq Er EBADF
-The
-.Fa path
-argument does not specify an absolute path and the
-.Fa fd
-argument is neither
-.Dv AT_FDCWD
-nor a valid file descriptor.
-.It Bq Er EFAULT
-The
-.Fa path
-argument
-points outside the process's allocated address space.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating the pathname.
-.It Bq Er ENAMETOOLONG
-A component of a pathname exceeded
-.Dv NAME_MAX
-characters, or an entire path name exceeded
-.Dv PATH_MAX
-characters.
-.It Bq Er ENOENT
-The named file does not exist.
-.It Bq Er ENOTDIR
-A component of the path prefix is not a directory.
-.It Bq Er ENOTDIR
-The
-.Fa path
-argument is not an absolute path and
-.Fa fd
-is neither
-.Dv AT_FDCWD
-nor a file descriptor associated with a directory.
-.It Bq Er ENOTCAPABLE
-.Fa path
-is an absolute path,
-or contained a ".." component leading to a
-directory outside of the directory hierarchy specified by
-.Fa fd ,
-and the process is in capability mode or the
-.Dv AT_RESOLVE_BENEATH
-flag was specified.
-.El
-.Sh SEE ALSO
-.Xr chflags 2 ,
-.Xr stat 2 ,
-.Xr symlink 2 ,
-.Xr utimes 2 ,
-.Xr utime 3 ,
-.Xr symlink 7
-.Sh STANDARDS
-The
-.Fn futimens
-and
-.Fn utimensat
-system calls are expected to conform to
-.St -p1003.1-2008 .
-.Sh HISTORY
-The
-.Fn futimens
-and
-.Fn utimensat
-system calls appeared in
-.Fx 10.3 .
diff --git a/lib/libc/sys/utimes.2 b/lib/libc/sys/utimes.2
deleted file mode 100644
index 6831e504d1f8..000000000000
--- a/lib/libc/sys/utimes.2
+++ /dev/null
@@ -1,264 +0,0 @@
-.\" $NetBSD: utimes.2,v 1.13 1999/03/22 19:45:11 garbled Exp $
-.\"
-.\" Copyright (c) 1990, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)utimes.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd March 30, 2020
-.Dt UTIMES 2
-.Os
-.Sh NAME
-.Nm utimes ,
-.Nm lutimes ,
-.Nm futimes ,
-.Nm futimesat
-.Nd set file access and modification times
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/time.h
-.Ft int
-.Fn utimes "const char *path" "const struct timeval *times"
-.Ft int
-.Fn lutimes "const char *path" "const struct timeval *times"
-.Ft int
-.Fn futimes "int fd" "const struct timeval *times"
-.Ft int
-.Fn futimesat "int fd" "const char *path" "const struct timeval times[2]"
-.Sh DESCRIPTION
-.Bf -symbolic
-These interfaces are obsoleted by
-.Xr futimens 2
-and
-.Xr utimensat 2
-because they are not accurate to nanoseconds.
-.Ef
-.Pp
-The access and modification times of the file named by
-.Fa path
-or referenced by
-.Fa fd
-are changed as specified by the argument
-.Fa times .
-.Pp
-If
-.Fa times
-is
-.Dv NULL ,
-the access and modification times are set to the current time.
-The caller must be the owner of the file, have permission to
-write the file, or be the super-user.
-.Pp
-If
-.Fa times
-is
-.No non- Ns Dv NULL ,
-it is assumed to point to an array of two timeval structures.
-The access time is set to the value of the first element, and the
-modification time is set to the value of the second element.
-For file systems that support file birth (creation) times (such as
-.Dv UFS2 ) ,
-the birth time will be set to the value of the second element
-if the second element is older than the currently set birth time.
-To set both a birth time and a modification time,
-two calls are required; the first to set the birth time
-and the second to set the (presumably newer) modification time.
-Ideally a new system call will be added that allows the setting
-of all three times at once.
-The caller must be the owner of the file or be the super-user.
-.Pp
-In either case, the inode-change-time of the file is set to the current
-time.
-.Pp
-The
-.Fn lutimes
-system call
-is like
-.Fn utimes
-except in the case where the named file is a symbolic link,
-in which case
-.Fn lutimes
-changes the access and modification times of the link,
-while
-.Fn utimes
-changes the times of the file the link references.
-.Pp
-The
-.Fn futimesat
-system call is equivalent to
-.Fn utimes
-except in the case where
-.Fa path
-specifies a relative path.
-In this case the access and modification time
-is set to that of a file relative to the directory associated with the file
-descriptor
-.Fa fd
-instead of the current working directory.
-If
-.Fn futimesat
-is passed the special value
-.Dv AT_FDCWD
-in the
-.Fa fd
-parameter, the current working directory is used and the behavior
-is identical to a call to
-.Fn utimes .
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-All of the system call will fail if:
-.Bl -tag -width Er
-.It Bq Er EACCES
-Search permission is denied for a component of the path prefix.
-.It Bq Er EACCES
-The
-.Fa times
-argument is
-.Dv NULL
-and the effective user ID of the process does not
-match the owner of the file, and is not the super-user, and write
-access is denied.
-.It Bq Er EFAULT
-The
-.Fa path
-or
-.Fa times
-argument
-points outside the process's allocated address space.
-.It Bq Er EFAULT
-The
-.Fa times
-argument
-points outside the process's allocated address space.
-.It Bq Er EINVAL
-The
-.Va tv_usec
-component of at least one of the values specified by the
-.Fa times
-argument has a value less than 0 or greater than 999999.
-.It Bq Er EIO
-An I/O error occurred while reading or writing the affected inode.
-.It Bq Er EINTEGRITY
-Corrupted data was detected while reading from the file system.
-.It Bq Er ELOOP
-Too many symbolic links were encountered in translating the pathname.
-.It Bq Er ENAMETOOLONG
-A component of a pathname exceeded
-.Dv NAME_MAX
-characters, or an entire path name exceeded
-.Dv PATH_MAX
-characters.
-.It Bq Er ENOENT
-The named file does not exist.
-.It Bq Er ENOTDIR
-A component of the path prefix is not a directory.
-.It Bq Er EPERM
-The
-.Fa times
-argument is not
-.Dv NULL
-and the calling process's effective user ID
-does not match the owner of the file and is not the super-user.
-.It Bq Er EPERM
-The named file has its immutable or append-only flags set.
-See the
-.Xr chflags 2
-manual page for more information.
-.It Bq Er EROFS
-The file system containing the file is mounted read-only.
-.El
-.Pp
-The
-.Fn futimes
-system call
-will fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa fd
-argument
-does not refer to a valid descriptor.
-.El
-.Pp
-In addition to the errors returned by the
-.Fn utimes ,
-the
-.Fn futimesat
-may fail if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa path
-argument does not specify an absolute path and the
-.Fa fd
-argument is neither
-.Dv AT_FDCWD
-nor a valid file descriptor open for searching.
-.It Bq Er ENOTDIR
-The
-.Fa path
-argument is not an absolute path and
-.Fa fd
-is neither
-.Dv AT_FDCWD
-nor a file descriptor associated with a directory.
-.El
-.Sh SEE ALSO
-.Xr chflags 2 ,
-.Xr stat 2 ,
-.Xr utimensat 2 ,
-.Xr utime 3
-.Sh STANDARDS
-The
-.Fn utimes
-function is expected to conform to
-.St -xpg4.2 .
-The
-.Fn futimesat
-system call follows The Open Group Extended API Set 2 specification
-but was replaced by
-.Fn utimensat
-in
-.St -p1003.1-2008 .
-.Sh HISTORY
-The
-.Fn utimes
-system call appeared in
-.Bx 4.2 .
-The
-.Fn futimes
-and
-.Fn lutimes
-system calls first appeared in
-.Fx 3.0 .
-The
-.Fn futimesat
-system call appeared in
-.Fx 8.0 .
diff --git a/lib/libc/sys/utrace.2 b/lib/libc/sys/utrace.2
deleted file mode 100644
index 814091aeb30d..000000000000
--- a/lib/libc/sys/utrace.2
+++ /dev/null
@@ -1,80 +0,0 @@
-.\" $NetBSD: utrace.2,v 1.11 2003/04/24 12:17:49 wiz Exp $
-.\"
-.\" Copyright (c) 2000 The NetBSD Foundation, Inc.
-.\" All rights reserved.
-.\"
-.\" This code is derived from software contributed to The NetBSD Foundation
-.\" by Gregory McGarry <g.mcgarry@ieee.org>.
-.\"
-.\" 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 AUTHOR ``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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd December 11, 2015
-.Dt UTRACE 2
-.Os
-.Sh NAME
-.Nm utrace
-.Nd insert user record in ktrace log
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/param.h
-.In sys/time.h
-.In sys/uio.h
-.In sys/ktrace.h
-.Ft int
-.Fn utrace "const void *addr" "size_t len"
-.Sh DESCRIPTION
-Adds a record to the process trace with information supplied by user.
-The record contains
-.Fa len
-bytes from memory pointed to by
-.Fa addr .
-This call only has an effect if the calling process is being traced.
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-.Bl -tag -width Er
-.It Bq Er EINVAL
-Specified data length
-.Fa len
-was bigger than
-.Dv KTR_USER_MAXLEN .
-.It Bq Er ENOMEM
-Insufficient memory to honor the request.
-.It Bq Er ENOSYS
-Currently running kernel was compiled without
-.Xr ktrace 2
-support
-.Pq Cd "options KTRACE" .
-.El
-.Sh SEE ALSO
-.Xr kdump 1 ,
-.Xr ktrace 1 ,
-.Xr truss 1 ,
-.Xr ktrace 2 ,
-.Xr sysdecode_utrace 3
-.Sh HISTORY
-The
-.Fn utrace
-system call first appeared in
-.Fx 2.2 .
diff --git a/lib/libc/sys/uuidgen.2 b/lib/libc/sys/uuidgen.2
deleted file mode 100644
index 9c90102b3e2f..000000000000
--- a/lib/libc/sys/uuidgen.2
+++ /dev/null
@@ -1,142 +0,0 @@
-.\" Copyright (c) 2002 Marcel Moolenaar
-.\" All rights reserved.
-.\"
-.\" 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 AUTHOR ``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 AUTHOR 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd May 26, 2002
-.Dt UUIDGEN 2
-.Os
-.Sh NAME
-.Nm uuidgen
-.Nd generate universally unique identifiers
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/uuid.h
-.Ft int
-.Fn uuidgen "struct uuid *store" "int count"
-.Sh DESCRIPTION
-The
-.Fn uuidgen
-system call generates
-.Fa count
-universally unique identifiers (UUIDs) and writes them to the buffer
-pointed to by
-.Fa store .
-The identifiers are generated according to the syntax and semantics of the
-DCE version 1 variant of universally unique identifiers.
-See below for a more in-depth description of the identifiers.
-When no IEEE 802
-address is available for the node field, a random multicast address is
-generated for each invocation of the system call.
-According to the algorithm of generating time-based UUIDs, this will also
-force a new random clock sequence, thereby increasing the likelihood for
-the identifier to be unique.
-.Pp
-When multiple identifiers are to be generated, the
-.Fn uuidgen
-system call will generate a set of identifiers that is dense in such a way
-that there is no identifier that is larger than the smallest identifier in the
-set and smaller than the largest identifier in the set and that is not already
-in the set.
-.Pp
-Universally unique identifiers, also known as globally unique identifiers
-(GUIDs), have a binary representation of 128-bits.
-The grouping and meaning of these bits is described by the following
-structure and its description of the fields that follow it:
-.Bd -literal
-struct uuid {
- uint32_t time_low;
- uint16_t time_mid;
- uint16_t time_hi_and_version;
- uint8_t clock_seq_hi_and_reserved;
- uint8_t clock_seq_low;
- uint8_t node[_UUID_NODE_LEN];
-};
-.Ed
-.Bl -tag -width ".Va clock_seq_hi_and_reserved"
-.It Va time_low
-The least significant 32 bits of a 60-bit timestamp.
-This field is stored in the native byte-order.
-.It Va time_mid
-The least significant 16 bits of the most significant 28 bits of the 60-bit
-timestamp.
-This field is stored in the native byte-order.
-.It Va time_hi_and_version
-The most significant 12 bits of the 60-bit timestamp multiplexed with a 4-bit
-version number.
-The version number is stored in the most significant 4 bits of the 16-bit
-field.
-This field is stored in the native byte-order.
-.It Va clock_seq_hi_and_reserved
-The most significant 6 bits of a 14-bit sequence number multiplexed with a
-2-bit variant value.
-Note that the width of the variant value is determined by the variant itself.
-Identifiers generated by the
-.Fn uuidgen
-system call have variant value 10b.
-the variant value is stored in the most significant bits of the field.
-.It Va clock_seq_low
-The least significant 8 bits of a 14-bit sequence number.
-.It Va node
-The 6-byte IEEE 802 (MAC) address of one of the interfaces of the node.
-If no such interface exists, a random multi-cast address is used instead.
-.El
-.Pp
-The binary representation is sensitive to byte ordering.
-Any multi-byte field is to be stored in the local or native byte-order and
-identifiers must be converted when transmitted to hosts that do not agree
-on the byte-order.
-The specification does not however document what this means in concrete
-terms and is otherwise beyond the scope of this system call.
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-The
-.Fn uuidgen
-system call can fail with:
-.Bl -tag -width Er
-.It Bq Er EFAULT
-The buffer pointed to by
-.Fa store
-could not be written to for any or all identifiers.
-.It Bq Er EINVAL
-The
-.Fa count
-argument is less than 1 or larger than the hard upper limit of 2048.
-.El
-.Sh SEE ALSO
-.Xr uuidgen 1 ,
-.Xr uuid 3
-.Sh STANDARDS
-The identifiers are represented and generated in conformance with the DCE 1.1
-RPC specification.
-The
-.Fn uuidgen
-system call is itself not part of the specification.
-.Sh HISTORY
-The
-.Fn uuidgen
-system call first appeared in
-.Fx 5.0 .
diff --git a/lib/libc/sys/vadvise.c b/lib/libc/sys/vadvise.c
index e53e24cbd7c4..44e26a69f9c1 100644
--- a/lib/libc/sys/vadvise.c
+++ b/lib/libc/sys/vadvise.c
@@ -29,11 +29,8 @@
* 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/cdefs.h>
#include <sys/errno.h>
int vadvise(int);
diff --git a/lib/libc/sys/vfork.2 b/lib/libc/sys/vfork.2
deleted file mode 100644
index 172a4c168228..000000000000
--- a/lib/libc/sys/vfork.2
+++ /dev/null
@@ -1,145 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)vfork.2 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD$
-.\"
-.Dd May 22, 2016
-.Dt VFORK 2
-.Os
-.Sh NAME
-.Nm vfork
-.Nd create a new process without copying the address space
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft pid_t
-.Fn vfork void
-.Sh DESCRIPTION
-.Bf -symbolic
-Since this function is hard to use correctly from application software,
-it is recommended to use
-.Xr posix_spawn 3
-or
-.Xr fork 2
-instead.
-.Ef
-.Pp
-The
-.Fn vfork
-system call
-can be used to create new processes without fully copying the address
-space of the old process, which is inefficient in a paged
-environment.
-It is useful when the purpose of
-.Xr fork 2
-would have been to create a new system context for an
-.Xr execve 2 .
-The
-.Fn vfork
-system call
-differs from
-.Xr fork 2
-in that the child borrows the parent process's address space and the
-calling thread's stack
-until a call to
-.Xr execve 2
-or an exit (either by a call to
-.Xr _exit 2
-or abnormally).
-The calling thread is suspended while the child is using its resources.
-Other threads continue to run.
-.Pp
-The
-.Fn vfork
-system call
-returns 0 in the child's context and (later) the pid of the child in
-the parent's context.
-.Pp
-Many problems can occur when replacing
-.Xr fork 2
-with
-.Fn vfork .
-For example, it does not work to return while running in the child's context
-from the procedure that called
-.Fn vfork
-since the eventual return from
-.Fn vfork
-would then return to a no longer existent stack frame.
-Also, changing process state which is partially implemented in user space
-such as signal handlers with
-.Xr libthr 3
-will corrupt the parent's state.
-.Pp
-Be careful, also, to call
-.Xr _exit 2
-rather than
-.Xr exit 3
-if you cannot
-.Xr execve 2 ,
-since
-.Xr exit 3
-will flush and close standard I/O channels, and thereby mess up the
-parent processes standard I/O data structures.
-(Even with
-.Xr fork 2
-it is wrong to call
-.Xr exit 3
-since buffered data would then be flushed twice.)
-.Sh RETURN VALUES
-Same as for
-.Xr fork 2 .
-.Sh SEE ALSO
-.Xr _exit 2 ,
-.Xr execve 2 ,
-.Xr fork 2 ,
-.Xr rfork 2 ,
-.Xr sigaction 2 ,
-.Xr wait 2 ,
-.Xr exit 3 ,
-.Xr posix_spawn 3
-.Sh HISTORY
-The
-.Fn vfork
-system call appeared in
-.Bx 3 .
-.Sh BUGS
-To avoid a possible deadlock situation,
-processes that are children in the middle
-of a
-.Fn vfork
-are never sent
-.Dv SIGTTOU
-or
-.Dv SIGTTIN
-signals; rather,
-output or
-.Xr ioctl 2
-calls
-are allowed
-and input attempts result in an end-of-file indication.
diff --git a/lib/libc/sys/wait.2 b/lib/libc/sys/wait.2
deleted file mode 100644
index 196597f1055b..000000000000
--- a/lib/libc/sys/wait.2
+++ /dev/null
@@ -1,689 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993, 1994
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)wait.2 8.2 (Berkeley) 4/19/94
-.\" $FreeBSD$
-.\"
-.Dd August 11, 2019
-.Dt WAIT 2
-.Os
-.Sh NAME
-.Nm wait ,
-.Nm waitid ,
-.Nm waitpid ,
-.Nm wait3 ,
-.Nm wait4 ,
-.Nm wait6
-.Nd wait for processes to change status
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In sys/types.h
-.In sys/wait.h
-.Ft pid_t
-.Fn wait "int *status"
-.Ft pid_t
-.Fn waitpid "pid_t wpid" "int *status" "int options"
-.In signal.h
-.Ft int
-.Fn waitid "idtype_t idtype" "id_t id" "siginfo_t *info" "int options"
-.In sys/time.h
-.In sys/resource.h
-.Ft pid_t
-.Fn wait3 "int *status" "int options" "struct rusage *rusage"
-.Ft pid_t
-.Fn wait4 "pid_t wpid" "int *status" "int options" "struct rusage *rusage"
-.Ft pid_t
-.Fo wait6
-.Fa "idtype_t idtype" "id_t id"
-.Fa "int *status"
-.Fa "int options"
-.Fa "struct __wrusage *wrusage"
-.Fa "siginfo_t *infop"
-.Fc
-.Sh DESCRIPTION
-The
-.Fn wait
-function suspends execution of its calling thread until
-.Fa status
-information is available for a child process
-or a signal is received.
-On return from a successful
-.Fn wait
-call,
-the
-.Fa status
-area contains information about the process that reported a status change
-as defined below.
-.Pp
-The
-.Fn wait4
-and
-.Fn wait6
-system calls provide a more general interface for programs
-that need to wait for specific child processes,
-that need resource utilization statistics accumulated by child processes,
-or that require options.
-The other wait functions are implemented using either
-.Fn wait4
-or
-.Fn wait6 .
-.Pp
-The
-.Fn wait6
-function is the most general function in this family and its distinct
-features are:
-.Pp
-All of the desired process statuses to be waited on must be explicitly
-specified in
-.Fa options .
-The
-.Fn wait ,
-.Fn waitpid ,
-.Fn wait3 ,
-and
-.Fn wait4
-functions all implicitly wait for exited and trapped processes,
-but the
-.Fn waitid
-and
-.Fn wait6
-functions require the corresponding
-.Dv WEXITED
-and
-.Dv WTRAPPED
-flags to be explicitly specified.
-This allows waiting for processes which have experienced other
-status changes without having to also handle the exit status from
-terminated processes.
-.Pp
-The
-.Fn wait6
-function accepts a
-.Fa wrusage
-argument which points to a structure defined as:
-.Bd -literal
-struct __wrusage {
- struct rusage wru_self;
- struct rusage wru_children;
-};
-.Ed
-.Pp
-This allows the calling process to collect resource usage statistics
-from both its own child process as well as from its grand children.
-When no resource usage statistics are needed this pointer can be
-.Dv NULL .
-.Pp
-The last argument
-.Fa infop
-must be either
-.Dv NULL
-or a pointer to a
-.Fa siginfo_t
-structure.
-If
-.Pf non- Dv NULL ,
-the structure is filled with the same data as for a
-.Dv SIGCHLD
-signal delivered when the process changed state.
-.Pp
-The set of child processes to be queried is specified by the arguments
-.Fa idtype
-and
-.Fa id .
-The separate
-.Fa idtype
-and
-.Fa id
-arguments support many other types of
-identifiers in addition to process IDs and process group IDs.
-.Bl -bullet -offset indent
-.It
-If
-.Fa idtype
-is
-.Dv P_PID ,
-.Fn waitid
-and
-.Fn wait6
-wait for the child process with a process ID equal to
-.Dv (pid_t)id .
-.It
-If
-.Fa idtype
-is
-.Dv P_PGID ,
-.Fn waitid
-and
-.Fn wait6
-wait for the child process with a process group ID equal to
-.Dv (pid_t)id .
-.It
-If
-.Fa idtype
-is
-.Dv P_ALL ,
-.Fn waitid
-and
-.Fn wait6
-wait for any child process and the
-.Dv id
-is ignored.
-.It
-If
-.Fa idtype
-is
-.Dv P_PID
-or
-.Dv P_PGID
-and the
-.Dv id
-is zero,
-.Fn waitid
-and
-.Fn wait6
-wait for any child process in the same process group as the caller.
-.El
-.Pp
-Non-standard identifier types supported by this
-implementation of
-.Fn waitid
-and
-.Fn wait6
-are:
-.Bl -tag -width P_JAILID
-.It Dv P_UID
-Wait for processes whose effective user ID is equal to
-.Dv (uid_t) Fa id .
-.It Dv P_GID
-Wait for processes whose effective group ID is equal to
-.Dv (gid_t) Fa id .
-.It Dv P_SID
-Wait for processes whose session ID is equal to
-.Fa id .
-.\" This is just how sessions work, not sure this needs to be documented here
-If the child process started its own session,
-its session ID will be the same as its process ID.
-Otherwise the session ID of a child process will match the caller's session ID.
-.It Dv P_JAILID
-Waits for processes within a jail whose jail identifier is equal to
-.Fa id .
-.El
-.Pp
-For the
-.Fn waitpid
-and
-.Fn wait4
-functions, the single
-.Fa wpid
-argument specifies the set of child processes for which to wait.
-.Bl -bullet -offset indent
-.It
-If
-.Fa wpid
-is -1, the call waits for any child process.
-.It
-If
-.Fa wpid
-is 0,
-the call waits for any child process in the process group of the caller.
-.It
-If
-.Fa wpid
-is greater than zero, the call waits for the process with process ID
-.Fa wpid .
-.It
-If
-.Fa wpid
-is less than -1, the call waits for any process whose process group ID
-equals the absolute value of
-.Fa wpid .
-.El
-.Pp
-The
-.Fa status
-argument is defined below.
-.Pp
-The
-.Fa options
-argument contains the bitwise OR of any of the following options.
-.Bl -tag -width WCONTINUED
-.It Dv WCONTINUED
-Report the status of selected processes that
-have continued from a job control stop by receiving a
-.Dv SIGCONT
-signal.
-.It Dv WNOHANG
-Do not block when
-there are no processes wishing to report status.
-.It Dv WUNTRACED
-Report the status of selected processes which are stopped due to a
-.Dv SIGTTIN , SIGTTOU , SIGTSTP ,
-or
-.Dv SIGSTOP
-signal.
-.It Dv WSTOPPED
-An alias for
-.Dv WUNTRACED .
-.It Dv WTRAPPED
-Report the status of selected processes which are being traced via
-.Xr ptrace 2
-and have trapped or reached a breakpoint.
-This flag is implicitly set for the functions
-.Fn wait ,
-.Fn waitpid ,
-.Fn wait3 ,
-and
-.Fn wait4 .
-.br
-For the
-.Fn waitid
-and
-.Fn wait6
-functions, the flag has to be explicitly included in
-.Fa options
-if status reports from trapped processes are expected.
-.It Dv WEXITED
-Report the status of selected processes which have terminated.
-This flag is implicitly set for the functions
-.Fn wait ,
-.Fn waitpid ,
-.Fn wait3 ,
-and
-.Fn wait4 .
-.br
-For the
-.Fn waitid
-and
-.Fn wait6
-functions, the flag has to be explicitly included in
-.Fa options
-if status reports from terminated processes are expected.
-.It Dv WNOWAIT
-Keep the process whose status is returned in a waitable state.
-The process may be waited for again after this call completes.
-.El
-.sp
-For the
-.Fn waitid
-and
-.Fn wait6
-functions, at least one of the options
-.Dv WEXITED ,
-.Dv WUNTRACED ,
-.Dv WSTOPPED ,
-.Dv WTRAPPED ,
-or
-.Dv WCONTINUED
-must be specified.
-Otherwise there will be no events for the call to report.
-To avoid hanging indefinitely in such a case these functions
-return -1 with
-.Dv errno
-set to
-.Dv EINVAL .
-.Pp
-If
-.Fa rusage
-is non-NULL, a summary of the resources used by the terminated
-process and all its children is returned.
-.Pp
-If
-.Fa wrusage
-is non-NULL, separate summaries are returned for the resources used
-by the terminated process and the resources used by all its children.
-.Pp
-If
-.Fa infop
-is non-NULL, a
-.Dv siginfo_t
-structure is returned with the
-.Fa si_signo
-field set to
-.Dv SIGCHLD
-and the
-.Fa si_pid
-field set to the process ID of the process reporting status.
-For the exited process, the
-.Fa si_status
-field of the
-.Dv siginfo_t
-structure contains the full 32 bit exit status passed to
-.Xr _exit 2 ;
-the
-.Fa status
-argument of other calls only returns 8 lowest bits of the exit status.
-.Pp
-When the
-.Dv WNOHANG
-option is specified and no processes
-wish to report status,
-.Fn waitid
-sets the
-.Fa si_signo
-and
-.Fa si_pid
-fields in
-.Fa infop
-to zero.
-Checking these fields is the only way to know if a status change was reported.
-.Pp
-When the
-.Dv WNOHANG
-option is specified and no processes
-wish to report status,
-.Fn wait4
-and
-.Fn wait6
-return a
-process id
-of 0.
-.Pp
-The
-.Fn wait
-call is the same as
-.Fn wait4
-with a
-.Fa wpid
-value of -1,
-with an
-.Fa options
-value of zero,
-and a
-.Fa rusage
-value of
-.Dv NULL .
-The
-.Fn waitpid
-function is identical to
-.Fn wait4
-with an
-.Fa rusage
-value of
-.Dv NULL .
-The older
-.Fn wait3
-call is the same as
-.Fn wait4
-with a
-.Fa wpid
-value of -1.
-The
-.Fn wait4
-function is identical to
-.Fn wait6
-with the flags
-.Dv WEXITED
-and
-.Dv WTRAPPED
-set in
-.Fa options
-and
-.Fa infop
-set to
-.Dv NULL .
-.Pp
-The following macros may be used to test the current status of the process.
-Exactly one of the following four macros will evaluate to a non-zero
-.Pq true
-value:
-.Bl -tag -width Ds
-.It Fn WIFCONTINUED status
-True if the process has not terminated, and
-has continued after a job control stop.
-This macro can be true only if the wait call specified the
-.Dv WCONTINUED
-option.
-.It Fn WIFEXITED status
-True if the process terminated normally by a call to
-.Xr _exit 2
-or
-.Xr exit 3 .
-.It Fn WIFSIGNALED status
-True if the process terminated due to receipt of a signal.
-.It Fn WIFSTOPPED status
-True if the process has not terminated, but has stopped and can be restarted.
-This macro can be true only if the wait call specified the
-.Dv WUNTRACED
-option
-or if the child process is being traced (see
-.Xr ptrace 2 ) .
-.El
-.Pp
-Depending on the values of those macros, the following macros
-produce the remaining status information about the child process:
-.Bl -tag -width Ds
-.It Fn WEXITSTATUS status
-If
-.Fn WIFEXITED status
-is true, evaluates to the low-order 8 bits
-of the argument passed to
-.Xr _exit 2
-or
-.Xr exit 3
-by the child.
-.It Fn WTERMSIG status
-If
-.Fn WIFSIGNALED status
-is true, evaluates to the number of the signal
-that caused the termination of the process.
-.It Fn WCOREDUMP status
-If
-.Fn WIFSIGNALED status
-is true, evaluates as true if the termination
-of the process was accompanied by the creation of a core file
-containing an image of the process when the signal was received.
-.It Fn WSTOPSIG status
-If
-.Fn WIFSTOPPED status
-is true, evaluates to the number of the signal
-that caused the process to stop.
-.El
-.Sh NOTES
-See
-.Xr sigaction 2
-for a list of termination signals.
-A status of 0 indicates normal termination.
-.Pp
-If a parent process terminates without
-waiting for all of its child processes to terminate,
-the remaining child processes are re-assigned to the reaper
-of the exiting process as the parent, see
-.Xr procctl 2
-.Dv PROC_REAP_ACQUIRE .
-If no specific reaper was assigned, the process with ID 1, the init process,
-becomes the parent of the orphaned children by default.
-.Pp
-If a signal is caught while any of the
-.Fn wait
-calls are pending,
-the call may be interrupted or restarted when the signal-catching routine
-returns,
-depending on the options in effect for the signal;
-see discussion of
-.Dv SA_RESTART
-in
-.Xr sigaction 2 .
-.Pp
-The implementation queues one
-.Dv SIGCHLD
-signal for each child process whose
-status has changed; if
-.Fn wait
-returns because the status of a child process is available, the pending
-SIGCHLD signal associated with the process ID of the child process will
-be discarded.
-Any other pending
-.Dv SIGCHLD
-signals remain pending.
-.Pp
-If
-.Dv SIGCHLD
-is blocked and
-.Fn wait
-returns because the status of a child process is available, the pending
-.Dv SIGCHLD
-signal will be cleared unless another status of the child process
-is available.
-.Sh RETURN VALUES
-If
-.Fn wait
-returns due to a stopped, continued,
-or terminated child process, the process ID of the child
-is returned to the calling process.
-Otherwise, a value of \-1
-is returned and
-.Va errno
-is set to indicate the error.
-.Pp
-If
-.Fn wait6 ,
-.Fn wait4 ,
-.Fn wait3 ,
-or
-.Fn waitpid
-returns due to a stopped, continued,
-or terminated child process, the process ID of the child
-is returned to the calling process.
-If there are no children not previously awaited,
--1 is returned with
-.Va errno
-set to
-.Er ECHILD .
-Otherwise, if
-.Dv WNOHANG
-is specified and there are
-no stopped, continued or exited children,
-0 is returned.
-If an error is detected or a caught signal aborts the call,
-a value of -1
-is returned and
-.Va errno
-is set to indicate the error.
-.Pp
-If
-.Fn waitid
-returns because one or more processes have a state change to report,
-0 is returned.
-If an error is detected,
-a value of -1
-is returned and
-.Va errno
-is set to indicate the error.
-If
-.Dv WNOHANG
-is specified and there are
-no stopped, continued or exited children,
-0 is returned.
-The
-.Fa si_signo
-and
-.Fa si_pid
-fields of
-.Fa infop
-must be checked against zero to determine if a process reported status.
-.Pp
-The
-.Fn wait
-family of functions will not return a child process created with
-.Xr pdfork 2
-unless specifically directed to do so by specifying its process ID.
-.Sh ERRORS
-The
-.Fn wait
-function
-will fail and return immediately if:
-.Bl -tag -width Er
-.It Bq Er ECHILD
-The calling process has no existing unwaited-for
-child processes.
-.It Bq Er ECHILD
-No status from the terminated child process is available
-because the calling process has asked the system to discard
-such status by ignoring the signal
-.Dv SIGCHLD
-or setting the flag
-.Dv SA_NOCLDWAIT
-for that signal.
-.It Bq Er EFAULT
-The
-.Fa status
-or
-.Fa rusage
-argument points to an illegal address.
-(May not be detected before exit of a child process.)
-.It Bq Er EINTR
-The call was interrupted by a caught signal,
-or the signal did not have the
-.Dv SA_RESTART
-flag set.
-.It Bq Er EINVAL
-An invalid value was specified for
-.Fa options ,
-or
-.Fa idtype
-and
-.Fa id
-do not specify a valid set of processes.
-.El
-.Sh SEE ALSO
-.Xr _exit 2 ,
-.Xr procctl 2 ,
-.Xr ptrace 2 ,
-.Xr sigaction 2 ,
-.Xr exit 3 ,
-.Xr siginfo 3
-.Sh STANDARDS
-The
-.Fn wait ,
-.Fn waitpid ,
-and
-.Fn waitid
-functions are defined by POSIX;
-.Fn wait6 ,
-.Fn wait4 ,
-and
-.Fn wait3
-are not specified by POSIX.
-The
-.Fn WCOREDUMP
-macro
-is an extension to the POSIX interface.
-.Pp
-The ability to use the
-.Dv WNOWAIT
-flag with
-.Fn waitpid
-is an extension;
-.Tn POSIX
-only permits this flag with
-.Fn waitid .
-.Sh HISTORY
-The
-.Fn wait
-function appeared in
-.At v1 .
diff --git a/lib/libc/gen/wait.c b/lib/libc/sys/wait.c
index b4fc17ee8113..6678ecc522ba 100644
--- a/lib/libc/gen/wait.c
+++ b/lib/libc/sys/wait.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)wait.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/types.h>
#include <sys/time.h>
@@ -47,9 +43,7 @@ pid_t __wait(int *);
pid_t
__wait(int *istat)
{
-
- return (((pid_t (*)(pid_t, int *, int, struct rusage *))
- __libc_interposing[INTERPOS_wait4])(WAIT_ANY, istat, 0, NULL));
+ return (INTERPOS_SYS(wait4, WAIT_ANY, istat, 0, NULL));
}
__weak_reference(__wait, wait);
diff --git a/lib/libc/gen/wait3.c b/lib/libc/sys/wait3.c
index 104ab8e5652e..4e98ccff5227 100644
--- a/lib/libc/gen/wait3.c
+++ b/lib/libc/sys/wait3.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)wait3.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/types.h>
#include <sys/time.h>
@@ -47,9 +43,7 @@ pid_t __wait3(int *, int, struct rusage *);
pid_t
__wait3(int *istat, int options, struct rusage *rup)
{
-
- return (((pid_t (*)(pid_t, int *, int, struct rusage *))
- __libc_interposing[INTERPOS_wait4])(WAIT_ANY, istat, options, rup));
+ return (INTERPOS_SYS(wait4, WAIT_ANY, istat, options, rup));
}
__weak_reference(__wait3, wait3);
diff --git a/lib/libc/sys/wait4.c b/lib/libc/sys/wait4.c
index a5dbd0fcb1aa..57b0071ef87f 100644
--- a/lib/libc/sys/wait4.c
+++ b/lib/libc/sys/wait4.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2014 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/wait.h>
#include "libc_private.h"
@@ -43,7 +39,5 @@ __weak_reference(__sys_wait4, __wait4);
pid_t
wait4(pid_t pid, int *status, int options, struct rusage *ru)
{
-
- return (((pid_t (*)(pid_t, int *, int, struct rusage *))
- __libc_interposing[INTERPOS_wait4])(pid, status, options, ru));
+ return (INTERPOS_SYS(wait4, pid, status, options, ru));
}
diff --git a/lib/libc/sys/wait6.c b/lib/libc/sys/wait6.c
index d280a7698747..118a7ef6b99e 100644
--- a/lib/libc/sys/wait6.c
+++ b/lib/libc/sys/wait6.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2015 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
@@ -45,8 +41,5 @@ pid_t
wait6(idtype_t idtype, id_t id, int *status, int options, struct __wrusage *ru,
siginfo_t *infop)
{
-
- return (((pid_t (*)(idtype_t, id_t, int *, int, struct __wrusage *,
- siginfo_t *))__libc_interposing[INTERPOS_wait6])(idtype, id,
- status, options, ru, infop));
+ return (INTERPOS_SYS(wait6, idtype, id, status, options, ru, infop));
}
diff --git a/lib/libc/gen/waitid.c b/lib/libc/sys/waitid.c
index b9a8c577150a..334f25e99bb6 100644
--- a/lib/libc/gen/waitid.c
+++ b/lib/libc/sys/waitid.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2012 Jukka A. Ukkonen
* All rights reserved.
@@ -28,9 +28,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/types.h>
#include <sys/wait.h>
@@ -49,9 +46,7 @@ __waitid(idtype_t idtype, id_t id, siginfo_t *info, int flags)
int status;
pid_t ret;
- ret = ((pid_t (*)(idtype_t, id_t, int *, int, struct __wrusage *,
- siginfo_t *))__libc_interposing[INTERPOS_wait6])(idtype, id,
- &status, flags, NULL, info);
+ ret = INTERPOS_SYS(wait6, idtype, id, &status, flags, NULL, info);
/*
* According to SUSv4, waitid() shall not return a PID when a
diff --git a/lib/libc/gen/waitpid.c b/lib/libc/sys/waitpid.c
index c17cefa09ab3..d8fdcec23a1c 100644
--- a/lib/libc/gen/waitpid.c
+++ b/lib/libc/sys/waitpid.c
@@ -29,10 +29,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__SCCSID("@(#)waitpid.c 8.1 (Berkeley) 6/4/93");
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <sys/types.h>
#include <sys/time.h>
@@ -47,9 +43,7 @@ pid_t __waitpid(pid_t, int *, int);
pid_t
__waitpid(pid_t pid, int *istat, int options)
{
-
- return (((pid_t (*)(pid_t, int *, int, struct rusage *))
- __libc_interposing[INTERPOS_wait4])(pid, istat, options, NULL));
+ return (INTERPOS_SYS(wait4, pid, istat, options, NULL));
}
__weak_reference(__waitpid, waitpid);
diff --git a/lib/libc/sys/write.2 b/lib/libc/sys/write.2
deleted file mode 100644
index 937e95b53a14..000000000000
--- a/lib/libc/sys/write.2
+++ /dev/null
@@ -1,314 +0,0 @@
-.\" Copyright (c) 1980, 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" 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.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-.\"
-.\" @(#)write.2 8.5 (Berkeley) 4/2/94
-.\" $FreeBSD$
-.\"
-.Dd February 11, 2021
-.Dt WRITE 2
-.Os
-.Sh NAME
-.Nm write ,
-.Nm writev ,
-.Nm pwrite ,
-.Nm pwritev
-.Nd write output
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In unistd.h
-.Ft ssize_t
-.Fn write "int fd" "const void *buf" "size_t nbytes"
-.Ft ssize_t
-.Fn pwrite "int fd" "const void *buf" "size_t nbytes" "off_t offset"
-.In sys/uio.h
-.Ft ssize_t
-.Fn writev "int fd" "const struct iovec *iov" "int iovcnt"
-.Ft ssize_t
-.Fn pwritev "int fd" "const struct iovec *iov" "int iovcnt" "off_t offset"
-.Sh DESCRIPTION
-The
-.Fn write
-system call
-attempts to write
-.Fa nbytes
-of data to the object referenced by the descriptor
-.Fa fd
-from the buffer pointed to by
-.Fa buf .
-The
-.Fn writev
-system call
-performs the same action, but gathers the output data
-from the
-.Fa iovcnt
-buffers specified by the members of the
-.Fa iov
-array: iov[0], iov[1], ..., iov[iovcnt\|-\|1].
-The
-.Fn pwrite
-and
-.Fn pwritev
-system calls
-perform the same functions, but write to the specified position in
-the file without modifying the file pointer.
-.Pp
-For
-.Fn writev
-and
-.Fn pwritev ,
-the
-.Fa iovec
-structure is defined as:
-.Pp
-.Bd -literal -offset indent -compact
-struct iovec {
- void *iov_base; /* Base address. */
- size_t iov_len; /* Length. */
-};
-.Ed
-.Pp
-Each
-.Fa iovec
-entry specifies the base address and length of an area
-in memory from which data should be written.
-The
-.Fn writev
-system call
-will always write a complete area before proceeding
-to the next.
-.Pp
-On objects capable of seeking, the
-.Fn write
-starts at a position
-given by the pointer associated with
-.Fa fd ,
-see
-.Xr lseek 2 .
-Upon return from
-.Fn write ,
-the pointer is incremented by the number of bytes which were written.
-.Pp
-Objects that are not capable of seeking always write from the current
-position.
-The value of the pointer associated with such an object
-is undefined.
-.Pp
-If the real user is not the super-user, then
-.Fn write
-clears the set-user-id bit on a file.
-This prevents penetration of system security
-by a user who
-.Dq captures
-a writable set-user-id file
-owned by the super-user.
-.Pp
-When using non-blocking I/O on objects such as sockets that are subject
-to flow control,
-.Fn write
-and
-.Fn writev
-may write fewer bytes than requested;
-the return value must be noted,
-and the remainder of the operation should be retried when possible.
-.Sh RETURN VALUES
-Upon successful completion the number of bytes which were written
-is returned.
-Otherwise a -1 is returned and the global variable
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-The
-.Fn write ,
-.Fn writev ,
-.Fn pwrite
-and
-.Fn pwritev
-system calls
-will fail and the file pointer will remain unchanged if:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa fd
-argument
-is not a valid descriptor open for writing.
-.It Bq Er EPIPE
-An attempt is made to write to a pipe that is not open
-for reading by any process.
-.It Bq Er EPIPE
-An attempt is made to write to a socket of type
-.Dv SOCK_STREAM
-that is not connected to a peer socket.
-.It Bq Er EFBIG
-An attempt was made to write a file that exceeds the process's
-file size limit or the maximum file size.
-.It Bq Er EFAULT
-Part of
-.Fa iov
-or data to be written to the file
-points outside the process's allocated address space.
-.It Bq Er EINVAL
-The pointer associated with
-.Fa fd
-was negative.
-.It Bq Er ENOSPC
-There is no free space remaining on the file system
-containing the file.
-.It Bq Er EDQUOT
-The user's quota of disk blocks on the file system
-containing the file has been exhausted.
-.It Bq Er EIO
-An I/O error occurred while reading from or writing to the file system.
-.It Bq Er EINTR
-A signal interrupted the write before it could be completed.
-.It Bq Er EAGAIN
-The file was marked for non-blocking I/O,
-and no data could be written immediately.
-.It Bq Er EROFS
-An attempt was made to write over a disk label area at the beginning
-of a slice.
-Use
-.Xr disklabel 8
-.Fl W
-to enable writing on the disk label area.
-.It Bq Er EINVAL
-The value
-.Fa nbytes
-is greater than
-.Dv SSIZE_MAX
-(or greater than
-.Dv INT_MAX ,
-if the sysctl
-.Va debug.iosize_max_clamp
-is non-zero).
-.It Bq Er EINTEGRITY
-The backing store for
-.Fa fd
-detected corrupted data while reading.
-(For example, writing a partial filesystem block may require first reading
-the existing block which may trigger this error.)
-.El
-.Pp
-In addition,
-.Fn writev
-and
-.Fn pwritev
-may return one of the following errors:
-.Bl -tag -width Er
-.It Bq Er EDESTADDRREQ
-The destination is no longer available when writing to a
-.Ux
-domain datagram socket on which
-.Xr connect 2
-had been used to set a destination address.
-.It Bq Er EINVAL
-The
-.Fa iovcnt
-argument
-was less than or equal to 0, or greater than
-.Dv IOV_MAX .
-.It Bq Er EINVAL
-One of the
-.Fa iov_len
-values in the
-.Fa iov
-array was negative.
-.It Bq Er EINVAL
-The sum of the
-.Fa iov_len
-values is greater than
-.Dv SSIZE_MAX
-(or greater than
-.Dv INT_MAX ,
-if the sysctl
-.Va debug.iosize_max_clamp
-is non-zero).
-.It Bq Er ENOBUFS
-The mbuf pool has been completely exhausted when writing to a socket.
-.El
-.Pp
-The
-.Fn pwrite
-and
-.Fn pwritev
-system calls may also return the following errors:
-.Bl -tag -width Er
-.It Bq Er EINVAL
-The
-.Fa offset
-value was negative.
-.It Bq Er ESPIPE
-The file descriptor is associated with a pipe, socket, or FIFO.
-.El
-.Sh SEE ALSO
-.Xr fcntl 2 ,
-.Xr lseek 2 ,
-.Xr open 2 ,
-.Xr pipe 2 ,
-.Xr select 2
-.Sh STANDARDS
-The
-.Fn write
-system call is expected to conform to
-.St -p1003.1-90 .
-The
-.Fn writev
-and
-.Fn pwrite
-system calls are expected to conform to
-.St -xpg4.2 .
-.Sh HISTORY
-The
-.Fn pwritev
-system call appeared in
-.Fx 6.0 .
-The
-.Fn pwrite
-function appeared in
-.At V.4 .
-The
-.Fn writev
-system call appeared in
-.Bx 4.2 .
-The
-.Fn write
-function appeared in
-.At v1 .
-.Sh BUGS
-The
-.Fn pwrite
-system call appends the file without changing the file offset if
-.Dv O_APPEND
-is set, contrary to
-.St -p1003.1-2008
-where
-.Fn pwrite
-writes into
-.Fa offset
-regardless of whether
-.Dv O_APPEND
-is set.
diff --git a/lib/libc/sys/write.c b/lib/libc/sys/write.c
index ffb1aa5ffba7..5880856b8af8 100644
--- a/lib/libc/sys/write.c
+++ b/lib/libc/sys/write.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2014 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/syscall.h>
#include <unistd.h>
@@ -44,7 +40,5 @@ __weak_reference(__sys_write, __write);
ssize_t
write(int fd, const void *buf, size_t nbytes)
{
-
- return (((ssize_t (*)(int, const void *, size_t))
- __libc_interposing[INTERPOS_write])(fd, buf, nbytes));
+ return (INTERPOS_SYS(write, fd, buf, nbytes));
}
diff --git a/lib/libc/sys/writev.c b/lib/libc/sys/writev.c
index 20b10053dc59..9a32cb603ab8 100644
--- a/lib/libc/sys/writev.c
+++ b/lib/libc/sys/writev.c
@@ -1,6 +1,5 @@
/*
* Copyright (c) 2014 The FreeBSD Foundation.
- * All rights reserved.
*
* Portions of this software were developed by Konstantin Belousov
* under sponsorship from the FreeBSD Foundation.
@@ -30,9 +29,6 @@
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/syscall.h>
#include <sys/uio.h>
@@ -45,7 +41,5 @@ __weak_reference(__sys_writev, __writev);
ssize_t
writev(int fd, const struct iovec *iov, int iovcnt)
{
-
- return (((ssize_t (*)(int, const struct iovec *, int))
- __libc_interposing[INTERPOS_writev])(fd, iov, iovcnt));
+ return (INTERPOS_SYS(writev, fd, iov, iovcnt));
}
diff --git a/lib/libc/tests/Makefile b/lib/libc/tests/Makefile
index 11c3a635339d..7b262ea646fb 100644
--- a/lib/libc/tests/Makefile
+++ b/lib/libc/tests/Makefile
@@ -1,4 +1,3 @@
-# $FreeBSD$
.include <src.opts.mk>
diff --git a/lib/libc/tests/Makefile.depend b/lib/libc/tests/Makefile.depend
index f80275d86ab1..11aba52f82cf 100644
--- a/lib/libc/tests/Makefile.depend
+++ b/lib/libc/tests/Makefile.depend
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
diff --git a/lib/libc/tests/Makefile.netbsd-tests b/lib/libc/tests/Makefile.netbsd-tests
index 18b0276b7296..98ff48bde5c8 100644
--- a/lib/libc/tests/Makefile.netbsd-tests
+++ b/lib/libc/tests/Makefile.netbsd-tests
@@ -1,4 +1,3 @@
-# $FreeBSD$
TESTSRC:= ${SRCTOP}/contrib/netbsd-tests/${RELDIR:C/libc\/tests/libc/}
diff --git a/lib/libc/tests/c063/Makefile b/lib/libc/tests/c063/Makefile
index 3be612dcaa42..d71ddad1f5f4 100644
--- a/lib/libc/tests/c063/Makefile
+++ b/lib/libc/tests/c063/Makefile
@@ -1,4 +1,3 @@
-# $FreeBSD$
NETBSD_ATF_TESTS_C= faccessat_test
NETBSD_ATF_TESTS_C+= fchmodat_test
diff --git a/lib/libc/tests/c063/Makefile.depend b/lib/libc/tests/c063/Makefile.depend
index 10e58b789640..e89a5c52c82a 100644
--- a/lib/libc/tests/c063/Makefile.depend
+++ b/lib/libc/tests/c063/Makefile.depend
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
diff --git a/lib/libc/tests/db/Makefile b/lib/libc/tests/db/Makefile
index 132cfb321a22..617295b8b145 100644
--- a/lib/libc/tests/db/Makefile
+++ b/lib/libc/tests/db/Makefile
@@ -1,4 +1,3 @@
-# $FreeBSD$
PACKAGE= tests
diff --git a/lib/libc/tests/db/Makefile.depend b/lib/libc/tests/db/Makefile.depend
index 10e58b789640..e89a5c52c82a 100644
--- a/lib/libc/tests/db/Makefile.depend
+++ b/lib/libc/tests/db/Makefile.depend
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
diff --git a/lib/libc/tests/gen/Makefile b/lib/libc/tests/gen/Makefile
index a808f6617ec7..edffdc98b35e 100644
--- a/lib/libc/tests/gen/Makefile
+++ b/lib/libc/tests/gen/Makefile
@@ -1,4 +1,3 @@
-# $FreeBSD$
.include <bsd.own.mk>
diff --git a/lib/libc/tests/gen/Makefile.depend b/lib/libc/tests/gen/Makefile.depend
index a359c100b4e2..33d10e940cd0 100644
--- a/lib/libc/tests/gen/Makefile.depend
+++ b/lib/libc/tests/gen/Makefile.depend
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
diff --git a/lib/libc/tests/gen/arc4random_test.c b/lib/libc/tests/gen/arc4random_test.c
index a28db303e88c..e96ebdc6c6ca 100644
--- a/lib/libc/tests/gen/arc4random_test.c
+++ b/lib/libc/tests/gen/arc4random_test.c
@@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/wait.h>
diff --git a/lib/libc/tests/gen/dir2_test.c b/lib/libc/tests/gen/dir2_test.c
index 3322a5e5086c..4ec5a1759d06 100644
--- a/lib/libc/tests/gen/dir2_test.c
+++ b/lib/libc/tests/gen/dir2_test.c
@@ -31,9 +31,6 @@
* opendir, readdir, seekdir, telldir, closedir, etc
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <dirent.h>
#include <fcntl.h>
#include <stdio.h>
diff --git a/lib/libc/tests/gen/dlopen_empty_test.c b/lib/libc/tests/gen/dlopen_empty_test.c
index 42f9269a10b2..6fb3bf8d8343 100644
--- a/lib/libc/tests/gen/dlopen_empty_test.c
+++ b/lib/libc/tests/gen/dlopen_empty_test.c
@@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/stat.h>
#include <dlfcn.h>
#include <errno.h>
diff --git a/lib/libc/tests/gen/execve/Makefile b/lib/libc/tests/gen/execve/Makefile
index 5e8bc6fb7640..5f563dc8e3cd 100644
--- a/lib/libc/tests/gen/execve/Makefile
+++ b/lib/libc/tests/gen/execve/Makefile
@@ -1,4 +1,3 @@
-# $FreeBSD$
.include <bsd.own.mk>
diff --git a/lib/libc/tests/gen/execve/Makefile.depend b/lib/libc/tests/gen/execve/Makefile.depend
index 10e58b789640..e89a5c52c82a 100644
--- a/lib/libc/tests/gen/execve/Makefile.depend
+++ b/lib/libc/tests/gen/execve/Makefile.depend
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
diff --git a/lib/libc/tests/gen/fmtcheck_test.c b/lib/libc/tests/gen/fmtcheck_test.c
index 3e180c9ca2e6..27a12217e81e 100644
--- a/lib/libc/tests/gen/fmtcheck_test.c
+++ b/lib/libc/tests/gen/fmtcheck_test.c
@@ -28,9 +28,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <err.h>
#include <stdio.h>
diff --git a/lib/libc/tests/gen/fmtmsg_test.c b/lib/libc/tests/gen/fmtmsg_test.c
index aa3ca19425fe..30a5156cdcc8 100644
--- a/lib/libc/tests/gen/fmtmsg_test.c
+++ b/lib/libc/tests/gen/fmtmsg_test.c
@@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/wait.h>
#include <err.h>
diff --git a/lib/libc/tests/gen/fnmatch_test.c b/lib/libc/tests/gen/fnmatch_test.c
index 8d9ead2eff91..6cdf5f2a05fa 100644
--- a/lib/libc/tests/gen/fnmatch_test.c
+++ b/lib/libc/tests/gen/fnmatch_test.c
@@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <errno.h>
#include <stdio.h>
diff --git a/lib/libc/tests/gen/fnmatch_testcases.h b/lib/libc/tests/gen/fnmatch_testcases.h
index 996e13c7756b..196160a4801b 100644
--- a/lib/libc/tests/gen/fnmatch_testcases.h
+++ b/lib/libc/tests/gen/fnmatch_testcases.h
@@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <fnmatch.h>
struct testcase {
diff --git a/lib/libc/tests/gen/fpclassify2_test.c b/lib/libc/tests/gen/fpclassify2_test.c
index a6bb1df3c9f2..45180ac5be42 100644
--- a/lib/libc/tests/gen/fpclassify2_test.c
+++ b/lib/libc/tests/gen/fpclassify2_test.c
@@ -22,8 +22,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$
*/
#include <math.h>
diff --git a/lib/libc/tests/gen/ftw_test.c b/lib/libc/tests/gen/ftw_test.c
index b120f01ff4f1..3d2cf3446dee 100644
--- a/lib/libc/tests/gen/ftw_test.c
+++ b/lib/libc/tests/gen/ftw_test.c
@@ -28,9 +28,6 @@
* Limited test program for nftw() as specified by IEEE Std. 1003.1-2008.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/wait.h>
#include <err.h>
#include <errno.h>
diff --git a/lib/libc/tests/gen/getentropy_test.c b/lib/libc/tests/gen/getentropy_test.c
index 1290e6e50529..156d3a94a7de 100644
--- a/lib/libc/tests/gen/getentropy_test.c
+++ b/lib/libc/tests/gen/getentropy_test.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018 Conrad Meyer <cem@FreeBSD.org>
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <errno.h>
#include <signal.h>
diff --git a/lib/libc/tests/gen/getmntinfo_test.c b/lib/libc/tests/gen/getmntinfo_test.c
index 183fa84ed0e6..06e1091d8a15 100644
--- a/lib/libc/tests/gen/getmntinfo_test.c
+++ b/lib/libc/tests/gen/getmntinfo_test.c
@@ -28,9 +28,6 @@
* Limited test program for getmntinfo(3), a non-standard BSDism.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/ucred.h>
diff --git a/lib/libc/tests/gen/glob2_test.c b/lib/libc/tests/gen/glob2_test.c
index dfcce0eed3da..8f69c36fece7 100644
--- a/lib/libc/tests/gen/glob2_test.c
+++ b/lib/libc/tests/gen/glob2_test.c
@@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <errno.h>
#include <fcntl.h>
diff --git a/lib/libc/tests/gen/makecontext_test.c b/lib/libc/tests/gen/makecontext_test.c
index 50d835d15cbe..23e3cf85f677 100644
--- a/lib/libc/tests/gen/makecontext_test.c
+++ b/lib/libc/tests/gen/makecontext_test.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018 John H. Baldwin <jhb@FreeBSD.org>
*
@@ -25,9 +25,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <atf-c.h>
#include <ucontext.h>
diff --git a/lib/libc/tests/gen/popen_test.c b/lib/libc/tests/gen/popen_test.c
index 5c615b7146e9..43eadd380f39 100644
--- a/lib/libc/tests/gen/popen_test.c
+++ b/lib/libc/tests/gen/popen_test.c
@@ -29,9 +29,6 @@
* with BSD extensions.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/wait.h>
#include <errno.h>
diff --git a/lib/libc/tests/gen/posix_spawn/Makefile b/lib/libc/tests/gen/posix_spawn/Makefile
index 21feba9dce05..7a13fdf501c5 100644
--- a/lib/libc/tests/gen/posix_spawn/Makefile
+++ b/lib/libc/tests/gen/posix_spawn/Makefile
@@ -1,4 +1,3 @@
-# $FreeBSD$
.include <bsd.own.mk>
diff --git a/lib/libc/tests/gen/posix_spawn/Makefile.depend b/lib/libc/tests/gen/posix_spawn/Makefile.depend
index 10e58b789640..e89a5c52c82a 100644
--- a/lib/libc/tests/gen/posix_spawn/Makefile.depend
+++ b/lib/libc/tests/gen/posix_spawn/Makefile.depend
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
diff --git a/lib/libc/tests/gen/posix_spawn_test.c b/lib/libc/tests/gen/posix_spawn_test.c
index 5e2c485473d0..77c3b5a569d9 100644
--- a/lib/libc/tests/gen/posix_spawn_test.c
+++ b/lib/libc/tests/gen/posix_spawn_test.c
@@ -29,9 +29,6 @@
* IEEE Std. 1003.1-2008.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/wait.h>
#include <errno.h>
#include <stdio.h>
@@ -117,17 +114,14 @@ ATF_TC_BODY(posix_spawnp_enoexec_fallback_null_argv0, tc)
{
char buf[FILENAME_MAX];
char *myargs[1];
- int error, status;
- pid_t pid, waitres;
+ int error;
+ pid_t pid;
snprintf(buf, sizeof(buf), "%s/spawnp_enoexec.sh",
atf_tc_get_config_var(tc, "srcdir"));
myargs[0] = NULL;
error = posix_spawnp(&pid, buf, NULL, NULL, myargs, myenv);
- ATF_REQUIRE(error == 0);
- waitres = waitpid(pid, &status, 0);
- ATF_REQUIRE(waitres == pid);
- ATF_REQUIRE(WIFEXITED(status) && WEXITSTATUS(status) == 42);
+ ATF_REQUIRE(error == EINVAL);
}
ATF_TP_ADD_TCS(tp)
diff --git a/lib/libc/tests/gen/realpath2_test.c b/lib/libc/tests/gen/realpath2_test.c
index 82ad7f870697..f89dd99cbb72 100644
--- a/lib/libc/tests/gen/realpath2_test.c
+++ b/lib/libc/tests/gen/realpath2_test.c
@@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <errno.h>
#include <fcntl.h>
diff --git a/lib/libc/tests/gen/sigsetops_test.c b/lib/libc/tests/gen/sigsetops_test.c
index ba9abed403b0..a22c4b3f4f59 100644
--- a/lib/libc/tests/gen/sigsetops_test.c
+++ b/lib/libc/tests/gen/sigsetops_test.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2019 Kyle Evans <kevans@FreeBSD.org>
* All rights reserved.
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <signal.h>
#include <stdbool.h>
diff --git a/lib/libc/tests/gen/spawnp_enoexec.sh b/lib/libc/tests/gen/spawnp_enoexec.sh
index 02941633e108..1050b7a6f944 100755
--- a/lib/libc/tests/gen/spawnp_enoexec.sh
+++ b/lib/libc/tests/gen/spawnp_enoexec.sh
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Intentionally no interpreter
exit 42
diff --git a/lib/libc/tests/gen/test-fnmatch.c b/lib/libc/tests/gen/test-fnmatch.c
index 7771ab37f0a0..1a6c6ed7efdf 100644
--- a/lib/libc/tests/gen/test-fnmatch.c
+++ b/lib/libc/tests/gen/test-fnmatch.c
@@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/lib/libc/tests/gen/wordexp_test.c b/lib/libc/tests/gen/wordexp_test.c
index 3ccc67774c7f..909097fbf51e 100644
--- a/lib/libc/tests/gen/wordexp_test.c
+++ b/lib/libc/tests/gen/wordexp_test.c
@@ -29,9 +29,6 @@
* IEEE Std. 1003.1-2001.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/wait.h>
#include <errno.h>
#include <signal.h>
diff --git a/lib/libc/tests/hash/Makefile b/lib/libc/tests/hash/Makefile
index 7811d455cdc3..009b7d1c5239 100644
--- a/lib/libc/tests/hash/Makefile
+++ b/lib/libc/tests/hash/Makefile
@@ -1,4 +1,3 @@
-# $FreeBSD$
PACKAGE= tests
diff --git a/lib/libc/tests/hash/Makefile.depend b/lib/libc/tests/hash/Makefile.depend
index 81f787db80e9..c969d41de00c 100644
--- a/lib/libc/tests/hash/Makefile.depend
+++ b/lib/libc/tests/hash/Makefile.depend
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
diff --git a/lib/libc/tests/iconv/Makefile b/lib/libc/tests/iconv/Makefile
index 635c26c7cfb7..fd4ab284ebe3 100644
--- a/lib/libc/tests/iconv/Makefile
+++ b/lib/libc/tests/iconv/Makefile
@@ -1,4 +1,3 @@
-# $FreeBSD$
TESTSDIR= ${TESTSBASE}/lib/libc/iconv
diff --git a/lib/libc/tests/iconv/Makefile.depend b/lib/libc/tests/iconv/Makefile.depend
index c062f6026d94..1af0c88e099c 100644
--- a/lib/libc/tests/iconv/Makefile.depend
+++ b/lib/libc/tests/iconv/Makefile.depend
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
diff --git a/lib/libc/tests/iconv/iconvctl_test.c b/lib/libc/tests/iconv/iconvctl_test.c
index 993629e6b4bd..f534218cf294 100644
--- a/lib/libc/tests/iconv/iconvctl_test.c
+++ b/lib/libc/tests/iconv/iconvctl_test.c
@@ -23,9 +23,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <iconv.h>
#include <atf-c.h>
diff --git a/lib/libc/tests/inet/Makefile b/lib/libc/tests/inet/Makefile
index fa4499c9d11b..0c5a1674237d 100644
--- a/lib/libc/tests/inet/Makefile
+++ b/lib/libc/tests/inet/Makefile
@@ -1,4 +1,3 @@
-# $FreeBSD$
.include <bsd.own.mk>
diff --git a/lib/libc/tests/inet/Makefile.depend b/lib/libc/tests/inet/Makefile.depend
index 4be488723cf3..d0eb7a0f9f74 100644
--- a/lib/libc/tests/inet/Makefile.depend
+++ b/lib/libc/tests/inet/Makefile.depend
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
diff --git a/lib/libc/tests/locale/Makefile b/lib/libc/tests/locale/Makefile
index 83caf8cb3bd3..03e89571aacd 100644
--- a/lib/libc/tests/locale/Makefile
+++ b/lib/libc/tests/locale/Makefile
@@ -1,4 +1,3 @@
-# $FreeBSD$
.include <bsd.own.mk>
@@ -13,6 +12,7 @@ ATF_TESTS_C+= mbsnrtowcs_2_test
ATF_TESTS_C+= mbsrtowcs_test
ATF_TESTS_C+= mbstowcs_2_test
ATF_TESTS_C+= mbtowc_2_test
+ATF_TESTS_C+= newlocale_test
ATF_TESTS_C+= towctrans_test
ATF_TESTS_C+= wcrtomb_test
ATF_TESTS_C+= wcsnrtombs_test
diff --git a/lib/libc/tests/locale/Makefile.depend b/lib/libc/tests/locale/Makefile.depend
index 45823695c1bb..e5ddbc552be2 100644
--- a/lib/libc/tests/locale/Makefile.depend
+++ b/lib/libc/tests/locale/Makefile.depend
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
diff --git a/lib/libc/tests/locale/btowc_test.c b/lib/libc/tests/locale/btowc_test.c
index 01a1133e89d5..27e6ff533621 100644
--- a/lib/libc/tests/locale/btowc_test.c
+++ b/lib/libc/tests/locale/btowc_test.c
@@ -31,9 +31,6 @@
* The function is tested in the "C" and "ja_JP.eucJP" locales.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <limits.h>
#include <locale.h>
#include <stdio.h>
diff --git a/lib/libc/tests/locale/c16rtomb_test.c b/lib/libc/tests/locale/c16rtomb_test.c
index ea1f64f7d308..6812fbbc5164 100644
--- a/lib/libc/tests/locale/c16rtomb_test.c
+++ b/lib/libc/tests/locale/c16rtomb_test.c
@@ -30,9 +30,6 @@
* Test program for c16rtomb() as specified by ISO/IEC 9899:2011.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <limits.h>
#include <locale.h>
diff --git a/lib/libc/tests/locale/iswctype_test.c b/lib/libc/tests/locale/iswctype_test.c
index 14e57b4e29a3..79b941522d2b 100644
--- a/lib/libc/tests/locale/iswctype_test.c
+++ b/lib/libc/tests/locale/iswctype_test.c
@@ -31,9 +31,6 @@
* The functions are tested in the "C" and "ja_JP.eucJP" locales.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <errno.h>
#include <locale.h>
diff --git a/lib/libc/tests/locale/mblen_test.c b/lib/libc/tests/locale/mblen_test.c
index fbb938d3e5a6..e081b0d4246a 100644
--- a/lib/libc/tests/locale/mblen_test.c
+++ b/lib/libc/tests/locale/mblen_test.c
@@ -32,9 +32,6 @@
* "ja_JP.eucJP". Other encodings are not tested.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <limits.h>
#include <locale.h>
#include <stdio.h>
diff --git a/lib/libc/tests/locale/mbrlen_test.c b/lib/libc/tests/locale/mbrlen_test.c
index c2bc54832156..50088596fc89 100644
--- a/lib/libc/tests/locale/mbrlen_test.c
+++ b/lib/libc/tests/locale/mbrlen_test.c
@@ -32,9 +32,6 @@
* "ja_JP.eucJP". Other encodings are not tested.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <limits.h>
#include <locale.h>
diff --git a/lib/libc/tests/locale/mbrtoc16_test.c b/lib/libc/tests/locale/mbrtoc16_test.c
index a6289e1004ca..98a140c56fc0 100644
--- a/lib/libc/tests/locale/mbrtoc16_test.c
+++ b/lib/libc/tests/locale/mbrtoc16_test.c
@@ -30,9 +30,6 @@
* Test program for mbrtoc16() as specified by ISO/IEC 9899:2011.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <limits.h>
#include <locale.h>
diff --git a/lib/libc/tests/locale/mbrtowc_test.c b/lib/libc/tests/locale/mbrtowc_test.c
index 37e0bfd6fbaa..df611a7df573 100644
--- a/lib/libc/tests/locale/mbrtowc_test.c
+++ b/lib/libc/tests/locale/mbrtowc_test.c
@@ -32,9 +32,6 @@
* "ja_JP.eucJP". Other encodings are not tested.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <limits.h>
#include <locale.h>
diff --git a/lib/libc/tests/locale/mbsnrtowcs_test.c b/lib/libc/tests/locale/mbsnrtowcs_test.c
index 4012b7e99720..a355bc7d7a6a 100644
--- a/lib/libc/tests/locale/mbsnrtowcs_test.c
+++ b/lib/libc/tests/locale/mbsnrtowcs_test.c
@@ -31,9 +31,6 @@
* "ja_JP.eucJP". Other encodings are not tested.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <limits.h>
#include <locale.h>
diff --git a/lib/libc/tests/locale/mbsrtowcs_test.c b/lib/libc/tests/locale/mbsrtowcs_test.c
index 1b9d5c933af1..d8d215fda2ad 100644
--- a/lib/libc/tests/locale/mbsrtowcs_test.c
+++ b/lib/libc/tests/locale/mbsrtowcs_test.c
@@ -32,9 +32,6 @@
* "ja_JP.eucJP". Other encodings are not tested.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <limits.h>
#include <locale.h>
diff --git a/lib/libc/tests/locale/mbstowcs_test.c b/lib/libc/tests/locale/mbstowcs_test.c
index 77b0e9e52f35..404adfd7b19a 100644
--- a/lib/libc/tests/locale/mbstowcs_test.c
+++ b/lib/libc/tests/locale/mbstowcs_test.c
@@ -32,9 +32,6 @@
* "ja_JP.eucJP". Other encodings are not tested.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <limits.h>
#include <locale.h>
diff --git a/lib/libc/tests/locale/mbtowc_test.c b/lib/libc/tests/locale/mbtowc_test.c
index 7c7f80eb5cc4..e5ff276b4610 100644
--- a/lib/libc/tests/locale/mbtowc_test.c
+++ b/lib/libc/tests/locale/mbtowc_test.c
@@ -32,9 +32,6 @@
* "ja_JP.eucJP". Other encodings are not tested.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <limits.h>
#include <locale.h>
#include <stdio.h>
diff --git a/lib/libc/tests/locale/newlocale_test.c b/lib/libc/tests/locale/newlocale_test.c
new file mode 100644
index 000000000000..cb0ebb323a42
--- /dev/null
+++ b/lib/libc/tests/locale/newlocale_test.c
@@ -0,0 +1,111 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright 2023 Yuri Pankov <yuripv@FreeBSD.org>
+ *
+ * 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 AUTHOR 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 AUTHOR 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.
+ */
+
+#include <sys/param.h>
+
+#include <locale.h>
+
+#include <atf-c.h>
+
+struct {
+ int lpmask;
+ const char *lpname;
+} lparts[] = {
+ { LC_COLLATE_MASK, "LC_COLLATE" },
+ { LC_CTYPE_MASK, "LC_CTYPE" },
+ { LC_MONETARY_MASK, "LC_MONETARY" },
+ { LC_NUMERIC_MASK, "LC_NUMERIC" },
+ { LC_TIME_MASK, "LC_TIME" },
+ { LC_MESSAGES_MASK, "LC_MESSAGES" },
+};
+
+static void
+check_lparts(const char *expected)
+{
+ int i;
+
+ for (i = 0; i < nitems(lparts); i++) {
+ const char *actual;
+
+ actual = querylocale(lparts[i].lpmask, uselocale(NULL));
+ ATF_CHECK_STREQ_MSG(expected, actual, "wrong value for %s",
+ lparts[i].lpname);
+ }
+}
+
+static void
+do_locale_switch(const char *loc1, const char *loc2)
+{
+ locale_t l1, l2;
+
+ /* Create and use the first locale */
+ l1 = newlocale(LC_ALL_MASK, loc1, NULL);
+ ATF_REQUIRE(l1 != NULL);
+ ATF_REQUIRE(uselocale(l1) != NULL);
+ check_lparts(loc1);
+ /*
+ * Create and use second locale, creation deliberately done only after
+ * the first locale check as newlocale() call would previously clobber
+ * the first locale contents.
+ */
+ l2 = newlocale(LC_ALL_MASK, loc2, NULL);
+ ATF_REQUIRE(l2 != NULL);
+ ATF_REQUIRE(uselocale(l2) != NULL);
+ check_lparts(loc2);
+ /* Switch back to first locale */
+ ATF_REQUIRE(uselocale(l1) != NULL);
+ check_lparts(loc1);
+
+ freelocale(l1);
+ freelocale(l2);
+}
+
+/*
+ * PR 255646, 269375: Check that newlocale()/uselocale() used to switch between
+ * C, POSIX, and C.UTF-8 locales (and only these) do not stomp on other locale
+ * contents (collate part specifically).
+ * The issue is cosmetic only as all three have empty collate parts, but we need
+ * to correctly report the one in use in any case.
+ */
+
+ATF_TC_WITHOUT_HEAD(newlocale_c_posix_cu8_test);
+ATF_TC_BODY(newlocale_c_posix_cu8_test, tc)
+{
+ do_locale_switch("C", "POSIX");
+ do_locale_switch("C", "C.UTF-8");
+ do_locale_switch("POSIX", "C");
+ do_locale_switch("POSIX", "C.UTF-8");
+ do_locale_switch("C.UTF-8", "C");
+ do_locale_switch("C.UTF-8", "POSIX");
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+ ATF_TP_ADD_TC(tp, newlocale_c_posix_cu8_test);
+
+ return (atf_no_error());
+}
diff --git a/lib/libc/tests/locale/towctrans_test.c b/lib/libc/tests/locale/towctrans_test.c
index bb9d97ca2e54..f34eb554f283 100644
--- a/lib/libc/tests/locale/towctrans_test.c
+++ b/lib/libc/tests/locale/towctrans_test.c
@@ -31,9 +31,6 @@
* The functions are tested in the "C" and "ja_JP.eucJP" locales.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <locale.h>
#include <stdio.h>
#include <string.h>
diff --git a/lib/libc/tests/locale/wcrtomb_test.c b/lib/libc/tests/locale/wcrtomb_test.c
index 09199ba97c99..2bc7cbc2365f 100644
--- a/lib/libc/tests/locale/wcrtomb_test.c
+++ b/lib/libc/tests/locale/wcrtomb_test.c
@@ -32,9 +32,6 @@
* "ja_JP.eucJP". Other encodings are not tested.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <limits.h>
#include <locale.h>
diff --git a/lib/libc/tests/locale/wcsnrtombs_test.c b/lib/libc/tests/locale/wcsnrtombs_test.c
index 2e330a10ad83..8764c1567066 100644
--- a/lib/libc/tests/locale/wcsnrtombs_test.c
+++ b/lib/libc/tests/locale/wcsnrtombs_test.c
@@ -31,9 +31,6 @@
* "ja_JP.eucJP". Other encodings are not tested.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <limits.h>
#include <locale.h>
diff --git a/lib/libc/tests/locale/wcsrtombs_test.c b/lib/libc/tests/locale/wcsrtombs_test.c
index 4c3455a87769..dcb111dfd87c 100644
--- a/lib/libc/tests/locale/wcsrtombs_test.c
+++ b/lib/libc/tests/locale/wcsrtombs_test.c
@@ -32,9 +32,6 @@
* "ja_JP.eucJP". Other encodings are not tested.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <limits.h>
#include <locale.h>
diff --git a/lib/libc/tests/locale/wcstombs_test.c b/lib/libc/tests/locale/wcstombs_test.c
index f3fcd81001f1..2506be2806f6 100644
--- a/lib/libc/tests/locale/wcstombs_test.c
+++ b/lib/libc/tests/locale/wcstombs_test.c
@@ -32,9 +32,6 @@
* "ja_JP.eucJP". Other encodings are not tested.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <limits.h>
#include <locale.h>
diff --git a/lib/libc/tests/locale/wctomb_test.c b/lib/libc/tests/locale/wctomb_test.c
index 255cda432d7d..1e142ed74c48 100644
--- a/lib/libc/tests/locale/wctomb_test.c
+++ b/lib/libc/tests/locale/wctomb_test.c
@@ -32,9 +32,6 @@
* "ja_JP.eucJP". Other encodings are not tested.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <limits.h>
#include <locale.h>
diff --git a/lib/libc/tests/net/Makefile b/lib/libc/tests/net/Makefile
index 14ab914e67ef..6e90f22b98f5 100644
--- a/lib/libc/tests/net/Makefile
+++ b/lib/libc/tests/net/Makefile
@@ -1,4 +1,3 @@
-# $FreeBSD$
PACKAGE= tests
diff --git a/lib/libc/tests/net/Makefile.depend b/lib/libc/tests/net/Makefile.depend
index 22a01a72015a..daaf971bd513 100644
--- a/lib/libc/tests/net/Makefile.depend
+++ b/lib/libc/tests/net/Makefile.depend
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
diff --git a/lib/libc/tests/net/ether_test.c b/lib/libc/tests/net/ether_test.c
index 5b596f01a439..fbeed15efaa7 100644
--- a/lib/libc/tests/net/ether_test.c
+++ b/lib/libc/tests/net/ether_test.c
@@ -22,8 +22,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$
*/
#include <sys/types.h>
diff --git a/lib/libc/tests/net/eui64_aton_test.c b/lib/libc/tests/net/eui64_aton_test.c
index 7b97d7fb0521..a4b09695fda9 100644
--- a/lib/libc/tests/net/eui64_aton_test.c
+++ b/lib/libc/tests/net/eui64_aton_test.c
@@ -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$
*/
#include <sys/types.h>
diff --git a/lib/libc/tests/net/eui64_ntoa_test.c b/lib/libc/tests/net/eui64_ntoa_test.c
index 4158e7a42cce..1da80fc2ea02 100644
--- a/lib/libc/tests/net/eui64_ntoa_test.c
+++ b/lib/libc/tests/net/eui64_ntoa_test.c
@@ -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$
*/
#include <sys/types.h>
diff --git a/lib/libc/tests/net/getaddrinfo/Makefile b/lib/libc/tests/net/getaddrinfo/Makefile
index 96b60d2a9792..c9c9fba7d53c 100644
--- a/lib/libc/tests/net/getaddrinfo/Makefile
+++ b/lib/libc/tests/net/getaddrinfo/Makefile
@@ -1,4 +1,3 @@
-# $FreeBSD$
PACKAGE= tests
@@ -8,7 +7,7 @@ TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/libc/net/${.CURDIR:T}
BINDIR= ${TESTSDIR}
-.error "This testcase needs to be ported to FreeBSD (the output from getaddrinfo_test differs from NetBSD)"
+.error This testcase needs to be ported to FreeBSD (the output from getaddrinfo_test differs from NetBSD)
NETBSD_ATF_TESTS_SH= getaddrinfo_test
diff --git a/lib/libc/tests/net/test-eui64.h b/lib/libc/tests/net/test-eui64.h
index ea82a10c1487..8bb5fbb956b7 100644
--- a/lib/libc/tests/net/test-eui64.h
+++ b/lib/libc/tests/net/test-eui64.h
@@ -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 _TEST_EUI64_H
#define _TEST_EUI64_H
diff --git a/lib/libc/tests/nss/Makefile b/lib/libc/tests/nss/Makefile
index c2f6e0940c07..df85dd463937 100644
--- a/lib/libc/tests/nss/Makefile
+++ b/lib/libc/tests/nss/Makefile
@@ -1,4 +1,3 @@
-# $FreeBSD$
.PATH: ${.CURDIR:H}/resolv
diff --git a/lib/libc/tests/nss/Makefile.depend b/lib/libc/tests/nss/Makefile.depend
index d313b17d4486..f17dae18048f 100644
--- a/lib/libc/tests/nss/Makefile.depend
+++ b/lib/libc/tests/nss/Makefile.depend
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
diff --git a/lib/libc/tests/nss/getaddrinfo_test.c b/lib/libc/tests/nss/getaddrinfo_test.c
index aeac04110510..4528e272a46f 100644
--- a/lib/libc/tests/nss/getaddrinfo_test.c
+++ b/lib/libc/tests/nss/getaddrinfo_test.c
@@ -25,9 +25,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/socket.h>
#include <arpa/inet.h>
diff --git a/lib/libc/tests/nss/getgr_test.c b/lib/libc/tests/nss/getgr_test.c
index 63dfea085095..7c0e265fa6f6 100644
--- a/lib/libc/tests/nss/getgr_test.c
+++ b/lib/libc/tests/nss/getgr_test.c
@@ -25,9 +25,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <arpa/inet.h>
#include <errno.h>
#include <grp.h>
diff --git a/lib/libc/tests/nss/gethostby_test.c b/lib/libc/tests/nss/gethostby_test.c
index 39dbb9d9d55a..0ed96170fc6d 100644
--- a/lib/libc/tests/nss/gethostby_test.c
+++ b/lib/libc/tests/nss/gethostby_test.c
@@ -25,9 +25,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/socket.h>
#include <arpa/inet.h>
diff --git a/lib/libc/tests/nss/getproto_test.c b/lib/libc/tests/nss/getproto_test.c
index 8de4ee60fdac..9b8250e47032 100644
--- a/lib/libc/tests/nss/getproto_test.c
+++ b/lib/libc/tests/nss/getproto_test.c
@@ -25,9 +25,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <arpa/inet.h>
#include <assert.h>
#include <errno.h>
diff --git a/lib/libc/tests/nss/getpw_test.c b/lib/libc/tests/nss/getpw_test.c
index 1d9ae6c1a5db..3a44497cf848 100644
--- a/lib/libc/tests/nss/getpw_test.c
+++ b/lib/libc/tests/nss/getpw_test.c
@@ -25,9 +25,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <pwd.h>
#include <stdio.h>
diff --git a/lib/libc/tests/nss/getrpc_test.c b/lib/libc/tests/nss/getrpc_test.c
index 9be2349f2f90..6cca3cab9e86 100644
--- a/lib/libc/tests/nss/getrpc_test.c
+++ b/lib/libc/tests/nss/getrpc_test.c
@@ -25,9 +25,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <arpa/inet.h>
#include <rpc/rpc.h>
#include <errno.h>
diff --git a/lib/libc/tests/nss/getserv_test.c b/lib/libc/tests/nss/getserv_test.c
index 56dc6611f1ba..486a8c20836f 100644
--- a/lib/libc/tests/nss/getserv_test.c
+++ b/lib/libc/tests/nss/getserv_test.c
@@ -25,9 +25,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <arpa/inet.h>
#include <errno.h>
#include <netdb.h>
diff --git a/lib/libc/tests/nss/getusershell_test.c b/lib/libc/tests/nss/getusershell_test.c
index e5c4b6755263..ac23792fde8e 100644
--- a/lib/libc/tests/nss/getusershell_test.c
+++ b/lib/libc/tests/nss/getusershell_test.c
@@ -25,9 +25,6 @@
*
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <assert.h>
#include <errno.h>
#include <stdio.h>
diff --git a/lib/libc/tests/nss/testutil.h b/lib/libc/tests/nss/testutil.h
index 7b55e16580d1..1f7b8086ec49 100644
--- a/lib/libc/tests/nss/testutil.h
+++ b/lib/libc/tests/nss/testutil.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$
*/
#include <sys/queue.h>
diff --git a/lib/libc/tests/regex/Makefile b/lib/libc/tests/regex/Makefile
index 8c1c5d06961f..00f681c0751f 100644
--- a/lib/libc/tests/regex/Makefile
+++ b/lib/libc/tests/regex/Makefile
@@ -1,4 +1,3 @@
-# $FreeBSD$
PACKAGE= tests
diff --git a/lib/libc/tests/regex/Makefile.depend b/lib/libc/tests/regex/Makefile.depend
index 1b5e74fae1b0..9df74fa6efd2 100644
--- a/lib/libc/tests/regex/Makefile.depend
+++ b/lib/libc/tests/regex/Makefile.depend
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
diff --git a/lib/libc/tests/regex/Makefile.inc b/lib/libc/tests/regex/Makefile.inc
index 9e0584bd73e3..1af987faa15e 100644
--- a/lib/libc/tests/regex/Makefile.inc
+++ b/lib/libc/tests/regex/Makefile.inc
@@ -1,4 +1,3 @@
-# $FreeBSD$
.include <bsd.own.mk>
diff --git a/lib/libc/tests/regex/multibyte.sh b/lib/libc/tests/regex/multibyte.sh
index 3ab02118f623..18323f500a2b 100755
--- a/lib/libc/tests/regex/multibyte.sh
+++ b/lib/libc/tests/regex/multibyte.sh
@@ -1,5 +1,3 @@
-# $FreeBSD$
-
atf_test_case bmpat
bmpat_head()
{
@@ -46,8 +44,50 @@ icase_body()
echo $c | atf_check -o "inline:$c\n" sed -ne "/$a/Ip"
}
+atf_test_case mbset cleanup
+mbset_head()
+{
+ atf_set "descr" "Check multibyte sets matching"
+}
+mbset_body()
+{
+ export LC_CTYPE="C.UTF-8"
+
+ # This involved an erroneously implemented optimization which reduces
+ # single-element sets to an exact match with a single codepoint.
+ # Match sets record small-codepoint characters in a bitmap and
+ # large-codepoint characters in an array; the optimization would falsely
+ # trigger if either the bitmap or the array was a singleton, ignoring
+ # the members of the other side of the set.
+ #
+ # To exercise this, we construct sets which have one member of one side
+ # and one or more of the other, and verify that all members can be
+ # found.
+ printf "a" > mbset; atf_check -o not-empty sed -ne '/[aà]/p' mbset
+ printf "à" > mbset; atf_check -o not-empty sed -ne '/[aà]/p' mbset
+ printf "a" > mbset; atf_check -o not-empty sed -ne '/[aàá]/p' mbset
+ printf "à" > mbset; atf_check -o not-empty sed -ne '/[aàá]/p' mbset
+ printf "á" > mbset; atf_check -o not-empty sed -ne '/[aàá]/p' mbset
+ printf "à" > mbset; atf_check -o not-empty sed -ne '/[abà]/p' mbset
+ printf "a" > mbset; atf_check -o not-empty sed -ne '/[abà]/p' mbset
+ printf "b" > mbset; atf_check -o not-empty sed -ne '/[abà]/p' mbset
+ printf "a" > mbset; atf_check -o not-empty sed -Ene '/[aà]/p' mbset
+ printf "à" > mbset; atf_check -o not-empty sed -Ene '/[aà]/p' mbset
+ printf "a" > mbset; atf_check -o not-empty sed -Ene '/[aàá]/p' mbset
+ printf "à" > mbset; atf_check -o not-empty sed -Ene '/[aàá]/p' mbset
+ printf "á" > mbset; atf_check -o not-empty sed -Ene '/[aàá]/p' mbset
+ printf "à" > mbset; atf_check -o not-empty sed -Ene '/[abà]/p' mbset
+ printf "a" > mbset; atf_check -o not-empty sed -Ene '/[abà]/p' mbset
+ printf "b" > mbset; atf_check -o not-empty sed -Ene '/[abà]/p' mbset
+}
+mbset_cleanup()
+{
+ rm -f mbset
+}
+
atf_init_test_cases()
{
atf_add_test_case bmpat
atf_add_test_case icase
+ atf_add_test_case mbset
}
diff --git a/lib/libc/tests/resolv/Makefile b/lib/libc/tests/resolv/Makefile
index cb82da67c4f7..f1c00f7ea5c9 100644
--- a/lib/libc/tests/resolv/Makefile
+++ b/lib/libc/tests/resolv/Makefile
@@ -1,4 +1,3 @@
-# $FreeBSD$
PACKAGE= tests
diff --git a/lib/libc/tests/resolv/Makefile.depend b/lib/libc/tests/resolv/Makefile.depend
index c3293e1c797c..e14b2568ac65 100644
--- a/lib/libc/tests/resolv/Makefile.depend
+++ b/lib/libc/tests/resolv/Makefile.depend
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
diff --git a/lib/libc/tests/resolv/mach b/lib/libc/tests/resolv/mach
index 4b47ebb73448..df57df90e0a0 100644
--- a/lib/libc/tests/resolv/mach
+++ b/lib/libc/tests/resolv/mach
@@ -1,4 +1,3 @@
-# $FreeBSD$
localhost
anoncvs.cirr.com
anoncvs.netbsd.se
diff --git a/lib/libc/tests/resolv/resolv_test.c b/lib/libc/tests/resolv/resolv_test.c
index 4f17469fa0cb..d7b836ed8f3e 100644
--- a/lib/libc/tests/resolv/resolv_test.c
+++ b/lib/libc/tests/resolv/resolv_test.c
@@ -28,7 +28,6 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-/* $FreeBSD$ */
#include <sys/cdefs.h>
__RCSID("$NetBSD: resolv.c,v 1.6 2004/05/23 16:59:11 christos Exp $");
diff --git a/lib/libc/tests/rpc/Makefile b/lib/libc/tests/rpc/Makefile
index d7780ef4b86c..8c908ce40c6f 100644
--- a/lib/libc/tests/rpc/Makefile
+++ b/lib/libc/tests/rpc/Makefile
@@ -1,4 +1,3 @@
-# $FreeBSD$
SRCS.xdr_test= ${RPCSRC:.x=_xdr.c} t_xdr.c ${RPCSRC:.x=.h} \
h_testbits.h
diff --git a/lib/libc/tests/rpc/Makefile.depend b/lib/libc/tests/rpc/Makefile.depend
index ad95e3223964..50e2a6c3c778 100644
--- a/lib/libc/tests/rpc/Makefile.depend
+++ b/lib/libc/tests/rpc/Makefile.depend
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
diff --git a/lib/libc/tests/setjmp/Makefile b/lib/libc/tests/setjmp/Makefile
index 39b0a96295f4..309a5c82c462 100644
--- a/lib/libc/tests/setjmp/Makefile
+++ b/lib/libc/tests/setjmp/Makefile
@@ -1,4 +1,3 @@
-# $FreeBSD$
NETBSD_ATF_TESTS_C= setjmp_test
NETBSD_ATF_TESTS_C+= threadjmp_test
diff --git a/lib/libc/tests/setjmp/Makefile.depend b/lib/libc/tests/setjmp/Makefile.depend
index 10e58b789640..e89a5c52c82a 100644
--- a/lib/libc/tests/setjmp/Makefile.depend
+++ b/lib/libc/tests/setjmp/Makefile.depend
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
diff --git a/lib/libc/tests/ssp/Makefile b/lib/libc/tests/ssp/Makefile
index 452c57246e39..22f48d7dfe54 100644
--- a/lib/libc/tests/ssp/Makefile
+++ b/lib/libc/tests/ssp/Makefile
@@ -1,4 +1,3 @@
-# $FreeBSD$
.include <bsd.own.mk>
@@ -11,6 +10,7 @@ CFLAGS.h_raw+= -fstack-protector-all -Wstack-protector
# override the sanitizer runtime libraries to be the ones installed on the
# target system.
CFLAGS.h_raw+= -fsanitize=bounds
+LIBADD+=sys
.elif ${COMPILER_TYPE} == "gcc"
CFLAGS.h_raw+= --param ssp-buffer-size=1
LDADD+= -lssp
@@ -38,7 +38,7 @@ PROGS+= h_raw
LDADD.h_raw+= ${SANITIZER_LDFLAGS}
.else
.if make(all)
-.info "Could not find runtime library ${_libclang_rt_ubsan}, skipping h_raw"
+.info Could not find runtime library ${_libclang_rt_ubsan}, skipping h_raw
.endif
.endif
.endif
diff --git a/lib/libc/tests/ssp/Makefile.depend b/lib/libc/tests/ssp/Makefile.depend
index cf65fef9f923..a3475b45b52e 100644
--- a/lib/libc/tests/ssp/Makefile.depend
+++ b/lib/libc/tests/ssp/Makefile.depend
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
diff --git a/lib/libc/tests/stdio/Makefile b/lib/libc/tests/stdio/Makefile
index 248a05bc45e7..f0822601e34b 100644
--- a/lib/libc/tests/stdio/Makefile
+++ b/lib/libc/tests/stdio/Makefile
@@ -1,8 +1,9 @@
-# $FreeBSD$
.include <bsd.own.mk>
+ATF_TESTS_C+= eintr_test
ATF_TESTS_C+= fdopen_test
+ATF_TESTS_C+= flushlbuf_test
ATF_TESTS_C+= fmemopen2_test
ATF_TESTS_C+= fopen2_test
ATF_TESTS_C+= freopen_test
@@ -16,6 +17,10 @@ ATF_TESTS_C+= print_positional_test
ATF_TESTS_C+= printbasic_test
ATF_TESTS_C+= printfloat_test
ATF_TESTS_C+= scanfloat_test
+ATF_TESTS_C+= snprintf_test
+ATF_TESTS_C+= sscanf_test
+ATF_TESTS_C+= swprintf_test
+ATF_TESTS_C+= swscanf_test
SRCS.fopen2_test= fopen_test.c
@@ -30,12 +35,19 @@ NETBSD_ATF_TESTS_C+= popen_test
NETBSD_ATF_TESTS_C+= printf_test
NETBSD_ATF_TESTS_C+= scanf_test
+LIBADD.eintr_test+= md
LIBADD.printfloat_test+= m
LIBADD.scanfloat_test+= m
+# Older toolchains won't understand C23 %b, %wN, %wfN
+PROG_OVERRIDE_VARS+= NO_WFORMAT
+NO_WFORMAT.snprintf_test=
+NO_WFORMAT.sscanf_test=
+NO_WFORMAT.swprintf_test=
+NO_WFORMAT.swscanf_test=
+
.if ${COMPILER_TYPE} == "gcc"
# 90: use of assignment suppression and length modifier together in scanf format
-PROG_OVERRIDE_VARS+= NO_WFORMAT
NO_WFORMAT.scanfloat_test=
.endif
diff --git a/lib/libc/tests/stdio/Makefile.depend b/lib/libc/tests/stdio/Makefile.depend
index 45823695c1bb..e5ddbc552be2 100644
--- a/lib/libc/tests/stdio/Makefile.depend
+++ b/lib/libc/tests/stdio/Makefile.depend
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
diff --git a/lib/libc/tests/stdio/eintr_test.c b/lib/libc/tests/stdio/eintr_test.c
new file mode 100644
index 000000000000..55354c8926c5
--- /dev/null
+++ b/lib/libc/tests/stdio/eintr_test.c
@@ -0,0 +1,143 @@
+/*
+ * Initially written by Yar Tikhiy <yar@freebsd.org> in PR 76398.
+ * Bug fixes and instrumentation by kib@freebsd.org.
+ */
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <err.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <md5.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include <atf-c.h>
+
+#define NDATA 1000
+#define DELAY 2
+
+static void
+hup(int signo __unused)
+{
+}
+
+static int ndata, seq;
+
+static void
+setdata(int n)
+{
+ ndata = n;
+ seq = 0;
+}
+
+static char *
+getdata(void)
+{
+ static char databuf[256];
+ static char xeof[] = "#";
+
+ if (seq > ndata)
+ return (NULL);
+ if (seq == ndata) {
+ seq++;
+ return (xeof);
+ }
+ sprintf(databuf, "%08d xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n", seq++);
+ return (databuf);
+}
+
+ATF_TC_WITHOUT_HEAD(eintr_test);
+ATF_TC_BODY(eintr_test, tc)
+{
+ char c, digest0[33], digest[33], *p;
+ FILE *fp;
+ int i, s[2], total0, total;
+ MD5_CTX md5;
+ pid_t child;
+ struct sigaction sa;
+
+ MD5Init(&md5);
+ setdata(NDATA);
+ for (total0 = 0; (p = getdata()) != NULL; total0 += strlen(p))
+ MD5Update(&md5, p, strlen(p));
+ p = MD5End(&md5, digest0);
+
+ sa.sa_handler = hup;
+ sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+ ATF_REQUIRE(sigaction(SIGHUP, &sa, NULL) == 0);
+
+ ATF_REQUIRE(socketpair(PF_UNIX, SOCK_STREAM, 0, s) == 0);
+
+ switch (child = fork()) {
+ case -1:
+ atf_tc_fail("fork failed %s", strerror(errno));
+ break;
+
+ case 0:
+ ATF_REQUIRE((fp = fdopen(s[0], "w")) != NULL);
+ close(s[1]);
+ setdata(NDATA);
+ while ((p = getdata())) {
+ for (; *p;) {
+ if (fputc(*p, fp) == EOF) {
+ if (errno == EINTR) {
+ clearerr(fp);
+ } else {
+ atf_tc_fail("fputc errno %s",
+ strerror(errno));
+ }
+ } else {
+ p++;
+ }
+ }
+ }
+ fclose(fp);
+ break;
+
+ default:
+ close(s[0]);
+ ATF_REQUIRE((fp = fdopen(s[1], "r")) != NULL);
+ sleep(DELAY);
+ ATF_REQUIRE(kill(child, SIGHUP) != -1);
+ sleep(DELAY);
+ MD5Init(&md5);
+ for (total = 0;;) {
+ i = fgetc(fp);
+ if (i == EOF) {
+ if (errno == EINTR) {
+ clearerr(fp);
+ } else {
+ atf_tc_fail("fgetc errno %s",
+ strerror(errno));
+ }
+ continue;
+ }
+ total++;
+ c = i;
+ MD5Update(&md5, &c, 1);
+ if (i == '#')
+ break;
+ }
+ MD5End(&md5, digest);
+ fclose(fp);
+ ATF_REQUIRE_MSG(total == total0,
+ "Total number of bytes read does not match: %d %d",
+ total, total0);
+ ATF_REQUIRE_MSG(strcmp(digest, digest0) == 0,
+ "Digests do not match %s %s", digest, digest0);
+ break;
+ }
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+ ATF_TP_ADD_TC(tp, eintr_test);
+ return (atf_no_error());
+}
diff --git a/lib/libc/tests/stdio/fdopen_test.c b/lib/libc/tests/stdio/fdopen_test.c
index 060635af498b..5abaed7375b6 100644
--- a/lib/libc/tests/stdio/fdopen_test.c
+++ b/lib/libc/tests/stdio/fdopen_test.c
@@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <fcntl.h>
#include <paths.h>
diff --git a/lib/libc/tests/stdio/flushlbuf_test.c b/lib/libc/tests/stdio/flushlbuf_test.c
new file mode 100644
index 000000000000..11d9ea4ecc6c
--- /dev/null
+++ b/lib/libc/tests/stdio/flushlbuf_test.c
@@ -0,0 +1,155 @@
+/*-
+ * Copyright (c) 2023 Klara, Inc.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <errno.h>
+#include <stdio.h>
+
+#include <atf-c.h>
+
+#define BUFSIZE 16
+
+static const char seq[] =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "abcdefghijklmnopqrstuvwxyz"
+ "0123456789+/";
+
+struct stream {
+ char buf[BUFSIZE];
+ unsigned int len;
+ unsigned int pos;
+};
+
+static int writefn(void *cookie, const char *buf, int len)
+{
+ struct stream *s = cookie;
+ int written = 0;
+
+ if (len <= 0)
+ return 0;
+ while (len > 0 && s->pos < s->len) {
+ s->buf[s->pos++] = *buf++;
+ written++;
+ len--;
+ }
+ if (written > 0)
+ return written;
+ errno = EAGAIN;
+ return -1;
+}
+
+ATF_TC_WITHOUT_HEAD(flushlbuf_partial);
+ATF_TC_BODY(flushlbuf_partial, tc)
+{
+ static struct stream s;
+ static char buf[BUFSIZE + 1];
+ FILE *f;
+ unsigned int i = 0;
+ int ret = 0;
+
+ /*
+ * Create the stream and its buffer, print just enough characters
+ * to the stream to fill the buffer without triggering a flush,
+ * then check the state.
+ */
+ s.len = BUFSIZE / 2; // write will fail after this amount
+ ATF_REQUIRE((f = fwopen(&s, writefn)) != NULL);
+ ATF_REQUIRE(setvbuf(f, buf, _IOLBF, BUFSIZE) == 0);
+ while (i < BUFSIZE)
+ if ((ret = fprintf(f, "%c", seq[i++])) < 0)
+ break;
+ ATF_CHECK_EQ(BUFSIZE, i);
+ ATF_CHECK_EQ(seq[i - 1], buf[BUFSIZE - 1]);
+ ATF_CHECK_EQ(1, ret);
+ ATF_CHECK_EQ(0, s.pos);
+
+ /*
+ * At this point, the buffer is full but writefn() has not yet
+ * been called. The next fprintf() call will trigger a preemptive
+ * fflush(), and writefn() will consume s.len characters before
+ * returning EAGAIN, causing fprintf() to fail without having
+ * written anything (which is why we don't increment i here).
+ */
+ ret = fprintf(f, "%c", seq[i]);
+ ATF_CHECK_ERRNO(EAGAIN, ret < 0);
+ ATF_CHECK_EQ(s.len, s.pos);
+
+ /*
+ * We have consumed s.len characters from the buffer, so continue
+ * printing until it is full again and check that no overflow has
+ * occurred yet.
+ */
+ while (i < BUFSIZE + s.len)
+ fprintf(f, "%c", seq[i++]);
+ ATF_CHECK_EQ(BUFSIZE + s.len, i);
+ ATF_CHECK_EQ(seq[i - 1], buf[BUFSIZE - 1]);
+ ATF_CHECK_EQ(0, buf[BUFSIZE]);
+
+ /*
+ * The straw that breaks the camel's back: libc fails to recognize
+ * that the buffer is full and continues to write beyond its end.
+ */
+ fprintf(f, "%c", seq[i++]);
+ ATF_CHECK_EQ(0, buf[BUFSIZE]);
+}
+
+ATF_TC_WITHOUT_HEAD(flushlbuf_full);
+ATF_TC_BODY(flushlbuf_full, tc)
+{
+ static struct stream s;
+ static char buf[BUFSIZE];
+ FILE *f;
+ unsigned int i = 0;
+ int ret = 0;
+
+ /*
+ * Create the stream and its buffer, print just enough characters
+ * to the stream to fill the buffer without triggering a flush,
+ * then check the state.
+ */
+ s.len = 0; // any attempt to write will fail
+ ATF_REQUIRE((f = fwopen(&s, writefn)) != NULL);
+ ATF_REQUIRE(setvbuf(f, buf, _IOLBF, BUFSIZE) == 0);
+ while (i < BUFSIZE)
+ if ((ret = fprintf(f, "%c", seq[i++])) < 0)
+ break;
+ ATF_CHECK_EQ(BUFSIZE, i);
+ ATF_CHECK_EQ(seq[i - 1], buf[BUFSIZE - 1]);
+ ATF_CHECK_EQ(1, ret);
+ ATF_CHECK_EQ(0, s.pos);
+
+ /*
+ * At this point, the buffer is full but writefn() has not yet
+ * been called. The next fprintf() call will trigger a preemptive
+ * fflush(), and writefn() will immediately return EAGAIN, causing
+ * fprintf() to fail without having written anything (which is why
+ * we don't increment i here).
+ */
+ ret = fprintf(f, "%c", seq[i]);
+ ATF_CHECK_ERRNO(EAGAIN, ret < 0);
+ ATF_CHECK_EQ(s.len, s.pos);
+
+ /*
+ * Now make our stream writeable.
+ */
+ s.len = sizeof(s.buf);
+
+ /*
+ * Flush the stream again. The data we failed to write previously
+ * should still be in the buffer and will now be written to the
+ * stream.
+ */
+ ATF_CHECK_EQ(0, fflush(f));
+ ATF_CHECK_EQ(seq[0], s.buf[0]);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+
+ ATF_TP_ADD_TC(tp, flushlbuf_partial);
+ ATF_TP_ADD_TC(tp, flushlbuf_full);
+
+ return (atf_no_error());
+}
diff --git a/lib/libc/tests/stdio/fmemopen2_test.c b/lib/libc/tests/stdio/fmemopen2_test.c
index a2ca3257fe4e..2e1b9ea917a5 100644
--- a/lib/libc/tests/stdio/fmemopen2_test.c
+++ b/lib/libc/tests/stdio/fmemopen2_test.c
@@ -28,9 +28,6 @@ SUCH DAMAGE.
* a FILE * retrieved using fmemopen()
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <stdio.h>
#include <string.h>
diff --git a/lib/libc/tests/stdio/fopen_test.c b/lib/libc/tests/stdio/fopen_test.c
index 962e7fdb1a34..4dda5cbf0e5e 100644
--- a/lib/libc/tests/stdio/fopen_test.c
+++ b/lib/libc/tests/stdio/fopen_test.c
@@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <fcntl.h>
#include <paths.h>
#include <stdio.h>
diff --git a/lib/libc/tests/stdio/freopen_test.c b/lib/libc/tests/stdio/freopen_test.c
index 8ca4719e8603..55fe3c580dd3 100644
--- a/lib/libc/tests/stdio/freopen_test.c
+++ b/lib/libc/tests/stdio/freopen_test.c
@@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <errno.h>
#include <paths.h>
#include <stdbool.h>
diff --git a/lib/libc/tests/stdio/getdelim_test.c b/lib/libc/tests/stdio/getdelim_test.c
index 7b20b02a36f1..01a0ab0949fe 100644
--- a/lib/libc/tests/stdio/getdelim_test.c
+++ b/lib/libc/tests/stdio/getdelim_test.c
@@ -25,9 +25,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/lib/libc/tests/stdio/gets_s_test.c b/lib/libc/tests/stdio/gets_s_test.c
index 7d02990f82d4..4e1a59006b60 100644
--- a/lib/libc/tests/stdio/gets_s_test.c
+++ b/lib/libc/tests/stdio/gets_s_test.c
@@ -23,9 +23,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <assert.h>
#include <stdint.h>
#include <stdio.h>
diff --git a/lib/libc/tests/stdio/mkostemp_test.c b/lib/libc/tests/stdio/mkostemp_test.c
index 0dd475b4ec61..b31335fed43f 100644
--- a/lib/libc/tests/stdio/mkostemp_test.c
+++ b/lib/libc/tests/stdio/mkostemp_test.c
@@ -28,9 +28,6 @@
* Test program for mkostemp().
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/stat.h>
#include <errno.h>
diff --git a/lib/libc/tests/stdio/open_memstream2_test.c b/lib/libc/tests/stdio/open_memstream2_test.c
index 21ea64c7c669..c9c6528832d8 100644
--- a/lib/libc/tests/stdio/open_memstream2_test.c
+++ b/lib/libc/tests/stdio/open_memstream2_test.c
@@ -25,9 +25,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <err.h>
#include <errno.h>
#include <limits.h>
diff --git a/lib/libc/tests/stdio/open_wmemstream_test.c b/lib/libc/tests/stdio/open_wmemstream_test.c
index 324bcf3d3482..7ab882a4740a 100644
--- a/lib/libc/tests/stdio/open_wmemstream_test.c
+++ b/lib/libc/tests/stdio/open_wmemstream_test.c
@@ -25,9 +25,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <err.h>
#include <errno.h>
#include <limits.h>
diff --git a/lib/libc/tests/stdio/perror_test.c b/lib/libc/tests/stdio/perror_test.c
index 989f1ff6ea59..f3cb646d094e 100644
--- a/lib/libc/tests/stdio/perror_test.c
+++ b/lib/libc/tests/stdio/perror_test.c
@@ -29,9 +29,6 @@
* ISO/IEC 9899:1999.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <err.h>
#include <errno.h>
#include <limits.h>
diff --git a/lib/libc/tests/stdio/print_positional_test.c b/lib/libc/tests/stdio/print_positional_test.c
index 9c9ec314d62d..f896a30882f4 100644
--- a/lib/libc/tests/stdio/print_positional_test.c
+++ b/lib/libc/tests/stdio/print_positional_test.c
@@ -29,9 +29,6 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/lib/libc/tests/stdio/printbasic_test.c b/lib/libc/tests/stdio/printbasic_test.c
index 322e7477da25..411dff518795 100644
--- a/lib/libc/tests/stdio/printbasic_test.c
+++ b/lib/libc/tests/stdio/printbasic_test.c
@@ -28,9 +28,6 @@
* Tests for basic and miscellaneous printf() formats.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <err.h>
#include <limits.h>
#include <locale.h>
diff --git a/lib/libc/tests/stdio/printfloat_test.c b/lib/libc/tests/stdio/printfloat_test.c
index 736ba1b493ef..031859124163 100644
--- a/lib/libc/tests/stdio/printfloat_test.c
+++ b/lib/libc/tests/stdio/printfloat_test.c
@@ -28,9 +28,6 @@
* Test for printf() floating point formats.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <err.h>
#include <fenv.h>
#include <float.h>
diff --git a/lib/libc/tests/stdio/scanfloat_test.c b/lib/libc/tests/stdio/scanfloat_test.c
index 7e27e69542e7..a93238504dd1 100644
--- a/lib/libc/tests/stdio/scanfloat_test.c
+++ b/lib/libc/tests/stdio/scanfloat_test.c
@@ -28,9 +28,6 @@
* Test for scanf() floating point formats.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <fenv.h>
#include <float.h>
#include <locale.h>
diff --git a/lib/libc/tests/stdio/snprintf_test.c b/lib/libc/tests/stdio/snprintf_test.c
new file mode 100644
index 000000000000..29b908b65120
--- /dev/null
+++ b/lib/libc/tests/stdio/snprintf_test.c
@@ -0,0 +1,205 @@
+/*-
+ * Copyright (c) 2023 Dag-Erling Smørgrav
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <assert.h>
+#include <limits.h>
+#include <locale.h>
+#include <stdint.h>
+#include <stdio.h>
+
+#include <atf-c.h>
+
+#ifndef nitems
+#define nitems(a) (sizeof(a) / sizeof(a[0]))
+#endif
+
+#define SNPRINTF_TEST(output, format, ...) \
+ do { \
+ char buf[256]; \
+ assert(strlen(output) < nitems(buf)); \
+ int ret = snprintf(buf, nitems(buf), format, \
+ __VA_ARGS__); \
+ ATF_CHECK_EQ(strlen(output), ret); \
+ if (ret > 0) { \
+ ATF_CHECK_EQ(0, strcmp(output, buf)); \
+ } \
+ } while (0)
+
+ATF_TC_WITHOUT_HEAD(snprintf_b);
+ATF_TC_BODY(snprintf_b, tc)
+{
+ SNPRINTF_TEST("0", "%b", 0);
+ SNPRINTF_TEST(" 0", "%12b", 0);
+ SNPRINTF_TEST("000000000000", "%012b", 0);
+ SNPRINTF_TEST("1", "%b", 1);
+ SNPRINTF_TEST(" 1", "%12b", 1);
+ SNPRINTF_TEST("000000000001", "%012b", 1);
+ SNPRINTF_TEST("1111111111111111111111111111111", "%b", INT_MAX);
+ SNPRINTF_TEST("0", "%#b", 0);
+ SNPRINTF_TEST(" 0", "%#12b", 0);
+ SNPRINTF_TEST("000000000000", "%#012b", 0);
+ SNPRINTF_TEST("0b1", "%#b", 1);
+ SNPRINTF_TEST(" 0b1", "%#12b", 1);
+ SNPRINTF_TEST("0b0000000001", "%#012b", 1);
+ SNPRINTF_TEST("0b1111111111111111111111111111111", "%#b", INT_MAX);
+}
+
+ATF_TC_WITHOUT_HEAD(snprintf_B);
+ATF_TC_BODY(snprintf_B, tc)
+{
+ SNPRINTF_TEST("0", "%B", 0);
+ SNPRINTF_TEST(" 0", "%12B", 0);
+ SNPRINTF_TEST("000000000000", "%012B", 0);
+ SNPRINTF_TEST("1", "%B", 1);
+ SNPRINTF_TEST(" 1", "%12B", 1);
+ SNPRINTF_TEST("000000000001", "%012B", 1);
+ SNPRINTF_TEST("1111111111111111111111111111111", "%B", INT_MAX);
+ SNPRINTF_TEST("0", "%#B", 0);
+ SNPRINTF_TEST(" 0", "%#12B", 0);
+ SNPRINTF_TEST("000000000000", "%#012B", 0);
+ SNPRINTF_TEST("0B1", "%#B", 1);
+ SNPRINTF_TEST(" 0B1", "%#12B", 1);
+ SNPRINTF_TEST("0B0000000001", "%#012B", 1);
+ SNPRINTF_TEST("0B1111111111111111111111111111111", "%#B", INT_MAX);
+}
+
+ATF_TC_WITHOUT_HEAD(snprintf_d);
+ATF_TC_BODY(snprintf_d, tc)
+{
+ SNPRINTF_TEST("0", "%d", 0);
+ SNPRINTF_TEST(" 0", "%12d", 0);
+ SNPRINTF_TEST("000000000000", "%012d", 0);
+ SNPRINTF_TEST("1", "%d", 1);
+ SNPRINTF_TEST(" 1", "%12d", 1);
+ SNPRINTF_TEST("000000000001", "%012d", 1);
+ SNPRINTF_TEST("2147483647", "%d", INT_MAX);
+ SNPRINTF_TEST(" 2147483647", "%12d", INT_MAX);
+ SNPRINTF_TEST("002147483647", "%012d", INT_MAX);
+ SNPRINTF_TEST("2,147,483,647", "%'d", INT_MAX);
+}
+
+ATF_TC_WITHOUT_HEAD(snprintf_x);
+ATF_TC_BODY(snprintf_x, tc)
+{
+ SNPRINTF_TEST("0", "%x", 0);
+ SNPRINTF_TEST(" 0", "%12x", 0);
+ SNPRINTF_TEST("000000000000", "%012x", 0);
+ SNPRINTF_TEST("1", "%x", 1);
+ SNPRINTF_TEST(" 1", "%12x", 1);
+ SNPRINTF_TEST("000000000001", "%012x", 1);
+ SNPRINTF_TEST("7fffffff", "%x", INT_MAX);
+ SNPRINTF_TEST(" 7fffffff", "%12x", INT_MAX);
+ SNPRINTF_TEST("00007fffffff", "%012x", INT_MAX);
+ SNPRINTF_TEST("0", "%#x", 0);
+ SNPRINTF_TEST(" 0", "%#12x", 0);
+ SNPRINTF_TEST("000000000000", "%#012x", 0);
+ SNPRINTF_TEST("0x1", "%#x", 1);
+ SNPRINTF_TEST(" 0x1", "%#12x", 1);
+ SNPRINTF_TEST("0x0000000001", "%#012x", 1);
+ SNPRINTF_TEST("0x7fffffff", "%#x", INT_MAX);
+ SNPRINTF_TEST(" 0x7fffffff", "%#12x", INT_MAX);
+ SNPRINTF_TEST("0x007fffffff", "%#012x", INT_MAX);
+}
+
+ATF_TC_WITHOUT_HEAD(snprintf_X);
+ATF_TC_BODY(snprintf_X, tc)
+{
+ SNPRINTF_TEST("0", "%X", 0);
+ SNPRINTF_TEST(" 0", "%12X", 0);
+ SNPRINTF_TEST("000000000000", "%012X", 0);
+ SNPRINTF_TEST("1", "%X", 1);
+ SNPRINTF_TEST(" 1", "%12X", 1);
+ SNPRINTF_TEST("000000000001", "%012X", 1);
+ SNPRINTF_TEST("7FFFFFFF", "%X", INT_MAX);
+ SNPRINTF_TEST(" 7FFFFFFF", "%12X", INT_MAX);
+ SNPRINTF_TEST("00007FFFFFFF", "%012X", INT_MAX);
+ SNPRINTF_TEST("0", "%#X", 0);
+ SNPRINTF_TEST(" 0", "%#12X", 0);
+ SNPRINTF_TEST("000000000000", "%#012X", 0);
+ SNPRINTF_TEST("0X1", "%#X", 1);
+ SNPRINTF_TEST(" 0X1", "%#12X", 1);
+ SNPRINTF_TEST("0X0000000001", "%#012X", 1);
+ SNPRINTF_TEST("0X7FFFFFFF", "%#X", INT_MAX);
+ SNPRINTF_TEST(" 0X7FFFFFFF", "%#12X", INT_MAX);
+ SNPRINTF_TEST("0X007FFFFFFF", "%#012X", INT_MAX);
+}
+
+ATF_TC_WITHOUT_HEAD(snprintf_wN);
+ATF_TC_BODY(snprintf_wN, tc)
+{
+ SNPRINTF_TEST("0", "%w8d", (int8_t)0);
+ SNPRINTF_TEST("-128", "%w8d", (int8_t)SCHAR_MIN);
+ SNPRINTF_TEST("127", "%w8d", (int8_t)SCHAR_MAX);
+ SNPRINTF_TEST("0", "%w8u", (uint8_t)0);
+ SNPRINTF_TEST("255", "%w8u", (uint8_t)UCHAR_MAX);
+
+ SNPRINTF_TEST("0", "%w16d", (int16_t)0);
+ SNPRINTF_TEST("-32768", "%w16d", (int16_t)SHRT_MIN);
+ SNPRINTF_TEST("32767", "%w16d", (int16_t)SHRT_MAX);
+ SNPRINTF_TEST("0", "%w16u", (uint16_t)0);
+ SNPRINTF_TEST("65535", "%w16u", (uint16_t)USHRT_MAX);
+
+ SNPRINTF_TEST("0", "%w32d", (int32_t)0);
+ SNPRINTF_TEST("-2147483648", "%w32d", (int32_t)INT_MIN);
+ SNPRINTF_TEST("2147483647", "%w32d", (int32_t)INT_MAX);
+ SNPRINTF_TEST("0", "%w32u", (uint32_t)0);
+ SNPRINTF_TEST("4294967295", "%w32u", (uint32_t)UINT_MAX);
+
+ SNPRINTF_TEST("0", "%w64d", (int64_t)0);
+ SNPRINTF_TEST("-9223372036854775808", "%w64d", (int64_t)LLONG_MIN);
+ SNPRINTF_TEST("9223372036854775807", "%w64d", (int64_t)LLONG_MAX);
+ SNPRINTF_TEST("0", "%w64u", (uint64_t)0);
+ SNPRINTF_TEST("18446744073709551615", "%w64u", (uint64_t)ULLONG_MAX);
+
+ SNPRINTF_TEST("wd", "%wd", 0);
+ SNPRINTF_TEST("w1d", "%w1d", 0);
+ SNPRINTF_TEST("w128d", "%w128d", 0);
+}
+
+ATF_TC_WITHOUT_HEAD(snprintf_wfN);
+ATF_TC_BODY(snprintf_wfN, tc)
+{
+ SNPRINTF_TEST("0", "%wf8d", (int_fast8_t)0);
+ SNPRINTF_TEST("-2147483648", "%wf8d", (int_fast8_t)INT_MIN);
+ SNPRINTF_TEST("2147483647", "%wf8d", (int_fast8_t)INT_MAX);
+ SNPRINTF_TEST("0", "%wf8u", (uint8_t)0);
+ SNPRINTF_TEST("4294967295", "%wf8u", (uint_fast8_t)UINT_MAX);
+
+ SNPRINTF_TEST("0", "%wf16d", (int_fast16_t)0);
+ SNPRINTF_TEST("-2147483648", "%wf16d", (int_fast16_t)INT_MIN);
+ SNPRINTF_TEST("2147483647", "%wf16d", (int_fast16_t)INT_MAX);
+ SNPRINTF_TEST("0", "%wf16u", (uint16_t)0);
+ SNPRINTF_TEST("4294967295", "%wf16u", (uint_fast16_t)UINT_MAX);
+
+ SNPRINTF_TEST("0", "%wf32d", (int_fast32_t)0);
+ SNPRINTF_TEST("-2147483648", "%wf32d", (int_fast32_t)INT_MIN);
+ SNPRINTF_TEST("2147483647", "%wf32d", (int_fast32_t)INT_MAX);
+ SNPRINTF_TEST("0", "%wf32u", (uint32_t)0);
+ SNPRINTF_TEST("4294967295", "%wf32u", (uint_fast32_t)UINT_MAX);
+
+ SNPRINTF_TEST("0", "%wf64d", (int_fast64_t)0);
+ SNPRINTF_TEST("-9223372036854775808", "%wf64d", (int_fast64_t)LLONG_MIN);
+ SNPRINTF_TEST("9223372036854775807", "%wf64d", (int_fast64_t)LLONG_MAX);
+ SNPRINTF_TEST("0", "%wf64u", (uint64_t)0);
+ SNPRINTF_TEST("18446744073709551615", "%wf64u", (uint_fast64_t)ULLONG_MAX);
+
+ SNPRINTF_TEST("wfd", "%wfd", 0);
+ SNPRINTF_TEST("wf1d", "%wf1d", 0);
+ SNPRINTF_TEST("wf128d", "%wf128d", 0);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+ setlocale(LC_NUMERIC, "en_US.UTF-8");
+ ATF_TP_ADD_TC(tp, snprintf_b);
+ ATF_TP_ADD_TC(tp, snprintf_B);
+ ATF_TP_ADD_TC(tp, snprintf_d);
+ ATF_TP_ADD_TC(tp, snprintf_x);
+ ATF_TP_ADD_TC(tp, snprintf_X);
+ ATF_TP_ADD_TC(tp, snprintf_wN);
+ ATF_TP_ADD_TC(tp, snprintf_wfN);
+ return (atf_no_error());
+}
diff --git a/lib/libc/tests/stdio/sscanf_test.c b/lib/libc/tests/stdio/sscanf_test.c
new file mode 100644
index 000000000000..e916873d38c3
--- /dev/null
+++ b/lib/libc/tests/stdio/sscanf_test.c
@@ -0,0 +1,331 @@
+/*-
+ * Copyright (c) 2023 Dag-Erling Smørgrav
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <limits.h>
+#include <locale.h>
+#include <stdint.h>
+#include <stdio.h>
+
+#include <atf-c.h>
+
+static const struct sscanf_test_case {
+ char input[8];
+ struct {
+ int ret, val, len;
+ } b, o, d, x, i;
+} sscanf_test_cases[] = {
+// input binary octal decimal hexadecimal automatic
+ // all digits
+ { "0", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, },
+ { "1", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, },
+ { "2", { 0, 0, 0 }, { 1, 2, 1 }, { 1, 2, 1 }, { 1, 2, 1 }, { 1, 2, 1 }, },
+ { "3", { 0, 0, 0 }, { 1, 3, 1 }, { 1, 3, 1 }, { 1, 3, 1 }, { 1, 3, 1 }, },
+ { "4", { 0, 0, 0 }, { 1, 4, 1 }, { 1, 4, 1 }, { 1, 4, 1 }, { 1, 4, 1 }, },
+ { "5", { 0, 0, 0 }, { 1, 5, 1 }, { 1, 5, 1 }, { 1, 5, 1 }, { 1, 5, 1 }, },
+ { "6", { 0, 0, 0 }, { 1, 6, 1 }, { 1, 6, 1 }, { 1, 6, 1 }, { 1, 6, 1 }, },
+ { "7", { 0, 0, 0 }, { 1, 7, 1 }, { 1, 7, 1 }, { 1, 7, 1 }, { 1, 7, 1 }, },
+ { "8", { 0, 0, 0 }, { 0, 0, 0 }, { 1, 8, 1 }, { 1, 8, 1 }, { 1, 8, 1 }, },
+ { "9", { 0, 0, 0 }, { 0, 0, 0 }, { 1, 9, 1 }, { 1, 9, 1 }, { 1, 9, 1 }, },
+ { "A", { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 1, 10, 1 }, { 0, 0, 0 }, },
+ { "B", { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 1, 11, 1 }, { 0, 0, 0 }, },
+ { "C", { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 1, 12, 1 }, { 0, 0, 0 }, },
+ { "D", { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 1, 13, 1 }, { 0, 0, 0 }, },
+ { "E", { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 1, 14, 1 }, { 0, 0, 0 }, },
+ { "F", { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 1, 15, 1 }, { 0, 0, 0 }, },
+ { "X", { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, },
+ { "a", { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 1, 10, 1 }, { 0, 0, 0 }, },
+ { "b", { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 1, 11, 1 }, { 0, 0, 0 }, },
+ { "c", { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 1, 12, 1 }, { 0, 0, 0 }, },
+ { "d", { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 1, 13, 1 }, { 0, 0, 0 }, },
+ { "e", { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 1, 14, 1 }, { 0, 0, 0 }, },
+ { "f", { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 1, 15, 1 }, { 0, 0, 0 }, },
+ { "x", { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, },
+ // all digits with leading zero
+ { "00", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, },
+ { "01", { 1, 1, 2 }, { 1, 1, 2 }, { 1, 1, 2 }, { 1, 1, 2 }, { 1, 1, 2 }, },
+ { "02", { 1, 0, 1 }, { 1, 2, 2 }, { 1, 2, 2 }, { 1, 2, 2 }, { 1, 2, 2 }, },
+ { "03", { 1, 0, 1 }, { 1, 3, 2 }, { 1, 3, 2 }, { 1, 3, 2 }, { 1, 3, 2 }, },
+ { "04", { 1, 0, 1 }, { 1, 4, 2 }, { 1, 4, 2 }, { 1, 4, 2 }, { 1, 4, 2 }, },
+ { "05", { 1, 0, 1 }, { 1, 5, 2 }, { 1, 5, 2 }, { 1, 5, 2 }, { 1, 5, 2 }, },
+ { "06", { 1, 0, 1 }, { 1, 6, 2 }, { 1, 6, 2 }, { 1, 6, 2 }, { 1, 6, 2 }, },
+ { "07", { 1, 0, 1 }, { 1, 7, 2 }, { 1, 7, 2 }, { 1, 7, 2 }, { 1, 7, 2 }, },
+ { "08", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 8, 2 }, { 1, 8, 2 }, { 1, 0, 1 }, },
+ { "09", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 9, 2 }, { 1, 9, 2 }, { 1, 0, 1 }, },
+ { "0A", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 10, 2 }, { 1, 0, 1 }, },
+ { "0B", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 11, 2 }, { 1, 0, 1 }, },
+ { "0C", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 12, 2 }, { 1, 0, 1 }, },
+ { "0D", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 13, 2 }, { 1, 0, 1 }, },
+ { "0E", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 14, 2 }, { 1, 0, 1 }, },
+ { "0F", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 15, 2 }, { 1, 0, 1 }, },
+ { "0X", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, },
+ { "0a", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 10, 2 }, { 1, 0, 1 }, },
+ { "0b", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 11, 2 }, { 1, 0, 1 }, },
+ { "0c", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 12, 2 }, { 1, 0, 1 }, },
+ { "0d", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 13, 2 }, { 1, 0, 1 }, },
+ { "0e", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 14, 2 }, { 1, 0, 1 }, },
+ { "0f", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 15, 2 }, { 1, 0, 1 }, },
+ { "0x", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, },
+ // all digits with leading one
+ { "10", { 1, 2, 2 }, { 1, 8, 2 }, { 1, 10, 2 }, { 1, 16, 2 }, { 1, 10, 2 }, },
+ { "11", { 1, 3, 2 }, { 1, 9, 2 }, { 1, 11, 2 }, { 1, 17, 2 }, { 1, 11, 2 }, },
+ { "12", { 1, 1, 1 }, { 1, 10, 2 }, { 1, 12, 2 }, { 1, 18, 2 }, { 1, 12, 2 }, },
+ { "13", { 1, 1, 1 }, { 1, 11, 2 }, { 1, 13, 2 }, { 1, 19, 2 }, { 1, 13, 2 }, },
+ { "14", { 1, 1, 1 }, { 1, 12, 2 }, { 1, 14, 2 }, { 1, 20, 2 }, { 1, 14, 2 }, },
+ { "15", { 1, 1, 1 }, { 1, 13, 2 }, { 1, 15, 2 }, { 1, 21, 2 }, { 1, 15, 2 }, },
+ { "16", { 1, 1, 1 }, { 1, 14, 2 }, { 1, 16, 2 }, { 1, 22, 2 }, { 1, 16, 2 }, },
+ { "17", { 1, 1, 1 }, { 1, 15, 2 }, { 1, 17, 2 }, { 1, 23, 2 }, { 1, 17, 2 }, },
+ { "18", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 18, 2 }, { 1, 24, 2 }, { 1, 18, 2 }, },
+ { "19", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 19, 2 }, { 1, 25, 2 }, { 1, 19, 2 }, },
+ { "1A", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 26, 2 }, { 1, 1, 1 }, },
+ { "1B", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 27, 2 }, { 1, 1, 1 }, },
+ { "1C", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 28, 2 }, { 1, 1, 1 }, },
+ { "1D", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 29, 2 }, { 1, 1, 1 }, },
+ { "1E", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 30, 2 }, { 1, 1, 1 }, },
+ { "1F", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 31, 2 }, { 1, 1, 1 }, },
+ { "1X", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, },
+ { "1a", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 26, 2 }, { 1, 1, 1 }, },
+ { "1b", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 27, 2 }, { 1, 1, 1 }, },
+ { "1c", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 28, 2 }, { 1, 1, 1 }, },
+ { "1d", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 29, 2 }, { 1, 1, 1 }, },
+ { "1e", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 30, 2 }, { 1, 1, 1 }, },
+ { "1f", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 31, 2 }, { 1, 1, 1 }, },
+ { "1x", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, },
+ // all digits with leading binary prefix
+ { "0b0", { 1, 0, 3 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 176, 3 }, { 1, 0, 3 }, },
+ { "0b1", { 1, 1, 3 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 177, 3 }, { 1, 1, 3 }, },
+ { "0b2", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 178, 3 }, { 1, 0, 1 }, },
+ { "0b3", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 179, 3 }, { 1, 0, 1 }, },
+ { "0b4", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 180, 3 }, { 1, 0, 1 }, },
+ { "0b5", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 181, 3 }, { 1, 0, 1 }, },
+ { "0b6", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 182, 3 }, { 1, 0, 1 }, },
+ { "0b7", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 183, 3 }, { 1, 0, 1 }, },
+ { "0b8", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 184, 3 }, { 1, 0, 1 }, },
+ { "0b9", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 185, 3 }, { 1, 0, 1 }, },
+ { "0bA", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 186, 3 }, { 1, 0, 1 }, },
+ { "0bB", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 187, 3 }, { 1, 0, 1 }, },
+ { "0bC", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 188, 3 }, { 1, 0, 1 }, },
+ { "0bD", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 189, 3 }, { 1, 0, 1 }, },
+ { "0bE", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 190, 3 }, { 1, 0, 1 }, },
+ { "0bF", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 191, 3 }, { 1, 0, 1 }, },
+ { "0bX", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 11, 2 }, { 1, 0, 1 }, },
+ { "0ba", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 186, 3 }, { 1, 0, 1 }, },
+ { "0bb", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 187, 3 }, { 1, 0, 1 }, },
+ { "0bc", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 188, 3 }, { 1, 0, 1 }, },
+ { "0bd", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 189, 3 }, { 1, 0, 1 }, },
+ { "0be", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 190, 3 }, { 1, 0, 1 }, },
+ { "0bf", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 191, 3 }, { 1, 0, 1 }, },
+ { "0bx", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 11, 2 }, { 1, 0, 1 }, },
+ // all digits with leading hexadecimal prefix
+ { "0x0", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 3 }, { 1, 0, 3 }, },
+ { "0x1", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 1, 3 }, { 1, 1, 3 }, },
+ { "0x2", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 2, 3 }, { 1, 2, 3 }, },
+ { "0x3", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 3, 3 }, { 1, 3, 3 }, },
+ { "0x4", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 4, 3 }, { 1, 4, 3 }, },
+ { "0x5", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 5, 3 }, { 1, 5, 3 }, },
+ { "0x6", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 6, 3 }, { 1, 6, 3 }, },
+ { "0x7", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 7, 3 }, { 1, 7, 3 }, },
+ { "0x8", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 8, 3 }, { 1, 8, 3 }, },
+ { "0x9", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 9, 3 }, { 1, 9, 3 }, },
+ { "0xA", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 10, 3 }, { 1, 10, 3 }, },
+ { "0xB", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 11, 3 }, { 1, 11, 3 }, },
+ { "0xC", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 12, 3 }, { 1, 12, 3 }, },
+ { "0xD", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 13, 3 }, { 1, 13, 3 }, },
+ { "0xE", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 14, 3 }, { 1, 14, 3 }, },
+ { "0xF", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 15, 3 }, { 1, 15, 3 }, },
+ { "0xX", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, },
+ { "0xa", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 10, 3 }, { 1, 10, 3 }, },
+ { "0xb", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 11, 3 }, { 1, 11, 3 }, },
+ { "0xc", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 12, 3 }, { 1, 12, 3 }, },
+ { "0xd", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 13, 3 }, { 1, 13, 3 }, },
+ { "0xe", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 14, 3 }, { 1, 14, 3 }, },
+ { "0xf", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 15, 3 }, { 1, 15, 3 }, },
+ { "0xX", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, },
+ // terminator
+ { "" }
+};
+
+#define SSCANF_TEST(string, format, expret, expval, explen) \
+ do { \
+ int ret = 0, val = 0, len = 0; \
+ ret = sscanf(string, format "%n", &val, &len); \
+ ATF_CHECK_EQ(expret, ret); \
+ if (expret && ret) { \
+ ATF_CHECK_EQ(expval, val); \
+ ATF_CHECK_EQ(explen, len); \
+ } \
+ } while (0)
+
+ATF_TC_WITHOUT_HEAD(sscanf_b);
+ATF_TC_BODY(sscanf_b, tc)
+{
+ const struct sscanf_test_case *stc;
+ char input[16];
+
+ for (stc = sscanf_test_cases; *stc->input; stc++) {
+ strcpy(input + 1, stc->input);
+ SSCANF_TEST(input + 1, "%b", stc->b.ret, stc->b.val, stc->b.len);
+ input[0] = '+';
+ SSCANF_TEST(input, "%b", stc->b.ret, stc->b.val, stc->b.len ? stc->b.len + 1 : 0);
+ input[0] = '-';
+ SSCANF_TEST(input, "%b", stc->b.ret, -stc->b.val, stc->b.len ? stc->b.len + 1 : 0);
+ }
+}
+
+ATF_TC_WITHOUT_HEAD(sscanf_o);
+ATF_TC_BODY(sscanf_o, tc)
+{
+ const struct sscanf_test_case *stc;
+ char input[16];
+
+ for (stc = sscanf_test_cases; *stc->input; stc++) {
+ strcpy(input + 1, stc->input);
+ SSCANF_TEST(input + 1, "%o", stc->o.ret, stc->o.val, stc->o.len);
+ input[0] = '+';
+ SSCANF_TEST(input, "%o", stc->o.ret, stc->o.val, stc->o.len ? stc->o.len + 1 : 0);
+ input[0] = '-';
+ SSCANF_TEST(input, "%o", stc->o.ret, -stc->o.val, stc->o.len ? stc->o.len + 1 : 0);
+ }
+}
+
+ATF_TC_WITHOUT_HEAD(sscanf_d);
+ATF_TC_BODY(sscanf_d, tc)
+{
+ const struct sscanf_test_case *stc;
+ char input[16];
+
+ for (stc = sscanf_test_cases; *stc->input; stc++) {
+ strcpy(input + 1, stc->input);
+ SSCANF_TEST(input + 1, "%d", stc->d.ret, stc->d.val, stc->d.len);
+ input[0] = '+';
+ SSCANF_TEST(input, "%d", stc->d.ret, stc->d.val, stc->d.len ? stc->d.len + 1 : 0);
+ input[0] = '-';
+ SSCANF_TEST(input, "%d", stc->d.ret, -stc->d.val, stc->d.len ? stc->d.len + 1 : 0);
+ }
+}
+
+ATF_TC_WITHOUT_HEAD(sscanf_x);
+ATF_TC_BODY(sscanf_x, tc)
+{
+ const struct sscanf_test_case *stc;
+ char input[16];
+
+ for (stc = sscanf_test_cases; *stc->input; stc++) {
+ strcpy(input + 1, stc->input);
+ SSCANF_TEST(input + 1, "%x", stc->x.ret, stc->x.val, stc->x.len);
+ input[0] = '+';
+ SSCANF_TEST(input, "%x", stc->x.ret, stc->x.val, stc->x.len ? stc->x.len + 1 : 0);
+ input[0] = '-';
+ SSCANF_TEST(input, "%x", stc->x.ret, -stc->x.val, stc->x.len ? stc->x.len + 1 : 0);
+ }
+}
+
+ATF_TC_WITHOUT_HEAD(sscanf_i);
+ATF_TC_BODY(sscanf_i, tc)
+{
+ const struct sscanf_test_case *stc;
+ char input[16];
+
+ for (stc = sscanf_test_cases; *stc->input; stc++) {
+ strcpy(input + 1, stc->input);
+ SSCANF_TEST(input + 1, "%i", stc->i.ret, stc->i.val, stc->i.len);
+ input[0] = '+';
+ SSCANF_TEST(input, "%i", stc->i.ret, stc->i.val, stc->i.len ? stc->i.len + 1 : 0);
+ input[0] = '-';
+ SSCANF_TEST(input, "%i", stc->i.ret, -stc->i.val, stc->i.len ? stc->i.len + 1 : 0);
+ }
+}
+
+ATF_TC_WITHOUT_HEAD(sscanf_wN);
+ATF_TC_BODY(sscanf_wN, tc)
+{
+ const char x00[] = "0x00";
+ const char x7f[] = "0x7fffffffffffffff";
+ const char xff[] = "0xffffffffffffffff";
+
+#define SSCANF_WN_TEST(N, imin, umax) \
+ do { \
+ int##N##_t i; \
+ uint##N##_t u; \
+ ATF_CHECK_EQ(1, sscanf(x00, "%w" #N "i", &i)); \
+ ATF_CHECK_EQ(0, i); \
+ ATF_CHECK_EQ(1, sscanf(x7f, "%w" #N "i", &i)); \
+ ATF_CHECK_EQ(imin, i); \
+ ATF_CHECK_EQ(1, sscanf(x00, "%w" #N "x", &u)); \
+ ATF_CHECK_EQ(0, u); \
+ ATF_CHECK_EQ(1, sscanf(xff, "%w" #N "x", &u)); \
+ ATF_CHECK_EQ(umax, u); \
+ } while (0)
+ SSCANF_WN_TEST(8, -1, UCHAR_MAX);
+ SSCANF_WN_TEST(16, -1, USHRT_MAX);
+ SSCANF_WN_TEST(32, -1, UINT_MAX);
+ SSCANF_WN_TEST(64, LLONG_MAX, ULLONG_MAX);
+#undef SSCANF_WN_TEST
+
+ ATF_CHECK_EQ(0, sscanf(x00, "%wi", (int *)NULL));
+ ATF_CHECK_EQ(0, sscanf(x00, "%w1i", (int *)NULL));
+ ATF_CHECK_EQ(0, sscanf(x00, "%w128i", (int *)NULL));
+}
+
+ATF_TC_WITHOUT_HEAD(sscanf_wfN);
+ATF_TC_BODY(sscanf_wfN, tc)
+{
+ const char x00[] = "0x00";
+ const char x7f[] = "0x7fffffffffffffff";
+ const char xff[] = "0xffffffffffffffff";
+
+#define SSCANF_WFN_TEST(N, imin, umax) \
+ do { \
+ int_fast##N##_t i; \
+ uint_fast##N##_t u; \
+ ATF_CHECK_EQ(1, sscanf(x00, "%wf" #N "i", &i)); \
+ ATF_CHECK_EQ(0, i); \
+ ATF_CHECK_EQ(1, sscanf(x7f, "%wf" #N "i", &i)); \
+ ATF_CHECK_EQ(imin, i); \
+ ATF_CHECK_EQ(1, sscanf(x00, "%wf" #N "x", &u)); \
+ ATF_CHECK_EQ(0, u); \
+ ATF_CHECK_EQ(1, sscanf(xff, "%wf" #N "x", &u)); \
+ ATF_CHECK_EQ(umax, u); \
+ } while (0)
+ SSCANF_WFN_TEST(8, -1, UINT_MAX);
+ SSCANF_WFN_TEST(16, -1, UINT_MAX);
+ SSCANF_WFN_TEST(32, -1, UINT_MAX);
+ SSCANF_WFN_TEST(64, LLONG_MAX, ULLONG_MAX);
+#undef SSCANF_WFN_TEST
+
+ ATF_CHECK_EQ(0, sscanf(x00, "%wfi", (int *)NULL));
+ ATF_CHECK_EQ(0, sscanf(x00, "%wf1i", (int *)NULL));
+ ATF_CHECK_EQ(0, sscanf(x00, "%wf128i", (int *)NULL));
+}
+
+/*
+ * Test termination cases: non-numeric character, fixed width, EOF
+ */
+ATF_TC_WITHOUT_HEAD(sscanf_termination);
+ATF_TC_BODY(sscanf_termination, tc)
+{
+ int a = 0, b = 0, c = 0;
+ char d = 0;
+
+ ATF_CHECK_EQ(4, sscanf("3.1415", "%d%c%2d%d", &a, &d, &b, &c));
+ ATF_CHECK_EQ(3, a);
+ ATF_CHECK_EQ(14, b);
+ ATF_CHECK_EQ(15, c);
+ ATF_CHECK_EQ('.', d);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+ setlocale(LC_NUMERIC, "en_US.UTF-8");
+ ATF_TP_ADD_TC(tp, sscanf_b);
+ ATF_TP_ADD_TC(tp, sscanf_o);
+ ATF_TP_ADD_TC(tp, sscanf_d);
+ ATF_TP_ADD_TC(tp, sscanf_x);
+ ATF_TP_ADD_TC(tp, sscanf_i);
+ ATF_TP_ADD_TC(tp, sscanf_wN);
+ ATF_TP_ADD_TC(tp, sscanf_wfN);
+ ATF_TP_ADD_TC(tp, sscanf_termination);
+ return (atf_no_error());
+}
diff --git a/lib/libc/tests/stdio/swprintf_test.c b/lib/libc/tests/stdio/swprintf_test.c
new file mode 100644
index 000000000000..f00ecc7f1c1d
--- /dev/null
+++ b/lib/libc/tests/stdio/swprintf_test.c
@@ -0,0 +1,206 @@
+/*-
+ * Copyright (c) 2023 Dag-Erling Smørgrav
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <assert.h>
+#include <limits.h>
+#include <locale.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <wchar.h>
+
+#include <atf-c.h>
+
+#ifndef nitems
+#define nitems(a) (sizeof(a) / sizeof(a[0]))
+#endif
+
+#define SWPRINTF_TEST(output, format, ...) \
+ do { \
+ wchar_t buf[256]; \
+ assert(wcslen(L##output) < nitems(buf)); \
+ int ret = swprintf(buf, nitems(buf), L##format, \
+ __VA_ARGS__); \
+ ATF_CHECK_EQ(wcslen(L##output), ret); \
+ if (ret > 0) { \
+ ATF_CHECK_EQ(0, wcscmp(L##output, buf)); \
+ } \
+ } while (0)
+
+ATF_TC_WITHOUT_HEAD(swprintf_b);
+ATF_TC_BODY(swprintf_b, tc)
+{
+ SWPRINTF_TEST("0", "%b", 0);
+ SWPRINTF_TEST(" 0", "%12b", 0);
+ SWPRINTF_TEST("000000000000", "%012b", 0);
+ SWPRINTF_TEST("1", "%b", 1);
+ SWPRINTF_TEST(" 1", "%12b", 1);
+ SWPRINTF_TEST("000000000001", "%012b", 1);
+ SWPRINTF_TEST("1111111111111111111111111111111", "%b", INT_MAX);
+ SWPRINTF_TEST("0", "%#b", 0);
+ SWPRINTF_TEST(" 0", "%#12b", 0);
+ SWPRINTF_TEST("000000000000", "%#012b", 0);
+ SWPRINTF_TEST("0b1", "%#b", 1);
+ SWPRINTF_TEST(" 0b1", "%#12b", 1);
+ SWPRINTF_TEST("0b0000000001", "%#012b", 1);
+ SWPRINTF_TEST("0b1111111111111111111111111111111", "%#b", INT_MAX);
+}
+
+ATF_TC_WITHOUT_HEAD(swprintf_B);
+ATF_TC_BODY(swprintf_B, tc)
+{
+ SWPRINTF_TEST("0", "%B", 0);
+ SWPRINTF_TEST(" 0", "%12B", 0);
+ SWPRINTF_TEST("000000000000", "%012B", 0);
+ SWPRINTF_TEST("1", "%B", 1);
+ SWPRINTF_TEST(" 1", "%12B", 1);
+ SWPRINTF_TEST("000000000001", "%012B", 1);
+ SWPRINTF_TEST("1111111111111111111111111111111", "%B", INT_MAX);
+ SWPRINTF_TEST("0", "%#B", 0);
+ SWPRINTF_TEST(" 0", "%#12B", 0);
+ SWPRINTF_TEST("000000000000", "%#012B", 0);
+ SWPRINTF_TEST("0B1", "%#B", 1);
+ SWPRINTF_TEST(" 0B1", "%#12B", 1);
+ SWPRINTF_TEST("0B0000000001", "%#012B", 1);
+ SWPRINTF_TEST("0B1111111111111111111111111111111", "%#B", INT_MAX);
+}
+
+ATF_TC_WITHOUT_HEAD(swprintf_d);
+ATF_TC_BODY(swprintf_d, tc)
+{
+ SWPRINTF_TEST("0", "%d", 0);
+ SWPRINTF_TEST(" 0", "%12d", 0);
+ SWPRINTF_TEST("000000000000", "%012d", 0);
+ SWPRINTF_TEST("1", "%d", 1);
+ SWPRINTF_TEST(" 1", "%12d", 1);
+ SWPRINTF_TEST("000000000001", "%012d", 1);
+ SWPRINTF_TEST("2147483647", "%d", INT_MAX);
+ SWPRINTF_TEST(" 2147483647", "%12d", INT_MAX);
+ SWPRINTF_TEST("002147483647", "%012d", INT_MAX);
+ SWPRINTF_TEST("2,147,483,647", "%'d", INT_MAX);
+}
+
+ATF_TC_WITHOUT_HEAD(swprintf_x);
+ATF_TC_BODY(swprintf_x, tc)
+{
+ SWPRINTF_TEST("0", "%x", 0);
+ SWPRINTF_TEST(" 0", "%12x", 0);
+ SWPRINTF_TEST("000000000000", "%012x", 0);
+ SWPRINTF_TEST("1", "%x", 1);
+ SWPRINTF_TEST(" 1", "%12x", 1);
+ SWPRINTF_TEST("000000000001", "%012x", 1);
+ SWPRINTF_TEST("7fffffff", "%x", INT_MAX);
+ SWPRINTF_TEST(" 7fffffff", "%12x", INT_MAX);
+ SWPRINTF_TEST("00007fffffff", "%012x", INT_MAX);
+ SWPRINTF_TEST("0", "%#x", 0);
+ SWPRINTF_TEST(" 0", "%#12x", 0);
+ SWPRINTF_TEST("000000000000", "%#012x", 0);
+ SWPRINTF_TEST("0x1", "%#x", 1);
+ SWPRINTF_TEST(" 0x1", "%#12x", 1);
+ SWPRINTF_TEST("0x0000000001", "%#012x", 1);
+ SWPRINTF_TEST("0x7fffffff", "%#x", INT_MAX);
+ SWPRINTF_TEST(" 0x7fffffff", "%#12x", INT_MAX);
+ SWPRINTF_TEST("0x007fffffff", "%#012x", INT_MAX);
+}
+
+ATF_TC_WITHOUT_HEAD(swprintf_X);
+ATF_TC_BODY(swprintf_X, tc)
+{
+ SWPRINTF_TEST("0", "%X", 0);
+ SWPRINTF_TEST(" 0", "%12X", 0);
+ SWPRINTF_TEST("000000000000", "%012X", 0);
+ SWPRINTF_TEST("1", "%X", 1);
+ SWPRINTF_TEST(" 1", "%12X", 1);
+ SWPRINTF_TEST("000000000001", "%012X", 1);
+ SWPRINTF_TEST("7FFFFFFF", "%X", INT_MAX);
+ SWPRINTF_TEST(" 7FFFFFFF", "%12X", INT_MAX);
+ SWPRINTF_TEST("00007FFFFFFF", "%012X", INT_MAX);
+ SWPRINTF_TEST("0", "%#X", 0);
+ SWPRINTF_TEST(" 0", "%#12X", 0);
+ SWPRINTF_TEST("000000000000", "%#012X", 0);
+ SWPRINTF_TEST("0X1", "%#X", 1);
+ SWPRINTF_TEST(" 0X1", "%#12X", 1);
+ SWPRINTF_TEST("0X0000000001", "%#012X", 1);
+ SWPRINTF_TEST("0X7FFFFFFF", "%#X", INT_MAX);
+ SWPRINTF_TEST(" 0X7FFFFFFF", "%#12X", INT_MAX);
+ SWPRINTF_TEST("0X007FFFFFFF", "%#012X", INT_MAX);
+}
+
+ATF_TC_WITHOUT_HEAD(swprintf_wN);
+ATF_TC_BODY(swprintf_wN, tc)
+{
+ SWPRINTF_TEST("0", "%w8d", (int8_t)0);
+ SWPRINTF_TEST("-128", "%w8d", (int8_t)SCHAR_MIN);
+ SWPRINTF_TEST("127", "%w8d", (int8_t)SCHAR_MAX);
+ SWPRINTF_TEST("0", "%w8u", (uint8_t)0);
+ SWPRINTF_TEST("255", "%w8u", (uint8_t)UCHAR_MAX);
+
+ SWPRINTF_TEST("0", "%w16d", (int16_t)0);
+ SWPRINTF_TEST("-32768", "%w16d", (int16_t)SHRT_MIN);
+ SWPRINTF_TEST("32767", "%w16d", (int16_t)SHRT_MAX);
+ SWPRINTF_TEST("0", "%w16u", (uint16_t)0);
+ SWPRINTF_TEST("65535", "%w16u", (uint16_t)USHRT_MAX);
+
+ SWPRINTF_TEST("0", "%w32d", (int32_t)0);
+ SWPRINTF_TEST("-2147483648", "%w32d", (int32_t)INT_MIN);
+ SWPRINTF_TEST("2147483647", "%w32d", (int32_t)INT_MAX);
+ SWPRINTF_TEST("0", "%w32u", (uint32_t)0);
+ SWPRINTF_TEST("4294967295", "%w32u", (uint32_t)UINT_MAX);
+
+ SWPRINTF_TEST("0", "%w64d", (int64_t)0);
+ SWPRINTF_TEST("-9223372036854775808", "%w64d", (int64_t)LLONG_MIN);
+ SWPRINTF_TEST("9223372036854775807", "%w64d", (int64_t)LLONG_MAX);
+ SWPRINTF_TEST("0", "%w64u", (uint64_t)0);
+ SWPRINTF_TEST("18446744073709551615", "%w64u", (uint64_t)ULLONG_MAX);
+
+ SWPRINTF_TEST("wd", "%wd", 0);
+ SWPRINTF_TEST("w1d", "%w1d", 0);
+ SWPRINTF_TEST("w128d", "%w128d", 0);
+}
+
+ATF_TC_WITHOUT_HEAD(swprintf_wfN);
+ATF_TC_BODY(swprintf_wfN, tc)
+{
+ SWPRINTF_TEST("0", "%wf8d", (int_fast8_t)0);
+ SWPRINTF_TEST("-2147483648", "%wf8d", (int_fast8_t)INT_MIN);
+ SWPRINTF_TEST("2147483647", "%wf8d", (int_fast8_t)INT_MAX);
+ SWPRINTF_TEST("0", "%wf8u", (uint8_t)0);
+ SWPRINTF_TEST("4294967295", "%wf8u", (uint_fast8_t)UINT_MAX);
+
+ SWPRINTF_TEST("0", "%wf16d", (int_fast16_t)0);
+ SWPRINTF_TEST("-2147483648", "%wf16d", (int_fast16_t)INT_MIN);
+ SWPRINTF_TEST("2147483647", "%wf16d", (int_fast16_t)INT_MAX);
+ SWPRINTF_TEST("0", "%wf16u", (uint16_t)0);
+ SWPRINTF_TEST("4294967295", "%wf16u", (uint_fast16_t)UINT_MAX);
+
+ SWPRINTF_TEST("0", "%wf32d", (int_fast32_t)0);
+ SWPRINTF_TEST("-2147483648", "%wf32d", (int_fast32_t)INT_MIN);
+ SWPRINTF_TEST("2147483647", "%wf32d", (int_fast32_t)INT_MAX);
+ SWPRINTF_TEST("0", "%wf32u", (uint32_t)0);
+ SWPRINTF_TEST("4294967295", "%wf32u", (uint_fast32_t)UINT_MAX);
+
+ SWPRINTF_TEST("0", "%wf64d", (int_fast64_t)0);
+ SWPRINTF_TEST("-9223372036854775808", "%wf64d", (int_fast64_t)LLONG_MIN);
+ SWPRINTF_TEST("9223372036854775807", "%wf64d", (int_fast64_t)LLONG_MAX);
+ SWPRINTF_TEST("0", "%wf64u", (uint64_t)0);
+ SWPRINTF_TEST("18446744073709551615", "%wf64u", (uint_fast64_t)ULLONG_MAX);
+
+ SWPRINTF_TEST("wfd", "%wfd", 0);
+ SWPRINTF_TEST("wf1d", "%wf1d", 0);
+ SWPRINTF_TEST("wf128d", "%wf128d", 0);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+ setlocale(LC_NUMERIC, "en_US.UTF-8");
+ ATF_TP_ADD_TC(tp, swprintf_b);
+ ATF_TP_ADD_TC(tp, swprintf_B);
+ ATF_TP_ADD_TC(tp, swprintf_d);
+ ATF_TP_ADD_TC(tp, swprintf_x);
+ ATF_TP_ADD_TC(tp, swprintf_X);
+ ATF_TP_ADD_TC(tp, swprintf_wN);
+ ATF_TP_ADD_TC(tp, swprintf_wfN);
+ return (atf_no_error());
+}
diff --git a/lib/libc/tests/stdio/swscanf_test.c b/lib/libc/tests/stdio/swscanf_test.c
new file mode 100644
index 000000000000..f7ad30b963a7
--- /dev/null
+++ b/lib/libc/tests/stdio/swscanf_test.c
@@ -0,0 +1,334 @@
+/*-
+ * Copyright (c) 2023 Dag-Erling Smørgrav
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <limits.h>
+#include <locale.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <wchar.h>
+
+#include <atf-c.h>
+
+#define L(s) L ## s
+
+static const struct swscanf_test_case {
+ wchar_t input[8];
+ struct {
+ int ret, val, len;
+ } b, o, d, x, i;
+} swscanf_test_cases[] = {
+// input binary octal decimal hexadecimal automatic
+ // all digits
+ { L"0", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, },
+ { L"1", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, },
+ { L"2", { 0, 0, 0 }, { 1, 2, 1 }, { 1, 2, 1 }, { 1, 2, 1 }, { 1, 2, 1 }, },
+ { L"3", { 0, 0, 0 }, { 1, 3, 1 }, { 1, 3, 1 }, { 1, 3, 1 }, { 1, 3, 1 }, },
+ { L"4", { 0, 0, 0 }, { 1, 4, 1 }, { 1, 4, 1 }, { 1, 4, 1 }, { 1, 4, 1 }, },
+ { L"5", { 0, 0, 0 }, { 1, 5, 1 }, { 1, 5, 1 }, { 1, 5, 1 }, { 1, 5, 1 }, },
+ { L"6", { 0, 0, 0 }, { 1, 6, 1 }, { 1, 6, 1 }, { 1, 6, 1 }, { 1, 6, 1 }, },
+ { L"7", { 0, 0, 0 }, { 1, 7, 1 }, { 1, 7, 1 }, { 1, 7, 1 }, { 1, 7, 1 }, },
+ { L"8", { 0, 0, 0 }, { 0, 0, 0 }, { 1, 8, 1 }, { 1, 8, 1 }, { 1, 8, 1 }, },
+ { L"9", { 0, 0, 0 }, { 0, 0, 0 }, { 1, 9, 1 }, { 1, 9, 1 }, { 1, 9, 1 }, },
+ { L"A", { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 1, 10, 1 }, { 0, 0, 0 }, },
+ { L"B", { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 1, 11, 1 }, { 0, 0, 0 }, },
+ { L"C", { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 1, 12, 1 }, { 0, 0, 0 }, },
+ { L"D", { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 1, 13, 1 }, { 0, 0, 0 }, },
+ { L"E", { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 1, 14, 1 }, { 0, 0, 0 }, },
+ { L"F", { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 1, 15, 1 }, { 0, 0, 0 }, },
+ { L"X", { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, },
+ { L"a", { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 1, 10, 1 }, { 0, 0, 0 }, },
+ { L"b", { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 1, 11, 1 }, { 0, 0, 0 }, },
+ { L"c", { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 1, 12, 1 }, { 0, 0, 0 }, },
+ { L"d", { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 1, 13, 1 }, { 0, 0, 0 }, },
+ { L"e", { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 1, 14, 1 }, { 0, 0, 0 }, },
+ { L"f", { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 1, 15, 1 }, { 0, 0, 0 }, },
+ { L"x", { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, },
+ // all digits with leading zero
+ { L"00", { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, { 1, 0, 2 }, },
+ { L"01", { 1, 1, 2 }, { 1, 1, 2 }, { 1, 1, 2 }, { 1, 1, 2 }, { 1, 1, 2 }, },
+ { L"02", { 1, 0, 1 }, { 1, 2, 2 }, { 1, 2, 2 }, { 1, 2, 2 }, { 1, 2, 2 }, },
+ { L"03", { 1, 0, 1 }, { 1, 3, 2 }, { 1, 3, 2 }, { 1, 3, 2 }, { 1, 3, 2 }, },
+ { L"04", { 1, 0, 1 }, { 1, 4, 2 }, { 1, 4, 2 }, { 1, 4, 2 }, { 1, 4, 2 }, },
+ { L"05", { 1, 0, 1 }, { 1, 5, 2 }, { 1, 5, 2 }, { 1, 5, 2 }, { 1, 5, 2 }, },
+ { L"06", { 1, 0, 1 }, { 1, 6, 2 }, { 1, 6, 2 }, { 1, 6, 2 }, { 1, 6, 2 }, },
+ { L"07", { 1, 0, 1 }, { 1, 7, 2 }, { 1, 7, 2 }, { 1, 7, 2 }, { 1, 7, 2 }, },
+ { L"08", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 8, 2 }, { 1, 8, 2 }, { 1, 0, 1 }, },
+ { L"09", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 9, 2 }, { 1, 9, 2 }, { 1, 0, 1 }, },
+ { L"0A", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 10, 2 }, { 1, 0, 1 }, },
+ { L"0B", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 11, 2 }, { 1, 0, 1 }, },
+ { L"0C", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 12, 2 }, { 1, 0, 1 }, },
+ { L"0D", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 13, 2 }, { 1, 0, 1 }, },
+ { L"0E", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 14, 2 }, { 1, 0, 1 }, },
+ { L"0F", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 15, 2 }, { 1, 0, 1 }, },
+ { L"0X", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, },
+ { L"0a", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 10, 2 }, { 1, 0, 1 }, },
+ { L"0b", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 11, 2 }, { 1, 0, 1 }, },
+ { L"0c", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 12, 2 }, { 1, 0, 1 }, },
+ { L"0d", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 13, 2 }, { 1, 0, 1 }, },
+ { L"0e", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 14, 2 }, { 1, 0, 1 }, },
+ { L"0f", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 15, 2 }, { 1, 0, 1 }, },
+ { L"0x", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, },
+ // all digits with leading one
+ { L"10", { 1, 2, 2 }, { 1, 8, 2 }, { 1, 10, 2 }, { 1, 16, 2 }, { 1, 10, 2 }, },
+ { L"11", { 1, 3, 2 }, { 1, 9, 2 }, { 1, 11, 2 }, { 1, 17, 2 }, { 1, 11, 2 }, },
+ { L"12", { 1, 1, 1 }, { 1, 10, 2 }, { 1, 12, 2 }, { 1, 18, 2 }, { 1, 12, 2 }, },
+ { L"13", { 1, 1, 1 }, { 1, 11, 2 }, { 1, 13, 2 }, { 1, 19, 2 }, { 1, 13, 2 }, },
+ { L"14", { 1, 1, 1 }, { 1, 12, 2 }, { 1, 14, 2 }, { 1, 20, 2 }, { 1, 14, 2 }, },
+ { L"15", { 1, 1, 1 }, { 1, 13, 2 }, { 1, 15, 2 }, { 1, 21, 2 }, { 1, 15, 2 }, },
+ { L"16", { 1, 1, 1 }, { 1, 14, 2 }, { 1, 16, 2 }, { 1, 22, 2 }, { 1, 16, 2 }, },
+ { L"17", { 1, 1, 1 }, { 1, 15, 2 }, { 1, 17, 2 }, { 1, 23, 2 }, { 1, 17, 2 }, },
+ { L"18", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 18, 2 }, { 1, 24, 2 }, { 1, 18, 2 }, },
+ { L"19", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 19, 2 }, { 1, 25, 2 }, { 1, 19, 2 }, },
+ { L"1A", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 26, 2 }, { 1, 1, 1 }, },
+ { L"1B", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 27, 2 }, { 1, 1, 1 }, },
+ { L"1C", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 28, 2 }, { 1, 1, 1 }, },
+ { L"1D", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 29, 2 }, { 1, 1, 1 }, },
+ { L"1E", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 30, 2 }, { 1, 1, 1 }, },
+ { L"1F", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 31, 2 }, { 1, 1, 1 }, },
+ { L"1X", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, },
+ { L"1a", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 26, 2 }, { 1, 1, 1 }, },
+ { L"1b", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 27, 2 }, { 1, 1, 1 }, },
+ { L"1c", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 28, 2 }, { 1, 1, 1 }, },
+ { L"1d", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 29, 2 }, { 1, 1, 1 }, },
+ { L"1e", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 30, 2 }, { 1, 1, 1 }, },
+ { L"1f", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 31, 2 }, { 1, 1, 1 }, },
+ { L"1x", { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, },
+ // all digits with leading binary prefix
+ { L"0b0", { 1, 0, 3 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 176, 3 }, { 1, 0, 3 }, },
+ { L"0b1", { 1, 1, 3 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 177, 3 }, { 1, 1, 3 }, },
+ { L"0b2", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 178, 3 }, { 1, 0, 1 }, },
+ { L"0b3", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 179, 3 }, { 1, 0, 1 }, },
+ { L"0b4", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 180, 3 }, { 1, 0, 1 }, },
+ { L"0b5", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 181, 3 }, { 1, 0, 1 }, },
+ { L"0b6", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 182, 3 }, { 1, 0, 1 }, },
+ { L"0b7", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 183, 3 }, { 1, 0, 1 }, },
+ { L"0b8", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 184, 3 }, { 1, 0, 1 }, },
+ { L"0b9", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 185, 3 }, { 1, 0, 1 }, },
+ { L"0bA", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 186, 3 }, { 1, 0, 1 }, },
+ { L"0bB", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 187, 3 }, { 1, 0, 1 }, },
+ { L"0bC", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 188, 3 }, { 1, 0, 1 }, },
+ { L"0bD", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 189, 3 }, { 1, 0, 1 }, },
+ { L"0bE", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 190, 3 }, { 1, 0, 1 }, },
+ { L"0bF", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 191, 3 }, { 1, 0, 1 }, },
+ { L"0bX", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 11, 2 }, { 1, 0, 1 }, },
+ { L"0ba", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 186, 3 }, { 1, 0, 1 }, },
+ { L"0bb", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 187, 3 }, { 1, 0, 1 }, },
+ { L"0bc", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 188, 3 }, { 1, 0, 1 }, },
+ { L"0bd", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 189, 3 }, { 1, 0, 1 }, },
+ { L"0be", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 190, 3 }, { 1, 0, 1 }, },
+ { L"0bf", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 191, 3 }, { 1, 0, 1 }, },
+ { L"0bx", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 11, 2 }, { 1, 0, 1 }, },
+ // all digits with leading hexadecimal prefix
+ { L"0x0", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 3 }, { 1, 0, 3 }, },
+ { L"0x1", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 1, 3 }, { 1, 1, 3 }, },
+ { L"0x2", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 2, 3 }, { 1, 2, 3 }, },
+ { L"0x3", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 3, 3 }, { 1, 3, 3 }, },
+ { L"0x4", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 4, 3 }, { 1, 4, 3 }, },
+ { L"0x5", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 5, 3 }, { 1, 5, 3 }, },
+ { L"0x6", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 6, 3 }, { 1, 6, 3 }, },
+ { L"0x7", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 7, 3 }, { 1, 7, 3 }, },
+ { L"0x8", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 8, 3 }, { 1, 8, 3 }, },
+ { L"0x9", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 9, 3 }, { 1, 9, 3 }, },
+ { L"0xA", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 10, 3 }, { 1, 10, 3 }, },
+ { L"0xB", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 11, 3 }, { 1, 11, 3 }, },
+ { L"0xC", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 12, 3 }, { 1, 12, 3 }, },
+ { L"0xD", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 13, 3 }, { 1, 13, 3 }, },
+ { L"0xE", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 14, 3 }, { 1, 14, 3 }, },
+ { L"0xF", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 15, 3 }, { 1, 15, 3 }, },
+ { L"0xX", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, },
+ { L"0xa", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 10, 3 }, { 1, 10, 3 }, },
+ { L"0xb", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 11, 3 }, { 1, 11, 3 }, },
+ { L"0xc", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 12, 3 }, { 1, 12, 3 }, },
+ { L"0xd", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 13, 3 }, { 1, 13, 3 }, },
+ { L"0xe", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 14, 3 }, { 1, 14, 3 }, },
+ { L"0xf", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 15, 3 }, { 1, 15, 3 }, },
+ { L"0xX", { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, { 1, 0, 1 }, },
+ // terminator
+ { L"" }
+};
+
+#define SWSCANF_TEST(string, format, expret, expval, explen) \
+ do { \
+ int ret = 0, val = 0, len = 0; \
+ ret = swscanf(string, format L"%n", &val, &len); \
+ ATF_CHECK_EQ(expret, ret); \
+ if (expret && ret) { \
+ ATF_CHECK_EQ(expval, val); \
+ ATF_CHECK_EQ(explen, len); \
+ } \
+ } while (0)
+
+ATF_TC_WITHOUT_HEAD(swscanf_b);
+ATF_TC_BODY(swscanf_b, tc)
+{
+ const struct swscanf_test_case *stc;
+ wchar_t input[16];
+
+ for (stc = swscanf_test_cases; *stc->input; stc++) {
+ wcscpy(input + 1, stc->input);
+ SWSCANF_TEST(input + 1, L"%b", stc->b.ret, stc->b.val, stc->b.len);
+ input[0] = L'+';
+ SWSCANF_TEST(input, L"%b", stc->b.ret, stc->b.val, stc->b.len ? stc->b.len + 1 : 0);
+ input[0] = L'-';
+ SWSCANF_TEST(input, L"%b", stc->b.ret, -stc->b.val, stc->b.len ? stc->b.len + 1 : 0);
+ }
+}
+
+ATF_TC_WITHOUT_HEAD(swscanf_o);
+ATF_TC_BODY(swscanf_o, tc)
+{
+ const struct swscanf_test_case *stc;
+ wchar_t input[16];
+
+ for (stc = swscanf_test_cases; *stc->input; stc++) {
+ wcscpy(input + 1, stc->input);
+ SWSCANF_TEST(input + 1, L"%o", stc->o.ret, stc->o.val, stc->o.len);
+ input[0] = L'+';
+ SWSCANF_TEST(input, L"%o", stc->o.ret, stc->o.val, stc->o.len ? stc->o.len + 1 : 0);
+ input[0] = L'-';
+ SWSCANF_TEST(input, L"%o", stc->o.ret, -stc->o.val, stc->o.len ? stc->o.len + 1 : 0);
+ }
+}
+
+ATF_TC_WITHOUT_HEAD(swscanf_d);
+ATF_TC_BODY(swscanf_d, tc)
+{
+ const struct swscanf_test_case *stc;
+ wchar_t input[16];
+
+ for (stc = swscanf_test_cases; *stc->input; stc++) {
+ wcscpy(input + 1, stc->input);
+ SWSCANF_TEST(input + 1, L"%d", stc->d.ret, stc->d.val, stc->d.len);
+ input[0] = L'+';
+ SWSCANF_TEST(input, L"%d", stc->d.ret, stc->d.val, stc->d.len ? stc->d.len + 1 : 0);
+ input[0] = L'-';
+ SWSCANF_TEST(input, L"%d", stc->d.ret, -stc->d.val, stc->d.len ? stc->d.len + 1 : 0);
+ }
+}
+
+ATF_TC_WITHOUT_HEAD(swscanf_x);
+ATF_TC_BODY(swscanf_x, tc)
+{
+ const struct swscanf_test_case *stc;
+ wchar_t input[16];
+
+ for (stc = swscanf_test_cases; *stc->input; stc++) {
+ wcscpy(input + 1, stc->input);
+ SWSCANF_TEST(input + 1, L"%x", stc->x.ret, stc->x.val, stc->x.len);
+ input[0] = L'+';
+ SWSCANF_TEST(input, L"%x", stc->x.ret, stc->x.val, stc->x.len ? stc->x.len + 1 : 0);
+ input[0] = L'-';
+ SWSCANF_TEST(input, L"%x", stc->x.ret, -stc->x.val, stc->x.len ? stc->x.len + 1 : 0);
+ }
+}
+
+ATF_TC_WITHOUT_HEAD(swscanf_i);
+ATF_TC_BODY(swscanf_i, tc)
+{
+ const struct swscanf_test_case *stc;
+ wchar_t input[16];
+
+ for (stc = swscanf_test_cases; *stc->input; stc++) {
+ wcscpy(input + 1, stc->input);
+ SWSCANF_TEST(input + 1, L"%i", stc->i.ret, stc->i.val, stc->i.len);
+ input[0] = L'+';
+ SWSCANF_TEST(input, L"%i", stc->i.ret, stc->i.val, stc->i.len ? stc->i.len + 1 : 0);
+ input[0] = L'-';
+ SWSCANF_TEST(input, L"%i", stc->i.ret, -stc->i.val, stc->i.len ? stc->i.len + 1 : 0);
+ }
+}
+
+ATF_TC_WITHOUT_HEAD(swscanf_wN);
+ATF_TC_BODY(swscanf_wN, tc)
+{
+ const wchar_t x00[] = L"0x00";
+ const wchar_t x7f[] = L"0x7fffffffffffffff";
+ const wchar_t xff[] = L"0xffffffffffffffff";
+
+#define SWSCANF_WN_TEST(N, imin, umax) \
+ do { \
+ int##N##_t i; \
+ uint##N##_t u; \
+ ATF_CHECK_EQ(1, swscanf(x00, L"%w" L(#N) L"i", &i)); \
+ ATF_CHECK_EQ(0, i); \
+ ATF_CHECK_EQ(1, swscanf(x7f, L"%w" L(#N) L"i", &i)); \
+ ATF_CHECK_EQ(imin, i); \
+ ATF_CHECK_EQ(1, swscanf(x00, L"%w" L(#N) L"x", &u)); \
+ ATF_CHECK_EQ(0, u); \
+ ATF_CHECK_EQ(1, swscanf(xff, L"%w" L(#N) L"x", &u)); \
+ ATF_CHECK_EQ(umax, u); \
+ } while (0)
+ SWSCANF_WN_TEST(8, -1, UCHAR_MAX);
+ SWSCANF_WN_TEST(16, -1, USHRT_MAX);
+ SWSCANF_WN_TEST(32, -1, UINT_MAX);
+ SWSCANF_WN_TEST(64, LLONG_MAX, ULLONG_MAX);
+#undef SWSCANF_WN_TEST
+
+ ATF_CHECK_EQ(0, swscanf(x00, L"%wi", (int *)NULL));
+ ATF_CHECK_EQ(0, swscanf(x00, L"%w1i", (int *)NULL));
+ ATF_CHECK_EQ(0, swscanf(x00, L"%w128i", (int *)NULL));
+}
+
+ATF_TC_WITHOUT_HEAD(swscanf_wfN);
+ATF_TC_BODY(swscanf_wfN, tc)
+{
+ const wchar_t x00[] = L"0x00";
+ const wchar_t x7f[] = L"0x7fffffffffffffff";
+ const wchar_t xff[] = L"0xffffffffffffffff";
+
+#define SWSCANF_WFN_TEST(N, imin, umax) \
+ do { \
+ int_fast##N##_t i; \
+ uint_fast##N##_t u; \
+ ATF_CHECK_EQ(1, swscanf(x00, L"%wf" L(#N) L"i", &i)); \
+ ATF_CHECK_EQ(0, i); \
+ ATF_CHECK_EQ(1, swscanf(x7f, L"%wf" L(#N) L"i", &i)); \
+ ATF_CHECK_EQ(imin, i); \
+ ATF_CHECK_EQ(1, swscanf(x00, L"%wf" L(#N) L"x", &u)); \
+ ATF_CHECK_EQ(0, u); \
+ ATF_CHECK_EQ(1, swscanf(xff, L"%wf" L(#N) L"x", &u)); \
+ ATF_CHECK_EQ(umax, u); \
+ } while (0)
+ SWSCANF_WFN_TEST(8, -1, UINT_MAX);
+ SWSCANF_WFN_TEST(16, -1, UINT_MAX);
+ SWSCANF_WFN_TEST(32, -1, UINT_MAX);
+ SWSCANF_WFN_TEST(64, LLONG_MAX, ULLONG_MAX);
+#undef SWSCANF_WFN_TEST
+
+ ATF_CHECK_EQ(0, swscanf(x00, L"%wfi", (int *)NULL));
+ ATF_CHECK_EQ(0, swscanf(x00, L"%wf1i", (int *)NULL));
+ ATF_CHECK_EQ(0, swscanf(x00, L"%wf128i", (int *)NULL));
+}
+
+/*
+ * Test termination cases: non-numeric character, fixed width, EOF
+ */
+ATF_TC_WITHOUT_HEAD(swscanf_termination);
+ATF_TC_BODY(swscanf_termination, tc)
+{
+ int a = 0, b = 0, c = 0;
+ wchar_t d = 0;
+
+ ATF_CHECK_EQ(4, swscanf(L"3.1415", L"%d%lc%2d%d", &a, &d, &b, &c));
+ ATF_CHECK_EQ(3, a);
+ ATF_CHECK_EQ(14, b);
+ ATF_CHECK_EQ(15, c);
+ ATF_CHECK_EQ(L'.', d);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+ setlocale(LC_NUMERIC, "en_US.UTF-8");
+ ATF_TP_ADD_TC(tp, swscanf_b);
+ ATF_TP_ADD_TC(tp, swscanf_o);
+ ATF_TP_ADD_TC(tp, swscanf_d);
+ ATF_TP_ADD_TC(tp, swscanf_x);
+ ATF_TP_ADD_TC(tp, swscanf_i);
+ ATF_TP_ADD_TC(tp, swscanf_wN);
+ ATF_TP_ADD_TC(tp, swscanf_wfN);
+ ATF_TP_ADD_TC(tp, swscanf_termination);
+ return (atf_no_error());
+}
diff --git a/lib/libc/tests/stdlib/Makefile b/lib/libc/tests/stdlib/Makefile
index bd85efcb1b95..860e530389df 100644
--- a/lib/libc/tests/stdlib/Makefile
+++ b/lib/libc/tests/stdlib/Makefile
@@ -1,13 +1,18 @@
-# $FreeBSD$
.include <src.opts.mk>
+ATF_TESTS_C+= clearenv_test
ATF_TESTS_C+= dynthr_test
ATF_TESTS_C+= heapsort_test
ATF_TESTS_C+= mergesort_test
ATF_TESTS_C+= qsort_test
+.if ${COMPILER_TYPE} == "clang"
+ATF_TESTS_C+= qsort_b_test
+.endif
+ATF_TESTS_C+= qsort_r_compat_test
ATF_TESTS_C+= qsort_r_test
ATF_TESTS_C+= qsort_s_test
+ATF_TESTS_C+= quick_exit_test
ATF_TESTS_C+= set_constraint_handler_s_test
ATF_TESTS_C+= strfmon_test
ATF_TESTS_C+= tsearch_test
@@ -58,6 +63,12 @@ CXXSTD.cxa_thread_atexit_test= c++11
CXXSTD.cxa_thread_atexit_nothr_test= c++11
LIBADD.cxa_thread_atexit_test+= pthread
+# Tests that requires Blocks feature
+.for t in qsort_b_test
+CFLAGS.${t}.c+= -fblocks
+LIBADD.${t}+= BlocksRuntime
+.endfor
+
.for t in h_getopt h_getopt_long
CFLAGS.$t+= -I${LIBNETBSD_SRCDIR} -I${SRCTOP}/contrib/netbsd-tests
LDFLAGS.$t+= -L${LIBNETBSD_OBJDIR}
diff --git a/lib/libc/tests/stdlib/Makefile.depend b/lib/libc/tests/stdlib/Makefile.depend
index 7332c13b1b62..777d716dbd01 100644
--- a/lib/libc/tests/stdlib/Makefile.depend
+++ b/lib/libc/tests/stdlib/Makefile.depend
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
diff --git a/lib/libc/tests/stdlib/clearenv_test.c b/lib/libc/tests/stdlib/clearenv_test.c
new file mode 100644
index 000000000000..003535a00060
--- /dev/null
+++ b/lib/libc/tests/stdlib/clearenv_test.c
@@ -0,0 +1,173 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (C) 2021 Mariusz Zaborski <oshogbo@FreeBSD.org>
+ *
+ * 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 AUTHOR 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 AUTHOR 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.
+ */
+
+/*
+ * Test for clearenv(3) routine.
+ */
+
+#include <atf-c.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#define TEST_VARIABLE "TEST_VAR"
+#define TEST_SYSTEM_VARIABLE "PWD"
+
+extern char **environ;
+
+void
+create_multiple_variables(int num)
+{
+ char name[64];
+ char value[64];
+ int i;
+
+ for (i = 0; i < num; i++) {
+ snprintf(name, sizeof(name), "%s_%d", TEST_VARIABLE, i);
+ snprintf(value, sizeof(value), "%d", i);
+ ATF_CHECK(getenv(name) == NULL);
+ ATF_CHECK(setenv(name, value, 0) != -1);
+ ATF_CHECK_STREQ(getenv(name), value);
+ }
+}
+
+void
+check_if_nulled_variables(int num)
+{
+ char name[64];
+ int i;
+
+ for (i = 0; i < num; i++) {
+ snprintf(name, sizeof(name), "%s_%d", TEST_VARIABLE, i);
+ ATF_CHECK(getenv(name) == NULL);
+ }
+}
+
+ATF_TC_WITHOUT_HEAD(clearenv__single_var_test);
+ATF_TC_BODY(clearenv__single_var_test, tc)
+{
+
+ ATF_CHECK(setenv(TEST_VARIABLE, "true", 0) != -1);
+ ATF_CHECK_STREQ(getenv(TEST_VARIABLE), "true");
+ ATF_CHECK(clearenv() == 0);
+ ATF_CHECK(getenv(TEST_VARIABLE) == NULL);
+}
+
+ATF_TC_WITHOUT_HEAD(clearenv__multiple_vars_test);
+ATF_TC_BODY(clearenv__multiple_vars_test, tc)
+{
+
+ create_multiple_variables(10);
+ ATF_CHECK(clearenv() == 0);
+ check_if_nulled_variables(10);
+}
+
+ATF_TC_WITHOUT_HEAD(clearenv__recreated_vars_test);
+ATF_TC_BODY(clearenv__recreated_vars_test, tc)
+{
+
+ create_multiple_variables(10);
+ ATF_CHECK(clearenv() == 0);
+ check_if_nulled_variables(10);
+ create_multiple_variables(10);
+}
+
+ATF_TC_WITHOUT_HEAD(clearenv__system_var_test);
+ATF_TC_BODY(clearenv__system_var_test, tc)
+{
+
+ ATF_CHECK(getenv(TEST_SYSTEM_VARIABLE) != NULL);
+ ATF_CHECK(clearenv() == 0);
+ ATF_CHECK(getenv(TEST_SYSTEM_VARIABLE) == NULL);
+}
+
+ATF_TC_WITHOUT_HEAD(clearenv__recreated_system_var_test);
+ATF_TC_BODY(clearenv__recreated_system_var_test, tc)
+{
+
+ ATF_CHECK(getenv(TEST_SYSTEM_VARIABLE) != NULL);
+ ATF_CHECK(clearenv() == 0);
+ ATF_CHECK(getenv(TEST_SYSTEM_VARIABLE) == NULL);
+ ATF_CHECK(setenv(TEST_SYSTEM_VARIABLE, "test", 0) != -1);
+ ATF_CHECK_STREQ(getenv(TEST_SYSTEM_VARIABLE), "test");
+}
+
+ATF_TC_WITHOUT_HEAD(clearenv__double_clear_vars);
+ATF_TC_BODY(clearenv__double_clear_vars, tc)
+{
+
+ create_multiple_variables(10);
+ ATF_CHECK(clearenv() == 0);
+ check_if_nulled_variables(10);
+ ATF_CHECK(clearenv() == 0);
+ check_if_nulled_variables(10);
+ create_multiple_variables(10);
+}
+
+ATF_TC_WITHOUT_HEAD(clearenv__environ_null);
+ATF_TC_BODY(clearenv__environ_null, tc)
+{
+
+ ATF_CHECK(clearenv() == 0);
+ ATF_CHECK(environ != NULL);
+}
+
+ATF_TC_WITHOUT_HEAD(clearenv__putenv_vars);
+ATF_TC_BODY(clearenv__putenv_vars, tc)
+{
+ char buf[64], ref[64];
+
+ snprintf(buf, sizeof(buf), "%s=1", TEST_VARIABLE);
+ strcpy(ref, buf);
+
+ ATF_CHECK(getenv(TEST_VARIABLE) == NULL);
+ ATF_CHECK(putenv(buf) != -1);
+ ATF_CHECK(strcmp(getenv(TEST_VARIABLE), "1") == 0);
+
+ ATF_CHECK(clearenv() == 0);
+
+ ATF_CHECK(getenv(TEST_VARIABLE) == NULL);
+ ATF_CHECK(strcmp(buf, ref) == 0);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+
+ ATF_TP_ADD_TC(tp, clearenv__single_var_test);
+ ATF_TP_ADD_TC(tp, clearenv__multiple_vars_test);
+ ATF_TP_ADD_TC(tp, clearenv__recreated_vars_test);
+
+ ATF_TP_ADD_TC(tp, clearenv__system_var_test);
+ ATF_TP_ADD_TC(tp, clearenv__recreated_system_var_test);
+
+ ATF_TP_ADD_TC(tp, clearenv__double_clear_vars);
+ ATF_TP_ADD_TC(tp, clearenv__environ_null);
+
+ ATF_TP_ADD_TC(tp, clearenv__putenv_vars);
+
+ return (atf_no_error());
+}
diff --git a/lib/libc/tests/stdlib/cxa_thread_atexit_nothr_test.cc b/lib/libc/tests/stdlib/cxa_thread_atexit_nothr_test.cc
index 3ac360279e8a..0b3b9497a6bd 100644
--- a/lib/libc/tests/stdlib/cxa_thread_atexit_nothr_test.cc
+++ b/lib/libc/tests/stdlib/cxa_thread_atexit_nothr_test.cc
@@ -25,9 +25,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <dlfcn.h>
#include <atf-c++.hpp>
#include <cstdio>
diff --git a/lib/libc/tests/stdlib/cxa_thread_atexit_test.cc b/lib/libc/tests/stdlib/cxa_thread_atexit_test.cc
index ded91c943c8a..628a70b510d1 100644
--- a/lib/libc/tests/stdlib/cxa_thread_atexit_test.cc
+++ b/lib/libc/tests/stdlib/cxa_thread_atexit_test.cc
@@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <dlfcn.h>
#include <atf-c++.hpp>
#include <cstdio>
diff --git a/lib/libc/tests/stdlib/dynthr_mod/Makefile b/lib/libc/tests/stdlib/dynthr_mod/Makefile
index b2a93b3af6d6..1db3a3c9d571 100644
--- a/lib/libc/tests/stdlib/dynthr_mod/Makefile
+++ b/lib/libc/tests/stdlib/dynthr_mod/Makefile
@@ -1,9 +1,9 @@
-# $FreeBSD$
SHLIB_NAME= dynthr_mod.so
SHLIBDIR= ${TESTSDIR}
SRCS= dynthr_mod.c
LIBADD= pthread
+PACKAGE= tests
TESTSDIR:= ${TESTSBASE}/${RELDIR:C/libc\/tests/libc/:H}
diff --git a/lib/libc/tests/stdlib/dynthr_mod/dynthr_mod.c b/lib/libc/tests/stdlib/dynthr_mod/dynthr_mod.c
index 4f5622f47a81..eccffcd0bd49 100644
--- a/lib/libc/tests/stdlib/dynthr_mod/dynthr_mod.c
+++ b/lib/libc/tests/stdlib/dynthr_mod/dynthr_mod.c
@@ -31,9 +31,6 @@
* may be omitted in redistributions.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
@@ -51,6 +48,7 @@ mod_thread(void *ptr __unused)
char *volatile dummy;
dummy = malloc(500);
+ *dummy = 'a';
return (NULL);
}
diff --git a/lib/libc/tests/stdlib/dynthr_test.c b/lib/libc/tests/stdlib/dynthr_test.c
index d72ee280ccb2..5b0af718afc7 100644
--- a/lib/libc/tests/stdlib/dynthr_test.c
+++ b/lib/libc/tests/stdlib/dynthr_test.c
@@ -31,9 +31,6 @@
* may be omitted in redistributions.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
diff --git a/lib/libc/tests/stdlib/heapsort_test.c b/lib/libc/tests/stdlib/heapsort_test.c
index a83786d1cc5f..b6747ff5d3aa 100644
--- a/lib/libc/tests/stdlib/heapsort_test.c
+++ b/lib/libc/tests/stdlib/heapsort_test.c
@@ -28,9 +28,6 @@
* Test for heapsort() routine.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/lib/libc/tests/stdlib/mergesort_test.c b/lib/libc/tests/stdlib/mergesort_test.c
index 4334b924f6bb..156d6bb7c2c3 100644
--- a/lib/libc/tests/stdlib/mergesort_test.c
+++ b/lib/libc/tests/stdlib/mergesort_test.c
@@ -28,9 +28,6 @@
* Test for mergesort() routine.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/lib/libc/mips/gen/signalcontext.c b/lib/libc/tests/stdlib/qsort_b_test.c
index 7870a1efede8..60cd30ac222a 100644
--- a/lib/libc/mips/gen/signalcontext.c
+++ b/lib/libc/tests/stdlib/qsort_b_test.c
@@ -1,7 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 2004 Olivier Houchard
+ * Copyright (C) 2004 Maxim Sobolev <sobomax@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -26,30 +24,53 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+/*
+ * Test for qsort_b() routine.
+ */
-#include <sys/param.h>
-#include <sys/signal.h>
-#include <sys/ucontext.h>
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
-#include <machine/frame.h>
-#include <machine/sigframe.h>
+#include "test-sort.h"
-#include <errno.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <strings.h>
-#include <signal.h>
+ATF_TC_WITHOUT_HEAD(qsort_b_test);
+ATF_TC_BODY(qsort_b_test, tc)
+{
+ int testvector[IVEC_LEN];
+ int sresvector[IVEC_LEN];
+ int i, j;
-__weak_reference(__signalcontext, signalcontext);
+ for (j = 2; j < IVEC_LEN; j++) {
+ /* Populate test vectors */
+ for (i = 0; i < j; i++)
+ testvector[i] = sresvector[i] = initvector[i];
-extern void _ctx_start(void);
+ /* Sort using qsort_b(3) */
+ qsort_b(testvector, j, sizeof(testvector[0]),
+ ^(const void* a, const void* b) {
+ if (*(int *)a > *(int *)b)
+ return (1);
+ else if (*(int *)a < *(int *)b)
+ return (-1);
+ else
+ return (0);
+ });
+ /* Sort using reference slow sorting routine */
+ ssort(sresvector, j);
-int
-__signalcontext(ucontext_t *ucp, int sig, __sighandler_t *func)
+ /* Compare results */
+ for (i = 0; i < j; i++)
+ ATF_CHECK_MSG(testvector[i] == sresvector[i],
+ "item at index %d didn't match: %d != %d",
+ i, testvector[i], sresvector[i]);
+ }
+}
+
+ATF_TP_ADD_TCS(tp)
{
- /* XXXMIPS: Implement me */
- return (0);
+
+ ATF_TP_ADD_TC(tp, qsort_b_test);
+
+ return (atf_no_error());
}
diff --git a/lib/libc/amd64/sys/amd64_get_gsbase.c b/lib/libc/tests/stdlib/qsort_r_compat_test.c
index 0deac34c90d1..d7b06615292e 100644
--- a/lib/libc/amd64/sys/amd64_get_gsbase.c
+++ b/lib/libc/tests/stdlib/qsort_r_compat_test.c
@@ -1,13 +1,8 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 2003 Peter Wemm
- * Copyright (c) 2017, 2018 The FreeBSD Foundation
+ * Copyright (C) 2020 Edward Tomasz Napierala <trasz@FreeBSD.org>
+ * Copyright (C) 2004 Maxim Sobolev <sobomax@FreeBSD.org>
* All rights reserved.
*
- * Portions of this software were developed by Konstantin Belousov
- * under sponsorship from the FreeBSD Foundation.
- *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -30,38 +25,65 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+/*
+ * Test for historical qsort_r(3) routine.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "test-sort.h"
-#define IN_RTLD 1
-#include <sys/param.h>
-#undef IN_RTLD
-#include <machine/cpufunc.h>
-#include <machine/specialreg.h>
-#include <machine/sysarch.h>
-#include <x86/ifunc.h>
-#include "libc_private.h"
+#define THUNK 42
static int
-amd64_get_gsbase_cpu(void **addr)
+sorthelp_r(void *thunk, const void *a, const void *b)
{
+ const int *oa, *ob;
- *addr = (void *)rdgsbase();
+ ATF_REQUIRE_EQ(*(int *)thunk, THUNK);
+
+ oa = a;
+ ob = b;
+ /* Don't use "return *oa - *ob" since it's easy to cause overflow! */
+ if (*oa > *ob)
+ return (1);
+ if (*oa < *ob)
+ return (-1);
return (0);
}
-static int
-amd64_get_gsbase_syscall(void **addr)
+ATF_TC_WITHOUT_HEAD(qsort_r_compat_test);
+ATF_TC_BODY(qsort_r_compat_test, tc)
{
+ int testvector[IVEC_LEN];
+ int sresvector[IVEC_LEN];
+ int i, j;
+ int thunk = THUNK;
+
+ for (j = 2; j < IVEC_LEN; j++) {
+ /* Populate test vectors */
+ for (i = 0; i < j; i++)
+ testvector[i] = sresvector[i] = initvector[i];
- return (sysarch(AMD64_GET_GSBASE, addr));
+ /* Sort using qsort_r(3) */
+ qsort_r(testvector, j, sizeof(testvector[0]), &thunk,
+ sorthelp_r);
+ /* Sort using reference slow sorting routine */
+ ssort(sresvector, j);
+
+ /* Compare results */
+ for (i = 0; i < j; i++)
+ ATF_CHECK_MSG(testvector[i] == sresvector[i],
+ "item at index %d didn't match: %d != %d",
+ i, testvector[i], sresvector[i]);
+ }
}
-DEFINE_UIFUNC(, int, amd64_get_gsbase, (void **))
+ATF_TP_ADD_TCS(tp)
{
- if (__getosreldate() >= P_OSREL_WRFSBASE &&
- (cpu_stdext_feature & CPUID_STDEXT_FSGSBASE) != 0)
- return (amd64_get_gsbase_cpu);
- return (amd64_get_gsbase_syscall);
+ ATF_TP_ADD_TC(tp, qsort_r_compat_test);
+
+ return (atf_no_error());
}
diff --git a/lib/libc/tests/stdlib/qsort_r_test.c b/lib/libc/tests/stdlib/qsort_r_test.c
index c27e6d92d587..446d63279fbf 100644
--- a/lib/libc/tests/stdlib/qsort_r_test.c
+++ b/lib/libc/tests/stdlib/qsort_r_test.c
@@ -29,9 +29,6 @@
* Test for qsort_r(3) routine.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdio.h>
#include <stdlib.h>
@@ -40,7 +37,7 @@ __FBSDID("$FreeBSD$");
#define THUNK 42
static int
-sorthelp_r(void *thunk, const void *a, const void *b)
+sorthelp_r(const void *a, const void *b, void *thunk)
{
const int *oa, *ob;
@@ -70,8 +67,8 @@ ATF_TC_BODY(qsort_r_test, tc)
testvector[i] = sresvector[i] = initvector[i];
/* Sort using qsort_r(3) */
- qsort_r(testvector, j, sizeof(testvector[0]), &thunk,
- sorthelp_r);
+ qsort_r(testvector, j, sizeof(testvector[0]), sorthelp_r,
+ &thunk);
/* Sort using reference slow sorting routine */
ssort(sresvector, j);
diff --git a/lib/libc/tests/stdlib/qsort_s_test.c b/lib/libc/tests/stdlib/qsort_s_test.c
index e3ed7ae3b208..c3210caf24e1 100644
--- a/lib/libc/tests/stdlib/qsort_s_test.c
+++ b/lib/libc/tests/stdlib/qsort_s_test.c
@@ -30,9 +30,6 @@
* Test for qsort_s(3) routine.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/lib/libc/tests/stdlib/qsort_test.c b/lib/libc/tests/stdlib/qsort_test.c
index 14e02925dfa5..a6202e55fd62 100644
--- a/lib/libc/tests/stdlib/qsort_test.c
+++ b/lib/libc/tests/stdlib/qsort_test.c
@@ -28,9 +28,6 @@
* Test for qsort() routine.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/lib/libc/tests/stdlib/quick_exit_test.c b/lib/libc/tests/stdlib/quick_exit_test.c
new file mode 100644
index 000000000000..9feed8a6fa63
--- /dev/null
+++ b/lib/libc/tests/stdlib/quick_exit_test.c
@@ -0,0 +1,81 @@
+/*-
+ * Copyright (c) 2023 Klara, Inc.
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#include <sys/wait.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <atf-c.h>
+
+static void func_a(void)
+{
+ if (write(STDOUT_FILENO, "a", 1) != 1)
+ _Exit(1);
+}
+
+static void func_b(void)
+{
+ if (write(STDOUT_FILENO, "b", 1) != 1)
+ _Exit(1);
+}
+
+static void func_c(void)
+{
+ if (write(STDOUT_FILENO, "c", 1) != 1)
+ _Exit(1);
+}
+
+static void child(void)
+{
+ // this will be received by the parent
+ printf("hello, ");
+ fflush(stdout);
+ // this won't, because quick_exit() does not flush
+ printf("world");
+ // these will be called in reverse order, producing "abc"
+ if (at_quick_exit(func_c) != 0 ||
+ at_quick_exit(func_b) != 0 ||
+ at_quick_exit(func_a) != 0)
+ _Exit(1);
+ quick_exit(0);
+}
+
+ATF_TC_WITHOUT_HEAD(quick_exit);
+ATF_TC_BODY(quick_exit, tc)
+{
+ char buf[100] = "";
+ ssize_t len;
+ int p[2], wstatus = 0;
+ pid_t pid;
+
+ ATF_REQUIRE(pipe(p) == 0);
+ pid = fork();
+ if (pid == 0) {
+ if (dup2(p[1], STDOUT_FILENO) < 0)
+ _Exit(1);
+ (void)close(p[1]);
+ (void)close(p[0]);
+ child();
+ _Exit(1);
+ }
+ ATF_REQUIRE_MSG(pid > 0,
+ "expect fork() to succeed");
+ ATF_CHECK_EQ_MSG(pid, waitpid(pid, &wstatus, 0),
+ "expect to collect child process");
+ ATF_CHECK_EQ_MSG(0, wstatus,
+ "expect child to exit cleanly");
+ ATF_CHECK_MSG((len = read(p[0], buf, sizeof(buf))) > 0,
+ "expect to receive output from child");
+ ATF_CHECK_STREQ("hello, abc", buf);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+ ATF_TP_ADD_TC(tp, quick_exit);
+ return (atf_no_error());
+}
diff --git a/lib/libc/tests/stdlib/set_constraint_handler_s_test.c b/lib/libc/tests/stdlib/set_constraint_handler_s_test.c
index 6a33c98c9279..87db1f71ed4d 100644
--- a/lib/libc/tests/stdlib/set_constraint_handler_s_test.c
+++ b/lib/libc/tests/stdlib/set_constraint_handler_s_test.c
@@ -23,9 +23,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <assert.h>
#include <stdlib.h>
diff --git a/lib/libc/tests/stdlib/strfmon_test.c b/lib/libc/tests/stdlib/strfmon_test.c
index 35825ec31b5b..86f6256dba0b 100644
--- a/lib/libc/tests/stdlib/strfmon_test.c
+++ b/lib/libc/tests/stdlib/strfmon_test.c
@@ -10,7 +10,7 @@
* 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 AUTHOR 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
@@ -24,8 +24,7 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
+#include <sys/param.h>
#include <locale.h>
#include <monetary.h>
@@ -53,19 +52,201 @@ ATF_TC_BODY(strfmon_locale_thousands, tc)
atf_tc_skip("multi-byte thousands-separator not found");
n = 1234.56;
- strfmon(actual, sizeof(actual), "%i", n);
+ strfmon(actual, sizeof(actual) - 1, "%i", n);
strcpy(expected, "1");
strlcat(expected, ts, sizeof(expected));
strlcat(expected, "234", sizeof(expected));
- /* We're just testing the thousands separator, not all of strmon. */
+ /* We're just testing the thousands separator, not all of strfmon. */
actual[strlen(expected)] = '\0';
ATF_CHECK_STREQ(expected, actual);
}
+ATF_TC_WITHOUT_HEAD(strfmon_examples);
+ATF_TC_BODY(strfmon_examples, tc)
+{
+ const struct {
+ const char *format;
+ const char *expected;
+ } tests[] = {
+ { "%n", "[$123.45] [-$123.45] [$3,456.78]" },
+ { "%11n", "[ $123.45] [ -$123.45] [ $3,456.78]" },
+ { "%#5n", "[ $ 123.45] [-$ 123.45] [ $ 3,456.78]" },
+ { "%=*#5n", "[ $***123.45] [-$***123.45] [ $*3,456.78]" },
+ { "%=0#5n", "[ $000123.45] [-$000123.45] [ $03,456.78]" },
+ { "%^#5n", "[ $ 123.45] [-$ 123.45] [ $ 3456.78]" },
+ { "%^#5.0n", "[ $ 123] [-$ 123] [ $ 3457]" },
+ { "%^#5.4n", "[ $ 123.4500] [-$ 123.4500] [ $ 3456.7810]" },
+ { "%(#5n", "[ $ 123.45 ] [($ 123.45)] [ $ 3,456.78 ]" },
+ { "%!(#5n", "[ 123.45 ] [( 123.45)] [ 3,456.78 ]" },
+ { "%-14#5.4n", "[ $ 123.4500 ] [-$ 123.4500 ] [ $ 3,456.7810 ]" },
+ { "%14#5.4n", "[ $ 123.4500] [ -$ 123.4500] [ $ 3,456.7810]" },
+ };
+ size_t i;
+ char actual[100], format[50];
+
+ if (setlocale(LC_MONETARY, "en_US.UTF-8") == NULL)
+ atf_tc_skip("unable to setlocale()");
+
+ for (i = 0; i < nitems(tests); ++i) {
+ snprintf(format, sizeof(format), "[%s] [%s] [%s]",
+ tests[i].format, tests[i].format, tests[i].format);
+ strfmon(actual, sizeof(actual) - 1, format,
+ 123.45, -123.45, 3456.781);
+ ATF_CHECK_STREQ_MSG(tests[i].expected, actual,
+ "[%s]", tests[i].format);
+ }
+}
+
+ATF_TC(strfmon_cs_precedes_0);
+ATF_TC_HEAD(strfmon_cs_precedes_0, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "sep_by_space x sign_posn when cs_precedes = 0");
+}
+ATF_TC_BODY(strfmon_cs_precedes_0, tc)
+{
+ const struct {
+ const char *expected;
+ } tests[] = {
+ /* sep_by_space x sign_posn */
+ { "[(123.00$)] [-123.00$] [123.00$-] [123.00-$] [123.00$-]" },
+ { "[(123.00 $)] [-123.00 $] [123.00 $-] [123.00 -$] [123.00 $-]" },
+ { "[(123.00$)] [- 123.00$] [123.00$ -] [123.00- $] [123.00$ -]" },
+ };
+ size_t i, j;
+ struct lconv *lc;
+ char actual[100], buf[100];
+
+ if (setlocale(LC_MONETARY, "en_US.UTF-8") == NULL)
+ atf_tc_skip("unable to setlocale()");
+
+ lc = localeconv();
+ lc->n_cs_precedes = 0;
+
+ for (i = 0; i < nitems(tests); ++i) {
+ actual[0] = '\0';
+ lc->n_sep_by_space = i;
+
+ for (j = 0; j < 5; ++j) {
+ lc->n_sign_posn = j;
+
+ strfmon(buf, sizeof(buf) - 1, "[%n] ", -123.0);
+ strlcat(actual, buf, sizeof(actual));
+ }
+
+ actual[strlen(actual) - 1] = '\0';
+ ATF_CHECK_STREQ_MSG(tests[i].expected, actual,
+ "sep_by_space = %zu", i);
+ }
+}
+
+ATF_TC(strfmon_cs_precedes_1);
+ATF_TC_HEAD(strfmon_cs_precedes_1, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "sep_by_space x sign_posn when cs_precedes = 1");
+}
+ATF_TC_BODY(strfmon_cs_precedes_1, tc)
+{
+ const struct {
+ const char *expected;
+ } tests[] = {
+ /* sep_by_space x sign_posn */
+ { "[($123.00)] [-$123.00] [$123.00-] [-$123.00] [$-123.00]" },
+ { "[($ 123.00)] [-$ 123.00] [$ 123.00-] [-$ 123.00] [$- 123.00]" },
+ { "[($123.00)] [- $123.00] [$123.00 -] [- $123.00] [$ -123.00]" },
+ };
+ size_t i, j;
+ struct lconv *lc;
+ char actual[100], buf[100];
+
+ if (setlocale(LC_MONETARY, "en_US.UTF-8") == NULL)
+ atf_tc_skip("unable to setlocale()");
+
+ lc = localeconv();
+ lc->n_cs_precedes = 1;
+
+ for (i = 0; i < nitems(tests); ++i) {
+ actual[0] = '\0';
+ lc->n_sep_by_space = i;
+
+ for (j = 0; j < 5; ++j) {
+ lc->n_sign_posn = j;
+
+ strfmon(buf, sizeof(buf) - 1, "[%n] ", -123.0);
+ strlcat(actual, buf, sizeof(actual));
+ }
+
+ actual[strlen(actual) - 1] = '\0';
+ ATF_CHECK_STREQ_MSG(tests[i].expected, actual,
+ "sep_by_space = %zu", i);
+ }
+}
+
+ATF_TC_WITHOUT_HEAD(strfmon_international_currency_code);
+ATF_TC_BODY(strfmon_international_currency_code, tc)
+{
+ const struct {
+ const char *locale;
+ const char *expected;
+ } tests[] = {
+ { "en_US.UTF-8", "[USD123.45]" },
+ { "de_DE.UTF-8", "[123,45 EUR]" },
+ { "C", "[123.45]" },
+ };
+ size_t i;
+ char actual[100];
+
+ for (i = 0; i < nitems(tests); ++i) {
+ if (setlocale(LC_MONETARY, tests[i].locale) == NULL)
+ atf_tc_skip("unable to setlocale()");
+
+ strfmon(actual, sizeof(actual) - 1, "[%i]", 123.45);
+ ATF_CHECK_STREQ(tests[i].expected, actual);
+ }
+}
+
+ATF_TC(strfmon_l);
+ATF_TC_HEAD(strfmon_l, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "checks strfmon_l under different locales");
+}
+ATF_TC_BODY(strfmon_l, tc)
+{
+ const struct {
+ const char *locale;
+ const char *expected;
+ } tests[] = {
+ { "C", "[ **1234.57 ] [ **1234.57 ]" },
+ { "de_DE.UTF-8", "[ **1234,57 €] [ **1.234,57 EUR]" },
+ { "en_GB.UTF-8", "[ £**1234.57] [ GBP**1,234.57]" },
+ };
+ locale_t loc;
+ size_t i;
+ char buf[100];
+
+ for (i = 0; i < nitems(tests); ++i) {
+ loc = newlocale(LC_MONETARY_MASK, tests[i].locale, NULL);
+ ATF_REQUIRE(loc != NULL);
+
+ strfmon_l(buf, sizeof(buf) - 1, loc, "[%^=*#6n] [%=*#6i]",
+ 1234.567, 1234.567);
+ ATF_REQUIRE_STREQ(tests[i].expected, buf);
+
+ freelocale(loc);
+ }
+}
+
ATF_TP_ADD_TCS(tp)
{
ATF_TP_ADD_TC(tp, strfmon_locale_thousands);
+ ATF_TP_ADD_TC(tp, strfmon_examples);
+ ATF_TP_ADD_TC(tp, strfmon_cs_precedes_0);
+ ATF_TP_ADD_TC(tp, strfmon_cs_precedes_1);
+ ATF_TP_ADD_TC(tp, strfmon_international_currency_code);
+ ATF_TP_ADD_TC(tp, strfmon_l);
return (atf_no_error());
}
diff --git a/lib/libc/tests/stdlib/test-sort.h b/lib/libc/tests/stdlib/test-sort.h
index f038acdb42cc..562f92b6748c 100644
--- a/lib/libc/tests/stdlib/test-sort.h
+++ b/lib/libc/tests/stdlib/test-sort.h
@@ -22,8 +22,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 _TEST_SORT_H
diff --git a/lib/libc/tests/stdlib/tsearch_test.c b/lib/libc/tests/stdlib/tsearch_test.c
index ee25743f10b0..ee9deec588cb 100644
--- a/lib/libc/tests/stdlib/tsearch_test.c
+++ b/lib/libc/tests/stdlib/tsearch_test.c
@@ -23,9 +23,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <atf-c.h>
#define _SEARCH_PRIVATE
#include <search.h>
diff --git a/lib/libc/tests/string/Makefile b/lib/libc/tests/string/Makefile
index c6a98572564d..4fce79685c0e 100644
--- a/lib/libc/tests/string/Makefile
+++ b/lib/libc/tests/string/Makefile
@@ -1,13 +1,32 @@
-# $FreeBSD$
+# ensure libc functions are tested, not clang's builtins
+CFLAGS+= -fno-builtin
+
+ATF_TESTS_C+= bcmp_test
+ATF_TESTS_C+= ffs_test
+ATF_TESTS_C+= ffsl_test
+ATF_TESTS_C+= ffsll_test
+ATF_TESTS_C+= fls_test
+ATF_TESTS_C+= flsl_test
+ATF_TESTS_C+= flsll_test
+ATF_TESTS_C+= memccpy_test
ATF_TESTS_C+= memcmp_test
+ATF_TESTS_C+= memrchr_test
ATF_TESTS_C+= memset_s_test
+ATF_TESTS_C+= strncmp_test
ATF_TESTS_C+= stpncpy_test
+ATF_TESTS_C+= strcmp2_test
+ATF_TESTS_C+= strcspn_test
ATF_TESTS_C+= strerror2_test
-ATF_TESTS_C+= wcscasecmp_test
-ATF_TESTS_C+= wcsnlen_test
+ATF_TESTS_C+= strlcpy_test
+ATF_TESTS_C+= strspn_test
+ATF_TESTS_C+= strverscmp_test
ATF_TESTS_C+= strxfrm_test
+ATF_TESTS_C+= timingsafe_bcmp_test
+ATF_TESTS_C+= timingsafe_memcmp_test
+ATF_TESTS_C+= wcscasecmp_test
ATF_TESTS_C+= wcscoll_test
+ATF_TESTS_C+= wcsnlen_test
# TODO: popcount, stresep
@@ -17,16 +36,16 @@ NETBSD_ATF_TESTS_C+= memmem_test
NETBSD_ATF_TESTS_C+= memset_test
NETBSD_ATF_TESTS_C+= strcat_test
NETBSD_ATF_TESTS_C+= strchr_test
+NETBSD_ATF_TESTS_C+= strchrnul_test
NETBSD_ATF_TESTS_C+= strcmp_test
NETBSD_ATF_TESTS_C+= strcpy_test
-NETBSD_ATF_TESTS_C+= strcspn_test
NETBSD_ATF_TESTS_C+= strerror_test
NETBSD_ATF_TESTS_C+= strlen_test
NETBSD_ATF_TESTS_C+= strpbrk_test
NETBSD_ATF_TESTS_C+= strrchr_test
-NETBSD_ATF_TESTS_C+= strspn_test
NETBSD_ATF_TESTS_C+= swab_test
+SRCS.strcmp2_test= strcmp_test.c
SRCS.strerror2_test= strerror_test.c
.include "../Makefile.netbsd-tests"
diff --git a/lib/libc/tests/string/Makefile.depend b/lib/libc/tests/string/Makefile.depend
index 8e6506e2f706..946944e9e951 100644
--- a/lib/libc/tests/string/Makefile.depend
+++ b/lib/libc/tests/string/Makefile.depend
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
diff --git a/lib/libc/powerpc64/gen/_set_tp.c b/lib/libc/tests/string/bcmp_test.c
index 541ad2d0d8a4..fdf5e48b3eb4 100644
--- a/lib/libc/powerpc64/gen/_set_tp.c
+++ b/lib/libc/tests/string/bcmp_test.c
@@ -1,8 +1,8 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * Copyright (c) 2023 The FreeBSD Foundation
*
- * Copyright (c) 2004 Doug Rabson
- * All rights reserved.
+ * This software was developed by Robert Clausecker <fuz@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -13,25 +13,20 @@
* 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR OR CONTRIBUTORS BE LIABLE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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.
- *
- * $FreeBSD$
+ * SUCH DAMAGE
*/
-#include "libc_private.h"
-void
-_set_tp(void *tpval)
-{
+#define MEMCMP bcmp
+#define RES(x) ((x) != 0)
- __asm __volatile("mr 13,%0" :: "r"((char*)tpval + 0x7010));
-}
+#include "memcmp_test.c"
diff --git a/lib/libc/tests/string/ffs_test.c b/lib/libc/tests/string/ffs_test.c
new file mode 100644
index 000000000000..4b59385d712e
--- /dev/null
+++ b/lib/libc/tests/string/ffs_test.c
@@ -0,0 +1,87 @@
+/*-
+ * Copyright (c) 2023 The FreeBSD Foundation
+ *
+ * This software was developed by Robert Clausecker <fuz@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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 AUTHOR 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 AUTHOR 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
+ */
+
+#include <atf-c.h>
+#include <limits.h>
+#include <stdint.h>
+#include <strings.h>
+
+#ifndef FFS
+# define FFS ffs
+# define TYPE int
+# define TYPE_MIN INT_MIN
+#endif
+
+ATF_TC_WITHOUT_HEAD(zero);
+ATF_TC_BODY(zero, tc)
+{
+ ATF_CHECK_EQ((TYPE)0, FFS(0));
+}
+
+ATF_TC_WITHOUT_HEAD(twobit);
+ATF_TC_BODY(twobit, tc)
+{
+ const TYPE one = 1;
+ TYPE x;
+ const int n = sizeof(TYPE) * CHAR_BIT;
+ int i, j;
+
+ for (i = 0; i < n - 1; i++)
+ for (j = 0; j <= i; j++) {
+ x = one << i | one << j;
+ ATF_CHECK_EQ_MSG(j + 1, FFS(x),
+ "%s(%#jx) == %d != %d", __STRING(FFS), (intmax_t)x, FFS(x), j + 1);
+ }
+}
+
+ATF_TC_WITHOUT_HEAD(twobitneg);
+ATF_TC_BODY(twobitneg, tc)
+{
+ const TYPE one = 1;
+ TYPE x;
+ const int n = sizeof(TYPE) * CHAR_BIT;
+ int i, j;
+
+ for (i = 0; i < n - 1; i++)
+ for (j = 0; j <= i; j++) {
+ x = one << i | one << j | TYPE_MIN;
+ ATF_CHECK_EQ_MSG(j + 1, FFS(x),
+ "%s(%#jx) == %d != %d", __STRING(FFS), (intmax_t)x, FFS(x), j + 1);
+ }
+}
+
+
+ATF_TP_ADD_TCS(tp)
+{
+
+ ATF_TP_ADD_TC(tp, zero);
+ ATF_TP_ADD_TC(tp, twobit);
+ ATF_TP_ADD_TC(tp, twobitneg);
+
+ return (atf_no_error());
+}
diff --git a/lib/libc/tests/string/ffsl_test.c b/lib/libc/tests/string/ffsl_test.c
new file mode 100644
index 000000000000..809cea3d3a93
--- /dev/null
+++ b/lib/libc/tests/string/ffsl_test.c
@@ -0,0 +1,32 @@
+/*-
+ * Copyright (c) 2023 The FreeBSD Foundation
+ *
+ * This software was developed by Robert Clausecker <fuz@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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 AUTHOR 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 AUTHOR 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
+ */
+#define FFS ffsl
+#define TYPE long
+#define TYPE_MIN LONG_MIN
+
+#include "ffs_test.c"
diff --git a/lib/libc/tests/string/ffsll_test.c b/lib/libc/tests/string/ffsll_test.c
new file mode 100644
index 000000000000..1a620cbf9aba
--- /dev/null
+++ b/lib/libc/tests/string/ffsll_test.c
@@ -0,0 +1,32 @@
+/*-
+ * Copyright (c) 2023 The FreeBSD Foundation
+ *
+ * This software was developed by Robert Clausecker <fuz@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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 AUTHOR 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 AUTHOR 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
+ */
+#define FFS ffsll
+#define TYPE long long
+#define TYPE_MIN LLONG_MIN
+
+#include "ffs_test.c"
diff --git a/lib/libc/tests/string/fls_test.c b/lib/libc/tests/string/fls_test.c
new file mode 100644
index 000000000000..55691b36617c
--- /dev/null
+++ b/lib/libc/tests/string/fls_test.c
@@ -0,0 +1,87 @@
+/*-
+ * Copyright (c) 2023 The FreeBSD Foundation
+ *
+ * This software was developed by Robert Clausecker <fuz@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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 AUTHOR 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 AUTHOR 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
+ */
+
+#include <atf-c.h>
+#include <limits.h>
+#include <stdint.h>
+#include <strings.h>
+
+#ifndef FLS
+# define FLS fls
+# define TYPE int
+# define TYPE_MIN INT_MIN
+#endif
+
+ATF_TC_WITHOUT_HEAD(zero);
+ATF_TC_BODY(zero, tc)
+{
+ ATF_CHECK_EQ((TYPE)0, FLS(0));
+}
+
+ATF_TC_WITHOUT_HEAD(twobit);
+ATF_TC_BODY(twobit, tc)
+{
+ const TYPE one = 1;
+ TYPE x;
+ const int n = sizeof(TYPE) * CHAR_BIT;
+ int i, j;
+
+ for (i = 0; i < n - 1; i++)
+ for (j = 0; j <= i; j++) {
+ x = one << i | one << j;
+ ATF_CHECK_EQ_MSG(i + 1, FLS(x),
+ "%s(%#jx) == %d != %d", __STRING(FLS), (intmax_t)x, FLS(x), i + 1);
+ }
+}
+
+ATF_TC_WITHOUT_HEAD(twobitneg);
+ATF_TC_BODY(twobitneg, tc)
+{
+ const TYPE one = 1;
+ TYPE x;
+ const int n = sizeof(TYPE) * CHAR_BIT;
+ int i, j;
+
+ for (i = 0; i < n - 1; i++)
+ for (j = 0; j <= i; j++) {
+ x = one << i | one << j | TYPE_MIN;
+ ATF_CHECK_EQ_MSG(n, FLS(x),
+ "%s(%#jx) == %d != %d", __STRING(FLS), (intmax_t)x, FLS(x), n);
+ }
+}
+
+
+ATF_TP_ADD_TCS(tp)
+{
+
+ ATF_TP_ADD_TC(tp, zero);
+ ATF_TP_ADD_TC(tp, twobit);
+ ATF_TP_ADD_TC(tp, twobitneg);
+
+ return (atf_no_error());
+}
diff --git a/lib/libc/tests/string/flsl_test.c b/lib/libc/tests/string/flsl_test.c
new file mode 100644
index 000000000000..4b1e330d4564
--- /dev/null
+++ b/lib/libc/tests/string/flsl_test.c
@@ -0,0 +1,32 @@
+/*-
+ * Copyright (c) 2023 The FreeBSD Foundation
+ *
+ * This software was developed by Robert Clausecker <fuz@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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 AUTHOR 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 AUTHOR 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
+ */
+#define FLS flsl
+#define TYPE long
+#define TYPE_MIN LONG_MIN
+
+#include "fls_test.c"
diff --git a/lib/libc/tests/string/flsll_test.c b/lib/libc/tests/string/flsll_test.c
new file mode 100644
index 000000000000..23f469b7b5de
--- /dev/null
+++ b/lib/libc/tests/string/flsll_test.c
@@ -0,0 +1,32 @@
+/*-
+ * Copyright (c) 2023 The FreeBSD Foundation
+ *
+ * This software was developed by Robert Clausecker <fuz@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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 AUTHOR 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 AUTHOR 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
+ */
+#define FLS flsll
+#define TYPE long long
+#define TYPE_MIN LLONG_MIN
+
+#include "fls_test.c"
diff --git a/lib/libc/tests/string/memccpy_test.c b/lib/libc/tests/string/memccpy_test.c
new file mode 100644
index 000000000000..82f4ef34af54
--- /dev/null
+++ b/lib/libc/tests/string/memccpy_test.c
@@ -0,0 +1,205 @@
+/*-
+ * Copyright (c) 2009 David Schultz <das@FreeBSD.org>
+ * Copyright (c) 2023 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Robert Clausecker
+ * <fuz@FreeBSD.org> under sponsorship from the FreeBSD Foundation.
+ *
+ * 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 AUTHOR 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 AUTHOR 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.
+ */
+
+#include <sys/cdefs.h>
+#include <sys/param.h>
+#include <sys/mman.h>
+#include <assert.h>
+#include <dlfcn.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <atf-c.h>
+
+void *(*memccpy_fn)(void *restrict, const void *restrict, int, size_t);
+
+static char *
+makebuf(size_t len, int guard_at_end)
+{
+ char *buf;
+ size_t alloc_size, page_size;
+
+ page_size = getpagesize();
+ alloc_size = roundup2(len, page_size) + page_size;
+
+ buf = mmap(NULL, alloc_size, PROT_READ | PROT_WRITE, MAP_ANON, -1, 0);
+ assert(buf);
+ if (guard_at_end) {
+ assert(munmap(buf + alloc_size - page_size, page_size) == 0);
+ return (buf + alloc_size - page_size - len);
+ } else {
+ assert(munmap(buf, page_size) == 0);
+ return (buf + page_size);
+ }
+}
+
+static void
+test_memccpy(const char *s)
+{
+ char *src, *dst, *expected;
+ size_t size, bufsize, x;
+ int i, j;
+
+ size = strlen(s) + 1;
+ for (i = 0; i <= 1; i++) {
+ for (j = 0; j <= 1; j++) {
+ for (bufsize = 0; bufsize <= size + 10; bufsize++) {
+ src = makebuf(size, i);
+ memcpy(src, s, size);
+ dst = makebuf(bufsize, j);
+ memset(dst, 'X', bufsize);
+ expected = bufsize >= size ? dst + size : NULL;
+ assert(memccpy_fn(dst, src, src[size-1], bufsize) == expected);
+ assert(bufsize == 0 || strncmp(src, dst, bufsize - 1) == 0);
+ for (x = size; x < bufsize; x++)
+ assert(dst[x] == 'X');
+ }
+ }
+ }
+}
+
+static void
+test_sentinel(char *dest, char *src, size_t destlen, size_t srclen)
+{
+ size_t i, effective_len;
+ void *res, *wantres;
+ const char *fail = NULL;
+ char terminator;
+
+ for (i = 0; i < srclen; i++)
+ /* src will never include (){} */
+ src[i] = '0' + i;
+
+ /* source sentinels: not to be copied */
+ src[-1] = '(';
+ src[srclen] = ')';
+
+ memset(dest, '\xee', destlen);
+
+ /* destination sentinels: not to be touched */
+ dest[-1] = '{';
+ dest[destlen] = '}';
+
+ effective_len = srclen < destlen ? srclen : destlen;
+ wantres = srclen <= destlen ? dest + srclen : NULL;
+ terminator = src[srclen-1];
+ res = memccpy_fn(dest, src, terminator, destlen);
+
+ if (dest[-1] != '{')
+ fail = "start sentinel overwritten";
+ else if (dest[destlen] != '}')
+ fail = "end sentinel overwritten";
+ else if (res != wantres)
+ fail = "incorrect return value";
+ else if (destlen > 0 && memcmp(src, dest, effective_len) != 0)
+ fail = "string not copied correctly";
+ else for (i = srclen; i < destlen; i++)
+ if (dest[i] != '\xee') {
+ fail = "buffer mutilated behind string";
+ break;
+ }
+
+ if (fail)
+ atf_tc_fail_nonfatal("%s\n"
+ "memccpy(%p \"%s\", %p \"%s\", %u '%c', %zu) = %p (want %p)\n",
+ fail, dest, dest, src, src, terminator, terminator, destlen, res, wantres);
+}
+
+ATF_TC_WITHOUT_HEAD(null);
+ATF_TC_BODY(null, tc)
+{
+ ATF_CHECK_EQ(memccpy_fn(NULL, "foo", 42, 0), NULL);
+}
+
+ATF_TC(zero_extension);
+ATF_TC_HEAD(zero_extension, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Ensure the upper bits of the terminator are ignored");
+}
+ATF_TC_BODY(zero_extension, tc)
+{
+ int mask = -1 & ~UCHAR_MAX;
+ char buf[16];
+
+ memset(buf, 0xcc, sizeof(buf));
+ ATF_CHECK_EQ(memccpy(buf, "foobar", 'r', sizeof(buf)), buf + sizeof("foobar") - 1);
+ ATF_CHECK_EQ(memcmp(buf, "foobar", sizeof("foobar") - 1), 0);
+
+ memset(buf, 0xcc, sizeof(buf));
+ ATF_CHECK_EQ(memccpy(buf, "foobar", mask | 'r', sizeof(buf)), buf + sizeof("foobar") - 1);
+ ATF_CHECK_EQ(memcmp(buf, "foobar", sizeof("foobar") - 1), 0);
+}
+
+ATF_TC_WITHOUT_HEAD(bounds);
+ATF_TC_BODY(bounds, tc)
+{
+ size_t i;
+ char buf[64];
+
+ for (i = 0; i < sizeof(buf) - 1; i++) {
+ buf[i] = ' ' + i;
+ test_memccpy(buf);
+ }
+}
+
+ATF_TC_WITHOUT_HEAD(alignments);
+ATF_TC_BODY(alignments, tc)
+{
+ size_t srcalign, destalign, srclen, destlen;
+ char src[15+2+64]; /* 15 offsets + 64 max length + sentinels */
+ char dest[15+2+64]; /* 15 offsets + 64 max length + sentinels */
+
+ for (srcalign = 0; srcalign < 16; srcalign++)
+ for (destalign = 0; destalign < 16; destalign++)
+ for (srclen = 1; srclen < 64; srclen++)
+ for (destlen = 0; destlen < 64; destlen++)
+ test_sentinel(dest+destalign+1,
+ src+srcalign+1, destlen, srclen);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+ void *dl_handle;
+
+ dl_handle = dlopen(NULL, RTLD_LAZY);
+ memccpy_fn = dlsym(dl_handle, "test_memccpy");
+ if (memccpy_fn == NULL)
+ memccpy_fn = memccpy;
+
+ ATF_TP_ADD_TC(tp, null);
+ ATF_TP_ADD_TC(tp, zero_extension);
+ ATF_TP_ADD_TC(tp, bounds);
+ ATF_TP_ADD_TC(tp, alignments);
+
+ return (atf_no_error());
+}
diff --git a/lib/libc/tests/string/memcmp_test.c b/lib/libc/tests/string/memcmp_test.c
index d7fbd8c342bd..5286a0b994f3 100644
--- a/lib/libc/tests/string/memcmp_test.c
+++ b/lib/libc/tests/string/memcmp_test.c
@@ -1,7 +1,11 @@
/*-
* Copyright (c) 2016 Jilles Tjoelker <jilles@FreeBSD.org>
+ * Copyright (c) 2023 The FreeBSD Foundation
* All rights reserved.
*
+ * Portions of this software were developed by Robert Clausecker
+ * <fuz@FreeBSD.org> under sponsorship from the FreeBSD Foundation.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -24,22 +28,48 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <assert.h>
+#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <atf-c.h>
+#ifndef MEMCMP
+#define MEMCMP memcmp
+#endif
+
+/*
+ * On FreeBSD we demand that memcmp returns the difference between the
+ * characters at the first site of mismatch. However, ISO/IEC 9899:1990
+ * only specifies that a number greater than, equal to, or less than
+ * zero shall be returned. If a unit test for this less strict
+ * behaviour is desired, define RES(x) to be (((x) > 0) - ((x) < 0)).
+ */
+#ifndef RES
+#define RES(x) (x)
+#endif
+
+static int (*memcmp_fn)(const void *, const void *, size_t);
+
+static void
+check_memcmp(const char *a, const char *b, size_t len, int expected)
+{
+ int got;
+
+ got = memcmp_fn(a, b, len);
+ ATF_CHECK_EQ_MSG(RES(expected), RES(got),
+ "%s(%p, %p, %zu) gave %d, but wanted %d",
+ __XSTRING(MEMCMP), a, b, len, got, expected);
+}
+
ATF_TC_WITHOUT_HEAD(zero);
ATF_TC_BODY(zero, tc)
{
- assert(memcmp("a", "b", 0) == 0);
- assert(memcmp("", "", 0) == 0);
+ check_memcmp("a", "b", 0, 0);
+ check_memcmp("", "", 0, 0);
}
ATF_TC_WITHOUT_HEAD(eq);
@@ -51,9 +81,9 @@ ATF_TC_BODY(eq, tc)
for (i = 0; i < 256; i++)
data1[i] = data2[i] = i ^ 0x55;
for (i = 1; i < 256; i++)
- assert(memcmp(data1, data2, i) == 0);
+ check_memcmp(data1, data2, i, 0);
for (i = 1; i < 256; i++)
- assert(memcmp(data1 + i, data2 + i, 256 - i) == 0);
+ check_memcmp(data1 + i, data2 + i, 256 - i, 0);
}
ATF_TC_WITHOUT_HEAD(neq);
@@ -67,9 +97,9 @@ ATF_TC_BODY(neq, tc)
data2[i] = i ^ 0x55;
}
for (i = 1; i < 256; i++)
- assert(memcmp(data1, data2, i) != 0);
+ check_memcmp(data1, data2, i, -0x55);
for (i = 1; i < 256; i++)
- assert(memcmp(data1 + i, data2 + i, 256 - i) != 0);
+ check_memcmp(data1 + i, data2 + i, 256 - i, i - (i ^ 0x55));
}
ATF_TC_WITHOUT_HEAD(diff);
@@ -83,37 +113,43 @@ ATF_TC_BODY(diff, tc)
data1[128] = 255;
data2[128] = 0;
for (i = 1; i < 66; i++) {
- assert(memcmp(data1 + 128, data2 + 128, i) == 255);
- assert(memcmp(data2 + 128, data1 + 128, i) == -255);
- assert(memcmp(data1 + 129 - i, data2 + 129 - i, i) == 255);
- assert(memcmp(data2 + 129 - i, data1 + 129 - i, i) == -255);
- assert(memcmp(data1 + 129 - i, data2 + 129 - i, i * 2) == 255);
- assert(memcmp(data2 + 129 - i, data1 + 129 - i, i * 2) == -255);
+ check_memcmp(data1 + 128, data2 + 128, i, 255);
+ check_memcmp(data2 + 128, data1 + 128, i, -255);
+ check_memcmp(data1 + 129 - i, data2 + 129 - i, i, 255);
+ check_memcmp(data2 + 129 - i, data1 + 129 - i, i, -255);
+ check_memcmp(data1 + 129 - i, data2 + 129 - i, i * 2, 255);
+ check_memcmp(data2 + 129 - i, data1 + 129 - i, i * 2, -255);
}
data1[128] = 'c';
data2[128] = 'e';
for (i = 1; i < 66; i++) {
- assert(memcmp(data1 + 128, data2 + 128, i) == -2);
- assert(memcmp(data2 + 128, data1 + 128, i) == 2);
- assert(memcmp(data1 + 129 - i, data2 + 129 - i, i) == -2);
- assert(memcmp(data2 + 129 - i, data1 + 129 - i, i) == 2);
- assert(memcmp(data1 + 129 - i, data2 + 129 - i, i * 2) == -2);
- assert(memcmp(data2 + 129 - i, data1 + 129 - i, i * 2) == 2);
+ check_memcmp(data1 + 128, data2 + 128, i, -2);
+ check_memcmp(data2 + 128, data1 + 128, i, 2);
+ check_memcmp(data1 + 129 - i, data2 + 129 - i, i, -2);
+ check_memcmp(data2 + 129 - i, data1 + 129 - i, i, 2);
+ check_memcmp(data1 + 129 - i, data2 + 129 - i, i * 2, -2);
+ check_memcmp(data2 + 129 - i, data1 + 129 - i, i * 2, 2);
}
memset(data1 + 129, 'A', sizeof(data1) - 129);
memset(data2 + 129, 'Z', sizeof(data2) - 129);
for (i = 1; i < 66; i++) {
- assert(memcmp(data1 + 128, data2 + 128, i) == -2);
- assert(memcmp(data2 + 128, data1 + 128, i) == 2);
- assert(memcmp(data1 + 129 - i, data2 + 129 - i, i) == -2);
- assert(memcmp(data2 + 129 - i, data1 + 129 - i, i) == 2);
- assert(memcmp(data1 + 129 - i, data2 + 129 - i, i * 2) == -2);
- assert(memcmp(data2 + 129 - i, data1 + 129 - i, i * 2) == 2);
+ check_memcmp(data1 + 128, data2 + 128, i, -2);
+ check_memcmp(data2 + 128, data1 + 128, i, 2);
+ check_memcmp(data1 + 129 - i, data2 + 129 - i, i, -2);
+ check_memcmp(data2 + 129 - i, data1 + 129 - i, i, 2);
+ check_memcmp(data1 + 129 - i, data2 + 129 - i, i * 2, -2);
+ check_memcmp(data2 + 129 - i, data1 + 129 - i, i * 2, 2);
}
}
ATF_TP_ADD_TCS(tp)
{
+ void *dl_handle;
+
+ dl_handle = dlopen(NULL, RTLD_LAZY);
+ memcmp_fn = dlsym(dl_handle, "test_" __XSTRING(MEMCMP));
+ if (memcmp_fn == NULL)
+ memcmp_fn = MEMCMP;
ATF_TP_ADD_TC(tp, zero);
ATF_TP_ADD_TC(tp, eq);
diff --git a/lib/libc/tests/string/memrchr_test.c b/lib/libc/tests/string/memrchr_test.c
new file mode 100644
index 000000000000..12f696c9dc1e
--- /dev/null
+++ b/lib/libc/tests/string/memrchr_test.c
@@ -0,0 +1,116 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2023 Robert Clausecker
+ */
+
+#include <sys/cdefs.h>
+
+#include <dlfcn.h>
+#include <limits.h>
+#include <string.h>
+
+#include <atf-c.h>
+
+static void *(*memrchr_fn)(const void *, int, size_t);
+
+ATF_TC_WITHOUT_HEAD(null);
+ATF_TC_BODY(null, tc)
+{
+ ATF_CHECK_EQ(memrchr_fn(NULL, 42, 0), NULL);
+}
+
+ATF_TC_WITHOUT_HEAD(not_found);
+ATF_TC_BODY(not_found, tc)
+{
+ size_t i, j;
+ char buf[1+15+64+1]; /* offset [0..15] + 64 buffer bytes + sentinels */
+
+ buf[0] = 'X';
+ memset(buf + 1, '-', sizeof(buf) - 1);
+
+ for (i = 0; i < 16; i++)
+ for (j = 0; j < 64; j++) {
+ buf[i + j + 1] = 'X';
+ ATF_CHECK_EQ(memrchr_fn(buf + i + 1, 'X', j), NULL);
+ buf[i + j + 1] = '-';
+ }
+}
+
+static void
+do_found_test(char buf[], size_t len, size_t first, size_t second)
+{
+ /* invariant: first <= second */
+
+ buf[first] = 'X';
+ buf[second] = 'X';
+ ATF_CHECK_EQ(memrchr_fn(buf, 'X', len), buf + second);
+ buf[first] = '-';
+ buf[second] = '-';
+}
+
+ATF_TC_WITHOUT_HEAD(found);
+ATF_TC_BODY(found, tc)
+{
+ size_t i, j, k, l;
+ char buf[1+15+64+1];
+
+ buf[0] = 'X';
+ memset(buf + 1, '-', sizeof(buf) - 1);
+
+ for (i = 0; i < 16; i++)
+ for (j = 0; j < 64; j++)
+ for (k = 0; k < j; k++)
+ for (l = 0; l <= k; l++) {
+ buf[i + j + 1] = 'X';
+ do_found_test(buf + i + 1, j, l, k);
+ buf[i + j + 1] = '-';
+ }
+}
+
+/* check that the right character is found */
+static void
+do_values_test(unsigned char buf[], size_t len, size_t i, int c)
+{
+ /* sentinels */
+ buf[-1] = c;
+ buf[len] = c;
+ memset(buf, c + 1, len);
+
+ if (i < len) {
+ buf[i] = c;
+ ATF_CHECK_EQ(memrchr_fn(buf, c, len), buf + i);
+ } else
+ ATF_CHECK_EQ(memrchr_fn(buf, c, len), NULL);
+}
+
+ATF_TC_WITHOUT_HEAD(values);
+ATF_TC_BODY(values, tc)
+{
+ size_t i, j, k;
+ int c;
+ unsigned char buf[1+15+64+1];
+
+ for (i = 0; i < 16; i++)
+ for (j = 0; j < 64; j++)
+ for (k = 0; k <= j; k++)
+ for (c = 0; c <= UCHAR_MAX; c++)
+ do_values_test(buf + i + 1, j, k, c);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+ void *dl_handle;
+
+ dl_handle = dlopen(NULL, RTLD_LAZY);
+ memrchr_fn = dlsym(dl_handle, "test_memrchr");
+ if (memrchr_fn == NULL)
+ memrchr_fn = memrchr;
+
+ ATF_TP_ADD_TC(tp, null);
+ ATF_TP_ADD_TC(tp, not_found);
+ ATF_TP_ADD_TC(tp, found);
+ ATF_TP_ADD_TC(tp, values);
+
+ return (atf_no_error());
+}
diff --git a/lib/libc/tests/string/memset_s_test.c b/lib/libc/tests/string/memset_s_test.c
index e0cfd867ff2a..c822a2ee4554 100644
--- a/lib/libc/tests/string/memset_s_test.c
+++ b/lib/libc/tests/string/memset_s_test.c
@@ -23,9 +23,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
diff --git a/lib/libc/tests/string/stpncpy_test.c b/lib/libc/tests/string/stpncpy_test.c
index 0a7b1d28e9c1..8574b2d591be 100644
--- a/lib/libc/tests/string/stpncpy_test.c
+++ b/lib/libc/tests/string/stpncpy_test.c
@@ -1,7 +1,11 @@
/*-
* Copyright (c) 2009 David Schultz <das@FreeBSD.org>
+ * Copyright (c) 2023 The FreeBSD Foundation
* All rights reserved.
*
+ * Portions of this software were developed by Robert Clausecker
+ * <fuz@FreeBSD.org> under sponsorship from the FreeBSD Foundation.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -24,32 +28,35 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/mman.h>
#include <assert.h>
+#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <atf-c.h>
+static char *(*stpncpy_fn)(char *restrict, const char *restrict, size_t);
+
static char *
makebuf(size_t len, int guard_at_end)
{
char *buf;
- size_t alloc_size = roundup2(len, PAGE_SIZE) + PAGE_SIZE;
+ size_t alloc_size, page_size;
+
+ page_size = getpagesize();
+ alloc_size = roundup2(len, page_size) + page_size;
buf = mmap(NULL, alloc_size, PROT_READ | PROT_WRITE, MAP_ANON, -1, 0);
assert(buf);
if (guard_at_end) {
- assert(munmap(buf + alloc_size - PAGE_SIZE, PAGE_SIZE) == 0);
- return (buf + alloc_size - PAGE_SIZE - len);
+ assert(munmap(buf + alloc_size - page_size, page_size) == 0);
+ return (buf + alloc_size - page_size - len);
} else {
- assert(munmap(buf, PAGE_SIZE) == 0);
- return (buf + PAGE_SIZE);
+ assert(munmap(buf, page_size) == 0);
+ return (buf + page_size);
}
}
@@ -69,7 +76,7 @@ test_stpncpy(const char *s)
dst = makebuf(bufsize, j);
memset(dst, 'X', bufsize);
len = (bufsize < size) ? bufsize : size - 1;
- assert(stpncpy(dst, src, bufsize) == dst+len);
+ assert(stpncpy_fn(dst, src, bufsize) == dst+len);
assert(memcmp(src, dst, len) == 0);
for (x = len; x < bufsize; x++)
assert(dst[x] == '\0');
@@ -78,33 +85,97 @@ test_stpncpy(const char *s)
}
}
-ATF_TC_WITHOUT_HEAD(nul);
-ATF_TC_BODY(nul, tc)
+static void
+test_sentinel(char *dest, char *src, size_t destlen, size_t srclen)
{
+ size_t i;
+ const char *res, *wantres;
+ const char *fail = NULL;
+
+ for (i = 0; i < srclen; i++)
+ /* src will never include (){} */
+ src[i] = '0' + i;
+ src[srclen] = '\0';
+
+ /* source sentinels: not to be copied */
+ src[-1] = '(';
+ src[srclen+1] = ')';
+
+ memset(dest, 0xee, destlen);
+
+ /* destination sentinels: not to be touched */
+ dest[-1] = '{';
+ dest[destlen] = '}';
+
+ wantres = dest + (srclen > destlen ? destlen : srclen);
+ res = stpncpy_fn(dest, src, destlen);
+
+ if (dest[-1] != '{')
+ fail = "start sentinel overwritten";
+ else if (dest[destlen] != '}')
+ fail = "end sentinel overwritten";
+ else if (strncmp(src, dest, destlen) != 0)
+ fail = "string not copied correctly";
+ else if (res != wantres)
+ fail = "incorrect return value";
+ else for (i = srclen; i < destlen; i++)
+ if (dest[i] != '\0') {
+ fail = "incomplete NUL padding";
+ break;
+ }
- test_stpncpy("");
+ if (fail)
+ atf_tc_fail_nonfatal("%s\n"
+ "stpncpy(%p \"%s\", %p \"%s\", %zu) = %p (want %p)\n",
+ fail, dest, dest, src, src, destlen, res, wantres);
}
-ATF_TC_WITHOUT_HEAD(foo);
-ATF_TC_BODY(foo, tc)
+ATF_TC_WITHOUT_HEAD(null);
+ATF_TC_BODY(null, tc)
{
-
- test_stpncpy("foo");
+ ATF_CHECK_EQ(stpncpy_fn(NULL, NULL, 0), NULL);
}
-ATF_TC_WITHOUT_HEAD(glorp);
-ATF_TC_BODY(glorp, tc)
+ATF_TC_WITHOUT_HEAD(bounds);
+ATF_TC_BODY(bounds, tc)
{
+ size_t i;
+ char buf[64+1];
+
+ for (i = 0; i < sizeof(buf) - 1; i++) {
+ buf[i] = ' ' + i;
+ buf[i+1] = '\0';
+ test_stpncpy(buf);
+ }
+}
- test_stpncpy("glorp");
+ATF_TC_WITHOUT_HEAD(alignments);
+ATF_TC_BODY(alignments, tc)
+{
+ size_t srcalign, destalign, srclen, destlen;
+ char src[15+3+64]; /* 15 offsets + 64 max length + NUL + sentinels */
+ char dest[15+2+64]; /* 15 offsets + 64 max length + sentinels */
+
+ for (srcalign = 0; srcalign < 16; srcalign++)
+ for (destalign = 0; destalign < 16; destalign++)
+ for (srclen = 0; srclen < 64; srclen++)
+ for (destlen = 0; destlen < 64; destlen++)
+ test_sentinel(dest+destalign+1,
+ src+srcalign+1, destlen, srclen);
}
ATF_TP_ADD_TCS(tp)
{
+ void *dl_handle;
+
+ dl_handle = dlopen(NULL, RTLD_LAZY);
+ stpncpy_fn = dlsym(dl_handle, "test_stpncpy");
+ if (stpncpy_fn == NULL)
+ stpncpy_fn = stpncpy;
- ATF_TP_ADD_TC(tp, nul);
- ATF_TP_ADD_TC(tp, foo);
- ATF_TP_ADD_TC(tp, glorp);
+ ATF_TP_ADD_TC(tp, null);
+ ATF_TP_ADD_TC(tp, bounds);
+ ATF_TP_ADD_TC(tp, alignments);
return (atf_no_error());
}
diff --git a/lib/libc/tests/string/strcmp_test.c b/lib/libc/tests/string/strcmp_test.c
new file mode 100644
index 000000000000..75ebcbcadda2
--- /dev/null
+++ b/lib/libc/tests/string/strcmp_test.c
@@ -0,0 +1,132 @@
+/*-
+ * Copyright (c) 2023 The FreeBSD Foundation
+ *
+ * This software was developed by Robert Clausecker <fuz@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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 AUTHOR 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 AUTHOR 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
+ */
+
+#include <sys/cdefs.h>
+
+#include <atf-c.h>
+#include <dlfcn.h>
+#include <string.h>
+
+int (*volatile strcmp_fn)(const char *, const char *);
+
+ATF_TC(strcmp_alignments);
+ATF_TC_HEAD(strcmp_alignments, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Test strcmp(3) with various alignments");
+}
+
+static void
+alignment_testcase(char *a, char *b, int want)
+{
+ int res;
+
+ res = strcmp_fn(a, b);
+ ATF_CHECK_MSG(want == (res > 0) - (res < 0),
+ "strcmp(%p \"%s\", %p \"%s\") = %d != %d",
+ (void *)a, a, (void *)b, b, res, want);
+}
+
+static void
+check_strcmp_alignments(char a[], char b[],
+ size_t a_off, size_t b_off, size_t len, size_t pos)
+{
+ char *a_str, *b_str, a_orig, b_orig;
+
+ a[a_off] = '\0';
+ b[b_off] = '\0';
+
+ a_str = a + a_off + 1;
+ b_str = b + b_off + 1;
+
+ a_str[len] = '\0';
+ b_str[len] = '\0';
+ a_str[len+1] = 'A';
+ b_str[len+1] = 'B';
+
+ a_orig = a_str[pos];
+ b_orig = b_str[pos];
+
+ alignment_testcase(a_str, b_str, 0);
+
+ if (pos < len) {
+ a_str[pos] = '\0';
+ alignment_testcase(a_str, b_str, -1);
+ a_str[pos] = a_orig;
+ b_str[pos] = '\0';
+ alignment_testcase(a_str, b_str, 1);
+ b_str[pos] = b_orig;
+ }
+
+ a_str[pos] = 'X';
+ alignment_testcase(a_str, b_str, 1);
+ a_str[pos] = a_orig;
+ b_str[pos] = 'X';
+ alignment_testcase(a_str, b_str, -1);
+ b_str[pos] = b_orig;
+
+ a[a_off] = '-';
+ b[b_off] = '-';
+ a_str[len] = '-';
+ b_str[len] = '-';
+ a_str[len+1] = '-';
+ b_str[len+1] = '-';
+}
+
+ATF_TC_BODY(strcmp_alignments, tc)
+{
+ size_t a_off, b_off, len, pos;
+ /* 16B alignment offset + 64B buffer + sentinel before/after + NUL */
+ char a[64+16+3], b[64+16+3];
+
+ memset(a, '-', sizeof(a));
+ memset(b, '-', sizeof(b));
+ a[sizeof(a) - 1] = '\0';
+ b[sizeof(b) - 1] = '\0';
+
+ /* check alignment offsets relevant for SSE routines */
+ for (a_off = 0; a_off < 16; a_off++)
+ for (b_off = 0; b_off < 16; b_off++)
+ /* ensure main loop (@ 32B) is completed at least once */
+ for (len = 1; len <= 64; len++)
+ for (pos = 0; pos <= len; pos++)
+ check_strcmp_alignments(a, b, a_off, b_off, len, pos);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+ void *dl_handle;
+
+ dl_handle = dlopen(NULL, RTLD_LAZY);
+ strcmp_fn = dlsym(dl_handle, "test_strcmp");
+ if (strcmp_fn == NULL)
+ strcmp_fn = strcmp;
+
+ ATF_TP_ADD_TC(tp, strcmp_alignments);
+
+ return atf_no_error();
+}
diff --git a/lib/libc/tests/string/strcspn_test.c b/lib/libc/tests/string/strcspn_test.c
new file mode 100644
index 000000000000..293fc2bc8d4e
--- /dev/null
+++ b/lib/libc/tests/string/strcspn_test.c
@@ -0,0 +1,269 @@
+/*-
+ * Copyright (c) 2023 The FreeBSD Foundation
+ *
+ * This software was developed by Robert Clausecker <fuz@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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 AUTHOR 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 AUTHOR 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
+ */
+
+
+#include <atf-c.h>
+#include <assert.h>
+#include <limits.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <string.h>
+
+enum {
+ MAXALIGN = 16, /* test all offsets from this alignment */
+ MAXBUF = 64, /* test up to this buffer length */
+};
+
+enum { NOMATCH, MATCH };
+
+#ifdef STRSPN
+#define STRXSPN strspn
+#else
+#define STRXSPN strcspn
+#endif
+
+static void
+testcase(char *buf, size_t buflen, char *set, size_t setlen, int want_match)
+{
+ size_t i, outcome, expected;
+
+ assert(setlen < UCHAR_MAX - 2);
+
+ for (i = 0; i < buflen; i++)
+#ifdef STRSPN
+ buf[i] = UCHAR_MAX - i % (setlen > 0 ? setlen : 1);
+#else /* strcspn */
+ buf[i] = 1 + i % (UCHAR_MAX - setlen - 1);
+#endif
+
+ buf[i] = '\0';
+
+ for (i = 0; i < setlen; i++)
+ set[i] = UCHAR_MAX - i;
+
+ set[i] = '\0';
+
+#ifdef STRSPN
+ if (setlen == 0)
+ expected = 0;
+ else if (want_match == MATCH && buflen > 0) {
+ buf[buflen - 1] = 1;
+ expected = buflen - 1;
+ } else
+ expected = buflen;
+#else /* strcspn */
+ if (want_match == MATCH && buflen > 0 && setlen > 0) {
+ buf[buflen - 1] = UCHAR_MAX;
+ expected = buflen - 1;
+ } else
+ expected = buflen;
+#endif
+
+ outcome = STRXSPN(buf, set);
+ ATF_CHECK_EQ_MSG(expected, outcome, "%s(%p[%zu], %p[%zu]) = %zu != %zu",
+ __XSTRING(STRXSPN), buf, buflen, set, setlen, outcome, expected);
+}
+
+/* test set with all alignments and lengths of buf */
+static void
+test_buf_alignments(char *set, size_t setlen, int want_match)
+{
+ char buf[MAXALIGN + MAXBUF + 1];
+ size_t i, j;
+
+ for (i = 0; i < MAXALIGN; i++)
+ for (j = 0; j <= MAXBUF; j++)
+ testcase(buf + i, j, set, setlen, want_match);
+}
+
+/* test buf with all alignments and lengths of set */
+static void
+test_set_alignments(char *buf, size_t buflen, int want_match)
+{
+ char set[MAXALIGN + MAXBUF + 1];
+ size_t i, j;
+
+ for (i = 0; i < MAXALIGN; i++)
+ for (j = 0; j <= MAXBUF; j++)
+ testcase(buf, buflen, set + i, j, want_match);
+}
+
+ATF_TC_WITHOUT_HEAD(buf_alignments);
+ATF_TC_BODY(buf_alignments, tc)
+{
+ char set[41];
+
+ test_buf_alignments(set, 0, MATCH);
+ test_buf_alignments(set, 1, MATCH);
+ test_buf_alignments(set, 5, MATCH);
+ test_buf_alignments(set, 20, MATCH);
+ test_buf_alignments(set, 40, MATCH);
+
+ test_buf_alignments(set, 0, NOMATCH);
+ test_buf_alignments(set, 1, NOMATCH);
+ test_buf_alignments(set, 5, NOMATCH);
+ test_buf_alignments(set, 20, NOMATCH);
+ test_buf_alignments(set, 40, NOMATCH);
+}
+
+ATF_TC_WITHOUT_HEAD(set_alignments);
+ATF_TC_BODY(set_alignments, tc)
+{
+ char buf[31];
+
+ test_set_alignments(buf, 0, MATCH);
+ test_set_alignments(buf, 10, MATCH);
+ test_set_alignments(buf, 20, MATCH);
+ test_set_alignments(buf, 30, MATCH);
+
+ test_set_alignments(buf, 0, NOMATCH);
+ test_set_alignments(buf, 10, NOMATCH);
+ test_set_alignments(buf, 20, NOMATCH);
+ test_set_alignments(buf, 30, NOMATCH);
+}
+
+#ifndef STRSPN
+/* test all positions in which set could match buf */
+static void
+test_match_positions(char *buf, char *set, size_t buflen, size_t setlen)
+{
+ size_t i, j, outcome;
+
+ memset(buf, '-', buflen);
+
+ for (i = 0; i < setlen; i++)
+ set[i] = 'A' + i;
+
+ buf[buflen] = '\0';
+ set[setlen] = '\0';
+
+ /*
+ * Check for (mis)match at buffer position i
+ * against set position j.
+ */
+ for (i = 0; i < buflen; i++) {
+ for (j = 0; j < setlen; j++) {
+ buf[i] = set[j];
+
+ outcome = strcspn(buf, set);
+ ATF_CHECK_EQ_MSG(i, outcome,
+ "strcspn(\"%s\", \"%s\") = %zu != %zu",
+ buf, set, outcome, i);
+ }
+
+ buf[i] = '-';
+ }
+}
+
+ATF_TC_WITHOUT_HEAD(match_positions);
+ATF_TC_BODY(match_positions, tc)
+{
+ char buf[129], set[65];
+
+ test_match_positions(buf, set, 128, 64);
+ test_match_positions(buf, set, 64, 64);
+ test_match_positions(buf, set, 32, 64);
+ test_match_positions(buf, set, 16, 64);
+ test_match_positions(buf, set, 8, 64);
+ test_match_positions(buf, set, 128, 32);
+ test_match_positions(buf, set, 64, 32);
+ test_match_positions(buf, set, 32, 32);
+ test_match_positions(buf, set, 16, 32);
+ test_match_positions(buf, set, 8, 32);
+ test_match_positions(buf, set, 128, 16);
+ test_match_positions(buf, set, 64, 16);
+ test_match_positions(buf, set, 32, 16);
+ test_match_positions(buf, set, 16, 16);
+ test_match_positions(buf, set, 8, 16);
+ test_match_positions(buf, set, 128, 8);
+ test_match_positions(buf, set, 64, 8);
+ test_match_positions(buf, set, 32, 8);
+ test_match_positions(buf, set, 16, 8);
+ test_match_positions(buf, set, 8, 8);
+}
+
+/* if there are two matches, check that the earlier match is taken */
+static void
+test_match_order(char *buf, char *set, size_t buflen, size_t setlen)
+{
+ size_t i, j, k, l, outcome;
+
+ memset(buf, '-', buflen);
+
+ for (i = 0; i < setlen; i++)
+ set[i] = 'A' + i;
+
+ buf[buflen] = '\0';
+ set[setlen] = '\0';
+
+ for (i = 0; i < setlen; i++)
+ for (j = 0; j < setlen; j++)
+ for (k = 0; k + 1 < buflen; k++)
+ for (l = k + 1; l < buflen; l++) {
+ buf[k] = set[i];
+ buf[l] = set[j];
+ outcome = strcspn(buf, set);
+ ATF_CHECK_EQ_MSG(k, outcome,
+ "strcspn(\"%s\", \"%s\") = %zu != %zu",
+ buf, set, outcome, k);
+ buf[k] = '-';
+ buf[l] = '-';
+ }
+}
+
+ATF_TC_WITHOUT_HEAD(match_order);
+ATF_TC_BODY(match_order, tc)
+{
+ char buf[33], set[65];
+
+ test_match_order(buf, set, 32, 64);
+ test_match_order(buf, set, 16, 64);
+ test_match_order(buf, set, 8, 64);
+ test_match_order(buf, set, 32, 32);
+ test_match_order(buf, set, 16, 32);
+ test_match_order(buf, set, 8, 32);
+ test_match_order(buf, set, 32, 16);
+ test_match_order(buf, set, 16, 16);
+ test_match_order(buf, set, 8, 16);
+ test_match_order(buf, set, 32, 8);
+ test_match_order(buf, set, 16, 8);
+ test_match_order(buf, set, 8, 8);
+}
+#endif /* !defined(STRSPN) */
+
+ATF_TP_ADD_TCS(tp)
+{
+ ATF_TP_ADD_TC(tp, buf_alignments);
+ ATF_TP_ADD_TC(tp, set_alignments);
+#ifndef STRSPN
+ ATF_TP_ADD_TC(tp, match_positions);
+ ATF_TP_ADD_TC(tp, match_order);
+#endif
+
+ return (atf_no_error());
+}
diff --git a/lib/libc/tests/string/strerror_test.c b/lib/libc/tests/string/strerror_test.c
index 51bbf1765804..8f6cbfe38a59 100644
--- a/lib/libc/tests/string/strerror_test.c
+++ b/lib/libc/tests/string/strerror_test.c
@@ -22,8 +22,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$
*/
#include <assert.h>
diff --git a/lib/libc/tests/string/strlcpy_test.c b/lib/libc/tests/string/strlcpy_test.c
new file mode 100644
index 000000000000..646bef42683e
--- /dev/null
+++ b/lib/libc/tests/string/strlcpy_test.c
@@ -0,0 +1,183 @@
+/*-
+ * Copyright (c) 2009 David Schultz <das@FreeBSD.org>
+ * Copyright (c) 2023 The FreeBSD Foundation
+ * All rights reserved.
+ *
+ * Portions of this software were developed by Robert Clausecker
+ * <fuz@FreeBSD.org> under sponsorship from the FreeBSD Foundation.
+ *
+ * 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 AUTHOR 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 AUTHOR 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.
+ */
+
+#include <sys/cdefs.h>
+#include <sys/param.h>
+#include <sys/mman.h>
+#include <assert.h>
+#include <dlfcn.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <atf-c.h>
+
+size_t (*strlcpy_fn)(char *restrict, const char *restrict, size_t);
+
+static char *
+makebuf(size_t len, int guard_at_end)
+{
+ char *buf;
+ size_t alloc_size, page_size;
+
+ page_size = getpagesize();
+ alloc_size = roundup2(len, page_size) + page_size;
+
+ buf = mmap(NULL, alloc_size, PROT_READ | PROT_WRITE, MAP_ANON, -1, 0);
+ assert(buf);
+ if (guard_at_end) {
+ assert(munmap(buf + alloc_size - page_size, page_size) == 0);
+ return (buf + alloc_size - page_size - len);
+ } else {
+ assert(munmap(buf, page_size) == 0);
+ return (buf + page_size);
+ }
+}
+
+static void
+test_strlcpy(const char *s)
+{
+ char *src, *dst;
+ size_t size, bufsize, x;
+ int i, j;
+
+ size = strlen(s) + 1;
+ for (i = 0; i <= 1; i++) {
+ for (j = 0; j <= 1; j++) {
+ for (bufsize = 0; bufsize <= size + 10; bufsize++) {
+ src = makebuf(size, i);
+ memcpy(src, s, size);
+ dst = makebuf(bufsize, j);
+ memset(dst, 'X', bufsize);
+ assert(strlcpy_fn(dst, src, bufsize) == size-1);
+ assert(bufsize == 0 || strncmp(src, dst, bufsize - 1) == 0);
+ for (x = size; x < bufsize; x++)
+ assert(dst[x] == 'X');
+ }
+ }
+ }
+}
+
+static void
+test_sentinel(char *dest, char *src, size_t destlen, size_t srclen)
+{
+ size_t i;
+ size_t res, wantres;
+ const char *fail = NULL;
+
+ for (i = 0; i < srclen; i++)
+ /* src will never include (){} */
+ src[i] = '0' + i;
+ src[srclen] = '\0';
+
+ /* source sentinels: not to be copied */
+ src[-1] = '(';
+ src[srclen+1] = ')';
+
+ memset(dest, '\xee', destlen);
+
+ /* destination sentinels: not to be touched */
+ dest[-1] = '{';
+ dest[destlen] = '}';
+
+ wantres = srclen;
+ res = strlcpy_fn(dest, src, destlen);
+
+ if (dest[-1] != '{')
+ fail = "start sentinel overwritten";
+ else if (dest[destlen] != '}')
+ fail = "end sentinel overwritten";
+ else if (res != wantres)
+ fail = "incorrect return value";
+ else if (destlen > 0 && strncmp(src, dest, destlen - 1) != 0)
+ fail = "string not copied correctly";
+ else if (destlen > 0 && srclen >= destlen - 1 && dest[destlen-1] != '\0')
+ fail = "string not NUL terminated";
+ else for (i = srclen + 1; i < destlen; i++)
+ if (dest[i] != '\xee') {
+ fail = "buffer mutilated behind string";
+ break;
+ }
+
+ if (fail)
+ atf_tc_fail_nonfatal("%s\n"
+ "strlcpy(%p \"%s\", %p \"%s\", %zu) = %zu (want %zu)\n",
+ fail, dest, dest, src, src, destlen, res, wantres);
+}
+
+ATF_TC_WITHOUT_HEAD(null);
+ATF_TC_BODY(null, tc)
+{
+ ATF_CHECK_EQ(strlcpy_fn(NULL, "foo", 0), 3);
+}
+
+ATF_TC_WITHOUT_HEAD(bounds);
+ATF_TC_BODY(bounds, tc)
+{
+ size_t i;
+ char buf[64+1];
+
+ for (i = 0; i < sizeof(buf) - 1; i++) {
+ buf[i] = ' ' + i;
+ buf[i+1] = '\0';
+ test_strlcpy(buf);
+ }
+}
+
+ATF_TC_WITHOUT_HEAD(alignments);
+ATF_TC_BODY(alignments, tc)
+{
+ size_t srcalign, destalign, srclen, destlen;
+ char src[15+3+64]; /* 15 offsets + 64 max length + NUL + sentinels */
+ char dest[15+2+64]; /* 15 offsets + 64 max length + sentinels */
+
+ for (srcalign = 0; srcalign < 16; srcalign++)
+ for (destalign = 0; destalign < 16; destalign++)
+ for (srclen = 0; srclen < 64; srclen++)
+ for (destlen = 0; destlen < 64; destlen++)
+ test_sentinel(dest+destalign+1,
+ src+srcalign+1, destlen, srclen);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+ void *dl_handle;
+
+ dl_handle = dlopen(NULL, RTLD_LAZY);
+ strlcpy_fn = dlsym(dl_handle, "test_strlcpy");
+ if (strlcpy_fn == NULL)
+ strlcpy_fn = strlcpy;
+
+ ATF_TP_ADD_TC(tp, null);
+ ATF_TP_ADD_TC(tp, bounds);
+ ATF_TP_ADD_TC(tp, alignments);
+
+ return (atf_no_error());
+}
diff --git a/lib/libc/tests/string/strncmp_test.c b/lib/libc/tests/string/strncmp_test.c
new file mode 100644
index 000000000000..989c58bcfedf
--- /dev/null
+++ b/lib/libc/tests/string/strncmp_test.c
@@ -0,0 +1,165 @@
+/*-
+ * Copyright (c) 2023 The FreeBSD Foundation
+ *
+ * This software was developed by Robert Clausecker <fuz@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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 AUTHOR 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 AUTHOR 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
+ */
+
+#include <sys/cdefs.h>
+
+#include <atf-c.h>
+#include <dlfcn.h>
+#include <string.h>
+
+int (*volatile strncmp_fn)(const char *, const char *, size_t);
+
+static void
+alignment_testcase(char *a, char *b, int want, size_t len)
+{
+ int res;
+
+ res = strncmp_fn(a, b, len);
+ ATF_CHECK_MSG(want == (res > 0) - (res < 0),
+ "strcmp(%p \"%s\", %p \"%s\", %zu) = %d != %d",
+ (void *)a, a, (void *)b, b, len, res, want);
+}
+
+static void
+check_strncmp_alignments(char a[], char b[],
+ size_t a_off, size_t b_off, size_t len, size_t pos)
+{
+ char *a_str, *b_str, a_orig, b_orig;
+
+ a[a_off] = '\0';
+ b[b_off] = '\0';
+
+ a_str = a + a_off + 1;
+ b_str = b + b_off + 1;
+
+ a_str[len] = '\0';
+ b_str[len] = '\0';
+ a_str[len+1] = 'A';
+ b_str[len+1] = 'B';
+
+ a_orig = a_str[pos];
+ b_orig = b_str[pos];
+
+ alignment_testcase(a_str, b_str, 0, len + 16);
+ alignment_testcase(a_str, b_str, 0, len + 1);
+ alignment_testcase(a_str, b_str, 0, len);
+
+ if (pos < len) {
+ a_str[pos] = '\0';
+ alignment_testcase(a_str, b_str, -1, len + 16);
+ alignment_testcase(a_str, b_str, -1, len + 1);
+ alignment_testcase(a_str, b_str, -1, len);
+ alignment_testcase(a_str, b_str, -1, pos + 1);
+ alignment_testcase(a_str, b_str, 0, pos);
+ a_str[pos] = a_orig;
+
+ b_str[pos] = '\0';
+ alignment_testcase(a_str, b_str, 1, len + 16);
+ alignment_testcase(a_str, b_str, 1, len + 1);
+ alignment_testcase(a_str, b_str, 1, len);
+ alignment_testcase(a_str, b_str, 1, pos + 1);
+ alignment_testcase(a_str, b_str, 0, pos);
+ b_str[pos] = b_orig;
+ }
+
+ a_str[pos] = 'X';
+ alignment_testcase(a_str, b_str, 1, len + 16);
+ alignment_testcase(a_str, b_str, 0, pos);
+ alignment_testcase(a_str, b_str, 1, pos + 1);
+ if (pos < len) {
+ alignment_testcase(a_str, b_str, 1, len);
+ alignment_testcase(a_str, b_str, 1, len + 1);
+ }
+ a_str[pos] = a_orig;
+
+ b_str[pos] = 'X';
+ alignment_testcase(a_str, b_str, -1, len + 16);
+ alignment_testcase(a_str, b_str, 0, pos);
+ alignment_testcase(a_str, b_str, -1, pos + 1);
+ if (pos < len) {
+ alignment_testcase(a_str, b_str, -1, len);
+ alignment_testcase(a_str, b_str, -1, len + 1);
+ }
+ b_str[pos] = b_orig;
+
+ a[a_off] = '-';
+ b[b_off] = '-';
+ a_str[len] = '-';
+ b_str[len] = '-';
+ a_str[len+1] = '-';
+ b_str[len+1] = '-';
+}
+
+ATF_TC(strncmp_alignments);
+ATF_TC_HEAD(strncmp_alignments, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Test strncmp(3) with various alignments");
+}
+
+ATF_TC_BODY(strncmp_alignments, tc)
+{
+ size_t a_off, b_off, len, pos;
+ char a[64+16+16+3], b[64+16+16+3];
+
+ memset(a, '-', sizeof(a));
+ memset(b, '-', sizeof(b));
+ a[sizeof(a) - 1] = '\0';
+ b[sizeof(b) - 1] = '\0';
+
+ for (a_off = 0; a_off < 16; a_off++)
+ for (b_off = 0; b_off < 16; b_off++)
+ for (len = 1; len <= 64; len++)
+ for (pos = 0; pos <= len; pos++)
+ check_strncmp_alignments(a, b, a_off, b_off, len, pos);
+}
+
+ATF_TC(strncmp_null);
+ATF_TC_HEAD(strncmp_null, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "Test strncmp(3) with null pointers");
+}
+
+ATF_TC_BODY(strncmp_null, tc)
+{
+ alignment_testcase(NULL, NULL, 0, 0);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+ void *dl_handle;
+
+ dl_handle = dlopen(NULL, RTLD_LAZY);
+ strncmp_fn = dlsym(dl_handle, "test_strncmp");
+ if (strncmp_fn == NULL)
+ strncmp_fn = strncmp;
+
+ ATF_TP_ADD_TC(tp, strncmp_alignments);
+ ATF_TP_ADD_TC(tp, strncmp_null);
+
+ return atf_no_error();
+}
diff --git a/lib/libc/tests/string/strspn_test.c b/lib/libc/tests/string/strspn_test.c
new file mode 100644
index 000000000000..73a08ddefa1b
--- /dev/null
+++ b/lib/libc/tests/string/strspn_test.c
@@ -0,0 +1,30 @@
+/*-
+ * Copyright (c) 2023 The FreeBSD Foundation
+ *
+ * This software was developed by Robert Clausecker <fuz@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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 AUTHOR 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 AUTHOR 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
+ */
+
+#define STRSPN
+#include "strcspn_test.c"
diff --git a/lib/libc/tests/string/strverscmp_test.c b/lib/libc/tests/string/strverscmp_test.c
new file mode 100644
index 000000000000..fd6a2620cb48
--- /dev/null
+++ b/lib/libc/tests/string/strverscmp_test.c
@@ -0,0 +1,93 @@
+/*-
+* SPDX-License-Identifier: BSD-2-Clause
+* Copyright (c) 2022 Aymeric Wibo <obiwac@gmail.com>
+*/
+
+#include <atf-c.h>
+#include <string.h>
+
+static void
+check_all(size_t len, const char *ordered[len])
+{
+ const char *a, *b;
+
+ for (size_t i = 0; i < len; i++) {
+ for (size_t j = 0; j < len; j++) {
+ a = ordered[i];
+ b = ordered[j];
+
+ if (i == j)
+ ATF_CHECK_MSG(
+ strverscmp(a, b) == 0,
+ "strverscmp(\"%s\", \"%s\") == 0",
+ a, b
+ );
+ else if (i < j)
+ ATF_CHECK_MSG(
+ strverscmp(a, b) < 0,
+ "strverscmp(\"%s\", \"%s\") < 0",
+ a, b
+ );
+ else if (i > j)
+ ATF_CHECK_MSG(
+ strverscmp(a, b) > 0,
+ "strverscmp(\"%s\", \"%s\") > 0",
+ a, b
+ );
+ }
+ }
+}
+
+#define CHECK_ALL(...) do { \
+ const char *ordered[] = { __VA_ARGS__ }; \
+ check_all(sizeof(ordered) / sizeof(*ordered), ordered); \
+} while (0)
+
+ATF_TC_WITHOUT_HEAD(strcmp_functionality);
+ATF_TC_BODY(strcmp_functionality, tc)
+{
+ CHECK_ALL("", "a", "b");
+}
+
+/* from Linux man page strverscmp(3) */
+
+ATF_TC_WITHOUT_HEAD(vers_ordering);
+ATF_TC_BODY(vers_ordering, tc)
+{
+ CHECK_ALL("000", "00", "01", "010", "09", "0", "1", "9", "10");
+}
+
+ATF_TC_WITHOUT_HEAD(natural_ordering);
+ATF_TC_BODY(natural_ordering, tc)
+{
+ CHECK_ALL("jan1", "jan2", "jan9", "jan10", "jan11", "jan19", "jan20");
+}
+
+/* https://sourceware.org/bugzilla/show_bug.cgi?id=9913 */
+
+ATF_TC_WITHOUT_HEAD(glibc_bug_9913);
+ATF_TC_BODY(glibc_bug_9913, tc)
+{
+ CHECK_ALL(
+ "B0075022800016.gbp.corp.com",
+ "B007502280067.gbp.corp.com",
+ "B007502357019.GBP.CORP.COM"
+ );
+}
+
+ATF_TC_WITHOUT_HEAD(semver_ordering);
+ATF_TC_BODY(semver_ordering, tc)
+{
+ CHECK_ALL("2.6.20", "2.6.21");
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+ ATF_TP_ADD_TC(tp, strcmp_functionality);
+ ATF_TP_ADD_TC(tp, vers_ordering);
+ ATF_TP_ADD_TC(tp, natural_ordering);
+ ATF_TP_ADD_TC(tp, glibc_bug_9913);
+ ATF_TP_ADD_TC(tp, semver_ordering);
+
+ return (atf_no_error());
+}
diff --git a/lib/libc/tests/string/strxfrm_test.c b/lib/libc/tests/string/strxfrm_test.c
index 98f3b3bddee7..becc620ba79c 100644
--- a/lib/libc/tests/string/strxfrm_test.c
+++ b/lib/libc/tests/string/strxfrm_test.c
@@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <string.h>
#include <locale.h>
#include <stdio.h>
diff --git a/lib/libc/aarch64/sys/syscall.S b/lib/libc/tests/string/timingsafe_bcmp_test.c
index 63148357d567..96bf789633f2 100644
--- a/lib/libc/aarch64/sys/syscall.S
+++ b/lib/libc/tests/string/timingsafe_bcmp_test.c
@@ -1,9 +1,8 @@
/*-
- * Copyright (c) 2014 The FreeBSD Foundation
- * All rights reserved.
+ * Copyright (c) 2023 The FreeBSD Foundation
*
- * This software was developed by Andrew Turner under
- * sponsorship from the FreeBSD Foundation.
+ * This software was developed by Robert Clausecker <fuz@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -14,22 +13,20 @@
* 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR OR CONTRIBUTORS BE LIABLE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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.
+ * SUCH DAMAGE
*/
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
+#define MEMCMP timingsafe_bcmp
+#define RES(x) ((x) != 0)
-#include "SYS.h"
-
-RSYSCALL(syscall)
+#include "memcmp_test.c"
diff --git a/lib/libc/tests/string/timingsafe_memcmp_test.c b/lib/libc/tests/string/timingsafe_memcmp_test.c
new file mode 100644
index 000000000000..5f97e41fcf8a
--- /dev/null
+++ b/lib/libc/tests/string/timingsafe_memcmp_test.c
@@ -0,0 +1,32 @@
+/*-
+ * Copyright (c) 2023 The FreeBSD Foundation
+ *
+ * This software was developed by Robert Clausecker <fuz@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ *
+ * 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 AUTHOR 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 AUTHOR 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
+ */
+
+#define MEMCMP timingsafe_memcmp
+#define RES(x) (((x) > 0) - ((x) < 0))
+
+#include "memcmp_test.c"
diff --git a/lib/libc/tests/string/wcscasecmp_test.c b/lib/libc/tests/string/wcscasecmp_test.c
index 4385f3a8f0d2..9a47c0d91b31 100644
--- a/lib/libc/tests/string/wcscasecmp_test.c
+++ b/lib/libc/tests/string/wcscasecmp_test.c
@@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <assert.h>
#include <locale.h>
#include <stdio.h>
diff --git a/lib/libc/tests/string/wcscoll_test.c b/lib/libc/tests/string/wcscoll_test.c
index 022ad8e98297..2ce85bbb986b 100644
--- a/lib/libc/tests/string/wcscoll_test.c
+++ b/lib/libc/tests/string/wcscoll_test.c
@@ -26,9 +26,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <wchar.h>
#include <locale.h>
#include <stdlib.h>
diff --git a/lib/libc/tests/string/wcsnlen_test.c b/lib/libc/tests/string/wcsnlen_test.c
index 07870e3a5ca0..ba2e1c8d7c57 100644
--- a/lib/libc/tests/string/wcsnlen_test.c
+++ b/lib/libc/tests/string/wcsnlen_test.c
@@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/mman.h>
#include <assert.h>
@@ -41,16 +38,19 @@ static void *
makebuf(size_t len, int guard_at_end)
{
char *buf;
- size_t alloc_size = roundup2(len, PAGE_SIZE) + PAGE_SIZE;
+ size_t alloc_size, page_size;
+
+ page_size = getpagesize();
+ alloc_size = roundup2(len, page_size) + page_size;
buf = mmap(NULL, alloc_size, PROT_READ | PROT_WRITE, MAP_ANON, -1, 0);
ATF_CHECK(buf);
if (guard_at_end) {
- ATF_CHECK(munmap(buf + alloc_size - PAGE_SIZE, PAGE_SIZE) == 0);
- return (buf + alloc_size - PAGE_SIZE - len);
+ ATF_CHECK(munmap(buf + alloc_size - page_size, page_size) == 0);
+ return (buf + alloc_size - page_size - len);
} else {
- ATF_CHECK(munmap(buf, PAGE_SIZE) == 0);
- return (buf + PAGE_SIZE);
+ ATF_CHECK(munmap(buf, page_size) == 0);
+ return (buf + page_size);
}
}
diff --git a/lib/libc/tests/sys/Makefile b/lib/libc/tests/sys/Makefile
index e4a1bf30a8f9..380b3b511049 100644
--- a/lib/libc/tests/sys/Makefile
+++ b/lib/libc/tests/sys/Makefile
@@ -1,4 +1,3 @@
-# $FreeBSD$
PACKAGE= tests
@@ -8,6 +7,7 @@ PACKAGE= tests
ATF_TESTS_C+= brk_test
.endif
ATF_TESTS_C+= cpuset_test
+ATF_TESTS_C+= errno_test
ATF_TESTS_C+= queue_test
ATF_TESTS_C+= sendfile_test
@@ -74,6 +74,13 @@ NETBSD_ATF_TESTS_C+= write_test
LIBADD.getpid_test+= pthread
LIBADD.timer_create_test+= rt
+# Message queue IPC tests need to be executed serially since they variously
+# use global keys and exhaust global IPC limits.
+TEST_METADATA.msgctl_test+= is_exclusive="true"
+TEST_METADATA.msgget_test+= is_exclusive="true"
+TEST_METADATA.msgsnd_test+= is_exclusive="true"
+TEST_METADATA.msgrcv_test+= is_exclusive="true"
+
.include "../Makefile.netbsd-tests"
SRCS.mlock_test+= mlock_helper.c
diff --git a/lib/libc/tests/sys/Makefile.depend b/lib/libc/tests/sys/Makefile.depend
index 0e9a9cda6452..c9d1296c4e9c 100644
--- a/lib/libc/tests/sys/Makefile.depend
+++ b/lib/libc/tests/sys/Makefile.depend
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
diff --git a/lib/libc/tests/sys/brk_test.c b/lib/libc/tests/sys/brk_test.c
index 57b3d605e775..2d8c7af38ff7 100644
--- a/lib/libc/tests/sys/brk_test.c
+++ b/lib/libc/tests/sys/brk_test.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018 Mark Johnston <markj@FreeBSD.org>
*
@@ -25,9 +25,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/mman.h>
diff --git a/lib/libc/tests/sys/cpuset_test.c b/lib/libc/tests/sys/cpuset_test.c
index 52c0dc877ab8..53d6a8215bbc 100644
--- a/lib/libc/tests/sys/cpuset_test.c
+++ b/lib/libc/tests/sys/cpuset_test.c
@@ -25,9 +25,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD");
-
#include <sys/param.h>
#include <sys/cpuset.h>
#include <sys/jail.h>
diff --git a/lib/libc/tests/sys/errno_test.c b/lib/libc/tests/sys/errno_test.c
new file mode 100644
index 000000000000..27d0548fc29d
--- /dev/null
+++ b/lib/libc/tests/sys/errno_test.c
@@ -0,0 +1,36 @@
+/*-
+ * Copyright (c) 2024 The FreeBSD Foundation
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * This software were developed by Konstantin Belousov <kib@FreeBSD.org>
+ * under sponsorship from the FreeBSD Foundation.
+ */
+
+#include <errno.h>
+#include <unistd.h>
+
+#include <atf-c.h>
+
+ATF_TC(errno_basic);
+ATF_TC_HEAD(errno_basic, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Verify basic functionality of errno");
+}
+
+ATF_TC_BODY(errno_basic, tc)
+{
+ int res;
+
+ res = unlink("/non/existent/file");
+ ATF_REQUIRE(res == -1);
+ ATF_REQUIRE(errno == ENOENT);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+ ATF_TP_ADD_TC(tp, errno_basic);
+
+ return (atf_no_error());
+}
diff --git a/lib/libc/tests/sys/mlock_helper.c b/lib/libc/tests/sys/mlock_helper.c
index a483207aa5d6..e7a3d5e39c3f 100644
--- a/lib/libc/tests/sys/mlock_helper.c
+++ b/lib/libc/tests/sys/mlock_helper.c
@@ -28,9 +28,6 @@
* Helper for mlock(3) to avoid EAGAIN errors
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/sysctl.h>
diff --git a/lib/libc/tests/sys/queue_test.c b/lib/libc/tests/sys/queue_test.c
index 2405e3a69f5c..cfe9ac934cbd 100644
--- a/lib/libc/tests/sys/queue_test.c
+++ b/lib/libc/tests/sys/queue_test.c
@@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/queue.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/lib/libc/tests/sys/sendfile_test.c b/lib/libc/tests/sys/sendfile_test.c
index c12e4f7c1de3..d46e7b0cb186 100644
--- a/lib/libc/tests/sys/sendfile_test.c
+++ b/lib/libc/tests/sys/sendfile_test.c
@@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/mman.h>
#include <sys/socket.h>
@@ -380,6 +377,9 @@ ATF_TC_HEAD(fd_positive_file_v4, tc)
ATF_TC_BODY(fd_positive_file_v4, tc)
{
+ if (atf_tc_get_config_var_as_bool_wd(tc, "qemu", false))
+ atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25");
+
fd_positive_file_test(AF_INET);
}
@@ -393,6 +393,9 @@ ATF_TC_HEAD(fd_positive_file_v6, tc)
ATF_TC_BODY(fd_positive_file_v6, tc)
{
+ if (atf_tc_get_config_var_as_bool_wd(tc, "qemu", false))
+ atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25");
+
fd_positive_file_test(AF_INET6);
}
@@ -458,6 +461,8 @@ ATF_TC_HEAD(fd_positive_shm_v4, tc)
}
ATF_TC_BODY(fd_positive_shm_v4, tc)
{
+ if (atf_tc_get_config_var_as_bool_wd(tc, "qemu", false))
+ atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25");
fd_positive_shm_test(AF_INET);
}
@@ -471,6 +476,8 @@ ATF_TC_HEAD(fd_positive_shm_v6, tc)
}
ATF_TC_BODY(fd_positive_shm_v6, tc)
{
+ if (atf_tc_get_config_var_as_bool_wd(tc, "qemu", false))
+ atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25");
fd_positive_shm_test(AF_INET6);
}
@@ -502,6 +509,8 @@ ATF_TC_HEAD(fd_negative_bad_fd_v4, tc)
}
ATF_TC_BODY(fd_negative_bad_fd_v4, tc)
{
+ if (atf_tc_get_config_var_as_bool_wd(tc, "qemu", false))
+ atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25");
fd_negative_bad_fd_test(AF_INET);
}
@@ -515,6 +524,8 @@ ATF_TC_HEAD(fd_negative_bad_fd_v6, tc)
}
ATF_TC_BODY(fd_negative_bad_fd_v6, tc)
{
+ if (atf_tc_get_config_var_as_bool_wd(tc, "qemu", false))
+ atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25");
fd_negative_bad_fd_test(AF_INET6);
}
@@ -618,6 +629,8 @@ ATF_TC_HEAD(flags_v4, tc)
}
ATF_TC_BODY(flags_v4, tc)
{
+ if (atf_tc_get_config_var_as_bool_wd(tc, "qemu", false))
+ atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25");
flags_test(AF_INET);
}
@@ -630,6 +643,8 @@ ATF_TC_HEAD(flags_v6, tc)
}
ATF_TC_BODY(flags_v6, tc)
{
+ if (atf_tc_get_config_var_as_bool_wd(tc, "qemu", false))
+ atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25");
flags_test(AF_INET6);
}
@@ -746,6 +761,8 @@ ATF_TC_HEAD(hdtr_positive_v4, tc)
}
ATF_TC_BODY(hdtr_positive_v4, tc)
{
+ if (atf_tc_get_config_var_as_bool_wd(tc, "qemu", false))
+ atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25");
hdtr_positive_test(AF_INET);
}
@@ -759,6 +776,8 @@ ATF_TC_HEAD(hdtr_positive_v6, tc)
}
ATF_TC_BODY(hdtr_positive_v6, tc)
{
+ if (atf_tc_get_config_var_as_bool_wd(tc, "qemu", false))
+ atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25");
hdtr_positive_test(AF_INET);
}
@@ -810,6 +829,8 @@ ATF_TC_HEAD(hdtr_negative_bad_pointers_v4, tc)
}
ATF_TC_BODY(hdtr_negative_bad_pointers_v4, tc)
{
+ if (atf_tc_get_config_var_as_bool_wd(tc, "qemu", false))
+ atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25");
hdtr_negative_bad_pointers_test(AF_INET);
}
@@ -823,6 +844,8 @@ ATF_TC_HEAD(hdtr_negative_bad_pointers_v6, tc)
}
ATF_TC_BODY(hdtr_negative_bad_pointers_v6, tc)
{
+ if (atf_tc_get_config_var_as_bool_wd(tc, "qemu", false))
+ atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25");
hdtr_negative_bad_pointers_test(AF_INET6);
}
@@ -856,6 +879,8 @@ ATF_TC_HEAD(offset_negative_value_less_than_zero_v4, tc)
}
ATF_TC_BODY(offset_negative_value_less_than_zero_v4, tc)
{
+ if (atf_tc_get_config_var_as_bool_wd(tc, "qemu", false))
+ atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25");
offset_negative_value_less_than_zero_test(AF_INET);
}
@@ -869,6 +894,8 @@ ATF_TC_HEAD(offset_negative_value_less_than_zero_v6, tc)
}
ATF_TC_BODY(offset_negative_value_less_than_zero_v6, tc)
{
+ if (atf_tc_get_config_var_as_bool_wd(tc, "qemu", false))
+ atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25");
offset_negative_value_less_than_zero_test(AF_INET6);
}
@@ -909,6 +936,8 @@ ATF_TC_HEAD(sbytes_positive_v4, tc)
}
ATF_TC_BODY(sbytes_positive_v4, tc)
{
+ if (atf_tc_get_config_var_as_bool_wd(tc, "qemu", false))
+ atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25");
sbytes_positive_test(AF_INET);
}
@@ -922,6 +951,8 @@ ATF_TC_HEAD(sbytes_positive_v6, tc)
}
ATF_TC_BODY(sbytes_positive_v6, tc)
{
+ if (atf_tc_get_config_var_as_bool_wd(tc, "qemu", false))
+ atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25");
sbytes_positive_test(AF_INET6);
}
@@ -960,6 +991,8 @@ ATF_TC_HEAD(sbytes_negative_v4, tc)
}
ATF_TC_BODY(sbytes_negative_v4, tc)
{
+ if (atf_tc_get_config_var_as_bool_wd(tc, "qemu", false))
+ atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25");
sbytes_negative_test(AF_INET);
}
@@ -973,6 +1006,8 @@ ATF_TC_HEAD(sbytes_negative_v6, tc)
}
ATF_TC_BODY(sbytes_negative_v6, tc)
{
+ if (atf_tc_get_config_var_as_bool_wd(tc, "qemu", false))
+ atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25");
sbytes_negative_test(AF_INET6);
}
@@ -1005,6 +1040,8 @@ ATF_TC_HEAD(s_negative_not_connected_socket_v4, tc)
ATF_TC_BODY(s_negative_not_connected_socket_v4, tc)
{
+ if (atf_tc_get_config_var_as_bool_wd(tc, "qemu", false))
+ atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25");
s_negative_not_connected_socket_test(AF_INET);
}
@@ -1019,6 +1056,8 @@ ATF_TC_HEAD(s_negative_not_connected_socket_v6, tc)
ATF_TC_BODY(s_negative_not_connected_socket_v6, tc)
{
+ if (atf_tc_get_config_var_as_bool_wd(tc, "qemu", false))
+ atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25");
s_negative_not_connected_socket_test(AF_INET6);
}
@@ -1035,6 +1074,9 @@ ATF_TC_BODY(s_negative_not_descriptor, tc)
{
int client_sock, error, fd;
+ if (atf_tc_get_config_var_as_bool_wd(tc, "qemu", false))
+ atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25");
+
client_sock = -1;
fd = open(SOURCE_FILE, O_CREAT|O_RDWR, 0600);
@@ -1058,11 +1100,14 @@ ATF_TC_BODY(s_negative_not_socket_file_descriptor, tc)
{
int client_sock, error, fd;
+ if (atf_tc_get_config_var_as_bool_wd(tc, "qemu", false))
+ atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25");
+
fd = open(SOURCE_FILE, O_CREAT|O_RDWR, 0600);
ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno));
client_sock = open(_PATH_DEVNULL, O_WRONLY);
- ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno));
+ ATF_REQUIRE_MSG(client_sock != -1, "open failed: %s", strerror(errno));
error = sendfile(fd, client_sock, 0, 0, NULL, NULL, SF_FLAGS(0, 0));
ATF_REQUIRE_ERRNO(ENOTSOCK, error == -1);
@@ -1099,6 +1144,9 @@ ATF_TC_HEAD(s_negative_udp_socket_v4, tc)
ATF_TC_BODY(s_negative_udp_socket_v4, tc)
{
+ if (atf_tc_get_config_var_as_bool_wd(tc, "qemu", false))
+ atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25");
+
s_negative_udp_socket_test(AF_INET);
}
@@ -1112,6 +1160,9 @@ ATF_TC_HEAD(s_negative_udp_socket_v6, tc)
ATF_TC_BODY(s_negative_udp_socket_v6, tc)
{
+ if (atf_tc_get_config_var_as_bool_wd(tc, "qemu", false))
+ atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25");
+
s_negative_udp_socket_test(AF_INET6);
}
diff --git a/lib/libc/tests/termios/Makefile b/lib/libc/tests/termios/Makefile
index 0495d684b505..4900f0067ce0 100644
--- a/lib/libc/tests/termios/Makefile
+++ b/lib/libc/tests/termios/Makefile
@@ -1,4 +1,3 @@
-# $FreeBSD$
.include <bsd.own.mk>
diff --git a/lib/libc/tests/termios/Makefile.depend b/lib/libc/tests/termios/Makefile.depend
index 10e58b789640..e89a5c52c82a 100644
--- a/lib/libc/tests/termios/Makefile.depend
+++ b/lib/libc/tests/termios/Makefile.depend
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
diff --git a/lib/libc/tests/time/Makefile b/lib/libc/tests/time/Makefile
index feb543dad243..ac6d3bc55be0 100644
--- a/lib/libc/tests/time/Makefile
+++ b/lib/libc/tests/time/Makefile
@@ -1,4 +1,3 @@
-# $FreeBSD$
.include <bsd.own.mk>
diff --git a/lib/libc/tests/time/Makefile.depend b/lib/libc/tests/time/Makefile.depend
index 10e58b789640..e89a5c52c82a 100644
--- a/lib/libc/tests/time/Makefile.depend
+++ b/lib/libc/tests/time/Makefile.depend
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
diff --git a/lib/libc/tests/tls/Makefile b/lib/libc/tests/tls/Makefile
index 3cfaaadce590..dc0fbb4c90aa 100644
--- a/lib/libc/tests/tls/Makefile
+++ b/lib/libc/tests/tls/Makefile
@@ -1,4 +1,3 @@
-# $FreeBSD$
.include <bsd.own.mk>
diff --git a/lib/libc/tests/tls/Makefile.depend b/lib/libc/tests/tls/Makefile.depend
index eae2edfd9e27..e53b1a169e02 100644
--- a/lib/libc/tests/tls/Makefile.depend
+++ b/lib/libc/tests/tls/Makefile.depend
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
diff --git a/lib/libc/tests/tls/dso/Makefile b/lib/libc/tests/tls/dso/Makefile
index 84225f4a1d0e..2e08d6899d63 100644
--- a/lib/libc/tests/tls/dso/Makefile
+++ b/lib/libc/tests/tls/dso/Makefile
@@ -1,4 +1,3 @@
-# $FreeBSD$
TESTSRC= ${SRCTOP}/contrib/netbsd-tests/lib/libc/tls/${.CURDIR:T}
@@ -7,6 +6,7 @@ SHLIB_NAME= h_tls_dlopen.so
SRCS= h_tls_dlopen.c
MAN=
+PACKAGE= tests
LIBDIR= ${TESTSBASE}/lib/libc/tls
SHLIB_MAJOR= 1
diff --git a/lib/libc/tests/tls/dso/Makefile.depend b/lib/libc/tests/tls/dso/Makefile.depend
index c062f6026d94..1af0c88e099c 100644
--- a/lib/libc/tests/tls/dso/Makefile.depend
+++ b/lib/libc/tests/tls/dso/Makefile.depend
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
diff --git a/lib/libc/tests/tls_dso/Makefile b/lib/libc/tests/tls_dso/Makefile
index 5449799de96c..bae78739708d 100644
--- a/lib/libc/tests/tls_dso/Makefile
+++ b/lib/libc/tests/tls_dso/Makefile
@@ -1,4 +1,3 @@
-# $FreeBSD$
.include <bsd.own.mk>
@@ -8,6 +7,7 @@ SRCS= h_tls_dynamic.c
LIBDIR= ${TESTSBASE}/lib/libc/tls
SHLIBDIR= ${TESTSBASE}/lib/libc/tls
SHLIB_MAJOR= 1
+PACKAGE= tests
WITHOUT_STATIC=
WITHOUT_PROFILE=
diff --git a/lib/libc/tests/tls_dso/Makefile.depend b/lib/libc/tests/tls_dso/Makefile.depend
index 1c1a9bee1d67..93249906da4f 100644
--- a/lib/libc/tests/tls_dso/Makefile.depend
+++ b/lib/libc/tests/tls_dso/Makefile.depend
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
diff --git a/lib/libc/tests/ttyio/Makefile b/lib/libc/tests/ttyio/Makefile
index d5b8f0168558..79ec9a4039e5 100644
--- a/lib/libc/tests/ttyio/Makefile
+++ b/lib/libc/tests/ttyio/Makefile
@@ -1,4 +1,3 @@
-# $FreeBSD$
.include <bsd.own.mk>
diff --git a/lib/libc/tests/ttyio/Makefile.depend b/lib/libc/tests/ttyio/Makefile.depend
index 1b5e74fae1b0..9df74fa6efd2 100644
--- a/lib/libc/tests/ttyio/Makefile.depend
+++ b/lib/libc/tests/ttyio/Makefile.depend
@@ -1,4 +1,3 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
diff --git a/lib/libc/uuid/Makefile.inc b/lib/libc/uuid/Makefile.inc
index 05c1322b53a5..d9c8b0a6083d 100644
--- a/lib/libc/uuid/Makefile.inc
+++ b/lib/libc/uuid/Makefile.inc
@@ -1,4 +1,3 @@
-# $FreeBSD$
# DCE 1.1 UUID implementation sources
diff --git a/lib/libc/uuid/Symbol.map b/lib/libc/uuid/Symbol.map
index 10acc781225f..e1e587199a92 100644
--- a/lib/libc/uuid/Symbol.map
+++ b/lib/libc/uuid/Symbol.map
@@ -1,7 +1,3 @@
-/*
- * $FreeBSD$
- */
-
FBSD_1.0 {
uuid_to_string;
uuid_is_nil;
diff --git a/lib/libc/uuid/uuid.3 b/lib/libc/uuid/uuid.3
index 4fa41dec98bd..1cfd3a86ad91 100644
--- a/lib/libc/uuid/uuid.3
+++ b/lib/libc/uuid/uuid.3
@@ -23,14 +23,18 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd March 1, 2012
+.Dd November 19, 2021
.Dt UUID 3
.Os
.Sh NAME
-.Nm uuid_compare , uuid_create , uuid_create_nil , uuid_equal ,
-.Nm uuid_from_string , uuid_hash , uuid_is_nil , uuid_to_string
+.Nm uuid_compare ,
+.Nm uuid_create ,
+.Nm uuid_create_nil ,
+.Nm uuid_equal ,
+.Nm uuid_from_string ,
+.Nm uuid_hash ,
+.Nm uuid_is_nil ,
+.Nm uuid_to_string
.Nd DCE 1.1 compliant UUID functions
.Sh LIBRARY
.Lb libc
@@ -68,20 +72,12 @@ The
and
.Fn uuid_create_nil
functions create UUIDs.
-The
-.Fn uuid_compare ,
-.Fn uuid_equal
-and
-.Fn uuid_is_nil
-functions can be used to test UUIDs.
To convert from the binary representation to the string representation or
vice versa, use
.Fn uuid_to_string
or
.Fn uuid_from_string
respectively.
-A 16-bit hash value can be obtained by calling
-.Fn uuid_hash .
.Pp
The
.Fn uuid_to_string
@@ -111,6 +107,49 @@ functions decode a UUID from an octet stream in little-endian and
big-endian byte-order, respectively.
These routines are not part of the DCE RPC API.
They are provided for convenience.
+.Pp
+The
+.Fn uuid_compare
+and
+.Fn uuid_equal
+functions compare two UUIDs for equality.
+UUIDs are equal if pointers
+.Fa a
+and
+.Fa b
+are equal or both
+.Dv NULL ,
+or if the structures
+.Fa a
+and
+.Fa b
+point to are equal.
+.Fn uuid_compare
+returns 0 if the UUIDs are equal, -1 if
+.Fa a
+is less than
+.Fa b ,
+and 1 if
+.Fa a
+is greater than
+.Fa b .
+.Fn uuid_equal
+returns 1 if the UUIDs are equal, 0 if they are
+not equal.
+.Pp
+The
+.Fn uuid_is_nil
+function compares a UUID to
+.Dv NULL .
+The function returns 1 if
+.Fa u
+is
+.Dv NULL
+or if the UUID consists of all zeros, and zero otherwise.
+.Pp
+The
+.Fn uuid_hash
+function returns a 16-bit hash value for the specified UUID.
.Sh RETURN VALUES
The successful or unsuccessful completion of the function is returned in
the
@@ -127,6 +166,16 @@ The string representation of an UUID is not valid.
.It Dv uuid_s_no_memory
The function can not allocate memory to store an UUID representation.
.El
+.Pp
+.Fn uuid_compare ,
+.Fn uuid_equal ,
+.Fn uuid_is_nil ,
+and
+.Fn uuid_hash
+always set
+.Fa status
+to
+.Dv uuid_s_ok .
.Sh SEE ALSO
.Xr uuidgen 1 ,
.Xr uuidgen 2
diff --git a/lib/libc/uuid/uuid_compare.c b/lib/libc/uuid/uuid_compare.c
index 655fd2b7f3ba..9087e0856820 100644
--- a/lib/libc/uuid/uuid_compare.c
+++ b/lib/libc/uuid/uuid_compare.c
@@ -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$
*/
#include <string.h>
diff --git a/lib/libc/uuid/uuid_create.c b/lib/libc/uuid/uuid_create.c
index 5ff4732f9792..94e72b73c771 100644
--- a/lib/libc/uuid/uuid_create.c
+++ b/lib/libc/uuid/uuid_create.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002 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$
*/
#include <uuid.h>
diff --git a/lib/libc/uuid/uuid_create_nil.c b/lib/libc/uuid/uuid_create_nil.c
index 0fd68712c7b5..9ba67f069ab1 100644
--- a/lib/libc/uuid/uuid_create_nil.c
+++ b/lib/libc/uuid/uuid_create_nil.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002 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$
*/
#include <strings.h>
diff --git a/lib/libc/uuid/uuid_equal.c b/lib/libc/uuid/uuid_equal.c
index 885cb109c383..6faf57ca3e86 100644
--- a/lib/libc/uuid/uuid_equal.c
+++ b/lib/libc/uuid/uuid_equal.c
@@ -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$
*/
#include <string.h>
diff --git a/lib/libc/uuid/uuid_from_string.c b/lib/libc/uuid/uuid_from_string.c
index 3eeefe5038e9..0ca5897fb6e1 100644
--- a/lib/libc/uuid/uuid_from_string.c
+++ b/lib/libc/uuid/uuid_from_string.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002 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$
*/
#include <stdio.h>
diff --git a/lib/libc/uuid/uuid_hash.c b/lib/libc/uuid/uuid_hash.c
index 513f27e753f6..7455614aea4b 100644
--- a/lib/libc/uuid/uuid_hash.c
+++ b/lib/libc/uuid/uuid_hash.c
@@ -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$
*/
#include <uuid.h>
diff --git a/lib/libc/uuid/uuid_is_nil.c b/lib/libc/uuid/uuid_is_nil.c
index 893b2a305f44..dcf65c10ca97 100644
--- a/lib/libc/uuid/uuid_is_nil.c
+++ b/lib/libc/uuid/uuid_is_nil.c
@@ -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$
*/
#include <uuid.h>
diff --git a/lib/libc/uuid/uuid_stream.c b/lib/libc/uuid/uuid_stream.c
index 89e7050dc2fe..cd5a35655f0f 100644
--- a/lib/libc/uuid/uuid_stream.c
+++ b/lib/libc/uuid/uuid_stream.c
@@ -1,7 +1,7 @@
/* $NetBSD: uuid_stream.c,v 1.3 2008/04/19 18:21:38 plunky Exp $ */
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2002 Marcel Moolenaar
* All rights reserved.
@@ -28,9 +28,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/endian.h>
#include <uuid.h>
diff --git a/lib/libc/uuid/uuid_to_string.c b/lib/libc/uuid/uuid_to_string.c
index 7d362c7564e8..e3e76308f33e 100644
--- a/lib/libc/uuid/uuid_to_string.c
+++ b/lib/libc/uuid/uuid_to_string.c
@@ -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$
*/
#include <stdio.h>
diff --git a/lib/libc/x86/gen/Makefile.inc b/lib/libc/x86/gen/Makefile.inc
index 0943fdb04bbf..7449ef52fa61 100644
--- a/lib/libc/x86/gen/Makefile.inc
+++ b/lib/libc/x86/gen/Makefile.inc
@@ -1,4 +1,3 @@
-# $FreeBSD$
.PATH: ${LIBC_SRCTOP}/x86/gen
diff --git a/lib/libc/x86/gen/getcontextx.c b/lib/libc/x86/gen/getcontextx.c
index 056128a149ff..7373ae7395b9 100644
--- a/lib/libc/x86/gen/getcontextx.c
+++ b/lib/libc/x86/gen/getcontextx.c
@@ -1,5 +1,5 @@
/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ * SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2011 Konstantin Belousov <kib@FreeBSD.org>
* All rights reserved.
@@ -26,9 +26,6 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/types.h>
#include <sys/ucontext.h>
#include <errno.h>
diff --git a/lib/libc/x86/sys/Makefile.inc b/lib/libc/x86/sys/Makefile.inc
deleted file mode 100644
index eff3a1085ec6..000000000000
--- a/lib/libc/x86/sys/Makefile.inc
+++ /dev/null
@@ -1,22 +0,0 @@
-# $FreeBSD$
-
-.PATH: ${LIBC_SRCTOP}/x86/sys
-
-SRCS+= \
- __vdso_gettc.c \
- pkru.c
-
-MAN+= \
- pkru.3
-
-.if ${MACHINE_CPUARCH} == "amd64" && ${MK_HYPERV} != "no"
-CFLAGS+= -DWANT_HYPERV
-.endif
-# We can't use sanitizer instrumentation on ifuncs called during sanitizer
-# runtime startup.
-.if ${MK_ASAN} != "no"
-CFLAGS.__vdso_gettc.c+=-fno-sanitize=address
-.endif
-.if ${MK_UBSAN} != "no"
-CFLAGS.__vdso_gettc.c+=-fno-sanitize=undefined
-.endif
diff --git a/lib/libc/x86/sys/__vdso_gettc.c b/lib/libc/x86/sys/__vdso_gettc.c
deleted file mode 100644
index 5cc847e31c0e..000000000000
--- a/lib/libc/x86/sys/__vdso_gettc.c
+++ /dev/null
@@ -1,423 +0,0 @@
-/*-
- * Copyright (c) 2012 Konstantin Belousov <kib@FreeBSD.org>
- * Copyright (c) 2016, 2017, 2019 The FreeBSD Foundation
- * All rights reserved.
- *
- * Portions of this software were developed by Konstantin Belousov
- * under sponsorship from the FreeBSD Foundation.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include "namespace.h"
-#include <sys/capsicum.h>
-#include <sys/elf.h>
-#include <sys/fcntl.h>
-#include <sys/mman.h>
-#include <sys/time.h>
-#include <sys/vdso.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include "un-namespace.h"
-#include <machine/atomic.h>
-#include <machine/cpufunc.h>
-#include <machine/pvclock.h>
-#include <machine/specialreg.h>
-#include <dev/acpica/acpi_hpet.h>
-#ifdef WANT_HYPERV
-#include <dev/hyperv/hyperv.h>
-#endif
-#include <x86/ifunc.h>
-#include "libc_private.h"
-
-static inline u_int
-rdtsc_low(const struct vdso_timehands *th)
-{
- u_int rv;
-
- __asm __volatile("rdtsc; shrd %%cl, %%edx, %0"
- : "=a" (rv) : "c" (th->th_x86_shift) : "edx");
- return (rv);
-}
-
-static inline u_int
-rdtscp_low(const struct vdso_timehands *th)
-{
- u_int rv;
-
- __asm __volatile("rdtscp; movl %%edi,%%ecx; shrd %%cl, %%edx, %0"
- : "=a" (rv) : "D" (th->th_x86_shift) : "ecx", "edx");
- return (rv);
-}
-
-static u_int
-rdtsc_low_mb_lfence(const struct vdso_timehands *th)
-{
- lfence();
- return (rdtsc_low(th));
-}
-
-static u_int
-rdtsc_low_mb_mfence(const struct vdso_timehands *th)
-{
- mfence();
- return (rdtsc_low(th));
-}
-
-static u_int
-rdtsc_low_mb_none(const struct vdso_timehands *th)
-{
- return (rdtsc_low(th));
-}
-
-static u_int
-rdtsc32_mb_lfence(void)
-{
- lfence();
- return (rdtsc32());
-}
-
-static u_int
-rdtsc32_mb_mfence(void)
-{
- mfence();
- return (rdtsc32());
-}
-
-static u_int
-rdtsc32_mb_none(void)
-{
- return (rdtsc32());
-}
-
-static u_int
-rdtscp32_(void)
-{
- return (rdtscp32());
-}
-
-struct tsc_selector_tag {
- u_int (*ts_rdtsc32)(void);
- u_int (*ts_rdtsc_low)(const struct vdso_timehands *);
-};
-
-static const struct tsc_selector_tag tsc_selector[] = {
- [0] = { /* Intel, LFENCE */
- .ts_rdtsc32 = rdtsc32_mb_lfence,
- .ts_rdtsc_low = rdtsc_low_mb_lfence,
- },
- [1] = { /* AMD, MFENCE */
- .ts_rdtsc32 = rdtsc32_mb_mfence,
- .ts_rdtsc_low = rdtsc_low_mb_mfence,
- },
- [2] = { /* No SSE2 */
- .ts_rdtsc32 = rdtsc32_mb_none,
- .ts_rdtsc_low = rdtsc_low_mb_none,
- },
- [3] = { /* RDTSCP */
- .ts_rdtsc32 = rdtscp32_,
- .ts_rdtsc_low = rdtscp_low,
- },
-};
-
-static int
-tsc_selector_idx(u_int cpu_feature)
-{
- u_int amd_feature, cpu_exthigh, cpu_id, p[4], v[3];
- static const char amd_id[] = "AuthenticAMD";
- static const char hygon_id[] = "HygonGenuine";
- bool amd_cpu;
-
- if (cpu_feature == 0)
- return (2); /* should not happen due to RDTSC */
-
- do_cpuid(0, p);
- v[0] = p[1];
- v[1] = p[3];
- v[2] = p[2];
- amd_cpu = memcmp(v, amd_id, sizeof(amd_id) - 1) == 0 ||
- memcmp(v, hygon_id, sizeof(hygon_id) - 1) == 0;
-
- do_cpuid(1, p);
- cpu_id = p[0];
-
- if (cpu_feature != 0) {
- do_cpuid(0x80000000, p);
- cpu_exthigh = p[0];
- } else {
- cpu_exthigh = 0;
- }
- if (cpu_exthigh >= 0x80000001) {
- do_cpuid(0x80000001, p);
- amd_feature = p[3];
- } else {
- amd_feature = 0;
- }
-
- if ((amd_feature & AMDID_RDTSCP) != 0)
- return (3);
- if ((cpu_feature & CPUID_SSE2) == 0)
- return (2);
- return (amd_cpu ? 1 : 0);
-}
-
-DEFINE_UIFUNC(static, u_int, __vdso_gettc_rdtsc_low,
- (const struct vdso_timehands *th))
-{
- return (tsc_selector[tsc_selector_idx(cpu_feature)].ts_rdtsc_low);
-}
-
-DEFINE_UIFUNC(static, u_int, __vdso_gettc_rdtsc32, (void))
-{
- return (tsc_selector[tsc_selector_idx(cpu_feature)].ts_rdtsc32);
-}
-
-#define HPET_DEV_MAP_MAX 10
-static volatile char *hpet_dev_map[HPET_DEV_MAP_MAX];
-
-static void
-__vdso_init_hpet(uint32_t u)
-{
- static const char devprefix[] = "/dev/hpet";
- char devname[64], *c, *c1, t;
- volatile char *new_map, *old_map;
- unsigned int mode;
- uint32_t u1;
- int fd;
-
- c1 = c = stpcpy(devname, devprefix);
- u1 = u;
- do {
- *c++ = u1 % 10 + '0';
- u1 /= 10;
- } while (u1 != 0);
- *c = '\0';
- for (c--; c1 != c; c1++, c--) {
- t = *c1;
- *c1 = *c;
- *c = t;
- }
-
- old_map = hpet_dev_map[u];
- if (old_map != NULL)
- return;
-
- /*
- * Explicitely check for the capability mode to avoid
- * triggering trap_enocap on the device open by absolute path.
- */
- if ((cap_getmode(&mode) == 0 && mode != 0) ||
- (fd = _open(devname, O_RDONLY | O_CLOEXEC)) == -1) {
- /* Prevent the caller from re-entering. */
- atomic_cmpset_rel_ptr((volatile uintptr_t *)&hpet_dev_map[u],
- (uintptr_t)old_map, (uintptr_t)MAP_FAILED);
- return;
- }
-
- new_map = mmap(NULL, PAGE_SIZE, PROT_READ, MAP_SHARED, fd, 0);
- _close(fd);
- if (atomic_cmpset_rel_ptr((volatile uintptr_t *)&hpet_dev_map[u],
- (uintptr_t)old_map, (uintptr_t)new_map) == 0 &&
- new_map != MAP_FAILED)
- munmap((void *)new_map, PAGE_SIZE);
-}
-
-#ifdef WANT_HYPERV
-
-#define HYPERV_REFTSC_DEVPATH "/dev/" HYPERV_REFTSC_DEVNAME
-
-/*
- * NOTE:
- * We use 'NULL' for this variable to indicate that initialization
- * is required. And if this variable is 'MAP_FAILED', then Hyper-V
- * reference TSC can not be used, e.g. in misconfigured jail.
- */
-static struct hyperv_reftsc *hyperv_ref_tsc;
-
-static void
-__vdso_init_hyperv_tsc(void)
-{
- int fd;
- unsigned int mode;
-
- if (cap_getmode(&mode) == 0 && mode != 0)
- goto fail;
-
- fd = _open(HYPERV_REFTSC_DEVPATH, O_RDONLY | O_CLOEXEC);
- if (fd < 0)
- goto fail;
- hyperv_ref_tsc = mmap(NULL, sizeof(*hyperv_ref_tsc), PROT_READ,
- MAP_SHARED, fd, 0);
- _close(fd);
-
- return;
-fail:
- /* Prevent the caller from re-entering. */
- hyperv_ref_tsc = MAP_FAILED;
-}
-
-static int
-__vdso_hyperv_tsc(struct hyperv_reftsc *tsc_ref, u_int *tc)
-{
- uint64_t disc, ret, tsc, scale;
- uint32_t seq;
- int64_t ofs;
-
- while ((seq = atomic_load_acq_int(&tsc_ref->tsc_seq)) != 0) {
- scale = tsc_ref->tsc_scale;
- ofs = tsc_ref->tsc_ofs;
-
- mfence(); /* XXXKIB */
- tsc = rdtsc();
-
- /* ret = ((tsc * scale) >> 64) + ofs */
- __asm__ __volatile__ ("mulq %3" :
- "=d" (ret), "=a" (disc) :
- "a" (tsc), "r" (scale));
- ret += ofs;
-
- atomic_thread_fence_acq();
- if (tsc_ref->tsc_seq == seq) {
- *tc = ret;
- return (0);
- }
-
- /* Sequence changed; re-sync. */
- }
- return (ENOSYS);
-}
-
-#endif /* WANT_HYPERV */
-
-static struct pvclock_vcpu_time_info *pvclock_timeinfos;
-
-static int
-__vdso_pvclock_gettc(const struct vdso_timehands *th, u_int *tc)
-{
- uint64_t delta, ns, tsc;
- struct pvclock_vcpu_time_info *ti;
- uint32_t cpuid_ti, cpuid_tsc, version;
- bool stable;
-
- do {
- ti = &pvclock_timeinfos[0];
- version = atomic_load_acq_32(&ti->version);
- stable = (ti->flags & th->th_x86_pvc_stable_mask) != 0;
- if (stable) {
- tsc = rdtscp();
- } else {
- (void)rdtscp_aux(&cpuid_ti);
- ti = &pvclock_timeinfos[cpuid_ti];
- version = atomic_load_acq_32(&ti->version);
- tsc = rdtscp_aux(&cpuid_tsc);
- }
- delta = tsc - ti->tsc_timestamp;
- ns = ti->system_time + pvclock_scale_delta(delta,
- ti->tsc_to_system_mul, ti->tsc_shift);
- atomic_thread_fence_acq();
- } while ((ti->version & 1) != 0 || ti->version != version ||
- (!stable && cpuid_ti != cpuid_tsc));
- *tc = MAX(ns, th->th_x86_pvc_last_systime);
- return (0);
-}
-
-static void
-__vdso_init_pvclock_timeinfos(void)
-{
- struct pvclock_vcpu_time_info *timeinfos;
- size_t len;
- int fd, ncpus;
- unsigned int mode;
-
- timeinfos = MAP_FAILED;
- if (_elf_aux_info(AT_NCPUS, &ncpus, sizeof(ncpus)) != 0 ||
- (cap_getmode(&mode) == 0 && mode != 0) ||
- (fd = _open("/dev/" PVCLOCK_CDEVNAME, O_RDONLY | O_CLOEXEC)) < 0)
- goto leave;
- len = ncpus * sizeof(*pvclock_timeinfos);
- timeinfos = mmap(NULL, len, PROT_READ, MAP_SHARED, fd, 0);
- _close(fd);
-leave:
- if (atomic_cmpset_rel_ptr(
- (volatile uintptr_t *)&pvclock_timeinfos, (uintptr_t)NULL,
- (uintptr_t)timeinfos) == 0 && timeinfos != MAP_FAILED)
- (void)munmap((void *)timeinfos, len);
-}
-
-#pragma weak __vdso_gettc
-int
-__vdso_gettc(const struct vdso_timehands *th, u_int *tc)
-{
- volatile char *map;
- uint32_t idx;
-
- switch (th->th_algo) {
- case VDSO_TH_ALGO_X86_TSC:
- *tc = th->th_x86_shift > 0 ? __vdso_gettc_rdtsc_low(th) :
- __vdso_gettc_rdtsc32();
- return (0);
- case VDSO_TH_ALGO_X86_HPET:
- idx = th->th_x86_hpet_idx;
- if (idx >= HPET_DEV_MAP_MAX)
- return (ENOSYS);
- map = (volatile char *)atomic_load_acq_ptr(
- (volatile uintptr_t *)&hpet_dev_map[idx]);
- if (map == NULL) {
- __vdso_init_hpet(idx);
- map = (volatile char *)atomic_load_acq_ptr(
- (volatile uintptr_t *)&hpet_dev_map[idx]);
- }
- if (map == MAP_FAILED)
- return (ENOSYS);
- *tc = *(volatile uint32_t *)(map + HPET_MAIN_COUNTER);
- return (0);
-#ifdef WANT_HYPERV
- case VDSO_TH_ALGO_X86_HVTSC:
- if (hyperv_ref_tsc == NULL)
- __vdso_init_hyperv_tsc();
- if (hyperv_ref_tsc == MAP_FAILED)
- return (ENOSYS);
- return (__vdso_hyperv_tsc(hyperv_ref_tsc, tc));
-#endif
- case VDSO_TH_ALGO_X86_PVCLK:
- if (pvclock_timeinfos == NULL)
- __vdso_init_pvclock_timeinfos();
- if (pvclock_timeinfos == MAP_FAILED)
- return (ENOSYS);
- return (__vdso_pvclock_gettc(th, tc));
- default:
- return (ENOSYS);
- }
-}
-
-#pragma weak __vdso_gettimekeep
-int
-__vdso_gettimekeep(struct vdso_timekeep **tk)
-{
-
- return (_elf_aux_info(AT_TIMEKEEP, tk, sizeof(*tk)));
-}
diff --git a/lib/libc/x86/sys/pkru.3 b/lib/libc/x86/sys/pkru.3
deleted file mode 100644
index fc9a7ba8ca86..000000000000
--- a/lib/libc/x86/sys/pkru.3
+++ /dev/null
@@ -1,206 +0,0 @@
-.\" Copyright (c) 2019 The FreeBSD Foundation, Inc.
-.\" All rights reserved.
-.\"
-.\" This documentation was written by
-.\" Konstantin Belousov <kib@FreeBSD.org> under sponsorship
-.\" from the FreeBSD Foundation.
-.\"
-.\" 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 AUTHORS 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 AUTHORS 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.
-.\"
-.\" $FreeBSD$
-.\"
-.Dd February 16, 2019
-.Dt PKRU 3
-.Os
-.Sh NAME
-.Nm Protection Key Rights for User pages
-.Nd provide fast user-managed key-based access control for pages
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.In machine/sysarch.h
-.Ft int
-.Fn x86_pkru_get_perm "unsigned int keyidx" "int *access" "int *modify"
-.Ft int
-.Fn x86_pkru_set_perm "unsigned int keyidx" "int access" "int modify"
-.Ft int
-.Fo x86_pkru_protect_range
-.Fa "void *addr"
-.Fa "unsigned long len"
-.Fa "unsigned int keyidx"
-.Fa "int flag"
-.Fc
-.Ft int
-.Fn x86_pkru_unprotect_range "void *addr" "unsigned long len"
-.Sh DESCRIPTION
-The protection keys feature provides an additional mechanism, besides the
-normal page permissions as established by
-.Xr mmap 2
-and
-.Xr mprotect 2 ,
-to control access to user-mode addresses.
-The mechanism gives safety measures which can be used to avoid
-incidental read or modification of sensitive memory,
-or as a debugging feature.
-It cannot guard against conscious accesses since permissions
-are user-controllable.
-.Pp
-If supported by hardware, each mapped user linear address
-has an associated 4-bit protection key.
-A new per-thread PKRU hardware register determines, for each protection
-key, whether user-mode addresses with that protection key may be
-read or written.
-.Pp
-Only one key may apply to a given range at a time.
-The default protection key index is zero, it is used even if no key
-was explicitly assigned to the address, or if the key was removed.
-.Pp
-The protection prevents the system from accessing user addresses as well
-as the user applications.
-When a system call was unable to read or write user memory due to key
-protection, it returns the
-.Er EFAULT
-error code.
-Note that some side effects may have occurred if this error is reported.
-.Pp
-Protection keys require that the system uses 4-level paging
-(also called long mode),
-which means that it is only available on amd64 system.
-Both 64-bit and 32-bit applications can use protection keys.
-More information about the hardware feature is provided in the IA32 Software
-Developer's Manual published by Intel Corp.
-.Pp
-The key indexes written into the page table entries are managed by the
-.Fn sysarch
-syscall.
-Per-key permissions are managed using the user-mode instructions
-.Em RDPKRU
-and
-.Em WRPKRU .
-The system provides convenient library helpers for both the syscall and
-the instructions, described below.
-.Pp
-The
-.Fn x86_pkru_protect_range
-function assigns key
-.Fa keyidx
-to the range starting at
-.Fa addr
-and having length
-.Fa len .
-Starting address is truncated to the page start,
-and the end is rounded up to the end of the page.
-After a successfull call, the range has the specified key assigned,
-even if the key is zero and it did not change the page table entries.
-.Pp
-The
-.Fa flags
-argument takes the logical OR of the following values:
-.Bl -tag -width
-.It Bq Va AMD64_PKRU_EXCL
-Only assign the key if the range does not have any other keys assigned
-(including the zero key).
-You must first remove any existing key with
-.Fn x86_pkru_unprotect_range
-in order for this request to succeed.
-If the
-.Va AMD64_PKRU_EXCL
-flag is not specified,
-.Fn x86_pkru_protect_range
-replaces any existing key.
-.It Bq Va AMD64_PKRU_PERSIST
-The keys assigned to the range are persistent.
-They are re-established when the current mapping is destroyed
-and a new mapping is created in any sub-range of the specified range.
-You must use a
-.Fn x86_pkru_unprotect_range
-call to forget the key.
-.El
-.Pp
-The
-.Fn x86_pkru_unprotect_range
-function removes any keys assigned to the specified range.
-Existing mappings are changed to use key index zero in page table entries.
-Keys are no longer considered installed for all mappings in the range,
-for the purposes of
-.Fn x86_pkru_protect_range
-with the
-.Va AMD64_PKRU_EXCL
-flag.
-.Pp
-The
-.Fn x86_pkru_get_perm
-function returns access rights for the key specified by the
-.Fn keyidx
-argument.
-If the value pointed to by
-.Fa access
-is zero after the call, no read or write permissions is granted for
-mappings which are assigned the key
-.Fn keyidx .
-If
-.Fa access
-is not zero, read access is permitted.
-The non-zero value of the variable pointed to by the
-.Fa modify
-argument indicates that write access is permitted.
-.Pp
-Conversely, the
-.Fn x86_pkru_set_perm
-establishes the access and modify permissions for the given key index
-as specified by its arguments.
-.Sh RETURN VALUES
-.Rv -std
-.Sh ERRORS
-.Bl -tag -width Er
-.It Bq Er EOPNOTSUPP
-The hardware does not support protection keys.
-.It Bq Er EINVAL
-The supplied key index is invalid (greater than 15).
-.It Bq Er EINVAL
-The supplied
-.Fa flags
-argument for
-.Fn x86_pkru_protect_range
-has reserved bits set.
-.It Bq Er EFAULT
-The supplied address range does not completely fit into the user-managed
-address range.
-.It Bq Er ENOMEM
-The memory shortage prevents the completion of the operation.
-.It Bq Er EBUSY
-The
-.Va AMD64_PKRU_EXCL
-flag was specified for
-.Fn x86_pkru_protect_range
-and the range already has defined protection keys.
-.El
-.Sh SEE ALSO
-.Xr mmap 2 ,
-.Xr mprotect 2 ,
-.Xr munmap 2 ,
-.Xr sysarch 2 .
-.Sh STANDARDS
-The
-.Nm
-functions are non-standard and first appeared in
-.Fx 13.0 .
diff --git a/lib/libc/x86/sys/pkru.c b/lib/libc/x86/sys/pkru.c
deleted file mode 100644
index 28ce93389fd0..000000000000
--- a/lib/libc/x86/sys/pkru.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*-
- * Copyright (c) 2019 The FreeBSD Foundation
- * All rights reserved.
- *
- * Portions of this software were developed by Konstantin Belousov
- * under sponsorship from the FreeBSD Foundation.
- *
- * 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 AUTHOR 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 AUTHOR 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.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <machine/cpufunc.h>
-#include <machine/specialreg.h>
-#include <machine/sysarch.h>
-#include <x86/ifunc.h>
-#include <errno.h>
-#include <string.h>
-
-#define MAX_PKRU_IDX 0xf
-#ifdef __i386__
-#define X86_SET_PKRU I386_SET_PKRU
-#define X86_CLEAR_PKRU I386_CLEAR_PKRU
-#else
-#define X86_SET_PKRU AMD64_SET_PKRU
-#define X86_CLEAR_PKRU AMD64_CLEAR_PKRU
-#endif
-
-static int
-x86_pkru_get_perm_unsup(u_int keyidx, int *access, int *modify)
-{
-
- errno = EOPNOTSUPP;
- return (-1);
-}
-
-static int
-x86_pkru_get_perm_hw(u_int keyidx, int *access, int *modify)
-{
- uint32_t pkru;
-
- if (keyidx > MAX_PKRU_IDX) {
- errno = EINVAL;
- return (-1);
- }
- keyidx *= 2;
- pkru = rdpkru();
- *access = (pkru & (1 << keyidx)) == 0;
- *modify = (pkru & (2 << keyidx)) == 0;
- return (0);
-}
-
-DEFINE_UIFUNC(, int, x86_pkru_get_perm, (u_int, int *, int *))
-{
-
- return ((cpu_stdext_feature2 & CPUID_STDEXT2_OSPKE) == 0 ?
- x86_pkru_get_perm_unsup : x86_pkru_get_perm_hw);
-}
-
-static int
-x86_pkru_set_perm_unsup(u_int keyidx, int access, int modify)
-{
-
- errno = EOPNOTSUPP;
- return (-1);
-}
-
-static int
-x86_pkru_set_perm_hw(u_int keyidx, int access, int modify)
-{
- uint32_t pkru;
-
- if (keyidx > MAX_PKRU_IDX) {
- errno = EINVAL;
- return (-1);
- }
- keyidx *= 2;
- pkru = rdpkru();
- pkru &= ~(3 << keyidx);
- if (!access)
- pkru |= 1 << keyidx;
- if (!modify)
- pkru |= 2 << keyidx;
- wrpkru(pkru);
- return (0);
-}
-
-DEFINE_UIFUNC(, int, x86_pkru_set_perm, (u_int, int, int))
-{
-
- return ((cpu_stdext_feature2 & CPUID_STDEXT2_OSPKE) == 0 ?
- x86_pkru_set_perm_unsup : x86_pkru_set_perm_hw);
-}
-
-int
-x86_pkru_protect_range(void *addr, unsigned long len, u_int keyidx, int flags)
-{
- struct amd64_set_pkru a64pkru;
-
- memset(&a64pkru, 0, sizeof(a64pkru));
- a64pkru.addr = addr;
- a64pkru.len = len;
- a64pkru.keyidx = keyidx;
- a64pkru.flags = flags;
- return (sysarch(X86_SET_PKRU, &a64pkru));
-}
-
-int
-x86_pkru_unprotect_range(void *addr, unsigned long len)
-{
- struct amd64_set_pkru a64pkru;
-
- memset(&a64pkru, 0, sizeof(a64pkru));
- a64pkru.addr = addr;
- a64pkru.len = len;
- return (sysarch(X86_CLEAR_PKRU, &a64pkru));
-}
diff --git a/lib/libc/xdr/Makefile.inc b/lib/libc/xdr/Makefile.inc
index ff2c47305a9e..bbbd09d1e262 100644
--- a/lib/libc/xdr/Makefile.inc
+++ b/lib/libc/xdr/Makefile.inc
@@ -1,5 +1,3 @@
-# @(#)Makefile 5.11 (Berkeley) 9/6/90
-# $FreeBSD$
.PATH: ${LIBC_SRCTOP}/xdr ${LIBC_SRCTOP}/.
SRCS+= xdr.c xdr_array.c xdr_float.c xdr_mem.c \
@@ -27,26 +25,31 @@ MLINKS+= rpc_xdr.3 xdr_accepted_reply.3 \
xdr.3 xdr_float.3 \
xdr.3 xdr_free.3 \
xdr.3 xdr_getpos.3 \
+ xdr.3 xdr_hyper.3 \
xdr.3 xdr_inline.3 \
xdr.3 xdr_int.3 \
xdr.3 xdr_long.3 \
- xdr.3 xdrmem_create.3 \
+ xdr.3 xdr_longlong_t.3 \
xdr.3 xdr_opaque.3 \
xdr.3 xdr_pointer.3 \
- xdr.3 xdrrec_create.3 \
- xdr.3 xdrrec_endofrecord.3 \
- xdr.3 xdrrec_eof.3 \
- xdr.3 xdrrec_skiprecord.3 \
xdr.3 xdr_reference.3 \
xdr.3 xdr_setpos.3 \
xdr.3 xdr_short.3 \
xdr.3 xdr_sizeof.3 \
- xdr.3 xdrstdio_create.3 \
xdr.3 xdr_string.3 \
xdr.3 xdr_u_char.3 \
+ xdr.3 xdr_u_hyper.3 \
+ xdr.3 xdr_u_int.3 \
xdr.3 xdr_u_long.3 \
+ xdr.3 xdr_u_longlong_t.3 \
xdr.3 xdr_u_short.3 \
xdr.3 xdr_union.3 \
xdr.3 xdr_vector.3 \
xdr.3 xdr_void.3 \
+ xdr.3 xdrmem_create.3 \
+ xdr.3 xdrrec_create.3 \
+ xdr.3 xdrrec_endofrecord.3 \
+ xdr.3 xdrrec_eof.3 \
+ xdr.3 xdrrec_skiprecord.3 \
+ xdr.3 xdrstdio_create.3 \
xdr.3 xdr_wrapstring.3
diff --git a/lib/libc/xdr/Symbol.map b/lib/libc/xdr/Symbol.map
index a8eb3a101ec4..0a964fecdbdb 100644
--- a/lib/libc/xdr/Symbol.map
+++ b/lib/libc/xdr/Symbol.map
@@ -1,7 +1,3 @@
-/*
- * $FreeBSD$
- */
-
FBSD_1.0 {
xdr_free;
xdr_void;
diff --git a/lib/libc/xdr/xdr.3 b/lib/libc/xdr/xdr.3
index 6c16cfc3fcfb..65adb050fa44 100644
--- a/lib/libc/xdr/xdr.3
+++ b/lib/libc/xdr/xdr.3
@@ -1,5 +1,3 @@
-.\" @(#)xdr.3n 2.2 88/08/03 4.0 RPCSRC; from 1.16 88/03/14 SMI
-.\" $FreeBSD$
.\"
.Dd February 16, 1988
.Dt XDR 3
diff --git a/lib/libc/xdr/xdr.c b/lib/libc/xdr/xdr.c
index fcf4e9029074..6992cae69bf1 100644
--- a/lib/libc/xdr/xdr.c
+++ b/lib/libc/xdr/xdr.c
@@ -33,13 +33,6 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *sccsid2 = "@(#)xdr.c 1.35 87/08/12";
-static char *sccsid = "@(#)xdr.c 2.1 88/07/29 4.0 RPCSRC";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* xdr.c, Generic XDR routines implementation.
*
@@ -429,13 +422,13 @@ xdr_uint16_t(XDR *xdrs, uint16_t *u_int16_p)
bool_t
xdr_char(XDR *xdrs, char *cp)
{
- int i;
+ u_int i;
- i = (*cp);
- if (!xdr_int(xdrs, &i)) {
+ i = *((unsigned char *)cp);
+ if (!xdr_u_int(xdrs, &i)) {
return (FALSE);
}
- *cp = i;
+ *((unsigned char *)cp) = i;
return (TRUE);
}
@@ -628,7 +621,7 @@ xdr_netobj(XDR *xdrs, struct netobj *np)
}
/*
- * XDR a descriminated union
+ * XDR a discriminated union
* Support routine for discriminated unions.
* You create an array of xdrdiscrim structures, terminated with
* an entry with a null procedure pointer. The routine gets
diff --git a/lib/libc/xdr/xdr_array.c b/lib/libc/xdr/xdr_array.c
index 591c8b816f75..3d39895e756e 100644
--- a/lib/libc/xdr/xdr_array.c
+++ b/lib/libc/xdr/xdr_array.c
@@ -33,13 +33,6 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *sccsid2 = "@(#)xdr_array.c 1.10 87/08/11 Copyr 1984 Sun Micro";
-static char *sccsid = "@(#)xdr_array.c 2.1 88/07/29 4.0 RPCSRC";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* xdr_array.c, Generic XDR routines implementation.
*
diff --git a/lib/libc/xdr/xdr_float.c b/lib/libc/xdr/xdr_float.c
index d77a2e666d0e..87c6feacf3c5 100644
--- a/lib/libc/xdr/xdr_float.c
+++ b/lib/libc/xdr/xdr_float.c
@@ -33,13 +33,6 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *sccsid2 = "@(#)xdr_float.c 1.12 87/08/11 Copyr 1984 Sun Micro";
-static char *sccsid = "@(#)xdr_float.c 2.1 88/07/29 4.0 RPCSRC";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* xdr_float.c, Generic XDR routines implementation.
*
diff --git a/lib/libc/xdr/xdr_mem.c b/lib/libc/xdr/xdr_mem.c
index 423b647e4bed..f8a69d163d7e 100644
--- a/lib/libc/xdr/xdr_mem.c
+++ b/lib/libc/xdr/xdr_mem.c
@@ -33,13 +33,6 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *sccsid2 = "@(#)xdr_mem.c 1.19 87/08/11 Copyr 1984 Sun Micro";
-static char *sccsid = "@(#)xdr_mem.c 2.1 88/07/29 4.0 RPCSRC";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* xdr_mem.h, XDR implementation using memory buffers.
*
diff --git a/lib/libc/xdr/xdr_rec.c b/lib/libc/xdr/xdr_rec.c
index 3ecae9a1ab44..f1167fdeaa65 100644
--- a/lib/libc/xdr/xdr_rec.c
+++ b/lib/libc/xdr/xdr_rec.c
@@ -33,13 +33,6 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *sccsid2 = "@(#)xdr_rec.c 1.21 87/08/11 Copyr 1984 Sun Micro";
-static char *sccsid = "@(#)xdr_rec.c 2.2 88/08/01 4.0 RPCSRC";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* xdr_rec.c, Implements TCP/IP based XDR streams with a "record marking"
* layer above tcp (for rpc's use).
@@ -119,7 +112,7 @@ typedef struct rec_strm {
char *out_base; /* output buffer (points to frag header) */
char *out_finger; /* next output position */
char *out_boundry; /* data cannot up to this address */
- u_int32_t *frag_header; /* beginning of curren fragment */
+ u_int32_t *frag_header; /* beginning of current fragment */
bool_t frag_sent; /* true if buffer sent in middle of record */
/*
* in-coming bits
@@ -229,7 +222,7 @@ xdrrec_create(XDR *xdrs, u_int sendsize, u_int recvsize, void *tcp_handle,
/*
- * The reoutines defined below are the xdr ops which will go into the
+ * The routines defined below are the xdr ops which will go into the
* xdr handle filled in by xdrrec_create.
*/
@@ -491,9 +484,9 @@ xdrrec_eof(XDR *xdrs)
/*
* The client must tell the package when an end-of-record has occurred.
- * The second paraemters tells whether the record should be flushed to the
+ * The second parameters tells whether the record should be flushed to the
* (output) tcp stream. (This let's the package support batched or
- * pipelined procedure calls.) TRUE => immmediate flush to tcp connection.
+ * pipelined procedure calls.) TRUE => immediate flush to tcp connection.
*/
bool_t
xdrrec_endofrecord(XDR *xdrs, bool_t sendnow)
diff --git a/lib/libc/xdr/xdr_reference.c b/lib/libc/xdr/xdr_reference.c
index d18670f28ea6..e3698a35acd9 100644
--- a/lib/libc/xdr/xdr_reference.c
+++ b/lib/libc/xdr/xdr_reference.c
@@ -33,13 +33,6 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *sccsid2 = "@(#)xdr_reference.c 1.11 87/08/11 SMI";
-static char *sccsid = "@(#)xdr_reference.c 2.1 88/07/29 4.0 RPCSRC";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* xdr_reference.c, Generic XDR routines implementation.
*
@@ -63,7 +56,7 @@ __FBSDID("$FreeBSD$");
* referenced by a pointer inside the structure that is currently being
* translated. pp references a pointer to storage. If *pp is null
* the necessary storage is allocated.
- * size is the sizeof the referneced structure.
+ * size is the sizeof the referenced structure.
* proc is the routine to handle the referenced structure.
*/
bool_t
diff --git a/lib/libc/xdr/xdr_sizeof.c b/lib/libc/xdr/xdr_sizeof.c
index 71a6f4e8279b..b374daf82a39 100644
--- a/lib/libc/xdr/xdr_sizeof.c
+++ b/lib/libc/xdr/xdr_sizeof.c
@@ -37,9 +37,6 @@
* when serialized using XDR.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include <rpc/types.h>
#include <rpc/xdr.h>
diff --git a/lib/libc/xdr/xdr_stdio.c b/lib/libc/xdr/xdr_stdio.c
index 0d179f9802f9..22588bca2946 100644
--- a/lib/libc/xdr/xdr_stdio.c
+++ b/lib/libc/xdr/xdr_stdio.c
@@ -33,13 +33,6 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char *sccsid2 = "@(#)xdr_stdio.c 1.16 87/08/11 Copyr 1984 Sun Micro";
-static char *sccsid = "@(#)xdr_stdio.c 2.1 88/07/29 4.0 RPCSRC";
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* xdr_stdio.c, XDR implementation on standard i/o file.
*
diff --git a/lib/libc/yp/Makefile.inc b/lib/libc/yp/Makefile.inc
index 166c9d79caa7..887a29d51f09 100644
--- a/lib/libc/yp/Makefile.inc
+++ b/lib/libc/yp/Makefile.inc
@@ -1,5 +1,3 @@
-# from: @(#)Makefile.inc 5.3 (Berkeley) 2/20/91
-# $FreeBSD$
# yp sources
.PATH: ${LIBC_SRCTOP}/yp
diff --git a/lib/libc/yp/Symbol.map b/lib/libc/yp/Symbol.map
index cf2470a2dcb9..fff2b2e60e39 100644
--- a/lib/libc/yp/Symbol.map
+++ b/lib/libc/yp/Symbol.map
@@ -1,7 +1,3 @@
-/*
- * $FreeBSD$
- */
-
FBSD_1.0 {
xdr_datum;
xdr_ypresp_all_seq;
diff --git a/lib/libc/yp/xdryp.c b/lib/libc/yp/xdryp.c
index aa7c7123a04b..eae57e7e8347 100644
--- a/lib/libc/yp/xdryp.c
+++ b/lib/libc/yp/xdryp.c
@@ -29,15 +29,12 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <rpc/rpc.h>
#include <rpcsvc/yp.h>
#include <stdlib.h>
#include <string.h>
-extern int (*ypresp_allfn)();
+extern int (*ypresp_allfn)(u_long, char *, int, char *, int, void *);
extern void *ypresp_data;
/*
diff --git a/lib/libc/yp/yplib.c b/lib/libc/yp/yplib.c
index 92b57c2512db..95ed526b2e75 100644
--- a/lib/libc/yp/yplib.c
+++ b/lib/libc/yp/yplib.c
@@ -30,9 +30,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include "namespace.h"
#include "reentrant.h"
#include <sys/param.h>
@@ -92,13 +89,9 @@ struct dom_binding {
#endif
#define MAX_RETRIES 20
-extern bool_t xdr_domainname(), xdr_ypbind_resp();
-extern bool_t xdr_ypreq_key(), xdr_ypresp_val();
-extern bool_t xdr_ypreq_nokey(), xdr_ypresp_key_val();
-extern bool_t xdr_ypresp_all(), xdr_ypresp_all_seq();
-extern bool_t xdr_ypresp_master();
+bool_t xdr_ypresp_all_seq(XDR *xdrs, u_long *objp);
-int (*ypresp_allfn)();
+int (*ypresp_allfn)(unsigned long, char *, int, char *, int, void *);
void *ypresp_data;
static void _yp_unbind(struct dom_binding *);