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