os.h revision 40c5823b
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 <X11/Xfuncproto.h> 57#include "client.h" 58#include "misc.h" 59 60typedef pointer FID; 61 62#define ALLOCATE_LOCAL_FALLBACK(_size) FSalloc((unsigned long)_size) 63#define DEALLOCATE_LOCAL_FALLBACK(_ptr) FSfree((pointer)_ptr) 64 65#include "X11/Xalloca.h" 66 67#define MAX_REQUEST_SIZE 8192 68 69#define fsalloc(size) FSalloc((unsigned long)size) 70#define fsrealloc(ptr, size) FSrealloc((pointer)ptr, (unsigned long)size) 71#define fsfree(ptr) FSfree((pointer)ptr) 72 73extern int ListenPort; 74extern Bool UseSyslog; 75extern Bool CloneSelf; 76extern char ErrorFile[]; 77 78struct _osComm; /* FIXME: osCommPtr */ 79 80/* os/config.c */ 81extern int ReadConfigFile(const char *filename); 82 83/* os/connection.c */ 84extern void AttendClient(ClientPtr client); 85extern void CheckConnections(void); 86extern void CloseDownConnection(ClientPtr client); 87extern void IgnoreClient(ClientPtr client); 88extern void MakeNewConnections(void); 89extern void ReapAnyOldClients(void); 90extern void ResetSockets(void); 91extern void CloseSockets(void); 92extern void StopListening(void); 93 94/* os/daemon.c */ 95extern void BecomeDaemon(void); 96extern void DetachStdio(void); 97 98/* os/error.c */ 99extern void Error(const char *str); 100extern void InitErrors(void); 101extern void CloseErrors(void); 102extern void NoticeF(const char *f, ...) _X_ATTRIBUTE_PRINTF(1, 2); 103extern void ErrorF(const char * f, ...) _X_ATTRIBUTE_PRINTF(1, 2); 104extern void FatalError(const char* f, ...) _X_ATTRIBUTE_PRINTF(1, 2); 105 106/* os/io.c */ 107extern Bool InsertFakeRequest(ClientPtr client, char *data, int count); 108extern int FlushClient(ClientPtr client, struct _osComm *oc, char *extraBuf, int extraCount, int padsize); 109extern int ReadRequest(ClientPtr client); 110extern void FlushAllOutput(void); 111extern void FreeOsBuffers(struct _osComm *oc); 112extern void ResetCurrentRequest(ClientPtr client); 113extern void ResetOsBuffers(void); 114extern void WriteToClient(ClientPtr client, int count, char *buf); 115extern void WriteToClientUnpadded(ClientPtr client, int count, char *buf); 116 117/* os/osglue.c */ 118extern int ListCatalogues(const char *pattern, int patlen, int maxnames, char **catalogues, int *len); 119extern int ValidateCatalogues(int *num, char *cats); 120extern int SetAlternateServers(char *list); 121extern int ListAlternateServers(AlternateServerPtr *svrs); 122extern int CloneMyself(void); 123 124/* os/osinit.c */ 125extern void OsInit(void); 126 127/* os/utils.c */ 128extern void AutoResetServer (int n); 129extern void CleanupChild (int n); 130extern void GiveUp (int n); 131extern void ServerCacheFlush (int n); 132extern void ServerReconfig (int n); 133extern unsigned int GetTimeInMillis (void); 134extern pointer FSalloc(unsigned long); 135extern pointer FScalloc (unsigned long amount); 136extern pointer FSrealloc(pointer, unsigned long); 137extern void FSfree(pointer); 138extern void OsInitAllocator (void); 139extern void ProcessCmdLine (int argc, char **argv); 140extern void ProcessLSoption (char *str); 141extern void SetUserId(void); 142extern void SetDaemonState(void); 143 144/* os/waitfor.c */ 145extern int WaitForSomething(int *pClientsReady); 146 147extern void SetConfigValues(void); 148 149 150#endif /* _OS_H_ */ 151