aboutsummaryrefslogtreecommitdiff
path: root/libc/inc/sys.h
diff options
context:
space:
mode:
Diffstat (limited to 'libc/inc/sys.h')
-rw-r--r--libc/inc/sys.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/libc/inc/sys.h b/libc/inc/sys.h
index 3125cb0..8add0de 100644
--- a/libc/inc/sys.h
+++ b/libc/inc/sys.h
@@ -93,7 +93,9 @@ int sysv(enum sys num, ...);
static inline u32 getpid(void)
{
- u32 buf = 0;
+ static u32 buf = 0;
+ if (buf)
+ return buf;
read("/proc/self/pid", &buf, 0, sizeof(buf));
return buf;
}