blob: 6651feaab4c5ab2b5f54a1af17064c7e5b23fdba (
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
26
27
28
29
30
|
#ifndef __LIBC_LIBC_H
#define __LIBC_LIBC_H
#include <stdatomic.h>
#include <features.h>
#include <__stdio.h>
#include <thread.h>
#define __IMPL(_v) ((__##typeof(_v))_v)
#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 {
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
|