termios.inc 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  1. {
  2. }
  3. {$PACKRECORDS C}
  4. {
  5. Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
  6. @APPLE_LICENSE_HEADER_START@
  7. The contents of this file constitute Original Code as defined in and
  8. are subject to the Apple Public Source License Version 1.1 (the
  9. "License"). You may not use this file except in compliance with the
  10. License. Please obtain a copy of the License at
  11. http://www.apple.com/publicsource and read it before using this file.
  12. This Original Code and all software distributed under the License are
  13. distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  14. EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  15. INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
  16. FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
  17. License for the specific language governing rights and limitations
  18. under the License.
  19. @APPLE_LICENSE_HEADER_END@
  20. }
  21. { Copyright (c) 1997 Apple Computer, Inc. All Rights Reserved }
  22. {
  23. Copyright (c) 1988, 1989, 1993, 1994
  24. The Regents of the University of California. All rights reserved.
  25. Redistribution and use in source and binary forms, with or without
  26. modification, are permitted provided that the following conditions
  27. are met:
  28. 1. Redistributions of source code must retain the above copyright
  29. notice, this list of conditions and the following disclaimer.
  30. 2. Redistributions in binary form must reproduce the above copyright
  31. notice, this list of conditions and the following disclaimer in the
  32. documentation and/or other materials provided with the distribution.
  33. 3. All advertising materials mentioning features or use of this software
  34. must display the following acknowledgement:
  35. This product includes software developed by the University of
  36. California, Berkeley and its contributors.
  37. 4. Neither the name of the University nor the names of its contributors
  38. may be used to endorse or promote products derived from this software
  39. without specific prior written permission.
  40. THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  41. ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  42. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  43. ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  44. FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  45. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  46. OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  47. HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  48. LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  49. OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  50. SUCH DAMAGE.
  51. @(#)termios.h 8.3 (Berkeley) 3/28/94
  52. }
  53. {$ifndef _SYS_TERMIOS_H_}
  54. {$define _SYS_TERMIOS_H_}
  55. {
  56. Special Control Characters
  57. Index into c_cc[] character array.
  58. Name Subscript Enabled by
  59. }
  60. { ICANON }
  61. const
  62. VEOF = 0;
  63. { ICANON }
  64. VEOL = 1;
  65. {$ifndef _POSIX_SOURCE}
  66. { ICANON together with IEXTEN }
  67. const
  68. VEOL2 = 2;
  69. {$endif}
  70. { ICANON }
  71. const
  72. VERASE = 3;
  73. {$ifndef _POSIX_SOURCE}
  74. { ICANON together with IEXTEN }
  75. const
  76. VWERASE = 4;
  77. {$endif}
  78. { ICANON }
  79. const
  80. VKILL = 5;
  81. {$ifndef _POSIX_SOURCE}
  82. { ICANON together with IEXTEN }
  83. const
  84. VREPRINT = 6;
  85. {$endif}
  86. { 7 spare 1 }
  87. { ISIG }
  88. const
  89. VINTR = 8;
  90. { ISIG }
  91. VQUIT = 9;
  92. { ISIG }
  93. VSUSP = 10;
  94. {$ifndef _POSIX_SOURCE}
  95. { ISIG together with IEXTEN }
  96. const
  97. VDSUSP = 11;
  98. {$endif}
  99. { IXON, IXOFF }
  100. const
  101. VSTART = 12;
  102. { IXON, IXOFF }
  103. VSTOP = 13;
  104. {$ifndef _POSIX_SOURCE}
  105. { IEXTEN }
  106. const
  107. VLNEXT = 14;
  108. { IEXTEN }
  109. VDISCARD = 15;
  110. {$endif}
  111. { !ICANON }
  112. const
  113. VMIN = 16;
  114. { !ICANON }
  115. VTIME = 17;
  116. {$ifndef _POSIX_SOURCE}
  117. { ICANON together with IEXTEN }
  118. const
  119. VSTATUS = 18;
  120. { 19 spare 2 }
  121. {$endif}
  122. const
  123. NCCS = 20;
  124. {$ifndef _POSIX_VDISABLE}
  125. // as in linux freebsd netbsd and openbsd
  126. // Start
  127. Type
  128. winsize = record
  129. ws_row,
  130. ws_col,
  131. ws_xpixel,
  132. ws_ypixel : word;
  133. end;
  134. TWinSize=winsize;
  135. //End
  136. const
  137. _POSIX_VDISABLE = $ff;
  138. {$endif}
  139. {$ifndef _POSIX_SOURCE}
  140. { was #define dname(params) para_def_expr }
  141. { argument types are unknown }
  142. { return type might be wrong }
  143. // function CCEQ(val,c : longint) : longint;
  144. // as in freebsd netbsd and openbsd and in /usr/include/sys/termios.h
  145. {
  146. #define CCEQ(val, c) ((c) == (val) ? (val) != _POSIX_VDISABLE : 0)
  147. }
  148. {$endif}
  149. {
  150. Input flags - software input processing
  151. }
  152. { ignore BREAK condition }
  153. const
  154. IGNBRK = $00000001;
  155. { map BREAK to SIGINTR }
  156. BRKINT = $00000002;
  157. { ignore (discard) parity errors }
  158. IGNPAR = $00000004;
  159. { mark parity and framing errors }
  160. PARMRK = $00000008;
  161. { enable checking of parity errors }
  162. INPCK = $00000010;
  163. { strip 8th bit off chars }
  164. ISTRIP = $00000020;
  165. { map NL into CR }
  166. INLCR = $00000040;
  167. { ignore CR }
  168. IGNCR = $00000080;
  169. { map CR to NL (ala CRMOD) }
  170. ICRNL = $00000100;
  171. { enable output flow control }
  172. IXON = $00000200;
  173. { enable input flow control }
  174. IXOFF = $00000400;
  175. {$ifndef _POSIX_SOURCE}
  176. { any char will restart after stop }
  177. const
  178. IXANY = $00000800;
  179. { ring bell on input queue full }
  180. IMAXBEL = $00002000;
  181. {$endif}
  182. {_POSIX_SOURCE }
  183. {
  184. Output flags - software output processing
  185. }
  186. { enable following output processing }
  187. const
  188. OPOST = $00000001;
  189. {$ifndef _POSIX_SOURCE}
  190. { map NL to CR-NL (ala CRMOD) }
  191. const
  192. ONLCR = $00000002;
  193. { expand tabs to spaces }
  194. OXTABS = $00000004;
  195. { discard EOT's (^D) on output) }
  196. ONOEOT = $00000008;
  197. {$endif}
  198. {_POSIX_SOURCE }
  199. {
  200. Control flags - hardware control of terminal
  201. }
  202. {$ifndef _POSIX_SOURCE}
  203. { ignore control flags }
  204. const
  205. CIGNORE = $00000001;
  206. {$endif}
  207. { character size mask }
  208. const
  209. CSIZE = $00000300;
  210. { 5 bits (pseudo) }
  211. CS5 = $00000000;
  212. { 6 bits }
  213. CS6 = $00000100;
  214. { 7 bits }
  215. CS7 = $00000200;
  216. { 8 bits }
  217. CS8 = $00000300;
  218. { send 2 stop bits }
  219. CSTOPB = $00000400;
  220. { enable receiver }
  221. CREAD = $00000800;
  222. { parity enable }
  223. PARENB = $00001000;
  224. { odd parity, else even }
  225. PARODD = $00002000;
  226. { hang up on last close }
  227. HUPCL = $00004000;
  228. { ignore modem status lines }
  229. CLOCAL = $00008000;
  230. {$ifndef _POSIX_SOURCE}
  231. { CTS flow control of output }
  232. const
  233. CCTS_OFLOW = $00010000;
  234. { RTS flow control of input }
  235. CRTS_IFLOW = $00020000;
  236. CRTSCTS = CCTS_OFLOW or CRTS_IFLOW;
  237. { DTR flow control of input }
  238. CDTR_IFLOW = $00040000;
  239. { DSR flow control of output }
  240. CDSR_OFLOW = $00080000;
  241. { DCD flow control of output }
  242. CCAR_OFLOW = $00100000;
  243. { old name for CCAR_OFLOW }
  244. MDMBUF = $00100000;
  245. {$endif}
  246. {
  247. "Local" flags - dumping ground for other state
  248. Warning: some flags in this structure begin with
  249. the letter "I" and look like they belong in the
  250. input flag.
  251. }
  252. {$ifndef _POSIX_SOURCE}
  253. { visual erase for line kill }
  254. const
  255. ECHOKE = $00000001;
  256. {$endif}
  257. {_POSIX_SOURCE }
  258. { visually erase chars }
  259. const
  260. ECHOE = $00000002;
  261. { echo NL after line kill }
  262. ECHOK = $00000004;
  263. { enable echoing }
  264. ECHO = $00000008;
  265. { echo NL even if ECHO is off }
  266. ECHONL = $00000010;
  267. {$ifndef _POSIX_SOURCE}
  268. { visual erase mode for hardcopy }
  269. const
  270. ECHOPRT = $00000020;
  271. { echo control chars as ^(Char) }
  272. ECHOCTL = $00000040;
  273. {$endif}
  274. {_POSIX_SOURCE }
  275. { enable signals INTR, QUIT, [D]SUSP }
  276. const
  277. ISIG = $00000080;
  278. { canonicalize input lines }
  279. ICANON = $00000100;
  280. {$ifndef _POSIX_SOURCE}
  281. { use alternate WERASE algorithm }
  282. const
  283. ALTWERASE = $00000200;
  284. {$endif}
  285. {_POSIX_SOURCE }
  286. { enable DISCARD and LNEXT }
  287. const
  288. IEXTEN = $00000400;
  289. { external processing }
  290. EXTPROC = $00000800;
  291. { stop background jobs from output }
  292. TOSTOP = $00400000;
  293. {$ifndef _POSIX_SOURCE}
  294. { output being flushed (state) }
  295. const
  296. FLUSHO = $00800000;
  297. { no kernel output from VSTATUS }
  298. NOKERNINFO = $02000000;
  299. { XXX retype pending input (state) }
  300. PENDIN = $20000000;
  301. {$endif}
  302. {_POSIX_SOURCE }
  303. { don't flush after interrupt }
  304. const
  305. NOFLSH = $80000000;
  306. type
  307. tcflag_t = dword;
  308. cc_t = byte;
  309. speed_t = longint;
  310. { XXX should be unsigned long }
  311. { input flags }
  312. { output flags }
  313. { control flags }
  314. { local flags }
  315. { control chars }
  316. { input speed }
  317. { output speed }
  318. termios = record
  319. c_iflag : tcflag_t;
  320. c_oflag : tcflag_t;
  321. c_cflag : tcflag_t;
  322. c_lflag : tcflag_t;
  323. c_cc : array[0..(NCCS)-1] of cc_t;
  324. c_ispeed : speed_t;
  325. c_ospeed : speed_t;
  326. end;
  327. {
  328. Commands passed to tcsetattr() for setting the termios structure.
  329. }
  330. { make change immediate }
  331. const
  332. TCSANOW = 0;
  333. { drain output, then change }
  334. TCSADRAIN = 1;
  335. { drain output, flush input }
  336. TCSAFLUSH = 2;
  337. {$ifndef _POSIX_SOURCE}
  338. { flag - don't alter h.w. state }
  339. const
  340. TCSASOFT = $10;
  341. {$endif}
  342. {
  343. Standard speeds
  344. }
  345. const
  346. B0 = 0;
  347. B50 = 50;
  348. B75 = 75;
  349. B110 = 110;
  350. B134 = 134;
  351. B150 = 150;
  352. B200 = 200;
  353. B300 = 300;
  354. B600 = 600;
  355. B1200 = 1200;
  356. B1800 = 1800;
  357. B2400 = 2400;
  358. B4800 = 4800;
  359. B9600 = 9600;
  360. B19200 = 19200;
  361. B38400 = 38400;
  362. {$ifndef _POSIX_SOURCE}
  363. const
  364. B7200 = 7200;
  365. B14400 = 14400;
  366. B28800 = 28800;
  367. B57600 = 57600;
  368. B76800 = 76800;
  369. B115200 = 115200;
  370. B230400 = 230400;
  371. EXTA = 19200;
  372. EXTB = 38400;
  373. {$endif}
  374. { !_POSIX_SOURCE }
  375. const
  376. TCIFLUSH = 1;
  377. TCOFLUSH = 2;
  378. TCIOFLUSH = 3;
  379. TCOOFF = 1;
  380. TCOON = 2;
  381. TCIOFF = 3;
  382. TCION = 4;
  383. // as in freebsd netbsd and openbsd and in
  384. // /usr/include/sys/ttycom.h und ioccom.h
  385. IOCTLREAD = $40000000;
  386. IOCTLWRITE = $80000000;
  387. IOCTLVOID = $20000000;
  388. TIOCMODG = IOCTLREAD+$47400+ 3; { get modem control state }
  389. TIOCMODS = IOCTLWRITE+$47400+ 4; { set modem control state }
  390. TIOCM_LE =$0001; { line enable }
  391. TIOCM_DTR =$0002; { data terminal ready }
  392. TIOCM_RTS =$0004; { request to send }
  393. TIOCM_ST =$0010; { secondary transmit }
  394. TIOCM_SR =$0020; { secondary receive }
  395. TIOCM_CTS =$0040; { clear to send }
  396. TIOCM_CAR =$0100; { carrier detect }
  397. TIOCM_CD =TIOCM_CAR;
  398. TIOCM_RNG =$0200; { ring }
  399. TIOCM_RI =TIOCM_RNG;
  400. TIOCM_DSR =$0400; { data set ready }
  401. { 8-10 compat }
  402. TIOCEXCL =IOCTLVOID+$7400+ 13; { set exclusive use of tty }
  403. TIOCNXCL =IOCTLVOID+$7400+ 14; { reset exclusive use of tty }
  404. { 15 unused }
  405. TIOCFLUSH =IOCTLWRITE+$47400+ 16; { flush buffers }
  406. { 17-18 compat }
  407. TIOCGETA =IOCTLREAD+$2C7400+ 19; { get termios struct }
  408. TIOCSETA =IOCTLWRITE+$2C7400+ 20; { set termios struct }
  409. TIOCSETAW =IOCTLWRITE+$2C7400+ 21; { drain output, set }
  410. TIOCSETAF =IOCTLWRITE+$2C7400+ 22; { drn out, fls in, set }
  411. TIOCGETD =IOCTLREAD+$47400+ 26; { get line discipline }
  412. TIOCSETD =IOCTLWRITE+$47400+ 27; { set line discipline }
  413. { 127-124 compat }
  414. TIOCSBRK =IOCTLVOID+$7400+ 123; { set break bit }
  415. TIOCCBRK =IOCTLVOID+$7400+ 122; { clear break bit }
  416. TIOCSDTR =IOCTLVOID+$7400+ 121; { set data terminal ready }
  417. TIOCCDTR =IOCTLVOID+$7400+ 120; { clear data terminal ready }
  418. TIOCGPGRP =IOCTLREAD+$47400+ 119; { get pgrp of tty }
  419. TIOCSPGRP =IOCTLWRITE+$47400+ 118; { set pgrp of tty }
  420. { 117-116 compat }
  421. TIOCOUTQ =IOCTLREAD+$47400+ 115; { output queue size }
  422. TIOCSTI =IOCTLWRITE+$17400+ 114; { simulate terminal input }
  423. TIOCNOTTY =IOCTLVOID+$7400+ 113; { void tty association }
  424. TIOCPKT =IOCTLWRITE+$47400+ 112; { pty: set/clear packet mode }
  425. TIOCPKT_DATA =$00; { data packet }
  426. TIOCPKT_FLUSHREAD =$01; { flush packet }
  427. TIOCPKT_FLUSHWRITE =$02; { flush packet }
  428. TIOCPKT_STOP =$04; { stop output }
  429. TIOCPKT_START =$08; { start output }
  430. TIOCPKT_NOSTOP =$10; { no more ^S, ^Q }
  431. TIOCPKT_DOSTOP =$20; { now do ^S ^Q }
  432. TIOCPKT_IOCTL =$40; { state change of pty driver }
  433. TIOCSTOP =IOCTLVOID+$7400+ 111; { stop output, like ^S }
  434. TIOCSTART =IOCTLVOID+$7400+ 110; { start output, like ^Q }
  435. TIOCMSET =IOCTLWRITE+$47400+ 109; { set all modem bits }
  436. TIOCMBIS =IOCTLWRITE+$47400+ 108; { bis modem bits }
  437. TIOCMBIC =IOCTLWRITE+$47400+ 107; { bic modem bits }
  438. TIOCMGET =IOCTLREAD+$47400+ 106; { get all modem bits }
  439. TIOCREMOTE =IOCTLWRITE+$47400+ 105; { remote input editing }
  440. TIOCGWINSZ =IOCTLREAD+$87400+ 104; { get window size }
  441. TIOCSWINSZ =IOCTLWRITE+$87400+ 103; { set window size }
  442. TIOCUCNTL =IOCTLWRITE+$47400+ 102; { pty: set/clr usr cntl mode }
  443. TIOCSTAT =IOCTLVOID+$7400+ 101; { simulate ^T status message }
  444. // UIOCCMD(n) _IO('u', n) { usr cntl op "n" }
  445. TIOCSCONS =IOCTLWRITE+$47400+ 99; { 4.2 compatibility } // added from ttycom.h
  446. TIOCCONS =IOCTLWRITE+$47400+ 98; { become virtual console }
  447. TIOCSCTTY =IOCTLVOID+$7400+ 97; { become controlling tty }
  448. TIOCEXT =IOCTLWRITE+$47400+ 96; { pty: external processing }
  449. TIOCSIG =IOCTLVOID+$7400+ 95; { pty: generate signal }
  450. TIOCDRAIN =IOCTLVOID+$7400+ 94; { wait till output drained }
  451. TIOCMSDTRWAIT =IOCTLWRITE+$47400+ 91; { modem: set wait on close }
  452. TIOCMGDTRWAIT =IOCTLREAD+$47400+ 90; { modem: get wait on close }
  453. TIOCTIMESTAMP =IOCTLREAD+$87400+ 89; { enable/get timestamp
  454. * of last input event }
  455. TIOCDCDTIMESTAMP =IOCTLREAD+$87400+ 88; { enable/get timestamp
  456. * of last DCd rise }
  457. TIOCSDRAINWAIT =IOCTLWRITE+$47400+ 87; { set ttywait timeout }
  458. TIOCGDRAINWAIT =IOCTLREAD+$47400+ 86; { get ttywait timeout }
  459. TIOCDSIMICROCODE =IOCTLREAD+$47400+ 85; { download microcode to DSI Softmodem } // added from ttycom.h
  460. TTYDISC =0; { termios tty line discipline }
  461. TABLDISC =3; { tablet discipline } // added from ttycom.h
  462. SLIPDISC =4; { serial IP discipline }
  463. PPPDISC =5; { PPP discipline }
  464. NETGRAPHDISC =6; { Netgraph tty node discipline }
  465. {
  466. * Defaults on "first" open.
  467. }
  468. TTYDEF_IFLAG =(BRKINT or ICRNL or IMAXBEL or IXON or IXANY);
  469. TTYDEF_OFLAG =(OPOST or ONLCR);
  470. TTYDEF_LFLAG =(ECHO or ICANON or ISIG or IEXTEN or ECHOE or ECHOKE or ECHOCTL);
  471. TTYDEF_CFLAG =(CREAD or CS8 or HUPCL);
  472. TTYDEF_SPEED =(B9600);
  473. {
  474. * Control Character Defaults
  475. }
  476. CtrlMask = $1f; {\037}
  477. CEOF =chr( ORD('d') and CtrlMask);
  478. CEOL =chr( $ff and CtrlMask);{ XXX avoid _POSIX_VDISABLE }
  479. CERASE =chr( $7F and CtrlMask);
  480. CINTR =chr(ORD('c') and CtrlMask);
  481. CSTATUS =chr(ORD('t') and CtrlMask);
  482. CKILL =chr(ORD('u') and CtrlMask);
  483. CMIN =chr(1);
  484. CQUIT =chr(034 and CtrlMask); { FS, ^\ }
  485. CSUSP =chr(ORD('z') and CtrlMask);
  486. CTIME =chr(0);
  487. CDSUSP =chr(ORD('y') and CtrlMask);
  488. CSTART =chr(ORD('q') and CtrlMask);
  489. CSTOP =chr(ORD('s') and CtrlMask);
  490. CLNEXT =chr(ORD('v') and CtrlMask);
  491. CDISCARD =chr(ORD('o') and CtrlMask);
  492. CWERASE =chr(ORD('w') and CtrlMask);
  493. CREPRINT =chr(ORD('r') and CtrlMask);
  494. CEOT =CEOF;
  495. { compat }
  496. CBRK =CEOL;
  497. CRPRNT =CREPRINT;
  498. CFLUSH =CDISCARD;
  499. {
  500. * TTYDEFCHARS to include an array of default control characters.
  501. }
  502. ttydefchars : array[0..NCCS-1] OF char =(
  503. CEOF, CEOL, CEOL, CERASE, CWERASE, CKILL, CREPRINT,
  504. chr(_POSIX_VDISABLE), CINTR, CQUIT, CSUSP, CDSUSP, CSTART, CSTOP, CLNEXT,
  505. CDISCARD, CMIN, CTIME, CSTATUS, chr(_POSIX_VDISABLE));
  506. // from /usr/include/sys/iocomm.h
  507. { parameter length, at most 13 bits }
  508. IOCPARM_MASK = $1fff;
  509. { max size of ioctl args }
  510. IOCPARM_MAX = IOCPARM_MASK + 1;
  511. { no parameters }
  512. IOC_VOID = culong($20000000);
  513. { copy parameters out }
  514. IOC_OUT = culong($40000000);
  515. { copy parameters in }
  516. IOC_IN = culong($80000000);
  517. { copy paramters in and out }
  518. IOC_INOUT = (IOC_IN or IOC_OUT);
  519. { mask for IN/OUT/VOID }
  520. IOC_DIRMASK = culong($e0000000);
  521. // from /usr/include/sys/filio.h
  522. FIOCLEX = (IOC_VOID or (0 and IOCPARM_MASK) << 16) or ((ord('f') << 8) or 1);
  523. FIONCLEX = (IOC_VOID or (0 and IOCPARM_MASK) << 16) or ((ord('f') << 8) or 2);
  524. FIONREAD = (IOC_OUT or (sizeof(cint) and IOCPARM_MASK) << 16) or ((ord('f') << 8) or 127);
  525. FIONBIO = (IOC_IN or (sizeof(cint) and IOCPARM_MASK) << 16) or ((ord('f') << 8) or 126);
  526. FIOASYNC = (IOC_IN or (sizeof(cint) and IOCPARM_MASK) << 16) or ((ord('f') << 8) or 125);
  527. FIOSETOWN = (IOC_IN or (sizeof(cint) and IOCPARM_MASK) << 16) or ((ord('f') << 8) or 124);
  528. FIOGETOWN = (IOC_OUT or (sizeof(cint) and IOCPARM_MASK) << 16) or ((ord('f') << 8) or 123);
  529. FIODTYPE = (IOC_OUT or (sizeof(cint) and IOCPARM_MASK) << 16) or ((ord('f') << 8) or 122);
  530. {$endif}