1 #include <signal.h>
2 #include <errno.h>
3 #include <unsupported_api.h>
4 
5 #include "syscall.h"
6 
sigaltstack(const stack_t *restrict ss, stack_t *restrict old)7 int sigaltstack(const stack_t *restrict ss, stack_t *restrict old)
8 {
9 	unsupported_api(__FUNCTION__);
10 	if (ss) {
11 		if (!(ss->ss_flags & SS_DISABLE) && ss->ss_size < MINSIGSTKSZ) {
12 			errno = ENOMEM;
13 			return -1;
14 		}
15 		if (ss->ss_flags & SS_ONSTACK) {
16 			errno = EINVAL;
17 			return -1;
18 		}
19 	}
20 	return syscall(SYS_sigaltstack, ss, old);
21 }
22