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