| Skip Navigation Links | |
| Exit Print View | |
![]() | man pages section 2: System Calls Oracle Solaris 11 Information Library |
- get process, process group, and parent process IDs
#include <unistd.h>pid_tgetpid(void);
pid_tgetpgrp(void);
pid_tgetppid(void);
pid_tgetpgid(pid_tpid);
Thegetpid() function returns the process ID of the calling process.
Thegetpgrp() function returns the process group ID of the calling process.
Thegetppid() function returns the parent process ID of the calling process.
Thegetpgid() function returns the process group ID of the process whoseprocess ID is equal topid, or the process group ID ofthe calling process, ifpid is equal to 0.
Thegetpid(),getpgrp(), andgetppid() functions are always successful and no returnvalue is reserved to indicate an error.
Upon successful completion,getpgid() returns the process group ID. Otherwise,getpgid() returns(pid_t)-1 and setserrno to indicate the error.
Thegetpgid() function will fail if:
The process whose process ID is equal topid is not in the same session as the calling process, and the implementation does not allow access to the process group ID of that process from the calling process.
There is no process with a process ID equal topid.
Thegetpgid() function may fail if:
The value of thepid argument is invalid.
Seeattributes(5) for descriptions of the following attributes:
|
Intro(2),exec(2),fork(2),getsid(2),setpgid(2),setpgrp(2),setsid(2),signal(3C),attributes(5),standards(5)
Copyright © 2011, Oracle and/or its affiliates. All rights reserved.Legal Notices | ![]() ![]() |