Make improvements

- Clean up sigaction() code
- Add a port scanner example
- Introduce a ParseCidr() API
- Clean up our futex abstraction code
- Fix a harmless integer overflow in ParseIp()
- Use kernel semaphores on NetBSD to make threads much faster
This commit is contained in:
Justine Tunney 2022-11-07 02:22:09 -08:00
parent 539bddce8c
commit c995838e5c
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
107 changed files with 1085 additions and 492 deletions

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall sys_sem_close,0x0fafff190210dfff,globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall sys_sem_destroy,0x0fffff198fffffff,globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall sys_sem_getvalue,0x0fefff197fffffff,globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall sys_sem_init,0x0f7fff194fffffff,globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall sys_sem_open,0x0f8fff195210cfff,globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall sys_sem_post,0x0fbfff1912111fff,globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall sys_sem_timedwait,0x900fff9b9fffffff,globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall sys_sem_trywait,0x0fdfff1932110fff,globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall sys_sem_unlink,0x0f9fff196210efff,globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall sys_sem_wait,0x8fcfff992290ffff,globl

View file

@ -0,0 +1,2 @@
.include "o/libc/sysv/macros.internal.inc"
.scall sys_sem_wait_nocancel,0xfffffffff21a4fff,globl

View file

