7 * Copyright (c) 1996 Open Market, Inc.
10 * This file contains proprietary and confidential information and
11 * remains the unpublished property of Open Market, Inc. Use,
12 * disclosure, or reproduction is prohibited except as permitted by
13 * express written license agreement with Open Market, Inc.
16 * snapper@openmarket.com
22 #define WIN32_LEAN_AND_MEAN
27 #include "fcgi_config.h"
29 #ifdef HAVE_SYS_TIME_H
33 #if defined (c_plusplus) || defined (__cplusplus)
38 #define OS_Errno GetLastError()
39 #define OS_SetErrno(err) SetLastError(err)
41 #define DLLAPI __declspec(dllimport)
44 #define O_NONBLOCK 0x0004 /* no delay */
48 #define OS_Errno errno
49 #define OS_SetErrno(err) errno = (err)
52 /* This is the initializer for a "struct timeval" used in a select() call
53 * right after a new request is accept()ed to determine readablity. Its
54 * a drop-dead timer. Its only used for AF_UNIX sockets (not TCP sockets).
55 * Its a workaround for a kernel bug in Linux 2.0.x and SCO Unixware.
56 * Making this as small as possible, yet remain reliable would be best.
57 * 2 seconds is very conservative. 0,0 is not reliable. The shorter the
58 * timeout, the faster request processing will recover. The longer the
59 * timeout, the more likely this application being "busy" will cause other
60 * requests to abort and cause more dead sockets that need this timeout. */
61 #define READABLE_UNIX_FD_DROP_DEAD_TIMEVAL 2,0
64 #define STDIN_FILENO 0
68 #define STDOUT_FILENO 1
72 #define STDERR_FILENO 2
76 #define MAXPATHLEN 1024
84 # if defined(__STDC__) || defined(__cplusplus)
85 typedef void *ClientData;
87 typedef int *ClientData;
88 # endif /* __STDC__ */
92 typedef void (*OS_AsyncProc) (ClientData clientData, int len);
94 DLLAPI int OS_LibInit(int stdioFds[3]);
95 DLLAPI void OS_LibShutdown(void);
96 DLLAPI int OS_CreateLocalIpcFd(const char *bindPath, int backlog);
97 DLLAPI int OS_FcgiConnect(char *bindPath);
98 DLLAPI int OS_Read(int fd, char * buf, size_t len);
99 DLLAPI int OS_Write(int fd, char * buf, size_t len);
100 DLLAPI int OS_SpawnChild(char *execPath, int listenFd);
101 DLLAPI int OS_AsyncReadStdin(void *buf, int len, OS_AsyncProc procPtr,
102 ClientData clientData);
103 DLLAPI int OS_AsyncRead(int fd, int offset, void *buf, int len,
104 OS_AsyncProc procPtr, ClientData clientData);
105 DLLAPI int OS_AsyncWrite(int fd, int offset, void *buf, int len,
106 OS_AsyncProc procPtr, ClientData clientData);
107 DLLAPI int OS_Close(int fd);
108 DLLAPI int OS_CloseRead(int fd);
109 DLLAPI int OS_DoIo(struct timeval *tmo);
110 DLLAPI int OS_Accept(int listen_sock, int fail_on_intr, const char *webServerAddrs);
111 DLLAPI int OS_IpcClose(int ipcFd);
112 DLLAPI int OS_IsFcgi(int sock);
113 DLLAPI void OS_SetFlags(int fd, int flags);
115 #if defined (__cplusplus) || defined (c_plusplus)
116 } /* terminate extern "C" { */
119 #endif /* _FCGIOS_H */