Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

explain_setsid_or_die(3) [debian man page]

explain_setsid_or_die(3)				     Library Functions Manual					  explain_setsid_or_die(3)

NAME
explain_setsid_or_die - sets process group ID and report errors SYNOPSIS
#include <libexplain/setsid.h> pid_t explain_setsid_or_die(void); pid_t explain_setsid_on_error(void); DESCRIPTION
The explain_setsid_or_die function is used to call the setsid(2) system call. On failure an explanation will be printed to stderr, obtained from the explain_setsid(3) function, and then the process terminates by calling exit(EXIT_FAILURE). The explain_setsid_on_error function is used to call the setsid(2) system call. On failure an explanation will be printed to stderr, obtained from the explain_setsid(3) function, but still returns to the caller. RETURN VALUE
The explain_setsid_or_die function only returns on success, see setsid(2) for more information. On failure, prints an explanation and exits, it does not return. The explain_setsid_on_error function always returns the value return by the wrapped setsid(2) system call. EXAMPLE
The explain_setsid_or_die function is intended to be used in a fashion similar to the following example: explain_setsid_or_die(); SEE ALSO
setsid(2) creates a session and sets the process group ID explain_setsid(3) explain setsid(2) errors exit(2) terminate the calling process COPYRIGHT
libexplain version 0.52 Copyright (C) 2011 Peter Miller explain_setsid_or_die(3)

Check Out this Related Man Page

setsid(2)							   System Calls 							 setsid(2)

NAME
setsid - create session and set process group ID SYNOPSIS
#include <sys/types.h> #include <unistd.h> pid_t setsid(void); DESCRIPTION
The setsid() function creates a new session, if the calling process is not a process group leader. Upon return the calling process will be the session leader of this new session, will be the process group leader of a new process group, and will have no controlling terminal. The process group ID of the calling process will be set equal to the process ID of the calling process. The calling process will be the only process in the new process group and the only process in the new session. RETURN VALUES
Upon successful completion, setsid() returns the value of the process group ID of the calling process. Otherwise it returns (pid_t)-1 and sets errno to indicate the error. ERRORS
The setsid() function will fail if: EPERM 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. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |Async-Signal-Safe | +-----------------------------+-----------------------------+ SEE ALSO
getsid(2), setpgid(2), setpgrp(2), attributes(5), standards(5) WARNINGS
A call to setsid() by a process that is a process group leader will fail. A process can become a process group leader by being the last member of a pipeline started by a job control shell. Thus, a process that expects to be part of a pipeline, and that calls setsid(), should always first fork; the parent should exit and the child should call setsid(). This will ensure that the calling process will work reliably when started by both job control shells and non-job control shells. SunOS 5.11 21 Aug 2002 setsid(2)
Man Page