root / osdep.h @ 215cf0be
History | View | Annotate | Download (1.4 kB)
1 | ea88812f | bellard | #ifndef QEMU_OSDEP_H
|
---|---|---|---|
2 | ea88812f | bellard | #define QEMU_OSDEP_H
|
3 | ea88812f | bellard | |
4 | ea88812f | bellard | #include <stdarg.h> |
5 | ea88812f | bellard | |
6 | ea88812f | bellard | int qemu_vsnprintf(char *buf, int buflen, const char *fmt, va_list args); |
7 | ea88812f | bellard | void qemu_vprintf(const char *fmt, va_list ap); |
8 | ea88812f | bellard | void qemu_printf(const char *fmt, ...); |
9 | ea88812f | bellard | |
10 | ea88812f | bellard | void *qemu_malloc(size_t size);
|
11 | 0fb48229 | bellard | void *qemu_mallocz(size_t size);
|
12 | ea88812f | bellard | void qemu_free(void *ptr); |
13 | 2571929a | bellard | char *qemu_strdup(const char *str); |
14 | 49b470eb | bellard | |
15 | 49b470eb | bellard | void *qemu_vmalloc(size_t size);
|
16 | 49b470eb | bellard | void qemu_vfree(void *ptr); |
17 | ea88812f | bellard | |
18 | ea88812f | bellard | void *get_mmap_addr(unsigned long size); |
19 | ea88812f | bellard | |
20 | ea88812f | bellard | /* specific kludges for OS compatibility (should be moved elsewhere) */
|
21 | ea88812f | bellard | #if defined(__i386__) && !defined(CONFIG_SOFTMMU) && !defined(CONFIG_USER_ONLY)
|
22 | ea88812f | bellard | |
23 | ea88812f | bellard | /* disabled pthread version of longjmp which prevent us from using an
|
24 | ea88812f | bellard | alternative signal stack */
|
25 | ea88812f | bellard | extern void __longjmp(jmp_buf env, int val); |
26 | ea88812f | bellard | #define longjmp __longjmp
|
27 | ea88812f | bellard | |
28 | d2bfb39a | bellard | #include <signal.h> |
29 | d2bfb39a | bellard | |
30 | d2bfb39a | bellard | /* NOTE: it works only because the glibc sigset_t is >= kernel sigset_t */
|
31 | d2bfb39a | bellard | struct qemu_sigaction {
|
32 | d2bfb39a | bellard | union {
|
33 | d2bfb39a | bellard | void (*_sa_handler)(int); |
34 | d2bfb39a | bellard | void (*_sa_sigaction)(int, struct siginfo *, void *); |
35 | d2bfb39a | bellard | } _u; |
36 | d2bfb39a | bellard | unsigned long sa_flags; |
37 | d2bfb39a | bellard | void (*sa_restorer)(void); |
38 | d2bfb39a | bellard | sigset_t sa_mask; /* mask last for extensibility */
|
39 | d2bfb39a | bellard | }; |
40 | d2bfb39a | bellard | |
41 | d2bfb39a | bellard | int qemu_sigaction(int signum, const struct qemu_sigaction *act, |
42 | d2bfb39a | bellard | struct qemu_sigaction *oldact);
|
43 | d2bfb39a | bellard | |
44 | d2bfb39a | bellard | #undef sigaction
|
45 | d2bfb39a | bellard | #undef sa_handler
|
46 | d2bfb39a | bellard | #undef sa_sigaction
|
47 | d2bfb39a | bellard | #define sigaction qemu_sigaction
|
48 | d2bfb39a | bellard | #define sa_handler _u._sa_handler
|
49 | d2bfb39a | bellard | #define sa_sigaction _u._sa_sigaction
|
50 | d2bfb39a | bellard | |
51 | ea88812f | bellard | #endif
|
52 | ea88812f | bellard | |
53 | ea88812f | bellard | #endif |