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