BarryServer : Git

All the code for all my projects
// BarryServer : Git / OrionLibC / commit / 03048a95d88cc7a78171393371f5c22a0250a014 / unistd / getpid.c

// Related

OrionLibC

Barry Importing existing Orion LibC 03048a9 (2 years, 2 months ago)
diff --git a/unistd/getpid.c b/unistd/getpid.c
new file mode 100644
index 0000000..dc5d86a
--- /dev/null
+++ b/unistd/getpid.c
@@ -0,0 +1,13 @@
+#include <stddef.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
+
+/* Get the current process' id */
+pid_t
+getpid(void)
+{
+	int ret;
+	asm volatile("int $0x80" : "=a" (ret) : "0" (SYSCALL_GETPID),
+	             "c" (0), "S" (NULL));
+	return ret;
+}