@ -2094,44 +2094,44 @@ syscon nr __NR_ktrace 0xfff 0xfff 0x002d 0x002d 0x02d 0xfff
# unilateral undocumented errnos
#
# group name GNU/Systemd XNU's Not UNIX! FreeBSD OpenBSD NetBSD The New Technology Commentary
syscon junkerr ECHRNG 44 0 0 0 0 0
syscon junkerr EL2NSYNC 45 0 0 0 0 0
syscon junkerr EL3HLT 46 0 0 0 0 0
syscon junkerr EL3RST 47 0 0 0 0 0
syscon junkerr ELNRNG 48 0 0 0 0 0
syscon junkerr EUNATCH 49 0 0 0 0 0
syscon junkerr ENOCSI 50 0 0 0 0 0
syscon junkerr EL2HLT 51 0 0 0 0 0
syscon junkerr EBADE 52 0 0 0 0 0
syscon junkerr EBADR 53 0 0 0 0 0
syscon junkerr EXFULL 54 0 0 0 0 0
syscon junkerr ENOANO 55 0 0 0 0 0
syscon junkerr EBADRQC 56 0 0 0 0 0
syscon junkerr EBADSLT 57 0 0 0 0 0
syscon junkerr ENOPKG 65 0 0 0 0 0
syscon junkerr EADV 68 0 0 0 0 0
syscon junkerr ESRMNT 69 0 0 0 0 0
syscon junkerr ECOMM 70 0 0 0 0 0
syscon junkerr EDOTDOT 73 0 0 0 0 0
syscon junkerr ENOTUNIQ 76 0 0 0 0 0
syscon junkerr EREMCHG 78 0 0 0 0 0
syscon junkerr ELIBACC 79 0 0 0 0 0
syscon junkerr ELIBBAD 80 0 0 0 0 0
syscon junkerr ELIBSCN 81 0 0 0 0 0
syscon junkerr ELIBMAX 82 0 0 0 0 0
syscon junkerr ELIBEXEC 83 0 0 0 0 0
syscon junkerr ESTRPIPE 86 0 0 0 0 0
syscon junkerr EUCLEAN 117 0 0 0 0 0
syscon junkerr ENOTNAM 118 0 0 0 0 0
syscon junkerr ENAVAIL 119 0 0 0 0 0
syscon junkerr EISNAM 120 0 0 0 0 0
syscon junkerr EREMOTEIO 121 0 0 0 0 0
syscon junkerr ENOKEY 126 0 0 0 0 0
syscon junkerr EKEYEXPIRED 127 0 0 0 0 0
syscon junkerr EKEYREVOKED 128 0 0 0 0 0
syscon junkerr EKEYREJECTED 129 0 0 0 0 0
syscon junkerr ERFKILL 132 0 0 0 0 0
syscon junkerr EHWPOISON 133 0 0 0 0 0
syscon junkerr ECHRNG 44 -1 -1 -1 -1 -1
syscon junkerr EL2NSYNC 45 -1 -1 -1 -1 -1
syscon junkerr EL3HLT 46 -1 -1 -1 -1 -1
syscon junkerr EL3RST 47 -1 -1 -1 -1 -1
syscon junkerr ELNRNG 48 -1 -1 -1 -1 -1
syscon junkerr EUNATCH 49 -1 -1 -1 -1 -1
syscon junkerr ENOCSI 50 -1 -1 -1 -1 -1
syscon junkerr EL2HLT 51 -1 -1 -1 -1 -1
syscon junkerr EBADE 52 -1 -1 -1 -1 -1
syscon junkerr EBADR 53 -1 -1 -1 -1 -1
syscon junkerr EXFULL 54 -1 -1 -1 -1 -1
syscon junkerr ENOANO 55 -1 -1 -1 -1 -1
syscon junkerr EBADRQC 56 -1 -1 -1 -1 -1
syscon junkerr EBADSLT 57 -1 -1 -1 -1 -1
syscon junkerr ENOPKG 65 -1 -1 -1 -1 -1
syscon junkerr EADV 68 -1 -1 -1 -1 -1
syscon junkerr ESRMNT 69 -1 -1 -1 -1 -1
syscon junkerr ECOMM 70 -1 -1 -1 -1 -1
syscon junkerr EDOTDOT 73 -1 -1 -1 -1 -1
syscon junkerr ENOTUNIQ 76 -1 -1 -1 -1 -1
syscon junkerr EREMCHG 78 -1 -1 -1 -1 -1
syscon junkerr ELIBACC 79 -1 -1 -1 -1 -1
syscon junkerr ELIBBAD 80 -1 -1 -1 -1 -1
syscon junkerr ELIBSCN 81 -1 -1 -1 -1 -1
syscon junkerr ELIBMAX 82 -1 -1 -1 -1 -1
syscon junkerr ELIBEXEC 83 -1 -1 -1 -1 -1
syscon junkerr ESTRPIPE 86 -1 -1 -1 -1 -1
syscon junkerr EUCLEAN 117 -1 -1 -1 -1 -1
syscon junkerr ENOTNAM 118 -1 -1 -1 -1 -1
syscon junkerr ENAVAIL 119 -1 -1 -1 -1 -1
syscon junkerr EISNAM 120 -1 -1 -1 -1 -1
syscon junkerr EREMOTEIO 121 -1 -1 -1 -1 -1
syscon junkerr ENOKEY 126 -1 -1 -1 -1 -1
syscon junkerr EKEYEXPIRED 127 -1 -1 -1 -1 -1
syscon junkerr EKEYREVOKED 128 -1 -1 -1 -1 -1
syscon junkerr EKEYREJECTED 129 -1 -1 -1 -1 -1
syscon junkerr ERFKILL 132 -1 -1 -1 -1 -1
syscon junkerr EHWPOISON 133 -1 -1 -1 -1 -1
# arpanet fork combating human-induced exhaustion of our ipv4 address space
#

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,EADV,68,0,0,0,0,0
.syscon junkerr,EADV,68,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,EBADE,52,0,0,0,0,0
.syscon junkerr,EBADE,52,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,EBADR,53,0,0,0,0,0
.syscon junkerr,EBADR,53,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,EBADRQC,56,0,0,0,0,0
.syscon junkerr,EBADRQC,56,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,EBADSLT,57,0,0,0,0,0
.syscon junkerr,EBADSLT,57,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,ECHRNG,44,0,0,0,0,0
.syscon junkerr,ECHRNG,44,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,ECOMM,70,0,0,0,0,0
.syscon junkerr,ECOMM,70,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,EDOTDOT,73,0,0,0,0,0
.syscon junkerr,EDOTDOT,73,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,EHWPOISON,133,0,0,0,0,0
.syscon junkerr,EHWPOISON,133,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,EISNAM,120,0,0,0,0,0
.syscon junkerr,EISNAM,120,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,EKEYEXPIRED,127,0,0,0,0,0
.syscon junkerr,EKEYEXPIRED,127,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,EKEYREJECTED,129,0,0,0,0,0
.syscon junkerr,EKEYREJECTED,129,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,EKEYREVOKED,128,0,0,0,0,0
.syscon junkerr,EKEYREVOKED,128,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,EL2HLT,51,0,0,0,0,0
.syscon junkerr,EL2HLT,51,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,EL2NSYNC,45,0,0,0,0,0
.syscon junkerr,EL2NSYNC,45,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,EL3HLT,46,0,0,0,0,0
.syscon junkerr,EL3HLT,46,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,EL3RST,47,0,0,0,0,0
.syscon junkerr,EL3RST,47,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,ELIBACC,79,0,0,0,0,0
.syscon junkerr,ELIBACC,79,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,ELIBBAD,80,0,0,0,0,0
.syscon junkerr,ELIBBAD,80,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,ELIBEXEC,83,0,0,0,0,0
.syscon junkerr,ELIBEXEC,83,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,ELIBMAX,82,0,0,0,0,0
.syscon junkerr,ELIBMAX,82,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,ELIBSCN,81,0,0,0,0,0
.syscon junkerr,ELIBSCN,81,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,ELNRNG,48,0,0,0,0,0
.syscon junkerr,ELNRNG,48,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,ENAVAIL,119,0,0,0,0,0
.syscon junkerr,ENAVAIL,119,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,ENOANO,55,0,0,0,0,0
.syscon junkerr,ENOANO,55,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,ENOCSI,50,0,0,0,0,0
.syscon junkerr,ENOCSI,50,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,ENOKEY,126,0,0,0,0,0
.syscon junkerr,ENOKEY,126,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,ENOPKG,65,0,0,0,0,0
.syscon junkerr,ENOPKG,65,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,ENOTNAM,118,0,0,0,0,0
.syscon junkerr,ENOTNAM,118,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,ENOTUNIQ,76,0,0,0,0,0
.syscon junkerr,ENOTUNIQ,76,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,EREMCHG,78,0,0,0,0,0
.syscon junkerr,EREMCHG,78,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,EREMOTEIO,121,0,0,0,0,0
.syscon junkerr,EREMOTEIO,121,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,ERFKILL,132,0,0,0,0,0
.syscon junkerr,ERFKILL,132,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,ESRMNT,69,0,0,0,0,0
.syscon junkerr,ESRMNT,69,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,ESTRPIPE,86,0,0,0,0,0
.syscon junkerr,ESTRPIPE,86,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,EUCLEAN,117,0,0,0,0,0
.syscon junkerr,EUCLEAN,117,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,EUNATCH,49,0,0,0,0,0
.syscon junkerr,EUNATCH,49,-1,-1,-1,-1,-1

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon junkerr,EXFULL,54,0,0,0,0,0
.syscon junkerr,EXFULL,54,-1,-1,-1,-1,-1

