* Implemented sigaltstack() and set_signal_stack(), thus closing bug #1401.

* On exec() the new function thread_reset_for_exec() is called which clears the signals
  and cancels an eventually set alarm. Both things weren't done before...
* Some minor cleanups.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21989 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2007-08-16 18:01:47 +00:00
parent f2286d02b9
commit 0b70ea5992
13 changed files with 374 additions and 188 deletions
+2
View File
@@ -6,7 +6,9 @@ MergeObject posix_signal.o :
kill.c
raise.c
send_signal.c
set_signal_stack.c
sigaction.c
sigaltstack.c
signal.c
sigpending.c
sigprocmask.c
@@ -0,0 +1,28 @@
/*
* Copyright 2007, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License.
*/
#include <errno.h>
#include <signal.h>
#include <syscalls.h>
void
set_signal_stack(void *ptr, size_t size)
{
stack_t alternateStack;
status_t status;
alternateStack.ss_sp = ptr;
alternateStack.ss_size = size;
alternateStack.ss_flags = 0;
status = _kern_set_signal_stack(&alternateStack, NULL);
if (status < B_OK)
errno = status;
}
@@ -0,0 +1,23 @@
/*
* Copyright 2007, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License.
*/
#include <errno.h>
#include <signal.h>
#include <syscalls.h>
int
sigaltstack(const stack_t *alternateStack, stack_t *oldAlternateStack)
{
status_t status =_kern_set_signal_stack(alternateStack, oldAlternateStack);
if (status < B_OK) {
errno = status;
return -1;
}
return 0;
}