[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / libc / src / __support / File / linux / file.h
blob24e71b133c4813068f5eec93d413523f84910b2f
1 //===--- Linux specialization of the File data structure ------------------===//
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 //===----------------------------------------------------------------------===//
9 #include "src/__support/File/file.h"
11 namespace LIBC_NAMESPACE {
13 FileIOResult linux_file_write(File *, const void *, size_t);
14 FileIOResult linux_file_read(File *, void *, size_t);
15 ErrorOr<long> linux_file_seek(File *, long, int);
16 int linux_file_close(File *);
18 class LinuxFile : public File {
19 int fd;
21 public:
22 constexpr LinuxFile(int file_descriptor, uint8_t *buffer, size_t buffer_size,
23 int buffer_mode, bool owned, File::ModeFlags modeflags)
24 : File(&linux_file_write, &linux_file_read, &linux_file_seek,
25 &linux_file_close, buffer, buffer_size, buffer_mode, owned,
26 modeflags),
27 fd(file_descriptor) {}
29 int get_fd() const { return fd; }
32 } // namespace LIBC_NAMESPACE