-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Requires #53.
Example
C code showing naive implementation of signals support
#define _GNU_SOURCE
#include <unistd.h>
#include <signal.h>
#include <sys/syscall.h>
void handle(int v)
{
(void)v;
syscall(SYS_write, 0, "whatsuppp?\n", 11);
}
#define SA_RESTORER 0x04000000
void restorer()
{
syscall(SYS_rt_sigreturn);
}
int main()
{
struct sigaction sa = {};
sa.sa_handler = handle;
sigemptyset(&sa.sa_mask);
#if 0
sigaction(SIGINT, &sa, (void*)0);
#else
sa.sa_flags |= SA_RESTORER;
sa.sa_restorer = restorer;
syscall(SYS_rt_sigaction, SIGINT, &sa, (void*)0, 8);
#endif
usleep(10 * 1000000);
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels