1//===--- Definition of Linux stdin ----------------------------------------===//
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#include "file.h"
10#include "hdr/stdio_macros.h"
11#include "hdr/types/FILE.h"
12#include "src/__support/macros/config.h"
13
14namespace LIBC_NAMESPACE_DECL {
15
16constexpr size_t STDIN_BUFFER_SIZE = 512;
17uint8_t stdin_buffer[STDIN_BUFFER_SIZE];
18static LinuxFile StdIn(0, stdin_buffer, STDIN_BUFFER_SIZE, _IOFBF, false,
19 File::ModeFlags(File::OpenMode::READ));
20File *stdin = &StdIn;
21
22} // namespace LIBC_NAMESPACE_DECL
23
24extern "C" {
25FILE *stdin = reinterpret_cast<FILE *>(&LIBC_NAMESPACE::StdIn);
26} // extern "C"
27

Provided by KDAB

Privacy Policy
Improve your Profiling and Debugging skills
Find out more

source code of libc/src/__support/File/linux/stdin.cpp