33 lines
634 B
C
33 lines
634 B
C
#include "posix.h"
|
|
|
|
#include <errno.h>
|
|
#include <fx/io/stream.h>
|
|
#include <unistd.h>
|
|
|
|
fx_status fx_pipe_create(fx_iostream **reader, fx_iostream **writer)
|
|
{
|
|
#if 0
|
|
int fds[2];
|
|
int err = pipe(fds);
|
|
if (err != 0) {
|
|
return fx_status_from_errno(errno, FX_ERR_NOT_SUPPORTED);
|
|
}
|
|
|
|
fx_iostream *r = fx_iostream_create(FX_STREAM_READ, fds[0], true);
|
|
fx_iostream *w = fx_iostream_create(FX_STREAM_WRITE, fds[1], true);
|
|
|
|
if (!r || !w) {
|
|
fx_iostream_unref(r);
|
|
fx_iostream_unref(w);
|
|
close(fds[0]);
|
|
close(fds[1]);
|
|
return FX_ERR_NO_MEMORY;
|
|
}
|
|
|
|
*reader = r;
|
|
*writer = w;
|
|
return FX_SUCCESS;
|
|
#endif
|
|
return FX_ERR_NOT_SUPPORTED;
|
|
}
|