7 #include <sys/signal.h>
11 #define xglue(x, y) x ## y
12 #define glue(x, y) xglue(x, y)
13 #define stringify(s) tostring(s)
14 #define tostring(s) #s
19 #define __builtin_expect(x, n) (x)
22 #define likely(x) __builtin_expect(!!(x), 1)
23 #define unlikely(x) __builtin_expect(!!(x), 0)
26 #define container_of(ptr, type, member) ({ \
27 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
28 (type *)( (char *)__mptr - offsetof(type,member) );})
31 #define MIN(a, b) (((a) < (b)) ? (a) : (b))
34 #define MAX(a, b) (((a) > (b)) ? (a) : (b))
38 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
42 #if (__GNUC__ < 3) || defined(__APPLE__)
43 #define always_inline inline
45 #define always_inline __attribute__ (( always_inline )) __inline__
46 #define inline always_inline
49 #define inline always_inline
53 #define REGPARM __attribute((regparm(3)))
58 #define qemu_printf printf
60 void *qemu_memalign(size_t alignment
, size_t size
);
61 void *qemu_vmalloc(size_t size
);
62 void qemu_vfree(void *ptr
);
64 int qemu_create_pidfile(const char *filename
);
73 int qemu_gettimeofday(qemu_timeval
*tp
);
75 typedef struct timeval qemu_timeval
;
76 #define qemu_gettimeofday(tp) gettimeofday(tp, NULL);