1 //===-- Definition of kernel's version of struct termios --------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_LIBC_SRC_TERMIOS_LINUX_KERNEL_TERMIOS_H
10 #define LLVM_LIBC_SRC_TERMIOS_LINUX_KERNEL_TERMIOS_H
12 #include "src/__support/macros/config.h"
16 namespace LIBC_NAMESPACE_DECL
{
18 // The kernel's struct termios is different from the libc's struct termios. The
19 // kernel's syscalls expect the size and layout of its definition of struct
20 // termios. So, we define a flavor of struct termios which matches that of the
21 // kernel so that we can translate between the libc version and the kernel
22 // version when passing struct termios objects to syscalls.
24 // NOTE: The definitions here are generic definitions valid for most target
25 // architectures including x86_64 and aarch64. Definitions on some architectures
26 // deviate from these generic definitions. Adjustments have to be made for those
29 constexpr size_t KERNEL_NCCS
= 19;
31 struct kernel_termios
{
37 cc_t c_cc
[KERNEL_NCCS
];
40 } // namespace LIBC_NAMESPACE_DECL
42 #endif // LLVM_LIBC_SRC_TERMIOS_LINUX_KERNEL_TERMIOS_H