home *** CD-ROM | disk | FTP | other *** search
/ Zodiac Super OZ / MEDIADEPOT.ISO / FILES / 13 / DJCRX201.ZIP / include / sys / ioctl.h < prev    next >
C/C++ Source or Header  |  1996-08-13  |  16KB  |  361 lines

  1. #ifndef __dj_include_sys_ioctl_h_
  2. #define __dj_include_sys_ioctl_h_
  3.  
  4. #ifdef __cplusplus
  5. extern "C"{
  6. #endif
  7.  
  8.  
  9. #ifndef __dj_ENFORCE_ANSI_FREESTANDING
  10.  
  11. #ifndef __STRICT_ANSI__
  12.  
  13. #ifndef _POSIX_SOURCE
  14. /*
  15. **  plain ioctl functions. Do not use them.
  16. **  Never. Really _N_E_V_E_R_. Unless you really know what
  17. **  you are doing.
  18. **
  19. */
  20. #define DOS_PLAIN_GETDEVDATA    0x00
  21. #define DOS_PLAIN_SETDEVDATA    0x01
  22. #define DOS_PLAIN_RCVDATA       0x02
  23. #define DOS_PLAIN_SNDDATA       0x03
  24. #define DOS_PLAIN_RCVCTLDATA    0x04
  25. #define DOS_PLAIN_SNDCTLDATA    0x05
  26. #define DOS_PLAIN_CHKINSTAT     0x06
  27. #define DOS_PLAIN_CHKOUTSTAT    0x07
  28. #define DOS_PLAIN_ISCHANGEABLE  0x08
  29. #define DOS_PLAIN_ISREDIRBLK    0x09
  30. #define DOS_PLAIN_ISREDIRHND    0x0a
  31. #define DOS_PLAIN_SETRETRY      0x0b
  32. #define DOS_PLAIN_GENCHARREQ    0x0c
  33. #define DOS_PLAIN_GENBLKREQ     0x0d
  34. #define DOS_PLAIN_GLDRVMAP      0x0e
  35. #define DOS_PLAIN_SLDRVMAP      0x0f
  36. #define DOS_PLAIN_QGIOCTLCAPH   0x10
  37. #define DOS_PLAIN_QGIOCTLCAPD   0x11
  38. /*
  39. **  Flags for DOS commands
  40. */
  41. #define DOS_XFER        0x8000         /* use xfer buffer                   */
  42. #define DOS_RETMASK     0x7000         /* Here we put the bits to tell      */
  43.                                        /* what to return. 8 possible values */
  44. #define DOS_BRAINDEAD   0x0400         /* CX does not hold the number of    */
  45.                                        /* bytes to transfer                 */
  46.  
  47. #define DOS_XINARGS(a)  ((a & 3)<<12)  /* How many extra args we expect.    */
  48. #define DOS_RETAX       0x1000         /* return AX as result */
  49. #define DOS_RETDX       0x2000         /* return DX as result */
  50. #define DOS_RETDISI     0x3000         /* return DI SI as result */
  51. /*
  52. ** DOS ioctls we support:
  53. */
  54. #define DOS_GETDEVDATA      (DOS_PLAIN_GETDEVDATA|         DOS_RETDX|DOS_XINARGS(0))
  55. #define DOS_SETDEVDATA      (DOS_PLAIN_SETDEVDATA|                   DOS_XINARGS(1))
  56. #define DOS_RCVDATA         (DOS_PLAIN_RCVDATA   |DOS_XFER|DOS_RETAX|DOS_XINARGS(1))
  57. #define DOS_SNDDATA         (DOS_PLAIN_SNDDATA   |DOS_XFER|DOS_RETAX|DOS_XINARGS(1))
  58. #define DOS_RCVCTLDATA      (DOS_PLAIN_RCVCTLDATA|DOS_XFER|DOS_RETAX|DOS_XINARGS(1))
  59. #define DOS_SNDCTLDATA      (DOS_PLAIN_SNDCTLDATA|DOS_XFER|DOS_RETAX|DOS_XINARGS(1))
  60. #define DOS_CHKINSTAT       (DOS_PLAIN_CHKINSTAT |         DOS_RETAX)
  61. #define DOS_CHKOUTSTAT      (DOS_PLAIN_CHKOUTSTAT|         DOS_RETAX)
  62. #define DOS_ISCHANGEABLE    (DOS_PLAIN_ISCHANGEABLE|       DOS_RETAX)
  63. #define DOS_ISREDIRBLK      (DOS_PLAIN_ISREDIRBLK|         DOS_RETDX)
  64. #define DOS_ISREDIRHND      (DOS_PLAIN_ISREDIRHND|         DOS_RETDX)
  65. #define DOS_SETRETRY        (DOS_PLAIN_SETRETRY|                     DOS_XINARGS(1))
  66. /*
  67. These ones do not fit into my scheme, because they _DO_NOT_ put the size
  68. of the xfer buffer in CX. Aaaaargh
  69. */
  70. #define DOS_GENCHARREQ      (DOS_PLAIN_GENCHARREQ|DOS_BRAINDEAD|DOS_RETDISI)
  71. #define DOS_GENBLKREQ       (DOS_PLAIN_GENBLKREQ |DOS_BRAINDEAD|DOS_RETAX)
  72. #define DOS_GLDRVMAP        (DOS_PLAIN_GLDRVMAP|           DOS_RETAX)
  73. #define DOS_SLDRVMAP        (DOS_PLAIN_SLDRVMAP|           DOS_RETAX)
  74. #define DOS_QGIOCTLCAPH     (DOS_PLAIN_QGIOCTLCAPH|        DOS_RETAX)
  75. #define DOS_QGIOCTLCAPD     (DOS_PLAIN_QGIOCTLCAPD|        DOS_RETAX)
  76.  
  77.  
  78. #define __IS_UNIX_IOCTL(a) ((a) & 0xd0000000U)
  79. #if 0
  80. /*
  81. ** UNIX stuff
  82. **
  83. ** This is subject to major changes in the near future.
  84. ** Do not use it yet.
  85. */
  86.  
  87. /*
  88. ** __WARNING__ :
  89. ** This ifdef works for DJGPP, because its io.h
  90. ** defines __djgpp_include_io_h_
  91. */
  92. #ifndef _IO
  93. /*
  94. * Ioctl's have the command encoded in the lower word,
  95. * and the size of any in or out parameters in the upper
  96. * word.  The high 2 bits of the upper word are used
  97. * to encode the in/out status of the parameter; for now
  98. * we restrict parameters to at most 128 bytes.
  99. */
  100. #define IOCPARM_MASK    0x7f            /* parameters must be < 128 bytes */
  101. #define IOC_VOID        0x20000000      /* no parameters */
  102. #define IOC_OUT         0x40000000      /* copy out parameters */
  103. #define IOC_IN          0x80000000      /* copy in parameters */
  104. #define IOC_INOUT       (IOC_IN|IOC_OUT)
  105. /* the 0x20000000 is so we can distinguish new ioctl's from old */
  106. #define _IO(x,y)        (IOC_VOID|(x<<8)|y)
  107. #define _IOR(x,y,t)     (IOC_OUT|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y)
  108. #define _IOW(x,y,t)     (IOC_IN|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y)
  109. /* this should be _IORW, but stdio got there first */
  110. #define _IOWR(x,y,t)    (IOC_INOUT|((sizeof(t)&IOCPARM_MASK)<<16)|(x<<8)|y)
  111. #endif /* _IO */
  112. /* Common ioctl's for all disciplines which are handled in ttiocom */
  113. enum tty_ioctl {
  114.     TXISATTY = ('X'<<8),    /* quick path for isatty */
  115.     TXTTYNAME,                /* quick path for ttyname */
  116.     TXGETLD,                /* get line discipline */
  117.     TXSETLD,                /* set line discipline */
  118.     TXGETCD,                /* get control disciplines */
  119.     TXADDCD,                /* add control discipline */
  120.     TXDELCD,                /* delete control discipline */
  121.     TXSBAUD,                /* set integer baud rate */
  122.     TXGBAUD,                /* get integer baud rate */
  123.     TXSETIHOG,                /* set the input buffer limit */
  124.     TXSETOHOG,                /* set the output buffer limit */
  125.     TXGPGRP,                /* get p grp with posix security */
  126.     TXSPGRP                 /* set p grp with posix security */
  127. };
  128.  
  129. #define TTNAMEMAX 32        /* used with TXGETLD, et al */
  130.  
  131. union txname {                /* used with TXGETCD */
  132.     int tx_which;            /* which name to get -- inbound */
  133.     char tx_name[TTNAMEMAX];/* the name -- outbound */
  134. };
  135.  
  136. /* 
  137.  * window size structure used with TXSETWIN and TXGETWIN.  This is 
  138.  * exactly the same as the Berkeley structure and can be used with 
  139.  * TIOCSWINSZ and TIOCGWINSZ -- in fact they are defined to be the 
  140.  * same.
  141.  */
  142. struct winsize {
  143.     unsigned short    ws_row;            /* rows, in characters */
  144.     unsigned short    ws_col;            /* columns, in characters */
  145.     unsigned short    ws_xpixel;        /* horizontal size, pixels */
  146.     unsigned short    ws_ypixel;        /* vertical size, pixels */
  147. };
  148.  
  149. struct tchars {
  150.     char    t_intrc;    /* interrupt */
  151.     char    t_quitc;    /* quit */
  152.     char    t_startc;    /* start output */
  153.     char    t_stopc;    /* stop output */
  154.     char    t_eofc;        /* end-of-file */
  155.     char    t_brkc;        /* input delimiter (like nl) */
  156. };
  157. struct ltchars {
  158.     char    t_suspc;    /* stop process signal */
  159.     char    t_dsuspc;    /* delayed stop process signal */
  160.     char    t_rprntc;    /* reprint line */
  161.     char    t_flushc;    /* flush output (toggles) */
  162.     char    t_werasc;    /* word erase */
  163.     char    t_lnextc;    /* literal next character */
  164. };
  165.  
  166. /*
  167. * Structure for TIOCGETP and TIOCSETP ioctls.
  168. */
  169.  
  170. struct sgttyb {
  171.     char    sg_ispeed;        /* input speed */
  172.     char    sg_ospeed;        /* output speed */
  173.     char    sg_erase;        /* erase character */
  174.     char    sg_kill;        /* kill character */
  175.     short    sg_flags;        /* mode flags */
  176. };
  177.  
  178. /*
  179.  * Pun for SUN.
  180.  */
  181. struct ttysize {
  182.     unsigned short    ts_lines;
  183.     unsigned short    ts_cols;
  184.     unsigned short    ts_xxx;
  185.     unsigned short    ts_yyy;
  186. };
  187. #define    TIOCGSIZE    TIOCGWINSZ
  188. #define    TIOCSSIZE    TIOCSWINSZ
  189.  
  190.  
  191.  
  192.  
  193.  
  194. #define TIOCGETD    _IOR('t', 0, int)       /* get line discipline */
  195. #define TIOCSETD    _IOW('t', 1, int)       /* set line discipline */
  196. #define TIOCHPCL    _IO('t', 2)             /* hang up on last close */
  197. #define TIOCMODG    _IOR('t', 3, int)       /* get modem control state */
  198. #define TIOCMODS    _IOW('t', 4, int)       /* set modem control state */
  199. #define TIOCM_LE    0001                    /* line enable */
  200. #define TIOCM_DTR   0002                    /* data terminal ready */
  201. #define TIOCM_RTS   0004                    /* request to send */
  202. #define TIOCM_ST    0010                    /* secondary transmit */
  203. #define TIOCM_SR    0020                    /* secondary receive */
  204. #define TIOCM_CTS   0040                    /* clear to send */
  205. #define TIOCM_CAR   0100                    /* carrier detect */
  206. #define TIOCM_CD    TIOCM_CAR
  207. #define TIOCM_RNG   0200                    /* ring */
  208. #define TIOCM_RI    TIOCM_RNG
  209. #define TIOCM_DSR   0400                    /* data set ready */
  210. #define TIOCGETP    _IOR('t', 8,struct sgttyb)      /* get parameters -- gtty */
  211. #define TIOCSETP    _IOW('t', 9,struct sgttyb)      /* set parameters -- stty */
  212. #define TIOCSETN    _IOW('t',10,struct sgttyb)  /* as above, but no flushtty */
  213. #define TIOCEXCL    _IO('t', 13)                /* set exclusive use of tty */
  214. #define TIOCNXCL    _IO('t', 14)                /* reset exclusive use of tty */
  215. #define TIOCFLUSH   _IOW('t', 16, int)          /* flush buffers */
  216. #define TIOCSETC    _IOW('t',17,struct tchars)  /* set special characters */
  217. #define TIOCGETC    _IOR('t',18,struct tchars)  /* get special characters */
  218. #define TANDEM      0x00000001                  /* send stopc on out q full */
  219. #define CBREAK      0x00000002                  /* half-cooked mode */
  220. #define LCASE       0x00000004                  /* simulate lower case */
  221. #define ECHO        0x00000008                  /* echo input */
  222. #define CRMOD       0x00000010                  /* map \r to \r\n on output */
  223. #define RAW         0x00000020                  /* no i/o processing */
  224. #define ODDP        0x00000040                  /* get/send odd parity */
  225. #define EVENP       0x00000080                  /* get/send even parity */
  226. #define ANYP        0x000000c0                  /* get any parity/send none */
  227. #define CRDELAY     0x00000300                  /* \r delay */
  228. #define CR0         0x00000000
  229. #define CR1         0x00000100                  /* tn 300 */
  230. #define CR2         0x00000200                  /* tty 37 */
  231. #define CR3         0x00000300                  /* concept 100 */
  232. #define TBDELAY     0x00000c00                  /* horizontal tab delay */
  233. #define TAB0        0x00000000
  234. #define TAB1        0x00000400                  /* tty 37 */
  235. #define TAB2        0x00000800
  236. #define XTABS       0x00000c00                  /* expand tabs on output */
  237. #define BSDELAY     0x00001000                  /* \b delay */
  238. #define BS0         0x00000000
  239. #define BS1         0x00001000
  240. #define VTDELAY     0x00002000                  /* vertical tab delay */
  241. #define FF0         0x00000000
  242. #define FF1         0x00002000                  /* tty 37 */
  243. #define NLDELAY     0x0000c000                  /* \n delay */
  244. #define NL0         0x00000000
  245. #define NL1         0x00004000                  /* tty 37 */
  246. #define NL2         0x00008000                  /* vt05 */
  247. #define NL3         0x0000c000
  248. #define ALLDELAY    (NLDELAY|TBDELAY|CRDELAY|VTDELAY|BSDELAY)
  249. #define TOSTOP      0x00010000                  /* SIGSTOP on bckgnd output */
  250. #define PRTERA      0x00020000                  /* \ ... / erase */
  251. #define CRTERA      0x00040000                  /* " \b " to wipe out char */
  252. #define TILDE       0x00080000                  /* hazeltine tilde kludge */
  253. #define FLUSHO      0x00100000                  /* flush output to terminal */
  254. #define LITOUT      0x00200000                  /* literal output */
  255. #define CRTBS       0x00400000                  /* do backspacing for crt */
  256. #define MDMBUF      0x00800000                  /* dtr pacing */
  257. #define NOHANG      0x01000000                  /* no SIGHUP on carrier drop */
  258. #define L001000     0x02000000
  259. #define CRTKIL      0x04000000                  /* kill line with " \b " */
  260. #define PASS8       0x08000000
  261. #define CTLECH      0x10000000                  /* echo control chars as ^X */
  262. #define PENDIN      0x20000000                  /* tp->t_rawq needs reread */
  263. #define DECCTQ      0x40000000                  /* only ^Q starts after ^S */
  264. #define NOFLUSH     0x80000000                  /* no output flush on signal */
  265. #define TIOCCONS    _IOW('t', 98, int)          /* become virtual console */
  266. #ifdef    _BSD_INCLUDES
  267. /*
  268.  * Added for 4.3 BSD.
  269.  */
  270. #define     NOFLSH      NOFLUSH                 /* no output flush on signal */
  271. #endif    /* _BSD_INCLUDES */
  272.  
  273.                         /* locals, from 127 down */
  274. #define TIOCLBIS    _IOW('t', 127, int)              /* bis local mode bits */
  275. #define TIOCLBIC    _IOW('t', 126, int)             /* bic local mode bits */
  276. #define TIOCLSET    _IOW('t', 125, int)             /* set entire mode word */
  277. #define TIOCLGET    _IOR('t', 124, int)             /* get local modes */
  278. #define LCRTBS      (CRTBS>>16)
  279. #define LPRTERA     (PRTERA>>16)
  280. #define LCRTERA     (CRTERA>>16)
  281. #define LTILDE      (TILDE>>16)
  282. #define LMDMBUF     (MDMBUF>>16)
  283. #define LLITOUT     (LITOUT>>16)
  284. #define LTOSTOP     (TOSTOP>>16)
  285. #define LFLUSHO     (FLUSHO>>16)
  286. #define LNOHANG     (NOHANG>>16)
  287. #define LCRTKIL     (CRTKIL>>16)
  288. #define LPASS8      (PASS8>>16)
  289. #define LCTLECH     (CTLECH>>16)
  290. #define LPENDIN     (PENDIN>>16)
  291. #define LDECCTQ     (DECCTQ>>16)
  292. #define LNOFLSH     (NOFLUSH>>16)
  293. #define TIOCSBRK    _IO('t', 123)                   /* set break bit */
  294. #define TIOCCBRK    _IO('t', 122)                   /* clear break bit */
  295. #define TIOCSDTR    _IO('t', 121)                   /* set data terminal ready */
  296. #define TIOCCDTR    _IO('t', 120)                   /* clear data terminal ready */
  297. #define TIOCGPGRP   _IOR('t', 119, int)             /* get process group */
  298. #define TIOCSPGRP   _IOW('t', 118, int)             /* set process gorup */
  299. #define TIOCSLTC    _IOW('t',117,struct ltchars)   /* set local special chars */
  300. #define TIOCGLTC    _IOR('t',116,struct ltchars)   /* get local special chars */
  301. #define TIOCOUTQ    _IOR('t', 115, int)             /* output queue size */
  302. #define TIOCSTI     _IOW('t', 114, char)           /* simulate terminal input */
  303. #define TIOCNOTTY   _IO('t', 113)                   /* void tty association */
  304. #define TIOCPKT     _IOW('t', 112, int)         /* pty: set/clear packet mode */
  305. #define TIOCPKT_DATA        0x00                    /* data packet */
  306. #define TIOCPKT_FLUSHREAD   0x01                    /* flush packet */
  307. #define TIOCPKT_FLUSHWRITE  0x02                    /* flush packet */
  308. #define TIOCPKT_STOP        0x04                    /* stop output */
  309. #define TIOCPKT_START       0x08                    /* start output */
  310. #define TIOCPKT_NOSTOP      0x10                    /* no more ^S, ^Q */
  311. #define TIOCPKT_DOSTOP      0x20                    /* now do ^S ^Q */
  312. #define TIOCSTOP    _IO('t', 111)                   /* stop output, like ^S */
  313. #define TIOCSTART   _IO('t', 110)                   /* start output, like ^Q */
  314. #define TIOCMSET    _IOW('t', 109, int)             /* set all modem bits */
  315. #define TIOCMBIS    _IOW('t', 108, int)             /* bis modem bits */
  316. #define TIOCMBIC    _IOW('t', 107, int)             /* bic modem bits */
  317. #define TIOCMGET    _IOR('t', 106, int)             /* get all modem bits */
  318. #define TIOCREMOTE  _IOW('t', 105, int)             /* remote input editing */
  319. #define TIOCGWINSZ  _IOR('t', 104, struct winsize)      /* get window size */
  320. #define TIOCSWINSZ  _IOW('t', 103, struct winsize)      /* set window size */
  321. #define TIOCUCNTL   _IOW('t', 102, int)         /* pty: set/clr usr cntl mode */
  322. #define UIOCCMD(n)  _IO('u', n)                         /* usr cntl op "n" */
  323.  
  324. #define OTTYDISC    0                               /* old, v7 std tty driver */
  325. #define NETLDISC    1                               /* line discip for berk net */
  326. #define NTTYDISC    2                               /* new tty discipline */
  327. #define TABLDISC    3                               /* tablet discipline */
  328. #define SLIPDISC    4                               /* serial IP discipline */
  329.  
  330. #define FIOCLEX     _IO('f', 1)                     /* set exclusive use on fd */
  331. #define FIONCLEX    _IO('f', 2)                     /* remove exclusive use */
  332. /* another local */
  333.  
  334. #define FIONREAD    _IOR('f', 127, int)                 /* get # bytes to read */
  335. #define FIONBIO     _IOW('f', 126, int)         /* set/clear non-blocking i/o */
  336. #define FIOASYNC    _IOW('f', 125, int)                 /* set/clear async i/o */
  337.  
  338. #define FIOSETOWN   _IOW('f', 124, int)                 /* set owner */
  339. #define FIOGETOWN   _IOR('f', 123, int)                 /* get owner */
  340.  
  341.  
  342. #endif /* 0 */
  343.  
  344. int ioctl( int fd, int cmd, ...);
  345.  
  346.  
  347. #endif  /* ! _POSIX_SOURCE */
  348. #endif  /* ! __STRICT_ANSI__ */
  349. #endif  /* ! __dj_ENFORCE_ANSI_FREESTANDING */
  350.  
  351. #ifndef __dj_ENFORCE_FUNCTION_CALLS
  352. #endif /* !__dj_ENFORCE_FUNCTION_CALLS */
  353.  
  354.  
  355. #ifdef __cplusplus
  356. }
  357. #endif
  358.  
  359. #endif  /* !__dj_include_sys_ioctl_h_ */
  360.  
  361.