diff options
Diffstat (limited to 'libc/inc')
-rw-r--r-- | libc/inc/def.h | 3 | ||||
-rw-r--r-- | libc/inc/sys.h | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/libc/inc/def.h b/libc/inc/def.h index db1c95e..c334fcb 100644 --- a/libc/inc/def.h +++ b/libc/inc/def.h @@ -25,6 +25,9 @@ typedef unsigned long long u64; #define UNUSED(a) ((void)(a)) +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) +#define MAX(a, b) (((a) > (b)) ? (a) : (b)) + #define NORETURN __attribute__((noreturn)) #define NO_SANITIZE __attribute__((no_sanitize("undefined"))) #define PACKED __attribute__((packed)) 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; } |