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

📄 ioctl.h

📁 一个简单的操作系统minix的核心代码
💻 H
字号:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
				include/sys/ioctl.h	 	 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

01800	/* The ioctl.h header declares device controlling operations. */
01801	
01802	#ifndef _IOCTL_H
01803	#define _IOCTL_H
01804	
01805	#if _EM_WSIZE >= 4
01806	/* Ioctls have the command encoded in the low-order word, and the size
01807	 * of the parameter in the high-order word. The 3 high bits of the high-
01808	 * order word are used to encode the in/out/void status of the parameter.
01809	 */
01810	
01811	#define _IOCPARM_MASK   0x1FFF
01812	#define _IOC_VOID       0x20000000
01813	#define _IOCTYPE_MASK   0xFFFF
01814	#define _IOC_IN         0x40000000
01815	#define _IOC_OUT        0x80000000
01816	#define _IOC_INOUT      (_IOC_IN | _IOC_OUT)
01817	
01818	#define _IO(x,y)        ((x << 8) | y | _IOC_VOID)
01819	#define _IOR(x,y,t)     ((x << 8) | y | ((sizeof(t) & _IOCPARM_MASK) << 16) |\
01820	                                _IOC_OUT)
01821	#define _IOW(x,y,t)     ((x << 8) | y | ((sizeof(t) & _IOCPARM_MASK) << 16) |\
01822	                                _IOC_IN)
01823	#define _IORW(x,y,t)    ((x << 8) | y | ((sizeof(t) & _IOCPARM_MASK) << 16) |\
01824	                                _IOC_INOUT)
01825	#else
01826	/* No fancy encoding on a 16-bit machine. */
01827	
01828	#define _IO(x,y)        ((x << 8) | y)
01829	#define _IOR(x,y,t)     _IO(x,y)
01830	#define _IOW(x,y,t)     _IO(x,y)
01831	#define _IORW(x,y,t)    _IO(x,y)
01832	#endif
01833	
01834	
01835	/* Terminal ioctls. */
01836	#define TCGETS          _IOR('T',  8, struct termios) /* tcgetattr */
01837	#define TCSETS          _IOW('T',  9, struct termios) /* tcsetattr, TCSANOW */
01838	#define TCSETSW         _IOW('T', 10, struct termios) /* tcsetattr, TCSADRAIN */
01839	#define TCSETSF         _IOW('T', 11, struct termios) /* tcsetattr, TCSAFLUSH */
01840	#define TCSBRK          _IOW('T', 12, int)            /* tcsendbreak */
01841	#define TCDRAIN         _IO ('T', 13)                 /* tcdrain */
01842	#define TCFLOW          _IOW('T', 14, int)            /* tcflow */
01843	#define TCFLSH          _IOW('T', 15, int)            /* tcflush */
01844	#define TIOCGWINSZ      _IOR('T', 16, struct winsize)
01845	#define TIOCSWINSZ      _IOW('T', 17, struct winsize)
01846	#define TIOCGPGRP       _IOW('T', 18, int)
01847	#define TIOCSPGRP       _IOW('T', 19, int)
01848	#define TIOCSFON        _IOW('T', 20, u8_t [8192])
01849	
01850	#define TIOCGETP        _IOR('t',  1, struct sgttyb)
01851	#define TIOCSETP        _IOW('t',  2, struct sgttyb)
01852	#define TIOCGETC        _IOR('t',  3, struct tchars)
01853	#define TIOCSETC        _IOW('t',  4, struct tchars)
01854	
01855	
01856	/* Network ioctls. */
01857	#define NWIOSETHOPT     _IOW('n', 16, struct nwio_ethopt)
01858	#define NWIOGETHOPT     _IOR('n', 17, struct nwio_ethopt)
01859	#define NWIOGETHSTAT    _IOR('n', 18, struct nwio_ethstat)
01860	
01861	#define NWIOSIPCONF     _IOW('n', 32, struct nwio_ipconf)
01862	#define NWIOGIPCONF     _IOR('n', 33, struct nwio_ipconf)
01863	#define NWIOSIPOPT      _IOW('n', 34, struct nwio_ipopt)
01864	#define NWIOGIPOPT      _IOR('n', 35, struct nwio_ipopt)
01865	
01866	#define NWIOIPGROUTE    _IORW('n', 40, struct nwio_route)
01867	#define NWIOIPSROUTE    _IOW ('n', 41, struct nwio_route)
01868	#define NWIOIPDROUTE    _IOW ('n', 42, struct nwio_route)
01869	
01870	#define NWIOSTCPCONF    _IOW('n', 48, struct nwio_tcpconf)
01871	#define NWIOGTCPCONF    _IOR('n', 49, struct nwio_tcpconf)
01872	#define NWIOTCPCONN     _IOW('n', 50, struct nwio_tcpcl)
01873	#define NWIOTCPLISTEN   _IOW('n', 51, struct nwio_tcpcl)
01874	#define NWIOTCPATTACH   _IOW('n', 52, struct nwio_tcpatt)
01875	#define NWIOTCPSHUTDOWN _IO ('n', 53)
01876	#define NWIOSTCPOPT     _IOW('n', 54, struct nwio_tcpopt)
01877	#define NWIOGTCPOPT     _IOR('n', 55, struct nwio_tcpopt)
01878	
01879	#define NWIOSUDPOPT     _IOW('n', 64, struct nwio_udpopt)
01880	#define NWIOGUDPOPT     _IOR('n', 65, struct nwio_udpopt)
01881	
01882	/* Disk ioctls. */
01883	#define DIOCEJECT       _IO ('d', 5)
01884	#define DIOCSETP        _IOW('d', 6, struct partition)
01885	#define DIOCGETP        _IOR('d', 7, struct partition)
01886	
01887	/* Keyboard ioctls. */
01888	#define KIOCSMAP        _IOW('k', 3, keymap_t)
01889	
01890	/* Memory ioctls. */
01891	#define MIOCRAMSIZE     _IOW('m', 3, u32_t)     /* Size of the ramdisk */
01892	#define MIOCSPSINFO     _IOW('m', 4, void *)
01893	#define MIOCGPSINFO     _IOR('m', 5, struct psinfo)
01894	
01895	/* Magnetic tape ioctls. */
01896	#define MTIOCTOP        _IOW('M', 1, struct mtop)
01897	#define MTIOCGET        _IOR('M', 2, struct mtget)
01898	
01899	/* SCSI command. */
01900	#define SCIOCCMD        _IOW('S', 1, struct scsicmd)
01901	
01902	/* CD-ROM ioctls. */
01903	#define CDIOPLAYTI      _IOR('c', 1, struct cd_play_track)
01904	#define CDIOPLAYMSS     _IOR('c', 2, struct cd_play_mss)
01905	#define CDIOREADTOCHDR  _IOW('c', 3, struct cd_toc_entry)
01906	#define CDIOREADTOC     _IOW('c', 4, struct cd_toc_entry)
01907	#define CDIOREADSUBCH   _IOW('c', 5, struct cd_toc_entry)
01908	#define CDIOSTOP        _IO ('c', 10)
01909	#define CDIOPAUSE       _IO ('c', 11)
01910	#define CDIORESUME      _IO ('c', 12)
01911	#define CDIOEJECT       DIOCEJECT
01912	
01913	/* Soundcard DSP ioctls. */
01914	#define DSPIORATE       _IOR('s', 1, unsigned int)
01915	#define DSPIOSTEREO     _IOR('s', 2, unsigned int)
01916	#define DSPIOSIZE       _IOR('s', 3, unsigned int)
01917	#define DSPIOBITS       _IOR('s', 4, unsigned int)
01918	#define DSPIOSIGN       _IOR('s', 5, unsigned int)
01919	#define DSPIOMAX        _IOW('s', 6, unsigned int)
01920	#define DSPIORESET      _IO ('s', 7)
01921	
01922	/* Soundcard mixer ioctls. */
01923	#define MIXIOGETVOLUME          _IORW('s', 10, struct volume_level)
01924	#define MIXIOGETINPUTLEFT       _IORW('s', 11, struct inout_ctrl)
01925	#define MIXIOGETINPUTRIGHT      _IORW('s', 12, struct inout_ctrl)
01926	#define MIXIOGETOUTPUT          _IORW('s', 13, struct inout_ctrl)
01927	#define MIXIOSETVOLUME          _IORW('s', 20, struct volume_level)
01928	#define MIXIOSETINPUTLEFT       _IORW('s', 21, struct inout_ctrl)
01929	#define MIXIOSETINPUTRIGHT      _IORW('s', 22, struct inout_ctrl)
01930	#define MIXIOSETOUTPUT          _IORW('s', 23, struct inout_ctrl)
01931	
01932	#ifndef _ANSI
01933	#include <ansi.h>
01934	#endif
01935	
01936	_PROTOTYPE( int ioctl, (int _fd, int _request, void *_data)             );
01937	
01938	#endif /* _IOCTL_H */

⌨️ 快捷键说明

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