sys::process::get_id() now returns the process ID instead of a process handle on...
authorAaron Ballman <aaron@aaronballman.com>
Sat, 8 Jun 2013 20:29:03 +0000 (20:29 +0000)
committerAaron Ballman <aaron@aaronballman.com>
Sat, 8 Jun 2013 20:29:03 +0000 (20:29 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183621 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/Process.h
lib/Support/Windows/Process.inc
unittests/Support/ProcessTest.cpp

index 4256d4a03b9d8da28721562c5088b251eb9b8630..0baf7b911c164fef814c46b0588c6e8f1136919f 100644 (file)
@@ -50,13 +50,13 @@ protected:
 public:
   /// \brief Operating system specific type to identify a process.
   ///
-  /// Note that the windows one is defined to 'void *' as this is the
-  /// documented type for HANDLE on windows, and we don't want to pull in the
+  /// Note that the windows one is defined to 'unsigned long' as this is the
+  /// documented type for DWORD on windows, and we don't want to pull in the
   /// Windows headers here.
 #if defined(LLVM_ON_UNIX)
   typedef pid_t id_type;
 #elif defined(LLVM_ON_WIN32)
-  typedef void *id_type; // Must match the type of HANDLE.
+  typedef unsigned long id_type; // Must match the type of DWORD.
 #else
 #error Unsupported operating system.
 #endif
index ad9412852f101f6d8b8ab48a990eea721e44a318..359b99f5131f8d971ef3c7f228e9fb2b6fd1e0a1 100644 (file)
@@ -40,7 +40,7 @@ using namespace sys;
 
 
 process::id_type self_process::get_id() {
-  return GetCurrentProcess();
+  return GetCurrentProcessId();
 }
 
 static TimeValue getTimeValueFromFILETIME(FILETIME Time) {
index e57c0e6eaf81ab664e078700b28adfb1f3661b37..eff9c711a1ad0fee31a7d5f5c27e6aab0c6ada76 100644 (file)
@@ -26,7 +26,7 @@ TEST(ProcessTest, SelfProcess) {
 #if defined(LLVM_ON_UNIX)
   EXPECT_EQ(getpid(), process::get_self()->get_id());
 #elif defined(LLVM_ON_WIN32)
-  EXPECT_EQ(GetCurrentProcess(), process::get_self()->get_id());
+  EXPECT_EQ(GetCurrentProcessId(), process::get_self()->get_id());
 #endif
 
   EXPECT_LT(1u, process::get_self()->page_size());