aboutsummaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorMarvin Borner2021-03-14 16:06:57 +0100
committerMarvin Borner2021-03-14 16:06:57 +0100
commit6dec7db5158447b66f31a3f786ce2916cab83cec (patch)
tree2dbc3e52d90dab4aae8021773f09b6b72a74b8cb /libc
parent2f8328f2a41b77eea297ee7fc28818331d4e6c54 (diff)
Maaany fixes :)
I don't have the motivation to write better commit messages...
Diffstat (limited to 'libc')
-rw-r--r--libc/alloc.c2
-rw-r--r--libc/inc/def.h3
-rw-r--r--libc/inc/sys.h4
3 files changed, 6 insertions, 3 deletions
diff --git a/libc/alloc.c b/libc/alloc.c
index 4ccf35f..be986dc 100644
--- a/libc/alloc.c
+++ b/libc/alloc.c
@@ -86,8 +86,6 @@ struct liballoc_minor {
#define MAJOR_SIZE (ALIGN_UP(sizeof(struct liballoc_major), 16))
#define MINOR_SIZE (ALIGN_UP(sizeof(struct liballoc_minor), 16))
-#define MIN(__x, __y) ((__x) < (__y) ? (__x) : (__y))
-#define MAX(__x, __y) ((__x) > (__y) ? (__x) : (__y))
static struct liballoc_major *l_mem_root = NULL;
static struct liballoc_major *l_best_bet = NULL;
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;
}