summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/compat/cloudabi/cloudabi_clock.c3
-rw-r--r--sys/compat/cloudabi/cloudabi_errno.c3
-rw-r--r--sys/compat/cloudabi/cloudabi_fd.c3
-rw-r--r--sys/compat/cloudabi/cloudabi_file.c21
-rw-r--r--sys/compat/cloudabi/cloudabi_futex.c3
-rw-r--r--sys/compat/cloudabi/cloudabi_mem.c3
-rw-r--r--sys/compat/cloudabi/cloudabi_proc.c3
-rw-r--r--sys/compat/cloudabi/cloudabi_proto.h4
-rw-r--r--sys/compat/cloudabi/cloudabi_sock.c20
-rw-r--r--sys/compat/cloudabi/cloudabi_syscalldefs.h48
-rw-r--r--sys/compat/cloudabi/cloudabi_thread.c3
-rw-r--r--sys/compat/cloudabi/cloudabi_util.h2
-rw-r--r--sys/compat/cloudabi64/Makefile6
-rw-r--r--sys/compat/cloudabi64/cloudabi64_fd.c3
-rw-r--r--sys/compat/cloudabi64/cloudabi64_module.c3
-rw-r--r--sys/compat/cloudabi64/cloudabi64_poll.c9
-rw-r--r--sys/compat/cloudabi64/cloudabi64_sock.c7
-rw-r--r--sys/compat/cloudabi64/cloudabi64_syscalldefs.h45
-rw-r--r--sys/compat/cloudabi64/cloudabi64_systrace_args.c68
-rw-r--r--sys/compat/cloudabi64/cloudabi64_thread.c3
-rw-r--r--sys/compat/cloudabi64/cloudabi64_util.h2
-rw-r--r--sys/contrib/cloudabi/cloudabi64_types.h222
-rw-r--r--sys/contrib/cloudabi/cloudabi_types_common.h457
-rw-r--r--sys/contrib/cloudabi/syscalldefs_md.h255
-rw-r--r--sys/contrib/cloudabi/syscalldefs_mi.h476
-rw-r--r--sys/contrib/cloudabi/syscalls.master (renamed from sys/compat/cloudabi64/syscalls.master)211
26 files changed, 927 insertions, 956 deletions
diff --git a/sys/compat/cloudabi/cloudabi_clock.c b/sys/compat/cloudabi/cloudabi_clock.c
index ed32cf6..b26d98e 100644
--- a/sys/compat/cloudabi/cloudabi_clock.c
+++ b/sys/compat/cloudabi/cloudabi_clock.c
@@ -31,8 +31,9 @@ __FBSDID("$FreeBSD$");
#include <sys/stdint.h>
#include <sys/syscallsubr.h>
+#include <contrib/cloudabi/cloudabi_types_common.h>
+
#include <compat/cloudabi/cloudabi_proto.h>
-#include <compat/cloudabi/cloudabi_syscalldefs.h>
#include <compat/cloudabi/cloudabi_util.h>
/* Converts a CloudABI clock ID to a FreeBSD clock ID. */
diff --git a/sys/compat/cloudabi/cloudabi_errno.c b/sys/compat/cloudabi/cloudabi_errno.c
index 5193cfc..38520b9 100644
--- a/sys/compat/cloudabi/cloudabi_errno.c
+++ b/sys/compat/cloudabi/cloudabi_errno.c
@@ -28,7 +28,8 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
-#include <compat/cloudabi/cloudabi_syscalldefs.h>
+#include <contrib/cloudabi/cloudabi_types_common.h>
+
#include <compat/cloudabi/cloudabi_util.h>
/* Converts a FreeBSD errno to a CloudABI errno. */
diff --git a/sys/compat/cloudabi/cloudabi_fd.c b/sys/compat/cloudabi/cloudabi_fd.c
index 17177d2..c044adc 100644
--- a/sys/compat/cloudabi/cloudabi_fd.c
+++ b/sys/compat/cloudabi/cloudabi_fd.c
@@ -38,8 +38,9 @@ __FBSDID("$FreeBSD$");
#include <sys/unistd.h>
#include <sys/vnode.h>
+#include <contrib/cloudabi/cloudabi_types_common.h>
+
#include <compat/cloudabi/cloudabi_proto.h>
-#include <compat/cloudabi/cloudabi_syscalldefs.h>
#include <compat/cloudabi/cloudabi_util.h>
/* Translation between CloudABI and Capsicum rights. */
diff --git a/sys/compat/cloudabi/cloudabi_file.c b/sys/compat/cloudabi/cloudabi_file.c
index cdf0585..f48b754 100644
--- a/sys/compat/cloudabi/cloudabi_file.c
+++ b/sys/compat/cloudabi/cloudabi_file.c
@@ -39,8 +39,9 @@ __FBSDID("$FreeBSD$");
#include <sys/uio.h>
#include <sys/vnode.h>
+#include <contrib/cloudabi/cloudabi_types_common.h>
+
#include <compat/cloudabi/cloudabi_proto.h>
-#include <compat/cloudabi/cloudabi_syscalldefs.h>
#include <compat/cloudabi/cloudabi_util.h>
#include <security/mac/mac_framework.h>
@@ -185,8 +186,8 @@ cloudabi_sys_file_link(struct thread *td,
return (error);
}
- error = kern_linkat(td, uap->fd1, uap->fd2, path1, path2,
- UIO_SYSSPACE, (uap->fd1 & CLOUDABI_LOOKUP_SYMLINK_FOLLOW) != 0 ?
+ error = kern_linkat(td, uap->fd1.fd, uap->fd2, path1, path2,
+ UIO_SYSSPACE, (uap->fd1.flags & CLOUDABI_LOOKUP_SYMLINK_FOLLOW) ?
FOLLOW : NOFOLLOW);
cloudabi_freestr(path1);
cloudabi_freestr(path2);
@@ -248,7 +249,7 @@ cloudabi_sys_file_open(struct thread *td,
fflags |= O_SYNC;
cap_rights_set(&rights, CAP_FSYNC);
}
- if ((uap->fd & CLOUDABI_LOOKUP_SYMLINK_FOLLOW) == 0)
+ if ((uap->dirfd.flags & CLOUDABI_LOOKUP_SYMLINK_FOLLOW) == 0)
fflags |= O_NOFOLLOW;
if (write && (fflags & (O_APPEND | O_TRUNC)) == 0)
cap_rights_set(&rights, CAP_SEEK);
@@ -265,7 +266,7 @@ cloudabi_sys_file_open(struct thread *td,
fdrop(fp, td);
return (error);
}
- NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, path, uap->fd,
+ NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, path, uap->dirfd.fd,
&rights, td);
error = vn_open(&nd, &fflags, 0777 & ~td->td_proc->p_fd->fd_cmask, fp);
cloudabi_freestr(path);
@@ -657,8 +658,8 @@ cloudabi_sys_file_stat_get(struct thread *td,
return (error);
error = kern_statat(td,
- (uap->fd & CLOUDABI_LOOKUP_SYMLINK_FOLLOW) != 0 ? 0 :
- AT_SYMLINK_NOFOLLOW, uap->fd, path, UIO_SYSSPACE, &sb, NULL);
+ (uap->fd.flags & CLOUDABI_LOOKUP_SYMLINK_FOLLOW) != 0 ? 0 :
+ AT_SYMLINK_NOFOLLOW, uap->fd.fd, path, UIO_SYSSPACE, &sb, NULL);
cloudabi_freestr(path);
if (error != 0)
return (error);
@@ -711,8 +712,8 @@ cloudabi_sys_file_stat_put(struct thread *td,
return (error);
convert_utimens_arguments(&fs, uap->flags, ts);
- error = kern_utimensat(td, uap->fd, path, UIO_SYSSPACE, ts,
- UIO_SYSSPACE, (uap->fd & CLOUDABI_LOOKUP_SYMLINK_FOLLOW) != 0 ?
+ error = kern_utimensat(td, uap->fd.fd, path, UIO_SYSSPACE, ts,
+ UIO_SYSSPACE, (uap->fd.flags & CLOUDABI_LOOKUP_SYMLINK_FOLLOW) ?
0 : AT_SYMLINK_NOFOLLOW);
cloudabi_freestr(path);
return (error);
@@ -751,7 +752,7 @@ cloudabi_sys_file_unlink(struct thread *td,
if (error != 0)
return (error);
- if (uap->flag & CLOUDABI_UNLINK_REMOVEDIR)
+ if (uap->flags & CLOUDABI_UNLINK_REMOVEDIR)
error = kern_rmdirat(td, uap->fd, path, UIO_SYSSPACE);
else
error = kern_unlinkat(td, uap->fd, path, UIO_SYSSPACE, 0);
diff --git a/sys/compat/cloudabi/cloudabi_futex.c b/sys/compat/cloudabi/cloudabi_futex.c
index aec2f33..bc01265 100644
--- a/sys/compat/cloudabi/cloudabi_futex.c
+++ b/sys/compat/cloudabi/cloudabi_futex.c
@@ -37,8 +37,9 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/umtx.h>
+#include <contrib/cloudabi/cloudabi_types_common.h>
+
#include <compat/cloudabi/cloudabi_proto.h>
-#include <compat/cloudabi/cloudabi_syscalldefs.h>
#include <compat/cloudabi/cloudabi_util.h>
/*
diff --git a/sys/compat/cloudabi/cloudabi_mem.c b/sys/compat/cloudabi/cloudabi_mem.c
index 9d82673..34ee14a 100644
--- a/sys/compat/cloudabi/cloudabi_mem.c
+++ b/sys/compat/cloudabi/cloudabi_mem.c
@@ -30,8 +30,9 @@ __FBSDID("$FreeBSD$");
#include <sys/mman.h>
#include <sys/sysproto.h>
+#include <contrib/cloudabi/cloudabi_types_common.h>
+
#include <compat/cloudabi/cloudabi_proto.h>
-#include <compat/cloudabi/cloudabi_syscalldefs.h>
/* Converts CloudABI's memory protection flags to FreeBSD's. */
static int
diff --git a/sys/compat/cloudabi/cloudabi_proc.c b/sys/compat/cloudabi/cloudabi_proc.c
index 8d0b6e7..139af2c 100644
--- a/sys/compat/cloudabi/cloudabi_proc.c
+++ b/sys/compat/cloudabi/cloudabi_proc.c
@@ -38,8 +38,9 @@ __FBSDID("$FreeBSD$");
#include <sys/syscallsubr.h>
#include <sys/unistd.h>
+#include <contrib/cloudabi/cloudabi_types_common.h>
+
#include <compat/cloudabi/cloudabi_proto.h>
-#include <compat/cloudabi/cloudabi_syscalldefs.h>
int
cloudabi_sys_proc_exec(struct thread *td,
diff --git a/sys/compat/cloudabi/cloudabi_proto.h b/sys/compat/cloudabi/cloudabi_proto.h
index e4baffd..95271fd 100644
--- a/sys/compat/cloudabi/cloudabi_proto.h
+++ b/sys/compat/cloudabi/cloudabi_proto.h
@@ -30,5 +30,7 @@
* calls. Unfortunately, we don't have a separate system call table for
* those, so rely on the system call table from COMPAT_CLOUDABI64.
*/
-#include <compat/cloudabi64/cloudabi64_syscalldefs.h>
+
+#include <contrib/cloudabi/cloudabi64_types.h>
+
#include <compat/cloudabi64/cloudabi64_proto.h>
diff --git a/sys/compat/cloudabi/cloudabi_sock.c b/sys/compat/cloudabi/cloudabi_sock.c
index cdccdff..b66f0ab 100644
--- a/sys/compat/cloudabi/cloudabi_sock.c
+++ b/sys/compat/cloudabi/cloudabi_sock.c
@@ -43,8 +43,9 @@ __FBSDID("$FreeBSD$");
#include <netinet/in.h>
+#include <contrib/cloudabi/cloudabi_types_common.h>
+
#include <compat/cloudabi/cloudabi_proto.h>
-#include <compat/cloudabi/cloudabi_syscalldefs.h>
#include <compat/cloudabi/cloudabi_util.h>
/* Converts FreeBSD's struct sockaddr to CloudABI's cloudabi_sockaddr_t. */
@@ -117,12 +118,12 @@ cloudabi_sys_sock_accept(struct thread *td,
if (uap->buf == NULL) {
/* Only return the new file descriptor number. */
- return (kern_accept(td, uap->s, NULL, NULL, NULL));
+ return (kern_accept(td, uap->sock, NULL, NULL, NULL));
} else {
/* Also return properties of the new socket descriptor. */
sal = MAX(sizeof(struct sockaddr_in),
sizeof(struct sockaddr_in6));
- error = kern_accept(td, uap->s, (void *)&sa, &sal, NULL);
+ error = kern_accept(td, uap->sock, (void *)&sa, &sal, NULL);
if (error != 0)
return (error);
@@ -143,7 +144,7 @@ cloudabi_sys_sock_bind(struct thread *td,
error = copyin_sockaddr_un(uap->path, uap->pathlen, &sun);
if (error != 0)
return (error);
- return (kern_bindat(td, uap->fd, uap->s, (struct sockaddr *)&sun));
+ return (kern_bindat(td, uap->fd, uap->sock, (struct sockaddr *)&sun));
}
int
@@ -156,7 +157,8 @@ cloudabi_sys_sock_connect(struct thread *td,
error = copyin_sockaddr_un(uap->path, uap->pathlen, &sun);
if (error != 0)
return (error);
- return (kern_connectat(td, uap->fd, uap->s, (struct sockaddr *)&sun));
+ return (kern_connectat(td, uap->fd, uap->sock,
+ (struct sockaddr *)&sun));
}
int
@@ -164,7 +166,7 @@ cloudabi_sys_sock_listen(struct thread *td,
struct cloudabi_sys_sock_listen_args *uap)
{
struct listen_args listen_args = {
- .s = uap->s,
+ .s = uap->sock,
.backlog = uap->backlog,
};
@@ -176,7 +178,7 @@ cloudabi_sys_sock_shutdown(struct thread *td,
struct cloudabi_sys_sock_shutdown_args *uap)
{
struct shutdown_args shutdown_args = {
- .s = uap->fd,
+ .s = uap->sock,
};
switch (uap->how) {
@@ -207,7 +209,7 @@ cloudabi_sys_sock_stat_get(struct thread *td,
struct socket *so;
int error;
- error = getsock_cap(td, uap->fd, cap_rights_init(&rights,
+ error = getsock_cap(td, uap->sock, cap_rights_init(&rights,
CAP_GETSOCKOPT, CAP_GETPEERNAME, CAP_GETSOCKNAME), &fp, NULL);
if (error != 0)
return (error);
@@ -243,7 +245,7 @@ cloudabi_sys_sock_stat_get(struct thread *td,
/* Set ss_state. */
if ((so->so_options & SO_ACCEPTCONN) != 0)
- ss.ss_state |= CLOUDABI_SOCKSTAT_ACCEPTCONN;
+ ss.ss_state |= CLOUDABI_SOCKSTATE_ACCEPTCONN;
fdrop(fp, td);
return (copyout(&ss, uap->buf, sizeof(ss)));
diff --git a/sys/compat/cloudabi/cloudabi_syscalldefs.h b/sys/compat/cloudabi/cloudabi_syscalldefs.h
deleted file mode 100644
index fc86eff..0000000
--- a/sys/compat/cloudabi/cloudabi_syscalldefs.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*-
- * Copyright (c) 2015 Nuxi, https://nuxi.nl/
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must 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$
- */
-
-#ifndef _CLOUDABI_SYSCALLDEFS_H_
-#define _CLOUDABI_SYSCALLDEFS_H_
-
-#ifdef _KERNEL
-#include <sys/types.h>
-#include <sys/stdint.h>
-
-#define alignas _Alignas
-#define alignof _Alignof
-#define static_assert _Static_assert
-#else
-#include <assert.h>
-#include <stdalign.h>
-#include <stddef.h>
-#include <stdint.h>
-#endif
-
-/* Import machine-independent CloudABI definitions. */
-#include <contrib/cloudabi/syscalldefs_mi.h>
-
-#endif
diff --git a/sys/compat/cloudabi/cloudabi_thread.c b/sys/compat/cloudabi/cloudabi_thread.c
index 8aee708..37dc794 100644
--- a/sys/compat/cloudabi/cloudabi_thread.c
+++ b/sys/compat/cloudabi/cloudabi_thread.c
@@ -31,8 +31,9 @@ __FBSDID("$FreeBSD$");
#include <sys/sched.h>
#include <sys/syscallsubr.h>
+#include <contrib/cloudabi/cloudabi_types_common.h>
+
#include <compat/cloudabi/cloudabi_proto.h>
-#include <compat/cloudabi/cloudabi_syscalldefs.h>
int
cloudabi_sys_thread_exit(struct thread *td,
diff --git a/sys/compat/cloudabi/cloudabi_util.h b/sys/compat/cloudabi/cloudabi_util.h
index 10da229..52eb48c 100644
--- a/sys/compat/cloudabi/cloudabi_util.h
+++ b/sys/compat/cloudabi/cloudabi_util.h
@@ -30,7 +30,7 @@
#include <sys/socket.h>
-#include <compat/cloudabi/cloudabi_syscalldefs.h>
+#include <contrib/cloudabi/cloudabi_types_common.h>
struct file;
struct thread;
diff --git a/sys/compat/cloudabi64/Makefile b/sys/compat/cloudabi64/Makefile
index 3fbef57..83d27a3 100644
--- a/sys/compat/cloudabi64/Makefile
+++ b/sys/compat/cloudabi64/Makefile
@@ -8,5 +8,7 @@ sysent: cloudabi64_sysent.c cloudabi64_syscall.h cloudabi64_proto.h \
cloudabi64_sysent.c cloudabi64_syscall.h cloudabi64_proto.h \
cloudabi64_syscalls.c cloudabi64_systrace_args.c: \
- ../../kern/makesyscalls.sh syscalls.master syscalls.conf
- sh ../../kern/makesyscalls.sh syscalls.master syscalls.conf
+ ../../kern/makesyscalls.sh ../../contrib/cloudabi/syscalls.master \
+ syscalls.conf
+ sh ../../kern/makesyscalls.sh ../../contrib/cloudabi/syscalls.master \
+ syscalls.conf
diff --git a/sys/compat/cloudabi64/cloudabi64_fd.c b/sys/compat/cloudabi64/cloudabi64_fd.c
index b2fd67d..7d0c69a 100644
--- a/sys/compat/cloudabi64/cloudabi64_fd.c
+++ b/sys/compat/cloudabi64/cloudabi64_fd.c
@@ -34,7 +34,8 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/uio.h>
-#include <compat/cloudabi64/cloudabi64_syscalldefs.h>
+#include <contrib/cloudabi/cloudabi64_types.h>
+
#include <compat/cloudabi64/cloudabi64_proto.h>
/* Copies in 64-bit iovec structures from userspace. */
diff --git a/sys/compat/cloudabi64/cloudabi64_module.c b/sys/compat/cloudabi64/cloudabi64_module.c
index ca8ecf4..60100c5 100644
--- a/sys/compat/cloudabi64/cloudabi64_module.c
+++ b/sys/compat/cloudabi64/cloudabi64_module.c
@@ -36,7 +36,8 @@ __FBSDID("$FreeBSD$");
#include <sys/sysent.h>
#include <sys/systm.h>
-#include <compat/cloudabi64/cloudabi64_syscalldefs.h>
+#include <contrib/cloudabi/cloudabi64_types.h>
+
#include <compat/cloudabi64/cloudabi64_util.h>
register_t *
diff --git a/sys/compat/cloudabi64/cloudabi64_poll.c b/sys/compat/cloudabi64/cloudabi64_poll.c
index c8f1811..e44d69f 100644
--- a/sys/compat/cloudabi64/cloudabi64_poll.c
+++ b/sys/compat/cloudabi64/cloudabi64_poll.c
@@ -30,9 +30,10 @@ __FBSDID("$FreeBSD$");
#include <sys/proc.h>
#include <sys/syscallsubr.h>
+#include <contrib/cloudabi/cloudabi64_types.h>
+
#include <compat/cloudabi/cloudabi_util.h>
-#include <compat/cloudabi64/cloudabi64_syscalldefs.h>
#include <compat/cloudabi64/cloudabi64_proto.h>
/* Converts a FreeBSD signal number to a CloudABI signal number. */
@@ -248,7 +249,7 @@ cloudabi64_sys_poll(struct thread *td, struct cloudabi64_sys_poll_args *uap)
* Bandaid to support CloudABI futex constructs that are not
* implemented through FreeBSD's kqueue().
*/
- if (uap->nevents == 1) {
+ if (uap->nsubscriptions == 1) {
cloudabi64_subscription_t sub;
cloudabi64_event_t ev = {};
int error;
@@ -291,7 +292,7 @@ cloudabi64_sys_poll(struct thread *td, struct cloudabi64_sys_poll_args *uap)
td->td_retval[0] = 1;
return (copyout(&ev, uap->out, sizeof(ev)));
}
- } else if (uap->nevents == 2) {
+ } else if (uap->nsubscriptions == 2) {
cloudabi64_subscription_t sub[2];
cloudabi64_event_t ev[2] = {};
int error;
@@ -365,7 +366,7 @@ cloudabi64_sys_poll(struct thread *td, struct cloudabi64_sys_poll_args *uap)
}
}
- return (kern_kevent_anonymous(td, uap->nevents, &copyops));
+ return (kern_kevent_anonymous(td, uap->nsubscriptions, &copyops));
}
int
diff --git a/sys/compat/cloudabi64/cloudabi64_sock.c b/sys/compat/cloudabi64/cloudabi64_sock.c
index c612a32..e6b9c94 100644
--- a/sys/compat/cloudabi64/cloudabi64_sock.c
+++ b/sys/compat/cloudabi64/cloudabi64_sock.c
@@ -35,9 +35,10 @@ __FBSDID("$FreeBSD$");
#include <sys/systm.h>
#include <sys/uio.h>
+#include <contrib/cloudabi/cloudabi64_types.h>
+
#include <compat/cloudabi/cloudabi_util.h>
-#include <compat/cloudabi64/cloudabi64_syscalldefs.h>
#include <compat/cloudabi64/cloudabi64_proto.h>
static MALLOC_DEFINE(M_SOCKET, "socket", "CloudABI socket");
@@ -82,7 +83,7 @@ cloudabi64_sys_sock_recv(struct thread *td,
msghdr.msg_flags |= MSG_WAITALL;
/* TODO(ed): Add file descriptor passing. */
- error = kern_recvit(td, uap->s, &msghdr, UIO_SYSSPACE, NULL);
+ error = kern_recvit(td, uap->sock, &msghdr, UIO_SYSSPACE, NULL);
free(msghdr.msg_iov, M_SOCKET);
if (error != 0)
return (error);
@@ -132,7 +133,7 @@ cloudabi64_sys_sock_send(struct thread *td,
flags |= MSG_EOR;
/* TODO(ed): Add file descriptor passing. */
- error = kern_sendit(td, uap->s, &msghdr, flags, NULL, UIO_USERSPACE);
+ error = kern_sendit(td, uap->sock, &msghdr, flags, NULL, UIO_USERSPACE);
free(msghdr.msg_iov, M_SOCKET);
if (error != 0)
return (error);
diff --git a/sys/compat/cloudabi64/cloudabi64_syscalldefs.h b/sys/compat/cloudabi64/cloudabi64_syscalldefs.h
deleted file mode 100644
index d57f5f4..0000000
--- a/sys/compat/cloudabi64/cloudabi64_syscalldefs.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*-
- * Copyright (c) 2015 Nuxi, https://nuxi.nl/
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must 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$
- */
-
-#ifndef _CLOUDABI64_SYSCALLDEFS_H_
-#define _CLOUDABI64_SYSCALLDEFS_H_
-
-#include <sys/types.h>
-
-#include <compat/cloudabi/cloudabi_syscalldefs.h>
-
-typedef uint64_t cloudabi64_size_t;
-typedef uint64_t cloudabi64_uintptr_t;
-
-/* Import machine-dependent CloudABI definitions for 64-bit systems. */
-#define IDENT(ident) cloudabi64_##ident
-#define PTR(type) cloudabi64_uintptr_t
-#include <contrib/cloudabi/syscalldefs_md.h>
-#undef IDENT
-#undef PTR
-
-#endif
diff --git a/sys/compat/cloudabi64/cloudabi64_systrace_args.c b/sys/compat/cloudabi64/cloudabi64_systrace_args.c
index b3176aa..33ed931 100644
--- a/sys/compat/cloudabi64/cloudabi64_systrace_args.c
+++ b/sys/compat/cloudabi64/cloudabi64_systrace_args.c
@@ -75,7 +75,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
struct cloudabi64_sys_fd_pread_args *p = params;
iarg[0] = p->fd; /* cloudabi_fd_t */
uarg[1] = (intptr_t) p->iov; /* const cloudabi64_iovec_t * */
- iarg[2] = p->iovcnt; /* cloudabi64_size_t */
+ uarg[2] = p->iovcnt; /* size_t */
iarg[3] = p->offset; /* cloudabi_filesize_t */
*n_args = 4;
break;
@@ -85,7 +85,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
struct cloudabi64_sys_fd_pwrite_args *p = params;
iarg[0] = p->fd; /* cloudabi_fd_t */
uarg[1] = (intptr_t) p->iov; /* const cloudabi64_ciovec_t * */
- iarg[2] = p->iovcnt; /* cloudabi64_size_t */
+ uarg[2] = p->iovcnt; /* size_t */
iarg[3] = p->offset; /* cloudabi_filesize_t */
*n_args = 4;
break;
@@ -95,7 +95,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
struct cloudabi64_sys_fd_read_args *p = params;
iarg[0] = p->fd; /* cloudabi_fd_t */
uarg[1] = (intptr_t) p->iov; /* const cloudabi64_iovec_t * */
- iarg[2] = p->iovcnt; /* cloudabi64_size_t */
+ uarg[2] = p->iovcnt; /* size_t */
*n_args = 3;
break;
}
@@ -145,7 +145,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
struct cloudabi64_sys_fd_write_args *p = params;
iarg[0] = p->fd; /* cloudabi_fd_t */
uarg[1] = (intptr_t) p->iov; /* const cloudabi64_ciovec_t * */
- iarg[2] = p->iovcnt; /* cloudabi64_size_t */
+ uarg[2] = p->iovcnt; /* size_t */
*n_args = 3;
break;
}
@@ -193,7 +193,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
/* cloudabi_sys_file_open */
case 21: {
struct cloudabi_sys_file_open_args *p = params;
- iarg[0] = p->fd; /* cloudabi_lookup_t */
+ iarg[0] = p->dirfd; /* cloudabi_lookup_t */
uarg[1] = (intptr_t) p->path; /* const char * */
uarg[2] = p->pathlen; /* size_t */
iarg[3] = p->oflags; /* cloudabi_oflags_t */
@@ -217,7 +217,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
iarg[0] = p->fd; /* cloudabi_fd_t */
uarg[1] = (intptr_t) p->path; /* const char * */
uarg[2] = p->pathlen; /* size_t */
- uarg[3] = (intptr_t) p->buf; /* void * */
+ uarg[3] = (intptr_t) p->buf; /* char * */
uarg[4] = p->bufsize; /* size_t */
*n_args = 5;
break;
@@ -289,7 +289,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
iarg[0] = p->fd; /* cloudabi_fd_t */
uarg[1] = (intptr_t) p->path; /* const char * */
uarg[2] = p->pathlen; /* size_t */
- iarg[3] = p->flag; /* cloudabi_ulflags_t */
+ iarg[3] = p->flags; /* cloudabi_ulflags_t */
*n_args = 4;
break;
}
@@ -369,7 +369,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
struct cloudabi64_sys_poll_args *p = params;
uarg[0] = (intptr_t) p->in; /* const cloudabi64_subscription_t * */
uarg[1] = (intptr_t) p->out; /* cloudabi64_event_t * */
- iarg[2] = p->nevents; /* cloudabi64_size_t */
+ uarg[2] = p->nsubscriptions; /* size_t */
*n_args = 3;
break;
}
@@ -414,7 +414,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
/* cloudabi_sys_sock_accept */
case 45: {
struct cloudabi_sys_sock_accept_args *p = params;
- iarg[0] = p->s; /* cloudabi_fd_t */
+ iarg[0] = p->sock; /* cloudabi_fd_t */
uarg[1] = (intptr_t) p->buf; /* cloudabi_sockstat_t * */
*n_args = 2;
break;
@@ -422,7 +422,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
/* cloudabi_sys_sock_bind */
case 46: {
struct cloudabi_sys_sock_bind_args *p = params;
- iarg[0] = p->s; /* cloudabi_fd_t */
+ iarg[0] = p->sock; /* cloudabi_fd_t */
iarg[1] = p->fd; /* cloudabi_fd_t */
uarg[2] = (intptr_t) p->path; /* const char * */
uarg[3] = p->pathlen; /* size_t */
@@ -432,7 +432,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
/* cloudabi_sys_sock_connect */
case 47: {
struct cloudabi_sys_sock_connect_args *p = params;
- iarg[0] = p->s; /* cloudabi_fd_t */
+ iarg[0] = p->sock; /* cloudabi_fd_t */
iarg[1] = p->fd; /* cloudabi_fd_t */
uarg[2] = (intptr_t) p->path; /* const char * */
uarg[3] = p->pathlen; /* size_t */
@@ -442,7 +442,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
/* cloudabi_sys_sock_listen */
case 48: {
struct cloudabi_sys_sock_listen_args *p = params;
- iarg[0] = p->s; /* cloudabi_fd_t */
+ iarg[0] = p->sock; /* cloudabi_fd_t */
iarg[1] = p->backlog; /* cloudabi_backlog_t */
*n_args = 2;
break;
@@ -450,7 +450,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
/* cloudabi64_sys_sock_recv */
case 49: {
struct cloudabi64_sys_sock_recv_args *p = params;
- iarg[0] = p->s; /* cloudabi_fd_t */
+ iarg[0] = p->sock; /* cloudabi_fd_t */
uarg[1] = (intptr_t) p->in; /* const cloudabi64_recv_in_t * */
uarg[2] = (intptr_t) p->out; /* cloudabi64_recv_out_t * */
*n_args = 3;
@@ -459,7 +459,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
/* cloudabi64_sys_sock_send */
case 50: {
struct cloudabi64_sys_sock_send_args *p = params;
- iarg[0] = p->s; /* cloudabi_fd_t */
+ iarg[0] = p->sock; /* cloudabi_fd_t */
uarg[1] = (intptr_t) p->in; /* const cloudabi64_send_in_t * */
uarg[2] = (intptr_t) p->out; /* cloudabi64_send_out_t * */
*n_args = 3;
@@ -468,7 +468,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
/* cloudabi_sys_sock_shutdown */
case 51: {
struct cloudabi_sys_sock_shutdown_args *p = params;
- iarg[0] = p->fd; /* cloudabi_fd_t */
+ iarg[0] = p->sock; /* cloudabi_fd_t */
iarg[1] = p->how; /* cloudabi_sdflags_t */
*n_args = 2;
break;
@@ -476,7 +476,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
/* cloudabi_sys_sock_stat_get */
case 52: {
struct cloudabi_sys_sock_stat_get_args *p = params;
- iarg[0] = p->fd; /* cloudabi_fd_t */
+ iarg[0] = p->sock; /* cloudabi_fd_t */
uarg[1] = (intptr_t) p->buf; /* cloudabi_sockstat_t * */
iarg[2] = p->flags; /* cloudabi_ssflags_t */
*n_args = 3;
@@ -514,9 +514,9 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
struct cloudabi64_sys_poll_fd_args *p = params;
iarg[0] = p->fd; /* cloudabi_fd_t */
uarg[1] = (intptr_t) p->in; /* const cloudabi64_subscription_t * */
- iarg[2] = p->nin; /* cloudabi64_size_t */
+ uarg[2] = p->nin; /* size_t */
uarg[3] = (intptr_t) p->out; /* cloudabi64_event_t * */
- iarg[4] = p->nout; /* cloudabi64_size_t */
+ uarg[4] = p->nout; /* size_t */
uarg[5] = (intptr_t) p->timeout; /* const cloudabi64_subscription_t * */
*n_args = 6;
break;
@@ -630,7 +630,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "const cloudabi64_iovec_t *";
break;
case 2:
- p = "cloudabi64_size_t";
+ p = "size_t";
break;
case 3:
p = "cloudabi_filesize_t";
@@ -649,7 +649,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "const cloudabi64_ciovec_t *";
break;
case 2:
- p = "cloudabi64_size_t";
+ p = "size_t";
break;
case 3:
p = "cloudabi_filesize_t";
@@ -668,7 +668,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "const cloudabi64_iovec_t *";
break;
case 2:
- p = "cloudabi64_size_t";
+ p = "size_t";
break;
default:
break;
@@ -752,7 +752,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "const cloudabi64_ciovec_t *";
break;
case 2:
- p = "cloudabi64_size_t";
+ p = "size_t";
break;
default:
break;
@@ -891,7 +891,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "size_t";
break;
case 3:
- p = "void *";
+ p = "char *";
break;
case 4:
p = "size_t";
@@ -1171,7 +1171,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "cloudabi64_event_t *";
break;
case 2:
- p = "cloudabi64_size_t";
+ p = "size_t";
break;
default:
break;
@@ -1406,13 +1406,13 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "const cloudabi64_subscription_t *";
break;
case 2:
- p = "cloudabi64_size_t";
+ p = "size_t";
break;
case 3:
p = "cloudabi64_event_t *";
break;
case 4:
- p = "cloudabi64_size_t";
+ p = "size_t";
break;
case 5:
p = "const cloudabi64_subscription_t *";
@@ -1475,17 +1475,17 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
/* cloudabi64_sys_fd_pread */
case 8:
if (ndx == 0 || ndx == 1)
- p = "cloudabi64_size_t";
+ p = "size_t";
break;
/* cloudabi64_sys_fd_pwrite */
case 9:
if (ndx == 0 || ndx == 1)
- p = "cloudabi64_size_t";
+ p = "size_t";
break;
/* cloudabi64_sys_fd_read */
case 10:
if (ndx == 0 || ndx == 1)
- p = "cloudabi64_size_t";
+ p = "size_t";
break;
/* cloudabi_sys_fd_replace */
case 11:
@@ -1515,7 +1515,7 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
/* cloudabi64_sys_fd_write */
case 16:
if (ndx == 0 || ndx == 1)
- p = "cloudabi64_size_t";
+ p = "size_t";
break;
/* cloudabi_sys_file_advise */
case 17:
@@ -1630,7 +1630,7 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
/* cloudabi64_sys_poll */
case 39:
if (ndx == 0 || ndx == 1)
- p = "cloudabi64_size_t";
+ p = "size_t";
break;
/* cloudabi_sys_proc_exec */
case 40:
@@ -1677,12 +1677,12 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
/* cloudabi64_sys_sock_recv */
case 49:
if (ndx == 0 || ndx == 1)
- p = "cloudabi64_size_t";
+ p = "void";
break;
/* cloudabi64_sys_sock_send */
case 50:
if (ndx == 0 || ndx == 1)
- p = "cloudabi64_size_t";
+ p = "void";
break;
/* cloudabi_sys_sock_shutdown */
case 51:
@@ -1714,7 +1714,7 @@ systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
/* cloudabi64_sys_poll_fd */
case 57:
if (ndx == 0 || ndx == 1)
- p = "cloudabi64_size_t";
+ p = "size_t";
break;
default:
break;
diff --git a/sys/compat/cloudabi64/cloudabi64_thread.c b/sys/compat/cloudabi64/cloudabi64_thread.c
index 04b1782..51961f8 100644
--- a/sys/compat/cloudabi64/cloudabi64_thread.c
+++ b/sys/compat/cloudabi64/cloudabi64_thread.c
@@ -30,7 +30,8 @@ __FBSDID("$FreeBSD$");
#include <sys/proc.h>
#include <sys/systm.h>
-#include <compat/cloudabi64/cloudabi64_syscalldefs.h>
+#include <contrib/cloudabi/cloudabi64_types.h>
+
#include <compat/cloudabi64/cloudabi64_proto.h>
#include <compat/cloudabi64/cloudabi64_util.h>
diff --git a/sys/compat/cloudabi64/cloudabi64_util.h b/sys/compat/cloudabi64/cloudabi64_util.h
index 180a01e..dcec70e 100644
--- a/sys/compat/cloudabi64/cloudabi64_util.h
+++ b/sys/compat/cloudabi64/cloudabi64_util.h
@@ -31,7 +31,7 @@
#include <sys/types.h>
#include <sys/imgact_elf.h>
-#include <compat/cloudabi64/cloudabi64_syscalldefs.h>
+#include <contrib/cloudabi/cloudabi64_types.h>
struct image_params;
struct thread;
diff --git a/sys/contrib/cloudabi/cloudabi64_types.h b/sys/contrib/cloudabi/cloudabi64_types.h
new file mode 100644
index 0000000..22c0d3f
--- /dev/null
+++ b/sys/contrib/cloudabi/cloudabi64_types.h
@@ -0,0 +1,222 @@
+// Copyright (c) 2016 Nuxi, https://nuxi.nl/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must 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.
+
+// This file is automatically generated. Do not edit.
+// Source: https://github.com/NuxiNL/cloudabi
+
+#ifndef CLOUDABI64_TYPES_H
+#define CLOUDABI64_TYPES_H
+
+#include "cloudabi_types_common.h"
+
+typedef struct {
+ _Alignas(4) cloudabi_auxtype_t a_type;
+ union {
+ _Alignas(8) uint64_t a_val;
+ _Alignas(8) uint64_t a_ptr;
+ };
+} cloudabi64_auxv_t;
+_Static_assert(offsetof(cloudabi64_auxv_t, a_type) == 0, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_auxv_t, a_val) == 8, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_auxv_t, a_ptr) == 8, "Incorrect layout");
+_Static_assert(sizeof(cloudabi64_auxv_t) == 16, "Incorrect layout");
+_Static_assert(_Alignof(cloudabi64_auxv_t) == 8, "Incorrect layout");
+
+typedef struct {
+ _Alignas(8) uint64_t iov_base;
+ _Alignas(8) uint64_t iov_len;
+} cloudabi64_ciovec_t;
+_Static_assert(offsetof(cloudabi64_ciovec_t, iov_base) == 0, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_ciovec_t, iov_len) == 8, "Incorrect layout");
+_Static_assert(sizeof(cloudabi64_ciovec_t) == 16, "Incorrect layout");
+_Static_assert(_Alignof(cloudabi64_ciovec_t) == 8, "Incorrect layout");
+
+typedef struct {
+ _Alignas(8) cloudabi_userdata_t userdata;
+ _Alignas(2) cloudabi_errno_t error;
+ _Alignas(1) cloudabi_eventtype_t type;
+ union {
+ struct {
+ _Alignas(8) cloudabi_userdata_t identifier;
+ } clock;
+ struct {
+ _Alignas(8) uint64_t condvar;
+ } condvar;
+ struct {
+ _Alignas(8) cloudabi_filesize_t nbytes;
+ _Alignas(4) cloudabi_fd_t fd;
+ _Alignas(2) cloudabi_eventrwflags_t flags;
+ } fd_readwrite;
+ struct {
+ _Alignas(8) uint64_t lock;
+ } lock;
+ struct {
+ _Alignas(4) cloudabi_fd_t fd;
+ _Alignas(1) cloudabi_signal_t signal;
+ _Alignas(4) cloudabi_exitcode_t exitcode;
+ } proc_terminate;
+ };
+} cloudabi64_event_t;
+_Static_assert(offsetof(cloudabi64_event_t, userdata) == 0, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_event_t, error) == 8, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_event_t, type) == 10, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_event_t, clock.identifier) == 16, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_event_t, condvar.condvar) == 16, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_event_t, fd_readwrite.nbytes) == 16, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_event_t, fd_readwrite.fd) == 24, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_event_t, fd_readwrite.flags) == 28, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_event_t, lock.lock) == 16, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_event_t, proc_terminate.fd) == 16, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_event_t, proc_terminate.signal) == 20, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_event_t, proc_terminate.exitcode) == 24, "Incorrect layout");
+_Static_assert(sizeof(cloudabi64_event_t) == 32, "Incorrect layout");
+_Static_assert(_Alignof(cloudabi64_event_t) == 8, "Incorrect layout");
+
+typedef struct {
+ _Alignas(8) uint64_t iov_base;
+ _Alignas(8) uint64_t iov_len;
+} cloudabi64_iovec_t;
+_Static_assert(offsetof(cloudabi64_iovec_t, iov_base) == 0, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_iovec_t, iov_len) == 8, "Incorrect layout");
+_Static_assert(sizeof(cloudabi64_iovec_t) == 16, "Incorrect layout");
+_Static_assert(_Alignof(cloudabi64_iovec_t) == 8, "Incorrect layout");
+
+typedef struct {
+ _Alignas(8) uint64_t ri_data;
+ _Alignas(8) uint64_t ri_datalen;
+ _Alignas(8) uint64_t ri_fds;
+ _Alignas(8) uint64_t ri_fdslen;
+ _Alignas(2) cloudabi_msgflags_t ri_flags;
+} cloudabi64_recv_in_t;
+_Static_assert(offsetof(cloudabi64_recv_in_t, ri_data) == 0, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_recv_in_t, ri_datalen) == 8, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_recv_in_t, ri_fds) == 16, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_recv_in_t, ri_fdslen) == 24, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_recv_in_t, ri_flags) == 32, "Incorrect layout");
+_Static_assert(sizeof(cloudabi64_recv_in_t) == 40, "Incorrect layout");
+_Static_assert(_Alignof(cloudabi64_recv_in_t) == 8, "Incorrect layout");
+
+typedef struct {
+ _Alignas(8) uint64_t si_data;
+ _Alignas(8) uint64_t si_datalen;
+ _Alignas(8) uint64_t si_fds;
+ _Alignas(8) uint64_t si_fdslen;
+ _Alignas(2) cloudabi_msgflags_t si_flags;
+} cloudabi64_send_in_t;
+_Static_assert(offsetof(cloudabi64_send_in_t, si_data) == 0, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_send_in_t, si_datalen) == 8, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_send_in_t, si_fds) == 16, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_send_in_t, si_fdslen) == 24, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_send_in_t, si_flags) == 32, "Incorrect layout");
+_Static_assert(sizeof(cloudabi64_send_in_t) == 40, "Incorrect layout");
+_Static_assert(_Alignof(cloudabi64_send_in_t) == 8, "Incorrect layout");
+
+typedef struct {
+ _Alignas(8) uint64_t so_datalen;
+} cloudabi64_send_out_t;
+_Static_assert(offsetof(cloudabi64_send_out_t, so_datalen) == 0, "Incorrect layout");
+_Static_assert(sizeof(cloudabi64_send_out_t) == 8, "Incorrect layout");
+_Static_assert(_Alignof(cloudabi64_send_out_t) == 8, "Incorrect layout");
+
+typedef struct {
+ _Alignas(8) cloudabi_userdata_t userdata;
+ _Alignas(2) cloudabi_subflags_t flags;
+ _Alignas(1) cloudabi_eventtype_t type;
+ union {
+ struct {
+ _Alignas(8) cloudabi_userdata_t identifier;
+ _Alignas(4) cloudabi_clockid_t clock_id;
+ _Alignas(8) cloudabi_timestamp_t timeout;
+ _Alignas(8) cloudabi_timestamp_t precision;
+ _Alignas(2) cloudabi_subclockflags_t flags;
+ } clock;
+ struct {
+ _Alignas(8) uint64_t condvar;
+ _Alignas(8) uint64_t lock;
+ _Alignas(1) cloudabi_mflags_t condvar_scope;
+ _Alignas(1) cloudabi_mflags_t lock_scope;
+ } condvar;
+ struct {
+ _Alignas(4) cloudabi_fd_t fd;
+ _Alignas(2) cloudabi_subrwflags_t flags;
+ } fd_readwrite;
+ struct {
+ _Alignas(8) uint64_t lock;
+ _Alignas(1) cloudabi_mflags_t lock_scope;
+ } lock;
+ struct {
+ _Alignas(4) cloudabi_fd_t fd;
+ } proc_terminate;
+ };
+} cloudabi64_subscription_t;
+_Static_assert(offsetof(cloudabi64_subscription_t, userdata) == 0, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_subscription_t, flags) == 8, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_subscription_t, type) == 10, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_subscription_t, clock.identifier) == 16, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_subscription_t, clock.clock_id) == 24, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_subscription_t, clock.timeout) == 32, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_subscription_t, clock.precision) == 40, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_subscription_t, clock.flags) == 48, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_subscription_t, condvar.condvar) == 16, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_subscription_t, condvar.lock) == 24, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_subscription_t, condvar.condvar_scope) == 32, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_subscription_t, condvar.lock_scope) == 33, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_subscription_t, fd_readwrite.fd) == 16, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_subscription_t, fd_readwrite.flags) == 20, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_subscription_t, lock.lock) == 16, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_subscription_t, lock.lock_scope) == 24, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_subscription_t, proc_terminate.fd) == 16, "Incorrect layout");
+_Static_assert(sizeof(cloudabi64_subscription_t) == 56, "Incorrect layout");
+_Static_assert(_Alignof(cloudabi64_subscription_t) == 8, "Incorrect layout");
+
+typedef void cloudabi64_threadentry_t(cloudabi_tid_t tid, uint64_t aux);
+
+typedef struct {
+ _Alignas(8) uint64_t ro_datalen;
+ _Alignas(8) uint64_t ro_fdslen;
+ _Alignas(2) cloudabi_sockaddr_t ro_sockname;
+ _Alignas(2) cloudabi_sockaddr_t ro_peername;
+ _Alignas(2) cloudabi_msgflags_t ro_flags;
+} cloudabi64_recv_out_t;
+_Static_assert(offsetof(cloudabi64_recv_out_t, ro_datalen) == 0, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_recv_out_t, ro_fdslen) == 8, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_recv_out_t, ro_sockname) == 16, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_recv_out_t, ro_peername) == 36, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_recv_out_t, ro_flags) == 56, "Incorrect layout");
+_Static_assert(sizeof(cloudabi64_recv_out_t) == 64, "Incorrect layout");
+_Static_assert(_Alignof(cloudabi64_recv_out_t) == 8, "Incorrect layout");
+
+typedef struct {
+ _Alignas(8) uint64_t entry_point;
+ _Alignas(8) uint64_t stack;
+ _Alignas(8) uint64_t stack_size;
+ _Alignas(8) uint64_t argument;
+} cloudabi64_threadattr_t;
+_Static_assert(offsetof(cloudabi64_threadattr_t, entry_point) == 0, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_threadattr_t, stack) == 8, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_threadattr_t, stack_size) == 16, "Incorrect layout");
+_Static_assert(offsetof(cloudabi64_threadattr_t, argument) == 24, "Incorrect layout");
+_Static_assert(sizeof(cloudabi64_threadattr_t) == 32, "Incorrect layout");
+_Static_assert(_Alignof(cloudabi64_threadattr_t) == 8, "Incorrect layout");
+
+#endif
diff --git a/sys/contrib/cloudabi/cloudabi_types_common.h b/sys/contrib/cloudabi/cloudabi_types_common.h
new file mode 100644
index 0000000..b680057
--- /dev/null
+++ b/sys/contrib/cloudabi/cloudabi_types_common.h
@@ -0,0 +1,457 @@
+// Copyright (c) 2016 Nuxi, https://nuxi.nl/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must 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.
+
+// This file is automatically generated. Do not edit.
+// Source: https://github.com/NuxiNL/cloudabi
+
+#ifndef CLOUDABI_TYPES_COMMON_H
+#define CLOUDABI_TYPES_COMMON_H
+
+#if defined(__FreeBSD__) && defined(_KERNEL)
+#include <sys/stdint.h>
+#elif defined(__linux__) && defined(__KERNEL__)
+#include <linux/types.h>
+#else
+#include <stddef.h>
+#include <stdint.h>
+#endif
+
+typedef uint8_t cloudabi_advice_t;
+#define CLOUDABI_ADVICE_DONTNEED 1
+#define CLOUDABI_ADVICE_NOREUSE 2
+#define CLOUDABI_ADVICE_NORMAL 3
+#define CLOUDABI_ADVICE_RANDOM 4
+#define CLOUDABI_ADVICE_SEQUENTIAL 5
+#define CLOUDABI_ADVICE_WILLNEED 6
+
+typedef uint32_t cloudabi_auxtype_t;
+#define CLOUDABI_AT_ARGDATA 256
+#define CLOUDABI_AT_ARGDATALEN 257
+#define CLOUDABI_AT_CANARY 258
+#define CLOUDABI_AT_CANARYLEN 259
+#define CLOUDABI_AT_NCPUS 260
+#define CLOUDABI_AT_NULL 0
+#define CLOUDABI_AT_PAGESZ 6
+#define CLOUDABI_AT_PHDR 3
+#define CLOUDABI_AT_PHNUM 4
+#define CLOUDABI_AT_TID 261
+
+typedef uint32_t cloudabi_backlog_t;
+
+typedef uint32_t cloudabi_clockid_t;
+#define CLOUDABI_CLOCK_MONOTONIC 1
+#define CLOUDABI_CLOCK_PROCESS_CPUTIME_ID 2
+#define CLOUDABI_CLOCK_REALTIME 3
+#define CLOUDABI_CLOCK_THREAD_CPUTIME_ID 4
+
+typedef uint32_t cloudabi_condvar_t;
+#define CLOUDABI_CONDVAR_HAS_NO_WAITERS 0
+
+typedef uint64_t cloudabi_device_t;
+
+typedef uint64_t cloudabi_dircookie_t;
+#define CLOUDABI_DIRCOOKIE_START 0
+
+typedef uint16_t cloudabi_errno_t;
+#define CLOUDABI_E2BIG 1
+#define CLOUDABI_EACCES 2
+#define CLOUDABI_EADDRINUSE 3
+#define CLOUDABI_EADDRNOTAVAIL 4
+#define CLOUDABI_EAFNOSUPPORT 5
+#define CLOUDABI_EAGAIN 6
+#define CLOUDABI_EALREADY 7
+#define CLOUDABI_EBADF 8
+#define CLOUDABI_EBADMSG 9
+#define CLOUDABI_EBUSY 10
+#define CLOUDABI_ECANCELED 11
+#define CLOUDABI_ECHILD 12
+#define CLOUDABI_ECONNABORTED 13
+#define CLOUDABI_ECONNREFUSED 14
+#define CLOUDABI_ECONNRESET 15
+#define CLOUDABI_EDEADLK 16
+#define CLOUDABI_EDESTADDRREQ 17
+#define CLOUDABI_EDOM 18
+#define CLOUDABI_EDQUOT 19
+#define CLOUDABI_EEXIST 20
+#define CLOUDABI_EFAULT 21
+#define CLOUDABI_EFBIG 22
+#define CLOUDABI_EHOSTUNREACH 23
+#define CLOUDABI_EIDRM 24
+#define CLOUDABI_EILSEQ 25
+#define CLOUDABI_EINPROGRESS 26
+#define CLOUDABI_EINTR 27
+#define CLOUDABI_EINVAL 28
+#define CLOUDABI_EIO 29
+#define CLOUDABI_EISCONN 30
+#define CLOUDABI_EISDIR 31
+#define CLOUDABI_ELOOP 32
+#define CLOUDABI_EMFILE 33
+#define CLOUDABI_EMLINK 34
+#define CLOUDABI_EMSGSIZE 35
+#define CLOUDABI_EMULTIHOP 36
+#define CLOUDABI_ENAMETOOLONG 37
+#define CLOUDABI_ENETDOWN 38
+#define CLOUDABI_ENETRESET 39
+#define CLOUDABI_ENETUNREACH 40
+#define CLOUDABI_ENFILE 41
+#define CLOUDABI_ENOBUFS 42
+#define CLOUDABI_ENODEV 43
+#define CLOUDABI_ENOENT 44
+#define CLOUDABI_ENOEXEC 45
+#define CLOUDABI_ENOLCK 46
+#define CLOUDABI_ENOLINK 47
+#define CLOUDABI_ENOMEM 48
+#define CLOUDABI_ENOMSG 49
+#define CLOUDABI_ENOPROTOOPT 50
+#define CLOUDABI_ENOSPC 51
+#define CLOUDABI_ENOSYS 52
+#define CLOUDABI_ENOTCONN 53
+#define CLOUDABI_ENOTDIR 54
+#define CLOUDABI_ENOTEMPTY 55
+#define CLOUDABI_ENOTRECOVERABLE 56
+#define CLOUDABI_ENOTSOCK 57
+#define CLOUDABI_ENOTSUP 58
+#define CLOUDABI_ENOTTY 59
+#define CLOUDABI_ENXIO 60
+#define CLOUDABI_EOVERFLOW 61
+#define CLOUDABI_EOWNERDEAD 62
+#define CLOUDABI_EPERM 63
+#define CLOUDABI_EPIPE 64
+#define CLOUDABI_EPROTO 65
+#define CLOUDABI_EPROTONOSUPPORT 66
+#define CLOUDABI_EPROTOTYPE 67
+#define CLOUDABI_ERANGE 68
+#define CLOUDABI_EROFS 69
+#define CLOUDABI_ESPIPE 70
+#define CLOUDABI_ESRCH 71
+#define CLOUDABI_ESTALE 72
+#define CLOUDABI_ETIMEDOUT 73
+#define CLOUDABI_ETXTBSY 74
+#define CLOUDABI_EXDEV 75
+#define CLOUDABI_ENOTCAPABLE 76
+
+typedef uint16_t cloudabi_eventrwflags_t;
+#define CLOUDABI_EVENT_FD_READWRITE_HANGUP 0x0001
+
+typedef uint8_t cloudabi_eventtype_t;
+#define CLOUDABI_EVENTTYPE_CLOCK 1
+#define CLOUDABI_EVENTTYPE_CONDVAR 2
+#define CLOUDABI_EVENTTYPE_FD_READ 3
+#define CLOUDABI_EVENTTYPE_FD_WRITE 4
+#define CLOUDABI_EVENTTYPE_LOCK_RDLOCK 5
+#define CLOUDABI_EVENTTYPE_LOCK_WRLOCK 6
+#define CLOUDABI_EVENTTYPE_PROC_TERMINATE 7
+
+typedef uint32_t cloudabi_exitcode_t;
+
+typedef uint32_t cloudabi_fd_t;
+#define CLOUDABI_PROCESS_CHILD 0xffffffff
+#define CLOUDABI_MAP_ANON_FD 0xffffffff
+
+typedef uint16_t cloudabi_fdflags_t;
+#define CLOUDABI_FDFLAG_APPEND 0x0001
+#define CLOUDABI_FDFLAG_DSYNC 0x0002
+#define CLOUDABI_FDFLAG_NONBLOCK 0x0004
+#define CLOUDABI_FDFLAG_RSYNC 0x0008
+#define CLOUDABI_FDFLAG_SYNC 0x0010
+
+typedef uint16_t cloudabi_fdsflags_t;
+#define CLOUDABI_FDSTAT_FLAGS 0x0001
+#define CLOUDABI_FDSTAT_RIGHTS 0x0002
+
+typedef int64_t cloudabi_filedelta_t;
+
+typedef uint64_t cloudabi_filesize_t;
+
+typedef uint8_t cloudabi_filetype_t;
+#define CLOUDABI_FILETYPE_UNKNOWN 0
+#define CLOUDABI_FILETYPE_BLOCK_DEVICE 16
+#define CLOUDABI_FILETYPE_CHARACTER_DEVICE 17
+#define CLOUDABI_FILETYPE_DIRECTORY 32
+#define CLOUDABI_FILETYPE_FIFO 48
+#define CLOUDABI_FILETYPE_POLL 64
+#define CLOUDABI_FILETYPE_PROCESS 80
+#define CLOUDABI_FILETYPE_REGULAR_FILE 96
+#define CLOUDABI_FILETYPE_SHARED_MEMORY 112
+#define CLOUDABI_FILETYPE_SOCKET_DGRAM 128
+#define CLOUDABI_FILETYPE_SOCKET_SEQPACKET 129
+#define CLOUDABI_FILETYPE_SOCKET_STREAM 130
+#define CLOUDABI_FILETYPE_SYMBOLIC_LINK 144
+
+typedef uint16_t cloudabi_fsflags_t;
+#define CLOUDABI_FILESTAT_ATIM 0x0001
+#define CLOUDABI_FILESTAT_ATIM_NOW 0x0002
+#define CLOUDABI_FILESTAT_MTIM 0x0004
+#define CLOUDABI_FILESTAT_MTIM_NOW 0x0008
+#define CLOUDABI_FILESTAT_SIZE 0x0010
+
+typedef uint64_t cloudabi_inode_t;
+
+typedef uint32_t cloudabi_linkcount_t;
+
+typedef uint32_t cloudabi_lock_t;
+#define CLOUDABI_LOCK_UNLOCKED 0x00000000
+#define CLOUDABI_LOCK_WRLOCKED 0x40000000
+#define CLOUDABI_LOCK_KERNEL_MANAGED 0x80000000
+#define CLOUDABI_LOCK_BOGUS 0x80000000
+
+typedef uint32_t cloudabi_lookupflags_t;
+#define CLOUDABI_LOOKUP_SYMLINK_FOLLOW 0x00000001
+
+typedef uint8_t cloudabi_mflags_t;
+#define CLOUDABI_MAP_ANON 0x01
+#define CLOUDABI_MAP_FIXED 0x02
+#define CLOUDABI_MAP_PRIVATE 0x04
+#define CLOUDABI_MAP_SHARED 0x08
+
+typedef uint8_t cloudabi_mprot_t;
+#define CLOUDABI_PROT_EXEC 0x01
+#define CLOUDABI_PROT_WRITE 0x02
+#define CLOUDABI_PROT_READ 0x04
+
+typedef uint8_t cloudabi_msflags_t;
+#define CLOUDABI_MS_ASYNC 0x01
+#define CLOUDABI_MS_INVALIDATE 0x02
+#define CLOUDABI_MS_SYNC 0x04
+
+typedef uint16_t cloudabi_msgflags_t;
+#define CLOUDABI_MSG_CTRUNC 0x0001
+#define CLOUDABI_MSG_EOR 0x0002
+#define CLOUDABI_MSG_PEEK 0x0004
+#define CLOUDABI_MSG_TRUNC 0x0008
+#define CLOUDABI_MSG_WAITALL 0x0010
+
+typedef uint32_t cloudabi_nthreads_t;
+
+typedef uint16_t cloudabi_oflags_t;
+#define CLOUDABI_O_CREAT 0x0001
+#define CLOUDABI_O_DIRECTORY 0x0002
+#define CLOUDABI_O_EXCL 0x0004
+#define CLOUDABI_O_TRUNC 0x0008
+
+typedef uint64_t cloudabi_rights_t;
+#define CLOUDABI_RIGHT_FD_DATASYNC 0x0000000000000001
+#define CLOUDABI_RIGHT_FD_READ 0x0000000000000002
+#define CLOUDABI_RIGHT_FD_SEEK 0x0000000000000004
+#define CLOUDABI_RIGHT_FD_STAT_PUT_FLAGS 0x0000000000000008
+#define CLOUDABI_RIGHT_FD_SYNC 0x0000000000000010
+#define CLOUDABI_RIGHT_FD_TELL 0x0000000000000020
+#define CLOUDABI_RIGHT_FD_WRITE 0x0000000000000040
+#define CLOUDABI_RIGHT_FILE_ADVISE 0x0000000000000080
+#define CLOUDABI_RIGHT_FILE_ALLOCATE 0x0000000000000100
+#define CLOUDABI_RIGHT_FILE_CREATE_DIRECTORY 0x0000000000000200
+#define CLOUDABI_RIGHT_FILE_CREATE_FILE 0x0000000000000400
+#define CLOUDABI_RIGHT_FILE_CREATE_FIFO 0x0000000000000800
+#define CLOUDABI_RIGHT_FILE_LINK_SOURCE 0x0000000000001000
+#define CLOUDABI_RIGHT_FILE_LINK_TARGET 0x0000000000002000
+#define CLOUDABI_RIGHT_FILE_OPEN 0x0000000000004000
+#define CLOUDABI_RIGHT_FILE_READDIR 0x0000000000008000
+#define CLOUDABI_RIGHT_FILE_READLINK 0x0000000000010000
+#define CLOUDABI_RIGHT_FILE_RENAME_SOURCE 0x0000000000020000
+#define CLOUDABI_RIGHT_FILE_RENAME_TARGET 0x0000000000040000
+#define CLOUDABI_RIGHT_FILE_STAT_FGET 0x0000000000080000
+#define CLOUDABI_RIGHT_FILE_STAT_FPUT_SIZE 0x0000000000100000
+#define CLOUDABI_RIGHT_FILE_STAT_FPUT_TIMES 0x0000000000200000
+#define CLOUDABI_RIGHT_FILE_STAT_GET 0x0000000000400000
+#define CLOUDABI_RIGHT_FILE_STAT_PUT_TIMES 0x0000000000800000
+#define CLOUDABI_RIGHT_FILE_SYMLINK 0x0000000001000000
+#define CLOUDABI_RIGHT_FILE_UNLINK 0x0000000002000000
+#define CLOUDABI_RIGHT_MEM_MAP 0x0000000004000000
+#define CLOUDABI_RIGHT_MEM_MAP_EXEC 0x0000000008000000
+#define CLOUDABI_RIGHT_POLL_FD_READWRITE 0x0000000010000000
+#define CLOUDABI_RIGHT_POLL_MODIFY 0x0000000020000000
+#define CLOUDABI_RIGHT_POLL_PROC_TERMINATE 0x0000000040000000
+#define CLOUDABI_RIGHT_POLL_WAIT 0x0000000080000000
+#define CLOUDABI_RIGHT_PROC_EXEC 0x0000000100000000
+#define CLOUDABI_RIGHT_SOCK_ACCEPT 0x0000000200000000
+#define CLOUDABI_RIGHT_SOCK_BIND_DIRECTORY 0x0000000400000000
+#define CLOUDABI_RIGHT_SOCK_BIND_SOCKET 0x0000000800000000
+#define CLOUDABI_RIGHT_SOCK_CONNECT_DIRECTORY 0x0000001000000000
+#define CLOUDABI_RIGHT_SOCK_CONNECT_SOCKET 0x0000002000000000
+#define CLOUDABI_RIGHT_SOCK_LISTEN 0x0000004000000000
+#define CLOUDABI_RIGHT_SOCK_SHUTDOWN 0x0000008000000000
+#define CLOUDABI_RIGHT_SOCK_STAT_GET 0x0000010000000000
+
+typedef uint8_t cloudabi_sa_family_t;
+#define CLOUDABI_AF_UNSPEC 0
+#define CLOUDABI_AF_INET 1
+#define CLOUDABI_AF_INET6 2
+#define CLOUDABI_AF_UNIX 3
+
+typedef uint8_t cloudabi_sdflags_t;
+#define CLOUDABI_SHUT_RD 0x01
+#define CLOUDABI_SHUT_WR 0x02
+
+typedef uint8_t cloudabi_signal_t;
+#define CLOUDABI_SIGABRT 1
+#define CLOUDABI_SIGALRM 2
+#define CLOUDABI_SIGBUS 3
+#define CLOUDABI_SIGCHLD 4
+#define CLOUDABI_SIGCONT 5
+#define CLOUDABI_SIGFPE 6
+#define CLOUDABI_SIGHUP 7
+#define CLOUDABI_SIGILL 8
+#define CLOUDABI_SIGINT 9
+#define CLOUDABI_SIGKILL 10
+#define CLOUDABI_SIGPIPE 11
+#define CLOUDABI_SIGQUIT 12
+#define CLOUDABI_SIGSEGV 13
+#define CLOUDABI_SIGSTOP 14
+#define CLOUDABI_SIGSYS 15
+#define CLOUDABI_SIGTERM 16
+#define CLOUDABI_SIGTRAP 17
+#define CLOUDABI_SIGTSTP 18
+#define CLOUDABI_SIGTTIN 19
+#define CLOUDABI_SIGTTOU 20
+#define CLOUDABI_SIGURG 21
+#define CLOUDABI_SIGUSR1 22
+#define CLOUDABI_SIGUSR2 23
+#define CLOUDABI_SIGVTALRM 24
+#define CLOUDABI_SIGXCPU 25
+#define CLOUDABI_SIGXFSZ 26
+
+typedef uint8_t cloudabi_ssflags_t;
+#define CLOUDABI_SOCKSTAT_CLEAR_ERROR 0x01
+
+typedef uint32_t cloudabi_sstate_t;
+#define CLOUDABI_SOCKSTATE_ACCEPTCONN 0x00000001
+
+typedef uint16_t cloudabi_subclockflags_t;
+#define CLOUDABI_SUBSCRIPTION_CLOCK_ABSTIME 0x0001
+
+typedef uint16_t cloudabi_subflags_t;
+#define CLOUDABI_SUBSCRIPTION_ADD 0x0001
+#define CLOUDABI_SUBSCRIPTION_CLEAR 0x0002
+#define CLOUDABI_SUBSCRIPTION_DELETE 0x0004
+#define CLOUDABI_SUBSCRIPTION_DISABLE 0x0008
+#define CLOUDABI_SUBSCRIPTION_ENABLE 0x0010
+#define CLOUDABI_SUBSCRIPTION_ONESHOT 0x0020
+
+typedef uint16_t cloudabi_subrwflags_t;
+#define CLOUDABI_SUBSCRIPTION_FD_READWRITE_POLL 0x0001
+
+typedef uint32_t cloudabi_tid_t;
+
+typedef uint64_t cloudabi_timestamp_t;
+
+typedef uint8_t cloudabi_ulflags_t;
+#define CLOUDABI_UNLINK_REMOVEDIR 0x01
+
+typedef uint64_t cloudabi_userdata_t;
+
+typedef uint8_t cloudabi_whence_t;
+#define CLOUDABI_WHENCE_CUR 1
+#define CLOUDABI_WHENCE_END 2
+#define CLOUDABI_WHENCE_SET 3
+
+typedef struct {
+ _Alignas(8) cloudabi_dircookie_t d_next;
+ _Alignas(8) cloudabi_inode_t d_ino;
+ _Alignas(4) uint32_t d_namlen;
+ _Alignas(1) cloudabi_filetype_t d_type;
+} cloudabi_dirent_t;
+_Static_assert(offsetof(cloudabi_dirent_t, d_next) == 0, "Incorrect layout");
+_Static_assert(offsetof(cloudabi_dirent_t, d_ino) == 8, "Incorrect layout");
+_Static_assert(offsetof(cloudabi_dirent_t, d_namlen) == 16, "Incorrect layout");
+_Static_assert(offsetof(cloudabi_dirent_t, d_type) == 20, "Incorrect layout");
+_Static_assert(sizeof(cloudabi_dirent_t) == 24, "Incorrect layout");
+_Static_assert(_Alignof(cloudabi_dirent_t) == 8, "Incorrect layout");
+
+typedef struct {
+ _Alignas(1) cloudabi_filetype_t fs_filetype;
+ _Alignas(2) cloudabi_fdflags_t fs_flags;
+ _Alignas(8) cloudabi_rights_t fs_rights_base;
+ _Alignas(8) cloudabi_rights_t fs_rights_inheriting;
+} cloudabi_fdstat_t;
+_Static_assert(offsetof(cloudabi_fdstat_t, fs_filetype) == 0, "Incorrect layout");
+_Static_assert(offsetof(cloudabi_fdstat_t, fs_flags) == 2, "Incorrect layout");
+_Static_assert(offsetof(cloudabi_fdstat_t, fs_rights_base) == 8, "Incorrect layout");
+_Static_assert(offsetof(cloudabi_fdstat_t, fs_rights_inheriting) == 16, "Incorrect layout");
+_Static_assert(sizeof(cloudabi_fdstat_t) == 24, "Incorrect layout");
+_Static_assert(_Alignof(cloudabi_fdstat_t) == 8, "Incorrect layout");
+
+typedef struct {
+ _Alignas(8) cloudabi_device_t st_dev;
+ _Alignas(8) cloudabi_inode_t st_ino;
+ _Alignas(1) cloudabi_filetype_t st_filetype;
+ _Alignas(4) cloudabi_linkcount_t st_nlink;
+ _Alignas(8) cloudabi_filesize_t st_size;
+ _Alignas(8) cloudabi_timestamp_t st_atim;
+ _Alignas(8) cloudabi_timestamp_t st_mtim;
+ _Alignas(8) cloudabi_timestamp_t st_ctim;
+} cloudabi_filestat_t;
+_Static_assert(offsetof(cloudabi_filestat_t, st_dev) == 0, "Incorrect layout");
+_Static_assert(offsetof(cloudabi_filestat_t, st_ino) == 8, "Incorrect layout");
+_Static_assert(offsetof(cloudabi_filestat_t, st_filetype) == 16, "Incorrect layout");
+_Static_assert(offsetof(cloudabi_filestat_t, st_nlink) == 20, "Incorrect layout");
+_Static_assert(offsetof(cloudabi_filestat_t, st_size) == 24, "Incorrect layout");
+_Static_assert(offsetof(cloudabi_filestat_t, st_atim) == 32, "Incorrect layout");
+_Static_assert(offsetof(cloudabi_filestat_t, st_mtim) == 40, "Incorrect layout");
+_Static_assert(offsetof(cloudabi_filestat_t, st_ctim) == 48, "Incorrect layout");
+_Static_assert(sizeof(cloudabi_filestat_t) == 56, "Incorrect layout");
+_Static_assert(_Alignof(cloudabi_filestat_t) == 8, "Incorrect layout");
+
+typedef struct {
+ _Alignas(4) cloudabi_fd_t fd;
+ _Alignas(4) cloudabi_lookupflags_t flags;
+} cloudabi_lookup_t;
+_Static_assert(offsetof(cloudabi_lookup_t, fd) == 0, "Incorrect layout");
+_Static_assert(offsetof(cloudabi_lookup_t, flags) == 4, "Incorrect layout");
+_Static_assert(sizeof(cloudabi_lookup_t) == 8, "Incorrect layout");
+_Static_assert(_Alignof(cloudabi_lookup_t) == 4, "Incorrect layout");
+
+typedef struct {
+ _Alignas(1) cloudabi_sa_family_t sa_family;
+ union {
+ struct {
+ _Alignas(1) uint8_t addr[4];
+ _Alignas(2) uint16_t port;
+ } sa_inet;
+ struct {
+ _Alignas(1) uint8_t addr[16];
+ _Alignas(2) uint16_t port;
+ } sa_inet6;
+ };
+} cloudabi_sockaddr_t;
+_Static_assert(offsetof(cloudabi_sockaddr_t, sa_family) == 0, "Incorrect layout");
+_Static_assert(offsetof(cloudabi_sockaddr_t, sa_inet.addr) == 2, "Incorrect layout");
+_Static_assert(offsetof(cloudabi_sockaddr_t, sa_inet.port) == 6, "Incorrect layout");
+_Static_assert(offsetof(cloudabi_sockaddr_t, sa_inet6.addr) == 2, "Incorrect layout");
+_Static_assert(offsetof(cloudabi_sockaddr_t, sa_inet6.port) == 18, "Incorrect layout");
+_Static_assert(sizeof(cloudabi_sockaddr_t) == 20, "Incorrect layout");
+_Static_assert(_Alignof(cloudabi_sockaddr_t) == 2, "Incorrect layout");
+
+typedef struct {
+ _Alignas(2) cloudabi_sockaddr_t ss_sockname;
+ _Alignas(2) cloudabi_sockaddr_t ss_peername;
+ _Alignas(2) cloudabi_errno_t ss_error;
+ _Alignas(4) cloudabi_sstate_t ss_state;
+} cloudabi_sockstat_t;
+_Static_assert(offsetof(cloudabi_sockstat_t, ss_sockname) == 0, "Incorrect layout");
+_Static_assert(offsetof(cloudabi_sockstat_t, ss_peername) == 20, "Incorrect layout");
+_Static_assert(offsetof(cloudabi_sockstat_t, ss_error) == 40, "Incorrect layout");
+_Static_assert(offsetof(cloudabi_sockstat_t, ss_state) == 44, "Incorrect layout");
+_Static_assert(sizeof(cloudabi_sockstat_t) == 48, "Incorrect layout");
+_Static_assert(_Alignof(cloudabi_sockstat_t) == 4, "Incorrect layout");
+
+#endif
diff --git a/sys/contrib/cloudabi/syscalldefs_md.h b/sys/contrib/cloudabi/syscalldefs_md.h
deleted file mode 100644
index f2e3705..0000000
--- a/sys/contrib/cloudabi/syscalldefs_md.h
+++ /dev/null
@@ -1,255 +0,0 @@
-// Copyright (c) 2015 Nuxi, https://nuxi.nl/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must 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.
-
-// Machine dependent definitions.
-
-// Macro to force sane alignment rules.
-//
-// On x86-32 it is the case that 64-bit integers are 4-byte aligned when
-// embedded in structs, even though they are 8-byte aligned when not
-// embedded. Force 8-byte alignment explicitly.
-#define MEMBER(type) alignas(alignof(type)) type
-#define ASSERT_OFFSET(type, field, offset32, offset64) \
- static_assert((sizeof(PTR(void)) == 4 && \
- offsetof(IDENT(type), field) == (offset32)) || \
- (sizeof(PTR(void)) == 8 && \
- offsetof(IDENT(type), field) == (offset64)), \
- "Offset incorrect")
-#define ASSERT_SIZE(type, size32, size64) \
- static_assert( \
- (sizeof(PTR(void)) == 4 && sizeof(IDENT(type)) == (size32)) || \
- (sizeof(PTR(void)) == 8 && sizeof(IDENT(type)) == (size64)), \
- "Size incorrect")
-
-typedef void IDENT(threadentry_t)(cloudabi_tid_t, PTR(void));
-
-// Auxiliary vector entry, used to provide paramters on startup.
-typedef struct {
- uint32_t a_type;
- union {
- MEMBER(IDENT(size_t)) a_val;
- MEMBER(PTR(void)) a_ptr;
- };
-} IDENT(auxv_t);
-ASSERT_OFFSET(auxv_t, a_type, 0, 0);
-ASSERT_OFFSET(auxv_t, a_val, 4, 8);
-ASSERT_OFFSET(auxv_t, a_ptr, 4, 8);
-ASSERT_SIZE(auxv_t, 8, 16);
-
-typedef struct {
- MEMBER(PTR(const void)) iov_base;
- MEMBER(IDENT(size_t)) iov_len;
-} IDENT(ciovec_t);
-ASSERT_OFFSET(ciovec_t, iov_base, 0, 0);
-ASSERT_OFFSET(ciovec_t, iov_len, 4, 8);
-ASSERT_SIZE(ciovec_t, 8, 16);
-
-typedef struct {
- MEMBER(cloudabi_userdata_t) userdata;
- MEMBER(cloudabi_errno_t) error;
- MEMBER(cloudabi_eventtype_t) type;
- union {
- // CLOUDABI_EVENTTYPE_CLOCK: Wait until the value of a clock
- // exceeds a value.
- struct {
- MEMBER(cloudabi_userdata_t) identifier;
- } clock;
-
- // CLOUDABI_EVENTTYPE_CONDVAR: Release a lock and wait on a
- // condition variable.
- struct {
- MEMBER(PTR(_Atomic(cloudabi_condvar_t))) condvar;
- } condvar;
-
- // CLOUDABI_EVENTTYPE_FD_READ and CLOUDABI_EVENTTYPE_FD_WRITE:
- // Wait for a file descriptor to allow read() and write() to be
- // called without blocking.
- struct {
- MEMBER(cloudabi_filesize_t) nbytes;
- MEMBER(cloudabi_fd_t) fd;
- MEMBER(uint16_t) flags;
- } fd_readwrite;
-
- // CLOUDABI_EVENT_LOCK_RDLOCK and CLOUDABI_EVENT_LOCK_WRLOCK: Wait
- // and acquire a read or write lock.
- struct {
- MEMBER(PTR(_Atomic(cloudabi_lock_t))) lock;
- } lock;
-
- // CLOUDABI_EVENTTYPE_PROC_TERMINATE: Wait for a process to terminate.
- struct {
- MEMBER(cloudabi_fd_t) fd;
- MEMBER(cloudabi_signal_t) signal; // Non-zero if process got killed.
- MEMBER(cloudabi_exitcode_t) exitcode; // Exit code.
- } proc_terminate;
- };
-} IDENT(event_t);
-ASSERT_OFFSET(event_t, userdata, 0, 0);
-ASSERT_OFFSET(event_t, error, 8, 8);
-ASSERT_OFFSET(event_t, type, 10, 10);
-ASSERT_OFFSET(event_t, clock.identifier, 16, 16);
-ASSERT_OFFSET(event_t, condvar.condvar, 16, 16);
-ASSERT_OFFSET(event_t, fd_readwrite.nbytes, 16, 16);
-ASSERT_OFFSET(event_t, fd_readwrite.fd, 24, 24);
-ASSERT_OFFSET(event_t, fd_readwrite.flags, 28, 28);
-ASSERT_OFFSET(event_t, lock.lock, 16, 16);
-ASSERT_OFFSET(event_t, proc_terminate.fd, 16, 16);
-ASSERT_OFFSET(event_t, proc_terminate.signal, 20, 20);
-ASSERT_OFFSET(event_t, proc_terminate.exitcode, 24, 24);
-ASSERT_SIZE(event_t, 32, 32);
-
-typedef struct {
- MEMBER(PTR(void)) iov_base;
- MEMBER(IDENT(size_t)) iov_len;
-} IDENT(iovec_t);
-ASSERT_OFFSET(iovec_t, iov_base, 0, 0);
-ASSERT_OFFSET(iovec_t, iov_len, 4, 8);
-ASSERT_SIZE(iovec_t, 8, 16);
-
-typedef struct {
- MEMBER(PTR(const IDENT(iovec_t))) ri_data; // Data I/O vectors.
- MEMBER(IDENT(size_t)) ri_datalen; // Number of data I/O vectors.
- MEMBER(PTR(cloudabi_fd_t)) ri_fds; // File descriptors.
- MEMBER(IDENT(size_t)) ri_fdslen; // Number of file descriptors.
- MEMBER(cloudabi_msgflags_t) ri_flags; // Input flags.
-} IDENT(recv_in_t);
-ASSERT_OFFSET(recv_in_t, ri_data, 0, 0);
-ASSERT_OFFSET(recv_in_t, ri_datalen, 4, 8);
-ASSERT_OFFSET(recv_in_t, ri_fds, 8, 16);
-ASSERT_OFFSET(recv_in_t, ri_fdslen, 12, 24);
-ASSERT_OFFSET(recv_in_t, ri_flags, 16, 32);
-ASSERT_SIZE(recv_in_t, 20, 40);
-
-typedef struct {
- MEMBER(IDENT(size_t)) ro_datalen; // Bytes of data received.
- MEMBER(IDENT(size_t)) ro_fdslen; // Number of file descriptors received.
- MEMBER(cloudabi_sockaddr_t) ro_sockname; // Address of receiver.
- MEMBER(cloudabi_sockaddr_t) ro_peername; // Address of sender.
- MEMBER(cloudabi_msgflags_t) ro_flags; // Output flags.
-} IDENT(recv_out_t);
-ASSERT_OFFSET(recv_out_t, ro_datalen, 0, 0);
-ASSERT_OFFSET(recv_out_t, ro_fdslen, 4, 8);
-ASSERT_OFFSET(recv_out_t, ro_sockname, 8, 16);
-ASSERT_OFFSET(recv_out_t, ro_peername, 28, 36);
-ASSERT_OFFSET(recv_out_t, ro_flags, 48, 56);
-ASSERT_SIZE(recv_out_t, 52, 64);
-
-typedef struct {
- MEMBER(PTR(const IDENT(ciovec_t))) si_data; // Data I/O vectors.
- MEMBER(IDENT(size_t)) si_datalen; // Number of data I/O vectors.
- MEMBER(PTR(const cloudabi_fd_t)) si_fds; // File descriptors.
- MEMBER(IDENT(size_t)) si_fdslen; // Number of file descriptors.
- MEMBER(cloudabi_msgflags_t) si_flags; // Input flags.
-} IDENT(send_in_t);
-ASSERT_OFFSET(send_in_t, si_data, 0, 0);
-ASSERT_OFFSET(send_in_t, si_datalen, 4, 8);
-ASSERT_OFFSET(send_in_t, si_fds, 8, 16);
-ASSERT_OFFSET(send_in_t, si_fdslen, 12, 24);
-ASSERT_OFFSET(send_in_t, si_flags, 16, 32);
-ASSERT_SIZE(send_in_t, 20, 40);
-
-typedef struct {
- MEMBER(IDENT(size_t)) so_datalen; // Bytes of data sent.
-} IDENT(send_out_t);
-ASSERT_OFFSET(send_out_t, so_datalen, 0, 0);
-ASSERT_SIZE(send_out_t, 4, 8);
-
-typedef struct {
- MEMBER(cloudabi_userdata_t) userdata;
- MEMBER(uint16_t) flags;
- MEMBER(cloudabi_eventtype_t) type;
- union {
- // CLOUDABI_EVENTTYPE_CLOCK: Wait until the value of a clock
- // exceeds a value.
- struct {
- MEMBER(cloudabi_userdata_t) identifier;
- MEMBER(cloudabi_clockid_t) clock_id;
- MEMBER(cloudabi_timestamp_t) timeout;
- MEMBER(cloudabi_timestamp_t) precision;
- MEMBER(uint16_t) flags;
- } clock;
-
- // CLOUDABI_EVENTTYPE_CONDVAR: Release a lock and wait on a
- // condition variable.
- struct {
- MEMBER(PTR(_Atomic(cloudabi_condvar_t))) condvar;
- MEMBER(PTR(_Atomic(cloudabi_lock_t))) lock;
- MEMBER(cloudabi_mflags_t) condvar_scope;
- MEMBER(cloudabi_mflags_t) lock_scope;
- } condvar;
-
- // CLOUDABI_EVENTTYPE_FD_READ and CLOUDABI_EVENTTYPE_FD_WRITE:
- // Wait for a file descriptor to allow read() and write() to be
- // called without blocking.
- struct {
- MEMBER(cloudabi_fd_t) fd;
- MEMBER(uint16_t) flags;
- } fd_readwrite;
-
- // CLOUDABI_EVENT_LOCK_RDLOCK and CLOUDABI_EVENT_LOCK_WRLOCK: Wait
- // and acquire a read or write lock.
- struct {
- MEMBER(PTR(_Atomic(cloudabi_lock_t))) lock;
- MEMBER(cloudabi_mflags_t) lock_scope;
- } lock;
-
- // CLOUDABI_EVENTTYPE_PROC_TERMINATE: Wait for a process to terminate.
- struct {
- MEMBER(cloudabi_fd_t) fd;
- } proc_terminate;
- };
-} IDENT(subscription_t);
-ASSERT_OFFSET(subscription_t, userdata, 0, 0);
-ASSERT_OFFSET(subscription_t, flags, 8, 8);
-ASSERT_OFFSET(subscription_t, type, 10, 10);
-ASSERT_OFFSET(subscription_t, clock.identifier, 16, 16);
-ASSERT_OFFSET(subscription_t, clock.clock_id, 24, 24);
-ASSERT_OFFSET(subscription_t, clock.timeout, 32, 32);
-ASSERT_OFFSET(subscription_t, clock.precision, 40, 40);
-ASSERT_OFFSET(subscription_t, clock.flags, 48, 48);
-ASSERT_OFFSET(subscription_t, condvar.condvar, 16, 16);
-ASSERT_OFFSET(subscription_t, condvar.lock, 20, 24);
-ASSERT_OFFSET(subscription_t, condvar.condvar_scope, 24, 32);
-ASSERT_OFFSET(subscription_t, condvar.lock_scope, 25, 33);
-ASSERT_OFFSET(subscription_t, fd_readwrite.fd, 16, 16);
-ASSERT_OFFSET(subscription_t, fd_readwrite.flags, 20, 20);
-ASSERT_OFFSET(subscription_t, lock.lock, 16, 16);
-ASSERT_OFFSET(subscription_t, lock.lock_scope, 20, 24);
-ASSERT_OFFSET(subscription_t, proc_terminate.fd, 16, 16);
-ASSERT_SIZE(subscription_t, 56, 56);
-
-typedef struct {
- MEMBER(PTR(IDENT(threadentry_t))) entry_point; // Entry point.
- MEMBER(PTR(void)) stack; // Pointer to stack buffer.
- MEMBER(IDENT(size_t)) stack_size; // Size of stack buffer.
- MEMBER(PTR(void)) argument; // Argument to be passed to entry point.
-} IDENT(threadattr_t);
-ASSERT_OFFSET(threadattr_t, entry_point, 0, 0);
-ASSERT_OFFSET(threadattr_t, stack, 4, 8);
-ASSERT_OFFSET(threadattr_t, stack_size, 8, 16);
-ASSERT_OFFSET(threadattr_t, argument, 12, 24);
-ASSERT_SIZE(threadattr_t, 16, 32);
-
-#undef MEMBER
-#undef ASSERT_OFFSET
-#undef ASSERT_SIZE
diff --git a/sys/contrib/cloudabi/syscalldefs_mi.h b/sys/contrib/cloudabi/syscalldefs_mi.h
deleted file mode 100644
index adce208..0000000
--- a/sys/contrib/cloudabi/syscalldefs_mi.h
+++ /dev/null
@@ -1,476 +0,0 @@
-// Copyright (c) 2015 Nuxi, https://nuxi.nl/
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-// 1. Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// 2. Redistributions in binary form must 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.
-
-#ifndef COMMON_SYSCALLDEFS_MI_H
-#define COMMON_SYSCALLDEFS_MI_H
-
-// Machine independent definitions.
-
-// Socket address families.
-#define CLOUDABI_AF_UNSPEC 0
-#define CLOUDABI_AF_INET 1
-#define CLOUDABI_AF_INET6 2
-#define CLOUDABI_AF_UNIX 3
-
-// File and memory I/O advice.
-#define CLOUDABI_ADVICE_DONTNEED 1
-#define CLOUDABI_ADVICE_NOREUSE 2
-#define CLOUDABI_ADVICE_NORMAL 3
-#define CLOUDABI_ADVICE_RANDOM 4
-#define CLOUDABI_ADVICE_SEQUENTIAL 5
-#define CLOUDABI_ADVICE_WILLNEED 6
-
-// Auxiliary vector entries. All entries that are also part of the
-// x86-64 ABI use the same number. All extensions start at 256.
-#define CLOUDABI_AT_ARGDATA 256
-#define CLOUDABI_AT_ARGDATALEN 257
-#define CLOUDABI_AT_CANARY 258
-#define CLOUDABI_AT_CANARYLEN 259
-#define CLOUDABI_AT_NCPUS 260
-#define CLOUDABI_AT_NULL 0
-#define CLOUDABI_AT_PAGESZ 6
-#define CLOUDABI_AT_PHDR 3
-#define CLOUDABI_AT_PHNUM 4
-#define CLOUDABI_AT_TID 261
-
-// Clocks.
-#define CLOUDABI_CLOCK_MONOTONIC 1
-#define CLOUDABI_CLOCK_PROCESS_CPUTIME_ID 2
-#define CLOUDABI_CLOCK_REALTIME 3
-#define CLOUDABI_CLOCK_THREAD_CPUTIME_ID 4
-
-// Condition variables.
-#define CLOUDABI_CONDVAR_HAS_NO_WAITERS 0
-
-// The start of a directory, to be passed to readdir().
-#define CLOUDABI_DIRCOOKIE_START 0
-
-// POSIX standard error numbers.
-#define CLOUDABI_E2BIG 1
-#define CLOUDABI_EACCES 2
-#define CLOUDABI_EADDRINUSE 3
-#define CLOUDABI_EADDRNOTAVAIL 4
-#define CLOUDABI_EAFNOSUPPORT 5
-#define CLOUDABI_EAGAIN 6
-#define CLOUDABI_EALREADY 7
-#define CLOUDABI_EBADF 8
-#define CLOUDABI_EBADMSG 9
-#define CLOUDABI_EBUSY 10
-#define CLOUDABI_ECANCELED 11
-#define CLOUDABI_ECHILD 12
-#define CLOUDABI_ECONNABORTED 13
-#define CLOUDABI_ECONNREFUSED 14
-#define CLOUDABI_ECONNRESET 15
-#define CLOUDABI_EDEADLK 16
-#define CLOUDABI_EDESTADDRREQ 17
-#define CLOUDABI_EDOM 18
-#define CLOUDABI_EDQUOT 19
-#define CLOUDABI_EEXIST 20
-#define CLOUDABI_EFAULT 21
-#define CLOUDABI_EFBIG 22
-#define CLOUDABI_EHOSTUNREACH 23
-#define CLOUDABI_EIDRM 24
-#define CLOUDABI_EILSEQ 25
-#define CLOUDABI_EINPROGRESS 26
-#define CLOUDABI_EINTR 27
-#define CLOUDABI_EINVAL 28
-#define CLOUDABI_EIO 29
-#define CLOUDABI_EISCONN 30
-#define CLOUDABI_EISDIR 31
-#define CLOUDABI_ELOOP 32
-#define CLOUDABI_EMFILE 33
-#define CLOUDABI_EMLINK 34
-#define CLOUDABI_EMSGSIZE 35
-#define CLOUDABI_EMULTIHOP 36
-#define CLOUDABI_ENAMETOOLONG 37
-#define CLOUDABI_ENETDOWN 38
-#define CLOUDABI_ENETRESET 39
-#define CLOUDABI_ENETUNREACH 40
-#define CLOUDABI_ENFILE 41
-#define CLOUDABI_ENOBUFS 42
-#define CLOUDABI_ENODEV 43
-#define CLOUDABI_ENOENT 44
-#define CLOUDABI_ENOEXEC 45
-#define CLOUDABI_ENOLCK 46
-#define CLOUDABI_ENOLINK 47
-#define CLOUDABI_ENOMEM 48
-#define CLOUDABI_ENOMSG 49
-#define CLOUDABI_ENOPROTOOPT 50
-#define CLOUDABI_ENOSPC 51
-#define CLOUDABI_ENOSYS 52
-#define CLOUDABI_ENOTCONN 53
-#define CLOUDABI_ENOTDIR 54
-#define CLOUDABI_ENOTEMPTY 55
-#define CLOUDABI_ENOTRECOVERABLE 56
-#define CLOUDABI_ENOTSOCK 57
-#define CLOUDABI_ENOTSUP 58
-#define CLOUDABI_ENOTTY 59
-#define CLOUDABI_ENXIO 60
-#define CLOUDABI_EOVERFLOW 61
-#define CLOUDABI_EOWNERDEAD 62
-#define CLOUDABI_EPERM 63
-#define CLOUDABI_EPIPE 64
-#define CLOUDABI_EPROTO 65
-#define CLOUDABI_EPROTONOSUPPORT 66
-#define CLOUDABI_EPROTOTYPE 67
-#define CLOUDABI_ERANGE 68
-#define CLOUDABI_EROFS 69
-#define CLOUDABI_ESPIPE 70
-#define CLOUDABI_ESRCH 71
-#define CLOUDABI_ESTALE 72
-#define CLOUDABI_ETIMEDOUT 73
-#define CLOUDABI_ETXTBSY 74
-#define CLOUDABI_EXDEV 75
-
-// Non-standard error numbers.
-#define CLOUDABI_ENOTCAPABLE 76
-
-#define CLOUDABI_EVENT_FD_READWRITE_HANGUP 0x1
-
-// Filter types for cloudabi_eventtype_t.
-#define CLOUDABI_EVENTTYPE_CLOCK 1
-#define CLOUDABI_EVENTTYPE_CONDVAR 2
-#define CLOUDABI_EVENTTYPE_FD_READ 3
-#define CLOUDABI_EVENTTYPE_FD_WRITE 4
-#define CLOUDABI_EVENTTYPE_LOCK_RDLOCK 5
-#define CLOUDABI_EVENTTYPE_LOCK_WRLOCK 6
-#define CLOUDABI_EVENTTYPE_PROC_TERMINATE 7
-
-// File descriptor behavior flags.
-#define CLOUDABI_FDFLAG_APPEND 0x1
-#define CLOUDABI_FDFLAG_DSYNC 0x2
-#define CLOUDABI_FDFLAG_NONBLOCK 0x4
-#define CLOUDABI_FDFLAG_RSYNC 0x8
-#define CLOUDABI_FDFLAG_SYNC 0x10
-
-// fdstat_put() flags.
-#define CLOUDABI_FDSTAT_FLAGS 0x1
-#define CLOUDABI_FDSTAT_RIGHTS 0x2
-
-// filestat_put() flags.
-#define CLOUDABI_FILESTAT_ATIM 0x1
-#define CLOUDABI_FILESTAT_ATIM_NOW 0x2
-#define CLOUDABI_FILESTAT_MTIM 0x4
-#define CLOUDABI_FILESTAT_MTIM_NOW 0x8
-#define CLOUDABI_FILESTAT_SIZE 0x10
-
-// File types returned through struct stat::st_mode.
-#define CLOUDABI_FILETYPE_UNKNOWN 0
-#define CLOUDABI_FILETYPE_BLOCK_DEVICE 0x10
-#define CLOUDABI_FILETYPE_CHARACTER_DEVICE 0x11
-#define CLOUDABI_FILETYPE_DIRECTORY 0x20
-#define CLOUDABI_FILETYPE_FIFO 0x30
-#define CLOUDABI_FILETYPE_POLL 0x40
-#define CLOUDABI_FILETYPE_PROCESS 0x50
-#define CLOUDABI_FILETYPE_REGULAR_FILE 0x60
-#define CLOUDABI_FILETYPE_SHARED_MEMORY 0x70
-#define CLOUDABI_FILETYPE_SOCKET_DGRAM 0x80
-#define CLOUDABI_FILETYPE_SOCKET_SEQPACKET 0x81
-#define CLOUDABI_FILETYPE_SOCKET_STREAM 0x82
-#define CLOUDABI_FILETYPE_SYMBOLIC_LINK 0x90
-
-// Read-write lock related constants.
-#define CLOUDABI_LOCK_UNLOCKED 0 // Lock is unlocked.
-#define CLOUDABI_LOCK_WRLOCKED 0x40000000 // Lock is write locked.
-#define CLOUDABI_LOCK_KERNEL_MANAGED 0x80000000 // Lock has waiters.
-#define CLOUDABI_LOCK_BOGUS 0x80000000 // Lock is broken.
-
-// Lookup properties for *at() functions.
-#define CLOUDABI_LOOKUP_SYMLINK_FOLLOW (UINT64_C(0x1) << 32)
-
-// Open flags for openat(), etc.
-#define CLOUDABI_O_CREAT 0x1
-#define CLOUDABI_O_DIRECTORY 0x2
-#define CLOUDABI_O_EXCL 0x4
-#define CLOUDABI_O_TRUNC 0x8
-
-// File descriptor returned to pdfork()'s child process.
-#define CLOUDABI_PROCESS_CHILD 0xffffffff
-
-// mmap() map flags.
-#define CLOUDABI_MAP_ANON 0x1
-#define CLOUDABI_MAP_FIXED 0x2
-#define CLOUDABI_MAP_PRIVATE 0x4
-#define CLOUDABI_MAP_SHARED 0x8
-
-// File descriptor that must be passed in when using CLOUDABI_MAP_ANON.
-#define CLOUDABI_MAP_ANON_FD 0xffffffff
-
-// msync() flags.
-#define CLOUDABI_MS_ASYNC 0x1
-#define CLOUDABI_MS_INVALIDATE 0x2
-#define CLOUDABI_MS_SYNC 0x4
-
-// send() and recv() flags.
-#define CLOUDABI_MSG_CTRUNC 0x1 // Control data truncated.
-#define CLOUDABI_MSG_EOR 0x2 // Terminates a record.
-#define CLOUDABI_MSG_PEEK 0x4 // Leave received data in queue.
-#define CLOUDABI_MSG_TRUNC 0x8 // Normal data truncated.
-#define CLOUDABI_MSG_WAITALL 0x10 // Attempt to fill the read buffer.
-
-// mmap()/mprotect() protection flags.
-#define CLOUDABI_PROT_EXEC 0x1
-#define CLOUDABI_PROT_WRITE 0x2
-#define CLOUDABI_PROT_READ 0x4
-
-// File descriptor capabilities/rights.
-#define CLOUDABI_RIGHT_BIT(bit) (UINT64_C(1) << (bit))
-#define CLOUDABI_RIGHT_FD_DATASYNC CLOUDABI_RIGHT_BIT(0)
-#define CLOUDABI_RIGHT_FD_READ CLOUDABI_RIGHT_BIT(1)
-#define CLOUDABI_RIGHT_FD_SEEK CLOUDABI_RIGHT_BIT(2)
-#define CLOUDABI_RIGHT_FD_STAT_PUT_FLAGS CLOUDABI_RIGHT_BIT(3)
-#define CLOUDABI_RIGHT_FD_SYNC CLOUDABI_RIGHT_BIT(4)
-#define CLOUDABI_RIGHT_FD_TELL CLOUDABI_RIGHT_BIT(5)
-#define CLOUDABI_RIGHT_FD_WRITE CLOUDABI_RIGHT_BIT(6)
-#define CLOUDABI_RIGHT_FILE_ADVISE CLOUDABI_RIGHT_BIT(7)
-#define CLOUDABI_RIGHT_FILE_ALLOCATE CLOUDABI_RIGHT_BIT(8)
-#define CLOUDABI_RIGHT_FILE_CREATE_DIRECTORY CLOUDABI_RIGHT_BIT(9)
-#define CLOUDABI_RIGHT_FILE_CREATE_FILE CLOUDABI_RIGHT_BIT(10)
-#define CLOUDABI_RIGHT_FILE_CREATE_FIFO CLOUDABI_RIGHT_BIT(11)
-#define CLOUDABI_RIGHT_FILE_LINK_SOURCE CLOUDABI_RIGHT_BIT(12)
-#define CLOUDABI_RIGHT_FILE_LINK_TARGET CLOUDABI_RIGHT_BIT(13)
-#define CLOUDABI_RIGHT_FILE_OPEN CLOUDABI_RIGHT_BIT(14)
-#define CLOUDABI_RIGHT_FILE_READDIR CLOUDABI_RIGHT_BIT(15)
-#define CLOUDABI_RIGHT_FILE_READLINK CLOUDABI_RIGHT_BIT(16)
-#define CLOUDABI_RIGHT_FILE_RENAME_SOURCE CLOUDABI_RIGHT_BIT(17)
-#define CLOUDABI_RIGHT_FILE_RENAME_TARGET CLOUDABI_RIGHT_BIT(18)
-#define CLOUDABI_RIGHT_FILE_STAT_FGET CLOUDABI_RIGHT_BIT(19)
-#define CLOUDABI_RIGHT_FILE_STAT_FPUT_SIZE CLOUDABI_RIGHT_BIT(20)
-#define CLOUDABI_RIGHT_FILE_STAT_FPUT_TIMES CLOUDABI_RIGHT_BIT(21)
-#define CLOUDABI_RIGHT_FILE_STAT_GET CLOUDABI_RIGHT_BIT(22)
-#define CLOUDABI_RIGHT_FILE_STAT_PUT_TIMES CLOUDABI_RIGHT_BIT(23)
-#define CLOUDABI_RIGHT_FILE_SYMLINK CLOUDABI_RIGHT_BIT(24)
-#define CLOUDABI_RIGHT_FILE_UNLINK CLOUDABI_RIGHT_BIT(25)
-#define CLOUDABI_RIGHT_MEM_MAP CLOUDABI_RIGHT_BIT(26)
-#define CLOUDABI_RIGHT_MEM_MAP_EXEC CLOUDABI_RIGHT_BIT(27)
-#define CLOUDABI_RIGHT_POLL_FD_READWRITE CLOUDABI_RIGHT_BIT(28)
-#define CLOUDABI_RIGHT_POLL_MODIFY CLOUDABI_RIGHT_BIT(29)
-#define CLOUDABI_RIGHT_POLL_PROC_TERMINATE CLOUDABI_RIGHT_BIT(30)
-#define CLOUDABI_RIGHT_POLL_WAIT CLOUDABI_RIGHT_BIT(31)
-#define CLOUDABI_RIGHT_PROC_EXEC CLOUDABI_RIGHT_BIT(32)
-#define CLOUDABI_RIGHT_SOCK_ACCEPT CLOUDABI_RIGHT_BIT(33)
-#define CLOUDABI_RIGHT_SOCK_BIND_DIRECTORY CLOUDABI_RIGHT_BIT(34)
-#define CLOUDABI_RIGHT_SOCK_BIND_SOCKET CLOUDABI_RIGHT_BIT(35)
-#define CLOUDABI_RIGHT_SOCK_CONNECT_DIRECTORY CLOUDABI_RIGHT_BIT(36)
-#define CLOUDABI_RIGHT_SOCK_CONNECT_SOCKET CLOUDABI_RIGHT_BIT(37)
-#define CLOUDABI_RIGHT_SOCK_LISTEN CLOUDABI_RIGHT_BIT(38)
-#define CLOUDABI_RIGHT_SOCK_SHUTDOWN CLOUDABI_RIGHT_BIT(39)
-#define CLOUDABI_RIGHT_SOCK_STAT_GET CLOUDABI_RIGHT_BIT(40)
-
-// Socket shutdown flags.
-#define CLOUDABI_SHUT_RD 0x1
-#define CLOUDABI_SHUT_WR 0x2
-
-// Signals.
-#define CLOUDABI_SIGABRT 1
-#define CLOUDABI_SIGALRM 2
-#define CLOUDABI_SIGBUS 3
-#define CLOUDABI_SIGCHLD 4
-#define CLOUDABI_SIGCONT 5
-#define CLOUDABI_SIGFPE 6
-#define CLOUDABI_SIGHUP 7
-#define CLOUDABI_SIGILL 8
-#define CLOUDABI_SIGINT 9
-#define CLOUDABI_SIGKILL 10
-#define CLOUDABI_SIGPIPE 11
-#define CLOUDABI_SIGQUIT 12
-#define CLOUDABI_SIGSEGV 13
-#define CLOUDABI_SIGSTOP 14
-#define CLOUDABI_SIGSYS 15
-#define CLOUDABI_SIGTERM 16
-#define CLOUDABI_SIGTRAP 17
-#define CLOUDABI_SIGTSTP 18
-#define CLOUDABI_SIGTTIN 19
-#define CLOUDABI_SIGTTOU 20
-#define CLOUDABI_SIGURG 21
-#define CLOUDABI_SIGUSR1 22
-#define CLOUDABI_SIGUSR2 23
-#define CLOUDABI_SIGVTALRM 24
-#define CLOUDABI_SIGXCPU 25
-#define CLOUDABI_SIGXFSZ 26
-
-// sockstat() flags.
-#define CLOUDABI_SOCKSTAT_CLEAR_ERROR 0x1
-
-// sockstat() state.
-#define CLOUDABI_SOCKSTAT_ACCEPTCONN 0x1
-
-// cloudabi_subscription_t flags.
-#define CLOUDABI_SUBSCRIPTION_ADD 0x1
-#define CLOUDABI_SUBSCRIPTION_CLEAR 0x2
-#define CLOUDABI_SUBSCRIPTION_DELETE 0x4
-#define CLOUDABI_SUBSCRIPTION_DISABLE 0x8
-#define CLOUDABI_SUBSCRIPTION_ENABLE 0x10
-#define CLOUDABI_SUBSCRIPTION_ONESHOT 0x20
-
-// cloudabi_subscription_t::clock.flags.
-#define CLOUDABI_SUBSCRIPTION_CLOCK_ABSTIME 0x1
-
-// cloudabi_subscription_t::fd_readwrite.flags.
-#define CLOUDABI_SUBSCRIPTION_FD_READWRITE_POLL 0x1
-
-// unlinkat().
-#define CLOUDABI_UNLINK_REMOVEDIR 0x1
-
-// Seeking.
-#define CLOUDABI_WHENCE_CUR 1
-#define CLOUDABI_WHENCE_END 2
-#define CLOUDABI_WHENCE_SET 3
-
-typedef uint8_t cloudabi_advice_t; // posix_fadvise() and posix_madvise().
-typedef uint32_t cloudabi_backlog_t; // listen().
-typedef uint32_t cloudabi_clockid_t; // clock_*().
-typedef uint32_t cloudabi_condvar_t; // pthread_cond_*().
-typedef uint64_t cloudabi_device_t; // struct stat::st_dev.
-typedef uint64_t cloudabi_dircookie_t; // readdir().
-typedef uint16_t cloudabi_errno_t; // errno.
-typedef uint8_t cloudabi_eventtype_t; // poll().
-typedef uint32_t cloudabi_exitcode_t; // _exit() and _Exit().
-typedef uint32_t cloudabi_fd_t; // File descriptors.
-typedef uint16_t cloudabi_fdflags_t; // cloudabi_fdstat_t.
-typedef uint16_t cloudabi_fdsflags_t; // fd_stat_put().
-typedef int64_t cloudabi_filedelta_t; // lseek().
-typedef uint64_t cloudabi_filesize_t; // ftruncate(), struct stat::st_size.
-typedef uint8_t cloudabi_filetype_t; // struct stat::st_mode.
-typedef uint16_t cloudabi_fsflags_t; // file_stat_put().
-typedef uint64_t cloudabi_inode_t; // struct stat::st_ino.
-typedef uint32_t cloudabi_linkcount_t; // struct stat::st_nlink.
-typedef uint32_t cloudabi_lock_t; // pthread_{mutex,rwlock}_*().
-typedef uint64_t cloudabi_lookup_t; // openat(), linkat(), etc.
-typedef uint8_t cloudabi_mflags_t; // mmap().
-typedef uint8_t cloudabi_mprot_t; // mmap().
-typedef uint8_t cloudabi_msflags_t; // msync().
-typedef uint16_t cloudabi_msgflags_t; // send() and recv().
-typedef uint32_t cloudabi_nthreads_t; // pthread_cond_*().
-typedef uint16_t cloudabi_oflags_t; // openat(), etc.
-typedef uint64_t cloudabi_rights_t; // File descriptor rights.
-typedef uint8_t cloudabi_sa_family_t; // Socket address family.
-typedef uint8_t cloudabi_sdflags_t; // shutdown().
-typedef uint8_t cloudabi_ssflags_t; // sockstat().
-typedef uint8_t cloudabi_signal_t; // raise().
-typedef uint32_t cloudabi_tid_t; // Thread ID.
-typedef uint64_t cloudabi_timestamp_t; // clock_*(), struct stat::st_*tim.
-typedef uint8_t cloudabi_ulflags_t; // unlinkat().
-typedef uint64_t cloudabi_userdata_t; // User-supplied data for callbacks.
-typedef uint8_t cloudabi_whence_t; // lseek().
-
-// Macro to force sane alignment rules.
-//
-// On x86-32 it is the case that 64-bit integers are 4-byte aligned when
-// embedded in structs, even though they are 8-byte aligned when not
-// embedded. Force 8-byte alignment explicitly.
-#define MEMBER(type) alignas(alignof(type)) type
-#define ASSERT_OFFSET(type, field, offset) \
- static_assert(offsetof(cloudabi_##type, field) == (offset), \
- "Offset incorrect")
-#define ASSERT_SIZE(type, size) \
- static_assert(sizeof(cloudabi_##type) == (size), "Size incorrect")
-
-// Directory entries.
-typedef struct {
- MEMBER(cloudabi_dircookie_t) d_next; // Cookie of the next entry.
- MEMBER(cloudabi_inode_t) d_ino; // Inode number of the current entry.
- MEMBER(uint32_t) d_namlen; // Length of the name of the current entry.
- MEMBER(cloudabi_filetype_t) d_type; // File type of the current entry.
-} cloudabi_dirent_t;
-ASSERT_OFFSET(dirent_t, d_next, 0);
-ASSERT_OFFSET(dirent_t, d_ino, 8);
-ASSERT_OFFSET(dirent_t, d_namlen, 16);
-ASSERT_OFFSET(dirent_t, d_type, 20);
-ASSERT_SIZE(dirent_t, 24);
-
-// File descriptor status.
-typedef struct {
- MEMBER(cloudabi_filetype_t) fs_filetype; // File descriptor type.
- MEMBER(cloudabi_fdflags_t) fs_flags; // Non-blocking mode, etc.
- MEMBER(cloudabi_rights_t) fs_rights_base; // Base rights.
- MEMBER(cloudabi_rights_t) fs_rights_inheriting; // Inheriting rights.
-} cloudabi_fdstat_t;
-ASSERT_OFFSET(fdstat_t, fs_filetype, 0);
-ASSERT_OFFSET(fdstat_t, fs_flags, 2);
-ASSERT_OFFSET(fdstat_t, fs_rights_base, 8);
-ASSERT_OFFSET(fdstat_t, fs_rights_inheriting, 16);
-ASSERT_SIZE(fdstat_t, 24);
-
-// File status.
-typedef struct {
- MEMBER(cloudabi_device_t) st_dev; // Device storing the file.
- MEMBER(cloudabi_inode_t) st_ino; // Inode of the file.
- MEMBER(cloudabi_filetype_t) st_filetype; // File type.
- MEMBER(cloudabi_linkcount_t) st_nlink; // Number of hardlinks.
- MEMBER(cloudabi_filesize_t) st_size; // Size of the file.
- MEMBER(cloudabi_timestamp_t) st_atim; // Access time.
- MEMBER(cloudabi_timestamp_t) st_mtim; // Modification time.
- MEMBER(cloudabi_timestamp_t) st_ctim; // Change time.
-} cloudabi_filestat_t;
-ASSERT_OFFSET(filestat_t, st_dev, 0);
-ASSERT_OFFSET(filestat_t, st_ino, 8);
-ASSERT_OFFSET(filestat_t, st_filetype, 16);
-ASSERT_OFFSET(filestat_t, st_nlink, 20);
-ASSERT_OFFSET(filestat_t, st_size, 24);
-ASSERT_OFFSET(filestat_t, st_atim, 32);
-ASSERT_OFFSET(filestat_t, st_mtim, 40);
-ASSERT_OFFSET(filestat_t, st_ctim, 48);
-ASSERT_SIZE(filestat_t, 56);
-
-typedef struct {
- MEMBER(cloudabi_sa_family_t) sa_family;
- union {
- struct {
- // IPv4 address and port number.
- MEMBER(uint8_t) addr[4];
- MEMBER(uint16_t) port;
- } sa_inet;
- struct {
- // IPv6 address and port number.
- // TODO(ed): What about the flow info and scope ID?
- MEMBER(uint8_t) addr[16];
- MEMBER(uint16_t) port;
- } sa_inet6;
- };
-} cloudabi_sockaddr_t;
-ASSERT_OFFSET(sockaddr_t, sa_family, 0);
-ASSERT_OFFSET(sockaddr_t, sa_inet.addr, 2);
-ASSERT_OFFSET(sockaddr_t, sa_inet.port, 6);
-ASSERT_OFFSET(sockaddr_t, sa_inet6.addr, 2);
-ASSERT_OFFSET(sockaddr_t, sa_inet6.port, 18);
-ASSERT_SIZE(sockaddr_t, 20);
-
-// Socket status.
-typedef struct {
- MEMBER(cloudabi_sockaddr_t) ss_sockname; // Socket address.
- MEMBER(cloudabi_sockaddr_t) ss_peername; // Peer address.
- MEMBER(cloudabi_errno_t) ss_error; // Current error state.
- MEMBER(uint32_t) ss_state; // State flags.
-} cloudabi_sockstat_t;
-ASSERT_OFFSET(sockstat_t, ss_sockname, 0);
-ASSERT_OFFSET(sockstat_t, ss_peername, 20);
-ASSERT_OFFSET(sockstat_t, ss_error, 40);
-ASSERT_OFFSET(sockstat_t, ss_state, 44);
-ASSERT_SIZE(sockstat_t, 48);
-
-#undef MEMBER
-#undef ASSERT_OFFSET
-#undef ASSERT_SIZE
-
-#endif
diff --git a/sys/compat/cloudabi64/syscalls.master b/sys/contrib/cloudabi/syscalls.master
index 5fd6f7e..0257fa6 100644
--- a/sys/compat/cloudabi64/syscalls.master
+++ b/sys/contrib/cloudabi/syscalls.master
@@ -1,19 +1,42 @@
$FreeBSD$
-; System call table for CloudABI.
+; Copyright (c) 2016 Nuxi, https://nuxi.nl/
;
-; All system calls that do not use any machine-dependent data types are
-; prefixed with cloudabi_sys_. The others are called cloudabi64_sys_.
+; Redistribution and use in source and binary forms, with or without
+; modification, are permitted provided that the following conditions
+; are met:
+; 1. Redistributions of source code must retain the above copyright
+; notice, this list of conditions and the following disclaimer.
+; 2. Redistributions in binary form must 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.
+
+; This file is automatically generated. Do not edit.
+; Source: https://github.com/NuxiNL/cloudabi
#include <sys/sysent.h>
#include <sys/sysproto.h>
-#include <compat/cloudabi64/cloudabi64_syscalldefs.h>
+#include <contrib/cloudabi/cloudabi64_types.h>
+
#include <compat/cloudabi64/cloudabi64_proto.h>
0 AUE_NULL STD { cloudabi_timestamp_t \
cloudabi_sys_clock_res_get( \
cloudabi_clockid_t clock_id); }
+
1 AUE_NULL STD { cloudabi_timestamp_t \
cloudabi_sys_clock_time_get( \
cloudabi_clockid_t clock_id, \
@@ -26,195 +49,269 @@
3 AUE_NULL STD { void cloudabi_sys_fd_close( \
cloudabi_fd_t fd); }
+
4 AUE_NULL STD { cloudabi_fd_t cloudabi_sys_fd_create1( \
cloudabi_filetype_t type); }
+
5 AUE_NULL STD { void cloudabi_sys_fd_create2( \
cloudabi_filetype_t type); }
+
6 AUE_NULL STD { void cloudabi_sys_fd_datasync( \
cloudabi_fd_t fd); }
+
7 AUE_NULL STD { cloudabi_fd_t cloudabi_sys_fd_dup( \
cloudabi_fd_t from); }
-8 AUE_NULL STD { cloudabi64_size_t cloudabi64_sys_fd_pread( \
+
+8 AUE_NULL STD { size_t cloudabi64_sys_fd_pread( \
cloudabi_fd_t fd, \
const cloudabi64_iovec_t *iov, \
- cloudabi64_size_t iovcnt, \
+ size_t iovcnt, \
cloudabi_filesize_t offset); }
-9 AUE_NULL STD { cloudabi64_size_t cloudabi64_sys_fd_pwrite( \
+
+9 AUE_NULL STD { size_t cloudabi64_sys_fd_pwrite( \
cloudabi_fd_t fd, \
const cloudabi64_ciovec_t *iov, \
- cloudabi64_size_t iovcnt, \
+ size_t iovcnt, \
cloudabi_filesize_t offset); }
-10 AUE_NULL STD { cloudabi64_size_t cloudabi64_sys_fd_read( \
+
+10 AUE_NULL STD { size_t cloudabi64_sys_fd_read( \
cloudabi_fd_t fd, \
const cloudabi64_iovec_t *iov, \
- cloudabi64_size_t iovcnt); }
+ size_t iovcnt); }
+
11 AUE_NULL STD { void cloudabi_sys_fd_replace( \
cloudabi_fd_t from, \
cloudabi_fd_t to); }
-12 AUE_NULL STD { cloudabi_filesize_t cloudabi_sys_fd_seek( \
+
+12 AUE_NULL STD { cloudabi_filesize_t \
+ cloudabi_sys_fd_seek( \
cloudabi_fd_t fd, \
cloudabi_filedelta_t offset, \
cloudabi_whence_t whence); }
+
13 AUE_NULL STD { void cloudabi_sys_fd_stat_get( \
cloudabi_fd_t fd, \
cloudabi_fdstat_t *buf); }
+
14 AUE_NULL STD { void cloudabi_sys_fd_stat_put( \
cloudabi_fd_t fd, \
const cloudabi_fdstat_t *buf, \
cloudabi_fdsflags_t flags); }
+
15 AUE_NULL STD { void cloudabi_sys_fd_sync( \
cloudabi_fd_t fd); }
-16 AUE_NULL STD { cloudabi64_size_t cloudabi64_sys_fd_write( \
+
+16 AUE_NULL STD { size_t cloudabi64_sys_fd_write( \
cloudabi_fd_t fd, \
const cloudabi64_ciovec_t *iov, \
- cloudabi64_size_t iovcnt); }
+ size_t iovcnt); }
17 AUE_NULL STD { void cloudabi_sys_file_advise( \
cloudabi_fd_t fd, \
cloudabi_filesize_t offset, \
cloudabi_filesize_t len, \
cloudabi_advice_t advice); }
+
18 AUE_NULL STD { void cloudabi_sys_file_allocate( \
cloudabi_fd_t fd, \
cloudabi_filesize_t offset, \
cloudabi_filesize_t len); }
+
19 AUE_NULL STD { void cloudabi_sys_file_create( \
cloudabi_fd_t fd, \
- const char *path, size_t pathlen, \
+ const char *path, \
+ size_t pathlen, \
cloudabi_filetype_t type); }
+
20 AUE_NULL STD { void cloudabi_sys_file_link( \
cloudabi_lookup_t fd1, \
- const char *path1, size_t path1len, \
+ const char *path1, \
+ size_t path1len, \
cloudabi_fd_t fd2, \
- const char *path2, size_t path2len); }
+ const char *path2, \
+ size_t path2len); }
+
21 AUE_NULL STD { cloudabi_fd_t cloudabi_sys_file_open( \
- cloudabi_lookup_t fd, \
- const char *path, size_t pathlen, \
+ cloudabi_lookup_t dirfd, \
+ const char *path, \
+ size_t pathlen, \
cloudabi_oflags_t oflags, \
const cloudabi_fdstat_t *fds); }
+
22 AUE_NULL STD { size_t cloudabi_sys_file_readdir( \
cloudabi_fd_t fd, \
- void *buf, size_t nbyte, \
+ void *buf, \
+ size_t nbyte, \
cloudabi_dircookie_t cookie); }
+
23 AUE_NULL STD { size_t cloudabi_sys_file_readlink( \
cloudabi_fd_t fd, \
- const char *path, size_t pathlen, \
- void *buf, size_t bufsize); }
+ const char *path, \
+ size_t pathlen, \
+ char *buf, \
+ size_t bufsize); }
+
24 AUE_NULL STD { void cloudabi_sys_file_rename( \
cloudabi_fd_t oldfd, \
- const char *old, size_t oldlen, \
+ const char *old, \
+ size_t oldlen, \
cloudabi_fd_t newfd, \
- const char *new, size_t newlen); }
+ const char *new, \
+ size_t newlen); }
+
25 AUE_NULL STD { void cloudabi_sys_file_stat_fget( \
cloudabi_fd_t fd, \
cloudabi_filestat_t *buf); }
+
26 AUE_NULL STD { void cloudabi_sys_file_stat_fput( \
cloudabi_fd_t fd, \
const cloudabi_filestat_t *buf, \
cloudabi_fsflags_t flags); }
+
27 AUE_NULL STD { void cloudabi_sys_file_stat_get( \
cloudabi_lookup_t fd, \
- const char *path, size_t pathlen, \
+ const char *path, \
+ size_t pathlen, \
cloudabi_filestat_t *buf); }
+
28 AUE_NULL STD { void cloudabi_sys_file_stat_put( \
cloudabi_lookup_t fd, \
- const char *path, size_t pathlen, \
+ const char *path, \
+ size_t pathlen, \
const cloudabi_filestat_t *buf, \
cloudabi_fsflags_t flags); }
+
29 AUE_NULL STD { void cloudabi_sys_file_symlink( \
- const char *path1, size_t path1len, \
+ const char *path1, \
+ size_t path1len, \
cloudabi_fd_t fd, \
- const char *path2, size_t path2len); }
+ const char *path2, \
+ size_t path2len); }
+
30 AUE_NULL STD { void cloudabi_sys_file_unlink( \
cloudabi_fd_t fd, \
- const char *path, size_t pathlen, \
- cloudabi_ulflags_t flag); }
+ const char *path, \
+ size_t pathlen, \
+ cloudabi_ulflags_t flags); }
31 AUE_NULL STD { void cloudabi_sys_lock_unlock( \
cloudabi_lock_t *lock, \
cloudabi_mflags_t scope); }
32 AUE_NULL STD { void cloudabi_sys_mem_advise( \
- void *addr, size_t len, \
+ void *addr, \
+ size_t len, \
cloudabi_advice_t advice); }
+
33 AUE_NULL STD { void cloudabi_sys_mem_lock( \
- const void *addr, size_t len); }
+ const void *addr, \
+ size_t len); }
+
34 AUE_NULL STD { void cloudabi_sys_mem_map( \
- void *addr, size_t len, \
+ void *addr, \
+ size_t len, \
cloudabi_mprot_t prot, \
cloudabi_mflags_t flags, \
cloudabi_fd_t fd, \
cloudabi_filesize_t off); }
+
35 AUE_NULL STD { void cloudabi_sys_mem_protect( \
- void *addr, size_t len, \
+ void *addr, \
+ size_t len, \
cloudabi_mprot_t prot); }
+
36 AUE_NULL STD { void cloudabi_sys_mem_sync( \
- void *addr, size_t len, \
+ void *addr, \
+ size_t len, \
cloudabi_msflags_t flags); }
+
37 AUE_NULL STD { void cloudabi_sys_mem_unlock( \
- const void *addr, size_t len); }
+ const void *addr, \
+ size_t len); }
+
38 AUE_NULL STD { void cloudabi_sys_mem_unmap( \
- void * addr, size_t len); }
+ void *addr, \
+ size_t len); }
-39 AUE_NULL STD { cloudabi64_size_t cloudabi64_sys_poll( \
+39 AUE_NULL STD { size_t cloudabi64_sys_poll( \
const cloudabi64_subscription_t *in, \
cloudabi64_event_t *out, \
- cloudabi64_size_t nevents); }
+ size_t nsubscriptions); }
40 AUE_NULL STD { void cloudabi_sys_proc_exec( \
- cloudabi_fd_t fd, const void *data, \
+ cloudabi_fd_t fd, \
+ const void *data, \
size_t datalen, \
const cloudabi_fd_t *fds, \
size_t fdslen); }
+
41 AUE_NULL STD { void cloudabi_sys_proc_exit( \
cloudabi_exitcode_t rval); }
-42 AUE_NULL STD { cloudabi_fd_t cloudabi_sys_proc_fork(); }
+
+42 AUE_NULL STD { void cloudabi_sys_proc_fork(); }
+
43 AUE_NULL STD { void cloudabi_sys_proc_raise( \
cloudabi_signal_t sig); }
44 AUE_NULL STD { void cloudabi_sys_random_get( \
- void *buf, size_t nbyte); }
+ void *buf, \
+ size_t nbyte); }
45 AUE_NULL STD { cloudabi_fd_t cloudabi_sys_sock_accept( \
- cloudabi_fd_t s, \
+ cloudabi_fd_t sock, \
cloudabi_sockstat_t *buf); }
+
46 AUE_NULL STD { void cloudabi_sys_sock_bind( \
- cloudabi_fd_t s, cloudabi_fd_t fd, \
- const char *path, size_t pathlen); }
+ cloudabi_fd_t sock, \
+ cloudabi_fd_t fd, \
+ const char *path, \
+ size_t pathlen); }
+
47 AUE_NULL STD { void cloudabi_sys_sock_connect( \
- cloudabi_fd_t s, cloudabi_fd_t fd, \
- const char *path, size_t pathlen); }
+ cloudabi_fd_t sock, \
+ cloudabi_fd_t fd, \
+ const char *path, \
+ size_t pathlen); }
+
48 AUE_NULL STD { void cloudabi_sys_sock_listen( \
- cloudabi_fd_t s, \
+ cloudabi_fd_t sock, \
cloudabi_backlog_t backlog); }
-49 AUE_NULL STD { cloudabi64_size_t cloudabi64_sys_sock_recv( \
- cloudabi_fd_t s, \
+
+49 AUE_NULL STD { void cloudabi64_sys_sock_recv( \
+ cloudabi_fd_t sock, \
const cloudabi64_recv_in_t *in, \
cloudabi64_recv_out_t *out); }
-50 AUE_NULL STD { cloudabi64_size_t cloudabi64_sys_sock_send( \
- cloudabi_fd_t s, \
+
+50 AUE_NULL STD { void cloudabi64_sys_sock_send( \
+ cloudabi_fd_t sock, \
const cloudabi64_send_in_t *in, \
cloudabi64_send_out_t *out); }
+
51 AUE_NULL STD { void cloudabi_sys_sock_shutdown( \
- cloudabi_fd_t fd, \
+ cloudabi_fd_t sock, \
cloudabi_sdflags_t how); }
+
52 AUE_NULL STD { void cloudabi_sys_sock_stat_get( \
- cloudabi_fd_t fd, \
+ cloudabi_fd_t sock, \
cloudabi_sockstat_t *buf, \
cloudabi_ssflags_t flags); }
53 AUE_NULL STD { cloudabi_tid_t cloudabi64_sys_thread_create( \
cloudabi64_threadattr_t *attr); }
+
54 AUE_NULL STD { void cloudabi_sys_thread_exit( \
cloudabi_lock_t *lock, \
cloudabi_mflags_t scope); }
-55 AUE_NULL STD { void cloudabi_sys_thread_tcb_set(void *tcb); }
+
+55 AUE_NULL STD { void cloudabi_sys_thread_tcb_set( \
+ void *tcb); }
+
56 AUE_NULL STD { void cloudabi_sys_thread_yield(); }
-57 AUE_NULL STD { cloudabi64_size_t cloudabi64_sys_poll_fd( \
+57 AUE_NULL STD { size_t cloudabi64_sys_poll_fd( \
cloudabi_fd_t fd, \
const cloudabi64_subscription_t *in, \
- cloudabi64_size_t nin, \
+ size_t nin, \
cloudabi64_event_t *out, \
- cloudabi64_size_t nout, \
+ size_t nout, \
const cloudabi64_subscription_t *timeout); }
OpenPOWER on IntegriCloud