#
PACKAGE_NAME="vboxguest"
-PACKAGE_VERSION=5.0.0
+PACKAGE_VERSION=5.0.2
AUTOINSTALL=yes
BUILT_MODULE_NAME[0]="vboxguest"
-/* $Id: time.cpp 100874 2015-06-09 14:01:31Z bird $ */\r
+/* $Id: time.cpp 101690 2015-07-18 18:55:25Z bird $ */\r
/** @file\r
* IPRT - Time.\r
*/\r
offUTCHour = -offUTCHour;\r
}\r
cch = RTStrPrintf(psz, cb,\r
- "%RI32-%02u-%02uT%02u:%02u:%02u.%09RU32%c%02%02",\r
+ "%RI32-%02u-%02uT%02u:%02u:%02u.%09RU32%c%02d%02d",\r
pTime->i32Year, pTime->u8Month, pTime->u8MonthDay,\r
pTime->u8Hour, pTime->u8Minute, pTime->u8Second, pTime->u32Nanosecond,\r
chSign, offUTCHour, offUTCMinute);\r
VBGLR3DECL(int) VbglR3GuestPropDisconnect(uint32_t u32ClientId);\r
VBGLR3DECL(int) VbglR3GuestPropWrite(uint32_t u32ClientId, const char *pszName, const char *pszValue, const char *pszFlags);\r
VBGLR3DECL(int) VbglR3GuestPropWriteValue(uint32_t u32ClientId, const char *pszName, const char *pszValue);\r
-VBGLR3DECL(int) VbglR3GuestPropWriteValueV(uint32_t u32ClientId, const char *pszName, const char *pszValueFormat, va_list va);\r
-VBGLR3DECL(int) VbglR3GuestPropWriteValueF(uint32_t u32ClientId, const char *pszName, const char *pszValueFormat, ...);\r
+VBGLR3DECL(int) VbglR3GuestPropWriteValueV(uint32_t u32ClientId, const char *pszName,\r
+ const char *pszValueFormat, va_list va) RT_IPRT_FORMAT_ATTR(3, 0);\r
+VBGLR3DECL(int) VbglR3GuestPropWriteValueF(uint32_t u32ClientId, const char *pszName,\r
+ const char *pszValueFormat, ...) RT_IPRT_FORMAT_ATTR(3, 4);\r
VBGLR3DECL(int) VbglR3GuestPropRead(uint32_t u32ClientId, const char *pszName, void *pvBuf, uint32_t cbBuf, char **ppszValue, uint64_t *pu64Timestamp, char **ppszFlags, uint32_t *pcbBufActual);\r
VBGLR3DECL(int) VbglR3GuestPropReadValue(uint32_t ClientId, const char *pszName, char *pszValue, uint32_t cchValue, uint32_t *pcchValueActual);\r
VBGLR3DECL(int) VbglR3GuestPropReadValueAlloc(uint32_t u32ClientId, const char *pszName, char **ppszValue);\r
#define VERR_VMM_SWITCHER_STUB (-2715)\r
/** HM returned in the wrong state. */\r
#define VERR_VMM_WRONG_HM_VMCPU_STATE (-2716)\r
+/** SMAP enabled, but the AC flag was found to be clear - check the kernel\r
+ * log for details. */\r
+#define VERR_VMM_SMAP_BUT_AC_CLEAR (-2717)\r
/** @} */\r
\r
\r
#define VERR_VD_DMG_XML_PARSE_ERROR (-3284)\r
/** Unable to locate a usable DMG file within the XAR archive. */\r
#define VERR_VD_DMG_NOT_FOUND_INSIDE_XAR (-3285)\r
+/** The size of the raw image is not dividable by 512 */\r
+#define VERR_VD_RAW_SIZE_MODULO_512 (-3286)\r
+/** The size of the raw image is not dividable by 2048 */\r
+#define VERR_VD_RAW_SIZE_MODULO_2048 (-3287)\r
+/** The size of the raw optical image is too small (<= 32K) */\r
+#define VERR_VD_RAW_SIZE_OPTICAL_TOO_SMALL (-3288)\r
+/** The size of the raw floppy image is too big (>2.88MB) */\r
+#define VERR_VD_RAW_SIZE_FLOPPY_TOO_BIG (-3289)\r
+\r
/** @} */\r
\r
\r
#define VWRN_SUPDRV_TSC_DELTA_MEASUREMENT_FAILED 3746\r
/** A TSC-delta measurement request is currently being serviced. */\r
#define VERR_SUPDRV_TSC_DELTA_MEASUREMENT_BUSY (-3747)\r
+/** The process trying to open VBoxDrv is not a budding VM process (1). */\r
+#define VERR_SUPDRV_NOT_BUDDING_VM_PROCESS_1 (-3748)\r
+/** The process trying to open VBoxDrv is not a budding VM process (2). */\r
+#define VERR_SUPDRV_NOT_BUDDING_VM_PROCESS_2 (-3749)\r
/** @} */\r
\r
\r
/** Internal VMX processing error no 5. */\r
#define VERR_VMX_IPE_5 (-4027)\r
/** VT-x features for all modes (SMX and non-SMX) disabled by the BIOS. */\r
-#define VERR_VMX_MSR_ALL_VMXON_DISABLED (-4028)\r
+#define VERR_VMX_MSR_ALL_VMX_DISABLED (-4028)\r
/** VT-x features disabled by the BIOS. */\r
-#define VERR_VMX_MSR_VMXON_DISABLED (-4029)\r
+#define VERR_VMX_MSR_VMX_DISABLED (-4029)\r
/** VM-Entry Controls internal cache invalid. */\r
#define VERR_VMX_ENTRY_CTLS_CACHE_INVALID (-4030)\r
/** VM-Exit Controls internal cache invalid. */\r
/** VM-Execution Secondary Processor-based Controls internal\r
* cache invalid. */\r
#define VERR_VMX_PROC_EXEC2_CTLS_CACHE_INVALID (-4034)\r
+/** Failed to set VMXON enable bit while enabling VT-x through the MSR. */\r
+#define VERR_VMX_MSR_VMX_ENABLE_FAILED (-4035)\r
+/** Failed to enable VMXON-in-SMX bit while enabling VT-x through the MSR. */\r
+#define VERR_VMX_MSR_SMX_VMX_ENABLE_FAILED (-4036)\r
/** @} */\r
\r
\r
\r
\r
/**\r
+ * Modifies the [RE]FLAGS register.\r
+ * @returns Original value.\r
+ * @param fAndEfl Flags to keep (applied first).\r
+ * @param fOrEfl Flags to be set.\r
+ */\r
+#if RT_INLINE_ASM_EXTERNAL && RT_INLINE_ASM_USES_INTRIN < 15\r
+DECLASM(RTCCUINTREG) ASMChangeFlags(RTCCUINTREG fAndEfl, RTCCUINTREG fOrEfl);\r
+#else\r
+DECLINLINE(RTCCUINTREG) ASMChangeFlags(RTCCUINTREG fAndEfl, RTCCUINTREG fOrEfl)\r
+{\r
+ RTCCUINTREG fOldEfl;\r
+# if RT_INLINE_ASM_GNU_STYLE\r
+# ifdef RT_ARCH_AMD64\r
+ __asm__ __volatile__("pushfq\n\t"\r
+ "movq (%%rsp), %0\n\t"\r
+ "andq %0, %1\n\t"\r
+ "orq %3, %1\n\t"\r
+ "mov %1, (%%rsp)\n\t"\r
+ "popfq\n\t"\r
+ : "=&r" (fOldEfl),\r
+ "=r" (fAndEfl)\r
+ : "1" (fAndEfl),\r
+ "rn" (fOrEfl) );\r
+# else\r
+ __asm__ __volatile__("pushfl\n\t"\r
+ "movl (%%esp), %0\n\t"\r
+ "andl %1, (%%esp)\n\t"\r
+ "orl %2, (%%esp)\n\t"\r
+ "popfl\n\t"\r
+ : "=&r" (fOldEfl)\r
+ : "rn" (fAndEfl),\r
+ "rn" (fOrEfl) );\r
+# endif\r
+# elif RT_INLINE_ASM_USES_INTRIN >= 15\r
+ fOldEfl = __readeflags();\r
+ __writeeflags((fOldEfl & fAndEfl) | fOrEfl);\r
+# else\r
+ __asm\r
+ {\r
+# ifdef RT_ARCH_AMD64\r
+ mov rdx, [fAndEfl]\r
+ mov rcx, [fOrEfl]\r
+ pushfq\r
+ mov rax, [rsp]\r
+ and rdx, rax\r
+ or rdx, rcx\r
+ mov [rsp], rdx\r
+ popfq\r
+ mov [fOldEfl], rax\r
+# else\r
+ mov edx, [fAndEfl]\r
+ mov ecx, [fOrEfl]\r
+ pushfd\r
+ mov eax, [esp]\r
+ and edx, eax\r
+ or edx, ecx\r
+ mov [esp], edx\r
+ popfd\r
+ mov [fOldEfl], eax\r
+# endif\r
+ }\r
+# endif\r
+ return fOldEfl;\r
+}\r
+#endif\r
+\r
+\r
+/**\r
+ * Modifies the [RE]FLAGS register by ORing in one or more flags.\r
+ * @returns Original value.\r
+ * @param fOrEfl The flags to be set (ORed in).\r
+ */\r
+#if RT_INLINE_ASM_EXTERNAL && RT_INLINE_ASM_USES_INTRIN < 15\r
+DECLASM(RTCCUINTREG) ASMAddFlags(RTCCUINTREG fOrEfl);\r
+#else\r
+DECLINLINE(RTCCUINTREG) ASMAddFlags(RTCCUINTREG fOrEfl)\r
+{\r
+ RTCCUINTREG fOldEfl;\r
+# if RT_INLINE_ASM_GNU_STYLE\r
+# ifdef RT_ARCH_AMD64\r
+ __asm__ __volatile__("pushfq\n\t"\r
+ "movq (%%rsp), %0\n\t"\r
+ "orq %1, (%%rsp)\n\t"\r
+ "popfq\n\t"\r
+ : "=&r" (fOldEfl)\r
+ : "rn" (fOrEfl) );\r
+# else\r
+ __asm__ __volatile__("pushfl\n\t"\r
+ "movl (%%esp), %0\n\t"\r
+ "orl %1, (%%esp)\n\t"\r
+ "popfl\n\t"\r
+ : "=&r" (fOldEfl)\r
+ : "rn" (fOrEfl) );\r
+# endif\r
+# elif RT_INLINE_ASM_USES_INTRIN >= 15\r
+ fOldEfl = __readeflags();\r
+ __writeeflags(fOldEfl | fOrEfl);\r
+# else\r
+ __asm\r
+ {\r
+# ifdef RT_ARCH_AMD64\r
+ mov rcx, [fOrEfl]\r
+ pushfq\r
+ mov rdx, [rsp]\r
+ or [rsp], rcx\r
+ popfq\r
+ mov [fOldEfl], rax\r
+# else\r
+ mov ecx, [fOrEfl]\r
+ pushfd\r
+ mov edx, [esp]\r
+ or [esp], ecx\r
+ popfd\r
+ mov [fOldEfl], eax\r
+# endif\r
+ }\r
+# endif\r
+ return fOldEfl;\r
+}\r
+#endif\r
+\r
+\r
+/**\r
+ * Modifies the [RE]FLAGS register by AND'ing out one or more flags.\r
+ * @returns Original value.\r
+ * @param fAndEfl The flags to keep.\r
+ */\r
+#if RT_INLINE_ASM_EXTERNAL && RT_INLINE_ASM_USES_INTRIN < 15\r
+DECLASM(RTCCUINTREG) ASMClearFlags(RTCCUINTREG fAndEfl);\r
+#else\r
+DECLINLINE(RTCCUINTREG) ASMClearFlags(RTCCUINTREG fAndEfl)\r
+{\r
+ RTCCUINTREG fOldEfl;\r
+# if RT_INLINE_ASM_GNU_STYLE\r
+# ifdef RT_ARCH_AMD64\r
+ __asm__ __volatile__("pushfq\n\t"\r
+ "movq (%%rsp), %0\n\t"\r
+ "andq %1, (%%rsp)\n\t"\r
+ "popfq\n\t"\r
+ : "=&r" (fOldEfl)\r
+ : "rn" (fAndEfl) );\r
+# else\r
+ __asm__ __volatile__("pushfl\n\t"\r
+ "movl (%%esp), %0\n\t"\r
+ "andl %1, (%%esp)\n\t"\r
+ "popfl\n\t"\r
+ : "=&r" (fOldEfl)\r
+ : "rn" (fAndEfl) );\r
+# endif\r
+# elif RT_INLINE_ASM_USES_INTRIN >= 15\r
+ fOldEfl = __readeflags();\r
+ __writeeflags(fOldEfl & fAndEfl);\r
+# else\r
+ __asm\r
+ {\r
+# ifdef RT_ARCH_AMD64\r
+ mov rdx, [fAndEfl]\r
+ pushfq\r
+ mov rdx, [rsp]\r
+ and [rsp], rdx\r
+ popfq\r
+ mov [fOldEfl], rax\r
+# else\r
+ mov edx, [fAndEfl]\r
+ pushfd\r
+ mov edx, [esp]\r
+ and [esp], edx\r
+ popfd\r
+ mov [fOldEfl], eax\r
+# endif\r
+ }\r
+# endif\r
+ return fOldEfl;\r
+}\r
+#endif\r
+\r
+\r
+/**\r
* Gets the content of the CPU timestamp counter register.\r
*\r
* @returns TSC.\r
* @param pszFormat Printf like format string.\r
* @param ... Arguments to that string.\r
*/\r
-RTDECL(void) RTAssertMsg2(const char *pszFormat, ...);\r
+RTDECL(void) RTAssertMsg2(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);\r
/**\r
* Weak version of RTAssertMsg2 that forwards to RTAssertMsg2WeakV.\r
*\r
*\r
* @copydoc RTAssertMsg2\r
*/\r
-RTDECL(void) RTAssertMsg2Weak(const char *pszFormat, ...);\r
+RTDECL(void) RTAssertMsg2Weak(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);\r
\r
/**\r
* The 2nd (optional) part of an assert message.\r
* @param pszFormat Printf like format string.\r
* @param va Arguments to that string.\r
*/\r
-RTDECL(void) RTAssertMsg2V(const char *pszFormat, va_list va);\r
+RTDECL(void) RTAssertMsg2V(const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(1, 0);\r
/**\r
* Weak version of RTAssertMsg2V that can be overridden locally in a module to\r
* modify, redirect or otherwise mess with the assertion output.\r
*\r
* @copydoc RTAssertMsg2V\r
*/\r
-RTDECL(void) RTAssertMsg2WeakV(const char *pszFormat, va_list va);\r
+RTDECL(void) RTAssertMsg2WeakV(const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(1, 0);\r
\r
/**\r
* Additional information which should be appended to the 2nd part of an\r
* @param pszFormat Printf like format string.\r
* @param ... Arguments to that string.\r
*/\r
-RTDECL(void) RTAssertMsg2Add(const char *pszFormat, ...);\r
+RTDECL(void) RTAssertMsg2Add(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);\r
/**\r
* Weak version of RTAssertMsg2Add that forwards to RTAssertMsg2AddWeakV.\r
*\r
*\r
* @copydoc RTAssertMsg2Add\r
*/\r
-RTDECL(void) RTAssertMsg2AddWeak(const char *pszFormat, ...);\r
+RTDECL(void) RTAssertMsg2AddWeak(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);\r
\r
/**\r
* Additional information which should be appended to the 2nd part of an\r
* @param pszFormat Printf like format string.\r
* @param va Arguments to that string.\r
*/\r
-RTDECL(void) RTAssertMsg2AddV(const char *pszFormat, va_list va);\r
+RTDECL(void) RTAssertMsg2AddV(const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(1, 0);\r
/**\r
* Weak version of RTAssertMsg2AddV that can be overridden locally in a module\r
* to modify, redirect or otherwise mess with the assertion output.\r
*\r
* @copydoc RTAssertMsg2AddV\r
*/\r
-RTDECL(void) RTAssertMsg2AddWeakV(const char *pszFormat, va_list va);\r
+RTDECL(void) RTAssertMsg2AddWeakV(const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(1, 0);\r
\r
#ifdef IN_RING0\r
/**\r
# define RT_THROW(type)\r
#endif\r
\r
+/** @def RT_IPRT_FORMAT_ATTR\r
+ * Identifies a function taking an IPRT format string.\r
+ * @param a_iFmt The index (1-based) of the format string argument.\r
+ * @param a_iArgs The index (1-based) of the first format argument, use 0 for\r
+ * va_list.\r
+ */\r
+#if defined(__GNUC__) && defined(WITH_IPRT_FORMAT_ATTRIBUTE)\r
+# define RT_IPRT_FORMAT_ATTR(a_iFmt, a_iArgs) __attribute__((__iprt_format__(a_iFmt, a_iArgs)))\r
+#else\r
+# define RT_IPRT_FORMAT_ATTR(a_iFmt, a_iArgs)\r
+#endif\r
+\r
+/** @def RT_IPRT_FORMAT_ATTR_MAYBE_NULL\r
+ * Identifies a function taking an IPRT format string, NULL is allowed.\r
+ * @param a_iFmt The index (1-based) of the format string argument.\r
+ * @param a_iArgs The index (1-based) of the first format argument, use 0 for\r
+ * va_list.\r
+ */\r
+#if defined(__GNUC__) && defined(WITH_IPRT_FORMAT_ATTRIBUTE)\r
+# define RT_IPRT_FORMAT_ATTR_MAYBE_NULL(a_iFmt, a_iArgs) __attribute__((__iprt_format_maybe_null__(a_iFmt, a_iArgs)))\r
+#else\r
+# define RT_IPRT_FORMAT_ATTR_MAYBE_NULL(a_iFmt, a_iArgs)\r
+#endif\r
+\r
+\r
/** @def RT_GCC_SUPPORTS_VISIBILITY_HIDDEN\r
* Indicates that the "hidden" visibility attribute can be used (GCC) */\r
#if defined(__GNUC__)\r
* @param pszFormat The format string.\r
* @param ... The format arguments.\r
*/\r
-RTDECL(int) RTErrInfoSetF(PRTERRINFO pErrInfo, int rc, const char *pszFormat, ...);\r
+RTDECL(int) RTErrInfoSetF(PRTERRINFO pErrInfo, int rc, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(3, 4);\r
\r
/**\r
* Fills in the error info details, with a vsprintf style message.\r
* @param pszFormat The format string.\r
* @param va The format arguments.\r
*/\r
-RTDECL(int) RTErrInfoSetV(PRTERRINFO pErrInfo, int rc, const char *pszFormat, va_list va);\r
+RTDECL(int) RTErrInfoSetV(PRTERRINFO pErrInfo, int rc, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(3, 0);\r
\r
/**\r
* Adds more error info details.\r
* @param pszFormat The format string to add.\r
* @param ... The format arguments.\r
*/\r
-RTDECL(int) RTErrInfoAddF(PRTERRINFO pErrInfo, int rc, const char *pszFormat, ...);\r
+RTDECL(int) RTErrInfoAddF(PRTERRINFO pErrInfo, int rc, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(3, 4);\r
\r
/**\r
* Adds more error info details, with a vsprintf style message.\r
* @param pszFormat The format string to add.\r
* @param va The format arguments.\r
*/\r
-RTDECL(int) RTErrInfoAddV(PRTERRINFO pErrInfo, int rc, const char *pszFormat, va_list va);\r
+RTDECL(int) RTErrInfoAddV(PRTERRINFO pErrInfo, int rc, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(3, 0);\r
\r
/**\r
* Checks if the error info is set.\r
* @param pszFormat IPRT format string.\r
* @param ... Format arguments.\r
*/\r
-typedef DECLCALLBACK(void) FNRTHEAPSIMPLEPRINTF(const char *pszFormat, ...);\r
+typedef DECLCALLBACK(void) FNRTHEAPSIMPLEPRINTF(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);\r
/** Pointer to a FNRTHEAPSIMPLEPRINTF function. */\r
typedef FNRTHEAPSIMPLEPRINTF *PFNRTHEAPSIMPLEPRINTF;\r
\r
* @param pszFormat IPRT format string.\r
* @param ... Format arguments.\r
*/\r
-typedef DECLCALLBACK(void) FNRTHEAPOFFSETPRINTF(const char *pszFormat, ...);\r
+typedef DECLCALLBACK(void) FNRTHEAPOFFSETPRINTF(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);\r
/** Pointer to a FNRTHEAPOFFSETPRINTF function. */\r
typedef FNRTHEAPOFFSETPRINTF *PFNRTHEAPOFFSETPRINTF;\r
\r
* optional (NULL). Max length is 32 bytes.\r
* @param ... Format string arguments.\r
*/\r
-RTDECL(void) RTLockValidatorRecExclInit(PRTLOCKVALRECEXCL pRec, RTLOCKVALCLASS hClass, uint32_t uSubClass,\r
- void *hLock, bool fEnabled, const char *pszNameFmt, ...);\r
+RTDECL(void) RTLockValidatorRecExclInit(PRTLOCKVALRECEXCL pRec, RTLOCKVALCLASS hClass, uint32_t uSubClass, void *hLock,\r
+ bool fEnabled, const char *pszNameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(6, 7);\r
/**\r
* Initialize a lock validator record.\r
*\r
* optional (NULL). Max length is 32 bytes.\r
* @param va Format string arguments.\r
*/\r
-RTDECL(void) RTLockValidatorRecExclInitV(PRTLOCKVALRECEXCL pRec, RTLOCKVALCLASS hClass, uint32_t uSubClass,\r
- void *hLock, bool fEnabled, const char *pszNameFmt, va_list va);\r
+RTDECL(void) RTLockValidatorRecExclInitV(PRTLOCKVALRECEXCL pRec, RTLOCKVALCLASS hClass, uint32_t uSubClass, void *hLock,\r
+ bool fEnabled, const char *pszNameFmt, va_list va) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(6, 0);\r
/**\r
* Uninitialize a lock validator record previously initialized by\r
* RTLockRecValidatorInit.\r
* optional (NULL). Max length is 32 bytes.\r
* @param ... Format string arguments.\r
*/\r
-RTDECL(int) RTLockValidatorRecExclCreate(PRTLOCKVALRECEXCL *ppRec, RTLOCKVALCLASS hClass, uint32_t uSubClass,\r
- void *hLock, bool fEnabled, const char *pszNameFmt, ...);\r
+RTDECL(int) RTLockValidatorRecExclCreate(PRTLOCKVALRECEXCL *ppRec, RTLOCKVALCLASS hClass, uint32_t uSubClass, void *hLock,\r
+ bool fEnabled, const char *pszNameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(6, 7);\r
\r
/**\r
* Create and initialize a lock validator record.\r
* optional (NULL). Max length is 32 bytes.\r
* @param va Format string arguments.\r
*/\r
-RTDECL(int) RTLockValidatorRecExclCreateV(PRTLOCKVALRECEXCL *ppRec, RTLOCKVALCLASS hClass, uint32_t uSubClass,\r
- void *hLock, bool fEnabled, const char *pszNameFmt, va_list va);\r
+RTDECL(int) RTLockValidatorRecExclCreateV(PRTLOCKVALRECEXCL *ppRec, RTLOCKVALCLASS hClass, uint32_t uSubClass, void *hLock,\r
+ bool fEnabled, const char *pszNameFmt, va_list va) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(6, 0);\r
\r
/**\r
* Deinitialize and destroy a record created by RTLockValidatorRecExclCreate.\r
* @param ... Format string arguments.\r
*/\r
RTDECL(void) RTLockValidatorRecSharedInit(PRTLOCKVALRECSHRD pRec, RTLOCKVALCLASS hClass, uint32_t uSubClass,\r
- void *hLock, bool fSignaller, bool fEnabled, const char *pszNameFmt, ...);\r
+ void *hLock, bool fSignaller, bool fEnabled,\r
+ const char *pszNameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(7, 8);\r
\r
/**\r
* Initialize a lock validator record for a shared lock.\r
* @param va Format string arguments.\r
*/\r
RTDECL(void) RTLockValidatorRecSharedInitV(PRTLOCKVALRECSHRD pRec, RTLOCKVALCLASS hClass, uint32_t uSubClass,\r
- void *hLock, bool fSignaller, bool fEnabled, const char *pszNameFmt, va_list va);\r
+ void *hLock, bool fSignaller, bool fEnabled,\r
+ const char *pszNameFmt, va_list va) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(7, 0);\r
\r
/**\r
* Uninitialize a lock validator record previously initialized by\r
* @param ... Format string arguments.\r
*/\r
RTDECL(int) RTLockValidatorRecSharedCreate(PRTLOCKVALRECSHRD *ppRec, RTLOCKVALCLASS hClass, uint32_t uSubClass,\r
- void *pvLock, bool fSignaller, bool fEnabled, const char *pszNameFmt, ...);\r
+ void *pvLock, bool fSignaller, bool fEnabled,\r
+ const char *pszNameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(7, 8);\r
\r
/**\r
* Create and initialize a lock validator record for a shared lock.\r
* @param va Format string arguments.\r
*/\r
RTDECL(int) RTLockValidatorRecSharedCreateV(PRTLOCKVALRECSHRD *ppRec, RTLOCKVALCLASS hClass, uint32_t uSubClass,\r
- void *pvLock, bool fSignaller, bool fEnabled, const char *pszNameFmt, va_list va);\r
+ void *pvLock, bool fSignaller, bool fEnabled,\r
+ const char *pszNameFmt, va_list va) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(7, 0);\r
\r
/**\r
* Deinitialize and destroy a record created by RTLockValidatorRecSharedCreate.\r
RTDECL(int) RTLockValidatorClassCreateEx(PRTLOCKVALCLASS phClass, PCRTLOCKVALSRCPOS pSrcPos,\r
bool fAutodidact, bool fRecursionOk, bool fStrictReleaseOrder,\r
RTMSINTERVAL cMsMinDeadlock, RTMSINTERVAL cMsMinOrder,\r
- const char *pszNameFmt, ...);\r
+ const char *pszNameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(8, 9);\r
\r
/**\r
* Creates a new lock validator class, all properties specified.\r
RTDECL(int) RTLockValidatorClassCreateExV(PRTLOCKVALCLASS phClass, PCRTLOCKVALSRCPOS pSrcPos,\r
bool fAutodidact, bool fRecursionOk, bool fStrictReleaseOrder,\r
RTMSINTERVAL cMsMinDeadlock, RTMSINTERVAL cMsMinOrder,\r
- const char *pszNameFmt, va_list va);\r
+ const char *pszNameFmt, va_list va) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(8, 0);\r
\r
/**\r
* Creates a new lock validator class.\r
* length is 32 bytes.\r
* @param ... Format string arguments.\r
*/\r
-RTDECL(int) RTLockValidatorClassCreate(PRTLOCKVALCLASS phClass, bool fAutodidact, RT_SRC_POS_DECL, const char *pszNameFmt, ...);\r
+RTDECL(int) RTLockValidatorClassCreate(PRTLOCKVALCLASS phClass, bool fAutodidact, RT_SRC_POS_DECL,\r
+ const char *pszNameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(6, 7);\r
\r
/**\r
* Creates a new lock validator class with a reference that is consumed by the\r
* length is 32 bytes.\r
* @param ... Format string arguments.\r
*/\r
-RTDECL(RTLOCKVALCLASS) RTLockValidatorClassCreateUnique(RT_SRC_POS_DECL, const char *pszNameFmt, ...);\r
+RTDECL(RTLOCKVALCLASS) RTLockValidatorClassCreateUnique(RT_SRC_POS_DECL,\r
+ const char *pszNameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(4, 5);\r
\r
/**\r
* Finds a class for the specified source position.\r
* length is 32 bytes.\r
* @param ... Format string arguments.\r
*/\r
-RTDECL(RTLOCKVALCLASS) RTLockValidatorClassForSrcPos(RT_SRC_POS_DECL, const char *pszNameFmt, ...);\r
+RTDECL(RTLOCKVALCLASS) RTLockValidatorClassForSrcPos(RT_SRC_POS_DECL,\r
+ const char *pszNameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(4, 5);\r
\r
/**\r
* Retains a reference to a lock validator class.\r
* @param pszFormat Format string.\r
* @param ... Optional arguments as specified in the format string.\r
*/\r
-typedef DECLCALLBACK(void) FNRTLOGGER(const char *pszFormat, ...);\r
+typedef DECLCALLBACK(void) FNRTLOGGER(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);\r
/** Pointer to logger function. */\r
typedef FNRTLOGGER *PFNRTLOGGER;\r
\r
* @param pszFormat Format string.\r
* @param ... Optional arguments specified in the format string.\r
*/\r
-typedef DECLCALLBACK(void) FNRTLOGPHASEMSG(PRTLOGGER pLogger, const char *pszFormat, ...);\r
+typedef DECLCALLBACK(void) FNRTLOGPHASEMSG(PRTLOGGER pLogger, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(2, 3);\r
/** Pointer to header/footer message callback function. */\r
typedef FNRTLOGPHASEMSG *PFNRTLOGPHASEMSG;\r
\r
} RTLOGDEST;\r
\r
\r
-RTDECL(void) RTLogPrintfEx(void *pvInstance, unsigned fFlags, unsigned iGroup, const char *pszFormat, ...);\r
+RTDECL(void) RTLogPrintfEx(void *pvInstance, unsigned fFlags, unsigned iGroup,\r
+ const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(4, 5);\r
\r
\r
#ifdef DOXYGEN_RUNNING\r
* @param ... Format arguments.\r
* @remark This is a worker function for LogRelIt.\r
*/\r
-RTDECL(void) RTLogRelLogger(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup, const char *pszFormat, ...);\r
+RTDECL(void) RTLogRelLogger(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup,\r
+ const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(4, 5);\r
\r
/**\r
* Write to a logger instance, defaulting to the release one.\r
* @param pszFormat Format string.\r
* @param args Format arguments.\r
*/\r
-RTDECL(void) RTLogRelLoggerV(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup, const char *pszFormat, va_list args);\r
+RTDECL(void) RTLogRelLoggerV(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup,\r
+ const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR(4, 0);\r
\r
/**\r
* printf like function for writing to the default release log.\r
*\r
* @remark The API doesn't support formatting of floating point numbers at the moment.\r
*/\r
-RTDECL(void) RTLogRelPrintf(const char *pszFormat, ...);\r
+RTDECL(void) RTLogRelPrintf(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);\r
\r
/**\r
* vprintf like function for writing to the default release log.\r
*\r
* @remark The API doesn't support formatting of floating point numbers at the moment.\r
*/\r
-RTDECL(void) RTLogRelPrintfV(const char *pszFormat, va_list args);\r
+RTDECL(void) RTLogRelPrintfV(const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR(1, 0);\r
\r
/**\r
* Changes the buffering setting of the default release logger.\r
*/\r
RTDECL(int) RTLogCreate(PRTLOGGER *ppLogger, uint32_t fFlags, const char *pszGroupSettings,\r
const char *pszEnvVarBase, unsigned cGroups, const char * const * papszGroups,\r
- uint32_t fDestFlags, const char *pszFilenameFmt, ...);\r
+ uint32_t fDestFlags, const char *pszFilenameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(8, 9);\r
\r
/**\r
* Create a logger instance.\r
RTDECL(int) RTLogCreateEx(PRTLOGGER *ppLogger, uint32_t fFlags, const char *pszGroupSettings,\r
const char *pszEnvVarBase, unsigned cGroups, const char * const * papszGroups,\r
uint32_t fDestFlags, PFNRTLOGPHASE pfnPhase, uint32_t cHistory,\r
- uint64_t cbHistoryFileMax, uint32_t cSecsHistoryTimeSlot,\r
- char *pszErrorMsg, size_t cchErrorMsg, const char *pszFilenameFmt, ...);\r
+ uint64_t cbHistoryFileMax, uint32_t cSecsHistoryTimeSlot, char *pszErrorMsg, size_t cchErrorMsg,\r
+ const char *pszFilenameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(14, 15);\r
\r
/**\r
* Create a logger instance.\r
RTDECL(int) RTLogCreateExV(PRTLOGGER *ppLogger, uint32_t fFlags, const char *pszGroupSettings,\r
const char *pszEnvVarBase, unsigned cGroups, const char * const * papszGroups,\r
uint32_t fDestFlags, PFNRTLOGPHASE pfnPhase, uint32_t cHistory,\r
- uint64_t cbHistoryFileMax, uint32_t cSecsHistoryTimeSlot,\r
- char *pszErrorMsg, size_t cchErrorMsg, const char *pszFilenameFmt, va_list args);\r
+ uint64_t cbHistoryFileMax, uint32_t cSecsHistoryTimeSlot, char *pszErrorMsg, size_t cchErrorMsg,\r
+ const char *pszFilenameFmt, va_list args) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(14, 0);\r
\r
/**\r
* Create a logger instance for singled threaded ring-0 usage.\r
* @param pszFormat Format string.\r
* @param ... Format arguments.\r
*/\r
-RTDECL(void) RTLogLogger(PRTLOGGER pLogger, void *pvCallerRet, const char *pszFormat, ...);\r
+RTDECL(void) RTLogLogger(PRTLOGGER pLogger, void *pvCallerRet, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(3, 4);\r
\r
/**\r
* Write to a logger instance.\r
* @param pszFormat Format string.\r
* @param args Format arguments.\r
*/\r
-RTDECL(void) RTLogLoggerV(PRTLOGGER pLogger, const char *pszFormat, va_list args);\r
+RTDECL(void) RTLogLoggerV(PRTLOGGER pLogger, const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR(3, 0);\r
\r
/**\r
* Write to a logger instance.\r
* @param ... Format arguments.\r
* @remark This is a worker function of LogIt.\r
*/\r
-RTDECL(void) RTLogLoggerEx(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup, const char *pszFormat, ...);\r
+RTDECL(void) RTLogLoggerEx(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup,\r
+ const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(4, 5);\r
\r
/**\r
* Write to a logger instance.\r
* @param pszFormat Format string.\r
* @param args Format arguments.\r
*/\r
-RTDECL(void) RTLogLoggerExV(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup, const char *pszFormat, va_list args);\r
+RTDECL(void) RTLogLoggerExV(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup,\r
+ const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR(4, 0);\r
\r
/**\r
* printf like function for writing to the default log.\r
*\r
* @remark The API doesn't support formatting of floating point numbers at the moment.\r
*/\r
-RTDECL(void) RTLogPrintf(const char *pszFormat, ...);\r
+RTDECL(void) RTLogPrintf(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);\r
\r
/**\r
* vprintf like function for writing to the default log.\r
*\r
* @remark The API doesn't support formatting of floating point numbers at the moment.\r
*/\r
-RTDECL(void) RTLogPrintfV(const char *pszFormat, va_list args);\r
+RTDECL(void) RTLogPrintfV(const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR(1, 0);\r
\r
/**\r
* Dumper vprintf-like function outputting to a logger.\r
* @param pszFormat Format string.\r
* @param va Format arguments.\r
*/\r
-RTDECL(void) RTLogDumpPrintfV(void *pvUser, const char *pszFormat, va_list va);\r
+RTDECL(void) RTLogDumpPrintfV(void *pvUser, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(2, 0);\r
\r
\r
#ifndef DECLARED_FNRTSTROUTPUT /* duplicated in iprt/string.h */\r
* @param pszFormat Format string.\r
* @param args Argument list.\r
*/\r
-RTDECL(size_t) RTLogFormatV(PFNRTSTROUTPUT pfnOutput, void *pvArg, const char *pszFormat, va_list args);\r
+RTDECL(size_t) RTLogFormatV(PFNRTSTROUTPUT pfnOutput, void *pvArg, const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR(3, 0);\r
\r
/**\r
* Write log buffer to COM port.\r
* @param pszFormat Format string.\r
* @param ... Optional arguments specified in the format string.\r
*/\r
-RTDECL(size_t) RTLogComPrintf(const char *pszFormat, ...);\r
+RTDECL(size_t) RTLogComPrintf(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);\r
\r
/**\r
* Prints a formatted string to the serial port used for logging.\r
* @param pszFormat Format string.\r
* @param args Optional arguments specified in the format string.\r
*/\r
-RTDECL(size_t) RTLogComPrintfV(const char *pszFormat, va_list args);\r
+RTDECL(size_t) RTLogComPrintfV(const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR(1, 0);\r
\r
\r
#if 0 /* not implemented yet */\r
* @param pszFormat Format string.\r
* @param ... Optional arguments specified in the format string.\r
*/\r
-RTDECL(size_t) RTLogBackdoorPrintf(const char *pszFormat, ...);\r
+RTDECL(size_t) RTLogBackdoorPrintf(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);\r
\r
/**\r
* Prints a formatted string to the backdoor port.\r
* @param pszFormat Format string.\r
* @param args Optional arguments specified in the format string.\r
*/\r
-RTDECL(size_t) RTLogBackdoorPrintfV(const char *pszFormat, va_list args);\r
+RTDECL(size_t) RTLogBackdoorPrintfV(const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR(1, 0);\r
\r
#endif /* VBOX */\r
\r
# define RTSymlinkIsDangling RT_MANGLER(RTSymlinkIsDangling)\r
# define RTSymlinkRead RT_MANGLER(RTSymlinkRead)\r
# define RTSymlinkReadA RT_MANGLER(RTSymlinkReadA)\r
+# define RTSystemIsInsideVM RT_MANGLER(RTSystemIsInsideVM)\r
# define RTSystemQueryAvailableRam RT_MANGLER(RTSystemQueryAvailableRam)\r
# define RTSystemQueryDmiString RT_MANGLER(RTSystemQueryDmiString)\r
# define RTSystemQueryOSInfo RT_MANGLER(RTSystemQueryOSInfo)\r
* optional (NULL). Max length is 32 bytes.\r
* @param ... Format string arguments.\r
*/\r
-RTDECL(int) RTSemEventCreateEx(PRTSEMEVENT phEventSem, uint32_t fFlags, RTLOCKVALCLASS hClass, const char *pszNameFmt, ...);\r
+RTDECL(int) RTSemEventCreateEx(PRTSEMEVENT phEventSem, uint32_t fFlags, RTLOCKVALCLASS hClass,\r
+ const char *pszNameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(4, 5);\r
\r
/** @name RTSemMutexCreateEx flags\r
* @{ */\r
* @param ... Format string arguments.\r
*/\r
RTDECL(int) RTSemEventMultiCreateEx(PRTSEMEVENTMULTI phEventMultiSem, uint32_t fFlags, RTLOCKVALCLASS hClass,\r
- const char *pszNameFmt, ...);\r
+ const char *pszNameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(4, 5);\r
\r
/** @name RTSemMutexCreateEx flags\r
* @{ */\r
* optional (NULL). Max length is 32 bytes.\r
* @param ... Format string arguments.\r
*/\r
-RTDECL(int) RTSemMutexCreateEx(PRTSEMMUTEX phMutexSem, uint32_t fFlags,\r
- RTLOCKVALCLASS hClass, uint32_t uSubClass, const char *pszNameFmt, ...);\r
+RTDECL(int) RTSemMutexCreateEx(PRTSEMMUTEX phMutexSem, uint32_t fFlags, RTLOCKVALCLASS hClass, uint32_t uSubClass,\r
+ const char *pszNameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(5, 6);\r
\r
/** @name RTSemMutexCreateEx flags\r
* @{ */\r
* optional (NULL). Max length is 32 bytes.\r
* @param ... Format string arguments.\r
*/\r
-RTDECL(int) RTSemRWCreateEx(PRTSEMRW phRWSem, uint32_t fFlags,\r
- RTLOCKVALCLASS hClass, uint32_t uSubClass, const char *pszNameFmt, ...);\r
+RTDECL(int) RTSemRWCreateEx(PRTSEMRW phRWSem, uint32_t fFlags, RTLOCKVALCLASS hClass, uint32_t uSubClass,\r
+ const char *pszNameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(5, 6);\r
\r
/** @name RTSemRWCreateEx flags\r
* @{ */\r
#include <iprt/err.h> /* for VINF_SUCCESS */\r
#if defined(RT_OS_LINUX) && defined(__KERNEL__)\r
RT_C_DECLS_BEGIN\r
+# define new newhack /* string.h: strreplace */\r
# include <linux/string.h>\r
+# undef new\r
RT_C_DECLS_END\r
\r
#elif defined(IN_XF86_MODULE) && !defined(NO_ANSIC)\r
* @param pszFormat Pointer to the format string, @see pg_rt_str_format.\r
* @param InArgs Argument list.\r
*/\r
-RTDECL(size_t) RTStrFormatV(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, PFNSTRFORMAT pfnFormat, void *pvArgFormat, const char *pszFormat, va_list InArgs);\r
+RTDECL(size_t) RTStrFormatV(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, PFNSTRFORMAT pfnFormat, void *pvArgFormat,\r
+ const char *pszFormat, va_list InArgs) RT_IPRT_FORMAT_ATTR(5, 0);\r
\r
/**\r
* Partial implementation of a printf like formatter.\r
* @param pszFormat Pointer to the format string, @see pg_rt_str_format.\r
* @param ... Argument list.\r
*/\r
-RTDECL(size_t) RTStrFormat(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, PFNSTRFORMAT pfnFormat, void *pvArgFormat, const char *pszFormat, ...);\r
+RTDECL(size_t) RTStrFormat(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, PFNSTRFORMAT pfnFormat, void *pvArgFormat,\r
+ const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(5, 6);\r
\r
/**\r
* Formats an integer number according to the parameters.\r
* @param cchPrecision Precision.\r
* @param fFlags Flags, RTSTR_F_XXX.\r
*/\r
-RTDECL(int) RTStrFormatNumber(char *psz, uint64_t u64Value, unsigned int uiBase, signed int cchWidth, signed int cchPrecision, unsigned int fFlags);\r
+RTDECL(int) RTStrFormatNumber(char *psz, uint64_t u64Value, unsigned int uiBase, signed int cchWidth, signed int cchPrecision,\r
+ unsigned int fFlags);\r
\r
/**\r
* Formats an unsigned 8-bit number.\r
* @param pszFormat Pointer to the format string, @see pg_rt_str_format.\r
* @param args The format argument.\r
*/\r
-RTDECL(size_t) RTStrPrintfV(char *pszBuffer, size_t cchBuffer, const char *pszFormat, va_list args);\r
+RTDECL(size_t) RTStrPrintfV(char *pszBuffer, size_t cchBuffer, const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR(3, 0);\r
\r
/**\r
* String printf.\r
* @param pszFormat Pointer to the format string, @see pg_rt_str_format.\r
* @param ... The format argument.\r
*/\r
-RTDECL(size_t) RTStrPrintf(char *pszBuffer, size_t cchBuffer, const char *pszFormat, ...);\r
+RTDECL(size_t) RTStrPrintf(char *pszBuffer, size_t cchBuffer, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(3, 4);\r
\r
\r
/**\r
* @param pszFormat Pointer to the format string, @see pg_rt_str_format.\r
* @param args The format argument.\r
*/\r
-RTDECL(size_t) RTStrPrintfExV(PFNSTRFORMAT pfnFormat, void *pvArg, char *pszBuffer, size_t cchBuffer, const char *pszFormat, va_list args);\r
+RTDECL(size_t) RTStrPrintfExV(PFNSTRFORMAT pfnFormat, void *pvArg, char *pszBuffer, size_t cchBuffer,\r
+ const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR(5, 0);\r
\r
/**\r
* String printf with custom formatting.\r
* @param pszFormat Pointer to the format string, @see pg_rt_str_format.\r
* @param ... The format argument.\r
*/\r
-RTDECL(size_t) RTStrPrintfEx(PFNSTRFORMAT pfnFormat, void *pvArg, char *pszBuffer, size_t cchBuffer, const char *pszFormat, ...);\r
+RTDECL(size_t) RTStrPrintfEx(PFNSTRFORMAT pfnFormat, void *pvArg, char *pszBuffer, size_t cchBuffer,\r
+ const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(5, 6);\r
\r
\r
/**\r
* @param args The format argument.\r
* @param pszTag Allocation tag used for statistics and such.\r
*/\r
-RTDECL(int) RTStrAPrintfVTag(char **ppszBuffer, const char *pszFormat, va_list args, const char *pszTag);\r
+RTDECL(int) RTStrAPrintfVTag(char **ppszBuffer, const char *pszFormat, va_list args, const char *pszTag) RT_IPRT_FORMAT_ATTR(2, 0);\r
\r
/**\r
* Allocating string printf.\r
* @param pszFormat Pointer to the format string, @see pg_rt_str_format.\r
* @param ... The format argument.\r
*/\r
-DECLINLINE(int) RTStrAPrintf(char **ppszBuffer, const char *pszFormat, ...)\r
+DECLINLINE(int) RT_IPRT_FORMAT_ATTR(2, 3) RTStrAPrintf(char **ppszBuffer, const char *pszFormat, ...)\r
{\r
int cbRet;\r
va_list va;\r
* @param pszFormat Pointer to the format string, @see pg_rt_str_format.\r
* @param ... The format argument.\r
*/\r
-DECLINLINE(int) RTStrAPrintfTag(char **ppszBuffer, const char *pszTag, const char *pszFormat, ...)\r
+DECLINLINE(int) RT_IPRT_FORMAT_ATTR(3, 4) RTStrAPrintfTag(char **ppszBuffer, const char *pszTag, const char *pszFormat, ...)\r
{\r
int cbRet;\r
va_list va;\r
* @param args The format argument.\r
* @param pszTag Allocation tag used for statistics and such.\r
*/\r
-RTDECL(char *) RTStrAPrintf2VTag(const char *pszFormat, va_list args, const char *pszTag);\r
+RTDECL(char *) RTStrAPrintf2VTag(const char *pszFormat, va_list args, const char *pszTag) RT_IPRT_FORMAT_ATTR(1, 0);\r
\r
/**\r
* Allocating string printf, version 2 (default tag).\r
* @param pszFormat Pointer to the format string, @see pg_rt_str_format.\r
* @param ... The format argument.\r
*/\r
-DECLINLINE(char *) RTStrAPrintf2(const char *pszFormat, ...)\r
+DECLINLINE(char *) RT_IPRT_FORMAT_ATTR(1, 2) RTStrAPrintf2(const char *pszFormat, ...)\r
{\r
char *pszRet;\r
va_list va;\r
* @param pszFormat Pointer to the format string, @see pg_rt_str_format.\r
* @param ... The format argument.\r
*/\r
-DECLINLINE(char *) RTStrAPrintf2Tag(const char *pszTag, const char *pszFormat, ...)\r
+DECLINLINE(char *) RT_IPRT_FORMAT_ATTR(2, 3) RTStrAPrintf2Tag(const char *pszTag, const char *pszFormat, ...)\r
{\r
char *pszRet;\r
va_list va;\r
* @param va Format arguments.\r
*/\r
RTDECL(int) RTThreadCreateV(PRTTHREAD pThread, PFNRTTHREAD pfnThread, void *pvUser, size_t cbStack,\r
- RTTHREADTYPE enmType, uint32_t fFlags, const char *pszNameFmt, va_list va);\r
+ RTTHREADTYPE enmType, uint32_t fFlags, const char *pszNameFmt, va_list va) RT_IPRT_FORMAT_ATTR(7, 0);\r
\r
/**\r
* Create a new thread.\r
* @param ... Format arguments.\r
*/\r
RTDECL(int) RTThreadCreateF(PRTTHREAD pThread, PFNRTTHREAD pfnThread, void *pvUser, size_t cbStack,\r
- RTTHREADTYPE enmType, uint32_t fFlags, const char *pszNameFmt, ...);\r
+ RTTHREADTYPE enmType, uint32_t fFlags, const char *pszNameFmt, ...) RT_IPRT_FORMAT_ATTR(7, 8);\r
\r
/**\r
* Gets the native thread id of a IPRT thread.\r
# endif\r
# include <sys/types.h>\r
# ifndef offsetof\r
-# error "offsetof is not defined..."\r
+# error "offsetof is not defined!"\r
# endif\r
\r
# elif defined(RT_OS_FREEBSD) && HC_ARCH_BITS == 64 && defined(RT_ARCH_X86)\r
* @param pszFormat The format string.\r
* @param va Arguments for the format string.\r
*/\r
-typedef DECLCALLBACK(void) FNRTDUMPPRINTFV(void *pvUser, const char *pszFormat, va_list va);\r
+typedef DECLCALLBACK(void) FNRTDUMPPRINTFV(void *pvUser, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(2, 0);\r
/** Pointer to a generic printf-like function for dumping. */\r
typedef FNRTDUMPPRINTFV *PFNRTDUMPPRINTFV;\r
\r
*/\r
typedef union RTPTRUNION\r
{\r
- /** Pointer into the void... */\r
+ /** Pointer into the void. */\r
void *pv;\r
/** As a signed integer. */\r
intptr_t i;\r
*/\r
typedef union RTCPTRUNION\r
{\r
- /** Pointer into the void... */\r
+ /** Pointer into the void. */\r
void const *pv;\r
/** As a signed integer. */\r
intptr_t i;\r
*/\r
typedef union RTVPTRUNION\r
{\r
- /** Pointer into the void... */\r
+ /** Pointer into the void. */\r
void volatile *pv;\r
/** As a signed integer. */\r
intptr_t i;\r
*/\r
typedef union RTCVPTRUNION\r
{\r
- /** Pointer into the void... */\r
+ /** Pointer into the void. */\r
void const volatile *pv;\r
/** As a signed integer. */\r
intptr_t i;\r
-/* $Id: RTLogWriteDebugger-r0drv-linux.c 100874 2015-06-09 14:01:31Z bird $ */\r
+/* $Id: RTLogWriteDebugger-r0drv-linux.c 102031 2015-08-11 14:39:19Z bird $ */\r
/** @file\r
* IPRT - Log To Debugger, Ring-0 Driver, Linux.\r
*/\r
\r
RTDECL(void) RTLogWriteDebugger(const char *pch, size_t cb)\r
{\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
printk("%.*s", (int)cb, pch);\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
}\r
RT_EXPORT_SYMBOL(RTLogWriteDebugger);\r
\r
-/* $Id: alloc-r0drv-linux.c 100874 2015-06-09 14:01:31Z bird $ */\r
+/* $Id: alloc-r0drv-linux.c 102053 2015-08-12 13:43:38Z fmehnert $ */\r
/** @file\r
* IPRT - Memory Allocation, Ring-0 Driver, Linux.\r
*/\r
DECLHIDDEN(int) rtR0MemAllocEx(size_t cb, uint32_t fFlags, PRTMEMHDR *ppHdr)\r
{\r
PRTMEMHDR pHdr;\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
\r
/*\r
* Allocate.\r
pHdr = vmalloc(cb + sizeof(*pHdr));\r
}\r
if (RT_UNLIKELY(!pHdr))\r
+ {\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VERR_NO_MEMORY;\r
+ }\r
\r
/*\r
* Initialize.\r
pHdr->cbReq = cb;\r
\r
*ppHdr = pHdr;\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VINF_SUCCESS;\r
}\r
\r
*/\r
DECLHIDDEN(void) rtR0MemFree(PRTMEMHDR pHdr)\r
{\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
+\r
pHdr->u32Magic += 1;\r
if (pHdr->fFlags & RTMEMHDR_FLAG_KMALLOC)\r
kfree(pHdr);\r
#endif\r
else\r
vfree(pHdr);\r
+\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
}\r
\r
\r
int cOrder;\r
unsigned cPages;\r
struct page *paPages;\r
+ void *pvRet;\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
\r
/*\r
* validate input.\r
#endif\r
}\r
*pPhys = page_to_phys(paPages);\r
- return phys_to_virt(page_to_phys(paPages));\r
+ pvRet = phys_to_virt(page_to_phys(paPages));\r
}\r
+ else\r
+ pvRet = NULL;\r
\r
- return NULL;\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
+ return pvRet;\r
}\r
RT_EXPORT_SYMBOL(RTMemContAlloc);\r
\r
unsigned cPages;\r
unsigned iPage;\r
struct page *paPages;\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
\r
/* validate */\r
AssertMsg(!((uintptr_t)pv & PAGE_OFFSET_MASK), ("pv=%p\n", pv));\r
#endif\r
}\r
__free_pages(paPages, cOrder);\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
}\r
}\r
RT_EXPORT_SYMBOL(RTMemContFree);\r
-/* $Id: assert-r0drv-linux.c 100874 2015-06-09 14:01:31Z bird $ */\r
+/* $Id: assert-r0drv-linux.c 102031 2015-08-11 14:39:19Z bird $ */\r
/** @file\r
* IPRT - Assertion Workers, Ring-0 Drivers, Linux.\r
*/\r
\r
DECLHIDDEN(void) rtR0AssertNativeMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)\r
{\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
printk(KERN_EMERG\r
"\r\n!!Assertion Failed!!\r\n"\r
"Expression: %s\r\n"\r
"Location : %s(%d) %s\r\n",\r
pszExpr, pszFile, uLine, pszFunction);\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
}\r
\r
\r
DECLHIDDEN(void) rtR0AssertNativeMsg2V(bool fInitial, const char *pszFormat, va_list va)\r
{\r
char szMsg[256];\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
\r
RTStrPrintfV(szMsg, sizeof(szMsg) - 1, pszFormat, va);\r
szMsg[sizeof(szMsg) - 1] = '\0';\r
printk(KERN_EMERG "%s", szMsg);\r
\r
NOREF(fInitial);\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
}\r
\r
\r
-/* $Id: initterm-r0drv-linux.c 100874 2015-06-09 14:01:31Z bird $ */\r
+/* $Id: initterm-r0drv-linux.c 102031 2015-08-11 14:39:19Z bird $ */\r
/** @file\r
* IPRT - Initialization & Termination, R0 Driver, Linux.\r
*/\r
*/\r
DECLHIDDEN(void) rtR0LnxWorkqueuePush(RTR0LNXWORKQUEUEITEM *pWork, void (*pfnWorker)(RTR0LNXWORKQUEUEITEM *))\r
{\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
+\r
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 41)\r
# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 20)\r
INIT_WORK(pWork, pfnWorker);\r
INIT_TQUEUE(pWork, (void (*)(void *))pfnWorker, pWork);\r
queue_task(pWork, &g_rtR0LnxWorkQueue);\r
#endif\r
+\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
}\r
\r
\r
*/\r
DECLHIDDEN(void) rtR0LnxWorkqueueFlush(void)\r
{\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
+\r
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 41)\r
flush_workqueue(g_prtR0LnxWorkQueue);\r
#else\r
run_task_queue(&g_rtR0LnxWorkQueue);\r
#endif\r
+\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
}\r
\r
\r
DECLHIDDEN(int) rtR0InitNative(void)\r
{\r
+ int rc = VINF_SUCCESS;\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
+\r
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 41)\r
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)\r
g_prtR0LnxWorkQueue = create_workqueue("iprt-VBoxWQueue");\r
g_prtR0LnxWorkQueue = create_workqueue("iprt-VBoxQ");\r
#endif\r
if (!g_prtR0LnxWorkQueue)\r
- return VERR_NO_MEMORY;\r
+ rc = VERR_NO_MEMORY;\r
#endif\r
\r
- return VINF_SUCCESS;\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
+ return rc;\r
}\r
\r
\r
DECLHIDDEN(void) rtR0TermNative(void)\r
{\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
+\r
rtR0LnxWorkqueueFlush();\r
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 41)\r
destroy_workqueue(g_prtR0LnxWorkQueue);\r
#endif\r
\r
rtR0MemExecCleanup();\r
+\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
}\r
\r
-/* $Id: memobj-r0drv-linux.c 100874 2015-06-09 14:01:31Z bird $ */\r
+/* $Id: memobj-r0drv-linux.c 102031 2015-08-11 14:39:19Z bird $ */\r
/** @file\r
* IPRT - Ring-0 Memory Objects, Linux.\r
*/\r
\r
DECLHIDDEN(int) rtR0MemObjNativeFree(RTR0MEMOBJ pMem)\r
{\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
PRTR0MEMOBJLNX pMemLnx = (PRTR0MEMOBJLNX)pMem;\r
\r
/*\r
AssertMsgFailed(("enmType=%d\n", pMemLnx->Core.enmType));\r
return VERR_INTERNAL_ERROR;\r
}\r
+ IPRT_LINUX_RESTORE_EFL_ONLY_AC();\r
return VINF_SUCCESS;\r
}\r
\r
\r
DECLHIDDEN(int) rtR0MemObjNativeAllocPage(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)\r
{\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
PRTR0MEMOBJLNX pMemLnx;\r
int rc;\r
\r
if (RT_SUCCESS(rc))\r
{\r
*ppMem = &pMemLnx->Core;\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return rc;\r
}\r
\r
rtR0MemObjDelete(&pMemLnx->Core);\r
}\r
\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return rc;\r
}\r
\r
\r
DECLHIDDEN(int) rtR0MemObjNativeAllocLow(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)\r
{\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
PRTR0MEMOBJLNX pMemLnx;\r
int rc;\r
\r
if (RT_SUCCESS(rc))\r
{\r
*ppMem = &pMemLnx->Core;\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return rc;\r
}\r
\r
rtR0MemObjDelete(&pMemLnx->Core);\r
}\r
\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return rc;\r
}\r
\r
\r
DECLHIDDEN(int) rtR0MemObjNativeAllocCont(PPRTR0MEMOBJINTERNAL ppMem, size_t cb, bool fExecutable)\r
{\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
PRTR0MEMOBJLNX pMemLnx;\r
int rc;\r
\r
#endif\r
pMemLnx->Core.u.Cont.Phys = page_to_phys(pMemLnx->apPages[0]);\r
*ppMem = &pMemLnx->Core;\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return rc;\r
}\r
\r
rtR0MemObjDelete(&pMemLnx->Core);\r
}\r
\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return rc;\r
}\r
\r
size_t cb, size_t uAlignment, RTHCPHYS PhysHighest)\r
{\r
int rc;\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
\r
/*\r
* There are two clear cases and that's the <=16MB and anything-goes ones.\r
/* ZONE_DMA: 0-16MB */\r
rc = rtR0MemObjLinuxAllocPhysSub2(ppMem, enmType, cb, uAlignment, PhysHighest, GFP_DMA);\r
}\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return rc;\r
}\r
\r
\r
DECLHIDDEN(int) rtR0MemObjNativeEnterPhys(PPRTR0MEMOBJINTERNAL ppMem, RTHCPHYS Phys, size_t cb, uint32_t uCachePolicy)\r
{\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
+\r
/*\r
* All we need to do here is to validate that we can use\r
* ioremap on the specified address (32/64-bit dma_addr_t).\r
\r
pMemLnx = (PRTR0MEMOBJLNX)rtR0MemObjNew(sizeof(*pMemLnx), RTR0MEMOBJTYPE_PHYS, NULL, cb);\r
if (!pMemLnx)\r
+ {\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VERR_NO_MEMORY;\r
+ }\r
\r
pMemLnx->Core.u.Phys.PhysBase = PhysAddr;\r
pMemLnx->Core.u.Phys.fAllocated = false;\r
pMemLnx->Core.u.Phys.uCachePolicy = uCachePolicy;\r
Assert(!pMemLnx->cPages);\r
*ppMem = &pMemLnx->Core;\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VINF_SUCCESS;\r
}\r
\r
\r
DECLHIDDEN(int) rtR0MemObjNativeLockUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3Ptr, size_t cb, uint32_t fAccess, RTR0PROCESS R0Process)\r
{\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
const int cPages = cb >> PAGE_SHIFT;\r
struct task_struct *pTask = rtR0ProcessToLinuxTask(R0Process);\r
struct vm_area_struct **papVMAs;\r
*/\r
pMemLnx = (PRTR0MEMOBJLNX)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJLNX, apPages[cPages]), RTR0MEMOBJTYPE_LOCK, (void *)R3Ptr, cb);\r
if (!pMemLnx)\r
+ {\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VERR_NO_MEMORY;\r
+ }\r
\r
papVMAs = (struct vm_area_struct **)RTMemAlloc(sizeof(*papVMAs) * cPages);\r
if (papVMAs)\r
Assert(!pMemLnx->fMappedToRing0);\r
*ppMem = &pMemLnx->Core;\r
\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VINF_SUCCESS;\r
}\r
\r
}\r
\r
rtR0MemObjDelete(&pMemLnx->Core);\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return rc;\r
}\r
\r
\r
DECLHIDDEN(int) rtR0MemObjNativeLockKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pv, size_t cb, uint32_t fAccess)\r
{\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
void *pvLast = (uint8_t *)pv + cb - 1;\r
size_t const cPages = cb >> PAGE_SHIFT;\r
PRTR0MEMOBJLNX pMemLnx;\r
*/\r
pMemLnx = (PRTR0MEMOBJLNX)rtR0MemObjNew(RT_OFFSETOF(RTR0MEMOBJLNX, apPages[cPages]), RTR0MEMOBJTYPE_LOCK, pv, cb);\r
if (!pMemLnx)\r
+ {\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VERR_NO_MEMORY;\r
+ }\r
\r
/*\r
* Gather the pages.\r
Assert(!pMemLnx->fMappedToRing0);\r
*ppMem = &pMemLnx->Core;\r
\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VINF_SUCCESS;\r
}\r
\r
rtR0MemObjDelete(&pMemLnx->Core);\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return rc;\r
}\r
\r
DECLHIDDEN(int) rtR0MemObjNativeReserveKernel(PPRTR0MEMOBJINTERNAL ppMem, void *pvFixed, size_t cb, size_t uAlignment)\r
{\r
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 22)\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
const size_t cPages = cb >> PAGE_SHIFT;\r
struct page *pDummyPage;\r
struct page **papPages;\r
* the dummy page is mapped all over the reserved area.\r
*/\r
pDummyPage = alloc_page(GFP_HIGHUSER | __GFP_NOWARN);\r
- if (!pDummyPage)\r
- return VERR_NO_MEMORY;\r
- papPages = RTMemAlloc(sizeof(*papPages) * cPages);\r
- if (papPages)\r
+ if (pDummyPage)\r
{\r
- void *pv;\r
- size_t iPage = cPages;\r
- while (iPage-- > 0)\r
- papPages[iPage] = pDummyPage;\r
+ papPages = RTMemAlloc(sizeof(*papPages) * cPages);\r
+ if (papPages)\r
+ {\r
+ void *pv;\r
+ size_t iPage = cPages;\r
+ while (iPage-- > 0)\r
+ papPages[iPage] = pDummyPage;\r
# ifdef VM_MAP\r
- pv = vmap(papPages, cPages, VM_MAP, PAGE_KERNEL_RO);\r
+ pv = vmap(papPages, cPages, VM_MAP, PAGE_KERNEL_RO);\r
# else\r
- pv = vmap(papPages, cPages, VM_ALLOC, PAGE_KERNEL_RO);\r
+ pv = vmap(papPages, cPages, VM_ALLOC, PAGE_KERNEL_RO);\r
# endif\r
- RTMemFree(papPages);\r
- if (pv)\r
- {\r
- PRTR0MEMOBJLNX pMemLnx = (PRTR0MEMOBJLNX)rtR0MemObjNew(sizeof(*pMemLnx), RTR0MEMOBJTYPE_RES_VIRT, pv, cb);\r
- if (pMemLnx)\r
+ RTMemFree(papPages);\r
+ if (pv)\r
{\r
- pMemLnx->Core.u.ResVirt.R0Process = NIL_RTR0PROCESS;\r
- pMemLnx->cPages = 1;\r
- pMemLnx->apPages[0] = pDummyPage;\r
- *ppMem = &pMemLnx->Core;\r
- return VINF_SUCCESS;\r
+ PRTR0MEMOBJLNX pMemLnx = (PRTR0MEMOBJLNX)rtR0MemObjNew(sizeof(*pMemLnx), RTR0MEMOBJTYPE_RES_VIRT, pv, cb);\r
+ if (pMemLnx)\r
+ {\r
+ pMemLnx->Core.u.ResVirt.R0Process = NIL_RTR0PROCESS;\r
+ pMemLnx->cPages = 1;\r
+ pMemLnx->apPages[0] = pDummyPage;\r
+ *ppMem = &pMemLnx->Core;\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
+ return VINF_SUCCESS;\r
+ }\r
+ vunmap(pv);\r
}\r
- vunmap(pv);\r
}\r
+ __free_page(pDummyPage);\r
}\r
- __free_page(pDummyPage);\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VERR_NO_MEMORY;\r
\r
#else /* < 2.4.22 */\r
\r
DECLHIDDEN(int) rtR0MemObjNativeReserveUser(PPRTR0MEMOBJINTERNAL ppMem, RTR3PTR R3PtrFixed, size_t cb, size_t uAlignment, RTR0PROCESS R0Process)\r
{\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
PRTR0MEMOBJLNX pMemLnx;\r
void *pv;\r
struct task_struct *pTask = rtR0ProcessToLinuxTask(R0Process);\r
*/\r
pv = rtR0MemObjLinuxDoMmap(R3PtrFixed, cb, uAlignment, pTask, RTMEM_PROT_NONE);\r
if (pv == (void *)-1)\r
+ {\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VERR_NO_MEMORY;\r
+ }\r
\r
pMemLnx = (PRTR0MEMOBJLNX)rtR0MemObjNew(sizeof(*pMemLnx), RTR0MEMOBJTYPE_RES_VIRT, pv, cb);\r
if (!pMemLnx)\r
{\r
rtR0MemObjLinuxDoMunmap(pv, cb, pTask);\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VERR_NO_MEMORY;\r
}\r
\r
pMemLnx->Core.u.ResVirt.R0Process = R0Process;\r
*ppMem = &pMemLnx->Core;\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VINF_SUCCESS;\r
}\r
\r
int rc = VERR_NO_MEMORY;\r
PRTR0MEMOBJLNX pMemLnxToMap = (PRTR0MEMOBJLNX)pMemToMap;\r
PRTR0MEMOBJLNX pMemLnx;\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
\r
/* Fail if requested to do something we can't. */\r
AssertMsgReturn(!offSub && !cbSub, ("%#x %#x\n", offSub, cbSub), VERR_NOT_SUPPORTED);\r
{\r
pMemLnx->Core.u.Mapping.R0Process = NIL_RTR0PROCESS;\r
*ppMem = &pMemLnx->Core;\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VINF_SUCCESS;\r
}\r
rtR0MemObjDelete(&pMemLnx->Core);\r
}\r
\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return rc;\r
}\r
\r
struct page *pDummyPage;\r
RTHCPHYS DummyPhys;\r
#endif\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
\r
/*\r
* Check for restrictions.\r
*/\r
pDummyPage = alloc_page(GFP_USER | __GFP_NOWARN);\r
if (!pDummyPage)\r
+ {\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VERR_NO_MEMORY;\r
+ }\r
SetPageReserved(pDummyPage);\r
DummyPhys = page_to_phys(pDummyPage);\r
#endif\r
pMemLnx->Core.pv = pv;\r
pMemLnx->Core.u.Mapping.R0Process = R0Process;\r
*ppMem = &pMemLnx->Core;\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VINF_SUCCESS;\r
}\r
\r
__free_page(pDummyPage);\r
#endif\r
\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return rc;\r
}\r
\r
-/* $Id: memuserkernel-r0drv-linux.c 100874 2015-06-09 14:01:31Z bird $ */\r
+/* $Id: memuserkernel-r0drv-linux.c 102031 2015-08-11 14:39:19Z bird $ */\r
/** @file\r
* IPRT - User & Kernel Memory, Ring-0 Driver, Linux.\r
*/\r
\r
RTR0DECL(int) RTR0MemUserCopyFrom(void *pvDst, RTR3PTR R3PtrSrc, size_t cb)\r
{\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
if (RT_LIKELY(copy_from_user(pvDst, (void *)R3PtrSrc, cb) == 0))\r
+ {\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VINF_SUCCESS;\r
+ }\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VERR_ACCESS_DENIED;\r
}\r
RT_EXPORT_SYMBOL(RTR0MemUserCopyFrom);\r
\r
RTR0DECL(int) RTR0MemUserCopyTo(RTR3PTR R3PtrDst, void const *pvSrc, size_t cb)\r
{\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
if (RT_LIKELY(copy_to_user((void *)R3PtrDst, pvSrc, cb) == 0))\r
+ {\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VINF_SUCCESS;\r
+ }\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VERR_ACCESS_DENIED;\r
}\r
RT_EXPORT_SYMBOL(RTR0MemUserCopyTo);\r
\r
RTR0DECL(bool) RTR0MemUserIsValidAddr(RTR3PTR R3Ptr)\r
{\r
- return access_ok(VERIFY_READ, (void *)R3Ptr, 1);\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
+ bool fRc = access_ok(VERIFY_READ, (void *)R3Ptr, 1);\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
+ return fRc;\r
}\r
RT_EXPORT_SYMBOL(RTR0MemUserIsValidAddr);\r
\r
# endif\r
# endif /* !_ASM_EXTABLE */\r
int rc;\r
+ IPRT_LINUX_SAVE_EFL_AC(); /* paranoia */\r
if (!cb)\r
return VINF_SUCCESS;\r
\r
"2" (pvSrc),\r
"3" (cb)\r
: "memory");\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return rc;\r
#else\r
return VERR_NOT_SUPPORTED;\r
-/* $Id: mp-r0drv-linux.c 100874 2015-06-09 14:01:31Z bird $ */\r
+/* $Id: mp-r0drv-linux.c 102031 2015-08-11 14:39:19Z bird $ */\r
/** @file\r
* IPRT - Multiprocessor, Ring-0 Driver, Linux.\r
*/\r
\r
RTDECL(int) RTMpOnAll(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)\r
{\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
int rc;\r
RTMPARGS Args;\r
RTCPUSET OnlineSet;\r
}\r
\r
RTThreadPreemptRestore(&PreemptState);\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VINF_SUCCESS;\r
}\r
RT_EXPORT_SYMBOL(RTMpOnAll);\r
\r
RTDECL(int) RTMpOnOthers(PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)\r
{\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
int rc;\r
RTMPARGS Args;\r
\r
RTThreadPreemptRestore(&PreemptState);\r
\r
Assert(rc == 0); NOREF(rc);\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VINF_SUCCESS;\r
}\r
RT_EXPORT_SYMBOL(RTMpOnOthers);\r
\r
RTDECL(int) RTMpOnPair(RTCPUID idCpu1, RTCPUID idCpu2, uint32_t fFlags, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)\r
{\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
int rc;\r
RTTHREADPREEMPTSTATE PreemptState = RTTHREADPREEMPTSTATE_INITIALIZER;\r
\r
else\r
rc = VERR_CPU_NOT_FOUND;\r
RTThreadPreemptRestore(&PreemptState);;\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return rc;\r
}\r
RT_EXPORT_SYMBOL(RTMpOnPair);\r
\r
RTDECL(int) RTMpOnSpecific(RTCPUID idCpu, PFNRTMPWORKER pfnWorker, void *pvUser1, void *pvUser2)\r
{\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
int rc;\r
RTMPARGS Args;\r
\r
RTThreadPreemptRestore(&PreemptState);;\r
\r
NOREF(rc);\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return rc;\r
}\r
RT_EXPORT_SYMBOL(RTMpOnSpecific);\r
{\r
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)\r
int rc;\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
\r
if (!RTMpIsCpuPossible(idCpu))\r
return VERR_CPU_NOT_FOUND;\r
# endif /* older kernels */\r
NOREF(rc);\r
Assert(rc == 0);\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VINF_SUCCESS;\r
\r
#else /* older kernels */\r
-/* $Id: mpnotification-r0drv-linux.c 99004 2015-03-17 11:15:47Z fmehnert $ */\r
+/* $Id: mpnotification-r0drv-linux.c 102031 2015-08-11 14:39:19Z bird $ */\r
/** @file\r
* IPRT - Multiprocessor Event Notifications, Ring-0 Driver, Linux.\r
*/\r
DECLHIDDEN(int) rtR0MpNotificationNativeInit(void)\r
{\r
int rc;\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
\r
# ifdef CPU_DOWN_FAILED\r
RTCpuSetEmpty(&g_MpPendingOfflineSet);\r
# endif\r
\r
rc = register_cpu_notifier(&g_NotifierBlock);\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
AssertMsgReturn(!rc, ("%d\n", rc), RTErrConvertFromErrno(rc));\r
return VINF_SUCCESS;\r
}\r
\r
DECLHIDDEN(void) rtR0MpNotificationNativeTerm(void)\r
{\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
unregister_cpu_notifier(&g_NotifierBlock);\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
}\r
\r
#else /* Not supported / Not needed */\r
-/* $Id: semevent-r0drv-linux.c 100874 2015-06-09 14:01:31Z bird $ */\r
+/* $Id: semevent-r0drv-linux.c 102031 2015-08-11 14:39:19Z bird $ */\r
/** @file\r
* IPRT - Single Release Event Semaphores, Ring-0 Driver, Linux.\r
*/\r
RTDECL(int) RTSemEventCreateEx(PRTSEMEVENT phEventSem, uint32_t fFlags, RTLOCKVALCLASS hClass, const char *pszNameFmt, ...)\r
{\r
PRTSEMEVENTINTERNAL pThis;\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
\r
AssertReturn(!(fFlags & ~(RTSEMEVENT_FLAGS_NO_LOCK_VAL | RTSEMEVENT_FLAGS_BOOTSTRAP_HACK)), VERR_INVALID_PARAMETER);\r
Assert(!(fFlags & RTSEMEVENT_FLAGS_BOOTSTRAP_HACK) || (fFlags & RTSEMEVENT_FLAGS_NO_LOCK_VAL));\r
init_waitqueue_head(&pThis->Head);\r
\r
*phEventSem = pThis;\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VINF_SUCCESS;\r
}\r
RT_EXPORT_SYMBOL(RTSemEventCreate);\r
\r
RTDECL(int) RTSemEventDestroy(RTSEMEVENT hEventSem)\r
{\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
+\r
/*\r
* Validate input.\r
*/\r
Assert(!waitqueue_active(&pThis->Head));\r
wake_up_all(&pThis->Head);\r
rtR0SemEventLnxRelease(pThis);\r
+\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VINF_SUCCESS;\r
}\r
RT_EXPORT_SYMBOL(RTSemEventDestroy);\r
\r
RTDECL(int) RTSemEventSignal(RTSEMEVENT hEventSem)\r
{\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
+\r
/*\r
* Validate input.\r
*/\r
wake_up(&pThis->Head);\r
\r
rtR0SemEventLnxRelease(pThis);\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VINF_SUCCESS;\r
}\r
RT_EXPORT_SYMBOL(RTSemEventSignal);\r
/*\r
* We have to wait.\r
*/\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
RTR0SEMLNXWAIT Wait;\r
rc = rtR0SemLnxWaitInit(&Wait, fFlags, uTimeout, &pThis->Head);\r
if (RT_SUCCESS(rc))\r
rtR0SemLnxWaitDelete(&Wait);\r
IPRT_DEBUG_SEMS_STATE_RC(pThis, 'E', rc);\r
}\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
}\r
\r
rtR0SemEventLnxRelease(pThis);\r
-/* $Id: semeventmulti-r0drv-linux.c 100874 2015-06-09 14:01:31Z bird $ */\r
+/* $Id: semeventmulti-r0drv-linux.c 102031 2015-08-11 14:39:19Z bird $ */\r
/** @file\r
* IPRT - Multiple Release Event Semaphores, Ring-0 Driver, Linux.\r
*/\r
const char *pszNameFmt, ...)\r
{\r
PRTSEMEVENTMULTIINTERNAL pThis;\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
\r
AssertReturn(!(fFlags & ~RTSEMEVENTMULTI_FLAGS_NO_LOCK_VAL), VERR_INVALID_PARAMETER);\r
pThis = (PRTSEMEVENTMULTIINTERNAL)RTMemAlloc(sizeof(*pThis));\r
init_waitqueue_head(&pThis->Head);\r
\r
*phEventMultiSem = pThis;\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VINF_SUCCESS;\r
}\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VERR_NO_MEMORY;\r
}\r
RT_EXPORT_SYMBOL(RTSemEventMultiCreate);\r
\r
RTDECL(int) RTSemEventMultiDestroy(RTSEMEVENTMULTI hEventMultiSem)\r
{\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
+\r
/*\r
* Validate input.\r
*/\r
Assert(!waitqueue_active(&pThis->Head));\r
wake_up_all(&pThis->Head);\r
rtR0SemEventMultiLnxRelease(pThis);\r
+\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VINF_SUCCESS;\r
}\r
RT_EXPORT_SYMBOL(RTSemEventMultiDestroy);\r
\r
RTDECL(int) RTSemEventMultiSignal(RTSEMEVENTMULTI hEventMultiSem)\r
{\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
uint32_t fNew;\r
uint32_t fOld;\r
\r
wake_up_all(&pThis->Head);\r
\r
rtR0SemEventMultiLnxRelease(pThis);\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VINF_SUCCESS;\r
}\r
RT_EXPORT_SYMBOL(RTSemEventMultiSignal);\r
* We have to wait.\r
*/\r
RTR0SEMLNXWAIT Wait;\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
rc = rtR0SemLnxWaitInit(&Wait, fFlags, uTimeout, &pThis->Head);\r
if (RT_SUCCESS(rc))\r
{\r
rtR0SemLnxWaitDelete(&Wait);\r
IPRT_DEBUG_SEMS_STATE_RC(pThis, 'E', rc);\r
}\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
}\r
\r
rtR0SemEventMultiLnxRelease(pThis);\r
-/* $Id: semfastmutex-r0drv-linux.c 100874 2015-06-09 14:01:31Z bird $ */\r
+/* $Id: semfastmutex-r0drv-linux.c 102031 2015-08-11 14:39:19Z bird $ */\r
/** @file\r
* IPRT - Fast Mutex Semaphores, Ring-0 Driver, Linux.\r
*/\r
\r
RTDECL(int) RTSemFastMutexCreate(PRTSEMFASTMUTEX phFastMtx)\r
{\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
+\r
/*\r
* Allocate.\r
*/\r
#endif\r
\r
*phFastMtx = pThis;\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VINF_SUCCESS;\r
}\r
RT_EXPORT_SYMBOL(RTSemFastMutexCreate);\r
\r
RTDECL(int) RTSemFastMutexRequest(RTSEMFASTMUTEX hFastMtx)\r
{\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
+\r
/*\r
* Validate.\r
*/\r
AssertRelease(pThis->Owner == NIL_RTNATIVETHREAD);\r
ASMAtomicUoWriteSize(&pThis->Owner, RTThreadNativeSelf());\r
#endif\r
+\r
+ IPRT_LINUX_RESTORE_EFL_ONLY_AC();\r
return VINF_SUCCESS;\r
}\r
RT_EXPORT_SYMBOL(RTSemFastMutexRequest);\r
\r
RTDECL(int) RTSemFastMutexRelease(RTSEMFASTMUTEX hFastMtx)\r
{\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
+\r
/*\r
* Validate.\r
*/\r
#endif\r
up(&pThis->Semaphore);\r
IPRT_DEBUG_SEMS_STATE(pThis, 'u');\r
+\r
+ IPRT_LINUX_RESTORE_EFL_ONLY_AC();\r
return VINF_SUCCESS;\r
}\r
RT_EXPORT_SYMBOL(RTSemFastMutexRelease);\r
-/* $Id: semmutex-r0drv-linux.c 100874 2015-06-09 14:01:31Z bird $ */\r
+/* $Id: semmutex-r0drv-linux.c 102039 2015-08-12 08:54:55Z fmehnert $ */\r
/** @file\r
* IPRT - Mutex Semaphores, Ring-0 Driver, Linux.\r
*/\r
\r
RTDECL(int) RTSemMutexCreate(PRTSEMMUTEX phMtx)\r
{\r
+ int rc = VINF_SUCCESS;\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
+\r
/*\r
* Allocate.\r
*/\r
PRTSEMMUTEXINTERNAL pThis;\r
pThis = (PRTSEMMUTEXINTERNAL)RTMemAlloc(sizeof(*pThis));\r
- if (!pThis)\r
- return VERR_NO_MEMORY;\r
+ if (pThis)\r
+ {\r
+ /*\r
+ * Initialize.\r
+ */\r
+ pThis->u32Magic = RTSEMMUTEX_MAGIC;\r
+ pThis->cRecursions = 0;\r
+ pThis->pOwnerTask = NULL;\r
+ pThis->cRefs = 1;\r
+ RTListInit(&pThis->WaiterList);\r
+ spin_lock_init(&pThis->Spinlock);\r
+\r
+ *phMtx = pThis;\r
+ }\r
+ else\r
+ rc = VERR_NO_MEMORY;\r
\r
- /*\r
- * Initialize.\r
- */\r
- pThis->u32Magic = RTSEMMUTEX_MAGIC;\r
- pThis->cRecursions = 0;\r
- pThis->pOwnerTask = NULL;\r
- pThis->cRefs = 1;\r
- RTListInit(&pThis->WaiterList);\r
- spin_lock_init(&pThis->Spinlock);\r
-\r
- *phMtx = pThis;\r
- return VINF_SUCCESS;\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
+ return rc;\r
}\r
RT_EXPORT_SYMBOL(RTSemMutexCreate);\r
\r
*/\r
AssertReturn(ASMAtomicCmpXchgU32(&pThis->u32Magic, RTSEMMUTEX_MAGIC_DEAD, RTSEMMUTEX_MAGIC), VERR_INVALID_HANDLE);\r
\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
+\r
spin_lock_irqsave(&pThis->Spinlock, fSavedIrq);\r
RTListForEach(&pThis->WaiterList, pCur, RTSEMMUTEXLNXWAITER, ListEntry)\r
{\r
RTMemFree(pThis);\r
}\r
\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
+\r
return VINF_SUCCESS;\r
}\r
RT_EXPORT_SYMBOL(RTSemMutexDestroy);\r
struct task_struct *pSelf = current;\r
unsigned long fSavedIrq;\r
int rc;\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
\r
/*\r
* Validate.\r
* No, so go to sleep.\r
*/\r
else\r
- return rtSemMutexLinuxRequestSleep(pThis, cMillies, fInterruptible, fSavedIrq);\r
+ {\r
+ rc = rtSemMutexLinuxRequestSleep(pThis, cMillies, fInterruptible, fSavedIrq);\r
+ IPRT_LINUX_RESTORE_EFL_ONLY_AC();\r
+ return rc;\r
+ }\r
\r
IPRT_DEBUG_SEMS_STATE_RC(pThis, 'M', rc);\r
spin_unlock_irqrestore(&pThis->Spinlock, fSavedIrq);\r
+ IPRT_LINUX_RESTORE_EFL_ONLY_AC();\r
return rc;\r
}\r
\r
struct task_struct *pSelf = current;\r
unsigned long fSavedIrq;\r
int rc;\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
\r
/*\r
* Validate.\r
spin_unlock_irqrestore(&pThis->Spinlock, fSavedIrq);\r
\r
AssertRC(rc);\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return rc;\r
}\r
RT_EXPORT_SYMBOL(RTSemMutexRelease);\r
PRTSEMMUTEXINTERNAL pThis = hMutexSem;\r
unsigned long fSavedIrq;\r
bool fOwned;\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
\r
/*\r
* Validate.\r
fOwned = pThis->pOwnerTask != NULL;\r
spin_unlock_irqrestore(&pThis->Spinlock, fSavedIrq);\r
\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return fOwned;\r
\r
}\r
-/* $Id: spinlock-r0drv-linux.c 100874 2015-06-09 14:01:31Z bird $ */\r
+/* $Id: spinlock-r0drv-linux.c 102092 2015-08-13 14:49:41Z bird $ */\r
/** @file\r
* IPRT - Spinlocks, Ring-0 Driver, Linux.\r
*/\r
\r
RTDECL(int) RTSpinlockCreate(PRTSPINLOCK pSpinlock, uint32_t fFlags, const char *pszName)\r
{\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
PRTSPINLOCKINTERNAL pThis;\r
AssertReturn(fFlags == RTSPINLOCK_FLAGS_INTERRUPT_SAFE || fFlags == RTSPINLOCK_FLAGS_INTERRUPT_UNSAFE, VERR_INVALID_PARAMETER);\r
\r
spin_lock_init(&pThis->Spinlock);\r
\r
*pSpinlock = pThis;\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VINF_SUCCESS;\r
}\r
RT_EXPORT_SYMBOL(RTSpinlockCreate);\r
RTDECL(void) RTSpinlockAcquire(RTSPINLOCK Spinlock)\r
{\r
PRTSPINLOCKINTERNAL pThis = (PRTSPINLOCKINTERNAL)Spinlock;\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
RT_ASSERT_PREEMPT_CPUID_VAR();\r
AssertMsg(pThis && pThis->u32Magic == RTSPINLOCK_MAGIC,\r
("pThis=%p u32Magic=%08x\n", pThis, pThis ? (int)pThis->u32Magic : 0));\r
lockdep_on();\r
#endif\r
\r
+ IPRT_LINUX_RESTORE_EFL_ONLY_AC();\r
RT_ASSERT_PREEMPT_CPUID_SPIN_ACQUIRED(pThis);\r
}\r
RT_EXPORT_SYMBOL(RTSpinlockAcquire);\r
RTDECL(void) RTSpinlockRelease(RTSPINLOCK Spinlock)\r
{\r
PRTSPINLOCKINTERNAL pThis = (PRTSPINLOCKINTERNAL)Spinlock;\r
+ IPRT_LINUX_SAVE_EFL_AC(); /* spin_unlock* may preempt and trash eflags.ac. */\r
RT_ASSERT_PREEMPT_CPUID_SPIN_RELEASE_VARS();\r
AssertMsg(pThis && pThis->u32Magic == RTSPINLOCK_MAGIC,\r
("pThis=%p u32Magic=%08x\n", pThis, pThis ? (int)pThis->u32Magic : 0));\r
lockdep_on();\r
#endif\r
\r
+ IPRT_LINUX_RESTORE_EFL_ONLY_AC();\r
RT_ASSERT_PREEMPT_CPUID();\r
}\r
RT_EXPORT_SYMBOL(RTSpinlockRelease);\r
-/* $Id: the-linux-kernel.h 100874 2015-06-09 14:01:31Z bird $ */\r
+/* $Id: the-linux-kernel.h 102085 2015-08-13 13:26:00Z bird $ */\r
/** @file\r
* IPRT - Include all necessary headers for the Linux kernel.\r
*/\r
* The AMD 64 switch_to in macro in arch/x86/include/asm/switch_to.h stopped\r
* restoring flags.\r
* @{ */\r
-#ifdef CONFIG_X86_SMAP\r
+#if defined(CONFIG_X86_SMAP) || defined(RT_STRICT) || defined(IPRT_WITH_EFLAGS_AC_PRESERVING)\r
# include <iprt/asm-amd64-x86.h>\r
# define IPRT_X86_EFL_AC RT_BIT(18)\r
-# define IPRT_LINUX_SAVE_EFL_AC() RTCCUINTREG fSavedEfl = ASMGetFlags();\r
+# define IPRT_LINUX_SAVE_EFL_AC() RTCCUINTREG fSavedEfl = ASMGetFlags()\r
# define IPRT_LINUX_RESTORE_EFL_AC() ASMSetFlags(fSavedEfl)\r
-# define IPRT_LINUX_RESTORE_EFL_ONLY_AC() ASMSetFlags((ASMGetFlags() & ~IPRT_X86_EFL_AC) | (fSavedEfl & IPRT_X86_EFL_AC))\r
+# define IPRT_LINUX_RESTORE_EFL_ONLY_AC() ASMChangeFlags(~IPRT_X86_EFL_AC, fSavedEfl & IPRT_X86_EFL_AC)\r
#else\r
# define IPRT_LINUX_SAVE_EFL_AC() do { } while (0)\r
# define IPRT_LINUX_RESTORE_EFL_AC() do { } while (0)\r
-/* $Id: thread-r0drv-linux.c 100317 2015-05-14 15:59:15Z bird $ */\r
+/* $Id: thread-r0drv-linux.c 102031 2015-08-11 14:39:19Z bird $ */\r
/** @file\r
* IPRT - Threads, Ring-0 Driver, Linux.\r
*/\r
\r
static int rtR0ThreadLnxSleepCommon(RTMSINTERVAL cMillies)\r
{\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
long cJiffies = msecs_to_jiffies(cMillies);\r
set_current_state(TASK_INTERRUPTIBLE);\r
cJiffies = schedule_timeout(cJiffies);\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
if (!cJiffies)\r
return VINF_SUCCESS;\r
return VERR_INTERRUPTED;\r
\r
RTDECL(bool) RTThreadYield(void)\r
{\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 20)\r
yield();\r
#else\r
sys_sched_yield();\r
schedule();\r
#endif\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return true;\r
}\r
RT_EXPORT_SYMBOL(RTThreadYield);\r
-/* $Id: thread2-r0drv-linux.c 100874 2015-06-09 14:01:31Z bird $ */\r
+/* $Id: thread2-r0drv-linux.c 102031 2015-08-11 14:39:19Z bird $ */\r
/** @file\r
* IPRT - Threads (Part 2), Ring-0 Driver, Linux.\r
*/\r
{\r
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 4)\r
struct task_struct *NativeThread;\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
\r
RT_ASSERT_PREEMPTIBLE();\r
\r
NativeThread = kthread_run(rtThreadNativeMain, pThreadInt, "iprt-%s", pThreadInt->szName);\r
\r
- if (IS_ERR(NativeThread))\r
- return VERR_GENERAL_FAILURE;\r
-\r
- *pNativeThread = (RTNATIVETHREAD)NativeThread;\r
- return VINF_SUCCESS;\r
+ if (!IS_ERR(NativeThread))\r
+ {\r
+ *pNativeThread = (RTNATIVETHREAD)NativeThread;\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
+ return VINF_SUCCESS;\r
+ }\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
+ return VERR_GENERAL_FAILURE;\r
#else\r
return VERR_NOT_IMPLEMENTED;\r
#endif\r
-/* $Id: time-r0drv-linux.c 100874 2015-06-09 14:01:31Z bird $ */\r
+/* $Id: time-r0drv-linux.c 102031 2015-08-11 14:39:19Z bird $ */\r
/** @file\r
* IPRT - Time, Ring-0 Driver, Linux.\r
*/\r
\r
RTDECL(PRTTIMESPEC) RTTimeNow(PRTTIMESPEC pTime)\r
{\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 16)\r
struct timespec Ts;\r
ktime_get_real_ts(&Ts);\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return RTTimeSpecSetTimespec(pTime, &Ts);\r
\r
#else /* < 2.6.16 */\r
struct timeval Tv;\r
do_gettimeofday(&Tv);\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return RTTimeSpecSetTimeval(pTime, &Tv);\r
#endif\r
}\r
-/* $Id: timer-r0drv-linux.c 100874 2015-06-09 14:01:31Z bird $ */\r
+/* $Id: timer-r0drv-linux.c 102031 2015-08-11 14:39:19Z bird $ */\r
/** @file\r
* IPRT - Timers, Ring-0 Driver, Linux.\r
*/\r
{\r
RTTIMERLINUXSTARTONCPUARGS Args;\r
int rc2;\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
\r
/*\r
* Validate.\r
* Omni timer?\r
*/\r
if (pTimer->fAllCpus)\r
- return rtTimerLnxOmniStart(pTimer, &Args);\r
+ {\r
+ rc2 = rtTimerLnxOmniStart(pTimer, &Args);\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
+ return rc2;\r
+ }\r
#endif\r
\r
/*\r
return rc2;\r
}\r
}\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VINF_SUCCESS;\r
}\r
break;\r
if (rtTimerLnxCmpXchgState(&pTimer->aSubTimers[0].enmState, RTTIMERLNXSTATE_CB_RESTARTING, enmState))\r
{\r
ASMAtomicWriteBool(&pTimer->fSuspended, false);\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VINF_SUCCESS;\r
}\r
break;\r
\r
default:\r
AssertMsgFailed(("%d\n", enmState));\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VERR_INTERNAL_ERROR_4;\r
}\r
ASMNopPause();\r
/*\r
* Validate.\r
*/\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
AssertPtrReturn(pTimer, VERR_INVALID_HANDLE);\r
AssertReturn(pTimer->u32Magic == RTTIMER_MAGIC, VERR_INVALID_HANDLE);\r
RTTIMERLNX_LOG(("stop %p\n", pTimer));\r
return VERR_TIMER_SUSPENDED;\r
\r
rtTimerLnxStop(pTimer, false /*fForDestroy*/);\r
+\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VINF_SUCCESS;\r
}\r
RT_EXPORT_SYMBOL(RTTimerStop);\r
{\r
unsigned long cJiffies;\r
unsigned long flFlags;\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
\r
/*\r
* Validate.\r
if (pTimer->fHighRes)\r
{\r
ASMAtomicWriteU64(&pTimer->u64NanoInterval, u64NanoInterval);\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VINF_SUCCESS;\r
}\r
#endif\r
pTimer->cJiffies = cJiffies;\r
ASMAtomicWriteU64(&pTimer->u64NanoInterval, u64NanoInterval);\r
spin_unlock_irqrestore(&pTimer->ChgIntLock, flFlags);\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VINF_SUCCESS;\r
}\r
RT_EXPORT_SYMBOL(RTTimerChangeInterval);\r
RTDECL(int) RTTimerDestroy(PRTTIMER pTimer)\r
{\r
bool fCanDestroy;\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
\r
/*\r
* Validate. It's ok to pass NULL pointer.\r
rtTimerLnxDestroyIt(pTimer);\r
}\r
\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VINF_SUCCESS;\r
}\r
RT_EXPORT_SYMBOL(RTTimerDestroy);\r
RTCPUID iCpu;\r
unsigned cCpus;\r
int rc;\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
\r
rtR0LnxWorkqueueFlush(); /* for 2.4 */\r
*ppTimer = NULL;\r
* Validate flags.\r
*/\r
if (!RTTIMER_FLAGS_ARE_VALID(fFlags))\r
+ {\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VERR_INVALID_PARAMETER;\r
+ }\r
if ( (fFlags & RTTIMER_FLAGS_CPU_SPECIFIC)\r
&& (fFlags & RTTIMER_FLAGS_CPU_ALL) != RTTIMER_FLAGS_CPU_ALL\r
&& !RTMpIsCpuPossible(RTMpCpuIdFromSetIndex(fFlags & RTTIMER_FLAGS_CPU_MASK)))\r
+ {\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VERR_CPU_NOT_FOUND;\r
+ }\r
\r
/*\r
* Allocate the timer handler.\r
{\r
cCpus = RTMpGetMaxCpuId() + 1;\r
Assert(cCpus <= RTCPUSET_MAX_CPUS); /* On linux we have a 1:1 relationship between cpuid and set index. */\r
- AssertReturn(u64NanoInterval, VERR_NOT_IMPLEMENTED); /* We don't implement single shot on all cpus, sorry. */\r
+ AssertReturnStmt(u64NanoInterval, IPRT_LINUX_RESTORE_EFL_AC(), VERR_NOT_IMPLEMENTED); /* We don't implement single shot on all cpus, sorry. */\r
}\r
#endif\r
\r
rc = RTMemAllocEx(RT_OFFSETOF(RTTIMER, aSubTimers[cCpus]), 0,\r
RTMEMALLOCEX_FLAGS_ZEROED | RTMEMALLOCEX_FLAGS_ANY_CTX_FREE, (void **)&pTimer);\r
if (RT_FAILURE(rc))\r
+ {\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return rc;\r
+ }\r
\r
/*\r
* Initialize it.\r
if (RT_FAILURE(rc))\r
{\r
RTTimerDestroy(pTimer);\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return rc;\r
}\r
}\r
\r
RTTIMERLNX_LOG(("create %p hires=%d fFlags=%#x cCpus=%u\n", pTimer, pTimer->fHighRes, fFlags, cCpus));\r
*ppTimer = pTimer;\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
return VINF_SUCCESS;\r
}\r
RT_EXPORT_SYMBOL(RTTimerCreateEx);\r
#if 0 /** @todo Not sure if this is what we want or not... Add new API for\r
* querying the resolution of the high res timers? */\r
struct timespec Ts;\r
- int rc = hrtimer_get_res(CLOCK_MONOTONIC, &Ts);\r
+ int rc;\r
+ IPRT_LINUX_SAVE_EFL_AC();\r
+ rc = hrtimer_get_res(CLOCK_MONOTONIC, &Ts);\r
+ IPRT_LINUX_RESTORE_EFL_AC();\r
if (!rc)\r
{\r
Assert(!Ts.tv_sec);\r
-#define VBOX_SVN_REV 101573
+#define VBOX_SVN_REV 102096
#define VBOX_VERSION_MAJOR 5
#define VBOX_VERSION_MINOR 0
-#define VBOX_VERSION_BUILD 0
-#define VBOX_VERSION_STRING_RAW "5.0.0"
-#define VBOX_VERSION_STRING "5.0.0"
+#define VBOX_VERSION_BUILD 2
+#define VBOX_VERSION_STRING_RAW "5.0.2"
+#define VBOX_VERSION_STRING "5.0.2"
#define VBOX_API_VERSION_STRING "5_0"
#define VBOX_BUILD_SERVER_BUILD 1
}\r
\r
/**\r
+ * Translate RTFMODE into DT_xxx (in conjunction to rtDirType())\r
+ * @param fMode file mode\r
+ * returns d_type\r
+ */\r
+static int sf_get_d_type(RTFMODE fMode)\r
+{\r
+ int d_type;\r
+ switch (fMode & RTFS_TYPE_MASK)\r
+ {\r
+ case RTFS_TYPE_FIFO: d_type = DT_FIFO; break;\r
+ case RTFS_TYPE_DEV_CHAR: d_type = DT_CHR; break;\r
+ case RTFS_TYPE_DIRECTORY: d_type = DT_DIR; break;\r
+ case RTFS_TYPE_DEV_BLOCK: d_type = DT_BLK; break;\r
+ case RTFS_TYPE_FILE: d_type = DT_REG; break;\r
+ case RTFS_TYPE_SYMLINK: d_type = DT_LNK; break;\r
+ case RTFS_TYPE_SOCKET: d_type = DT_SOCK; break;\r
+ case RTFS_TYPE_WHITEOUT: d_type = DT_WHT; break;\r
+ default: d_type = DT_UNKNOWN; break;\r
+ }\r
+ return d_type;\r
+}\r
+\r
+/**\r
* Extract element ([dir]->f_pos) from the directory [dir] into [d_name].\r
*\r
* @returns 0 for success, 1 for end reached, Linux error code otherwise.\r
*/\r
-static int sf_getdent(struct file *dir, char d_name[NAME_MAX])\r
+static int sf_getdent(struct file *dir, char d_name[NAME_MAX], int *d_type)\r
{\r
loff_t cur;\r
struct sf_glob_info *sf_g;\r
info = (SHFLDIRINFO *) ((uintptr_t) info + size);\r
}\r
\r
+ *d_type = sf_get_d_type(info->Info.Attr.fMode);\r
+\r
return sf_nlscpy(sf_g, d_name, NAME_MAX,\r
info->name.String.utf8, info->name.u16Length);\r
}\r
ino_t fake_ino;\r
loff_t sanity;\r
char d_name[NAME_MAX];\r
+ int d_type = DT_UNKNOWN;\r
\r
- err = sf_getdent(dir, d_name);\r
+ err = sf_getdent(dir, d_name, &d_type);\r
switch (err)\r
{\r
case 1:\r
}\r
\r
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)\r
- if (!dir_emit(ctx, d_name, strlen(d_name), fake_ino, DT_UNKNOWN))\r
+ if (!dir_emit(ctx, d_name, strlen(d_name), fake_ino, d_type))\r
{\r
LogFunc(("dir_emit failed\n"));\r
return 0;\r
}\r
#else\r
- err = filldir(opaque, d_name, strlen(d_name), dir->f_pos, fake_ino, DT_UNKNOWN);\r
+ err = filldir(opaque, d_name, strlen(d_name), dir->f_pos, fake_ino, d_type);\r
if (err)\r
{\r
LogFunc(("filldir returned error %d\n", err));\r
VBGLR3DECL(int) VbglR3GuestPropDisconnect(uint32_t u32ClientId);\r
VBGLR3DECL(int) VbglR3GuestPropWrite(uint32_t u32ClientId, const char *pszName, const char *pszValue, const char *pszFlags);\r
VBGLR3DECL(int) VbglR3GuestPropWriteValue(uint32_t u32ClientId, const char *pszName, const char *pszValue);\r
-VBGLR3DECL(int) VbglR3GuestPropWriteValueV(uint32_t u32ClientId, const char *pszName, const char *pszValueFormat, va_list va);\r
-VBGLR3DECL(int) VbglR3GuestPropWriteValueF(uint32_t u32ClientId, const char *pszName, const char *pszValueFormat, ...);\r
+VBGLR3DECL(int) VbglR3GuestPropWriteValueV(uint32_t u32ClientId, const char *pszName,\r
+ const char *pszValueFormat, va_list va) RT_IPRT_FORMAT_ATTR(3, 0);\r
+VBGLR3DECL(int) VbglR3GuestPropWriteValueF(uint32_t u32ClientId, const char *pszName,\r
+ const char *pszValueFormat, ...) RT_IPRT_FORMAT_ATTR(3, 4);\r
VBGLR3DECL(int) VbglR3GuestPropRead(uint32_t u32ClientId, const char *pszName, void *pvBuf, uint32_t cbBuf, char **ppszValue, uint64_t *pu64Timestamp, char **ppszFlags, uint32_t *pcbBufActual);\r
VBGLR3DECL(int) VbglR3GuestPropReadValue(uint32_t ClientId, const char *pszName, char *pszValue, uint32_t cchValue, uint32_t *pcchValueActual);\r
VBGLR3DECL(int) VbglR3GuestPropReadValueAlloc(uint32_t u32ClientId, const char *pszName, char **ppszValue);\r
#define VERR_VMM_SWITCHER_STUB (-2715)\r
/** HM returned in the wrong state. */\r
#define VERR_VMM_WRONG_HM_VMCPU_STATE (-2716)\r
+/** SMAP enabled, but the AC flag was found to be clear - check the kernel\r
+ * log for details. */\r
+#define VERR_VMM_SMAP_BUT_AC_CLEAR (-2717)\r
/** @} */\r
\r
\r
#define VERR_VD_DMG_XML_PARSE_ERROR (-3284)\r
/** Unable to locate a usable DMG file within the XAR archive. */\r
#define VERR_VD_DMG_NOT_FOUND_INSIDE_XAR (-3285)\r
+/** The size of the raw image is not dividable by 512 */\r
+#define VERR_VD_RAW_SIZE_MODULO_512 (-3286)\r
+/** The size of the raw image is not dividable by 2048 */\r
+#define VERR_VD_RAW_SIZE_MODULO_2048 (-3287)\r
+/** The size of the raw optical image is too small (<= 32K) */\r
+#define VERR_VD_RAW_SIZE_OPTICAL_TOO_SMALL (-3288)\r
+/** The size of the raw floppy image is too big (>2.88MB) */\r
+#define VERR_VD_RAW_SIZE_FLOPPY_TOO_BIG (-3289)\r
+\r
/** @} */\r
\r
\r
#define VWRN_SUPDRV_TSC_DELTA_MEASUREMENT_FAILED 3746\r
/** A TSC-delta measurement request is currently being serviced. */\r
#define VERR_SUPDRV_TSC_DELTA_MEASUREMENT_BUSY (-3747)\r
+/** The process trying to open VBoxDrv is not a budding VM process (1). */\r
+#define VERR_SUPDRV_NOT_BUDDING_VM_PROCESS_1 (-3748)\r
+/** The process trying to open VBoxDrv is not a budding VM process (2). */\r
+#define VERR_SUPDRV_NOT_BUDDING_VM_PROCESS_2 (-3749)\r
/** @} */\r
\r
\r
/** Internal VMX processing error no 5. */\r
#define VERR_VMX_IPE_5 (-4027)\r
/** VT-x features for all modes (SMX and non-SMX) disabled by the BIOS. */\r
-#define VERR_VMX_MSR_ALL_VMXON_DISABLED (-4028)\r
+#define VERR_VMX_MSR_ALL_VMX_DISABLED (-4028)\r
/** VT-x features disabled by the BIOS. */\r
-#define VERR_VMX_MSR_VMXON_DISABLED (-4029)\r
+#define VERR_VMX_MSR_VMX_DISABLED (-4029)\r
/** VM-Entry Controls internal cache invalid. */\r
#define VERR_VMX_ENTRY_CTLS_CACHE_INVALID (-4030)\r
/** VM-Exit Controls internal cache invalid. */\r
/** VM-Execution Secondary Processor-based Controls internal\r
* cache invalid. */\r
#define VERR_VMX_PROC_EXEC2_CTLS_CACHE_INVALID (-4034)\r
+/** Failed to set VMXON enable bit while enabling VT-x through the MSR. */\r
+#define VERR_VMX_MSR_VMX_ENABLE_FAILED (-4035)\r
+/** Failed to enable VMXON-in-SMX bit while enabling VT-x through the MSR. */\r
+#define VERR_VMX_MSR_SMX_VMX_ENABLE_FAILED (-4036)\r
/** @} */\r
\r
\r
\r
\r
/**\r
+ * Modifies the [RE]FLAGS register.\r
+ * @returns Original value.\r
+ * @param fAndEfl Flags to keep (applied first).\r
+ * @param fOrEfl Flags to be set.\r
+ */\r
+#if RT_INLINE_ASM_EXTERNAL && RT_INLINE_ASM_USES_INTRIN < 15\r
+DECLASM(RTCCUINTREG) ASMChangeFlags(RTCCUINTREG fAndEfl, RTCCUINTREG fOrEfl);\r
+#else\r
+DECLINLINE(RTCCUINTREG) ASMChangeFlags(RTCCUINTREG fAndEfl, RTCCUINTREG fOrEfl)\r
+{\r
+ RTCCUINTREG fOldEfl;\r
+# if RT_INLINE_ASM_GNU_STYLE\r
+# ifdef RT_ARCH_AMD64\r
+ __asm__ __volatile__("pushfq\n\t"\r
+ "movq (%%rsp), %0\n\t"\r
+ "andq %0, %1\n\t"\r
+ "orq %3, %1\n\t"\r
+ "mov %1, (%%rsp)\n\t"\r
+ "popfq\n\t"\r
+ : "=&r" (fOldEfl),\r
+ "=r" (fAndEfl)\r
+ : "1" (fAndEfl),\r
+ "rn" (fOrEfl) );\r
+# else\r
+ __asm__ __volatile__("pushfl\n\t"\r
+ "movl (%%esp), %0\n\t"\r
+ "andl %1, (%%esp)\n\t"\r
+ "orl %2, (%%esp)\n\t"\r
+ "popfl\n\t"\r
+ : "=&r" (fOldEfl)\r
+ : "rn" (fAndEfl),\r
+ "rn" (fOrEfl) );\r
+# endif\r
+# elif RT_INLINE_ASM_USES_INTRIN >= 15\r
+ fOldEfl = __readeflags();\r
+ __writeeflags((fOldEfl & fAndEfl) | fOrEfl);\r
+# else\r
+ __asm\r
+ {\r
+# ifdef RT_ARCH_AMD64\r
+ mov rdx, [fAndEfl]\r
+ mov rcx, [fOrEfl]\r
+ pushfq\r
+ mov rax, [rsp]\r
+ and rdx, rax\r
+ or rdx, rcx\r
+ mov [rsp], rdx\r
+ popfq\r
+ mov [fOldEfl], rax\r
+# else\r
+ mov edx, [fAndEfl]\r
+ mov ecx, [fOrEfl]\r
+ pushfd\r
+ mov eax, [esp]\r
+ and edx, eax\r
+ or edx, ecx\r
+ mov [esp], edx\r
+ popfd\r
+ mov [fOldEfl], eax\r
+# endif\r
+ }\r
+# endif\r
+ return fOldEfl;\r
+}\r
+#endif\r
+\r
+\r
+/**\r
+ * Modifies the [RE]FLAGS register by ORing in one or more flags.\r
+ * @returns Original value.\r
+ * @param fOrEfl The flags to be set (ORed in).\r
+ */\r
+#if RT_INLINE_ASM_EXTERNAL && RT_INLINE_ASM_USES_INTRIN < 15\r
+DECLASM(RTCCUINTREG) ASMAddFlags(RTCCUINTREG fOrEfl);\r
+#else\r
+DECLINLINE(RTCCUINTREG) ASMAddFlags(RTCCUINTREG fOrEfl)\r
+{\r
+ RTCCUINTREG fOldEfl;\r
+# if RT_INLINE_ASM_GNU_STYLE\r
+# ifdef RT_ARCH_AMD64\r
+ __asm__ __volatile__("pushfq\n\t"\r
+ "movq (%%rsp), %0\n\t"\r
+ "orq %1, (%%rsp)\n\t"\r
+ "popfq\n\t"\r
+ : "=&r" (fOldEfl)\r
+ : "rn" (fOrEfl) );\r
+# else\r
+ __asm__ __volatile__("pushfl\n\t"\r
+ "movl (%%esp), %0\n\t"\r
+ "orl %1, (%%esp)\n\t"\r
+ "popfl\n\t"\r
+ : "=&r" (fOldEfl)\r
+ : "rn" (fOrEfl) );\r
+# endif\r
+# elif RT_INLINE_ASM_USES_INTRIN >= 15\r
+ fOldEfl = __readeflags();\r
+ __writeeflags(fOldEfl | fOrEfl);\r
+# else\r
+ __asm\r
+ {\r
+# ifdef RT_ARCH_AMD64\r
+ mov rcx, [fOrEfl]\r
+ pushfq\r
+ mov rdx, [rsp]\r
+ or [rsp], rcx\r
+ popfq\r
+ mov [fOldEfl], rax\r
+# else\r
+ mov ecx, [fOrEfl]\r
+ pushfd\r
+ mov edx, [esp]\r
+ or [esp], ecx\r
+ popfd\r
+ mov [fOldEfl], eax\r
+# endif\r
+ }\r
+# endif\r
+ return fOldEfl;\r
+}\r
+#endif\r
+\r
+\r
+/**\r
+ * Modifies the [RE]FLAGS register by AND'ing out one or more flags.\r
+ * @returns Original value.\r
+ * @param fAndEfl The flags to keep.\r
+ */\r
+#if RT_INLINE_ASM_EXTERNAL && RT_INLINE_ASM_USES_INTRIN < 15\r
+DECLASM(RTCCUINTREG) ASMClearFlags(RTCCUINTREG fAndEfl);\r
+#else\r
+DECLINLINE(RTCCUINTREG) ASMClearFlags(RTCCUINTREG fAndEfl)\r
+{\r
+ RTCCUINTREG fOldEfl;\r
+# if RT_INLINE_ASM_GNU_STYLE\r
+# ifdef RT_ARCH_AMD64\r
+ __asm__ __volatile__("pushfq\n\t"\r
+ "movq (%%rsp), %0\n\t"\r
+ "andq %1, (%%rsp)\n\t"\r
+ "popfq\n\t"\r
+ : "=&r" (fOldEfl)\r
+ : "rn" (fAndEfl) );\r
+# else\r
+ __asm__ __volatile__("pushfl\n\t"\r
+ "movl (%%esp), %0\n\t"\r
+ "andl %1, (%%esp)\n\t"\r
+ "popfl\n\t"\r
+ : "=&r" (fOldEfl)\r
+ : "rn" (fAndEfl) );\r
+# endif\r
+# elif RT_INLINE_ASM_USES_INTRIN >= 15\r
+ fOldEfl = __readeflags();\r
+ __writeeflags(fOldEfl & fAndEfl);\r
+# else\r
+ __asm\r
+ {\r
+# ifdef RT_ARCH_AMD64\r
+ mov rdx, [fAndEfl]\r
+ pushfq\r
+ mov rdx, [rsp]\r
+ and [rsp], rdx\r
+ popfq\r
+ mov [fOldEfl], rax\r
+# else\r
+ mov edx, [fAndEfl]\r
+ pushfd\r
+ mov edx, [esp]\r
+ and [esp], edx\r
+ popfd\r
+ mov [fOldEfl], eax\r
+# endif\r
+ }\r
+# endif\r
+ return fOldEfl;\r
+}\r
+#endif\r
+\r
+\r
+/**\r
* Gets the content of the CPU timestamp counter register.\r
*\r
* @returns TSC.\r
* @param pszFormat Printf like format string.\r
* @param ... Arguments to that string.\r
*/\r
-RTDECL(void) RTAssertMsg2(const char *pszFormat, ...);\r
+RTDECL(void) RTAssertMsg2(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);\r
/**\r
* Weak version of RTAssertMsg2 that forwards to RTAssertMsg2WeakV.\r
*\r
*\r
* @copydoc RTAssertMsg2\r
*/\r
-RTDECL(void) RTAssertMsg2Weak(const char *pszFormat, ...);\r
+RTDECL(void) RTAssertMsg2Weak(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);\r
\r
/**\r
* The 2nd (optional) part of an assert message.\r
* @param pszFormat Printf like format string.\r
* @param va Arguments to that string.\r
*/\r
-RTDECL(void) RTAssertMsg2V(const char *pszFormat, va_list va);\r
+RTDECL(void) RTAssertMsg2V(const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(1, 0);\r
/**\r
* Weak version of RTAssertMsg2V that can be overridden locally in a module to\r
* modify, redirect or otherwise mess with the assertion output.\r
*\r
* @copydoc RTAssertMsg2V\r
*/\r
-RTDECL(void) RTAssertMsg2WeakV(const char *pszFormat, va_list va);\r
+RTDECL(void) RTAssertMsg2WeakV(const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(1, 0);\r
\r
/**\r
* Additional information which should be appended to the 2nd part of an\r
* @param pszFormat Printf like format string.\r
* @param ... Arguments to that string.\r
*/\r
-RTDECL(void) RTAssertMsg2Add(const char *pszFormat, ...);\r
+RTDECL(void) RTAssertMsg2Add(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);\r
/**\r
* Weak version of RTAssertMsg2Add that forwards to RTAssertMsg2AddWeakV.\r
*\r
*\r
* @copydoc RTAssertMsg2Add\r
*/\r
-RTDECL(void) RTAssertMsg2AddWeak(const char *pszFormat, ...);\r
+RTDECL(void) RTAssertMsg2AddWeak(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);\r
\r
/**\r
* Additional information which should be appended to the 2nd part of an\r
* @param pszFormat Printf like format string.\r
* @param va Arguments to that string.\r
*/\r
-RTDECL(void) RTAssertMsg2AddV(const char *pszFormat, va_list va);\r
+RTDECL(void) RTAssertMsg2AddV(const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(1, 0);\r
/**\r
* Weak version of RTAssertMsg2AddV that can be overridden locally in a module\r
* to modify, redirect or otherwise mess with the assertion output.\r
*\r
* @copydoc RTAssertMsg2AddV\r
*/\r
-RTDECL(void) RTAssertMsg2AddWeakV(const char *pszFormat, va_list va);\r
+RTDECL(void) RTAssertMsg2AddWeakV(const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(1, 0);\r
\r
#ifdef IN_RING0\r
/**\r
# define RT_THROW(type)\r
#endif\r
\r
+/** @def RT_IPRT_FORMAT_ATTR\r
+ * Identifies a function taking an IPRT format string.\r
+ * @param a_iFmt The index (1-based) of the format string argument.\r
+ * @param a_iArgs The index (1-based) of the first format argument, use 0 for\r
+ * va_list.\r
+ */\r
+#if defined(__GNUC__) && defined(WITH_IPRT_FORMAT_ATTRIBUTE)\r
+# define RT_IPRT_FORMAT_ATTR(a_iFmt, a_iArgs) __attribute__((__iprt_format__(a_iFmt, a_iArgs)))\r
+#else\r
+# define RT_IPRT_FORMAT_ATTR(a_iFmt, a_iArgs)\r
+#endif\r
+\r
+/** @def RT_IPRT_FORMAT_ATTR_MAYBE_NULL\r
+ * Identifies a function taking an IPRT format string, NULL is allowed.\r
+ * @param a_iFmt The index (1-based) of the format string argument.\r
+ * @param a_iArgs The index (1-based) of the first format argument, use 0 for\r
+ * va_list.\r
+ */\r
+#if defined(__GNUC__) && defined(WITH_IPRT_FORMAT_ATTRIBUTE)\r
+# define RT_IPRT_FORMAT_ATTR_MAYBE_NULL(a_iFmt, a_iArgs) __attribute__((__iprt_format_maybe_null__(a_iFmt, a_iArgs)))\r
+#else\r
+# define RT_IPRT_FORMAT_ATTR_MAYBE_NULL(a_iFmt, a_iArgs)\r
+#endif\r
+\r
+\r
/** @def RT_GCC_SUPPORTS_VISIBILITY_HIDDEN\r
* Indicates that the "hidden" visibility attribute can be used (GCC) */\r
#if defined(__GNUC__)\r
* @param pszFormat The format string.\r
* @param ... The format arguments.\r
*/\r
-RTDECL(int) RTErrInfoSetF(PRTERRINFO pErrInfo, int rc, const char *pszFormat, ...);\r
+RTDECL(int) RTErrInfoSetF(PRTERRINFO pErrInfo, int rc, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(3, 4);\r
\r
/**\r
* Fills in the error info details, with a vsprintf style message.\r
* @param pszFormat The format string.\r
* @param va The format arguments.\r
*/\r
-RTDECL(int) RTErrInfoSetV(PRTERRINFO pErrInfo, int rc, const char *pszFormat, va_list va);\r
+RTDECL(int) RTErrInfoSetV(PRTERRINFO pErrInfo, int rc, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(3, 0);\r
\r
/**\r
* Adds more error info details.\r
* @param pszFormat The format string to add.\r
* @param ... The format arguments.\r
*/\r
-RTDECL(int) RTErrInfoAddF(PRTERRINFO pErrInfo, int rc, const char *pszFormat, ...);\r
+RTDECL(int) RTErrInfoAddF(PRTERRINFO pErrInfo, int rc, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(3, 4);\r
\r
/**\r
* Adds more error info details, with a vsprintf style message.\r
* @param pszFormat The format string to add.\r
* @param va The format arguments.\r
*/\r
-RTDECL(int) RTErrInfoAddV(PRTERRINFO pErrInfo, int rc, const char *pszFormat, va_list va);\r
+RTDECL(int) RTErrInfoAddV(PRTERRINFO pErrInfo, int rc, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(3, 0);\r
\r
/**\r
* Checks if the error info is set.\r
* @param pszFormat Format string.\r
* @param ... Optional arguments as specified in the format string.\r
*/\r
-typedef DECLCALLBACK(void) FNRTLOGGER(const char *pszFormat, ...);\r
+typedef DECLCALLBACK(void) FNRTLOGGER(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);\r
/** Pointer to logger function. */\r
typedef FNRTLOGGER *PFNRTLOGGER;\r
\r
* @param pszFormat Format string.\r
* @param ... Optional arguments specified in the format string.\r
*/\r
-typedef DECLCALLBACK(void) FNRTLOGPHASEMSG(PRTLOGGER pLogger, const char *pszFormat, ...);\r
+typedef DECLCALLBACK(void) FNRTLOGPHASEMSG(PRTLOGGER pLogger, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(2, 3);\r
/** Pointer to header/footer message callback function. */\r
typedef FNRTLOGPHASEMSG *PFNRTLOGPHASEMSG;\r
\r
} RTLOGDEST;\r
\r
\r
-RTDECL(void) RTLogPrintfEx(void *pvInstance, unsigned fFlags, unsigned iGroup, const char *pszFormat, ...);\r
+RTDECL(void) RTLogPrintfEx(void *pvInstance, unsigned fFlags, unsigned iGroup,\r
+ const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(4, 5);\r
\r
\r
#ifdef DOXYGEN_RUNNING\r
* @param ... Format arguments.\r
* @remark This is a worker function for LogRelIt.\r
*/\r
-RTDECL(void) RTLogRelLogger(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup, const char *pszFormat, ...);\r
+RTDECL(void) RTLogRelLogger(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup,\r
+ const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(4, 5);\r
\r
/**\r
* Write to a logger instance, defaulting to the release one.\r
* @param pszFormat Format string.\r
* @param args Format arguments.\r
*/\r
-RTDECL(void) RTLogRelLoggerV(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup, const char *pszFormat, va_list args);\r
+RTDECL(void) RTLogRelLoggerV(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup,\r
+ const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR(4, 0);\r
\r
/**\r
* printf like function for writing to the default release log.\r
*\r
* @remark The API doesn't support formatting of floating point numbers at the moment.\r
*/\r
-RTDECL(void) RTLogRelPrintf(const char *pszFormat, ...);\r
+RTDECL(void) RTLogRelPrintf(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);\r
\r
/**\r
* vprintf like function for writing to the default release log.\r
*\r
* @remark The API doesn't support formatting of floating point numbers at the moment.\r
*/\r
-RTDECL(void) RTLogRelPrintfV(const char *pszFormat, va_list args);\r
+RTDECL(void) RTLogRelPrintfV(const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR(1, 0);\r
\r
/**\r
* Changes the buffering setting of the default release logger.\r
*/\r
RTDECL(int) RTLogCreate(PRTLOGGER *ppLogger, uint32_t fFlags, const char *pszGroupSettings,\r
const char *pszEnvVarBase, unsigned cGroups, const char * const * papszGroups,\r
- uint32_t fDestFlags, const char *pszFilenameFmt, ...);\r
+ uint32_t fDestFlags, const char *pszFilenameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(8, 9);\r
\r
/**\r
* Create a logger instance.\r
RTDECL(int) RTLogCreateEx(PRTLOGGER *ppLogger, uint32_t fFlags, const char *pszGroupSettings,\r
const char *pszEnvVarBase, unsigned cGroups, const char * const * papszGroups,\r
uint32_t fDestFlags, PFNRTLOGPHASE pfnPhase, uint32_t cHistory,\r
- uint64_t cbHistoryFileMax, uint32_t cSecsHistoryTimeSlot,\r
- char *pszErrorMsg, size_t cchErrorMsg, const char *pszFilenameFmt, ...);\r
+ uint64_t cbHistoryFileMax, uint32_t cSecsHistoryTimeSlot, char *pszErrorMsg, size_t cchErrorMsg,\r
+ const char *pszFilenameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(14, 15);\r
\r
/**\r
* Create a logger instance.\r
RTDECL(int) RTLogCreateExV(PRTLOGGER *ppLogger, uint32_t fFlags, const char *pszGroupSettings,\r
const char *pszEnvVarBase, unsigned cGroups, const char * const * papszGroups,\r
uint32_t fDestFlags, PFNRTLOGPHASE pfnPhase, uint32_t cHistory,\r
- uint64_t cbHistoryFileMax, uint32_t cSecsHistoryTimeSlot,\r
- char *pszErrorMsg, size_t cchErrorMsg, const char *pszFilenameFmt, va_list args);\r
+ uint64_t cbHistoryFileMax, uint32_t cSecsHistoryTimeSlot, char *pszErrorMsg, size_t cchErrorMsg,\r
+ const char *pszFilenameFmt, va_list args) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(14, 0);\r
\r
/**\r
* Create a logger instance for singled threaded ring-0 usage.\r
* @param pszFormat Format string.\r
* @param ... Format arguments.\r
*/\r
-RTDECL(void) RTLogLogger(PRTLOGGER pLogger, void *pvCallerRet, const char *pszFormat, ...);\r
+RTDECL(void) RTLogLogger(PRTLOGGER pLogger, void *pvCallerRet, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(3, 4);\r
\r
/**\r
* Write to a logger instance.\r
* @param pszFormat Format string.\r
* @param args Format arguments.\r
*/\r
-RTDECL(void) RTLogLoggerV(PRTLOGGER pLogger, const char *pszFormat, va_list args);\r
+RTDECL(void) RTLogLoggerV(PRTLOGGER pLogger, const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR(3, 0);\r
\r
/**\r
* Write to a logger instance.\r
* @param ... Format arguments.\r
* @remark This is a worker function of LogIt.\r
*/\r
-RTDECL(void) RTLogLoggerEx(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup, const char *pszFormat, ...);\r
+RTDECL(void) RTLogLoggerEx(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup,\r
+ const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(4, 5);\r
\r
/**\r
* Write to a logger instance.\r
* @param pszFormat Format string.\r
* @param args Format arguments.\r
*/\r
-RTDECL(void) RTLogLoggerExV(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup, const char *pszFormat, va_list args);\r
+RTDECL(void) RTLogLoggerExV(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup,\r
+ const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR(4, 0);\r
\r
/**\r
* printf like function for writing to the default log.\r
*\r
* @remark The API doesn't support formatting of floating point numbers at the moment.\r
*/\r
-RTDECL(void) RTLogPrintf(const char *pszFormat, ...);\r
+RTDECL(void) RTLogPrintf(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);\r
\r
/**\r
* vprintf like function for writing to the default log.\r
*\r
* @remark The API doesn't support formatting of floating point numbers at the moment.\r
*/\r
-RTDECL(void) RTLogPrintfV(const char *pszFormat, va_list args);\r
+RTDECL(void) RTLogPrintfV(const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR(1, 0);\r
\r
/**\r
* Dumper vprintf-like function outputting to a logger.\r
* @param pszFormat Format string.\r
* @param va Format arguments.\r
*/\r
-RTDECL(void) RTLogDumpPrintfV(void *pvUser, const char *pszFormat, va_list va);\r
+RTDECL(void) RTLogDumpPrintfV(void *pvUser, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(2, 0);\r
\r
\r
#ifndef DECLARED_FNRTSTROUTPUT /* duplicated in iprt/string.h */\r
* @param pszFormat Format string.\r
* @param args Argument list.\r
*/\r
-RTDECL(size_t) RTLogFormatV(PFNRTSTROUTPUT pfnOutput, void *pvArg, const char *pszFormat, va_list args);\r
+RTDECL(size_t) RTLogFormatV(PFNRTSTROUTPUT pfnOutput, void *pvArg, const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR(3, 0);\r
\r
/**\r
* Write log buffer to COM port.\r
* @param pszFormat Format string.\r
* @param ... Optional arguments specified in the format string.\r
*/\r
-RTDECL(size_t) RTLogComPrintf(const char *pszFormat, ...);\r
+RTDECL(size_t) RTLogComPrintf(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);\r
\r
/**\r
* Prints a formatted string to the serial port used for logging.\r
* @param pszFormat Format string.\r
* @param args Optional arguments specified in the format string.\r
*/\r
-RTDECL(size_t) RTLogComPrintfV(const char *pszFormat, va_list args);\r
+RTDECL(size_t) RTLogComPrintfV(const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR(1, 0);\r
\r
\r
#if 0 /* not implemented yet */\r
* @param pszFormat Format string.\r
* @param ... Optional arguments specified in the format string.\r
*/\r
-RTDECL(size_t) RTLogBackdoorPrintf(const char *pszFormat, ...);\r
+RTDECL(size_t) RTLogBackdoorPrintf(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);\r
\r
/**\r
* Prints a formatted string to the backdoor port.\r
* @param pszFormat Format string.\r
* @param args Optional arguments specified in the format string.\r
*/\r
-RTDECL(size_t) RTLogBackdoorPrintfV(const char *pszFormat, va_list args);\r
+RTDECL(size_t) RTLogBackdoorPrintfV(const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR(1, 0);\r
\r
#endif /* VBOX */\r
\r
# define RTSymlinkIsDangling RT_MANGLER(RTSymlinkIsDangling)\r
# define RTSymlinkRead RT_MANGLER(RTSymlinkRead)\r
# define RTSymlinkReadA RT_MANGLER(RTSymlinkReadA)\r
+# define RTSystemIsInsideVM RT_MANGLER(RTSystemIsInsideVM)\r
# define RTSystemQueryAvailableRam RT_MANGLER(RTSystemQueryAvailableRam)\r
# define RTSystemQueryDmiString RT_MANGLER(RTSystemQueryDmiString)\r
# define RTSystemQueryOSInfo RT_MANGLER(RTSystemQueryOSInfo)\r
* optional (NULL). Max length is 32 bytes.\r
* @param ... Format string arguments.\r
*/\r
-RTDECL(int) RTSemEventCreateEx(PRTSEMEVENT phEventSem, uint32_t fFlags, RTLOCKVALCLASS hClass, const char *pszNameFmt, ...);\r
+RTDECL(int) RTSemEventCreateEx(PRTSEMEVENT phEventSem, uint32_t fFlags, RTLOCKVALCLASS hClass,\r
+ const char *pszNameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(4, 5);\r
\r
/** @name RTSemMutexCreateEx flags\r
* @{ */\r
* @param ... Format string arguments.\r
*/\r
RTDECL(int) RTSemEventMultiCreateEx(PRTSEMEVENTMULTI phEventMultiSem, uint32_t fFlags, RTLOCKVALCLASS hClass,\r
- const char *pszNameFmt, ...);\r
+ const char *pszNameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(4, 5);\r
\r
/** @name RTSemMutexCreateEx flags\r
* @{ */\r
* optional (NULL). Max length is 32 bytes.\r
* @param ... Format string arguments.\r
*/\r
-RTDECL(int) RTSemMutexCreateEx(PRTSEMMUTEX phMutexSem, uint32_t fFlags,\r
- RTLOCKVALCLASS hClass, uint32_t uSubClass, const char *pszNameFmt, ...);\r
+RTDECL(int) RTSemMutexCreateEx(PRTSEMMUTEX phMutexSem, uint32_t fFlags, RTLOCKVALCLASS hClass, uint32_t uSubClass,\r
+ const char *pszNameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(5, 6);\r
\r
/** @name RTSemMutexCreateEx flags\r
* @{ */\r
* optional (NULL). Max length is 32 bytes.\r
* @param ... Format string arguments.\r
*/\r
-RTDECL(int) RTSemRWCreateEx(PRTSEMRW phRWSem, uint32_t fFlags,\r
- RTLOCKVALCLASS hClass, uint32_t uSubClass, const char *pszNameFmt, ...);\r
+RTDECL(int) RTSemRWCreateEx(PRTSEMRW phRWSem, uint32_t fFlags, RTLOCKVALCLASS hClass, uint32_t uSubClass,\r
+ const char *pszNameFmt, ...) RT_IPRT_FORMAT_ATTR_MAYBE_NULL(5, 6);\r
\r
/** @name RTSemRWCreateEx flags\r
* @{ */\r
#include <iprt/err.h> /* for VINF_SUCCESS */\r
#if defined(RT_OS_LINUX) && defined(__KERNEL__)\r
RT_C_DECLS_BEGIN\r
+# define new newhack /* string.h: strreplace */\r
# include <linux/string.h>\r
+# undef new\r
RT_C_DECLS_END\r
\r
#elif defined(IN_XF86_MODULE) && !defined(NO_ANSIC)\r
* @param pszFormat Pointer to the format string, @see pg_rt_str_format.\r
* @param InArgs Argument list.\r
*/\r
-RTDECL(size_t) RTStrFormatV(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, PFNSTRFORMAT pfnFormat, void *pvArgFormat, const char *pszFormat, va_list InArgs);\r
+RTDECL(size_t) RTStrFormatV(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, PFNSTRFORMAT pfnFormat, void *pvArgFormat,\r
+ const char *pszFormat, va_list InArgs) RT_IPRT_FORMAT_ATTR(5, 0);\r
\r
/**\r
* Partial implementation of a printf like formatter.\r
* @param pszFormat Pointer to the format string, @see pg_rt_str_format.\r
* @param ... Argument list.\r
*/\r
-RTDECL(size_t) RTStrFormat(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, PFNSTRFORMAT pfnFormat, void *pvArgFormat, const char *pszFormat, ...);\r
+RTDECL(size_t) RTStrFormat(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, PFNSTRFORMAT pfnFormat, void *pvArgFormat,\r
+ const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(5, 6);\r
\r
/**\r
* Formats an integer number according to the parameters.\r
* @param cchPrecision Precision.\r
* @param fFlags Flags, RTSTR_F_XXX.\r
*/\r
-RTDECL(int) RTStrFormatNumber(char *psz, uint64_t u64Value, unsigned int uiBase, signed int cchWidth, signed int cchPrecision, unsigned int fFlags);\r
+RTDECL(int) RTStrFormatNumber(char *psz, uint64_t u64Value, unsigned int uiBase, signed int cchWidth, signed int cchPrecision,\r
+ unsigned int fFlags);\r
\r
/**\r
* Formats an unsigned 8-bit number.\r
* @param pszFormat Pointer to the format string, @see pg_rt_str_format.\r
* @param args The format argument.\r
*/\r
-RTDECL(size_t) RTStrPrintfV(char *pszBuffer, size_t cchBuffer, const char *pszFormat, va_list args);\r
+RTDECL(size_t) RTStrPrintfV(char *pszBuffer, size_t cchBuffer, const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR(3, 0);\r
\r
/**\r
* String printf.\r
* @param pszFormat Pointer to the format string, @see pg_rt_str_format.\r
* @param ... The format argument.\r
*/\r
-RTDECL(size_t) RTStrPrintf(char *pszBuffer, size_t cchBuffer, const char *pszFormat, ...);\r
+RTDECL(size_t) RTStrPrintf(char *pszBuffer, size_t cchBuffer, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(3, 4);\r
\r
\r
/**\r
* @param pszFormat Pointer to the format string, @see pg_rt_str_format.\r
* @param args The format argument.\r
*/\r
-RTDECL(size_t) RTStrPrintfExV(PFNSTRFORMAT pfnFormat, void *pvArg, char *pszBuffer, size_t cchBuffer, const char *pszFormat, va_list args);\r
+RTDECL(size_t) RTStrPrintfExV(PFNSTRFORMAT pfnFormat, void *pvArg, char *pszBuffer, size_t cchBuffer,\r
+ const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR(5, 0);\r
\r
/**\r
* String printf with custom formatting.\r
* @param pszFormat Pointer to the format string, @see pg_rt_str_format.\r
* @param ... The format argument.\r
*/\r
-RTDECL(size_t) RTStrPrintfEx(PFNSTRFORMAT pfnFormat, void *pvArg, char *pszBuffer, size_t cchBuffer, const char *pszFormat, ...);\r
+RTDECL(size_t) RTStrPrintfEx(PFNSTRFORMAT pfnFormat, void *pvArg, char *pszBuffer, size_t cchBuffer,\r
+ const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(5, 6);\r
\r
\r
/**\r
* @param args The format argument.\r
* @param pszTag Allocation tag used for statistics and such.\r
*/\r
-RTDECL(int) RTStrAPrintfVTag(char **ppszBuffer, const char *pszFormat, va_list args, const char *pszTag);\r
+RTDECL(int) RTStrAPrintfVTag(char **ppszBuffer, const char *pszFormat, va_list args, const char *pszTag) RT_IPRT_FORMAT_ATTR(2, 0);\r
\r
/**\r
* Allocating string printf.\r
* @param pszFormat Pointer to the format string, @see pg_rt_str_format.\r
* @param ... The format argument.\r
*/\r
-DECLINLINE(int) RTStrAPrintf(char **ppszBuffer, const char *pszFormat, ...)\r
+DECLINLINE(int) RT_IPRT_FORMAT_ATTR(2, 3) RTStrAPrintf(char **ppszBuffer, const char *pszFormat, ...)\r
{\r
int cbRet;\r
va_list va;\r
* @param pszFormat Pointer to the format string, @see pg_rt_str_format.\r
* @param ... The format argument.\r
*/\r
-DECLINLINE(int) RTStrAPrintfTag(char **ppszBuffer, const char *pszTag, const char *pszFormat, ...)\r
+DECLINLINE(int) RT_IPRT_FORMAT_ATTR(3, 4) RTStrAPrintfTag(char **ppszBuffer, const char *pszTag, const char *pszFormat, ...)\r
{\r
int cbRet;\r
va_list va;\r
* @param args The format argument.\r
* @param pszTag Allocation tag used for statistics and such.\r
*/\r
-RTDECL(char *) RTStrAPrintf2VTag(const char *pszFormat, va_list args, const char *pszTag);\r
+RTDECL(char *) RTStrAPrintf2VTag(const char *pszFormat, va_list args, const char *pszTag) RT_IPRT_FORMAT_ATTR(1, 0);\r
\r
/**\r
* Allocating string printf, version 2 (default tag).\r
* @param pszFormat Pointer to the format string, @see pg_rt_str_format.\r
* @param ... The format argument.\r
*/\r
-DECLINLINE(char *) RTStrAPrintf2(const char *pszFormat, ...)\r
+DECLINLINE(char *) RT_IPRT_FORMAT_ATTR(1, 2) RTStrAPrintf2(const char *pszFormat, ...)\r
{\r
char *pszRet;\r
va_list va;\r
* @param pszFormat Pointer to the format string, @see pg_rt_str_format.\r
* @param ... The format argument.\r
*/\r
-DECLINLINE(char *) RTStrAPrintf2Tag(const char *pszTag, const char *pszFormat, ...)\r
+DECLINLINE(char *) RT_IPRT_FORMAT_ATTR(2, 3) RTStrAPrintf2Tag(const char *pszTag, const char *pszFormat, ...)\r
{\r
char *pszRet;\r
va_list va;\r
# endif\r
# include <sys/types.h>\r
# ifndef offsetof\r
-# error "offsetof is not defined..."\r
+# error "offsetof is not defined!"\r
# endif\r
\r
# elif defined(RT_OS_FREEBSD) && HC_ARCH_BITS == 64 && defined(RT_ARCH_X86)\r
* @param pszFormat The format string.\r
* @param va Arguments for the format string.\r
*/\r
-typedef DECLCALLBACK(void) FNRTDUMPPRINTFV(void *pvUser, const char *pszFormat, va_list va);\r
+typedef DECLCALLBACK(void) FNRTDUMPPRINTFV(void *pvUser, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(2, 0);\r
/** Pointer to a generic printf-like function for dumping. */\r
typedef FNRTDUMPPRINTFV *PFNRTDUMPPRINTFV;\r
\r
*/\r
typedef union RTPTRUNION\r
{\r
- /** Pointer into the void... */\r
+ /** Pointer into the void. */\r
void *pv;\r
/** As a signed integer. */\r
intptr_t i;\r
*/\r
typedef union RTCPTRUNION\r
{\r
- /** Pointer into the void... */\r
+ /** Pointer into the void. */\r
void const *pv;\r
/** As a signed integer. */\r
intptr_t i;\r
*/\r
typedef union RTVPTRUNION\r
{\r
- /** Pointer into the void... */\r
+ /** Pointer into the void. */\r
void volatile *pv;\r
/** As a signed integer. */\r
intptr_t i;\r
*/\r
typedef union RTCVPTRUNION\r
{\r
- /** Pointer into the void... */\r
+ /** Pointer into the void. */\r
void const volatile *pv;\r
/** As a signed integer. */\r
intptr_t i;\r
\r
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)\r
\r
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)\r
+static const char *sf_follow_link(struct dentry *dentry, void **cookie)\r
+# else\r
static void *sf_follow_link(struct dentry *dentry, struct nameidata *nd)\r
+# endif\r
{\r
struct inode *inode = dentry->d_inode;\r
struct sf_glob_info *sf_g = GET_GLOB_INFO(inode->i_sb);\r
error = -EPROTO;\r
}\r
}\r
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)\r
+ return error ? ERR_PTR(error) : (*cookie = path);\r
+# else\r
nd_set_link(nd, error ? ERR_PTR(error) : path);\r
return NULL;\r
+# endif\r
}\r
\r
+# if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)\r
static void sf_put_link(struct dentry *dentry, struct nameidata *nd, void *cookie)\r
{\r
char *page = nd_get_link(nd);\r
if (!IS_ERR(page))\r
free_page((unsigned long)page);\r
}\r
+#endif\r
\r
struct inode_operations sf_lnk_iops =\r
{\r
.readlink = generic_readlink,\r
.follow_link = sf_follow_link,\r
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)\r
+ .put_link = free_page_put_link,\r
+# else\r
.put_link = sf_put_link\r
+# endif\r
};\r
\r
#endif\r
-/* $Id: the-linux-kernel.h 100874 2015-06-09 14:01:31Z bird $ */\r
+/* $Id: the-linux-kernel.h 102085 2015-08-13 13:26:00Z bird $ */\r
/** @file\r
* IPRT - Include all necessary headers for the Linux kernel.\r
*/\r
* The AMD 64 switch_to in macro in arch/x86/include/asm/switch_to.h stopped\r
* restoring flags.\r
* @{ */\r
-#ifdef CONFIG_X86_SMAP\r
+#if defined(CONFIG_X86_SMAP) || defined(RT_STRICT) || defined(IPRT_WITH_EFLAGS_AC_PRESERVING)\r
# include <iprt/asm-amd64-x86.h>\r
# define IPRT_X86_EFL_AC RT_BIT(18)\r
-# define IPRT_LINUX_SAVE_EFL_AC() RTCCUINTREG fSavedEfl = ASMGetFlags();\r
+# define IPRT_LINUX_SAVE_EFL_AC() RTCCUINTREG fSavedEfl = ASMGetFlags()\r
# define IPRT_LINUX_RESTORE_EFL_AC() ASMSetFlags(fSavedEfl)\r
-# define IPRT_LINUX_RESTORE_EFL_ONLY_AC() ASMSetFlags((ASMGetFlags() & ~IPRT_X86_EFL_AC) | (fSavedEfl & IPRT_X86_EFL_AC))\r
+# define IPRT_LINUX_RESTORE_EFL_ONLY_AC() ASMChangeFlags(~IPRT_X86_EFL_AC, fSavedEfl & IPRT_X86_EFL_AC)\r
#else\r
# define IPRT_LINUX_SAVE_EFL_AC() do { } while (0)\r
# define IPRT_LINUX_RESTORE_EFL_AC() do { } while (0)\r
#define VBOX_VERSION_MAJOR 5
#define VBOX_VERSION_MINOR 0
-#define VBOX_VERSION_BUILD 0
-#define VBOX_VERSION_STRING_RAW "5.0.0"
-#define VBOX_VERSION_STRING "5.0.0"
+#define VBOX_VERSION_BUILD 2
+#define VBOX_VERSION_STRING_RAW "5.0.2"
+#define VBOX_VERSION_STRING "5.0.2"
#define VBOX_API_VERSION_STRING "5_0"
#define VBOX_BUILD_SERVER_BUILD 1
# define RTSymlinkIsDangling RT_MANGLER(RTSymlinkIsDangling)\r
# define RTSymlinkRead RT_MANGLER(RTSymlinkRead)\r
# define RTSymlinkReadA RT_MANGLER(RTSymlinkReadA)\r
+# define RTSystemIsInsideVM RT_MANGLER(RTSystemIsInsideVM)\r
# define RTSystemQueryAvailableRam RT_MANGLER(RTSystemQueryAvailableRam)\r
# define RTSystemQueryDmiString RT_MANGLER(RTSystemQueryDmiString)\r
# define RTSystemQueryOSInfo RT_MANGLER(RTSystemQueryOSInfo)\r
#define VBOX_VERSION_MAJOR 5
#define VBOX_VERSION_MINOR 0
-#define VBOX_VERSION_BUILD 0
-#define VBOX_VERSION_STRING_RAW "5.0.0"
-#define VBOX_VERSION_STRING "5.0.0"
+#define VBOX_VERSION_BUILD 2
+#define VBOX_VERSION_STRING_RAW "5.0.2"
+#define VBOX_VERSION_STRING "5.0.2"
#define VBOX_API_VERSION_STRING "5_0"
#define VBOX_BUILD_SERVER_BUILD 1