[llvm] a3eb3d3 - [Support] Delete ioctl TIOCGWINSZ
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 31 16:41:30 PDT 2020
Author: Fangrui Song
Date: 2020-03-31T16:41:09-07:00
New Revision: a3eb3d3d92d037fe3c9deaad87f6fc42fe9ea766
URL: https://github.com/llvm/llvm-project/commit/a3eb3d3d92d037fe3c9deaad87f6fc42fe9ea766
DIFF: https://github.com/llvm/llvm-project/commit/a3eb3d3d92d037fe3c9deaad87f6fc42fe9ea766.diff
LOG: [Support] Delete ioctl TIOCGWINSZ
D61326 essentially disabled `ioctl(FileID, TIOCGWINSZ, &ws)`. Nobody
has complained for one year. So let's just delete the code.
Added:
Modified:
llvm/lib/Support/Unix/Process.inc
Removed:
################################################################################
diff --git a/llvm/lib/Support/Unix/Process.inc b/llvm/lib/Support/Unix/Process.inc
index dfe81d7e2833..a68b30a546c8 100644
--- a/llvm/lib/Support/Unix/Process.inc
+++ b/llvm/lib/Support/Unix/Process.inc
@@ -280,7 +280,7 @@ bool Process::FileDescriptorIsDisplayed(int fd) {
#endif
}
-static unsigned getColumns(int FileID) {
+static unsigned getColumns() {
// If COLUMNS is defined in the environment, wrap to that many columns.
if (const char *ColumnsStr = std::getenv("COLUMNS")) {
int Columns = std::atoi(ColumnsStr);
@@ -288,31 +288,23 @@ static unsigned getColumns(int FileID) {
return Columns;
}
- unsigned Columns = 0;
-
-#if defined(HAVE_SYS_IOCTL_H) && defined(HAVE_TERMIOS_H) \
- && !(defined(_XOPEN_SOURCE) || defined(_POSIX_C_SOURCE))
- // Try to determine the width of the terminal.
- struct winsize ws;
- if (ioctl(FileID, TIOCGWINSZ, &ws) == 0)
- Columns = ws.ws_col;
-#endif
-
- return Columns;
+ // We used to call ioctl TIOCGWINSZ to determine the width. It is considered
+ // unuseful.
+ return 0;
}
unsigned Process::StandardOutColumns() {
if (!StandardOutIsDisplayed())
return 0;
- return getColumns(1);
+ return getColumns();
}
unsigned Process::StandardErrColumns() {
if (!StandardErrIsDisplayed())
return 0;
- return getColumns(2);
+ return getColumns();
}
#ifdef HAVE_TERMINFO
More information about the llvm-commits
mailing list