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