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 | /*
|
---|
69 | * This is private, and should not be included by any drivers. Drivers
|
---|
70 | * may include xf86_OSproc.h to get prototypes for public interfaces.
|
---|
71 | */
|
---|
72 |
|
---|
73 | #ifndef _XF86_OSLIB_H
|
---|
74 | #define _XF86_OSLIB_H
|
---|
75 |
|
---|
76 | #include <X11/Xos.h>
|
---|
77 | #include <X11/Xfuncproto.h>
|
---|
78 |
|
---|
79 | #include <stdio.h>
|
---|
80 | #include <ctype.h>
|
---|
81 | #include <stddef.h>
|
---|
82 |
|
---|
83 | /**************************************************************************/
|
---|
84 | /* SYSV386 (SVR3, SVR4), including Solaris */
|
---|
85 | /**************************************************************************/
|
---|
86 | #if (defined(SYSV) || defined(SVR4)) && \
|
---|
87 | (defined(sun) || defined(__i386__))
|
---|
88 | # include <sys/ioctl.h>
|
---|
89 | # include <signal.h>
|
---|
90 | # include <termio.h>
|
---|
91 | # include <sys/stat.h>
|
---|
92 | # include <sys/types.h>
|
---|
93 |
|
---|
94 |
|
---|
95 | # include <errno.h>
|
---|
96 |
|
---|
97 | # if defined(_NEED_SYSI86)
|
---|
98 | # if !(defined (sun) && defined (SVR4))
|
---|
99 | # include <sys/immu.h>
|
---|
100 | # include <sys/region.h>
|
---|
101 | # include <sys/proc.h>
|
---|
102 | # endif
|
---|
103 | # include <sys/tss.h>
|
---|
104 | # include <sys/sysi86.h>
|
---|
105 | # if defined(SVR4) && !defined(sun)
|
---|
106 | # include <sys/seg.h>
|
---|
107 | # endif /* SVR4 && !sun */
|
---|
108 | /* V86SC_IOPL was moved to <sys/sysi86.h> on Solaris 7 and later */
|
---|
109 | # if !defined(V86SC_IOPL) /* Solaris 7 or later? */
|
---|
110 | # include <sys/v86.h> /* Nope */
|
---|
111 | # endif
|
---|
112 | # if defined(sun) && (defined (__i386__) || defined(__i386) || defined(__x86)) && defined (SVR4)
|
---|
113 | # include <sys/psw.h>
|
---|
114 | # endif
|
---|
115 | # endif /* _NEED_SYSI86 */
|
---|
116 |
|
---|
117 | # if defined(HAS_SVR3_MMAPDRV)
|
---|
118 | # include <sys/sysmacros.h>
|
---|
119 | # if !defined(_NEED_SYSI86)
|
---|
120 | # include <sys/immu.h>
|
---|
121 | # include <sys/region.h>
|
---|
122 | # endif
|
---|
123 | # include <sys/mmap.h> /* MMAP driver header */
|
---|
124 | # endif
|
---|
125 |
|
---|
126 | # if !defined(sun) || defined(HAVE_SYS_VT_H)
|
---|
127 | # define HAS_USL_VTS
|
---|
128 | # endif
|
---|
129 | # if !defined(sun)
|
---|
130 | # include <sys/emap.h>
|
---|
131 | # endif
|
---|
132 | # if defined(HAS_USL_VTS)
|
---|
133 | # if !defined(sun)
|
---|
134 | # include <sys/at_ansi.h>
|
---|
135 | # endif
|
---|
136 | # include <sys/kd.h>
|
---|
137 | # include <sys/vt.h>
|
---|
138 | # endif
|
---|
139 |
|
---|
140 | # if defined(sun)
|
---|
141 | # include <sys/fbio.h>
|
---|
142 | # include <sys/kbd.h>
|
---|
143 | # include <sys/kbio.h>
|
---|
144 |
|
---|
145 | /* undefine symbols from <sys/kbd.h> we don't need that conflict with enum
|
---|
146 | definitions in parser/xf86tokens.h */
|
---|
147 | # undef STRING
|
---|
148 | # undef LEFTALT
|
---|
149 | # undef RIGHTALT
|
---|
150 |
|
---|
151 | # define LED_CAP LED_CAPS_LOCK
|
---|
152 | # define LED_NUM LED_NUM_LOCK
|
---|
153 | # define LED_SCR LED_SCROLL_LOCK
|
---|
154 | # define LED_COMP LED_COMPOSE
|
---|
155 | # endif /* sun */
|
---|
156 |
|
---|
157 | # if !defined(VT_ACKACQ)
|
---|
158 | # define VT_ACKACQ 2
|
---|
159 | # endif /* !VT_ACKACQ */
|
---|
160 |
|
---|
161 |
|
---|
162 | # if defined(SVR4)
|
---|
163 | # include <sys/mman.h>
|
---|
164 | # if !(defined(sun) && defined (SVR4))
|
---|
165 | # define DEV_MEM "/dev/pmem"
|
---|
166 | # endif
|
---|
167 | # define CLEARDTR_SUPPORT
|
---|
168 | # define POSIX_TTY
|
---|
169 | # endif /* SVR4 */
|
---|
170 |
|
---|
171 | #endif /* (SYSV || SVR4) */
|
---|
172 |
|
---|
173 | /**************************************************************************/
|
---|
174 | /* Linux or Glibc-based system */
|
---|
175 | /**************************************************************************/
|
---|
176 | #if defined(__linux__) || defined(__GLIBC__)
|
---|
177 | # include <sys/ioctl.h>
|
---|
178 | # include <signal.h>
|
---|
179 | # include <stdlib.h>
|
---|
180 | # include <sys/types.h>
|
---|
181 | # include <assert.h>
|
---|
182 |
|
---|
183 | # ifdef __linux__
|
---|
184 | # include <termio.h>
|
---|
185 | # else /* __GLIBC__ */
|
---|
186 | # include <termios.h>
|
---|
187 | # endif
|
---|
188 | # ifdef __sparc__
|
---|
189 | # include <sys/param.h>
|
---|
190 | # endif
|
---|
191 |
|
---|
192 | # include <errno.h>
|
---|
193 |
|
---|
194 | # include <sys/stat.h>
|
---|
195 |
|
---|
196 | # include <sys/mman.h>
|
---|
197 | # ifdef __linux__
|
---|
198 | # define HAS_USL_VTS
|
---|
199 | # include <sys/kd.h>
|
---|
200 | # include <sys/vt.h>
|
---|
201 | # define LDGMAP GIO_SCRNMAP
|
---|
202 | # define LDSMAP PIO_SCRNMAP
|
---|
203 | # define LDNMAP LDSMAP
|
---|
204 | # define CLEARDTR_SUPPORT
|
---|
205 | # endif
|
---|
206 |
|
---|
207 | # define POSIX_TTY
|
---|
208 |
|
---|
209 | #endif /* __linux__ || __GLIBC__ */
|
---|
210 |
|
---|
211 | /**************************************************************************/
|
---|
212 | /* 386BSD and derivatives, BSD/386 */
|
---|
213 | /**************************************************************************/
|
---|
214 |
|
---|
215 | #if defined(__386BSD__) && (defined(__FreeBSD__) || defined(__NetBSD__))
|
---|
216 | # undef __386BSD__
|
---|
217 | #endif
|
---|
218 |
|
---|
219 | #ifdef CSRG_BASED
|
---|
220 | # include <sys/ioctl.h>
|
---|
221 | # include <signal.h>
|
---|
222 |
|
---|
223 | # include <termios.h>
|
---|
224 | # define termio termios
|
---|
225 | # define POSIX_TTY
|
---|
226 |
|
---|
227 | # include <errno.h>
|
---|
228 |
|
---|
229 | # include <sys/types.h>
|
---|
230 | # include <sys/mman.h>
|
---|
231 | # include <sys/stat.h>
|
---|
232 |
|
---|
233 | #endif /* CSRG_BASED */
|
---|
234 |
|
---|
235 | /**************************************************************************/
|
---|
236 | /* Kernel of *BSD */
|
---|
237 | /**************************************************************************/
|
---|
238 | #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
|
---|
239 | defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
|
---|
240 |
|
---|
241 | # include <sys/param.h>
|
---|
242 | # if defined(__FreeBSD_version) && !defined(__FreeBSD_kernel_version)
|
---|
243 | # define __FreeBSD_kernel_version __FreeBSD_version
|
---|
244 | # endif
|
---|
245 |
|
---|
246 | # if !defined(LINKKIT)
|
---|
247 | /* Don't need this stuff for the Link Kit */
|
---|
248 | # ifdef SYSCONS_SUPPORT
|
---|
249 | # define COMPAT_SYSCONS
|
---|
250 | # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
---|
251 | # if defined(__DragonFly__) || (__FreeBSD_kernel_version >= 410000)
|
---|
252 | # include <sys/consio.h>
|
---|
253 | # include <sys/kbio.h>
|
---|
254 | # else
|
---|
255 | # include <machine/console.h>
|
---|
256 | # endif /* FreeBSD 4.1 RELEASE or lator */
|
---|
257 | # else
|
---|
258 | # include <sys/console.h>
|
---|
259 | # endif
|
---|
260 | # endif /* SYSCONS_SUPPORT */
|
---|
261 | # if defined(PCVT_SUPPORT) && !defined(__NetBSD__) && !defined(__OpenBSD__)
|
---|
262 | # if !defined(SYSCONS_SUPPORT)
|
---|
263 | /* no syscons, so include pcvt specific header file */
|
---|
264 | # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
---|
265 | # include <machine/pcvt_ioctl.h>
|
---|
266 | # else
|
---|
267 | # include <sys/pcvt_ioctl.h>
|
---|
268 | # endif /* __FreeBSD_kernel__ */
|
---|
269 | # else /* pcvt and syscons: hard-code the ID magic */
|
---|
270 | # define VGAPCVTID _IOWR('V',113, struct pcvtid)
|
---|
271 | struct pcvtid {
|
---|
272 | char name[16];
|
---|
273 | int rmajor, rminor;
|
---|
274 | };
|
---|
275 | # endif /* PCVT_SUPPORT && SYSCONS_SUPPORT */
|
---|
276 | # endif /* PCVT_SUPPORT */
|
---|
277 | # ifdef WSCONS_SUPPORT
|
---|
278 | # include <dev/wscons/wsconsio.h>
|
---|
279 | # include <dev/wscons/wsdisplay_usl_io.h>
|
---|
280 | # endif /* WSCONS_SUPPORT */
|
---|
281 | # if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
|
---|
282 | # if defined(__FreeBSD_kernel_version) && (__FreeBSD_kernel_version >= 500013)
|
---|
283 | # include <sys/mouse.h>
|
---|
284 | # else
|
---|
285 | # undef MOUSE_GETINFO
|
---|
286 | # include <machine/mouse.h>
|
---|
287 | # endif
|
---|
288 | # endif
|
---|
289 | /* Include these definitions in case ioctl_pc.h didn't get included */
|
---|
290 | # ifndef CONSOLE_X_MODE_ON
|
---|
291 | # define CONSOLE_X_MODE_ON _IO('t',121)
|
---|
292 | # endif
|
---|
293 | # ifndef CONSOLE_X_MODE_OFF
|
---|
294 | # define CONSOLE_X_MODE_OFF _IO('t',122)
|
---|
295 | # endif
|
---|
296 | # ifndef CONSOLE_X_BELL
|
---|
297 | # define CONSOLE_X_BELL _IOW('t',123,int[2])
|
---|
298 | # endif
|
---|
299 | # ifndef CONSOLE_X_TV_ON
|
---|
300 | # define CONSOLE_X_TV_ON _IOW('t',155,int)
|
---|
301 | # define XMODE_RGB 0
|
---|
302 | # define XMODE_NTSC 1
|
---|
303 | # define XMODE_PAL 2
|
---|
304 | # define XMODE_SECAM 3
|
---|
305 | # endif
|
---|
306 | # ifndef CONSOLE_X_TV_OFF
|
---|
307 | # define CONSOLE_X_TV_OFF _IO('t',156)
|
---|
308 | # endif
|
---|
309 | #ifndef CONSOLE_GET_LINEAR_INFO
|
---|
310 | # define CONSOLE_GET_LINEAR_INFO _IOR('t',157,struct map_info)
|
---|
311 | #endif
|
---|
312 | #ifndef CONSOLE_GET_IO_INFO
|
---|
313 | # define CONSOLE_GET_IO_INFO _IOR('t',158,struct map_info)
|
---|
314 | #endif
|
---|
315 | #ifndef CONSOLE_GET_MEM_INFO
|
---|
316 | # define CONSOLE_GET_MEM_INFO _IOR('t',159,struct map_info)
|
---|
317 | #endif
|
---|
318 | # endif /* !LINKKIT */
|
---|
319 |
|
---|
320 | #if defined(USE_I386_IOPL) || defined(USE_AMD64_IOPL)
|
---|
321 | #include <machine/sysarch.h>
|
---|
322 | #endif
|
---|
323 |
|
---|
324 | # define CLEARDTR_SUPPORT
|
---|
325 |
|
---|
326 | #endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ */
|
---|
327 |
|
---|
328 | /**************************************************************************/
|
---|
329 | /* IRIX */
|
---|
330 | /**************************************************************************/
|
---|
331 |
|
---|
332 | /**************************************************************************/
|
---|
333 | /* Generic */
|
---|
334 | /**************************************************************************/
|
---|
335 |
|
---|
336 | #include <sys/wait.h> /* May need to adjust this for other OSs */
|
---|
337 |
|
---|
338 | /* For PATH_MAX */
|
---|
339 | #include "misc.h"
|
---|
340 |
|
---|
341 | /*
|
---|
342 | * Hack originally for ISC 2.2 POSIX headers, but may apply elsewhere,
|
---|
343 | * and it's safe, so just do it.
|
---|
344 | */
|
---|
345 | #if !defined(O_NDELAY) && defined(O_NONBLOCK)
|
---|
346 | # define O_NDELAY O_NONBLOCK
|
---|
347 | #endif /* !O_NDELAY && O_NONBLOCK */
|
---|
348 |
|
---|
349 | #if !defined(MAXHOSTNAMELEN)
|
---|
350 | # define MAXHOSTNAMELEN 32
|
---|
351 | #endif /* !MAXHOSTNAMELEN */
|
---|
352 |
|
---|
353 | #if defined(_POSIX_SOURCE)
|
---|
354 | # include <limits.h>
|
---|
355 | #else
|
---|
356 | # define _POSIX_SOURCE
|
---|
357 | # include <limits.h>
|
---|
358 | # undef _POSIX_SOURCE
|
---|
359 | #endif /* _POSIX_SOURCE */
|
---|
360 |
|
---|
361 |
|
---|
362 | #ifndef DEV_MEM
|
---|
363 | #define DEV_MEM "/dev/mem"
|
---|
364 | #endif
|
---|
365 |
|
---|
366 | #ifndef MAP_FAILED
|
---|
367 | #define MAP_FAILED ((void *)-1)
|
---|
368 | #endif
|
---|
369 |
|
---|
370 | #define SYSCALL(call) while(((call) == -1) && (errno == EINTR))
|
---|
371 |
|
---|
372 | #define XF86_OS_PRIVS
|
---|
373 | #include "xf86_OSproc.h"
|
---|
374 |
|
---|
375 | #ifndef NO_COMPILER_H
|
---|
376 | #include "compiler.h"
|
---|
377 | #endif
|
---|
378 |
|
---|
379 | #endif /* _XF86_OSLIB_H */
|
---|