DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

getsid(S)


getsid -- get session ID

Syntax

cc . . . -lc
#include <unistd.h>

pid_t getsid(pid_t pid);

Description

The function getsid returns the session ID of the process whose process ID is equal to pid. If pid is equal to (pid_t)0, getsid returns the session ID of the calling process.

Return values

On success, getsid returns the session ID of the specified process. On failure, getsid returns (pid_t)-1 and sets errno to identify the error.

Diagnostics

In the following conditions, getsid fails and sets errno to:

[EPERM]
The process whose process ID is equal to pid is not in the same session as the calling process, and the implementation does not allow access to the session ID of that process from the calling process.

[ESRCH]
There is no process with a process ID equal to pid.

Files


/lib/libc.a
linking library

See also

exec(S), fork(S), getpid(S), setpgid(S), setsid(S)

Standards conformance

getsid is conformant with:

AT&T SVID Issue 3.


© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003