os.h revision bbe1b32b
1/* $Xorg: os.h,v 1.5 2001/02/09 02:05:44 xorgcvs Exp $ */
2/*
3Copyright 1987, 1998  The Open Group
4
5Permission to use, copy, modify, distribute, and sell this software and its
6documentation for any purpose is hereby granted without fee, provided that
7the above copyright notice appear in all copies and that both that
8copyright notice and this permission notice appear in supporting
9documentation.
10
11The above copyright notice and this permission notice shall be included in
12all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
17OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
21Except as contained in this notice, the name of The Open Group shall not be
22used in advertising or otherwise to promote the sale, use or other dealings
23in this Software without prior written authorization from The Open Group.
24 * Copyright 1990, 1991 Network Computing Devices;
25 * Portions Copyright 1987 by Digital Equipment Corporation
26 *
27 * Permission to use, copy, modify, distribute, and sell this software and its
28 * documentation for any purpose is hereby granted without fee, provided that
29 * the above copyright notice appear in all copies and that both that
30 * copyright notice and this permission notice appear in supporting
31 * documentation, and that the names of Network Computing Devices,
32 * or Digital not be used in advertising or
33 * publicity pertaining to distribution of the software without specific,
34 * written prior permission.  Network Computing Devices, or Digital
35 * make no representations about the
36 * suitability of this software for any purpose.  It is provided "as is"
37 * without express or implied warranty.
38 *
39 * NETWORK COMPUTING DEVICES, AND DIGITAL DISCLAIM ALL WARRANTIES WITH
40 * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
41 * AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES, OR DIGITAL BE
42 * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
43 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
44 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
45 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
46 *
47 * $NCDXorg: @(#)os.h,v 4.2 1991/05/10 07:59:16 lemke Exp $
48 *
49 */
50/* $XFree86: xc/programs/xfs/include/os.h,v 3.14 2002/10/15 01:45:03 dawes Exp $ */
51
52#ifndef	_OS_H_
53#define	_OS_H_
54
55typedef struct _FontPathRec *FontPathPtr;
56typedef struct _alt_server *AlternateServerPtr;
57typedef struct _auth *AuthPtr;
58
59#include <X11/fonts/FSproto.h>
60#include "client.h"
61#include "misc.h"
62
63typedef pointer FID;
64
65#define ALLOCATE_LOCAL_FALLBACK(_size) FSalloc((unsigned long)_size)
66#define DEALLOCATE_LOCAL_FALLBACK(_ptr) FSfree((pointer)_ptr)
67
68#include "X11/Xalloca.h"
69
70#define	MAX_REQUEST_SIZE	8192
71
72#ifdef SIGNALRETURNSINT
73#define SIGVAL int
74#else
75#define SIGVAL void
76#endif
77
78#define	fsalloc(size)		FSalloc((unsigned long)size)
79#define	fsrealloc(ptr, size)	FSrealloc((pointer)ptr, (unsigned long)size)
80#define	fsfree(ptr)		FSfree((pointer)ptr)
81
82extern int  ListenPort;
83extern Bool UseSyslog;
84extern Bool CloneSelf;
85extern char ErrorFile[];
86#ifdef FONTCACHE
87#include <X11/extensions/fontcacheP.h>
88extern FontCacheSettings cacheSettings;
89#endif
90
91struct _osComm;	/* FIXME: osCommPtr */
92
93/* os/config.c */
94extern	int	ReadConfigFile(const char *filename);
95
96/* os/connection.c */
97extern	void	AttendClient(ClientPtr client);
98extern	void	CheckConnections(void);
99extern	void	CloseDownConnection(ClientPtr client);
100extern	void	IgnoreClient(ClientPtr client);
101extern	void	MakeNewConnections(void);
102extern	void	ReapAnyOldClients(void);
103extern	void	ResetSockets(void);
104extern	void	CloseSockets(void);
105extern	void	StopListening(void);
106
107/* os/daemon.c */
108extern	void	BecomeDaemon(void);
109
110/* os/error.c */
111extern void	Error(char *str);
112extern void	InitErrors(void);
113extern void	CloseErrors(void);
114extern void	NoticeF(char *f, ...);
115extern void	ErrorF(char * f, ...);
116extern void	FatalError(char* f, ...);
117
118/* os/io.c */
119extern	Bool	InsertFakeRequest(ClientPtr client, char *data, int count);
120extern	int	FlushClient(ClientPtr client, struct _osComm *oc, char *extraBuf, int extraCount, int padsize);
121extern	int	ReadRequest(ClientPtr client);
122extern	void	FlushAllOutput(void);
123extern	void	FreeOsBuffers(struct _osComm *oc);
124extern	void	ResetCurrentRequest(ClientPtr client);
125extern	void	ResetOsBuffers(void);
126extern	void	WriteToClient(ClientPtr client, int count, char *buf);
127extern	void	WriteToClientUnpadded(ClientPtr client, int count, char *buf);
128
129/* os/osglue.c */
130extern int 	ListCatalogues(char *pattern, int patlen, int maxnames, char **catalogues, int *len);
131extern int 	ValidateCatalogues(int *num, char *cats);
132extern int 	SetAlternateServers(char *list);
133extern int 	ListAlternateServers(AlternateServerPtr *svrs);
134extern int 	CloneMyself(void);
135
136/* os/osinit.c */
137extern	void	OsInit(void);
138
139/* os/utils.c */
140extern	SIGVAL	AutoResetServer (int n);
141extern	SIGVAL	CleanupChild (int n);
142extern	SIGVAL	GiveUp (int n);
143extern	SIGVAL	ServerCacheFlush (int n);
144extern	SIGVAL	ServerReconfig (int n);
145extern	long	GetTimeInMillis (void);
146extern	pointer	FSalloc(unsigned long);
147extern	pointer	FScalloc (unsigned long amount);
148extern	pointer	FSrealloc(pointer, unsigned long);
149extern	void	FSfree(pointer);
150extern	void	OsInitAllocator (void);
151extern	void	ProcessCmdLine (int argc, char **argv);
152extern	void	ProcessLSoption (char *str);
153extern	void	SetUserId(void);
154extern	void	SetDaemonState(void);
155
156/* os/waitfor.c */
157extern	int	WaitForSomething(int *pClientsReady);
158
159extern void	SetConfigValues(void);
160
161
162#endif				/* _OS_H_ */
163