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