File tree Expand file tree Collapse file tree 22 files changed +545
-0
lines changed Expand file tree Collapse file tree 22 files changed +545
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ set(TARGET_LIBC_ENTRYPOINTS
22
22
23
23
# fcntl.h entrypoints
24
24
libc.src.fcntl.creat
25
+ libc.src.fcntl.fcntl
25
26
libc.src.fcntl.open
26
27
libc.src.fcntl.openat
27
28
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ set(TARGET_LIBC_ENTRYPOINTS
22
22
23
23
# fcntl.h entrypoints
24
24
libc.src.fcntl.creat
25
+ libc.src.fcntl.fcntl
25
26
libc.src.fcntl.open
26
27
libc.src.fcntl.openat
27
28
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ set(TARGET_LIBC_ENTRYPOINTS
22
22
23
23
# fcntl.h entrypoints
24
24
libc.src.fcntl.creat
25
+ libc.src.fcntl.fcntl
25
26
libc.src.fcntl.open
26
27
libc.src.fcntl.openat
27
28
Original file line number Diff line number Diff line change @@ -32,6 +32,15 @@ add_proxy_header_library(
32
32
libc.include.math
33
33
)
34
34
35
+ add_proxy_header_library (
36
+ fcntl_macros
37
+ HDRS
38
+ fcntl_macros.h
39
+ FULL_BUILD_DEPENDS
40
+ libc.include.llvm-libc-macros.fcntl_macros
41
+ libc.include.fcntl
42
+ )
43
+
35
44
add_proxy_header_library (
36
45
fenv_macros
37
46
HDRS
Original file line number Diff line number Diff line change
1
+ //===-- Definition of macros from fcntl/fcntl.h ---------------------------===//
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_HDR_FCNTL_MACROS_H
10
+ #define LLVM_LIBC_HDR_FCNTL_MACROS_H
11
+
12
+ #ifdef LIBC_FULL_BUILD
13
+
14
+ #include "include/llvm-libc-macros/fcntl-macros.h"
15
+
16
+ #else // Overlay mode
17
+
18
+ #include <fcntl.h>
19
+
20
+ #endif // LLVM_LIBC_FULL_BUILD
21
+
22
+ #endif // LLVM_LIBC_HDR_FCNTL_MACROS_H
Original file line number Diff line number Diff line change @@ -14,6 +14,30 @@ add_proxy_header_library(
14
14
libc.include.llvm-libc-types.struct_epoll_event
15
15
)
16
16
17
+ add_proxy_header_library (
18
+ struct_flock
19
+ HDRS
20
+ struct_flock.h
21
+ FULL_BUILD_DEPENDS
22
+ libc.include.llvm-libc-types.struct_flock
23
+ )
24
+
25
+ add_proxy_header_library (
26
+ struct_flock64
27
+ HDRS
28
+ struct_flock64.h
29
+ FULL_BUILD_DEPENDS
30
+ libc.include.llvm-libc-types.struct_flock64
31
+ )
32
+
33
+ add_proxy_header_library (
34
+ struct_f_owner_ex
35
+ HDRS
36
+ struct_f_owner_ex.h
37
+ FULL_BUILD_DEPENDS
38
+ libc.include.llvm-libc-types.struct_f_owner_ex
39
+ )
40
+
17
41
add_proxy_header_library (
18
42
struct_timespec
19
43
HDRS
Original file line number Diff line number Diff line change
1
+ //===-- Proxy for struct f_owner_ex --------------------------------------===//
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
+ #ifndef LLVM_LIBC_HDR_TYPES_STRUCT_F_OWNER_EX_H
9
+ #define LLVM_LIBC_HDR_TYPES_STRUCT_F_OWNER_EX_H
10
+
11
+ #ifdef LIBC_FULL_BUILD
12
+
13
+ #include "include/llvm-libc-types/struct_f_owner_ex.h"
14
+
15
+ #else
16
+
17
+ #include <fcntl.h>
18
+
19
+ #endif // LIBC_FULL_BUILD
20
+
21
+ #endif // LLVM_LIBC_HDR_TYPES_STRUCT_F_OWNER_EX_H
Original file line number Diff line number Diff line change
1
+ //===-- Proxy for struct flock -------------------------------------------===//
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
+ #ifndef LLVM_LIBC_HDR_TYPES_STRUCT_FLOCK_H
9
+ #define LLVM_LIBC_HDR_TYPES_STRUCT_FLOCK_H
10
+
11
+ #ifdef LIBC_FULL_BUILD
12
+
13
+ #include "include/llvm-libc-types/struct_flock.h"
14
+
15
+ #else
16
+
17
+ #include <fcntl.h>
18
+
19
+ #endif // LIBC_FULL_BUILD
20
+
21
+ #endif // LLVM_LIBC_HDR_TYPES_STRUCT_FLOCK_H
Original file line number Diff line number Diff line change
1
+ //===-- Proxy for struct flock64 -----------------------------------------===//
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
+ #ifndef LLVM_LIBC_HDR_TYPES_STRUCT_FLOCK64_H
9
+ #define LLVM_LIBC_HDR_TYPES_STRUCT_FLOCK64_H
10
+
11
+ #ifdef LIBC_FULL_BUILD
12
+
13
+ #include "include/llvm-libc-types/struct_flock64.h"
14
+
15
+ #else
16
+
17
+ #include <fcntl.h>
18
+
19
+ #endif // LIBC_FULL_BUILD
20
+
21
+ #endif // LLVM_LIBC_HDR_TYPES_STRUCT_FLOCK64_H
Original file line number Diff line number Diff line change @@ -43,6 +43,10 @@ add_gen_header(
43
43
DEPENDS
44
44
.llvm-libc-macros.fcntl_macros
45
45
.llvm-libc-types.mode_t
46
+ .llvm-libc-types.struct_flock
47
+ .llvm-libc-types.struct_flock64
48
+ .llvm-libc-types.off64_t
49
+ .llvm-libc-types.pid_t
46
50
.llvm-libc-types.off_t
47
51
.llvm_libc_common_h
48
52
)
Original file line number Diff line number Diff line change 67
67
#define F_SETFD 2
68
68
#define F_GETFL 3
69
69
#define F_SETFL 4
70
+ #define F_GETLK 5
71
+ #define F_SETLK 6
72
+ #define F_SETLKW 7
73
+ #define F_SETOWN 8
74
+ #define F_GETOWN 9
75
+ #define F_SETSIG 10
76
+ #define F_GETSIG 11
77
+ #define F_GETLK64 12
78
+ #define F_SETLK64 13
79
+ #define F_SETLKW64 14
80
+ #define F_SETOWN_EX 15
81
+ #define F_GETOWN_EX 16
82
+
83
+ // Open File Description Locks.
84
+ #define F_OFD_GETLK 36
85
+ #define F_OFD_SETLK 37
86
+ #define F_OFD_SETLKW 38
87
+
88
+ // Close on succesful
89
+ #define F_CLOEXEC 1
90
+
91
+ #define F_RDLCK 0
92
+ #define F_WRLCK 1
93
+ #define F_UNLCK 2
94
+
95
+ // For Large File Support
96
+ #if defined(_LARGEFILE64_SOURCE )
97
+ #define F_GETLK F_GETLK64
98
+ #define F_SETLK F_SETLK64
99
+ #define F_SETLKW F_SETLKW64
100
+ #endif
70
101
71
102
#endif // LLVM_LIBC_MACROS_LINUX_FCNTL_MACROS_H
Original file line number Diff line number Diff line change @@ -60,6 +60,9 @@ add_header(rlim_t HDR rlim_t.h)
60
60
add_header (time_t HDR time_t.h )
61
61
add_header (stack_t HDR stack_t.h )
62
62
add_header (suseconds_t HDR suseconds_t.h )
63
+ add_header (struct_flock HDR struct_flock.h DEPENDS .off_t .pid_t )
64
+ add_header (struct_flock64 HDR struct_flock64.h DEPENDS .off64_t .pid_t )
65
+ add_header (struct_f_owner_ex HDR struct_f_owner_ex.h DEPENDS .pid_t )
63
66
add_header (struct_timeval HDR struct_timeval.h DEPENDS .suseconds_t .time_t )
64
67
add_header (struct_rlimit HDR struct_rlimit.h DEPENDS .rlim_t )
65
68
add_header (struct_rusage HDR struct_rusage.h DEPENDS .struct_timeval )
Original file line number Diff line number Diff line change
1
+ //===-- Definition of type struct f_owner_ex ------------------------------===//
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_TYPES_STRUCT_F_OWNER_EX_H
10
+ #define LLVM_LIBC_TYPES_STRUCT_F_OWNER_EX_H
11
+
12
+ #include "llvm-libc-types/pid_t.h"
13
+
14
+ enum pid_type {
15
+ F_OWNER_TID = 0 ,
16
+ F_OWNER_PID ,
17
+ F_OWNER_PGRP ,
18
+ };
19
+
20
+ struct f_owner_ex {
21
+ enum pid_type type ;
22
+ pid_t pid ;
23
+ };
24
+
25
+ #endif // LLVM_LIBC_TYPES_STRUCT_F_OWNER_EX_H
Original file line number Diff line number Diff line change
1
+ //===-- Definition of type struct flock64 ---------------------------------===//
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_TYPES_STRUCT_FLOCK_H
10
+ #define LLVM_LIBC_TYPES_STRUCT_FLOCK_H
11
+
12
+ #include "llvm-libc-types/off_t.h"
13
+ #include "llvm-libc-types/pid_t.h"
14
+
15
+ #include <stdint.h>
16
+
17
+ struct flock {
18
+ int16_t l_type ;
19
+ int16_t l_whence ;
20
+ off_t l_start ;
21
+ off_t l_len ;
22
+ pid_t l_pid ;
23
+ };
24
+
25
+ #endif // LLVM_LIBC_TYPES_STRUCT_FLOCK_H
Original file line number Diff line number Diff line change
1
+ //===-- Definition of type struct flock64 ---------------------------------===//
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_TYPES_STRUCT_FLOCK64_H
10
+ #define LLVM_LIBC_TYPES_STRUCT_FLOCK64_H
11
+
12
+ #include "llvm-libc-types/off64_t.h"
13
+ #include "llvm-libc-types/pid_t.h"
14
+
15
+ #include <stdint.h>
16
+
17
+ struct flock64 {
18
+ int16_t l_type ;
19
+ int16_t l_whence ;
20
+ off64_t l_start ;
21
+ off64_t l_len ;
22
+ pid_t l_pid ;
23
+ };
24
+
25
+ #endif // LLVM_LIBC_TYPES_STRUCT_FLOCK64_H
Original file line number Diff line number Diff line change @@ -230,6 +230,11 @@ def POSIX : StandardSpec<"POSIX"> {
230
230
RetValSpec<IntType>,
231
231
[ArgSpec<ConstCharPtr>, ArgSpec<ModeTType>]
232
232
>,
233
+ FunctionSpec<
234
+ "fcntl",
235
+ RetValSpec<IntType>,
236
+ [ArgSpec<IntType>, ArgSpec<IntType>, ArgSpec<VarArgType>]
237
+ >,
233
238
FunctionSpec<
234
239
"open",
235
240
RetValSpec<IntType>,
Original file line number Diff line number Diff line change @@ -9,6 +9,13 @@ add_entrypoint_object(
9
9
.${LIBC_TARGET_OS}.creat
10
10
)
11
11
12
+ add_entrypoint_object (
13
+ fcntl
14
+ ALIAS
15
+ DEPENDS
16
+ .${LIBC_TARGET_OS}.fcntl
17
+ )
18
+
12
19
add_entrypoint_object (
13
20
open
14
21
ALIAS
Original file line number Diff line number Diff line change
1
+ // ===-- Implementation header of fcntl --------------------------*- C++ -*-===//
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_SRC_FCNTL_FCNTL_H
10
+ #define LLVM_LIBC_SRC_FCNTL_FCNTL_H
11
+
12
+ namespace LIBC_NAMESPACE {
13
+
14
+ int fcntl (int fd, int cmd, ...);
15
+
16
+ } // namespace LIBC_NAMESPACE
17
+
18
+ #endif // LLVM_LIBC_SRC_FCNTL_FCNTL_H
Original file line number Diff line number Diff line change @@ -10,6 +10,22 @@ add_entrypoint_object(
10
10
libc.src.errno.errno
11
11
)
12
12
13
+ add_entrypoint_object (
14
+ fcntl
15
+ SRCS
16
+ fcntl.cpp
17
+ HDRS
18
+ ../fcntl.h
19
+ DEPENDS
20
+ libc.include.fcntl
21
+ libc.hdr.types.struct_flock
22
+ libc.hdr.types.struct_flock64
23
+ libc.hdr.types.struct_f_owner_ex
24
+ libc.hdr.fcntl_macros
25
+ libc.src.__support.OSUtil.osutil
26
+ libc.src.errno.errno
27
+ )
28
+
13
29
add_entrypoint_object (
14
30
open
15
31
SRCS
You can’t perform that action at this time.
0 commit comments