diff options
author | Marvin Borner | 2021-03-14 16:06:57 +0100 |
---|---|---|
committer | Marvin Borner | 2021-03-14 16:06:57 +0100 |
commit | 6dec7db5158447b66f31a3f786ce2916cab83cec (patch) | |
tree | 2dbc3e52d90dab4aae8021773f09b6b72a74b8cb /libc/inc | |
parent | 2f8328f2a41b77eea297ee7fc28818331d4e6c54 (diff) |
Maaany fixes :)
I don't have the motivation to write better commit messages...
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; } |