#endif
#include "php.h"
#include <ancillary.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#define PHP_ANCILLARY_VERSION "1.0"
#define PHP_ANCILLARY_EXTNAME "ancillary"
{
zval *zstream;
php_stream *stream;
- int fd_in, fd_out;
+ int fd_in, fd_out[2];
+ char *headers;
+
+ if ((headers = calloc(8*1024, 1)) == NULL) {
+ return;
+ }
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zstream))
return;
RETURN_FALSE;
}
- if(ancil_recv_fd(fd_in, &fd_out)) {
+ if(ancil_recv_fds(fd_in, fd_out, 2) == 0) {
RETURN_FALSE;
}
+ {
+ char bf[2048];
+
+ sprintf(bf, "zero: [%d] uno: [%d]\n", fd_out[0], fd_out[1]);
+ write(1, bf, strlen(bf));
+ }
+ {
+ int fh;
+
+ if ((fh = open("/tmp/out_php-anc.txt", O_WRONLY | O_CREAT | O_APPEND)) > -1) {
+ // write(fh, headers, 8*1024);
+ close(fh);
+ }
+ }
- if ((stream = php_stream_fopen_from_fd(fd_out, "r+b", NULL)) == NULL) {
+ if ((stream = php_stream_fopen_from_fd(fd_out[0], "r+b", NULL)) == NULL) {
RETURN_FALSE;
}