brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 5a3a972 Raw
43 lines · c
1//===-- Definition of kernel's version of struct termios --------*- 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-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LLVM_LIBC_SRC_TERMIOS_LINUX_KERNEL_TERMIOS_H10#define LLVM_LIBC_SRC_TERMIOS_LINUX_KERNEL_TERMIOS_H11 12#include "src/__support/macros/config.h"13#include <stddef.h>14#include <termios.h>15 16namespace LIBC_NAMESPACE_DECL {17 18// The kernel's struct termios is different from the libc's struct termios. The19// kernel's syscalls expect the size and layout of its definition of struct20// termios. So, we define a flavor of struct termios which matches that of the21// kernel so that we can translate between the libc version and the kernel22// version when passing struct termios objects to syscalls.23 24// NOTE: The definitions here are generic definitions valid for most target25// architectures including x86_64 and aarch64. Definitions on some architectures26// deviate from these generic definitions. Adjustments have to be made for those27// architectures.28 29constexpr size_t KERNEL_NCCS = 19;30 31struct kernel_termios {32  tcflag_t c_iflag;33  tcflag_t c_oflag;34  tcflag_t c_cflag;35  tcflag_t c_lflag;36  cc_t c_line;37  cc_t c_cc[KERNEL_NCCS];38};39 40} // namespace LIBC_NAMESPACE_DECL41 42#endif // LLVM_LIBC_SRC_TERMIOS_LINUX_KERNEL_TERMIOS_H43