Skip to content

Commit

Permalink
remove signal related APIs
Browse files Browse the repository at this point in the history
snapshot_preview2 dropped the signal related APIs. This means
removing __wasi_proc_raise() and __wasi_signal_t, which is
what this commit does.

Refs: #59
  • Loading branch information
cjihrig committed Feb 21, 2020
1 parent 1873de4 commit 6939709
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 351 deletions.
177 changes: 0 additions & 177 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,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)
Expand Down Expand Up @@ -1073,18 +1072,6 @@ Inputs:

Does not return.

### <a href="#proc_raise" name="proc_raise"></a>`uvwasi_proc_raise()`

Send a signal to the process of the calling thread.

Note: This is similar to `raise` in POSIX.

Inputs:

- <a href="#proc_raise.sig" name="proc_raise.sig"></a><code>[\_\_wasi\_signal\_t](#signal) <strong>sig</strong></code>

The signal condition to trigger.

### <a href="#random_get" name="random_get"></a>`uvwasi_random_get()`

Write high-quality random data into a buffer.
Expand Down Expand Up @@ -2179,170 +2166,6 @@ defined, it must be set to zero.

Used by [`uvwasi_sock_send()`](#sock_send).

### <a href="#signal" name="signal"></a>`uvwasi_signal_t` (`uint8_t`)

Signal condition.

Used by [`uvwasi_proc_raise()`](#proc_raise).

Possible values:

- <a href="#signal.abrt" name="signal.abrt"></a>**`UVWASI_SIGABRT`**

Process abort signal.

Action: Terminates the process.

- <a href="#signal.alrm" name="signal.alrm"></a>**`UVWASI_SIGALRM`**

Alarm clock.

Action: Terminates the process.

- <a href="#signal.bus" name="signal.bus"></a>**`UVWASI_SIGBUS`**

Access to an undefined portion of a memory object.

Action: Terminates the process.

- <a href="#signal.chld" name="signal.chld"></a>**`UVWASI_SIGCHLD`**

Child process terminated, stopped, or continued.

Action: Ignored.

- <a href="#signal.cont" name="signal.cont"></a>**`UVWASI_SIGCONT`**

Continue executing, if stopped.

Action: Continues executing, if stopped.

- <a href="#signal.fpe" name="signal.fpe"></a>**`UVWASI_SIGFPE`**

Erroneous arithmetic operation.

Action: Terminates the process.

- <a href="#signal.hup" name="signal.hup"></a>**`UVWASI_SIGHUP`**

Hangup.

Action: Terminates the process.

- <a href="#signal.ill" name="signal.ill"></a>**`UVWASI_SIGILL`**

Illegal instruction.

Action: Terminates the process.

- <a href="#signal.int" name="signal.int"></a>**`UVWASI_SIGINT`**

Terminate interrupt signal.

Action: Terminates the process.

- <a href="#signal.kill" name="signal.kill"></a>**`UVWASI_SIGKILL`**

Kill.

Action: Terminates the process.

- <a href="#signal.pipe" name="signal.pipe"></a>**`UVWASI_SIGPIPE`**

Write on a pipe with no one to read it.

Action: Ignored.

- <a href="#signal.quit" name="signal.quit"></a>**`UVWASI_SIGQUIT`**

Terminal quit signal.

Action: Terminates the process.

- <a href="#signal.segv" name="signal.segv"></a>**`UVWASI_SIGSEGV`**

Invalid memory reference.

Action: Terminates the process.

- <a href="#signal.stop" name="signal.stop"></a>**`UVWASI_SIGSTOP`**

Stop executing.

Action: Stops executing.

- <a href="#signal.sys" name="signal.sys"></a>**`UVWASI_SIGSYS`**

Bad system call.

Action: Terminates the process.

- <a href="#signal.term" name="signal.term"></a>**`UVWASI_SIGTERM`**

Termination signal.

Action: Terminates the process.

- <a href="#signal.trap" name="signal.trap"></a>**`UVWASI_SIGTRAP`**

Trace/breakpoint trap.

Action: Terminates the process.

- <a href="#signal.tstp" name="signal.tstp"></a>**`UVWASI_SIGTSTP`**

Terminal stop signal.

Action: Stops executing.

- <a href="#signal.ttin" name="signal.ttin"></a>**`UVWASI_SIGTTIN`**

Background process attempting read.

Action: Stops executing.

- <a href="#signal.ttou" name="signal.ttou"></a>**`UVWASI_SIGTTOU`**

Background process attempting write.

Action: Stops executing.

- <a href="#signal.urg" name="signal.urg"></a>**`UVWASI_SIGURG`**

High bandwidth data is available at a socket.

Action: Ignored.

- <a href="#signal.usr1" name="signal.usr1"></a>**`UVWASI_SIGUSR1`**

User-defined signal 1.

Action: Terminates the process.

- <a href="#signal.usr2" name="signal.usr2"></a>**`UVWASI_SIGUSR2`**

User-defined signal 2.

Action: Terminates the process.

- <a href="#signal.vtalrm" name="signal.vtalrm"></a>**`UVWASI_SIGVTALRM`**

Virtual timer expired.

Action: Terminates the process.

- <a href="#signal.xcpu" name="signal.xcpu"></a>**`UVWASI_SIGXCPU`**

CPU time limit exceeded.

Action: Terminates the process.

- <a href="#signal.xfsz" name="signal.xfsz"></a>**`UVWASI_SIGXFSZ`**

File size limit exceeded.

Action: Terminates the process.

### <a href="#subclockflags" name="subclockflags"></a>`uvwasi_subclockflags_t` (`uint16_t` bitfield)

Flags determining how to interpret the timestamp provided in
Expand Down
1 change: 0 additions & 1 deletion include/uvwasi.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,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,
Expand Down
32 changes: 0 additions & 32 deletions include/wasi_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
85 changes: 0 additions & 85 deletions src/uv_mapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/uv_mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
18 changes: 0 additions & 18 deletions src/uvwasi.c
Original file line number Diff line number Diff line change
Expand Up @@ -2267,24 +2267,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;

Expand Down
2 changes: 0 additions & 2 deletions test/test-einval-input-validation.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
Loading

0 comments on commit 6939709

Please sign in to comment.