tcgetsid: fix cygwin header bug
[gnulib.git] / lib / termios.in.h
1 /* Substitute for and wrapper around <termios.h>.
2    Copyright (C) 2010-2012 Free Software Foundation, Inc.
3
4    This program is free software; you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation; either version 2, or (at your option)
7    any later version.
8
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12    GNU General Public License for more details.
13
14    You should have received a copy of the GNU General Public License
15    along with this program; if not, see <http://www.gnu.org/licenses/>.  */
16
17 #ifndef _@GUARD_PREFIX@_TERMIOS_H
18
19 #if __GNUC__ >= 3
20 @PRAGMA_SYSTEM_HEADER@
21 #endif
22 @PRAGMA_COLUMNS@
23
24 /* On HP-UX 11.00, some of the function declarations in <sys/termio.h>,
25    included by <termios.h>, are not protected by extern "C".  Enforce
26    "C" linkage for these functions nevertheless.  */
27 #if defined __hpux && defined __cplusplus
28 # include <sys/types.h>
29 # include <sys/ioctl.h>
30 extern "C" {
31 # include <sys/termio.h>
32 }
33 #endif
34
35 /* On Cygwin 1.7.11, tcgetsid returns int instead of pid_t; at least
36    they are the same size on that platform.  */
37 #ifdef __CYGWIN__
38 # include <sys/types.h>
39 #endif
40
41 /* The include_next requires a split double-inclusion guard.  */
42 #if @HAVE_TERMIOS_H@
43 # @INCLUDE_NEXT@ @NEXT_TERMIOS_H@
44 #endif
45
46 #ifndef _@GUARD_PREFIX@_TERMIOS_H
47 #define _@GUARD_PREFIX@_TERMIOS_H
48
49 #if @GNULIB_TCGETSID@
50 /* Get pid_t.  */
51 # include <sys/types.h>
52 #endif
53
54 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
55
56 /* The definition of _GL_WARN_ON_USE is copied here.  */
57
58
59 /* Declare overridden functions.  */
60
61 #if @GNULIB_TCGETSID@
62 /* Return the session ID of the controlling terminal of the current process.
63    The argument is a descriptor if this controlling terminal.
64    Return -1, with errno set, upon failure.  errno = ENOSYS means that the
65    function is unsupported.  */
66 # if !@HAVE_DECL_TCGETSID@
67 _GL_FUNCDECL_SYS (tcgetsid, pid_t, (int fd));
68 # endif
69 _GL_CXXALIAS_SYS (tcgetsid, pid_t, (int fd));
70 _GL_CXXALIASWARN (tcgetsid);
71 #elif defined GNULIB_POSIXCHECK
72 # undef tcgetsid
73 # if HAVE_RAW_DECL_TCGETSID
74 _GL_WARN_ON_USE (tcgetsid, "tcgetsid is not portable - "
75                  "use gnulib module tcgetsid for portability");
76 # endif
77 #endif
78
79
80 #endif /* _@GUARD_PREFIX@_TERMIOS_H */
81 #endif /* _@GUARD_PREFIX@_TERMIOS_H */