diff options
author | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-14 16:49:22 +0000 |
---|---|---|
committer | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-14 16:49:22 +0000 |
commit | 58396f7f075f465fe9fb7580af16c96ad0a88738 (patch) | |
tree | 6c78793d0af9e1cf786dceb03ccb130df18a9c95 | |
parent | db757f1d2a5a951ec26aa4ed64134d8113089fd0 (diff) |
Initial revisionXORG-STABLE
-rw-r--r-- | include/difs.h | 86 | ||||
-rw-r--r-- | include/difsutils.h | 78 | ||||
-rw-r--r-- | include/dispatch.h | 73 | ||||
-rw-r--r-- | include/fsevents.h | 65 | ||||
-rw-r--r-- | include/fsresource.h | 98 | ||||
-rw-r--r-- | include/swaprep.h | 63 | ||||
-rw-r--r-- | include/swapreq.h | 55 | ||||
-rw-r--r-- | os/daemon.c | 167 | ||||
-rw-r--r-- | xfs.def | 4 |
9 files changed, 689 insertions, 0 deletions
diff --git a/include/difs.h b/include/difs.h new file mode 100644 index 0000000..c2de977 --- /dev/null +++ b/include/difs.h @@ -0,0 +1,86 @@ +/* $XFree86: xc/programs/xfs/include/difs.h,v 1.4 2001/08/01 00:45:04 tsi Exp $ */ +/* + * Copyright (C) 1999 The XFree86 Project, Inc. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the XFree86 Project shall + * not be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the + * XFree86 Project. + */ +#ifndef _DIFS_H +#define _DIFS_H + +#include "difsfn.h" +#include "globals.h" +#include "fontstruct.h" + +typedef int (*InitialFunc)(ClientPtr); +typedef int (*ProcFunc)(ClientPtr); +typedef int (*SwappedProcFunc)(ClientPtr); +typedef void (*EventSwapFunc)(fsError *, fsError *); +typedef void (*ReplySwapFunc)(ClientPtr, int, void *); + +extern InitialFunc InitialVector[3]; +extern ReplySwapFunc ReplySwapVector[NUM_PROC_VECTORS]; + +/* FIXME: this is derived from fontstruct.h; should integrate it */ + +/* difs/atom.c */ +extern Atom MakeAtom ( char *string, unsigned len, Bool makeit ); +extern int ValidAtom ( Atom atom ); +extern char * NameForAtom ( Atom atom ); +extern void InitAtoms ( void ); + +/* difs/charinfo.c */ +extern int GetExtents ( ClientPtr client, FontPtr pfont, Mask flags, unsigned long num_ranges, fsRange *range, unsigned long *num_extents, fsXCharInfo **data ); +extern int GetBitmaps ( ClientPtr client, FontPtr pfont, fsBitmapFormat format, Mask flags, unsigned long num_ranges, fsRange *range, int *size, unsigned long *num_glyphs, fsOffset32 **offsets, pointer *data, int *freeData ); + +/* difs/initfonts.c */ +extern void InitFonts ( void ); + +/* difs/fonts.c */ +extern int FontToFSError ( int err ); +extern void UseFPE ( FontPathElementPtr fpe ); +extern void FreeFPE ( FontPathElementPtr fpe ); +extern void QueueFontWakeup ( FontPathElementPtr fpe ); +extern void RemoveFontWakeup ( FontPathElementPtr fpe ); +extern void FontWakeup ( pointer data, int count, unsigned long *LastSelectMask ); +extern int OpenFont ( ClientPtr client, Font fid, fsBitmapFormat format, fsBitmapFormatMask format_mask, int namelen, char *name ); +extern int CloseClientFont ( ClientFontPtr cfp, FSID fid ); +extern int SetFontCatalogue ( char *str, int *badpath ); +extern int ListFonts ( ClientPtr client, int length, unsigned char *pattern, int maxNames ); +#if 0 +extern int StartListFontsWithInfo ( ClientPtr client, int length, unsigned char *pattern, int maxNames ); +#endif +extern int LoadGlyphRanges ( ClientPtr client, FontPtr pfont, Bool range_flag, int num_ranges, int item_size, fsChar2b *data ); +extern void FreeFonts ( void ); +extern FontPtr find_old_font ( FSID id ); +extern void DeleteClientFontStuff ( ClientPtr client ); + +/* difs/fontinfo.c */ +extern void CopyCharInfo ( CharInfoPtr ci, fsXCharInfo *dst ); +extern int convert_props ( FontInfoPtr pinfo, fsPropInfo **props ); +extern int QueryExtents ( ClientPtr client, ClientFontPtr cfp, int item_size, int nranges, Bool range_flag, pointer range_data ); +extern int QueryBitmaps ( ClientPtr client, ClientFontPtr cfp, int item_size, fsBitmapFormat format, int nranges, Bool range_flag, pointer range_data ); + +/* difs/main.c */ +extern int NotImplemented(void); + +#endif diff --git a/include/difsutils.h b/include/difsutils.h new file mode 100644 index 0000000..2a31631 --- /dev/null +++ b/include/difsutils.h @@ -0,0 +1,78 @@ +/* + * $XFree86: xc/programs/xfs/include/difsutils.h,v 1.5 2002/10/15 01:45:03 dawes Exp $ + */ + +/************************************************************ + +Copyright 1998 by Thomas E. Dickey <dickey@clark.net> + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of the above listed +copyright holder(s) not be used in advertising or publicity pertaining +to distribution of the software without specific, written prior +permission. + +THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD +TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE +LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +********************************************************/ + +#ifndef _DIFSUTILS_H +#define _DIFSUTILS_H 1 + +#include <misc.h> +#include <auth.h> +#include <font.h> +#include <accstr.h> +#include <fontstruct.h> + +typedef void (*DifsWakeupFunc)(pointer data, int result, unsigned long * pReadmask); +typedef Bool (*DifsWorkFunc) (ClientPtr, pointer); + +extern AuthContextPtr GetClientAuthorization (void); +extern Bool ClientIsAsleep (ClientPtr client); +extern Bool ClientSleep (ClientPtr client, Bool (*function) (ClientPtr, pointer), pointer data); +extern Bool QueueWorkProc (DifsWorkFunc function, ClientPtr client, pointer data); +extern Bool RegisterBlockAndWakeupHandlers (BlockHandlerProcPtr blockHandler, DifsWakeupFunc wakeupHandler, pointer blockData); +extern Bool ValidHost (HostList list, HostAddress *addr); +#if 0 +extern Bool XpClientIsBitmapClient (ClientPtr client); +extern Bool XpClientIsPrintClient (ClientPtr client, FontPathElementPtr fpe); +extern FontResolutionPtr GetClientResolutions (int *num); +#endif +extern int AddHost (HostList *list, HostAddress *addr); +#if 0 +extern int GetDefaultPointSize (void); +#endif +extern int RemoveHost (HostList *list, HostAddress *addr); +extern int SetDefaultResolutions (char *str); +#if 0 +extern int client_auth_generation (ClientPtr client); +#endif +extern int set_font_authorizations (char **authorizations, int *authlen, ClientPtr client); +extern int strncmpnocase (char *first, char *second, int n); +extern pointer Xalloc (unsigned long m); +extern pointer Xrealloc (pointer n, unsigned long m); +extern void BlockHandler (OSTimePtr pTimeout, pointer pReadmask); +extern void ClientWakeup (ClientPtr client); +extern void CopyISOLatin1Lowered (unsigned char *dest, unsigned char *source, int length); +extern void InitBlockAndWakeupHandlers (void); +extern void NoopDDA (void); +extern void ProcessWorkQueue (void); +extern void RemoveBlockAndWakeupHandlers (BlockHandlerProcPtr blockHandler, DifsWakeupFunc wakeupHandler, pointer blockData); +extern void SetDefaultPointSize (int ps); +extern void WakeupHandler (int result, unsigned long * pReadmask); +extern void Xfree (unsigned long *n); +extern pointer Xcalloc (unsigned long n); + +#endif /* _DIFSUTILS_H */ diff --git a/include/dispatch.h b/include/dispatch.h new file mode 100644 index 0000000..ba359da --- /dev/null +++ b/include/dispatch.h @@ -0,0 +1,73 @@ +/* + * $XFree86: xc/programs/xfs/include/dispatch.h,v 1.3 2001/08/28 23:44:54 paulo Exp $ + */ + +/************************************************************ + +Copyright 1998 by Thomas E. Dickey <dickey@clark.net> + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of the above listed +copyright holder(s) not be used in advertising or publicity pertaining +to distribution of the software without specific, written prior +permission. + +THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD +TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE +LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +********************************************************/ + +#ifndef _DISPATCH_H_ +#define _DISPATCH_H_ 1 + +#include <misc.h> +extern ClientPtr currentClient; + +extern void Dispatch (void); +extern int ProcInitialConnection (ClientPtr client); +extern int ProcEstablishConnection (ClientPtr client); +#ifdef DEBUG +#define SendErrToClient(client, error, data) \ + fprintf(stderr, "SendErrToClient %s %d\n", __FILE__, __LINE__),\ + DoSendErrToClient(client, error, data) +#else +#define SendErrToClient DoSendErrToClient +#endif +extern void DoSendErrToClient (ClientPtr client, int error, pointer data); +extern int ProcBadRequest (ClientPtr client); +extern int ProcNoop (ClientPtr client); +extern int ProcListCatalogues (ClientPtr client); +extern int ProcSetCatalogues (ClientPtr client); +extern int ProcGetCatalogues (ClientPtr client); +extern int ProcCreateAC (ClientPtr client); +extern int DeleteAuthCont (pointer value, FSID id); +extern int ProcFreeAC (ClientPtr client); +extern int ProcSetAuthorization (ClientPtr client); +extern int ProcSetResolution (ClientPtr client); +extern int ProcGetResolution (ClientPtr client); +extern int ProcListFonts (ClientPtr client); +extern int ProcListFontsWithXInfo (ClientPtr client); +extern int ProcOpenBitmapFont (ClientPtr client); +extern int ProcQueryXInfo (ClientPtr client); +extern int ProcQueryXExtents (ClientPtr client); +extern int ProcQueryXBitmaps (ClientPtr client); +extern int ProcCloseFont (ClientPtr client); +#if 0 +extern void CloseDownClient (ClientPtr client); +#endif +extern void InitProcVectors (void); +extern void InitClient (ClientPtr client, int i, pointer ospriv); +extern ClientPtr NextAvailableClient (pointer ospriv); +extern void MarkClientException (ClientPtr client); + +#endif /* _DISPATCH_H_ */ diff --git a/include/fsevents.h b/include/fsevents.h new file mode 100644 index 0000000..1047235 --- /dev/null +++ b/include/fsevents.h @@ -0,0 +1,65 @@ +/* $XConsortium: events.h,v 1.5 94/04/17 19:55:57 dpw Exp $ */ +/* +Copyright (c) 1987 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + * Copyright 1990, 1991 Network Computing Devices; + * Portions Copyright 1987 by Digital Equipment Corporation + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the names of Network Computing Devices, + * or Digital not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Network Computing Devices, or Digital + * make no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * NETWORK COMPUTING DEVICES, AND DIGITAL DISCLAIM ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES, OR DIGITAL BE + * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)events.h 4.2 91/05/03 + * + */ +/* $XFree86: xc/programs/xfs/include/fsevents.h,v 1.3 1998/10/25 12:48:04 dawes Exp $ */ + +#ifndef _EVENTS_H_ +#define _EVENTS_H_ + +#include <misc.h> +#include "FS.h" + +extern int ProcGetEventMask(ClientPtr client); +extern int ProcSetEventMask(ClientPtr client); +extern void SendKeepAlive(ClientPtr client); +extern void SendKeepAliveEvent(ClientPtr client); +extern void WriteErrorToClient(ClientPtr client, fsError *error); + +#endif /* _EVENTS_H_ */ diff --git a/include/fsresource.h b/include/fsresource.h new file mode 100644 index 0000000..3f4c204 --- /dev/null +++ b/include/fsresource.h @@ -0,0 +1,98 @@ +/* $XConsortium: resource.h,v 1.4 94/04/17 19:56:00 dpw Exp $ */ +/* +Copyright (c) 1987 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from the X Consortium. + * Copyright 1990, 1991 Network Computing Devices; + * Portions Copyright 1987 by Digital Equipment Corporation + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the names of Network Computing Devices, + * or Digital not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Network Computing Devices, or Digital + * make no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * NETWORK COMPUTING DEVICES, AND DIGITAL DISCLAIM ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES, DIGITAL OR MIT BE + * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * @(#)resource.h 4.1 91/05/02 + * + */ +/* $XFree86: xc/programs/xfs/include/fsresource.h,v 1.4 1999/03/07 11:41:01 dawes Exp $ */ + +#ifndef _RESOURCE_H_ +#define _RESOURCE_H_ + +#include "misc.h" + +typedef unsigned long RESTYPE; + +#define RC_VANILLA ((RESTYPE)0) +#define RC_CACHED ((RESTYPE)1<<31) +#define RC_LASTPREDEF RC_CACHED +#define RC_ANY (~(RESTYPE)0) + +#define RT_FONT ((RESTYPE)1) +#define RT_AUTHCONT ((RESTYPE)2) +#define RT_LASTPREDEF RT_AUTHCONT +#define RT_NONE ((RESTYPE)0) + +#define CLIENTOFFSET 22 +#define RESOURCE_ID_MASK 0x3FFFFF +#define CLIENT_BITS(id) ((id) & 0x1fc00000) +#define CLIENT_ID(id) ((int)(CLIENT_BITS(id) >> CLIENTOFFSET)) +#define SERVER_BIT 0x20000000 + +#define INVALID (0) + +#define BAD_RESOURCE 0xe0000000 + +#ifdef NOTYET +extern Bool ChangeResourceValue(int cid, FSID id, RESTYPE rtype, pointer value); +extern FSID FakeClientID(int client); +extern RESTYPE CreateNewResourceClass(void); +extern RESTYPE CreateNewResourceType(DeleteType deleteFunc); +extern pointer LookupIDByClass(FSID id, RESTYPE classes); +extern void FreeResourceByType(int cid, FSID id, RESTYPE type, Bool skipFree); +#endif /* NOTYET */ + +extern Bool AddResource(int cid, FSID id, RESTYPE type, pointer value); +extern Bool InitClientResources(ClientPtr client); +extern FSID FakeClientID(int client); +extern pointer LookupIDByType(int cid, FSID id, RESTYPE rtype); +extern void FreeAllResources(void); +extern void FreeClientResources(ClientPtr client); +extern void FreeResource(int cid, FSID id, RESTYPE skipDeleteFuncType); +int NoneDeleteFunc (void *ptr, FSID id); + +#endif /* _RESOURCE_H_ */ diff --git a/include/swaprep.h b/include/swaprep.h new file mode 100644 index 0000000..df15318 --- /dev/null +++ b/include/swaprep.h @@ -0,0 +1,63 @@ +/* + * $XFree86: xc/programs/xfs/include/swaprep.h,v 1.1 1998/10/25 07:12:32 dawes Exp $ + */ + +/************************************************************ + +Copyright 1998 by Thomas E. Dickey <dickey@clark.net> + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of the above listed +copyright holder(s) not be used in advertising or publicity pertaining +to distribution of the software without specific, written prior +permission. + +THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD +TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE +LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +********************************************************/ + +/* + * difs/swaprep.c -- font server reply swapping + */ + + +#ifndef _SWAPREP_H_ +#define _SWAPREP_H_ 1 + +#include <misc.h> + +extern void CopySwap16Write (ClientPtr client, int size, short *pbuf); +extern void CopySwap32Write (ClientPtr client, int size, long *pbuf); +extern void SCreateACReply (ClientPtr client, int size, void * data); +extern void SErrorEvent (fsError *error, fsError *perror); +extern void SGenericReply (ClientPtr client, int size, void * data); +extern void SGetEventMaskReply (ClientPtr client, int size, void * data); +extern void SGetResolutionReply (ClientPtr client, int size, void * data); +extern void SListCataloguesReply (ClientPtr client, int size, void * data); +extern void SListExtensionsReply (ClientPtr client, int size, void * data); +extern void SListFontsReply (ClientPtr client, int size, void * data); +extern void SListFontsWithXInfoReply (ClientPtr client, int size, void * data); +extern void SOpenBitmapFontReply (ClientPtr client, int size, void * data); +extern void SQueryExtensionReply (ClientPtr client, int size, void * data); +extern void SQueryXBitmapsReply (ClientPtr client, int size, void * data); +extern void SQueryXExtentsReply (ClientPtr client, int size, void * data); +extern void SQueryXInfoReply (ClientPtr client, int size, void * data); +extern void Swap16Write (ClientPtr client, int size, short *pbuf); +extern void Swap32Write (ClientPtr client, int size, long *pbuf); +extern void SwapExtents (fsXCharInfo *extents, int num); +extern void SwapPropInfo (fsPropInfo *pi); +extern void WriteSConnSetup (ClientPtr client, fsConnSetup *pcsp); +extern void WriteSConnectionInfo (ClientPtr client, unsigned long size, char *pInfo); + +#endif /* _SWAPREP_H_ */ diff --git a/include/swapreq.h b/include/swapreq.h new file mode 100644 index 0000000..698aa34 --- /dev/null +++ b/include/swapreq.h @@ -0,0 +1,55 @@ +/* + * $XFree86: xc/programs/xfs/include/swapreq.h,v 1.2 2001/06/25 20:40:18 paulo Exp $ + */ + +/************************************************************ + +Copyright 1998 by Thomas E. Dickey <dickey@clark.net> + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of the above listed +copyright holder(s) not be used in advertising or publicity pertaining +to distribution of the software without specific, written prior +permission. + +THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD +TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE +LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +********************************************************/ + +/* + * difs/swapreq.h -- swapped requests + */ + + +#ifndef _SWAPREQ_H_ +#define _SWAPREQ_H_ 1 + +#include <misc.h> + +extern int SProcCreateAC(ClientPtr client); +extern int SProcListCatalogues(ClientPtr client); +extern int SProcListFonts(ClientPtr client); +extern int SProcListFontsWithXInfo(ClientPtr client); +extern int SProcOpenBitmapFont(ClientPtr client); +extern int SProcQueryExtension(ClientPtr client); +extern int SProcQueryXBitmaps(ClientPtr client); +extern int SProcQueryXExtents(ClientPtr client); +extern int SProcResourceRequest(ClientPtr client); +extern int SProcSetResolution(ClientPtr client); +extern int SProcSimpleRequest(ClientPtr client); +extern int SwapConnClientPrefix(ClientPtr client, fsConnClientPrefix *pCCP); +extern void SwapLongs(long *list, unsigned long count); +extern void SwapShorts(short *list, unsigned long count); + +#endif /* _SWAPREQ_H_ */ diff --git a/os/daemon.c b/os/daemon.c new file mode 100644 index 0000000..0e5ce3e --- /dev/null +++ b/os/daemon.c @@ -0,0 +1,167 @@ +/* + +Copyright (c) 1988 X Consortium + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the X Consortium shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from the X Consortium. + +*/ +/* $XFree86: xc/programs/xfs/os/daemon.c,v 1.12 2002/10/20 21:42:50 tsi Exp $ */ + +#include <X11/Xos.h> +#include <sys/types.h> +#include <errno.h> +#include <stdlib.h> + +#ifndef __GLIBC__ +# if defined(__osf__) || \ + defined(__GNU__) || \ + defined(__CYGWIN__) || \ + defined(linux) +# define setpgrp setpgid +# endif +#endif + +#if defined(SVR4) || defined(USG) || defined(__GLIBC__) +# include <termios.h> +#else +# include <sys/ioctl.h> +#endif +#ifdef hpux +# include <sys/ptyio.h> +#endif + +#ifdef X_NOT_POSIX +# define Pid_t int +#else +# define Pid_t pid_t +#endif + +#include "os.h" + +void +BecomeOrphan () +{ + Pid_t child_id; + + chdir("/"); + /* + * fork so that the process goes into the background automatically. Also + * has a nice side effect of having the child process get inherited by + * init (pid 1). + * Separate the child into its own process group before the parent + * exits. This eliminates the possibility that the child might get + * killed when the init script that's running xfs exits. + */ + + child_id = fork(); + switch (child_id) { + case 0: + /* child */ + break; + case -1: + /* error */ + FatalError("daemon fork failed, %s\n", strerror(errno)); + break; + + default: + /* parent */ + +#if defined(CSRG_BASED) || \ + defined(SYSV) || \ + defined(SVR4) || \ + defined(__QNXNTO__) || \ + defined(__GLIBC__) || \ + defined(linux) + { + int stat; +# if defined(SVR4) || defined(__QNXNTO__) + /* This gets error EPERM. Why? */ + stat = setpgid (child_id, child_id); +# elif defined(SYSV) + stat = 0; /* don't know how to set child's process group */ +# elif defined(__GLIBC__) + stat = setpgrp (); +# else + stat = setpgrp (child_id, child_id); +# endif + if (stat != 0) + FatalError("setting process group for daemon failed: %s\n", + strerror(errno)); + } +#endif /* ! (CSRG_BASED || SYSV || SVR4 || __QNXNTO__ || __GLIBC__) */ + exit (0); + } +} + +void +BecomeDaemon () +{ + /* + * Close standard file descriptors and get rid of controlling tty. + */ + + /* If our C library has the daemon() function, just use it. */ +#if defined(__GLIBC__) || defined(CSRG_BASED) + daemon (0, 0); +#else + register int i; + +# if defined(SYSV) || defined(SVR4) || defined(__QNXNTO__) + setpgrp (); +# else + setpgrp (0, getpid()); +# endif + + close (0); + close (1); + close (2); + +# if !defined(__UNIXOS2__) && !defined(__CYGWIN__) +# if !((defined(SYSV) || defined(SVR4)) && defined(i386)) + if ((i = open ("/dev/tty", O_RDWR)) >= 0) { /* did open succeed? */ +# if defined(USG) && defined(TCCLRCTTY) + int zero = 0; + (void) ioctl (i, TCCLRCTTY, &zero); +# else +# if (defined(SYSV) || defined(SVR4)) && defined(TIOCTTY) + int zero = 0; + (void) ioctl (i, TIOCTTY, &zero); +# else + (void) ioctl (i, TIOCNOTTY, (char *) 0); /* detach, BSD style */ +# endif +# endif + (void) close (i); + } +# endif /* !((SYSV || SVR4) && i386) */ +# endif /* !__UNIXOS2__ && !__CYGWIN__ */ + + /* + * Set up the standard file descriptors. + */ + (void) open ("/", O_RDONLY); /* root inode already in core */ + (void) dup2 (0, 1); + (void) dup2 (0, 2); +#endif +} @@ -0,0 +1,4 @@ +NAME XFS NOTWINDOWCOMPAT +DESCRIPTION "X11R6 XFree86 3.1.1 Font Server EMX 0.9A" +PROTMODE +EXETYPE OS2 |