Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-05-18 08:29:51

0001 /*
0002  * fcgios.h --
0003  *
0004  *      Description of file.
0005  *
0006  *
0007  *  Copyright (c) 1996 Open Market, Inc.
0008  *  All rights reserved.
0009  *
0010  *  This file contains proprietary and confidential information and
0011  *  remains the unpublished property of Open Market, Inc. Use,
0012  *  disclosure, or reproduction is prohibited except as permitted by
0013  *  express written license agreement with Open Market, Inc.
0014  *
0015  *  Bill Snapper
0016  *  snapper@openmarket.com
0017  */
0018 #ifndef _FCGIOS_H
0019 #define _FCGIOS_H
0020 
0021 #ifdef _WIN32
0022 #define WIN32_LEAN_AND_MEAN 
0023 #include <windows.h>
0024 #include <winsock2.h>
0025 #endif
0026 
0027 #include "fcgi_config.h"
0028 
0029 #ifdef HAVE_SYS_TIME_H
0030 #include <sys/time.h>
0031 #endif
0032 
0033 #ifdef HAVE_SYS_TYPES_H
0034 #include <sys/types.h>
0035 #endif
0036 
0037 #if defined (c_plusplus) || defined (__cplusplus)
0038 extern "C" {
0039 #endif
0040 
0041 #ifdef _WIN32
0042 #define OS_Errno GetLastError()
0043 #define OS_SetErrno(err) SetLastError(err)
0044 #ifndef O_NONBLOCK
0045 #define O_NONBLOCK     0x0004  /* no delay */
0046 #endif
0047 #else /* !_WIN32 */
0048 #define OS_Errno errno
0049 #define OS_SetErrno(err) errno = (err)
0050 #endif /* !_WIN32 */
0051 
0052 #ifndef DLLAPI
0053 #if defined (_WIN32) && defined (_MSC_VER)
0054 #define DLLAPI __declspec(dllimport)
0055 #else
0056 #define DLLAPI
0057 #endif
0058 #endif
0059 
0060 
0061 /* This is the initializer for a "struct timeval" used in a select() call
0062  * right after a new request is accept()ed to determine readablity.  Its
0063  * a drop-dead timer.  Its only used for AF_UNIX sockets (not TCP sockets).
0064  * Its a workaround for a kernel bug in Linux 2.0.x and SCO Unixware.
0065  * Making this as small as possible, yet remain reliable would be best.
0066  * 2 seconds is very conservative.  0,0 is not reliable.  The shorter the
0067  * timeout, the faster request processing will recover.  The longer the
0068  * timeout, the more likely this application being "busy" will cause other
0069  * requests to abort and cause more dead sockets that need this timeout. */
0070 #define READABLE_UNIX_FD_DROP_DEAD_TIMEVAL 2,0
0071 
0072 #ifndef STDIN_FILENO
0073 #define STDIN_FILENO  0
0074 #endif
0075 
0076 #ifndef STDOUT_FILENO
0077 #define STDOUT_FILENO 1
0078 #endif
0079 
0080 #ifndef STDERR_FILENO
0081 #define STDERR_FILENO 2
0082 #endif
0083 
0084 #ifndef MAXPATHLEN
0085 #define MAXPATHLEN 1024
0086 #endif
0087 
0088 #ifndef X_OK
0089 #define X_OK       0x01
0090 #endif
0091 
0092 #ifndef _CLIENTDATA
0093 #   if defined(__STDC__) || defined(__cplusplus)
0094     typedef void *ClientData;
0095 #   else
0096     typedef int *ClientData;
0097 #   endif /* __STDC__ */
0098 #define _CLIENTDATA
0099 #endif
0100 
0101 typedef void (*OS_AsyncProc) (ClientData clientData, int len);
0102 
0103 DLLAPI int OS_LibInit(int stdioFds[3]);
0104 DLLAPI void OS_LibShutdown(void);
0105 DLLAPI int OS_CreateLocalIpcFd(const char *bindPath, int backlog);
0106 DLLAPI int OS_FcgiConnect(char *bindPath);
0107 DLLAPI int OS_Read(int fd, char * buf, size_t len);
0108 DLLAPI int OS_Write(int fd, char * buf, size_t len);
0109 DLLAPI int OS_SpawnChild(char *execPath, int listenFd);
0110 DLLAPI int OS_AsyncReadStdin(void *buf, int len, OS_AsyncProc procPtr,
0111                              ClientData clientData);
0112 DLLAPI int OS_AsyncRead(int fd, int offset, void *buf, int len,
0113                         OS_AsyncProc procPtr, ClientData clientData);
0114 DLLAPI int OS_AsyncWrite(int fd, int offset, void *buf, int len,
0115                          OS_AsyncProc procPtr, ClientData clientData);
0116 DLLAPI int OS_Close(int fd, int shutdown);
0117 DLLAPI int OS_CloseRead(int fd);
0118 DLLAPI int OS_DoIo(struct timeval *tmo);
0119 DLLAPI int OS_Accept(int listen_sock, int fail_on_intr, const char *webServerAddrs);
0120 DLLAPI int OS_IpcClose(int ipcFd, int shutdown);
0121 DLLAPI int OS_IsFcgi(int sock);
0122 DLLAPI void OS_SetFlags(int fd, int flags);
0123 
0124 DLLAPI void OS_ShutdownPending(void);
0125 
0126 #if defined (__cplusplus) || defined (c_plusplus)
0127 } /* terminate extern "C" { */
0128 #endif
0129 
0130 #endif /* _FCGIOS_H */