blob: 68114513961f730c46171e5fcb2d4529ce2161aa (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
/*
* stddef.h
*/
#ifndef _STDDEF_H
#define _STDDEF_H
#ifndef __KLIBC__
# error "__KLIBC__ not defined, compiler invocation error!"
#endif
/*
* __SIZE_TYPE__ and __PTRDIFF_TYPE__ are defined by GCC and
* many other compilers to what types the ABI expects on the
* target platform for size_t and ptrdiff_t, so we use these
* for size_t, ssize_t, ptrdiff_t definitions, if available;
* fall back to unsigned long, which is correct on ILP32 and
* LP64 platforms (Linux does not have any others) otherwise.
*
* Note: the order "long unsigned int" precisely matches GCC.
*/
#ifndef __SIZE_TYPE__
#define __SIZE_TYPE__ long unsigned int
#endif
#ifndef __PTRDIFF_TYPE__
#define __PTRDIFF_TYPE__ long int
#endif
#define _SIZE_T
typedef __SIZE_TYPE__ size_t;
#define _PTRDIFF_T
typedef __PTRDIFF_TYPE__ ptrdiff_t;
#undef NULL
#ifdef __cplusplus
# define NULL 0
#else
# define NULL ((void *)0)
#endif
#undef offsetof
#define offsetof(t,m) ((size_t)&((t *)0)->m)
/*
* The container_of construct: if p is a pointer to member m of
* container class c, then return a pointer to the container of which
* *p is a member.
*/
#undef container_of
#define container_of(p, c, m) ((c *)((char *)(p) - offsetof(c,m)))
#endif /* _STDDEF_H */
|