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: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h,v 1.7 2005/05/21 07:46:37 alanc 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(PowerMAX_OS)
|
---|
135 | # define HAS_USL_VTS
|
---|
136 | # include <sys/immu.h>
|
---|
137 | # include <sys/sysmacros.h>
|
---|
138 | # elif defined(_NEED_SYSI86)
|
---|
139 | # include <sys/immu.h>
|
---|
140 | # if !(defined (sun) && defined (SVR4))
|
---|
141 | # include <sys/region.h>
|
---|
142 | # endif
|
---|
143 | # include <sys/proc.h>
|
---|
144 | # include <sys/tss.h>
|
---|
145 | # include <sys/sysi86.h>
|
---|
146 | # if defined(SVR4) && !defined(sun)
|
---|
147 | # include <sys/seg.h>
|
---|
148 | # endif /* SVR4 && !sun */
|
---|
149 | /* V86SC_IOPL was moved to <sys/sysi86.h> on Solaris 7 and later */
|
---|
150 | # if defined(sun) && defined (SVR4) /* Solaris? */
|
---|
151 | # if defined(i386) || defined(__x86) /* on x86 or x64? */
|
---|
152 | # if !defined(V86SC_IOPL) /* Solaris 7 or later? */
|
---|
153 | # include <sys/v86.h> /* Nope */
|
---|
154 | # endif
|
---|
155 | # endif /* V86SC_IOPL */
|
---|
156 | # else
|
---|
157 | # include <sys/v86.h> /* Not solaris */
|
---|
158 | # endif /* sun && i386 && SVR4 */
|
---|
159 | # if defined(sun) && (defined (i386) || defined(__x86)) && defined (SVR4)
|
---|
160 | # include <sys/psw.h>
|
---|
161 | # endif
|
---|
162 | # endif /* _NEED_SYSI86 */
|
---|
163 |
|
---|
164 | # if defined(HAS_SVR3_MMAPDRV)
|
---|
165 | # include <sys/sysmacros.h>
|
---|
166 | # if !defined(_NEED_SYSI86)
|
---|
167 | # include <sys/immu.h>
|
---|
168 | # include <sys/region.h>
|
---|
169 | # endif
|
---|
170 | # include <sys/mmap.h> /* MMAP driver header */
|
---|
171 | # endif
|
---|
172 |
|
---|
173 | # if !defined(sun) || (!defined(sparc) && !defined(__SOL8__))
|
---|
174 | # define HAS_USL_VTS
|
---|
175 | # endif
|
---|
176 | # if !defined(sun)
|
---|
177 | # include <sys/emap.h>
|
---|
178 | # endif
|
---|
179 | # if defined(SCO325)
|
---|
180 | # include <sys/vtkd.h>
|
---|
181 | # include <sys/console.h>
|
---|
182 | # include <sys/scankbd.h>
|
---|
183 | # include <sys/vid.h>
|
---|
184 | # define LED_CAP CLKED
|
---|
185 | # define LED_NUM NLKED
|
---|
186 | # define LED_SCR SLKED
|
---|
187 | # elif defined(HAS_USL_VTS)
|
---|
188 | # include <sys/at_ansi.h>
|
---|
189 | # include <sys/kd.h>
|
---|
190 | # include <sys/vt.h>
|
---|
191 | # elif defined(sun)
|
---|
192 | # include <sys/fbio.h>
|
---|
193 | # include <sys/kbd.h>
|
---|
194 | # include <sys/kbio.h>
|
---|
195 |
|
---|
196 | /* undefine symbols from <sys/kbd.h> we don't need that conflict with enum
|
---|
197 | definitions in parser/xf86tokens.h */
|
---|
198 | # undef STRING
|
---|
199 | # undef LEFTALT
|
---|
200 | # undef RIGHTALT
|
---|
201 |
|
---|
202 | # define LED_CAP LED_CAPS_LOCK
|
---|
203 | # define LED_NUM LED_NUM_LOCK
|
---|
204 | # define LED_SCR LED_SCROLL_LOCK
|
---|
205 | # define LED_COMP LED_COMPOSE
|
---|
206 | # endif /* sun */
|
---|
207 |
|
---|
208 | # if !defined(VT_ACKACQ)
|
---|
209 | # define VT_ACKACQ 2
|
---|
210 | # endif /* !VT_ACKACQ */
|
---|
211 |
|
---|
212 | # if defined(__SCO__)
|
---|
213 | # include <sys/sysmacros.h>
|
---|
214 | # define POSIX_TTY
|
---|
215 | # endif /* __SCO__ */
|
---|
216 |
|
---|
217 | # if defined(SVR4) || defined(SCO325)
|
---|
218 | # include <sys/mman.h>
|
---|
219 | # if !(defined(sun) && defined (SVR4))
|
---|
220 | # define DEV_MEM "/dev/pmem"
|
---|
221 | # elif defined(PowerMAX_OS)
|
---|
222 | # define DEV_MEM "/dev/iomem"
|
---|
223 | # endif
|
---|
224 | # ifdef SCO325
|
---|
225 | # undef DEV_MEM
|
---|
226 | # define DEV_MEM "/dev/mem"
|
---|
227 | # endif
|
---|
228 | # define CLEARDTR_SUPPORT
|
---|
229 | # define POSIX_TTY
|
---|
230 | # endif /* SVR4 */
|
---|
231 |
|
---|
232 | # ifdef ISC
|
---|
233 | # include <termios.h>
|
---|
234 | # define POSIX_TTY
|
---|
235 | # endif
|
---|
236 |
|
---|
237 | # if defined(sun) && defined (i386) && defined (SVR4) && !defined(__SOL8__)
|
---|
238 | # define USE_VT_SYSREQ
|
---|
239 | # define VT_SYSREQ_DEFAULT TRUE
|
---|
240 | # endif
|
---|
241 |
|
---|
242 | # if defined(ATT) && !defined(i386)
|
---|
243 | # define i386 /* not defined in ANSI C mode */
|
---|
244 | # endif /* ATT && !i386 */
|
---|
245 |
|
---|
246 | # if (defined(ATT) || defined(SVR4)) && !defined(sun)
|
---|
247 | # ifndef __UNIXWARE__
|
---|
248 | # ifndef XQUEUE
|
---|
249 | # define XQUEUE
|
---|
250 | # endif
|
---|
251 | # endif
|
---|
252 | # include <sys/xque.h>
|
---|
253 | # endif /* ATT || SVR4 */
|
---|
254 |
|
---|
255 | # ifdef SYSV
|
---|
256 | # if !defined(ISC) || defined(ISC202) || defined(ISC22)
|
---|
257 | # define NEED_STRERROR
|
---|
258 | # endif
|
---|
259 | # endif
|
---|
260 |
|
---|
261 | #endif /* (SYSV || SVR4) && !DGUX */
|
---|
262 |
|
---|
263 |
|
---|
264 |
|
---|
265 | /**************************************************************************/
|
---|
266 | /* DG/ux R4.20MU03 Intel AViion Machines */
|
---|
267 | /**************************************************************************/
|
---|
268 | #if defined(DGUX) && defined(SVR4)
|
---|
269 | #include <sys/ioctl.h>
|
---|
270 | #include <signal.h>
|
---|
271 | #include <ctype.h>
|
---|
272 | #include <termios.h> /* Use termios for BSD Flavor ttys */
|
---|
273 | #include <sys/termios.h>
|
---|
274 | #include <sys/stat.h>
|
---|
275 | #include <sys/types.h>
|
---|
276 | #include <sys/param.h>
|
---|
277 | #include <errno.h>
|
---|
278 | #include <sys/sysi86.h>
|
---|
279 | #include <unistd.h>
|
---|
280 | #include <sys/proc.h>
|
---|
281 | #include <sys/map.h>
|
---|
282 | #include <sys/sysmacros.h>
|
---|
283 | #include <sys/mman.h> /* Memory handling */
|
---|
284 | #include <sys/kd.h> /* definitios for KDENABIO KDDISABIO needed for IOPL s */
|
---|
285 | #include <sys/kbd.h>
|
---|
286 | #include <fcntl.h>
|
---|
287 | #include <time.h>
|
---|
288 | #include <sys/stream.h>
|
---|
289 | #include <sys/ptms.h>
|
---|
290 |
|
---|
291 | #include <sys/socket.h>
|
---|
292 | #include <sys/utsname.h>
|
---|
293 | #include <sys/stropts.h>
|
---|
294 | #include <sys/sockio.h>
|
---|
295 |
|
---|
296 |
|
---|
297 | #define POSIX_TTY
|
---|
298 |
|
---|
299 | #undef HAS_USL_VTS
|
---|
300 | #undef USE_VT_SYSREQ
|
---|
301 | #undef VT_ACKACQ
|
---|
302 |
|
---|
303 | #define LED_CAP KBD_LED_CAPS_LOCK
|
---|
304 | #define LED_NUM KBD_LED_NUM_LOCK
|
---|
305 | #define LED_SCR KBD_LED_SCROLL_LOCK
|
---|
306 |
|
---|
307 | #define KDGKBTYPE KBD_GET_LANGUAGE
|
---|
308 |
|
---|
309 |
|
---|
310 | /* General keyboard types */
|
---|
311 | # define KB_84 2
|
---|
312 | # define KB_101 1 /* Because ioctl(dgkeybdFd,KBD_GET_LANGUAGE,&type) gives 1=US keyboard */
|
---|
313 | # define KB_OTHER 3
|
---|
314 |
|
---|
315 | #define KDSETLED KBD_SET_LED
|
---|
316 | #define KDGETLED KBD_GET_STATE
|
---|
317 | #undef KDMKTONE
|
---|
318 | #define KDMKTONE KBD_TONE_HIGH
|
---|
319 |
|
---|
320 |
|
---|
321 | #undef DEV_MEM
|
---|
322 | #define DEV_MEM "/dev/mem"
|
---|
323 | #define CLEARDTR_SUPPORT
|
---|
324 |
|
---|
325 | #undef VT_SYSREQ_DEFAULT
|
---|
326 | #define VT_SYSREQ_DEFAULT FALSE /* Make sure that we dont define any VTs since DG/ux has none */
|
---|
327 |
|
---|
328 | #endif /* DGUX && SVR4 */
|
---|
329 |
|
---|
330 | /**************************************************************************/
|
---|
331 | /* Linux or Glibc-based system */
|
---|
332 | /**************************************************************************/
|
---|
333 | #if defined(__linux__) || defined(__GLIBC__)
|
---|
334 | # include <sys/ioctl.h>
|
---|
335 | # include <signal.h>
|
---|
336 | # include <stdlib.h>
|
---|
337 | # include <sys/types.h>
|
---|
338 | # include <assert.h>
|
---|
339 |
|
---|
340 | #ifdef __GNU__ /* GNU/Hurd */
|
---|
341 | # define USE_OSMOUSE
|
---|
342 | #endif
|
---|
343 |
|
---|
344 | # ifdef __linux__
|
---|
345 | # include <termio.h>
|
---|
346 | # else /* __GLIBC__ */
|
---|
347 | # include <termios.h>
|
---|
348 | # endif
|
---|
349 | # ifdef __sparc__
|
---|
350 | # include <sys/param.h>
|
---|
351 | # endif
|
---|
352 |
|
---|
353 | # include <errno.h>
|
---|
354 |
|
---|
355 | # include <sys/stat.h>
|
---|
356 |
|
---|
357 | # include <sys/mman.h>
|
---|
358 | # ifdef __linux__
|
---|
359 | # define HAS_USL_VTS
|
---|
360 | # include <sys/kd.h>
|
---|
361 | # include <sys/vt.h>
|
---|
362 | # define LDGMAP GIO_SCRNMAP
|
---|
363 | # define LDSMAP PIO_SCRNMAP
|
---|
364 | # define LDNMAP LDSMAP
|
---|
365 | # define CLEARDTR_SUPPORT
|
---|
366 | # define USE_VT_SYSREQ
|
---|
367 | # endif
|
---|
368 |
|
---|
369 | # define POSIX_TTY
|
---|
370 |
|
---|
371 | #endif /* __linux__ || __GLIBC__ */
|
---|
372 |
|
---|
373 | /**************************************************************************/
|
---|
374 | /* LynxOS AT */
|
---|
375 | /**************************************************************************/
|
---|
376 | #if defined(Lynx)
|
---|
377 |
|
---|
378 | # include <termio.h>
|
---|
379 | # include <sys/ioctl.h>
|
---|
380 | # include <param.h>
|
---|
381 | # include <signal.h>
|
---|
382 | # include <kd.h>
|
---|
383 | # include <vt.h>
|
---|
384 | # include <sys/stat.h>
|
---|
385 |
|
---|
386 | # include <errno.h>
|
---|
387 | extern int errno;
|
---|
388 |
|
---|
389 | /* smem_create et.al. to access physical memory */
|
---|
390 | # include <smem.h>
|
---|
391 |
|
---|
392 | /* keyboard types */
|
---|
393 | # define KB_84 1
|
---|
394 | # define KB_101 2
|
---|
395 | # define KB_OTHER 3
|
---|
396 |
|
---|
397 | /* atc drivers ignores argument to VT_RELDISP ioctl */
|
---|
398 | # define VT_ACKACQ 2
|
---|
399 |
|
---|
400 | # include <termios.h>
|
---|
401 | # define POSIX_TTY
|
---|
402 | # define CLEARDTR_SUPPORT
|
---|
403 |
|
---|
404 | /* LynxOS 2.5.1 has these */
|
---|
405 | # ifdef LED_NUMLOCK
|
---|
406 | # define LED_CAP LED_CAPSLOCK
|
---|
407 | # define LED_NUM LED_NUMLOCK
|
---|
408 | # define LED_SCR LED_SCROLLOCK
|
---|
409 | # endif
|
---|
410 |
|
---|
411 | #endif /* Lynx */
|
---|
412 |
|
---|
413 | /**************************************************************************/
|
---|
414 | /* 386BSD and derivatives, BSD/386 */
|
---|
415 | /**************************************************************************/
|
---|
416 |
|
---|
417 | #if defined(__386BSD__) && (defined(__FreeBSD__) || defined(__NetBSD__))
|
---|
418 | # undef __386BSD__
|
---|
419 | #endif
|
---|
420 |
|
---|
421 | #ifdef CSRG_BASED
|
---|
422 | # include <sys/ioctl.h>
|
---|
423 | # include <signal.h>
|
---|
424 |
|
---|
425 | # include <termios.h>
|
---|
426 | # define termio termios
|
---|
427 | # define POSIX_TTY
|
---|
428 |
|
---|
429 | # include <errno.h>
|
---|
430 |
|
---|
431 | # include <sys/types.h>
|
---|
432 | # include <sys/mman.h>
|
---|
433 | # include <sys/stat.h>
|
---|
434 |
|
---|
435 | # if defined(__bsdi__)
|
---|
436 | # include <sys/param.h>
|
---|
437 | # if (_BSDI_VERSION < 199510)
|
---|
438 | # include <i386/isa/vgaioctl.h>
|
---|
439 | # endif
|
---|
440 | # endif /* __bsdi__ */
|
---|
441 |
|
---|
442 | #endif /* CSRG_BASED */
|
---|
443 |
|
---|
444 | /**************************************************************************/
|
---|
445 | /* Kernel of *BSD */
|
---|
446 | /**************************************************************************/
|
---|
447 | #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
|
---|
448 | defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__)
|
---|
449 |
|
---|
450 | # include <sys/param.h>
|
---|
451 | # if defined(__FreeBSD_version) && !defined(__FreeBSD_kernel_version)
|
---|
452 | # define __FreeBSD_kernel_version __FreeBSD_version
|
---|
453 | # endif
|
---|
454 |
|
---|
455 | # if !defined(LINKKIT)
|
---|
456 | /* Don't need this stuff for the Link Kit */
|
---|
457 | # if defined(__bsdi__)
|
---|
458 | # include <i386/isa/pcconsioctl.h>
|
---|
459 | # define CONSOLE_X_MODE_ON PCCONIOCRAW
|
---|
460 | # define CONSOLE_X_MODE_OFF PCCONIOCCOOK
|
---|
461 | # define CONSOLE_X_BELL PCCONIOCBEEP
|
---|
462 | # else /* __bsdi__ */
|
---|
463 | # if defined(__OpenBSD__)
|
---|
464 | # ifdef PCCONS_SUPPORT
|
---|
465 | # include <machine/pccons.h>
|
---|
466 | # undef CONSOLE_X_MODE_ON
|
---|
467 | # undef CONSOLE_X_MODE_OFF
|
---|
468 | # undef CONSOLE_X_BELL
|
---|
469 | # endif
|
---|
470 | # endif
|
---|
471 | # ifdef SYSCONS_SUPPORT
|
---|
472 | # define COMPAT_SYSCONS
|
---|
473 | # if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
|
---|
474 | # include <machine/console.h>
|
---|
475 | # else
|
---|
476 | # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
---|
477 | # if (__FreeBSD_kernel_version >= 410000)
|
---|
478 | # include <sys/consio.h>
|
---|
479 | # include <sys/kbio.h>
|
---|
480 | # else
|
---|
481 | # include <machine/console.h>
|
---|
482 | # endif /* FreeBSD 4.1 RELEASE or lator */
|
---|
483 | # else
|
---|
484 | # include <sys/console.h>
|
---|
485 | # endif
|
---|
486 | # endif
|
---|
487 | # endif /* SYSCONS_SUPPORT */
|
---|
488 | # if defined(PCVT_SUPPORT)
|
---|
489 | # if !defined(SYSCONS_SUPPORT)
|
---|
490 | /* no syscons, so include pcvt specific header file */
|
---|
491 | # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
---|
492 | # include <machine/pcvt_ioctl.h>
|
---|
493 | # else
|
---|
494 | # if defined(__NetBSD__) || defined(__OpenBSD__)
|
---|
495 | # if !defined(WSCONS_SUPPORT)
|
---|
496 | # include <machine/pcvt_ioctl.h>
|
---|
497 | # endif /* WSCONS_SUPPORT */
|
---|
498 | # else
|
---|
499 | # include <sys/pcvt_ioctl.h>
|
---|
500 | # endif /* __NetBSD__ */
|
---|
501 | # endif /* __FreeBSD_kernel__ || __OpenBSD__ */
|
---|
502 | # else /* pcvt and syscons: hard-code the ID magic */
|
---|
503 | # define VGAPCVTID _IOWR('V',113, struct pcvtid)
|
---|
504 | struct pcvtid {
|
---|
505 | char name[16];
|
---|
506 | int rmajor, rminor;
|
---|
507 | };
|
---|
508 | # endif /* PCVT_SUPPORT && SYSCONS_SUPPORT */
|
---|
509 | # endif /* PCVT_SUPPORT */
|
---|
510 | # ifdef WSCONS_SUPPORT
|
---|
511 | # include <dev/wscons/wsconsio.h>
|
---|
512 | # include <dev/wscons/wsdisplay_usl_io.h>
|
---|
513 | # endif /* WSCONS_SUPPORT */
|
---|
514 | # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
---|
515 | # if (__FreeBSD_kernel_version >= 500013)
|
---|
516 | # include <sys/mouse.h>
|
---|
517 | # else
|
---|
518 | # undef MOUSE_GETINFO
|
---|
519 | # include <machine/mouse.h>
|
---|
520 | # endif
|
---|
521 | # endif
|
---|
522 | /* Include these definitions in case ioctl_pc.h didn't get included */
|
---|
523 | # ifndef CONSOLE_X_MODE_ON
|
---|
524 | # define CONSOLE_X_MODE_ON _IO('t',121)
|
---|
525 | # endif
|
---|
526 | # ifndef CONSOLE_X_MODE_OFF
|
---|
527 | # define CONSOLE_X_MODE_OFF _IO('t',122)
|
---|
528 | # endif
|
---|
529 | # ifndef CONSOLE_X_BELL
|
---|
530 | # define CONSOLE_X_BELL _IOW('t',123,int[2])
|
---|
531 | # endif
|
---|
532 | # ifndef CONSOLE_X_TV_ON
|
---|
533 | # define CONSOLE_X_TV_ON _IOW('t',155,int)
|
---|
534 | # define XMODE_RGB 0
|
---|
535 | # define XMODE_NTSC 1
|
---|
536 | # define XMODE_PAL 2
|
---|
537 | # define XMODE_SECAM 3
|
---|
538 | # endif
|
---|
539 | # ifndef CONSOLE_X_TV_OFF
|
---|
540 | # define CONSOLE_X_TV_OFF _IO('t',156)
|
---|
541 | # endif
|
---|
542 | #ifndef CONSOLE_GET_LINEAR_INFO
|
---|
543 | # define CONSOLE_GET_LINEAR_INFO _IOR('t',157,struct map_info)
|
---|
544 | #endif
|
---|
545 | #ifndef CONSOLE_GET_IO_INFO
|
---|
546 | # define CONSOLE_GET_IO_INFO _IOR('t',158,struct map_info)
|
---|
547 | #endif
|
---|
548 | #ifndef CONSOLE_GET_MEM_INFO
|
---|
549 | # define CONSOLE_GET_MEM_INFO _IOR('t',159,struct map_info)
|
---|
550 | #endif
|
---|
551 | # endif /* __bsdi__ */
|
---|
552 | # endif /* !LINKKIT */
|
---|
553 |
|
---|
554 | #if defined(USE_I386_IOPL) || defined(USE_AMD64_IOPL)
|
---|
555 | #include <machine/sysarch.h>
|
---|
556 | #endif
|
---|
557 |
|
---|
558 | # define CLEARDTR_SUPPORT
|
---|
559 |
|
---|
560 | # if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) || defined(WSCONS_SUPPORT)
|
---|
561 | # define USE_VT_SYSREQ
|
---|
562 | # endif
|
---|
563 |
|
---|
564 | #endif
|
---|
565 | /* __FreeBSD_kernel__ || __NetBSD__ || __OpenBSD__ || __bsdi__ */
|
---|
566 |
|
---|
567 | /**************************************************************************/
|
---|
568 | /* OS/2 */
|
---|
569 | /**************************************************************************/
|
---|
570 | /* currently OS/2 with a modified EMX/GCC compiler only */
|
---|
571 | #if defined(__UNIXOS2__)
|
---|
572 | # include <signal.h>
|
---|
573 | # include <errno.h>
|
---|
574 | # include <sys/stat.h>
|
---|
575 |
|
---|
576 | /* I would have liked to have this included here always, but
|
---|
577 | * it causes clashes for BYTE and BOOL with Xmd.h, which is too dangerous.
|
---|
578 | * So I'll include it in place where I know it does no harm.
|
---|
579 | */
|
---|
580 | #if defined(I_NEED_OS2_H)
|
---|
581 | # undef BOOL
|
---|
582 | # undef BYTE
|
---|
583 | # include <os2.h>
|
---|
584 | #endif
|
---|
585 |
|
---|
586 | /* keyboard types */
|
---|
587 | # define KB_84 1
|
---|
588 | # define KB_101 2
|
---|
589 | /* could detect more keyboards */
|
---|
590 | # define KB_OTHER 3
|
---|
591 |
|
---|
592 | /* LEDs */
|
---|
593 | # define LED_CAP 0x40
|
---|
594 | # define LED_NUM 0x20
|
---|
595 | # define LED_SCR 0x10
|
---|
596 |
|
---|
597 | /* mouse driver */
|
---|
598 | # define OSMOUSE_ONLY
|
---|
599 | # define MOUSE_PROTOCOL_IN_KERNEL
|
---|
600 |
|
---|
601 | extern char* __XOS2RedirRoot(char*);
|
---|
602 |
|
---|
603 | #endif
|
---|
604 |
|
---|
605 | /**************************************************************************/
|
---|
606 | /* QNX4 */
|
---|
607 | /**************************************************************************/
|
---|
608 | /* This is the QNX code for Watcom 10.6 and QNX 4.x */
|
---|
609 | #if defined(QNX4)
|
---|
610 | #include <signal.h>
|
---|
611 | #include <errno.h>
|
---|
612 | #include <sys/stat.h>
|
---|
613 | #include <termios.h>
|
---|
614 | #include <ioctl.h>
|
---|
615 | #include <sys/param.h>
|
---|
616 |
|
---|
617 | /* Warning: by default, the fd_set size is 32 in QNX! */
|
---|
618 | #define FD_SETSIZE 256
|
---|
619 | #include <sys/select.h>
|
---|
620 |
|
---|
621 | /* keyboard types */
|
---|
622 | # define KB_84 1
|
---|
623 | # define KB_101 2
|
---|
624 | # define KB_OTHER 3
|
---|
625 |
|
---|
626 | /* LEDs */
|
---|
627 | # define LED_CAP 0x04
|
---|
628 | # define LED_NUM 0x02
|
---|
629 | # define LED_SCR 0x01
|
---|
630 |
|
---|
631 | # define POSIX_TTY
|
---|
632 | # define OSMOUSE_ONLY
|
---|
633 | # define MOUSE_PROTOCOL_IN_KERNEL
|
---|
634 |
|
---|
635 | #define TIOCM_DTR 0x0001 /* data terminal ready */
|
---|
636 | #define TIOCM_RTS 0x0002 /* request to send */
|
---|
637 | #define TIOCM_CTS 0x1000 /* clear to send */
|
---|
638 | #define TIOCM_DSR 0x2000 /* data set ready */
|
---|
639 | #define TIOCM_RI 0x4000 /* ring */
|
---|
640 | #define TIOCM_RNG TIOCM_RI
|
---|
641 | #define TIOCM_CD 0x8000 /* carrier detect */
|
---|
642 | #define TIOCM_CAR TIOCM_CD
|
---|
643 | #define TIOCM_LE 0x0100 /* line enable */
|
---|
644 | #define TIOCM_ST 0x0200 /* secondary transmit */
|
---|
645 | #define TIOCM_SR 0x0400 /* secondary receive */
|
---|
646 |
|
---|
647 | #endif
|
---|
648 |
|
---|
649 | /**************************************************************************/
|
---|
650 | /* QNX/Neutrino */
|
---|
651 | /**************************************************************************/
|
---|
652 | /* This is the Neutrino code for for NTO2.0 and GCC */
|
---|
653 | #if defined(__QNXNTO__)
|
---|
654 | #include <signal.h>
|
---|
655 | #include <errno.h>
|
---|
656 | #include <sys/stat.h>
|
---|
657 | #include <termios.h>
|
---|
658 | #include <ioctl.h>
|
---|
659 | #include <sys/param.h>
|
---|
660 |
|
---|
661 | /* Warning: by default, the fd_set size is 32 in NTO! */
|
---|
662 | #define FD_SETSIZE 256
|
---|
663 | #include <sys/select.h>
|
---|
664 |
|
---|
665 | /* keyboard types */
|
---|
666 | # define KB_84 1
|
---|
667 | # define KB_101 2
|
---|
668 | # define KB_OTHER 3
|
---|
669 |
|
---|
670 | # define POSIX_TTY
|
---|
671 |
|
---|
672 | #endif
|
---|
673 |
|
---|
674 | /**************************************************************************/
|
---|
675 | /* IRIX */
|
---|
676 | /**************************************************************************/
|
---|
677 | #if defined(sgi)
|
---|
678 |
|
---|
679 | #include <errno.h>
|
---|
680 | #include <sys/types.h>
|
---|
681 | #include <sys/stat.h>
|
---|
682 |
|
---|
683 | #endif
|
---|
684 |
|
---|
685 | /**************************************************************************/
|
---|
686 | /* Generic */
|
---|
687 | /**************************************************************************/
|
---|
688 |
|
---|
689 | #include <sys/wait.h> /* May need to adjust this for other OSs */
|
---|
690 |
|
---|
691 | /*
|
---|
692 | * Hack originally for ISC 2.2 POSIX headers, but may apply elsewhere,
|
---|
693 | * and it's safe, so just do it.
|
---|
694 | */
|
---|
695 | #if !defined(O_NDELAY) && defined(O_NONBLOCK)
|
---|
696 | # define O_NDELAY O_NONBLOCK
|
---|
697 | #endif /* !O_NDELAY && O_NONBLOCK */
|
---|
698 |
|
---|
699 | #if !defined(MAXHOSTNAMELEN)
|
---|
700 | # define MAXHOSTNAMELEN 32
|
---|
701 | #endif /* !MAXHOSTNAMELEN */
|
---|
702 |
|
---|
703 | #if !defined(X_NOT_POSIX)
|
---|
704 | # if defined(_POSIX_SOURCE)
|
---|
705 | # include <limits.h>
|
---|
706 | # else
|
---|
707 | # define _POSIX_SOURCE
|
---|
708 | # include <limits.h>
|
---|
709 | # undef _POSIX_SOURCE
|
---|
710 | # endif /* _POSIX_SOURCE */
|
---|
711 | #endif /* !X_NOT_POSIX */
|
---|
712 | #if !defined(PATH_MAX)
|
---|
713 | # if defined(MAXPATHLEN)
|
---|
714 | # define PATH_MAX MAXPATHLEN
|
---|
715 | # else
|
---|
716 | # define PATH_MAX 1024
|
---|
717 | # endif /* MAXPATHLEN */
|
---|
718 | #endif /* !PATH_MAX */
|
---|
719 |
|
---|
720 | #ifdef NEED_STRERROR
|
---|
721 | # ifndef strerror
|
---|
722 | extern char *sys_errlist[];
|
---|
723 | extern int sys_nerr;
|
---|
724 | # define strerror(n) \
|
---|
725 | ((n) >= 0 && (n) < sys_nerr) ? sys_errlist[n] : "unknown error"
|
---|
726 | # endif /* !strerror */
|
---|
727 | #endif /* NEED_STRERROR */
|
---|
728 |
|
---|
729 | #if defined(ISC) || defined(Lynx)
|
---|
730 | #define rint(x) RInt(x)
|
---|
731 | double RInt(
|
---|
732 | double x
|
---|
733 | );
|
---|
734 | #endif
|
---|
735 |
|
---|
736 | #ifndef DEV_MEM
|
---|
737 | #define DEV_MEM "/dev/mem"
|
---|
738 | #endif
|
---|
739 |
|
---|
740 | #ifndef VT_SYSREQ_DEFAULT
|
---|
741 | #define VT_SYSREQ_DEFAULT FALSE
|
---|
742 | #endif
|
---|
743 |
|
---|
744 | #ifdef OSMOUSE_ONLY
|
---|
745 | # ifndef MOUSE_PROTOCOL_IN_KERNEL
|
---|
746 | # define MOUSE_PROTOCOL_IN_KERNEL
|
---|
747 | # endif
|
---|
748 | #endif
|
---|
749 |
|
---|
750 | #define SYSCALL(call) while(((call) == -1) && (errno == EINTR))
|
---|
751 |
|
---|
752 | #define XF86_OS_PRIVS
|
---|
753 | #include "xf86_OSproc.h"
|
---|
754 |
|
---|
755 | #ifndef NO_COMPILER_H
|
---|
756 | #include "compiler.h"
|
---|
757 | #endif
|
---|
758 |
|
---|
759 | #endif /* _XF86_OSLIB_H */
|
---|