blob: d59c2b3c695a7c8a9d50db0c65137a5a50ff9c37 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#ifndef __LIBC_LIBC_H
#define __LIBC_LIBC_H
#include <stdatomic.h>
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#define __unused __attribute__((unused))
#define aligned(type) __attribute__((aligned(__alignof__(type))))
#define __weak __attribute__((__weak__))
#define weak_reference(old, new) \
extern __typeof(old) new __attribute__((__weak__, __alias__(#old)))
static struct {
enum {
LIBC_ENVP_TOUCHED = 1 << 0,
} flags;
struct {
volatile atomic_flag abort;
volatile atomic_flag malloc;
volatile atomic_flag environ;
} lock;
} libc = { .lock = { ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT } };
#endif
|