Warning: main(topsc.html) [function.main]: failed to open stream: No such file or directory in /home/eng123/public_html/sourcecode/c/unix/processid.html on line 13

Warning: main(topsc.html) [function.main]: failed to open stream: No such file or directory in /home/eng123/public_html/sourcecode/c/unix/processid.html on line 13

Warning: main() [function.include]: Failed opening 'topsc.html' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/eng123/public_html/sourcecode/c/unix/processid.html on line 13


Warning: main(leftsc.html) [function.main]: failed to open stream: No such file or directory in /home/eng123/public_html/sourcecode/c/unix/processid.html on line 16

Warning: main(leftsc.html) [function.main]: failed to open stream: No such file or directory in /home/eng123/public_html/sourcecode/c/unix/processid.html on line 16

Warning: main() [function.include]: Failed opening 'leftsc.html' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/eng123/public_html/sourcecode/c/unix/processid.html on line 16

Displaying  Source Code(s)  
 


Warning: main(adsc.html) [function.main]: failed to open stream: No such file or directory in /home/eng123/public_html/sourcecode/c/unix/processid.html on line 31

Warning: main(adsc.html) [function.main]: failed to open stream: No such file or directory in /home/eng123/public_html/sourcecode/c/unix/processid.html on line 31

Warning: main() [function.include]: Failed opening 'adsc.html' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/eng123/public_html/sourcecode/c/unix/processid.html on line 31

 
Program to print its Process ID, Parent Process ID and Group ID

--------------------------------------------------------------------------------



/*
* Program to print its Process ID, Parent Process ID and Group ID
*/

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>

int main()
{
pid_t pid, ppid;
gid_t gid;

/* get the process id */
if ((pid = getpid()) < 0) {
perror("
unable to get pid");
} else {
printf("
The process id is %d", pid);
}

/* get the parent process id */
if ((ppid = getppid()) < 0) {
perror("
unable to get the ppid");
} else {
printf("
The parent process id is %d", ppid);
}

/* get the group process id */
if ((gid = getgid()) < 0) {
perror("
unable to get the group id<BR>);
} else {
printf("
The group id is %d<BR>, gid);
}

return(0);
}

 

 

 

Contribute content or training reports / feedback / Comments
job placement papers
All rights reserved © copyright 123ENG