setsid(2) System Calls Manual setsid(2)NAME
setsid - Sets the process group ID
SYNOPSIS
#include <unistd.h>
pid_t setsid( void );
Application developers may want to specify an #include statement for <sys/types.h> before the one for <unistd.h> if programs are being
developed for multiple platforms. The additional #include statement is not required on Tru64 UNIX systems or by ISO or X/Open standards,
but may be required on other vendors' systems that conform to these standards.
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
setsid(): XPG4, XPG4-UNIX
Refer to the standards(5) reference page for more information about industry standards and associated tags.
DESCRIPTION
The setsid() function creates a new session when the calling process is not a process group leader. The calling process then becomes the
session leader of this session, becomes the process leader of the new process group, and has no controlling terminal. The process group ID
of the calling process is set equal to its process ID. The calling process becomes the only process in the new process group and the only
process in the new session.
RETURN VALUES
Upon successful completion, the setsid function returns the value of the new process group ID. Otherwise, a value of (pid_t)-1 is returned
and errno is set to indicate the error.
ERRORS
The setsid() function sets errno to the specified values for the following conditions: The calling process is already the process group
leader, or the process group ID of another process matches the process ID of the calling process.
RELATED INFORMATION
Functions: getpid(2), getsid(2), setpgid(2)
Standards: standards(5) delim off
setsid(2)
Check Out this Related Man Page
setsid(2) System Calls Manual setsid(2)NAME
setsid - create session and set process group ID
SYNOPSIS DESCRIPTION
If the calling process is not a process group leader, creates a new session. The calling process becomes the session leader of this new
session, it becomes the process group leader of a new process group, and it has no controlling terminal. The process group ID of the call-
ing process is set equal to the process ID of the calling process. The calling process is the only process in the new process group and
the only process in the new session.
Security Restrictions
Some or all of the actions associated with this system call may require privileges. See privileges(5) for more information.
RETURN VALUE
Upon successful completion, returns the value of the new process group ID of the calling process. Otherwise, it returns a value of and
sets to indicate the error.
ERRORS
If fails, no changes occur and (see errno(2)) is set to one of the following values:
The calling process is already a process group leader, or
the process group ID of a process other than the calling process matches the process ID of the calling process.
The calling process does not have sufficient privileges.
AUTHOR
was developed by HP and AT&T.
SEE ALSO exec(2), exit(2), fork(2), getpid(2), kill(2), setpgid(2), setpgrp(2), setpgrp3(2), signal(2), privileges(5), termio(7).
STANDARDS CONFORMANCE setsid(2)
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)
CO UNixware 7.1.1
Hi friends,
I have chopped my case statementt out of my .profile and put it in another script called setsid. The case statement works when run from my .profile but not from my setsid file.
All that the script does is set an environmental variable based on user input.... (7 Replies)
I have been asked to put together some coding standards for the project I am assigned to. I have found documented standards for C/C++, Java but was wondering if there is a good place for UNIX scripting (Korn/Bourne) standards?
Does anyone know of a good place to find information on scripting... (3 Replies)
Hi,
i need to find the process name using the process id in C. This has to be done in HP, AIX, Solaris & Linux??
How can this be done? Is there any common solution to all platforms?
On linux i have heard that /proc/<pid>/cmdline can be used. Is there a structure available to read this?
... (3 Replies)
I'm having to write 'C' programs for a group of HP-UX 11.X systems. While I have found many 'C' reference books which I like, none of them reference using 'C' in the UNIX environment.
Anyone have any good recommendations for books about 'C' programming under UNIX?
Thanks.
Chris (0 Replies)
Hi all ! :)
What I want?
1. All child process must be in the same group of process. Parent is a leader of the group.
How to do this? I would be greatfull of some example of code, I read about setsid but I can't even start...
My code so far:
#include <stdio.h>
#include <stdlib.h>... (2 Replies)
I would like to create the following script:
run a python script with setsid
python may or may not fail with exception
check if all of the group processes were terminated correctly
if not, kill the remaining processes
How can I do that?
Thanks a lot (3 Replies)