Commit | Line | Data |
ee03fac4 |
1 | /* |
0198fd3c |
2 | * fcgios.h -- |
3 | * |
4 | * Description of file. |
5 | * |
6 | * |
7 | * Copyright (c) 1996 Open Market, Inc. |
8 | * All rights reserved. |
9 | * |
10 | * This file contains proprietary and confidential information and |
ee03fac4 |
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. |
0198fd3c |
14 | * |
15 | * Bill Snapper |
16 | * snapper@openmarket.com |
17 | */ |
18 | #ifndef _FCGIOS_H |
19 | #define _FCGIOS_H |
20 | |
21 | #ifdef _WIN32 |
fdb63fa0 |
22 | #include <io.h> |
0198fd3c |
23 | #define OS_Errno GetLastError() |
24 | #define OS_SetErrno(err) SetLastError(err) |
25 | #ifndef DLLAPI |
26 | #define DLLAPI __declspec(dllimport) |
27 | #endif |
fdb63fa0 |
28 | |
29 | #else /* !_WIN32 */ |
30 | #ifdef HAVE_SYS_TIME_H |
31 | #include <sys/time.h> |
32 | #endif |
0198fd3c |
33 | #define DLLAPI |
34 | #define OS_Errno errno |
35 | #define OS_SetErrno(err) errno = (err) |
fdb63fa0 |
36 | #endif /* !_WIN32 */ |
0198fd3c |
37 | |
0198fd3c |
38 | |
4a7222d7 |
39 | /* This is the initializer for a "struct timeval" used in a select() call |
40 | * right after a new request is accept()ed to determine readablity. Its |
41 | * a drop-dead timer. Its only used for AF_UNIX sockets (not TCP sockets). |
42 | * Its a workaround for a kernel bug in Linux 2.0.x and SCO Unixware. |
43 | * Making this as small as possible, yet remain reliable would be best. |
ee03fac4 |
44 | * 2 seconds is very conservative. 0,0 is not reliable. The shorter the |
4a7222d7 |
45 | * timeout, the faster request processing will recover. The longer the |
46 | * timeout, the more likely this application being "busy" will cause other |
47 | * requests to abort and cause more dead sockets that need this timeout. */ |
48 | #define READABLE_UNIX_FD_DROP_DEAD_TIMEVAL 2,0 |
49 | |
0198fd3c |
50 | #ifndef STDIN_FILENO |
51 | #define STDIN_FILENO 0 |
52 | #endif |
53 | |
0198fd3c |
54 | #ifndef STDOUT_FILENO |
55 | #define STDOUT_FILENO 1 |
56 | #endif |
57 | |
58 | #ifndef STDERR_FILENO |
59 | #define STDERR_FILENO 2 |
60 | #endif |
61 | |
62 | #ifndef MAXPATHLEN |
63 | #define MAXPATHLEN 1024 |
64 | #endif |
65 | |
66 | #ifndef X_OK |
67 | #define X_OK 0x01 |
68 | #endif |
69 | |
70 | #ifdef _WIN32 |
71 | #ifndef O_NONBLOCK |
72 | #define O_NONBLOCK 0x0004 /* no delay */ |
73 | #endif |
74 | #endif |
75 | |
76 | #if defined (c_plusplus) || defined (__cplusplus) |
77 | extern "C" { |
78 | #endif |
79 | |
80 | #ifndef _CLIENTDATA |
81 | # if defined(__STDC__) || defined(__cplusplus) |
82 | typedef void *ClientData; |
83 | # else |
84 | typedef int *ClientData; |
85 | # endif /* __STDC__ */ |
86 | #define _CLIENTDATA |
87 | #endif |
88 | |
89 | typedef void (*OS_AsyncProc) (ClientData clientData, int len); |
90 | |
91 | DLLAPI int OS_LibInit(int stdioFds[3]); |
92 | DLLAPI void OS_LibShutdown(void); |
93 | DLLAPI int OS_CreateLocalIpcFd(char *bindPath); |
94 | DLLAPI int OS_FcgiConnect(char *bindPath); |
95 | DLLAPI int OS_Read(int fd, char * buf, size_t len); |
96 | DLLAPI int OS_Write(int fd, char * buf, size_t len); |
97 | DLLAPI int OS_SpawnChild(char *execPath, int listenFd); |
ee03fac4 |
98 | DLLAPI int OS_AsyncReadStdin(void *buf, int len, OS_AsyncProc procPtr, |
0198fd3c |
99 | ClientData clientData); |
100 | DLLAPI int OS_AsyncRead(int fd, int offset, void *buf, int len, |
101 | OS_AsyncProc procPtr, ClientData clientData); |
ee03fac4 |
102 | DLLAPI int OS_AsyncWrite(int fd, int offset, void *buf, int len, |
0198fd3c |
103 | OS_AsyncProc procPtr, ClientData clientData); |
104 | DLLAPI int OS_Close(int fd); |
105 | DLLAPI int OS_CloseRead(int fd); |
106 | DLLAPI int OS_DoIo(struct timeval *tmo); |
107 | DLLAPI int OS_FcgiIpcAccept(char *clientAddrList); |
108 | DLLAPI int OS_IpcClose(int ipcFd); |
109 | DLLAPI int OS_IsFcgi(void); |
110 | DLLAPI void OS_SetFlags(int fd, int flags); |
111 | |
112 | #if defined (__cplusplus) || defined (c_plusplus) |
113 | } /* terminate extern "C" { */ |
114 | #endif |
115 | |
116 | #endif /* _FCGIOS_H */ |