slabtop, vmstat, watch: remove file descriptor constants
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
7267c3a22b
commit
94fa402d4b
@ -414,7 +414,7 @@ int main(int argc, char *argv[])
|
|||||||
tv.tv_sec = delay;
|
tv.tv_sec = delay;
|
||||||
tv.tv_usec = 0;
|
tv.tv_usec = 0;
|
||||||
if (select(STDOUT_FILENO, &readfds, NULL, NULL, &tv) > 0) {
|
if (select(STDOUT_FILENO, &readfds, NULL, NULL, &tv) > 0) {
|
||||||
if (read(0, &c, 1) != 1)
|
if (read(STDIN_FILENO, &c, 1) != 1)
|
||||||
break;
|
break;
|
||||||
parse_input(c);
|
parse_input(c);
|
||||||
}
|
}
|
||||||
|
2
vmstat.c
2
vmstat.c
@ -694,7 +694,7 @@ static int winhi(void)
|
|||||||
struct winsize win;
|
struct winsize win;
|
||||||
int rows = 24;
|
int rows = 24;
|
||||||
|
|
||||||
if (ioctl(1, TIOCGWINSZ, &win) != -1 && win.ws_row > 0)
|
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &win) != -1 && 0 < win.ws_row)
|
||||||
rows = win.ws_row;
|
rows = win.ws_row;
|
||||||
|
|
||||||
return rows;
|
return rows;
|
||||||
|
2
watch.c
2
watch.c
@ -220,7 +220,7 @@ static void get_terminal_size(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (incoming_cols < 0 || incoming_rows < 0) {
|
if (incoming_cols < 0 || incoming_rows < 0) {
|
||||||
if (ioctl(2, TIOCGWINSZ, &w) == 0) {
|
if (ioctl(STDERR_FILENO, TIOCGWINSZ, &w) == 0) {
|
||||||
if (incoming_rows < 0 && w.ws_row > 0) {
|
if (incoming_rows < 0 && w.ws_row > 0) {
|
||||||
height = w.ws_row;
|
height = w.ws_row;
|
||||||
snprintf(env_row_buf, sizeof env_row_buf,
|
snprintf(env_row_buf, sizeof env_row_buf,
|
||||||
|
Loading…
Reference in New Issue
Block a user