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