DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

getsid(S)


getsid -- get session ID

Synopsis

   #include <sys/types.h>
   #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.

Errors

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.

References

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

Notices

Considerations for threads programming

These ID numbers are attributes of the containing process and are shared by sibling threads.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 - 01 June 2005