updates based on the latest fcgi_config.h.in
[catagits/fcgi2.git] / include / fcgios.h
CommitLineData
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
a2355203 21#ifdef _WIN32
22#define WIN32_LEAN_AND_MEAN
23#include <windows.h>
24#include <winsock2.h>
25#endif
26
344bf056 27#include "fcgi_config.h"
28
344bf056 29#ifdef HAVE_SYS_TIME_H
30#include <sys/time.h>
31#endif
32
6cb02b97 33#ifdef HAVE_SYS_TYPES_H
34#include <sys/types.h>
35#endif
36
344bf056 37#if defined (c_plusplus) || defined (__cplusplus)
38extern "C" {
39#endif
40
344bf056 41#ifdef _WIN32
0198fd3c 42#define OS_Errno GetLastError()
43#define OS_SetErrno(err) SetLastError(err)
344bf056 44#ifndef O_NONBLOCK
45#define O_NONBLOCK 0x0004 /* no delay */
fdb63fa0 46#endif
344bf056 47#else /* !_WIN32 */
0198fd3c 48#define OS_Errno errno
49#define OS_SetErrno(err) errno = (err)
344bf056 50#endif /* !_WIN32 */
0198fd3c 51
e6368b61 52#ifndef DLLAPI
53#ifdef _WIN32
54#define DLLAPI __declspec(dllimport)
55#else
56#define DLLAPI
57#endif
58#endif
59
60
4a7222d7 61/* This is the initializer for a "struct timeval" used in a select() call
62 * right after a new request is accept()ed to determine readablity. Its
63 * a drop-dead timer. Its only used for AF_UNIX sockets (not TCP sockets).
64 * Its a workaround for a kernel bug in Linux 2.0.x and SCO Unixware.
65 * Making this as small as possible, yet remain reliable would be best.
ee03fac4 66 * 2 seconds is very conservative. 0,0 is not reliable. The shorter the
4a7222d7 67 * timeout, the faster request processing will recover. The longer the
68 * timeout, the more likely this application being "busy" will cause other
69 * requests to abort and cause more dead sockets that need this timeout. */
70#define READABLE_UNIX_FD_DROP_DEAD_TIMEVAL 2,0
71
0198fd3c 72#ifndef STDIN_FILENO
73#define STDIN_FILENO 0
74#endif
75
0198fd3c 76#ifndef STDOUT_FILENO
77#define STDOUT_FILENO 1
78#endif
79
80#ifndef STDERR_FILENO
81#define STDERR_FILENO 2
82#endif
83
84#ifndef MAXPATHLEN
85#define MAXPATHLEN 1024
86#endif
87
88#ifndef X_OK
89#define X_OK 0x01
90#endif
91
0198fd3c 92#ifndef _CLIENTDATA
93# if defined(__STDC__) || defined(__cplusplus)
94 typedef void *ClientData;
95# else
96 typedef int *ClientData;
97# endif /* __STDC__ */
98#define _CLIENTDATA
99#endif
100
101typedef void (*OS_AsyncProc) (ClientData clientData, int len);
102
103DLLAPI int OS_LibInit(int stdioFds[3]);
104DLLAPI void OS_LibShutdown(void);
0b7c9662 105DLLAPI int OS_CreateLocalIpcFd(const char *bindPath, int backlog);
0198fd3c 106DLLAPI int OS_FcgiConnect(char *bindPath);
107DLLAPI int OS_Read(int fd, char * buf, size_t len);
108DLLAPI int OS_Write(int fd, char * buf, size_t len);
109DLLAPI int OS_SpawnChild(char *execPath, int listenFd);
ee03fac4 110DLLAPI int OS_AsyncReadStdin(void *buf, int len, OS_AsyncProc procPtr,
0198fd3c 111 ClientData clientData);
112DLLAPI int OS_AsyncRead(int fd, int offset, void *buf, int len,
113 OS_AsyncProc procPtr, ClientData clientData);
ee03fac4 114DLLAPI int OS_AsyncWrite(int fd, int offset, void *buf, int len,
0198fd3c 115 OS_AsyncProc procPtr, ClientData clientData);
116DLLAPI int OS_Close(int fd);
117DLLAPI int OS_CloseRead(int fd);
118DLLAPI int OS_DoIo(struct timeval *tmo);
1dd5d7a8 119DLLAPI int OS_Accept(int listen_sock, int fail_on_intr, const char *webServerAddrs);
0198fd3c 120DLLAPI int OS_IpcClose(int ipcFd);
0b7c9662 121DLLAPI int OS_IsFcgi(int sock);
0198fd3c 122DLLAPI void OS_SetFlags(int fd, int flags);
123
91281991 124DLLAPI void OS_ShutdownPending(void);
d0686b0d 125
0198fd3c 126#if defined (__cplusplus) || defined (c_plusplus)
127} /* terminate extern "C" { */
128#endif
129
130#endif /* _FCGIOS_H */