git: 9front

Download patch

ref: 299ab61bb1c5e5713297cf00668c09d9dc42e145
parent: 5a5345100bae3d0af7c7cd4ce685cb85a04584bf
author: aiju <aiju@phicode.de>
date: Sat Aug 20 12:10:02 EDT 2011

getpid: use tos

--- a/sys/src/libc/9sys/getpid.c
+++ b/sys/src/libc/9sys/getpid.c
@@ -1,17 +1,9 @@
 #include	<u.h>
 #include	<libc.h>
+#include	<tos.h>
 
 int
 getpid(void)
 {
-	char b[20];
-	int f;
-
-	memset(b, 0, sizeof(b));
-	f = open("#c/pid", 0);
-	if(f >= 0) {
-		read(f, b, sizeof(b));
-		close(f);
-	}
-	return atol(b);
+	return _tos->pid;
 }
--