Statistics
| Branch: | Revision:

root / osdep.h @ 14ce26e7

History | View | Annotate | Download (1.3 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 ea88812f bellard
15 ea88812f bellard
void *get_mmap_addr(unsigned long size);
16 ea88812f bellard
17 ea88812f bellard
/* specific kludges for OS compatibility (should be moved elsewhere) */
18 ea88812f bellard
#if defined(__i386__) && !defined(CONFIG_SOFTMMU) && !defined(CONFIG_USER_ONLY)
19 ea88812f bellard
20 ea88812f bellard
/* disabled pthread version of longjmp which prevent us from using an
21 ea88812f bellard
   alternative signal stack */
22 ea88812f bellard
extern void __longjmp(jmp_buf env, int val);
23 ea88812f bellard
#define longjmp __longjmp
24 ea88812f bellard
25 d2bfb39a bellard
#include <signal.h>
26 d2bfb39a bellard
27 d2bfb39a bellard
/* NOTE: it works only because the glibc sigset_t is >= kernel sigset_t */
28 d2bfb39a bellard
struct qemu_sigaction {
29 d2bfb39a bellard
    union {
30 d2bfb39a bellard
        void (*_sa_handler)(int);
31 d2bfb39a bellard
        void (*_sa_sigaction)(int, struct siginfo *, void *);
32 d2bfb39a bellard
    } _u;
33 d2bfb39a bellard
    unsigned long sa_flags;
34 d2bfb39a bellard
    void (*sa_restorer)(void);
35 d2bfb39a bellard
    sigset_t sa_mask;                /* mask last for extensibility */
36 d2bfb39a bellard
};
37 d2bfb39a bellard
38 d2bfb39a bellard
int qemu_sigaction(int signum, const struct qemu_sigaction *act, 
39 d2bfb39a bellard
                   struct qemu_sigaction *oldact);
40 d2bfb39a bellard
41 d2bfb39a bellard
#undef sigaction
42 d2bfb39a bellard
#undef sa_handler
43 d2bfb39a bellard
#undef sa_sigaction
44 d2bfb39a bellard
#define sigaction qemu_sigaction
45 d2bfb39a bellard
#define sa_handler        _u._sa_handler
46 d2bfb39a bellard
#define sa_sigaction        _u._sa_sigaction
47 d2bfb39a bellard
48 ea88812f bellard
#endif
49 ea88812f bellard
50 ea88812f bellard
#endif