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 |
|
---|
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 DDXOSVERRORF
|
---|
87 | extern _X_EXPORT void (*OsVendorVErrorFProc)(const char *, va_list args);
|
---|
88 | #endif
|
---|
89 |
|
---|
90 | extern _X_EXPORT int WaitForSomething(
|
---|
91 | int* /*pClientsReady*/
|
---|
92 | );
|
---|
93 |
|
---|
94 | extern _X_EXPORT int ReadRequestFromClient(ClientPtr /*client*/);
|
---|
95 |
|
---|
96 | extern _X_EXPORT Bool InsertFakeRequest(
|
---|
97 | ClientPtr /*client*/,
|
---|
98 | char* /*data*/,
|
---|
99 | int /*count*/);
|
---|
100 |
|
---|
101 | extern _X_EXPORT void ResetCurrentRequest(ClientPtr /*client*/);
|
---|
102 |
|
---|
103 | extern _X_EXPORT void FlushAllOutput(void);
|
---|
104 |
|
---|
105 | extern _X_EXPORT void FlushIfCriticalOutputPending(void);
|
---|
106 |
|
---|
107 | extern _X_EXPORT void SetCriticalOutputPending(void);
|
---|
108 |
|
---|
109 | extern _X_EXPORT int WriteToClient(ClientPtr /*who*/, int /*count*/, const void* /*buf*/);
|
---|
110 |
|
---|
111 | extern _X_EXPORT void ResetOsBuffers(void);
|
---|
112 |
|
---|
113 | extern _X_EXPORT void InitConnectionLimits(void);
|
---|
114 |
|
---|
115 | extern _X_EXPORT void NotifyParentProcess(void);
|
---|
116 |
|
---|
117 | extern _X_EXPORT void CreateWellKnownSockets(void);
|
---|
118 |
|
---|
119 | extern _X_EXPORT void ResetWellKnownSockets(void);
|
---|
120 |
|
---|
121 | extern _X_EXPORT void CloseWellKnownConnections(void);
|
---|
122 |
|
---|
123 | extern _X_EXPORT XID AuthorizationIDOfClient(ClientPtr /*client*/);
|
---|
124 |
|
---|
125 | extern _X_EXPORT char *ClientAuthorized(
|
---|
126 | ClientPtr /*client*/,
|
---|
127 | unsigned int /*proto_n*/,
|
---|
128 | char* /*auth_proto*/,
|
---|
129 | unsigned int /*string_n*/,
|
---|
130 | char* /*auth_string*/);
|
---|
131 |
|
---|
132 | extern _X_EXPORT Bool EstablishNewConnections(
|
---|
133 | ClientPtr /*clientUnused*/,
|
---|
134 | pointer /*closure*/);
|
---|
135 |
|
---|
136 | extern _X_EXPORT void CheckConnections(void);
|
---|
137 |
|
---|
138 | extern _X_EXPORT void CloseDownConnection(ClientPtr /*client*/);
|
---|
139 |
|
---|
140 | extern _X_EXPORT void AddGeneralSocket(int /*fd*/);
|
---|
141 |
|
---|
142 | extern _X_EXPORT void RemoveGeneralSocket(int /*fd*/);
|
---|
143 |
|
---|
144 | extern _X_EXPORT void AddEnabledDevice(int /*fd*/);
|
---|
145 |
|
---|
146 | extern _X_EXPORT void RemoveEnabledDevice(int /*fd*/);
|
---|
147 |
|
---|
148 | extern _X_EXPORT int OnlyListenToOneClient(ClientPtr /*client*/);
|
---|
149 |
|
---|
150 | extern _X_EXPORT void ListenToAllClients(void);
|
---|
151 |
|
---|
152 | extern _X_EXPORT void IgnoreClient(ClientPtr /*client*/);
|
---|
153 |
|
---|
154 | extern _X_EXPORT void AttendClient(ClientPtr /*client*/);
|
---|
155 |
|
---|
156 | extern _X_EXPORT void MakeClientGrabImpervious(ClientPtr /*client*/);
|
---|
157 |
|
---|
158 | extern _X_EXPORT void MakeClientGrabPervious(ClientPtr /*client*/);
|
---|
159 |
|
---|
160 | #ifdef XQUARTZ
|
---|
161 | extern void ListenOnOpenFD(int /* fd */, int /* noxauth */);
|
---|
162 | #endif
|
---|
163 |
|
---|
164 | extern _X_EXPORT CARD32 GetTimeInMillis(void);
|
---|
165 |
|
---|
166 | extern _X_EXPORT void AdjustWaitForDelay(
|
---|
167 | pointer /*waitTime*/,
|
---|
168 | unsigned long /*newdelay*/);
|
---|
169 |
|
---|
170 | typedef struct _OsTimerRec *OsTimerPtr;
|
---|
171 |
|
---|
172 | typedef CARD32 (*OsTimerCallback)(
|
---|
173 | OsTimerPtr /* timer */,
|
---|
174 | CARD32 /* time */,
|
---|
175 | pointer /* arg */);
|
---|
176 |
|
---|
177 | extern _X_EXPORT void TimerInit(void);
|
---|
178 |
|
---|
179 | extern _X_EXPORT Bool TimerForce(OsTimerPtr /* timer */);
|
---|
180 |
|
---|
181 | #define TimerAbsolute (1<<0)
|
---|
182 | #define TimerForceOld (1<<1)
|
---|
183 |
|
---|
184 | extern _X_EXPORT OsTimerPtr TimerSet(
|
---|
185 | 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(
|
---|
207 | char ** /* authorizations */,
|
---|
208 | int * /*authlen */,
|
---|
209 | pointer /* client */);
|
---|
210 |
|
---|
211 | #ifndef _HAVE_XALLOC_DECLS
|
---|
212 | #define _HAVE_XALLOC_DECLS
|
---|
213 | extern _X_EXPORT pointer Xalloc(unsigned long /*amount*/);
|
---|
214 | extern _X_EXPORT pointer Xcalloc(unsigned long /*amount*/);
|
---|
215 | extern _X_EXPORT pointer Xrealloc(pointer /*ptr*/, unsigned long /*amount*/);
|
---|
216 | extern _X_EXPORT void Xfree(pointer /*ptr*/);
|
---|
217 | #endif
|
---|
218 |
|
---|
219 | extern _X_EXPORT pointer XNFalloc(unsigned long /*amount*/);
|
---|
220 | extern _X_EXPORT pointer XNFcalloc(unsigned long /*amount*/);
|
---|
221 | extern _X_EXPORT pointer XNFrealloc(pointer /*ptr*/, unsigned long /*amount*/);
|
---|
222 |
|
---|
223 | extern _X_EXPORT char *Xstrdup(const char *s);
|
---|
224 | extern _X_EXPORT char *XNFstrdup(const char *s);
|
---|
225 | extern _X_EXPORT char *Xprintf(const char *fmt, ...);
|
---|
226 | extern _X_EXPORT char *Xvprintf(const char *fmt, va_list va);
|
---|
227 | extern _X_EXPORT char *XNFprintf(const char *fmt, ...);
|
---|
228 | extern _X_EXPORT char *XNFvprintf(const char *fmt, va_list va);
|
---|
229 |
|
---|
230 | typedef void (*OsSigHandlerPtr)(int /* sig */);
|
---|
231 | typedef int (*OsSigWrapperPtr)(int /* sig */);
|
---|
232 |
|
---|
233 | extern _X_EXPORT OsSigHandlerPtr OsSignal(int /* sig */, OsSigHandlerPtr /* handler */);
|
---|
234 | extern _X_EXPORT OsSigWrapperPtr OsRegisterSigWrapper(OsSigWrapperPtr newWrap);
|
---|
235 |
|
---|
236 | extern _X_EXPORT int auditTrailLevel;
|
---|
237 |
|
---|
238 | extern _X_EXPORT void LockServer(void);
|
---|
239 | extern _X_EXPORT void UnlockServer(void);
|
---|
240 |
|
---|
241 | extern _X_EXPORT int OsLookupColor(
|
---|
242 | int /*screen*/,
|
---|
243 | char * /*name*/,
|
---|
244 | unsigned /*len*/,
|
---|
245 | unsigned short * /*pred*/,
|
---|
246 | unsigned short * /*pgreen*/,
|
---|
247 | unsigned short * /*pblue*/);
|
---|
248 |
|
---|
249 | extern _X_EXPORT void OsInit(void);
|
---|
250 |
|
---|
251 | extern _X_EXPORT void OsCleanup(Bool);
|
---|
252 |
|
---|
253 | extern _X_EXPORT void OsVendorFatalError(void);
|
---|
254 |
|
---|
255 | extern _X_EXPORT void OsVendorInit(void);
|
---|
256 |
|
---|
257 | extern _X_EXPORT void OsBlockSignals (void);
|
---|
258 |
|
---|
259 | extern _X_EXPORT void OsReleaseSignals (void);
|
---|
260 |
|
---|
261 | #if !defined(WIN32)
|
---|
262 | extern _X_EXPORT int System(char *);
|
---|
263 | extern _X_EXPORT pointer Popen(char *, char *);
|
---|
264 | extern _X_EXPORT int Pclose(pointer);
|
---|
265 | extern _X_EXPORT pointer Fopen(char *, char *);
|
---|
266 | extern _X_EXPORT int Fclose(pointer);
|
---|
267 | #else
|
---|
268 | #define System(a) system(a)
|
---|
269 | #define Popen(a,b) popen(a,b)
|
---|
270 | #define Pclose(a) pclose(a)
|
---|
271 | #define Fopen(a,b) fopen(a,b)
|
---|
272 | #define Fclose(a) fclose(a)
|
---|
273 | #endif
|
---|
274 |
|
---|
275 | extern _X_EXPORT void CheckUserParameters(int argc, char **argv, char **envp);
|
---|
276 | extern _X_EXPORT void CheckUserAuthorization(void);
|
---|
277 |
|
---|
278 | extern _X_EXPORT int AddHost(
|
---|
279 | ClientPtr /*client*/,
|
---|
280 | int /*family*/,
|
---|
281 | unsigned /*length*/,
|
---|
282 | pointer /*pAddr*/);
|
---|
283 |
|
---|
284 | extern _X_EXPORT Bool ForEachHostInFamily (
|
---|
285 | int /*family*/,
|
---|
286 | Bool (* /*func*/ )(
|
---|
287 | unsigned char * /* addr */,
|
---|
288 | short /* len */,
|
---|
289 | pointer /* closure */),
|
---|
290 | pointer /*closure*/);
|
---|
291 |
|
---|
292 | extern _X_EXPORT int RemoveHost(
|
---|
293 | ClientPtr /*client*/,
|
---|
294 | int /*family*/,
|
---|
295 | unsigned /*length*/,
|
---|
296 | pointer /*pAddr*/);
|
---|
297 |
|
---|
298 | extern _X_EXPORT int GetHosts(
|
---|
299 | pointer * /*data*/,
|
---|
300 | int * /*pnHosts*/,
|
---|
301 | int * /*pLen*/,
|
---|
302 | BOOL * /*pEnabled*/);
|
---|
303 |
|
---|
304 | typedef struct sockaddr * sockaddrPtr;
|
---|
305 |
|
---|
306 | extern _X_EXPORT int InvalidHost(sockaddrPtr /*saddr*/, int /*len*/, ClientPtr client);
|
---|
307 |
|
---|
308 | extern _X_EXPORT int LocalClient(ClientPtr /* client */);
|
---|
309 |
|
---|
310 | extern _X_EXPORT int LocalClientCred(ClientPtr, int *, int *);
|
---|
311 |
|
---|
312 | #define LCC_UID_SET (1 << 0)
|
---|
313 | #define LCC_GID_SET (1 << 1)
|
---|
314 | #define LCC_PID_SET (1 << 2)
|
---|
315 | #define LCC_ZID_SET (1 << 3)
|
---|
316 |
|
---|
317 | typedef struct {
|
---|
318 | int fieldsSet; /* Bit mask of fields set */
|
---|
319 | int euid; /* Effective uid */
|
---|
320 | int egid; /* Primary effective group id */
|
---|
321 | int nSuppGids; /* Number of supplementary group ids */
|
---|
322 | int *pSuppGids; /* Array of supplementary group ids */
|
---|
323 | int pid; /* Process id */
|
---|
324 | int zoneid; /* Only set on Solaris 10 & later */
|
---|
325 | } LocalClientCredRec;
|
---|
326 |
|
---|
327 | extern _X_EXPORT int GetLocalClientCreds(ClientPtr, LocalClientCredRec **);
|
---|
328 | extern _X_EXPORT void FreeLocalClientCreds(LocalClientCredRec *);
|
---|
329 |
|
---|
330 | extern _X_EXPORT int ChangeAccessControl(ClientPtr /*client*/, int /*fEnabled*/);
|
---|
331 |
|
---|
332 | extern _X_EXPORT int GetAccessControl(void);
|
---|
333 |
|
---|
334 |
|
---|
335 | extern _X_EXPORT void AddLocalHosts(void);
|
---|
336 |
|
---|
337 | extern _X_EXPORT void ResetHosts(char *display);
|
---|
338 |
|
---|
339 | extern _X_EXPORT void EnableLocalHost(void);
|
---|
340 |
|
---|
341 | extern _X_EXPORT void DisableLocalHost(void);
|
---|
342 |
|
---|
343 | extern _X_EXPORT void AccessUsingXdmcp(void);
|
---|
344 |
|
---|
345 | extern _X_EXPORT void DefineSelf(int /*fd*/);
|
---|
346 |
|
---|
347 | #if XDMCP
|
---|
348 | extern _X_EXPORT void AugmentSelf(pointer /*from*/, int /*len*/);
|
---|
349 |
|
---|
350 | extern _X_EXPORT void RegisterAuthorizations(void);
|
---|
351 | #endif
|
---|
352 |
|
---|
353 | extern _X_EXPORT void InitAuthorization(char * /*filename*/);
|
---|
354 |
|
---|
355 | /* extern int LoadAuthorization(void); */
|
---|
356 |
|
---|
357 | extern _X_EXPORT int AuthorizationFromID (
|
---|
358 | XID id,
|
---|
359 | unsigned short *name_lenp,
|
---|
360 | char **namep,
|
---|
361 | unsigned short *data_lenp,
|
---|
362 | char **datap);
|
---|
363 |
|
---|
364 | extern _X_EXPORT XID CheckAuthorization(
|
---|
365 | unsigned int /*namelength*/,
|
---|
366 | char * /*name*/,
|
---|
367 | unsigned int /*datalength*/,
|
---|
368 | char * /*data*/,
|
---|
369 | ClientPtr /*client*/,
|
---|
370 | char ** /*reason*/
|
---|
371 | );
|
---|
372 |
|
---|
373 | extern _X_EXPORT void ResetAuthorization(void);
|
---|
374 |
|
---|
375 | extern _X_EXPORT int RemoveAuthorization (
|
---|
376 | unsigned short name_length,
|
---|
377 | char *name,
|
---|
378 | unsigned short data_length,
|
---|
379 | char *data);
|
---|
380 |
|
---|
381 | extern _X_EXPORT int AddAuthorization(
|
---|
382 | unsigned int /*name_length*/,
|
---|
383 | char * /*name*/,
|
---|
384 | unsigned int /*data_length*/,
|
---|
385 | char * /*data*/);
|
---|
386 |
|
---|
387 | #ifdef XCSECURITY
|
---|
388 | extern _X_EXPORT XID GenerateAuthorization(
|
---|
389 | unsigned int /* name_length */,
|
---|
390 | char * /* name */,
|
---|
391 | unsigned int /* data_length */,
|
---|
392 | char * /* data */,
|
---|
393 | unsigned int * /* data_length_return */,
|
---|
394 | char ** /* data_return */);
|
---|
395 | #endif
|
---|
396 |
|
---|
397 | extern _X_EXPORT int ddxProcessArgument(int /*argc*/, char * /*argv*/ [], int /*i*/);
|
---|
398 |
|
---|
399 | extern _X_EXPORT void ddxUseMsg(void);
|
---|
400 |
|
---|
401 | /* int ReqLen(xReq *req, ClientPtr client)
|
---|
402 | * Given a pointer to a *complete* request, return its length in bytes.
|
---|
403 | * Note that if the request is a big request (as defined in the Big
|
---|
404 | * Requests extension), the macro lies by returning 4 less than the
|
---|
405 | * length that it actually occupies in the request buffer. This is so you
|
---|
406 | * can blindly compare the length with the various sz_<request> constants
|
---|
407 | * in Xproto.h without having to know/care about big requests.
|
---|
408 | */
|
---|
409 | #define ReqLen(_pxReq, _client) \
|
---|
410 | ((_pxReq->length ? \
|
---|
411 | (_client->swapped ? lswaps(_pxReq->length) : _pxReq->length) \
|
---|
412 | : ((_client->swapped ? \
|
---|
413 | lswapl(((CARD32*)_pxReq)[1]) : ((CARD32*)_pxReq)[1])-1) \
|
---|
414 | ) << 2)
|
---|
415 |
|
---|
416 | /* otherReqTypePtr CastxReq(xReq *req, otherReqTypePtr)
|
---|
417 | * Cast the given request to one of type otherReqTypePtr to access
|
---|
418 | * fields beyond the length field.
|
---|
419 | */
|
---|
420 | #define CastxReq(_pxReq, otherReqTypePtr) \
|
---|
421 | (_pxReq->length ? (otherReqTypePtr)_pxReq \
|
---|
422 | : (otherReqTypePtr)(((CARD32*)_pxReq)+1))
|
---|
423 |
|
---|
424 | /* stuff for ReplyCallback */
|
---|
425 | extern _X_EXPORT CallbackListPtr ReplyCallback;
|
---|
426 | typedef struct {
|
---|
427 | ClientPtr client;
|
---|
428 | const void *replyData;
|
---|
429 | unsigned long dataLenBytes;
|
---|
430 | unsigned long bytesRemaining;
|
---|
431 | Bool startOfReply;
|
---|
432 | } ReplyInfoRec;
|
---|
433 |
|
---|
434 | /* stuff for FlushCallback */
|
---|
435 | extern _X_EXPORT CallbackListPtr FlushCallback;
|
---|
436 |
|
---|
437 | extern _X_EXPORT void AbortDDX(void);
|
---|
438 | extern _X_EXPORT void ddxGiveUp(void);
|
---|
439 | extern _X_EXPORT int TimeSinceLastInputEvent(void);
|
---|
440 |
|
---|
441 | /* strcasecmp.c */
|
---|
442 | #if NEED_STRCASECMP
|
---|
443 | #define strcasecmp xstrcasecmp
|
---|
444 | extern _X_EXPORT int xstrcasecmp(const char *s1, const char *s2);
|
---|
445 | #endif
|
---|
446 |
|
---|
447 | #if NEED_STRNCASECMP
|
---|
448 | #define strncasecmp xstrncasecmp
|
---|
449 | extern _X_EXPORT int xstrncasecmp(const char *s1, const char *s2, size_t n);
|
---|
450 | #endif
|
---|
451 |
|
---|
452 | #if NEED_STRCASESTR
|
---|
453 | #define strcasestr xstrcasestr
|
---|
454 | extern _X_EXPORT char *xstrcasestr(const char *s, const char *find);
|
---|
455 | #endif
|
---|
456 |
|
---|
457 | #ifndef HAS_STRLCPY
|
---|
458 | extern _X_EXPORT size_t strlcpy(char *dst, const char *src, size_t siz);
|
---|
459 | extern _X_EXPORT size_t strlcat(char *dst, const char *src, size_t siz);
|
---|
460 | #endif
|
---|
461 |
|
---|
462 | /* Logging. */
|
---|
463 | typedef enum _LogParameter {
|
---|
464 | XLOG_FLUSH,
|
---|
465 | XLOG_SYNC,
|
---|
466 | XLOG_VERBOSITY,
|
---|
467 | XLOG_FILE_VERBOSITY
|
---|
468 | } LogParameter;
|
---|
469 |
|
---|
470 | /* Flags for log messages. */
|
---|
471 | typedef enum {
|
---|
472 | X_PROBED, /* Value was probed */
|
---|
473 | X_CONFIG, /* Value was given in the config file */
|
---|
474 | X_DEFAULT, /* Value is a default */
|
---|
475 | X_CMDLINE, /* Value was given on the command line */
|
---|
476 | X_NOTICE, /* Notice */
|
---|
477 | X_ERROR, /* Error message */
|
---|
478 | X_WARNING, /* Warning message */
|
---|
479 | X_INFO, /* Informational message */
|
---|
480 | X_NONE, /* No prefix */
|
---|
481 | X_NOT_IMPLEMENTED, /* Not implemented */
|
---|
482 | X_UNKNOWN = -1 /* unknown -- this must always be last */
|
---|
483 | } MessageType;
|
---|
484 |
|
---|
485 | /* XXX Need to check which GCC versions have the format(printf) attribute. */
|
---|
486 | #if defined(__GNUC__) && (__GNUC__ > 2)
|
---|
487 | #define _printf_attribute(a,b) __attribute((format(__printf__,a,b)))
|
---|
488 | #else
|
---|
489 | #define _printf_attribute(a,b) /**/
|
---|
490 | #endif
|
---|
491 |
|
---|
492 | extern _X_EXPORT const char *LogInit(const char *fname, const char *backup);
|
---|
493 | extern _X_EXPORT void LogClose(void);
|
---|
494 | extern _X_EXPORT Bool LogSetParameter(LogParameter param, int value);
|
---|
495 | extern _X_EXPORT void LogVWrite(int verb, const char *f, va_list args);
|
---|
496 | extern _X_EXPORT void LogWrite(int verb, const char *f, ...) _printf_attribute(2,3);
|
---|
497 | extern _X_EXPORT void LogVMessageVerb(MessageType type, int verb, const char *format,
|
---|
498 | va_list args);
|
---|
499 | extern _X_EXPORT void LogMessageVerb(MessageType type, int verb, const char *format,
|
---|
500 | ...) _printf_attribute(3,4);
|
---|
501 | extern _X_EXPORT void LogMessage(MessageType type, const char *format, ...)
|
---|
502 | _printf_attribute(2,3);
|
---|
503 | extern _X_EXPORT void FreeAuditTimer(void);
|
---|
504 | extern _X_EXPORT void AuditF(const char *f, ...) _printf_attribute(1,2);
|
---|
505 | extern _X_EXPORT void VAuditF(const char *f, va_list args);
|
---|
506 | extern _X_EXPORT void FatalError(const char *f, ...) _printf_attribute(1,2)
|
---|
507 | #if defined(__GNUC__) && (__GNUC__ > 2)
|
---|
508 | __attribute((noreturn))
|
---|
509 | #endif
|
---|
510 | ;
|
---|
511 |
|
---|
512 | #ifdef DEBUG
|
---|
513 | #define DebugF ErrorF
|
---|
514 | #else
|
---|
515 | #define DebugF(...) /* */
|
---|
516 | #endif
|
---|
517 |
|
---|
518 | extern _X_EXPORT void VErrorF(const char *f, va_list args);
|
---|
519 | extern _X_EXPORT void ErrorF(const char *f, ...) _printf_attribute(1,2);
|
---|
520 | extern _X_EXPORT void Error(char *str);
|
---|
521 | extern _X_EXPORT void LogPrintMarkers(void);
|
---|
522 |
|
---|
523 | extern _X_EXPORT void xorg_backtrace(void);
|
---|
524 |
|
---|
525 | #endif /* OS_H */
|
---|