mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 13:52:28 +00:00
Add sigpending to redbean unix.* module (#605)
This commit is contained in:
parent
2d17ab016c
commit
f68151c010
2 changed files with 21 additions and 0 deletions
15
third_party/lua/lunix.c
vendored
15
third_party/lua/lunix.c
vendored
|
@ -1797,6 +1797,20 @@ static int LuaUnixSigsuspend(lua_State *L) {
|
|||
return LuaUnixSysretErrno(L, "sigsuspend", olderr);
|
||||
}
|
||||
|
||||
// unix.sigpending()
|
||||
// ├─→ mask:unix.Sigset
|
||||
// └─→ nil, unix.Errno
|
||||
static int LuaUnixSigpending(lua_State *L) {
|
||||
int olderr = errno;
|
||||
struct sigset mask;
|
||||
if (!sigpending(&mask)) {
|
||||
LuaPushSigset(L, mask);
|
||||
return 1;
|
||||
} else {
|
||||
return LuaUnixSysretErrno(L, "sigpending", olderr);
|
||||
}
|
||||
}
|
||||
|
||||
// unix.setitimer(which[, intervalsec, intns, valuesec, valuens])
|
||||
// ├─→ intervalsec:int, intervalns:int, valuesec:int, valuens:int
|
||||
// └─→ nil, unix.Errno
|
||||
|
@ -2977,6 +2991,7 @@ static const luaL_Reg kLuaUnix[] = {
|
|||
{"shutdown", LuaUnixShutdown}, // make socket half empty or full
|
||||
{"sigaction", LuaUnixSigaction}, // install signal handler
|
||||
{"sigprocmask", LuaUnixSigprocmask}, // change signal mask
|
||||
{"sigpending", LuaUnixSigpending}, // get pending signals
|
||||
{"sigsuspend", LuaUnixSigsuspend}, // wait for signal
|
||||
{"siocgifconf", LuaUnixSiocgifconf}, // get list of network interfaces
|
||||
{"socket", LuaUnixSocket}, // create network communication fd
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue