diff --git a/README.md b/README.md index 11ec5db..923894e 100644 --- a/README.md +++ b/README.md @@ -244,7 +244,6 @@ This section has been adapted from the official WASI API documentation. - [`uvwasi_path_unlink_file()`](#path_unlink_file) - [`uvwasi_poll_oneoff()`](#poll_oneoff) - [`uvwasi_proc_exit()`](#proc_exit) -- [`uvwasi_proc_raise()`](#proc_raise) - [`uvwasi_random_get()`](#random_get) - [`uvwasi_sched_yield()`](#sched_yield) - [`uvwasi_sock_recv()`](#sock_recv) @@ -1081,18 +1080,6 @@ Inputs: Does not return. -### `uvwasi_proc_raise()` - -Send a signal to the process of the calling thread. - -Note: This is similar to `raise` in POSIX. - -Inputs: - -- [\_\_wasi\_signal\_t](#signal) sig - - The signal condition to trigger. - ### `uvwasi_random_get()` Write high-quality random data into a buffer. @@ -2187,170 +2174,6 @@ defined, it must be set to zero. Used by [`uvwasi_sock_send()`](#sock_send). -### `uvwasi_signal_t` (`uint8_t`) - -Signal condition. - -Used by [`uvwasi_proc_raise()`](#proc_raise). - -Possible values: - -- **`UVWASI_SIGABRT`** - - Process abort signal. - - Action: Terminates the process. - -- **`UVWASI_SIGALRM`** - - Alarm clock. - - Action: Terminates the process. - -- **`UVWASI_SIGBUS`** - - Access to an undefined portion of a memory object. - - Action: Terminates the process. - -- **`UVWASI_SIGCHLD`** - - Child process terminated, stopped, or continued. - - Action: Ignored. - -- **`UVWASI_SIGCONT`** - - Continue executing, if stopped. - - Action: Continues executing, if stopped. - -- **`UVWASI_SIGFPE`** - - Erroneous arithmetic operation. - - Action: Terminates the process. - -- **`UVWASI_SIGHUP`** - - Hangup. - - Action: Terminates the process. - -- **`UVWASI_SIGILL`** - - Illegal instruction. - - Action: Terminates the process. - -- **`UVWASI_SIGINT`** - - Terminate interrupt signal. - - Action: Terminates the process. - -- **`UVWASI_SIGKILL`** - - Kill. - - Action: Terminates the process. - -- **`UVWASI_SIGPIPE`** - - Write on a pipe with no one to read it. - - Action: Ignored. - -- **`UVWASI_SIGQUIT`** - - Terminal quit signal. - - Action: Terminates the process. - -- **`UVWASI_SIGSEGV`** - - Invalid memory reference. - - Action: Terminates the process. - -- **`UVWASI_SIGSTOP`** - - Stop executing. - - Action: Stops executing. - -- **`UVWASI_SIGSYS`** - - Bad system call. - - Action: Terminates the process. - -- **`UVWASI_SIGTERM`** - - Termination signal. - - Action: Terminates the process. - -- **`UVWASI_SIGTRAP`** - - Trace/breakpoint trap. - - Action: Terminates the process. - -- **`UVWASI_SIGTSTP`** - - Terminal stop signal. - - Action: Stops executing. - -- **`UVWASI_SIGTTIN`** - - Background process attempting read. - - Action: Stops executing. - -- **`UVWASI_SIGTTOU`** - - Background process attempting write. - - Action: Stops executing. - -- **`UVWASI_SIGURG`** - - High bandwidth data is available at a socket. - - Action: Ignored. - -- **`UVWASI_SIGUSR1`** - - User-defined signal 1. - - Action: Terminates the process. - -- **`UVWASI_SIGUSR2`** - - User-defined signal 2. - - Action: Terminates the process. - -- **`UVWASI_SIGVTALRM`** - - Virtual timer expired. - - Action: Terminates the process. - -- **`UVWASI_SIGXCPU`** - - CPU time limit exceeded. - - Action: Terminates the process. - -- **`UVWASI_SIGXFSZ`** - - File size limit exceeded. - - Action: Terminates the process. - ### `uvwasi_subclockflags_t` (`uint16_t` bitfield) Flags determining how to interpret the timestamp provided in diff --git a/include/uvwasi.h b/include/uvwasi.h index 39ee2f0..9b4398d 100644 --- a/include/uvwasi.h +++ b/include/uvwasi.h @@ -243,7 +243,6 @@ uvwasi_errno_t uvwasi_poll_oneoff(uvwasi_t* uvwasi, size_t nsubscriptions, size_t* nevents); uvwasi_errno_t uvwasi_proc_exit(uvwasi_t* uvwasi, uvwasi_exitcode_t rval); -uvwasi_errno_t uvwasi_proc_raise(uvwasi_t* uvwasi, uvwasi_signal_t sig); uvwasi_errno_t uvwasi_random_get(uvwasi_t* uvwasi, void* buf, size_t buf_len); uvwasi_errno_t uvwasi_sched_yield(uvwasi_t* uvwasi); uvwasi_errno_t uvwasi_sock_recv(uvwasi_t* uvwasi, diff --git a/include/wasi_types.h b/include/wasi_types.h index 8f5748f..ffa3614 100644 --- a/include/wasi_types.h +++ b/include/wasi_types.h @@ -222,38 +222,6 @@ typedef uint8_t uvwasi_sdflags_t; /* Bitfield */ typedef uint16_t uvwasi_siflags_t; /* Bitfield */ -typedef uint8_t uvwasi_signal_t; -#define UVWASI_SIGHUP 1 -#define UVWASI_SIGINT 2 -#define UVWASI_SIGQUIT 3 -#define UVWASI_SIGILL 4 -#define UVWASI_SIGTRAP 5 -#define UVWASI_SIGABRT 6 -#define UVWASI_SIGBUS 7 -#define UVWASI_SIGFPE 8 -#define UVWASI_SIGKILL 9 -#define UVWASI_SIGUSR1 10 -#define UVWASI_SIGSEGV 11 -#define UVWASI_SIGUSR2 12 -#define UVWASI_SIGPIPE 13 -#define UVWASI_SIGALRM 14 -#define UVWASI_SIGTERM 15 -#define UVWASI_SIGCHLD 16 -#define UVWASI_SIGCONT 17 -#define UVWASI_SIGSTOP 18 -#define UVWASI_SIGTSTP 19 -#define UVWASI_SIGTTIN 20 -#define UVWASI_SIGTTOU 21 -#define UVWASI_SIGURG 22 -#define UVWASI_SIGXCPU 23 -#define UVWASI_SIGXFSZ 24 -#define UVWASI_SIGVTALRM 25 -#define UVWASI_SIGPROF 26 -#define UVWASI_SIGWINCH 27 -#define UVWASI_SIGPOLL 28 -#define UVWASI_SIGPWR 29 -#define UVWASI_SIGSYS 30 - typedef uint16_t uvwasi_subclockflags_t; /* Bitfield */ #define UVWASI_SUBSCRIPTION_CLOCK_ABSTIME (1 << 0) diff --git a/src/uv_mapping.c b/src/uv_mapping.c index da922de..a0963b2 100644 --- a/src/uv_mapping.c +++ b/src/uv_mapping.c @@ -104,91 +104,6 @@ uvwasi_errno_t uvwasi__translate_uv_error(int err) { } -int uvwasi__translate_to_uv_signal(uvwasi_signal_t sig) { - switch (sig) { -#ifdef SIGABRT - case UVWASI_SIGABRT: return SIGABRT; -#endif -#ifdef SIGALRM - case UVWASI_SIGALRM: return SIGALRM; -#endif -#ifdef SIGBUS - case UVWASI_SIGBUS: return SIGBUS; -#endif -#ifdef SIGCHLD - case UVWASI_SIGCHLD: return SIGCHLD; -#endif -#ifdef SIGCONT - case UVWASI_SIGCONT: return SIGCONT; -#endif -#ifdef SIGFPE - case UVWASI_SIGFPE: return SIGFPE; -#endif -#ifdef SIGHUP - case UVWASI_SIGHUP: return SIGHUP; -#endif -#ifdef SIGILL - case UVWASI_SIGILL: return SIGILL; -#endif -#ifdef SIGINT - case UVWASI_SIGINT: return SIGINT; -#endif -#ifdef SIGKILL - case UVWASI_SIGKILL: return SIGKILL; -#endif -#ifdef SIGPIPE - case UVWASI_SIGPIPE: return SIGPIPE; -#endif -#ifdef SIGQUIT - case UVWASI_SIGQUIT: return SIGQUIT; -#endif -#ifdef SIGSEGV - case UVWASI_SIGSEGV: return SIGSEGV; -#endif -#ifdef SIGSTOP - case UVWASI_SIGSTOP: return SIGSTOP; -#endif -#ifdef SIGSYS - case UVWASI_SIGSYS: return SIGSYS; -#endif -#ifdef SIGTERM - case UVWASI_SIGTERM: return SIGTERM; -#endif -#ifdef SIGTRAP - case UVWASI_SIGTRAP: return SIGTRAP; -#endif -#ifdef SIGTSTP - case UVWASI_SIGTSTP: return SIGTSTP; -#endif -#ifdef SIGTTIN - case UVWASI_SIGTTIN: return SIGTTIN; -#endif -#ifdef SIGTTOU - case UVWASI_SIGTTOU: return SIGTTOU; -#endif -#ifdef SIGURG - case UVWASI_SIGURG: return SIGURG; -#endif -#ifdef SIGUSR1 - case UVWASI_SIGUSR1: return SIGUSR1; -#endif -#ifdef SIGUSR2 - case UVWASI_SIGUSR2: return SIGUSR2; -#endif -#ifdef SIGVTALRM - case UVWASI_SIGVTALRM: return SIGVTALRM; -#endif -#ifdef SIGXCPU - case UVWASI_SIGXCPU: return SIGXCPU; -#endif -#ifdef SIGXFSZ - case UVWASI_SIGXFSZ: return SIGXFSZ; -#endif - default: return -1; - } -} - - uvwasi_timestamp_t uvwasi__timespec_to_timestamp(const uv_timespec_t* ts) { /* TODO(cjihrig): Handle overflow. */ return (uvwasi_timestamp_t) ts->tv_sec * NANOS_PER_SEC + ts->tv_nsec; diff --git a/src/uv_mapping.h b/src/uv_mapping.h index 5a0542a..9d9bbd1 100644 --- a/src/uv_mapping.h +++ b/src/uv_mapping.h @@ -7,7 +7,6 @@ #define NANOS_PER_SEC 1000000000 uvwasi_errno_t uvwasi__translate_uv_error(int err); -int uvwasi__translate_to_uv_signal(uvwasi_signal_t sig); uvwasi_timestamp_t uvwasi__timespec_to_timestamp(const uv_timespec_t* ts); uvwasi_filetype_t uvwasi__stat_to_filetype(const uv_stat_t* stat); void uvwasi__stat_to_filestat(const uv_stat_t* stat, uvwasi_filestat_t* fs); diff --git a/src/uvwasi.c b/src/uvwasi.c index 46e50c6..f694957 100644 --- a/src/uvwasi.c +++ b/src/uvwasi.c @@ -2275,24 +2275,6 @@ uvwasi_errno_t uvwasi_proc_exit(uvwasi_t* uvwasi, uvwasi_exitcode_t rval) { } -uvwasi_errno_t uvwasi_proc_raise(uvwasi_t* uvwasi, uvwasi_signal_t sig) { - int r; - - if (uvwasi == NULL) - return UVWASI_EINVAL; - - r = uvwasi__translate_to_uv_signal(sig); - if (r == -1) - return UVWASI_ENOSYS; - - r = uv_kill(uv_os_getpid(), r); - if (r != 0) - return uvwasi__translate_uv_error(r); - - return UVWASI_ESUCCESS; -} - - uvwasi_errno_t uvwasi_random_get(uvwasi_t* uvwasi, void* buf, size_t buf_len) { int r; diff --git a/test/test-einval-input-validation.c b/test/test-einval-input-validation.c index 3bb0b75..f4eab44 100644 --- a/test/test-einval-input-validation.c +++ b/test/test-einval-input-validation.c @@ -153,8 +153,6 @@ int main(void) { CHECK(uvwasi_poll_oneoff(&uvw, &test_sub, &test_event, 0, &test_size)); CHECK(uvwasi_poll_oneoff(&uvw, &test_sub, &test_event, 5, NULL)); - CHECK(uvwasi_proc_raise(NULL, UVWASI_SIGUSR2)); - CHECK(uvwasi_random_get(NULL, test_void, 10)); CHECK(uvwasi_random_get(&uvw, NULL, 10)); diff --git a/test/test-uv-mapping.c b/test/test-uv-mapping.c index efedbeb..378d453 100644 --- a/test/test-uv-mapping.c +++ b/test/test-uv-mapping.c @@ -4,10 +4,6 @@ #define CHECK_ERR(err) assert(uvwasi__translate_uv_error(UV_ ## err ) == \ UVWASI_ ## err) -#ifndef _WIN32 -# define CHECK_SIG(sig) assert(uvwasi__translate_to_uv_signal(UVWASI_ ## sig) \ - == (sig)) -#endif /* _WIN32 */ int main(void) { /* Verify error code translation. */ @@ -71,36 +67,5 @@ int main(void) { assert(uvwasi__translate_uv_error(1) == 1); assert(uvwasi__translate_uv_error(-99999) == UVWASI_ENOSYS); - /* Verify signal translation. */ -#ifndef _WIN32 - CHECK_SIG(SIGABRT); - CHECK_SIG(SIGALRM); - CHECK_SIG(SIGBUS); - CHECK_SIG(SIGCHLD); - CHECK_SIG(SIGCONT); - CHECK_SIG(SIGFPE); - CHECK_SIG(SIGHUP); - CHECK_SIG(SIGILL); - CHECK_SIG(SIGINT); - CHECK_SIG(SIGKILL); - CHECK_SIG(SIGPIPE); - CHECK_SIG(SIGQUIT); - CHECK_SIG(SIGSEGV); - CHECK_SIG(SIGSTOP); - CHECK_SIG(SIGSYS); - CHECK_SIG(SIGTERM); - CHECK_SIG(SIGTRAP); - CHECK_SIG(SIGTSTP); - CHECK_SIG(SIGTTIN); - CHECK_SIG(SIGTTOU); - CHECK_SIG(SIGURG); - CHECK_SIG(SIGUSR1); - CHECK_SIG(SIGUSR2); - CHECK_SIG(SIGVTALRM); - CHECK_SIG(SIGXCPU); - CHECK_SIG(SIGXFSZ); -#endif /* _WIN32 */ - assert(uvwasi__translate_to_uv_signal(255) == -1); - return 0; }