make sigaltstack work (missing macros in signal.h, error conditions)
This commit is contained in:
parent
1b538acb0a
commit
6871fd773d
3 changed files with 15 additions and 1 deletions
|
|
@ -1,8 +1,18 @@
|
|||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include "syscall.h"
|
||||
|
||||
int sigaltstack(const stack_t *ss, stack_t *old)
|
||||
{
|
||||
/* depends on kernel struct matching */
|
||||
if (ss) {
|
||||
if (ss->ss_size < MINSIGSTKSZ) {
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
if (ss->ss_flags & ~SS_DISABLE) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return syscall2(__NR_sigaltstack, (long)ss, (long)old);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue