Open System Services System Calls Reference Manual (G06.28+, H06.05+)

System Functions (f - i) getsid(2)
NAME
getsid - Gets the process group ID of the session leader
LIBRARY
G-series native OSS processes: system library
SYNOPSIS
#include <unistd.h>
pid_t getsid(
pid_t pid);
PARAMETERS
pid Species the OSS process ID of the target process. If the value specied is
pid_t(0) (an OSS process ID of zero), the function uses the OSS process ID of
the calling process.
DESCRIPTION
The getsid() function returns the process group ID of the process that is the session leader of the
process specied by the OSS process ID in the pid parameter. Specifying a pid of 0 (zero) returns
the process group ID of the calling process.
Use From the Guardian Environment
Calls to getsid() from Guardian processes are not successful because Guardian processes do not
have OSS process IDs. Such calls return an errno value of [ENOTOSS].
RETURN VALUES
Upon successful completion, the getsid() function returns the process group ID of the specied
process. If the function call fails, the value -1 is returned and errno is set to indicate the error.
ERRORS
If any of these conditions occurs, the getsid() function sets errno to the corresponding value:
[ENOTOSS] The calling process is not an OSS process. The requested operation is not sup-
ported from the Guardian environment.
[EPERM] The specied process is not in the same session as the calling process, and the
calling process lacks sufcient privilege to read the specied process.
[ESRCH] No process has been found that has an OSS process ID identical to that specied
by the pid parameter.
RELATED INFORMATION
Functions: execl(2), execle(2), execlp(2), execv(2), execve(2), execvp(2), fork(2), setsid(2),
tdm_execve(2), tdm_execvep(2), tdm_fork(2), tdm_spawn(2), tdm_spawnp(2).
STANDARDS CONFORMANCE
The following is an HP extension to the XPG4 Version 2 specication:
The errno value [ENOTOSS] can be returned.
527186-007 Hewlett-Packard Company 3117