Date: Wed, 26 Nov 2003 17:40:20 -0800 (PST) From: Jean-Yves Lefort <jylefort@brutele.be> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/35377: process gets unkillable (-9) in "ttywai" state Message-ID: <200311270140.hAR1eKrC031247@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/35377; it has been noted by GNATS. From: Jean-Yves Lefort <jylefort@brutele.be> To: freebsd-gnats-submit@FreeBSD.org, yuri@tsoft.com Cc: Subject: Re: kern/35377: process gets unkillable (-9) in "ttywai" state Date: Thu, 27 Nov 2003 02:35:19 +0100 The problem should probably be fixed in the kernel, but I developed a workaround: --- start of ttyflush.c --- #include <stdio.h> #include <string.h> #include <errno.h> #include <stdlib.h> #include <fcntl.h> #include <unistd.h> #include <sys/ioctl.h> int main (int argc, char **argv) { int fd; int what = FWRITE; if (argc != 2) { printf("Usage: %s TERMINAL_DEVICE\n", argv[0]); exit(1); } fd = open(argv[1], O_RDONLY); if (fd == -1) { fprintf(stderr, "Unable to open terminal device %s: %s\n", argv[1], strerror(errno)); exit(1); } if (ioctl(fd, TIOCFLUSH, &what) == -1) { fprintf(stderr, "ioctl() error: %s\n", strerror(errno)); exit(1); } if (close(fd) == -1) { fprintf(stderr, "Unable to close terminal device: %s\n", strerror(errno)); exit(1); } return 0; } --- end of ttyflush.c --- Compile it, and use it this way: 1) Get the pseudo-terminal device of the offending process: $ ps axww | grep irssi 87545 p1- IEs+ 0:00.24 irssi $ In this case, it's /dev/ttyp1 2) Flush the output queue, using the above program: ./ttyflush /dev/ttyp1 That'll allow the process to exit. Regards, Jean-Yves Lefort -- Jean-Yves Lefort jylefort@brutele.be http://lefort.be.eu.org/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200311270140.hAR1eKrC031247>