Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

getpgid(2) [osf1 man page]

getpgid(2)							System Calls Manual							getpgid(2)

NAME
getpgid - Gets process group ID LIBRARY
Standard C Library (libc.a) SYNOPSIS
#include <sys/types.h> #include <unistd.h> pid_t getpgid( pid_t pid); PARAMETERS
Specifies the process ID of the target process; zero implies the calling process. DESCRIPTION
The getpgid() function returns the process group ID of the process specified by the process ID pid. Specifying a pid of 0 (zero) returns the process group ID of the calling process. RETURN VALUES
The getpgid() function returns the process group ID of the process specified. If there was an error, a value of -1 is returned and errno is set to indicate the error. ERRORS
If any of the following conditions occurs, the getpgid() function sets errno to the corresponding value: The specified process is not in the same session as the calling process, and the calling process lacks sufficient privilege to read the specified process. As released, Tru64 UNIX does not check the privilege. No process has been found that has a process ID identical to that specified by the pid parameter. RELATED INFORMATION
Functions: exec(2), fork(2), setpgid(2) delim off getpgid(2)

Check Out this Related Man Page

getpid(2)							   System Calls 							 getpid(2)

NAME
getpid, getpgrp, getppid, getpgid - get process, process group, and parent process IDs SYNOPSIS
#include <unistd.h> pid_t getpid(void); pid_t getpgrp(void); pid_t getppid(void); pid_t getpgid(pid_t pid); DESCRIPTION
The getpid() function returns the process ID of the calling process. The getpgrp() function returns the process group ID of the calling process. The getppid() function returns the parent process ID of the calling process. The getpgid() function returns the process group ID of the process whose process ID is equal to pid, or the process group ID of the calling process, if pid is equal to 0. RETURN VALUES
Upon successful completion, these functions return the process group ID. Otherwise, getpgid() returns (pid_t)-1 and sets errno to indicate the error. ERRORS
The getpgid() function will fail if: EPERM The process whose process ID is equal to pid 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. ESRCH There is no process with a process ID equal to pid. The getpgid() function may fail if: EINVAL The value of the pid argument is invalid. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |Async-Signal-Safe | +-----------------------------+-----------------------------+ SEE ALSO
intro(2), exec(2), fork(2), getsid(2), setpgid(2), setpgrp(2), setsid(2), signal(3C), attributes(5), standards(5) SunOS 5.10 28 Dec 1996 getpid(2)
Man Page

15 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Finding Out When A Process Has Finished?

Problem I have an application which basically runs lots of UNIX programs remotely, using the Telnet protocol. For each program it remotely executes, it stores the process ID (PID) for that process. At regular intervals, I would like my application to take the PID for every process still... (5 Replies)
Discussion started by: 1cuervo
5 Replies

2. UNIX for Dummies Questions & Answers

Newbie: The UNIX Login process

I'm a complete newbie to UNIX so bear with me please... I would like to get a description or process flow of a typcial UNIX loging process....for example, from the moment someone inputs their ID and password to final access. What are the files and order in which they are accessed? How does the... (2 Replies)
Discussion started by: ngp
2 Replies

3. Programming

get process name from pid - getcommandline

All, I have a requirement to get the process name of the newly execv'd process. After getting the complete process name, I need to carry out further operations on that. Problem so far is how do I retrieve the name of the process ? There is an API in windows called GetCommandLine. I... (2 Replies)
Discussion started by: vino
2 Replies

4. UNIX for Dummies Questions & Answers

process id

hi folks, how do you find a process id if you are given a port number? (3 Replies)
Discussion started by: kirpond
3 Replies

5. Programming

forking a new process

Hi I'm currently working with C on UNIX (HPUX) and need to be able to fork a seperate Java process from within a running C process. I can run the following code from the command line via a script but am having difficulty getting it to work from within the code. I am trying to use execl. Is... (4 Replies)
Discussion started by: themezzaman
4 Replies

6. Solaris

files asscciated with a particular process

if i am finding out that a process has a more cpu usage before killing the process what are the commands to find out the files which are used by the process. can anyone help this thanks (1 Reply)
Discussion started by: sureshlee_83
1 Replies

7. AIX

process the old file first

hello i have direcotry in which i will be getting a number of input files with different names and i need to write a script where i need to process the older file first and then come out of the loop. can any one throw some light appreciate (2 Replies)
Discussion started by: dsdev_123
2 Replies

8. UNIX for Dummies Questions & Answers

which process writes to file

Some process rewrites a file ( i'm hacked :) Can I somehow monitor which process does that? (2 Replies)
Discussion started by: hachik
2 Replies

9. UNIX for Advanced & Expert Users

lsof and have to find file, pid

Hi All, My target is to find the biggest files opened by any process and from that i have to find process id and the corresponding file also. To get the process id which is accessing the biggest file in the given file system, i am using the below command. pid=`lsof -s /home/arun/my_work |... (4 Replies)
Discussion started by: Arunprasad
4 Replies

10. Solaris

How to know about a hanged process

Hi, My process is visible in 'ps' command but actually it is not working or it got hanged. This process is not generating any log. Now How can I know that my process got hanged. Please help. (2 Replies)
Discussion started by: sanjay1979
2 Replies

11. Programming

[C] Process pid by name

Hi I use linux OS. I've already written a function that allow me to get the process name by pid. (searching in /proc). Now I'd like to perform the inverse task.I mean get the process pid by its name. I could write a function that search in every folder in /proc for the process name, but i... (2 Replies)
Discussion started by: Dedalus
2 Replies

12. AIX

Need explanation of 'who -d' output

Can someone tell me what the output of 'who -d' is ? What's causing the process in the list to be there ? What can be done to get rid of / fix those process ? Are those process simple problems, important or urgent onces ? I am asking because while looking for another 'who' option, I... (2 Replies)
Discussion started by: Browser_ice
2 Replies

13. Shell Programming and Scripting

simple shell

Hi everyone I am writing a simple shell but the background '&' not working i dont understand this is my fork pid_t pid; pid=fork(); if(pid<0) { printf("\nChild process failed."); exit(1);... (2 Replies)
Discussion started by: basicxx
2 Replies

14. Shell Programming and Scripting

block process checking

How can i check block process in Linux? If found any what action is required? How to check the pid of process? How to kill the block process? How to find out bottleneck process? (3 Replies)
Discussion started by: learnbash
3 Replies

15. UNIX for Beginners Questions & Answers

Pid file and process check

Hello, I am running ubuntu14.04 What I am trying to do is restart a process with a shell when pid is dead. I restored pid nr in a file and check with ps aux | grep -v grep | grep $(cat *.pid)| awk '{ print $2 }' While surfing on google, I have found an answer saying that restoring pid in a... (2 Replies)
Discussion started by: baris35
2 Replies