VirtualBox

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

Last change on this file was 106061, checked in by vboxsync, 3 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
Line 
1/* $Id: VBoxDTraceLibCWrappers.h 106061 2024-09-16 14:03:52Z 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-2024 Oracle and/or its affiliates.
10 *
11 * This file is part of VirtualBox base platform packages, as
12 * available from http://www.virtualbox.org.
13 *
14 * The contents of this file are subject to the terms of the Common
15 * Development and Distribution License Version 1.0 (CDDL) only, as it
16 * comes in the "COPYING.CDDL" file of the VirtualBox distribution.
17 *
18 * SPDX-License-Identifier: CDDL-1.0
19 */
20
21#ifndef VBOX_INCLUDED_SRC_VBoxDTrace_include_VBoxDTraceLibCWrappers_h
22#define VBOX_INCLUDED_SRC_VBoxDTrace_include_VBoxDTraceLibCWrappers_h
23#ifndef RT_WITHOUT_PRAGMA_ONCE
24# pragma once
25#endif
26
27#include <assert.h>
28#include <stdlib.h>
29#include <string.h>
30#ifdef RT_OS_WINDOWS
31# include <process.h>
32#else
33# include <sys/types.h>
34# include <limits.h> /* Workaround for syslimit.h bug in gcc 4.8.3 on gentoo. */
35# ifdef RT_OS_DARWIN
36# include <sys/syslimits.h> /* PATH_MAX */
37# elif !defined(RT_OS_SOLARIS) && !defined(RT_OS_FREEBSD)
38# include <syslimits.h> /* PATH_MAX */
39# endif
40# include <libgen.h> /* basename */
41# include <unistd.h>
42# include <strings.h> /* bzero & bcopy.*/
43#endif
44
45#include <iprt/mem.h>
46#include <iprt/process.h>
47#include <iprt/param.h>
48#include <iprt/alloca.h>
49#include <iprt/assert.h>
50#include <iprt/mem.h>
51#include <iprt/string.h>
52#include <iprt/time.h>
53
54
55#undef gethrtime
56#define gethrtime() RTTimeNanoTS()
57#undef strcasecmp
58#define strcasecmp(a_psz1, a_psz2) RTStrICmp(a_psz1, a_psz2)
59#undef strncasecmp
60#define strncasecmp(a_psz1, a_psz2, a_cch) RTStrNICmp(a_psz1, a_psz2, a_cch)
61#undef strlcpy
62#define strlcpy(a_pszDst, a_pszSrc, a_cbDst) ((void)RTStrCopy(a_pszDst, a_cbDst, a_pszSrc))
63
64#undef assert
65#define assert(expr) Assert(expr)
66
67#undef PATH_MAX
68#define PATH_MAX RTPATH_MAX
69
70#undef getpid
71#define getpid RTProcSelf
72
73#undef basename
74#define basename(a_pszPath) RTPathFilename(a_pszPath)
75
76#undef malloc
77#define malloc(a_cb) RTMemAlloc(a_cb)
78#undef calloc
79#define calloc(a_cItems, a_cb) RTMemAllocZ((size_t)(a_cb) * (a_cItems))
80#undef realloc
81#define realloc(a_pvOld, a_cbNew) RTMemRealloc(a_pvOld, a_cbNew)
82#undef free
83#define free(a_pv) RTMemFree(a_pv)
84
85/* Not using RTStrDup and RTStrNDup here because the allocation won't be freed
86 by RTStrFree and thus may cause trouble when using the efence. */
87#undef strdup
88#define strdup(a_psz) ((char *)RTMemDup(a_psz, strlen(a_psz) + 1))
89#undef strndup
90#define strndup(a_psz, a_cchMax) ((char *)RTMemDupEx(a_psz, RTStrNLen(a_psz, a_cchMax), 1))
91
92/* For various stupid reasons, these are duplicated in VBoxDTraceTypes.h. */
93#undef bcopy
94#define bcopy(a_pSrc, a_pDst, a_cb) ((void)memmove(a_pDst, a_pSrc, a_cb))
95#undef bzero
96#define bzero(a_pDst, a_cb) ((void)memset(a_pDst, 0, a_cb))
97#undef bcmp
98#define bcmp(a_p1, a_p2, a_cb) (memcmp(a_p1, a_p2, a_cb))
99
100#endif /* !VBOX_INCLUDED_SRC_VBoxDTrace_include_VBoxDTraceLibCWrappers_h */
101
Note: See TracBrowser for help on using the repository browser.

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