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((pointer)(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((pointer)(ptr), (unsigned long)(size))
|
---|
78 | #define xfree(ptr) Xfree((pointer)(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 | extern _X_EXPORT Bool InsertFakeRequest(ClientPtr /*client */ ,
|
---|
102 | char * /*data */ ,
|
---|
103 | int /*count */ );
|
---|
104 |
|
---|
105 | extern _X_EXPORT void ResetCurrentRequest(ClientPtr /*client */ );
|
---|
106 |
|
---|
107 | extern _X_EXPORT void FlushAllOutput(void);
|
---|
108 |
|
---|
109 | extern _X_EXPORT void FlushIfCriticalOutputPending(void);
|
---|
110 |
|
---|
111 | extern _X_EXPORT void SetCriticalOutputPending(void);
|
---|
112 |
|
---|
113 | extern _X_EXPORT int WriteToClient(ClientPtr /*who */ , int /*count */ ,
|
---|
114 | const void * /*buf */ );
|
---|
115 |
|
---|
116 | extern _X_EXPORT void ResetOsBuffers(void);
|
---|
117 |
|
---|
118 | extern _X_EXPORT void InitConnectionLimits(void);
|
---|
119 |
|
---|
120 | extern _X_EXPORT void NotifyParentProcess(void);
|
---|
121 |
|
---|
122 | extern _X_EXPORT void CreateWellKnownSockets(void);
|
---|
123 |
|
---|
124 | extern _X_EXPORT void ResetWellKnownSockets(void);
|
---|
125 |
|
---|
126 | extern _X_EXPORT void CloseWellKnownConnections(void);
|
---|
127 |
|
---|
128 | extern _X_EXPORT XID AuthorizationIDOfClient(ClientPtr /*client */ );
|
---|
129 |
|
---|
130 | extern _X_EXPORT const char *ClientAuthorized(ClientPtr /*client */ ,
|
---|
131 | unsigned int /*proto_n */ ,
|
---|
132 | char * /*auth_proto */ ,
|
---|
133 | unsigned int /*string_n */ ,
|
---|
134 | char * /*auth_string */ );
|
---|
135 |
|
---|
136 | extern _X_EXPORT Bool EstablishNewConnections(ClientPtr /*clientUnused */ ,
|
---|
137 | pointer /*closure */ );
|
---|
138 |
|
---|
139 | extern _X_EXPORT void CheckConnections(void);
|
---|
140 |
|
---|
141 | extern _X_EXPORT void CloseDownConnection(ClientPtr /*client */ );
|
---|
142 |
|
---|
143 | extern _X_EXPORT void AddGeneralSocket(int /*fd */ );
|
---|
144 |
|
---|
145 | extern _X_EXPORT void RemoveGeneralSocket(int /*fd */ );
|
---|
146 |
|
---|
147 | extern _X_EXPORT void AddEnabledDevice(int /*fd */ );
|
---|
148 |
|
---|
149 | extern _X_EXPORT void RemoveEnabledDevice(int /*fd */ );
|
---|
150 |
|
---|
151 | extern _X_EXPORT int OnlyListenToOneClient(ClientPtr /*client */ );
|
---|
152 |
|
---|
153 | extern _X_EXPORT void ListenToAllClients(void);
|
---|
154 |
|
---|
155 | extern _X_EXPORT void IgnoreClient(ClientPtr /*client */ );
|
---|
156 |
|
---|
157 | extern _X_EXPORT void AttendClient(ClientPtr /*client */ );
|
---|
158 |
|
---|
159 | extern _X_EXPORT void MakeClientGrabImpervious(ClientPtr /*client */ );
|
---|
160 |
|
---|
161 | extern _X_EXPORT void MakeClientGrabPervious(ClientPtr /*client */ );
|
---|
162 |
|
---|
163 | #ifdef XQUARTZ
|
---|
164 | extern void ListenOnOpenFD(int /* fd */ , int /* noxauth */ );
|
---|
165 | #endif
|
---|
166 |
|
---|
167 | extern _X_EXPORT CARD32 GetTimeInMillis(void);
|
---|
168 |
|
---|
169 | extern _X_EXPORT void AdjustWaitForDelay(pointer /*waitTime */ ,
|
---|
170 | unsigned long /*newdelay */ );
|
---|
171 |
|
---|
172 | typedef struct _OsTimerRec *OsTimerPtr;
|
---|
173 |
|
---|
174 | typedef CARD32 (*OsTimerCallback) (OsTimerPtr /* timer */ ,
|
---|
175 | CARD32 /* time */ ,
|
---|
176 | pointer /* arg */ );
|
---|
177 |
|
---|
178 | extern _X_EXPORT void TimerInit(void);
|
---|
179 |
|
---|
180 | extern _X_EXPORT Bool TimerForce(OsTimerPtr /* timer */ );
|
---|
181 |
|
---|
182 | #define TimerAbsolute (1<<0)
|
---|
183 | #define TimerForceOld (1<<1)
|
---|
184 |
|
---|
185 | extern _X_EXPORT OsTimerPtr TimerSet(OsTimerPtr /* timer */ ,
|
---|
186 | int /* flags */ ,
|
---|
187 | CARD32 /* millis */ ,
|
---|
188 | OsTimerCallback /* func */ ,
|
---|
189 | pointer /* arg */ );
|
---|
190 |
|
---|
191 | extern _X_EXPORT void TimerCheck(void);
|
---|
192 | extern _X_EXPORT void TimerCancel(OsTimerPtr /* pTimer */ );
|
---|
193 | extern _X_EXPORT void TimerFree(OsTimerPtr /* pTimer */ );
|
---|
194 |
|
---|
195 | extern _X_EXPORT void SetScreenSaverTimer(void);
|
---|
196 | extern _X_EXPORT void FreeScreenSaverTimer(void);
|
---|
197 |
|
---|
198 | extern _X_EXPORT void AutoResetServer(int /*sig */ );
|
---|
199 |
|
---|
200 | extern _X_EXPORT void GiveUp(int /*sig */ );
|
---|
201 |
|
---|
202 | extern _X_EXPORT void UseMsg(void);
|
---|
203 |
|
---|
204 | extern _X_EXPORT void ProcessCommandLine(int /*argc */ , char * /*argv */ []);
|
---|
205 |
|
---|
206 | extern _X_EXPORT int set_font_authorizations(char ** /* authorizations */ ,
|
---|
207 | int * /*authlen */ ,
|
---|
208 | pointer /* client */ );
|
---|
209 |
|
---|
210 | #ifndef _HAVE_XALLOC_DECLS
|
---|
211 | #define _HAVE_XALLOC_DECLS
|
---|
212 |
|
---|
213 | /*
|
---|
214 | * Use malloc(3) instead.
|
---|
215 | */
|
---|
216 | extern _X_EXPORT void *
|
---|
217 | Xalloc(unsigned long /*amount */ ) _X_DEPRECATED;
|
---|
218 |
|
---|
219 | /*
|
---|
220 | * Use calloc(3) instead
|
---|
221 | */
|
---|
222 | extern _X_EXPORT void *
|
---|
223 | Xcalloc(unsigned long /*amount */ ) _X_DEPRECATED;
|
---|
224 |
|
---|
225 | /*
|
---|
226 | * Use realloc(3) instead
|
---|
227 | */
|
---|
228 | extern _X_EXPORT void *
|
---|
229 | Xrealloc(void * /*ptr */ , unsigned long /*amount */ )
|
---|
230 | _X_DEPRECATED;
|
---|
231 |
|
---|
232 | /*
|
---|
233 | * Use free(3) instead
|
---|
234 | */
|
---|
235 | extern _X_EXPORT void
|
---|
236 | Xfree(void * /*ptr */ )
|
---|
237 | _X_DEPRECATED;
|
---|
238 |
|
---|
239 | #endif
|
---|
240 |
|
---|
241 | /*
|
---|
242 | * This function malloc(3)s buffer, terminating the server if there is not
|
---|
243 | * enough memory.
|
---|
244 | */
|
---|
245 | extern _X_EXPORT void *
|
---|
246 | XNFalloc(unsigned long /*amount */ );
|
---|
247 |
|
---|
248 | /*
|
---|
249 | * This function calloc(3)s buffer, terminating the server if there is not
|
---|
250 | * enough memory.
|
---|
251 | */
|
---|
252 | extern _X_EXPORT void *
|
---|
253 | XNFcalloc(unsigned long /*amount */ );
|
---|
254 |
|
---|
255 | /*
|
---|
256 | * This function realloc(3)s passed buffer, terminating the server if there is
|
---|
257 | * not enough memory.
|
---|
258 | */
|
---|
259 | extern _X_EXPORT void *
|
---|
260 | XNFrealloc(void * /*ptr */ , unsigned long /*amount */ );
|
---|
261 |
|
---|
262 | /*
|
---|
263 | * This function strdup(3)s passed string. The only difference from the library
|
---|
264 | * function that it is safe to pass NULL, as NULL will be returned.
|
---|
265 | */
|
---|
266 | extern _X_EXPORT char *
|
---|
267 | Xstrdup(const char *s);
|
---|
268 |
|
---|
269 | /*
|
---|
270 | * This function strdup(3)s passed string, terminating the server if there is
|
---|
271 | * not enough memory. If NULL is passed to this function, NULL is returned.
|
---|
272 | */
|
---|
273 | extern _X_EXPORT char *
|
---|
274 | XNFstrdup(const char *s);
|
---|
275 |
|
---|
276 | /* Include new X*asprintf API */
|
---|
277 | #include "Xprintf.h"
|
---|
278 |
|
---|
279 | /* Older api deprecated in favor of the asprintf versions */
|
---|
280 | extern _X_EXPORT char *
|
---|
281 | Xprintf(const char *fmt, ...)
|
---|
282 | _X_ATTRIBUTE_PRINTF(1, 2)
|
---|
283 | _X_DEPRECATED;
|
---|
284 | extern _X_EXPORT char *
|
---|
285 | Xvprintf(const char *fmt, va_list va)
|
---|
286 | _X_ATTRIBUTE_PRINTF(1, 0)
|
---|
287 | _X_DEPRECATED;
|
---|
288 | extern _X_EXPORT char *
|
---|
289 | XNFprintf(const char *fmt, ...)
|
---|
290 | _X_ATTRIBUTE_PRINTF(1, 2)
|
---|
291 | _X_DEPRECATED;
|
---|
292 | extern _X_EXPORT char *
|
---|
293 | XNFvprintf(const char *fmt, va_list va)
|
---|
294 | _X_ATTRIBUTE_PRINTF(1, 0)
|
---|
295 | _X_DEPRECATED;
|
---|
296 |
|
---|
297 | typedef void (*OsSigHandlerPtr) (int /* sig */ );
|
---|
298 | typedef int (*OsSigWrapperPtr) (int /* sig */ );
|
---|
299 |
|
---|
300 | extern _X_EXPORT OsSigHandlerPtr
|
---|
301 | OsSignal(int /* sig */ , OsSigHandlerPtr /* handler */ );
|
---|
302 | extern _X_EXPORT OsSigWrapperPtr
|
---|
303 | OsRegisterSigWrapper(OsSigWrapperPtr newWrap);
|
---|
304 |
|
---|
305 | extern _X_EXPORT int auditTrailLevel;
|
---|
306 |
|
---|
307 | extern _X_EXPORT void
|
---|
308 | LockServer(void);
|
---|
309 | extern _X_EXPORT void
|
---|
310 | UnlockServer(void);
|
---|
311 |
|
---|
312 | extern _X_EXPORT int
|
---|
313 | OsLookupColor(int /*screen */ ,
|
---|
314 | char * /*name */ ,
|
---|
315 | unsigned /*len */ ,
|
---|
316 | unsigned short * /*pred */ ,
|
---|
317 | unsigned short * /*pgreen */ ,
|
---|
318 | unsigned short * /*pblue */ );
|
---|
319 |
|
---|
320 | extern _X_EXPORT void
|
---|
321 | OsInit(void);
|
---|
322 |
|
---|
323 | extern _X_EXPORT void
|
---|
324 | OsCleanup(Bool);
|
---|
325 |
|
---|
326 | extern _X_EXPORT void
|
---|
327 | OsVendorFatalError(const char *f, va_list args)
|
---|
328 | _X_ATTRIBUTE_PRINTF(1, 0);
|
---|
329 |
|
---|
330 | extern _X_EXPORT void
|
---|
331 | OsVendorInit(void);
|
---|
332 |
|
---|
333 | extern _X_EXPORT void
|
---|
334 | OsBlockSignals(void);
|
---|
335 |
|
---|
336 | extern _X_EXPORT void
|
---|
337 | OsReleaseSignals(void);
|
---|
338 |
|
---|
339 | extern _X_EXPORT int
|
---|
340 | OsBlockSIGIO(void);
|
---|
341 |
|
---|
342 | extern _X_EXPORT void
|
---|
343 | OsReleaseSIGIO(void);
|
---|
344 |
|
---|
345 | extern void
|
---|
346 | OsResetSignals(void);
|
---|
347 |
|
---|
348 | extern _X_EXPORT void
|
---|
349 | OsAbort(void)
|
---|
350 | _X_NORETURN;
|
---|
351 |
|
---|
352 | #if !defined(WIN32)
|
---|
353 | extern _X_EXPORT int
|
---|
354 | System(const char *);
|
---|
355 | extern _X_EXPORT pointer
|
---|
356 | Popen(const char *, const char *);
|
---|
357 | extern _X_EXPORT int
|
---|
358 | Pclose(pointer);
|
---|
359 | extern _X_EXPORT pointer
|
---|
360 | Fopen(const char *, const char *);
|
---|
361 | extern _X_EXPORT int
|
---|
362 | Fclose(pointer);
|
---|
363 | #else
|
---|
364 |
|
---|
365 | extern const char *
|
---|
366 | Win32TempDir(void);
|
---|
367 |
|
---|
368 | extern int
|
---|
369 | System(const char *cmdline);
|
---|
370 |
|
---|
371 | #define Fopen(a,b) fopen(a,b)
|
---|
372 | #define Fclose(a) fclose(a)
|
---|
373 | #endif
|
---|
374 |
|
---|
375 | extern _X_EXPORT void
|
---|
376 | CheckUserParameters(int argc, char **argv, char **envp);
|
---|
377 | extern _X_EXPORT void
|
---|
378 | CheckUserAuthorization(void);
|
---|
379 |
|
---|
380 | extern _X_EXPORT int
|
---|
381 | AddHost(ClientPtr /*client */ ,
|
---|
382 | int /*family */ ,
|
---|
383 | unsigned /*length */ ,
|
---|
384 | const void * /*pAddr */ );
|
---|
385 |
|
---|
386 | extern _X_EXPORT Bool
|
---|
387 | ForEachHostInFamily(int /*family */ ,
|
---|
388 | Bool (* /*func */ )(
|
---|
389 | unsigned char * /* addr */ ,
|
---|
390 | short /* len */ ,
|
---|
391 | pointer /* closure */ ),
|
---|
392 | pointer /*closure */ );
|
---|
393 |
|
---|
394 | extern _X_EXPORT int
|
---|
395 | RemoveHost(ClientPtr /*client */ ,
|
---|
396 | int /*family */ ,
|
---|
397 | unsigned /*length */ ,
|
---|
398 | pointer /*pAddr */ );
|
---|
399 |
|
---|
400 | extern _X_EXPORT int
|
---|
401 | GetHosts(pointer * /*data */ ,
|
---|
402 | int * /*pnHosts */ ,
|
---|
403 | int * /*pLen */ ,
|
---|
404 | BOOL * /*pEnabled */ );
|
---|
405 |
|
---|
406 | typedef struct sockaddr *sockaddrPtr;
|
---|
407 |
|
---|
408 | extern _X_EXPORT int
|
---|
409 | InvalidHost(sockaddrPtr /*saddr */ , int /*len */ , ClientPtr client);
|
---|
410 |
|
---|
411 | extern _X_EXPORT int
|
---|
412 | LocalClientCred(ClientPtr, int *, int *);
|
---|
413 |
|
---|
414 | #define LCC_UID_SET (1 << 0)
|
---|
415 | #define LCC_GID_SET (1 << 1)
|
---|
416 | #define LCC_PID_SET (1 << 2)
|
---|
417 | #define LCC_ZID_SET (1 << 3)
|
---|
418 |
|
---|
419 | typedef struct {
|
---|
420 | int fieldsSet; /* Bit mask of fields set */
|
---|
421 | int euid; /* Effective uid */
|
---|
422 | int egid; /* Primary effective group id */
|
---|
423 | int nSuppGids; /* Number of supplementary group ids */
|
---|
424 | int *pSuppGids; /* Array of supplementary group ids */
|
---|
425 | int pid; /* Process id */
|
---|
426 | int zoneid; /* Only set on Solaris 10 & later */
|
---|
427 | } LocalClientCredRec;
|
---|
428 |
|
---|
429 | extern _X_EXPORT int
|
---|
430 | GetLocalClientCreds(ClientPtr, LocalClientCredRec **);
|
---|
431 | extern _X_EXPORT void
|
---|
432 | FreeLocalClientCreds(LocalClientCredRec *);
|
---|
433 |
|
---|
434 | extern _X_EXPORT int
|
---|
435 | ChangeAccessControl(ClientPtr /*client */ , int /*fEnabled */ );
|
---|
436 |
|
---|
437 | extern _X_EXPORT int
|
---|
438 | GetAccessControl(void);
|
---|
439 |
|
---|
440 | extern _X_EXPORT void
|
---|
441 | AddLocalHosts(void);
|
---|
442 |
|
---|
443 | extern _X_EXPORT void
|
---|
444 | ResetHosts(char *display);
|
---|
445 |
|
---|
446 | extern _X_EXPORT void
|
---|
447 | EnableLocalHost(void);
|
---|
448 |
|
---|
449 | extern _X_EXPORT void
|
---|
450 | DisableLocalHost(void);
|
---|
451 |
|
---|
452 | extern _X_EXPORT void
|
---|
453 | AccessUsingXdmcp(void);
|
---|
454 |
|
---|
455 | extern _X_EXPORT void
|
---|
456 | DefineSelf(int /*fd */ );
|
---|
457 |
|
---|
458 | #if XDMCP
|
---|
459 | extern _X_EXPORT void
|
---|
460 | AugmentSelf(pointer /*from */ , int /*len */ );
|
---|
461 |
|
---|
462 | extern _X_EXPORT void
|
---|
463 | RegisterAuthorizations(void);
|
---|
464 | #endif
|
---|
465 |
|
---|
466 | extern _X_EXPORT void
|
---|
467 | InitAuthorization(char * /*filename */ );
|
---|
468 |
|
---|
469 | /* extern int LoadAuthorization(void); */
|
---|
470 |
|
---|
471 | extern _X_EXPORT int
|
---|
472 | AuthorizationFromID(XID id,
|
---|
473 | unsigned short *name_lenp,
|
---|
474 | const char **namep,
|
---|
475 | unsigned short *data_lenp, char **datap);
|
---|
476 |
|
---|
477 | extern _X_EXPORT XID
|
---|
478 | CheckAuthorization(unsigned int /*namelength */ ,
|
---|
479 | const char * /*name */ ,
|
---|
480 | unsigned int /*datalength */ ,
|
---|
481 | const char * /*data */ ,
|
---|
482 | ClientPtr /*client */ ,
|
---|
483 | const char ** /*reason */
|
---|
484 | );
|
---|
485 |
|
---|
486 | extern _X_EXPORT void
|
---|
487 | ResetAuthorization(void);
|
---|
488 |
|
---|
489 | extern _X_EXPORT int
|
---|
490 | RemoveAuthorization(unsigned short name_length,
|
---|
491 | const char *name,
|
---|
492 | unsigned short data_length, const char *data);
|
---|
493 |
|
---|
494 | extern _X_EXPORT int
|
---|
495 | AddAuthorization(unsigned int /*name_length */ ,
|
---|
496 | const char * /*name */ ,
|
---|
497 | unsigned int /*data_length */ ,
|
---|
498 | char * /*data */ );
|
---|
499 |
|
---|
500 | #ifdef XCSECURITY
|
---|
501 | extern _X_EXPORT XID
|
---|
502 | GenerateAuthorization(unsigned int /* name_length */ ,
|
---|
503 | const char * /* name */ ,
|
---|
504 | unsigned int /* data_length */ ,
|
---|
505 | const char * /* data */ ,
|
---|
506 | unsigned int * /* data_length_return */ ,
|
---|
507 | char ** /* data_return */ );
|
---|
508 | #endif
|
---|
509 |
|
---|
510 | extern _X_EXPORT int
|
---|
511 | ddxProcessArgument(int /*argc */ , char * /*argv */ [], int /*i */ );
|
---|
512 |
|
---|
513 | extern _X_EXPORT void
|
---|
514 | ddxUseMsg(void);
|
---|
515 |
|
---|
516 | /* stuff for ReplyCallback */
|
---|
517 | extern _X_EXPORT CallbackListPtr ReplyCallback;
|
---|
518 | typedef struct {
|
---|
519 | ClientPtr client;
|
---|
520 | const void *replyData;
|
---|
521 | unsigned long dataLenBytes; /* actual bytes from replyData + pad bytes */
|
---|
522 | unsigned long bytesRemaining;
|
---|
523 | Bool startOfReply;
|
---|
524 | unsigned long padBytes; /* pad bytes from zeroed array */
|
---|
525 | } ReplyInfoRec;
|
---|
526 |
|
---|
527 | /* stuff for FlushCallback */
|
---|
528 | extern _X_EXPORT CallbackListPtr FlushCallback;
|
---|
529 |
|
---|
530 | enum ExitCode {
|
---|
531 | EXIT_NO_ERROR = 0,
|
---|
532 | EXIT_ERR_ABORT = 1,
|
---|
533 | EXIT_ERR_CONFIGURE = 2,
|
---|
534 | EXIT_ERR_DRIVERS = 3,
|
---|
535 | };
|
---|
536 |
|
---|
537 | extern _X_EXPORT void
|
---|
538 | AbortDDX(enum ExitCode error);
|
---|
539 | extern _X_EXPORT void
|
---|
540 | ddxGiveUp(enum ExitCode error);
|
---|
541 | extern _X_EXPORT int
|
---|
542 | TimeSinceLastInputEvent(void);
|
---|
543 |
|
---|
544 | /* strcasecmp.c */
|
---|
545 | #ifndef HAVE_STRCASECMP
|
---|
546 | #define strcasecmp xstrcasecmp
|
---|
547 | extern _X_EXPORT int
|
---|
548 | xstrcasecmp(const char *s1, const char *s2);
|
---|
549 | #endif
|
---|
550 |
|
---|
551 | #ifndef HAVE_STRNCASECMP
|
---|
552 | #define strncasecmp xstrncasecmp
|
---|
553 | extern _X_EXPORT int
|
---|
554 | xstrncasecmp(const char *s1, const char *s2, size_t n);
|
---|
555 | #endif
|
---|
556 |
|
---|
557 | #ifndef HAVE_STRCASESTR
|
---|
558 | #define strcasestr xstrcasestr
|
---|
559 | extern _X_EXPORT char *
|
---|
560 | xstrcasestr(const char *s, const char *find);
|
---|
561 | #endif
|
---|
562 |
|
---|
563 | #ifndef HAVE_STRLCPY
|
---|
564 | extern _X_EXPORT size_t
|
---|
565 | strlcpy(char *dst, const char *src, size_t siz);
|
---|
566 | extern _X_EXPORT size_t
|
---|
567 | strlcat(char *dst, const char *src, size_t siz);
|
---|
568 | #endif
|
---|
569 |
|
---|
570 | #ifndef HAVE_STRNDUP
|
---|
571 | extern _X_EXPORT char *
|
---|
572 | strndup(const char *str, size_t n);
|
---|
573 | #endif
|
---|
574 |
|
---|
575 | /* Logging. */
|
---|
576 | typedef enum _LogParameter {
|
---|
577 | XLOG_FLUSH,
|
---|
578 | XLOG_SYNC,
|
---|
579 | XLOG_VERBOSITY,
|
---|
580 | XLOG_FILE_VERBOSITY
|
---|
581 | } LogParameter;
|
---|
582 |
|
---|
583 | /* Flags for log messages. */
|
---|
584 | typedef enum {
|
---|
585 | X_PROBED, /* Value was probed */
|
---|
586 | X_CONFIG, /* Value was given in the config file */
|
---|
587 | X_DEFAULT, /* Value is a default */
|
---|
588 | X_CMDLINE, /* Value was given on the command line */
|
---|
589 | X_NOTICE, /* Notice */
|
---|
590 | X_ERROR, /* Error message */
|
---|
591 | X_WARNING, /* Warning message */
|
---|
592 | X_INFO, /* Informational message */
|
---|
593 | X_NONE, /* No prefix */
|
---|
594 | X_NOT_IMPLEMENTED, /* Not implemented */
|
---|
595 | X_DEBUG, /* Debug message */
|
---|
596 | X_UNKNOWN = -1 /* unknown -- this must always be last */
|
---|
597 | } MessageType;
|
---|
598 |
|
---|
599 | extern _X_EXPORT const char *
|
---|
600 | LogInit(const char *fname, const char *backup);
|
---|
601 | extern _X_EXPORT void
|
---|
602 | LogClose(enum ExitCode error);
|
---|
603 | extern _X_EXPORT Bool
|
---|
604 | LogSetParameter(LogParameter param, int value);
|
---|
605 | extern _X_EXPORT void
|
---|
606 | LogVWrite(int verb, const char *f, va_list args)
|
---|
607 | _X_ATTRIBUTE_PRINTF(2, 0);
|
---|
608 | extern _X_EXPORT void
|
---|
609 | LogWrite(int verb, const char *f, ...)
|
---|
610 | _X_ATTRIBUTE_PRINTF(2, 3);
|
---|
611 | extern _X_EXPORT void
|
---|
612 | LogVMessageVerb(MessageType type, int verb, const char *format, va_list args)
|
---|
613 | _X_ATTRIBUTE_PRINTF(3, 0);
|
---|
614 | extern _X_EXPORT void
|
---|
615 | LogMessageVerb(MessageType type, int verb, const char *format, ...)
|
---|
616 | _X_ATTRIBUTE_PRINTF(3, 4);
|
---|
617 | extern _X_EXPORT void
|
---|
618 | LogMessage(MessageType type, const char *format, ...)
|
---|
619 | _X_ATTRIBUTE_PRINTF(2, 3);
|
---|
620 | extern _X_EXPORT void
|
---|
621 | LogMessageVerbSigSafe(MessageType type, int verb, const char *format, ...)
|
---|
622 | _X_ATTRIBUTE_PRINTF(3, 4);
|
---|
623 | extern _X_EXPORT void
|
---|
624 | LogVMessageVerbSigSafe(MessageType type, int verb, const char *format, va_list args)
|
---|
625 | _X_ATTRIBUTE_PRINTF(3, 0);
|
---|
626 |
|
---|
627 | extern _X_EXPORT void
|
---|
628 | LogVHdrMessageVerb(MessageType type, int verb,
|
---|
629 | const char *msg_format, va_list msg_args,
|
---|
630 | const char *hdr_format, va_list hdr_args)
|
---|
631 | _X_ATTRIBUTE_PRINTF(3, 0)
|
---|
632 | _X_ATTRIBUTE_PRINTF(5, 0);
|
---|
633 | extern _X_EXPORT void
|
---|
634 | LogHdrMessageVerb(MessageType type, int verb,
|
---|
635 | const char *msg_format, va_list msg_args,
|
---|
636 | const char *hdr_format, ...)
|
---|
637 | _X_ATTRIBUTE_PRINTF(3, 0)
|
---|
638 | _X_ATTRIBUTE_PRINTF(5, 6);
|
---|
639 | extern _X_EXPORT void
|
---|
640 | LogHdrMessage(MessageType type, const char *msg_format,
|
---|
641 | va_list msg_args, const char *hdr_format, ...)
|
---|
642 | _X_ATTRIBUTE_PRINTF(2, 0)
|
---|
643 | _X_ATTRIBUTE_PRINTF(4, 5);
|
---|
644 |
|
---|
645 | extern _X_EXPORT void
|
---|
646 | FreeAuditTimer(void);
|
---|
647 | extern _X_EXPORT void
|
---|
648 | AuditF(const char *f, ...)
|
---|
649 | _X_ATTRIBUTE_PRINTF(1, 2);
|
---|
650 | extern _X_EXPORT void
|
---|
651 | VAuditF(const char *f, va_list args)
|
---|
652 | _X_ATTRIBUTE_PRINTF(1, 0);
|
---|
653 | extern _X_EXPORT void
|
---|
654 | FatalError(const char *f, ...)
|
---|
655 | _X_ATTRIBUTE_PRINTF(1, 2)
|
---|
656 | _X_NORETURN;
|
---|
657 |
|
---|
658 | #ifdef DEBUG
|
---|
659 | #define DebugF ErrorF
|
---|
660 | #else
|
---|
661 | #define DebugF(...) /* */
|
---|
662 | #endif
|
---|
663 |
|
---|
664 | extern _X_EXPORT void
|
---|
665 | VErrorF(const char *f, va_list args)
|
---|
666 | _X_ATTRIBUTE_PRINTF(1, 0);
|
---|
667 | extern _X_EXPORT void
|
---|
668 | ErrorF(const char *f, ...)
|
---|
669 | _X_ATTRIBUTE_PRINTF(1, 2);
|
---|
670 | extern _X_EXPORT void
|
---|
671 | VErrorFSigSafe(const char *f, va_list args)
|
---|
672 | _X_ATTRIBUTE_PRINTF(1, 0);
|
---|
673 | extern _X_EXPORT void
|
---|
674 | ErrorFSigSafe(const char *f, ...)
|
---|
675 | _X_ATTRIBUTE_PRINTF(1, 2);
|
---|
676 | extern _X_EXPORT void
|
---|
677 | LogPrintMarkers(void);
|
---|
678 |
|
---|
679 | extern _X_EXPORT void
|
---|
680 | xorg_backtrace(void);
|
---|
681 |
|
---|
682 | #endif /* OS_H */
|
---|