mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2024-10-16 13:02:32 +00:00
libc-wasi: Remove unused code (#2528)
This commit is contained in:
parent
9e3904337e
commit
48b71a05fb
|
@ -264,37 +264,6 @@ typedef uint8_t __wasi_sdflags_t;
|
||||||
typedef uint16_t __wasi_siflags_t;
|
typedef uint16_t __wasi_siflags_t;
|
||||||
|
|
||||||
typedef uint8_t __wasi_signal_t;
|
typedef uint8_t __wasi_signal_t;
|
||||||
// 0 is reserved; POSIX has special semantics for kill(pid, 0).
|
|
||||||
#define __WASI_SIGHUP (1)
|
|
||||||
#define __WASI_SIGINT (2)
|
|
||||||
#define __WASI_SIGQUIT (3)
|
|
||||||
#define __WASI_SIGILL (4)
|
|
||||||
#define __WASI_SIGTRAP (5)
|
|
||||||
#define __WASI_SIGABRT (6)
|
|
||||||
#define __WASI_SIGBUS (7)
|
|
||||||
#define __WASI_SIGFPE (8)
|
|
||||||
#define __WASI_SIGKILL (9)
|
|
||||||
#define __WASI_SIGUSR1 (10)
|
|
||||||
#define __WASI_SIGSEGV (11)
|
|
||||||
#define __WASI_SIGUSR2 (12)
|
|
||||||
#define __WASI_SIGPIPE (13)
|
|
||||||
#define __WASI_SIGALRM (14)
|
|
||||||
#define __WASI_SIGTERM (15)
|
|
||||||
#define __WASI_SIGCHLD (16)
|
|
||||||
#define __WASI_SIGCONT (17)
|
|
||||||
#define __WASI_SIGSTOP (18)
|
|
||||||
#define __WASI_SIGTSTP (19)
|
|
||||||
#define __WASI_SIGTTIN (20)
|
|
||||||
#define __WASI_SIGTTOU (21)
|
|
||||||
#define __WASI_SIGURG (22)
|
|
||||||
#define __WASI_SIGXCPU (23)
|
|
||||||
#define __WASI_SIGXFSZ (24)
|
|
||||||
#define __WASI_SIGVTALRM (25)
|
|
||||||
#define __WASI_SIGPROF (26)
|
|
||||||
#define __WASI_SIGWINCH (27)
|
|
||||||
#define __WASI_SIGPOLL (28)
|
|
||||||
#define __WASI_SIGPWR (29)
|
|
||||||
#define __WASI_SIGSYS (30)
|
|
||||||
|
|
||||||
typedef uint16_t __wasi_subclockflags_t;
|
typedef uint16_t __wasi_subclockflags_t;
|
||||||
#define __WASI_SUBSCRIPTION_CLOCK_ABSTIME (0x0001)
|
#define __WASI_SUBSCRIPTION_CLOCK_ABSTIME (0x0001)
|
||||||
|
@ -986,20 +955,6 @@ __wasi_errno_t wasmtime_ssp_poll_oneoff(
|
||||||
size_t *nevents
|
size_t *nevents
|
||||||
) WASMTIME_SSP_SYSCALL_NAME(poll_oneoff) __attribute__((__warn_unused_result__));
|
) WASMTIME_SSP_SYSCALL_NAME(poll_oneoff) __attribute__((__warn_unused_result__));
|
||||||
|
|
||||||
#if 0
|
|
||||||
/**
|
|
||||||
* We throw exception in libc-wasi wrapper function wasi_proc_exit()
|
|
||||||
* but not call this function.
|
|
||||||
*/
|
|
||||||
_Noreturn void wasmtime_ssp_proc_exit(
|
|
||||||
__wasi_exitcode_t rval
|
|
||||||
) WASMTIME_SSP_SYSCALL_NAME(proc_exit);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
__wasi_errno_t wasmtime_ssp_proc_raise(
|
|
||||||
__wasi_signal_t sig
|
|
||||||
) WASMTIME_SSP_SYSCALL_NAME(proc_raise) __attribute__((__warn_unused_result__));
|
|
||||||
|
|
||||||
__wasi_errno_t wasmtime_ssp_random_get(
|
__wasi_errno_t wasmtime_ssp_random_get(
|
||||||
void *buf,
|
void *buf,
|
||||||
size_t buf_len
|
size_t buf_len
|
||||||
|
|
|
@ -2787,123 +2787,6 @@ wasmtime_ssp_poll_oneoff(
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
/**
|
|
||||||
* We throw exception in libc-wasi wrapper function wasi_proc_exit()
|
|
||||||
* but not call this function.
|
|
||||||
*/
|
|
||||||
void wasmtime_ssp_proc_exit(
|
|
||||||
__wasi_exitcode_t rval
|
|
||||||
) {
|
|
||||||
_Exit((int32)rval);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
__wasi_errno_t
|
|
||||||
wasmtime_ssp_proc_raise(__wasi_signal_t sig)
|
|
||||||
{
|
|
||||||
static const int signals[] = {
|
|
||||||
#define X(v) [__WASI_##v] = v
|
|
||||||
#if defined(SIGABRT)
|
|
||||||
X(SIGABRT),
|
|
||||||
#endif
|
|
||||||
#if defined(SIGALRM)
|
|
||||||
X(SIGALRM),
|
|
||||||
#endif
|
|
||||||
#if defined(SIGBUS)
|
|
||||||
X(SIGBUS),
|
|
||||||
#endif
|
|
||||||
#if defined(SIGCHLD)
|
|
||||||
X(SIGCHLD),
|
|
||||||
#endif
|
|
||||||
#if defined(SIGCONT)
|
|
||||||
X(SIGCONT),
|
|
||||||
#endif
|
|
||||||
#if defined(SIGFPE)
|
|
||||||
X(SIGFPE),
|
|
||||||
#endif
|
|
||||||
#if defined(SIGHUP)
|
|
||||||
X(SIGHUP),
|
|
||||||
#endif
|
|
||||||
#if defined(SIGILL)
|
|
||||||
X(SIGILL),
|
|
||||||
#endif
|
|
||||||
#if defined(SIGINT)
|
|
||||||
X(SIGINT),
|
|
||||||
#endif
|
|
||||||
#if defined(SIGKILL)
|
|
||||||
X(SIGKILL),
|
|
||||||
#endif
|
|
||||||
#if defined(SIGPIPE)
|
|
||||||
X(SIGPIPE),
|
|
||||||
#endif
|
|
||||||
#if defined(SIGQUIT)
|
|
||||||
X(SIGQUIT),
|
|
||||||
#endif
|
|
||||||
#if defined(SIGSYS)
|
|
||||||
X(SIGSEGV),
|
|
||||||
#endif
|
|
||||||
#if defined(SIGSTOP)
|
|
||||||
X(SIGSTOP),
|
|
||||||
#endif
|
|
||||||
#if defined(SIGSYS)
|
|
||||||
X(SIGSYS),
|
|
||||||
#endif
|
|
||||||
#if defined(SIGTERM)
|
|
||||||
X(SIGTERM),
|
|
||||||
#endif
|
|
||||||
#if defined(SIGTRAP)
|
|
||||||
X(SIGTRAP),
|
|
||||||
#endif
|
|
||||||
#if defined(SIGTSTP)
|
|
||||||
X(SIGTSTP),
|
|
||||||
#endif
|
|
||||||
#if defined(SIGTTIN)
|
|
||||||
X(SIGTTIN),
|
|
||||||
#endif
|
|
||||||
#if defined(SIGTTOU)
|
|
||||||
X(SIGTTOU),
|
|
||||||
#endif
|
|
||||||
#if defined(SIGURG)
|
|
||||||
X(SIGURG),
|
|
||||||
#endif
|
|
||||||
#if defined(SIGUSR1)
|
|
||||||
X(SIGUSR1),
|
|
||||||
#endif
|
|
||||||
#if defined(SIGUSR2)
|
|
||||||
X(SIGUSR2),
|
|
||||||
#endif
|
|
||||||
#if defined(SIGVTALRM)
|
|
||||||
X(SIGVTALRM),
|
|
||||||
#endif
|
|
||||||
#if defined(SIGXCPU)
|
|
||||||
X(SIGXCPU),
|
|
||||||
#endif
|
|
||||||
#if defined(SIGXFSZ)
|
|
||||||
X(SIGXFSZ),
|
|
||||||
#endif
|
|
||||||
#undef X
|
|
||||||
};
|
|
||||||
if (sig >= sizeof(signals) / sizeof(signals[0]) || signals[sig] == 0)
|
|
||||||
return __WASI_EINVAL;
|
|
||||||
|
|
||||||
#if CONFIG_TLS_USE_GSBASE
|
|
||||||
// TLS on OS X depends on installing a SIGSEGV handler. Reset SIGSEGV
|
|
||||||
// to the default action before raising.
|
|
||||||
if (sig == __WASI_SIGSEGV) {
|
|
||||||
struct sigaction sa = {
|
|
||||||
.sa_handler = SIG_DFL,
|
|
||||||
};
|
|
||||||
sigemptyset(&sa.sa_mask);
|
|
||||||
sigaction(SIGSEGV, &sa, NULL);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (raise(signals[sig]) < 0)
|
|
||||||
return convert_errno(errno);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
__wasi_errno_t
|
__wasi_errno_t
|
||||||
wasmtime_ssp_random_get(void *buf, size_t nbyte)
|
wasmtime_ssp_random_get(void *buf, size_t nbyte)
|
||||||
{
|
{
|
||||||
|
|
|
@ -101,12 +101,6 @@
|
||||||
#define st_mtim st_mtimespec
|
#define st_mtim st_mtimespec
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __APPLE__
|
|
||||||
#define CONFIG_TLS_USE_GSBASE 1
|
|
||||||
#else
|
|
||||||
#define CONFIG_TLS_USE_GSBASE 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(BH_PLATFORM_LINUX_SGX)
|
#if !defined(BH_PLATFORM_LINUX_SGX)
|
||||||
/* Clang's __GNUC_PREREQ macro has a different meaning than GCC one,
|
/* Clang's __GNUC_PREREQ macro has a different meaning than GCC one,
|
||||||
so we have to handle this case specially */
|
so we have to handle this case specially */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user