Name
getpid, getppid
- get process identification
Library
libc.lib
Synopsis
Detailed description
The
getpid
system call
returns
the process ID of
the calling process.
Though the ID is guaranteed to be unique, it should
NOT
be used for constructing temporary file names, for
security reasons; see
mkstemp
instead.
The
getppid
system call
returns the process ID of the parent
of the calling process.
Examples
/**
* Detailed description : Sample usage of getpid system call
**/
#include <unistd.h>
int main()
{
pid_t pid ;
if((pid = getpid()) < 0 )
{
printf("getpid system call failed \n") ;
return -1 ;
}
printf("pid of this process is %d \n " , pid) ;
return 0 ;
}
Errors
The
getpid
and
getppid
system calls are always successful, and no return value is reserved to
indicate an error.
See also
Feedback
For additional information or queries on this page send feedback
© 2005-2007 Nokia
|
|