Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

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