VirtualBox

source: vbox/trunk/src/VBox/ExtPacks/VBoxDTrace/include/VBoxDTraceLibCWrappers.h@ 53996

最後變更 在這個檔案從53996是 53996,由 vboxsync 提交於 10 年 前

syslimits.h not on solaris?

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 2.6 KB
 
1/* $Id: VBoxDTraceLibCWrappers.h 53996 2015-01-27 23:59:01Z vboxsync $ */
2/** @file
3 * VBoxDTraceTLibCWrappers.h - IPRT wrappers/fake for lib C stuff.
4 *
5 * Contributed by: bird
6 */
7
8/*
9 * Copyright (C) 2012-2015 Oracle Corporation
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.alldomusa.eu.org. This file is free software;
13 * you can redistribute it and/or modify it under the terms of the Common
14 * Development and Distribution License Version 1.0 (CDDL) only, as it
15 * comes in the "COPYING.CDDL" file of the VirtualBox OSE distribution.
16 * VirtualBox OSE is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY of any kind.
18 *
19 */
20
21#ifndef ___VBoxDTraceLibCWrappers_h___
22#define ___VBoxDTraceLibCWrappers_h___
23
24#include <assert.h>
25#include <stdlib.h>
26#include <string.h>
27#ifdef RT_OS_WINDOWS
28# include <process.h>
29#else
30# include <sys/types.h>
31# include <limits.h> /* Workaround for syslimit.h bug in gcc 4.8.3 on gentoo. */
32# ifndef RT_OS_SOLARIS
33# include <syslimits.h> /* PATH_MAX */
34# endif
35# include <libgen.h> /* basename */
36# include <unistd.h>
37# include <strings.h> /* bzero & bcopy.*/
38#endif
39
40#include <iprt/mem.h>
41#include <iprt/process.h>
42#include <iprt/param.h>
43#include <iprt/alloca.h>
44#include <iprt/assert.h>
45#include <iprt/mem.h>
46#include <iprt/string.h>
47#include <iprt/time.h>
48
49
50#undef gethrtime
51#define gethrtime() RTTimeNanoTS()
52#undef strcasecmp
53#define strcasecmp(a_psz1, a_psz2) RTStrICmp(a_psz1, a_psz2)
54#undef strncasecmp
55#define strncasecmp(a_psz1, a_psz2, a_cch) RTStrNICmp(a_psz1, a_psz2, a_cch)
56#undef strlcpy
57#define strlcpy(a_pszDst, a_pszSrc, a_cbDst) ((void)RTStrCopy(a_pszDst, a_cbDst, a_pszSrc))
58
59#undef assert
60#define assert(expr) Assert(expr)
61
62#undef PATH_MAX
63#define PATH_MAX RTPATH_MAX
64
65#undef getpid
66#define getpid RTProcSelf
67
68#undef basename
69#define basename(a_pszPath) RTPathFilename(a_pszPath)
70
71#undef malloc
72#define malloc(a_cb) RTMemAlloc(a_cb)
73#undef calloc
74#define calloc(a_cItems, a_cb) RTMemAllocZ((size_t)(a_cb) * (a_cItems))
75#undef realloc
76#define realloc(a_pvOld, a_cbNew) RTMemRealloc(a_pvOld, a_cbNew)
77#undef free
78#define free(a_pv) RTMemFree(a_pv)
79
80/* Not using RTStrDup and RTStrNDup here because the allocation won't be freed
81 by RTStrFree and thus may cause trouble when using the efence. */
82#undef strdup
83#define strdup(a_psz) ((char *)RTMemDup(a_psz, strlen(a_psz) + 1))
84#undef strndup
85#define strndup(a_psz, a_cchMax) ((char *)RTMemDupEx(a_psz, RTStrNLen(a_psz, a_cchMax), 1))
86
87#endif
88
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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