1 | /***********************************************************
|
---|
2 |
|
---|
3 | Copyright 1987, 1998 The Open Group
|
---|
4 |
|
---|
5 | Permission to use, copy, modify, distribute, and sell this software and its
|
---|
6 | documentation for any purpose is hereby granted without fee, provided that
|
---|
7 | the above copyright notice appear in all copies and that both that
|
---|
8 | copyright notice and this permission notice appear in supporting
|
---|
9 | documentation.
|
---|
10 |
|
---|
11 | The above copyright notice and this permission notice shall be included in
|
---|
12 | all copies or substantial portions of the Software.
|
---|
13 |
|
---|
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
---|
15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
---|
16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
---|
17 | OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
---|
18 | AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
---|
19 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
---|
20 |
|
---|
21 | Except as contained in this notice, the name of The Open Group shall not be
|
---|
22 | used in advertising or otherwise to promote the sale, use or other dealings
|
---|
23 | in this Software without prior written authorization from The Open Group.
|
---|
24 |
|
---|
25 | Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
---|
26 |
|
---|
27 | All Rights Reserved
|
---|
28 |
|
---|
29 | Permission to use, copy, modify, and distribute this software and its
|
---|
30 | documentation for any purpose and without fee is hereby granted,
|
---|
31 | provided that the above copyright notice appear in all copies and that
|
---|
32 | both that copyright notice and this permission notice appear in
|
---|
33 | supporting documentation, and that the name of Digital not be
|
---|
34 | used in advertising or publicity pertaining to distribution of the
|
---|
35 | software without specific, written prior permission.
|
---|
36 |
|
---|
37 | DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
---|
38 | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
---|
39 | DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
---|
40 | ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
---|
41 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
---|
42 | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
---|
43 | SOFTWARE.
|
---|
44 |
|
---|
45 | ******************************************************************/
|
---|
46 |
|
---|
47 | #ifndef OS_H
|
---|
48 | #define OS_H
|
---|
49 |
|
---|
50 | #include "misc.h"
|
---|
51 | #include <stdarg.h>
|
---|
52 | #include <stdint.h>
|
---|
53 | #include <string.h>
|
---|
54 |
|
---|
55 | #define SCREEN_SAVER_ON 0
|
---|
56 | #define SCREEN_SAVER_OFF 1
|
---|
57 | #define SCREEN_SAVER_FORCER 2
|
---|
58 | #define SCREEN_SAVER_CYCLE 3
|
---|
59 |
|
---|
60 | #ifndef MAX_REQUEST_SIZE
|
---|
61 | #define MAX_REQUEST_SIZE 65535
|
---|
62 | #endif
|
---|
63 | #ifndef MAX_BIG_REQUEST_SIZE
|
---|
64 | #define MAX_BIG_REQUEST_SIZE 4194303
|
---|
65 | #endif
|
---|
66 |
|
---|
67 | typedef struct _FontPathRec *FontPathPtr;
|
---|
68 | typedef struct _NewClientRec *NewClientPtr;
|
---|
69 |
|
---|
70 | #ifndef xalloc
|
---|
71 | #define xnfalloc(size) XNFalloc((unsigned long)(size))
|
---|
72 | #define xnfcalloc(_num, _size) XNFcalloc((unsigned long)(_num)*(unsigned long)(_size))
|
---|
73 | #define xnfrealloc(ptr, size) XNFrealloc((void *)(ptr), (unsigned long)(size))
|
---|
74 |
|
---|
75 | #define xalloc(size) Xalloc((unsigned long)(size))
|
---|
76 | #define xcalloc(_num, _size) Xcalloc((unsigned long)(_num)*(unsigned long)(_size))
|
---|
77 | #define xrealloc(ptr, size) Xrealloc((void *)(ptr), (unsigned long)(size))
|
---|
78 | #define xfree(ptr) Xfree((void *)(ptr))
|
---|
79 | #define xstrdup(s) Xstrdup(s)
|
---|
80 | #define xnfstrdup(s) XNFstrdup(s)
|
---|
81 | #endif
|
---|
82 |
|
---|
83 | #include <stdio.h>
|
---|
84 | #include <stdarg.h>
|
---|
85 |
|
---|
86 | #ifdef DDXBEFORERESET
|
---|
87 | extern void ddxBeforeReset(void);
|
---|
88 | #endif
|
---|
89 |
|
---|
90 | #ifdef DDXOSVERRORF
|
---|
91 | extern _X_EXPORT void (*OsVendorVErrorFProc) (const char *,
|
---|
92 | va_list args)
|
---|
93 | _X_ATTRIBUTE_PRINTF(1, 0);
|
---|
94 | #endif
|
---|
95 |
|
---|
96 | extern _X_EXPORT int WaitForSomething(int * /*pClientsReady */
|
---|
97 | );
|
---|
98 |
|
---|
99 | extern _X_EXPORT int ReadRequestFromClient(ClientPtr /*client */ );
|
---|
100 |
|
---|
101 | #if XTRANS_SEND_FDS
|
---|
102 | extern _X_EXPORT int ReadFdFromClient(ClientPtr client);
|
---|
103 |
|
---|
104 | extern _X_EXPORT int WriteFdToClient(ClientPtr client, int fd, Bool do_close);
|
---|
105 | #endif
|
---|
106 |
|
---|
107 | extern _X_EXPORT Bool InsertFakeRequest(ClientPtr /*client */ ,
|
---|
108 | char * /*data */ ,
|
---|
109 | int /*count */ );
|
---|
110 |
|
---|
111 | extern _X_EXPORT void ResetCurrentRequest(ClientPtr /*client */ );
|
---|
112 |
|
---|
113 | extern _X_EXPORT void FlushAllOutput(void);
|
---|
114 |
|
---|
115 | extern _X_EXPORT void FlushIfCriticalOutputPending(void);
|
---|
116 |
|
---|
117 | extern _X_EXPORT void SetCriticalOutputPending(void);
|
---|
118 |
|
---|
119 | extern _X_EXPORT int WriteToClient(ClientPtr /*who */ , int /*count */ ,
|
---|
120 | const void * /*buf */ );
|
---|
121 |
|
---|
122 | extern _X_EXPORT void ResetOsBuffers(void);
|
---|
123 |
|
---|
124 | extern _X_EXPORT void InitConnectionLimits(void);
|
---|
125 |
|
---|
126 | extern _X_EXPORT void NotifyParentProcess(void);
|
---|
127 |
|
---|
128 | extern _X_EXPORT void CreateWellKnownSockets(void);
|
---|
129 |
|
---|
130 | extern _X_EXPORT void ResetWellKnownSockets(void);
|
---|
131 |
|
---|
132 | extern _X_EXPORT void CloseWellKnownConnections(void);
|
---|
133 |
|
---|
134 | extern _X_EXPORT XID AuthorizationIDOfClient(ClientPtr /*client */ );
|
---|
135 |
|
---|
136 | extern _X_EXPORT const char *ClientAuthorized(ClientPtr /*client */ ,
|
---|
137 | unsigned int /*proto_n */ ,
|
---|
138 | char * /*auth_proto */ ,
|
---|
139 | unsigned int /*string_n */ ,
|
---|
140 | char * /*auth_string */ );
|
---|
141 |
|
---|
142 | extern _X_EXPORT Bool EstablishNewConnections(ClientPtr /*clientUnused */ ,
|
---|
143 | void */*closure */ );
|
---|
144 |
|
---|
145 | extern _X_EXPORT void CheckConnections(void);
|
---|
146 |
|
---|
147 | extern _X_EXPORT void CloseDownConnection(ClientPtr /*client */ );
|
---|
148 |
|
---|
149 | extern _X_EXPORT void AddGeneralSocket(int /*fd */ );
|
---|
150 |
|
---|
151 | extern _X_EXPORT void RemoveGeneralSocket(int /*fd */ );
|
---|
152 |
|
---|
153 | extern _X_EXPORT void AddEnabledDevice(int /*fd */ );
|
---|
154 |
|
---|
155 | extern _X_EXPORT void RemoveEnabledDevice(int /*fd */ );
|
---|
156 |
|
---|
157 | extern _X_EXPORT int OnlyListenToOneClient(ClientPtr /*client */ );
|
---|
158 |
|
---|
159 | extern _X_EXPORT void ListenToAllClients(void);
|
---|
160 |
|
---|
161 | extern _X_EXPORT void IgnoreClient(ClientPtr /*client */ );
|
---|
162 |
|
---|
163 | extern _X_EXPORT void AttendClient(ClientPtr /*client */ );
|
---|
164 |
|
---|
165 | extern _X_EXPORT void MakeClientGrabImpervious(ClientPtr /*client */ );
|
---|
166 |
|
---|
167 | extern _X_EXPORT void MakeClientGrabPervious(ClientPtr /*client */ );
|
---|
168 |
|
---|
169 | extern _X_EXPORT void ListenOnOpenFD(int /* fd */ , int /* noxauth */ );
|
---|
170 |
|
---|
171 | extern _X_EXPORT Bool AddClientOnOpenFD(int /* fd */ );
|
---|
172 |
|
---|
173 | extern _X_EXPORT CARD32 GetTimeInMillis(void);
|
---|
174 | extern _X_EXPORT CARD64 GetTimeInMicros(void);
|
---|
175 |
|
---|
176 | extern _X_EXPORT void AdjustWaitForDelay(void */*waitTime */ ,
|
---|
177 | unsigned long /*newdelay */ );
|
---|
178 |
|
---|
179 | typedef struct _OsTimerRec *OsTimerPtr;
|
---|
180 |
|
---|
181 | typedef CARD32 (*OsTimerCallback) (OsTimerPtr /* timer */ ,
|
---|
182 | CARD32 /* time */ ,
|
---|
183 | void */* arg */ );
|
---|
184 |
|
---|
185 | extern _X_EXPORT void TimerInit(void);
|
---|
186 |
|
---|
187 | extern _X_EXPORT Bool TimerForce(OsTimerPtr /* timer */ );
|
---|
188 |
|
---|
189 | #define TimerAbsolute (1<<0)
|
---|
190 | #define TimerForceOld (1<<1)
|
---|
191 |
|
---|
192 | extern _X_EXPORT OsTimerPtr TimerSet(OsTimerPtr /* timer */ ,
|
---|
193 | int /* flags */ ,
|
---|
194 | CARD32 /* millis */ ,
|
---|
195 | OsTimerCallback /* func */ ,
|
---|
196 | void */* arg */ );
|
---|
197 |
|
---|
198 | extern _X_EXPORT void TimerCheck(void);
|
---|
199 | extern _X_EXPORT void TimerCancel(OsTimerPtr /* pTimer */ );
|
---|
200 | extern _X_EXPORT void TimerFree(OsTimerPtr /* pTimer */ );
|
---|
201 |
|
---|
202 | extern _X_EXPORT void SetScreenSaverTimer(void);
|
---|
203 | extern _X_EXPORT void FreeScreenSaverTimer(void);
|
---|
204 |
|
---|
205 | extern _X_EXPORT void AutoResetServer(int /*sig */ );
|
---|
206 |
|
---|
207 | extern _X_EXPORT void GiveUp(int /*sig */ );
|
---|
208 |
|
---|
209 | extern _X_EXPORT void UseMsg(void);
|
---|
210 |
|
---|
211 | extern _X_EXPORT void ProcessCommandLine(int /*argc */ , char * /*argv */ []);
|
---|
212 |
|
---|
213 | extern _X_EXPORT int set_font_authorizations(char ** /* authorizations */ ,
|
---|
214 | int * /*authlen */ ,
|
---|
215 | void */* client */ );
|
---|
216 |
|
---|
217 | #ifndef _HAVE_XALLOC_DECLS
|
---|
218 | #define _HAVE_XALLOC_DECLS
|
---|
219 |
|
---|
220 | /*
|
---|
221 | * Use malloc(3) instead.
|
---|
222 | */
|
---|
223 | extern _X_EXPORT void *
|
---|
224 | Xalloc(unsigned long /*amount */ ) _X_DEPRECATED;
|
---|
225 |
|
---|
226 | /*
|
---|
227 | * Use calloc(3) instead
|
---|
228 | */
|
---|
229 | extern _X_EXPORT void *
|
---|
230 | Xcalloc(unsigned long /*amount */ ) _X_DEPRECATED;
|
---|
231 |
|
---|
232 | /*
|
---|
233 | * Use realloc(3) instead
|
---|
234 | */
|
---|
235 | extern _X_EXPORT void *
|
---|
236 | Xrealloc(void * /*ptr */ , unsigned long /*amount */ )
|
---|
237 | _X_DEPRECATED;
|
---|
238 |
|
---|
239 | /*
|
---|
240 | * Use free(3) instead
|
---|
241 | */
|
---|
242 | extern _X_EXPORT void
|
---|
243 | Xfree(void * /*ptr */ )
|
---|
244 | _X_DEPRECATED;
|
---|
245 |
|
---|
246 | #endif
|
---|
247 |
|
---|
248 | /*
|
---|
249 | * This function malloc(3)s buffer, terminating the server if there is not
|
---|
250 | * enough memory.
|
---|
251 | */
|
---|
252 | extern _X_EXPORT void *
|
---|
253 | XNFalloc(unsigned long /*amount */ );
|
---|
254 |
|
---|
255 | /*
|
---|
256 | * This function calloc(3)s buffer, terminating the server if there is not
|
---|
257 | * enough memory.
|
---|
258 | */
|
---|
259 | extern _X_EXPORT void *
|
---|
260 | XNFcalloc(unsigned long /*amount */ );
|
---|
261 |
|
---|
262 | /*
|
---|
263 | * This function realloc(3)s passed buffer, terminating the server if there is
|
---|
264 | * not enough memory.
|
---|
265 | */
|
---|
266 | extern _X_EXPORT void *
|
---|
267 | XNFrealloc(void * /*ptr */ , unsigned long /*amount */ );
|
---|
268 |
|
---|
269 | /*
|
---|
270 | * This function strdup(3)s passed string. The only difference from the library
|
---|
271 | * function that it is safe to pass NULL, as NULL will be returned.
|
---|
272 | */
|
---|
273 | extern _X_EXPORT char *
|
---|
274 | Xstrdup(const char *s);
|
---|
275 |
|
---|
276 | /*
|
---|
277 | * This function strdup(3)s passed string, terminating the server if there is
|
---|
278 | * not enough memory. If NULL is passed to this function, NULL is returned.
|
---|
279 | */
|
---|
280 | extern _X_EXPORT char *
|
---|
281 | XNFstrdup(const char *s);
|
---|
282 |
|
---|
283 | /* Include new X*asprintf API */
|
---|
284 | #include "Xprintf.h"
|
---|
285 |
|
---|
286 | /* Older api deprecated in favor of the asprintf versions */
|
---|
287 | extern _X_EXPORT char *
|
---|
288 | Xprintf(const char *fmt, ...)
|
---|
289 | _X_ATTRIBUTE_PRINTF(1, 2)
|
---|
290 | _X_DEPRECATED;
|
---|
291 | extern _X_EXPORT char *
|
---|
292 | Xvprintf(const char *fmt, va_list va)
|
---|
293 | _X_ATTRIBUTE_PRINTF(1, 0)
|
---|
294 | _X_DEPRECATED;
|
---|
295 | extern _X_EXPORT char *
|
---|
296 | XNFprintf(const char *fmt, ...)
|
---|
297 | _X_ATTRIBUTE_PRINTF(1, 2)
|
---|
298 | _X_DEPRECATED;
|
---|
299 | extern _X_EXPORT char *
|
---|
300 | XNFvprintf(const char *fmt, va_list va)
|
---|
301 | _X_ATTRIBUTE_PRINTF(1, 0)
|
---|
302 | _X_DEPRECATED;
|
---|
303 |
|
---|
304 | typedef void (*OsSigHandlerPtr) (int /* sig */ );
|
---|
305 | typedef int (*OsSigWrapperPtr) (int /* sig */ );
|
---|
306 |
|
---|
307 | extern _X_EXPORT OsSigHandlerPtr
|
---|
308 | OsSignal(int /* sig */ , OsSigHandlerPtr /* handler */ );
|
---|
309 | extern _X_EXPORT OsSigWrapperPtr
|
---|
310 | OsRegisterSigWrapper(OsSigWrapperPtr newWrap);
|
---|
311 |
|
---|
312 | extern _X_EXPORT int auditTrailLevel;
|
---|
313 |
|
---|
314 | extern _X_EXPORT void
|
---|
315 | LockServer(void);
|
---|
316 | extern _X_EXPORT void
|
---|
317 | UnlockServer(void);
|
---|
318 |
|
---|
319 | extern _X_EXPORT int
|
---|
320 | OsLookupColor(int /*screen */ ,
|
---|
321 | char * /*name */ ,
|
---|
322 | unsigned /*len */ ,
|
---|
323 | unsigned short * /*pred */ ,
|
---|
324 | unsigned short * /*pgreen */ ,
|
---|
325 | unsigned short * /*pblue */ );
|
---|
326 |
|
---|
327 | extern _X_EXPORT void
|
---|
328 | OsInit(void);
|
---|
329 |
|
---|
330 | extern _X_EXPORT void
|
---|
331 | OsCleanup(Bool);
|
---|
332 |
|
---|
333 | extern _X_EXPORT void
|
---|
334 | OsVendorFatalError(const char *f, va_list args)
|
---|
335 | _X_ATTRIBUTE_PRINTF(1, 0);
|
---|
336 |
|
---|
337 | extern _X_EXPORT void
|
---|
338 | OsVendorInit(void);
|
---|
339 |
|
---|
340 | extern _X_EXPORT void
|
---|
341 | OsBlockSignals(void);
|
---|
342 |
|
---|
343 | extern _X_EXPORT void
|
---|
344 | OsReleaseSignals(void);
|
---|
345 |
|
---|
346 | extern _X_EXPORT int
|
---|
347 | OsBlockSIGIO(void);
|
---|
348 |
|
---|
349 | extern _X_EXPORT void
|
---|
350 | OsReleaseSIGIO(void);
|
---|
351 |
|
---|
352 | extern void
|
---|
353 | OsResetSignals(void);
|
---|
354 |
|
---|
355 | extern _X_EXPORT void
|
---|
356 | OsAbort(void)
|
---|
357 | _X_NORETURN;
|
---|
358 |
|
---|
359 | #if !defined(WIN32)
|
---|
360 | extern _X_EXPORT int
|
---|
361 | System(const char *);
|
---|
362 | extern _X_EXPORT void *
|
---|
363 | Popen(const char *, const char *);
|
---|
364 | extern _X_EXPORT int
|
---|
365 | Pclose(void *);
|
---|
366 | extern _X_EXPORT void *
|
---|
367 | Fopen(const char *, const char *);
|
---|
368 | extern _X_EXPORT int
|
---|
369 | Fclose(void *);
|
---|
370 | #else
|
---|
371 |
|
---|
372 | extern const char *
|
---|
373 | Win32TempDir(void);
|
---|
374 |
|
---|
375 | extern int
|
---|
376 | System(const char *cmdline);
|
---|
377 |
|
---|
378 | #define Fopen(a,b) fopen(a,b)
|
---|
379 | #define Fclose(a) fclose(a)
|
---|
380 | #endif
|
---|
381 |
|
---|
382 | extern _X_EXPORT void
|
---|
383 | CheckUserParameters(int argc, char **argv, char **envp);
|
---|
384 | extern _X_EXPORT void
|
---|
385 | CheckUserAuthorization(void);
|
---|
386 |
|
---|
387 | extern _X_EXPORT int
|
---|
388 | AddHost(ClientPtr /*client */ ,
|
---|
389 | int /*family */ ,
|
---|
390 | unsigned /*length */ ,
|
---|
391 | const void * /*pAddr */ );
|
---|
392 |
|
---|
393 | extern _X_EXPORT Bool
|
---|
394 | ForEachHostInFamily(int /*family */ ,
|
---|
395 | Bool (* /*func */ )(
|
---|
396 | unsigned char * /* addr */ ,
|
---|
397 | short /* len */ ,
|
---|
398 | void */* closure */ ),
|
---|
399 | void */*closure */ );
|
---|
400 |
|
---|
401 | extern _X_EXPORT int
|
---|
402 | RemoveHost(ClientPtr /*client */ ,
|
---|
403 | int /*family */ ,
|
---|
404 | unsigned /*length */ ,
|
---|
405 | void */*pAddr */ );
|
---|
406 |
|
---|
407 | extern _X_EXPORT int
|
---|
408 | GetHosts(void ** /*data */ ,
|
---|
409 | int * /*pnHosts */ ,
|
---|
410 | int * /*pLen */ ,
|
---|
411 | BOOL * /*pEnabled */ );
|
---|
412 |
|
---|
413 | typedef struct sockaddr *sockaddrPtr;
|
---|
414 |
|
---|
415 | extern _X_EXPORT int
|
---|
416 | InvalidHost(sockaddrPtr /*saddr */ , int /*len */ , ClientPtr client);
|
---|
417 |
|
---|
418 | extern _X_EXPORT int
|
---|
419 | LocalClientCred(ClientPtr, int *, int *);
|
---|
420 |
|
---|
421 | #define LCC_UID_SET (1 << 0)
|
---|
422 | #define LCC_GID_SET (1 << 1)
|
---|
423 | #define LCC_PID_SET (1 << 2)
|
---|
424 | #define LCC_ZID_SET (1 << 3)
|
---|
425 |
|
---|
426 | typedef struct {
|
---|
427 | int fieldsSet; /* Bit mask of fields set */
|
---|
428 | int euid; /* Effective uid */
|
---|
429 | int egid; /* Primary effective group id */
|
---|
430 | int nSuppGids; /* Number of supplementary group ids */
|
---|
431 | int *pSuppGids; /* Array of supplementary group ids */
|
---|
432 | int pid; /* Process id */
|
---|
433 | int zoneid; /* Only set on Solaris 10 & later */
|
---|
434 | } LocalClientCredRec;
|
---|
435 |
|
---|
436 | extern _X_EXPORT int
|
---|
437 | GetLocalClientCreds(ClientPtr, LocalClientCredRec **);
|
---|
438 | extern _X_EXPORT void
|
---|
439 | FreeLocalClientCreds(LocalClientCredRec *);
|
---|
440 |
|
---|
441 | extern _X_EXPORT int
|
---|
442 | ChangeAccessControl(ClientPtr /*client */ , int /*fEnabled */ );
|
---|
443 |
|
---|
444 | extern _X_EXPORT int
|
---|
445 | GetAccessControl(void);
|
---|
446 |
|
---|
447 | extern _X_EXPORT void
|
---|
448 | AddLocalHosts(void);
|
---|
449 |
|
---|
450 | extern _X_EXPORT void
|
---|
451 | ResetHosts(const char *display);
|
---|
452 |
|
---|
453 | extern _X_EXPORT void
|
---|
454 | EnableLocalHost(void);
|
---|
455 |
|
---|
456 | extern _X_EXPORT void
|
---|
457 | DisableLocalHost(void);
|
---|
458 |
|
---|
459 | extern _X_EXPORT void
|
---|
460 | AccessUsingXdmcp(void);
|
---|
461 |
|
---|
462 | extern _X_EXPORT void
|
---|
463 | DefineSelf(int /*fd */ );
|
---|
464 |
|
---|
465 | #if XDMCP
|
---|
466 | extern _X_EXPORT void
|
---|
467 | AugmentSelf(void */*from */ , int /*len */ );
|
---|
468 |
|
---|
469 | extern _X_EXPORT void
|
---|
470 | RegisterAuthorizations(void);
|
---|
471 | #endif
|
---|
472 |
|
---|
473 | extern _X_EXPORT void
|
---|
474 | InitAuthorization(const char * /*filename */ );
|
---|
475 |
|
---|
476 | /* extern int LoadAuthorization(void); */
|
---|
477 |
|
---|
478 | extern _X_EXPORT int
|
---|
479 | AuthorizationFromID(XID id,
|
---|
480 | unsigned short *name_lenp,
|
---|
481 | const char **namep,
|
---|
482 | unsigned short *data_lenp, char **datap);
|
---|
483 |
|
---|
484 | extern _X_EXPORT XID
|
---|
485 | CheckAuthorization(unsigned int /*namelength */ ,
|
---|
486 | const char * /*name */ ,
|
---|
487 | unsigned int /*datalength */ ,
|
---|
488 | const char * /*data */ ,
|
---|
489 | ClientPtr /*client */ ,
|
---|
490 | const char ** /*reason */
|
---|
491 | );
|
---|
492 |
|
---|
493 | extern _X_EXPORT void
|
---|
494 | ResetAuthorization(void);
|
---|
495 |
|
---|
496 | extern _X_EXPORT int
|
---|
497 | RemoveAuthorization(unsigned short name_length,
|
---|
498 | const char *name,
|
---|
499 | unsigned short data_length, const char *data);
|
---|
500 |
|
---|
501 | extern _X_EXPORT int
|
---|
502 | AddAuthorization(unsigned int /*name_length */ ,
|
---|
503 | const char * /*name */ ,
|
---|
504 | unsigned int /*data_length */ ,
|
---|
505 | char * /*data */ );
|
---|
506 |
|
---|
507 | #ifdef XCSECURITY
|
---|
508 | extern _X_EXPORT XID
|
---|
509 | GenerateAuthorization(unsigned int /* name_length */ ,
|
---|
510 | const char * /* name */ ,
|
---|
511 | unsigned int /* data_length */ ,
|
---|
512 | const char * /* data */ ,
|
---|
513 | unsigned int * /* data_length_return */ ,
|
---|
514 | char ** /* data_return */ );
|
---|
515 | #endif
|
---|
516 |
|
---|
517 | extern _X_EXPORT int
|
---|
518 | ddxProcessArgument(int /*argc */ , char * /*argv */ [], int /*i */ );
|
---|
519 |
|
---|
520 | extern _X_EXPORT void
|
---|
521 | ddxUseMsg(void);
|
---|
522 |
|
---|
523 | /* stuff for ReplyCallback */
|
---|
524 | extern _X_EXPORT CallbackListPtr ReplyCallback;
|
---|
525 | typedef struct {
|
---|
526 | ClientPtr client;
|
---|
527 | const void *replyData;
|
---|
528 | unsigned long dataLenBytes; /* actual bytes from replyData + pad bytes */
|
---|
529 | unsigned long bytesRemaining;
|
---|
530 | Bool startOfReply;
|
---|
531 | unsigned long padBytes; /* pad bytes from zeroed array */
|
---|
532 | } ReplyInfoRec;
|
---|
533 |
|
---|
534 | /* stuff for FlushCallback */
|
---|
535 | extern _X_EXPORT CallbackListPtr FlushCallback;
|
---|
536 |
|
---|
537 | enum ExitCode {
|
---|
538 | EXIT_NO_ERROR = 0,
|
---|
539 | EXIT_ERR_ABORT = 1,
|
---|
540 | EXIT_ERR_CONFIGURE = 2,
|
---|
541 | EXIT_ERR_DRIVERS = 3,
|
---|
542 | };
|
---|
543 |
|
---|
544 | extern _X_EXPORT void
|
---|
545 | AbortDDX(enum ExitCode error);
|
---|
546 | extern _X_EXPORT void
|
---|
547 | ddxGiveUp(enum ExitCode error);
|
---|
548 | extern _X_EXPORT int
|
---|
549 | TimeSinceLastInputEvent(void);
|
---|
550 |
|
---|
551 | /* strcasecmp.c */
|
---|
552 | #ifndef HAVE_STRCASECMP
|
---|
553 | #define strcasecmp xstrcasecmp
|
---|
554 | extern _X_EXPORT int
|
---|
555 | xstrcasecmp(const char *s1, const char *s2);
|
---|
556 | #endif
|
---|
557 |
|
---|
558 | #ifndef HAVE_STRNCASECMP
|
---|
559 | #define strncasecmp xstrncasecmp
|
---|
560 | extern _X_EXPORT int
|
---|
561 | xstrncasecmp(const char *s1, const char *s2, size_t n);
|
---|
562 | #endif
|
---|
563 |
|
---|
564 | #ifndef HAVE_STRCASESTR
|
---|
565 | #define strcasestr xstrcasestr
|
---|
566 | extern _X_EXPORT char *
|
---|
567 | xstrcasestr(const char *s, const char *find);
|
---|
568 | #endif
|
---|
569 |
|
---|
570 | #ifndef HAVE_STRLCPY
|
---|
571 | extern _X_EXPORT size_t
|
---|
572 | strlcpy(char *dst, const char *src, size_t siz);
|
---|
573 | extern _X_EXPORT size_t
|
---|
574 | strlcat(char *dst, const char *src, size_t siz);
|
---|
575 | #endif
|
---|
576 |
|
---|
577 | #ifndef HAVE_STRNDUP
|
---|
578 | extern _X_EXPORT char *
|
---|
579 | strndup(const char *str, size_t n);
|
---|
580 | #endif
|
---|
581 |
|
---|
582 | /* Logging. */
|
---|
583 | typedef enum _LogParameter {
|
---|
584 | XLOG_FLUSH,
|
---|
585 | XLOG_SYNC,
|
---|
586 | XLOG_VERBOSITY,
|
---|
587 | XLOG_FILE_VERBOSITY
|
---|
588 | } LogParameter;
|
---|
589 |
|
---|
590 | /* Flags for log messages. */
|
---|
591 | typedef enum {
|
---|
592 | X_PROBED, /* Value was probed */
|
---|
593 | X_CONFIG, /* Value was given in the config file */
|
---|
594 | X_DEFAULT, /* Value is a default */
|
---|
595 | X_CMDLINE, /* Value was given on the command line */
|
---|
596 | X_NOTICE, /* Notice */
|
---|
597 | X_ERROR, /* Error message */
|
---|
598 | X_WARNING, /* Warning message */
|
---|
599 | X_INFO, /* Informational message */
|
---|
600 | X_NONE, /* No prefix */
|
---|
601 | X_NOT_IMPLEMENTED, /* Not implemented */
|
---|
602 | X_DEBUG, /* Debug message */
|
---|
603 | X_UNKNOWN = -1 /* unknown -- this must always be last */
|
---|
604 | } MessageType;
|
---|
605 |
|
---|
606 | extern _X_EXPORT const char *
|
---|
607 | LogInit(const char *fname, const char *backup);
|
---|
608 | extern _X_EXPORT void
|
---|
609 | LogClose(enum ExitCode error);
|
---|
610 | extern _X_EXPORT Bool
|
---|
611 | LogSetParameter(LogParameter param, int value);
|
---|
612 | extern _X_EXPORT void
|
---|
613 | LogVWrite(int verb, const char *f, va_list args)
|
---|
614 | _X_ATTRIBUTE_PRINTF(2, 0);
|
---|
615 | extern _X_EXPORT void
|
---|
616 | LogWrite(int verb, const char *f, ...)
|
---|
617 | _X_ATTRIBUTE_PRINTF(2, 3);
|
---|
618 | extern _X_EXPORT void
|
---|
619 | LogVMessageVerb(MessageType type, int verb, const char *format, va_list args)
|
---|
620 | _X_ATTRIBUTE_PRINTF(3, 0);
|
---|
621 | extern _X_EXPORT void
|
---|
622 | LogMessageVerb(MessageType type, int verb, const char *format, ...)
|
---|
623 | _X_ATTRIBUTE_PRINTF(3, 4);
|
---|
624 | extern _X_EXPORT void
|
---|
625 | LogMessage(MessageType type, const char *format, ...)
|
---|
626 | _X_ATTRIBUTE_PRINTF(2, 3);
|
---|
627 | extern _X_EXPORT void
|
---|
628 | LogMessageVerbSigSafe(MessageType type, int verb, const char *format, ...)
|
---|
629 | _X_ATTRIBUTE_PRINTF(3, 4);
|
---|
630 | extern _X_EXPORT void
|
---|
631 | LogVMessageVerbSigSafe(MessageType type, int verb, const char *format, va_list args)
|
---|
632 | _X_ATTRIBUTE_PRINTF(3, 0);
|
---|
633 |
|
---|
634 | extern _X_EXPORT void
|
---|
635 | LogVHdrMessageVerb(MessageType type, int verb,
|
---|
636 | const char *msg_format, va_list msg_args,
|
---|
637 | const char *hdr_format, va_list hdr_args)
|
---|
638 | _X_ATTRIBUTE_PRINTF(3, 0)
|
---|
639 | _X_ATTRIBUTE_PRINTF(5, 0);
|
---|
640 | extern _X_EXPORT void
|
---|
641 | LogHdrMessageVerb(MessageType type, int verb,
|
---|
642 | const char *msg_format, va_list msg_args,
|
---|
643 | const char *hdr_format, ...)
|
---|
644 | _X_ATTRIBUTE_PRINTF(3, 0)
|
---|
645 | _X_ATTRIBUTE_PRINTF(5, 6);
|
---|
646 | extern _X_EXPORT void
|
---|
647 | LogHdrMessage(MessageType type, const char *msg_format,
|
---|
648 | va_list msg_args, const char *hdr_format, ...)
|
---|
649 | _X_ATTRIBUTE_PRINTF(2, 0)
|
---|
650 | _X_ATTRIBUTE_PRINTF(4, 5);
|
---|
651 |
|
---|
652 | extern _X_EXPORT void
|
---|
653 | FreeAuditTimer(void);
|
---|
654 | extern _X_EXPORT void
|
---|
655 | AuditF(const char *f, ...)
|
---|
656 | _X_ATTRIBUTE_PRINTF(1, 2);
|
---|
657 | extern _X_EXPORT void
|
---|
658 | VAuditF(const char *f, va_list args)
|
---|
659 | _X_ATTRIBUTE_PRINTF(1, 0);
|
---|
660 | extern _X_EXPORT void
|
---|
661 | FatalError(const char *f, ...)
|
---|
662 | _X_ATTRIBUTE_PRINTF(1, 2)
|
---|
663 | _X_NORETURN;
|
---|
664 |
|
---|
665 | #ifdef DEBUG
|
---|
666 | #define DebugF ErrorF
|
---|
667 | #else
|
---|
668 | #define DebugF(...) /* */
|
---|
669 | #endif
|
---|
670 |
|
---|
671 | extern _X_EXPORT void
|
---|
672 | VErrorF(const char *f, va_list args)
|
---|
673 | _X_ATTRIBUTE_PRINTF(1, 0);
|
---|
674 | extern _X_EXPORT void
|
---|
675 | ErrorF(const char *f, ...)
|
---|
676 | _X_ATTRIBUTE_PRINTF(1, 2);
|
---|
677 | extern _X_EXPORT void
|
---|
678 | VErrorFSigSafe(const char *f, va_list args)
|
---|
679 | _X_ATTRIBUTE_PRINTF(1, 0);
|
---|
680 | extern _X_EXPORT void
|
---|
681 | ErrorFSigSafe(const char *f, ...)
|
---|
682 | _X_ATTRIBUTE_PRINTF(1, 2);
|
---|
683 | extern _X_EXPORT void
|
---|
684 | LogPrintMarkers(void);
|
---|
685 |
|
---|
686 | extern _X_EXPORT void
|
---|
687 | xorg_backtrace(void);
|
---|
688 |
|
---|
689 | extern _X_EXPORT int
|
---|
690 | os_move_fd(int fd);
|
---|
691 |
|
---|
692 | #endif /* OS_H */
|
---|