| 1 |
/* Substitute for and wrapper around <sys/ioctl.h>. |
| 2 |
Copyright (C) 2008-2024 Free Software Foundation, Inc. |
| 3 |
|
| 4 |
This file is free software: you can redistribute it and/or modify |
| 5 |
it under the terms of the GNU Lesser General Public License as |
| 6 |
published by the Free Software Foundation; either version 2.1 of the |
| 7 |
License, or (at your option) any later version. |
| 8 |
|
| 9 |
This file 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 Lesser General Public License for more details. |
| 13 |
|
| 14 |
You should have received a copy of the GNU Lesser General Public License |
| 15 |
along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
| 16 |
|
| 17 |
#ifndef _@GUARD_PREFIX@_SYS_IOCTL_H |
| 18 |
|
| 19 |
#if __GNUC__ >= 3 |
| 20 |
@PRAGMA_SYSTEM_HEADER@ |
| 21 |
#endif |
| 22 |
@PRAGMA_COLUMNS@ |
| 23 |
|
| 24 |
/* The include_next requires a split double-inclusion guard. */ |
| 25 |
#if @HAVE_SYS_IOCTL_H@ |
| 26 |
# @INCLUDE_NEXT@ @NEXT_SYS_IOCTL_H@ |
| 27 |
#endif |
| 28 |
|
| 29 |
#ifndef _@GUARD_PREFIX@_SYS_IOCTL_H |
| 30 |
#define _@GUARD_PREFIX@_SYS_IOCTL_H |
| 31 |
|
| 32 |
/* This file uses GNULIB_POSIXCHECK, HAVE_RAW_DECL_*. */ |
| 33 |
#if !_GL_CONFIG_H_INCLUDED |
| 34 |
#error "Please include config.h first." |
| 35 |
#endif |
| 36 |
|
| 37 |
/* AIX 5.1 and Solaris 10 declare ioctl() in <unistd.h> and in <stropts.h>, |
| 38 |
but not in <sys/ioctl.h>. |
| 39 |
Haiku declares ioctl() in <unistd.h>, but not in <sys/ioctl.h>. |
| 40 |
But avoid namespace pollution on glibc systems. */ |
| 41 |
#ifndef __GLIBC__ |
| 42 |
# include <unistd.h> |
| 43 |
#endif |
| 44 |
|
| 45 |
/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ |
| 46 |
|
| 47 |
/* The definition of _GL_WARN_ON_USE is copied here. */ |
| 48 |
|
| 49 |
|
| 50 |
/* Declare overridden functions. */ |
| 51 |
|
| 52 |
#if @GNULIB_IOCTL@ |
| 53 |
# if @REPLACE_IOCTL@ |
| 54 |
# if !(defined __cplusplus && defined GNULIB_NAMESPACE) |
| 55 |
# undef ioctl |
| 56 |
# define ioctl rpl_ioctl |
| 57 |
# endif |
| 58 |
_GL_FUNCDECL_RPL (ioctl, int, |
| 59 |
(int fd, int request, ... /* {void *,char *} arg */), ); |
| 60 |
_GL_CXXALIAS_RPL (ioctl, int, |
| 61 |
(int fd, int request, ... /* {void *,char *} arg */)); |
| 62 |
# else |
| 63 |
# if @SYS_IOCTL_H_HAVE_WINSOCK2_H@ || 1 |
| 64 |
_GL_FUNCDECL_SYS (ioctl, int, |
| 65 |
(int fd, int request, ... /* {void *,char *} arg */), ); |
| 66 |
# endif |
| 67 |
_GL_CXXALIAS_SYS (ioctl, int, |
| 68 |
(int fd, int request, ... /* {void *,char *} arg */)); |
| 69 |
# endif |
| 70 |
# if __GLIBC__ >= 2 |
| 71 |
_GL_CXXALIASWARN (ioctl); |
| 72 |
# endif |
| 73 |
#elif @SYS_IOCTL_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ |
| 74 |
# if !GNULIB_IOCTL |
| 75 |
# undef ioctl |
| 76 |
# define ioctl ioctl_used_without_requesting_gnulib_module_ioctl |
| 77 |
# endif |
| 78 |
#elif defined GNULIB_POSIXCHECK |
| 79 |
# undef ioctl |
| 80 |
# if HAVE_RAW_DECL_IOCTL |
| 81 |
_GL_WARN_ON_USE (ioctl, "ioctl does not portably work on sockets - " |
| 82 |
"use gnulib module ioctl for portability"); |
| 83 |
# endif |
| 84 |
#endif |
| 85 |
|
| 86 |
|
| 87 |
#endif /* _@GUARD_PREFIX@_SYS_IOCTL_H */ |
| 88 |
#endif /* _@GUARD_PREFIX@_SYS_IOCTL_H */ |