Skip to content

Commit 6939709

Browse files
committed
remove signal related APIs
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
1 parent 1873de4 commit 6939709

8 files changed

+0
-351
lines changed

README.md

Lines changed: 0 additions & 177 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@ This section has been adapted from the official WASI API documentation.
236236
- [`uvwasi_path_unlink_file()`](#path_unlink_file)
237237
- [`uvwasi_poll_oneoff()`](#poll_oneoff)
238238
- [`uvwasi_proc_exit()`](#proc_exit)
239-
- [`uvwasi_proc_raise()`](#proc_raise)
240239
- [`uvwasi_random_get()`](#random_get)
241240
- [`uvwasi_sched_yield()`](#sched_yield)
242241
- [`uvwasi_sock_recv()`](#sock_recv)
@@ -1073,18 +1072,6 @@ Inputs:
10731072

10741073
Does not return.
10751074

1076-
### <a href="#proc_raise" name="proc_raise"></a>`uvwasi_proc_raise()`
1077-
1078-
Send a signal to the process of the calling thread.
1079-
1080-
Note: This is similar to `raise` in POSIX.
1081-
1082-
Inputs:
1083-
1084-
- <a href="#proc_raise.sig" name="proc_raise.sig"></a><code>[\_\_wasi\_signal\_t](#signal) <strong>sig</strong></code>
1085-
1086-
The signal condition to trigger.
1087-
10881075
### <a href="#random_get" name="random_get"></a>`uvwasi_random_get()`
10891076

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

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

2182-
### <a href="#signal" name="signal"></a>`uvwasi_signal_t` (`uint8_t`)
2183-
2184-
Signal condition.
2185-
2186-
Used by [`uvwasi_proc_raise()`](#proc_raise).
2187-
2188-
Possible values:
2189-
2190-
- <a href="#signal.abrt" name="signal.abrt"></a>**`UVWASI_SIGABRT`**
2191-
2192-
Process abort signal.
2193-
2194-
Action: Terminates the process.
2195-
2196-
- <a href="#signal.alrm" name="signal.alrm"></a>**`UVWASI_SIGALRM`**
2197-
2198-
Alarm clock.
2199-
2200-
Action: Terminates the process.
2201-
2202-
- <a href="#signal.bus" name="signal.bus"></a>**`UVWASI_SIGBUS`**
2203-
2204-
Access to an undefined portion of a memory object.
2205-
2206-
Action: Terminates the process.
2207-
2208-
- <a href="#signal.chld" name="signal.chld"></a>**`UVWASI_SIGCHLD`**
2209-
2210-
Child process terminated, stopped, or continued.
2211-
2212-
Action: Ignored.
2213-
2214-
- <a href="#signal.cont" name="signal.cont"></a>**`UVWASI_SIGCONT`**
2215-
2216-
Continue executing, if stopped.
2217-
2218-
Action: Continues executing, if stopped.
2219-
2220-
- <a href="#signal.fpe" name="signal.fpe"></a>**`UVWASI_SIGFPE`**
2221-
2222-
Erroneous arithmetic operation.
2223-
2224-
Action: Terminates the process.
2225-
2226-
- <a href="#signal.hup" name="signal.hup"></a>**`UVWASI_SIGHUP`**
2227-
2228-
Hangup.
2229-
2230-
Action: Terminates the process.
2231-
2232-
- <a href="#signal.ill" name="signal.ill"></a>**`UVWASI_SIGILL`**
2233-
2234-
Illegal instruction.
2235-
2236-
Action: Terminates the process.
2237-
2238-
- <a href="#signal.int" name="signal.int"></a>**`UVWASI_SIGINT`**
2239-
2240-
Terminate interrupt signal.
2241-
2242-
Action: Terminates the process.
2243-
2244-
- <a href="#signal.kill" name="signal.kill"></a>**`UVWASI_SIGKILL`**
2245-
2246-
Kill.
2247-
2248-
Action: Terminates the process.
2249-
2250-
- <a href="#signal.pipe" name="signal.pipe"></a>**`UVWASI_SIGPIPE`**
2251-
2252-
Write on a pipe with no one to read it.
2253-
2254-
Action: Ignored.
2255-
2256-
- <a href="#signal.quit" name="signal.quit"></a>**`UVWASI_SIGQUIT`**
2257-
2258-
Terminal quit signal.
2259-
2260-
Action: Terminates the process.
2261-
2262-
- <a href="#signal.segv" name="signal.segv"></a>**`UVWASI_SIGSEGV`**
2263-
2264-
Invalid memory reference.
2265-
2266-
Action: Terminates the process.
2267-
2268-
- <a href="#signal.stop" name="signal.stop"></a>**`UVWASI_SIGSTOP`**
2269-
2270-
Stop executing.
2271-
2272-
Action: Stops executing.
2273-
2274-
- <a href="#signal.sys" name="signal.sys"></a>**`UVWASI_SIGSYS`**
2275-
2276-
Bad system call.
2277-
2278-
Action: Terminates the process.
2279-
2280-
- <a href="#signal.term" name="signal.term"></a>**`UVWASI_SIGTERM`**
2281-
2282-
Termination signal.
2283-
2284-
Action: Terminates the process.
2285-
2286-
- <a href="#signal.trap" name="signal.trap"></a>**`UVWASI_SIGTRAP`**
2287-
2288-
Trace/breakpoint trap.
2289-
2290-
Action: Terminates the process.
2291-
2292-
- <a href="#signal.tstp" name="signal.tstp"></a>**`UVWASI_SIGTSTP`**
2293-
2294-
Terminal stop signal.
2295-
2296-
Action: Stops executing.
2297-
2298-
- <a href="#signal.ttin" name="signal.ttin"></a>**`UVWASI_SIGTTIN`**
2299-
2300-
Background process attempting read.
2301-
2302-
Action: Stops executing.
2303-
2304-
- <a href="#signal.ttou" name="signal.ttou"></a>**`UVWASI_SIGTTOU`**
2305-
2306-
Background process attempting write.
2307-
2308-
Action: Stops executing.
2309-
2310-
- <a href="#signal.urg" name="signal.urg"></a>**`UVWASI_SIGURG`**
2311-
2312-
High bandwidth data is available at a socket.
2313-
2314-
Action: Ignored.
2315-
2316-
- <a href="#signal.usr1" name="signal.usr1"></a>**`UVWASI_SIGUSR1`**
2317-
2318-
User-defined signal 1.
2319-
2320-
Action: Terminates the process.
2321-
2322-
- <a href="#signal.usr2" name="signal.usr2"></a>**`UVWASI_SIGUSR2`**
2323-
2324-
User-defined signal 2.
2325-
2326-
Action: Terminates the process.
2327-
2328-
- <a href="#signal.vtalrm" name="signal.vtalrm"></a>**`UVWASI_SIGVTALRM`**
2329-
2330-
Virtual timer expired.
2331-
2332-
Action: Terminates the process.
2333-
2334-
- <a href="#signal.xcpu" name="signal.xcpu"></a>**`UVWASI_SIGXCPU`**
2335-
2336-
CPU time limit exceeded.
2337-
2338-
Action: Terminates the process.
2339-
2340-
- <a href="#signal.xfsz" name="signal.xfsz"></a>**`UVWASI_SIGXFSZ`**
2341-
2342-
File size limit exceeded.
2343-
2344-
Action: Terminates the process.
2345-
23462169
### <a href="#subclockflags" name="subclockflags"></a>`uvwasi_subclockflags_t` (`uint16_t` bitfield)
23472170

23482171
Flags determining how to interpret the timestamp provided in

include/uvwasi.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,6 @@ uvwasi_errno_t uvwasi_poll_oneoff(uvwasi_t* uvwasi,
240240
size_t nsubscriptions,
241241
size_t* nevents);
242242
uvwasi_errno_t uvwasi_proc_exit(uvwasi_t* uvwasi, uvwasi_exitcode_t rval);
243-
uvwasi_errno_t uvwasi_proc_raise(uvwasi_t* uvwasi, uvwasi_signal_t sig);
244243
uvwasi_errno_t uvwasi_random_get(uvwasi_t* uvwasi, void* buf, size_t buf_len);
245244
uvwasi_errno_t uvwasi_sched_yield(uvwasi_t* uvwasi);
246245
uvwasi_errno_t uvwasi_sock_recv(uvwasi_t* uvwasi,

include/wasi_types.h

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -222,38 +222,6 @@ typedef uint8_t uvwasi_sdflags_t; /* Bitfield */
222222

223223
typedef uint16_t uvwasi_siflags_t; /* Bitfield */
224224

225-
typedef uint8_t uvwasi_signal_t;
226-
#define UVWASI_SIGHUP 1
227-
#define UVWASI_SIGINT 2
228-
#define UVWASI_SIGQUIT 3
229-
#define UVWASI_SIGILL 4
230-
#define UVWASI_SIGTRAP 5
231-
#define UVWASI_SIGABRT 6
232-
#define UVWASI_SIGBUS 7
233-
#define UVWASI_SIGFPE 8
234-
#define UVWASI_SIGKILL 9
235-
#define UVWASI_SIGUSR1 10
236-
#define UVWASI_SIGSEGV 11
237-
#define UVWASI_SIGUSR2 12
238-
#define UVWASI_SIGPIPE 13
239-
#define UVWASI_SIGALRM 14
240-
#define UVWASI_SIGTERM 15
241-
#define UVWASI_SIGCHLD 16
242-
#define UVWASI_SIGCONT 17
243-
#define UVWASI_SIGSTOP 18
244-
#define UVWASI_SIGTSTP 19
245-
#define UVWASI_SIGTTIN 20
246-
#define UVWASI_SIGTTOU 21
247-
#define UVWASI_SIGURG 22
248-
#define UVWASI_SIGXCPU 23
249-
#define UVWASI_SIGXFSZ 24
250-
#define UVWASI_SIGVTALRM 25
251-
#define UVWASI_SIGPROF 26
252-
#define UVWASI_SIGWINCH 27
253-
#define UVWASI_SIGPOLL 28
254-
#define UVWASI_SIGPWR 29
255-
#define UVWASI_SIGSYS 30
256-
257225
typedef uint16_t uvwasi_subclockflags_t; /* Bitfield */
258226
#define UVWASI_SUBSCRIPTION_CLOCK_ABSTIME (1 << 0)
259227

src/uv_mapping.c

Lines changed: 0 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -104,91 +104,6 @@ uvwasi_errno_t uvwasi__translate_uv_error(int err) {
104104
}
105105

106106

107-
int uvwasi__translate_to_uv_signal(uvwasi_signal_t sig) {
108-
switch (sig) {
109-
#ifdef SIGABRT
110-
case UVWASI_SIGABRT: return SIGABRT;
111-
#endif
112-
#ifdef SIGALRM
113-
case UVWASI_SIGALRM: return SIGALRM;
114-
#endif
115-
#ifdef SIGBUS
116-
case UVWASI_SIGBUS: return SIGBUS;
117-
#endif
118-
#ifdef SIGCHLD
119-
case UVWASI_SIGCHLD: return SIGCHLD;
120-
#endif
121-
#ifdef SIGCONT
122-
case UVWASI_SIGCONT: return SIGCONT;
123-
#endif
124-
#ifdef SIGFPE
125-
case UVWASI_SIGFPE: return SIGFPE;
126-
#endif
127-
#ifdef SIGHUP
128-
case UVWASI_SIGHUP: return SIGHUP;
129-
#endif
130-
#ifdef SIGILL
131-
case UVWASI_SIGILL: return SIGILL;
132-
#endif
133-
#ifdef SIGINT
134-
case UVWASI_SIGINT: return SIGINT;
135-
#endif
136-
#ifdef SIGKILL
137-
case UVWASI_SIGKILL: return SIGKILL;
138-
#endif
139-
#ifdef SIGPIPE
140-
case UVWASI_SIGPIPE: return SIGPIPE;
141-
#endif
142-
#ifdef SIGQUIT
143-
case UVWASI_SIGQUIT: return SIGQUIT;
144-
#endif
145-
#ifdef SIGSEGV
146-
case UVWASI_SIGSEGV: return SIGSEGV;
147-
#endif
148-
#ifdef SIGSTOP
149-
case UVWASI_SIGSTOP: return SIGSTOP;
150-
#endif
151-
#ifdef SIGSYS
152-
case UVWASI_SIGSYS: return SIGSYS;
153-
#endif
154-
#ifdef SIGTERM
155-
case UVWASI_SIGTERM: return SIGTERM;
156-
#endif
157-
#ifdef SIGTRAP
158-
case UVWASI_SIGTRAP: return SIGTRAP;
159-
#endif
160-
#ifdef SIGTSTP
161-
case UVWASI_SIGTSTP: return SIGTSTP;
162-
#endif
163-
#ifdef SIGTTIN
164-
case UVWASI_SIGTTIN: return SIGTTIN;
165-
#endif
166-
#ifdef SIGTTOU
167-
case UVWASI_SIGTTOU: return SIGTTOU;
168-
#endif
169-
#ifdef SIGURG
170-
case UVWASI_SIGURG: return SIGURG;
171-
#endif
172-
#ifdef SIGUSR1
173-
case UVWASI_SIGUSR1: return SIGUSR1;
174-
#endif
175-
#ifdef SIGUSR2
176-
case UVWASI_SIGUSR2: return SIGUSR2;
177-
#endif
178-
#ifdef SIGVTALRM
179-
case UVWASI_SIGVTALRM: return SIGVTALRM;
180-
#endif
181-
#ifdef SIGXCPU
182-
case UVWASI_SIGXCPU: return SIGXCPU;
183-
#endif
184-
#ifdef SIGXFSZ
185-
case UVWASI_SIGXFSZ: return SIGXFSZ;
186-
#endif
187-
default: return -1;
188-
}
189-
}
190-
191-
192107
uvwasi_timestamp_t uvwasi__timespec_to_timestamp(const uv_timespec_t* ts) {
193108
/* TODO(cjihrig): Handle overflow. */
194109
return (uvwasi_timestamp_t) ts->tv_sec * NANOS_PER_SEC + ts->tv_nsec;

src/uv_mapping.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#define NANOS_PER_SEC 1000000000
88

99
uvwasi_errno_t uvwasi__translate_uv_error(int err);
10-
int uvwasi__translate_to_uv_signal(uvwasi_signal_t sig);
1110
uvwasi_timestamp_t uvwasi__timespec_to_timestamp(const uv_timespec_t* ts);
1211
uvwasi_filetype_t uvwasi__stat_to_filetype(const uv_stat_t* stat);
1312
void uvwasi__stat_to_filestat(const uv_stat_t* stat, uvwasi_filestat_t* fs);

src/uvwasi.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2267,24 +2267,6 @@ uvwasi_errno_t uvwasi_proc_exit(uvwasi_t* uvwasi, uvwasi_exitcode_t rval) {
22672267
}
22682268

22692269

2270-
uvwasi_errno_t uvwasi_proc_raise(uvwasi_t* uvwasi, uvwasi_signal_t sig) {
2271-
int r;
2272-
2273-
if (uvwasi == NULL)
2274-
return UVWASI_EINVAL;
2275-
2276-
r = uvwasi__translate_to_uv_signal(sig);
2277-
if (r == -1)
2278-
return UVWASI_ENOSYS;
2279-
2280-
r = uv_kill(uv_os_getpid(), r);
2281-
if (r != 0)
2282-
return uvwasi__translate_uv_error(r);
2283-
2284-
return UVWASI_ESUCCESS;
2285-
}
2286-
2287-
22882270
uvwasi_errno_t uvwasi_random_get(uvwasi_t* uvwasi, void* buf, size_t buf_len) {
22892271
int r;
22902272

test/test-einval-input-validation.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,6 @@ int main(void) {
153153
CHECK(uvwasi_poll_oneoff(&uvw, &test_sub, &test_event, 0, &test_size));
154154
CHECK(uvwasi_poll_oneoff(&uvw, &test_sub, &test_event, 5, NULL));
155155

156-
CHECK(uvwasi_proc_raise(NULL, UVWASI_SIGUSR2));
157-
158156
CHECK(uvwasi_random_get(NULL, test_void, 10));
159157
CHECK(uvwasi_random_get(&uvw, NULL, 10));
160158

0 commit comments

Comments
 (0)