BarryServer : Git

All the code for all my projects
// BarryServer : Git / OrionLibC / commit / ad9b6af63f1fdfcf3556c9b2fc670f72cdc60ab4 / unistd

// Related

OrionLibC

Barry Updating libc for pipes and signals ad9b6af (2 years, 2 months ago)
diff --git a/unistd/pipe.c b/unistd/pipe.c
new file mode 100644
index 0000000..1143262
--- /dev/null
+++ b/unistd/pipe.c
@@ -0,0 +1,18 @@
+#include <sys/syscall.h>
+#include <errno.h>
+
+/* Close a file */
+int
+pipe(int pipefd[2])
+{
+	int *pfd = pipefd;
+
+	int ret;
+	asm volatile("int $0x80" : "=a" (ret) : "0" (SYSCALL_PIPE),
+	             "c" (1), "S" (&pfd));
+
+	if (ret >= 0)
+		return ret;
+	errno = -ret;
+	return -1;
+}