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