]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/uclibc/lib/libpthread/src/signals.c
update
[l4.git] / l4 / pkg / uclibc / lib / libpthread / src / signals.c
1 /* Handling of signals */
2
3 #include <signal.h>
4 #include <errno.h>
5 #include <pthread-l4.h>
6 #include <l4/sys/thread.h>
7
8 int pthread_kill(pthread_t thread, int signo);
9 int pthread_kill(pthread_t thread, int signo)
10 {
11   l4_cap_idx_t c = pthread_getl4cap(thread);
12
13   if (signo >= _NSIG)
14     {
15       errno = EINVAL;
16       return -1;
17     }
18
19   if (l4_is_invalid_cap(c))
20     {
21       errno = ESRCH;
22       return -1;
23     }
24
25   int x = l4_error(l4_thread_ex_regs(c, ~0UL, ~0UL,
26                                      L4_THREAD_EX_REGS_TRIGGER_EXCEPTION));
27   if (x)
28     {
29       errno = EINVAL;
30       return -1;
31     }
32
33   return x ? -1 : 0;
34 }