]> git.ipfire.org Git - thirdparty/glibc.git/blame - bits/ioctl-types.h
NEWS: Add advisories.
[thirdparty/glibc.git] / bits / ioctl-types.h
CommitLineData
80791291 1/* Structure types for pre-termios terminal ioctls. Generic Unix version.
dff8da6b 2 Copyright (C) 1996-2024 Free Software Foundation, Inc.
54d79e99 3 This file is part of the GNU C Library.
80791291 4
54d79e99 5 The GNU C Library is free software; you can redistribute it and/or
41bdb6e2
AJ
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
80791291 9
54d79e99
UD
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
41bdb6e2 13 Lesser General Public License for more details.
80791291 14
41bdb6e2 15 You should have received a copy of the GNU Lesser General Public
59ba27a6 16 License along with the GNU C Library; if not, see
5a82c748 17 <https://www.gnu.org/licenses/>. */
80791291 18
f4017d20
UD
19#ifndef _SYS_IOCTL_H
20# error "Never use <bits/ioctl-types.h> directly; include <sys/ioctl.h> instead."
21#endif
80791291 22
f4017d20 23#if defined TIOCGETC || defined TIOCSETC
80791291
RM
24/* Type of ARG for TIOCGETC and TIOCSETC requests. */
25struct tchars
26{
27 char t_intrc; /* Interrupt character. */
28 char t_quitc; /* Quit character. */
29 char t_startc; /* Start-output character. */
30 char t_stopc; /* Stop-output character. */
31 char t_eofc; /* End-of-file character. */
32 char t_brkc; /* Input delimiter character. */
33};
34
c8dc1727 35# define _IOT_tchars /* Hurd ioctl type field. */ \
80791291
RM
36 _IOT (_IOTS (char), 6, 0, 0, 0, 0)
37#endif
38
f4017d20 39#if defined TIOCGLTC || defined TIOCSLTC
80791291
RM
40/* Type of ARG for TIOCGLTC and TIOCSLTC requests. */
41struct ltchars
42{
43 char t_suspc; /* Suspend character. */
44 char t_dsuspc; /* Delayed suspend character. */
45 char t_rprntc; /* Reprint-line character. */
46 char t_flushc; /* Flush-output character. */
47 char t_werasc; /* Word-erase character. */
48 char t_lnextc; /* Literal-next character. */
49};
50
c8dc1727 51# define _IOT_ltchars /* Hurd ioctl type field. */ \
80791291
RM
52 _IOT (_IOTS (char), 6, 0, 0, 0, 0)
53#endif
54
55/* Type of ARG for TIOCGETP and TIOCSETP requests (and gtty and stty). */
56struct sgttyb
57{
58 char sg_ispeed; /* Input speed. */
59 char sg_ospeed; /* Output speed. */
60 char sg_erase; /* Erase character. */
61 char sg_kill; /* Kill character. */
62 short int sg_flags; /* Mode flags. */
63};
64
65#define _IOT_sgttyb /* Hurd ioctl type field. */ \
bc8db248 66 _IOT (_IOTS (char), 4, _IOTS (short int), 1, 0, 0)
80791291 67
f4017d20 68#if defined TIOCGWINSZ || defined TIOCSWINSZ
80791291
RM
69/* Type of ARG for TIOCGWINSZ and TIOCSWINSZ requests. */
70struct winsize
71{
72 unsigned short int ws_row; /* Rows, in characters. */
73 unsigned short int ws_col; /* Columns, in characters. */
74
75 /* These are not actually used. */
76 unsigned short int ws_xpixel; /* Horizontal pixels. */
77 unsigned short int ws_ypixel; /* Vertical pixels. */
78};
79
c8dc1727 80# define _IOT_winsize /* Hurd ioctl type field. */ \
80791291
RM
81 _IOT (_IOTS (unsigned short int), 4, 0, 0, 0, 0)
82#endif
83
f4017d20 84#if defined TIOCGSIZE || defined TIOCSSIZE
e75154a6
RM
85/* The BSD-style ioctl constructor macros use `sizeof', which can't be used
86 in a preprocessor conditional. Since the commands are always unique
87 regardless of the size bits, we can safely define away `sizeof' for the
88 purpose of the conditional. */
c8dc1727
CD
89# define sizeof(type) 0
90# if defined TIOCGWINSZ && TIOCGSIZE == TIOCGWINSZ
80791291
RM
91/* Many systems that have TIOCGWINSZ define TIOCGSIZE for source
92 compatibility with Sun; they define `struct ttysize' to have identical
93 layout as `struct winsize' and #define TIOCGSIZE to be TIOCGWINSZ
94 (likewise TIOCSSIZE and TIOCSWINSZ). */
95struct ttysize
96{
97 unsigned short int ts_lines;
98 unsigned short int ts_cols;
99 unsigned short int ts_xxx;
100 unsigned short int ts_yyy;
101};
c8dc1727
CD
102# define _IOT_ttysize _IOT_winsize
103# else
80791291
RM
104/* Suns use a different layout for `struct ttysize', and TIOCGSIZE and
105 TIOCGWINSZ are separate commands that do the same thing with different
106 structures (likewise TIOCSSIZE and TIOCSWINSZ). */
107struct ttysize
108{
109 int ts_lines, ts_cols; /* Lines and columns, in characters. */
110};
c8dc1727
CD
111# endif
112# undef sizeof /* See above. */
80791291 113#endif