}
+/*
+ *----------------------------------------------------------------------
+ *
+ * File_MakeSafeTempDir --
+ *
+ * Create a temporary directory in a safe area.
+ *
+ * Optional argument 'prefix' specifies the name prefix of the
+ * created directory. When not provided a default will be provided.
+ *
+ * Results:
+ * NULL Failure
+ * !NULL Path name of created directory
+ *
+ * Side effects:
+ * Creates a directory if successful. Errno is set on error
+ *
+ *----------------------------------------------------------------------
+ */
+
+Unicode
+File_MakeSafeTempDir(ConstUnicode prefix) // IN:
+{
+ Unicode result = NULL;
+ Unicode dir = File_GetSafeTmpDir(TRUE);
+
+ if (dir != NULL) {
+ ConstUnicode effectivePrefix = (prefix == NULL) ? "safeDir" : prefix;
+
+ File_MakeTempEx2(dir, FALSE, FileMakeTempExCreateNameFunc,
+ (void *) effectivePrefix, &result);
+
+ Unicode_Free(dir);
+ }
+
+ return result;
+}
+
+
/*
*----------------------------------------------------------------------
*
* File_MakeSafeTemp --
*
- * Exactly the same as File_MakeTemp except uses a safe directory
+ * Exactly the same as File_MakeTempEx except uses a safe directory
* as the default temporary directory.
*
* Results:
*
* Side effects:
* Creates a file if successful.
+ *
*----------------------------------------------------------------------
*/
#include "includeCheck.h"
#include "vm_basic_types.h" // For INLINE.
+#if defined VMKERNEL
+#include "vm_assert.h" // For ASSERT_ON_COMPILE.
+#endif
+
/* Checks for FreeBSD, filtering out VMKERNEL. */
#define __IS_FREEBSD__ (!defined(VMKERNEL) && defined(__FreeBSD__))
#define __IS_FREEBSD_VER__(ver) (__IS_FREEBSD__ && __FreeBSD_version >= (ver))
#define GetReturnAddress() _ReturnAddress()
#elif __GNUC__
#define GetReturnAddress() __builtin_return_address(0)
+
+#if VMKERNEL
+/*
+ * Using __builtin_frame_address(N) and__builtin_return_address(N)
+ * with N >= 1 causes crashes for code compiled without frame pointers.
+ * Use Stackwalk_ReturnAddress(N) instead. Or, to collect a backtrace
+ * fragment, use STACKWALK_STORE_BACKTRACE().
+ */
+#define __builtin_frame_address(N) ({ \
+ ASSERT_ON_COMPILE(N == 0); \
+ __builtin_frame_address(N); \
+ })
+#define __builtin_return_address(N) ({ \
+ ASSERT_ON_COMPILE(N == 0); \
+ __builtin_return_address(N); \
+ })
+#endif
#endif