File tree Expand file tree Collapse file tree 13 files changed +533
-1
lines changed Expand file tree Collapse file tree 13 files changed +533
-1
lines changed Original file line number Diff line number Diff line change @@ -8,4 +8,5 @@ set(TARGET_PUBLIC_HEADERS
8
8
libc.include.stdlib
9
9
libc.include.string
10
10
libc.include.strings
11
+ libc.include.sys_queue
11
12
)
Original file line number Diff line number Diff line change @@ -8,4 +8,5 @@ set(TARGET_PUBLIC_HEADERS
8
8
libc.include.stdlib
9
9
libc.include.string
10
10
libc.include.strings
11
+ libc.include.sys_queue
11
12
)
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ set(TARGET_PUBLIC_HEADERS
31
31
libc.include.sys_mman
32
32
libc.include.sys_prctl
33
33
libc.include.sys_random
34
+ libc.include.sys_queue
34
35
libc.include.sys_resource
35
36
libc.include.sys_select
36
37
libc.include.sys_socket
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ set(TARGET_PUBLIC_HEADERS
30
30
libc.include.sys_ioctl
31
31
libc.include.sys_mman
32
32
libc.include.sys_prctl
33
+ libc.include.sys_queue
33
34
libc.include.sys_random
34
35
libc.include.sys_resource
35
36
libc.include.sys_select
Original file line number Diff line number Diff line change @@ -345,6 +345,14 @@ add_gen_header(
345
345
.llvm_libc_common_h
346
346
)
347
347
348
+ add_header (
349
+ sys_queue
350
+ HDR
351
+ sys/queue.h
352
+ DEPENDS
353
+ .llvm-libc-macros.sys_queue_macros
354
+ )
355
+
348
356
add_gen_header (
349
357
sys_random
350
358
DEF_FILE sys/random.h.def
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ function(add_macro_header name)
4
4
"MACRO_HEADER"
5
5
"" # Optional arguments
6
6
"HDR" # Single value arguments
7
- "" # Multi-value arguments
7
+ "DEPENDS " # Multi-value arguments
8
8
${ARGN}
9
9
)
10
10
if (TARGET libc.include.llvm-libc-macros.${LIBC_TARGET_OS}.${name} )
@@ -14,12 +14,15 @@ function(add_macro_header name)
14
14
${MACRO_HEADER_HDR}
15
15
DEPENDS
16
16
.${LIBC_TARGET_OS}.${name}
17
+ ${MACRO_HEADER_DEPENDS}
17
18
)
18
19
else ()
19
20
add_header (
20
21
${name}
21
22
HDR
22
23
${MACRO_HEADER_HDR}
24
+ DEPENDS
25
+ ${MACRO_HEADER_DEPENDS}
23
26
)
24
27
endif ()
25
28
endfunction (add_macro_header )
@@ -70,6 +73,20 @@ add_macro_header(
70
73
math -macros.h
71
74
)
72
75
76
+ add_macro_header (
77
+ offsetof_macro
78
+ HDR
79
+ offsetof-macro.h
80
+ )
81
+
82
+ add_macro_header (
83
+ containerof_macro
84
+ HDR
85
+ containerof-macro.h
86
+ DEPENDS
87
+ .offsetof_macro
88
+ )
89
+
73
90
add_macro_header (
74
91
sched_macros
75
92
HDR
@@ -118,6 +135,15 @@ add_macro_header(
118
135
sys-mman-macros.h
119
136
)
120
137
138
+ add_macro_header (
139
+ sys_queue_macros
140
+ HDR
141
+ sys-queue-macros.h
142
+ DEPENDS
143
+ .null_macro
144
+ .containerof_macro
145
+ )
146
+
121
147
add_macro_header (
122
148
sys_random_macros
123
149
HDR
Original file line number Diff line number Diff line change
1
+ //===-- Definition of the containerof macro -------------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ //
7
+ //===----------------------------------------------------------------------===//
8
+
9
+ #ifndef __LLVM_LIBC_MACROS_CONTAINEROF_MACRO_H
10
+ #define __LLVM_LIBC_MACROS_CONTAINEROF_MACRO_H
11
+
12
+ #include <llvm-libc-macros/offsetof-macro.h>
13
+
14
+ #define __containerof (ptr , type , member ) \
15
+ ({ \
16
+ const __typeof(((type *)0)->member) *__ptr = (ptr); \
17
+ (type *)(void *)((const char *)__ptr - offsetof(type, member)); \
18
+ })
19
+
20
+ #endif // __LLVM_LIBC_MACROS_CONTAINEROF_MACRO_H
Original file line number Diff line number Diff line change
1
+ //===-- Definition of the offsetof macro ----------------------------------===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ //
7
+ //===----------------------------------------------------------------------===//
8
+
9
+ #ifndef __LLVM_LIBC_MACROS_OFFSETOF_MACRO_H
10
+ #define __LLVM_LIBC_MACROS_OFFSETOF_MACRO_H
11
+
12
+ #define __need_offsetof
13
+ #include <stddef.h>
14
+
15
+ #endif // __LLVM_LIBC_MACROS_OFFSETOF_MACRO_H
You can’t perform that action at this time.
0 commit comments