OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / man3 / tcgetsid.3
1 .\" Copyright (C) 2002 Andries Brouwer <aeb@cwi.nl>
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein.  The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .TH TCGETSID 3 2014-01-13 "GNU" "Linux Programmer's Manual"
26 .SH NAME
27 tcgetsid \- get session ID
28 .SH SYNOPSIS
29 .BR "#define _XOPEN_SOURCE 500" "        /* See feature_test_macros(7) */"
30 .br
31 .B "#include <termios.h>"
32 .sp
33 .BI "pid_t tcgetsid(int " fd );
34 .SH DESCRIPTION
35 The function
36 .BR tcgetsid ()
37 returns the session ID of the current session that has the
38 terminal associated to
39 .I fd
40 as controlling terminal.
41 This terminal must be the controlling terminal of the calling process.
42 .SH RETURN VALUE
43 When
44 .I fd
45 refers to the controlling terminal of our session,
46 the function
47 .BR tcgetsid ()
48 will return the session ID of this session.
49 Otherwise, \-1 is returned, and
50 .I errno
51 is set appropriately.
52 .SH ERRORS
53 .TP
54 .B EBADF
55 .I fd
56 is not a valid file descriptor.
57 .TP
58 .B ENOTTY
59 The calling process does not have a controlling terminal, or
60 it has one but it is not described by
61 .IR fd .
62 .SH VERSIONS
63 .BR tcgetsid ()
64 is provided in glibc since version 2.1.
65 .SH ATTRIBUTES
66 .SS Multithreading (see pthreads(7))
67 The
68 .BR tcgetsid ()
69 function is thread-safe.
70 .SH CONFORMING TO
71 POSIX.1-2001.
72 .SH NOTES
73 This function is implemented via the
74 .B TIOCGSID
75 .BR ioctl (2),
76 present
77 since Linux 2.1.71.
78 .SH SEE ALSO
79 .BR getsid (2)
80 .SH COLOPHON
81 This page is part of release 3.79 of the Linux
82 .I man-pages
83 project.
84 A description of the project,
85 information about reporting bugs,
86 and the latest version of this page,
87 can be found at
88 \%http://www.kernel.org/doc/man\-pages/.