getsid
Section: System Calls (2)
Updated: 2026-02-08
Index
JM Home Page
roff page
名前
getsid - セッション ID を取得する。
ライブラリ
標準 C ライブラリ (libc,~-lc)
書式
#include <unistd.h>
pid_t getsid(pid_t pid);
glibc 向けの機能検査マクロの要件 (feature_test_macros(7) 参照):
getsid():
_XOPEN_SOURCE >= 500
|| /* glibc 2.12 以降: */ _POSIX_C_SOURCE >= 200809L
説明
getsid() returns the session ID of the process with process ID pid.
If pid is 0, getsid() returns the session ID of the calling process.
返り値
On success, a session ID is returned. On error, (pid_t) -1 is returned,
and errno is set to indicate the error.
エラー
- EPERM
-
プロセス ID pid のプロセスは存在するが、呼び出し元のプロセスと同じセッションではなく、 さらに実装がこの状態をエラーと判断した場合。
- ESRCH
-
プロセス ID が pid のプロセスがない。
バージョン
Linux は EPERM を返さない。
標準規格
POSIX.1-2024.
歴史
SVr4, SUSv1, Linux 2.0, POSIX.1-2001 XSI, POSIX.1-2008.
注意
セッションとセッション ID の説明は credentials(7) を参照。
関連項目
getpgid(2), setsid(2), credentials(7)
Index
- 名前
-
- ライブラリ
-
- 書式
-
- 説明
-
- 返り値
-
- エラー
-
- バージョン
-
- 標準規格
-
- 歴史
-
- 注意
-
- 関連項目
-
This document was created by
man2html,
using the manual pages.