blob: 6f233d354d926f5e6926ad78a145a73455565ca0 (
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
|
#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_reference(old, new) \
extern __typeof(old)((new)) __attribute__((__weak__, __alias__(#old)))
static struct libc {
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
|