shithub: riscv

Download patch

ref: 23fcac090ca7e6d0856572f107ca6b2ade0ada5b
parent: 8434f98cdda98c5463ccc3ba89feeeda064e873c
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;
 }
--