⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ioctls.h

📁 Glibc 2.3.2源代码(解压后有100多M)
💻 H
📖 第 1 页 / 共 2 页
字号:
/* Copyright (C) 1992,93,96,97,98,99,2001 Free Software Foundation, Inc.   This file is part of the GNU C Library.   The GNU C Library is free software; you can redistribute it and/or   modify it under the terms of the GNU Lesser General Public   License as published by the Free Software Foundation; either   version 2.1 of the License, or (at your option) any later version.   The GNU C Library is distributed in the hope that it will be useful,   but WITHOUT ANY WARRANTY; without even the implied warranty of   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU   Lesser General Public License for more details.   You should have received a copy of the GNU Lesser General Public   License along with the GNU C Library; if not, write to the Free   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA   02111-1307 USA.  */#ifndef __BITS_IOCTLS_H#define __BITS_IOCTLS_H	1#if !defined _HURD_IOCTL_H && !defined _SYS_IOCTL_H# error "Never use <bits/ioctls.h> directly; include <hurd/ioctl.h> instead."#endif/* These macros are also defined in <bits/termios.h> (with numerically   identical values) but this serves to shut up cpp's complaining. */#ifdef MDMBUF# undef MDMBUF#endif#ifdef ECHO# undef ECHO#endif#ifdef TOSTOP# undef TOSTOP#endif#ifdef FLUSHO# undef FLUSHO#endif#ifdef PENDIN# undef PENDIN#endif#ifdef NOFLSH# undef NOFLSH#endif/* Hurd ioctl request are made up of several fields:    10987654321098765432109876543210    IOt0t1t2cc0c0cc1c1cc2ggggccccccc     bits [31,30]: inout direction (enum __ioctl_dir)     bits [29,11]: type encoding as follows; zero count indicates omitted datum	  [29,28]: datum #0 type (enum __ioctl_datum)	  [27,26]: datum #1 type (enum __ioctl_datum)	  [24,25]: datum #2 type (enum __ioctl_datum)	  [23,19]: datum #0 count	[0,31]	  [18,14]: datum #1 count [0,31]	  [13,11]: datum #2 count [0,3]     bits [07,10]: group (letter - 'f': ['f','v'])     bits [00,06]: command	[0,127]   The following macros construct and dissect these fields.  */enum __ioctl_dir  {    IOC_VOID = 0,		/* No parameters.  */    IOC_OUT = 1,		/* Data is written into the user's buffer.  */    IOC_IN = 2,			/* Data is read from the user's buffer.  */    IOC_INOUT = (IOC_IN|IOC_OUT)  };enum __ioctl_datum { IOC_8, IOC_16, IOC_32, IOC_64 };/* Construct an ioctl from constructed type plus other fields.  */#define	_IOC(inout, group, num, type) \  ((num) | ((((group) - 'f') | ((type) | (inout) << 19) << 4) << 7))/* Dissect an ioctl into its component fields.  */#define _IOC_INOUT(request)	(((unsigned int) (request) >> 30) & IOC_INOUT)#define _IOC_GROUP(request)	('f' + (((unsigned int) (request) >> 7) & 0xf))#define _IOC_COMMAND(request)	((unsigned int) (request) & 0x7f)#define _IOC_TYPE(request)	(((unsigned int) (request) >> 11) & 0x7ffff)#define _IOC_NOTYPE(request)	((unsigned int) (request) & 0x3ff)/* Construct a type information field from   the broken-out type and count fields.  */#define	_IOT(t0, c0, t1, c1, t2, c2) \  ((c2) | (((c1) | ((c0) | ((t2) | ((t1) | (t0) << 2) << 2) << 5) << 5) << 3))/* Dissect a type information field into the type and count fields.  */#define	_IOT_TYPE0(type)	(((unsigned int) (type) >> 17) & 3)#define	_IOT_TYPE1(type)	(((unsigned int) (type) >> 15) & 3)#define	_IOT_TYPE2(type)	(((unsigned int) (type) >> 13) & 3)#define	_IOT_COUNT0(type)	(((unsigned int) (type) >> 8) & 0x1f)#define	_IOT_COUNT1(type)	(((unsigned int) (type) >> 3) & 0x1f)#define	_IOT_COUNT2(type)	(((unsigned int) (type) >> 0) & 7)/* Construct an ioctl from all the broken-out fields.  */#define	_IOCT(inout, group, num, t0, c0, t1, c1, t2, c2)		      \  _IOC ((inout), (group), (num), _IOT ((t0), (c0), (t1), (c1), (t2), (c2)))/* Construct an individual type field for TYPE.  */#define _IOTS(type)	\  (sizeof (type) == 8 ? IOC_64 : (sizeof (type) >> 1))/* Construct a type information field for   a single argument of the scalar TYPE.  */#define	_IOT_SIMPLE(type)	_IOT (_IOTS (type), 1, 0, 0, 0, 0)/* Basic C types.  */#define	_IOT__IOTBASE_int	_IOT_SIMPLE (int)#define	_IOT__IOTBASE_char	_IOT_SIMPLE (char)#define	_IOT__IOTBASE_short	_IOT_SIMPLE (short)/* Standard flavors of ioctls.   _IOT_foobar is defined either in this file,   or where struct foobar is defined.  */#define	_IO(g, n)	_IOC (IOC_VOID, (g), (n), 0)#define	_IOR(g, n, t)	_IOC (IOC_OUT, (g), (n), _IOC_ENCODE_TYPE (t))#define	_IOW(g, n, t)	_IOC (IOC_IN, (g), (n), _IOC_ENCODE_TYPE (t))#define	_IOWR(g, n, t)	_IOC (IOC_INOUT, (g), (n), _IOC_ENCODE_TYPE (t))/* These macros do some preprocessor gymnastics to turn a TYPESPEC of   `struct foobar' into the identifier `_IOT_foobar', which is generally   defined using `_IOT' (above) in whatever file defines `struct foobar'.   For a TYPESPEC that does not begin with `struct' produces a different   identifier: `int' produces `_IOT__IOTBASE_int'.  These identifiers   are defined for the basic C types above.  */#define _IOC_ENCODE_TYPE(typespec)	_IOC_ENCODE_TYPE_1(_IOTBASE_##typespec)#define _IOTBASE_struct#define _IOC_ENCODE_TYPE_1(typespec)	_IOC_ENCODE_TYPE_2(typespec)#define _IOC_ENCODE_TYPE_2(typespec)	_IOT_##typespec/* ioctls verbatim from 4.4 <sys/ioctl.h>.  */#define	TIOCMODG	_IOR('t', 3, int)	/* get modem control state */#define	TIOCMODS	_IOW('t', 4, int)	/* set modem control state */#define		TIOCM_LE	0001		/* line enable */#define		TIOCM_DTR	0002		/* data terminal ready */#define		TIOCM_RTS	0004		/* request to send */#define		TIOCM_ST	0010		/* secondary transmit */#define		TIOCM_SR	0020		/* secondary receive */#define		TIOCM_CTS	0040		/* clear to send */#define		TIOCM_CAR	0100		/* carrier detect */#define		TIOCM_CD	TIOCM_CAR#define		TIOCM_RNG	0200		/* ring */#define		TIOCM_RI	TIOCM_RNG#define		TIOCM_DSR	0400		/* data set ready */						/* 8-10 compat */#define	TIOCEXCL	_IO('t', 13)		/* set exclusive use of tty */#define	TIOCNXCL	_IO('t', 14)		/* reset exclusive use of tty */						/* 15 unused */#define	TIOCFLUSH	_IOW('t', 16, int)	/* flush buffers */						/* 17-18 compat */#define	TIOCGETA	_IOR('t', 19, struct termios) /* get termios struct */#define	TIOCSETA	_IOW('t', 20, struct termios) /* set termios struct */#define	TIOCSETAW	_IOW('t', 21, struct termios) /* drain output, set */#define	TIOCSETAF	_IOW('t', 22, struct termios) /* drn out, fls in, set */#define	TIOCGETD	_IOR('t', 26, int)	/* get line discipline */#define	TIOCSETD	_IOW('t', 27, int)	/* set line discipline */						/* 127-124 compat */#define	TIOCSBRK	_IO('t', 123)		/* set break bit */#define	TIOCCBRK	_IO('t', 122)		/* clear break bit */#define	TIOCSDTR	_IO('t', 121)		/* set data terminal ready */#define	TIOCCDTR	_IO('t', 120)		/* clear data terminal ready */#define	TIOCGPGRP	_IOR('t', 119, int)	/* get pgrp of tty */#define	TIOCSPGRP	_IOW('t', 118, int)	/* set pgrp of tty */						/* 117-116 compat */#define	TIOCOUTQ	_IOR('t', 115, int)	/* output queue size */#define	TIOCSTI		_IOW('t', 114, char)	/* simulate terminal input */#define	TIOCNOTTY	_IO('t', 113)		/* void tty association */#define	TIOCPKT		_IOW('t', 112, int)	/* pty: set/clear packet mode */#define		TIOCPKT_DATA		0x00	/* data packet */#define		TIOCPKT_FLUSHREAD	0x01	/* flush packet */#define		TIOCPKT_FLUSHWRITE	0x02	/* flush packet */#define		TIOCPKT_STOP		0x04	/* stop output */#define		TIOCPKT_START		0x08	/* start output */#define		TIOCPKT_NOSTOP		0x10	/* no more ^S, ^Q */#define		TIOCPKT_DOSTOP		0x20	/* now do ^S ^Q */#define		TIOCPKT_IOCTL		0x40	/* state change of pty driver */#define	TIOCSTOP	_IO('t', 111)		/* stop output, like ^S */#define	TIOCSTART	_IO('t', 110)		/* start output, like ^Q */#define	TIOCMSET	_IOW('t', 109, int)	/* set all modem bits */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -