PXFSETSID(3F) Last changed: 1-6-98
PXFSETSID - Creates a new session for a calling process
SUBROUTINE PXFSETSID (isid, ierror)
INTEGER isid, ierror
UNICOS, UNICOS/mk, and IRIX systems
On IRIX systems, this routine is in libfortran.so which is linked by
default when compiling programs with the MIPSpro 7 Fortran 90 compiler
or when compiling programs with the -craylibs option to the MIPSpro
7.2 F77 compiler.
The PXFSETSID routine uses the setsid(2) system call to create a new
session for the calling process. The calling process must not be the
process leader for PXFSETSID to be successful.
After the successful completion of PXFSETSID, the calling process will
be the session leader for the new session and the process group leader
for the new process group. The calling process also will have no
controlling terminal.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on
UNICOS, UNICOS/mk, or IRIX systems, all arguments must be of default
kind unless documented otherwise. On UNICOS and UNICOS/mk, default
kind is KIND=8 for integer, real, complex, and logical arguments; on
IRIX, the default kind is KIND=4.
The following is a list of arguments for this routine:
isid An output integer variable for the new process group ID of
the calling process.
ierror An output integer variable that contains zero if PXFSETSID
was successful or nonzero if PXFSETSID was not successful.
This routine may return the EPERM error value if the calling process
is already a process group leader, or the calling process group ID of
a process other than the calling process matches the process ID of the
calling process.
In this example, PXFFORK(3F) is called to create a child process,
which calls PXFSETSID to create a new session. The child writes the
value of ierror to Fortran unit 10 and stops. After the fork, the
parent process waits for the child to finish execution, and then reads
from Fortran unit 10. If the value read in from unit 10 is not equal
to zero, the child's call to PXFSETSID was unsucessful.
program pxftest
integer isid, iretpid, istat, ierror, i
CALL PXFFORK(iretpid,ierror)
if (ierror .ne. 0) then
print *,'FAILED: PXFFORK call with error = ',ierror
else
if (iretpid .eq. 0) then
CALL PXFSETSID(isid, ierror)
write (10,*) ierror
stop
else
CALL PXFWAIT(istat, iretpid, ierror)
read (10,*) i
if (i .eq. 0) then
print *,'PASSED: PXFSETSID call under normal conditions'
else
print *,'FAILED: PXFSETSID call with error = ',i
endif
endif
endif
setsid(2)
PXFFORK(3F)
Application Programmer's Library Reference Manual, publication SR2165,
for the printed version of this man page.
PXFSETSID(3F) Last changed: 1-6-98
PXFSETSID - Creates a new session for a calling process
SUBROUTINE PXFSETSID (isid, ierror)
INTEGER isid, ierror
UNICOS, UNICOS/mk, and IRIX systems
On IRIX systems, this routine is in libfortran.so which is linked by
default when compiling programs with the MIPSpro 7 Fortran 90 compiler
or when compiling programs with the -craylibs option to the MIPSpro
7.2 F77 compiler.
The PXFSETSID routine uses the setsid(2) system call to create a new
session for the calling process. The calling process must not be the
process leader for PXFSETSID to be successful.
After the successful completion of PXFSETSID, the calling process will
be the session leader for the new session and the process group leader
for the new process group. The calling process also will have no
controlling terminal.
When using the CF90 compiler or MIPSpro 7 Fortran 90 compiler on
UNICOS, UNICOS/mk, or IRIX systems, all arguments must be of default
kind unless documented otherwise. On UNICOS and UNICOS/mk, default
kind is KIND=8 for integer, real, complex, and logical arguments; on
IRIX, the default kind is KIND=4.
The following is a list of arguments for this routine:
isid An output integer variable for the new process group ID of
the calling process.
ierror An output integer variable that contains zero if PXFSETSID
was successful or nonzero if PXFSETSID was not successful.
This routine may return the EPERM error value if the calling process
is already a process group leader, or the calling process group ID of
a process other than the calling process matches the process ID of the
calling process.
In this example, PXFFORK(3F) is called to create a child process,
which calls PXFSETSID to create a new session. The child writes the
value of ierror to Fortran unit 10 and stops. After the fork, the
parent process waits for the child to finish execution, and then reads
from Fortran unit 10. If the value read in from unit 10 is not equal
to zero, the child's call to PXFSETSID was unsucessful.
program pxftest
integer isid, iretpid, istat, ierror, i
CALL PXFFORK(iretpid,ierror)
if (ierror .ne. 0) then
print *,'FAILED: PXFFORK call with error = ',ierror
else
if (iretpid .eq. 0) then
CALL PXFSETSID(isid, ierror)
write (10,*) ierror
stop
else
CALL PXFWAIT(istat, iretpid, ierror)
read (10,*) i
if (i .eq. 0) then
print *,'PASSED: PXFSETSID call under normal conditions'
else
print *,'FAILED: PXFSETSID call with error = ',i
endif
endif
endif
setsid(2)
PXFFORK(3F)
Application Programmer's Library Reference Manual, publication SR2165,
for the printed version of this man page.
[ Back ]
|