From f8fe689a81f906d1b91bb3220acde2a4ecb14c5b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 6 May 2024 05:01:46 +0200 Subject: Adding upstream version 6.0.4-dfsg. Signed-off-by: Daniel Baumann --- .../VBoxDTrace/include/VBoxDTraceLibCWrappers.h | 100 +++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 src/VBox/ExtPacks/VBoxDTrace/include/VBoxDTraceLibCWrappers.h (limited to 'src/VBox/ExtPacks/VBoxDTrace/include/VBoxDTraceLibCWrappers.h') diff --git a/src/VBox/ExtPacks/VBoxDTrace/include/VBoxDTraceLibCWrappers.h b/src/VBox/ExtPacks/VBoxDTrace/include/VBoxDTraceLibCWrappers.h new file mode 100644 index 00000000..dc2df3c5 --- /dev/null +++ b/src/VBox/ExtPacks/VBoxDTrace/include/VBoxDTraceLibCWrappers.h @@ -0,0 +1,100 @@ +/* $Id: VBoxDTraceLibCWrappers.h $ */ +/** @file + * VBoxDTraceTLibCWrappers.h - IPRT wrappers/fake for lib C stuff. + * + * Contributed by: bird + */ + +/* + * Copyright (C) 2012-2019 Oracle Corporation + * + * This file is part of VirtualBox Open Source Edition (OSE), as + * available from http://www.virtualbox.org. This file is free software; + * you can redistribute it and/or modify it under the terms of the Common + * Development and Distribution License Version 1.0 (CDDL) only, as it + * comes in the "COPYING.CDDL" file of the VirtualBox OSE distribution. + * VirtualBox OSE is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY of any kind. + */ + +#ifndef VBOX_INCLUDED_SRC_VBoxDTrace_include_VBoxDTraceLibCWrappers_h +#define VBOX_INCLUDED_SRC_VBoxDTrace_include_VBoxDTraceLibCWrappers_h +#ifndef RT_WITHOUT_PRAGMA_ONCE +# pragma once +#endif + +#include +#include +#include +#ifdef RT_OS_WINDOWS +# include +#else +# include +# include /* Workaround for syslimit.h bug in gcc 4.8.3 on gentoo. */ +# ifdef RT_OS_DARWIN +# include /* PATH_MAX */ +# elif !defined(RT_OS_SOLARIS) +# include /* PATH_MAX */ +# endif +# include /* basename */ +# include +# include /* bzero & bcopy.*/ +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + + +#undef gethrtime +#define gethrtime() RTTimeNanoTS() +#undef strcasecmp +#define strcasecmp(a_psz1, a_psz2) RTStrICmp(a_psz1, a_psz2) +#undef strncasecmp +#define strncasecmp(a_psz1, a_psz2, a_cch) RTStrNICmp(a_psz1, a_psz2, a_cch) +#undef strlcpy +#define strlcpy(a_pszDst, a_pszSrc, a_cbDst) ((void)RTStrCopy(a_pszDst, a_cbDst, a_pszSrc)) + +#undef assert +#define assert(expr) Assert(expr) + +#undef PATH_MAX +#define PATH_MAX RTPATH_MAX + +#undef getpid +#define getpid RTProcSelf + +#undef basename +#define basename(a_pszPath) RTPathFilename(a_pszPath) + +#undef malloc +#define malloc(a_cb) RTMemAlloc(a_cb) +#undef calloc +#define calloc(a_cItems, a_cb) RTMemAllocZ((size_t)(a_cb) * (a_cItems)) +#undef realloc +#define realloc(a_pvOld, a_cbNew) RTMemRealloc(a_pvOld, a_cbNew) +#undef free +#define free(a_pv) RTMemFree(a_pv) + +/* Not using RTStrDup and RTStrNDup here because the allocation won't be freed + by RTStrFree and thus may cause trouble when using the efence. */ +#undef strdup +#define strdup(a_psz) ((char *)RTMemDup(a_psz, strlen(a_psz) + 1)) +#undef strndup +#define strndup(a_psz, a_cchMax) ((char *)RTMemDupEx(a_psz, RTStrNLen(a_psz, a_cchMax), 1)) + +/* For various stupid reasons, these are duplicated in VBoxDTraceTypes.h. */ +#undef bcopy +#define bcopy(a_pSrc, a_pDst, a_cb) ((void)memmove(a_pDst, a_pSrc, a_cb)) +#undef bzero +#define bzero(a_pDst, a_cb) ((void)memset(a_pDst, 0, a_cb)) +#undef bcmp +#define bcmp(a_p1, a_p2, a_cb) (memcmp(a_p1, a_p2, a_cb)) + +#endif /* !VBOX_INCLUDED_SRC_VBoxDTrace_include_VBoxDTraceLibCWrappers_h */ + -- cgit v1.2.3