initial import
[glibc.git] / misc / sys / ioctl.h
blobb37a2740cd03474025233d51bcc0a6077b9e0112
1 /* Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 The GNU C Library 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 GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If
16 not, write to the, 1992 Free Software Foundation, Inc., 675 Mass Ave,
17 Cambridge, MA 02139, USA. */
19 #ifndef _SYS_IOCTL_H
21 #define _SYS_IOCTL_H 1
22 #include <features.h>
24 __BEGIN_DECLS
26 /* Get the list of `ioctl' requests and related constants. */
27 #include <ioctls.h>
29 /* On a Unix system, the system <sys/ioctl.h> probably defines some of the
30 symbols we define in <sys/ttydefaults.h> (usually with the same values).
31 The code to generate <ioctls.h> has omitted these symbols to avoid the
32 conflict, but a Unix program expects <sys/ioctl.h> to define them, so we
33 must include <sys/ttydefaults.h> here. */
34 #include <sys/ttydefaults.h>
36 #if defined(TIOCGETC) || defined(TIOCSETC)
37 /* Type of ARG for TIOCGETC and TIOCSETC requests. */
38 struct tchars
40 char t_intrc; /* Interrupt character. */
41 char t_quitc; /* Quit character. */
42 char t_startc; /* Start-output character. */
43 char t_stopc; /* Stop-output character. */
44 char t_eofc; /* End-of-file character. */
45 char t_brkc; /* Input delimiter character. */
48 #define _IOT_tchars /* Hurd ioctl type field. */ \
49 _IOT (_IOTS (char), 6, 0, 0, 0, 0)
50 #endif
52 #if defined(TIOCGLTC) || defined(TIOCSLTC)
53 /* Type of ARG for TIOCGLTC and TIOCSLTC requests. */
54 struct ltchars
56 char t_suspc; /* Suspend character. */
57 char t_dsuspc; /* Delayed suspend character. */
58 char t_rprntc; /* Reprint-line character. */
59 char t_flushc; /* Flush-output character. */
60 char t_werasc; /* Word-erase character. */
61 char t_lnextc; /* Literal-next character. */
64 #define _IOT_ltchars /* Hurd ioctl type field. */ \
65 _IOT (_IOTS (char), 6, 0, 0, 0, 0)
66 #endif
68 /* Type of ARG for TIOCGETP and TIOCSETP requests (and gtty and stty). */
69 struct sgttyb
71 char sg_ispeed; /* Input speed. */
72 char sg_ospeed; /* Output speed. */
73 char sg_erase; /* Erase character. */
74 char sg_kill; /* Kill character. */
75 short int sg_flags; /* Mode flags. */
78 #define _IOT_sgttyb /* Hurd ioctl type field. */ \
79 _IOT (_IOTS (char), 6, _IOTS (short int), 1, 0, 0)
81 #if defined(TIOCGWINSZ) || defined(TIOCSWINSZ)
82 /* Type of ARG for TIOCGWINSZ and TIOCSWINSZ requests. */
83 struct winsize
85 unsigned short int ws_row; /* Rows, in characters. */
86 unsigned short int ws_col; /* Columns, in characters. */
88 /* These are not actually used. */
89 unsigned short int ws_xpixel; /* Horizontal pixels. */
90 unsigned short int ws_ypixel; /* Vertical pixels. */
93 #define _IOT_winsize /* Hurd ioctl type field. */ \
94 _IOT (_IOTS (unsigned short int), 4, 0, 0, 0, 0)
95 #endif
97 #if defined (TIOCGSIZE) || defined (TIOCSSIZE)
98 # if defined (TIOCGWINSZ) && TIOCGSIZE == TIOCGWINSZ
99 /* Many systems that have TIOCGWINSZ define TIOCGSIZE for source
100 compatibility with Sun; they define `struct ttysize' to have identical
101 layout as `struct winsize' and #define TIOCGSIZE to be TIOCGWINSZ
102 (likewise TIOCSSIZE and TIOCSWINSZ). */
103 struct ttysize
105 unsigned short int ts_lines;
106 unsigned short int ts_cols;
107 unsigned short int ts_xxx;
108 unsigned short int ts_yyy;
110 #define _IOT_ttysize _IOT_winsize
111 # else
112 /* Suns use a different layout for `struct ttysize', and TIOCGSIZE and
113 TIOCGWINSZ are separate commands that do the same thing with different
114 structures (likewise TIOCSSIZE and TIOCSWINSZ). */
115 struct ttysize
117 int ts_lines, ts_cols; /* Lines and columns, in characters. */
119 # endif
120 #endif
122 /* Perform the I/O control operation specified by REQUEST on FD.
123 One argument may follow; its presence and type depend on REQUEST.
124 Return value depends on REQUEST. Usually -1 indicates error. */
125 extern int __ioctl __P ((int __fd, unsigned long int __request, ...));
126 extern int ioctl __P ((int __fd, unsigned long int __request, ...));
128 __END_DECLS
130 #endif /* sys/ioctl.h */