Commit | Line | Data |
0198fd3c |
1 | /* |
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 |
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. |
14 | * |
15 | * Bill Snapper |
16 | * snapper@openmarket.com |
17 | */ |
18 | #ifndef _FCGIOS_H |
19 | #define _FCGIOS_H |
20 | |
52c5620a |
21 | #include <sys/time.h> |
22 | |
0198fd3c |
23 | #ifdef _WIN32 |
24 | #define OS_Errno GetLastError() |
25 | #define OS_SetErrno(err) SetLastError(err) |
26 | #ifndef DLLAPI |
27 | #define DLLAPI __declspec(dllimport) |
28 | #endif |
29 | #else |
30 | #define DLLAPI |
31 | #define OS_Errno errno |
32 | #define OS_SetErrno(err) errno = (err) |
33 | #endif |
34 | |
35 | #ifdef _WIN32 |
36 | #include <io.h> |
37 | #endif |
38 | |
39 | #ifndef STDIN_FILENO |
40 | #define STDIN_FILENO 0 |
41 | #endif |
42 | |
43 | |
44 | #ifndef STDOUT_FILENO |
45 | #define STDOUT_FILENO 1 |
46 | #endif |
47 | |
48 | #ifndef STDERR_FILENO |
49 | #define STDERR_FILENO 2 |
50 | #endif |
51 | |
52 | #ifndef MAXPATHLEN |
53 | #define MAXPATHLEN 1024 |
54 | #endif |
55 | |
56 | #ifndef X_OK |
57 | #define X_OK 0x01 |
58 | #endif |
59 | |
60 | #ifdef _WIN32 |
61 | #ifndef O_NONBLOCK |
62 | #define O_NONBLOCK 0x0004 /* no delay */ |
63 | #endif |
64 | #endif |
65 | |
66 | #if defined (c_plusplus) || defined (__cplusplus) |
67 | extern "C" { |
68 | #endif |
69 | |
70 | #ifndef _CLIENTDATA |
71 | # if defined(__STDC__) || defined(__cplusplus) |
72 | typedef void *ClientData; |
73 | # else |
74 | typedef int *ClientData; |
75 | # endif /* __STDC__ */ |
76 | #define _CLIENTDATA |
77 | #endif |
78 | |
79 | typedef void (*OS_AsyncProc) (ClientData clientData, int len); |
80 | |
81 | DLLAPI int OS_LibInit(int stdioFds[3]); |
82 | DLLAPI void OS_LibShutdown(void); |
83 | DLLAPI int OS_CreateLocalIpcFd(char *bindPath); |
84 | DLLAPI int OS_FcgiConnect(char *bindPath); |
85 | DLLAPI int OS_Read(int fd, char * buf, size_t len); |
86 | DLLAPI int OS_Write(int fd, char * buf, size_t len); |
87 | DLLAPI int OS_SpawnChild(char *execPath, int listenFd); |
88 | DLLAPI int OS_AsyncReadStdin(void *buf, int len, OS_AsyncProc procPtr, |
89 | ClientData clientData); |
90 | DLLAPI int OS_AsyncRead(int fd, int offset, void *buf, int len, |
91 | OS_AsyncProc procPtr, ClientData clientData); |
92 | DLLAPI int OS_AsyncWrite(int fd, int offset, void *buf, int len, |
93 | OS_AsyncProc procPtr, ClientData clientData); |
94 | DLLAPI int OS_Close(int fd); |
95 | DLLAPI int OS_CloseRead(int fd); |
96 | DLLAPI int OS_DoIo(struct timeval *tmo); |
97 | DLLAPI int OS_FcgiIpcAccept(char *clientAddrList); |
98 | DLLAPI int OS_IpcClose(int ipcFd); |
99 | DLLAPI int OS_IsFcgi(void); |
100 | DLLAPI void OS_SetFlags(int fd, int flags); |
101 | |
102 | #if defined (__cplusplus) || defined (c_plusplus) |
103 | } /* terminate extern "C" { */ |
104 | #endif |
105 | |
106 | #endif /* _FCGIOS_H */ |