View file

@ -428,6 +428,18 @@ scall sys_issetugid 0xfff0fd0fd2147fff globl hidden
scall sys_minherit 0x1110fa0fa20fafff globl # no wrapper
scall sys_pathconf 0x0bf0bf0bf20bffff globl # no wrapper
scall sys_sysctl 0x0ca0ca0ca20cafff globl # no wrapper
#──────────────────XNU & FREEBSD & NETBSD────────────────────
scall sys_sem_init 0x0f7fff194fffffff globl
scall sys_sem_destroy 0x0fffff198fffffff globl
scall sys_sem_open 0x0f8fff195210cfff globl
scall sys_sem_close 0x0fafff190210dfff globl
scall sys_sem_unlink 0x0f9fff196210efff globl
scall sys_sem_post 0x0fbfff1912111fff globl
scall sys_sem_wait 0x8fcfff992290ffff globl
scall sys_sem_trywait 0x0fdfff1932110fff globl
scall sys_sem_timedwait 0x900fff9b9fffffff globl
scall sys_sem_wait_nocancel 0xfffffffff21a4fff globl # no wrapper
scall sys_sem_getvalue 0x0fefff197fffffff globl
#───────────────────────XNU & FREEBSD────────────────────────
scall sys_ntp_adjtime 0x0b0fff0b0220ffff globl # no wrapper
scall sys_ntp_gettime 0x1c0fff0f82210fff globl # no wrapper
@ -597,13 +609,6 @@ scall sys_bsdthread_register 0xfffffffff216efff globl hidden
#scall renameatx_np 0xfffffffff21e8fff globl
#scall searchfs 0xfffffffff20e1fff globl
#scall select_nocancel 0xfffffffff2197fff globl
#scall sem_close 0xfffffffff210dfff globl
#scall sem_open 0xfffffffff210cfff globl
#scall sem_post 0xfffffffff2111fff globl
#scall sem_trywait 0xfffffffff2110fff globl
#scall sem_unlink 0xfffffffff210efff globl
#scall sem_wait 0xfffffffff210ffff globl
#scall sem_wait_nocancel 0xfffffffff21a4fff globl
#scall sendmsg_nocancel 0xfffffffff2192fff globl
#scall sendmsg_x 0xfffffffff21e1fff globl
#scall sendto_nocancel 0xfffffffff219dfff globl
@ -711,16 +716,6 @@ scall getpagesize_freebsd 0xffffff040fffffff globl hidden
#scall kmq_timedreceive 0xffffff1cbfffffff globl
#scall kmq_timedsend 0xffffff1ccfffffff globl
#scall kmq_unlink 0xffffff1cefffffff globl
#scall ksem_close 0xffffff190fffffff globl
#scall ksem_destroy 0xffffff198fffffff globl
#scall ksem_getvalue 0xffffff197fffffff globl
#scall ksem_init 0xffffff194fffffff globl
#scall ksem_open 0xffffff195fffffff globl
#scall ksem_post 0xffffff191fffffff globl
#scall ksem_timedwait 0xffffff1b9fffffff globl
#scall ksem_trywait 0xffffff193fffffff globl
#scall ksem_unlink 0xffffff196fffffff globl
#scall ksem_wait 0xffffff192fffffff globl
#scall lchflags 0x130fff187fffffff globl
#scall lchmod 0x112fff112fffffff globl
#scall lgetfh 0xffffff0a0fffffff globl