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 |
|
---|
26 | Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
---|
27 |
|
---|
28 | All Rights Reserved
|
---|
29 |
|
---|
30 | Permission to use, copy, modify, and distribute this software and its
|
---|
31 | documentation for any purpose and without fee is hereby granted,
|
---|
32 | provided that the above copyright notice appear in all copies and that
|
---|
33 | both that copyright notice and this permission notice appear in
|
---|
34 | supporting documentation, and that the name of Digital not be
|
---|
35 | used in advertising or publicity pertaining to distribution of the
|
---|
36 | software without specific, written prior permission.
|
---|
37 |
|
---|
38 | DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
---|
39 | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
---|
40 | DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
---|
41 | ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
---|
42 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
---|
43 | ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
---|
44 | SOFTWARE.
|
---|
45 |
|
---|
46 | ******************************************************************/
|
---|
47 |
|
---|
48 |
|
---|
49 | #ifndef OS_H
|
---|
50 | #define OS_H
|
---|
51 |
|
---|
52 | #include "misc.h"
|
---|
53 | #include <stdarg.h>
|
---|
54 | #include <string.h>
|
---|
55 |
|
---|
56 | #define SCREEN_SAVER_ON 0
|
---|
57 | #define SCREEN_SAVER_OFF 1
|
---|
58 | #define SCREEN_SAVER_FORCER 2
|
---|
59 | #define SCREEN_SAVER_CYCLE 3
|
---|
60 |
|
---|
61 | #ifndef MAX_REQUEST_SIZE
|
---|
62 | #define MAX_REQUEST_SIZE 65535
|
---|
63 | #endif
|
---|
64 | #ifndef MAX_BIG_REQUEST_SIZE
|
---|
65 | #define MAX_BIG_REQUEST_SIZE 4194303
|
---|
66 | #endif
|
---|
67 |
|
---|
68 | typedef struct _FontPathRec *FontPathPtr;
|
---|
69 | typedef struct _NewClientRec *NewClientPtr;
|
---|
70 |
|
---|
71 | #ifndef xalloc
|
---|
72 | #define xnfalloc(size) XNFalloc((unsigned long)(size))
|
---|
73 | #define xnfcalloc(_num, _size) XNFcalloc((unsigned long)(_num)*(unsigned long)(_size))
|
---|
74 | #define xnfrealloc(ptr, size) XNFrealloc((pointer)(ptr), (unsigned long)(size))
|
---|
75 |
|
---|
76 | #define xalloc(size) Xalloc((unsigned long)(size))
|
---|
77 | #define xcalloc(_num, _size) Xcalloc((unsigned long)(_num)*(unsigned long)(_size))
|
---|
78 | #define xrealloc(ptr, size) Xrealloc((pointer)(ptr), (unsigned long)(size))
|
---|
79 | #define xfree(ptr) Xfree((pointer)(ptr))
|
---|
80 | #define xstrdup(s) Xstrdup(s)
|
---|
81 | #define xnfstrdup(s) XNFstrdup(s)
|
---|
82 | #endif
|
---|
83 |
|
---|
84 | #include <stdio.h>
|
---|
85 | #include <stdarg.h>
|
---|
86 |
|
---|
87 | #ifdef DDXBEFORERESET
|
---|
88 | extern void ddxBeforeReset (void);
|
---|
89 | #endif
|
---|
90 |
|
---|
91 | #ifdef DDXOSVERRORF
|
---|
92 | extern _X_EXPORT void (*OsVendorVErrorFProc)(const char *, va_list args);
|
---|
93 | #endif
|
---|
94 |
|
---|
95 | extern _X_EXPORT int WaitForSomething(
|
---|
96 | int* /*pClientsReady*/
|
---|
97 | );
|
---|
98 |
|
---|
99 | extern _X_EXPORT int ReadRequestFromClient(ClientPtr /*client*/);
|
---|
100 |
|
---|
101 | extern _X_EXPORT Bool InsertFakeRequest(
|
---|
102 | ClientPtr /*client*/,
|
---|
103 | char* /*data*/,
|
---|
104 | int /*count*/);
|
---|
105 |
|
---|
106 | extern _X_EXPORT void ResetCurrentRequest(ClientPtr /*client*/);
|
---|
107 |
|
---|
108 | extern _X_EXPORT void FlushAllOutput(void);
|
---|
109 |
|
---|
110 | extern _X_EXPORT void FlushIfCriticalOutputPending(void);
|
---|
111 |
|
---|
112 | extern _X_EXPORT void SetCriticalOutputPending(void);
|
---|
113 |
|
---|
114 | extern _X_EXPORT int WriteToClient(ClientPtr /*who*/, int /*count*/, 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(
|
---|
131 | ClientPtr /*client*/,
|
---|
132 | unsigned int /*proto_n*/,
|
---|
133 | char* /*auth_proto*/,
|
---|
134 | unsigned int /*string_n*/,
|
---|
135 | char* /*auth_string*/);
|
---|
136 |
|
---|
137 | extern _X_EXPORT Bool EstablishNewConnections(
|
---|
138 | ClientPtr /*clientUnused*/,
|
---|
139 | pointer /*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 | #ifdef XQUARTZ
|
---|
166 | extern void ListenOnOpenFD(int /* fd */, int /* noxauth */);
|
---|
167 | #endif
|
---|
168 |
|
---|
169 | extern _X_EXPORT CARD32 GetTimeInMillis(void);
|
---|
170 |
|
---|
171 | extern _X_EXPORT void AdjustWaitForDelay(
|
---|
172 | pointer /*waitTime*/,
|
---|
173 | unsigned long /*newdelay*/);
|
---|
174 |
|
---|
175 | typedef struct _OsTimerRec *OsTimerPtr;
|
---|
176 |
|
---|
177 | typedef CARD32 (*OsTimerCallback)(
|
---|
178 | OsTimerPtr /* timer */,
|
---|
179 | CARD32 /* time */,
|
---|
180 | pointer /* arg */);
|
---|
181 |
|
---|
182 | extern _X_EXPORT void TimerInit(void);
|
---|
183 |
|
---|
184 | extern _X_EXPORT Bool TimerForce(OsTimerPtr /* timer */);
|
---|
185 |
|
---|
186 | #define TimerAbsolute (1<<0)
|
---|
187 | #define TimerForceOld (1<<1)
|
---|
188 |
|
---|
189 | extern _X_EXPORT OsTimerPtr TimerSet(
|
---|
190 | OsTimerPtr /* timer */,
|
---|
191 | int /* flags */,
|
---|
192 | CARD32 /* millis */,
|
---|
193 | OsTimerCallback /* func */,
|
---|
194 | pointer /* arg */);
|
---|
195 |
|
---|
196 | extern _X_EXPORT void TimerCheck(void);
|
---|
197 | extern _X_EXPORT void TimerCancel(OsTimerPtr /* pTimer */);
|
---|
198 | extern _X_EXPORT void TimerFree(OsTimerPtr /* pTimer */);
|
---|
199 |
|
---|
200 | extern _X_EXPORT void SetScreenSaverTimer(void);
|
---|
201 | extern _X_EXPORT void FreeScreenSaverTimer(void);
|
---|
202 |
|
---|
203 | extern _X_EXPORT void AutoResetServer(int /*sig*/);
|
---|
204 |
|
---|
205 | extern _X_EXPORT void GiveUp(int /*sig*/);
|
---|
206 |
|
---|
207 | extern _X_EXPORT void UseMsg(void);
|
---|
208 |
|
---|
209 | extern _X_EXPORT void ProcessCommandLine(int /*argc*/, char* /*argv*/[]);
|
---|
210 |
|
---|
211 | extern _X_EXPORT int set_font_authorizations(
|
---|
212 | char ** /* authorizations */,
|
---|
213 | int * /*authlen */,
|
---|
214 | pointer /* client */);
|
---|
215 |
|
---|
216 | #ifndef _HAVE_XALLOC_DECLS
|
---|
217 | #define _HAVE_XALLOC_DECLS
|
---|
218 |
|
---|
219 | /*
|
---|
220 | * Use malloc(3) instead.
|
---|
221 | */
|
---|
222 | extern _X_EXPORT void *Xalloc(unsigned long /*amount*/) _X_DEPRECATED;
|
---|
223 | /*
|
---|
224 | * Use calloc(3) instead
|
---|
225 | */
|
---|
226 | extern _X_EXPORT void *Xcalloc(unsigned long /*amount*/) _X_DEPRECATED;
|
---|
227 | /*
|
---|
228 | * Use realloc(3) instead
|
---|
229 | */
|
---|
230 | extern _X_EXPORT void *Xrealloc(void * /*ptr*/, unsigned long /*amount*/)
|
---|
231 | _X_DEPRECATED;
|
---|
232 | /*
|
---|
233 | * Use free(3) instead
|
---|
234 | */
|
---|
235 | extern _X_EXPORT void Xfree(void * /*ptr*/) _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 *XNFalloc(unsigned long /*amount*/);
|
---|
244 | /*
|
---|
245 | * This function calloc(3)s buffer, terminating the server if there is not
|
---|
246 | * enough memory.
|
---|
247 | */
|
---|
248 | extern _X_EXPORT void *XNFcalloc(unsigned long /*amount*/);
|
---|
249 | /*
|
---|
250 | * This function realloc(3)s passed buffer, terminating the server if there is
|
---|
251 | * not enough memory.
|
---|
252 | */
|
---|
253 | extern _X_EXPORT void *XNFrealloc(void * /*ptr*/, unsigned long /*amount*/);
|
---|
254 |
|
---|
255 | /*
|
---|
256 | * This function strdup(3)s passed string. The only difference from the library
|
---|
257 | * function that it is safe to pass NULL, as NULL will be returned.
|
---|
258 | */
|
---|
259 | extern _X_EXPORT char *Xstrdup(const char *s);
|
---|
260 |
|
---|
261 | /*
|
---|
262 | * This function strdup(3)s passed string, terminating the server if there is
|
---|
263 | * not enough memory. If NULL is passed to this function, NULL is returned.
|
---|
264 | */
|
---|
265 | extern _X_EXPORT char *XNFstrdup(const char *s);
|
---|
266 |
|
---|
267 | /* Include new X*asprintf API */
|
---|
268 | #include "Xprintf.h"
|
---|
269 |
|
---|
270 | /* Older api deprecated in favor of the asprintf versions */
|
---|
271 | extern _X_EXPORT char *Xprintf(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1,2) _X_DEPRECATED;
|
---|
272 | extern _X_EXPORT char *Xvprintf(const char *fmt, va_list va)_X_ATTRIBUTE_PRINTF(1,0) _X_DEPRECATED;
|
---|
273 | extern _X_EXPORT char *XNFprintf(const char *fmt, ...) _X_ATTRIBUTE_PRINTF(1,2) _X_DEPRECATED;
|
---|
274 | extern _X_EXPORT char *XNFvprintf(const char *fmt, va_list va)_X_ATTRIBUTE_PRINTF(1,0) _X_DEPRECATED;
|
---|
275 |
|
---|
276 | typedef void (*OsSigHandlerPtr)(int /* sig */);
|
---|
277 | typedef int (*OsSigWrapperPtr)(int /* sig */);
|
---|
278 |
|
---|
279 | extern _X_EXPORT OsSigHandlerPtr OsSignal(int /* sig */, OsSigHandlerPtr /* handler */);
|
---|
280 | extern _X_EXPORT OsSigWrapperPtr OsRegisterSigWrapper(OsSigWrapperPtr newWrap);
|
---|
281 |
|
---|
282 | extern _X_EXPORT int auditTrailLevel;
|
---|
283 |
|
---|
284 | extern _X_EXPORT void LockServer(void);
|
---|
285 | extern _X_EXPORT void UnlockServer(void);
|
---|
286 |
|
---|
287 | extern _X_EXPORT int OsLookupColor(
|
---|
288 | int /*screen*/,
|
---|
289 | char * /*name*/,
|
---|
290 | unsigned /*len*/,
|
---|
291 | unsigned short * /*pred*/,
|
---|
292 | unsigned short * /*pgreen*/,
|
---|
293 | unsigned short * /*pblue*/);
|
---|
294 |
|
---|
295 | extern _X_EXPORT void OsInit(void);
|
---|
296 |
|
---|
297 | extern _X_EXPORT void OsCleanup(Bool);
|
---|
298 |
|
---|
299 | extern _X_EXPORT void OsVendorFatalError(void);
|
---|
300 |
|
---|
301 | extern _X_EXPORT void OsVendorInit(void);
|
---|
302 |
|
---|
303 | extern _X_EXPORT void OsBlockSignals (void);
|
---|
304 |
|
---|
305 | extern _X_EXPORT void OsReleaseSignals (void);
|
---|
306 |
|
---|
307 | extern _X_EXPORT void OsAbort (void) _X_NORETURN;
|
---|
308 |
|
---|
309 | #if !defined(WIN32)
|
---|
310 | extern _X_EXPORT int System(const char *);
|
---|
311 | extern _X_EXPORT pointer Popen(const char *, const char *);
|
---|
312 | extern _X_EXPORT int Pclose(pointer);
|
---|
313 | extern _X_EXPORT pointer Fopen(const char *, const char *);
|
---|
314 | extern _X_EXPORT int Fclose(pointer);
|
---|
315 | #else
|
---|
316 | #define System(a) system(a)
|
---|
317 | #define Popen(a,b) popen(a,b)
|
---|
318 | #define Pclose(a) pclose(a)
|
---|
319 | #define Fopen(a,b) fopen(a,b)
|
---|
320 | #define Fclose(a) fclose(a)
|
---|
321 | #endif
|
---|
322 |
|
---|
323 | extern _X_EXPORT void CheckUserParameters(int argc, char **argv, char **envp);
|
---|
324 | extern _X_EXPORT void CheckUserAuthorization(void);
|
---|
325 |
|
---|
326 | extern _X_EXPORT int AddHost(
|
---|
327 | ClientPtr /*client*/,
|
---|
328 | int /*family*/,
|
---|
329 | unsigned /*length*/,
|
---|
330 | const void */*pAddr*/);
|
---|
331 |
|
---|
332 | extern _X_EXPORT Bool ForEachHostInFamily (
|
---|
333 | int /*family*/,
|
---|
334 | Bool (* /*func*/ )(
|
---|
335 | unsigned char * /* addr */,
|
---|
336 | short /* len */,
|
---|
337 | pointer /* closure */),
|
---|
338 | pointer /*closure*/);
|
---|
339 |
|
---|
340 | extern _X_EXPORT int RemoveHost(
|
---|
341 | ClientPtr /*client*/,
|
---|
342 | int /*family*/,
|
---|
343 | unsigned /*length*/,
|
---|
344 | pointer /*pAddr*/);
|
---|
345 |
|
---|
346 | extern _X_EXPORT int GetHosts(
|
---|
347 | pointer * /*data*/,
|
---|
348 | int * /*pnHosts*/,
|
---|
349 | int * /*pLen*/,
|
---|
350 | BOOL * /*pEnabled*/);
|
---|
351 |
|
---|
352 | typedef struct sockaddr * sockaddrPtr;
|
---|
353 |
|
---|
354 | extern _X_EXPORT int InvalidHost(sockaddrPtr /*saddr*/, int /*len*/, ClientPtr client);
|
---|
355 |
|
---|
356 | extern _X_EXPORT int LocalClient(ClientPtr /* client */);
|
---|
357 |
|
---|
358 | extern _X_EXPORT int LocalClientCred(ClientPtr, int *, int *);
|
---|
359 |
|
---|
360 | #define LCC_UID_SET (1 << 0)
|
---|
361 | #define LCC_GID_SET (1 << 1)
|
---|
362 | #define LCC_PID_SET (1 << 2)
|
---|
363 | #define LCC_ZID_SET (1 << 3)
|
---|
364 |
|
---|
365 | typedef struct {
|
---|
366 | int fieldsSet; /* Bit mask of fields set */
|
---|
367 | int euid; /* Effective uid */
|
---|
368 | int egid; /* Primary effective group id */
|
---|
369 | int nSuppGids; /* Number of supplementary group ids */
|
---|
370 | int *pSuppGids; /* Array of supplementary group ids */
|
---|
371 | int pid; /* Process id */
|
---|
372 | int zoneid; /* Only set on Solaris 10 & later */
|
---|
373 | } LocalClientCredRec;
|
---|
374 |
|
---|
375 | extern _X_EXPORT int GetLocalClientCreds(ClientPtr, LocalClientCredRec **);
|
---|
376 | extern _X_EXPORT void FreeLocalClientCreds(LocalClientCredRec *);
|
---|
377 |
|
---|
378 | extern _X_EXPORT int ChangeAccessControl(ClientPtr /*client*/, int /*fEnabled*/);
|
---|
379 |
|
---|
380 | extern _X_EXPORT int GetAccessControl(void);
|
---|
381 |
|
---|
382 |
|
---|
383 | extern _X_EXPORT void AddLocalHosts(void);
|
---|
384 |
|
---|
385 | extern _X_EXPORT void ResetHosts(char *display);
|
---|
386 |
|
---|
387 | extern _X_EXPORT void EnableLocalHost(void);
|
---|
388 |
|
---|
389 | extern _X_EXPORT void DisableLocalHost(void);
|
---|
390 |
|
---|
391 | extern _X_EXPORT void AccessUsingXdmcp(void);
|
---|
392 |
|
---|
393 | extern _X_EXPORT void DefineSelf(int /*fd*/);
|
---|
394 |
|
---|
395 | #if XDMCP
|
---|
396 | extern _X_EXPORT void AugmentSelf(pointer /*from*/, int /*len*/);
|
---|
397 |
|
---|
398 | extern _X_EXPORT void RegisterAuthorizations(void);
|
---|
399 | #endif
|
---|
400 |
|
---|
401 | extern _X_EXPORT void InitAuthorization(char * /*filename*/);
|
---|
402 |
|
---|
403 | /* extern int LoadAuthorization(void); */
|
---|
404 |
|
---|
405 | extern _X_EXPORT int AuthorizationFromID (
|
---|
406 | XID id,
|
---|
407 | unsigned short *name_lenp,
|
---|
408 | const char **namep,
|
---|
409 | unsigned short *data_lenp,
|
---|
410 | char **datap);
|
---|
411 |
|
---|
412 | extern _X_EXPORT XID CheckAuthorization(
|
---|
413 | unsigned int /*namelength*/,
|
---|
414 | const char * /*name*/,
|
---|
415 | unsigned int /*datalength*/,
|
---|
416 | const char * /*data*/,
|
---|
417 | ClientPtr /*client*/,
|
---|
418 | const char ** /*reason*/
|
---|
419 | );
|
---|
420 |
|
---|
421 | extern _X_EXPORT void ResetAuthorization(void);
|
---|
422 |
|
---|
423 | extern _X_EXPORT int RemoveAuthorization (
|
---|
424 | unsigned short name_length,
|
---|
425 | const char *name,
|
---|
426 | unsigned short data_length,
|
---|
427 | const char *data);
|
---|
428 |
|
---|
429 | extern _X_EXPORT int AddAuthorization(
|
---|
430 | unsigned int /*name_length*/,
|
---|
431 | const char * /*name*/,
|
---|
432 | unsigned int /*data_length*/,
|
---|
433 | char * /*data*/);
|
---|
434 |
|
---|
435 | #ifdef XCSECURITY
|
---|
436 | extern _X_EXPORT XID GenerateAuthorization(
|
---|
437 | unsigned int /* name_length */,
|
---|
438 | const char * /* name */,
|
---|
439 | unsigned int /* data_length */,
|
---|
440 | const char * /* data */,
|
---|
441 | unsigned int * /* data_length_return */,
|
---|
442 | char ** /* data_return */);
|
---|
443 | #endif
|
---|
444 |
|
---|
445 | extern _X_EXPORT int ddxProcessArgument(int /*argc*/, char * /*argv*/ [], int /*i*/);
|
---|
446 |
|
---|
447 | extern _X_EXPORT void ddxUseMsg(void);
|
---|
448 |
|
---|
449 | /* stuff for ReplyCallback */
|
---|
450 | extern _X_EXPORT CallbackListPtr ReplyCallback;
|
---|
451 | typedef struct {
|
---|
452 | ClientPtr client;
|
---|
453 | const void *replyData;
|
---|
454 | unsigned long dataLenBytes; /* actual bytes from replyData + pad bytes */
|
---|
455 | unsigned long bytesRemaining;
|
---|
456 | Bool startOfReply;
|
---|
457 | unsigned long padBytes; /* pad bytes from zeroed array */
|
---|
458 | } ReplyInfoRec;
|
---|
459 |
|
---|
460 | /* stuff for FlushCallback */
|
---|
461 | extern _X_EXPORT CallbackListPtr FlushCallback;
|
---|
462 |
|
---|
463 | enum ExitCode {
|
---|
464 | EXIT_NO_ERROR = 0,
|
---|
465 | EXIT_ERR_ABORT = 1,
|
---|
466 | EXIT_ERR_CONFIGURE = 2,
|
---|
467 | EXIT_ERR_DRIVERS = 3,
|
---|
468 | };
|
---|
469 |
|
---|
470 | extern _X_EXPORT void AbortDDX(enum ExitCode error);
|
---|
471 | extern _X_EXPORT void ddxGiveUp(enum ExitCode error);
|
---|
472 | extern _X_EXPORT int TimeSinceLastInputEvent(void);
|
---|
473 |
|
---|
474 | /* strcasecmp.c */
|
---|
475 | #ifndef HAVE_STRCASECMP
|
---|
476 | #define strcasecmp xstrcasecmp
|
---|
477 | extern _X_EXPORT int xstrcasecmp(const char *s1, const char *s2);
|
---|
478 | #endif
|
---|
479 |
|
---|
480 | #ifndef HAVE_STRNCASECMP
|
---|
481 | #define strncasecmp xstrncasecmp
|
---|
482 | extern _X_EXPORT int xstrncasecmp(const char *s1, const char *s2, size_t n);
|
---|
483 | #endif
|
---|
484 |
|
---|
485 | #ifndef HAVE_STRCASESTR
|
---|
486 | #define strcasestr xstrcasestr
|
---|
487 | extern _X_EXPORT char *xstrcasestr(const char *s, const char *find);
|
---|
488 | #endif
|
---|
489 |
|
---|
490 | #ifndef HAVE_STRLCPY
|
---|
491 | extern _X_EXPORT size_t strlcpy(char *dst, const char *src, size_t siz);
|
---|
492 | extern _X_EXPORT size_t strlcat(char *dst, const char *src, size_t siz);
|
---|
493 | #endif
|
---|
494 |
|
---|
495 | #ifndef HAVE_STRNDUP
|
---|
496 | extern _X_EXPORT char * strndup(const char *str, size_t n);
|
---|
497 | #endif
|
---|
498 |
|
---|
499 | /* Logging. */
|
---|
500 | typedef enum _LogParameter {
|
---|
501 | XLOG_FLUSH,
|
---|
502 | XLOG_SYNC,
|
---|
503 | XLOG_VERBOSITY,
|
---|
504 | XLOG_FILE_VERBOSITY
|
---|
505 | } LogParameter;
|
---|
506 |
|
---|
507 | /* Flags for log messages. */
|
---|
508 | typedef enum {
|
---|
509 | X_PROBED, /* Value was probed */
|
---|
510 | X_CONFIG, /* Value was given in the config file */
|
---|
511 | X_DEFAULT, /* Value is a default */
|
---|
512 | X_CMDLINE, /* Value was given on the command line */
|
---|
513 | X_NOTICE, /* Notice */
|
---|
514 | X_ERROR, /* Error message */
|
---|
515 | X_WARNING, /* Warning message */
|
---|
516 | X_INFO, /* Informational message */
|
---|
517 | X_NONE, /* No prefix */
|
---|
518 | X_NOT_IMPLEMENTED, /* Not implemented */
|
---|
519 | X_UNKNOWN = -1 /* unknown -- this must always be last */
|
---|
520 | } MessageType;
|
---|
521 |
|
---|
522 | extern _X_EXPORT const char *LogInit(const char *fname, const char *backup);
|
---|
523 | extern _X_EXPORT void LogClose(enum ExitCode error);
|
---|
524 | extern _X_EXPORT Bool LogSetParameter(LogParameter param, int value);
|
---|
525 | extern _X_EXPORT void LogVWrite(int verb, const char *f, va_list args) _X_ATTRIBUTE_PRINTF(2,0);
|
---|
526 | extern _X_EXPORT void LogWrite(int verb, const char *f, ...) _X_ATTRIBUTE_PRINTF(2,3);
|
---|
527 | extern _X_EXPORT void LogVMessageVerb(MessageType type, int verb, const char *format,
|
---|
528 | va_list args) _X_ATTRIBUTE_PRINTF(3,0);
|
---|
529 | extern _X_EXPORT void LogMessageVerb(MessageType type, int verb, const char *format,
|
---|
530 | ...) _X_ATTRIBUTE_PRINTF(3,4);
|
---|
531 | extern _X_EXPORT void LogMessage(MessageType type, const char *format, ...)
|
---|
532 | _X_ATTRIBUTE_PRINTF(2,3);
|
---|
533 |
|
---|
534 | extern _X_EXPORT void LogVHdrMessageVerb(MessageType type, int verb,
|
---|
535 | const char *msg_format, va_list msg_args,
|
---|
536 | const char *hdr_format, va_list hdr_args)
|
---|
537 | _X_ATTRIBUTE_PRINTF(3,0) _X_ATTRIBUTE_PRINTF(5,0);
|
---|
538 | extern _X_EXPORT void LogHdrMessageVerb(MessageType type, int verb,
|
---|
539 | const char *msg_format, va_list msg_args,
|
---|
540 | const char *hdr_format, ...)
|
---|
541 | _X_ATTRIBUTE_PRINTF(3,0) _X_ATTRIBUTE_PRINTF(5,6);
|
---|
542 | extern _X_EXPORT void LogHdrMessage(MessageType type, const char *msg_format,
|
---|
543 | va_list msg_args, const char *hdr_format, ...)
|
---|
544 | _X_ATTRIBUTE_PRINTF(2,0) _X_ATTRIBUTE_PRINTF(4,5);
|
---|
545 |
|
---|
546 | extern _X_EXPORT void FreeAuditTimer(void);
|
---|
547 | extern _X_EXPORT void AuditF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2);
|
---|
548 | extern _X_EXPORT void VAuditF(const char *f, va_list args) _X_ATTRIBUTE_PRINTF(1,0);
|
---|
549 | extern _X_EXPORT void FatalError(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2) _X_NORETURN;
|
---|
550 |
|
---|
551 | #ifdef DEBUG
|
---|
552 | #define DebugF ErrorF
|
---|
553 | #else
|
---|
554 | #define DebugF(...) /* */
|
---|
555 | #endif
|
---|
556 |
|
---|
557 | extern _X_EXPORT void VErrorF(const char *f, va_list args) _X_ATTRIBUTE_PRINTF(1,0);
|
---|
558 | extern _X_EXPORT void ErrorF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1,2);
|
---|
559 | extern _X_EXPORT void LogPrintMarkers(void);
|
---|
560 |
|
---|
561 | extern _X_EXPORT void xorg_backtrace(void);
|
---|
562 |
|
---|
563 | #endif /* OS_H */
|
---|