jehanne: add sigaction (in libposix_conf.c)

This implementation ignores both flags and mask:
- ignoring SA_SIGINFO in sa_flags means that sigaction forward to the signal machinery
- ignoring sa_mask means that no mask is set for the signal (but note that Jehanne's notes
  are not reentrant).
This commit is contained in:
Giacomo Tesio 2017-09-10 23:42:01 +02:00
parent cb02879013
commit 7f5b6a5ef1
1 changed files with 19 additions and 0 deletions

View File

@ -100,6 +100,7 @@ extern void jehanne_sysfatal(const char*, ...);
#define __CYGWIN__ /* needed for O_ACCMODE */
#include <fcntl.h>
#undef __CYGWIN__
#include <reent.h>
extern void __application_newlib_init(void) __attribute__((weak));
@ -432,3 +433,21 @@ initialize_newlib(void)
if(__application_newlib_init != 0)
__application_newlib_init();
}
int
sigaction(int sig, const struct sigaction *act, struct sigaction *oact)
{
if(sig <= 0 || sig > SIGUSR2 || sig == SIGKILL){
_REENT->_errno = EINVAL;
return -1;
}
if(oact){
oact->sa_handler = _REENT->_sig_func[sig];
oact->sa_mask = 0;
oact->sa_flags = 0;
}
if(act){
_REENT->_sig_func[sig] = act->sa_handler;
}
return 0;
}