--- /dev/null
+#include <unistd.h>
+#include <corax/ipc.h>
+#include <corax/ipc/io.h>
+#include <crxstd.h>
+#include <string.h>
+#include <errno.h>
+
+int pipe(int pipefd[2])
+{
+ struct cxmsg msg;
+ struct cxio_pipe *data;
+ int ret_val;
+
+ data = (struct cxio_pipe*)msg.cm_data;
+ data->flags = 0;
+
+ msg.cm_len = sizeof(*data);
+ msg.cm_type = CXIO_PIPE;
+
+ ret_val = cxsendrecv(PID_IO, &msg);
+
+ if(!ret_val) {
+ struct cxio_response *resp;
+
+ resp = (struct cxio_response*)msg.cm_data;
+
+ ret_val = resp->retval;
+ errno = resp->error;
+
+ if(!ret_val) {
+ /*
+ * Call has succeeded, but we should still check if the amount
+ * of data returned by the IO process has the expected size.
+ */
+ if(resp->extralen == sizeof(int[2])) {
+ memcpy(pipefd, resp->extradata, resp->extralen);
+ } else {
+ ret_val = -1;
+ errno = EFAULT;
+ }
+ }
+ } else {
+ ret_val = -1;
+ errno = EFAULT;
+ }
+
+ return(ret_val);
+}