ref: 4008733e9bc1a9285b70d055f6aeaa4b0a39483b
parent: 7ef923fc9dfde99b672009f84340f5f398b96a80
author: Ori Bernstein <[email protected]>
date: Sat Sep 9 12:14:13 EDT 2017
Add missing files.
--- /dev/null
+++ b/lib/sys/ifreq+netbsd.myr
@@ -1,0 +1,2 @@
+pkg sys =
+;;
--- /dev/null
+++ b/lib/sys/syscall+netbsd-x64.s
@@ -1,0 +1,62 @@
+.globl sys$syscall
+sys$syscall:
+ /*
+ hack: We load 6 args regardless of
+ how many we actually have. This may
+ load junk values, but if the syscall
+ doesn't use them, it's going to be
+ harmless.
+ */
+ movq %rdi,%rax
+ /* 8(%rsp): hidden type arg */
+ movq 16(%rsp),%rdi
+ movq 24(%rsp),%rsi
+ movq 32(%rsp),%rdx
+ movq 40(%rsp),%r10
+ movq 48(%rsp),%r8
+ movq 56(%rsp),%r9
+ /*
+ if there syscalls are more than 6
+ args (eg, mmap), the remaining args
+ are on the stack, with 8 dummy bytes
+ for a return address.
+ */
+ movq 64(%rsp),%rbx
+ pushq %rbx
+ pushq %rbx
+
+ syscall
+ jae .success
+ negq %rax
+
+.success:
+ addq $16,%rsp
+ ret
+
+/* __tfork_thread(tfp : tforkparams#, sz : size, fn : void#, arg : void#-> tid) */
+.globl sys$__tfork_thread
+sys$__tfork_thread:
+ /* syscall */
+ movq %rdx, %r8
+ movq %rcx, %r9
+ movq $8, %rax
+ syscall
+ jb .failparent
+
+ /* are we in the parent? */
+ cmpq $0,%rax
+ jnz .doneparent
+
+ /* call the function and __threxit */
+ movq %r9, %rdi
+ callq *%r8
+
+ movq $302,%rax
+ xorq %rdi,%rdi
+ syscall
+
+.failparent:
+ negq %rax
+
+.doneparent:
+ ret
--- /dev/null
+++ b/lib/sys/syserrno+netbsd.myr
@@ -1,0 +1,123 @@
+pkg sys =
+ type errno = int
+
+ const Eperm : errno = -1 /* Operation not permitted */
+ const Enoent : errno = -2 /* No such file or directory */
+ const Esrch : errno = -3 /* No such process */
+ const Eintr : errno = -4 /* Interrupted system call */
+ const Eio : errno = -5 /* Input/output error */
+ const Enxio : errno = -6 /* Device not configured */
+ const E2big : errno = -7 /* Argument list too long */
+ const Enoexec : errno = -8 /* Exec format error */
+ const Ebadf : errno = -9 /* Bad file descriptor */
+ const Echild : errno = -10 /* No child processes */
+ const Edeadlk : errno = -11 /* Resource deadlock avoided */
+ /* 11 was EAGAIN */
+ const Enomem : errno = -12 /* Cannot allocate memory */
+ const Eacces : errno = -13 /* Permission denied */
+ const Efault : errno = -14 /* Bad address */
+ const Enotblk : errno = -15 /* Block device required */
+ const Ebusy : errno = -16 /* Device busy */
+ const Eexist : errno = -17 /* File exists */
+ const Exdev : errno = -18 /* Cross-device link */
+ const Enodev : errno = -19 /* Operation not supported by device */
+ const Enotdir : errno = -20 /* Not a directory */
+ const Eisdir : errno = -21 /* Is a directory */
+ const Einval : errno = -22 /* Invalid argument */
+ const Enfile : errno = -23 /* Too many open files in system */
+ const Emfile : errno = -24 /* Too many open files */
+ const Enotty : errno = -25 /* Inappropriate ioctl for device */
+ const Etxtbsy : errno = -26 /* Text file busy */
+ const Efbig : errno = -27 /* File too large */
+ const Enospc : errno = -28 /* No space left on device */
+ const Espipe : errno = -29 /* Illegal seek */
+ const Erofs : errno = -30 /* Read-only filesystem */
+ const Emlink : errno = -31 /* Too many links */
+ const Epipe : errno = -32 /* Broken pipe */
+
+ /* math software */
+ const Edom : errno = -33 /* Numerical argument out of domain */
+ const Erange : errno = -34 /* Result too large */
+
+ /* non-blocking and interrupt i/o */
+ const Eagain : errno = -35 /* Resource temporarily unavailable */
+ const Einprogress : errno = -36 /* Operation now in progress */
+ const Ealready : errno = -37 /* Operation already in progress */
+
+ /* ipc/network software -- argument errors */
+ const Enotsock : errno = -38 /* Socket operation on non-socket */
+ const Edestaddrreq : errno = -39 /* Destination address required */
+ const Emsgsize : errno = -40 /* Message too long */
+ const Eprototype : errno = -41 /* Protocol wrong type for socket */
+ const Enoprotoopt : errno = -42 /* Protocol not available */
+ const Eprotonosupport : errno = -43 /* Protocol not supported */
+ const Esocktnosupport : errno = -44 /* Socket type not supported */
+ const Eopnotsupp : errno = -45 /* Operation not supported */
+ const Epfnosupport : errno = -46 /* Protocol family not supported */
+ const Eafnosupport : errno = -47 /* Address family not supported by protocol family */
+ const Eaddrinuse : errno = -48 /* Address already in use */
+ const Eaddrnotavail : errno = -49 /* Can't assign requested address */
+
+ /* ipc/network software -- operational errors */
+ const Enetdown : errno = -50 /* Network is down */
+ const Enetunreach : errno = -51 /* Network is unreachable */
+ const Enetreset : errno = -52 /* Network dropped connection on reset */
+ const Econnaborted : errno = -53 /* Software caused connection abort */
+ const Econnreset : errno = -54 /* Connection reset by peer */
+ const Enobufs : errno = -55 /* No buffer space available */
+ const Eisconn : errno = -56 /* Socket is already connected */
+ const Enotconn : errno = -57 /* Socket is not connected */
+ const Eshutdown : errno = -58 /* Can't send after socket shutdown */
+ const Etoomanyrefs : errno = -59 /* Too many references: can't splice */
+ const Etimedout : errno = -60 /* Operation timed out */
+ const Econnrefused : errno = -61 /* Connection refused */
+
+ const Eloop : errno = -62 /* Too many levels of symbolic links */
+ const Enametoolong : errno = -63 /* File name too long */
+
+ /* should be rearranged */
+ const Ehostdown : errno = -64 /* Host is down */
+ const Ehostunreach : errno = -65 /* No route to host */
+ const Enotempty : errno = -66 /* Directory not empty */
+
+ /* quotas & mush */
+ const Eproclim : errno = -67 /* Too many processes */
+ const Eusers : errno = -68 /* Too many users */
+ const Edquot : errno = -69 /* Disc quota exceeded */
+
+ /* Network File System */
+ const Estale : errno = -70 /* Stale NFS file handle */
+ const Eremote : errno = -71 /* Too many levels of remote in path */
+ const Ebadrpc : errno = -72 /* RPC struct is bad */
+ const Erpcmismatch : errno = -73 /* RPC version wrong */
+ const Eprogunavail : errno = -74 /* RPC prog. not avail */
+ const Eprogmismatch : errno = -75 /* Program version wrong */
+ const Eprocunavail : errno = -76 /* Bad procedure for program */
+
+ const Enolck : errno = -77 /* No locks available */
+ const Enosys : errno = -78 /* Function not implemented */
+
+ const Eftype : errno = -79 /* Inappropriate file type or format */
+ const Eauth : errno = -80 /* Authentication error */
+ const Eneedauth : errno = -81 /* Need authenticator */
+ const Eidrm : errno = -82 /* Identifier removed */
+ const Enomsg : errno = -83 /* No message of desired type */
+ const Eoverflow : errno = -84 /* Value too large to be stored in data type */
+ const Ecanceled : errno = -85 /* Operation canceled */
+ const Eilseq : errno = -86 /* Illegal byte sequence */
+ const Enoattr : errno = -87 /* Attribute not found */
+
+ const Edoofus : errno = -88 /* Programming error */
+
+ const Ebadmsg : errno = -89 /* Bad message */
+ const Emultihop : errno = -90 /* Multihop attempted */
+ const Enolink : errno = -91 /* Link has been severed */
+ const Eproto : errno = -92 /* Protocol error */
+
+ const Enotcapable : errno = -93 /* Capabilities insufficient */
+ const Ecapmode : errno = -94 /* Not permitted in capability mode */
+ const Enotrecoverable : errno = -95 /* State not recoverable */
+ const Eownerdead : errno = -96 /* Previous owner died */
+
+ const Elast : errno = -96 /* Must be equal largest errno */
+;;