Upgrade to CloudABI v0.17.

Compared to the previous version, v0.16, there are a couple of minor
changes:

- CLOUDABI_AT_PID: Process identifiers for CloudABI processes.

  Initially, BSD process identifiers weren't exposed inside the runtime,
  due to them being pretty much useless inside of a cluster computing
  environment. When jobs are scheduled across systems, the BSD process
  number doesn't act as an identifier. Even on individual systems they
  may recycle relatively quickly.

  With this change, the kernel will now generate a UUIDv4 when executing
  a process. These UUIDs can be obtained within the process using
  program_getpid(). Right now, FreeBSD will not attempt to store this
  value. This should of course happen at some point in time, so that it
  may be printed by administration tools.

- Removal of some unused structure members for polling.

  With the polling framework being simplified/redesigned, it turns out
  some of the structure fields were not used by the C library. We can
  remove these to keep things nice and tidy.

Obtained from:	https://github.com/NuxiNL/cloudabi
This commit is contained in:
Ed Schouten 2017-11-08 14:21:52 +00:00
parent 8c9e091944
commit 7e6155744d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=325555
13 changed files with 86 additions and 132 deletions

View File

@ -63,10 +63,10 @@ cloudabi32_copyout_strings(struct image_params *imgp)
int
cloudabi32_fixup(register_t **stack_base, struct image_params *imgp)
{
char canarybuf[64];
char canarybuf[64], pidbuf[16];
Elf32_Auxargs *args;
struct thread *td;
void *argdata, *canary;
void *argdata, *canary, *pid;
size_t argdatalen;
int error;
@ -79,8 +79,9 @@ cloudabi32_fixup(register_t **stack_base, struct image_params *imgp)
td = curthread;
td->td_proc->p_osrel = __FreeBSD_version;
/* Store canary for stack smashing protection. */
argdata = *stack_base;
/* Store canary for stack smashing protection. */
arc4rand(canarybuf, sizeof(canarybuf), 0);
*stack_base -= howmany(sizeof(canarybuf), sizeof(register_t));
canary = *stack_base;
@ -88,6 +89,20 @@ cloudabi32_fixup(register_t **stack_base, struct image_params *imgp)
if (error != 0)
return (error);
/*
* Generate a random UUID that identifies the process. Right now
* we don't store this UUID in the kernel. Ideally, it should be
* exposed through ps(1).
*/
arc4rand(pidbuf, sizeof(pidbuf), 0);
pidbuf[6] = (pidbuf[6] & 0x0f) | 0x40;
pidbuf[8] = (pidbuf[8] & 0x3f) | 0x80;
*stack_base -= howmany(sizeof(pidbuf), sizeof(register_t));
pid = *stack_base;
error = copyout(pidbuf, pid, sizeof(pidbuf));
if (error != 0)
return (error);
/*
* Compute length of program arguments. As the argument data is
* binary safe, we had to add a trailing null byte in
@ -111,9 +126,10 @@ cloudabi32_fixup(register_t **stack_base, struct image_params *imgp)
VAL(CLOUDABI_AT_PAGESZ, args->pagesz),
PTR(CLOUDABI_AT_PHDR, args->phdr),
VAL(CLOUDABI_AT_PHNUM, args->phnum),
VAL(CLOUDABI_AT_TID, td->td_tid),
PTR(CLOUDABI_AT_PID, pid),
PTR(CLOUDABI_AT_SYSINFO_EHDR,
imgp->proc->p_sysent->sv_shared_page_base),
VAL(CLOUDABI_AT_TID, td->td_tid),
#undef VAL
#undef PTR
{ .a_type = CLOUDABI_AT_NULL },

View File

@ -78,7 +78,7 @@ convert_signal(int sig)
struct cloudabi32_kevent_args {
const cloudabi32_subscription_t *in;
cloudabi32_event_t *out;
cloudabi_event_t *out;
};
/* Converts CloudABI's subscription objects to FreeBSD's struct kevent. */
@ -145,7 +145,7 @@ cloudabi32_kevent_copyin(void *arg, struct kevent *kevp, int count)
static int
cloudabi32_kevent_copyout(void *arg, struct kevent *kevp, int count)
{
cloudabi32_event_t ev;
cloudabi_event_t ev;
struct cloudabi32_kevent_args *args;
int error;
@ -157,19 +157,15 @@ cloudabi32_kevent_copyout(void *arg, struct kevent *kevp, int count)
switch (kevp->filter) {
case EVFILT_TIMER:
ev.type = CLOUDABI_EVENTTYPE_CLOCK;
ev.clock.identifier = kevp->ident;
break;
case EVFILT_READ:
ev.type = CLOUDABI_EVENTTYPE_FD_READ;
ev.fd_readwrite.fd = kevp->ident;
break;
case EVFILT_WRITE:
ev.type = CLOUDABI_EVENTTYPE_FD_WRITE;
ev.fd_readwrite.fd = kevp->ident;
break;
case EVFILT_PROCDESC:
ev.type = CLOUDABI_EVENTTYPE_PROC_TERMINATE;
ev.proc_terminate.fd = kevp->ident;
break;
}
@ -231,7 +227,7 @@ cloudabi32_sys_poll(struct thread *td, struct cloudabi32_sys_poll_args *uap)
*/
if (uap->nsubscriptions == 1) {
cloudabi32_subscription_t sub;
cloudabi32_event_t ev = {};
cloudabi_event_t ev = {};
int error;
error = copyin(uap->in, &sub, sizeof(sub));
@ -241,7 +237,6 @@ cloudabi32_sys_poll(struct thread *td, struct cloudabi32_sys_poll_args *uap)
ev.type = sub.type;
if (sub.type == CLOUDABI_EVENTTYPE_CONDVAR) {
/* Wait on a condition variable. */
ev.condvar.condvar = sub.condvar.condvar;
ev.error = cloudabi_convert_errno(
cloudabi_futex_condvar_wait(
td, TO_PTR(sub.condvar.condvar),
@ -253,7 +248,6 @@ cloudabi32_sys_poll(struct thread *td, struct cloudabi32_sys_poll_args *uap)
return (copyout(&ev, uap->out, sizeof(ev)));
} else if (sub.type == CLOUDABI_EVENTTYPE_LOCK_RDLOCK) {
/* Acquire a read lock. */
ev.lock.lock = sub.lock.lock;
ev.error = cloudabi_convert_errno(
cloudabi_futex_lock_rdlock(
td, TO_PTR(sub.lock.lock),
@ -263,7 +257,6 @@ cloudabi32_sys_poll(struct thread *td, struct cloudabi32_sys_poll_args *uap)
return (copyout(&ev, uap->out, sizeof(ev)));
} else if (sub.type == CLOUDABI_EVENTTYPE_LOCK_WRLOCK) {
/* Acquire a write lock. */
ev.lock.lock = sub.lock.lock;
ev.error = cloudabi_convert_errno(
cloudabi_futex_lock_wrlock(
td, TO_PTR(sub.lock.lock),
@ -274,7 +267,7 @@ cloudabi32_sys_poll(struct thread *td, struct cloudabi32_sys_poll_args *uap)
}
} else if (uap->nsubscriptions == 2) {
cloudabi32_subscription_t sub[2];
cloudabi32_event_t ev[2] = {};
cloudabi_event_t ev[2] = {};
int error;
error = copyin(uap->in, &sub, sizeof(sub));
@ -288,8 +281,6 @@ cloudabi32_sys_poll(struct thread *td, struct cloudabi32_sys_poll_args *uap)
sub[1].type == CLOUDABI_EVENTTYPE_CLOCK &&
sub[1].clock.flags == CLOUDABI_SUBSCRIPTION_CLOCK_ABSTIME) {
/* Wait for a condition variable with timeout. */
ev[0].condvar.condvar = sub[0].condvar.condvar;
ev[1].clock.identifier = sub[1].clock.identifier;
error = cloudabi_futex_condvar_wait(
td, TO_PTR(sub[0].condvar.condvar),
sub[0].condvar.condvar_scope,
@ -309,8 +300,6 @@ cloudabi32_sys_poll(struct thread *td, struct cloudabi32_sys_poll_args *uap)
sub[1].type == CLOUDABI_EVENTTYPE_CLOCK &&
sub[1].clock.flags == CLOUDABI_SUBSCRIPTION_CLOCK_ABSTIME) {
/* Acquire a read lock with a timeout. */
ev[0].lock.lock = sub[0].lock.lock;
ev[1].clock.identifier = sub[1].clock.identifier;
error = cloudabi_futex_lock_rdlock(
td, TO_PTR(sub[0].lock.lock),
sub[0].lock.lock_scope, sub[1].clock.clock_id,
@ -328,8 +317,6 @@ cloudabi32_sys_poll(struct thread *td, struct cloudabi32_sys_poll_args *uap)
sub[1].type == CLOUDABI_EVENTTYPE_CLOCK &&
sub[1].clock.flags == CLOUDABI_SUBSCRIPTION_CLOCK_ABSTIME) {
/* Acquire a write lock with a timeout. */
ev[0].lock.lock = sub[0].lock.lock;
ev[1].clock.identifier = sub[1].clock.identifier;
error = cloudabi_futex_lock_wrlock(
td, TO_PTR(sub[0].lock.lock),
sub[0].lock.lock_scope, sub[1].clock.clock_id,

View File

@ -224,7 +224,7 @@ struct cloudabi_sys_mem_unmap_args {
};
struct cloudabi32_sys_poll_args {
char in_l_[PADL_(const cloudabi32_subscription_t *)]; const cloudabi32_subscription_t * in; char in_r_[PADR_(const cloudabi32_subscription_t *)];
char out_l_[PADL_(cloudabi32_event_t *)]; cloudabi32_event_t * out; char out_r_[PADR_(cloudabi32_event_t *)];
char out_l_[PADL_(cloudabi_event_t *)]; cloudabi_event_t * out; char out_r_[PADR_(cloudabi_event_t *)];
char nsubscriptions_l_[PADL_(size_t)]; size_t nsubscriptions; char nsubscriptions_r_[PADR_(size_t)];
};
struct cloudabi_sys_proc_exec_args {

View File

@ -352,7 +352,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
case 37: {
struct cloudabi32_sys_poll_args *p = params;
uarg[0] = (intptr_t) p->in; /* const cloudabi32_subscription_t * */
uarg[1] = (intptr_t) p->out; /* cloudabi32_event_t * */
uarg[1] = (intptr_t) p->out; /* cloudabi_event_t * */
uarg[2] = p->nsubscriptions; /* size_t */
*n_args = 3;
break;
@ -1062,7 +1062,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "userland const cloudabi32_subscription_t *";
break;
case 1:
p = "userland cloudabi32_event_t *";
p = "userland cloudabi_event_t *";
break;
case 2:
p = "size_t";

View File

@ -63,10 +63,10 @@ cloudabi64_copyout_strings(struct image_params *imgp)
int
cloudabi64_fixup(register_t **stack_base, struct image_params *imgp)
{
char canarybuf[64];
char canarybuf[64], pidbuf[16];
Elf64_Auxargs *args;
struct thread *td;
void *argdata, *canary;
void *argdata, *canary, *pid;
size_t argdatalen;
int error;
@ -79,8 +79,9 @@ cloudabi64_fixup(register_t **stack_base, struct image_params *imgp)
td = curthread;
td->td_proc->p_osrel = __FreeBSD_version;
/* Store canary for stack smashing protection. */
argdata = *stack_base;
/* Store canary for stack smashing protection. */
arc4rand(canarybuf, sizeof(canarybuf), 0);
*stack_base -= howmany(sizeof(canarybuf), sizeof(register_t));
canary = *stack_base;
@ -88,6 +89,20 @@ cloudabi64_fixup(register_t **stack_base, struct image_params *imgp)
if (error != 0)
return (error);
/*
* Generate a random UUID that identifies the process. Right now
* we don't store this UUID in the kernel. Ideally, it should be
* exposed through ps(1).
*/
arc4rand(pidbuf, sizeof(pidbuf), 0);
pidbuf[6] = (pidbuf[6] & 0x0f) | 0x40;
pidbuf[8] = (pidbuf[8] & 0x3f) | 0x80;
*stack_base -= howmany(sizeof(pidbuf), sizeof(register_t));
pid = *stack_base;
error = copyout(pidbuf, pid, sizeof(pidbuf));
if (error != 0)
return (error);
/*
* Compute length of program arguments. As the argument data is
* binary safe, we had to add a trailing null byte in
@ -111,9 +126,10 @@ cloudabi64_fixup(register_t **stack_base, struct image_params *imgp)
VAL(CLOUDABI_AT_PAGESZ, args->pagesz),
PTR(CLOUDABI_AT_PHDR, args->phdr),
VAL(CLOUDABI_AT_PHNUM, args->phnum),
VAL(CLOUDABI_AT_TID, td->td_tid),
PTR(CLOUDABI_AT_PID, pid),
PTR(CLOUDABI_AT_SYSINFO_EHDR,
imgp->proc->p_sysent->sv_shared_page_base),
VAL(CLOUDABI_AT_TID, td->td_tid),
#undef VAL
#undef PTR
{ .a_type = CLOUDABI_AT_NULL },

View File

@ -78,7 +78,7 @@ convert_signal(int sig)
struct cloudabi64_kevent_args {
const cloudabi64_subscription_t *in;
cloudabi64_event_t *out;
cloudabi_event_t *out;
};
/* Converts CloudABI's subscription objects to FreeBSD's struct kevent. */
@ -145,7 +145,7 @@ cloudabi64_kevent_copyin(void *arg, struct kevent *kevp, int count)
static int
cloudabi64_kevent_copyout(void *arg, struct kevent *kevp, int count)
{
cloudabi64_event_t ev;
cloudabi_event_t ev;
struct cloudabi64_kevent_args *args;
int error;
@ -157,19 +157,15 @@ cloudabi64_kevent_copyout(void *arg, struct kevent *kevp, int count)
switch (kevp->filter) {
case EVFILT_TIMER:
ev.type = CLOUDABI_EVENTTYPE_CLOCK;
ev.clock.identifier = kevp->ident;
break;
case EVFILT_READ:
ev.type = CLOUDABI_EVENTTYPE_FD_READ;
ev.fd_readwrite.fd = kevp->ident;
break;
case EVFILT_WRITE:
ev.type = CLOUDABI_EVENTTYPE_FD_WRITE;
ev.fd_readwrite.fd = kevp->ident;
break;
case EVFILT_PROCDESC:
ev.type = CLOUDABI_EVENTTYPE_PROC_TERMINATE;
ev.proc_terminate.fd = kevp->ident;
break;
}
@ -231,7 +227,7 @@ cloudabi64_sys_poll(struct thread *td, struct cloudabi64_sys_poll_args *uap)
*/
if (uap->nsubscriptions == 1) {
cloudabi64_subscription_t sub;
cloudabi64_event_t ev = {};
cloudabi_event_t ev = {};
int error;
error = copyin(uap->in, &sub, sizeof(sub));
@ -241,7 +237,6 @@ cloudabi64_sys_poll(struct thread *td, struct cloudabi64_sys_poll_args *uap)
ev.type = sub.type;
if (sub.type == CLOUDABI_EVENTTYPE_CONDVAR) {
/* Wait on a condition variable. */
ev.condvar.condvar = sub.condvar.condvar;
ev.error = cloudabi_convert_errno(
cloudabi_futex_condvar_wait(
td, TO_PTR(sub.condvar.condvar),
@ -253,7 +248,6 @@ cloudabi64_sys_poll(struct thread *td, struct cloudabi64_sys_poll_args *uap)
return (copyout(&ev, uap->out, sizeof(ev)));
} else if (sub.type == CLOUDABI_EVENTTYPE_LOCK_RDLOCK) {
/* Acquire a read lock. */
ev.lock.lock = sub.lock.lock;
ev.error = cloudabi_convert_errno(
cloudabi_futex_lock_rdlock(
td, TO_PTR(sub.lock.lock),
@ -263,7 +257,6 @@ cloudabi64_sys_poll(struct thread *td, struct cloudabi64_sys_poll_args *uap)
return (copyout(&ev, uap->out, sizeof(ev)));
} else if (sub.type == CLOUDABI_EVENTTYPE_LOCK_WRLOCK) {
/* Acquire a write lock. */
ev.lock.lock = sub.lock.lock;
ev.error = cloudabi_convert_errno(
cloudabi_futex_lock_wrlock(
td, TO_PTR(sub.lock.lock),
@ -274,7 +267,7 @@ cloudabi64_sys_poll(struct thread *td, struct cloudabi64_sys_poll_args *uap)
}
} else if (uap->nsubscriptions == 2) {
cloudabi64_subscription_t sub[2];
cloudabi64_event_t ev[2] = {};
cloudabi_event_t ev[2] = {};
int error;
error = copyin(uap->in, &sub, sizeof(sub));
@ -288,8 +281,6 @@ cloudabi64_sys_poll(struct thread *td, struct cloudabi64_sys_poll_args *uap)
sub[1].type == CLOUDABI_EVENTTYPE_CLOCK &&
sub[1].clock.flags == CLOUDABI_SUBSCRIPTION_CLOCK_ABSTIME) {
/* Wait for a condition variable with timeout. */
ev[0].condvar.condvar = sub[0].condvar.condvar;
ev[1].clock.identifier = sub[1].clock.identifier;
error = cloudabi_futex_condvar_wait(
td, TO_PTR(sub[0].condvar.condvar),
sub[0].condvar.condvar_scope,
@ -309,8 +300,6 @@ cloudabi64_sys_poll(struct thread *td, struct cloudabi64_sys_poll_args *uap)
sub[1].type == CLOUDABI_EVENTTYPE_CLOCK &&
sub[1].clock.flags == CLOUDABI_SUBSCRIPTION_CLOCK_ABSTIME) {
/* Acquire a read lock with a timeout. */
ev[0].lock.lock = sub[0].lock.lock;
ev[1].clock.identifier = sub[1].clock.identifier;
error = cloudabi_futex_lock_rdlock(
td, TO_PTR(sub[0].lock.lock),
sub[0].lock.lock_scope, sub[1].clock.clock_id,
@ -328,8 +317,6 @@ cloudabi64_sys_poll(struct thread *td, struct cloudabi64_sys_poll_args *uap)
sub[1].type == CLOUDABI_EVENTTYPE_CLOCK &&
sub[1].clock.flags == CLOUDABI_SUBSCRIPTION_CLOCK_ABSTIME) {
/* Acquire a write lock with a timeout. */
ev[0].lock.lock = sub[0].lock.lock;
ev[1].clock.identifier = sub[1].clock.identifier;
error = cloudabi_futex_lock_wrlock(
td, TO_PTR(sub[0].lock.lock),
sub[0].lock.lock_scope, sub[1].clock.clock_id,

View File

@ -224,7 +224,7 @@ struct cloudabi_sys_mem_unmap_args {
};
struct cloudabi64_sys_poll_args {
char in_l_[PADL_(const cloudabi64_subscription_t *)]; const cloudabi64_subscription_t * in; char in_r_[PADR_(const cloudabi64_subscription_t *)];
char out_l_[PADL_(cloudabi64_event_t *)]; cloudabi64_event_t * out; char out_r_[PADR_(cloudabi64_event_t *)];
char out_l_[PADL_(cloudabi_event_t *)]; cloudabi_event_t * out; char out_r_[PADR_(cloudabi_event_t *)];
char nsubscriptions_l_[PADL_(size_t)]; size_t nsubscriptions; char nsubscriptions_r_[PADR_(size_t)];
};
struct cloudabi_sys_proc_exec_args {

View File

@ -352,7 +352,7 @@ systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args)
case 37: {
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 * */
uarg[1] = (intptr_t) p->out; /* cloudabi_event_t * */
uarg[2] = p->nsubscriptions; /* size_t */
*n_args = 3;
break;
@ -1062,7 +1062,7 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz)
p = "userland const cloudabi64_subscription_t *";
break;
case 1:
p = "userland cloudabi64_event_t *";
p = "userland cloudabi_event_t *";
break;
case 2:
p = "size_t";

View File

@ -52,47 +52,6 @@ _Static_assert(offsetof(cloudabi32_ciovec_t, buf_len) == 4, "Incorrect layout");
_Static_assert(sizeof(cloudabi32_ciovec_t) == 8, "Incorrect layout");
_Static_assert(_Alignof(cloudabi32_ciovec_t) == 4, "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(4) uint32_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(4) uint32_t lock;
} lock;
struct {
_Alignas(4) cloudabi_fd_t fd;
_Alignas(1) cloudabi_signal_t signal;
_Alignas(4) cloudabi_exitcode_t exitcode;
} proc_terminate;
};
} cloudabi32_event_t;
_Static_assert(offsetof(cloudabi32_event_t, userdata) == 0, "Incorrect layout");
_Static_assert(offsetof(cloudabi32_event_t, error) == 8, "Incorrect layout");
_Static_assert(offsetof(cloudabi32_event_t, type) == 10, "Incorrect layout");
_Static_assert(offsetof(cloudabi32_event_t, clock.identifier) == 16, "Incorrect layout");
_Static_assert(offsetof(cloudabi32_event_t, condvar.condvar) == 16, "Incorrect layout");
_Static_assert(offsetof(cloudabi32_event_t, fd_readwrite.nbytes) == 16, "Incorrect layout");
_Static_assert(offsetof(cloudabi32_event_t, fd_readwrite.fd) == 24, "Incorrect layout");
_Static_assert(offsetof(cloudabi32_event_t, fd_readwrite.flags) == 28, "Incorrect layout");
_Static_assert(offsetof(cloudabi32_event_t, lock.lock) == 16, "Incorrect layout");
_Static_assert(offsetof(cloudabi32_event_t, proc_terminate.fd) == 16, "Incorrect layout");
_Static_assert(offsetof(cloudabi32_event_t, proc_terminate.signal) == 20, "Incorrect layout");
_Static_assert(offsetof(cloudabi32_event_t, proc_terminate.exitcode) == 24, "Incorrect layout");
_Static_assert(sizeof(cloudabi32_event_t) == 32, "Incorrect layout");
_Static_assert(_Alignof(cloudabi32_event_t) == 8, "Incorrect layout");
typedef struct {
_Alignas(4) uint32_t buf;
_Alignas(4) uint32_t buf_len;

View File

@ -52,47 +52,6 @@ _Static_assert(offsetof(cloudabi64_ciovec_t, buf_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 buf;
_Alignas(8) uint64_t buf_len;

View File

@ -56,6 +56,7 @@ typedef uint32_t cloudabi_auxtype_t;
#define CLOUDABI_AT_PAGESZ 6
#define CLOUDABI_AT_PHDR 3
#define CLOUDABI_AT_PHNUM 4
#define CLOUDABI_AT_PID 263
#define CLOUDABI_AT_SYSINFO_EHDR 262
#define CLOUDABI_AT_TID 261
@ -352,6 +353,35 @@ _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(8) cloudabi_userdata_t userdata;
_Alignas(2) cloudabi_errno_t error;
_Alignas(1) cloudabi_eventtype_t type;
union {
struct {
_Alignas(8) cloudabi_filesize_t nbytes;
_Alignas(1) char unused[4];
_Alignas(2) cloudabi_eventrwflags_t flags;
} fd_readwrite;
struct {
_Alignas(1) char unused[4];
_Alignas(1) cloudabi_signal_t signal;
_Alignas(4) cloudabi_exitcode_t exitcode;
} proc_terminate;
};
} cloudabi_event_t;
_Static_assert(offsetof(cloudabi_event_t, userdata) == 0, "Incorrect layout");
_Static_assert(offsetof(cloudabi_event_t, error) == 8, "Incorrect layout");
_Static_assert(offsetof(cloudabi_event_t, type) == 10, "Incorrect layout");
_Static_assert(offsetof(cloudabi_event_t, fd_readwrite.nbytes) == 16, "Incorrect layout");
_Static_assert(offsetof(cloudabi_event_t, fd_readwrite.unused) == 24, "Incorrect layout");
_Static_assert(offsetof(cloudabi_event_t, fd_readwrite.flags) == 28, "Incorrect layout");
_Static_assert(offsetof(cloudabi_event_t, proc_terminate.unused) == 16, "Incorrect layout");
_Static_assert(offsetof(cloudabi_event_t, proc_terminate.signal) == 20, "Incorrect layout");
_Static_assert(offsetof(cloudabi_event_t, proc_terminate.exitcode) == 24, "Incorrect layout");
_Static_assert(sizeof(cloudabi_event_t) == 32, "Incorrect layout");
_Static_assert(_Alignof(cloudabi_event_t) == 8, "Incorrect layout");
typedef struct {
_Alignas(1) cloudabi_filetype_t fs_filetype;
_Alignas(2) cloudabi_fdflags_t fs_flags;

View File

@ -228,7 +228,7 @@
37 AUE_NULL STD { size_t cloudabi32_sys_poll( \
const cloudabi32_subscription_t *in, \
cloudabi32_event_t *out, \
cloudabi_event_t *out, \
size_t nsubscriptions); }
38 AUE_NULL STD { void cloudabi_sys_proc_exec( \

View File

@ -228,7 +228,7 @@
37 AUE_NULL STD { size_t cloudabi64_sys_poll( \
const cloudabi64_subscription_t *in, \
cloudabi64_event_t *out, \
cloudabi_event_t *out, \
size_t nsubscriptions); }
38 AUE_NULL STD { void cloudabi_sys_proc_exec( \