SETPGID(2) BSD System Calls Manual SETPGID(2)NAME
setpgid, setpgrp -- set process group
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <unistd.h>
int
setpgid(pid_t pid, pid_t pgrp);
int
setpgrp(pid_t pid, pid_t pgrp);
DESCRIPTION
setpgid() sets the process group of the specified process pid to the specified pgrp. If pid is zero, then the call applies to the current
process. If pgrp is zero, then the process id of the process specified by pid is used instead.
If the invoker is not the super-user, then the affected process must have the same effective user-id as the invoker or be a descendant of the
invoking process.
RETURN VALUES
setpgid() returns 0 when the operation was successful. If the request failed, -1 is returned and the global variable errno indicates the
reason.
ERRORS
setpgid() will fail and the process group will not be altered if:
[EACCES] The value of the pid argument matches the process ID of a child process of the calling process, and the child process has
successfully executed one of the exec functions.
[EINVAL] The value of the pgrp argument is less than zero.
[EPERM] The effective user ID of the requested process is different from that of the caller and the process is not a descendant of
the calling process.
[ESRCH] The value of the pid argument does not match the process ID of the calling process or of a child process of the calling
process.
SEE ALSO getpgrp(2)STANDARDS
The setpgid() function conforms to ISO/IEC 9945-1:1990 (``POSIX.1'').
COMPATIBILITY
setpgrp() is identical to setpgid(), and is retained for calling convention compatibility with historical versions of BSD.
BSD December 18, 2003 BSD
Check Out this Related Man Page
SETPGID(2) BSD System Calls Manual SETPGID(2)NAME
setpgid, setpgrp -- set process group
SYNOPSIS
#include <unistd.h>
int
setpgid(pid_t pid, pid_t pgrp);
int
setpgrp(pid_t pid, pid_t pgrp);
DESCRIPTION
Setpgid() sets the process group of the specified process pid to the specified pgrp. If pid is zero, then the call applies to the current
process.
If the invoker is not the super-user, then the affected process must have the same effective user-id as the invoker or be a descendant of the
invoking process.
RETURN VALUES
Setpgid() returns 0 when the operation was successful. If the request failed, -1 is returned and the global variable errno indicates the
reason.
ERRORS
Setpgid() will fail and the process group will not be altered if:
[EACCES] The value of the pid argument matches the process ID of a child process of the calling process, and the child process has
successfully executed one of the exec functions.
[EPERM] The effective user ID of the requested process is different from that of the caller and the process is not a descendant of
the calling process.
[ESRCH] The value of the pid argument does not match the process ID of the calling process or of a child process of the calling
process.
SEE ALSO getpgrp(2)STANDARDS
The setpgid() function conforms to IEEE Std 1003.1-1988 (``POSIX.1'').
COMPATIBILITY
Setpgrp() is identical to setpgid(), and is retained for calling convention compatibility with historical versions of BSD.
4th Berkeley Distribution June 4, 1993 4th Berkeley Distribution
question: for the below program
i just printed the value for pid, child pid and parent pid
why does it give me 6 values? i assume ppid is 28086
but can't figure out why there are 5 values printed instead of just two!
can someone comment on that!
#include<stdio.h>
#define DIM 8
int... (3 Replies)
Hi ALL :
consider the given 2 codes:
//p1.c
#include<stdio.h>
FILE * fp;
main()
{
pid_t pid;
fp=fopen("..........");
// now i am transfering the control to a new process(p2.c).
pid=fork();
if(pid==0)
.....
execl(" p2".....);
....
... (6 Replies)
Hi,
Am working on linux. while forking in a loop how to avoid the child process from forking..for example
int n = 5;
pid_t pid;
pid_t ch_pid;
/*exactly wanted to create n processes and not 2^n processes*/
for(i = 0; i < n;i++)
{
if(pid = fork())
{
/* parent... (4 Replies)
Hi,
I need to get the pid of a process and have to store the pid in a variable and i want to use this value(pid) of the variable for some process. Please can anyone tell me how to get the pid of a process and store it in a variable. please help me on this.
Thanks in advance,
Amudha (7 Replies)
Hi,
I have a unix script that basically has a while loop inside which it checks Oracle database for certain records. If it finds the records, it does some processing and then goes back to the while loop. If it doesnot find any matching records, then it sleeps for 30 seconds and then goes back to... (17 Replies)
Hi,
We've a process on AIX UNIX server which is executed by multiple uses during a day. I wish to create a log file for every time the process is executed. I wish to know how unique are PID(s) on AIX UNIX servers if I were to name the log files with <date> and <PID>?
E.g. If I create my... (1 Reply)
The monitoring tools what we have not able to see historical information about the process name or pid number for the process that consumed high CPU or memory or paging space. Can you please suggest some of the best monitoring tools available in the market that monitors primarily AIX and other Unix... (0 Replies)