VirtualBox

Ignore:
Timestamp:
Jan 2, 2015 12:19:17 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
97422
Message:

VBoxDTrace: porting libdtrace... (r22)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ExtPacks/VBoxDTrace/include/VBoxDTraceTypes.h

    r53648 r53652  
    3434#include <iprt/types.h>
    3535#include <iprt/stdarg.h>
     36#include <iprt/param.h>
     37#ifdef IN_RING3
     38# include <sys/types.h>
     39#endif
    3640
    3741RT_C_DECLS_BEGIN
     
    4044
    4145typedef unsigned char               uchar_t;
     46typedef unsigned short              ushort_t;
    4247typedef unsigned int                uint_t;
    4348typedef uintptr_t                   ulong_t;
     49typedef uint64_t                    hrtime_t;
     50typedef RTCCUINTREG                 greg_t;
    4451typedef uintptr_t                   pc_t;
     52typedef uintptr_t                   id_t;
    4553typedef unsigned int                model_t;
    4654typedef uint32_t                    zoneid_t;
     
    5462#define NANOSEC                     RT_NS_1SEC
    5563#define MILLISEC                    RT_MS_1SEC
     64#define MAXPATHLEN                  RTPATH_MAX
     65#define PATH_MAX                    RTPATH_MAX
     66#define NBBY                        8
     67#define NCPU                        RTCPUSET_MAX_CPUS
    5668
    5769#if defined(RT_ARCH_X86)
    5870# ifndef __i386
    59 #  define __i386            1
     71#  define __i386                1
     72# endif
     73# ifndef __x86
     74#  define __x86                 1
    6075# endif
    6176
    6277#elif defined(RT_ARCH_AMD64)
    6378# ifndef __x86_64
    64 #  define __x86_64          1
     79#  define __x86_64              1
     80# endif
     81# ifndef __x86
     82#  define __x86                 1
    6583# endif
    6684
     
    94112
    95113/*
    96  * CTF - probably needs to be ported wholesale or smth.
    97  */
    98 #define CTF_MODEL_NATIVE            1
    99 typedef struct VBoxDtCtfFile        ctf_file_t;
    100 typedef intptr_t                    ctf_id_t;
    101 
    102 
     114 * Errno defines compatible with the CRT of the given host...
     115 */
    103116#ifdef IN_RING0
     117# define EINVAL                 (22)
     118# define EBUSY                  (16)
     119# define EFBIG                  (27)
     120# define ENOMEM                 (12)
     121# define ENOSPC                 (28)
     122# define ENOENT                 (2)
     123# define EFAULT                 (14)
     124# define E2BIG                  (7)
     125# define EACCES                 (13)
     126# define ENXIO                  (6)
     127# define EAGAIN                 (11)
     128# define ENOTTY                 (25)
     129# define ESRCH                  (3)
     130#endif
     131#if defined(_MSC_VER) || defined(IN_RING0)
     132# define EALREADY               (114)
     133#endif
     134
     135
     136#ifdef IN_RING0
    104137
    105138/*
    106139 * Kernel stuff...
    107140 */
    108 typedef uint64_t                    hrtime_t;
    109 typedef RTCCUINTREG                 greg_t;
    110 
    111141#define P2ROUNDUP(uWhat, uAlign)    ( ((uWhat) + (uAlign) - 1) & ~(uAlign - 1) )
    112142#define IS_P2ALIGNED(uWhat, uAlign) ( !((uWhat) & ((uAlign) - 1)) )
     
    114144#define MIN(a1, a2)                 RT_MIN(a1, a2)
    115145
    116 #define NBBY                        8
    117 #define NCPU                        RTCPUSET_MAX_CPUS
    118146#define B_FALSE                     (0)
    119147#define B_TRUE                      (1)
     
    235263void VBoxDtUPrintfV(const char *pszFormat, va_list va);
    236264
    237 
    238 /*
    239  * Errno defines compatible with the CRT of the given host...
    240  */
    241 #define EINVAL                  (22)
    242 #define EBUSY                   (16)
    243 #define EFBIG                   (27)
    244 #define ENOMEM                  (12)
    245 #define ENOSPC                  (28)
    246 #define ENOENT                  (2)
    247 #define EFAULT                  (14)
    248 #define E2BIG                   (7)
    249 #define EACCES                  (13)
    250 #define EALREADY                (114)
    251 #define ENXIO                   (6)
    252 #define EAGAIN                  (11)
    253 #define ENOTTY                  (25)
    254 #define ESRCH                   (3)
    255 
    256265/*
    257266 * Memory allocation wrappers.
     
    344353#endif /* IN_RING0 */
    345354
     355
     356#ifdef IN_RING3
     357/*
     358 * Make life a little easier in ring-3.
     359 */
     360# include <iprt/alloca.h>
     361# include <iprt/mem.h>
     362# include <iprt/string.h>
     363# include <iprt/time.h>
     364# define gethrtime()                RTTimeNanoTS()
     365
     366/* This isn't necessarily making things easier at first, but allows EF and
     367   such later on when things doesn't work right. */
     368# include <stdlib.h>
     369# include <string.h>
     370# define malloc(a_cbMem)            RTMemAlloc(a_cbMem)
     371# define realloc(a_pvOld, a_cbMem)  RTMemRealloc(a_pvOld, a_cbMem)
     372# define calloc(a_cbItem, a_cItems) RTMemAllocZ((size_t)(a_cbItem) * (a_cItems))
     373# define free(a_pvMem)              RTMemFree(a_pvMem)
     374# define strdup(a_psz)              RTStrDup(a_psz)
     375
     376#endif
     377
    346378RT_C_DECLS_END
    347379#endif
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette