bump version to 0.82 and prepare for release
[catagits/fcgi2.git] / include / fcgios.h
CommitLineData
ee03fac4 1/*
0198fd3c 2 * fcgios.h --
3 *
0198fd3c 4 * Bill Snapper
5 * snapper@openmarket.com
89856cf4 6 *
7 * Copyright (c) 1996 Open Market, Inc.
8 *
9 * See the file "LICENSE" for information on usage and redistribution
10 * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
0198fd3c 11 */
12#ifndef _FCGIOS_H
13#define _FCGIOS_H
14
a2355203 15#ifdef _WIN32
16#define WIN32_LEAN_AND_MEAN
17#include <windows.h>
18#include <winsock2.h>
19#endif
20
344bf056 21#include "fcgi_config.h"
22
344bf056 23#ifdef HAVE_SYS_TIME_H
24#include <sys/time.h>
25#endif
26
6cb02b97 27#ifdef HAVE_SYS_TYPES_H
28#include <sys/types.h>
29#endif
30
344bf056 31#if defined (c_plusplus) || defined (__cplusplus)
32extern "C" {
33#endif
34
344bf056 35#ifdef _WIN32
0198fd3c 36#define OS_Errno GetLastError()
37#define OS_SetErrno(err) SetLastError(err)
344bf056 38#ifndef O_NONBLOCK
39#define O_NONBLOCK 0x0004 /* no delay */
fdb63fa0 40#endif
344bf056 41#else /* !_WIN32 */
0198fd3c 42#define OS_Errno errno
43#define OS_SetErrno(err) errno = (err)
344bf056 44#endif /* !_WIN32 */
0198fd3c 45
e6368b61 46#ifndef DLLAPI
47#ifdef _WIN32
48#define DLLAPI __declspec(dllimport)
49#else
50#define DLLAPI
51#endif
52#endif
53
54
4a7222d7 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.
ee03fac4 60 * 2 seconds is very conservative. 0,0 is not reliable. The shorter the
4a7222d7 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
65
0198fd3c 66#ifndef STDIN_FILENO
67#define STDIN_FILENO 0
68#endif
69
0198fd3c 70#ifndef STDOUT_FILENO
71#define STDOUT_FILENO 1
72#endif
73
74#ifndef STDERR_FILENO
75#define STDERR_FILENO 2
76#endif
77
78#ifndef MAXPATHLEN
79#define MAXPATHLEN 1024
80#endif
81
82#ifndef X_OK
83#define X_OK 0x01
84#endif
85
0198fd3c 86#ifndef _CLIENTDATA
87# if defined(__STDC__) || defined(__cplusplus)
88 typedef void *ClientData;
89# else
90 typedef int *ClientData;
91# endif /* __STDC__ */
92#define _CLIENTDATA
93#endif
94
95typedef void (*OS_AsyncProc) (ClientData clientData, int len);
96
97DLLAPI int OS_LibInit(int stdioFds[3]);
98DLLAPI void OS_LibShutdown(void);
0b7c9662 99DLLAPI int OS_CreateLocalIpcFd(const char *bindPath, int backlog);
0198fd3c 100DLLAPI int OS_FcgiConnect(char *bindPath);
101DLLAPI int OS_Read(int fd, char * buf, size_t len);
102DLLAPI int OS_Write(int fd, char * buf, size_t len);
103DLLAPI int OS_SpawnChild(char *execPath, int listenFd);
ee03fac4 104DLLAPI int OS_AsyncReadStdin(void *buf, int len, OS_AsyncProc procPtr,
5ac48a20 105 ClientData clientData);
0198fd3c 106DLLAPI int OS_AsyncRead(int fd, int offset, void *buf, int len,
5ac48a20 107 OS_AsyncProc procPtr, ClientData clientData);
ee03fac4 108DLLAPI int OS_AsyncWrite(int fd, int offset, void *buf, int len,
5ac48a20 109 OS_AsyncProc procPtr, ClientData clientData);
2a7273a1 110DLLAPI int OS_Close(int fd, int shutdown);
0198fd3c 111DLLAPI int OS_CloseRead(int fd);
112DLLAPI int OS_DoIo(struct timeval *tmo);
1dd5d7a8 113DLLAPI int OS_Accept(int listen_sock, int fail_on_intr, const char *webServerAddrs);
2a7273a1 114DLLAPI int OS_IpcClose(int ipcFd, int shutdown);
0b7c9662 115DLLAPI int OS_IsFcgi(int sock);
0198fd3c 116DLLAPI void OS_SetFlags(int fd, int flags);
117
91281991 118DLLAPI void OS_ShutdownPending(void);
d0686b0d 119
0198fd3c 120#if defined (__cplusplus) || defined (c_plusplus)
121} /* terminate extern "C" { */
122#endif
123
124#endif /* _FCGIOS_H */