12 #include <sys/ioctl.h>
26 n =
read(fd, c_out,
sizeof(*c_out));
42 err =
write(fd, buf, n);
53 unsigned short *cols_out)
61 ret = ((*rows_out != size.
ws_row) || (*cols_out != size.
ws_col));
81 sigemptyset(&no_sigio);
82 sigaddset(&no_sigio,
SIGIO);
135 static void winch_handler(
int sig)
144 static int winch_thread(
void *
arg)
154 count =
write(pipe_fd, &c,
sizeof(c));
155 if (count !=
sizeof(c))
157 "synchronization byte, err = %d\n", -count);
170 "errno = %d\n",
errno);
184 "fd %d err = %d\n", pty_fd, errno);
188 if (tcsetpgrp(pty_fd,
os_getpid()) < 0) {
190 "fd %d err = %d\n", pty_fd, errno);
200 count =
read(pipe_fd, &c,
sizeof(c));
201 if (count !=
sizeof(c))
203 "synchronization byte, err = %d\n", errno);
212 count =
write(pipe_fd, &c,
sizeof(c));
213 if (count !=
sizeof(c))
215 "err = %d\n", errno);
219 static int winch_tramp(
int fd,
struct tty_struct *tty,
int *fd_out,
220 unsigned long *stack_out)
234 .pipe_fd = fds[1] } );
249 n =
read(fds[0], &c,
sizeof(c));
250 if (n !=
sizeof(c)) {
252 "synchronization byte\n");
290 thread = winch_tramp(fd, tty, &thread_fd, &stack);
296 count =
write(thread_fd, &c,
sizeof(c));
297 if (count !=
sizeof(c))
299 "synchronization byte, err = %d\n",
errno);