[all-commits] [llvm/llvm-project] 7639ba: [libc] add isatty

michaelrj-google via All-commits all-commits at lists.llvm.org
Mon Oct 10 15:21:02 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7639ba690648fae2b2034aa842942419b2fdcad4
      https://github.com/llvm/llvm-project/commit/7639ba690648fae2b2034aa842942419b2fdcad4
  Author: Michael Jones <michaelrj at google.com>
  Date:   2022-10-10 (Mon, 10 Oct 2022)

  Changed paths:
    M libc/config/linux/x86_64/entrypoints.txt
    M libc/config/linux/x86_64/headers.txt
    M libc/include/CMakeLists.txt
    M libc/include/llvm-libc-macros/CMakeLists.txt
    M libc/include/llvm-libc-macros/linux/CMakeLists.txt
    A libc/include/llvm-libc-macros/linux/sys-ioctl-macros.h
    A libc/include/llvm-libc-macros/sys-ioctl-macros.h
    A libc/include/sys/ioctl.h.def
    M libc/spec/posix.td
    M libc/src/unistd/CMakeLists.txt
    A libc/src/unistd/isatty.h
    M libc/src/unistd/linux/CMakeLists.txt
    A libc/src/unistd/linux/isatty.cpp
    M libc/test/src/unistd/CMakeLists.txt
    A libc/test/src/unistd/isatty_test.cpp

  Log Message:
  -----------
  [libc] add isatty

The isatty function uses the side effects of an ioctl call to determine
if a specific file descriptor is a terminal. I chose TIOCGETD (get line
discipline of terminal) because it didn't require any new structs.

Reviewed By: sivachandra, lntue

Differential Revision: https://reviews.llvm.org/D135618




More information about the All-commits mailing list