umem  1.0.1
Macros | Typedefs
sol_compat.h File Reference
#include "config.h"
#include <stdint.h>
#include <pthread.h>
#include <sys/time.h>

Go to the source code of this file.

Macros

#define THR_RETURN   void *
 
#define THR_API
 
#define INLINE   inline
 
#define thr_self()   pthread_self()
 
#define thr_sigsetmask   pthread_sigmask
 
#define THR_BOUND   1
 
#define THR_DETACHED   2
 
#define THR_DAEMON   4
 
#define mutex_init(mp, type, arg)   pthread_mutex_init(mp, NULL)
 
#define mutex_lock(mp)   pthread_mutex_lock(mp)
 
#define mutex_unlock(mp)   pthread_mutex_unlock(mp)
 
#define mutex_destroy(mp)   pthread_mutex_destroy(mp)
 
#define mutex_trylock(mp)   pthread_mutex_trylock(mp)
 
#define DEFAULTMUTEX   PTHREAD_MUTEX_INITIALIZER
 
#define DEFAULTCV   PTHREAD_COND_INITIALIZER
 
#define MUTEX_HELD(mp)   1 /* not really, but only used in an assert */
 
#define cond_init(c, type, arg)   pthread_cond_init(c, NULL)
 
#define cond_wait(c, m)   pthread_cond_wait(c, m)
 
#define _cond_wait(c, m)   pthread_cond_wait(c, m)
 
#define cond_signal(c)   pthread_cond_signal(c)
 
#define cond_broadcast(c)   pthread_cond_broadcast(c)
 
#define cond_destroy(c)   pthread_cond_destroy(c)
 
#define cond_timedwait   pthread_cond_timedwait
 
#define _cond_timedwait   pthread_cond_timedwait
 
#define RTLD_FIRST   0
 
#define ec_atomic_inc64(a)   (*a)++
 
#define P2PHASE(x, align)   ((x) & ((align) - 1))
 
#define P2ALIGN(x, align)   ((x) & -(align))
 
#define P2NPHASE(x, align)   (-(x) & ((align) - 1))
 
#define P2ROUNDUP(x, align)   (-(-(x) & -(align)))
 
#define P2END(x, align)   (-(~(x) & -(align)))
 
#define P2PHASEUP(x, align, phase)   ((phase) - (((phase) - (x)) & -(align)))
 
#define P2CROSS(x, y, align)   (((x) ^ (y)) > (align) - 1)
 
#define P2SAMEHIGHBIT(x, y)   (((x) ^ (y)) < ((x) & (y)))
 
#define IS_P2ALIGNED(v, a)   ((((uintptr_t)(v)) & ((uintptr_t)(a) - 1)) == 0)
 
#define ISP2(x)   (((x) & ((x) - 1)) == 0)
 
#define atomic_add_64(lvalptr, delta)   ec_atomic_inc64(lvalptr)
 
#define atomic_add_32_nv(a, b)   ec_atomic_inc(a)
 
#define NANOSEC   1000000000
 
#define issetugid()   (geteuid() == 0)
 
#define _sysconf(a)   sysconf(a)
 
#define __NORETURN   __attribute__ ((noreturn))
 
#define EC_UMEM_DUMMY_PCSTACK   1
 
#define MIN(a, b)   ((a) < (b) ? (a) : (b))
 
#define MAX(a, b)   ((a) > (b) ? (a) : (b))
 

Typedefs

typedef pthread_t thread_t
 
typedef pthread_mutex_t mutex_t
 
typedef pthread_cond_t cond_t
 
typedef u_int64_t hrtime_t
 
typedef uint32_t uint_t
 
typedef unsigned long ulong_t
 
typedef struct timespec timestruc_t
 
typedef long long longlong_t
 
typedef struct timespec timespec_t
 

Macro Definition Documentation

◆ __NORETURN

#define __NORETURN   __attribute__ ((noreturn))

◆ _cond_timedwait

#define _cond_timedwait   pthread_cond_timedwait

◆ _cond_wait

#define _cond_wait (   c,
 
)    pthread_cond_wait(c, m)

◆ _sysconf

#define _sysconf (   a)    sysconf(a)

Referenced by umem_type_init(), and vmem_mmap_arena().

◆ atomic_add_32_nv

#define atomic_add_32_nv (   a,
 
)    ec_atomic_inc(a)

Referenced by vmem_create().

◆ atomic_add_64

#define atomic_add_64 (   lvalptr,
  delta 
)    ec_atomic_inc64(lvalptr)

◆ cond_broadcast

