New module 'sys_ioctl'.
[gnulib.git] / lib / sys_ioctl.in.h
1 /* Substitute for and wrapper around <sys/ioctl.h>.
2    Copyright (C) 2008 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, write to the Free Software Foundation,
16    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
17
18 #ifndef _GL_SYS_IOCTL_H
19
20 @PRAGMA_SYSTEM_HEADER@
21
22 /* The include_next requires a split double-inclusion guard.  */
23 #if @HAVE_SYS_IOCTL_H@
24 # @INCLUDE_NEXT@ @NEXT_SYS_IOCTL_H@
25 #endif
26
27 #ifndef _GL_SYS_IOCTL_H
28 #define _GL_SYS_IOCTL_H
29
30 /* AIX 5.1 and Solaris 10 declare ioctl() in <unistd.h> and in <stropts.h>,
31    but not in <sys/ioctl.h>.  */
32 #include <unistd.h>
33
34 /* The definition of GL_LINK_WARNING is copied here.  */
35
36
37 /* Declare overridden functions.  */
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42
43
44 #if @GNULIB_IOCTL@
45 # if @SYS_IOCTL_H_HAVE_WINSOCK2_H@
46 #  undef ioctl
47 #  define ioctl rpl_ioctl
48 extern int ioctl (int fd, int request, ... /* {void *,char *} arg */);
49 # endif
50 #elif @SYS_IOCTL_H_HAVE_WINSOCK2_H@
51 # undef ioctl
52 # define ioctl ioctl_used_without_requesting_gnulib_module_ioctl
53 #elif defined GNULIB_POSIXCHECK
54 # undef ioctl
55 # define ioctl(f,c,a) \
56     (GL_LINK_WARNING ("ioctl does not portably work on sockets - " \
57                       "use gnulib module ioctl for portability"), \
58      ioctl (f, c, a))
59 #endif
60
61
62 #ifdef __cplusplus
63 }
64 #endif
65
66
67 #endif /* _GL_SYS_IOCTL_H */
68 #endif /* _GL_SYS_IOCTL_H */