diff options
author | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-17 19:03:40 +0000 |
---|---|---|
committer | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-17 19:03:40 +0000 |
commit | 5c8484a80f4bf5d994df7b90709b2022f381e5cf (patch) | |
tree | 27585bbe88b0dacb8efb63b041f67b2f4f7cf0a6 | |
parent | 9e8dd4f7585c334c5b08f05f01c8900b5e4edf52 (diff) |
merge XFree86 4.3.0.1 to -CURRENT
-rw-r--r-- | include/X11/fonts/FSlib.h | 115 | ||||
-rw-r--r-- | src/FSClServ.c | 5 | ||||
-rw-r--r-- | src/FSConnServ.c | 10 | ||||
-rw-r--r-- | src/FSErrHndlr.c | 22 | ||||
-rw-r--r-- | src/FSOpenFont.c | 6 | ||||
-rw-r--r-- | src/FSOpenServ.c | 15 | ||||
-rw-r--r-- | src/FSQXExt.c | 5 | ||||
-rw-r--r-- | src/FSServName.c | 10 | ||||
-rw-r--r-- | src/FSSetCats.c | 7 | ||||
-rw-r--r-- | src/FSSynchro.c | 22 | ||||
-rw-r--r-- | src/FSlibInt.c | 41 | ||||
-rw-r--r-- | src/FSlibint.h | 78 | ||||
-rw-r--r-- | src/FSlibos.h | 23 |
13 files changed, 225 insertions, 134 deletions
diff --git a/include/X11/fonts/FSlib.h b/include/X11/fonts/FSlib.h index 7cf9c4e..50bdbbe 100644 --- a/include/X11/fonts/FSlib.h +++ b/include/X11/fonts/FSlib.h @@ -24,6 +24,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ +/* $XFree86: xc/lib/FS/FSlib.h,v 1.7 2001/12/19 21:37:29 dawes Exp $ */ /* @@ -58,7 +59,10 @@ in this Software without prior written authorization from The Open Group. #ifndef _FSLIB_H_ #define _FSLIB_H_ +#include <X11/Xfuncproto.h> + #include <X11/fonts/FS.h> +#include <X11/fonts/FSproto.h> #define Bool int #define Status int @@ -91,7 +95,7 @@ typedef struct _alternate { typedef struct _FSExtData { int number; /* number returned by FSRegisterExtension */ struct _FSExtData *next; /* next item on list of data for structure */ - int (*free_private) (); /* called to free private storage */ + int (*free_private) (char *); /* called to free private storage */ char *private_data; /* data private to this extension. */ } FSExtData; @@ -103,19 +107,23 @@ typedef struct { /* public to extension, cannot be changed */ int first_error; /* first error number for the extension */ } FSExtCodes; +typedef struct _FSServer FSServer; +typedef union _FSEvent FSEvent; + typedef struct _FSExtent { struct _FSExtent *next; /* next in list */ FSExtCodes codes; /* public information, all extension told */ - int (*close_server) (); /* routine to call when connection + int (*close_server) (FSServer *, FSExtCodes *); /* routine to call when connection * closed */ - int (*error) (); /* who to call when an error occurs */ - int (*error_string) (); /* routine to supply error string */ + int (*error) (FSServer *, fsError *, FSExtCodes *, int *); /* who to call when an error occurs */ + int (*error_string) (FSServer *, int, FSExtCodes *, char *, int); /* routine to supply error string */ char *name; } _FSExtension; +typedef int (*FSSyncHandler)(FSServer *); /* server data structure */ -typedef struct _FSServer { +struct _FSServer { struct _FSServer *next; int fd; int proto_version; @@ -141,14 +149,14 @@ typedef struct _FSServer { FSExtData *ext_data; _FSExtension *ext_procs; int ext_number; - Bool (*event_vec[132]) (); - Status(*wire_vec[132]) (); + Bool (*event_vec[132]) (FSServer *, FSEvent *, fsEvent *); + Status (*wire_vec[132]) (FSServer *, FSEvent *, fsEvent *); char *scratch_buffer; unsigned long scratch_length; - int (*synchandler) (); + FSSyncHandler synchandler; unsigned long flags; struct _XtransConnInfo *trans_conn; /* transport connection object */ -} FSServer; +}; typedef struct { int type; @@ -167,10 +175,10 @@ typedef struct { unsigned char minor_code; } FSErrorEvent; -typedef union _FSEvent { +union _FSEvent { int type; FSAnyEvent fsany; -} FSEvent; +}; typedef struct _FSQEvent { struct _FSQEvent *next; @@ -232,25 +240,74 @@ typedef struct _FSXFontInfoHeader { } FSXFontInfoHeader; -/* function decls */ - -FSServer *FSOpenServer(); - -extern int (*FSSynchronize()) (); -extern int (*FSSetAfterFunction()) (); -char *FSServerName(); -char **FSListExtensions(); -Bool FSQueryExtension(); - -char **FSListCatalogues(); -char **FSGetCatalogues(); - -long FSMaxRequestSize(); - -char **FSListFonts(); -char **FSListFontsWithXInfo(); +/* function decls */ -Font FSOpenBitmapFont(); +_XFUNCPROTOBEGIN + +extern FSServer * FSOpenServer ( char *server ); + +extern FSSyncHandler FSSynchronize(FSServer *, int); +extern FSSyncHandler FSSetAfterFunction(FSServer *, FSSyncHandler); + +extern char * FSServerName ( char *server ); +extern char ** FSListExtensions ( FSServer *svr, int *next ); +extern int FSQueryExtension ( FSServer *svr, char *name, int *major_opcode, + int *first_event, int *first_error ); + +extern char ** FSListCatalogues ( FSServer *svr, char *pattern, + int maxNames, int *actualCount ); +extern char ** FSGetCatalogues ( FSServer *svr, int *num ); + +extern long FSMaxRequestSize ( FSServer *svr ); + +extern char ** FSListFonts ( FSServer *svr, char *pattern, int maxNames, + int *actualCount ); +extern char ** FSListFontsWithXInfo ( FSServer *svr, char *pattern, + int maxNames, int *count, + FSXFontInfoHeader ***info, + FSPropInfo ***pprops, + FSPropOffset ***offsets, + unsigned char ***prop_data ); +extern Font FSOpenBitmapFont ( FSServer *svr, FSBitmapFormat hint, + FSBitmapFormatMask fmask, char *name, + Font *otherid ); + +extern int FSSync ( FSServer *svr, Bool discard ); + +extern int FSCloseServer ( FSServer *svr ); +extern int FSCloseFont ( FSServer *svr, Font fid ); +extern int FSGetErrorDatabaseText ( FSServer *svr, char *name, char *type, + char *defaultp, char *buffer, int nbytes ); +extern int FSGetErrorText ( FSServer *svr, int code, char *buffer, + + int nbytes ); +extern int FSFlush ( FSServer *svr ); +extern int FSFreeFontNames ( char **list ); +extern int FSFreeCatalogues ( char **list ); +extern int FSFreeExtensionList ( char **list ); +extern int FSNextEvent ( FSServer *svr, FSEvent *event ); +extern int FSQueryXBitmaps8 ( FSServer *svr, Font fid, FSBitmapFormat format, + int range_type, unsigned char *str, + unsigned long str_len, FSOffset **offsets, + unsigned char **glyphdata ); +extern int FSQueryXBitmaps16 ( FSServer *svr, Font fid, FSBitmapFormat format, + int range_type, FSChar2b *str, + unsigned long str_len, FSOffset **offsets, + unsigned char **glyphdata ); +extern int FSQueryXExtents8 ( FSServer *svr, Font fid, int range_type, + unsigned char *str, unsigned long str_len, + FSXCharInfo **extents ); +extern int FSQueryXExtents16 ( FSServer *svr, Font fid, int range_type, + FSChar2b *str, unsigned long str_len, + FSXCharInfo **extents ); +extern int FSQueryXInfo ( FSServer *svr, Font fid, FSXFontInfoHeader *info, + FSPropInfo *props, FSPropOffset **offsets, + unsigned char **prop_data ); +extern int FSSetCatalogues ( FSServer *svr, int num, char **cats ); +extern int FSFree ( char *data ); +extern unsigned char * FSMalloc ( unsigned size ); + +_XFUNCPROTOEND #endif /* _FSLIB_H_ */ diff --git a/src/FSClServ.c b/src/FSClServ.c index f7cc8ad..e5a36a3 100644 --- a/src/FSClServ.c +++ b/src/FSClServ.c @@ -24,6 +24,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ +/* $XFree86: xc/lib/FS/FSClServ.c,v 1.5 2001/12/14 19:53:32 dawes Exp $ */ /* @@ -51,6 +52,7 @@ in this Software without prior written authorization from The Open Group. */ +#include "FSlib.h" #include "FSlibint.h" extern FSServer *_FSHeadOfServerList; @@ -62,9 +64,6 @@ FSCloseServer(svr) _FSExtension *ext; FSServer **sv = &_FSHeadOfServerList; FSServer *s = _FSHeadOfServerList; - extern void _FSFreeQ(); - extern void _FSDisconnectServer(); - extern int FSSync(); svr->flags |= FSlibServerClosing; (void) FSSync(svr, 1); /* throw out pending events */ diff --git a/src/FSConnServ.c b/src/FSConnServ.c index 5def4c3..8de4f2e 100644 --- a/src/FSConnServ.c +++ b/src/FSConnServ.c @@ -50,6 +50,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/lib/FS/FSConnServ.c,v 3.11 2001/12/14 19:53:32 dawes Exp $ */ #include <stdio.h> #include "FSlibint.h" @@ -60,8 +61,12 @@ in this Software without prior written authorization from The Open Group. #ifdef WIN32 #define ECHECK(err) (WSAGetLastError() == err) #else +#ifdef ISC +#define ECHECK(err) ((errno == err) || errno == EAGAIN || errno == EWOULDBLOCK) +#else #define ECHECK(err) (errno == err) #endif +#endif /* * Attempts to connect to server, given server name. Returns transport @@ -74,7 +79,7 @@ XtransConnInfo _FSConnectServer(server_name) char *server_name; { - XtransConnInfo trans_conn; /* transport connection object */ + XtransConnInfo trans_conn = NULL; /* transport connection object */ int retry, connect_stat; int madeConnection = 0; @@ -134,8 +139,7 @@ _FSDisconnectServer(trans_conn) (void) _FSTransClose(trans_conn); } -#undef NULL -#define NULL ((char *) 0) + /* * This is an OS dependent routine which: * 1) returns as soon as the connection can be written on.... diff --git a/src/FSErrHndlr.c b/src/FSErrHndlr.c index 129605b..40fcccd 100644 --- a/src/FSErrHndlr.c +++ b/src/FSErrHndlr.c @@ -23,7 +23,8 @@ * 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. - */ +*/ +/* $XFree86: xc/lib/FS/FSErrHndlr.c,v 1.5 2001/12/14 19:53:32 dawes Exp $ */ /* @@ -53,14 +54,10 @@ in this Software without prior written authorization from The Open Group. #include "FSlibint.h" -extern int _FSDefaultError(); -extern int _FSDefaultIOError(); - -int (* - FSSetErrorHandler(handler)) () - int (*handler) (); +FSErrorHandler +FSSetErrorHandler(FSErrorHandler handler) { - int (*oldhandler) () = _FSErrorFunction; + FSErrorHandler oldhandler = _FSErrorFunction; if (handler != NULL) { _FSErrorFunction = handler; @@ -70,13 +67,10 @@ int (* return oldhandler; } -extern int _FSIOError(); - -int (* - FSSetIOErrorHandler(handler)) () - int (*handler) (); +FSIOErrorHandler +FSSetIOErrorHandler(FSIOErrorHandler handler) { - int (*oldhandler) () = _FSIOErrorFunction; + FSIOErrorHandler oldhandler = _FSIOErrorFunction; if (handler != NULL) { _FSIOErrorFunction = handler; diff --git a/src/FSOpenFont.c b/src/FSOpenFont.c index 0ed7bd5..8c137d7 100644 --- a/src/FSOpenFont.c +++ b/src/FSOpenFont.c @@ -24,6 +24,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ +/* $XFree86: xc/lib/FS/FSOpenFont.c,v 1.6 2001/12/14 19:53:33 dawes Exp $ */ /* @@ -65,13 +66,12 @@ FSOpenBitmapFont(svr, hint, fmask, name, otherid) fsOpenBitmapFontReq *req; fsOpenBitmapFontReply reply; Font fid; - unsigned char buf[256]; - char* bufptr; + char buf[256]; nbytes = name ? strlen(name) : 0; if (nbytes > 255) return 0; GetReq(OpenBitmapFont, req); - buf[0] = (unsigned char) nbytes; + buf[0] = nbytes; memcpy(&buf[1], name, nbytes); nbytes++; req->fid = fid = svr->resource_id++; diff --git a/src/FSOpenServ.c b/src/FSOpenServ.c index 7d006a9..b3b8612 100644 --- a/src/FSOpenServ.c +++ b/src/FSOpenServ.c @@ -24,6 +24,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ +/* $XFree86: xc/lib/FS/FSOpenServ.c,v 1.6 2001/12/14 19:53:33 dawes Exp $ */ /* @@ -65,11 +66,9 @@ static fsReq _dummy_request = { 0, 0, 0 }; -FSServer *_FSHeadOfServerList = NULL; +static void OutOfMemory ( FSServer *svr, char *setup ); -extern Bool _FSWireToEvent(); -extern Status _FSUnknownNativeEvent(); -extern Bool _FSUnknownWireEvent(); +FSServer *_FSHeadOfServerList = NULL; void _FSFreeServerStructure(svr) FSServer *svr; @@ -90,7 +89,6 @@ void OutOfMemory(svr, setup) FSServer *svr; char *setup; { - extern void _FSDisconnectServer(); _FSDisconnectServer(svr->trans_conn); _FSFreeServerStructure(svr); @@ -121,11 +119,6 @@ FSOpenServer(server) int altlen; char *vendor_string; long setuplength; - extern void _FSSendClientPrefix(); - extern XtransConnInfo _FSConnectServer(); -#ifdef X_NOT_STDC_ENV - extern char *getenv(); -#endif if (server == NULL || *server == '\0') { if ((server = getenv("FONTSERVER")) == NULL) { @@ -192,7 +185,7 @@ FSOpenServer(server) } bcopy(ad, alts[i].name, altlen); alts[i].name[altlen] = '\0'; - ad += altlen + (4 - (altlen + 2) & 3); + ad += altlen + ((4 - (altlen + 2)) & 3); } FSfree((char *) alt_data); diff --git a/src/FSQXExt.c b/src/FSQXExt.c index 81b6814..f96cad0 100644 --- a/src/FSQXExt.c +++ b/src/FSQXExt.c @@ -24,6 +24,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ +/* $XFree86: xc/lib/FS/FSQXExt.c,v 1.5 2001/12/14 19:53:33 dawes Exp $ */ /* @@ -54,9 +55,7 @@ in this Software without prior written authorization from The Open Group. #include "FSlibint.h" static void -_FS_convert_char_info(src, dst) - fsXCharInfo *src; - FSXCharInfo *dst; +_FS_convert_char_info(fsXCharInfo *src, FSXCharInfo *dst) { dst->ascent = src->ascent; dst->descent = src->descent; diff --git a/src/FSServName.c b/src/FSServName.c index e7b63e3..43f806d 100644 --- a/src/FSServName.c +++ b/src/FSServName.c @@ -24,6 +24,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ +/* $XFree86: xc/lib/FS/FSServName.c,v 1.4 2001/12/14 19:53:33 dawes Exp $ */ /* @@ -52,13 +53,8 @@ in this Software without prior written authorization from The Open Group. */ #include <stdio.h> - -#include <X11/Xosdefs.h> -#ifndef X_NOT_STDC_ENV -#include <stdlib.h> -#else -char *getenv(); -#endif +#include <X11/Xosdefs.h> +#include <stdlib.h> char * FSServerName(server) diff --git a/src/FSSetCats.c b/src/FSSetCats.c index cd05a94..e73133f 100644 --- a/src/FSSetCats.c +++ b/src/FSSetCats.c @@ -24,6 +24,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ +/* $XFree86: xc/lib/FS/FSSetCats.c,v 1.5 2001/12/14 19:53:33 dawes Exp $ */ /* @@ -59,9 +60,9 @@ FSSetCatalogues(svr, num, cats) int num; char **cats; { - unsigned char nbytes; + int nbytes; fsSetCataloguesReq *req; - unsigned char buf[256]; + char buf[256]; int i; int len, tlen, tnum; @@ -79,7 +80,7 @@ FSSetCatalogues(svr, num, cats) for (i = 0; i < num; i++) { nbytes = strlen(cats[i]); if (nbytes < 256) { - buf[0] = (unsigned char) nbytes; + buf[0] = nbytes; memcpy(&buf[1], cats[i], nbytes); nbytes++; _FSSend(svr, buf, (long) nbytes); diff --git a/src/FSSynchro.c b/src/FSSynchro.c index 3e6654c..884cfd3 100644 --- a/src/FSSynchro.c +++ b/src/FSSynchro.c @@ -24,6 +24,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ +/* $XFree86: xc/lib/FS/FSSynchro.c,v 1.5 2001/12/14 19:53:33 dawes Exp $ */ /* @@ -51,23 +52,20 @@ in this Software without prior written authorization from The Open Group. */ +#include "FSlib.h" #include "FSlibint.h" static int -_FSSyncFunction(svr) - FSServer *svr; +_FSSyncFunction(FSServer *svr) { - extern int FSSync(); return FSSync(svr, 0); } -int -(* FSSynchronize(svr, onoff)) () - FSServer *svr; - int onoff; +FSSyncHandler +FSSynchronize(FSServer *svr, int onoff) { - int (*temp) (); + FSSyncHandler temp; temp = svr->synchandler; if (onoff) @@ -77,12 +75,12 @@ int return temp; } -int -(* FSSetAfterFunction(svr, func)) () +FSSyncHandler +FSSetAfterFunction(svr, func) FSServer *svr; - int (*func) (); + FSSyncHandler func; { - int (*temp) (); + FSSyncHandler temp; temp = svr->synchandler; svr->synchandler = func; diff --git a/src/FSlibInt.c b/src/FSlibInt.c index b485b9d..accbab4 100644 --- a/src/FSlibInt.c +++ b/src/FSlibInt.c @@ -50,6 +50,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/lib/FS/FSlibInt.c,v 3.10 2001/12/14 19:53:33 dawes Exp $ */ /* * FSlibInt.c - Internal support routines for the C subroutine @@ -59,7 +60,8 @@ in this Software without prior written authorization from The Open Group. #include "FSlibint.h" #include <X11/Xos.h> -static void _EatData32(); +static void _EatData32 ( FSServer *svr, unsigned long n ); +static char * _SysErrorMsg ( int n ); /* check for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX * systems are broken and return EWOULDBLOCK when they should return EAGAIN @@ -81,7 +83,11 @@ static void _EatData32(); #define ECHECK(err) (WSAGetLastError() == err) #define ESET(val) WSASetLastError(val) #else +#ifdef ISC +#define ECHECK(err) ((errno == err) || ETEST()) +#else #define ECHECK(err) (errno == err) +#endif #define ESET(val) errno = val #endif @@ -271,19 +277,37 @@ _FSRead(svr, data, size) register long size; { register long bytes_read; +#if defined(SVR4) && defined(i386) + int num_failed_reads = 0; +#endif if (size == 0) return; ESET(0); + /* + * For SVR4 with a unix-domain connection, ETEST() after selecting + * readable means the server has died. To do this here, we look for + * two consecutive reads returning ETEST(). + */ while ((bytes_read = _FSTransRead(svr->trans_conn, data, (int) size)) != size) { if (bytes_read > 0) { size -= bytes_read; data += bytes_read; +#if defined(SVR4) && defined(i386) + num_failed_reads = 0; +#endif } else if (ETEST()) { _FSWaitForReadable(svr); +#if defined(SVR4) && defined(i386) + num_failed_reads++; + if (num_failed_reads > 1) { + ESET(EPIPE); + (*_FSIOErrorFunction) (svr); + } +#endif ESET(0); } #ifdef SUNSYSV @@ -300,6 +324,10 @@ _FSRead(svr, data, size) /* If it's a system call interrupt, it's not an error. */ if (!ECHECK(EINTR)) (*_FSIOErrorFunction) (svr); +#if defined(SVR4) && defined(i386) + else + num_failed_reads = 0; +#endif } } } @@ -922,6 +950,7 @@ _SysErrorMsg(n) * _FSDefaultIOError - Default fatal system error reporting routine. Called * when an X internal system error is encountered. */ +int _FSDefaultIOError(svr) FSServer *svr; { @@ -944,6 +973,7 @@ _FSDefaultIOError(svr) " The connection was probably broken by a server shutdown.\r\n"); } exit(1); + /* NOTREACHED */ } /* @@ -986,8 +1016,6 @@ _FSPrintDefaultError(svr, event, fp) char number[32]; char *mtype = "FSlibMessage"; register _FSExtension *ext = (_FSExtension *) NULL; - extern int FSGetErrorText(); - extern int FSGetErrorDatabaseText(); (void) FSGetErrorText(svr, event->error_code, buffer, BUFSIZ); (void) FSGetErrorDatabaseText(svr, mtype, "FSError", "FS Error", mesg, @@ -1046,8 +1074,9 @@ _FSDefaultError(svr, event) /* NOTREACHED */ } -int (*_FSIOErrorFunction) () = _FSDefaultIOError; -int (*_FSErrorFunction) () = _FSDefaultError; + +FSIOErrorHandler _FSIOErrorFunction = _FSDefaultIOError; +FSErrorHandler _FSErrorFunction = _FSDefaultError; /* * This routine can be used to (cheaply) get some memory within a single @@ -1254,8 +1283,10 @@ _FSFreeQ() } #ifdef _POSIX_SOURCE /* stupid makedepend [need if] */ +#ifndef __QNX__ /* QNX's uname nodename entry is not same as tcpip hostname */ #define NEED_UTSNAME #endif +#endif #ifdef hpux #define NEED_UTSNAME #endif diff --git a/src/FSlibint.h b/src/FSlibint.h index 7b7af15..06910ce 100644 --- a/src/FSlibint.h +++ b/src/FSlibint.h @@ -50,11 +50,12 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/lib/FS/FSlibint.h,v 3.7 2001/12/14 19:53:33 dawes Exp $ */ /* * FSlib internal decls */ - +#include <stdio.h> #ifdef USG #ifndef __TYPES__ #include <sys/types.h> /* forgot to protect it... */ @@ -74,31 +75,46 @@ in this Software without prior written authorization from The Open Group. #include "FSproto.h" #include "FSlibos.h" #include <errno.h> - -#ifndef NULL -#define NULL 0 -#endif - -#ifdef X_NOT_STDC_ENV -extern int errno; /* Internal system error number. */ -#endif - -extern int (*_FSIOErrorFunction) (); -extern int (*_FSErrorFunction) (); - -extern void _FSEatData(); -extern void _FSWaitForWritable(); -extern void _FSWaitForReadable(); -extern void _FSFlush(); -extern void _FSRead(); -extern void _FSReadEvents(); -extern void _FSReadPad(); -extern void _FSSend(); -extern void _FSEnq(); -extern void _FSFreeServerStructure(); -extern int _FSError(); -extern int _FSTransGetConnectionNumber(); -extern Status _FSReply(); +#include <stddef.h> + +typedef int (* FSIOErrorHandler)(FSServer *); +typedef int (* FSErrorHandler)(FSServer *, FSErrorEvent *); + +extern FSIOErrorHandler _FSIOErrorFunction; +extern FSErrorHandler _FSErrorFunction; + +extern void _FSEatData ( FSServer *svr, unsigned long n ); +extern void _FSWaitForWritable ( FSServer *svr ); +extern void _FSWaitForReadable ( FSServer *svr ); +extern void _FSFlush ( FSServer *svr ); +extern void _FSRead ( FSServer *svr, char *data, long size ); +extern void _FSReadEvents ( FSServer *svr ); +extern void _FSReadPad ( FSServer *svr, char *data, long size ); +extern void _FSSend ( FSServer *svr, char *data, long size ); +extern void _FSEnq ( FSServer *svr, fsEvent *event ); +extern void _FSFreeServerStructure ( FSServer *svr ); +extern int _FSError ( FSServer *svr, fsError *rep ); +extern int _FSReply ( FSServer *svr, fsReply *rep, int extra, int discard ); +extern XtransConnInfo _FSConnectServer ( char *server_name ); +extern void _FSDisconnectServer ( XtransConnInfo trans_conn ); +extern void _FSSendClientPrefix ( FSServer *svr, fsConnClientPrefix *client ); +extern int _FSEventsQueued ( FSServer *svr, int mode ); +extern unsigned long _FSSetLastRequestRead ( FSServer *svr, + fsGenericReply *rep ); +extern int _FSUnknownWireEvent ( FSServer *svr, FSEvent *re, fsEvent *event ); +extern int _FSUnknownNativeEvent ( FSServer *svr, FSEvent *re, + fsEvent *event ); +extern int _FSWireToEvent ( FSServer *svr, FSEvent *re, fsEvent *event ); +extern int _FSDefaultIOError ( FSServer *svr ); +extern int _FSPrintDefaultError ( FSServer *svr, FSErrorEvent *event, + FILE *fp ); +extern int _FSDefaultError ( FSServer *svr, FSErrorEvent *event ); +extern char * _FSAllocScratch ( FSServer *svr, unsigned long nbytes ); +extern void _FSFreeQ ( void ); +extern int _FSGetHostname ( char *buf, int maxlen ); + +extern FSErrorHandler FSSetErrorHandler ( FSErrorHandler handler ); +extern FSIOErrorHandler FSSetIOErrorHandler ( FSIOErrorHandler handler ); #ifndef BUFSIZE #define BUFSIZE 2048 /* FS output buffer size. */ @@ -141,7 +157,7 @@ extern Status _FSReply(); * */ -#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) +#if !defined(UNIXCPP) || defined(ANSICPP) #define GetReq(name, req) \ WORD64ALIGN\ if ((svr->bufptr + SIZEOF(fs##name##Req)) > svr->bufmax)\ @@ -168,7 +184,7 @@ extern Status _FSReply(); /* GetReqExtra is the same as GetReq, but allocates "n" additional bytes after the request. "n" must be a multiple of 4! */ -#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) +#if !defined(UNIXCPP) || defined(ANSICPP) #define GetReqExtra(name, n, req) \ WORD64ALIGN\ if ((svr->bufptr + SIZEOF(fs##name##Req) + n) > svr->bufmax)\ @@ -197,7 +213,7 @@ extern Status _FSReply(); * "rid" is the name of the resource. */ -#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) +#if !defined(UNIXCPP) || defined(ANSICPP) #define GetResReq(name, rid, req) \ WORD64ALIGN\ if ((svr->bufptr + SIZEOF(fsResourceReq)) > svr->bufmax)\ @@ -226,7 +242,7 @@ extern Status _FSReply(); * at all. */ -#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) +#if !defined(UNIXCPP) || defined(ANSICPP) #define GetEmptyReq(name, req) \ WORD64ALIGN\ if ((svr->bufptr + SIZEOF(fsReq)) > svr->bufmax)\ @@ -336,7 +352,7 @@ extern void Data(); * don't line up with proto */ -#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) +#if !defined(UNIXCPP) || defined(ANSICPP) #define FSCat(x,y) x##_##y #else #define FSCat(x,y) x/**/_/**/y diff --git a/src/FSlibos.h b/src/FSlibos.h index 1d03b06..5be36ec 100644 --- a/src/FSlibos.h +++ b/src/FSlibos.h @@ -50,6 +50,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/lib/FS/FSlibos.h,v 3.9 2002/05/31 18:45:39 dawes Exp $ */ /* * FSlib networking & os include file @@ -87,18 +88,30 @@ in this Software without prior written authorization from The Open Group. #ifdef NOFILE #define OPEN_MAX NOFILE #else +#if !defined(__UNIXOS2__) && !defined(__QNX__) +#ifdef __GNU__ +#define OPEN_MAX (sysconf(_SC_OPEN_MAX)) +#else /* !__GNU__ */ #define OPEN_MAX NOFILES_MAX +#endif /* __GNU__ */ +#else /* !__UNIXOS2__ && !__QNX__ */ +#define OPEN_MAX 256 +#endif /* __UNIXOS2__ */ #endif #endif #endif #endif #endif +#ifdef __GNU__ +#define FS_OPEN_MAX 256 +#else /*!__GNU__*/ #if OPEN_MAX > 256 #define FS_OPEN_MAX 256 #else #define FS_OPEN_MAX OPEN_MAX #endif +#endif /*__GNU__*/ #endif /* FS_OPEN_MAX */ @@ -243,18 +256,8 @@ typedef fd_set FdSet; #endif #include <X11/Xtrans.h> -#ifndef X_NOT_STDC_ENV #include <stdlib.h> #include <string.h> -#else -char *malloc(), *realloc(), *calloc(); -void exit(); -#ifdef SYSV -#include <string.h> -#else -#include <strings.h> -#endif -#endif /* * The following definitions can be used for locking requests in multi-threaded |