system_setsid(3f) - [M_system:QUERY] create session and set the process group ID of a session leader (LICENSE:PD)
Synopsis
Description
Return Value
Errors
Examples
integer(kind=c_int) function system_setsid(pid)
integer(kind=c_int) :: pid
The setsid() function creates a new session, if the calling process is not a process group leader. Upon return the calling process shall be the session leader of this new session, shall be the process group leader of a new process group, and shall have no controlling terminal. The process group ID of the calling process shall be set equal to the process ID of the calling process. The calling process shall be the only process in the new process group and the only process in the new session.
Upon successful completion, setsid() shall return the value of the new process group ID of the calling process. Otherwise, it shall return -1 and set errno to indicate the error.
The setsid() function shall fail if:
o The calling process is already a process group leader o the process group ID of a process other than the calling process matches the process ID of the calling process.
Set SID from Fortran
program demo_system_setsid use M_system, only : system_setsid implicit none write(*,*)SID=,system_setsid() end program demo_system_setsidResults:
> SID= 484299
Nemo Release 3.1 | system_setsid (3m_system) | March 07, 2025 |