Annotation of qemu/osdep.h, revision 1.1.1.5

1.1       root        1: #ifndef QEMU_OSDEP_H
                      2: #define QEMU_OSDEP_H
                      3: 
                      4: #include <stdarg.h>
1.1.1.5 ! root        5: #ifdef __OpenBSD__
        !             6: #include <sys/types.h>
        !             7: #include <sys/signal.h>
        !             8: #endif
        !             9: 
        !            10: #ifndef _WIN32
        !            11: #include <sys/time.h>
        !            12: #endif
1.1       root       13: 
1.1.1.4   root       14: #ifndef glue
                     15: #define xglue(x, y) x ## y
                     16: #define glue(x, y) xglue(x, y)
                     17: #define stringify(s)   tostring(s)
                     18: #define tostring(s)    #s
                     19: #endif
                     20: 
                     21: #ifndef likely
                     22: #if __GNUC__ < 3
                     23: #define __builtin_expect(x, n) (x)
                     24: #endif
                     25: 
                     26: #define likely(x)   __builtin_expect(!!(x), 1)
                     27: #define unlikely(x)   __builtin_expect(!!(x), 0)
                     28: #endif
                     29: 
1.1.1.5 ! root       30: #ifndef offsetof
        !            31: #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *) 0)->MEMBER)
        !            32: #endif
        !            33: #ifndef container_of
        !            34: #define container_of(ptr, type, member) ({                      \
        !            35:         const typeof(((type *) 0)->member) *__mptr = (ptr);     \
        !            36:         (type *) ((char *) __mptr - offsetof(type, member));})
        !            37: #endif
        !            38: 
1.1.1.4   root       39: #ifndef MIN
                     40: #define MIN(a, b) (((a) < (b)) ? (a) : (b))
                     41: #endif
                     42: #ifndef MAX
                     43: #define MAX(a, b) (((a) > (b)) ? (a) : (b))
                     44: #endif
                     45: 
1.1.1.5 ! root       46: #ifndef ARRAY_SIZE
        !            47: #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
        !            48: #endif
        !            49: 
1.1.1.4   root       50: #ifndef always_inline
                     51: #if (__GNUC__ < 3) || defined(__APPLE__)
                     52: #define always_inline inline
                     53: #else
                     54: #define always_inline __attribute__ (( always_inline )) __inline__
1.1.1.5 ! root       55: #ifdef __OPTIMIZE__
        !            56: #define inline always_inline
1.1.1.4   root       57: #endif
                     58: #endif
1.1.1.5 ! root       59: #else
1.1.1.4   root       60: #define inline always_inline
1.1.1.5 ! root       61: #endif
1.1.1.4   root       62: 
                     63: #ifdef __i386__
1.1.1.5 ! root       64: #define REGPARM __attribute((regparm(3)))
1.1.1.4   root       65: #else
1.1.1.5 ! root       66: #define REGPARM
1.1.1.4   root       67: #endif
                     68: 
1.1.1.3   root       69: #define qemu_printf printf
1.1       root       70: 
1.1.1.5 ! root       71: #if defined (__GNUC__) && defined (__GNUC_MINOR__)
        !            72: # define QEMU_GNUC_PREREQ(maj, min) \
        !            73:          ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
        !            74: #else
        !            75: # define QEMU_GNUC_PREREQ(maj, min) 0
        !            76: #endif
1.1       root       77: 
1.1.1.4   root       78: void *qemu_memalign(size_t alignment, size_t size);
1.1       root       79: void *qemu_vmalloc(size_t size);
                     80: void qemu_vfree(void *ptr);
                     81: 
1.1.1.4   root       82: int qemu_create_pidfile(const char *filename);
                     83: 
                     84: #ifdef _WIN32
                     85: int ffs(int i);
                     86: 
                     87: typedef struct {
                     88:     long tv_sec;
                     89:     long tv_usec;
                     90: } qemu_timeval;
                     91: int qemu_gettimeofday(qemu_timeval *tp);
                     92: #else
                     93: typedef struct timeval qemu_timeval;
                     94: #define qemu_gettimeofday(tp) gettimeofday(tp, NULL);
                     95: #endif /* !_WIN32 */
                     96: 
1.1       root       97: #endif

unix.superglobalmegacorp.com