setsid(2) 맨 페이지 - 윈디하나의 솔라나라

개요

섹션
맨 페이지 이름
검색(S)

setsid(2)

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(7) for descriptions of the following attributes:


       tab()  box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE TYPEAT‐
       TRIBUTE VALUE _ Interface  StabilityCommitted  _  MT-LevelAsync-Signal-
       Safe _ StandardSee standards(7).


SEE ALSO
       setpgrp(2), getsid(2), setpgid(2), standards(7), attributes(7)

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.



Oracle Solaris 11.4               21 Aug 2002                        setsid(2)
맨 페이지 내용의 저작권은 맨 페이지 작성자에게 있습니다.
RSS ATOM XHTML 5 CSS3