176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman/* 276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com> 376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * All rights reserved. 476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * 576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * Redistribution and use in source and binary forms, with or without 676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * modification, are permitted provided that the following conditions 776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * are met: 876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * 1. Redistributions of source code must retain the above copyright 976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * notice, this list of conditions and the following disclaimer. 1076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * 2. Redistributions in binary form must reproduce the above copyright 1176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * notice, this list of conditions and the following disclaimer in the 1276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * documentation and/or other materials provided with the distribution. 1376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * 3. The name of the author may not be used to endorse or promote products 1476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * derived from this software without specific prior written permission. 1576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * 1676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 1776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 2076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 2576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman */ 2776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 2876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#include "defs.h" 296e87ee0d5c9459d3c6c14050c6a59cba54ae8d45Roland McGrath/* 306e87ee0d5c9459d3c6c14050c6a59cba54ae8d45Roland McGrath * The C library's definition of struct termios might differ from 316e87ee0d5c9459d3c6c14050c6a59cba54ae8d45Roland McGrath * the kernel one, and we need to use the kernel layout. 326e87ee0d5c9459d3c6c14050c6a59cba54ae8d45Roland McGrath */ 336e87ee0d5c9459d3c6c14050c6a59cba54ae8d45Roland McGrath#include <linux/termios.h> 3476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef HAVE_SYS_FILIO_H 35a6d91ded3f2d5401e09a9c2fa442aabfbfe593a8Denys Vlasenko# include <sys/filio.h> 3676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 3776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 380ed617bd66624cec6138102545d73b2e2346f1f6Dmitry V. Levin#include "xlat/tcxonc_options.h" 3976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 40bf79f2e16b090ffe59cd1e1820935680a2da7b78Wichert Akkerman#ifdef TCLFLSH 410ed617bd66624cec6138102545d73b2e2346f1f6Dmitry V. Levin#include "xlat/tcflsh_options.h" 42bf79f2e16b090ffe59cd1e1820935680a2da7b78Wichert Akkerman#endif 4376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 440ed617bd66624cec6138102545d73b2e2346f1f6Dmitry V. Levin#include "xlat/baud_options.h" 450ed617bd66624cec6138102545d73b2e2346f1f6Dmitry V. Levin#include "xlat/modem_flags.h" 4676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 47c7afb4881f14e44968f3a78ae5988f04ecc66b68Dmitry V. Levinint 48c7afb4881f14e44968f3a78ae5988f04ecc66b68Dmitry V. Levinterm_ioctl(struct tcb *tcp, const unsigned int code, long arg) 4976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 5076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman struct termios tios; 5176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman struct termio tio; 5276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman struct winsize ws; 5376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCGSIZE 5476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman struct ttysize ts; 5576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 5676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman int i; 5776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 5876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (entering(tcp)) 5976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 6076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 6176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman switch (code) { 6276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 6376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman /* ioctls with termios or termio args */ 6476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 6576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TCGETS 6676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TCGETS: 6776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (syserror(tcp)) 6876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 6976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TCSETS: 7076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TCSETSW: 7176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TCSETSF: 7276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (!verbose(tcp) || umove(tcp, arg, &tios) < 0) 7376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 7476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (abbrev(tcp)) { 7560fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko tprints(", {"); 7676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printxval(baud_options, tios.c_cflag & CBAUD, "B???"); 7776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(" %sopost %sisig %sicanon %secho ...}", 7876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman (tios.c_oflag & OPOST) ? "" : "-", 7976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman (tios.c_lflag & ISIG) ? "" : "-", 8076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman (tios.c_lflag & ICANON) ? "" : "-", 8176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman (tios.c_lflag & ECHO) ? "" : "-"); 8276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 1; 8376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 8476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", {c_iflags=%#lx, c_oflags=%#lx, ", 8576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman (long) tios.c_iflag, (long) tios.c_oflag); 8676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("c_cflags=%#lx, c_lflags=%#lx, ", 8776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman (long) tios.c_cflag, (long) tios.c_lflag); 8876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("c_line=%u, ", tios.c_line); 8976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (!(tios.c_lflag & ICANON)) 9076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("c_cc[VMIN]=%d, c_cc[VTIME]=%d, ", 9176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tios.c_cc[VMIN], tios.c_cc[VTIME]); 9276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("c_cc=\""); 9376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman for (i = 0; i < NCCS; i++) 9476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("\\x%02x", tios.c_cc[i]); 9576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("\"}"); 9676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 1; 9776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* TCGETS */ 9876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 9976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TCGETA 10076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TCGETA: 10176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (syserror(tcp)) 10276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 10376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TCSETA: 10476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TCSETAW: 10576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TCSETAF: 10676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (!verbose(tcp) || umove(tcp, arg, &tio) < 0) 10776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 10876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (abbrev(tcp)) { 10960fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko tprints(", {"); 11076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printxval(baud_options, tio.c_cflag & CBAUD, "B???"); 11176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(" %sopost %sisig %sicanon %secho ...}", 11276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman (tio.c_oflag & OPOST) ? "" : "-", 11376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman (tio.c_lflag & ISIG) ? "" : "-", 11476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman (tio.c_lflag & ICANON) ? "" : "-", 11576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman (tio.c_lflag & ECHO) ? "" : "-"); 11676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 1; 11776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 11876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", {c_iflags=%#lx, c_oflags=%#lx, ", 11976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman (long) tio.c_iflag, (long) tio.c_oflag); 12076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("c_cflags=%#lx, c_lflags=%#lx, ", 12176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman (long) tio.c_cflag, (long) tio.c_lflag); 12276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("c_line=%u, ", tio.c_line); 12376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef _VMIN 12476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (!(tio.c_lflag & ICANON)) 12576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("c_cc[_VMIN]=%d, c_cc[_VTIME]=%d, ", 12676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tio.c_cc[_VMIN], tio.c_cc[_VTIME]); 12776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#else /* !_VMIN */ 12876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (!(tio.c_lflag & ICANON)) 12976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("c_cc[VMIN]=%d, c_cc[VTIME]=%d, ", 13076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tio.c_cc[VMIN], tio.c_cc[VTIME]); 13176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* !_VMIN */ 13276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("c_cc=\""); 13376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman for (i = 0; i < NCC; i++) 13476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("\\x%02x", tio.c_cc[i]); 13576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("\"}"); 13676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 1; 13776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* TCGETA */ 13876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 13976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman /* ioctls with winsize or ttysize args */ 14076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 14176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCGWINSZ 14276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TIOCGWINSZ: 14376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (syserror(tcp)) 14476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 14576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TIOCSWINSZ: 14676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (!verbose(tcp) || umove(tcp, arg, &ws) < 0) 14776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 14876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", {ws_row=%d, ws_col=%d, ws_xpixel=%d, ws_ypixel=%d}", 14976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman ws.ws_row, ws.ws_col, ws.ws_xpixel, ws.ws_ypixel); 15076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 1; 15176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* TIOCGWINSZ */ 15276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 15376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCGSIZE 15476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TIOCGSIZE: 15576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (syserror(tcp)) 15676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 15776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TIOCSSIZE: 15876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (!verbose(tcp) || umove(tcp, arg, &ts) < 0) 15976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 16076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", {ts_lines=%d, ts_cols=%d}", 16176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman ts.ts_lines, ts.ts_cols); 16276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 1; 16376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 16476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 16576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman /* ioctls with a direct decodable arg */ 166bf79f2e16b090ffe59cd1e1820935680a2da7b78Wichert Akkerman#ifdef TCXONC 16776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TCXONC: 16860fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko tprints(", "); 16976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printxval(tcxonc_options, arg, "TC???"); 17076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 1; 171bf79f2e16b090ffe59cd1e1820935680a2da7b78Wichert Akkerman#endif 172bf79f2e16b090ffe59cd1e1820935680a2da7b78Wichert Akkerman#ifdef TCLFLSH 17376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TCFLSH: 17460fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko tprints(", "); 17576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printxval(tcflsh_options, arg, "TC???"); 17676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 1; 177bf79f2e16b090ffe59cd1e1820935680a2da7b78Wichert Akkerman#endif 1786a4ac6ccc8f8733b0dfce917af3844bfbc51900cDenys Vlasenko#ifdef TIOCSCTTY 1796a4ac6ccc8f8733b0dfce917af3844bfbc51900cDenys Vlasenko case TIOCSCTTY: 1806a4ac6ccc8f8733b0dfce917af3844bfbc51900cDenys Vlasenko tprintf(", %ld", arg); 1816a4ac6ccc8f8733b0dfce917af3844bfbc51900cDenys Vlasenko return 1; 1826a4ac6ccc8f8733b0dfce917af3844bfbc51900cDenys Vlasenko#endif 18376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 18476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman /* ioctls with an indirect parameter displayed as modem flags */ 18576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 18676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCMGET 18776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TIOCMGET: 18876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TIOCMBIS: 18976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TIOCMBIC: 19076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TIOCMSET: 191bcd2c95437f6548f12b3f08867a099a9e4e8f4b6Roland McGrath if (umove(tcp, arg, &i) < 0) 19276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 19360fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko tprints(", ["); 194bcd2c95437f6548f12b3f08867a099a9e4e8f4b6Roland McGrath printflags(modem_flags, i, "TIOCM_???"); 19560fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko tprints("]"); 19676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 1; 19776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* TIOCMGET */ 19876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 19976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman /* ioctls with an indirect parameter displayed in decimal */ 20076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 20176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TIOCSPGRP: 20276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TIOCGPGRP: 20376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCGETPGRP 20476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TIOCGETPGRP: 20576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 20676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCSETPGRP 20776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TIOCSETPGRP: 20876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 20976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef FIONREAD 21076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case FIONREAD: 21176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 21276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TIOCOUTQ: 21376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef FIONBIO 21476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case FIONBIO: 21576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 21676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef FIOASYNC 21776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case FIOASYNC: 21876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 21976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef FIOGETOWN 22076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case FIOGETOWN: 22176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 22276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef FIOSETOWN 22376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case FIOSETOWN: 22476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 22576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCGETD 22676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TIOCGETD: 22776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 22876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCSETD 22976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TIOCSETD: 23076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 23176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCPKT 23276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TIOCPKT: 23376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 23476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCREMOTE 23576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TIOCREMOTE: 23676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 23776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCUCNTL 23876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TIOCUCNTL: 23976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 24076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCTCNTL 24176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TIOCTCNTL: 24276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 24376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCSIGNAL 24476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TIOCSIGNAL: 24576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 24676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCSSOFTCAR 24776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TIOCSSOFTCAR: 24876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 24976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCGSOFTCAR 25076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TIOCGSOFTCAR: 25176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 25276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCISPACE 25376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TIOCISPACE: 25476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 25576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCISIZE 25676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TIOCISIZE: 25776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 25876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCSINTR 25976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TIOCSINTR: 26076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 2612e2553a534f532a1546ea2b2f3dc3cd2276d020dWichert Akkerman#ifdef TIOCSPTLCK 2622e2553a534f532a1546ea2b2f3dc3cd2276d020dWichert Akkerman case TIOCSPTLCK: 2632e2553a534f532a1546ea2b2f3dc3cd2276d020dWichert Akkerman#endif 2642e2553a534f532a1546ea2b2f3dc3cd2276d020dWichert Akkerman#ifdef TIOCGPTN 2652e2553a534f532a1546ea2b2f3dc3cd2276d020dWichert Akkerman case TIOCGPTN: 2662e2553a534f532a1546ea2b2f3dc3cd2276d020dWichert Akkerman#endif 26760fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko tprints(", "); 268bcd2c95437f6548f12b3f08867a099a9e4e8f4b6Roland McGrath printnum_int(tcp, arg, "%d"); 26976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 1; 27076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 27176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman /* ioctls with an indirect parameter displayed as a char */ 27276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 27376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCSTI 27476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TIOCSTI: 27576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 27660fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko tprints(", "); 27776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printstr(tcp, arg, 1); 27876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 1; 27976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 28076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman /* ioctls with no parameters */ 28176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 28276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCNOTTY 28376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TIOCNOTTY: 28476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 28576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef FIOCLEX 28676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case FIOCLEX: 28776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 28876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef FIONCLEX 28976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case FIONCLEX: 29076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 29176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TIOCCONS 29276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman case TIOCCONS: 29376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif 29476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 1; 29576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 29676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman /* ioctls which are unknown */ 29776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 29876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman default: 29976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 30076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 30176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 302