}
}
+SAPI_API int sapi_get_fd(int *fd TSRMLS_DC)
+{
+ if (sapi_module.get_fd) {
+ return sapi_module.get_fd(fd TSRMLS_CC);
+ } else {
+ return -1;
+ }
+}
+
/*
* Local variables:
* tab-width: 4
SAPI_API size_t sapi_apply_default_charset(char **mimetype, size_t len TSRMLS_DC);
SAPI_API void sapi_activate_headers_only(TSRMLS_D);
+SAPI_API int sapi_get_fd(int *fd TSRMLS_DC);
+
struct _sapi_module_struct {
char *name;
char *pretty_name;
void (*block_interruptions)(void);
void (*unblock_interruptions)(void);
+
void (*default_post_reader)(TSRMLS_D);
void (*treat_data)(int arg, char *str, zval *destArray TSRMLS_DC);
char *executable_location;
int php_ini_ignore;
+
+ int (*get_fd)(int *fd TSRMLS_DC);
+
};
}
/* }}} */
+/* {{{ sapi_apache_get_fd
+ */
+static int sapi_apache_get_fd(int *nfd TSRMLS_DC)
+{
+ request_rec *r = SG(server_context);
+ int fd;
+
+ fd = r->connection->client->fd;
+
+ if (fd >= 0) {
+ if (nfd) *nfd = fd;
+ return 0;
+ }
+ return -1;
+}
+/* }}} */
+
/* {{{ sapi_module_struct apache_sapi_module
*/
static sapi_module_struct apache_sapi_module = {
unblock_alarms, /* Unblock interruptions */
#endif
- STANDARD_SAPI_MODULE_PROPERTIES
+ NULL, /* default post reader */
+ NULL, /* treat data */
+ NULL, /* exe location */
+ 0, /* ini ignore */
+ sapi_apache_get_fd
};
/* }}} */
return SUCCESS;
}
+static int sapi_thttpd_get_fd(int *nfd TSRMLS_DC)
+{
+ if (nfd) *nfd = TG(hc)->conn_fd;
+ return 0;
+}
+
static sapi_module_struct thttpd_sapi_module = {
"thttpd",
"thttpd",
NULL, /* Block interruptions */
NULL, /* Unblock interruptions */
- STANDARD_SAPI_MODULE_PROPERTIES
+ NULL,
+ NULL,
+ NULL,
+ 0,
+ sapi_thttpd_get_fd
};
static void thttpd_module_main(int show_source TSRMLS_DC)