1 | /*
|
---|
2 | * Copyright 1990, 1991 by Thomas Roell, Dinkelscherben, Germany
|
---|
3 | * Copyright 1992 by David Dawes <[email protected]>
|
---|
4 | * Copyright 1992 by Jim Tsillas <[email protected]>
|
---|
5 | * Copyright 1992 by Rich Murphey <[email protected]>
|
---|
6 | * Copyright 1992 by Robert Baron <[email protected]>
|
---|
7 | * Copyright 1992 by Orest Zborowski <[email protected]>
|
---|
8 | * Copyright 1993 by Vrije Universiteit, The Netherlands
|
---|
9 | * Copyright 1993 by David Wexelblat <[email protected]>
|
---|
10 | * Copyright 1994, 1996 by Holger Veit <[email protected]>
|
---|
11 | * Copyright 1997 by Takis Psarogiannakopoulos <[email protected]>
|
---|
12 | * Copyright 1994-2003 by The XFree86 Project, Inc
|
---|
13 | *
|
---|
14 | * Permission to use, copy, modify, distribute, and sell this software and its
|
---|
15 | * documentation for any purpose is hereby granted without fee, provided that
|
---|
16 | * the above copyright notice appear in all copies and that both that
|
---|
17 | * copyright notice and this permission notice appear in supporting
|
---|
18 | * documentation, and that the names of the above listed copyright holders
|
---|
19 | * not be used in advertising or publicity pertaining to distribution of
|
---|
20 | * the software without specific, written prior permission. The above listed
|
---|
21 | * copyright holders make no representations about the suitability of this
|
---|
22 | * software for any purpose. It is provided "as is" without express or
|
---|
23 | * implied warranty.
|
---|
24 | *
|
---|
25 | * THE ABOVE LISTED COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD
|
---|
26 | * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
---|
27 | * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDERS BE
|
---|
28 | * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
|
---|
29 | * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
|
---|
30 | * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
---|
31 | * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
---|
32 | *
|
---|
33 | */
|
---|
34 |
|
---|
35 | /*
|
---|
36 | * The ARM32 code here carries the following copyright:
|
---|
37 | *
|
---|
38 | * Copyright 1997
|
---|
39 | * Digital Equipment Corporation. All rights reserved.
|
---|
40 | * This software is furnished under license and may be used and copied only in
|
---|
41 | * accordance with the following terms and conditions. Subject to these
|
---|
42 | * conditions, you may download, copy, install, use, modify and distribute
|
---|
43 | * this software in source and/or binary form. No title or ownership is
|
---|
44 | * transferred hereby.
|
---|
45 | *
|
---|
46 | * 1) Any source code used, modified or distributed must reproduce and retain
|
---|
47 | * this copyright notice and list of conditions as they appear in the
|
---|
48 | * source file.
|
---|
49 | *
|
---|
50 | * 2) No right is granted to use any trade name, trademark, or logo of Digital
|
---|
51 | * Equipment Corporation. Neither the "Digital Equipment Corporation"
|
---|
52 | * name nor any trademark or logo of Digital Equipment Corporation may be
|
---|
53 | * used to endorse or promote products derived from this software without
|
---|
54 | * the prior written permission of Digital Equipment Corporation.
|
---|
55 | *
|
---|
56 | * 3) This software is provided "AS-IS" and any express or implied warranties,
|
---|
57 | * including but not limited to, any implied warranties of merchantability,
|
---|
58 | * fitness for a particular purpose, or non-infringement are disclaimed.
|
---|
59 | * In no event shall DIGITAL be liable for any damages whatsoever, and in
|
---|
60 | * particular, DIGITAL shall not be liable for special, indirect,
|
---|
61 | * consequential, or incidental damages or damages for lost profits, loss
|
---|
62 | * of revenue or loss of use, whether such damages arise in contract,
|
---|
63 | * negligence, tort, under statute, in equity, at law or otherwise, even
|
---|
64 | * if advised of the possibility of such damage.
|
---|
65 | *
|
---|
66 | */
|
---|
67 |
|
---|
68 | /* $XConsortium: xf86_OSlib.h /main/22 1996/10/27 11:06:31 kaleb $ */
|
---|
69 |
|
---|
70 | /*
|
---|
71 | * This is private, and should not be included by any drivers. Drivers
|
---|
72 | * may include xf86_OSproc.h to get prototypes for public interfaces.
|
---|
73 | */
|
---|
74 |
|
---|
75 | #ifndef _XF86_OSLIB_H
|
---|
76 | #define _XF86_OSLIB_H
|
---|
77 |
|
---|
78 | #include <X11/Xos.h>
|
---|
79 | #include <X11/Xfuncproto.h>
|
---|
80 |
|
---|
81 | /*
|
---|
82 | * Define some things from the "ANSI" C wrappers that are needed in the
|
---|
83 | * the core server.
|
---|
84 | */
|
---|
85 | #ifndef HAVE_WRAPPER_DECLS
|
---|
86 | #define HAVE_WRAPPER_DECLS
|
---|
87 | #undef usleep
|
---|
88 | #define usleep(a) xf86usleep(a)
|
---|
89 | extern void xf86usleep(unsigned long);
|
---|
90 | extern int xf86getpagesize(void);
|
---|
91 | extern int xf86GetErrno(void);
|
---|
92 | typedef unsigned long xf86size_t;
|
---|
93 | typedef signed long xf86ssize_t;
|
---|
94 | #endif
|
---|
95 |
|
---|
96 | #include <stdio.h>
|
---|
97 | #include <ctype.h>
|
---|
98 | #include <stddef.h>
|
---|
99 |
|
---|
100 | /**************************************************************************/
|
---|
101 | /* SYSV386 (SVR3, SVR4), including Solaris */
|
---|
102 | /**************************************************************************/
|
---|
103 | #if (defined(SYSV) || defined(SVR4)) && \
|
---|
104 | !defined(DGUX) && !defined(sgi) && \
|
---|
105 | (defined(sun) || defined(i386))
|
---|
106 | # ifdef SCO325
|
---|
107 | # ifndef _SVID3
|
---|
108 | # define _SVID3
|
---|
109 | # endif
|
---|
110 | # ifndef _NO_STATIC
|
---|
111 | # define _NO_STATIC
|
---|
112 | # endif
|
---|
113 | # endif
|
---|
114 | # include <sys/ioctl.h>
|
---|
115 | # include <signal.h>
|
---|
116 | # include <termio.h>
|
---|
117 | # include <sys/stat.h>
|
---|
118 | # include <sys/types.h>
|
---|
119 | # if defined(__SCO__) || defined(ISC)
|
---|
120 | # include <sys/param.h>
|
---|
121 | # endif
|
---|
122 |
|
---|
123 | # ifdef ISC
|
---|
124 | # define TIOCMSET (TIOC|26) /* set all modem bits */
|
---|
125 | # define TIOCMBIS (TIOC|27) /* bis modem bits */
|
---|
126 | # define TIOCMBIC (TIOC|28) /* bic modem bits */
|
---|
127 | # define TIOCMGET (TIOC|29) /* get all modem bits */
|
---|
128 | # endif
|
---|
129 |
|
---|
130 | # include <errno.h>
|
---|
131 |
|
---|
132 | # if defined(_NEED_SYSI86)
|
---|
133 | # if !(defined (sun) && defined (SVR4))
|
---|
134 | # include <sys/immu.h>
|
---|
135 | # include <sys/region.h>
|
---|
136 | # endif
|
---|
137 | # include <sys/proc.h>
|
---|
138 | # include <sys/tss.h>
|
---|
139 | # include <sys/sysi86.h>
|
---|
140 | # if defined(SVR4) && !defined(sun)
|
---|
141 | # include <sys/seg.h>
|
---|
142 | # endif /* SVR4 && !sun */
|
---|
143 | /* V86SC_IOPL was moved to <sys/sysi86.h> on Solaris 7 and later */
|
---|
144 | # if defined(sun) && defined (SVR4) /* Solaris? */
|
---|
145 | # if defined(i386) || defined(__x86) /* on x86 or x64? */
|
---|
146 | # if !defined(V86SC_IOPL) /* Solaris 7 or later? */
|
---|
147 | # include <sys/v86.h> /* Nope */
|
---|
148 | # endif
|
---|
149 | # endif /* V86SC_IOPL */
|
---|
150 | # else
|
---|
151 | # include <sys/v86.h> /* Not solaris */
|
---|
152 | # endif /* sun && i386 && SVR4 */
|
---|
153 | # if defined(sun) && (defined (i386) || defined(__x86)) && defined (SVR4)
|
---|
154 | # include <sys/psw.h>
|
---|
155 | # endif
|
---|
156 | # endif /* _NEED_SYSI86 */
|
---|
157 |
|
---|
158 | # if defined(HAS_SVR3_MMAPDRV)
|
---|
159 | # include <sys/sysmacros.h>
|
---|
160 | # if !defined(_NEED_SYSI86)
|
---|
161 | # include <sys/immu.h>
|
---|
162 | # include <sys/region.h>
|
---|
163 | # endif
|
---|
164 | # include <sys/mmap.h> /* MMAP driver header */
|
---|
165 | # endif
|
---|
166 |
|
---|
167 | # if !defined(sun) || (!defined(sparc) && !defined(__SOL8__))
|
---|
168 | # define HAS_USL_VTS
|
---|
169 | # endif
|
---|
170 | # if !defined(sun)
|
---|
171 | # include <sys/emap.h>
|
---|
172 | # endif
|
---|
173 | # if defined(SCO325)
|
---|
174 | # include <sys/vtkd.h>
|
---|
175 | # include <sys/console.h>
|
---|
176 | # include <sys/scankbd.h>
|
---|
177 | # include <sys/vid.h>
|
---|
178 | # define LED_CAP CLKED
|
---|
179 | # define LED_NUM NLKED
|
---|
180 | # define LED_SCR SLKED
|
---|
181 | # elif defined(HAS_USL_VTS)
|
---|
182 | # include <sys/at_ansi.h>
|
---|
183 | # include <sys/kd.h>
|
---|
184 | # include <sys/vt.h>
|
---|
185 | # elif defined(sun)
|
---|
186 | # include <sys/fbio.h>
|
---|
187 | # include <sys/kbd.h>
|
---|
188 | # include <sys/kbio.h>
|
---|
189 |
|
---|
190 | /* undefine symbols from <sys/kbd.h> we don't need that conflict with enum
|
---|
191 | definitions in parser/xf86tokens.h */
|
---|
192 | # undef STRING
|
---|
193 | # undef LEFTALT
|
---|
194 | # undef RIGHTALT
|
---|
195 |
|
---|
196 | # define LED_CAP LED_CAPS_LOCK
|
---|
197 | # define LED_NUM LED_NUM_LOCK
|
---|
198 | # define LED_SCR LED_SCROLL_LOCK
|
---|
199 | # define LED_COMP LED_COMPOSE
|
---|
200 | # endif /* sun */
|
---|
201 |
|
---|
202 | # if !defined(VT_ACKACQ)
|
---|
203 | # define VT_ACKACQ 2
|
---|
204 | # endif /* !VT_ACKACQ */
|
---|
205 |
|
---|
206 | # if defined(__SCO__)
|
---|
207 | # include <sys/sysmacros.h>
|
---|
208 | # define POSIX_TTY
|
---|
209 | # endif /* __SCO__ */
|
---|
210 |
|
---|
211 | # if defined(SVR4) || defined(SCO325)
|
---|
212 | # include <sys/mman.h>
|
---|
213 | # if !(defined(sun) && defined (SVR4))
|
---|
214 | # define DEV_MEM "/dev/pmem"
|
---|
215 | # endif
|
---|
216 | # ifdef SCO325
|
---|
217 | # undef DEV_MEM
|
---|
218 | # define DEV_MEM "/dev/mem"
|
---|
219 | # endif
|
---|
220 | # define CLEARDTR_SUPPORT
|
---|
221 | # define POSIX_TTY
|
---|
222 | # endif /* SVR4 */
|
---|
223 |
|
---|
224 | # ifdef ISC
|
---|
225 | # include <termios.h>
|
---|
226 | # define POSIX_TTY
|
---|
227 | # endif
|
---|
228 |
|
---|
229 | # if defined(sun) && defined (i386) && defined (SVR4) && !defined(__SOL8__)
|
---|
230 | # define USE_VT_SYSREQ
|
---|
231 | # define VT_SYSREQ_DEFAULT TRUE
|
---|
232 | # endif
|
---|
233 |
|
---|
234 | # if defined(ATT) && !defined(i386)
|
---|
235 | # define i386 /* not defined in ANSI C mode */
|
---|
236 | # endif /* ATT && !i386 */
|
---|
237 |
|
---|
238 | # if (defined(ATT) || defined(SVR4)) && !defined(sun)
|
---|
239 | # ifndef __UNIXWARE__
|
---|
240 | # ifndef XQUEUE
|
---|
241 | # define XQUEUE
|
---|
242 | # endif
|
---|
243 | # endif
|
---|
244 | # include <sys/xque.h>
|
---|
245 | # endif /* ATT || SVR4 */
|
---|
246 |
|
---|
247 | # ifdef SYSV
|
---|
248 | # if !defined(ISC) || defined(ISC202) || defined(ISC22)
|
---|
249 | # define NEED_STRERROR
|
---|
250 | # endif
|
---|
251 | # endif
|
---|
252 |
|
---|
253 | #endif /* (SYSV || SVR4) && !DGUX */
|
---|
254 |
|
---|
255 |
|
---|
256 |
|
---|
257 | /**************************************************************************/
|
---|
258 | /* DG/ux R4.20MU03 Intel AViion Machines */
|
---|
259 | /**************************************************************************/
|
---|
260 | #if defined(DGUX) && defined(SVR4)
|
---|
261 | #include <sys/ioctl.h>
|
---|
262 | #include <signal.h>
|
---|
263 | #include <ctype.h>
|
---|
264 | #include <termios.h> /* Use termios for BSD Flavor ttys */
|
---|
265 | #include <sys/termios.h>
|
---|
266 | #include <sys/stat.h>
|
---|
267 | #include <sys/types.h>
|
---|
268 | #include <sys/param.h>
|
---|
269 | #include <errno.h>
|
---|
270 | #include <sys/sysi86.h>
|
---|
271 | #include <unistd.h>
|
---|
272 | #include <sys/proc.h>
|
---|
273 | #include <sys/map.h>
|
---|
274 | #include <sys/sysmacros.h>
|
---|
275 | #include <sys/mman.h> /* Memory handling */
|
---|
276 | #include <sys/kd.h> /* definitios for KDENABIO KDDISABIO needed for IOPL s */
|
---|
277 | #include <sys/kbd.h>
|
---|
278 | #include <fcntl.h>
|
---|
279 | #include <time.h>
|
---|
280 | #include <sys/stream.h>
|
---|
281 | #include <sys/ptms.h>
|
---|
282 |
|
---|
283 | #include <sys/socket.h>
|
---|
284 | #include <sys/utsname.h>
|
---|
285 | #include <sys/stropts.h>
|
---|
286 | #include <sys/sockio.h>
|
---|
287 |
|
---|
288 |
|
---|
289 | #define POSIX_TTY
|
---|
290 |
|
---|
291 | #undef HAS_USL_VTS
|
---|
292 | #undef USE_VT_SYSREQ
|
---|
293 | #undef VT_ACKACQ
|
---|
294 |
|
---|
295 | #define LED_CAP KBD_LED_CAPS_LOCK
|
---|
296 | #define LED_NUM KBD_LED_NUM_LOCK
|
---|
297 | #define LED_SCR KBD_LED_SCROLL_LOCK
|
---|
298 |
|
---|
299 | #define KDGKBTYPE KBD_GET_LANGUAGE
|
---|
300 |
|
---|
301 |
|
---|
302 | /* General keyboard types */
|
---|
303 | # define KB_84 2
|
---|
304 | # define KB_101 1 /* Because ioctl(dgkeybdFd,KBD_GET_LANGUAGE,&type) gives 1=US keyboard */
|
---|
305 | # define KB_OTHER 3
|
---|
306 |
|
---|
307 | #define KDSETLED KBD_SET_LED
|
---|
308 | #define KDGETLED KBD_GET_STATE
|
---|
309 | #undef KDMKTONE
|
---|
310 | #define KDMKTONE KBD_TONE_HIGH
|
---|
311 |
|
---|
312 |
|
---|
313 | #undef DEV_MEM
|
---|
314 | #define DEV_MEM "/dev/mem"
|
---|
315 | #define CLEARDTR_SUPPORT
|
---|
316 |
|
---|
317 | #undef VT_SYSREQ_DEFAULT
|
---|
318 | #define VT_SYSREQ_DEFAULT FALSE /* Make sure that we dont define any VTs since DG/ux has none */
|
---|
319 |
|
---|
320 | #endif /* DGUX && SVR4 */
|
---|
321 |
|
---|
322 | /**************************************************************************/
|
---|
323 | /* Linux or Glibc-based system */
|
---|
324 | /**************************************************************************/
|
---|
325 | #if defined(__linux__) || defined(__GLIBC__)
|
---|
326 | # include <sys/ioctl.h>
|
---|
327 | # include <signal.h>
|
---|
328 | # include <stdlib.h>
|
---|
329 | # include <sys/types.h>
|
---|
330 | # include <assert.h>
|
---|
331 |
|
---|
332 | #ifdef __GNU__ /* GNU/Hurd */
|
---|
333 | # define USE_OSMOUSE
|
---|
334 | #endif
|
---|
335 |
|
---|
336 | # ifdef __linux__
|
---|
337 | # include <termio.h>
|
---|
338 | # else /* __GLIBC__ */
|
---|
339 | # include <termios.h>
|
---|
340 | # endif
|
---|
341 | # ifdef __sparc__
|
---|
342 | # include <sys/param.h>
|
---|
343 | # endif
|
---|
344 |
|
---|
345 | # include <errno.h>
|
---|
346 |
|
---|
347 | # include <sys/stat.h>
|
---|
348 |
|
---|
349 | # include <sys/mman.h>
|
---|
350 | # ifdef __linux__
|
---|
351 | # define HAS_USL_VTS
|
---|
352 | # include <sys/kd.h>
|
---|
353 | # include <sys/vt.h>
|
---|
354 | # define LDGMAP GIO_SCRNMAP
|
---|
355 | # define LDSMAP PIO_SCRNMAP
|
---|
356 | # define LDNMAP LDSMAP
|
---|
357 | # define CLEARDTR_SUPPORT
|
---|
358 | # define USE_VT_SYSREQ
|
---|
359 | # endif
|
---|
360 |
|
---|
361 | # define POSIX_TTY
|
---|
362 |
|
---|
363 | #endif /* __linux__ || __GLIBC__ */
|
---|
364 |
|
---|
365 | /**************************************************************************/
|
---|
366 | /* LynxOS AT */
|
---|
367 | /**************************************************************************/
|
---|
368 | #if defined(Lynx)
|
---|
369 |
|
---|
370 | # include <termio.h>
|
---|
371 | # include <sys/ioctl.h>
|
---|
372 | # include <param.h>
|
---|
373 | # include <signal.h>
|
---|
374 | # include <kd.h>
|
---|
375 | # include <vt.h>
|
---|
376 | # include <sys/stat.h>
|
---|
377 |
|
---|
378 | # include <errno.h>
|
---|
379 | extern int errno;
|
---|
380 |
|
---|
381 | /* smem_create et.al. to access physical memory */
|
---|
382 | # include <smem.h>
|
---|
383 |
|
---|
384 | /* keyboard types */
|
---|
385 | # define KB_84 1
|
---|
386 | # define KB_101 2
|
---|
387 | # define KB_OTHER 3
|
---|
388 |
|
---|
389 | /* atc drivers ignores argument to VT_RELDISP ioctl */
|
---|
390 | # define VT_ACKACQ 2
|
---|
391 |
|
---|
392 | # include <termios.h>
|
---|
393 | # define POSIX_TTY
|
---|
394 | # define CLEARDTR_SUPPORT
|
---|
395 |
|
---|
396 | /* LynxOS 2.5.1 has these */
|
---|
397 | # ifdef LED_NUMLOCK
|
---|
398 | # define LED_CAP LED_CAPSLOCK
|
---|
399 | # define LED_NUM LED_NUMLOCK
|
---|
400 | # define LED_SCR LED_SCROLLOCK
|
---|
401 | # endif
|
---|
402 |
|
---|
403 | #endif /* Lynx */
|
---|
404 |
|
---|
405 | /**************************************************************************/
|
---|
406 | /* 386BSD and derivatives, BSD/386 */
|
---|
407 | /**************************************************************************/
|
---|
408 |
|
---|
409 | #if defined(__386BSD__) && (defined(__FreeBSD__) || defined(__NetBSD__))
|
---|
410 | # undef __386BSD__
|
---|
411 | #endif
|
---|
412 |
|
---|
413 | #ifdef CSRG_BASED
|
---|
414 | # include <sys/ioctl.h>
|
---|
415 | # include <signal.h>
|
---|
416 |
|
---|
417 | # include <termios.h>
|
---|
418 | # define termio termios
|
---|
419 | # define POSIX_TTY
|
---|
420 |
|
---|
421 | # include <errno.h>
|
---|
422 |
|
---|
423 | # include <sys/types.h>
|
---|
424 | # include <sys/mman.h>
|
---|
425 | # include <sys/stat.h>
|
---|
426 |
|
---|
427 | # if defined(__bsdi__)
|
---|
428 | # include <sys/param.h>
|
---|
429 | # if (_BSDI_VERSION < 199510)
|
---|
430 | # include <i386/isa/vgaioctl.h>
|
---|
431 | # endif
|
---|
432 | # endif /* __bsdi__ */
|
---|
433 |
|
---|
434 | #endif /* CSRG_BASED */
|
---|
435 |
|
---|
436 | /**************************************************************************/
|
---|
437 | /* Kernel of *BSD */
|
---|
438 | /**************************************************************************/
|
---|
439 | #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
|
---|
440 | defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__)
|
---|
441 |
|
---|
442 | # include <sys/param.h>
|
---|
443 | # if defined(__FreeBSD_version) && !defined(__FreeBSD_kernel_version)
|
---|
444 | # define __FreeBSD_kernel_version __FreeBSD_version
|
---|
445 | # endif
|
---|
446 |
|
---|
447 | # if !defined(LINKKIT)
|
---|
448 | /* Don't need this stuff for the Link Kit */
|
---|
449 | # if defined(__bsdi__)
|
---|
450 | # include <i386/isa/pcconsioctl.h>
|
---|
451 | # define CONSOLE_X_MODE_ON PCCONIOCRAW
|
---|
452 | # define CONSOLE_X_MODE_OFF PCCONIOCCOOK
|
---|
453 | # define CONSOLE_X_BELL PCCONIOCBEEP
|
---|
454 | # else /* __bsdi__ */
|
---|
455 | # if defined(__OpenBSD__)
|
---|
456 | # ifdef PCCONS_SUPPORT
|
---|
457 | # include <machine/pccons.h>
|
---|
458 | # undef CONSOLE_X_MODE_ON
|
---|
459 | # undef CONSOLE_X_MODE_OFF
|
---|
460 | # undef CONSOLE_X_BELL
|
---|
461 | # endif
|
---|
462 | # endif
|
---|
463 | # ifdef SYSCONS_SUPPORT
|
---|
464 | # define COMPAT_SYSCONS
|
---|
465 | # if defined(__NetBSD__) || defined(__OpenBSD__)
|
---|
466 | # include <machine/console.h>
|
---|
467 | # else
|
---|
468 | # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
---|
469 | # if defined(__DragonFly__) || (__FreeBSD_kernel_version >= 410000)
|
---|
470 | # include <sys/consio.h>
|
---|
471 | # include <sys/kbio.h>
|
---|
472 | # else
|
---|
473 | # include <machine/console.h>
|
---|
474 | # endif /* FreeBSD 4.1 RELEASE or lator */
|
---|
475 | # else
|
---|
476 | # include <sys/console.h>
|
---|
477 | # endif
|
---|
478 | # endif
|
---|
479 | # endif /* SYSCONS_SUPPORT */
|
---|
480 | # if defined(PCVT_SUPPORT)
|
---|
481 | # if !defined(SYSCONS_SUPPORT)
|
---|
482 | /* no syscons, so include pcvt specific header file */
|
---|
483 | # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
---|
484 | # include <machine/pcvt_ioctl.h>
|
---|
485 | # else
|
---|
486 | # if defined(__NetBSD__) || defined(__OpenBSD__)
|
---|
487 | # if !defined(WSCONS_SUPPORT)
|
---|
488 | # include <machine/pcvt_ioctl.h>
|
---|
489 | # endif /* WSCONS_SUPPORT */
|
---|
490 | # else
|
---|
491 | # include <sys/pcvt_ioctl.h>
|
---|
492 | # endif /* __NetBSD__ */
|
---|
493 | # endif /* __FreeBSD_kernel__ || __OpenBSD__ */
|
---|
494 | # else /* pcvt and syscons: hard-code the ID magic */
|
---|
495 | # define VGAPCVTID _IOWR('V',113, struct pcvtid)
|
---|
496 | struct pcvtid {
|
---|
497 | char name[16];
|
---|
498 | int rmajor, rminor;
|
---|
499 | };
|
---|
500 | # endif /* PCVT_SUPPORT && SYSCONS_SUPPORT */
|
---|
501 | # endif /* PCVT_SUPPORT */
|
---|
502 | # ifdef WSCONS_SUPPORT
|
---|
503 | # include <dev/wscons/wsconsio.h>
|
---|
504 | # include <dev/wscons/wsdisplay_usl_io.h>
|
---|
505 | # endif /* WSCONS_SUPPORT */
|
---|
506 | # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
---|
507 | # if defined(__FreeBSD_kernel_version) && (__FreeBSD_kernel_version >= 500013)
|
---|
508 | # include <sys/mouse.h>
|
---|
509 | # else
|
---|
510 | # undef MOUSE_GETINFO
|
---|
511 | # include <machine/mouse.h>
|
---|
512 | # endif
|
---|
513 | # endif
|
---|
514 | /* Include these definitions in case ioctl_pc.h didn't get included */
|
---|
515 | # ifndef CONSOLE_X_MODE_ON
|
---|
516 | # define CONSOLE_X_MODE_ON _IO('t',121)
|
---|
517 | # endif
|
---|
518 | # ifndef CONSOLE_X_MODE_OFF
|
---|
519 | # define CONSOLE_X_MODE_OFF _IO('t',122)
|
---|
520 | # endif
|
---|
521 | # ifndef CONSOLE_X_BELL
|
---|
522 | # define CONSOLE_X_BELL _IOW('t',123,int[2])
|
---|
523 | # endif
|
---|
524 | # ifndef CONSOLE_X_TV_ON
|
---|
525 | # define CONSOLE_X_TV_ON _IOW('t',155,int)
|
---|
526 | # define XMODE_RGB 0
|
---|
527 | # define XMODE_NTSC 1
|
---|
528 | # define XMODE_PAL 2
|
---|
529 | # define XMODE_SECAM 3
|
---|
530 | # endif
|
---|
531 | # ifndef CONSOLE_X_TV_OFF
|
---|
532 | # define CONSOLE_X_TV_OFF _IO('t',156)
|
---|
533 | # endif
|
---|
534 | #ifndef CONSOLE_GET_LINEAR_INFO
|
---|
535 | # define CONSOLE_GET_LINEAR_INFO _IOR('t',157,struct map_info)
|
---|
536 | #endif
|
---|
537 | #ifndef CONSOLE_GET_IO_INFO
|
---|
538 | # define CONSOLE_GET_IO_INFO _IOR('t',158,struct map_info)
|
---|
539 | #endif
|
---|
540 | #ifndef CONSOLE_GET_MEM_INFO
|
---|
541 | # define CONSOLE_GET_MEM_INFO _IOR('t',159,struct map_info)
|
---|
542 | #endif
|
---|
543 | # endif /* __bsdi__ */
|
---|
544 | # endif /* !LINKKIT */
|
---|
545 |
|
---|
546 | #if defined(USE_I386_IOPL) || defined(USE_AMD64_IOPL)
|
---|
547 | #include <machine/sysarch.h>
|
---|
548 | #endif
|
---|
549 |
|
---|
550 | # define CLEARDTR_SUPPORT
|
---|
551 |
|
---|
552 | # if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
|
---|
553 | # define USE_VT_SYSREQ
|
---|
554 | # endif
|
---|
555 |
|
---|
556 | #endif
|
---|
557 | /* __FreeBSD_kernel__ || __NetBSD__ || __OpenBSD__ || __bsdi__ */
|
---|
558 |
|
---|
559 | /**************************************************************************/
|
---|
560 | /* OS/2 */
|
---|
561 | /**************************************************************************/
|
---|
562 | /* currently OS/2 with a modified EMX/GCC compiler only */
|
---|
563 | #if defined(__UNIXOS2__)
|
---|
564 | # include <signal.h>
|
---|
565 | # include <errno.h>
|
---|
566 | # include <sys/stat.h>
|
---|
567 |
|
---|
568 | /* I would have liked to have this included here always, but
|
---|
569 | * it causes clashes for BYTE and BOOL with Xmd.h, which is too dangerous.
|
---|
570 | * So I'll include it in place where I know it does no harm.
|
---|
571 | */
|
---|
572 | #if defined(I_NEED_OS2_H)
|
---|
573 | # undef BOOL
|
---|
574 | # undef BYTE
|
---|
575 | # include <os2.h>
|
---|
576 | #endif
|
---|
577 |
|
---|
578 | /* keyboard types */
|
---|
579 | # define KB_84 1
|
---|
580 | # define KB_101 2
|
---|
581 | /* could detect more keyboards */
|
---|
582 | # define KB_OTHER 3
|
---|
583 |
|
---|
584 | /* LEDs */
|
---|
585 | # define LED_CAP 0x40
|
---|
586 | # define LED_NUM 0x20
|
---|
587 | # define LED_SCR 0x10
|
---|
588 |
|
---|
589 | /* mouse driver */
|
---|
590 | # define OSMOUSE_ONLY
|
---|
591 | # define MOUSE_PROTOCOL_IN_KERNEL
|
---|
592 |
|
---|
593 | extern char* __XOS2RedirRoot(char*);
|
---|
594 |
|
---|
595 | #endif
|
---|
596 |
|
---|
597 | /**************************************************************************/
|
---|
598 | /* QNX4 */
|
---|
599 | /**************************************************************************/
|
---|
600 | /* This is the QNX code for Watcom 10.6 and QNX 4.x */
|
---|
601 | #if defined(QNX4)
|
---|
602 | #include <signal.h>
|
---|
603 | #include <errno.h>
|
---|
604 | #include <sys/stat.h>
|
---|
605 | #include <termios.h>
|
---|
606 | #include <ioctl.h>
|
---|
607 | #include <sys/param.h>
|
---|
608 |
|
---|
609 | /* Warning: by default, the fd_set size is 32 in QNX! */
|
---|
610 | #define FD_SETSIZE 256
|
---|
611 | #include <sys/select.h>
|
---|
612 |
|
---|
613 | /* keyboard types */
|
---|
614 | # define KB_84 1
|
---|
615 | # define KB_101 2
|
---|
616 | # define KB_OTHER 3
|
---|
617 |
|
---|
618 | /* LEDs */
|
---|
619 | # define LED_CAP 0x04
|
---|
620 | # define LED_NUM 0x02
|
---|
621 | # define LED_SCR 0x01
|
---|
622 |
|
---|
623 | # define POSIX_TTY
|
---|
624 | # define OSMOUSE_ONLY
|
---|
625 | # define MOUSE_PROTOCOL_IN_KERNEL
|
---|
626 |
|
---|
627 | #define TIOCM_DTR 0x0001 /* data terminal ready */
|
---|
628 | #define TIOCM_RTS 0x0002 /* request to send */
|
---|
629 | #define TIOCM_CTS 0x1000 /* clear to send */
|
---|
630 | #define TIOCM_DSR 0x2000 /* data set ready */
|
---|
631 | #define TIOCM_RI 0x4000 /* ring */
|
---|
632 | #define TIOCM_RNG TIOCM_RI
|
---|
633 | #define TIOCM_CD 0x8000 /* carrier detect */
|
---|
634 | #define TIOCM_CAR TIOCM_CD
|
---|
635 | #define TIOCM_LE 0x0100 /* line enable */
|
---|
636 | #define TIOCM_ST 0x0200 /* secondary transmit */
|
---|
637 | #define TIOCM_SR 0x0400 /* secondary receive */
|
---|
638 |
|
---|
639 | #endif
|
---|
640 |
|
---|
641 | /**************************************************************************/
|
---|
642 | /* QNX/Neutrino */
|
---|
643 | /**************************************************************************/
|
---|
644 | /* This is the Neutrino code for for NTO2.0 and GCC */
|
---|
645 | #if defined(__QNXNTO__)
|
---|
646 | #include <signal.h>
|
---|
647 | #include <errno.h>
|
---|
648 | #include <sys/stat.h>
|
---|
649 | #include <termios.h>
|
---|
650 | #include <ioctl.h>
|
---|
651 | #include <sys/param.h>
|
---|
652 |
|
---|
653 | /* Warning: by default, the fd_set size is 32 in NTO! */
|
---|
654 | #define FD_SETSIZE 256
|
---|
655 | #include <sys/select.h>
|
---|
656 |
|
---|
657 | /* keyboard types */
|
---|
658 | # define KB_84 1
|
---|
659 | # define KB_101 2
|
---|
660 | # define KB_OTHER 3
|
---|
661 |
|
---|
662 | # define POSIX_TTY
|
---|
663 |
|
---|
664 | #endif
|
---|
665 |
|
---|
666 | /**************************************************************************/
|
---|
667 | /* IRIX */
|
---|
668 | /**************************************************************************/
|
---|
669 | #if defined(sgi)
|
---|
670 |
|
---|
671 | #include <errno.h>
|
---|
672 | #include <sys/types.h>
|
---|
673 | #include <sys/stat.h>
|
---|
674 |
|
---|
675 | #endif
|
---|
676 |
|
---|
677 | /**************************************************************************/
|
---|
678 | /* Generic */
|
---|
679 | /**************************************************************************/
|
---|
680 |
|
---|
681 | #include <sys/wait.h> /* May need to adjust this for other OSs */
|
---|
682 |
|
---|
683 | /*
|
---|
684 | * Hack originally for ISC 2.2 POSIX headers, but may apply elsewhere,
|
---|
685 | * and it's safe, so just do it.
|
---|
686 | */
|
---|
687 | #if !defined(O_NDELAY) && defined(O_NONBLOCK)
|
---|
688 | # define O_NDELAY O_NONBLOCK
|
---|
689 | #endif /* !O_NDELAY && O_NONBLOCK */
|
---|
690 |
|
---|
691 | #if !defined(MAXHOSTNAMELEN)
|
---|
692 | # define MAXHOSTNAMELEN 32
|
---|
693 | #endif /* !MAXHOSTNAMELEN */
|
---|
694 |
|
---|
695 | #if !defined(X_NOT_POSIX)
|
---|
696 | # if defined(_POSIX_SOURCE)
|
---|
697 | # include <limits.h>
|
---|
698 | # else
|
---|
699 | # define _POSIX_SOURCE
|
---|
700 | # include <limits.h>
|
---|
701 | # undef _POSIX_SOURCE
|
---|
702 | # endif /* _POSIX_SOURCE */
|
---|
703 | #endif /* !X_NOT_POSIX */
|
---|
704 | #if !defined(PATH_MAX)
|
---|
705 | # if defined(MAXPATHLEN)
|
---|
706 | # define PATH_MAX MAXPATHLEN
|
---|
707 | # else
|
---|
708 | # define PATH_MAX 1024
|
---|
709 | # endif /* MAXPATHLEN */
|
---|
710 | #endif /* !PATH_MAX */
|
---|
711 |
|
---|
712 | #ifdef NEED_STRERROR
|
---|
713 | # ifndef strerror
|
---|
714 | extern char *sys_errlist[];
|
---|
715 | extern int sys_nerr;
|
---|
716 | # define strerror(n) \
|
---|
717 | ((n) >= 0 && (n) < sys_nerr) ? sys_errlist[n] : "unknown error"
|
---|
718 | # endif /* !strerror */
|
---|
719 | #endif /* NEED_STRERROR */
|
---|
720 |
|
---|
721 | #if defined(ISC) || defined(Lynx)
|
---|
722 | #define rint(x) RInt(x)
|
---|
723 | double RInt(
|
---|
724 | double x
|
---|
725 | );
|
---|
726 | #endif
|
---|
727 |
|
---|
728 | #ifndef DEV_MEM
|
---|
729 | #define DEV_MEM "/dev/mem"
|
---|
730 | #endif
|
---|
731 |
|
---|
732 | #ifndef VT_SYSREQ_DEFAULT
|
---|
733 | #define VT_SYSREQ_DEFAULT FALSE
|
---|
734 | #endif
|
---|
735 |
|
---|
736 | #ifdef OSMOUSE_ONLY
|
---|
737 | # ifndef MOUSE_PROTOCOL_IN_KERNEL
|
---|
738 | # define MOUSE_PROTOCOL_IN_KERNEL
|
---|
739 | # endif
|
---|
740 | #endif
|
---|
741 |
|
---|
742 | #define SYSCALL(call) while(((call) == -1) && (errno == EINTR))
|
---|
743 |
|
---|
744 | #define XF86_OS_PRIVS
|
---|
745 | #include "xf86_OSproc.h"
|
---|
746 |
|
---|
747 | #ifndef NO_COMPILER_H
|
---|
748 | #include "compiler.h"
|
---|
749 | #endif
|
---|
750 |
|
---|
751 | #endif /* _XF86_OSLIB_H */
|
---|