_WCRTLINK int sigaction( int __signum, const struct sigaction *__act, struct sigaction *__oldact ) { /* given the sigaction layout we must use rt_sigaction this requires Linux kernel 2.2 or higher (probably not a big deal nowadays) */ u_long res = sys_call4( SYS_rt_sigaction, __signum, (u_long)__act, (u_long)__oldact, sizeof( sigset_t ) ); __syscall_return( int, res ); }
void up_signal_dispatch(_sa_sigaction_t sighand, int signo, FAR siginfo_t *info, FAR void *ucontext) { /* We are signalling a user group, but does the signal handler lie in the * user address space? Or the kernel address space? The OS does * intercept some signals for its own purpose (such as the death-of-child * signal. */ if (arm_uservaddr((uintptr_t)sighand)) { /* Yes.. Let sys_call4() do all of the work to get us into user space */ (void)sys_call4(SYS_signal_handler, (uintptr_t)sighand, (uintptr_t)signo, (uintptr_t)info, (uintptr_t)ucontext); } else { /* No.. we are already in kernel mode so just call the handler */ sighand(signo, info, ucontext); } }
_WCRTLINK int sigwait( const sigset_t *__set, int *__sig ) { u_long res; while( 1 ) { res = sys_call4( SYS_rt_sigtimedwait, (u_long)__set, 0, 0, sizeof( sigset_t ) ); if( res >= -125 ) { errno = -res; res = -1; } if( res != -1 ) { *__sig = res; res = 0; break; } if( (errno != EAGAIN) && (errno != EINTR) ) { res = errno; break; } /* System call was interrupted, so loop around and try again */ } return( (int)res ); }
void up_signal_dispatch(_sa_sigaction_t sighand, int signo, FAR siginfo_t *info, FAR void *ucontext) { /* Let sys_call4() do all of the work */ (void)sys_call4(SYS_signal_handler, (uintptr_t)sighand, (uintptr_t)signo, (uintptr_t)info, (uintptr_t)ucontext); }
_WCRTLINK pid_t waitpid( pid_t __pid, int *__stat_loc, int __options ) { syscall_res res = sys_call4( SYS_wait4, __pid, (u_long)__stat_loc, (u_long)__options, (u_long)NULL ); __syscall_return( pid_t, res ); }