scroll mode for very long start menus
[reactos.git] / posix / lib / psxdll / unistd / getppid.c
1 /* $Id: getppid.c,v 1.4 2002/10/29 04:45:48 rex Exp $
2 */
3 /*
4 * COPYRIGHT: See COPYING in the top level directory
5 * PROJECT: ReactOS POSIX+ Subsystem
6 * FILE: subsys/psx/lib/psxdll/unistd/getppid.c
7 * PURPOSE: Get the parent process ID
8 * PROGRAMMER: KJK::Hyperion <noog@libero.it>
9 * UPDATE HISTORY:
10 * 15/02/2002: Created
11 */
12
13 #include <ddk/ntddk.h>
14 #include <sys/types.h>
15 #include <unistd.h>
16 #include <psx/errno.h>
17
18 pid_t getppid(void)
19 {
20 PROCESS_BASIC_INFORMATION pbiInfo;
21 NTSTATUS nErrCode;
22
23 nErrCode = NtQueryInformationProcess
24 (
25 NtCurrentProcess(),
26 ProcessBasicInformation,
27 &pbiInfo,
28 sizeof(pbiInfo),
29 NULL
30 );
31
32 if(!NT_SUCCESS(nErrCode))
33 {
34 errno = __status_to_errno(nErrCode);
35 return (0);
36 }
37
38 return (pbiInfo.InheritedFromUniqueProcessId);
39 }
40
41 /* EOF */
42