Index: head/sys/compat/cloudabi/cloudabi_thread.c =================================================================== --- head/sys/compat/cloudabi/cloudabi_thread.c (revision 304477) +++ head/sys/compat/cloudabi/cloudabi_thread.c (revision 304478) @@ -1,77 +1,69 @@ /*- * 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. */ #include __FBSDID("$FreeBSD$"); #include #include #include #include #include #include #include int cloudabi_sys_thread_exit(struct thread *td, struct cloudabi_sys_thread_exit_args *uap) { struct cloudabi_sys_lock_unlock_args cloudabi_sys_lock_unlock_args = { .lock = uap->lock, .scope = uap->scope, }; umtx_thread_exit(td); /* Wake up joining thread. */ cloudabi_sys_lock_unlock(td, &cloudabi_sys_lock_unlock_args); /* * Attempt to terminate the thread. Terminate the process if * it's the last thread. */ kern_thr_exit(td); exit1(td, 0, 0); /* NOTREACHED */ } int -cloudabi_sys_thread_tcb_set(struct thread *td, - struct cloudabi_sys_thread_tcb_set_args *uap) -{ - - return (cpu_set_user_tls(td, uap->tcb)); -} - -int cloudabi_sys_thread_yield(struct thread *td, struct cloudabi_sys_thread_yield_args *uap) { sched_relinquish(td); return (0); } Index: head/sys/compat/cloudabi64/Makefile =================================================================== --- head/sys/compat/cloudabi64/Makefile (revision 304477) +++ head/sys/compat/cloudabi64/Makefile (revision 304478) @@ -1,14 +1,14 @@ # $FreeBSD$ all: @echo "make sysent only" sysent: cloudabi64_sysent.c cloudabi64_syscall.h cloudabi64_proto.h \ cloudabi64_syscalls.c cloudabi64_systrace_args.c cloudabi64_sysent.c cloudabi64_syscall.h cloudabi64_proto.h \ cloudabi64_syscalls.c cloudabi64_systrace_args.c: \ - ../../kern/makesyscalls.sh ../../contrib/cloudabi/syscalls.master \ + ../../kern/makesyscalls.sh ../../contrib/cloudabi/syscalls64.master \ syscalls.conf - sh ../../kern/makesyscalls.sh ../../contrib/cloudabi/syscalls.master \ + sh ../../kern/makesyscalls.sh ../../contrib/cloudabi/syscalls64.master \ syscalls.conf Index: head/sys/compat/cloudabi64/cloudabi64_proto.h =================================================================== --- head/sys/compat/cloudabi64/cloudabi64_proto.h (revision 304477) +++ head/sys/compat/cloudabi64/cloudabi64_proto.h (revision 304478) @@ -1,464 +1,465 @@ /* * System call prototypes. * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/contrib/cloudabi/syscalls.master 297468 2016-03-31 18:50:06Z ed + * created from FreeBSD */ #ifndef _CLOUDABI64_SYSPROTO_H_ #define _CLOUDABI64_SYSPROTO_H_ #include #include #include #include #include #include #include #include struct proc; struct thread; #define PAD_(t) (sizeof(register_t) <= sizeof(t) ? \ 0 : sizeof(register_t) - sizeof(t)) #if BYTE_ORDER == LITTLE_ENDIAN #define PADL_(t) 0 #define PADR_(t) PAD_(t) #else #define PADL_(t) PAD_(t) #define PADR_(t) 0 #endif struct cloudabi_sys_clock_res_get_args { char clock_id_l_[PADL_(cloudabi_clockid_t)]; cloudabi_clockid_t clock_id; char clock_id_r_[PADR_(cloudabi_clockid_t)]; }; struct cloudabi_sys_clock_time_get_args { char clock_id_l_[PADL_(cloudabi_clockid_t)]; cloudabi_clockid_t clock_id; char clock_id_r_[PADR_(cloudabi_clockid_t)]; char precision_l_[PADL_(cloudabi_timestamp_t)]; cloudabi_timestamp_t precision; char precision_r_[PADR_(cloudabi_timestamp_t)]; }; struct cloudabi_sys_condvar_signal_args { char condvar_l_[PADL_(cloudabi_condvar_t *)]; cloudabi_condvar_t * condvar; char condvar_r_[PADR_(cloudabi_condvar_t *)]; char scope_l_[PADL_(cloudabi_scope_t)]; cloudabi_scope_t scope; char scope_r_[PADR_(cloudabi_scope_t)]; char nwaiters_l_[PADL_(cloudabi_nthreads_t)]; cloudabi_nthreads_t nwaiters; char nwaiters_r_[PADR_(cloudabi_nthreads_t)]; }; struct cloudabi_sys_fd_close_args { char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; }; struct cloudabi_sys_fd_create1_args { char type_l_[PADL_(cloudabi_filetype_t)]; cloudabi_filetype_t type; char type_r_[PADR_(cloudabi_filetype_t)]; }; struct cloudabi_sys_fd_create2_args { char type_l_[PADL_(cloudabi_filetype_t)]; cloudabi_filetype_t type; char type_r_[PADR_(cloudabi_filetype_t)]; }; struct cloudabi_sys_fd_datasync_args { char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; }; struct cloudabi_sys_fd_dup_args { char from_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t from; char from_r_[PADR_(cloudabi_fd_t)]; }; struct cloudabi64_sys_fd_pread_args { char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; char iov_l_[PADL_(const cloudabi64_iovec_t *)]; const cloudabi64_iovec_t * iov; char iov_r_[PADR_(const cloudabi64_iovec_t *)]; char iovcnt_l_[PADL_(size_t)]; size_t iovcnt; char iovcnt_r_[PADR_(size_t)]; char offset_l_[PADL_(cloudabi_filesize_t)]; cloudabi_filesize_t offset; char offset_r_[PADR_(cloudabi_filesize_t)]; }; struct cloudabi64_sys_fd_pwrite_args { char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; char iov_l_[PADL_(const cloudabi64_ciovec_t *)]; const cloudabi64_ciovec_t * iov; char iov_r_[PADR_(const cloudabi64_ciovec_t *)]; char iovcnt_l_[PADL_(size_t)]; size_t iovcnt; char iovcnt_r_[PADR_(size_t)]; char offset_l_[PADL_(cloudabi_filesize_t)]; cloudabi_filesize_t offset; char offset_r_[PADR_(cloudabi_filesize_t)]; }; struct cloudabi64_sys_fd_read_args { char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; char iov_l_[PADL_(const cloudabi64_iovec_t *)]; const cloudabi64_iovec_t * iov; char iov_r_[PADR_(const cloudabi64_iovec_t *)]; char iovcnt_l_[PADL_(size_t)]; size_t iovcnt; char iovcnt_r_[PADR_(size_t)]; }; struct cloudabi_sys_fd_replace_args { char from_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t from; char from_r_[PADR_(cloudabi_fd_t)]; char to_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t to; char to_r_[PADR_(cloudabi_fd_t)]; }; struct cloudabi_sys_fd_seek_args { char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; char offset_l_[PADL_(cloudabi_filedelta_t)]; cloudabi_filedelta_t offset; char offset_r_[PADR_(cloudabi_filedelta_t)]; char whence_l_[PADL_(cloudabi_whence_t)]; cloudabi_whence_t whence; char whence_r_[PADR_(cloudabi_whence_t)]; }; struct cloudabi_sys_fd_stat_get_args { char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; char buf_l_[PADL_(cloudabi_fdstat_t *)]; cloudabi_fdstat_t * buf; char buf_r_[PADR_(cloudabi_fdstat_t *)]; }; struct cloudabi_sys_fd_stat_put_args { char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; char buf_l_[PADL_(const cloudabi_fdstat_t *)]; const cloudabi_fdstat_t * buf; char buf_r_[PADR_(const cloudabi_fdstat_t *)]; char flags_l_[PADL_(cloudabi_fdsflags_t)]; cloudabi_fdsflags_t flags; char flags_r_[PADR_(cloudabi_fdsflags_t)]; }; struct cloudabi_sys_fd_sync_args { char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; }; struct cloudabi64_sys_fd_write_args { char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; char iov_l_[PADL_(const cloudabi64_ciovec_t *)]; const cloudabi64_ciovec_t * iov; char iov_r_[PADR_(const cloudabi64_ciovec_t *)]; char iovcnt_l_[PADL_(size_t)]; size_t iovcnt; char iovcnt_r_[PADR_(size_t)]; }; struct cloudabi_sys_file_advise_args { char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; char offset_l_[PADL_(cloudabi_filesize_t)]; cloudabi_filesize_t offset; char offset_r_[PADR_(cloudabi_filesize_t)]; char len_l_[PADL_(cloudabi_filesize_t)]; cloudabi_filesize_t len; char len_r_[PADR_(cloudabi_filesize_t)]; char advice_l_[PADL_(cloudabi_advice_t)]; cloudabi_advice_t advice; char advice_r_[PADR_(cloudabi_advice_t)]; }; struct cloudabi_sys_file_allocate_args { char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; char offset_l_[PADL_(cloudabi_filesize_t)]; cloudabi_filesize_t offset; char offset_r_[PADR_(cloudabi_filesize_t)]; char len_l_[PADL_(cloudabi_filesize_t)]; cloudabi_filesize_t len; char len_r_[PADR_(cloudabi_filesize_t)]; }; struct cloudabi_sys_file_create_args { char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; char pathlen_l_[PADL_(size_t)]; size_t pathlen; char pathlen_r_[PADR_(size_t)]; char type_l_[PADL_(cloudabi_filetype_t)]; cloudabi_filetype_t type; char type_r_[PADR_(cloudabi_filetype_t)]; }; struct cloudabi_sys_file_link_args { char fd1_l_[PADL_(cloudabi_lookup_t)]; cloudabi_lookup_t fd1; char fd1_r_[PADR_(cloudabi_lookup_t)]; char path1_l_[PADL_(const char *)]; const char * path1; char path1_r_[PADR_(const char *)]; char path1len_l_[PADL_(size_t)]; size_t path1len; char path1len_r_[PADR_(size_t)]; char fd2_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd2; char fd2_r_[PADR_(cloudabi_fd_t)]; char path2_l_[PADL_(const char *)]; const char * path2; char path2_r_[PADR_(const char *)]; char path2len_l_[PADL_(size_t)]; size_t path2len; char path2len_r_[PADR_(size_t)]; }; struct cloudabi_sys_file_open_args { char dirfd_l_[PADL_(cloudabi_lookup_t)]; cloudabi_lookup_t dirfd; char dirfd_r_[PADR_(cloudabi_lookup_t)]; char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; char pathlen_l_[PADL_(size_t)]; size_t pathlen; char pathlen_r_[PADR_(size_t)]; char oflags_l_[PADL_(cloudabi_oflags_t)]; cloudabi_oflags_t oflags; char oflags_r_[PADR_(cloudabi_oflags_t)]; char fds_l_[PADL_(const cloudabi_fdstat_t *)]; const cloudabi_fdstat_t * fds; char fds_r_[PADR_(const cloudabi_fdstat_t *)]; }; struct cloudabi_sys_file_readdir_args { char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; char buf_l_[PADL_(void *)]; void * buf; char buf_r_[PADR_(void *)]; char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)]; char cookie_l_[PADL_(cloudabi_dircookie_t)]; cloudabi_dircookie_t cookie; char cookie_r_[PADR_(cloudabi_dircookie_t)]; }; struct cloudabi_sys_file_readlink_args { char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; char pathlen_l_[PADL_(size_t)]; size_t pathlen; char pathlen_r_[PADR_(size_t)]; char buf_l_[PADL_(char *)]; char * buf; char buf_r_[PADR_(char *)]; char bufsize_l_[PADL_(size_t)]; size_t bufsize; char bufsize_r_[PADR_(size_t)]; }; struct cloudabi_sys_file_rename_args { char oldfd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t oldfd; char oldfd_r_[PADR_(cloudabi_fd_t)]; char old_l_[PADL_(const char *)]; const char * old; char old_r_[PADR_(const char *)]; char oldlen_l_[PADL_(size_t)]; size_t oldlen; char oldlen_r_[PADR_(size_t)]; char newfd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t newfd; char newfd_r_[PADR_(cloudabi_fd_t)]; char new_l_[PADL_(const char *)]; const char * new; char new_r_[PADR_(const char *)]; char newlen_l_[PADL_(size_t)]; size_t newlen; char newlen_r_[PADR_(size_t)]; }; struct cloudabi_sys_file_stat_fget_args { char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; char buf_l_[PADL_(cloudabi_filestat_t *)]; cloudabi_filestat_t * buf; char buf_r_[PADR_(cloudabi_filestat_t *)]; }; struct cloudabi_sys_file_stat_fput_args { char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; char buf_l_[PADL_(const cloudabi_filestat_t *)]; const cloudabi_filestat_t * buf; char buf_r_[PADR_(const cloudabi_filestat_t *)]; char flags_l_[PADL_(cloudabi_fsflags_t)]; cloudabi_fsflags_t flags; char flags_r_[PADR_(cloudabi_fsflags_t)]; }; struct cloudabi_sys_file_stat_get_args { char fd_l_[PADL_(cloudabi_lookup_t)]; cloudabi_lookup_t fd; char fd_r_[PADR_(cloudabi_lookup_t)]; char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; char pathlen_l_[PADL_(size_t)]; size_t pathlen; char pathlen_r_[PADR_(size_t)]; char buf_l_[PADL_(cloudabi_filestat_t *)]; cloudabi_filestat_t * buf; char buf_r_[PADR_(cloudabi_filestat_t *)]; }; struct cloudabi_sys_file_stat_put_args { char fd_l_[PADL_(cloudabi_lookup_t)]; cloudabi_lookup_t fd; char fd_r_[PADR_(cloudabi_lookup_t)]; char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; char pathlen_l_[PADL_(size_t)]; size_t pathlen; char pathlen_r_[PADR_(size_t)]; char buf_l_[PADL_(const cloudabi_filestat_t *)]; const cloudabi_filestat_t * buf; char buf_r_[PADR_(const cloudabi_filestat_t *)]; char flags_l_[PADL_(cloudabi_fsflags_t)]; cloudabi_fsflags_t flags; char flags_r_[PADR_(cloudabi_fsflags_t)]; }; struct cloudabi_sys_file_symlink_args { char path1_l_[PADL_(const char *)]; const char * path1; char path1_r_[PADR_(const char *)]; char path1len_l_[PADL_(size_t)]; size_t path1len; char path1len_r_[PADR_(size_t)]; char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; char path2_l_[PADL_(const char *)]; const char * path2; char path2_r_[PADR_(const char *)]; char path2len_l_[PADL_(size_t)]; size_t path2len; char path2len_r_[PADR_(size_t)]; }; struct cloudabi_sys_file_unlink_args { char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; char pathlen_l_[PADL_(size_t)]; size_t pathlen; char pathlen_r_[PADR_(size_t)]; char flags_l_[PADL_(cloudabi_ulflags_t)]; cloudabi_ulflags_t flags; char flags_r_[PADR_(cloudabi_ulflags_t)]; }; struct cloudabi_sys_lock_unlock_args { char lock_l_[PADL_(cloudabi_lock_t *)]; cloudabi_lock_t * lock; char lock_r_[PADR_(cloudabi_lock_t *)]; char scope_l_[PADL_(cloudabi_scope_t)]; cloudabi_scope_t scope; char scope_r_[PADR_(cloudabi_scope_t)]; }; struct cloudabi_sys_mem_advise_args { char addr_l_[PADL_(void *)]; void * addr; char addr_r_[PADR_(void *)]; char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; char advice_l_[PADL_(cloudabi_advice_t)]; cloudabi_advice_t advice; char advice_r_[PADR_(cloudabi_advice_t)]; }; struct cloudabi_sys_mem_lock_args { char addr_l_[PADL_(const void *)]; const void * addr; char addr_r_[PADR_(const void *)]; char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; }; struct cloudabi_sys_mem_map_args { char addr_l_[PADL_(void *)]; void * addr; char addr_r_[PADR_(void *)]; char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; char prot_l_[PADL_(cloudabi_mprot_t)]; cloudabi_mprot_t prot; char prot_r_[PADR_(cloudabi_mprot_t)]; char flags_l_[PADL_(cloudabi_mflags_t)]; cloudabi_mflags_t flags; char flags_r_[PADR_(cloudabi_mflags_t)]; char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; char off_l_[PADL_(cloudabi_filesize_t)]; cloudabi_filesize_t off; char off_r_[PADR_(cloudabi_filesize_t)]; }; struct cloudabi_sys_mem_protect_args { char addr_l_[PADL_(void *)]; void * addr; char addr_r_[PADR_(void *)]; char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; char prot_l_[PADL_(cloudabi_mprot_t)]; cloudabi_mprot_t prot; char prot_r_[PADR_(cloudabi_mprot_t)]; }; struct cloudabi_sys_mem_sync_args { char addr_l_[PADL_(void *)]; void * addr; char addr_r_[PADR_(void *)]; char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; char flags_l_[PADL_(cloudabi_msflags_t)]; cloudabi_msflags_t flags; char flags_r_[PADR_(cloudabi_msflags_t)]; }; struct cloudabi_sys_mem_unlock_args { char addr_l_[PADL_(const void *)]; const void * addr; char addr_r_[PADR_(const void *)]; char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; }; struct cloudabi_sys_mem_unmap_args { char addr_l_[PADL_(void *)]; void * addr; char addr_r_[PADR_(void *)]; char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; }; 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 nsubscriptions_l_[PADL_(size_t)]; size_t nsubscriptions; char nsubscriptions_r_[PADR_(size_t)]; }; +struct cloudabi64_sys_poll_fd_args { + char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; + char in_l_[PADL_(const cloudabi64_subscription_t *)]; const cloudabi64_subscription_t * in; char in_r_[PADR_(const cloudabi64_subscription_t *)]; + char nin_l_[PADL_(size_t)]; size_t nin; char nin_r_[PADR_(size_t)]; + char out_l_[PADL_(cloudabi64_event_t *)]; cloudabi64_event_t * out; char out_r_[PADR_(cloudabi64_event_t *)]; + char nout_l_[PADL_(size_t)]; size_t nout; char nout_r_[PADR_(size_t)]; + char timeout_l_[PADL_(const cloudabi64_subscription_t *)]; const cloudabi64_subscription_t * timeout; char timeout_r_[PADR_(const cloudabi64_subscription_t *)]; +}; struct cloudabi_sys_proc_exec_args { char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; char data_l_[PADL_(const void *)]; const void * data; char data_r_[PADR_(const void *)]; char datalen_l_[PADL_(size_t)]; size_t datalen; char datalen_r_[PADR_(size_t)]; char fds_l_[PADL_(const cloudabi_fd_t *)]; const cloudabi_fd_t * fds; char fds_r_[PADR_(const cloudabi_fd_t *)]; char fdslen_l_[PADL_(size_t)]; size_t fdslen; char fdslen_r_[PADR_(size_t)]; }; struct cloudabi_sys_proc_exit_args { char rval_l_[PADL_(cloudabi_exitcode_t)]; cloudabi_exitcode_t rval; char rval_r_[PADR_(cloudabi_exitcode_t)]; }; struct cloudabi_sys_proc_fork_args { register_t dummy; }; struct cloudabi_sys_proc_raise_args { char sig_l_[PADL_(cloudabi_signal_t)]; cloudabi_signal_t sig; char sig_r_[PADR_(cloudabi_signal_t)]; }; struct cloudabi_sys_random_get_args { char buf_l_[PADL_(void *)]; void * buf; char buf_r_[PADR_(void *)]; char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)]; }; struct cloudabi_sys_sock_accept_args { char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)]; char buf_l_[PADL_(cloudabi_sockstat_t *)]; cloudabi_sockstat_t * buf; char buf_r_[PADR_(cloudabi_sockstat_t *)]; }; struct cloudabi_sys_sock_bind_args { char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)]; char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; char pathlen_l_[PADL_(size_t)]; size_t pathlen; char pathlen_r_[PADR_(size_t)]; }; struct cloudabi_sys_sock_connect_args { char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)]; char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; char pathlen_l_[PADL_(size_t)]; size_t pathlen; char pathlen_r_[PADR_(size_t)]; }; struct cloudabi_sys_sock_listen_args { char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)]; char backlog_l_[PADL_(cloudabi_backlog_t)]; cloudabi_backlog_t backlog; char backlog_r_[PADR_(cloudabi_backlog_t)]; }; struct cloudabi64_sys_sock_recv_args { char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)]; char in_l_[PADL_(const cloudabi64_recv_in_t *)]; const cloudabi64_recv_in_t * in; char in_r_[PADR_(const cloudabi64_recv_in_t *)]; char out_l_[PADL_(cloudabi64_recv_out_t *)]; cloudabi64_recv_out_t * out; char out_r_[PADR_(cloudabi64_recv_out_t *)]; }; struct cloudabi64_sys_sock_send_args { char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)]; char in_l_[PADL_(const cloudabi64_send_in_t *)]; const cloudabi64_send_in_t * in; char in_r_[PADR_(const cloudabi64_send_in_t *)]; char out_l_[PADL_(cloudabi64_send_out_t *)]; cloudabi64_send_out_t * out; char out_r_[PADR_(cloudabi64_send_out_t *)]; }; struct cloudabi_sys_sock_shutdown_args { char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)]; char how_l_[PADL_(cloudabi_sdflags_t)]; cloudabi_sdflags_t how; char how_r_[PADR_(cloudabi_sdflags_t)]; }; struct cloudabi_sys_sock_stat_get_args { char sock_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t sock; char sock_r_[PADR_(cloudabi_fd_t)]; char buf_l_[PADL_(cloudabi_sockstat_t *)]; cloudabi_sockstat_t * buf; char buf_r_[PADR_(cloudabi_sockstat_t *)]; char flags_l_[PADL_(cloudabi_ssflags_t)]; cloudabi_ssflags_t flags; char flags_r_[PADR_(cloudabi_ssflags_t)]; }; struct cloudabi64_sys_thread_create_args { char attr_l_[PADL_(cloudabi64_threadattr_t *)]; cloudabi64_threadattr_t * attr; char attr_r_[PADR_(cloudabi64_threadattr_t *)]; }; struct cloudabi_sys_thread_exit_args { char lock_l_[PADL_(cloudabi_lock_t *)]; cloudabi_lock_t * lock; char lock_r_[PADR_(cloudabi_lock_t *)]; char scope_l_[PADL_(cloudabi_scope_t)]; cloudabi_scope_t scope; char scope_r_[PADR_(cloudabi_scope_t)]; }; -struct cloudabi_sys_thread_tcb_set_args { - char tcb_l_[PADL_(void *)]; void * tcb; char tcb_r_[PADR_(void *)]; -}; struct cloudabi_sys_thread_yield_args { register_t dummy; }; -struct cloudabi64_sys_poll_fd_args { - char fd_l_[PADL_(cloudabi_fd_t)]; cloudabi_fd_t fd; char fd_r_[PADR_(cloudabi_fd_t)]; - char in_l_[PADL_(const cloudabi64_subscription_t *)]; const cloudabi64_subscription_t * in; char in_r_[PADR_(const cloudabi64_subscription_t *)]; - char nin_l_[PADL_(size_t)]; size_t nin; char nin_r_[PADR_(size_t)]; - char out_l_[PADL_(cloudabi64_event_t *)]; cloudabi64_event_t * out; char out_r_[PADR_(cloudabi64_event_t *)]; - char nout_l_[PADL_(size_t)]; size_t nout; char nout_r_[PADR_(size_t)]; - char timeout_l_[PADL_(const cloudabi64_subscription_t *)]; const cloudabi64_subscription_t * timeout; char timeout_r_[PADR_(const cloudabi64_subscription_t *)]; -}; int cloudabi_sys_clock_res_get(struct thread *, struct cloudabi_sys_clock_res_get_args *); int cloudabi_sys_clock_time_get(struct thread *, struct cloudabi_sys_clock_time_get_args *); int cloudabi_sys_condvar_signal(struct thread *, struct cloudabi_sys_condvar_signal_args *); int cloudabi_sys_fd_close(struct thread *, struct cloudabi_sys_fd_close_args *); int cloudabi_sys_fd_create1(struct thread *, struct cloudabi_sys_fd_create1_args *); int cloudabi_sys_fd_create2(struct thread *, struct cloudabi_sys_fd_create2_args *); int cloudabi_sys_fd_datasync(struct thread *, struct cloudabi_sys_fd_datasync_args *); int cloudabi_sys_fd_dup(struct thread *, struct cloudabi_sys_fd_dup_args *); int cloudabi64_sys_fd_pread(struct thread *, struct cloudabi64_sys_fd_pread_args *); int cloudabi64_sys_fd_pwrite(struct thread *, struct cloudabi64_sys_fd_pwrite_args *); int cloudabi64_sys_fd_read(struct thread *, struct cloudabi64_sys_fd_read_args *); int cloudabi_sys_fd_replace(struct thread *, struct cloudabi_sys_fd_replace_args *); int cloudabi_sys_fd_seek(struct thread *, struct cloudabi_sys_fd_seek_args *); int cloudabi_sys_fd_stat_get(struct thread *, struct cloudabi_sys_fd_stat_get_args *); int cloudabi_sys_fd_stat_put(struct thread *, struct cloudabi_sys_fd_stat_put_args *); int cloudabi_sys_fd_sync(struct thread *, struct cloudabi_sys_fd_sync_args *); int cloudabi64_sys_fd_write(struct thread *, struct cloudabi64_sys_fd_write_args *); int cloudabi_sys_file_advise(struct thread *, struct cloudabi_sys_file_advise_args *); int cloudabi_sys_file_allocate(struct thread *, struct cloudabi_sys_file_allocate_args *); int cloudabi_sys_file_create(struct thread *, struct cloudabi_sys_file_create_args *); int cloudabi_sys_file_link(struct thread *, struct cloudabi_sys_file_link_args *); int cloudabi_sys_file_open(struct thread *, struct cloudabi_sys_file_open_args *); int cloudabi_sys_file_readdir(struct thread *, struct cloudabi_sys_file_readdir_args *); int cloudabi_sys_file_readlink(struct thread *, struct cloudabi_sys_file_readlink_args *); int cloudabi_sys_file_rename(struct thread *, struct cloudabi_sys_file_rename_args *); int cloudabi_sys_file_stat_fget(struct thread *, struct cloudabi_sys_file_stat_fget_args *); int cloudabi_sys_file_stat_fput(struct thread *, struct cloudabi_sys_file_stat_fput_args *); int cloudabi_sys_file_stat_get(struct thread *, struct cloudabi_sys_file_stat_get_args *); int cloudabi_sys_file_stat_put(struct thread *, struct cloudabi_sys_file_stat_put_args *); int cloudabi_sys_file_symlink(struct thread *, struct cloudabi_sys_file_symlink_args *); int cloudabi_sys_file_unlink(struct thread *, struct cloudabi_sys_file_unlink_args *); int cloudabi_sys_lock_unlock(struct thread *, struct cloudabi_sys_lock_unlock_args *); int cloudabi_sys_mem_advise(struct thread *, struct cloudabi_sys_mem_advise_args *); int cloudabi_sys_mem_lock(struct thread *, struct cloudabi_sys_mem_lock_args *); int cloudabi_sys_mem_map(struct thread *, struct cloudabi_sys_mem_map_args *); int cloudabi_sys_mem_protect(struct thread *, struct cloudabi_sys_mem_protect_args *); int cloudabi_sys_mem_sync(struct thread *, struct cloudabi_sys_mem_sync_args *); int cloudabi_sys_mem_unlock(struct thread *, struct cloudabi_sys_mem_unlock_args *); int cloudabi_sys_mem_unmap(struct thread *, struct cloudabi_sys_mem_unmap_args *); int cloudabi64_sys_poll(struct thread *, struct cloudabi64_sys_poll_args *); +int cloudabi64_sys_poll_fd(struct thread *, struct cloudabi64_sys_poll_fd_args *); int cloudabi_sys_proc_exec(struct thread *, struct cloudabi_sys_proc_exec_args *); int cloudabi_sys_proc_exit(struct thread *, struct cloudabi_sys_proc_exit_args *); int cloudabi_sys_proc_fork(struct thread *, struct cloudabi_sys_proc_fork_args *); int cloudabi_sys_proc_raise(struct thread *, struct cloudabi_sys_proc_raise_args *); int cloudabi_sys_random_get(struct thread *, struct cloudabi_sys_random_get_args *); int cloudabi_sys_sock_accept(struct thread *, struct cloudabi_sys_sock_accept_args *); int cloudabi_sys_sock_bind(struct thread *, struct cloudabi_sys_sock_bind_args *); int cloudabi_sys_sock_connect(struct thread *, struct cloudabi_sys_sock_connect_args *); int cloudabi_sys_sock_listen(struct thread *, struct cloudabi_sys_sock_listen_args *); int cloudabi64_sys_sock_recv(struct thread *, struct cloudabi64_sys_sock_recv_args *); int cloudabi64_sys_sock_send(struct thread *, struct cloudabi64_sys_sock_send_args *); int cloudabi_sys_sock_shutdown(struct thread *, struct cloudabi_sys_sock_shutdown_args *); int cloudabi_sys_sock_stat_get(struct thread *, struct cloudabi_sys_sock_stat_get_args *); int cloudabi64_sys_thread_create(struct thread *, struct cloudabi64_sys_thread_create_args *); int cloudabi_sys_thread_exit(struct thread *, struct cloudabi_sys_thread_exit_args *); -int cloudabi_sys_thread_tcb_set(struct thread *, struct cloudabi_sys_thread_tcb_set_args *); int cloudabi_sys_thread_yield(struct thread *, struct cloudabi_sys_thread_yield_args *); -int cloudabi64_sys_poll_fd(struct thread *, struct cloudabi64_sys_poll_fd_args *); #ifdef COMPAT_43 #endif /* COMPAT_43 */ #ifdef COMPAT_FREEBSD4 #endif /* COMPAT_FREEBSD4 */ #ifdef COMPAT_FREEBSD6 #endif /* COMPAT_FREEBSD6 */ #ifdef COMPAT_FREEBSD7 #endif /* COMPAT_FREEBSD7 */ + +#ifdef COMPAT_FREEBSD10 + + +#endif /* COMPAT_FREEBSD10 */ + #define CLOUDABI64_SYS_AUE_cloudabi_sys_clock_res_get AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_clock_time_get AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_condvar_signal AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_fd_close AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_fd_create1 AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_fd_create2 AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_fd_datasync AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_fd_dup AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi64_sys_fd_pread AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi64_sys_fd_pwrite AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi64_sys_fd_read AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_fd_replace AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_fd_seek AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_fd_stat_get AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_fd_stat_put AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_fd_sync AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi64_sys_fd_write AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_file_advise AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_file_allocate AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_file_create AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_file_link AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_file_open AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_file_readdir AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_file_readlink AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_file_rename AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_file_stat_fget AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_file_stat_fput AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_file_stat_get AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_file_stat_put AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_file_symlink AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_file_unlink AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_lock_unlock AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_mem_advise AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_mem_lock AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_mem_map AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_mem_protect AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_mem_sync AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_mem_unlock AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_mem_unmap AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi64_sys_poll AUE_NULL +#define CLOUDABI64_SYS_AUE_cloudabi64_sys_poll_fd AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_proc_exec AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_proc_exit AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_proc_fork AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_proc_raise AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_random_get AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_sock_accept AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_sock_bind AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_sock_connect AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_sock_listen AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi64_sys_sock_recv AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi64_sys_sock_send AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_sock_shutdown AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_sock_stat_get AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi64_sys_thread_create AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_thread_exit AUE_NULL -#define CLOUDABI64_SYS_AUE_cloudabi_sys_thread_tcb_set AUE_NULL #define CLOUDABI64_SYS_AUE_cloudabi_sys_thread_yield AUE_NULL -#define CLOUDABI64_SYS_AUE_cloudabi64_sys_poll_fd AUE_NULL #undef PAD_ #undef PADL_ #undef PADR_ #endif /* !_CLOUDABI64_SYSPROTO_H_ */ Index: head/sys/compat/cloudabi64/cloudabi64_syscall.h =================================================================== --- head/sys/compat/cloudabi64/cloudabi64_syscall.h (revision 304477) +++ head/sys/compat/cloudabi64/cloudabi64_syscall.h (revision 304478) @@ -1,67 +1,66 @@ /* * System call numbers. * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/contrib/cloudabi/syscalls.master 297468 2016-03-31 18:50:06Z ed + * created from FreeBSD */ #define CLOUDABI64_SYS_cloudabi_sys_clock_res_get 0 #define CLOUDABI64_SYS_cloudabi_sys_clock_time_get 1 #define CLOUDABI64_SYS_cloudabi_sys_condvar_signal 2 #define CLOUDABI64_SYS_cloudabi_sys_fd_close 3 #define CLOUDABI64_SYS_cloudabi_sys_fd_create1 4 #define CLOUDABI64_SYS_cloudabi_sys_fd_create2 5 #define CLOUDABI64_SYS_cloudabi_sys_fd_datasync 6 #define CLOUDABI64_SYS_cloudabi_sys_fd_dup 7 #define CLOUDABI64_SYS_cloudabi64_sys_fd_pread 8 #define CLOUDABI64_SYS_cloudabi64_sys_fd_pwrite 9 #define CLOUDABI64_SYS_cloudabi64_sys_fd_read 10 #define CLOUDABI64_SYS_cloudabi_sys_fd_replace 11 #define CLOUDABI64_SYS_cloudabi_sys_fd_seek 12 #define CLOUDABI64_SYS_cloudabi_sys_fd_stat_get 13 #define CLOUDABI64_SYS_cloudabi_sys_fd_stat_put 14 #define CLOUDABI64_SYS_cloudabi_sys_fd_sync 15 #define CLOUDABI64_SYS_cloudabi64_sys_fd_write 16 #define CLOUDABI64_SYS_cloudabi_sys_file_advise 17 #define CLOUDABI64_SYS_cloudabi_sys_file_allocate 18 #define CLOUDABI64_SYS_cloudabi_sys_file_create 19 #define CLOUDABI64_SYS_cloudabi_sys_file_link 20 #define CLOUDABI64_SYS_cloudabi_sys_file_open 21 #define CLOUDABI64_SYS_cloudabi_sys_file_readdir 22 #define CLOUDABI64_SYS_cloudabi_sys_file_readlink 23 #define CLOUDABI64_SYS_cloudabi_sys_file_rename 24 #define CLOUDABI64_SYS_cloudabi_sys_file_stat_fget 25 #define CLOUDABI64_SYS_cloudabi_sys_file_stat_fput 26 #define CLOUDABI64_SYS_cloudabi_sys_file_stat_get 27 #define CLOUDABI64_SYS_cloudabi_sys_file_stat_put 28 #define CLOUDABI64_SYS_cloudabi_sys_file_symlink 29 #define CLOUDABI64_SYS_cloudabi_sys_file_unlink 30 #define CLOUDABI64_SYS_cloudabi_sys_lock_unlock 31 #define CLOUDABI64_SYS_cloudabi_sys_mem_advise 32 #define CLOUDABI64_SYS_cloudabi_sys_mem_lock 33 #define CLOUDABI64_SYS_cloudabi_sys_mem_map 34 #define CLOUDABI64_SYS_cloudabi_sys_mem_protect 35 #define CLOUDABI64_SYS_cloudabi_sys_mem_sync 36 #define CLOUDABI64_SYS_cloudabi_sys_mem_unlock 37 #define CLOUDABI64_SYS_cloudabi_sys_mem_unmap 38 #define CLOUDABI64_SYS_cloudabi64_sys_poll 39 -#define CLOUDABI64_SYS_cloudabi_sys_proc_exec 40 -#define CLOUDABI64_SYS_cloudabi_sys_proc_exit 41 -#define CLOUDABI64_SYS_cloudabi_sys_proc_fork 42 -#define CLOUDABI64_SYS_cloudabi_sys_proc_raise 43 -#define CLOUDABI64_SYS_cloudabi_sys_random_get 44 -#define CLOUDABI64_SYS_cloudabi_sys_sock_accept 45 -#define CLOUDABI64_SYS_cloudabi_sys_sock_bind 46 -#define CLOUDABI64_SYS_cloudabi_sys_sock_connect 47 -#define CLOUDABI64_SYS_cloudabi_sys_sock_listen 48 -#define CLOUDABI64_SYS_cloudabi64_sys_sock_recv 49 -#define CLOUDABI64_SYS_cloudabi64_sys_sock_send 50 -#define CLOUDABI64_SYS_cloudabi_sys_sock_shutdown 51 -#define CLOUDABI64_SYS_cloudabi_sys_sock_stat_get 52 -#define CLOUDABI64_SYS_cloudabi64_sys_thread_create 53 -#define CLOUDABI64_SYS_cloudabi_sys_thread_exit 54 -#define CLOUDABI64_SYS_cloudabi_sys_thread_tcb_set 55 +#define CLOUDABI64_SYS_cloudabi64_sys_poll_fd 40 +#define CLOUDABI64_SYS_cloudabi_sys_proc_exec 41 +#define CLOUDABI64_SYS_cloudabi_sys_proc_exit 42 +#define CLOUDABI64_SYS_cloudabi_sys_proc_fork 43 +#define CLOUDABI64_SYS_cloudabi_sys_proc_raise 44 +#define CLOUDABI64_SYS_cloudabi_sys_random_get 45 +#define CLOUDABI64_SYS_cloudabi_sys_sock_accept 46 +#define CLOUDABI64_SYS_cloudabi_sys_sock_bind 47 +#define CLOUDABI64_SYS_cloudabi_sys_sock_connect 48 +#define CLOUDABI64_SYS_cloudabi_sys_sock_listen 49 +#define CLOUDABI64_SYS_cloudabi64_sys_sock_recv 50 +#define CLOUDABI64_SYS_cloudabi64_sys_sock_send 51 +#define CLOUDABI64_SYS_cloudabi_sys_sock_shutdown 52 +#define CLOUDABI64_SYS_cloudabi_sys_sock_stat_get 53 +#define CLOUDABI64_SYS_cloudabi64_sys_thread_create 54 +#define CLOUDABI64_SYS_cloudabi_sys_thread_exit 55 #define CLOUDABI64_SYS_cloudabi_sys_thread_yield 56 -#define CLOUDABI64_SYS_cloudabi64_sys_poll_fd 57 -#define CLOUDABI64_SYS_MAXSYSCALL 58 +#define CLOUDABI64_SYS_MAXSYSCALL 57 Index: head/sys/compat/cloudabi64/cloudabi64_syscalls.c =================================================================== --- head/sys/compat/cloudabi64/cloudabi64_syscalls.c (revision 304477) +++ head/sys/compat/cloudabi64/cloudabi64_syscalls.c (revision 304478) @@ -1,68 +1,67 @@ /* * System call names. * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/contrib/cloudabi/syscalls.master 297468 2016-03-31 18:50:06Z ed + * created from FreeBSD */ const char *cloudabi64_syscallnames[] = { "cloudabi_sys_clock_res_get", /* 0 = cloudabi_sys_clock_res_get */ "cloudabi_sys_clock_time_get", /* 1 = cloudabi_sys_clock_time_get */ "cloudabi_sys_condvar_signal", /* 2 = cloudabi_sys_condvar_signal */ "cloudabi_sys_fd_close", /* 3 = cloudabi_sys_fd_close */ "cloudabi_sys_fd_create1", /* 4 = cloudabi_sys_fd_create1 */ "cloudabi_sys_fd_create2", /* 5 = cloudabi_sys_fd_create2 */ "cloudabi_sys_fd_datasync", /* 6 = cloudabi_sys_fd_datasync */ "cloudabi_sys_fd_dup", /* 7 = cloudabi_sys_fd_dup */ "cloudabi64_sys_fd_pread", /* 8 = cloudabi64_sys_fd_pread */ "cloudabi64_sys_fd_pwrite", /* 9 = cloudabi64_sys_fd_pwrite */ "cloudabi64_sys_fd_read", /* 10 = cloudabi64_sys_fd_read */ "cloudabi_sys_fd_replace", /* 11 = cloudabi_sys_fd_replace */ "cloudabi_sys_fd_seek", /* 12 = cloudabi_sys_fd_seek */ "cloudabi_sys_fd_stat_get", /* 13 = cloudabi_sys_fd_stat_get */ "cloudabi_sys_fd_stat_put", /* 14 = cloudabi_sys_fd_stat_put */ "cloudabi_sys_fd_sync", /* 15 = cloudabi_sys_fd_sync */ "cloudabi64_sys_fd_write", /* 16 = cloudabi64_sys_fd_write */ "cloudabi_sys_file_advise", /* 17 = cloudabi_sys_file_advise */ "cloudabi_sys_file_allocate", /* 18 = cloudabi_sys_file_allocate */ "cloudabi_sys_file_create", /* 19 = cloudabi_sys_file_create */ "cloudabi_sys_file_link", /* 20 = cloudabi_sys_file_link */ "cloudabi_sys_file_open", /* 21 = cloudabi_sys_file_open */ "cloudabi_sys_file_readdir", /* 22 = cloudabi_sys_file_readdir */ "cloudabi_sys_file_readlink", /* 23 = cloudabi_sys_file_readlink */ "cloudabi_sys_file_rename", /* 24 = cloudabi_sys_file_rename */ "cloudabi_sys_file_stat_fget", /* 25 = cloudabi_sys_file_stat_fget */ "cloudabi_sys_file_stat_fput", /* 26 = cloudabi_sys_file_stat_fput */ "cloudabi_sys_file_stat_get", /* 27 = cloudabi_sys_file_stat_get */ "cloudabi_sys_file_stat_put", /* 28 = cloudabi_sys_file_stat_put */ "cloudabi_sys_file_symlink", /* 29 = cloudabi_sys_file_symlink */ "cloudabi_sys_file_unlink", /* 30 = cloudabi_sys_file_unlink */ "cloudabi_sys_lock_unlock", /* 31 = cloudabi_sys_lock_unlock */ "cloudabi_sys_mem_advise", /* 32 = cloudabi_sys_mem_advise */ "cloudabi_sys_mem_lock", /* 33 = cloudabi_sys_mem_lock */ "cloudabi_sys_mem_map", /* 34 = cloudabi_sys_mem_map */ "cloudabi_sys_mem_protect", /* 35 = cloudabi_sys_mem_protect */ "cloudabi_sys_mem_sync", /* 36 = cloudabi_sys_mem_sync */ "cloudabi_sys_mem_unlock", /* 37 = cloudabi_sys_mem_unlock */ "cloudabi_sys_mem_unmap", /* 38 = cloudabi_sys_mem_unmap */ "cloudabi64_sys_poll", /* 39 = cloudabi64_sys_poll */ - "cloudabi_sys_proc_exec", /* 40 = cloudabi_sys_proc_exec */ - "cloudabi_sys_proc_exit", /* 41 = cloudabi_sys_proc_exit */ - "cloudabi_sys_proc_fork", /* 42 = cloudabi_sys_proc_fork */ - "cloudabi_sys_proc_raise", /* 43 = cloudabi_sys_proc_raise */ - "cloudabi_sys_random_get", /* 44 = cloudabi_sys_random_get */ - "cloudabi_sys_sock_accept", /* 45 = cloudabi_sys_sock_accept */ - "cloudabi_sys_sock_bind", /* 46 = cloudabi_sys_sock_bind */ - "cloudabi_sys_sock_connect", /* 47 = cloudabi_sys_sock_connect */ - "cloudabi_sys_sock_listen", /* 48 = cloudabi_sys_sock_listen */ - "cloudabi64_sys_sock_recv", /* 49 = cloudabi64_sys_sock_recv */ - "cloudabi64_sys_sock_send", /* 50 = cloudabi64_sys_sock_send */ - "cloudabi_sys_sock_shutdown", /* 51 = cloudabi_sys_sock_shutdown */ - "cloudabi_sys_sock_stat_get", /* 52 = cloudabi_sys_sock_stat_get */ - "cloudabi64_sys_thread_create", /* 53 = cloudabi64_sys_thread_create */ - "cloudabi_sys_thread_exit", /* 54 = cloudabi_sys_thread_exit */ - "cloudabi_sys_thread_tcb_set", /* 55 = cloudabi_sys_thread_tcb_set */ + "cloudabi64_sys_poll_fd", /* 40 = cloudabi64_sys_poll_fd */ + "cloudabi_sys_proc_exec", /* 41 = cloudabi_sys_proc_exec */ + "cloudabi_sys_proc_exit", /* 42 = cloudabi_sys_proc_exit */ + "cloudabi_sys_proc_fork", /* 43 = cloudabi_sys_proc_fork */ + "cloudabi_sys_proc_raise", /* 44 = cloudabi_sys_proc_raise */ + "cloudabi_sys_random_get", /* 45 = cloudabi_sys_random_get */ + "cloudabi_sys_sock_accept", /* 46 = cloudabi_sys_sock_accept */ + "cloudabi_sys_sock_bind", /* 47 = cloudabi_sys_sock_bind */ + "cloudabi_sys_sock_connect", /* 48 = cloudabi_sys_sock_connect */ + "cloudabi_sys_sock_listen", /* 49 = cloudabi_sys_sock_listen */ + "cloudabi64_sys_sock_recv", /* 50 = cloudabi64_sys_sock_recv */ + "cloudabi64_sys_sock_send", /* 51 = cloudabi64_sys_sock_send */ + "cloudabi_sys_sock_shutdown", /* 52 = cloudabi_sys_sock_shutdown */ + "cloudabi_sys_sock_stat_get", /* 53 = cloudabi_sys_sock_stat_get */ + "cloudabi64_sys_thread_create", /* 54 = cloudabi64_sys_thread_create */ + "cloudabi_sys_thread_exit", /* 55 = cloudabi_sys_thread_exit */ "cloudabi_sys_thread_yield", /* 56 = cloudabi_sys_thread_yield */ - "cloudabi64_sys_poll_fd", /* 57 = cloudabi64_sys_poll_fd */ }; Index: head/sys/compat/cloudabi64/cloudabi64_sysent.c =================================================================== --- head/sys/compat/cloudabi64/cloudabi64_sysent.c (revision 304477) +++ head/sys/compat/cloudabi64/cloudabi64_sysent.c (revision 304478) @@ -1,76 +1,75 @@ /* * System call switch table. * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/contrib/cloudabi/syscalls.master 297468 2016-03-31 18:50:06Z ed + * created from FreeBSD */ #include #include #include #include #define AS(name) (sizeof(struct name) / sizeof(register_t)) /* The casts are bogus but will do for now. */ struct sysent cloudabi64_sysent[] = { { AS(cloudabi_sys_clock_res_get_args), (sy_call_t *)cloudabi_sys_clock_res_get, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 0 = cloudabi_sys_clock_res_get */ { AS(cloudabi_sys_clock_time_get_args), (sy_call_t *)cloudabi_sys_clock_time_get, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 1 = cloudabi_sys_clock_time_get */ { AS(cloudabi_sys_condvar_signal_args), (sy_call_t *)cloudabi_sys_condvar_signal, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 2 = cloudabi_sys_condvar_signal */ { AS(cloudabi_sys_fd_close_args), (sy_call_t *)cloudabi_sys_fd_close, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 3 = cloudabi_sys_fd_close */ { AS(cloudabi_sys_fd_create1_args), (sy_call_t *)cloudabi_sys_fd_create1, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 4 = cloudabi_sys_fd_create1 */ { AS(cloudabi_sys_fd_create2_args), (sy_call_t *)cloudabi_sys_fd_create2, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 5 = cloudabi_sys_fd_create2 */ { AS(cloudabi_sys_fd_datasync_args), (sy_call_t *)cloudabi_sys_fd_datasync, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 6 = cloudabi_sys_fd_datasync */ { AS(cloudabi_sys_fd_dup_args), (sy_call_t *)cloudabi_sys_fd_dup, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 7 = cloudabi_sys_fd_dup */ { AS(cloudabi64_sys_fd_pread_args), (sy_call_t *)cloudabi64_sys_fd_pread, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 8 = cloudabi64_sys_fd_pread */ { AS(cloudabi64_sys_fd_pwrite_args), (sy_call_t *)cloudabi64_sys_fd_pwrite, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 9 = cloudabi64_sys_fd_pwrite */ { AS(cloudabi64_sys_fd_read_args), (sy_call_t *)cloudabi64_sys_fd_read, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 10 = cloudabi64_sys_fd_read */ { AS(cloudabi_sys_fd_replace_args), (sy_call_t *)cloudabi_sys_fd_replace, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 11 = cloudabi_sys_fd_replace */ { AS(cloudabi_sys_fd_seek_args), (sy_call_t *)cloudabi_sys_fd_seek, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 12 = cloudabi_sys_fd_seek */ { AS(cloudabi_sys_fd_stat_get_args), (sy_call_t *)cloudabi_sys_fd_stat_get, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 13 = cloudabi_sys_fd_stat_get */ { AS(cloudabi_sys_fd_stat_put_args), (sy_call_t *)cloudabi_sys_fd_stat_put, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 14 = cloudabi_sys_fd_stat_put */ { AS(cloudabi_sys_fd_sync_args), (sy_call_t *)cloudabi_sys_fd_sync, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 15 = cloudabi_sys_fd_sync */ { AS(cloudabi64_sys_fd_write_args), (sy_call_t *)cloudabi64_sys_fd_write, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 16 = cloudabi64_sys_fd_write */ { AS(cloudabi_sys_file_advise_args), (sy_call_t *)cloudabi_sys_file_advise, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 17 = cloudabi_sys_file_advise */ { AS(cloudabi_sys_file_allocate_args), (sy_call_t *)cloudabi_sys_file_allocate, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 18 = cloudabi_sys_file_allocate */ { AS(cloudabi_sys_file_create_args), (sy_call_t *)cloudabi_sys_file_create, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 19 = cloudabi_sys_file_create */ { AS(cloudabi_sys_file_link_args), (sy_call_t *)cloudabi_sys_file_link, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 20 = cloudabi_sys_file_link */ { AS(cloudabi_sys_file_open_args), (sy_call_t *)cloudabi_sys_file_open, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 21 = cloudabi_sys_file_open */ { AS(cloudabi_sys_file_readdir_args), (sy_call_t *)cloudabi_sys_file_readdir, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 22 = cloudabi_sys_file_readdir */ { AS(cloudabi_sys_file_readlink_args), (sy_call_t *)cloudabi_sys_file_readlink, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 23 = cloudabi_sys_file_readlink */ { AS(cloudabi_sys_file_rename_args), (sy_call_t *)cloudabi_sys_file_rename, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 24 = cloudabi_sys_file_rename */ { AS(cloudabi_sys_file_stat_fget_args), (sy_call_t *)cloudabi_sys_file_stat_fget, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 25 = cloudabi_sys_file_stat_fget */ { AS(cloudabi_sys_file_stat_fput_args), (sy_call_t *)cloudabi_sys_file_stat_fput, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 26 = cloudabi_sys_file_stat_fput */ { AS(cloudabi_sys_file_stat_get_args), (sy_call_t *)cloudabi_sys_file_stat_get, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 27 = cloudabi_sys_file_stat_get */ { AS(cloudabi_sys_file_stat_put_args), (sy_call_t *)cloudabi_sys_file_stat_put, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 28 = cloudabi_sys_file_stat_put */ { AS(cloudabi_sys_file_symlink_args), (sy_call_t *)cloudabi_sys_file_symlink, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 29 = cloudabi_sys_file_symlink */ { AS(cloudabi_sys_file_unlink_args), (sy_call_t *)cloudabi_sys_file_unlink, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 30 = cloudabi_sys_file_unlink */ { AS(cloudabi_sys_lock_unlock_args), (sy_call_t *)cloudabi_sys_lock_unlock, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 31 = cloudabi_sys_lock_unlock */ { AS(cloudabi_sys_mem_advise_args), (sy_call_t *)cloudabi_sys_mem_advise, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 32 = cloudabi_sys_mem_advise */ { AS(cloudabi_sys_mem_lock_args), (sy_call_t *)cloudabi_sys_mem_lock, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 33 = cloudabi_sys_mem_lock */ { AS(cloudabi_sys_mem_map_args), (sy_call_t *)cloudabi_sys_mem_map, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 34 = cloudabi_sys_mem_map */ { AS(cloudabi_sys_mem_protect_args), (sy_call_t *)cloudabi_sys_mem_protect, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 35 = cloudabi_sys_mem_protect */ { AS(cloudabi_sys_mem_sync_args), (sy_call_t *)cloudabi_sys_mem_sync, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 36 = cloudabi_sys_mem_sync */ { AS(cloudabi_sys_mem_unlock_args), (sy_call_t *)cloudabi_sys_mem_unlock, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 37 = cloudabi_sys_mem_unlock */ { AS(cloudabi_sys_mem_unmap_args), (sy_call_t *)cloudabi_sys_mem_unmap, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 38 = cloudabi_sys_mem_unmap */ { AS(cloudabi64_sys_poll_args), (sy_call_t *)cloudabi64_sys_poll, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 39 = cloudabi64_sys_poll */ - { AS(cloudabi_sys_proc_exec_args), (sy_call_t *)cloudabi_sys_proc_exec, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 40 = cloudabi_sys_proc_exec */ - { AS(cloudabi_sys_proc_exit_args), (sy_call_t *)cloudabi_sys_proc_exit, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 41 = cloudabi_sys_proc_exit */ - { 0, (sy_call_t *)cloudabi_sys_proc_fork, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 42 = cloudabi_sys_proc_fork */ - { AS(cloudabi_sys_proc_raise_args), (sy_call_t *)cloudabi_sys_proc_raise, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 43 = cloudabi_sys_proc_raise */ - { AS(cloudabi_sys_random_get_args), (sy_call_t *)cloudabi_sys_random_get, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 44 = cloudabi_sys_random_get */ - { AS(cloudabi_sys_sock_accept_args), (sy_call_t *)cloudabi_sys_sock_accept, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 45 = cloudabi_sys_sock_accept */ - { AS(cloudabi_sys_sock_bind_args), (sy_call_t *)cloudabi_sys_sock_bind, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 46 = cloudabi_sys_sock_bind */ - { AS(cloudabi_sys_sock_connect_args), (sy_call_t *)cloudabi_sys_sock_connect, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 47 = cloudabi_sys_sock_connect */ - { AS(cloudabi_sys_sock_listen_args), (sy_call_t *)cloudabi_sys_sock_listen, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 48 = cloudabi_sys_sock_listen */ - { AS(cloudabi64_sys_sock_recv_args), (sy_call_t *)cloudabi64_sys_sock_recv, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 49 = cloudabi64_sys_sock_recv */ - { AS(cloudabi64_sys_sock_send_args), (sy_call_t *)cloudabi64_sys_sock_send, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 50 = cloudabi64_sys_sock_send */ - { AS(cloudabi_sys_sock_shutdown_args), (sy_call_t *)cloudabi_sys_sock_shutdown, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 51 = cloudabi_sys_sock_shutdown */ - { AS(cloudabi_sys_sock_stat_get_args), (sy_call_t *)cloudabi_sys_sock_stat_get, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 52 = cloudabi_sys_sock_stat_get */ - { AS(cloudabi64_sys_thread_create_args), (sy_call_t *)cloudabi64_sys_thread_create, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 53 = cloudabi64_sys_thread_create */ - { AS(cloudabi_sys_thread_exit_args), (sy_call_t *)cloudabi_sys_thread_exit, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 54 = cloudabi_sys_thread_exit */ - { AS(cloudabi_sys_thread_tcb_set_args), (sy_call_t *)cloudabi_sys_thread_tcb_set, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 55 = cloudabi_sys_thread_tcb_set */ + { AS(cloudabi64_sys_poll_fd_args), (sy_call_t *)cloudabi64_sys_poll_fd, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 40 = cloudabi64_sys_poll_fd */ + { AS(cloudabi_sys_proc_exec_args), (sy_call_t *)cloudabi_sys_proc_exec, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 41 = cloudabi_sys_proc_exec */ + { AS(cloudabi_sys_proc_exit_args), (sy_call_t *)cloudabi_sys_proc_exit, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 42 = cloudabi_sys_proc_exit */ + { 0, (sy_call_t *)cloudabi_sys_proc_fork, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 43 = cloudabi_sys_proc_fork */ + { AS(cloudabi_sys_proc_raise_args), (sy_call_t *)cloudabi_sys_proc_raise, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 44 = cloudabi_sys_proc_raise */ + { AS(cloudabi_sys_random_get_args), (sy_call_t *)cloudabi_sys_random_get, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 45 = cloudabi_sys_random_get */ + { AS(cloudabi_sys_sock_accept_args), (sy_call_t *)cloudabi_sys_sock_accept, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 46 = cloudabi_sys_sock_accept */ + { AS(cloudabi_sys_sock_bind_args), (sy_call_t *)cloudabi_sys_sock_bind, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 47 = cloudabi_sys_sock_bind */ + { AS(cloudabi_sys_sock_connect_args), (sy_call_t *)cloudabi_sys_sock_connect, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 48 = cloudabi_sys_sock_connect */ + { AS(cloudabi_sys_sock_listen_args), (sy_call_t *)cloudabi_sys_sock_listen, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 49 = cloudabi_sys_sock_listen */ + { AS(cloudabi64_sys_sock_recv_args), (sy_call_t *)cloudabi64_sys_sock_recv, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 50 = cloudabi64_sys_sock_recv */ + { AS(cloudabi64_sys_sock_send_args), (sy_call_t *)cloudabi64_sys_sock_send, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 51 = cloudabi64_sys_sock_send */ + { AS(cloudabi_sys_sock_shutdown_args), (sy_call_t *)cloudabi_sys_sock_shutdown, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 52 = cloudabi_sys_sock_shutdown */ + { AS(cloudabi_sys_sock_stat_get_args), (sy_call_t *)cloudabi_sys_sock_stat_get, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 53 = cloudabi_sys_sock_stat_get */ + { AS(cloudabi64_sys_thread_create_args), (sy_call_t *)cloudabi64_sys_thread_create, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 54 = cloudabi64_sys_thread_create */ + { AS(cloudabi_sys_thread_exit_args), (sy_call_t *)cloudabi_sys_thread_exit, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 55 = cloudabi_sys_thread_exit */ { 0, (sy_call_t *)cloudabi_sys_thread_yield, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 56 = cloudabi_sys_thread_yield */ - { AS(cloudabi64_sys_poll_fd_args), (sy_call_t *)cloudabi64_sys_poll_fd, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 57 = cloudabi64_sys_poll_fd */ }; Index: head/sys/compat/cloudabi64/cloudabi64_systrace_args.c =================================================================== --- head/sys/compat/cloudabi64/cloudabi64_systrace_args.c (revision 304477) +++ head/sys/compat/cloudabi64/cloudabi64_systrace_args.c (revision 304478) @@ -1,1724 +1,1702 @@ /* * System call argument to DTrace register array converstion. * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ * This file is part of the DTrace syscall provider. */ static void systrace_args(int sysnum, void *params, uint64_t *uarg, int *n_args) { int64_t *iarg = (int64_t *) uarg; switch (sysnum) { /* cloudabi_sys_clock_res_get */ case 0: { struct cloudabi_sys_clock_res_get_args *p = params; iarg[0] = p->clock_id; /* cloudabi_clockid_t */ *n_args = 1; break; } /* cloudabi_sys_clock_time_get */ case 1: { struct cloudabi_sys_clock_time_get_args *p = params; iarg[0] = p->clock_id; /* cloudabi_clockid_t */ iarg[1] = p->precision; /* cloudabi_timestamp_t */ *n_args = 2; break; } /* cloudabi_sys_condvar_signal */ case 2: { struct cloudabi_sys_condvar_signal_args *p = params; uarg[0] = (intptr_t) p->condvar; /* cloudabi_condvar_t * */ iarg[1] = p->scope; /* cloudabi_scope_t */ iarg[2] = p->nwaiters; /* cloudabi_nthreads_t */ *n_args = 3; break; } /* cloudabi_sys_fd_close */ case 3: { struct cloudabi_sys_fd_close_args *p = params; iarg[0] = p->fd; /* cloudabi_fd_t */ *n_args = 1; break; } /* cloudabi_sys_fd_create1 */ case 4: { struct cloudabi_sys_fd_create1_args *p = params; iarg[0] = p->type; /* cloudabi_filetype_t */ *n_args = 1; break; } /* cloudabi_sys_fd_create2 */ case 5: { struct cloudabi_sys_fd_create2_args *p = params; iarg[0] = p->type; /* cloudabi_filetype_t */ *n_args = 1; break; } /* cloudabi_sys_fd_datasync */ case 6: { struct cloudabi_sys_fd_datasync_args *p = params; iarg[0] = p->fd; /* cloudabi_fd_t */ *n_args = 1; break; } /* cloudabi_sys_fd_dup */ case 7: { struct cloudabi_sys_fd_dup_args *p = params; iarg[0] = p->from; /* cloudabi_fd_t */ *n_args = 1; break; } /* cloudabi64_sys_fd_pread */ case 8: { 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 * */ uarg[2] = p->iovcnt; /* size_t */ iarg[3] = p->offset; /* cloudabi_filesize_t */ *n_args = 4; break; } /* cloudabi64_sys_fd_pwrite */ case 9: { 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 * */ uarg[2] = p->iovcnt; /* size_t */ iarg[3] = p->offset; /* cloudabi_filesize_t */ *n_args = 4; break; } /* cloudabi64_sys_fd_read */ case 10: { 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 * */ uarg[2] = p->iovcnt; /* size_t */ *n_args = 3; break; } /* cloudabi_sys_fd_replace */ case 11: { struct cloudabi_sys_fd_replace_args *p = params; iarg[0] = p->from; /* cloudabi_fd_t */ iarg[1] = p->to; /* cloudabi_fd_t */ *n_args = 2; break; } /* cloudabi_sys_fd_seek */ case 12: { struct cloudabi_sys_fd_seek_args *p = params; iarg[0] = p->fd; /* cloudabi_fd_t */ iarg[1] = p->offset; /* cloudabi_filedelta_t */ iarg[2] = p->whence; /* cloudabi_whence_t */ *n_args = 3; break; } /* cloudabi_sys_fd_stat_get */ case 13: { struct cloudabi_sys_fd_stat_get_args *p = params; iarg[0] = p->fd; /* cloudabi_fd_t */ uarg[1] = (intptr_t) p->buf; /* cloudabi_fdstat_t * */ *n_args = 2; break; } /* cloudabi_sys_fd_stat_put */ case 14: { struct cloudabi_sys_fd_stat_put_args *p = params; iarg[0] = p->fd; /* cloudabi_fd_t */ uarg[1] = (intptr_t) p->buf; /* const cloudabi_fdstat_t * */ iarg[2] = p->flags; /* cloudabi_fdsflags_t */ *n_args = 3; break; } /* cloudabi_sys_fd_sync */ case 15: { struct cloudabi_sys_fd_sync_args *p = params; iarg[0] = p->fd; /* cloudabi_fd_t */ *n_args = 1; break; } /* cloudabi64_sys_fd_write */ case 16: { 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 * */ uarg[2] = p->iovcnt; /* size_t */ *n_args = 3; break; } /* cloudabi_sys_file_advise */ case 17: { struct cloudabi_sys_file_advise_args *p = params; iarg[0] = p->fd; /* cloudabi_fd_t */ iarg[1] = p->offset; /* cloudabi_filesize_t */ iarg[2] = p->len; /* cloudabi_filesize_t */ iarg[3] = p->advice; /* cloudabi_advice_t */ *n_args = 4; break; } /* cloudabi_sys_file_allocate */ case 18: { struct cloudabi_sys_file_allocate_args *p = params; iarg[0] = p->fd; /* cloudabi_fd_t */ iarg[1] = p->offset; /* cloudabi_filesize_t */ iarg[2] = p->len; /* cloudabi_filesize_t */ *n_args = 3; break; } /* cloudabi_sys_file_create */ case 19: { struct cloudabi_sys_file_create_args *p = params; iarg[0] = p->fd; /* cloudabi_fd_t */ uarg[1] = (intptr_t) p->path; /* const char * */ uarg[2] = p->pathlen; /* size_t */ iarg[3] = p->type; /* cloudabi_filetype_t */ *n_args = 4; break; } /* cloudabi_sys_file_link */ case 20: { struct cloudabi_sys_file_link_args *p = params; iarg[0] = p->fd1; /* cloudabi_lookup_t */ uarg[1] = (intptr_t) p->path1; /* const char * */ uarg[2] = p->path1len; /* size_t */ iarg[3] = p->fd2; /* cloudabi_fd_t */ uarg[4] = (intptr_t) p->path2; /* const char * */ uarg[5] = p->path2len; /* size_t */ *n_args = 6; break; } /* cloudabi_sys_file_open */ case 21: { struct cloudabi_sys_file_open_args *p = params; 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 */ uarg[4] = (intptr_t) p->fds; /* const cloudabi_fdstat_t * */ *n_args = 5; break; } /* cloudabi_sys_file_readdir */ case 22: { struct cloudabi_sys_file_readdir_args *p = params; iarg[0] = p->fd; /* cloudabi_fd_t */ uarg[1] = (intptr_t) p->buf; /* void * */ uarg[2] = p->nbyte; /* size_t */ iarg[3] = p->cookie; /* cloudabi_dircookie_t */ *n_args = 4; break; } /* cloudabi_sys_file_readlink */ case 23: { struct cloudabi_sys_file_readlink_args *p = params; 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; /* char * */ uarg[4] = p->bufsize; /* size_t */ *n_args = 5; break; } /* cloudabi_sys_file_rename */ case 24: { struct cloudabi_sys_file_rename_args *p = params; iarg[0] = p->oldfd; /* cloudabi_fd_t */ uarg[1] = (intptr_t) p->old; /* const char * */ uarg[2] = p->oldlen; /* size_t */ iarg[3] = p->newfd; /* cloudabi_fd_t */ uarg[4] = (intptr_t) p->new; /* const char * */ uarg[5] = p->newlen; /* size_t */ *n_args = 6; break; } /* cloudabi_sys_file_stat_fget */ case 25: { struct cloudabi_sys_file_stat_fget_args *p = params; iarg[0] = p->fd; /* cloudabi_fd_t */ uarg[1] = (intptr_t) p->buf; /* cloudabi_filestat_t * */ *n_args = 2; break; } /* cloudabi_sys_file_stat_fput */ case 26: { struct cloudabi_sys_file_stat_fput_args *p = params; iarg[0] = p->fd; /* cloudabi_fd_t */ uarg[1] = (intptr_t) p->buf; /* const cloudabi_filestat_t * */ iarg[2] = p->flags; /* cloudabi_fsflags_t */ *n_args = 3; break; } /* cloudabi_sys_file_stat_get */ case 27: { struct cloudabi_sys_file_stat_get_args *p = params; iarg[0] = p->fd; /* cloudabi_lookup_t */ uarg[1] = (intptr_t) p->path; /* const char * */ uarg[2] = p->pathlen; /* size_t */ uarg[3] = (intptr_t) p->buf; /* cloudabi_filestat_t * */ *n_args = 4; break; } /* cloudabi_sys_file_stat_put */ case 28: { struct cloudabi_sys_file_stat_put_args *p = params; iarg[0] = p->fd; /* cloudabi_lookup_t */ uarg[1] = (intptr_t) p->path; /* const char * */ uarg[2] = p->pathlen; /* size_t */ uarg[3] = (intptr_t) p->buf; /* const cloudabi_filestat_t * */ iarg[4] = p->flags; /* cloudabi_fsflags_t */ *n_args = 5; break; } /* cloudabi_sys_file_symlink */ case 29: { struct cloudabi_sys_file_symlink_args *p = params; uarg[0] = (intptr_t) p->path1; /* const char * */ uarg[1] = p->path1len; /* size_t */ iarg[2] = p->fd; /* cloudabi_fd_t */ uarg[3] = (intptr_t) p->path2; /* const char * */ uarg[4] = p->path2len; /* size_t */ *n_args = 5; break; } /* cloudabi_sys_file_unlink */ case 30: { struct cloudabi_sys_file_unlink_args *p = params; iarg[0] = p->fd; /* cloudabi_fd_t */ uarg[1] = (intptr_t) p->path; /* const char * */ uarg[2] = p->pathlen; /* size_t */ iarg[3] = p->flags; /* cloudabi_ulflags_t */ *n_args = 4; break; } /* cloudabi_sys_lock_unlock */ case 31: { struct cloudabi_sys_lock_unlock_args *p = params; uarg[0] = (intptr_t) p->lock; /* cloudabi_lock_t * */ iarg[1] = p->scope; /* cloudabi_scope_t */ *n_args = 2; break; } /* cloudabi_sys_mem_advise */ case 32: { struct cloudabi_sys_mem_advise_args *p = params; uarg[0] = (intptr_t) p->addr; /* void * */ uarg[1] = p->len; /* size_t */ iarg[2] = p->advice; /* cloudabi_advice_t */ *n_args = 3; break; } /* cloudabi_sys_mem_lock */ case 33: { struct cloudabi_sys_mem_lock_args *p = params; uarg[0] = (intptr_t) p->addr; /* const void * */ uarg[1] = p->len; /* size_t */ *n_args = 2; break; } /* cloudabi_sys_mem_map */ case 34: { struct cloudabi_sys_mem_map_args *p = params; uarg[0] = (intptr_t) p->addr; /* void * */ uarg[1] = p->len; /* size_t */ iarg[2] = p->prot; /* cloudabi_mprot_t */ iarg[3] = p->flags; /* cloudabi_mflags_t */ iarg[4] = p->fd; /* cloudabi_fd_t */ iarg[5] = p->off; /* cloudabi_filesize_t */ *n_args = 6; break; } /* cloudabi_sys_mem_protect */ case 35: { struct cloudabi_sys_mem_protect_args *p = params; uarg[0] = (intptr_t) p->addr; /* void * */ uarg[1] = p->len; /* size_t */ iarg[2] = p->prot; /* cloudabi_mprot_t */ *n_args = 3; break; } /* cloudabi_sys_mem_sync */ case 36: { struct cloudabi_sys_mem_sync_args *p = params; uarg[0] = (intptr_t) p->addr; /* void * */ uarg[1] = p->len; /* size_t */ iarg[2] = p->flags; /* cloudabi_msflags_t */ *n_args = 3; break; } /* cloudabi_sys_mem_unlock */ case 37: { struct cloudabi_sys_mem_unlock_args *p = params; uarg[0] = (intptr_t) p->addr; /* const void * */ uarg[1] = p->len; /* size_t */ *n_args = 2; break; } /* cloudabi_sys_mem_unmap */ case 38: { struct cloudabi_sys_mem_unmap_args *p = params; uarg[0] = (intptr_t) p->addr; /* void * */ uarg[1] = p->len; /* size_t */ *n_args = 2; break; } /* cloudabi64_sys_poll */ case 39: { 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[2] = p->nsubscriptions; /* size_t */ *n_args = 3; break; } - /* cloudabi_sys_proc_exec */ + /* cloudabi64_sys_poll_fd */ case 40: { + 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 * */ + uarg[2] = p->nin; /* size_t */ + uarg[3] = (intptr_t) p->out; /* cloudabi64_event_t * */ + uarg[4] = p->nout; /* size_t */ + uarg[5] = (intptr_t) p->timeout; /* const cloudabi64_subscription_t * */ + *n_args = 6; + break; + } + /* cloudabi_sys_proc_exec */ + case 41: { struct cloudabi_sys_proc_exec_args *p = params; iarg[0] = p->fd; /* cloudabi_fd_t */ uarg[1] = (intptr_t) p->data; /* const void * */ uarg[2] = p->datalen; /* size_t */ uarg[3] = (intptr_t) p->fds; /* const cloudabi_fd_t * */ uarg[4] = p->fdslen; /* size_t */ *n_args = 5; break; } /* cloudabi_sys_proc_exit */ - case 41: { + case 42: { struct cloudabi_sys_proc_exit_args *p = params; iarg[0] = p->rval; /* cloudabi_exitcode_t */ *n_args = 1; break; } /* cloudabi_sys_proc_fork */ - case 42: { + case 43: { *n_args = 0; break; } /* cloudabi_sys_proc_raise */ - case 43: { + case 44: { struct cloudabi_sys_proc_raise_args *p = params; iarg[0] = p->sig; /* cloudabi_signal_t */ *n_args = 1; break; } /* cloudabi_sys_random_get */ - case 44: { + case 45: { struct cloudabi_sys_random_get_args *p = params; uarg[0] = (intptr_t) p->buf; /* void * */ uarg[1] = p->nbyte; /* size_t */ *n_args = 2; break; } /* cloudabi_sys_sock_accept */ - case 45: { + case 46: { struct cloudabi_sys_sock_accept_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ uarg[1] = (intptr_t) p->buf; /* cloudabi_sockstat_t * */ *n_args = 2; break; } /* cloudabi_sys_sock_bind */ - case 46: { + case 47: { struct cloudabi_sys_sock_bind_args *p = params; 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 */ *n_args = 4; break; } /* cloudabi_sys_sock_connect */ - case 47: { + case 48: { struct cloudabi_sys_sock_connect_args *p = params; 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 */ *n_args = 4; break; } /* cloudabi_sys_sock_listen */ - case 48: { + case 49: { struct cloudabi_sys_sock_listen_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ iarg[1] = p->backlog; /* cloudabi_backlog_t */ *n_args = 2; break; } /* cloudabi64_sys_sock_recv */ - case 49: { + case 50: { struct cloudabi64_sys_sock_recv_args *p = params; 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; break; } /* cloudabi64_sys_sock_send */ - case 50: { + case 51: { struct cloudabi64_sys_sock_send_args *p = params; 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; break; } /* cloudabi_sys_sock_shutdown */ - case 51: { + case 52: { struct cloudabi_sys_sock_shutdown_args *p = params; iarg[0] = p->sock; /* cloudabi_fd_t */ iarg[1] = p->how; /* cloudabi_sdflags_t */ *n_args = 2; break; } /* cloudabi_sys_sock_stat_get */ - case 52: { + case 53: { struct cloudabi_sys_sock_stat_get_args *p = params; 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; break; } /* cloudabi64_sys_thread_create */ - case 53: { + case 54: { struct cloudabi64_sys_thread_create_args *p = params; uarg[0] = (intptr_t) p->attr; /* cloudabi64_threadattr_t * */ *n_args = 1; break; } /* cloudabi_sys_thread_exit */ - case 54: { + case 55: { struct cloudabi_sys_thread_exit_args *p = params; uarg[0] = (intptr_t) p->lock; /* cloudabi_lock_t * */ iarg[1] = p->scope; /* cloudabi_scope_t */ *n_args = 2; break; } - /* cloudabi_sys_thread_tcb_set */ - case 55: { - struct cloudabi_sys_thread_tcb_set_args *p = params; - uarg[0] = (intptr_t) p->tcb; /* void * */ - *n_args = 1; - break; - } /* cloudabi_sys_thread_yield */ case 56: { *n_args = 0; break; } - /* cloudabi64_sys_poll_fd */ - case 57: { - 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 * */ - uarg[2] = p->nin; /* size_t */ - uarg[3] = (intptr_t) p->out; /* cloudabi64_event_t * */ - uarg[4] = p->nout; /* size_t */ - uarg[5] = (intptr_t) p->timeout; /* const cloudabi64_subscription_t * */ - *n_args = 6; - break; - } default: *n_args = 0; break; }; } static void systrace_entry_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) { const char *p = NULL; switch (sysnum) { /* cloudabi_sys_clock_res_get */ case 0: switch(ndx) { case 0: p = "cloudabi_clockid_t"; break; default: break; }; break; /* cloudabi_sys_clock_time_get */ case 1: switch(ndx) { case 0: p = "cloudabi_clockid_t"; break; case 1: p = "cloudabi_timestamp_t"; break; default: break; }; break; /* cloudabi_sys_condvar_signal */ case 2: switch(ndx) { case 0: p = "cloudabi_condvar_t *"; break; case 1: p = "cloudabi_scope_t"; break; case 2: p = "cloudabi_nthreads_t"; break; default: break; }; break; /* cloudabi_sys_fd_close */ case 3: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; default: break; }; break; /* cloudabi_sys_fd_create1 */ case 4: switch(ndx) { case 0: p = "cloudabi_filetype_t"; break; default: break; }; break; /* cloudabi_sys_fd_create2 */ case 5: switch(ndx) { case 0: p = "cloudabi_filetype_t"; break; default: break; }; break; /* cloudabi_sys_fd_datasync */ case 6: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; default: break; }; break; /* cloudabi_sys_fd_dup */ case 7: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; default: break; }; break; /* cloudabi64_sys_fd_pread */ case 8: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; case 1: p = "const cloudabi64_iovec_t *"; break; case 2: p = "size_t"; break; case 3: p = "cloudabi_filesize_t"; break; default: break; }; break; /* cloudabi64_sys_fd_pwrite */ case 9: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; case 1: p = "const cloudabi64_ciovec_t *"; break; case 2: p = "size_t"; break; case 3: p = "cloudabi_filesize_t"; break; default: break; }; break; /* cloudabi64_sys_fd_read */ case 10: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; case 1: p = "const cloudabi64_iovec_t *"; break; case 2: p = "size_t"; break; default: break; }; break; /* cloudabi_sys_fd_replace */ case 11: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; case 1: p = "cloudabi_fd_t"; break; default: break; }; break; /* cloudabi_sys_fd_seek */ case 12: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; case 1: p = "cloudabi_filedelta_t"; break; case 2: p = "cloudabi_whence_t"; break; default: break; }; break; /* cloudabi_sys_fd_stat_get */ case 13: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; case 1: p = "cloudabi_fdstat_t *"; break; default: break; }; break; /* cloudabi_sys_fd_stat_put */ case 14: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; case 1: p = "const cloudabi_fdstat_t *"; break; case 2: p = "cloudabi_fdsflags_t"; break; default: break; }; break; /* cloudabi_sys_fd_sync */ case 15: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; default: break; }; break; /* cloudabi64_sys_fd_write */ case 16: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; case 1: p = "const cloudabi64_ciovec_t *"; break; case 2: p = "size_t"; break; default: break; }; break; /* cloudabi_sys_file_advise */ case 17: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; case 1: p = "cloudabi_filesize_t"; break; case 2: p = "cloudabi_filesize_t"; break; case 3: p = "cloudabi_advice_t"; break; default: break; }; break; /* cloudabi_sys_file_allocate */ case 18: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; case 1: p = "cloudabi_filesize_t"; break; case 2: p = "cloudabi_filesize_t"; break; default: break; }; break; /* cloudabi_sys_file_create */ case 19: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; case 1: p = "const char *"; break; case 2: p = "size_t"; break; case 3: p = "cloudabi_filetype_t"; break; default: break; }; break; /* cloudabi_sys_file_link */ case 20: switch(ndx) { case 0: p = "cloudabi_lookup_t"; break; case 1: p = "const char *"; break; case 2: p = "size_t"; break; case 3: p = "cloudabi_fd_t"; break; case 4: p = "const char *"; break; case 5: p = "size_t"; break; default: break; }; break; /* cloudabi_sys_file_open */ case 21: switch(ndx) { case 0: p = "cloudabi_lookup_t"; break; case 1: p = "const char *"; break; case 2: p = "size_t"; break; case 3: p = "cloudabi_oflags_t"; break; case 4: p = "const cloudabi_fdstat_t *"; break; default: break; }; break; /* cloudabi_sys_file_readdir */ case 22: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; case 1: p = "void *"; break; case 2: p = "size_t"; break; case 3: p = "cloudabi_dircookie_t"; break; default: break; }; break; /* cloudabi_sys_file_readlink */ case 23: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; case 1: p = "const char *"; break; case 2: p = "size_t"; break; case 3: p = "char *"; break; case 4: p = "size_t"; break; default: break; }; break; /* cloudabi_sys_file_rename */ case 24: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; case 1: p = "const char *"; break; case 2: p = "size_t"; break; case 3: p = "cloudabi_fd_t"; break; case 4: p = "const char *"; break; case 5: p = "size_t"; break; default: break; }; break; /* cloudabi_sys_file_stat_fget */ case 25: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; case 1: p = "cloudabi_filestat_t *"; break; default: break; }; break; /* cloudabi_sys_file_stat_fput */ case 26: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; case 1: p = "const cloudabi_filestat_t *"; break; case 2: p = "cloudabi_fsflags_t"; break; default: break; }; break; /* cloudabi_sys_file_stat_get */ case 27: switch(ndx) { case 0: p = "cloudabi_lookup_t"; break; case 1: p = "const char *"; break; case 2: p = "size_t"; break; case 3: p = "cloudabi_filestat_t *"; break; default: break; }; break; /* cloudabi_sys_file_stat_put */ case 28: switch(ndx) { case 0: p = "cloudabi_lookup_t"; break; case 1: p = "const char *"; break; case 2: p = "size_t"; break; case 3: p = "const cloudabi_filestat_t *"; break; case 4: p = "cloudabi_fsflags_t"; break; default: break; }; break; /* cloudabi_sys_file_symlink */ case 29: switch(ndx) { case 0: p = "const char *"; break; case 1: p = "size_t"; break; case 2: p = "cloudabi_fd_t"; break; case 3: p = "const char *"; break; case 4: p = "size_t"; break; default: break; }; break; /* cloudabi_sys_file_unlink */ case 30: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; case 1: p = "const char *"; break; case 2: p = "size_t"; break; case 3: p = "cloudabi_ulflags_t"; break; default: break; }; break; /* cloudabi_sys_lock_unlock */ case 31: switch(ndx) { case 0: p = "cloudabi_lock_t *"; break; case 1: p = "cloudabi_scope_t"; break; default: break; }; break; /* cloudabi_sys_mem_advise */ case 32: switch(ndx) { case 0: p = "void *"; break; case 1: p = "size_t"; break; case 2: p = "cloudabi_advice_t"; break; default: break; }; break; /* cloudabi_sys_mem_lock */ case 33: switch(ndx) { case 0: p = "const void *"; break; case 1: p = "size_t"; break; default: break; }; break; /* cloudabi_sys_mem_map */ case 34: switch(ndx) { case 0: p = "void *"; break; case 1: p = "size_t"; break; case 2: p = "cloudabi_mprot_t"; break; case 3: p = "cloudabi_mflags_t"; break; case 4: p = "cloudabi_fd_t"; break; case 5: p = "cloudabi_filesize_t"; break; default: break; }; break; /* cloudabi_sys_mem_protect */ case 35: switch(ndx) { case 0: p = "void *"; break; case 1: p = "size_t"; break; case 2: p = "cloudabi_mprot_t"; break; default: break; }; break; /* cloudabi_sys_mem_sync */ case 36: switch(ndx) { case 0: p = "void *"; break; case 1: p = "size_t"; break; case 2: p = "cloudabi_msflags_t"; break; default: break; }; break; /* cloudabi_sys_mem_unlock */ case 37: switch(ndx) { case 0: p = "const void *"; break; case 1: p = "size_t"; break; default: break; }; break; /* cloudabi_sys_mem_unmap */ case 38: switch(ndx) { case 0: p = "void *"; break; case 1: p = "size_t"; break; default: break; }; break; /* cloudabi64_sys_poll */ case 39: switch(ndx) { case 0: p = "const cloudabi64_subscription_t *"; break; case 1: p = "cloudabi64_event_t *"; break; case 2: p = "size_t"; break; default: break; }; break; - /* cloudabi_sys_proc_exec */ + /* cloudabi64_sys_poll_fd */ case 40: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; case 1: + p = "const cloudabi64_subscription_t *"; + break; + case 2: + p = "size_t"; + break; + case 3: + p = "cloudabi64_event_t *"; + break; + case 4: + p = "size_t"; + break; + case 5: + p = "const cloudabi64_subscription_t *"; + break; + default: + break; + }; + break; + /* cloudabi_sys_proc_exec */ + case 41: + switch(ndx) { + case 0: + p = "cloudabi_fd_t"; + break; + case 1: p = "const void *"; break; case 2: p = "size_t"; break; case 3: p = "const cloudabi_fd_t *"; break; case 4: p = "size_t"; break; default: break; }; break; /* cloudabi_sys_proc_exit */ - case 41: + case 42: switch(ndx) { case 0: p = "cloudabi_exitcode_t"; break; default: break; }; break; /* cloudabi_sys_proc_fork */ - case 42: + case 43: break; /* cloudabi_sys_proc_raise */ - case 43: + case 44: switch(ndx) { case 0: p = "cloudabi_signal_t"; break; default: break; }; break; /* cloudabi_sys_random_get */ - case 44: + case 45: switch(ndx) { case 0: p = "void *"; break; case 1: p = "size_t"; break; default: break; }; break; /* cloudabi_sys_sock_accept */ - case 45: + case 46: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; case 1: p = "cloudabi_sockstat_t *"; break; default: break; }; break; /* cloudabi_sys_sock_bind */ - case 46: + case 47: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; case 1: p = "cloudabi_fd_t"; break; case 2: p = "const char *"; break; case 3: p = "size_t"; break; default: break; }; break; /* cloudabi_sys_sock_connect */ - case 47: + case 48: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; case 1: p = "cloudabi_fd_t"; break; case 2: p = "const char *"; break; case 3: p = "size_t"; break; default: break; }; break; /* cloudabi_sys_sock_listen */ - case 48: + case 49: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; case 1: p = "cloudabi_backlog_t"; break; default: break; }; break; /* cloudabi64_sys_sock_recv */ - case 49: + case 50: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; case 1: p = "const cloudabi64_recv_in_t *"; break; case 2: p = "cloudabi64_recv_out_t *"; break; default: break; }; break; /* cloudabi64_sys_sock_send */ - case 50: + case 51: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; case 1: p = "const cloudabi64_send_in_t *"; break; case 2: p = "cloudabi64_send_out_t *"; break; default: break; }; break; /* cloudabi_sys_sock_shutdown */ - case 51: + case 52: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; case 1: p = "cloudabi_sdflags_t"; break; default: break; }; break; /* cloudabi_sys_sock_stat_get */ - case 52: + case 53: switch(ndx) { case 0: p = "cloudabi_fd_t"; break; case 1: p = "cloudabi_sockstat_t *"; break; case 2: p = "cloudabi_ssflags_t"; break; default: break; }; break; /* cloudabi64_sys_thread_create */ - case 53: + case 54: switch(ndx) { case 0: p = "cloudabi64_threadattr_t *"; break; default: break; }; break; /* cloudabi_sys_thread_exit */ - case 54: + case 55: switch(ndx) { case 0: p = "cloudabi_lock_t *"; break; case 1: p = "cloudabi_scope_t"; break; default: break; }; break; - /* cloudabi_sys_thread_tcb_set */ - case 55: - switch(ndx) { - case 0: - p = "void *"; - break; - default: - break; - }; - break; /* cloudabi_sys_thread_yield */ case 56: break; - /* cloudabi64_sys_poll_fd */ - case 57: - switch(ndx) { - case 0: - p = "cloudabi_fd_t"; - break; - case 1: - p = "const cloudabi64_subscription_t *"; - break; - case 2: - p = "size_t"; - break; - case 3: - p = "cloudabi64_event_t *"; - break; - case 4: - p = "size_t"; - break; - case 5: - p = "const cloudabi64_subscription_t *"; - break; - default: - break; - }; - break; default: break; }; if (p != NULL) strlcpy(desc, p, descsz); } static void systrace_return_setargdesc(int sysnum, int ndx, char *desc, size_t descsz) { const char *p = NULL; switch (sysnum) { /* cloudabi_sys_clock_res_get */ case 0: if (ndx == 0 || ndx == 1) p = "cloudabi_timestamp_t"; break; /* cloudabi_sys_clock_time_get */ case 1: if (ndx == 0 || ndx == 1) p = "cloudabi_timestamp_t"; break; /* cloudabi_sys_condvar_signal */ case 2: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_fd_close */ case 3: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_fd_create1 */ case 4: if (ndx == 0 || ndx == 1) p = "cloudabi_fd_t"; break; /* cloudabi_sys_fd_create2 */ case 5: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_fd_datasync */ case 6: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_fd_dup */ case 7: if (ndx == 0 || ndx == 1) p = "cloudabi_fd_t"; break; /* cloudabi64_sys_fd_pread */ case 8: if (ndx == 0 || ndx == 1) p = "size_t"; break; /* cloudabi64_sys_fd_pwrite */ case 9: if (ndx == 0 || ndx == 1) p = "size_t"; break; /* cloudabi64_sys_fd_read */ case 10: if (ndx == 0 || ndx == 1) p = "size_t"; break; /* cloudabi_sys_fd_replace */ case 11: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_fd_seek */ case 12: if (ndx == 0 || ndx == 1) p = "cloudabi_filesize_t"; break; /* cloudabi_sys_fd_stat_get */ case 13: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_fd_stat_put */ case 14: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_fd_sync */ case 15: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi64_sys_fd_write */ case 16: if (ndx == 0 || ndx == 1) p = "size_t"; break; /* cloudabi_sys_file_advise */ case 17: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_file_allocate */ case 18: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_file_create */ case 19: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_file_link */ case 20: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_file_open */ case 21: if (ndx == 0 || ndx == 1) p = "cloudabi_fd_t"; break; /* cloudabi_sys_file_readdir */ case 22: if (ndx == 0 || ndx == 1) p = "size_t"; break; /* cloudabi_sys_file_readlink */ case 23: if (ndx == 0 || ndx == 1) p = "size_t"; break; /* cloudabi_sys_file_rename */ case 24: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_file_stat_fget */ case 25: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_file_stat_fput */ case 26: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_file_stat_get */ case 27: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_file_stat_put */ case 28: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_file_symlink */ case 29: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_file_unlink */ case 30: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_lock_unlock */ case 31: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_mem_advise */ case 32: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_mem_lock */ case 33: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_mem_map */ case 34: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_mem_protect */ case 35: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_mem_sync */ case 36: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_mem_unlock */ case 37: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_mem_unmap */ case 38: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi64_sys_poll */ case 39: if (ndx == 0 || ndx == 1) p = "size_t"; break; - /* cloudabi_sys_proc_exec */ + /* cloudabi64_sys_poll_fd */ case 40: if (ndx == 0 || ndx == 1) + p = "size_t"; + break; + /* cloudabi_sys_proc_exec */ + case 41: + if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_proc_exit */ - case 41: + case 42: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_proc_fork */ - case 42: - /* cloudabi_sys_proc_raise */ case 43: + /* cloudabi_sys_proc_raise */ + case 44: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_random_get */ - case 44: + case 45: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_sock_accept */ - case 45: + case 46: if (ndx == 0 || ndx == 1) p = "cloudabi_fd_t"; break; /* cloudabi_sys_sock_bind */ - case 46: + case 47: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_sock_connect */ - case 47: + case 48: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_sock_listen */ - case 48: + case 49: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi64_sys_sock_recv */ - case 49: + case 50: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi64_sys_sock_send */ - case 50: + case 51: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_sock_shutdown */ - case 51: + case 52: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_sock_stat_get */ - case 52: + case 53: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi64_sys_thread_create */ - case 53: + case 54: if (ndx == 0 || ndx == 1) p = "cloudabi_tid_t"; break; /* cloudabi_sys_thread_exit */ - case 54: - if (ndx == 0 || ndx == 1) - p = "void"; - break; - /* cloudabi_sys_thread_tcb_set */ case 55: if (ndx == 0 || ndx == 1) p = "void"; break; /* cloudabi_sys_thread_yield */ case 56: - /* cloudabi64_sys_poll_fd */ - case 57: - if (ndx == 0 || ndx == 1) - p = "size_t"; - break; default: break; }; if (p != NULL) strlcpy(desc, p, descsz); } Index: head/sys/contrib/cloudabi/syscalls.master =================================================================== --- head/sys/contrib/cloudabi/syscalls.master (revision 304477) +++ head/sys/contrib/cloudabi/syscalls.master (nonexistent) @@ -1,318 +0,0 @@ - $FreeBSD$ - -; Copyright (c) 2016 Nuxi (https://nuxi.nl/) and contributors. -; -; Redistribution and use in source and binary forms, with or without -; modification, are permitted provided that the following conditions -; are met: -; 1. Redistributions of source code must retain the above copyright -; notice, this list of conditions and the following disclaimer. -; 2. Redistributions in binary form must 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 -#include - -#include - -#include - -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, \ - cloudabi_timestamp_t precision); } - -2 AUE_NULL STD { void cloudabi_sys_condvar_signal( \ - cloudabi_condvar_t *condvar, \ - cloudabi_scope_t scope, \ - cloudabi_nthreads_t nwaiters); } - -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 { size_t cloudabi64_sys_fd_pread( \ - cloudabi_fd_t fd, \ - const cloudabi64_iovec_t *iov, \ - size_t iovcnt, \ - cloudabi_filesize_t offset); } - -9 AUE_NULL STD { size_t cloudabi64_sys_fd_pwrite( \ - cloudabi_fd_t fd, \ - const cloudabi64_ciovec_t *iov, \ - size_t iovcnt, \ - cloudabi_filesize_t offset); } - -10 AUE_NULL STD { size_t cloudabi64_sys_fd_read( \ - cloudabi_fd_t fd, \ - const cloudabi64_iovec_t *iov, \ - 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( \ - 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 { size_t cloudabi64_sys_fd_write( \ - cloudabi_fd_t fd, \ - const cloudabi64_ciovec_t *iov, \ - 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, \ - cloudabi_filetype_t type); } - -20 AUE_NULL STD { void cloudabi_sys_file_link( \ - cloudabi_lookup_t fd1, \ - const char *path1, \ - size_t path1len, \ - cloudabi_fd_t fd2, \ - const char *path2, \ - size_t path2len); } - -21 AUE_NULL STD { cloudabi_fd_t cloudabi_sys_file_open( \ - 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, \ - cloudabi_dircookie_t cookie); } - -23 AUE_NULL STD { size_t cloudabi_sys_file_readlink( \ - cloudabi_fd_t fd, \ - 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, \ - cloudabi_fd_t newfd, \ - 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, \ - 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 cloudabi_filestat_t *buf, \ - cloudabi_fsflags_t flags); } - -29 AUE_NULL STD { void cloudabi_sys_file_symlink( \ - const char *path1, \ - size_t path1len, \ - cloudabi_fd_t fd, \ - 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 flags); } - -31 AUE_NULL STD { void cloudabi_sys_lock_unlock( \ - cloudabi_lock_t *lock, \ - cloudabi_scope_t scope); } - -32 AUE_NULL STD { void cloudabi_sys_mem_advise( \ - void *addr, \ - size_t len, \ - cloudabi_advice_t advice); } - -33 AUE_NULL STD { void cloudabi_sys_mem_lock( \ - const void *addr, \ - size_t len); } - -34 AUE_NULL STD { void cloudabi_sys_mem_map( \ - 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, \ - cloudabi_mprot_t prot); } - -36 AUE_NULL STD { void cloudabi_sys_mem_sync( \ - void *addr, \ - size_t len, \ - cloudabi_msflags_t flags); } - -37 AUE_NULL STD { void cloudabi_sys_mem_unlock( \ - const void *addr, \ - size_t len); } - -38 AUE_NULL STD { void cloudabi_sys_mem_unmap( \ - void *addr, \ - size_t len); } - -39 AUE_NULL STD { size_t cloudabi64_sys_poll( \ - const cloudabi64_subscription_t *in, \ - cloudabi64_event_t *out, \ - size_t nsubscriptions); } - -40 AUE_NULL STD { void cloudabi_sys_proc_exec( \ - 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 { 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); } - -45 AUE_NULL STD { cloudabi_fd_t cloudabi_sys_sock_accept( \ - cloudabi_fd_t sock, \ - cloudabi_sockstat_t *buf); } - -46 AUE_NULL STD { void cloudabi_sys_sock_bind( \ - 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 sock, \ - cloudabi_fd_t fd, \ - const char *path, \ - size_t pathlen); } - -48 AUE_NULL STD { void cloudabi_sys_sock_listen( \ - cloudabi_fd_t sock, \ - cloudabi_backlog_t backlog); } - -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 { 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 sock, \ - cloudabi_sdflags_t how); } - -52 AUE_NULL STD { void cloudabi_sys_sock_stat_get( \ - 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_scope_t scope); } - -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 { size_t cloudabi64_sys_poll_fd( \ - cloudabi_fd_t fd, \ - const cloudabi64_subscription_t *in, \ - size_t nin, \ - cloudabi64_event_t *out, \ - size_t nout, \ - const cloudabi64_subscription_t *timeout); } Property changes on: head/sys/contrib/cloudabi/syscalls.master ___________________________________________________________________ Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Index: head/sys/contrib/cloudabi/cloudabi64_types.h =================================================================== --- head/sys/contrib/cloudabi/cloudabi64_types.h (revision 304477) +++ head/sys/contrib/cloudabi/cloudabi64_types.h (revision 304478) @@ -1,232 +1,275 @@ // Copyright (c) 2016 Nuxi (https://nuxi.nl/) and contributors. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // 1. Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // 2. Redistributions in binary form must 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; - }; + _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; + _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_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; - }; + _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(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; + _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 void cloudabi64_processentry_t(uint64_t auxv); 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; + _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(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; + _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(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"); +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_scope_t condvar_scope; - _Alignas(1) cloudabi_scope_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_scope_t lock_scope; - } lock; - struct { - _Alignas(4) cloudabi_fd_t fd; - } proc_terminate; - }; + _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_scope_t condvar_scope; + _Alignas(1) cloudabi_scope_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_scope_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(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 struct { - _Alignas(8) uint64_t parent; -} cloudabi64_tcb_t; +typedef struct { _Alignas(8) uint64_t parent; } cloudabi64_tcb_t; _Static_assert(offsetof(cloudabi64_tcb_t, parent) == 0, "Incorrect layout"); _Static_assert(sizeof(cloudabi64_tcb_t) == 8, "Incorrect layout"); _Static_assert(_Alignof(cloudabi64_tcb_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; + _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(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; + _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(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 Index: head/sys/contrib/cloudabi/cloudabi_types.h =================================================================== --- head/sys/contrib/cloudabi/cloudabi_types.h (revision 304477) +++ head/sys/contrib/cloudabi/cloudabi_types.h (revision 304478) @@ -1,273 +1,413 @@ // Copyright (c) 2016 Nuxi (https://nuxi.nl/) and contributors. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // 1. Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // 2. Redistributions in binary form must 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_H #define CLOUDABI_TYPES_H #include "cloudabi_types_common.h" typedef struct { - _Alignas(4) cloudabi_auxtype_t a_type; - union { - size_t a_val; - void *a_ptr; - }; + _Alignas(4) cloudabi_auxtype_t a_type; + union { + size_t a_val; + void *a_ptr; + }; } cloudabi_auxv_t; _Static_assert(offsetof(cloudabi_auxv_t, a_type) == 0, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || offsetof(cloudabi_auxv_t, a_val) == 4, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || offsetof(cloudabi_auxv_t, a_val) == 8, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || offsetof(cloudabi_auxv_t, a_ptr) == 4, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || offsetof(cloudabi_auxv_t, a_ptr) == 8, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || sizeof(cloudabi_auxv_t) == 8, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || sizeof(cloudabi_auxv_t) == 16, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || _Alignof(cloudabi_auxv_t) == 4, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || _Alignof(cloudabi_auxv_t) == 8, "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || offsetof(cloudabi_auxv_t, a_val) == 4, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || offsetof(cloudabi_auxv_t, a_val) == 8, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || offsetof(cloudabi_auxv_t, a_ptr) == 4, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || offsetof(cloudabi_auxv_t, a_ptr) == 8, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || sizeof(cloudabi_auxv_t) == 8, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || sizeof(cloudabi_auxv_t) == 16, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || _Alignof(cloudabi_auxv_t) == 4, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || _Alignof(cloudabi_auxv_t) == 8, + "Incorrect layout"); typedef struct { - const void *iov_base; - size_t iov_len; + const void *iov_base; + size_t iov_len; } cloudabi_ciovec_t; _Static_assert(offsetof(cloudabi_ciovec_t, iov_base) == 0, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || offsetof(cloudabi_ciovec_t, iov_len) == 4, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || offsetof(cloudabi_ciovec_t, iov_len) == 8, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || sizeof(cloudabi_ciovec_t) == 8, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || sizeof(cloudabi_ciovec_t) == 16, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || _Alignof(cloudabi_ciovec_t) == 4, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || _Alignof(cloudabi_ciovec_t) == 8, "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || offsetof(cloudabi_ciovec_t, iov_len) == 4, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || offsetof(cloudabi_ciovec_t, iov_len) == 8, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || sizeof(cloudabi_ciovec_t) == 8, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || sizeof(cloudabi_ciovec_t) == 16, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || _Alignof(cloudabi_ciovec_t) == 4, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || _Alignof(cloudabi_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 { - _Atomic(cloudabi_condvar_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 { - _Atomic(cloudabi_lock_t) *lock; - } lock; - struct { - _Alignas(4) cloudabi_fd_t fd; - _Alignas(1) cloudabi_signal_t signal; - _Alignas(4) cloudabi_exitcode_t exitcode; - } proc_terminate; - }; + _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 { + _Atomic(cloudabi_condvar_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 { + _Atomic(cloudabi_lock_t) * lock; + } lock; + struct { + _Alignas(4) cloudabi_fd_t fd; + _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, clock.identifier) == 16, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_event_t, condvar.condvar) == 16, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_event_t, fd_readwrite.nbytes) == 16, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_event_t, fd_readwrite.fd) == 24, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_event_t, fd_readwrite.flags) == 28, "Incorrect layout"); +_Static_assert(offsetof(cloudabi_event_t, clock.identifier) == 16, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi_event_t, condvar.condvar) == 16, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi_event_t, fd_readwrite.nbytes) == 16, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi_event_t, fd_readwrite.fd) == 24, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi_event_t, fd_readwrite.flags) == 28, + "Incorrect layout"); _Static_assert(offsetof(cloudabi_event_t, lock.lock) == 16, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_event_t, proc_terminate.fd) == 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(offsetof(cloudabi_event_t, proc_terminate.fd) == 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 { - void *iov_base; - size_t iov_len; + void *iov_base; + size_t iov_len; } cloudabi_iovec_t; _Static_assert(offsetof(cloudabi_iovec_t, iov_base) == 0, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || offsetof(cloudabi_iovec_t, iov_len) == 4, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || offsetof(cloudabi_iovec_t, iov_len) == 8, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || sizeof(cloudabi_iovec_t) == 8, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || sizeof(cloudabi_iovec_t) == 16, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || _Alignof(cloudabi_iovec_t) == 4, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || _Alignof(cloudabi_iovec_t) == 8, "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || offsetof(cloudabi_iovec_t, iov_len) == 4, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || offsetof(cloudabi_iovec_t, iov_len) == 8, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || sizeof(cloudabi_iovec_t) == 8, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || sizeof(cloudabi_iovec_t) == 16, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || _Alignof(cloudabi_iovec_t) == 4, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || _Alignof(cloudabi_iovec_t) == 8, + "Incorrect layout"); typedef void cloudabi_processentry_t(const cloudabi_auxv_t *auxv); typedef struct { - const cloudabi_iovec_t *ri_data; - size_t ri_datalen; - cloudabi_fd_t *ri_fds; - size_t ri_fdslen; - _Alignas(2) cloudabi_msgflags_t ri_flags; + const cloudabi_iovec_t *ri_data; + size_t ri_datalen; + cloudabi_fd_t *ri_fds; + size_t ri_fdslen; + _Alignas(2) cloudabi_msgflags_t ri_flags; } cloudabi_recv_in_t; _Static_assert(offsetof(cloudabi_recv_in_t, ri_data) == 0, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || offsetof(cloudabi_recv_in_t, ri_datalen) == 4, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || offsetof(cloudabi_recv_in_t, ri_datalen) == 8, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || offsetof(cloudabi_recv_in_t, ri_fds) == 8, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || offsetof(cloudabi_recv_in_t, ri_fds) == 16, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || offsetof(cloudabi_recv_in_t, ri_fdslen) == 12, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || offsetof(cloudabi_recv_in_t, ri_fdslen) == 24, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || offsetof(cloudabi_recv_in_t, ri_flags) == 16, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || offsetof(cloudabi_recv_in_t, ri_flags) == 32, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || sizeof(cloudabi_recv_in_t) == 20, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || sizeof(cloudabi_recv_in_t) == 40, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || _Alignof(cloudabi_recv_in_t) == 4, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || _Alignof(cloudabi_recv_in_t) == 8, "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || + offsetof(cloudabi_recv_in_t, ri_datalen) == 4, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || + offsetof(cloudabi_recv_in_t, ri_datalen) == 8, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || offsetof(cloudabi_recv_in_t, ri_fds) == 8, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || + offsetof(cloudabi_recv_in_t, ri_fds) == 16, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || + offsetof(cloudabi_recv_in_t, ri_fdslen) == 12, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || + offsetof(cloudabi_recv_in_t, ri_fdslen) == 24, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || + offsetof(cloudabi_recv_in_t, ri_flags) == 16, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || + offsetof(cloudabi_recv_in_t, ri_flags) == 32, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || sizeof(cloudabi_recv_in_t) == 20, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || sizeof(cloudabi_recv_in_t) == 40, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || _Alignof(cloudabi_recv_in_t) == 4, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || _Alignof(cloudabi_recv_in_t) == 8, + "Incorrect layout"); typedef struct { - const cloudabi_ciovec_t *si_data; - size_t si_datalen; - const cloudabi_fd_t *si_fds; - size_t si_fdslen; - _Alignas(2) cloudabi_msgflags_t si_flags; + const cloudabi_ciovec_t *si_data; + size_t si_datalen; + const cloudabi_fd_t *si_fds; + size_t si_fdslen; + _Alignas(2) cloudabi_msgflags_t si_flags; } cloudabi_send_in_t; _Static_assert(offsetof(cloudabi_send_in_t, si_data) == 0, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || offsetof(cloudabi_send_in_t, si_datalen) == 4, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || offsetof(cloudabi_send_in_t, si_datalen) == 8, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || offsetof(cloudabi_send_in_t, si_fds) == 8, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || offsetof(cloudabi_send_in_t, si_fds) == 16, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || offsetof(cloudabi_send_in_t, si_fdslen) == 12, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || offsetof(cloudabi_send_in_t, si_fdslen) == 24, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || offsetof(cloudabi_send_in_t, si_flags) == 16, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || offsetof(cloudabi_send_in_t, si_flags) == 32, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || sizeof(cloudabi_send_in_t) == 20, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || sizeof(cloudabi_send_in_t) == 40, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || _Alignof(cloudabi_send_in_t) == 4, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || _Alignof(cloudabi_send_in_t) == 8, "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || + offsetof(cloudabi_send_in_t, si_datalen) == 4, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || + offsetof(cloudabi_send_in_t, si_datalen) == 8, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || offsetof(cloudabi_send_in_t, si_fds) == 8, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || + offsetof(cloudabi_send_in_t, si_fds) == 16, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || + offsetof(cloudabi_send_in_t, si_fdslen) == 12, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || + offsetof(cloudabi_send_in_t, si_fdslen) == 24, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || + offsetof(cloudabi_send_in_t, si_flags) == 16, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || + offsetof(cloudabi_send_in_t, si_flags) == 32, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || sizeof(cloudabi_send_in_t) == 20, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || sizeof(cloudabi_send_in_t) == 40, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || _Alignof(cloudabi_send_in_t) == 4, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || _Alignof(cloudabi_send_in_t) == 8, + "Incorrect layout"); -typedef struct { - size_t so_datalen; -} cloudabi_send_out_t; -_Static_assert(offsetof(cloudabi_send_out_t, so_datalen) == 0, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || sizeof(cloudabi_send_out_t) == 4, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || sizeof(cloudabi_send_out_t) == 8, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || _Alignof(cloudabi_send_out_t) == 4, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || _Alignof(cloudabi_send_out_t) == 8, "Incorrect layout"); +typedef struct { size_t so_datalen; } cloudabi_send_out_t; +_Static_assert(offsetof(cloudabi_send_out_t, so_datalen) == 0, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || sizeof(cloudabi_send_out_t) == 4, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || sizeof(cloudabi_send_out_t) == 8, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || _Alignof(cloudabi_send_out_t) == 4, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || _Alignof(cloudabi_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 { - _Atomic(cloudabi_condvar_t) *condvar; - _Atomic(cloudabi_lock_t) *lock; - _Alignas(1) cloudabi_scope_t condvar_scope; - _Alignas(1) cloudabi_scope_t lock_scope; - } condvar; - struct { - _Alignas(4) cloudabi_fd_t fd; - _Alignas(2) cloudabi_subrwflags_t flags; - } fd_readwrite; - struct { - _Atomic(cloudabi_lock_t) *lock; - _Alignas(1) cloudabi_scope_t lock_scope; - } lock; - struct { - _Alignas(4) cloudabi_fd_t fd; - } proc_terminate; - }; + _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 { + _Atomic(cloudabi_condvar_t) * condvar; + _Atomic(cloudabi_lock_t) * lock; + _Alignas(1) cloudabi_scope_t condvar_scope; + _Alignas(1) cloudabi_scope_t lock_scope; + } condvar; + struct { + _Alignas(4) cloudabi_fd_t fd; + _Alignas(2) cloudabi_subrwflags_t flags; + } fd_readwrite; + struct { + _Atomic(cloudabi_lock_t) * lock; + _Alignas(1) cloudabi_scope_t lock_scope; + } lock; + struct { + _Alignas(4) cloudabi_fd_t fd; + } proc_terminate; + }; } cloudabi_subscription_t; -_Static_assert(offsetof(cloudabi_subscription_t, userdata) == 0, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_subscription_t, flags) == 8, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_subscription_t, type) == 10, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_subscription_t, clock.identifier) == 16, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_subscription_t, clock.clock_id) == 24, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_subscription_t, clock.timeout) == 32, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_subscription_t, clock.precision) == 40, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_subscription_t, clock.flags) == 48, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_subscription_t, condvar.condvar) == 16, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || offsetof(cloudabi_subscription_t, condvar.lock) == 20, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || offsetof(cloudabi_subscription_t, condvar.lock) == 24, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || offsetof(cloudabi_subscription_t, condvar.condvar_scope) == 24, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || offsetof(cloudabi_subscription_t, condvar.condvar_scope) == 32, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || offsetof(cloudabi_subscription_t, condvar.lock_scope) == 25, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || offsetof(cloudabi_subscription_t, condvar.lock_scope) == 33, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_subscription_t, fd_readwrite.fd) == 16, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_subscription_t, fd_readwrite.flags) == 20, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_subscription_t, lock.lock) == 16, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || offsetof(cloudabi_subscription_t, lock.lock_scope) == 20, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || offsetof(cloudabi_subscription_t, lock.lock_scope) == 24, "Incorrect layout"); -_Static_assert(offsetof(cloudabi_subscription_t, proc_terminate.fd) == 16, "Incorrect layout"); +_Static_assert(offsetof(cloudabi_subscription_t, userdata) == 0, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi_subscription_t, flags) == 8, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi_subscription_t, type) == 10, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi_subscription_t, clock.identifier) == 16, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi_subscription_t, clock.clock_id) == 24, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi_subscription_t, clock.timeout) == 32, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi_subscription_t, clock.precision) == 40, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi_subscription_t, clock.flags) == 48, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi_subscription_t, condvar.condvar) == 16, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || + offsetof(cloudabi_subscription_t, condvar.lock) == 20, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || + offsetof(cloudabi_subscription_t, condvar.lock) == 24, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || + offsetof(cloudabi_subscription_t, condvar.condvar_scope) == + 24, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || + offsetof(cloudabi_subscription_t, condvar.condvar_scope) == + 32, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || + offsetof(cloudabi_subscription_t, condvar.lock_scope) == 25, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || + offsetof(cloudabi_subscription_t, condvar.lock_scope) == 33, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi_subscription_t, fd_readwrite.fd) == 16, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi_subscription_t, fd_readwrite.flags) == 20, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi_subscription_t, lock.lock) == 16, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || + offsetof(cloudabi_subscription_t, lock.lock_scope) == 20, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || + offsetof(cloudabi_subscription_t, lock.lock_scope) == 24, + "Incorrect layout"); +_Static_assert(offsetof(cloudabi_subscription_t, proc_terminate.fd) == 16, + "Incorrect layout"); _Static_assert(sizeof(cloudabi_subscription_t) == 56, "Incorrect layout"); _Static_assert(_Alignof(cloudabi_subscription_t) == 8, "Incorrect layout"); -typedef struct { - void *parent; -} cloudabi_tcb_t; +typedef struct { void *parent; } cloudabi_tcb_t; _Static_assert(offsetof(cloudabi_tcb_t, parent) == 0, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || sizeof(cloudabi_tcb_t) == 4, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || sizeof(cloudabi_tcb_t) == 8, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || _Alignof(cloudabi_tcb_t) == 4, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || _Alignof(cloudabi_tcb_t) == 8, "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || sizeof(cloudabi_tcb_t) == 4, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || sizeof(cloudabi_tcb_t) == 8, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || _Alignof(cloudabi_tcb_t) == 4, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || _Alignof(cloudabi_tcb_t) == 8, + "Incorrect layout"); typedef void cloudabi_threadentry_t(cloudabi_tid_t tid, void *aux); typedef struct { - size_t ro_datalen; - size_t ro_fdslen; - _Alignas(2) cloudabi_sockaddr_t ro_sockname; - _Alignas(2) cloudabi_sockaddr_t ro_peername; - _Alignas(2) cloudabi_msgflags_t ro_flags; + size_t ro_datalen; + size_t ro_fdslen; + _Alignas(2) cloudabi_sockaddr_t ro_sockname; + _Alignas(2) cloudabi_sockaddr_t ro_peername; + _Alignas(2) cloudabi_msgflags_t ro_flags; } cloudabi_recv_out_t; -_Static_assert(offsetof(cloudabi_recv_out_t, ro_datalen) == 0, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || offsetof(cloudabi_recv_out_t, ro_fdslen) == 4, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || offsetof(cloudabi_recv_out_t, ro_fdslen) == 8, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || offsetof(cloudabi_recv_out_t, ro_sockname) == 8, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || offsetof(cloudabi_recv_out_t, ro_sockname) == 16, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || offsetof(cloudabi_recv_out_t, ro_peername) == 28, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || offsetof(cloudabi_recv_out_t, ro_peername) == 36, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || offsetof(cloudabi_recv_out_t, ro_flags) == 48, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || offsetof(cloudabi_recv_out_t, ro_flags) == 56, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || sizeof(cloudabi_recv_out_t) == 52, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || sizeof(cloudabi_recv_out_t) == 64, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || _Alignof(cloudabi_recv_out_t) == 4, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || _Alignof(cloudabi_recv_out_t) == 8, "Incorrect layout"); +_Static_assert(offsetof(cloudabi_recv_out_t, ro_datalen) == 0, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || + offsetof(cloudabi_recv_out_t, ro_fdslen) == 4, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || + offsetof(cloudabi_recv_out_t, ro_fdslen) == 8, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || + offsetof(cloudabi_recv_out_t, ro_sockname) == 8, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || + offsetof(cloudabi_recv_out_t, ro_sockname) == 16, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || + offsetof(cloudabi_recv_out_t, ro_peername) == 28, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || + offsetof(cloudabi_recv_out_t, ro_peername) == 36, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || + offsetof(cloudabi_recv_out_t, ro_flags) == 48, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || + offsetof(cloudabi_recv_out_t, ro_flags) == 56, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || sizeof(cloudabi_recv_out_t) == 52, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || sizeof(cloudabi_recv_out_t) == 64, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || _Alignof(cloudabi_recv_out_t) == 4, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || _Alignof(cloudabi_recv_out_t) == 8, + "Incorrect layout"); typedef struct { - cloudabi_threadentry_t *entry_point; - void *stack; - size_t stack_size; - void *argument; + cloudabi_threadentry_t *entry_point; + void *stack; + size_t stack_size; + void *argument; } cloudabi_threadattr_t; -_Static_assert(offsetof(cloudabi_threadattr_t, entry_point) == 0, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || offsetof(cloudabi_threadattr_t, stack) == 4, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || offsetof(cloudabi_threadattr_t, stack) == 8, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || offsetof(cloudabi_threadattr_t, stack_size) == 8, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || offsetof(cloudabi_threadattr_t, stack_size) == 16, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || offsetof(cloudabi_threadattr_t, argument) == 12, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || offsetof(cloudabi_threadattr_t, argument) == 24, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || sizeof(cloudabi_threadattr_t) == 16, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || sizeof(cloudabi_threadattr_t) == 32, "Incorrect layout"); -_Static_assert(sizeof(void *) != 4 || _Alignof(cloudabi_threadattr_t) == 4, "Incorrect layout"); -_Static_assert(sizeof(void *) != 8 || _Alignof(cloudabi_threadattr_t) == 8, "Incorrect layout"); +_Static_assert(offsetof(cloudabi_threadattr_t, entry_point) == 0, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || + offsetof(cloudabi_threadattr_t, stack) == 4, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || + offsetof(cloudabi_threadattr_t, stack) == 8, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || + offsetof(cloudabi_threadattr_t, stack_size) == 8, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || + offsetof(cloudabi_threadattr_t, stack_size) == 16, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || + offsetof(cloudabi_threadattr_t, argument) == 12, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || + offsetof(cloudabi_threadattr_t, argument) == 24, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || sizeof(cloudabi_threadattr_t) == 16, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || sizeof(cloudabi_threadattr_t) == 32, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 4 || _Alignof(cloudabi_threadattr_t) == 4, + "Incorrect layout"); +_Static_assert(sizeof(void *) != 8 || _Alignof(cloudabi_threadattr_t) == 8, + "Incorrect layout"); #endif Index: head/sys/contrib/cloudabi/cloudabi_types_common.h =================================================================== --- head/sys/contrib/cloudabi/cloudabi_types_common.h (revision 304477) +++ head/sys/contrib/cloudabi/cloudabi_types_common.h (revision 304478) @@ -1,464 +1,482 @@ // Copyright (c) 2016 Nuxi (https://nuxi.nl/) and contributors. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // 1. Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // 2. Redistributions in binary form must 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 #elif defined(__linux__) && defined(__KERNEL__) #include #else #include #include #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_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 +#define CLOUDABI_ADVICE_WILLNEED 6 typedef uint32_t cloudabi_auxtype_t; -#define CLOUDABI_AT_ARGDATA 256 -#define CLOUDABI_AT_ARGDATALEN 257 -#define CLOUDABI_AT_BASE 7 -#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_ARGDATA 256 +#define CLOUDABI_AT_ARGDATALEN 257 +#define CLOUDABI_AT_BASE 7 +#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_SYSINFO_EHDR 262 -#define CLOUDABI_AT_TID 261 +#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_MONOTONIC 1 #define CLOUDABI_CLOCK_PROCESS_CPUTIME_ID 2 -#define CLOUDABI_CLOCK_REALTIME 3 -#define CLOUDABI_CLOCK_THREAD_CPUTIME_ID 4 +#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_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_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 +#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_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 +#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_APPEND 0x0001 +#define CLOUDABI_FDFLAG_DSYNC 0x0002 #define CLOUDABI_FDFLAG_NONBLOCK 0x0004 -#define CLOUDABI_FDFLAG_RSYNC 0x0008 -#define CLOUDABI_FDFLAG_SYNC 0x0010 +#define CLOUDABI_FDFLAG_RSYNC 0x0008 +#define CLOUDABI_FDFLAG_SYNC 0x0010 typedef uint16_t cloudabi_fdsflags_t; -#define CLOUDABI_FDSTAT_FLAGS 0x0001 +#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_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 +#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 0x0001 #define CLOUDABI_FILESTAT_ATIM_NOW 0x0002 -#define CLOUDABI_FILESTAT_MTIM 0x0004 +#define CLOUDABI_FILESTAT_MTIM 0x0004 #define CLOUDABI_FILESTAT_MTIM_NOW 0x0008 -#define CLOUDABI_FILESTAT_SIZE 0x0010 +#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_UNLOCKED 0x00000000 +#define CLOUDABI_LOCK_WRLOCKED 0x40000000 #define CLOUDABI_LOCK_KERNEL_MANAGED 0x80000000 -#define CLOUDABI_LOCK_BOGUS 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_ANON 0x01 +#define CLOUDABI_MAP_FIXED 0x02 #define CLOUDABI_MAP_PRIVATE 0x04 -#define CLOUDABI_MAP_SHARED 0x08 +#define CLOUDABI_MAP_SHARED 0x08 typedef uint8_t cloudabi_mprot_t; -#define CLOUDABI_PROT_EXEC 0x01 +#define CLOUDABI_PROT_EXEC 0x01 #define CLOUDABI_PROT_WRITE 0x02 -#define CLOUDABI_PROT_READ 0x04 +#define CLOUDABI_PROT_READ 0x04 typedef uint8_t cloudabi_msflags_t; -#define CLOUDABI_MS_ASYNC 0x01 +#define CLOUDABI_MS_ASYNC 0x01 #define CLOUDABI_MS_INVALIDATE 0x02 -#define CLOUDABI_MS_SYNC 0x04 +#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_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_CREAT 0x0001 #define CLOUDABI_O_DIRECTORY 0x0002 -#define CLOUDABI_O_EXCL 0x0004 -#define CLOUDABI_O_TRUNC 0x0008 +#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_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 +#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 +#define CLOUDABI_AF_INET 1 +#define CLOUDABI_AF_INET6 2 +#define CLOUDABI_AF_UNIX 3 typedef uint8_t cloudabi_scope_t; #define CLOUDABI_SCOPE_PRIVATE 4 -#define CLOUDABI_SCOPE_SHARED 8 +#define CLOUDABI_SCOPE_SHARED 8 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_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 +#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_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_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; + _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; + _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_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(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; + _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(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; + _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; - }; + _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(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; + _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(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 Index: head/sys/contrib/cloudabi/cloudabi_vdso_aarch64.c =================================================================== --- head/sys/contrib/cloudabi/cloudabi_vdso_aarch64.c (revision 304477) +++ head/sys/contrib/cloudabi/cloudabi_vdso_aarch64.c (revision 304478) @@ -1,1610 +1,1058 @@ // Copyright (c) 2016 Nuxi (https://nuxi.nl/) and contributors. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // 1. Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // 2. Redistributions in binary form must 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 -cloudabi_errno_t -cloudabi_sys_clock_res_get( - cloudabi_clockid_t clock_id, - cloudabi_timestamp_t *resolution -) { - register uint64_t reg_x8 asm("x8") = 0; - register uint64_t reg_x0 asm("x0") = (uint64_t)clock_id; - register uint64_t okay; - asm volatile ( - "\tsvc 0\n" - "\tcset %0, cc\n" - : "=r"(okay) - , "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - if (okay) { - *resolution = (cloudabi_timestamp_t)reg_x0; - return 0; - } - return reg_x0; +cloudabi_errno_t cloudabi_sys_clock_res_get(cloudabi_clockid_t clock_id, + cloudabi_timestamp_t *resolution) { + register uint64_t reg_x8 asm("x8") = 0; + register uint64_t reg_x0 asm("x0") = (uint64_t)clock_id; + register uint64_t okay; + asm volatile( + "\tsvc 0\n" + "\tcset %0, cc\n" + : "=r"(okay), "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0) + : "memory", "x1", "x2", "x3", "x4", "x5", "x6", "x7", "x9", "x10", "x11", + "x12", "x13", "x14", "x15", "x16", "x17", "x18", "d0", "d1", "d2", "d3", + "d4", "d5", "d6", "d7"); + if (okay) { + *resolution = (cloudabi_timestamp_t)reg_x0; + return 0; + } + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_clock_time_get( - cloudabi_clockid_t clock_id, - cloudabi_timestamp_t precision, - cloudabi_timestamp_t *time -) { - register uint64_t reg_x8 asm("x8") = 1; - register uint64_t reg_x0 asm("x0") = (uint64_t)clock_id; - register uint64_t reg_x1 asm("x1") = (uint64_t)precision; - register uint64_t okay; - asm volatile ( - "\tsvc 0\n" - "\tcset %0, cc\n" - : "=r"(okay) - , "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - if (okay) { - *time = (cloudabi_timestamp_t)reg_x0; - return 0; - } - return reg_x0; +cloudabi_errno_t cloudabi_sys_clock_time_get(cloudabi_clockid_t clock_id, + cloudabi_timestamp_t precision, + cloudabi_timestamp_t *time) { + register uint64_t reg_x8 asm("x8") = 1; + register uint64_t reg_x0 asm("x0") = (uint64_t)clock_id; + register uint64_t reg_x1 asm("x1") = (uint64_t)precision; + register uint64_t okay; + asm volatile( + "\tsvc 0\n" + "\tcset %0, cc\n" + : "=r"(okay), "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1) + : "memory", "x2", "x3", "x4", "x5", "x6", "x7", "x9", "x10", "x11", "x12", + "x13", "x14", "x15", "x16", "x17", "x18", "d0", "d1", "d2", "d3", "d4", + "d5", "d6", "d7"); + if (okay) { + *time = (cloudabi_timestamp_t)reg_x0; + return 0; + } + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_condvar_signal( - _Atomic(cloudabi_condvar_t) *condvar, - cloudabi_scope_t scope, - cloudabi_nthreads_t nwaiters -) { - register uint64_t reg_x8 asm("x8") = 2; - register uint64_t reg_x0 asm("x0") = (uint64_t)condvar; - register uint64_t reg_x1 asm("x1") = (uint64_t)scope; - register uint64_t reg_x2 asm("x2") = (uint64_t)nwaiters; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - , "r"(reg_x2) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_condvar_signal(_Atomic(cloudabi_condvar_t) * + condvar, + cloudabi_scope_t scope, + cloudabi_nthreads_t nwaiters) { + register uint64_t reg_x8 asm("x8") = 2; + register uint64_t reg_x0 asm("x0") = (uint64_t)condvar; + register uint64_t reg_x1 asm("x1") = (uint64_t)scope; + register uint64_t reg_x2 asm("x2") = (uint64_t)nwaiters; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1), "r"(reg_x2) + : "memory", "x3", "x4", "x5", "x6", "x7", "x9", "x10", "x11", + "x12", "x13", "x14", "x15", "x16", "x17", "x18", "d0", "d1", + "d2", "d3", "d4", "d5", "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_fd_close( - cloudabi_fd_t fd -) { - register uint64_t reg_x8 asm("x8") = 3; - register uint64_t reg_x0 asm("x0") = (uint64_t)fd; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_fd_close(cloudabi_fd_t fd) { + register uint64_t reg_x8 asm("x8") = 3; + register uint64_t reg_x0 asm("x0") = (uint64_t)fd; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0) + : "memory", "x1", "x2", "x3", "x4", "x5", "x6", "x7", "x9", + "x10", "x11", "x12", "x13", "x14", "x15", "x16", "x17", "x18", + "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_fd_create1( - cloudabi_filetype_t type, - cloudabi_fd_t *fd -) { - register uint64_t reg_x8 asm("x8") = 4; - register uint64_t reg_x0 asm("x0") = (uint64_t)type; - register uint64_t okay; - asm volatile ( - "\tsvc 0\n" - "\tcset %0, cc\n" - : "=r"(okay) - , "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - if (okay) { - *fd = (cloudabi_fd_t)reg_x0; - return 0; - } - return reg_x0; +cloudabi_errno_t cloudabi_sys_fd_create1(cloudabi_filetype_t type, + cloudabi_fd_t *fd) { + register uint64_t reg_x8 asm("x8") = 4; + register uint64_t reg_x0 asm("x0") = (uint64_t)type; + register uint64_t okay; + asm volatile( + "\tsvc 0\n" + "\tcset %0, cc\n" + : "=r"(okay), "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0) + : "memory", "x1", "x2", "x3", "x4", "x5", "x6", "x7", "x9", "x10", "x11", + "x12", "x13", "x14", "x15", "x16", "x17", "x18", "d0", "d1", "d2", "d3", + "d4", "d5", "d6", "d7"); + if (okay) { + *fd = (cloudabi_fd_t)reg_x0; + return 0; + } + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_fd_create2( - cloudabi_filetype_t type, - cloudabi_fd_t *fd1, - cloudabi_fd_t *fd2 -) { - register uint64_t reg_x8 asm("x8") = 5; - register uint64_t reg_x0 asm("x0") = (uint64_t)type; - register uint64_t reg_x1 asm("x1"); - register uint64_t okay; - asm volatile ( - "\tsvc 0\n" - "\tcset %0, cc\n" - : "=r"(okay) - , "=r"(reg_x0) - , "=r"(reg_x1) - : "r"(reg_x8) - , "r"(reg_x0) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - if (okay) { - *fd1 = (cloudabi_fd_t)reg_x0; - *fd2 = (cloudabi_fd_t)reg_x1; - return 0; - } - return reg_x0; +cloudabi_errno_t cloudabi_sys_fd_create2(cloudabi_filetype_t type, + cloudabi_fd_t *fd1, + cloudabi_fd_t *fd2) { + register uint64_t reg_x8 asm("x8") = 5; + register uint64_t reg_x0 asm("x0") = (uint64_t)type; + register uint64_t reg_x1 asm("x1"); + register uint64_t okay; + asm volatile( + "\tsvc 0\n" + "\tcset %0, cc\n" + : "=r"(okay), "=r"(reg_x0), "=r"(reg_x1) + : "r"(reg_x8), "r"(reg_x0) + : "memory", "x2", "x3", "x4", "x5", "x6", "x7", "x9", "x10", "x11", "x12", + "x13", "x14", "x15", "x16", "x17", "x18", "d0", "d1", "d2", "d3", "d4", + "d5", "d6", "d7"); + if (okay) { + *fd1 = (cloudabi_fd_t)reg_x0; + *fd2 = (cloudabi_fd_t)reg_x1; + return 0; + } + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_fd_datasync( - cloudabi_fd_t fd -) { - register uint64_t reg_x8 asm("x8") = 6; - register uint64_t reg_x0 asm("x0") = (uint64_t)fd; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_fd_datasync(cloudabi_fd_t fd) { + register uint64_t reg_x8 asm("x8") = 6; + register uint64_t reg_x0 asm("x0") = (uint64_t)fd; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0) + : "memory", "x1", "x2", "x3", "x4", "x5", "x6", "x7", "x9", + "x10", "x11", "x12", "x13", "x14", "x15", "x16", "x17", "x18", + "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_fd_dup( - cloudabi_fd_t from, - cloudabi_fd_t *fd -) { - register uint64_t reg_x8 asm("x8") = 7; - register uint64_t reg_x0 asm("x0") = (uint64_t)from; - register uint64_t okay; - asm volatile ( - "\tsvc 0\n" - "\tcset %0, cc\n" - : "=r"(okay) - , "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - if (okay) { - *fd = (cloudabi_fd_t)reg_x0; - return 0; - } - return reg_x0; +cloudabi_errno_t cloudabi_sys_fd_dup(cloudabi_fd_t from, cloudabi_fd_t *fd) { + register uint64_t reg_x8 asm("x8") = 7; + register uint64_t reg_x0 asm("x0") = (uint64_t)from; + register uint64_t okay; + asm volatile( + "\tsvc 0\n" + "\tcset %0, cc\n" + : "=r"(okay), "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0) + : "memory", "x1", "x2", "x3", "x4", "x5", "x6", "x7", "x9", "x10", "x11", + "x12", "x13", "x14", "x15", "x16", "x17", "x18", "d0", "d1", "d2", "d3", + "d4", "d5", "d6", "d7"); + if (okay) { + *fd = (cloudabi_fd_t)reg_x0; + return 0; + } + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_fd_pread( - cloudabi_fd_t fd, - const cloudabi_iovec_t *iov, - size_t iovcnt, - cloudabi_filesize_t offset, - size_t *nread -) { - register uint64_t reg_x8 asm("x8") = 8; - register uint64_t reg_x0 asm("x0") = (uint64_t)fd; - register uint64_t reg_x1 asm("x1") = (uint64_t)iov; - register uint64_t reg_x2 asm("x2") = (uint64_t)iovcnt; - register uint64_t reg_x3 asm("x3") = (uint64_t)offset; - register uint64_t okay; - asm volatile ( - "\tsvc 0\n" - "\tcset %0, cc\n" - : "=r"(okay) - , "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - , "r"(reg_x2) - , "r"(reg_x3) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - if (okay) { - *nread = (size_t)reg_x0; - return 0; - } - return reg_x0; +cloudabi_errno_t cloudabi_sys_fd_pread(cloudabi_fd_t fd, + const cloudabi_iovec_t *iov, + size_t iovcnt, + cloudabi_filesize_t offset, + size_t *nread) { + register uint64_t reg_x8 asm("x8") = 8; + register uint64_t reg_x0 asm("x0") = (uint64_t)fd; + register uint64_t reg_x1 asm("x1") = (uint64_t)iov; + register uint64_t reg_x2 asm("x2") = (uint64_t)iovcnt; + register uint64_t reg_x3 asm("x3") = (uint64_t)offset; + register uint64_t okay; + asm volatile( + "\tsvc 0\n" + "\tcset %0, cc\n" + : "=r"(okay), "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1), "r"(reg_x2), "r"(reg_x3) + : "memory", "x4", "x5", "x6", "x7", "x9", "x10", "x11", "x12", "x13", + "x14", "x15", "x16", "x17", "x18", "d0", "d1", "d2", "d3", "d4", "d5", + "d6", "d7"); + if (okay) { + *nread = (size_t)reg_x0; + return 0; + } + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_fd_pwrite( - cloudabi_fd_t fd, - const cloudabi_ciovec_t *iov, - size_t iovcnt, - cloudabi_filesize_t offset, - size_t *nwritten -) { - register uint64_t reg_x8 asm("x8") = 9; - register uint64_t reg_x0 asm("x0") = (uint64_t)fd; - register uint64_t reg_x1 asm("x1") = (uint64_t)iov; - register uint64_t reg_x2 asm("x2") = (uint64_t)iovcnt; - register uint64_t reg_x3 asm("x3") = (uint64_t)offset; - register uint64_t okay; - asm volatile ( - "\tsvc 0\n" - "\tcset %0, cc\n" - : "=r"(okay) - , "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - , "r"(reg_x2) - , "r"(reg_x3) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - if (okay) { - *nwritten = (size_t)reg_x0; - return 0; - } - return reg_x0; +cloudabi_errno_t cloudabi_sys_fd_pwrite(cloudabi_fd_t fd, + const cloudabi_ciovec_t *iov, + size_t iovcnt, + cloudabi_filesize_t offset, + size_t *nwritten) { + register uint64_t reg_x8 asm("x8") = 9; + register uint64_t reg_x0 asm("x0") = (uint64_t)fd; + register uint64_t reg_x1 asm("x1") = (uint64_t)iov; + register uint64_t reg_x2 asm("x2") = (uint64_t)iovcnt; + register uint64_t reg_x3 asm("x3") = (uint64_t)offset; + register uint64_t okay; + asm volatile( + "\tsvc 0\n" + "\tcset %0, cc\n" + : "=r"(okay), "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1), "r"(reg_x2), "r"(reg_x3) + : "memory", "x4", "x5", "x6", "x7", "x9", "x10", "x11", "x12", "x13", + "x14", "x15", "x16", "x17", "x18", "d0", "d1", "d2", "d3", "d4", "d5", + "d6", "d7"); + if (okay) { + *nwritten = (size_t)reg_x0; + return 0; + } + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_fd_read( - cloudabi_fd_t fd, - const cloudabi_iovec_t *iov, - size_t iovcnt, - size_t *nread -) { - register uint64_t reg_x8 asm("x8") = 10; - register uint64_t reg_x0 asm("x0") = (uint64_t)fd; - register uint64_t reg_x1 asm("x1") = (uint64_t)iov; - register uint64_t reg_x2 asm("x2") = (uint64_t)iovcnt; - register uint64_t okay; - asm volatile ( - "\tsvc 0\n" - "\tcset %0, cc\n" - : "=r"(okay) - , "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - , "r"(reg_x2) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - if (okay) { - *nread = (size_t)reg_x0; - return 0; - } - return reg_x0; +cloudabi_errno_t cloudabi_sys_fd_read(cloudabi_fd_t fd, + const cloudabi_iovec_t *iov, + size_t iovcnt, size_t *nread) { + register uint64_t reg_x8 asm("x8") = 10; + register uint64_t reg_x0 asm("x0") = (uint64_t)fd; + register uint64_t reg_x1 asm("x1") = (uint64_t)iov; + register uint64_t reg_x2 asm("x2") = (uint64_t)iovcnt; + register uint64_t okay; + asm volatile( + "\tsvc 0\n" + "\tcset %0, cc\n" + : "=r"(okay), "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1), "r"(reg_x2) + : "memory", "x3", "x4", "x5", "x6", "x7", "x9", "x10", "x11", "x12", + "x13", "x14", "x15", "x16", "x17", "x18", "d0", "d1", "d2", "d3", "d4", + "d5", "d6", "d7"); + if (okay) { + *nread = (size_t)reg_x0; + return 0; + } + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_fd_replace( - cloudabi_fd_t from, - cloudabi_fd_t to -) { - register uint64_t reg_x8 asm("x8") = 11; - register uint64_t reg_x0 asm("x0") = (uint64_t)from; - register uint64_t reg_x1 asm("x1") = (uint64_t)to; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_fd_replace(cloudabi_fd_t from, cloudabi_fd_t to) { + register uint64_t reg_x8 asm("x8") = 11; + register uint64_t reg_x0 asm("x0") = (uint64_t)from; + register uint64_t reg_x1 asm("x1") = (uint64_t)to; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1) + : "memory", "x2", "x3", "x4", "x5", "x6", "x7", "x9", "x10", + "x11", "x12", "x13", "x14", "x15", "x16", "x17", "x18", "d0", + "d1", "d2", "d3", "d4", "d5", "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_fd_seek( - cloudabi_fd_t fd, - cloudabi_filedelta_t offset, - cloudabi_whence_t whence, - cloudabi_filesize_t *newoffset -) { - register uint64_t reg_x8 asm("x8") = 12; - register uint64_t reg_x0 asm("x0") = (uint64_t)fd; - register uint64_t reg_x1 asm("x1") = (uint64_t)offset; - register uint64_t reg_x2 asm("x2") = (uint64_t)whence; - register uint64_t okay; - asm volatile ( - "\tsvc 0\n" - "\tcset %0, cc\n" - : "=r"(okay) - , "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - , "r"(reg_x2) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - if (okay) { - *newoffset = (cloudabi_filesize_t)reg_x0; - return 0; - } - return reg_x0; +cloudabi_errno_t cloudabi_sys_fd_seek(cloudabi_fd_t fd, + cloudabi_filedelta_t offset, + cloudabi_whence_t whence, + cloudabi_filesize_t *newoffset) { + register uint64_t reg_x8 asm("x8") = 12; + register uint64_t reg_x0 asm("x0") = (uint64_t)fd; + register uint64_t reg_x1 asm("x1") = (uint64_t)offset; + register uint64_t reg_x2 asm("x2") = (uint64_t)whence; + register uint64_t okay; + asm volatile( + "\tsvc 0\n" + "\tcset %0, cc\n" + : "=r"(okay), "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1), "r"(reg_x2) + : "memory", "x3", "x4", "x5", "x6", "x7", "x9", "x10", "x11", "x12", + "x13", "x14", "x15", "x16", "x17", "x18", "d0", "d1", "d2", "d3", "d4", + "d5", "d6", "d7"); + if (okay) { + *newoffset = (cloudabi_filesize_t)reg_x0; + return 0; + } + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_fd_stat_get( - cloudabi_fd_t fd, - cloudabi_fdstat_t *buf -) { - register uint64_t reg_x8 asm("x8") = 13; - register uint64_t reg_x0 asm("x0") = (uint64_t)fd; - register uint64_t reg_x1 asm("x1") = (uint64_t)buf; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_fd_stat_get(cloudabi_fd_t fd, + cloudabi_fdstat_t *buf) { + register uint64_t reg_x8 asm("x8") = 13; + register uint64_t reg_x0 asm("x0") = (uint64_t)fd; + register uint64_t reg_x1 asm("x1") = (uint64_t)buf; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1) + : "memory", "x2", "x3", "x4", "x5", "x6", "x7", "x9", "x10", + "x11", "x12", "x13", "x14", "x15", "x16", "x17", "x18", "d0", + "d1", "d2", "d3", "d4", "d5", "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_fd_stat_put( - cloudabi_fd_t fd, - const cloudabi_fdstat_t *buf, - cloudabi_fdsflags_t flags -) { - register uint64_t reg_x8 asm("x8") = 14; - register uint64_t reg_x0 asm("x0") = (uint64_t)fd; - register uint64_t reg_x1 asm("x1") = (uint64_t)buf; - register uint64_t reg_x2 asm("x2") = (uint64_t)flags; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - , "r"(reg_x2) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_fd_stat_put(cloudabi_fd_t fd, + const cloudabi_fdstat_t *buf, + cloudabi_fdsflags_t flags) { + register uint64_t reg_x8 asm("x8") = 14; + register uint64_t reg_x0 asm("x0") = (uint64_t)fd; + register uint64_t reg_x1 asm("x1") = (uint64_t)buf; + register uint64_t reg_x2 asm("x2") = (uint64_t)flags; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1), "r"(reg_x2) + : "memory", "x3", "x4", "x5", "x6", "x7", "x9", "x10", "x11", + "x12", "x13", "x14", "x15", "x16", "x17", "x18", "d0", "d1", + "d2", "d3", "d4", "d5", "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_fd_sync( - cloudabi_fd_t fd -) { - register uint64_t reg_x8 asm("x8") = 15; - register uint64_t reg_x0 asm("x0") = (uint64_t)fd; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_fd_sync(cloudabi_fd_t fd) { + register uint64_t reg_x8 asm("x8") = 15; + register uint64_t reg_x0 asm("x0") = (uint64_t)fd; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0) + : "memory", "x1", "x2", "x3", "x4", "x5", "x6", "x7", "x9", + "x10", "x11", "x12", "x13", "x14", "x15", "x16", "x17", "x18", + "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_fd_write( - cloudabi_fd_t fd, - const cloudabi_ciovec_t *iov, - size_t iovcnt, - size_t *nwritten -) { - register uint64_t reg_x8 asm("x8") = 16; - register uint64_t reg_x0 asm("x0") = (uint64_t)fd; - register uint64_t reg_x1 asm("x1") = (uint64_t)iov; - register uint64_t reg_x2 asm("x2") = (uint64_t)iovcnt; - register uint64_t okay; - asm volatile ( - "\tsvc 0\n" - "\tcset %0, cc\n" - : "=r"(okay) - , "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - , "r"(reg_x2) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - if (okay) { - *nwritten = (size_t)reg_x0; - return 0; - } - return reg_x0; +cloudabi_errno_t cloudabi_sys_fd_write(cloudabi_fd_t fd, + const cloudabi_ciovec_t *iov, + size_t iovcnt, size_t *nwritten) { + register uint64_t reg_x8 asm("x8") = 16; + register uint64_t reg_x0 asm("x0") = (uint64_t)fd; + register uint64_t reg_x1 asm("x1") = (uint64_t)iov; + register uint64_t reg_x2 asm("x2") = (uint64_t)iovcnt; + register uint64_t okay; + asm volatile( + "\tsvc 0\n" + "\tcset %0, cc\n" + : "=r"(okay), "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1), "r"(reg_x2) + : "memory", "x3", "x4", "x5", "x6", "x7", "x9", "x10", "x11", "x12", + "x13", "x14", "x15", "x16", "x17", "x18", "d0", "d1", "d2", "d3", "d4", + "d5", "d6", "d7"); + if (okay) { + *nwritten = (size_t)reg_x0; + return 0; + } + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_file_advise( - cloudabi_fd_t fd, - cloudabi_filesize_t offset, - cloudabi_filesize_t len, - cloudabi_advice_t advice -) { - register uint64_t reg_x8 asm("x8") = 17; - register uint64_t reg_x0 asm("x0") = (uint64_t)fd; - register uint64_t reg_x1 asm("x1") = (uint64_t)offset; - register uint64_t reg_x2 asm("x2") = (uint64_t)len; - register uint64_t reg_x3 asm("x3") = (uint64_t)advice; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - , "r"(reg_x2) - , "r"(reg_x3) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_file_advise(cloudabi_fd_t fd, + cloudabi_filesize_t offset, + cloudabi_filesize_t len, + cloudabi_advice_t advice) { + register uint64_t reg_x8 asm("x8") = 17; + register uint64_t reg_x0 asm("x0") = (uint64_t)fd; + register uint64_t reg_x1 asm("x1") = (uint64_t)offset; + register uint64_t reg_x2 asm("x2") = (uint64_t)len; + register uint64_t reg_x3 asm("x3") = (uint64_t)advice; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1), "r"(reg_x2), "r"(reg_x3) + : "memory", "x4", "x5", "x6", "x7", "x9", "x10", "x11", "x12", + "x13", "x14", "x15", "x16", "x17", "x18", "d0", "d1", "d2", + "d3", "d4", "d5", "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_file_allocate( - cloudabi_fd_t fd, - cloudabi_filesize_t offset, - cloudabi_filesize_t len -) { - register uint64_t reg_x8 asm("x8") = 18; - register uint64_t reg_x0 asm("x0") = (uint64_t)fd; - register uint64_t reg_x1 asm("x1") = (uint64_t)offset; - register uint64_t reg_x2 asm("x2") = (uint64_t)len; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - , "r"(reg_x2) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_file_allocate(cloudabi_fd_t fd, + cloudabi_filesize_t offset, + cloudabi_filesize_t len) { + register uint64_t reg_x8 asm("x8") = 18; + register uint64_t reg_x0 asm("x0") = (uint64_t)fd; + register uint64_t reg_x1 asm("x1") = (uint64_t)offset; + register uint64_t reg_x2 asm("x2") = (uint64_t)len; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1), "r"(reg_x2) + : "memory", "x3", "x4", "x5", "x6", "x7", "x9", "x10", "x11", + "x12", "x13", "x14", "x15", "x16", "x17", "x18", "d0", "d1", + "d2", "d3", "d4", "d5", "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_file_create( - cloudabi_fd_t fd, - const char *path, - size_t pathlen, - cloudabi_filetype_t type -) { - register uint64_t reg_x8 asm("x8") = 19; - register uint64_t reg_x0 asm("x0") = (uint64_t)fd; - register uint64_t reg_x1 asm("x1") = (uint64_t)path; - register uint64_t reg_x2 asm("x2") = (uint64_t)pathlen; - register uint64_t reg_x3 asm("x3") = (uint64_t)type; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - , "r"(reg_x2) - , "r"(reg_x3) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_file_create(cloudabi_fd_t fd, const char *path, + size_t pathlen, + cloudabi_filetype_t type) { + register uint64_t reg_x8 asm("x8") = 19; + register uint64_t reg_x0 asm("x0") = (uint64_t)fd; + register uint64_t reg_x1 asm("x1") = (uint64_t)path; + register uint64_t reg_x2 asm("x2") = (uint64_t)pathlen; + register uint64_t reg_x3 asm("x3") = (uint64_t)type; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1), "r"(reg_x2), "r"(reg_x3) + : "memory", "x4", "x5", "x6", "x7", "x9", "x10", "x11", "x12", + "x13", "x14", "x15", "x16", "x17", "x18", "d0", "d1", "d2", + "d3", "d4", "d5", "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_file_link( - cloudabi_lookup_t fd1, - const char *path1, - size_t path1len, - cloudabi_fd_t fd2, - const char *path2, - size_t path2len -) { - register uint64_t reg_x8 asm("x8") = 20; - register uint64_t reg_x0 asm("x0") = *(uint64_t *)&fd1; - register uint64_t reg_x1 asm("x1") = (uint64_t)path1; - register uint64_t reg_x2 asm("x2") = (uint64_t)path1len; - register uint64_t reg_x3 asm("x3") = (uint64_t)fd2; - register uint64_t reg_x4 asm("x4") = (uint64_t)path2; - register uint64_t reg_x5 asm("x5") = (uint64_t)path2len; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - , "r"(reg_x2) - , "r"(reg_x3) - , "r"(reg_x4) - , "r"(reg_x5) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_file_link(cloudabi_lookup_t fd1, + const char *path1, size_t path1len, + cloudabi_fd_t fd2, const char *path2, + size_t path2len) { + register uint64_t reg_x8 asm("x8") = 20; + register uint64_t reg_x0 asm("x0") = *(uint64_t *)&fd1; + register uint64_t reg_x1 asm("x1") = (uint64_t)path1; + register uint64_t reg_x2 asm("x2") = (uint64_t)path1len; + register uint64_t reg_x3 asm("x3") = (uint64_t)fd2; + register uint64_t reg_x4 asm("x4") = (uint64_t)path2; + register uint64_t reg_x5 asm("x5") = (uint64_t)path2len; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1), "r"(reg_x2), + "r"(reg_x3), "r"(reg_x4), "r"(reg_x5) + : "memory", "x6", "x7", "x9", "x10", "x11", "x12", "x13", "x14", + "x15", "x16", "x17", "x18", "d0", "d1", "d2", "d3", "d4", "d5", + "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_file_open( - cloudabi_lookup_t dirfd, - const char *path, - size_t pathlen, - cloudabi_oflags_t oflags, - const cloudabi_fdstat_t *fds, - cloudabi_fd_t *fd -) { - register uint64_t reg_x8 asm("x8") = 21; - register uint64_t reg_x0 asm("x0") = *(uint64_t *)&dirfd; - register uint64_t reg_x1 asm("x1") = (uint64_t)path; - register uint64_t reg_x2 asm("x2") = (uint64_t)pathlen; - register uint64_t reg_x3 asm("x3") = (uint64_t)oflags; - register uint64_t reg_x4 asm("x4") = (uint64_t)fds; - register uint64_t okay; - asm volatile ( - "\tsvc 0\n" - "\tcset %0, cc\n" - : "=r"(okay) - , "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - , "r"(reg_x2) - , "r"(reg_x3) - , "r"(reg_x4) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - if (okay) { - *fd = (cloudabi_fd_t)reg_x0; - return 0; - } - return reg_x0; +cloudabi_errno_t cloudabi_sys_file_open(cloudabi_lookup_t dirfd, + const char *path, size_t pathlen, + cloudabi_oflags_t oflags, + const cloudabi_fdstat_t *fds, + cloudabi_fd_t *fd) { + register uint64_t reg_x8 asm("x8") = 21; + register uint64_t reg_x0 asm("x0") = *(uint64_t *)&dirfd; + register uint64_t reg_x1 asm("x1") = (uint64_t)path; + register uint64_t reg_x2 asm("x2") = (uint64_t)pathlen; + register uint64_t reg_x3 asm("x3") = (uint64_t)oflags; + register uint64_t reg_x4 asm("x4") = (uint64_t)fds; + register uint64_t okay; + asm volatile( + "\tsvc 0\n" + "\tcset %0, cc\n" + : "=r"(okay), "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1), "r"(reg_x2), "r"(reg_x3), + "r"(reg_x4) + : "memory", "x5", "x6", "x7", "x9", "x10", "x11", "x12", "x13", "x14", + "x15", "x16", "x17", "x18", "d0", "d1", "d2", "d3", "d4", "d5", "d6", + "d7"); + if (okay) { + *fd = (cloudabi_fd_t)reg_x0; + return 0; + } + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_file_readdir( - cloudabi_fd_t fd, - void *buf, - size_t nbyte, - cloudabi_dircookie_t cookie, - size_t *bufused -) { - register uint64_t reg_x8 asm("x8") = 22; - register uint64_t reg_x0 asm("x0") = (uint64_t)fd; - register uint64_t reg_x1 asm("x1") = (uint64_t)buf; - register uint64_t reg_x2 asm("x2") = (uint64_t)nbyte; - register uint64_t reg_x3 asm("x3") = (uint64_t)cookie; - register uint64_t okay; - asm volatile ( - "\tsvc 0\n" - "\tcset %0, cc\n" - : "=r"(okay) - , "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - , "r"(reg_x2) - , "r"(reg_x3) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - if (okay) { - *bufused = (size_t)reg_x0; - return 0; - } - return reg_x0; +cloudabi_errno_t cloudabi_sys_file_readdir(cloudabi_fd_t fd, void *buf, + size_t nbyte, + cloudabi_dircookie_t cookie, + size_t *bufused) { + register uint64_t reg_x8 asm("x8") = 22; + register uint64_t reg_x0 asm("x0") = (uint64_t)fd; + register uint64_t reg_x1 asm("x1") = (uint64_t)buf; + register uint64_t reg_x2 asm("x2") = (uint64_t)nbyte; + register uint64_t reg_x3 asm("x3") = (uint64_t)cookie; + register uint64_t okay; + asm volatile( + "\tsvc 0\n" + "\tcset %0, cc\n" + : "=r"(okay), "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1), "r"(reg_x2), "r"(reg_x3) + : "memory", "x4", "x5", "x6", "x7", "x9", "x10", "x11", "x12", "x13", + "x14", "x15", "x16", "x17", "x18", "d0", "d1", "d2", "d3", "d4", "d5", + "d6", "d7"); + if (okay) { + *bufused = (size_t)reg_x0; + return 0; + } + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_file_readlink( - cloudabi_fd_t fd, - const char *path, - size_t pathlen, - char *buf, - size_t bufsize, - size_t *bufused -) { - register uint64_t reg_x8 asm("x8") = 23; - register uint64_t reg_x0 asm("x0") = (uint64_t)fd; - register uint64_t reg_x1 asm("x1") = (uint64_t)path; - register uint64_t reg_x2 asm("x2") = (uint64_t)pathlen; - register uint64_t reg_x3 asm("x3") = (uint64_t)buf; - register uint64_t reg_x4 asm("x4") = (uint64_t)bufsize; - register uint64_t okay; - asm volatile ( - "\tsvc 0\n" - "\tcset %0, cc\n" - : "=r"(okay) - , "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - , "r"(reg_x2) - , "r"(reg_x3) - , "r"(reg_x4) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - if (okay) { - *bufused = (size_t)reg_x0; - return 0; - } - return reg_x0; +cloudabi_errno_t cloudabi_sys_file_readlink(cloudabi_fd_t fd, const char *path, + size_t pathlen, char *buf, + size_t bufsize, size_t *bufused) { + register uint64_t reg_x8 asm("x8") = 23; + register uint64_t reg_x0 asm("x0") = (uint64_t)fd; + register uint64_t reg_x1 asm("x1") = (uint64_t)path; + register uint64_t reg_x2 asm("x2") = (uint64_t)pathlen; + register uint64_t reg_x3 asm("x3") = (uint64_t)buf; + register uint64_t reg_x4 asm("x4") = (uint64_t)bufsize; + register uint64_t okay; + asm volatile( + "\tsvc 0\n" + "\tcset %0, cc\n" + : "=r"(okay), "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1), "r"(reg_x2), "r"(reg_x3), + "r"(reg_x4) + : "memory", "x5", "x6", "x7", "x9", "x10", "x11", "x12", "x13", "x14", + "x15", "x16", "x17", "x18", "d0", "d1", "d2", "d3", "d4", "d5", "d6", + "d7"); + if (okay) { + *bufused = (size_t)reg_x0; + return 0; + } + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_file_rename( - cloudabi_fd_t oldfd, - const char *old, - size_t oldlen, - cloudabi_fd_t newfd, - const char *new, - size_t newlen -) { - register uint64_t reg_x8 asm("x8") = 24; - register uint64_t reg_x0 asm("x0") = (uint64_t)oldfd; - register uint64_t reg_x1 asm("x1") = (uint64_t)old; - register uint64_t reg_x2 asm("x2") = (uint64_t)oldlen; - register uint64_t reg_x3 asm("x3") = (uint64_t)newfd; - register uint64_t reg_x4 asm("x4") = (uint64_t)new; - register uint64_t reg_x5 asm("x5") = (uint64_t)newlen; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - , "r"(reg_x2) - , "r"(reg_x3) - , "r"(reg_x4) - , "r"(reg_x5) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_file_rename(cloudabi_fd_t oldfd, const char *old, + size_t oldlen, cloudabi_fd_t newfd, + const char *new, size_t newlen) { + register uint64_t reg_x8 asm("x8") = 24; + register uint64_t reg_x0 asm("x0") = (uint64_t)oldfd; + register uint64_t reg_x1 asm("x1") = (uint64_t)old; + register uint64_t reg_x2 asm("x2") = (uint64_t)oldlen; + register uint64_t reg_x3 asm("x3") = (uint64_t)newfd; + register uint64_t reg_x4 asm("x4") = (uint64_t) new; + register uint64_t reg_x5 asm("x5") = (uint64_t)newlen; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1), "r"(reg_x2), + "r"(reg_x3), "r"(reg_x4), "r"(reg_x5) + : "memory", "x6", "x7", "x9", "x10", "x11", "x12", "x13", "x14", + "x15", "x16", "x17", "x18", "d0", "d1", "d2", "d3", "d4", "d5", + "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_file_stat_fget( - cloudabi_fd_t fd, - cloudabi_filestat_t *buf -) { - register uint64_t reg_x8 asm("x8") = 25; - register uint64_t reg_x0 asm("x0") = (uint64_t)fd; - register uint64_t reg_x1 asm("x1") = (uint64_t)buf; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_file_stat_fget(cloudabi_fd_t fd, + cloudabi_filestat_t *buf) { + register uint64_t reg_x8 asm("x8") = 25; + register uint64_t reg_x0 asm("x0") = (uint64_t)fd; + register uint64_t reg_x1 asm("x1") = (uint64_t)buf; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1) + : "memory", "x2", "x3", "x4", "x5", "x6", "x7", "x9", "x10", + "x11", "x12", "x13", "x14", "x15", "x16", "x17", "x18", "d0", + "d1", "d2", "d3", "d4", "d5", "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_file_stat_fput( - cloudabi_fd_t fd, - const cloudabi_filestat_t *buf, - cloudabi_fsflags_t flags -) { - register uint64_t reg_x8 asm("x8") = 26; - register uint64_t reg_x0 asm("x0") = (uint64_t)fd; - register uint64_t reg_x1 asm("x1") = (uint64_t)buf; - register uint64_t reg_x2 asm("x2") = (uint64_t)flags; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - , "r"(reg_x2) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_file_stat_fput(cloudabi_fd_t fd, + const cloudabi_filestat_t *buf, + cloudabi_fsflags_t flags) { + register uint64_t reg_x8 asm("x8") = 26; + register uint64_t reg_x0 asm("x0") = (uint64_t)fd; + register uint64_t reg_x1 asm("x1") = (uint64_t)buf; + register uint64_t reg_x2 asm("x2") = (uint64_t)flags; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1), "r"(reg_x2) + : "memory", "x3", "x4", "x5", "x6", "x7", "x9", "x10", "x11", + "x12", "x13", "x14", "x15", "x16", "x17", "x18", "d0", "d1", + "d2", "d3", "d4", "d5", "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_file_stat_get( - cloudabi_lookup_t fd, - const char *path, - size_t pathlen, - cloudabi_filestat_t *buf -) { - register uint64_t reg_x8 asm("x8") = 27; - register uint64_t reg_x0 asm("x0") = *(uint64_t *)&fd; - register uint64_t reg_x1 asm("x1") = (uint64_t)path; - register uint64_t reg_x2 asm("x2") = (uint64_t)pathlen; - register uint64_t reg_x3 asm("x3") = (uint64_t)buf; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - , "r"(reg_x2) - , "r"(reg_x3) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_file_stat_get(cloudabi_lookup_t fd, + const char *path, size_t pathlen, + cloudabi_filestat_t *buf) { + register uint64_t reg_x8 asm("x8") = 27; + register uint64_t reg_x0 asm("x0") = *(uint64_t *)&fd; + register uint64_t reg_x1 asm("x1") = (uint64_t)path; + register uint64_t reg_x2 asm("x2") = (uint64_t)pathlen; + register uint64_t reg_x3 asm("x3") = (uint64_t)buf; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1), "r"(reg_x2), "r"(reg_x3) + : "memory", "x4", "x5", "x6", "x7", "x9", "x10", "x11", "x12", + "x13", "x14", "x15", "x16", "x17", "x18", "d0", "d1", "d2", + "d3", "d4", "d5", "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_file_stat_put( - cloudabi_lookup_t fd, - const char *path, - size_t pathlen, - const cloudabi_filestat_t *buf, - cloudabi_fsflags_t flags -) { - register uint64_t reg_x8 asm("x8") = 28; - register uint64_t reg_x0 asm("x0") = *(uint64_t *)&fd; - register uint64_t reg_x1 asm("x1") = (uint64_t)path; - register uint64_t reg_x2 asm("x2") = (uint64_t)pathlen; - register uint64_t reg_x3 asm("x3") = (uint64_t)buf; - register uint64_t reg_x4 asm("x4") = (uint64_t)flags; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - , "r"(reg_x2) - , "r"(reg_x3) - , "r"(reg_x4) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_file_stat_put(cloudabi_lookup_t fd, + const char *path, size_t pathlen, + const cloudabi_filestat_t *buf, + cloudabi_fsflags_t flags) { + register uint64_t reg_x8 asm("x8") = 28; + register uint64_t reg_x0 asm("x0") = *(uint64_t *)&fd; + register uint64_t reg_x1 asm("x1") = (uint64_t)path; + register uint64_t reg_x2 asm("x2") = (uint64_t)pathlen; + register uint64_t reg_x3 asm("x3") = (uint64_t)buf; + register uint64_t reg_x4 asm("x4") = (uint64_t)flags; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1), "r"(reg_x2), + "r"(reg_x3), "r"(reg_x4) + : "memory", "x5", "x6", "x7", "x9", "x10", "x11", "x12", "x13", + "x14", "x15", "x16", "x17", "x18", "d0", "d1", "d2", "d3", + "d4", "d5", "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_file_symlink( - const char *path1, - size_t path1len, - cloudabi_fd_t fd, - const char *path2, - size_t path2len -) { - register uint64_t reg_x8 asm("x8") = 29; - register uint64_t reg_x0 asm("x0") = (uint64_t)path1; - register uint64_t reg_x1 asm("x1") = (uint64_t)path1len; - register uint64_t reg_x2 asm("x2") = (uint64_t)fd; - register uint64_t reg_x3 asm("x3") = (uint64_t)path2; - register uint64_t reg_x4 asm("x4") = (uint64_t)path2len; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - , "r"(reg_x2) - , "r"(reg_x3) - , "r"(reg_x4) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_file_symlink(const char *path1, size_t path1len, + cloudabi_fd_t fd, const char *path2, + size_t path2len) { + register uint64_t reg_x8 asm("x8") = 29; + register uint64_t reg_x0 asm("x0") = (uint64_t)path1; + register uint64_t reg_x1 asm("x1") = (uint64_t)path1len; + register uint64_t reg_x2 asm("x2") = (uint64_t)fd; + register uint64_t reg_x3 asm("x3") = (uint64_t)path2; + register uint64_t reg_x4 asm("x4") = (uint64_t)path2len; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1), "r"(reg_x2), + "r"(reg_x3), "r"(reg_x4) + : "memory", "x5", "x6", "x7", "x9", "x10", "x11", "x12", "x13", + "x14", "x15", "x16", "x17", "x18", "d0", "d1", "d2", "d3", + "d4", "d5", "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_file_unlink( - cloudabi_fd_t fd, - const char *path, - size_t pathlen, - cloudabi_ulflags_t flags -) { - register uint64_t reg_x8 asm("x8") = 30; - register uint64_t reg_x0 asm("x0") = (uint64_t)fd; - register uint64_t reg_x1 asm("x1") = (uint64_t)path; - register uint64_t reg_x2 asm("x2") = (uint64_t)pathlen; - register uint64_t reg_x3 asm("x3") = (uint64_t)flags; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - , "r"(reg_x2) - , "r"(reg_x3) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_file_unlink(cloudabi_fd_t fd, const char *path, + size_t pathlen, + cloudabi_ulflags_t flags) { + register uint64_t reg_x8 asm("x8") = 30; + register uint64_t reg_x0 asm("x0") = (uint64_t)fd; + register uint64_t reg_x1 asm("x1") = (uint64_t)path; + register uint64_t reg_x2 asm("x2") = (uint64_t)pathlen; + register uint64_t reg_x3 asm("x3") = (uint64_t)flags; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1), "r"(reg_x2), "r"(reg_x3) + : "memory", "x4", "x5", "x6", "x7", "x9", "x10", "x11", "x12", + "x13", "x14", "x15", "x16", "x17", "x18", "d0", "d1", "d2", + "d3", "d4", "d5", "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_lock_unlock( - _Atomic(cloudabi_lock_t) *lock, - cloudabi_scope_t scope -) { - register uint64_t reg_x8 asm("x8") = 31; - register uint64_t reg_x0 asm("x0") = (uint64_t)lock; - register uint64_t reg_x1 asm("x1") = (uint64_t)scope; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_lock_unlock(_Atomic(cloudabi_lock_t) * lock, + cloudabi_scope_t scope) { + register uint64_t reg_x8 asm("x8") = 31; + register uint64_t reg_x0 asm("x0") = (uint64_t)lock; + register uint64_t reg_x1 asm("x1") = (uint64_t)scope; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1) + : "memory", "x2", "x3", "x4", "x5", "x6", "x7", "x9", "x10", + "x11", "x12", "x13", "x14", "x15", "x16", "x17", "x18", "d0", + "d1", "d2", "d3", "d4", "d5", "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_mem_advise( - void *addr, - size_t len, - cloudabi_advice_t advice -) { - register uint64_t reg_x8 asm("x8") = 32; - register uint64_t reg_x0 asm("x0") = (uint64_t)addr; - register uint64_t reg_x1 asm("x1") = (uint64_t)len; - register uint64_t reg_x2 asm("x2") = (uint64_t)advice; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - , "r"(reg_x2) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_mem_advise(void *addr, size_t len, + cloudabi_advice_t advice) { + register uint64_t reg_x8 asm("x8") = 32; + register uint64_t reg_x0 asm("x0") = (uint64_t)addr; + register uint64_t reg_x1 asm("x1") = (uint64_t)len; + register uint64_t reg_x2 asm("x2") = (uint64_t)advice; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1), "r"(reg_x2) + : "memory", "x3", "x4", "x5", "x6", "x7", "x9", "x10", "x11", + "x12", "x13", "x14", "x15", "x16", "x17", "x18", "d0", "d1", + "d2", "d3", "d4", "d5", "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_mem_lock( - const void *addr, - size_t len -) { - register uint64_t reg_x8 asm("x8") = 33; - register uint64_t reg_x0 asm("x0") = (uint64_t)addr; - register uint64_t reg_x1 asm("x1") = (uint64_t)len; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_mem_lock(const void *addr, size_t len) { + register uint64_t reg_x8 asm("x8") = 33; + register uint64_t reg_x0 asm("x0") = (uint64_t)addr; + register uint64_t reg_x1 asm("x1") = (uint64_t)len; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1) + : "memory", "x2", "x3", "x4", "x5", "x6", "x7", "x9", "x10", + "x11", "x12", "x13", "x14", "x15", "x16", "x17", "x18", "d0", + "d1", "d2", "d3", "d4", "d5", "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_mem_map( - void *addr, - size_t len, - cloudabi_mprot_t prot, - cloudabi_mflags_t flags, - cloudabi_fd_t fd, - cloudabi_filesize_t off, - void **mem -) { - register uint64_t reg_x8 asm("x8") = 34; - register uint64_t reg_x0 asm("x0") = (uint64_t)addr; - register uint64_t reg_x1 asm("x1") = (uint64_t)len; - register uint64_t reg_x2 asm("x2") = (uint64_t)prot; - register uint64_t reg_x3 asm("x3") = (uint64_t)flags; - register uint64_t reg_x4 asm("x4") = (uint64_t)fd; - register uint64_t reg_x5 asm("x5") = (uint64_t)off; - register uint64_t okay; - asm volatile ( - "\tsvc 0\n" - "\tcset %0, cc\n" - : "=r"(okay) - , "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - , "r"(reg_x2) - , "r"(reg_x3) - , "r"(reg_x4) - , "r"(reg_x5) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - if (okay) { - *mem = (void *)reg_x0; - return 0; - } - return reg_x0; +cloudabi_errno_t cloudabi_sys_mem_map(void *addr, size_t len, + cloudabi_mprot_t prot, + cloudabi_mflags_t flags, cloudabi_fd_t fd, + cloudabi_filesize_t off, void **mem) { + register uint64_t reg_x8 asm("x8") = 34; + register uint64_t reg_x0 asm("x0") = (uint64_t)addr; + register uint64_t reg_x1 asm("x1") = (uint64_t)len; + register uint64_t reg_x2 asm("x2") = (uint64_t)prot; + register uint64_t reg_x3 asm("x3") = (uint64_t)flags; + register uint64_t reg_x4 asm("x4") = (uint64_t)fd; + register uint64_t reg_x5 asm("x5") = (uint64_t)off; + register uint64_t okay; + asm volatile( + "\tsvc 0\n" + "\tcset %0, cc\n" + : "=r"(okay), "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1), "r"(reg_x2), "r"(reg_x3), + "r"(reg_x4), "r"(reg_x5) + : "memory", "x6", "x7", "x9", "x10", "x11", "x12", "x13", "x14", "x15", + "x16", "x17", "x18", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); + if (okay) { + *mem = (void *)reg_x0; + return 0; + } + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_mem_protect( - void *addr, - size_t len, - cloudabi_mprot_t prot -) { - register uint64_t reg_x8 asm("x8") = 35; - register uint64_t reg_x0 asm("x0") = (uint64_t)addr; - register uint64_t reg_x1 asm("x1") = (uint64_t)len; - register uint64_t reg_x2 asm("x2") = (uint64_t)prot; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - , "r"(reg_x2) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_mem_protect(void *addr, size_t len, + cloudabi_mprot_t prot) { + register uint64_t reg_x8 asm("x8") = 35; + register uint64_t reg_x0 asm("x0") = (uint64_t)addr; + register uint64_t reg_x1 asm("x1") = (uint64_t)len; + register uint64_t reg_x2 asm("x2") = (uint64_t)prot; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1), "r"(reg_x2) + : "memory", "x3", "x4", "x5", "x6", "x7", "x9", "x10", "x11", + "x12", "x13", "x14", "x15", "x16", "x17", "x18", "d0", "d1", + "d2", "d3", "d4", "d5", "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_mem_sync( - void *addr, - size_t len, - cloudabi_msflags_t flags -) { - register uint64_t reg_x8 asm("x8") = 36; - register uint64_t reg_x0 asm("x0") = (uint64_t)addr; - register uint64_t reg_x1 asm("x1") = (uint64_t)len; - register uint64_t reg_x2 asm("x2") = (uint64_t)flags; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - , "r"(reg_x2) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_mem_sync(void *addr, size_t len, + cloudabi_msflags_t flags) { + register uint64_t reg_x8 asm("x8") = 36; + register uint64_t reg_x0 asm("x0") = (uint64_t)addr; + register uint64_t reg_x1 asm("x1") = (uint64_t)len; + register uint64_t reg_x2 asm("x2") = (uint64_t)flags; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1), "r"(reg_x2) + : "memory", "x3", "x4", "x5", "x6", "x7", "x9", "x10", "x11", + "x12", "x13", "x14", "x15", "x16", "x17", "x18", "d0", "d1", + "d2", "d3", "d4", "d5", "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_mem_unlock( - const void *addr, - size_t len -) { - register uint64_t reg_x8 asm("x8") = 37; - register uint64_t reg_x0 asm("x0") = (uint64_t)addr; - register uint64_t reg_x1 asm("x1") = (uint64_t)len; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_mem_unlock(const void *addr, size_t len) { + register uint64_t reg_x8 asm("x8") = 37; + register uint64_t reg_x0 asm("x0") = (uint64_t)addr; + register uint64_t reg_x1 asm("x1") = (uint64_t)len; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1) + : "memory", "x2", "x3", "x4", "x5", "x6", "x7", "x9", "x10", + "x11", "x12", "x13", "x14", "x15", "x16", "x17", "x18", "d0", + "d1", "d2", "d3", "d4", "d5", "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_mem_unmap( - void *addr, - size_t len -) { - register uint64_t reg_x8 asm("x8") = 38; - register uint64_t reg_x0 asm("x0") = (uint64_t)addr; - register uint64_t reg_x1 asm("x1") = (uint64_t)len; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_mem_unmap(void *addr, size_t len) { + register uint64_t reg_x8 asm("x8") = 38; + register uint64_t reg_x0 asm("x0") = (uint64_t)addr; + register uint64_t reg_x1 asm("x1") = (uint64_t)len; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1) + : "memory", "x2", "x3", "x4", "x5", "x6", "x7", "x9", "x10", + "x11", "x12", "x13", "x14", "x15", "x16", "x17", "x18", "d0", + "d1", "d2", "d3", "d4", "d5", "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_poll( - const cloudabi_subscription_t *in, - cloudabi_event_t *out, - size_t nsubscriptions, - size_t *nevents -) { - register uint64_t reg_x8 asm("x8") = 39; - register uint64_t reg_x0 asm("x0") = (uint64_t)in; - register uint64_t reg_x1 asm("x1") = (uint64_t)out; - register uint64_t reg_x2 asm("x2") = (uint64_t)nsubscriptions; - register uint64_t okay; - asm volatile ( - "\tsvc 0\n" - "\tcset %0, cc\n" - : "=r"(okay) - , "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - , "r"(reg_x2) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - if (okay) { - *nevents = (size_t)reg_x0; - return 0; - } - return reg_x0; +cloudabi_errno_t cloudabi_sys_poll(const cloudabi_subscription_t *in, + cloudabi_event_t *out, size_t nsubscriptions, + size_t *nevents) { + register uint64_t reg_x8 asm("x8") = 39; + register uint64_t reg_x0 asm("x0") = (uint64_t)in; + register uint64_t reg_x1 asm("x1") = (uint64_t)out; + register uint64_t reg_x2 asm("x2") = (uint64_t)nsubscriptions; + register uint64_t okay; + asm volatile( + "\tsvc 0\n" + "\tcset %0, cc\n" + : "=r"(okay), "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1), "r"(reg_x2) + : "memory", "x3", "x4", "x5", "x6", "x7", "x9", "x10", "x11", "x12", + "x13", "x14", "x15", "x16", "x17", "x18", "d0", "d1", "d2", "d3", "d4", + "d5", "d6", "d7"); + if (okay) { + *nevents = (size_t)reg_x0; + return 0; + } + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_poll_fd( - cloudabi_fd_t fd, - const cloudabi_subscription_t *in, - size_t nin, - cloudabi_event_t *out, - size_t nout, - const cloudabi_subscription_t *timeout, - size_t *nevents -) { - register uint64_t reg_x8 asm("x8") = 57; - register uint64_t reg_x0 asm("x0") = (uint64_t)fd; - register uint64_t reg_x1 asm("x1") = (uint64_t)in; - register uint64_t reg_x2 asm("x2") = (uint64_t)nin; - register uint64_t reg_x3 asm("x3") = (uint64_t)out; - register uint64_t reg_x4 asm("x4") = (uint64_t)nout; - register uint64_t reg_x5 asm("x5") = (uint64_t)timeout; - register uint64_t okay; - asm volatile ( - "\tsvc 0\n" - "\tcset %0, cc\n" - : "=r"(okay) - , "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - , "r"(reg_x2) - , "r"(reg_x3) - , "r"(reg_x4) - , "r"(reg_x5) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - if (okay) { - *nevents = (size_t)reg_x0; - return 0; - } - return reg_x0; +cloudabi_errno_t cloudabi_sys_poll_fd(cloudabi_fd_t fd, + const cloudabi_subscription_t *in, + size_t nin, cloudabi_event_t *out, + size_t nout, + const cloudabi_subscription_t *timeout, + size_t *nevents) { + register uint64_t reg_x8 asm("x8") = 40; + register uint64_t reg_x0 asm("x0") = (uint64_t)fd; + register uint64_t reg_x1 asm("x1") = (uint64_t)in; + register uint64_t reg_x2 asm("x2") = (uint64_t)nin; + register uint64_t reg_x3 asm("x3") = (uint64_t)out; + register uint64_t reg_x4 asm("x4") = (uint64_t)nout; + register uint64_t reg_x5 asm("x5") = (uint64_t)timeout; + register uint64_t okay; + asm volatile( + "\tsvc 0\n" + "\tcset %0, cc\n" + : "=r"(okay), "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1), "r"(reg_x2), "r"(reg_x3), + "r"(reg_x4), "r"(reg_x5) + : "memory", "x6", "x7", "x9", "x10", "x11", "x12", "x13", "x14", "x15", + "x16", "x17", "x18", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); + if (okay) { + *nevents = (size_t)reg_x0; + return 0; + } + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_proc_exec( - cloudabi_fd_t fd, - const void *data, - size_t datalen, - const cloudabi_fd_t *fds, - size_t fdslen -) { - register uint64_t reg_x8 asm("x8") = 40; - register uint64_t reg_x0 asm("x0") = (uint64_t)fd; - register uint64_t reg_x1 asm("x1") = (uint64_t)data; - register uint64_t reg_x2 asm("x2") = (uint64_t)datalen; - register uint64_t reg_x3 asm("x3") = (uint64_t)fds; - register uint64_t reg_x4 asm("x4") = (uint64_t)fdslen; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - , "r"(reg_x2) - , "r"(reg_x3) - , "r"(reg_x4) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_proc_exec(cloudabi_fd_t fd, const void *data, + size_t datalen, + const cloudabi_fd_t *fds, + size_t fdslen) { + register uint64_t reg_x8 asm("x8") = 41; + register uint64_t reg_x0 asm("x0") = (uint64_t)fd; + register uint64_t reg_x1 asm("x1") = (uint64_t)data; + register uint64_t reg_x2 asm("x2") = (uint64_t)datalen; + register uint64_t reg_x3 asm("x3") = (uint64_t)fds; + register uint64_t reg_x4 asm("x4") = (uint64_t)fdslen; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1), "r"(reg_x2), + "r"(reg_x3), "r"(reg_x4) + : "memory", "x5", "x6", "x7", "x9", "x10", "x11", "x12", "x13", + "x14", "x15", "x16", "x17", "x18", "d0", "d1", "d2", "d3", + "d4", "d5", "d6", "d7"); + return reg_x0; } -_Noreturn void -cloudabi_sys_proc_exit( - cloudabi_exitcode_t rval -) { - register uint64_t reg_x8 asm("x8") = 41; - register uint64_t reg_x0 asm("x0") = (uint64_t)rval; - asm volatile ( - "\tsvc 0\n" - : - : "r"(reg_x8) - , "r"(reg_x0) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - for (;;); +_Noreturn void cloudabi_sys_proc_exit(cloudabi_exitcode_t rval) { + register uint64_t reg_x8 asm("x8") = 42; + register uint64_t reg_x0 asm("x0") = (uint64_t)rval; + asm volatile("\tsvc 0\n" + : + : "r"(reg_x8), "r"(reg_x0) + : "memory", "x1", "x2", "x3", "x4", "x5", "x6", "x7", "x9", + "x10", "x11", "x12", "x13", "x14", "x15", "x16", "x17", "x18", + "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); + for (;;) + ; } -cloudabi_errno_t -cloudabi_sys_proc_fork( - cloudabi_fd_t *fd, - cloudabi_tid_t *tid -) { - register uint64_t reg_x8 asm("x8") = 42; - register uint64_t reg_x0 asm("x0"); - register uint64_t reg_x1 asm("x1"); - register uint64_t okay; - asm volatile ( - "\tsvc 0\n" - "\tcset %0, cc\n" - : "=r"(okay) - , "=r"(reg_x0) - , "=r"(reg_x1) - : "r"(reg_x8) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - if (okay) { - *fd = (cloudabi_fd_t)reg_x0; - *tid = (cloudabi_tid_t)reg_x1; - return 0; - } - return reg_x0; +cloudabi_errno_t cloudabi_sys_proc_fork(cloudabi_fd_t *fd, + cloudabi_tid_t *tid) { + register uint64_t reg_x8 asm("x8") = 43; + register uint64_t reg_x0 asm("x0"); + register uint64_t reg_x1 asm("x1"); + register uint64_t okay; + asm volatile( + "\tsvc 0\n" + "\tcset %0, cc\n" + : "=r"(okay), "=r"(reg_x0), "=r"(reg_x1) + : "r"(reg_x8) + : "memory", "x2", "x3", "x4", "x5", "x6", "x7", "x9", "x10", "x11", "x12", + "x13", "x14", "x15", "x16", "x17", "x18", "d0", "d1", "d2", "d3", "d4", + "d5", "d6", "d7"); + if (okay) { + *fd = (cloudabi_fd_t)reg_x0; + *tid = (cloudabi_tid_t)reg_x1; + return 0; + } + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_proc_raise( - cloudabi_signal_t sig -) { - register uint64_t reg_x8 asm("x8") = 43; - register uint64_t reg_x0 asm("x0") = (uint64_t)sig; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_proc_raise(cloudabi_signal_t sig) { + register uint64_t reg_x8 asm("x8") = 44; + register uint64_t reg_x0 asm("x0") = (uint64_t)sig; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0) + : "memory", "x1", "x2", "x3", "x4", "x5", "x6", "x7", "x9", + "x10", "x11", "x12", "x13", "x14", "x15", "x16", "x17", "x18", + "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_random_get( - void *buf, - size_t nbyte -) { - register uint64_t reg_x8 asm("x8") = 44; - register uint64_t reg_x0 asm("x0") = (uint64_t)buf; - register uint64_t reg_x1 asm("x1") = (uint64_t)nbyte; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_random_get(void *buf, size_t nbyte) { + register uint64_t reg_x8 asm("x8") = 45; + register uint64_t reg_x0 asm("x0") = (uint64_t)buf; + register uint64_t reg_x1 asm("x1") = (uint64_t)nbyte; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1) + : "memory", "x2", "x3", "x4", "x5", "x6", "x7", "x9", "x10", + "x11", "x12", "x13", "x14", "x15", "x16", "x17", "x18", "d0", + "d1", "d2", "d3", "d4", "d5", "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_sock_accept( - cloudabi_fd_t sock, - cloudabi_sockstat_t *buf, - cloudabi_fd_t *conn -) { - register uint64_t reg_x8 asm("x8") = 45; - register uint64_t reg_x0 asm("x0") = (uint64_t)sock; - register uint64_t reg_x1 asm("x1") = (uint64_t)buf; - register uint64_t okay; - asm volatile ( - "\tsvc 0\n" - "\tcset %0, cc\n" - : "=r"(okay) - , "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - if (okay) { - *conn = (cloudabi_fd_t)reg_x0; - return 0; - } - return reg_x0; +cloudabi_errno_t cloudabi_sys_sock_accept(cloudabi_fd_t sock, + cloudabi_sockstat_t *buf, + cloudabi_fd_t *conn) { + register uint64_t reg_x8 asm("x8") = 46; + register uint64_t reg_x0 asm("x0") = (uint64_t)sock; + register uint64_t reg_x1 asm("x1") = (uint64_t)buf; + register uint64_t okay; + asm volatile( + "\tsvc 0\n" + "\tcset %0, cc\n" + : "=r"(okay), "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1) + : "memory", "x2", "x3", "x4", "x5", "x6", "x7", "x9", "x10", "x11", "x12", + "x13", "x14", "x15", "x16", "x17", "x18", "d0", "d1", "d2", "d3", "d4", + "d5", "d6", "d7"); + if (okay) { + *conn = (cloudabi_fd_t)reg_x0; + return 0; + } + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_sock_bind( - cloudabi_fd_t sock, - cloudabi_fd_t fd, - const char *path, - size_t pathlen -) { - register uint64_t reg_x8 asm("x8") = 46; - register uint64_t reg_x0 asm("x0") = (uint64_t)sock; - register uint64_t reg_x1 asm("x1") = (uint64_t)fd; - register uint64_t reg_x2 asm("x2") = (uint64_t)path; - register uint64_t reg_x3 asm("x3") = (uint64_t)pathlen; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - , "r"(reg_x2) - , "r"(reg_x3) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_sock_bind(cloudabi_fd_t sock, cloudabi_fd_t fd, + const char *path, size_t pathlen) { + register uint64_t reg_x8 asm("x8") = 47; + register uint64_t reg_x0 asm("x0") = (uint64_t)sock; + register uint64_t reg_x1 asm("x1") = (uint64_t)fd; + register uint64_t reg_x2 asm("x2") = (uint64_t)path; + register uint64_t reg_x3 asm("x3") = (uint64_t)pathlen; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1), "r"(reg_x2), "r"(reg_x3) + : "memory", "x4", "x5", "x6", "x7", "x9", "x10", "x11", "x12", + "x13", "x14", "x15", "x16", "x17", "x18", "d0", "d1", "d2", + "d3", "d4", "d5", "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_sock_connect( - cloudabi_fd_t sock, - cloudabi_fd_t fd, - const char *path, - size_t pathlen -) { - register uint64_t reg_x8 asm("x8") = 47; - register uint64_t reg_x0 asm("x0") = (uint64_t)sock; - register uint64_t reg_x1 asm("x1") = (uint64_t)fd; - register uint64_t reg_x2 asm("x2") = (uint64_t)path; - register uint64_t reg_x3 asm("x3") = (uint64_t)pathlen; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - , "r"(reg_x2) - , "r"(reg_x3) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_sock_connect(cloudabi_fd_t sock, cloudabi_fd_t fd, + const char *path, size_t pathlen) { + register uint64_t reg_x8 asm("x8") = 48; + register uint64_t reg_x0 asm("x0") = (uint64_t)sock; + register uint64_t reg_x1 asm("x1") = (uint64_t)fd; + register uint64_t reg_x2 asm("x2") = (uint64_t)path; + register uint64_t reg_x3 asm("x3") = (uint64_t)pathlen; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1), "r"(reg_x2), "r"(reg_x3) + : "memory", "x4", "x5", "x6", "x7", "x9", "x10", "x11", "x12", + "x13", "x14", "x15", "x16", "x17", "x18", "d0", "d1", "d2", + "d3", "d4", "d5", "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_sock_listen( - cloudabi_fd_t sock, - cloudabi_backlog_t backlog -) { - register uint64_t reg_x8 asm("x8") = 48; - register uint64_t reg_x0 asm("x0") = (uint64_t)sock; - register uint64_t reg_x1 asm("x1") = (uint64_t)backlog; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_sock_listen(cloudabi_fd_t sock, + cloudabi_backlog_t backlog) { + register uint64_t reg_x8 asm("x8") = 49; + register uint64_t reg_x0 asm("x0") = (uint64_t)sock; + register uint64_t reg_x1 asm("x1") = (uint64_t)backlog; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1) + : "memory", "x2", "x3", "x4", "x5", "x6", "x7", "x9", "x10", + "x11", "x12", "x13", "x14", "x15", "x16", "x17", "x18", "d0", + "d1", "d2", "d3", "d4", "d5", "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_sock_recv( - cloudabi_fd_t sock, - const cloudabi_recv_in_t *in, - cloudabi_recv_out_t *out -) { - register uint64_t reg_x8 asm("x8") = 49; - register uint64_t reg_x0 asm("x0") = (uint64_t)sock; - register uint64_t reg_x1 asm("x1") = (uint64_t)in; - register uint64_t reg_x2 asm("x2") = (uint64_t)out; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - , "r"(reg_x2) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_sock_recv(cloudabi_fd_t sock, + const cloudabi_recv_in_t *in, + cloudabi_recv_out_t *out) { + register uint64_t reg_x8 asm("x8") = 50; + register uint64_t reg_x0 asm("x0") = (uint64_t)sock; + register uint64_t reg_x1 asm("x1") = (uint64_t)in; + register uint64_t reg_x2 asm("x2") = (uint64_t)out; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1), "r"(reg_x2) + : "memory", "x3", "x4", "x5", "x6", "x7", "x9", "x10", "x11", + "x12", "x13", "x14", "x15", "x16", "x17", "x18", "d0", "d1", + "d2", "d3", "d4", "d5", "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_sock_send( - cloudabi_fd_t sock, - const cloudabi_send_in_t *in, - cloudabi_send_out_t *out -) { - register uint64_t reg_x8 asm("x8") = 50; - register uint64_t reg_x0 asm("x0") = (uint64_t)sock; - register uint64_t reg_x1 asm("x1") = (uint64_t)in; - register uint64_t reg_x2 asm("x2") = (uint64_t)out; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - , "r"(reg_x2) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_sock_send(cloudabi_fd_t sock, + const cloudabi_send_in_t *in, + cloudabi_send_out_t *out) { + register uint64_t reg_x8 asm("x8") = 51; + register uint64_t reg_x0 asm("x0") = (uint64_t)sock; + register uint64_t reg_x1 asm("x1") = (uint64_t)in; + register uint64_t reg_x2 asm("x2") = (uint64_t)out; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1), "r"(reg_x2) + : "memory", "x3", "x4", "x5", "x6", "x7", "x9", "x10", "x11", + "x12", "x13", "x14", "x15", "x16", "x17", "x18", "d0", "d1", + "d2", "d3", "d4", "d5", "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_sock_shutdown( - cloudabi_fd_t sock, - cloudabi_sdflags_t how -) { - register uint64_t reg_x8 asm("x8") = 51; - register uint64_t reg_x0 asm("x0") = (uint64_t)sock; - register uint64_t reg_x1 asm("x1") = (uint64_t)how; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_sock_shutdown(cloudabi_fd_t sock, + cloudabi_sdflags_t how) { + register uint64_t reg_x8 asm("x8") = 52; + register uint64_t reg_x0 asm("x0") = (uint64_t)sock; + register uint64_t reg_x1 asm("x1") = (uint64_t)how; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1) + : "memory", "x2", "x3", "x4", "x5", "x6", "x7", "x9", "x10", + "x11", "x12", "x13", "x14", "x15", "x16", "x17", "x18", "d0", + "d1", "d2", "d3", "d4", "d5", "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_sock_stat_get( - cloudabi_fd_t sock, - cloudabi_sockstat_t *buf, - cloudabi_ssflags_t flags -) { - register uint64_t reg_x8 asm("x8") = 52; - register uint64_t reg_x0 asm("x0") = (uint64_t)sock; - register uint64_t reg_x1 asm("x1") = (uint64_t)buf; - register uint64_t reg_x2 asm("x2") = (uint64_t)flags; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - , "r"(reg_x2) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_sock_stat_get(cloudabi_fd_t sock, + cloudabi_sockstat_t *buf, + cloudabi_ssflags_t flags) { + register uint64_t reg_x8 asm("x8") = 53; + register uint64_t reg_x0 asm("x0") = (uint64_t)sock; + register uint64_t reg_x1 asm("x1") = (uint64_t)buf; + register uint64_t reg_x2 asm("x2") = (uint64_t)flags; + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1), "r"(reg_x2) + : "memory", "x3", "x4", "x5", "x6", "x7", "x9", "x10", "x11", + "x12", "x13", "x14", "x15", "x16", "x17", "x18", "d0", "d1", + "d2", "d3", "d4", "d5", "d6", "d7"); + return reg_x0; } -cloudabi_errno_t -cloudabi_sys_thread_create( - cloudabi_threadattr_t *attr, - cloudabi_tid_t *tid -) { - register uint64_t reg_x8 asm("x8") = 53; - register uint64_t reg_x0 asm("x0") = (uint64_t)attr; - register uint64_t okay; - asm volatile ( - "\tsvc 0\n" - "\tcset %0, cc\n" - : "=r"(okay) - , "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - if (okay) { - *tid = (cloudabi_tid_t)reg_x0; - return 0; - } - return reg_x0; +cloudabi_errno_t cloudabi_sys_thread_create(cloudabi_threadattr_t *attr, + cloudabi_tid_t *tid) { + register uint64_t reg_x8 asm("x8") = 54; + register uint64_t reg_x0 asm("x0") = (uint64_t)attr; + register uint64_t okay; + asm volatile( + "\tsvc 0\n" + "\tcset %0, cc\n" + : "=r"(okay), "=r"(reg_x0) + : "r"(reg_x8), "r"(reg_x0) + : "memory", "x1", "x2", "x3", "x4", "x5", "x6", "x7", "x9", "x10", "x11", + "x12", "x13", "x14", "x15", "x16", "x17", "x18", "d0", "d1", "d2", "d3", + "d4", "d5", "d6", "d7"); + if (okay) { + *tid = (cloudabi_tid_t)reg_x0; + return 0; + } + return reg_x0; } -_Noreturn void -cloudabi_sys_thread_exit( - _Atomic(cloudabi_lock_t) *lock, - cloudabi_scope_t scope -) { - register uint64_t reg_x8 asm("x8") = 54; - register uint64_t reg_x0 asm("x0") = (uint64_t)lock; - register uint64_t reg_x1 asm("x1") = (uint64_t)scope; - asm volatile ( - "\tsvc 0\n" - : - : "r"(reg_x8) - , "r"(reg_x0) - , "r"(reg_x1) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - for (;;); +_Noreturn void cloudabi_sys_thread_exit(_Atomic(cloudabi_lock_t) * lock, + cloudabi_scope_t scope) { + register uint64_t reg_x8 asm("x8") = 55; + register uint64_t reg_x0 asm("x0") = (uint64_t)lock; + register uint64_t reg_x1 asm("x1") = (uint64_t)scope; + asm volatile("\tsvc 0\n" + : + : "r"(reg_x8), "r"(reg_x0), "r"(reg_x1) + : "memory", "x2", "x3", "x4", "x5", "x6", "x7", "x9", "x10", + "x11", "x12", "x13", "x14", "x15", "x16", "x17", "x18", "d0", + "d1", "d2", "d3", "d4", "d5", "d6", "d7"); + for (;;) + ; } -cloudabi_errno_t -cloudabi_sys_thread_tcb_set( - void *tcb -) { - register uint64_t reg_x8 asm("x8") = 55; - register uint64_t reg_x0 asm("x0") = (uint64_t)tcb; - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - , "r"(reg_x0) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; +cloudabi_errno_t cloudabi_sys_thread_yield(void) { + register uint64_t reg_x8 asm("x8") = 56; + register uint64_t reg_x0 asm("x0"); + asm volatile("\tsvc 0\n" + : "=r"(reg_x0) + : "r"(reg_x8) + : "memory", "x1", "x2", "x3", "x4", "x5", "x6", "x7", "x9", + "x10", "x11", "x12", "x13", "x14", "x15", "x16", "x17", "x18", + "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); + return reg_x0; } - -cloudabi_errno_t -cloudabi_sys_thread_yield(void) { - register uint64_t reg_x8 asm("x8") = 56; - register uint64_t reg_x0 asm("x0"); - asm volatile ( - "\tsvc 0\n" - : "=r"(reg_x0) - : "r"(reg_x8) - : "memory" - , "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7" - , "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15" - , "x16", "x17", "x18" - , "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7"); - return reg_x0; -} - Index: head/sys/contrib/cloudabi/cloudabi_vdso_x86_64.c =================================================================== --- head/sys/contrib/cloudabi/cloudabi_vdso_x86_64.c (revision 304477) +++ head/sys/contrib/cloudabi/cloudabi_vdso_x86_64.c (revision 304478) @@ -1,1376 +1,950 @@ // Copyright (c) 2016 Nuxi (https://nuxi.nl/) and contributors. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // 1. Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // 2. Redistributions in binary form must 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 -cloudabi_errno_t -cloudabi_sys_clock_res_get( - cloudabi_clockid_t clock_id, - cloudabi_timestamp_t *resolution -) { - register uint64_t reg_rax asm("rax") = 0; - register uint64_t reg_rdi asm("rdi") = (uint64_t)clock_id; - register char okay; - asm volatile ( - "\tsyscall\n" - "\tsetnc %0\n" - : "=r"(okay) - , "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - if (okay) { - *resolution = (cloudabi_timestamp_t)reg_rax; - return 0; - } - return reg_rax; +cloudabi_errno_t cloudabi_sys_clock_res_get(cloudabi_clockid_t clock_id, + cloudabi_timestamp_t *resolution) { + register uint64_t reg_rax asm("rax") = 0; + register uint64_t reg_rdi asm("rdi") = (uint64_t)clock_id; + register char okay; + asm volatile( + "\tsyscall\n" + "\tsetnc %0\n" + : "=r"(okay), "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi) + : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); + if (okay) { + *resolution = (cloudabi_timestamp_t)reg_rax; + return 0; + } + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_clock_time_get( - cloudabi_clockid_t clock_id, - cloudabi_timestamp_t precision, - cloudabi_timestamp_t *time -) { - register uint64_t reg_rax asm("rax") = 1; - register uint64_t reg_rdi asm("rdi") = (uint64_t)clock_id; - register uint64_t reg_rsi asm("rsi") = (uint64_t)precision; - register char okay; - asm volatile ( - "\tsyscall\n" - "\tsetnc %0\n" - : "=r"(okay) - , "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - if (okay) { - *time = (cloudabi_timestamp_t)reg_rax; - return 0; - } - return reg_rax; +cloudabi_errno_t cloudabi_sys_clock_time_get(cloudabi_clockid_t clock_id, + cloudabi_timestamp_t precision, + cloudabi_timestamp_t *time) { + register uint64_t reg_rax asm("rax") = 1; + register uint64_t reg_rdi asm("rdi") = (uint64_t)clock_id; + register uint64_t reg_rsi asm("rsi") = (uint64_t)precision; + register char okay; + asm volatile( + "\tsyscall\n" + "\tsetnc %0\n" + : "=r"(okay), "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi) + : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); + if (okay) { + *time = (cloudabi_timestamp_t)reg_rax; + return 0; + } + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_condvar_signal( - _Atomic(cloudabi_condvar_t) *condvar, - cloudabi_scope_t scope, - cloudabi_nthreads_t nwaiters -) { - register uint64_t reg_rax asm("rax") = 2; - register uint64_t reg_rdi asm("rdi") = (uint64_t)condvar; - register uint64_t reg_rsi asm("rsi") = (uint64_t)scope; - register uint64_t reg_rdx asm("rdx") = (uint64_t)nwaiters; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - , "r"(reg_rdx) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_condvar_signal(_Atomic(cloudabi_condvar_t) * + condvar, + cloudabi_scope_t scope, + cloudabi_nthreads_t nwaiters) { + register uint64_t reg_rax asm("rax") = 2; + register uint64_t reg_rdi asm("rdi") = (uint64_t)condvar; + register uint64_t reg_rsi asm("rsi") = (uint64_t)scope; + register uint64_t reg_rdx asm("rdx") = (uint64_t)nwaiters; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi), "r"(reg_rdx) + : "memory", "rcx", "r8", "r9", "r10", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_fd_close( - cloudabi_fd_t fd -) { - register uint64_t reg_rax asm("rax") = 3; - register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_fd_close(cloudabi_fd_t fd) { + register uint64_t reg_rax asm("rax") = 3; + register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi) + : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_fd_create1( - cloudabi_filetype_t type, - cloudabi_fd_t *fd -) { - register uint64_t reg_rax asm("rax") = 4; - register uint64_t reg_rdi asm("rdi") = (uint64_t)type; - register char okay; - asm volatile ( - "\tsyscall\n" - "\tsetnc %0\n" - : "=r"(okay) - , "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - if (okay) { - *fd = (cloudabi_fd_t)reg_rax; - return 0; - } - return reg_rax; +cloudabi_errno_t cloudabi_sys_fd_create1(cloudabi_filetype_t type, + cloudabi_fd_t *fd) { + register uint64_t reg_rax asm("rax") = 4; + register uint64_t reg_rdi asm("rdi") = (uint64_t)type; + register char okay; + asm volatile( + "\tsyscall\n" + "\tsetnc %0\n" + : "=r"(okay), "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi) + : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); + if (okay) { + *fd = (cloudabi_fd_t)reg_rax; + return 0; + } + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_fd_create2( - cloudabi_filetype_t type, - cloudabi_fd_t *fd1, - cloudabi_fd_t *fd2 -) { - register uint64_t reg_rax asm("rax") = 5; - register uint64_t reg_rdi asm("rdi") = (uint64_t)type; - register uint64_t reg_rdx asm("rdx"); - register char okay; - asm volatile ( - "\tsyscall\n" - "\tsetnc %0\n" - : "=r"(okay) - , "=r"(reg_rax) - , "=r"(reg_rdx) - : "r"(reg_rax) - , "r"(reg_rdi) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - if (okay) { - *fd1 = (cloudabi_fd_t)reg_rax; - *fd2 = (cloudabi_fd_t)reg_rdx; - return 0; - } - return reg_rax; +cloudabi_errno_t cloudabi_sys_fd_create2(cloudabi_filetype_t type, + cloudabi_fd_t *fd1, + cloudabi_fd_t *fd2) { + register uint64_t reg_rax asm("rax") = 5; + register uint64_t reg_rdi asm("rdi") = (uint64_t)type; + register uint64_t reg_rdx asm("rdx"); + register char okay; + asm volatile( + "\tsyscall\n" + "\tsetnc %0\n" + : "=r"(okay), "=r"(reg_rax), "=r"(reg_rdx) + : "r"(reg_rax), "r"(reg_rdi) + : "memory", "rcx", "r8", "r9", "r10", "r11"); + if (okay) { + *fd1 = (cloudabi_fd_t)reg_rax; + *fd2 = (cloudabi_fd_t)reg_rdx; + return 0; + } + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_fd_datasync( - cloudabi_fd_t fd -) { - register uint64_t reg_rax asm("rax") = 6; - register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_fd_datasync(cloudabi_fd_t fd) { + register uint64_t reg_rax asm("rax") = 6; + register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi) + : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_fd_dup( - cloudabi_fd_t from, - cloudabi_fd_t *fd -) { - register uint64_t reg_rax asm("rax") = 7; - register uint64_t reg_rdi asm("rdi") = (uint64_t)from; - register char okay; - asm volatile ( - "\tsyscall\n" - "\tsetnc %0\n" - : "=r"(okay) - , "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - if (okay) { - *fd = (cloudabi_fd_t)reg_rax; - return 0; - } - return reg_rax; +cloudabi_errno_t cloudabi_sys_fd_dup(cloudabi_fd_t from, cloudabi_fd_t *fd) { + register uint64_t reg_rax asm("rax") = 7; + register uint64_t reg_rdi asm("rdi") = (uint64_t)from; + register char okay; + asm volatile( + "\tsyscall\n" + "\tsetnc %0\n" + : "=r"(okay), "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi) + : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); + if (okay) { + *fd = (cloudabi_fd_t)reg_rax; + return 0; + } + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_fd_pread( - cloudabi_fd_t fd, - const cloudabi_iovec_t *iov, - size_t iovcnt, - cloudabi_filesize_t offset, - size_t *nread -) { - register uint64_t reg_rax asm("rax") = 8; - register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; - register uint64_t reg_rsi asm("rsi") = (uint64_t)iov; - register uint64_t reg_rdx asm("rdx") = (uint64_t)iovcnt; - register uint64_t reg_r10 asm("r10") = (uint64_t)offset; - register char okay; - asm volatile ( - "\tsyscall\n" - "\tsetnc %0\n" - : "=r"(okay) - , "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - , "r"(reg_rdx) - , "r"(reg_r10) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - if (okay) { - *nread = (size_t)reg_rax; - return 0; - } - return reg_rax; +cloudabi_errno_t cloudabi_sys_fd_pread(cloudabi_fd_t fd, + const cloudabi_iovec_t *iov, + size_t iovcnt, + cloudabi_filesize_t offset, + size_t *nread) { + register uint64_t reg_rax asm("rax") = 8; + register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; + register uint64_t reg_rsi asm("rsi") = (uint64_t)iov; + register uint64_t reg_rdx asm("rdx") = (uint64_t)iovcnt; + register uint64_t reg_r10 asm("r10") = (uint64_t)offset; + register char okay; + asm volatile( + "\tsyscall\n" + "\tsetnc %0\n" + : "=r"(okay), "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi), "r"(reg_rdx), "r"(reg_r10) + : "memory", "rcx", "r8", "r9", "r11"); + if (okay) { + *nread = (size_t)reg_rax; + return 0; + } + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_fd_pwrite( - cloudabi_fd_t fd, - const cloudabi_ciovec_t *iov, - size_t iovcnt, - cloudabi_filesize_t offset, - size_t *nwritten -) { - register uint64_t reg_rax asm("rax") = 9; - register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; - register uint64_t reg_rsi asm("rsi") = (uint64_t)iov; - register uint64_t reg_rdx asm("rdx") = (uint64_t)iovcnt; - register uint64_t reg_r10 asm("r10") = (uint64_t)offset; - register char okay; - asm volatile ( - "\tsyscall\n" - "\tsetnc %0\n" - : "=r"(okay) - , "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - , "r"(reg_rdx) - , "r"(reg_r10) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - if (okay) { - *nwritten = (size_t)reg_rax; - return 0; - } - return reg_rax; +cloudabi_errno_t cloudabi_sys_fd_pwrite(cloudabi_fd_t fd, + const cloudabi_ciovec_t *iov, + size_t iovcnt, + cloudabi_filesize_t offset, + size_t *nwritten) { + register uint64_t reg_rax asm("rax") = 9; + register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; + register uint64_t reg_rsi asm("rsi") = (uint64_t)iov; + register uint64_t reg_rdx asm("rdx") = (uint64_t)iovcnt; + register uint64_t reg_r10 asm("r10") = (uint64_t)offset; + register char okay; + asm volatile( + "\tsyscall\n" + "\tsetnc %0\n" + : "=r"(okay), "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi), "r"(reg_rdx), "r"(reg_r10) + : "memory", "rcx", "r8", "r9", "r11"); + if (okay) { + *nwritten = (size_t)reg_rax; + return 0; + } + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_fd_read( - cloudabi_fd_t fd, - const cloudabi_iovec_t *iov, - size_t iovcnt, - size_t *nread -) { - register uint64_t reg_rax asm("rax") = 10; - register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; - register uint64_t reg_rsi asm("rsi") = (uint64_t)iov; - register uint64_t reg_rdx asm("rdx") = (uint64_t)iovcnt; - register char okay; - asm volatile ( - "\tsyscall\n" - "\tsetnc %0\n" - : "=r"(okay) - , "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - , "r"(reg_rdx) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - if (okay) { - *nread = (size_t)reg_rax; - return 0; - } - return reg_rax; +cloudabi_errno_t cloudabi_sys_fd_read(cloudabi_fd_t fd, + const cloudabi_iovec_t *iov, + size_t iovcnt, size_t *nread) { + register uint64_t reg_rax asm("rax") = 10; + register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; + register uint64_t reg_rsi asm("rsi") = (uint64_t)iov; + register uint64_t reg_rdx asm("rdx") = (uint64_t)iovcnt; + register char okay; + asm volatile( + "\tsyscall\n" + "\tsetnc %0\n" + : "=r"(okay), "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi), "r"(reg_rdx) + : "memory", "rcx", "r8", "r9", "r10", "r11"); + if (okay) { + *nread = (size_t)reg_rax; + return 0; + } + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_fd_replace( - cloudabi_fd_t from, - cloudabi_fd_t to -) { - register uint64_t reg_rax asm("rax") = 11; - register uint64_t reg_rdi asm("rdi") = (uint64_t)from; - register uint64_t reg_rsi asm("rsi") = (uint64_t)to; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_fd_replace(cloudabi_fd_t from, cloudabi_fd_t to) { + register uint64_t reg_rax asm("rax") = 11; + register uint64_t reg_rdi asm("rdi") = (uint64_t)from; + register uint64_t reg_rsi asm("rsi") = (uint64_t)to; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi) + : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_fd_seek( - cloudabi_fd_t fd, - cloudabi_filedelta_t offset, - cloudabi_whence_t whence, - cloudabi_filesize_t *newoffset -) { - register uint64_t reg_rax asm("rax") = 12; - register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; - register uint64_t reg_rsi asm("rsi") = (uint64_t)offset; - register uint64_t reg_rdx asm("rdx") = (uint64_t)whence; - register char okay; - asm volatile ( - "\tsyscall\n" - "\tsetnc %0\n" - : "=r"(okay) - , "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - , "r"(reg_rdx) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - if (okay) { - *newoffset = (cloudabi_filesize_t)reg_rax; - return 0; - } - return reg_rax; +cloudabi_errno_t cloudabi_sys_fd_seek(cloudabi_fd_t fd, + cloudabi_filedelta_t offset, + cloudabi_whence_t whence, + cloudabi_filesize_t *newoffset) { + register uint64_t reg_rax asm("rax") = 12; + register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; + register uint64_t reg_rsi asm("rsi") = (uint64_t)offset; + register uint64_t reg_rdx asm("rdx") = (uint64_t)whence; + register char okay; + asm volatile( + "\tsyscall\n" + "\tsetnc %0\n" + : "=r"(okay), "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi), "r"(reg_rdx) + : "memory", "rcx", "r8", "r9", "r10", "r11"); + if (okay) { + *newoffset = (cloudabi_filesize_t)reg_rax; + return 0; + } + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_fd_stat_get( - cloudabi_fd_t fd, - cloudabi_fdstat_t *buf -) { - register uint64_t reg_rax asm("rax") = 13; - register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; - register uint64_t reg_rsi asm("rsi") = (uint64_t)buf; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_fd_stat_get(cloudabi_fd_t fd, + cloudabi_fdstat_t *buf) { + register uint64_t reg_rax asm("rax") = 13; + register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; + register uint64_t reg_rsi asm("rsi") = (uint64_t)buf; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi) + : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_fd_stat_put( - cloudabi_fd_t fd, - const cloudabi_fdstat_t *buf, - cloudabi_fdsflags_t flags -) { - register uint64_t reg_rax asm("rax") = 14; - register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; - register uint64_t reg_rsi asm("rsi") = (uint64_t)buf; - register uint64_t reg_rdx asm("rdx") = (uint64_t)flags; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - , "r"(reg_rdx) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_fd_stat_put(cloudabi_fd_t fd, + const cloudabi_fdstat_t *buf, + cloudabi_fdsflags_t flags) { + register uint64_t reg_rax asm("rax") = 14; + register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; + register uint64_t reg_rsi asm("rsi") = (uint64_t)buf; + register uint64_t reg_rdx asm("rdx") = (uint64_t)flags; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi), "r"(reg_rdx) + : "memory", "rcx", "r8", "r9", "r10", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_fd_sync( - cloudabi_fd_t fd -) { - register uint64_t reg_rax asm("rax") = 15; - register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_fd_sync(cloudabi_fd_t fd) { + register uint64_t reg_rax asm("rax") = 15; + register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi) + : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_fd_write( - cloudabi_fd_t fd, - const cloudabi_ciovec_t *iov, - size_t iovcnt, - size_t *nwritten -) { - register uint64_t reg_rax asm("rax") = 16; - register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; - register uint64_t reg_rsi asm("rsi") = (uint64_t)iov; - register uint64_t reg_rdx asm("rdx") = (uint64_t)iovcnt; - register char okay; - asm volatile ( - "\tsyscall\n" - "\tsetnc %0\n" - : "=r"(okay) - , "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - , "r"(reg_rdx) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - if (okay) { - *nwritten = (size_t)reg_rax; - return 0; - } - return reg_rax; +cloudabi_errno_t cloudabi_sys_fd_write(cloudabi_fd_t fd, + const cloudabi_ciovec_t *iov, + size_t iovcnt, size_t *nwritten) { + register uint64_t reg_rax asm("rax") = 16; + register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; + register uint64_t reg_rsi asm("rsi") = (uint64_t)iov; + register uint64_t reg_rdx asm("rdx") = (uint64_t)iovcnt; + register char okay; + asm volatile( + "\tsyscall\n" + "\tsetnc %0\n" + : "=r"(okay), "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi), "r"(reg_rdx) + : "memory", "rcx", "r8", "r9", "r10", "r11"); + if (okay) { + *nwritten = (size_t)reg_rax; + return 0; + } + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_file_advise( - cloudabi_fd_t fd, - cloudabi_filesize_t offset, - cloudabi_filesize_t len, - cloudabi_advice_t advice -) { - register uint64_t reg_rax asm("rax") = 17; - register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; - register uint64_t reg_rsi asm("rsi") = (uint64_t)offset; - register uint64_t reg_rdx asm("rdx") = (uint64_t)len; - register uint64_t reg_r10 asm("r10") = (uint64_t)advice; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - , "r"(reg_rdx) - , "r"(reg_r10) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_file_advise(cloudabi_fd_t fd, + cloudabi_filesize_t offset, + cloudabi_filesize_t len, + cloudabi_advice_t advice) { + register uint64_t reg_rax asm("rax") = 17; + register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; + register uint64_t reg_rsi asm("rsi") = (uint64_t)offset; + register uint64_t reg_rdx asm("rdx") = (uint64_t)len; + register uint64_t reg_r10 asm("r10") = (uint64_t)advice; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi), "r"(reg_rdx), + "r"(reg_r10) + : "memory", "rcx", "r8", "r9", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_file_allocate( - cloudabi_fd_t fd, - cloudabi_filesize_t offset, - cloudabi_filesize_t len -) { - register uint64_t reg_rax asm("rax") = 18; - register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; - register uint64_t reg_rsi asm("rsi") = (uint64_t)offset; - register uint64_t reg_rdx asm("rdx") = (uint64_t)len; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - , "r"(reg_rdx) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_file_allocate(cloudabi_fd_t fd, + cloudabi_filesize_t offset, + cloudabi_filesize_t len) { + register uint64_t reg_rax asm("rax") = 18; + register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; + register uint64_t reg_rsi asm("rsi") = (uint64_t)offset; + register uint64_t reg_rdx asm("rdx") = (uint64_t)len; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi), "r"(reg_rdx) + : "memory", "rcx", "r8", "r9", "r10", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_file_create( - cloudabi_fd_t fd, - const char *path, - size_t pathlen, - cloudabi_filetype_t type -) { - register uint64_t reg_rax asm("rax") = 19; - register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; - register uint64_t reg_rsi asm("rsi") = (uint64_t)path; - register uint64_t reg_rdx asm("rdx") = (uint64_t)pathlen; - register uint64_t reg_r10 asm("r10") = (uint64_t)type; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - , "r"(reg_rdx) - , "r"(reg_r10) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_file_create(cloudabi_fd_t fd, const char *path, + size_t pathlen, + cloudabi_filetype_t type) { + register uint64_t reg_rax asm("rax") = 19; + register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; + register uint64_t reg_rsi asm("rsi") = (uint64_t)path; + register uint64_t reg_rdx asm("rdx") = (uint64_t)pathlen; + register uint64_t reg_r10 asm("r10") = (uint64_t)type; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi), "r"(reg_rdx), + "r"(reg_r10) + : "memory", "rcx", "r8", "r9", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_file_link( - cloudabi_lookup_t fd1, - const char *path1, - size_t path1len, - cloudabi_fd_t fd2, - const char *path2, - size_t path2len -) { - register uint64_t reg_rax asm("rax") = 20; - register uint64_t reg_rdi asm("rdi") = *(uint64_t *)&fd1; - register uint64_t reg_rsi asm("rsi") = (uint64_t)path1; - register uint64_t reg_rdx asm("rdx") = (uint64_t)path1len; - register uint64_t reg_r10 asm("r10") = (uint64_t)fd2; - register uint64_t reg_r8 asm("r8") = (uint64_t)path2; - register uint64_t reg_r9 asm("r9") = (uint64_t)path2len; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - , "r"(reg_rdx) - , "r"(reg_r10) - , "r"(reg_r8) - , "r"(reg_r9) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_file_link(cloudabi_lookup_t fd1, + const char *path1, size_t path1len, + cloudabi_fd_t fd2, const char *path2, + size_t path2len) { + register uint64_t reg_rax asm("rax") = 20; + register uint64_t reg_rdi asm("rdi") = *(uint64_t *)&fd1; + register uint64_t reg_rsi asm("rsi") = (uint64_t)path1; + register uint64_t reg_rdx asm("rdx") = (uint64_t)path1len; + register uint64_t reg_r10 asm("r10") = (uint64_t)fd2; + register uint64_t reg_r8 asm("r8") = (uint64_t)path2; + register uint64_t reg_r9 asm("r9") = (uint64_t)path2len; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi), "r"(reg_rdx), + "r"(reg_r10), "r"(reg_r8), "r"(reg_r9) + : "memory", "rcx", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_file_open( - cloudabi_lookup_t dirfd, - const char *path, - size_t pathlen, - cloudabi_oflags_t oflags, - const cloudabi_fdstat_t *fds, - cloudabi_fd_t *fd -) { - register uint64_t reg_rax asm("rax") = 21; - register uint64_t reg_rdi asm("rdi") = *(uint64_t *)&dirfd; - register uint64_t reg_rsi asm("rsi") = (uint64_t)path; - register uint64_t reg_rdx asm("rdx") = (uint64_t)pathlen; - register uint64_t reg_r10 asm("r10") = (uint64_t)oflags; - register uint64_t reg_r8 asm("r8") = (uint64_t)fds; - register char okay; - asm volatile ( - "\tsyscall\n" - "\tsetnc %0\n" - : "=r"(okay) - , "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - , "r"(reg_rdx) - , "r"(reg_r10) - , "r"(reg_r8) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - if (okay) { - *fd = (cloudabi_fd_t)reg_rax; - return 0; - } - return reg_rax; +cloudabi_errno_t cloudabi_sys_file_open(cloudabi_lookup_t dirfd, + const char *path, size_t pathlen, + cloudabi_oflags_t oflags, + const cloudabi_fdstat_t *fds, + cloudabi_fd_t *fd) { + register uint64_t reg_rax asm("rax") = 21; + register uint64_t reg_rdi asm("rdi") = *(uint64_t *)&dirfd; + register uint64_t reg_rsi asm("rsi") = (uint64_t)path; + register uint64_t reg_rdx asm("rdx") = (uint64_t)pathlen; + register uint64_t reg_r10 asm("r10") = (uint64_t)oflags; + register uint64_t reg_r8 asm("r8") = (uint64_t)fds; + register char okay; + asm volatile( + "\tsyscall\n" + "\tsetnc %0\n" + : "=r"(okay), "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi), "r"(reg_rdx), "r"(reg_r10), + "r"(reg_r8) + : "memory", "rcx", "r9", "r11"); + if (okay) { + *fd = (cloudabi_fd_t)reg_rax; + return 0; + } + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_file_readdir( - cloudabi_fd_t fd, - void *buf, - size_t nbyte, - cloudabi_dircookie_t cookie, - size_t *bufused -) { - register uint64_t reg_rax asm("rax") = 22; - register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; - register uint64_t reg_rsi asm("rsi") = (uint64_t)buf; - register uint64_t reg_rdx asm("rdx") = (uint64_t)nbyte; - register uint64_t reg_r10 asm("r10") = (uint64_t)cookie; - register char okay; - asm volatile ( - "\tsyscall\n" - "\tsetnc %0\n" - : "=r"(okay) - , "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - , "r"(reg_rdx) - , "r"(reg_r10) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - if (okay) { - *bufused = (size_t)reg_rax; - return 0; - } - return reg_rax; +cloudabi_errno_t cloudabi_sys_file_readdir(cloudabi_fd_t fd, void *buf, + size_t nbyte, + cloudabi_dircookie_t cookie, + size_t *bufused) { + register uint64_t reg_rax asm("rax") = 22; + register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; + register uint64_t reg_rsi asm("rsi") = (uint64_t)buf; + register uint64_t reg_rdx asm("rdx") = (uint64_t)nbyte; + register uint64_t reg_r10 asm("r10") = (uint64_t)cookie; + register char okay; + asm volatile( + "\tsyscall\n" + "\tsetnc %0\n" + : "=r"(okay), "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi), "r"(reg_rdx), "r"(reg_r10) + : "memory", "rcx", "r8", "r9", "r11"); + if (okay) { + *bufused = (size_t)reg_rax; + return 0; + } + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_file_readlink( - cloudabi_fd_t fd, - const char *path, - size_t pathlen, - char *buf, - size_t bufsize, - size_t *bufused -) { - register uint64_t reg_rax asm("rax") = 23; - register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; - register uint64_t reg_rsi asm("rsi") = (uint64_t)path; - register uint64_t reg_rdx asm("rdx") = (uint64_t)pathlen; - register uint64_t reg_r10 asm("r10") = (uint64_t)buf; - register uint64_t reg_r8 asm("r8") = (uint64_t)bufsize; - register char okay; - asm volatile ( - "\tsyscall\n" - "\tsetnc %0\n" - : "=r"(okay) - , "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - , "r"(reg_rdx) - , "r"(reg_r10) - , "r"(reg_r8) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - if (okay) { - *bufused = (size_t)reg_rax; - return 0; - } - return reg_rax; +cloudabi_errno_t cloudabi_sys_file_readlink(cloudabi_fd_t fd, const char *path, + size_t pathlen, char *buf, + size_t bufsize, size_t *bufused) { + register uint64_t reg_rax asm("rax") = 23; + register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; + register uint64_t reg_rsi asm("rsi") = (uint64_t)path; + register uint64_t reg_rdx asm("rdx") = (uint64_t)pathlen; + register uint64_t reg_r10 asm("r10") = (uint64_t)buf; + register uint64_t reg_r8 asm("r8") = (uint64_t)bufsize; + register char okay; + asm volatile( + "\tsyscall\n" + "\tsetnc %0\n" + : "=r"(okay), "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi), "r"(reg_rdx), "r"(reg_r10), + "r"(reg_r8) + : "memory", "rcx", "r9", "r11"); + if (okay) { + *bufused = (size_t)reg_rax; + return 0; + } + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_file_rename( - cloudabi_fd_t oldfd, - const char *old, - size_t oldlen, - cloudabi_fd_t newfd, - const char *new, - size_t newlen -) { - register uint64_t reg_rax asm("rax") = 24; - register uint64_t reg_rdi asm("rdi") = (uint64_t)oldfd; - register uint64_t reg_rsi asm("rsi") = (uint64_t)old; - register uint64_t reg_rdx asm("rdx") = (uint64_t)oldlen; - register uint64_t reg_r10 asm("r10") = (uint64_t)newfd; - register uint64_t reg_r8 asm("r8") = (uint64_t)new; - register uint64_t reg_r9 asm("r9") = (uint64_t)newlen; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - , "r"(reg_rdx) - , "r"(reg_r10) - , "r"(reg_r8) - , "r"(reg_r9) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_file_rename(cloudabi_fd_t oldfd, const char *old, + size_t oldlen, cloudabi_fd_t newfd, + const char *new, size_t newlen) { + register uint64_t reg_rax asm("rax") = 24; + register uint64_t reg_rdi asm("rdi") = (uint64_t)oldfd; + register uint64_t reg_rsi asm("rsi") = (uint64_t)old; + register uint64_t reg_rdx asm("rdx") = (uint64_t)oldlen; + register uint64_t reg_r10 asm("r10") = (uint64_t)newfd; + register uint64_t reg_r8 asm("r8") = (uint64_t) new; + register uint64_t reg_r9 asm("r9") = (uint64_t)newlen; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi), "r"(reg_rdx), + "r"(reg_r10), "r"(reg_r8), "r"(reg_r9) + : "memory", "rcx", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_file_stat_fget( - cloudabi_fd_t fd, - cloudabi_filestat_t *buf -) { - register uint64_t reg_rax asm("rax") = 25; - register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; - register uint64_t reg_rsi asm("rsi") = (uint64_t)buf; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_file_stat_fget(cloudabi_fd_t fd, + cloudabi_filestat_t *buf) { + register uint64_t reg_rax asm("rax") = 25; + register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; + register uint64_t reg_rsi asm("rsi") = (uint64_t)buf; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi) + : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_file_stat_fput( - cloudabi_fd_t fd, - const cloudabi_filestat_t *buf, - cloudabi_fsflags_t flags -) { - register uint64_t reg_rax asm("rax") = 26; - register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; - register uint64_t reg_rsi asm("rsi") = (uint64_t)buf; - register uint64_t reg_rdx asm("rdx") = (uint64_t)flags; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - , "r"(reg_rdx) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_file_stat_fput(cloudabi_fd_t fd, + const cloudabi_filestat_t *buf, + cloudabi_fsflags_t flags) { + register uint64_t reg_rax asm("rax") = 26; + register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; + register uint64_t reg_rsi asm("rsi") = (uint64_t)buf; + register uint64_t reg_rdx asm("rdx") = (uint64_t)flags; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi), "r"(reg_rdx) + : "memory", "rcx", "r8", "r9", "r10", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_file_stat_get( - cloudabi_lookup_t fd, - const char *path, - size_t pathlen, - cloudabi_filestat_t *buf -) { - register uint64_t reg_rax asm("rax") = 27; - register uint64_t reg_rdi asm("rdi") = *(uint64_t *)&fd; - register uint64_t reg_rsi asm("rsi") = (uint64_t)path; - register uint64_t reg_rdx asm("rdx") = (uint64_t)pathlen; - register uint64_t reg_r10 asm("r10") = (uint64_t)buf; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - , "r"(reg_rdx) - , "r"(reg_r10) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_file_stat_get(cloudabi_lookup_t fd, + const char *path, size_t pathlen, + cloudabi_filestat_t *buf) { + register uint64_t reg_rax asm("rax") = 27; + register uint64_t reg_rdi asm("rdi") = *(uint64_t *)&fd; + register uint64_t reg_rsi asm("rsi") = (uint64_t)path; + register uint64_t reg_rdx asm("rdx") = (uint64_t)pathlen; + register uint64_t reg_r10 asm("r10") = (uint64_t)buf; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi), "r"(reg_rdx), + "r"(reg_r10) + : "memory", "rcx", "r8", "r9", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_file_stat_put( - cloudabi_lookup_t fd, - const char *path, - size_t pathlen, - const cloudabi_filestat_t *buf, - cloudabi_fsflags_t flags -) { - register uint64_t reg_rax asm("rax") = 28; - register uint64_t reg_rdi asm("rdi") = *(uint64_t *)&fd; - register uint64_t reg_rsi asm("rsi") = (uint64_t)path; - register uint64_t reg_rdx asm("rdx") = (uint64_t)pathlen; - register uint64_t reg_r10 asm("r10") = (uint64_t)buf; - register uint64_t reg_r8 asm("r8") = (uint64_t)flags; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - , "r"(reg_rdx) - , "r"(reg_r10) - , "r"(reg_r8) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_file_stat_put(cloudabi_lookup_t fd, + const char *path, size_t pathlen, + const cloudabi_filestat_t *buf, + cloudabi_fsflags_t flags) { + register uint64_t reg_rax asm("rax") = 28; + register uint64_t reg_rdi asm("rdi") = *(uint64_t *)&fd; + register uint64_t reg_rsi asm("rsi") = (uint64_t)path; + register uint64_t reg_rdx asm("rdx") = (uint64_t)pathlen; + register uint64_t reg_r10 asm("r10") = (uint64_t)buf; + register uint64_t reg_r8 asm("r8") = (uint64_t)flags; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi), "r"(reg_rdx), + "r"(reg_r10), "r"(reg_r8) + : "memory", "rcx", "r9", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_file_symlink( - const char *path1, - size_t path1len, - cloudabi_fd_t fd, - const char *path2, - size_t path2len -) { - register uint64_t reg_rax asm("rax") = 29; - register uint64_t reg_rdi asm("rdi") = (uint64_t)path1; - register uint64_t reg_rsi asm("rsi") = (uint64_t)path1len; - register uint64_t reg_rdx asm("rdx") = (uint64_t)fd; - register uint64_t reg_r10 asm("r10") = (uint64_t)path2; - register uint64_t reg_r8 asm("r8") = (uint64_t)path2len; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - , "r"(reg_rdx) - , "r"(reg_r10) - , "r"(reg_r8) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_file_symlink(const char *path1, size_t path1len, + cloudabi_fd_t fd, const char *path2, + size_t path2len) { + register uint64_t reg_rax asm("rax") = 29; + register uint64_t reg_rdi asm("rdi") = (uint64_t)path1; + register uint64_t reg_rsi asm("rsi") = (uint64_t)path1len; + register uint64_t reg_rdx asm("rdx") = (uint64_t)fd; + register uint64_t reg_r10 asm("r10") = (uint64_t)path2; + register uint64_t reg_r8 asm("r8") = (uint64_t)path2len; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi), "r"(reg_rdx), + "r"(reg_r10), "r"(reg_r8) + : "memory", "rcx", "r9", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_file_unlink( - cloudabi_fd_t fd, - const char *path, - size_t pathlen, - cloudabi_ulflags_t flags -) { - register uint64_t reg_rax asm("rax") = 30; - register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; - register uint64_t reg_rsi asm("rsi") = (uint64_t)path; - register uint64_t reg_rdx asm("rdx") = (uint64_t)pathlen; - register uint64_t reg_r10 asm("r10") = (uint64_t)flags; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - , "r"(reg_rdx) - , "r"(reg_r10) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_file_unlink(cloudabi_fd_t fd, const char *path, + size_t pathlen, + cloudabi_ulflags_t flags) { + register uint64_t reg_rax asm("rax") = 30; + register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; + register uint64_t reg_rsi asm("rsi") = (uint64_t)path; + register uint64_t reg_rdx asm("rdx") = (uint64_t)pathlen; + register uint64_t reg_r10 asm("r10") = (uint64_t)flags; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi), "r"(reg_rdx), + "r"(reg_r10) + : "memory", "rcx", "r8", "r9", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_lock_unlock( - _Atomic(cloudabi_lock_t) *lock, - cloudabi_scope_t scope -) { - register uint64_t reg_rax asm("rax") = 31; - register uint64_t reg_rdi asm("rdi") = (uint64_t)lock; - register uint64_t reg_rsi asm("rsi") = (uint64_t)scope; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_lock_unlock(_Atomic(cloudabi_lock_t) * lock, + cloudabi_scope_t scope) { + register uint64_t reg_rax asm("rax") = 31; + register uint64_t reg_rdi asm("rdi") = (uint64_t)lock; + register uint64_t reg_rsi asm("rsi") = (uint64_t)scope; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi) + : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_mem_advise( - void *addr, - size_t len, - cloudabi_advice_t advice -) { - register uint64_t reg_rax asm("rax") = 32; - register uint64_t reg_rdi asm("rdi") = (uint64_t)addr; - register uint64_t reg_rsi asm("rsi") = (uint64_t)len; - register uint64_t reg_rdx asm("rdx") = (uint64_t)advice; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - , "r"(reg_rdx) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_mem_advise(void *addr, size_t len, + cloudabi_advice_t advice) { + register uint64_t reg_rax asm("rax") = 32; + register uint64_t reg_rdi asm("rdi") = (uint64_t)addr; + register uint64_t reg_rsi asm("rsi") = (uint64_t)len; + register uint64_t reg_rdx asm("rdx") = (uint64_t)advice; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi), "r"(reg_rdx) + : "memory", "rcx", "r8", "r9", "r10", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_mem_lock( - const void *addr, - size_t len -) { - register uint64_t reg_rax asm("rax") = 33; - register uint64_t reg_rdi asm("rdi") = (uint64_t)addr; - register uint64_t reg_rsi asm("rsi") = (uint64_t)len; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_mem_lock(const void *addr, size_t len) { + register uint64_t reg_rax asm("rax") = 33; + register uint64_t reg_rdi asm("rdi") = (uint64_t)addr; + register uint64_t reg_rsi asm("rsi") = (uint64_t)len; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi) + : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_mem_map( - void *addr, - size_t len, - cloudabi_mprot_t prot, - cloudabi_mflags_t flags, - cloudabi_fd_t fd, - cloudabi_filesize_t off, - void **mem -) { - register uint64_t reg_rax asm("rax") = 34; - register uint64_t reg_rdi asm("rdi") = (uint64_t)addr; - register uint64_t reg_rsi asm("rsi") = (uint64_t)len; - register uint64_t reg_rdx asm("rdx") = (uint64_t)prot; - register uint64_t reg_r10 asm("r10") = (uint64_t)flags; - register uint64_t reg_r8 asm("r8") = (uint64_t)fd; - register uint64_t reg_r9 asm("r9") = (uint64_t)off; - register char okay; - asm volatile ( - "\tsyscall\n" - "\tsetnc %0\n" - : "=r"(okay) - , "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - , "r"(reg_rdx) - , "r"(reg_r10) - , "r"(reg_r8) - , "r"(reg_r9) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - if (okay) { - *mem = (void *)reg_rax; - return 0; - } - return reg_rax; +cloudabi_errno_t cloudabi_sys_mem_map(void *addr, size_t len, + cloudabi_mprot_t prot, + cloudabi_mflags_t flags, cloudabi_fd_t fd, + cloudabi_filesize_t off, void **mem) { + register uint64_t reg_rax asm("rax") = 34; + register uint64_t reg_rdi asm("rdi") = (uint64_t)addr; + register uint64_t reg_rsi asm("rsi") = (uint64_t)len; + register uint64_t reg_rdx asm("rdx") = (uint64_t)prot; + register uint64_t reg_r10 asm("r10") = (uint64_t)flags; + register uint64_t reg_r8 asm("r8") = (uint64_t)fd; + register uint64_t reg_r9 asm("r9") = (uint64_t)off; + register char okay; + asm volatile( + "\tsyscall\n" + "\tsetnc %0\n" + : "=r"(okay), "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi), "r"(reg_rdx), "r"(reg_r10), + "r"(reg_r8), "r"(reg_r9) + : "memory", "rcx", "r11"); + if (okay) { + *mem = (void *)reg_rax; + return 0; + } + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_mem_protect( - void *addr, - size_t len, - cloudabi_mprot_t prot -) { - register uint64_t reg_rax asm("rax") = 35; - register uint64_t reg_rdi asm("rdi") = (uint64_t)addr; - register uint64_t reg_rsi asm("rsi") = (uint64_t)len; - register uint64_t reg_rdx asm("rdx") = (uint64_t)prot; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - , "r"(reg_rdx) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_mem_protect(void *addr, size_t len, + cloudabi_mprot_t prot) { + register uint64_t reg_rax asm("rax") = 35; + register uint64_t reg_rdi asm("rdi") = (uint64_t)addr; + register uint64_t reg_rsi asm("rsi") = (uint64_t)len; + register uint64_t reg_rdx asm("rdx") = (uint64_t)prot; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi), "r"(reg_rdx) + : "memory", "rcx", "r8", "r9", "r10", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_mem_sync( - void *addr, - size_t len, - cloudabi_msflags_t flags -) { - register uint64_t reg_rax asm("rax") = 36; - register uint64_t reg_rdi asm("rdi") = (uint64_t)addr; - register uint64_t reg_rsi asm("rsi") = (uint64_t)len; - register uint64_t reg_rdx asm("rdx") = (uint64_t)flags; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - , "r"(reg_rdx) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_mem_sync(void *addr, size_t len, + cloudabi_msflags_t flags) { + register uint64_t reg_rax asm("rax") = 36; + register uint64_t reg_rdi asm("rdi") = (uint64_t)addr; + register uint64_t reg_rsi asm("rsi") = (uint64_t)len; + register uint64_t reg_rdx asm("rdx") = (uint64_t)flags; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi), "r"(reg_rdx) + : "memory", "rcx", "r8", "r9", "r10", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_mem_unlock( - const void *addr, - size_t len -) { - register uint64_t reg_rax asm("rax") = 37; - register uint64_t reg_rdi asm("rdi") = (uint64_t)addr; - register uint64_t reg_rsi asm("rsi") = (uint64_t)len; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_mem_unlock(const void *addr, size_t len) { + register uint64_t reg_rax asm("rax") = 37; + register uint64_t reg_rdi asm("rdi") = (uint64_t)addr; + register uint64_t reg_rsi asm("rsi") = (uint64_t)len; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi) + : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_mem_unmap( - void *addr, - size_t len -) { - register uint64_t reg_rax asm("rax") = 38; - register uint64_t reg_rdi asm("rdi") = (uint64_t)addr; - register uint64_t reg_rsi asm("rsi") = (uint64_t)len; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_mem_unmap(void *addr, size_t len) { + register uint64_t reg_rax asm("rax") = 38; + register uint64_t reg_rdi asm("rdi") = (uint64_t)addr; + register uint64_t reg_rsi asm("rsi") = (uint64_t)len; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi) + : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_poll( - const cloudabi_subscription_t *in, - cloudabi_event_t *out, - size_t nsubscriptions, - size_t *nevents -) { - register uint64_t reg_rax asm("rax") = 39; - register uint64_t reg_rdi asm("rdi") = (uint64_t)in; - register uint64_t reg_rsi asm("rsi") = (uint64_t)out; - register uint64_t reg_rdx asm("rdx") = (uint64_t)nsubscriptions; - register char okay; - asm volatile ( - "\tsyscall\n" - "\tsetnc %0\n" - : "=r"(okay) - , "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - , "r"(reg_rdx) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - if (okay) { - *nevents = (size_t)reg_rax; - return 0; - } - return reg_rax; +cloudabi_errno_t cloudabi_sys_poll(const cloudabi_subscription_t *in, + cloudabi_event_t *out, size_t nsubscriptions, + size_t *nevents) { + register uint64_t reg_rax asm("rax") = 39; + register uint64_t reg_rdi asm("rdi") = (uint64_t)in; + register uint64_t reg_rsi asm("rsi") = (uint64_t)out; + register uint64_t reg_rdx asm("rdx") = (uint64_t)nsubscriptions; + register char okay; + asm volatile( + "\tsyscall\n" + "\tsetnc %0\n" + : "=r"(okay), "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi), "r"(reg_rdx) + : "memory", "rcx", "r8", "r9", "r10", "r11"); + if (okay) { + *nevents = (size_t)reg_rax; + return 0; + } + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_poll_fd( - cloudabi_fd_t fd, - const cloudabi_subscription_t *in, - size_t nin, - cloudabi_event_t *out, - size_t nout, - const cloudabi_subscription_t *timeout, - size_t *nevents -) { - register uint64_t reg_rax asm("rax") = 57; - register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; - register uint64_t reg_rsi asm("rsi") = (uint64_t)in; - register uint64_t reg_rdx asm("rdx") = (uint64_t)nin; - register uint64_t reg_r10 asm("r10") = (uint64_t)out; - register uint64_t reg_r8 asm("r8") = (uint64_t)nout; - register uint64_t reg_r9 asm("r9") = (uint64_t)timeout; - register char okay; - asm volatile ( - "\tsyscall\n" - "\tsetnc %0\n" - : "=r"(okay) - , "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - , "r"(reg_rdx) - , "r"(reg_r10) - , "r"(reg_r8) - , "r"(reg_r9) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - if (okay) { - *nevents = (size_t)reg_rax; - return 0; - } - return reg_rax; +cloudabi_errno_t cloudabi_sys_poll_fd(cloudabi_fd_t fd, + const cloudabi_subscription_t *in, + size_t nin, cloudabi_event_t *out, + size_t nout, + const cloudabi_subscription_t *timeout, + size_t *nevents) { + register uint64_t reg_rax asm("rax") = 40; + register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; + register uint64_t reg_rsi asm("rsi") = (uint64_t)in; + register uint64_t reg_rdx asm("rdx") = (uint64_t)nin; + register uint64_t reg_r10 asm("r10") = (uint64_t)out; + register uint64_t reg_r8 asm("r8") = (uint64_t)nout; + register uint64_t reg_r9 asm("r9") = (uint64_t)timeout; + register char okay; + asm volatile( + "\tsyscall\n" + "\tsetnc %0\n" + : "=r"(okay), "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi), "r"(reg_rdx), "r"(reg_r10), + "r"(reg_r8), "r"(reg_r9) + : "memory", "rcx", "r11"); + if (okay) { + *nevents = (size_t)reg_rax; + return 0; + } + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_proc_exec( - cloudabi_fd_t fd, - const void *data, - size_t datalen, - const cloudabi_fd_t *fds, - size_t fdslen -) { - register uint64_t reg_rax asm("rax") = 40; - register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; - register uint64_t reg_rsi asm("rsi") = (uint64_t)data; - register uint64_t reg_rdx asm("rdx") = (uint64_t)datalen; - register uint64_t reg_r10 asm("r10") = (uint64_t)fds; - register uint64_t reg_r8 asm("r8") = (uint64_t)fdslen; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - , "r"(reg_rdx) - , "r"(reg_r10) - , "r"(reg_r8) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_proc_exec(cloudabi_fd_t fd, const void *data, + size_t datalen, + const cloudabi_fd_t *fds, + size_t fdslen) { + register uint64_t reg_rax asm("rax") = 41; + register uint64_t reg_rdi asm("rdi") = (uint64_t)fd; + register uint64_t reg_rsi asm("rsi") = (uint64_t)data; + register uint64_t reg_rdx asm("rdx") = (uint64_t)datalen; + register uint64_t reg_r10 asm("r10") = (uint64_t)fds; + register uint64_t reg_r8 asm("r8") = (uint64_t)fdslen; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi), "r"(reg_rdx), + "r"(reg_r10), "r"(reg_r8) + : "memory", "rcx", "r9", "r11"); + return reg_rax; } -_Noreturn void -cloudabi_sys_proc_exit( - cloudabi_exitcode_t rval -) { - register uint64_t reg_rax asm("rax") = 41; - register uint64_t reg_rdi asm("rdi") = (uint64_t)rval; - asm volatile ( - "\tsyscall\n" - : - : "r"(reg_rax) - , "r"(reg_rdi) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - for (;;); +_Noreturn void cloudabi_sys_proc_exit(cloudabi_exitcode_t rval) { + register uint64_t reg_rax asm("rax") = 42; + register uint64_t reg_rdi asm("rdi") = (uint64_t)rval; + asm volatile("\tsyscall\n" + : + : "r"(reg_rax), "r"(reg_rdi) + : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); + for (;;) + ; } -cloudabi_errno_t -cloudabi_sys_proc_fork( - cloudabi_fd_t *fd, - cloudabi_tid_t *tid -) { - register uint64_t reg_rax asm("rax") = 42; - register uint64_t reg_rdx asm("rdx"); - register char okay; - asm volatile ( - "\tsyscall\n" - "\tsetnc %0\n" - : "=r"(okay) - , "=r"(reg_rax) - , "=r"(reg_rdx) - : "r"(reg_rax) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - if (okay) { - *fd = (cloudabi_fd_t)reg_rax; - *tid = (cloudabi_tid_t)reg_rdx; - return 0; - } - return reg_rax; +cloudabi_errno_t cloudabi_sys_proc_fork(cloudabi_fd_t *fd, + cloudabi_tid_t *tid) { + register uint64_t reg_rax asm("rax") = 43; + register uint64_t reg_rdx asm("rdx"); + register char okay; + asm volatile( + "\tsyscall\n" + "\tsetnc %0\n" + : "=r"(okay), "=r"(reg_rax), "=r"(reg_rdx) + : "r"(reg_rax) + : "memory", "rcx", "r8", "r9", "r10", "r11"); + if (okay) { + *fd = (cloudabi_fd_t)reg_rax; + *tid = (cloudabi_tid_t)reg_rdx; + return 0; + } + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_proc_raise( - cloudabi_signal_t sig -) { - register uint64_t reg_rax asm("rax") = 43; - register uint64_t reg_rdi asm("rdi") = (uint64_t)sig; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_proc_raise(cloudabi_signal_t sig) { + register uint64_t reg_rax asm("rax") = 44; + register uint64_t reg_rdi asm("rdi") = (uint64_t)sig; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi) + : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_random_get( - void *buf, - size_t nbyte -) { - register uint64_t reg_rax asm("rax") = 44; - register uint64_t reg_rdi asm("rdi") = (uint64_t)buf; - register uint64_t reg_rsi asm("rsi") = (uint64_t)nbyte; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_random_get(void *buf, size_t nbyte) { + register uint64_t reg_rax asm("rax") = 45; + register uint64_t reg_rdi asm("rdi") = (uint64_t)buf; + register uint64_t reg_rsi asm("rsi") = (uint64_t)nbyte; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi) + : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_sock_accept( - cloudabi_fd_t sock, - cloudabi_sockstat_t *buf, - cloudabi_fd_t *conn -) { - register uint64_t reg_rax asm("rax") = 45; - register uint64_t reg_rdi asm("rdi") = (uint64_t)sock; - register uint64_t reg_rsi asm("rsi") = (uint64_t)buf; - register char okay; - asm volatile ( - "\tsyscall\n" - "\tsetnc %0\n" - : "=r"(okay) - , "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - if (okay) { - *conn = (cloudabi_fd_t)reg_rax; - return 0; - } - return reg_rax; +cloudabi_errno_t cloudabi_sys_sock_accept(cloudabi_fd_t sock, + cloudabi_sockstat_t *buf, + cloudabi_fd_t *conn) { + register uint64_t reg_rax asm("rax") = 46; + register uint64_t reg_rdi asm("rdi") = (uint64_t)sock; + register uint64_t reg_rsi asm("rsi") = (uint64_t)buf; + register char okay; + asm volatile( + "\tsyscall\n" + "\tsetnc %0\n" + : "=r"(okay), "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi) + : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); + if (okay) { + *conn = (cloudabi_fd_t)reg_rax; + return 0; + } + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_sock_bind( - cloudabi_fd_t sock, - cloudabi_fd_t fd, - const char *path, - size_t pathlen -) { - register uint64_t reg_rax asm("rax") = 46; - register uint64_t reg_rdi asm("rdi") = (uint64_t)sock; - register uint64_t reg_rsi asm("rsi") = (uint64_t)fd; - register uint64_t reg_rdx asm("rdx") = (uint64_t)path; - register uint64_t reg_r10 asm("r10") = (uint64_t)pathlen; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - , "r"(reg_rdx) - , "r"(reg_r10) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_sock_bind(cloudabi_fd_t sock, cloudabi_fd_t fd, + const char *path, size_t pathlen) { + register uint64_t reg_rax asm("rax") = 47; + register uint64_t reg_rdi asm("rdi") = (uint64_t)sock; + register uint64_t reg_rsi asm("rsi") = (uint64_t)fd; + register uint64_t reg_rdx asm("rdx") = (uint64_t)path; + register uint64_t reg_r10 asm("r10") = (uint64_t)pathlen; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi), "r"(reg_rdx), + "r"(reg_r10) + : "memory", "rcx", "r8", "r9", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_sock_connect( - cloudabi_fd_t sock, - cloudabi_fd_t fd, - const char *path, - size_t pathlen -) { - register uint64_t reg_rax asm("rax") = 47; - register uint64_t reg_rdi asm("rdi") = (uint64_t)sock; - register uint64_t reg_rsi asm("rsi") = (uint64_t)fd; - register uint64_t reg_rdx asm("rdx") = (uint64_t)path; - register uint64_t reg_r10 asm("r10") = (uint64_t)pathlen; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - , "r"(reg_rdx) - , "r"(reg_r10) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_sock_connect(cloudabi_fd_t sock, cloudabi_fd_t fd, + const char *path, size_t pathlen) { + register uint64_t reg_rax asm("rax") = 48; + register uint64_t reg_rdi asm("rdi") = (uint64_t)sock; + register uint64_t reg_rsi asm("rsi") = (uint64_t)fd; + register uint64_t reg_rdx asm("rdx") = (uint64_t)path; + register uint64_t reg_r10 asm("r10") = (uint64_t)pathlen; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi), "r"(reg_rdx), + "r"(reg_r10) + : "memory", "rcx", "r8", "r9", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_sock_listen( - cloudabi_fd_t sock, - cloudabi_backlog_t backlog -) { - register uint64_t reg_rax asm("rax") = 48; - register uint64_t reg_rdi asm("rdi") = (uint64_t)sock; - register uint64_t reg_rsi asm("rsi") = (uint64_t)backlog; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_sock_listen(cloudabi_fd_t sock, + cloudabi_backlog_t backlog) { + register uint64_t reg_rax asm("rax") = 49; + register uint64_t reg_rdi asm("rdi") = (uint64_t)sock; + register uint64_t reg_rsi asm("rsi") = (uint64_t)backlog; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi) + : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_sock_recv( - cloudabi_fd_t sock, - const cloudabi_recv_in_t *in, - cloudabi_recv_out_t *out -) { - register uint64_t reg_rax asm("rax") = 49; - register uint64_t reg_rdi asm("rdi") = (uint64_t)sock; - register uint64_t reg_rsi asm("rsi") = (uint64_t)in; - register uint64_t reg_rdx asm("rdx") = (uint64_t)out; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - , "r"(reg_rdx) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_sock_recv(cloudabi_fd_t sock, + const cloudabi_recv_in_t *in, + cloudabi_recv_out_t *out) { + register uint64_t reg_rax asm("rax") = 50; + register uint64_t reg_rdi asm("rdi") = (uint64_t)sock; + register uint64_t reg_rsi asm("rsi") = (uint64_t)in; + register uint64_t reg_rdx asm("rdx") = (uint64_t)out; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi), "r"(reg_rdx) + : "memory", "rcx", "r8", "r9", "r10", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_sock_send( - cloudabi_fd_t sock, - const cloudabi_send_in_t *in, - cloudabi_send_out_t *out -) { - register uint64_t reg_rax asm("rax") = 50; - register uint64_t reg_rdi asm("rdi") = (uint64_t)sock; - register uint64_t reg_rsi asm("rsi") = (uint64_t)in; - register uint64_t reg_rdx asm("rdx") = (uint64_t)out; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - , "r"(reg_rdx) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_sock_send(cloudabi_fd_t sock, + const cloudabi_send_in_t *in, + cloudabi_send_out_t *out) { + register uint64_t reg_rax asm("rax") = 51; + register uint64_t reg_rdi asm("rdi") = (uint64_t)sock; + register uint64_t reg_rsi asm("rsi") = (uint64_t)in; + register uint64_t reg_rdx asm("rdx") = (uint64_t)out; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi), "r"(reg_rdx) + : "memory", "rcx", "r8", "r9", "r10", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_sock_shutdown( - cloudabi_fd_t sock, - cloudabi_sdflags_t how -) { - register uint64_t reg_rax asm("rax") = 51; - register uint64_t reg_rdi asm("rdi") = (uint64_t)sock; - register uint64_t reg_rsi asm("rsi") = (uint64_t)how; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_sock_shutdown(cloudabi_fd_t sock, + cloudabi_sdflags_t how) { + register uint64_t reg_rax asm("rax") = 52; + register uint64_t reg_rdi asm("rdi") = (uint64_t)sock; + register uint64_t reg_rsi asm("rsi") = (uint64_t)how; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi) + : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_sock_stat_get( - cloudabi_fd_t sock, - cloudabi_sockstat_t *buf, - cloudabi_ssflags_t flags -) { - register uint64_t reg_rax asm("rax") = 52; - register uint64_t reg_rdi asm("rdi") = (uint64_t)sock; - register uint64_t reg_rsi asm("rsi") = (uint64_t)buf; - register uint64_t reg_rdx asm("rdx") = (uint64_t)flags; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - , "r"(reg_rdx) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_sock_stat_get(cloudabi_fd_t sock, + cloudabi_sockstat_t *buf, + cloudabi_ssflags_t flags) { + register uint64_t reg_rax asm("rax") = 53; + register uint64_t reg_rdi asm("rdi") = (uint64_t)sock; + register uint64_t reg_rsi asm("rsi") = (uint64_t)buf; + register uint64_t reg_rdx asm("rdx") = (uint64_t)flags; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi), "r"(reg_rdx) + : "memory", "rcx", "r8", "r9", "r10", "r11"); + return reg_rax; } -cloudabi_errno_t -cloudabi_sys_thread_create( - cloudabi_threadattr_t *attr, - cloudabi_tid_t *tid -) { - register uint64_t reg_rax asm("rax") = 53; - register uint64_t reg_rdi asm("rdi") = (uint64_t)attr; - register char okay; - asm volatile ( - "\tsyscall\n" - "\tsetnc %0\n" - : "=r"(okay) - , "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - if (okay) { - *tid = (cloudabi_tid_t)reg_rax; - return 0; - } - return reg_rax; +cloudabi_errno_t cloudabi_sys_thread_create(cloudabi_threadattr_t *attr, + cloudabi_tid_t *tid) { + register uint64_t reg_rax asm("rax") = 54; + register uint64_t reg_rdi asm("rdi") = (uint64_t)attr; + register char okay; + asm volatile( + "\tsyscall\n" + "\tsetnc %0\n" + : "=r"(okay), "=r"(reg_rax) + : "r"(reg_rax), "r"(reg_rdi) + : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); + if (okay) { + *tid = (cloudabi_tid_t)reg_rax; + return 0; + } + return reg_rax; } -_Noreturn void -cloudabi_sys_thread_exit( - _Atomic(cloudabi_lock_t) *lock, - cloudabi_scope_t scope -) { - register uint64_t reg_rax asm("rax") = 54; - register uint64_t reg_rdi asm("rdi") = (uint64_t)lock; - register uint64_t reg_rsi asm("rsi") = (uint64_t)scope; - asm volatile ( - "\tsyscall\n" - : - : "r"(reg_rax) - , "r"(reg_rdi) - , "r"(reg_rsi) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - for (;;); +_Noreturn void cloudabi_sys_thread_exit(_Atomic(cloudabi_lock_t) * lock, + cloudabi_scope_t scope) { + register uint64_t reg_rax asm("rax") = 55; + register uint64_t reg_rdi asm("rdi") = (uint64_t)lock; + register uint64_t reg_rsi asm("rsi") = (uint64_t)scope; + asm volatile("\tsyscall\n" + : + : "r"(reg_rax), "r"(reg_rdi), "r"(reg_rsi) + : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); + for (;;) + ; } -cloudabi_errno_t -cloudabi_sys_thread_tcb_set( - void *tcb -) { - register uint64_t reg_rax asm("rax") = 55; - register uint64_t reg_rdi asm("rdi") = (uint64_t)tcb; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - , "r"(reg_rdi) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; +cloudabi_errno_t cloudabi_sys_thread_yield(void) { + register uint64_t reg_rax asm("rax") = 56; + asm volatile("\tsyscall\n" + : "=r"(reg_rax) + : "r"(reg_rax) + : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); + return reg_rax; } - -cloudabi_errno_t -cloudabi_sys_thread_yield(void) { - register uint64_t reg_rax asm("rax") = 56; - asm volatile ( - "\tsyscall\n" - : "=r"(reg_rax) - : "r"(reg_rax) - : "memory", "rcx", "rdx", "r8", "r9", "r10", "r11"); - return reg_rax; -} - Index: head/sys/contrib/cloudabi/syscalls64.master =================================================================== --- head/sys/contrib/cloudabi/syscalls64.master (nonexistent) +++ head/sys/contrib/cloudabi/syscalls64.master (revision 304478) @@ -0,0 +1,315 @@ + $FreeBSD$ + +; Copyright (c) 2016 Nuxi (https://nuxi.nl/) and contributors. +; +; Redistribution and use in source and binary forms, with or without +; modification, are permitted provided that the following conditions +; are met: +; 1. Redistributions of source code must retain the above copyright +; notice, this list of conditions and the following disclaimer. +; 2. Redistributions in binary form must 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 +#include + +#include + +#include + +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, \ + cloudabi_timestamp_t precision); } + +2 AUE_NULL STD { void cloudabi_sys_condvar_signal( \ + cloudabi_condvar_t *condvar, \ + cloudabi_scope_t scope, \ + cloudabi_nthreads_t nwaiters); } + +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 { size_t cloudabi64_sys_fd_pread( \ + cloudabi_fd_t fd, \ + const cloudabi64_iovec_t *iov, \ + size_t iovcnt, \ + cloudabi_filesize_t offset); } + +9 AUE_NULL STD { size_t cloudabi64_sys_fd_pwrite( \ + cloudabi_fd_t fd, \ + const cloudabi64_ciovec_t *iov, \ + size_t iovcnt, \ + cloudabi_filesize_t offset); } + +10 AUE_NULL STD { size_t cloudabi64_sys_fd_read( \ + cloudabi_fd_t fd, \ + const cloudabi64_iovec_t *iov, \ + 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( \ + 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 { size_t cloudabi64_sys_fd_write( \ + cloudabi_fd_t fd, \ + const cloudabi64_ciovec_t *iov, \ + 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, \ + cloudabi_filetype_t type); } + +20 AUE_NULL STD { void cloudabi_sys_file_link( \ + cloudabi_lookup_t fd1, \ + const char *path1, \ + size_t path1len, \ + cloudabi_fd_t fd2, \ + const char *path2, \ + size_t path2len); } + +21 AUE_NULL STD { cloudabi_fd_t cloudabi_sys_file_open( \ + 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, \ + cloudabi_dircookie_t cookie); } + +23 AUE_NULL STD { size_t cloudabi_sys_file_readlink( \ + cloudabi_fd_t fd, \ + 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, \ + cloudabi_fd_t newfd, \ + 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, \ + 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 cloudabi_filestat_t *buf, \ + cloudabi_fsflags_t flags); } + +29 AUE_NULL STD { void cloudabi_sys_file_symlink( \ + const char *path1, \ + size_t path1len, \ + cloudabi_fd_t fd, \ + 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 flags); } + +31 AUE_NULL STD { void cloudabi_sys_lock_unlock( \ + cloudabi_lock_t *lock, \ + cloudabi_scope_t scope); } + +32 AUE_NULL STD { void cloudabi_sys_mem_advise( \ + void *addr, \ + size_t len, \ + cloudabi_advice_t advice); } + +33 AUE_NULL STD { void cloudabi_sys_mem_lock( \ + const void *addr, \ + size_t len); } + +34 AUE_NULL STD { void cloudabi_sys_mem_map( \ + 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, \ + cloudabi_mprot_t prot); } + +36 AUE_NULL STD { void cloudabi_sys_mem_sync( \ + void *addr, \ + size_t len, \ + cloudabi_msflags_t flags); } + +37 AUE_NULL STD { void cloudabi_sys_mem_unlock( \ + const void *addr, \ + size_t len); } + +38 AUE_NULL STD { void cloudabi_sys_mem_unmap( \ + void *addr, \ + size_t len); } + +39 AUE_NULL STD { size_t cloudabi64_sys_poll( \ + const cloudabi64_subscription_t *in, \ + cloudabi64_event_t *out, \ + size_t nsubscriptions); } + +40 AUE_NULL STD { size_t cloudabi64_sys_poll_fd( \ + cloudabi_fd_t fd, \ + const cloudabi64_subscription_t *in, \ + size_t nin, \ + cloudabi64_event_t *out, \ + size_t nout, \ + const cloudabi64_subscription_t *timeout); } + +41 AUE_NULL STD { void cloudabi_sys_proc_exec( \ + cloudabi_fd_t fd, \ + const void *data, \ + size_t datalen, \ + const cloudabi_fd_t *fds, \ + size_t fdslen); } + +42 AUE_NULL STD { void cloudabi_sys_proc_exit( \ + cloudabi_exitcode_t rval); } + +43 AUE_NULL STD { void cloudabi_sys_proc_fork(); } + +44 AUE_NULL STD { void cloudabi_sys_proc_raise( \ + cloudabi_signal_t sig); } + +45 AUE_NULL STD { void cloudabi_sys_random_get( \ + void *buf, \ + size_t nbyte); } + +46 AUE_NULL STD { cloudabi_fd_t cloudabi_sys_sock_accept( \ + cloudabi_fd_t sock, \ + cloudabi_sockstat_t *buf); } + +47 AUE_NULL STD { void cloudabi_sys_sock_bind( \ + cloudabi_fd_t sock, \ + cloudabi_fd_t fd, \ + const char *path, \ + size_t pathlen); } + +48 AUE_NULL STD { void cloudabi_sys_sock_connect( \ + cloudabi_fd_t sock, \ + cloudabi_fd_t fd, \ + const char *path, \ + size_t pathlen); } + +49 AUE_NULL STD { void cloudabi_sys_sock_listen( \ + cloudabi_fd_t sock, \ + cloudabi_backlog_t backlog); } + +50 AUE_NULL STD { void cloudabi64_sys_sock_recv( \ + cloudabi_fd_t sock, \ + const cloudabi64_recv_in_t *in, \ + cloudabi64_recv_out_t *out); } + +51 AUE_NULL STD { void cloudabi64_sys_sock_send( \ + cloudabi_fd_t sock, \ + const cloudabi64_send_in_t *in, \ + cloudabi64_send_out_t *out); } + +52 AUE_NULL STD { void cloudabi_sys_sock_shutdown( \ + cloudabi_fd_t sock, \ + cloudabi_sdflags_t how); } + +53 AUE_NULL STD { void cloudabi_sys_sock_stat_get( \ + cloudabi_fd_t sock, \ + cloudabi_sockstat_t *buf, \ + cloudabi_ssflags_t flags); } + +54 AUE_NULL STD { cloudabi_tid_t cloudabi64_sys_thread_create( \ + cloudabi64_threadattr_t *attr); } + +55 AUE_NULL STD { void cloudabi_sys_thread_exit( \ + cloudabi_lock_t *lock, \ + cloudabi_scope_t scope); } + +56 AUE_NULL STD { void cloudabi_sys_thread_yield(); } Index: head/usr.bin/truss/syscalls.c =================================================================== --- head/usr.bin/truss/syscalls.c (revision 304477) +++ head/usr.bin/truss/syscalls.c (revision 304478) @@ -1,2116 +1,2114 @@ /* * Copyright 1997 Sean Eric Fagan * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Sean Eric Fagan * 4. Neither the name of the author may be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include __FBSDID("$FreeBSD$"); /* * This file has routines used to print out system calls and their * arguments. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "truss.h" #include "extern.h" #include "syscall.h" /* 64-bit alignment on 32-bit platforms. */ #if !defined(__LP64__) && defined(__powerpc__) #define QUAD_ALIGN 1 #else #define QUAD_ALIGN 0 #endif /* Number of slots needed for a 64-bit argument. */ #ifdef __LP64__ #define QUAD_SLOTS 1 #else #define QUAD_SLOTS 2 #endif /* * This should probably be in its own file, sorted alphabetically. */ static struct syscall decoded_syscalls[] = { /* Native ABI */ { .name = "__getcwd", .ret_type = 1, .nargs = 2, .args = { { Name | OUT, 0 }, { Int, 1 } } }, { .name = "_umtx_op", .ret_type = 1, .nargs = 5, .args = { { Ptr, 0 }, { Umtxop, 1 }, { LongHex, 2 }, { Ptr, 3 }, { Ptr, 4 } } }, { .name = "accept", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { Sockaddr | OUT, 1 }, { Ptr | OUT, 2 } } }, { .name = "access", .ret_type = 1, .nargs = 2, .args = { { Name | IN, 0 }, { Accessmode, 1 } } }, { .name = "bind", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { Sockaddr | IN, 1 }, { Int, 2 } } }, { .name = "bindat", .ret_type = 1, .nargs = 4, .args = { { Atfd, 0 }, { Int, 1 }, { Sockaddr | IN, 2 }, { Int, 3 } } }, { .name = "break", .ret_type = 1, .nargs = 1, .args = { { Ptr, 0 } } }, { .name = "chdir", .ret_type = 1, .nargs = 1, .args = { { Name, 0 } } }, { .name = "chflags", .ret_type = 1, .nargs = 2, .args = { { Name | IN, 0 }, { Hex, 1 } } }, { .name = "chmod", .ret_type = 1, .nargs = 2, .args = { { Name, 0 }, { Octal, 1 } } }, { .name = "chown", .ret_type = 1, .nargs = 3, .args = { { Name, 0 }, { Int, 1 }, { Int, 2 } } }, { .name = "chroot", .ret_type = 1, .nargs = 1, .args = { { Name, 0 } } }, { .name = "clock_gettime", .ret_type = 1, .nargs = 2, .args = { { Int, 0 }, { Timespec | OUT, 1 } } }, { .name = "close", .ret_type = 1, .nargs = 1, .args = { { Int, 0 } } }, { .name = "connect", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { Sockaddr | IN, 1 }, { Int, 2 } } }, { .name = "connectat", .ret_type = 1, .nargs = 4, .args = { { Atfd, 0 }, { Int, 1 }, { Sockaddr | IN, 2 }, { Int, 3 } } }, { .name = "eaccess", .ret_type = 1, .nargs = 2, .args = { { Name | IN, 0 }, { Accessmode, 1 } } }, { .name = "execve", .ret_type = 1, .nargs = 3, .args = { { Name | IN, 0 }, { ExecArgs | IN, 1 }, { ExecEnv | IN, 2 } } }, { .name = "exit", .ret_type = 0, .nargs = 1, .args = { { Hex, 0 } } }, { .name = "faccessat", .ret_type = 1, .nargs = 4, .args = { { Atfd, 0 }, { Name | IN, 1 }, { Accessmode, 2 }, { Atflags, 3 } } }, { .name = "fchmod", .ret_type = 1, .nargs = 2, .args = { { Int, 0 }, { Octal, 1 } } }, { .name = "fchmodat", .ret_type = 1, .nargs = 4, .args = { { Atfd, 0 }, { Name, 1 }, { Octal, 2 }, { Atflags, 3 } } }, { .name = "fchown", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { Int, 1 }, { Int, 2 } } }, { .name = "fchownat", .ret_type = 1, .nargs = 5, .args = { { Atfd, 0 }, { Name, 1 }, { Int, 2 }, { Int, 3 }, { Atflags, 4 } } }, { .name = "fcntl", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { Fcntl, 1 }, { Fcntlflag, 2 } } }, { .name = "fstat", .ret_type = 1, .nargs = 2, .args = { { Int, 0 }, { Stat | OUT, 1 } } }, { .name = "fstatat", .ret_type = 1, .nargs = 4, .args = { { Atfd, 0 }, { Name | IN, 1 }, { Stat | OUT, 2 }, { Atflags, 3 } } }, { .name = "fstatfs", .ret_type = 1, .nargs = 2, .args = { { Int, 0 }, { StatFs | OUT, 1 } } }, { .name = "ftruncate", .ret_type = 1, .nargs = 2, .args = { { Int | IN, 0 }, { QuadHex | IN, 1 + QUAD_ALIGN } } }, { .name = "futimens", .ret_type = 1, .nargs = 2, .args = { { Int, 0 }, { Timespec2 | IN, 1 } } }, { .name = "futimes", .ret_type = 1, .nargs = 2, .args = { { Int, 0 }, { Timeval2 | IN, 1 } } }, { .name = "futimesat", .ret_type = 1, .nargs = 3, .args = { { Atfd, 0 }, { Name | IN, 1 }, { Timeval2 | IN, 2 } } }, { .name = "getitimer", .ret_type = 1, .nargs = 2, .args = { { Int, 0 }, { Itimerval | OUT, 2 } } }, { .name = "getpeername", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { Sockaddr | OUT, 1 }, { Ptr | OUT, 2 } } }, { .name = "getpgid", .ret_type = 1, .nargs = 1, .args = { { Int, 0 } } }, { .name = "getrlimit", .ret_type = 1, .nargs = 2, .args = { { Resource, 0 }, { Rlimit | OUT, 1 } } }, { .name = "getrusage", .ret_type = 1, .nargs = 2, .args = { { Int, 0 }, { Rusage | OUT, 1 } } }, { .name = "getsid", .ret_type = 1, .nargs = 1, .args = { { Int, 0 } } }, { .name = "getsockname", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { Sockaddr | OUT, 1 }, { Ptr | OUT, 2 } } }, { .name = "gettimeofday", .ret_type = 1, .nargs = 2, .args = { { Timeval | OUT, 0 }, { Ptr, 1 } } }, { .name = "ioctl", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { Ioctl, 1 }, { Hex, 2 } } }, { .name = "kevent", .ret_type = 1, .nargs = 6, .args = { { Int, 0 }, { Kevent, 1 }, { Int, 2 }, { Kevent | OUT, 3 }, { Int, 4 }, { Timespec, 5 } } }, { .name = "kill", .ret_type = 1, .nargs = 2, .args = { { Int | IN, 0 }, { Signal | IN, 1 } } }, { .name = "kldfind", .ret_type = 1, .nargs = 1, .args = { { Name | IN, 0 } } }, { .name = "kldfirstmod", .ret_type = 1, .nargs = 1, .args = { { Int, 0 } } }, { .name = "kldload", .ret_type = 1, .nargs = 1, .args = { { Name | IN, 0 } } }, { .name = "kldnext", .ret_type = 1, .nargs = 1, .args = { { Int, 0 } } }, { .name = "kldstat", .ret_type = 1, .nargs = 2, .args = { { Int, 0 }, { Ptr, 1 } } }, { .name = "kldunload", .ret_type = 1, .nargs = 1, .args = { { Int, 0 } } }, { .name = "kse_release", .ret_type = 0, .nargs = 1, .args = { { Timespec, 0 } } }, { .name = "lchflags", .ret_type = 1, .nargs = 2, .args = { { Name | IN, 0 }, { Hex, 1 } } }, { .name = "lchmod", .ret_type = 1, .nargs = 2, .args = { { Name, 0 }, { Octal, 1 } } }, { .name = "lchown", .ret_type = 1, .nargs = 3, .args = { { Name, 0 }, { Int, 1 }, { Int, 2 } } }, { .name = "link", .ret_type = 1, .nargs = 2, .args = { { Name, 0 }, { Name, 1 } } }, { .name = "linkat", .ret_type = 1, .nargs = 5, .args = { { Atfd, 0 }, { Name, 1 }, { Atfd, 2 }, { Name, 3 }, { Atflags, 4 } } }, { .name = "lseek", .ret_type = 2, .nargs = 3, .args = { { Int, 0 }, { QuadHex, 1 + QUAD_ALIGN }, { Whence, 1 + QUAD_SLOTS + QUAD_ALIGN } } }, { .name = "lstat", .ret_type = 1, .nargs = 2, .args = { { Name | IN, 0 }, { Stat | OUT, 1 } } }, { .name = "lutimes", .ret_type = 1, .nargs = 2, .args = { { Name | IN, 0 }, { Timeval2 | IN, 1 } } }, { .name = "mkdir", .ret_type = 1, .nargs = 2, .args = { { Name, 0 }, { Octal, 1 } } }, { .name = "mkdirat", .ret_type = 1, .nargs = 3, .args = { { Atfd, 0 }, { Name, 1 }, { Octal, 2 } } }, { .name = "mkfifo", .ret_type = 1, .nargs = 2, .args = { { Name, 0 }, { Octal, 1 } } }, { .name = "mkfifoat", .ret_type = 1, .nargs = 3, .args = { { Atfd, 0 }, { Name, 1 }, { Octal, 2 } } }, { .name = "mknod", .ret_type = 1, .nargs = 3, .args = { { Name, 0 }, { Octal, 1 }, { Int, 2 } } }, { .name = "mknodat", .ret_type = 1, .nargs = 4, .args = { { Atfd, 0 }, { Name, 1 }, { Octal, 2 }, { Int, 3 } } }, { .name = "mmap", .ret_type = 1, .nargs = 6, .args = { { Ptr, 0 }, { Int, 1 }, { Mprot, 2 }, { Mmapflags, 3 }, { Int, 4 }, { QuadHex, 5 + QUAD_ALIGN } } }, { .name = "modfind", .ret_type = 1, .nargs = 1, .args = { { Name | IN, 0 } } }, { .name = "mount", .ret_type = 1, .nargs = 4, .args = { { Name, 0 }, { Name, 1 }, { Int, 2 }, { Ptr, 3 } } }, { .name = "mprotect", .ret_type = 1, .nargs = 3, .args = { { Ptr, 0 }, { Int, 1 }, { Mprot, 2 } } }, { .name = "munmap", .ret_type = 1, .nargs = 2, .args = { { Ptr, 0 }, { Int, 1 } } }, { .name = "nanosleep", .ret_type = 1, .nargs = 1, .args = { { Timespec, 0 } } }, { .name = "open", .ret_type = 1, .nargs = 3, .args = { { Name | IN, 0 }, { Open, 1 }, { Octal, 2 } } }, { .name = "openat", .ret_type = 1, .nargs = 4, .args = { { Atfd, 0 }, { Name | IN, 1 }, { Open, 2 }, { Octal, 3 } } }, { .name = "pathconf", .ret_type = 1, .nargs = 2, .args = { { Name | IN, 0 }, { Pathconf, 1 } } }, { .name = "pipe", .ret_type = 1, .nargs = 1, .args = { { PipeFds | OUT, 0 } } }, { .name = "pipe2", .ret_type = 1, .nargs = 2, .args = { { Ptr, 0 }, { Open, 1 } } }, { .name = "poll", .ret_type = 1, .nargs = 3, .args = { { Pollfd, 0 }, { Int, 1 }, { Int, 2 } } }, { .name = "posix_openpt", .ret_type = 1, .nargs = 1, .args = { { Open, 0 } } }, { .name = "procctl", .ret_type = 1, .nargs = 4, .args = { { Idtype, 0 }, { Quad, 1 + QUAD_ALIGN }, { Procctl, 1 + QUAD_ALIGN + QUAD_SLOTS }, { Ptr, 2 + QUAD_ALIGN + QUAD_SLOTS } } }, { .name = "read", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { BinString | OUT, 1 }, { Int, 2 } } }, { .name = "readlink", .ret_type = 1, .nargs = 3, .args = { { Name, 0 }, { Readlinkres | OUT, 1 }, { Int, 2 } } }, { .name = "readlinkat", .ret_type = 1, .nargs = 4, .args = { { Atfd, 0 }, { Name, 1 }, { Readlinkres | OUT, 2 }, { Int, 3 } } }, { .name = "recvfrom", .ret_type = 1, .nargs = 6, .args = { { Int, 0 }, { BinString | OUT, 1 }, { Int, 2 }, { Hex, 3 }, { Sockaddr | OUT, 4 }, { Ptr | OUT, 5 } } }, { .name = "rename", .ret_type = 1, .nargs = 2, .args = { { Name, 0 }, { Name, 1 } } }, { .name = "renameat", .ret_type = 1, .nargs = 4, .args = { { Atfd, 0 }, { Name, 1 }, { Atfd, 2 }, { Name, 3 } } }, { .name = "rfork", .ret_type = 1, .nargs = 1, .args = { { Rforkflags, 0 } } }, { .name = "rmdir", .ret_type = 1, .nargs = 1, .args = { { Name, 0 } } }, { .name = "select", .ret_type = 1, .nargs = 5, .args = { { Int, 0 }, { Fd_set, 1 }, { Fd_set, 2 }, { Fd_set, 3 }, { Timeval, 4 } } }, { .name = "sendto", .ret_type = 1, .nargs = 6, .args = { { Int, 0 }, { BinString | IN, 1 }, { Int, 2 }, { Hex, 3 }, { Sockaddr | IN, 4 }, { Ptr | IN, 5 } } }, { .name = "setitimer", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { Itimerval, 1 }, { Itimerval | OUT, 2 } } }, { .name = "setrlimit", .ret_type = 1, .nargs = 2, .args = { { Resource, 0 }, { Rlimit | IN, 1 } } }, { .name = "shutdown", .ret_type = 1, .nargs = 2, .args = { { Int, 0 }, { Shutdown, 1 } } }, { .name = "sigaction", .ret_type = 1, .nargs = 3, .args = { { Signal, 0 }, { Sigaction | IN, 1 }, { Sigaction | OUT, 2 } } }, { .name = "sigpending", .ret_type = 1, .nargs = 1, .args = { { Sigset | OUT, 0 } } }, { .name = "sigprocmask", .ret_type = 1, .nargs = 3, .args = { { Sigprocmask, 0 }, { Sigset, 1 }, { Sigset | OUT, 2 } } }, { .name = "sigqueue", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { Signal, 1 }, { LongHex, 2 } } }, { .name = "sigreturn", .ret_type = 1, .nargs = 1, .args = { { Ptr, 0 } } }, { .name = "sigsuspend", .ret_type = 1, .nargs = 1, .args = { { Sigset | IN, 0 } } }, { .name = "sigtimedwait", .ret_type = 1, .nargs = 3, .args = { { Sigset | IN, 0 }, { Ptr, 1 }, { Timespec | IN, 2 } } }, { .name = "sigwait", .ret_type = 1, .nargs = 2, .args = { { Sigset | IN, 0 }, { Ptr, 1 } } }, { .name = "sigwaitinfo", .ret_type = 1, .nargs = 2, .args = { { Sigset | IN, 0 }, { Ptr, 1 } } }, { .name = "socket", .ret_type = 1, .nargs = 3, .args = { { Sockdomain, 0 }, { Socktype, 1 }, { Int, 2 } } }, { .name = "stat", .ret_type = 1, .nargs = 2, .args = { { Name | IN, 0 }, { Stat | OUT, 1 } } }, { .name = "statfs", .ret_type = 1, .nargs = 2, .args = { { Name | IN, 0 }, { StatFs | OUT, 1 } } }, { .name = "symlink", .ret_type = 1, .nargs = 2, .args = { { Name, 0 }, { Name, 1 } } }, { .name = "symlinkat", .ret_type = 1, .nargs = 3, .args = { { Name, 0 }, { Atfd, 1 }, { Name, 2 } } }, { .name = "sysarch", .ret_type = 1, .nargs = 2, .args = { { Sysarch, 0 }, { Ptr, 1 } } }, { .name = "thr_kill", .ret_type = 1, .nargs = 2, .args = { { Long, 0 }, { Signal, 1 } } }, { .name = "thr_self", .ret_type = 1, .nargs = 1, .args = { { Ptr, 0 } } }, { .name = "truncate", .ret_type = 1, .nargs = 2, .args = { { Name | IN, 0 }, { QuadHex | IN, 1 + QUAD_ALIGN } } }, #if 0 /* Does not exist */ { .name = "umount", .ret_type = 1, .nargs = 2, .args = { { Name, 0 }, { Int, 2 } } }, #endif { .name = "unlink", .ret_type = 1, .nargs = 1, .args = { { Name, 0 } } }, { .name = "unlinkat", .ret_type = 1, .nargs = 3, .args = { { Atfd, 0 }, { Name, 1 }, { Atflags, 2 } } }, { .name = "unmount", .ret_type = 1, .nargs = 2, .args = { { Name, 0 }, { Int, 1 } } }, { .name = "utimensat", .ret_type = 1, .nargs = 4, .args = { { Atfd, 0 }, { Name | IN, 1 }, { Timespec2 | IN, 2 }, { Atflags, 3 } } }, { .name = "utimes", .ret_type = 1, .nargs = 2, .args = { { Name | IN, 0 }, { Timeval2 | IN, 1 } } }, { .name = "utrace", .ret_type = 1, .nargs = 1, .args = { { Utrace, 0 } } }, { .name = "wait4", .ret_type = 1, .nargs = 4, .args = { { Int, 0 }, { ExitStatus | OUT, 1 }, { Waitoptions, 2 }, { Rusage | OUT, 3 } } }, { .name = "wait6", .ret_type = 1, .nargs = 6, .args = { { Idtype, 0 }, { Quad, 1 + QUAD_ALIGN }, { ExitStatus | OUT, 1 + QUAD_ALIGN + QUAD_SLOTS }, { Waitoptions, 2 + QUAD_ALIGN + QUAD_SLOTS }, { Rusage | OUT, 3 + QUAD_ALIGN + QUAD_SLOTS }, { Ptr, 4 + QUAD_ALIGN + QUAD_SLOTS } } }, { .name = "write", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { BinString | IN, 1 }, { Int, 2 } } }, /* Linux ABI */ { .name = "linux_access", .ret_type = 1, .nargs = 2, .args = { { Name, 0 }, { Accessmode, 1 } } }, { .name = "linux_execve", .ret_type = 1, .nargs = 3, .args = { { Name | IN, 0 }, { ExecArgs | IN, 1 }, { ExecEnv | IN, 2 } } }, { .name = "linux_lseek", .ret_type = 2, .nargs = 3, .args = { { Int, 0 }, { Int, 1 }, { Whence, 2 } } }, { .name = "linux_mkdir", .ret_type = 1, .nargs = 2, .args = { { Name | IN, 0 }, { Int, 1 } } }, { .name = "linux_newfstat", .ret_type = 1, .nargs = 2, .args = { { Int, 0 }, { Ptr | OUT, 1 } } }, { .name = "linux_newstat", .ret_type = 1, .nargs = 2, .args = { { Name | IN, 0 }, { Ptr | OUT, 1 } } }, { .name = "linux_open", .ret_type = 1, .nargs = 3, .args = { { Name, 0 }, { Hex, 1 }, { Octal, 2 } } }, { .name = "linux_readlink", .ret_type = 1, .nargs = 3, .args = { { Name, 0 }, { Name | OUT, 1 }, { Int, 2 } } }, { .name = "linux_socketcall", .ret_type = 1, .nargs = 2, .args = { { Int, 0 }, { LinuxSockArgs, 1 } } }, { .name = "linux_stat64", .ret_type = 1, .nargs = 3, .args = { { Name | IN, 0 }, { Ptr | OUT, 1 }, { Ptr | IN, 1 } } }, /* CloudABI system calls. */ { .name = "cloudabi_sys_clock_res_get", .ret_type = 1, .nargs = 1, .args = { { CloudABIClockID, 0 } } }, { .name = "cloudabi_sys_clock_time_get", .ret_type = 1, .nargs = 2, .args = { { CloudABIClockID, 0 }, { CloudABITimestamp, 1 } } }, { .name = "cloudabi_sys_condvar_signal", .ret_type = 1, .nargs = 3, .args = { { Ptr, 0 }, { CloudABIMFlags, 1 }, { UInt, 2 } } }, { .name = "cloudabi_sys_fd_close", .ret_type = 1, .nargs = 1, .args = { { Int, 0 } } }, { .name = "cloudabi_sys_fd_create1", .ret_type = 1, .nargs = 1, .args = { { CloudABIFileType, 0 } } }, { .name = "cloudabi_sys_fd_create2", .ret_type = 1, .nargs = 2, .args = { { CloudABIFileType, 0 }, { PipeFds | OUT, 0 } } }, { .name = "cloudabi_sys_fd_datasync", .ret_type = 1, .nargs = 1, .args = { { Int, 0 } } }, { .name = "cloudabi_sys_fd_dup", .ret_type = 1, .nargs = 1, .args = { { Int, 0 } } }, { .name = "cloudabi_sys_fd_replace", .ret_type = 1, .nargs = 2, .args = { { Int, 0 }, { Int, 1 } } }, { .name = "cloudabi_sys_fd_seek", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { Int, 1 }, { CloudABIWhence, 2 } } }, { .name = "cloudabi_sys_fd_stat_get", .ret_type = 1, .nargs = 2, .args = { { Int, 0 }, { CloudABIFDStat | OUT, 1 } } }, { .name = "cloudabi_sys_fd_stat_put", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { CloudABIFDStat | IN, 1 }, { ClouduABIFDSFlags, 2 } } }, { .name = "cloudabi_sys_fd_sync", .ret_type = 1, .nargs = 1, .args = { { Int, 0 } } }, { .name = "cloudabi_sys_file_advise", .ret_type = 1, .nargs = 4, .args = { { Int, 0 }, { Int, 1 }, { Int, 2 }, { CloudABIAdvice, 3 } } }, { .name = "cloudabi_sys_file_allocate", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { Int, 1 }, { Int, 2 } } }, { .name = "cloudabi_sys_file_create", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { BinString | IN, 1 }, { CloudABIFileType, 3 } } }, { .name = "cloudabi_sys_file_link", .ret_type = 1, .nargs = 4, .args = { { CloudABILookup, 0 }, { BinString | IN, 1 }, { Int, 3 }, { BinString | IN, 4 } } }, { .name = "cloudabi_sys_file_open", .ret_type = 1, .nargs = 4, .args = { { Int, 0 }, { BinString | IN, 1 }, { CloudABIOFlags, 3 }, { CloudABIFDStat | IN, 4 } } }, { .name = "cloudabi_sys_file_readdir", .ret_type = 1, .nargs = 4, .args = { { Int, 0 }, { BinString | OUT, 1 }, { Int, 2 }, { Int, 3 } } }, { .name = "cloudabi_sys_file_readlink", .ret_type = 1, .nargs = 4, .args = { { Int, 0 }, { BinString | IN, 1 }, { BinString | OUT, 3 }, { Int, 4 } } }, { .name = "cloudabi_sys_file_rename", .ret_type = 1, .nargs = 4, .args = { { Int, 0 }, { BinString | IN, 1 }, { Int, 3 }, { BinString | IN, 4 } } }, { .name = "cloudabi_sys_file_stat_fget", .ret_type = 1, .nargs = 2, .args = { { Int, 0 }, { CloudABIFileStat | OUT, 1 } } }, { .name = "cloudabi_sys_file_stat_fput", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { CloudABIFileStat | IN, 1 }, { CloudABIFSFlags, 2 } } }, { .name = "cloudabi_sys_file_stat_get", .ret_type = 1, .nargs = 3, .args = { { CloudABILookup, 0 }, { BinString | IN, 1 }, { CloudABIFileStat | OUT, 3 } } }, { .name = "cloudabi_sys_file_stat_put", .ret_type = 1, .nargs = 4, .args = { { CloudABILookup, 0 }, { BinString | IN, 1 }, { CloudABIFileStat | IN, 3 }, { CloudABIFSFlags, 4 } } }, { .name = "cloudabi_sys_file_symlink", .ret_type = 1, .nargs = 3, .args = { { BinString | IN, 0 }, { Int, 2 }, { BinString | IN, 3 } } }, { .name = "cloudabi_sys_file_unlink", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { BinString | IN, 1 }, { CloudABIULFlags, 3 } } }, { .name = "cloudabi_sys_lock_unlock", .ret_type = 1, .nargs = 2, .args = { { Ptr, 0 }, { CloudABIMFlags, 1 } } }, { .name = "cloudabi_sys_mem_advise", .ret_type = 1, .nargs = 3, .args = { { Ptr, 0 }, { Int, 1 }, { CloudABIAdvice, 2 } } }, { .name = "cloudabi_sys_mem_lock", .ret_type = 1, .nargs = 2, .args = { { Ptr, 0 }, { Int, 1 } } }, { .name = "cloudabi_sys_mem_map", .ret_type = 1, .nargs = 6, .args = { { Ptr, 0 }, { Int, 1 }, { CloudABIMProt, 2 }, { CloudABIMFlags, 3 }, { Int, 4 }, { Int, 5 } } }, { .name = "cloudabi_sys_mem_protect", .ret_type = 1, .nargs = 3, .args = { { Ptr, 0 }, { Int, 1 }, { CloudABIMProt, 2 } } }, { .name = "cloudabi_sys_mem_sync", .ret_type = 1, .nargs = 3, .args = { { Ptr, 0 }, { Int, 1 }, { CloudABIMSFlags, 2 } } }, { .name = "cloudabi_sys_mem_unlock", .ret_type = 1, .nargs = 2, .args = { { Ptr, 0 }, { Int, 1 } } }, { .name = "cloudabi_sys_mem_unmap", .ret_type = 1, .nargs = 2, .args = { { Ptr, 0 }, { Int, 1 } } }, { .name = "cloudabi_sys_proc_exec", .ret_type = 1, .nargs = 5, .args = { { Int, 0 }, { BinString | IN, 1 }, { Int, 2 }, { IntArray, 3 }, { Int, 4 } } }, { .name = "cloudabi_sys_proc_exit", .ret_type = 1, .nargs = 1, .args = { { Int, 0 } } }, { .name = "cloudabi_sys_proc_fork", .ret_type = 1, .nargs = 0 }, { .name = "cloudabi_sys_proc_raise", .ret_type = 1, .nargs = 1, .args = { { CloudABISignal, 0 } } }, { .name = "cloudabi_sys_random_get", .ret_type = 1, .nargs = 2, .args = { { BinString | OUT, 0 }, { Int, 1 } } }, { .name = "cloudabi_sys_sock_accept", .ret_type = 1, .nargs = 2, .args = { { Int, 0 }, { CloudABISockStat | OUT, 1 } } }, { .name = "cloudabi_sys_sock_bind", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { Int, 1 }, { BinString | IN, 2 } } }, { .name = "cloudabi_sys_sock_connect", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { Int, 1 }, { BinString | IN, 2 } } }, { .name = "cloudabi_sys_sock_listen", .ret_type = 1, .nargs = 2, .args = { { Int, 0 }, { Int, 1 } } }, { .name = "cloudabi_sys_sock_shutdown", .ret_type = 1, .nargs = 2, .args = { { Int, 0 }, { CloudABISDFlags, 1 } } }, { .name = "cloudabi_sys_sock_stat_get", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { CloudABISockStat | OUT, 1 }, { CloudABISSFlags, 2 } } }, { .name = "cloudabi_sys_thread_exit", .ret_type = 1, .nargs = 2, .args = { { Ptr, 0 }, { CloudABIMFlags, 1 } } }, - { .name = "cloudabi_sys_thread_tcb_set", .ret_type = 1, .nargs = 1, - .args = { { Ptr, 0 } } }, { .name = "cloudabi_sys_thread_yield", .ret_type = 1, .nargs = 0 }, { .name = 0 }, }; static STAILQ_HEAD(, syscall) syscalls; /* Xlat idea taken from strace */ struct xlat { int val; const char *str; }; #define X(a) { a, #a }, #define XEND { 0, NULL } static struct xlat kevent_filters[] = { X(EVFILT_READ) X(EVFILT_WRITE) X(EVFILT_AIO) X(EVFILT_VNODE) X(EVFILT_PROC) X(EVFILT_SIGNAL) X(EVFILT_TIMER) X(EVFILT_PROCDESC) X(EVFILT_FS) X(EVFILT_LIO) X(EVFILT_USER) X(EVFILT_SENDFILE) XEND }; static struct xlat kevent_flags[] = { X(EV_ADD) X(EV_DELETE) X(EV_ENABLE) X(EV_DISABLE) X(EV_ONESHOT) X(EV_CLEAR) X(EV_RECEIPT) X(EV_DISPATCH) X(EV_FORCEONESHOT) X(EV_DROP) X(EV_FLAG1) X(EV_ERROR) X(EV_EOF) XEND }; static struct xlat kevent_user_ffctrl[] = { X(NOTE_FFNOP) X(NOTE_FFAND) X(NOTE_FFOR) X(NOTE_FFCOPY) XEND }; static struct xlat kevent_rdwr_fflags[] = { X(NOTE_LOWAT) X(NOTE_FILE_POLL) XEND }; static struct xlat kevent_vnode_fflags[] = { X(NOTE_DELETE) X(NOTE_WRITE) X(NOTE_EXTEND) X(NOTE_ATTRIB) X(NOTE_LINK) X(NOTE_RENAME) X(NOTE_REVOKE) XEND }; static struct xlat kevent_proc_fflags[] = { X(NOTE_EXIT) X(NOTE_FORK) X(NOTE_EXEC) X(NOTE_TRACK) X(NOTE_TRACKERR) X(NOTE_CHILD) XEND }; static struct xlat kevent_timer_fflags[] = { X(NOTE_SECONDS) X(NOTE_MSECONDS) X(NOTE_USECONDS) X(NOTE_NSECONDS) XEND }; static struct xlat poll_flags[] = { X(POLLSTANDARD) X(POLLIN) X(POLLPRI) X(POLLOUT) X(POLLERR) X(POLLHUP) X(POLLNVAL) X(POLLRDNORM) X(POLLRDBAND) X(POLLWRBAND) X(POLLINIGNEOF) XEND }; static struct xlat mmap_flags[] = { X(MAP_SHARED) X(MAP_PRIVATE) X(MAP_FIXED) X(MAP_RESERVED0020) X(MAP_RESERVED0040) X(MAP_RESERVED0080) X(MAP_RESERVED0100) X(MAP_HASSEMAPHORE) X(MAP_STACK) X(MAP_NOSYNC) X(MAP_ANON) X(MAP_EXCL) X(MAP_NOCORE) X(MAP_PREFAULT_READ) #ifdef MAP_32BIT X(MAP_32BIT) #endif XEND }; static struct xlat mprot_flags[] = { X(PROT_NONE) X(PROT_READ) X(PROT_WRITE) X(PROT_EXEC) XEND }; static struct xlat whence_arg[] = { X(SEEK_SET) X(SEEK_CUR) X(SEEK_END) X(SEEK_DATA) X(SEEK_HOLE) XEND }; static struct xlat sigaction_flags[] = { X(SA_ONSTACK) X(SA_RESTART) X(SA_RESETHAND) X(SA_NOCLDSTOP) X(SA_NODEFER) X(SA_NOCLDWAIT) X(SA_SIGINFO) XEND }; static struct xlat fcntl_arg[] = { X(F_DUPFD) X(F_GETFD) X(F_SETFD) X(F_GETFL) X(F_SETFL) X(F_GETOWN) X(F_SETOWN) X(F_OGETLK) X(F_OSETLK) X(F_OSETLKW) X(F_DUP2FD) X(F_GETLK) X(F_SETLK) X(F_SETLKW) X(F_SETLK_REMOTE) X(F_READAHEAD) X(F_RDAHEAD) X(F_DUPFD_CLOEXEC) X(F_DUP2FD_CLOEXEC) XEND }; static struct xlat fcntlfd_arg[] = { X(FD_CLOEXEC) XEND }; static struct xlat fcntlfl_arg[] = { X(O_APPEND) X(O_ASYNC) X(O_FSYNC) X(O_NONBLOCK) X(O_NOFOLLOW) X(FRDAHEAD) X(O_DIRECT) XEND }; static struct xlat sockdomain_arg[] = { X(PF_UNSPEC) X(PF_LOCAL) X(PF_UNIX) X(PF_INET) X(PF_IMPLINK) X(PF_PUP) X(PF_CHAOS) X(PF_NETBIOS) X(PF_ISO) X(PF_OSI) X(PF_ECMA) X(PF_DATAKIT) X(PF_CCITT) X(PF_SNA) X(PF_DECnet) X(PF_DLI) X(PF_LAT) X(PF_HYLINK) X(PF_APPLETALK) X(PF_ROUTE) X(PF_LINK) X(PF_XTP) X(PF_COIP) X(PF_CNT) X(PF_SIP) X(PF_IPX) X(PF_RTIP) X(PF_PIP) X(PF_ISDN) X(PF_KEY) X(PF_INET6) X(PF_NATM) X(PF_ATM) X(PF_NETGRAPH) X(PF_SLOW) X(PF_SCLUSTER) X(PF_ARP) X(PF_BLUETOOTH) X(PF_IEEE80211) X(PF_INET_SDP) X(PF_INET6_SDP) XEND }; static struct xlat socktype_arg[] = { X(SOCK_STREAM) X(SOCK_DGRAM) X(SOCK_RAW) X(SOCK_RDM) X(SOCK_SEQPACKET) XEND }; static struct xlat open_flags[] = { X(O_RDONLY) X(O_WRONLY) X(O_RDWR) X(O_ACCMODE) X(O_NONBLOCK) X(O_APPEND) X(O_SHLOCK) X(O_EXLOCK) X(O_ASYNC) X(O_FSYNC) X(O_NOFOLLOW) X(O_CREAT) X(O_TRUNC) X(O_EXCL) X(O_NOCTTY) X(O_DIRECT) X(O_DIRECTORY) X(O_EXEC) X(O_TTY_INIT) X(O_CLOEXEC) X(O_VERIFY) XEND }; static struct xlat shutdown_arg[] = { X(SHUT_RD) X(SHUT_WR) X(SHUT_RDWR) XEND }; static struct xlat resource_arg[] = { X(RLIMIT_CPU) X(RLIMIT_FSIZE) X(RLIMIT_DATA) X(RLIMIT_STACK) X(RLIMIT_CORE) X(RLIMIT_RSS) X(RLIMIT_MEMLOCK) X(RLIMIT_NPROC) X(RLIMIT_NOFILE) X(RLIMIT_SBSIZE) X(RLIMIT_VMEM) X(RLIMIT_NPTS) X(RLIMIT_SWAP) X(RLIMIT_KQUEUES) XEND }; static struct xlat pathconf_arg[] = { X(_PC_LINK_MAX) X(_PC_MAX_CANON) X(_PC_MAX_INPUT) X(_PC_NAME_MAX) X(_PC_PATH_MAX) X(_PC_PIPE_BUF) X(_PC_CHOWN_RESTRICTED) X(_PC_NO_TRUNC) X(_PC_VDISABLE) X(_PC_ASYNC_IO) X(_PC_PRIO_IO) X(_PC_SYNC_IO) X(_PC_ALLOC_SIZE_MIN) X(_PC_FILESIZEBITS) X(_PC_REC_INCR_XFER_SIZE) X(_PC_REC_MAX_XFER_SIZE) X(_PC_REC_MIN_XFER_SIZE) X(_PC_REC_XFER_ALIGN) X(_PC_SYMLINK_MAX) X(_PC_ACL_EXTENDED) X(_PC_ACL_PATH_MAX) X(_PC_CAP_PRESENT) X(_PC_INF_PRESENT) X(_PC_MAC_PRESENT) X(_PC_ACL_NFS4) X(_PC_MIN_HOLE_SIZE) XEND }; static struct xlat rfork_flags[] = { X(RFFDG) X(RFPROC) X(RFMEM) X(RFNOWAIT) X(RFCFDG) X(RFTHREAD) X(RFSIGSHARE) X(RFLINUXTHPN) X(RFTSIGZMB) X(RFPPWAIT) XEND }; static struct xlat wait_options[] = { X(WNOHANG) X(WUNTRACED) X(WCONTINUED) X(WNOWAIT) X(WEXITED) X(WTRAPPED) XEND }; static struct xlat idtype_arg[] = { X(P_PID) X(P_PPID) X(P_PGID) X(P_SID) X(P_CID) X(P_UID) X(P_GID) X(P_ALL) X(P_LWPID) X(P_TASKID) X(P_PROJID) X(P_POOLID) X(P_JAILID) X(P_CTID) X(P_CPUID) X(P_PSETID) XEND }; static struct xlat procctl_arg[] = { X(PROC_SPROTECT) X(PROC_REAP_ACQUIRE) X(PROC_REAP_RELEASE) X(PROC_REAP_STATUS) X(PROC_REAP_GETPIDS) X(PROC_REAP_KILL) X(PROC_TRACE_CTL) X(PROC_TRACE_STATUS) XEND }; static struct xlat umtx_ops[] = { X(UMTX_OP_RESERVED0) X(UMTX_OP_RESERVED1) X(UMTX_OP_WAIT) X(UMTX_OP_WAKE) X(UMTX_OP_MUTEX_TRYLOCK) X(UMTX_OP_MUTEX_LOCK) X(UMTX_OP_MUTEX_UNLOCK) X(UMTX_OP_SET_CEILING) X(UMTX_OP_CV_WAIT) X(UMTX_OP_CV_SIGNAL) X(UMTX_OP_CV_BROADCAST) X(UMTX_OP_WAIT_UINT) X(UMTX_OP_RW_RDLOCK) X(UMTX_OP_RW_WRLOCK) X(UMTX_OP_RW_UNLOCK) X(UMTX_OP_WAIT_UINT_PRIVATE) X(UMTX_OP_WAKE_PRIVATE) X(UMTX_OP_MUTEX_WAIT) X(UMTX_OP_MUTEX_WAKE) X(UMTX_OP_SEM_WAIT) X(UMTX_OP_SEM_WAKE) X(UMTX_OP_NWAKE_PRIVATE) X(UMTX_OP_MUTEX_WAKE2) X(UMTX_OP_SEM2_WAIT) X(UMTX_OP_SEM2_WAKE) XEND }; static struct xlat at_flags[] = { X(AT_EACCESS) X(AT_SYMLINK_NOFOLLOW) X(AT_SYMLINK_FOLLOW) X(AT_REMOVEDIR) XEND }; static struct xlat access_modes[] = { X(R_OK) X(W_OK) X(X_OK) XEND }; static struct xlat sysarch_ops[] = { #if defined(__i386__) || defined(__amd64__) X(I386_GET_LDT) X(I386_SET_LDT) X(I386_GET_IOPERM) X(I386_SET_IOPERM) X(I386_VM86) X(I386_GET_FSBASE) X(I386_SET_FSBASE) X(I386_GET_GSBASE) X(I386_SET_GSBASE) X(I386_GET_XFPUSTATE) X(AMD64_GET_FSBASE) X(AMD64_SET_FSBASE) X(AMD64_GET_GSBASE) X(AMD64_SET_GSBASE) X(AMD64_GET_XFPUSTATE) #endif XEND }; static struct xlat linux_socketcall_ops[] = { X(LINUX_SOCKET) X(LINUX_BIND) X(LINUX_CONNECT) X(LINUX_LISTEN) X(LINUX_ACCEPT) X(LINUX_GETSOCKNAME) X(LINUX_GETPEERNAME) X(LINUX_SOCKETPAIR) X(LINUX_SEND) X(LINUX_RECV) X(LINUX_SENDTO) X(LINUX_RECVFROM) X(LINUX_SHUTDOWN) X(LINUX_SETSOCKOPT) X(LINUX_GETSOCKOPT) X(LINUX_SENDMSG) X(LINUX_RECVMSG) XEND }; static struct xlat sigprocmask_ops[] = { X(SIG_BLOCK) X(SIG_UNBLOCK) X(SIG_SETMASK) XEND }; #undef X #define X(a) { CLOUDABI_##a, #a }, static struct xlat cloudabi_advice[] = { X(ADVICE_DONTNEED) X(ADVICE_NOREUSE) X(ADVICE_NORMAL) X(ADVICE_RANDOM) X(ADVICE_SEQUENTIAL) X(ADVICE_WILLNEED) XEND }; static struct xlat cloudabi_clockid[] = { X(CLOCK_MONOTONIC) X(CLOCK_PROCESS_CPUTIME_ID) X(CLOCK_REALTIME) X(CLOCK_THREAD_CPUTIME_ID) XEND }; static struct xlat cloudabi_errno[] = { X(E2BIG) X(EACCES) X(EADDRINUSE) X(EADDRNOTAVAIL) X(EAFNOSUPPORT) X(EAGAIN) X(EALREADY) X(EBADF) X(EBADMSG) X(EBUSY) X(ECANCELED) X(ECHILD) X(ECONNABORTED) X(ECONNREFUSED) X(ECONNRESET) X(EDEADLK) X(EDESTADDRREQ) X(EDOM) X(EDQUOT) X(EEXIST) X(EFAULT) X(EFBIG) X(EHOSTUNREACH) X(EIDRM) X(EILSEQ) X(EINPROGRESS) X(EINTR) X(EINVAL) X(EIO) X(EISCONN) X(EISDIR) X(ELOOP) X(EMFILE) X(EMLINK) X(EMSGSIZE) X(EMULTIHOP) X(ENAMETOOLONG) X(ENETDOWN) X(ENETRESET) X(ENETUNREACH) X(ENFILE) X(ENOBUFS) X(ENODEV) X(ENOENT) X(ENOEXEC) X(ENOLCK) X(ENOLINK) X(ENOMEM) X(ENOMSG) X(ENOPROTOOPT) X(ENOSPC) X(ENOSYS) X(ENOTCONN) X(ENOTDIR) X(ENOTEMPTY) X(ENOTRECOVERABLE) X(ENOTSOCK) X(ENOTSUP) X(ENOTTY) X(ENXIO) X(EOVERFLOW) X(EOWNERDEAD) X(EPERM) X(EPIPE) X(EPROTO) X(EPROTONOSUPPORT) X(EPROTOTYPE) X(ERANGE) X(EROFS) X(ESPIPE) X(ESRCH) X(ESTALE) X(ETIMEDOUT) X(ETXTBSY) X(EXDEV) X(ENOTCAPABLE) XEND }; static struct xlat cloudabi_fdflags[] = { X(FDFLAG_APPEND) X(FDFLAG_DSYNC) X(FDFLAG_NONBLOCK) X(FDFLAG_RSYNC) X(FDFLAG_SYNC) XEND }; static struct xlat cloudabi_fdsflags[] = { X(FDSTAT_FLAGS) X(FDSTAT_RIGHTS) XEND }; static struct xlat cloudabi_filetype[] = { X(FILETYPE_UNKNOWN) X(FILETYPE_BLOCK_DEVICE) X(FILETYPE_CHARACTER_DEVICE) X(FILETYPE_DIRECTORY) X(FILETYPE_FIFO) X(FILETYPE_POLL) X(FILETYPE_PROCESS) X(FILETYPE_REGULAR_FILE) X(FILETYPE_SHARED_MEMORY) X(FILETYPE_SOCKET_DGRAM) X(FILETYPE_SOCKET_SEQPACKET) X(FILETYPE_SOCKET_STREAM) X(FILETYPE_SYMBOLIC_LINK) XEND }; static struct xlat cloudabi_fsflags[] = { X(FILESTAT_ATIM) X(FILESTAT_ATIM_NOW) X(FILESTAT_MTIM) X(FILESTAT_MTIM_NOW) X(FILESTAT_SIZE) XEND }; static struct xlat cloudabi_mflags[] = { X(MAP_ANON) X(MAP_FIXED) X(MAP_PRIVATE) X(MAP_SHARED) XEND }; static struct xlat cloudabi_mprot[] = { X(PROT_EXEC) X(PROT_WRITE) X(PROT_READ) XEND }; static struct xlat cloudabi_msflags[] = { X(MS_ASYNC) X(MS_INVALIDATE) X(MS_SYNC) XEND }; static struct xlat cloudabi_oflags[] = { X(O_CREAT) X(O_DIRECTORY) X(O_EXCL) X(O_TRUNC) XEND }; static struct xlat cloudabi_sa_family[] = { X(AF_UNSPEC) X(AF_INET) X(AF_INET6) X(AF_UNIX) XEND }; static struct xlat cloudabi_sdflags[] = { X(SHUT_RD) X(SHUT_WR) XEND }; static struct xlat cloudabi_signal[] = { X(SIGABRT) X(SIGALRM) X(SIGBUS) X(SIGCHLD) X(SIGCONT) X(SIGFPE) X(SIGHUP) X(SIGILL) X(SIGINT) X(SIGKILL) X(SIGPIPE) X(SIGQUIT) X(SIGSEGV) X(SIGSTOP) X(SIGSYS) X(SIGTERM) X(SIGTRAP) X(SIGTSTP) X(SIGTTIN) X(SIGTTOU) X(SIGURG) X(SIGUSR1) X(SIGUSR2) X(SIGVTALRM) X(SIGXCPU) X(SIGXFSZ) XEND }; static struct xlat cloudabi_ssflags[] = { X(SOCKSTAT_CLEAR_ERROR) XEND }; static struct xlat cloudabi_ssstate[] = { X(SOCKSTATE_ACCEPTCONN) XEND }; static struct xlat cloudabi_ulflags[] = { X(UNLINK_REMOVEDIR) XEND }; static struct xlat cloudabi_whence[] = { X(WHENCE_CUR) X(WHENCE_END) X(WHENCE_SET) XEND }; #undef X #undef XEND /* * Searches an xlat array for a value, and returns it if found. Otherwise * return a string representation. */ static const char * lookup(struct xlat *xlat, int val, int base) { static char tmp[16]; for (; xlat->str != NULL; xlat++) if (xlat->val == val) return (xlat->str); switch (base) { case 8: sprintf(tmp, "0%o", val); break; case 16: sprintf(tmp, "0x%x", val); break; case 10: sprintf(tmp, "%u", val); break; default: errx(1,"Unknown lookup base"); break; } return (tmp); } static const char * xlookup(struct xlat *xlat, int val) { return (lookup(xlat, val, 16)); } /* * Searches an xlat array containing bitfield values. Remaining bits * set after removing the known ones are printed at the end: * IN|0x400. */ static char * xlookup_bits(struct xlat *xlat, int val) { int len, rem; static char str[512]; len = 0; rem = val; for (; xlat->str != NULL; xlat++) { if ((xlat->val & rem) == xlat->val) { /* * Don't print the "all-bits-zero" string unless all * bits are really zero. */ if (xlat->val == 0 && val != 0) continue; len += sprintf(str + len, "%s|", xlat->str); rem &= ~(xlat->val); } } /* * If we have leftover bits or didn't match anything, print * the remainder. */ if (rem || len == 0) len += sprintf(str + len, "0x%x", rem); if (len && str[len - 1] == '|') len--; str[len] = 0; return (str); } void init_syscalls(void) { struct syscall *sc; STAILQ_INIT(&syscalls); for (sc = decoded_syscalls; sc->name != NULL; sc++) STAILQ_INSERT_HEAD(&syscalls, sc, entries); } /* * If/when the list gets big, it might be desirable to do it * as a hash table or binary search. */ struct syscall * get_syscall(const char *name, int nargs) { struct syscall *sc; int i; if (name == NULL) return (NULL); STAILQ_FOREACH(sc, &syscalls, entries) if (strcmp(name, sc->name) == 0) return (sc); /* It is unknown. Add it into the list. */ #if DEBUG fprintf(stderr, "unknown syscall %s -- setting args to %d\n", name, nargs); #endif sc = calloc(1, sizeof(struct syscall)); sc->name = strdup(name); sc->ret_type = 1; sc->nargs = nargs; for (i = 0; i < nargs; i++) { sc->args[i].offset = i; /* Treat all unknown arguments as LongHex. */ sc->args[i].type = LongHex; } STAILQ_INSERT_HEAD(&syscalls, sc, entries); return (sc); } /* * Copy a fixed amount of bytes from the process. */ static int get_struct(pid_t pid, void *offset, void *buf, int len) { struct ptrace_io_desc iorequest; iorequest.piod_op = PIOD_READ_D; iorequest.piod_offs = offset; iorequest.piod_addr = buf; iorequest.piod_len = len; if (ptrace(PT_IO, pid, (caddr_t)&iorequest, 0) < 0) return (-1); return (0); } #define MAXSIZE 4096 /* * Copy a string from the process. Note that it is * expected to be a C string, but if max is set, it will * only get that much. */ static char * get_string(pid_t pid, void *addr, int max) { struct ptrace_io_desc iorequest; char *buf, *nbuf; size_t offset, size, totalsize; offset = 0; if (max) size = max + 1; else { /* Read up to the end of the current page. */ size = PAGE_SIZE - ((uintptr_t)addr % PAGE_SIZE); if (size > MAXSIZE) size = MAXSIZE; } totalsize = size; buf = malloc(totalsize); if (buf == NULL) return (NULL); for (;;) { iorequest.piod_op = PIOD_READ_D; iorequest.piod_offs = (char *)addr + offset; iorequest.piod_addr = buf + offset; iorequest.piod_len = size; if (ptrace(PT_IO, pid, (caddr_t)&iorequest, 0) < 0) { free(buf); return (NULL); } if (memchr(buf + offset, '\0', size) != NULL) return (buf); offset += size; if (totalsize < MAXSIZE && max == 0) { size = MAXSIZE - totalsize; if (size > PAGE_SIZE) size = PAGE_SIZE; nbuf = realloc(buf, totalsize + size); if (nbuf == NULL) { buf[totalsize - 1] = '\0'; return (buf); } buf = nbuf; totalsize += size; } else { buf[totalsize - 1] = '\0'; return (buf); } } } static char * strsig2(int sig) { static char tmp[sizeof(int) * 3 + 1]; char *ret; ret = strsig(sig); if (ret == NULL) { snprintf(tmp, sizeof(tmp), "%d", sig); ret = tmp; } return (ret); } static void print_kevent(FILE *fp, struct kevent *ke, int input) { switch (ke->filter) { case EVFILT_READ: case EVFILT_WRITE: case EVFILT_VNODE: case EVFILT_PROC: case EVFILT_TIMER: case EVFILT_PROCDESC: fprintf(fp, "%ju", (uintmax_t)ke->ident); break; case EVFILT_SIGNAL: fputs(strsig2(ke->ident), fp); break; default: fprintf(fp, "%p", (void *)ke->ident); } fprintf(fp, ",%s,%s,", xlookup(kevent_filters, ke->filter), xlookup_bits(kevent_flags, ke->flags)); switch (ke->filter) { case EVFILT_READ: case EVFILT_WRITE: fputs(xlookup_bits(kevent_rdwr_fflags, ke->fflags), fp); break; case EVFILT_VNODE: fputs(xlookup_bits(kevent_vnode_fflags, ke->fflags), fp); break; case EVFILT_PROC: case EVFILT_PROCDESC: fputs(xlookup_bits(kevent_proc_fflags, ke->fflags), fp); break; case EVFILT_TIMER: fputs(xlookup_bits(kevent_timer_fflags, ke->fflags), fp); break; case EVFILT_USER: { int ctrl, data; ctrl = ke->fflags & NOTE_FFCTRLMASK; data = ke->fflags & NOTE_FFLAGSMASK; if (input) { fputs(xlookup(kevent_user_ffctrl, ctrl), fp); if (ke->fflags & NOTE_TRIGGER) fputs("|NOTE_TRIGGER", fp); if (data != 0) fprintf(fp, "|%#x", data); } else { fprintf(fp, "%#x", data); } break; } default: fprintf(fp, "%#x", ke->fflags); } fprintf(fp, ",%p,%p", (void *)ke->data, (void *)ke->udata); } static void print_utrace(FILE *fp, void *utrace_addr, size_t len) { unsigned char *utrace_buffer; fprintf(fp, "{ "); if (sysdecode_utrace(fp, utrace_addr, len)) { fprintf(fp, " }"); return; } utrace_buffer = utrace_addr; fprintf(fp, "%zu:", len); while (len--) fprintf(fp, " %02x", *utrace_buffer++); fprintf(fp, " }"); } /* * Converts a syscall argument into a string. Said string is * allocated via malloc(), so needs to be free()'d. sc is * a pointer to the syscall description (see above); args is * an array of all of the system call arguments. */ char * print_arg(struct syscall_args *sc, unsigned long *args, long *retval, struct trussinfo *trussinfo) { FILE *fp; char *tmp; size_t tmplen; pid_t pid; fp = open_memstream(&tmp, &tmplen); pid = trussinfo->curthread->proc->pid; switch (sc->type & ARG_MASK) { case Hex: fprintf(fp, "0x%x", (int)args[sc->offset]); break; case Octal: fprintf(fp, "0%o", (int)args[sc->offset]); break; case Int: fprintf(fp, "%d", (int)args[sc->offset]); break; case UInt: fprintf(fp, "%u", (unsigned int)args[sc->offset]); break; case LongHex: fprintf(fp, "0x%lx", args[sc->offset]); break; case Long: fprintf(fp, "%ld", args[sc->offset]); break; case Name: { /* NULL-terminated string. */ char *tmp2; tmp2 = get_string(pid, (void*)args[sc->offset], 0); fprintf(fp, "\"%s\"", tmp2); free(tmp2); break; } case BinString: { /* * Binary block of data that might have printable characters. * XXX If type|OUT, assume that the length is the syscall's * return value. Otherwise, assume that the length of the block * is in the next syscall argument. */ int max_string = trussinfo->strsize; char tmp2[max_string + 1], *tmp3; int len; int truncated = 0; if (sc->type & OUT) len = retval[0]; else len = args[sc->offset + 1]; /* * Don't print more than max_string characters, to avoid word * wrap. If we have to truncate put some ... after the string. */ if (len > max_string) { len = max_string; truncated = 1; } if (len && get_struct(pid, (void*)args[sc->offset], &tmp2, len) != -1) { tmp3 = malloc(len * 4 + 1); while (len) { if (strvisx(tmp3, tmp2, len, VIS_CSTYLE|VIS_TAB|VIS_NL) <= max_string) break; len--; truncated = 1; } fprintf(fp, "\"%s\"%s", tmp3, truncated ? "..." : ""); free(tmp3); } else { fprintf(fp, "0x%lx", args[sc->offset]); } break; } case ExecArgs: case ExecEnv: case StringArray: { uintptr_t addr; union { char *strarray[0]; char buf[PAGE_SIZE]; } u; char *string; size_t len; u_int first, i; /* * Only parse argv[] and environment arrays from exec calls * if requested. */ if (((sc->type & ARG_MASK) == ExecArgs && (trussinfo->flags & EXECVEARGS) == 0) || ((sc->type & ARG_MASK) == ExecEnv && (trussinfo->flags & EXECVEENVS) == 0)) { fprintf(fp, "0x%lx", args[sc->offset]); break; } /* * Read a page of pointers at a time. Punt if the top-level * pointer is not aligned. Note that the first read is of * a partial page. */ addr = args[sc->offset]; if (addr % sizeof(char *) != 0) { fprintf(fp, "0x%lx", args[sc->offset]); break; } len = PAGE_SIZE - (addr & PAGE_MASK); if (get_struct(pid, (void *)addr, u.buf, len) == -1) { fprintf(fp, "0x%lx", args[sc->offset]); break; } fputc('[', fp); first = 1; i = 0; while (u.strarray[i] != NULL) { string = get_string(pid, u.strarray[i], 0); fprintf(fp, "%s \"%s\"", first ? "" : ",", string); free(string); first = 0; i++; if (i == len / sizeof(char *)) { addr += len; len = PAGE_SIZE; if (get_struct(pid, (void *)addr, u.buf, len) == -1) { fprintf(fp, ", "); break; } i = 0; } } fputs(" ]", fp); break; } #ifdef __LP64__ case Quad: fprintf(fp, "%ld", args[sc->offset]); break; case QuadHex: fprintf(fp, "0x%lx", args[sc->offset]); break; #else case Quad: case QuadHex: { unsigned long long ll; #if _BYTE_ORDER == _LITTLE_ENDIAN ll = (unsigned long long)args[sc->offset + 1] << 32 | args[sc->offset]; #else ll = (unsigned long long)args[sc->offset] << 32 | args[sc->offset + 1]; #endif if ((sc->type & ARG_MASK) == Quad) fprintf(fp, "%lld", ll); else fprintf(fp, "0x%llx", ll); break; } #endif case Ptr: fprintf(fp, "0x%lx", args[sc->offset]); break; case Readlinkres: { char *tmp2; if (retval[0] == -1) break; tmp2 = get_string(pid, (void*)args[sc->offset], retval[0]); fprintf(fp, "\"%s\"", tmp2); free(tmp2); break; } case Ioctl: { const char *temp; unsigned long cmd; cmd = args[sc->offset]; temp = sysdecode_ioctlname(cmd); if (temp) fputs(temp, fp); else { fprintf(fp, "0x%lx { IO%s%s 0x%lx('%c'), %lu, %lu }", cmd, cmd & IOC_OUT ? "R" : "", cmd & IOC_IN ? "W" : "", IOCGROUP(cmd), isprint(IOCGROUP(cmd)) ? (char)IOCGROUP(cmd) : '?', cmd & 0xFF, IOCPARM_LEN(cmd)); } break; } case Timespec: { struct timespec ts; if (get_struct(pid, (void *)args[sc->offset], &ts, sizeof(ts)) != -1) fprintf(fp, "{ %jd.%09ld }", (intmax_t)ts.tv_sec, ts.tv_nsec); else fprintf(fp, "0x%lx", args[sc->offset]); break; } case Timespec2: { struct timespec ts[2]; const char *sep; unsigned int i; if (get_struct(pid, (void *)args[sc->offset], &ts, sizeof(ts)) != -1) { fputs("{ ", fp); sep = ""; for (i = 0; i < nitems(ts); i++) { fputs(sep, fp); sep = ", "; switch (ts[i].tv_nsec) { case UTIME_NOW: fprintf(fp, "UTIME_NOW"); break; case UTIME_OMIT: fprintf(fp, "UTIME_OMIT"); break; default: fprintf(fp, "%jd.%09ld", (intmax_t)ts[i].tv_sec, ts[i].tv_nsec); break; } } fputs(" }", fp); } else fprintf(fp, "0x%lx", args[sc->offset]); break; } case Timeval: { struct timeval tv; if (get_struct(pid, (void *)args[sc->offset], &tv, sizeof(tv)) != -1) fprintf(fp, "{ %jd.%06ld }", (intmax_t)tv.tv_sec, tv.tv_usec); else fprintf(fp, "0x%lx", args[sc->offset]); break; } case Timeval2: { struct timeval tv[2]; if (get_struct(pid, (void *)args[sc->offset], &tv, sizeof(tv)) != -1) fprintf(fp, "{ %jd.%06ld, %jd.%06ld }", (intmax_t)tv[0].tv_sec, tv[0].tv_usec, (intmax_t)tv[1].tv_sec, tv[1].tv_usec); else fprintf(fp, "0x%lx", args[sc->offset]); break; } case Itimerval: { struct itimerval itv; if (get_struct(pid, (void *)args[sc->offset], &itv, sizeof(itv)) != -1) fprintf(fp, "{ %jd.%06ld, %jd.%06ld }", (intmax_t)itv.it_interval.tv_sec, itv.it_interval.tv_usec, (intmax_t)itv.it_value.tv_sec, itv.it_value.tv_usec); else fprintf(fp, "0x%lx", args[sc->offset]); break; } case LinuxSockArgs: { struct linux_socketcall_args largs; if (get_struct(pid, (void *)args[sc->offset], (void *)&largs, sizeof(largs)) != -1) fprintf(fp, "{ %s, 0x%lx }", lookup(linux_socketcall_ops, largs.what, 10), (long unsigned int)largs.args); else fprintf(fp, "0x%lx", args[sc->offset]); break; } case Pollfd: { /* * XXX: A Pollfd argument expects the /next/ syscall argument * to be the number of fds in the array. This matches the poll * syscall. */ struct pollfd *pfd; int numfds = args[sc->offset + 1]; size_t bytes = sizeof(struct pollfd) * numfds; int i; if ((pfd = malloc(bytes)) == NULL) err(1, "Cannot malloc %zu bytes for pollfd array", bytes); if (get_struct(pid, (void *)args[sc->offset], pfd, bytes) != -1) { fputs("{", fp); for (i = 0; i < numfds; i++) { fprintf(fp, " %d/%s", pfd[i].fd, xlookup_bits(poll_flags, pfd[i].events)); } fputs(" }", fp); } else { fprintf(fp, "0x%lx", args[sc->offset]); } free(pfd); break; } case Fd_set: { /* * XXX: A Fd_set argument expects the /first/ syscall argument * to be the number of fds in the array. This matches the * select syscall. */ fd_set *fds; int numfds = args[0]; size_t bytes = _howmany(numfds, _NFDBITS) * _NFDBITS; int i; if ((fds = malloc(bytes)) == NULL) err(1, "Cannot malloc %zu bytes for fd_set array", bytes); if (get_struct(pid, (void *)args[sc->offset], fds, bytes) != -1) { fputs("{", fp); for (i = 0; i < numfds; i++) { if (FD_ISSET(i, fds)) fprintf(fp, " %d", i); } fputs(" }", fp); } else fprintf(fp, "0x%lx", args[sc->offset]); free(fds); break; } case Signal: fputs(strsig2(args[sc->offset]), fp); break; case Sigset: { long sig; sigset_t ss; int i, first; sig = args[sc->offset]; if (get_struct(pid, (void *)args[sc->offset], (void *)&ss, sizeof(ss)) == -1) { fprintf(fp, "0x%lx", args[sc->offset]); break; } fputs("{ ", fp); first = 1; for (i = 1; i < sys_nsig; i++) { if (sigismember(&ss, i)) { fprintf(fp, "%s%s", !first ? "|" : "", strsig(i)); first = 0; } } if (!first) fputc(' ', fp); fputc('}', fp); break; } case Sigprocmask: { fputs(xlookup(sigprocmask_ops, args[sc->offset]), fp); break; } case Fcntlflag: { /* XXX: Output depends on the value of the previous argument. */ switch (args[sc->offset - 1]) { case F_SETFD: fputs(xlookup_bits(fcntlfd_arg, args[sc->offset]), fp); break; case F_SETFL: fputs(xlookup_bits(fcntlfl_arg, args[sc->offset]), fp); break; case F_GETFD: case F_GETFL: case F_GETOWN: break; default: fprintf(fp, "0x%lx", args[sc->offset]); break; } break; } case Open: fputs(xlookup_bits(open_flags, args[sc->offset]), fp); break; case Fcntl: fputs(xlookup(fcntl_arg, args[sc->offset]), fp); break; case Mprot: fputs(xlookup_bits(mprot_flags, args[sc->offset]), fp); break; case Mmapflags: { int align, flags; /* * MAP_ALIGNED can't be handled by xlookup_bits(), so * generate that string manually and prepend it to the * string from xlookup_bits(). Have to be careful to * avoid outputting MAP_ALIGNED|0 if MAP_ALIGNED is * the only flag. */ flags = args[sc->offset] & ~MAP_ALIGNMENT_MASK; align = args[sc->offset] & MAP_ALIGNMENT_MASK; if (align != 0) { if (align == MAP_ALIGNED_SUPER) fputs("MAP_ALIGNED_SUPER", fp); else fprintf(fp, "MAP_ALIGNED(%d)", align >> MAP_ALIGNMENT_SHIFT); if (flags == 0) break; fputc('|', fp); } fputs(xlookup_bits(mmap_flags, flags), fp); break; } case Whence: fputs(xlookup(whence_arg, args[sc->offset]), fp); break; case Sockdomain: fputs(xlookup(sockdomain_arg, args[sc->offset]), fp); break; case Socktype: { int type, flags; flags = args[sc->offset] & (SOCK_CLOEXEC | SOCK_NONBLOCK); type = args[sc->offset] & ~flags; fputs(xlookup(socktype_arg, type), fp); if (flags & SOCK_CLOEXEC) fprintf(fp, "|SOCK_CLOEXEC"); if (flags & SOCK_NONBLOCK) fprintf(fp, "|SOCK_NONBLOCK"); break; } case Shutdown: fputs(xlookup(shutdown_arg, args[sc->offset]), fp); break; case Resource: fputs(xlookup(resource_arg, args[sc->offset]), fp); break; case Pathconf: fputs(xlookup(pathconf_arg, args[sc->offset]), fp); break; case Rforkflags: fputs(xlookup_bits(rfork_flags, args[sc->offset]), fp); break; case Sockaddr: { char addr[64]; struct sockaddr_in *lsin; struct sockaddr_in6 *lsin6; struct sockaddr_un *sun; struct sockaddr *sa; socklen_t len; u_char *q; if (args[sc->offset] == 0) { fputs("NULL", fp); break; } /* * Extract the address length from the next argument. If * this is an output sockaddr (OUT is set), then the * next argument is a pointer to a socklen_t. Otherwise * the next argument contains a socklen_t by value. */ if (sc->type & OUT) { if (get_struct(pid, (void *)args[sc->offset + 1], &len, sizeof(len)) == -1) { fprintf(fp, "0x%lx", args[sc->offset]); break; } } else len = args[sc->offset + 1]; /* If the length is too small, just bail. */ if (len < sizeof(*sa)) { fprintf(fp, "0x%lx", args[sc->offset]); break; } sa = calloc(1, len); if (get_struct(pid, (void *)args[sc->offset], sa, len) == -1) { free(sa); fprintf(fp, "0x%lx", args[sc->offset]); break; } switch (sa->sa_family) { case AF_INET: if (len < sizeof(*lsin)) goto sockaddr_short; lsin = (struct sockaddr_in *)(void *)sa; inet_ntop(AF_INET, &lsin->sin_addr, addr, sizeof(addr)); fprintf(fp, "{ AF_INET %s:%d }", addr, htons(lsin->sin_port)); break; case AF_INET6: if (len < sizeof(*lsin6)) goto sockaddr_short; lsin6 = (struct sockaddr_in6 *)(void *)sa; inet_ntop(AF_INET6, &lsin6->sin6_addr, addr, sizeof(addr)); fprintf(fp, "{ AF_INET6 [%s]:%d }", addr, htons(lsin6->sin6_port)); break; case AF_UNIX: sun = (struct sockaddr_un *)sa; fprintf(fp, "{ AF_UNIX \"%.*s\" }", (int)(len - offsetof(struct sockaddr_un, sun_path)), sun->sun_path); break; default: sockaddr_short: fprintf(fp, "{ sa_len = %d, sa_family = %d, sa_data = {", (int)sa->sa_len, (int)sa->sa_family); for (q = (u_char *)sa->sa_data; q < (u_char *)sa + len; q++) fprintf(fp, "%s 0x%02x", q == (u_char *)sa->sa_data ? "" : ",", *q); fputs(" } }", fp); } free(sa); break; } case Sigaction: { struct sigaction sa; if (get_struct(pid, (void *)args[sc->offset], &sa, sizeof(sa)) != -1) { fputs("{ ", fp); if (sa.sa_handler == SIG_DFL) fputs("SIG_DFL", fp); else if (sa.sa_handler == SIG_IGN) fputs("SIG_IGN", fp); else fprintf(fp, "%p", sa.sa_handler); fprintf(fp, " %s ss_t }", xlookup_bits(sigaction_flags, sa.sa_flags)); } else fprintf(fp, "0x%lx", args[sc->offset]); break; } case Kevent: { /* * XXX XXX: The size of the array is determined by either the * next syscall argument, or by the syscall return value, * depending on which argument number we are. This matches the * kevent syscall, but luckily that's the only syscall that uses * them. */ struct kevent *ke; int numevents = -1; size_t bytes; int i; if (sc->offset == 1) numevents = args[sc->offset+1]; else if (sc->offset == 3 && retval[0] != -1) numevents = retval[0]; if (numevents >= 0) { bytes = sizeof(struct kevent) * numevents; if ((ke = malloc(bytes)) == NULL) err(1, "Cannot malloc %zu bytes for kevent array", bytes); } else ke = NULL; if (numevents >= 0 && get_struct(pid, (void *)args[sc->offset], ke, bytes) != -1) { fputc('{', fp); for (i = 0; i < numevents; i++) { fputc(' ', fp); print_kevent(fp, &ke[i], sc->offset == 1); } fputs(" }", fp); } else { fprintf(fp, "0x%lx", args[sc->offset]); } free(ke); break; } case Stat: { struct stat st; if (get_struct(pid, (void *)args[sc->offset], &st, sizeof(st)) != -1) { char mode[12]; strmode(st.st_mode, mode); fprintf(fp, "{ mode=%s,inode=%ju,size=%jd,blksize=%ld }", mode, (uintmax_t)st.st_ino, (intmax_t)st.st_size, (long)st.st_blksize); } else { fprintf(fp, "0x%lx", args[sc->offset]); } break; } case StatFs: { unsigned int i; struct statfs buf; if (get_struct(pid, (void *)args[sc->offset], &buf, sizeof(buf)) != -1) { char fsid[17]; bzero(fsid, sizeof(fsid)); if (buf.f_fsid.val[0] != 0 || buf.f_fsid.val[1] != 0) { for (i = 0; i < sizeof(buf.f_fsid); i++) snprintf(&fsid[i*2], sizeof(fsid) - (i*2), "%02x", ((u_char *)&buf.f_fsid)[i]); } fprintf(fp, "{ fstypename=%s,mntonname=%s,mntfromname=%s," "fsid=%s }", buf.f_fstypename, buf.f_mntonname, buf.f_mntfromname, fsid); } else fprintf(fp, "0x%lx", args[sc->offset]); break; } case Rusage: { struct rusage ru; if (get_struct(pid, (void *)args[sc->offset], &ru, sizeof(ru)) != -1) { fprintf(fp, "{ u=%jd.%06ld,s=%jd.%06ld,in=%ld,out=%ld }", (intmax_t)ru.ru_utime.tv_sec, ru.ru_utime.tv_usec, (intmax_t)ru.ru_stime.tv_sec, ru.ru_stime.tv_usec, ru.ru_inblock, ru.ru_oublock); } else fprintf(fp, "0x%lx", args[sc->offset]); break; } case Rlimit: { struct rlimit rl; if (get_struct(pid, (void *)args[sc->offset], &rl, sizeof(rl)) != -1) { fprintf(fp, "{ cur=%ju,max=%ju }", rl.rlim_cur, rl.rlim_max); } else fprintf(fp, "0x%lx", args[sc->offset]); break; } case ExitStatus: { int status; if (get_struct(pid, (void *)args[sc->offset], &status, sizeof(status)) != -1) { fputs("{ ", fp); if (WIFCONTINUED(status)) fputs("CONTINUED", fp); else if (WIFEXITED(status)) fprintf(fp, "EXITED,val=%d", WEXITSTATUS(status)); else if (WIFSIGNALED(status)) fprintf(fp, "SIGNALED,sig=%s%s", strsig2(WTERMSIG(status)), WCOREDUMP(status) ? ",cored" : ""); else fprintf(fp, "STOPPED,sig=%s", strsig2(WTERMSIG(status))); fputs(" }", fp); } else fprintf(fp, "0x%lx", args[sc->offset]); break; } case Waitoptions: fputs(xlookup_bits(wait_options, args[sc->offset]), fp); break; case Idtype: fputs(xlookup(idtype_arg, args[sc->offset]), fp); break; case Procctl: fputs(xlookup(procctl_arg, args[sc->offset]), fp); break; case Umtxop: fputs(xlookup(umtx_ops, args[sc->offset]), fp); break; case Atfd: if ((int)args[sc->offset] == AT_FDCWD) fputs("AT_FDCWD", fp); else fprintf(fp, "%d", (int)args[sc->offset]); break; case Atflags: fputs(xlookup_bits(at_flags, args[sc->offset]), fp); break; case Accessmode: if (args[sc->offset] == F_OK) fputs("F_OK", fp); else fputs(xlookup_bits(access_modes, args[sc->offset]), fp); break; case Sysarch: fputs(xlookup(sysarch_ops, args[sc->offset]), fp); break; case PipeFds: /* * The pipe() system call in the kernel returns its * two file descriptors via return values. However, * the interface exposed by libc is that pipe() * accepts a pointer to an array of descriptors. * Format the output to match the libc API by printing * the returned file descriptors as a fake argument. * * Overwrite the first retval to signal a successful * return as well. */ fprintf(fp, "{ %ld, %ld }", retval[0], retval[1]); retval[0] = 0; break; case Utrace: { size_t len; void *utrace_addr; len = args[sc->offset + 1]; utrace_addr = calloc(1, len); if (get_struct(pid, (void *)args[sc->offset], (void *)utrace_addr, len) != -1) print_utrace(fp, utrace_addr, len); else fprintf(fp, "0x%lx", args[sc->offset]); free(utrace_addr); break; } case IntArray: { int descriptors[16]; unsigned long i, ndescriptors; bool truncated; ndescriptors = args[sc->offset + 1]; truncated = false; if (ndescriptors > nitems(descriptors)) { ndescriptors = nitems(descriptors); truncated = true; } if (get_struct(pid, (void *)args[sc->offset], descriptors, ndescriptors * sizeof(descriptors[0])) != -1) { fprintf(fp, "{"); for (i = 0; i < ndescriptors; i++) fprintf(fp, i == 0 ? " %d" : ", %d", descriptors[i]); fprintf(fp, truncated ? ", ... }" : " }"); } else fprintf(fp, "0x%lx", args[sc->offset]); break; } case CloudABIAdvice: fputs(xlookup(cloudabi_advice, args[sc->offset]), fp); break; case CloudABIClockID: fputs(xlookup(cloudabi_clockid, args[sc->offset]), fp); break; case ClouduABIFDSFlags: fputs(xlookup_bits(cloudabi_fdsflags, args[sc->offset]), fp); break; case CloudABIFDStat: { cloudabi_fdstat_t fds; if (get_struct(pid, (void *)args[sc->offset], &fds, sizeof(fds)) != -1) { fprintf(fp, "{ %s, ", xlookup(cloudabi_filetype, fds.fs_filetype)); fprintf(fp, "%s, ... }", xlookup_bits(cloudabi_fdflags, fds.fs_flags)); } else fprintf(fp, "0x%lx", args[sc->offset]); break; } case CloudABIFileStat: { cloudabi_filestat_t fsb; if (get_struct(pid, (void *)args[sc->offset], &fsb, sizeof(fsb)) != -1) fprintf(fp, "{ %s, %lu }", xlookup(cloudabi_filetype, fsb.st_filetype), fsb.st_size); else fprintf(fp, "0x%lx", args[sc->offset]); break; } case CloudABIFileType: fputs(xlookup(cloudabi_filetype, args[sc->offset]), fp); break; case CloudABIFSFlags: fputs(xlookup_bits(cloudabi_fsflags, args[sc->offset]), fp); break; case CloudABILookup: if ((args[sc->offset] & CLOUDABI_LOOKUP_SYMLINK_FOLLOW) != 0) fprintf(fp, "%d|LOOKUP_SYMLINK_FOLLOW", (int)args[sc->offset]); else fprintf(fp, "%d", (int)args[sc->offset]); break; case CloudABIMFlags: fputs(xlookup_bits(cloudabi_mflags, args[sc->offset]), fp); break; case CloudABIMProt: fputs(xlookup_bits(cloudabi_mprot, args[sc->offset]), fp); break; case CloudABIMSFlags: fputs(xlookup_bits(cloudabi_msflags, args[sc->offset]), fp); break; case CloudABIOFlags: fputs(xlookup_bits(cloudabi_oflags, args[sc->offset]), fp); break; case CloudABISDFlags: fputs(xlookup_bits(cloudabi_sdflags, args[sc->offset]), fp); break; case CloudABISignal: fputs(xlookup(cloudabi_signal, args[sc->offset]), fp); break; case CloudABISockStat: { cloudabi_sockstat_t ss; if (get_struct(pid, (void *)args[sc->offset], &ss, sizeof(ss)) != -1) { fprintf(fp, "{ %s, ", xlookup( cloudabi_sa_family, ss.ss_sockname.sa_family)); fprintf(fp, "%s, ", xlookup( cloudabi_sa_family, ss.ss_peername.sa_family)); fprintf(fp, "%s, ", xlookup( cloudabi_errno, ss.ss_error)); fprintf(fp, "%s }", xlookup_bits( cloudabi_ssstate, ss.ss_state)); } else fprintf(fp, "0x%lx", args[sc->offset]); break; } case CloudABISSFlags: fputs(xlookup_bits(cloudabi_ssflags, args[sc->offset]), fp); break; case CloudABITimestamp: fprintf(fp, "%lu.%09lus", args[sc->offset] / 1000000000, args[sc->offset] % 1000000000); break; case CloudABIULFlags: fputs(xlookup_bits(cloudabi_ulflags, args[sc->offset]), fp); break; case CloudABIWhence: fputs(xlookup(cloudabi_whence, args[sc->offset]), fp); break; default: errx(1, "Invalid argument type %d\n", sc->type & ARG_MASK); } fclose(fp); return (tmp); } /* * Print (to outfile) the system call and its arguments. */ void print_syscall(struct trussinfo *trussinfo) { struct threadinfo *t; const char *name; char **s_args; int i, len, nargs; t = trussinfo->curthread; name = t->cs.name; nargs = t->cs.nargs; s_args = t->cs.s_args; len = print_line_prefix(trussinfo); len += fprintf(trussinfo->outfile, "%s(", name); for (i = 0; i < nargs; i++) { if (s_args[i] != NULL) len += fprintf(trussinfo->outfile, "%s", s_args[i]); else len += fprintf(trussinfo->outfile, ""); len += fprintf(trussinfo->outfile, "%s", i < (nargs - 1) ? "," : ""); } len += fprintf(trussinfo->outfile, ")"); for (i = 0; i < 6 - (len / 8); i++) fprintf(trussinfo->outfile, "\t"); } void print_syscall_ret(struct trussinfo *trussinfo, int errorp, long *retval) { struct timespec timediff; struct threadinfo *t; struct syscall *sc; int error; t = trussinfo->curthread; sc = t->cs.sc; if (trussinfo->flags & COUNTONLY) { timespecsubt(&t->after, &t->before, &timediff); timespecadd(&sc->time, &timediff, &sc->time); sc->ncalls++; if (errorp) sc->nerror++; return; } print_syscall(trussinfo); fflush(trussinfo->outfile); if (retval == NULL) { /* * This system call resulted in the current thread's exit, * so there is no return value or error to display. */ fprintf(trussinfo->outfile, "\n"); return; } if (errorp) { error = sysdecode_abi_to_freebsd_errno(t->proc->abi->abi, retval[0]); fprintf(trussinfo->outfile, " ERR#%ld '%s'\n", retval[0], error == INT_MAX ? "Unknown error" : strerror(error)); } #ifndef __LP64__ else if (sc->ret_type == 2) { off_t off; #if _BYTE_ORDER == _LITTLE_ENDIAN off = (off_t)retval[1] << 32 | retval[0]; #else off = (off_t)retval[0] << 32 | retval[1]; #endif fprintf(trussinfo->outfile, " = %jd (0x%jx)\n", (intmax_t)off, (intmax_t)off); } #endif else fprintf(trussinfo->outfile, " = %ld (0x%lx)\n", retval[0], retval[0]); } void print_summary(struct trussinfo *trussinfo) { struct timespec total = {0, 0}; struct syscall *sc; int ncall, nerror; fprintf(trussinfo->outfile, "%-20s%15s%8s%8s\n", "syscall", "seconds", "calls", "errors"); ncall = nerror = 0; STAILQ_FOREACH(sc, &syscalls, entries) if (sc->ncalls) { fprintf(trussinfo->outfile, "%-20s%5jd.%09ld%8d%8d\n", sc->name, (intmax_t)sc->time.tv_sec, sc->time.tv_nsec, sc->ncalls, sc->nerror); timespecadd(&total, &sc->time, &total); ncall += sc->ncalls; nerror += sc->nerror; } fprintf(trussinfo->outfile, "%20s%15s%8s%8s\n", "", "-------------", "-------", "-------"); fprintf(trussinfo->outfile, "%-20s%5jd.%09ld%8d%8d\n", "", (intmax_t)total.tv_sec, total.tv_nsec, ncall, nerror); }