Skip to content

Commit 879a02a

Browse files
authored
[POSIX]Implement signal functions in Starboard (youtube#6033)
This PR did four things: 1. Export symbol for kill, raise, pause and signal in Starboard. 2. Implements signal functions with Starboard wrappers, including: - sigaction - pthread_sigmask 3. Add musl implementation for the below functions: - sigaddset - sigdelset - sigemptyset - sigfillset - sigprocmask - sigismember 4. Move pthread_kill to signal wrappers from pthread wrappers. Bug: 412455890
1 parent 69d4151 commit 879a02a

13 files changed

+926
-27
lines changed

starboard/elf_loader/exported_symbols.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <malloc.h>
3030
#include <netdb.h>
3131
#include <sched.h>
32+
#include <signal.h>
3233
#include <stdlib.h>
3334
#include <sys/epoll.h>
3435
#include <sys/mman.h>
@@ -55,6 +56,7 @@
5556
#include "starboard/shared/modular/starboard_layer_posix_pipe2_abi_wrappers.h"
5657
#include "starboard/shared/modular/starboard_layer_posix_pthread_abi_wrappers.h"
5758
#include "starboard/shared/modular/starboard_layer_posix_semaphore_abi_wrappers.h"
59+
#include "starboard/shared/modular/starboard_layer_posix_signal_abi_wrappers.h"
5860
#include "starboard/shared/modular/starboard_layer_posix_socket_abi_wrappers.h"
5961
#include "starboard/shared/modular/starboard_layer_posix_socketpair_abi_wrappers.h"
6062
#include "starboard/shared/modular/starboard_layer_posix_stat_abi_wrappers.h"
@@ -240,6 +242,7 @@ ExportedSymbols::ExportedSymbols() {
240242
REGISTER_SYMBOL(getsockname);
241243
REGISTER_SYMBOL(getsockopt);
242244
REGISTER_SYMBOL(isatty);
245+
REGISTER_SYMBOL(kill);
243246
REGISTER_SYMBOL(listen);
244247
REGISTER_SYMBOL(madvise);
245248
REGISTER_SYMBOL(malloc);
@@ -252,10 +255,12 @@ ExportedSymbols::ExportedSymbols() {
252255
REGISTER_SYMBOL(msync);
253256
REGISTER_SYMBOL(munmap);
254257
REGISTER_SYMBOL(open);
258+
REGISTER_SYMBOL(pause);
255259
REGISTER_SYMBOL(pipe);
256260
REGISTER_SYMBOL(posix_memalign);
257261
REGISTER_SYMBOL(pread);
258262
REGISTER_SYMBOL(pwrite);
263+
REGISTER_SYMBOL(raise);
259264
REGISTER_SYMBOL(rand);
260265
REGISTER_SYMBOL(rand_r);
261266
REGISTER_SYMBOL(read);
@@ -267,6 +272,7 @@ ExportedSymbols::ExportedSymbols() {
267272
REGISTER_SYMBOL(sched_yield);
268273
REGISTER_SYMBOL(send);
269274
REGISTER_SYMBOL(sendto);
275+
REGISTER_SYMBOL(signal);
270276
REGISTER_SYMBOL(socket);
271277
REGISTER_SYMBOL(snprintf);
272278
REGISTER_SYMBOL(sprintf);
@@ -366,6 +372,7 @@ ExportedSymbols::ExportedSymbols() {
366372
REGISTER_WRAPPER(pthread_setname_np);
367373
REGISTER_WRAPPER(pthread_setschedparam);
368374
REGISTER_WRAPPER(pthread_setspecific);
375+
REGISTER_WRAPPER(pthread_sigmask);
369376
REGISTER_WRAPPER(readdir);
370377
REGISTER_WRAPPER(readdir_r);
371378
REGISTER_WRAPPER(setsockopt);
@@ -375,6 +382,7 @@ ExportedSymbols::ExportedSymbols() {
375382
REGISTER_WRAPPER(sem_timedwait);
376383
REGISTER_WRAPPER(sem_wait);
377384
REGISTER_WRAPPER(shutdown);
385+
REGISTER_WRAPPER(sigaction);
378386
REGISTER_WRAPPER(socketpair);
379387
REGISTER_WRAPPER(stat);
380388
REGISTER_WRAPPER(sysconf);

starboard/nplb/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ test("nplb") {
150150
"posix_compliance/posix_rand_r_test.cc",
151151
"posix_compliance/posix_rand_test.cc",
152152
"posix_compliance/posix_semaphore_test.cc",
153+
"posix_compliance/posix_signal_test.cc",
153154
"posix_compliance/posix_sleep_test.cc",
154155
"posix_compliance/posix_socket_accept_test.cc",
155156
"posix_compliance/posix_socket_bind_test.cc",

0 commit comments

Comments
 (0)