Annotation of qemu/osdep.h, revision 1.1.1.6

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

unix.superglobalmegacorp.com