summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--process.c4
-rw-r--r--win32/win32.c30
3 files changed, 23 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 34b95e54fc..3de7733b96 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Mon Sep 8 18:13:20 2008 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * win32/win32.c (getppid): typo. [ruby-dev:36202]
+
+ * process.c (get_ppid): mention the return value on Windows.
+
Mon Sep 8 18:15:59 2008 Tanaka Akira <akr@fsij.org>
* tool/transcode-tblgen.rb (ArrayCode): less string substitutions.
diff --git a/process.c b/process.c
index 8acfcc36db..a1c8ce8863 100644
--- a/process.c
+++ b/process.c
@@ -162,8 +162,8 @@ get_pid(void)
* call-seq:
* Process.ppid => fixnum
*
- * Returns the process id of the parent of this process. Always
- * returns 0 on NT. Not available on all platforms.
+ * Returns the process id of the parent of this process. Returns
+ * untrustworthy value on Win32/64. Not available on all platforms.
*
* puts "I am #{Process.pid}"
* Process.fork { puts "Dad is #{Process.ppid}" }
diff --git a/win32/win32.c b/win32/win32.c
index 7c802aba6b..5774d0c503 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -3965,21 +3965,21 @@ rb_w32_getppid(void)
HANDLE hNtDll = GetModuleHandle("ntdll.dll");
if (hNtDll) {
pNtQueryInformationProcess = (long (WINAPI *)(HANDLE, int, void *, ULONG, ULONG *))GetProcAddress(hNtDll, "NtQueryInformationProcess");
- if (pNtQueryInformationProcess) {
- struct {
- long ExitStatus;
- void* PebBaseAddress;
- ULONG AffinityMask;
- ULONG BasePriority;
- ULONG UniqueProcessId;
- ULONG ParentProcessId;
- } pbi;
- ULONG len;
- long ret = pNtQueryInformationProcess(GetCurrentProcess(), 0, &pbi, sizeof(pbi), &len);
- if (!ret) {
- ppid = pbi.ParentProcessId;
- }
- }
+ }
+ }
+ if (pNtQueryInformationProcess) {
+ struct {
+ long ExitStatus;
+ void* PebBaseAddress;
+ ULONG AffinityMask;
+ ULONG BasePriority;
+ ULONG UniqueProcessId;
+ ULONG ParentProcessId;
+ } pbi;
+ ULONG len;
+ long ret = pNtQueryInformationProcess(GetCurrentProcess(), 0, &pbi, sizeof(pbi), &len);
+ if (!ret) {
+ ppid = pbi.ParentProcessId;
}
}
}