]>
Commit | Line | Data |
---|---|---|
a1eaacb1 | 1 | '\" t |
fea681da MK |
2 | .\" Copyright (C) 2002 Andries Brouwer <aeb@cwi.nl> |
3 | .\" | |
5fbde956 | 4 | .\" SPDX-License-Identifier: Linux-man-pages-copyleft |
fea681da | 5 | .\" |
4c1c5274 | 6 | .TH tcgetsid 3 (date) "Linux man-pages (unreleased)" |
fea681da MK |
7 | .SH NAME |
8 | tcgetsid \- get session ID | |
aebfc588 AC |
9 | .SH LIBRARY |
10 | Standard C library | |
8fc3b2cf | 11 | .RI ( libc ", " \-lc ) |
fea681da | 12 | .SH SYNOPSIS |
c7db92b9 | 13 | .nf |
86b91fdf | 14 | .BR "#define _XOPEN_SOURCE 500" " /* See feature_test_macros(7) */" |
0daa9e92 | 15 | .B "#include <termios.h>" |
68e4db0a | 16 | .PP |
fea681da | 17 | .BI "pid_t tcgetsid(int " fd ); |
c7db92b9 | 18 | .fi |
fea681da MK |
19 | .SH DESCRIPTION |
20 | The function | |
63aa9df0 | 21 | .BR tcgetsid () |
fea681da MK |
22 | returns the session ID of the current session that has the |
23 | terminal associated to | |
24 | .I fd | |
25 | as controlling terminal. | |
26 | This terminal must be the controlling terminal of the calling process. | |
47297adb | 27 | .SH RETURN VALUE |
fea681da MK |
28 | When |
29 | .I fd | |
30 | refers to the controlling terminal of our session, | |
31 | the function | |
63aa9df0 | 32 | .BR tcgetsid () |
fea681da MK |
33 | will return the session ID of this session. |
34 | Otherwise, \-1 is returned, and | |
35 | .I errno | |
f6a4078b | 36 | is set to indicate the error. |
fea681da MK |
37 | .SH ERRORS |
38 | .TP | |
39 | .B EBADF | |
40 | .I fd | |
41 | is not a valid file descriptor. | |
42 | .TP | |
43 | .B ENOTTY | |
44 | The calling process does not have a controlling terminal, or | |
45 | it has one but it is not described by | |
46 | .IR fd . | |
87a77f93 | 47 | .SH ATTRIBUTES |
1d40db1e PH |
48 | For an explanation of the terms used in this section, see |
49 | .BR attributes (7). | |
c466875e MK |
50 | .ad l |
51 | .nh | |
1d40db1e PH |
52 | .TS |
53 | allbox; | |
c466875e | 54 | lbx lb lb |
1d40db1e PH |
55 | l l l. |
56 | Interface Attribute Value | |
57 | T{ | |
87a77f93 | 58 | .BR tcgetsid () |
1d40db1e PH |
59 | T} Thread safety MT-Safe |
60 | .TE | |
c466875e MK |
61 | .hy |
62 | .ad | |
63 | .sp 1 | |
196224f7 AC |
64 | .SH VERSIONS |
65 | .BR tcgetsid () | |
66 | is provided since glibc 2.1. | |
3113c7f3 | 67 | .SH STANDARDS |
89e88474 | 68 | POSIX.1-2001, POSIX.1-2008. |
fea681da | 69 | .SH NOTES |
097585ed MK |
70 | This function is implemented via the |
71 | .B TIOCGSID | |
fb186734 | 72 | .BR ioctl (2), |
1e321034 | 73 | present |
fea681da | 74 | since Linux 2.1.71. |
47297adb | 75 | .SH SEE ALSO |
fea681da | 76 | .BR getsid (2) |