Copyright (c) 1997 Peter Wemm <peter@FreeBSD.org> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other ma...
NAMEgetsid - get process session
SYNOPSISIn unistd.h Ft pid_t Fn getsid pid_t pid
DESCRIPTIONThe session ID of the process identified by Fa pid is returned by Fn getsid . If Fa pid is zero, Fn getsid returns the session ID of the current process.
RETURN VALUESUpon successful completion, the Fn getsid system call returns the session ID of the specified process; otherwise, it returns a value of -1 and sets errno to indicate an error.
ERRORSThe Fn getsid system call will succeed unless:
- Bq Er ESRCH
- if there is no process with a process ID equal to Fa pid .
Note that an implementation may restrict this system call to processes within the same session ID as the calling process.