X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=common%2Fos_process.hpp;h=e1b1df17179e8457239e9b021d593b30d23eaac5;hb=refs%2Fheads%2Fglx-copy-sub-buffer;hp=ba53408ccb8faa662df5d6f3ed021ce5e7d890f9;hpb=ee659c84695e9f94b1f6a5f8be203dc0012ca685;p=apitrace diff --git a/common/os_process.hpp b/common/os_process.hpp index ba53408..e1b1df1 100644 --- a/common/os_process.hpp +++ b/common/os_process.hpp @@ -33,6 +33,9 @@ #ifdef _WIN32 #include +#else +#include +#include #endif #include "os.hpp" @@ -41,7 +44,26 @@ namespace os { -inline void +typedef +#ifdef _WIN32 + DWORD +#else + pid_t +#endif +ProcessId; + + +static inline ProcessId +getCurrentProcessId(void) { +#ifdef _WIN32 + return GetCurrentProcessId(); +#else + return getpid(); +#endif +} + + +static inline void setEnvironment(const char *name, const char *value) { #ifdef _WIN32 SetEnvironmentVariableA(name, value); @@ -51,7 +73,7 @@ setEnvironment(const char *name, const char *value) { } -inline void +static inline void unsetEnvironment(const char *name) { #ifdef _WIN32 SetEnvironmentVariableA(name, NULL);