Commit d2bfb39ad220a6431e366bdff72353b09f60e3db
1 parent
3611a29c
use the kernel sigaction syscall to avoid relying on glibc one
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1044 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
3 changed files
with
39 additions
and
11 deletions
osdep.c
... | ... | @@ -144,6 +144,22 @@ void *shmat(int shmid, const void *shmaddr, int shmflg) |
144 | 144 | } |
145 | 145 | |
146 | 146 | /****************************************************************/ |
147 | +/* sigaction bypassing the threads */ | |
148 | + | |
149 | +static int kernel_sigaction(int signum, const struct qemu_sigaction *act, | |
150 | + struct qemu_sigaction *oldact, | |
151 | + int sigsetsize) | |
152 | +{ | |
153 | + QEMU_SYSCALL4(rt_sigaction, signum, act, oldact, sigsetsize); | |
154 | +} | |
155 | + | |
156 | +int qemu_sigaction(int signum, const struct qemu_sigaction *act, | |
157 | + struct qemu_sigaction *oldact) | |
158 | +{ | |
159 | + return kernel_sigaction(signum, act, oldact, 8); | |
160 | +} | |
161 | + | |
162 | +/****************************************************************/ | |
147 | 163 | /* memory allocation */ |
148 | 164 | |
149 | 165 | //#define DEBUG_MALLOC | ... | ... |
osdep.h
... | ... | @@ -22,6 +22,29 @@ void *get_mmap_addr(unsigned long size); |
22 | 22 | extern void __longjmp(jmp_buf env, int val); |
23 | 23 | #define longjmp __longjmp |
24 | 24 | |
25 | +#include <signal.h> | |
26 | + | |
27 | +/* NOTE: it works only because the glibc sigset_t is >= kernel sigset_t */ | |
28 | +struct qemu_sigaction { | |
29 | + union { | |
30 | + void (*_sa_handler)(int); | |
31 | + void (*_sa_sigaction)(int, struct siginfo *, void *); | |
32 | + } _u; | |
33 | + unsigned long sa_flags; | |
34 | + void (*sa_restorer)(void); | |
35 | + sigset_t sa_mask; /* mask last for extensibility */ | |
36 | +}; | |
37 | + | |
38 | +int qemu_sigaction(int signum, const struct qemu_sigaction *act, | |
39 | + struct qemu_sigaction *oldact); | |
40 | + | |
41 | +#undef sigaction | |
42 | +#undef sa_handler | |
43 | +#undef sa_sigaction | |
44 | +#define sigaction qemu_sigaction | |
45 | +#define sa_handler _u._sa_handler | |
46 | +#define sa_sigaction _u._sa_sigaction | |
47 | + | |
25 | 48 | #endif |
26 | 49 | |
27 | 50 | #endif | ... | ... |
vl.c
... | ... | @@ -68,17 +68,6 @@ |
68 | 68 | #ifdef __APPLE__ |
69 | 69 | #include <SDL/SDL.h> |
70 | 70 | #endif |
71 | -#if defined(__linux__) | |
72 | -/* SDL use the pthreads and they modify sigaction. We don't | |
73 | - want that. */ | |
74 | -#if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) | |
75 | -extern void __libc_sigaction(); | |
76 | -#define sigaction(sig, act, oact) __libc_sigaction(sig, act, oact) | |
77 | -#else | |
78 | -extern void __sigaction(); | |
79 | -#define sigaction(sig, act, oact) __sigaction(sig, act, oact) | |
80 | -#endif | |
81 | -#endif /* __linux__ */ | |
82 | 71 | #endif /* CONFIG_SDL */ |
83 | 72 | |
84 | 73 | #include "disas.h" | ... | ... |