* win32/win32.c (getppid): typo. [ruby-dev:36202]

* process.c (get_ppid): mention the return value on Windows.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2008-09-08 09:17:22 +00:00
parent 1625494feb
commit c27baaa090
3 changed files with 23 additions and 17 deletions

View File

@ -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> Mon Sep 8 18:15:59 2008 Tanaka Akira <akr@fsij.org>
* tool/transcode-tblgen.rb (ArrayCode): less string substitutions. * tool/transcode-tblgen.rb (ArrayCode): less string substitutions.

View File

@ -162,8 +162,8 @@ get_pid(void)
* call-seq: * call-seq:
* Process.ppid => fixnum * Process.ppid => fixnum
* *
* Returns the process id of the parent of this process. Always * Returns the process id of the parent of this process. Returns
* returns 0 on NT. Not available on all platforms. * untrustworthy value on Win32/64. Not available on all platforms.
* *
* puts "I am #{Process.pid}" * puts "I am #{Process.pid}"
* Process.fork { puts "Dad is #{Process.ppid}" } * Process.fork { puts "Dad is #{Process.ppid}" }

View File

@ -3965,21 +3965,21 @@ rb_w32_getppid(void)
HANDLE hNtDll = GetModuleHandle("ntdll.dll"); HANDLE hNtDll = GetModuleHandle("ntdll.dll");
if (hNtDll) { if (hNtDll) {
pNtQueryInformationProcess = (long (WINAPI *)(HANDLE, int, void *, ULONG, ULONG *))GetProcAddress(hNtDll, "NtQueryInformationProcess"); pNtQueryInformationProcess = (long (WINAPI *)(HANDLE, int, void *, ULONG, ULONG *))GetProcAddress(hNtDll, "NtQueryInformationProcess");
if (pNtQueryInformationProcess) { }
struct { }
long ExitStatus; if (pNtQueryInformationProcess) {
void* PebBaseAddress; struct {
ULONG AffinityMask; long ExitStatus;
ULONG BasePriority; void* PebBaseAddress;
ULONG UniqueProcessId; ULONG AffinityMask;
ULONG ParentProcessId; ULONG BasePriority;
} pbi; ULONG UniqueProcessId;
ULONG len; ULONG ParentProcessId;
long ret = pNtQueryInformationProcess(GetCurrentProcess(), 0, &pbi, sizeof(pbi), &len); } pbi;
if (!ret) { ULONG len;
ppid = pbi.ParentProcessId; long ret = pNtQueryInformationProcess(GetCurrentProcess(), 0, &pbi, sizeof(pbi), &len);
} if (!ret) {
} ppid = pbi.ParentProcessId;
} }
} }
} }