-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[libc] Implement fcntl() function (#89507)
Fixes #84968. Implements the `fcntl()` function defined in the `fcntl.h` header.
- Loading branch information
1 parent
d1b3648
commit aca5117
Showing
22 changed files
with
545 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//===-- Definition of macros from fcntl/fcntl.h ---------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLVM_LIBC_HDR_FCNTL_MACROS_H | ||
#define LLVM_LIBC_HDR_FCNTL_MACROS_H | ||
|
||
#ifdef LIBC_FULL_BUILD | ||
|
||
#include "include/llvm-libc-macros/fcntl-macros.h" | ||
|
||
#else // Overlay mode | ||
|
||
#include <fcntl.h> | ||
|
||
#endif // LLVM_LIBC_FULL_BUILD | ||
|
||
#endif // LLVM_LIBC_HDR_FCNTL_MACROS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//===-- Proxy for struct f_owner_ex --------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
#ifndef LLVM_LIBC_HDR_TYPES_STRUCT_F_OWNER_EX_H | ||
#define LLVM_LIBC_HDR_TYPES_STRUCT_F_OWNER_EX_H | ||
|
||
#ifdef LIBC_FULL_BUILD | ||
|
||
#include "include/llvm-libc-types/struct_f_owner_ex.h" | ||
|
||
#else | ||
|
||
#include <fcntl.h> | ||
|
||
#endif // LIBC_FULL_BUILD | ||
|
||
#endif // LLVM_LIBC_HDR_TYPES_STRUCT_F_OWNER_EX_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//===-- Proxy for struct flock -------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
#ifndef LLVM_LIBC_HDR_TYPES_STRUCT_FLOCK_H | ||
#define LLVM_LIBC_HDR_TYPES_STRUCT_FLOCK_H | ||
|
||
#ifdef LIBC_FULL_BUILD | ||
|
||
#include "include/llvm-libc-types/struct_flock.h" | ||
|
||
#else | ||
|
||
#include <fcntl.h> | ||
|
||
#endif // LIBC_FULL_BUILD | ||
|
||
#endif // LLVM_LIBC_HDR_TYPES_STRUCT_FLOCK_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//===-- Proxy for struct flock64 -----------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
#ifndef LLVM_LIBC_HDR_TYPES_STRUCT_FLOCK64_H | ||
#define LLVM_LIBC_HDR_TYPES_STRUCT_FLOCK64_H | ||
|
||
#ifdef LIBC_FULL_BUILD | ||
|
||
#include "include/llvm-libc-types/struct_flock64.h" | ||
|
||
#else | ||
|
||
#include <fcntl.h> | ||
|
||
#endif // LIBC_FULL_BUILD | ||
|
||
#endif // LLVM_LIBC_HDR_TYPES_STRUCT_FLOCK64_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
//===-- Definition of type struct f_owner_ex ------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLVM_LIBC_TYPES_STRUCT_F_OWNER_EX_H | ||
#define LLVM_LIBC_TYPES_STRUCT_F_OWNER_EX_H | ||
|
||
#include "llvm-libc-types/pid_t.h" | ||
|
||
enum pid_type { | ||
F_OWNER_TID = 0, | ||
F_OWNER_PID, | ||
F_OWNER_PGRP, | ||
}; | ||
|
||
struct f_owner_ex { | ||
enum pid_type type; | ||
pid_t pid; | ||
}; | ||
|
||
#endif // LLVM_LIBC_TYPES_STRUCT_F_OWNER_EX_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
//===-- Definition of type struct flock64 ---------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLVM_LIBC_TYPES_STRUCT_FLOCK_H | ||
#define LLVM_LIBC_TYPES_STRUCT_FLOCK_H | ||
|
||
#include "llvm-libc-types/off_t.h" | ||
#include "llvm-libc-types/pid_t.h" | ||
|
||
#include <stdint.h> | ||
|
||
struct flock { | ||
int16_t l_type; | ||
int16_t l_whence; | ||
off_t l_start; | ||
off_t l_len; | ||
pid_t l_pid; | ||
}; | ||
|
||
#endif // LLVM_LIBC_TYPES_STRUCT_FLOCK_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
//===-- Definition of type struct flock64 ---------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLVM_LIBC_TYPES_STRUCT_FLOCK64_H | ||
#define LLVM_LIBC_TYPES_STRUCT_FLOCK64_H | ||
|
||
#include "llvm-libc-types/off64_t.h" | ||
#include "llvm-libc-types/pid_t.h" | ||
|
||
#include <stdint.h> | ||
|
||
struct flock64 { | ||
int16_t l_type; | ||
int16_t l_whence; | ||
off64_t l_start; | ||
off64_t l_len; | ||
pid_t l_pid; | ||
}; | ||
|
||
#endif // LLVM_LIBC_TYPES_STRUCT_FLOCK64_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
//===-- Implementation header of fcntl --------------------------*- C++ -*-===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLVM_LIBC_SRC_FCNTL_FCNTL_H | ||
#define LLVM_LIBC_SRC_FCNTL_FCNTL_H | ||
|
||
namespace LIBC_NAMESPACE { | ||
|
||
int fcntl(int fd, int cmd, ...); | ||
|
||
} // namespace LIBC_NAMESPACE | ||
|
||
#endif // LLVM_LIBC_SRC_FCNTL_FCNTL_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.