signal handler works now. pushing so i can go back and see what i even did because i really was about to give up
This commit is contained in:
parent
b362e3764f
commit
fedd00f0d1
2 changed files with 8 additions and 8 deletions
|
|
@ -124,20 +124,19 @@ int msh_execute(char *cmd, char **args) {
|
|||
SIZE_TYPE ret;
|
||||
char *status_str;
|
||||
|
||||
/* msh_linux_setup_signals(); */
|
||||
msh_linux_setup_signals();
|
||||
|
||||
ret = (SIZE_TYPE)SYSCALL(waitid, P_ALL, fork, &status, WEXITED, &ru);
|
||||
|
||||
/*
|
||||
status_str = msh_allocate(64);
|
||||
/*status_str = msh_allocate(64);
|
||||
itoa(status.si_code, status_str, 10);
|
||||
msh_print_strings("Status ", status_str, "\n", 0);
|
||||
msh_deallocate(status_str);
|
||||
msh_deallocate(status_str);*/
|
||||
|
||||
SYSCALL(kill, fork, SIGKILL);
|
||||
|
||||
SYSCALL(write, 1, "\r", 2);
|
||||
*/
|
||||
|
||||
msh_linux_start_input_capture();
|
||||
|
||||
return status.si_signo;
|
||||
|
|
|
|||
|
|
@ -14,22 +14,23 @@
|
|||
#define INIT_SIGNAL(x) SYSCALL(rt_sigaction, x, &sigact, 0, sizeof(sigset_t));
|
||||
|
||||
static void signal_handler(int sig) {
|
||||
char *status_str = msh_allocate(64);
|
||||
/*char *status_str = msh_allocate(64);
|
||||
itoa(sig, status_str, 10);
|
||||
msh_print_strings("\nsignal ", status_str, "\n\n", 0);
|
||||
msh_deallocate(status_str);
|
||||
msh_deallocate(status_str);*/
|
||||
}
|
||||
|
||||
static void signal_restorer(void) { SYSCALL_0(rt_sigreturn); }
|
||||
|
||||
void msh_linux_setup_signals() {
|
||||
struct sigaction sigact;
|
||||
struct sigaction sigact_old;
|
||||
|
||||
memset(&sigact, 0, sizeof(sigact));
|
||||
|
||||
sigact.sa_handler = signal_handler;
|
||||
sigact.sa_restorer = signal_restorer;
|
||||
sigact.sa_flags = SA_RESTORER | SA_RESTART | SA_SIGINFO;
|
||||
sigact.sa_flags = SA_RESTORER | SA_RESTART;
|
||||
|
||||
SYSCALL(rt_sigprocmask, SIG_UNBLOCK, &sigact.sa_mask, &sigact.sa_mask,
|
||||
sizeof(sigset_t));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue