5 * snapper@openmarket.com
7 * Copyright (c) 1996 Open Market, Inc.
9 * See the file "LICENSE" for information on usage and redistribution
10 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
16 #define WIN32_LEAN_AND_MEAN
21 #include "fcgi_config.h"
23 #ifdef HAVE_SYS_TIME_H
27 #ifdef HAVE_SYS_TYPES_H
28 #include <sys/types.h>
31 #if defined (c_plusplus) || defined (__cplusplus)
36 #define OS_Errno GetLastError()
37 #define OS_SetErrno(err) SetLastError(err)
39 #define O_NONBLOCK 0x0004 /* no delay */
42 #define OS_Errno errno
43 #define OS_SetErrno(err) errno = (err)
48 #define DLLAPI __declspec(dllimport)
55 /* This is the initializer for a "struct timeval" used in a select() call
56 * right after a new request is accept()ed to determine readablity. Its
57 * a drop-dead timer. Its only used for AF_UNIX sockets (not TCP sockets).
58 * Its a workaround for a kernel bug in Linux 2.0.x and SCO Unixware.
59 * Making this as small as possible, yet remain reliable would be best.
60 * 2 seconds is very conservative. 0,0 is not reliable. The shorter the
61 * timeout, the faster request processing will recover. The longer the
62 * timeout, the more likely this application being "busy" will cause other
63 * requests to abort and cause more dead sockets that need this timeout. */
64 #define READABLE_UNIX_FD_DROP_DEAD_TIMEVAL 2,0
67 #define STDIN_FILENO 0
71 #define STDOUT_FILENO 1
75 #define STDERR_FILENO 2
79 #define MAXPATHLEN 1024
87 # if defined(__STDC__) || defined(__cplusplus)
88 typedef void *ClientData;
90 typedef int *ClientData;
91 # endif /* __STDC__ */
95 typedef void (*OS_AsyncProc) (ClientData clientData, int len);
97 DLLAPI int OS_LibInit(int stdioFds[3]);
98 DLLAPI void OS_LibShutdown(void);
99 DLLAPI int OS_CreateLocalIpcFd(const char *bindPath, int backlog);
100 DLLAPI int OS_FcgiConnect(char *bindPath);
101 DLLAPI int OS_Read(int fd, char * buf, size_t len);
102 DLLAPI int OS_Write(int fd, char * buf, size_t len);
103 DLLAPI int OS_SpawnChild(char *execPath, int listenFd);
104 DLLAPI int OS_AsyncReadStdin(void *buf, int len, OS_AsyncProc procPtr,
105 ClientData clientData);
106 DLLAPI int OS_AsyncRead(int fd, int offset, void *buf, int len,
107 OS_AsyncProc procPtr, ClientData clientData);
108 DLLAPI int OS_AsyncWrite(int fd, int offset, void *buf, int len,
109 OS_AsyncProc procPtr, ClientData clientData);
110 DLLAPI int OS_Close(int fd, int shutdown);
111 DLLAPI int OS_CloseRead(int fd);
112 DLLAPI int OS_DoIo(struct timeval *tmo);
113 DLLAPI int OS_Accept(int listen_sock, int fail_on_intr, const char *webServerAddrs);
114 DLLAPI int OS_IpcClose(int ipcFd, int shutdown);
115 DLLAPI int OS_IsFcgi(int sock);
116 DLLAPI void OS_SetFlags(int fd, int flags);
118 DLLAPI void OS_ShutdownPending(void);
120 #if defined (__cplusplus) || defined (c_plusplus)
121 } /* terminate extern "C" { */
124 #endif /* _FCGIOS_H */