Skip to content

Commit a3eb3d3

Browse files
committed
[Support] Delete ioctl TIOCGWINSZ
D61326 essentially disabled `ioctl(FileID, TIOCGWINSZ, &ws)`. Nobody has complained for one year. So let's just delete the code.
1 parent 7ea64ae commit a3eb3d3

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

llvm/lib/Support/Unix/Process.inc

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -280,39 +280,31 @@ bool Process::FileDescriptorIsDisplayed(int fd) {
280280
#endif
281281
}
282282

283-
static unsigned getColumns(int FileID) {
283+
static unsigned getColumns() {
284284
// If COLUMNS is defined in the environment, wrap to that many columns.
285285
if (const char *ColumnsStr = std::getenv("COLUMNS")) {
286286
int Columns = std::atoi(ColumnsStr);
287287
if (Columns > 0)
288288
return Columns;
289289
}
290290

291-
unsigned Columns = 0;
292-
293-
#if defined(HAVE_SYS_IOCTL_H) && defined(HAVE_TERMIOS_H) \
294-
&& !(defined(_XOPEN_SOURCE) || defined(_POSIX_C_SOURCE))
295-
// Try to determine the width of the terminal.
296-
struct winsize ws;
297-
if (ioctl(FileID, TIOCGWINSZ, &ws) == 0)
298-
Columns = ws.ws_col;
299-
#endif
300-
301-
return Columns;
291+
// We used to call ioctl TIOCGWINSZ to determine the width. It is considered
292+
// unuseful.
293+
return 0;
302294
}
303295

304296
unsigned Process::StandardOutColumns() {
305297
if (!StandardOutIsDisplayed())
306298
return 0;
307299

308-
return getColumns(1);
300+
return getColumns();
309301
}
310302

311303
unsigned Process::StandardErrColumns() {
312304
if (!StandardErrIsDisplayed())
313305
return 0;
314306

315-
return getColumns(2);
307+
return getColumns();
316308
}
317309

318310
#ifdef HAVE_TERMINFO

0 commit comments

Comments
 (0)