#define cond_broadcast (   c)    pthread_cond_broadcast(c)

◆ cond_destroy

#define cond_destroy (   c)    pthread_cond_destroy(c)

◆ cond_init

#define cond_init (   c,
  type,
  arg 
)    pthread_cond_init(c, NULL)

◆ cond_signal

#define cond_signal (   c)    pthread_cond_signal(c)

◆ cond_timedwait

#define cond_timedwait   pthread_cond_timedwait

◆ cond_wait

#define cond_wait (   c,
 
)    pthread_cond_wait(c, m)

◆ DEFAULTCV

#define DEFAULTCV   PTHREAD_COND_INITIALIZER

◆ DEFAULTMUTEX

#define DEFAULTMUTEX   PTHREAD_MUTEX_INITIALIZER

Referenced by vmem_heap_arena().

◆ ec_atomic_inc64

#define ec_atomic_inc64 (   a)    (*a)++

◆ EC_UMEM_DUMMY_PCSTACK

#define EC_UMEM_DUMMY_PCSTACK   1

◆ INLINE

#define INLINE   inline

◆ IS_P2ALIGNED

#define IS_P2ALIGNED (   v,
 
)    ((((uintptr_t)(v)) & ((uintptr_t)(a) - 1)) == 0)

◆ ISP2

#define ISP2 (   x)    (((x) & ((x) - 1)) == 0)

◆ issetugid

#define issetugid ( )    (geteuid() == 0)

Referenced by umem_error_enter(), and umem_init().

◆ MAX

#define MAX (   a,
 
)    ((a) > (b) ? (a) : (b))

Referenced by _sbrk_grow_aligned().

◆ MIN

#define MIN (   a,
 
)    ((a) < (b) ? (a) : (b))

◆ mutex_destroy

#define mutex_destroy (   mp)    pthread_mutex_destroy(mp)

◆ MUTEX_HELD

#define MUTEX_HELD (   mp)    1 /* not really, but only used in an assert */

◆ mutex_init

#define mutex_init (   mp,
  type,
  arg 
)    pthread_mutex_init(mp, NULL)

◆ mutex_lock

#define mutex_lock (   mp)    pthread_mutex_lock(mp)

◆ mutex_trylock

#define mutex_trylock (   mp)    pthread_mutex_trylock(mp)

◆ mutex_unlock

#define mutex_unlock (   mp)    pthread_mutex_unlock(mp)

◆ NANOSEC

#define NANOSEC   1000000000

Referenced by hrt2ts().

◆ P2ALIGN

#define P2ALIGN (   x,
  align 
)    ((x) & -(align))

◆ P2CROSS

#define P2CROSS (   x,
  y,
  align 
)    (((x) ^ (y)) > (align) - 1)

◆ P2END

#define P2END (   x,
  align 
)    (-(~(x) & -(align)))

◆ P2NPHASE

#define P2NPHASE (   x,
  align 
)    (-(x) & ((align) - 1))

Referenced by umem_cache_create().

◆ P2PHASE

#define P2PHASE (   x,
  align 
)    ((x) & ((align) - 1))

Referenced by memalign().

◆ P2PHASEUP

#define P2PHASEUP (   x,
  align,
  phase 
)    ((phase) - (((phase) - (x)) & -(align)))

◆ P2ROUNDUP

#define P2ROUNDUP (   x,
  align 
)    (-(-(x) & -(align)))

◆ P2SAMEHIGHBIT

#define P2SAMEHIGHBIT (   x,
 
)    (((x) ^ (y)) < ((x) & (y)))

◆ RTLD_FIRST

#define RTLD_FIRST   0

◆ THR_API

#define THR_API

◆ THR_BOUND

#define THR_BOUND   1

◆ THR_DAEMON

#define THR_DAEMON   4

◆ THR_DETACHED

#define THR_DETACHED   2

◆ THR_RETURN

#define THR_RETURN   void *

◆ thr_self

#define thr_self ( )    pthread_self()

◆ thr_sigsetmask

#define thr_sigsetmask   pthread_sigmask

Typedef Documentation

◆ cond_t

typedef pthread_cond_t cond_t

◆ hrtime_t

typedef u_int64_t hrtime_t

◆ longlong_t

typedef long long longlong_t

◆ mutex_t

typedef pthread_mutex_t mutex_t

◆ thread_t

typedef pthread_t thread_t

◆ timespec_t

typedef struct timespec timespec_t

◆ timestruc_t

typedef struct timespec timestruc_t

◆ uint_t

typedef uint32_t uint_t

◆ ulong_t

typedef unsigned long ulong_t