From owner-freebsd-bugs@FreeBSD.ORG Wed Nov 26 17:40:22 2003 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6C02016A4CE for ; Wed, 26 Nov 2003 17:40:22 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1FD8543FAF for ; Wed, 26 Nov 2003 17:40:21 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id hAR1eKFY031248 for ; Wed, 26 Nov 2003 17:40:20 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id hAR1eKrC031247; Wed, 26 Nov 2003 17:40:20 -0800 (PST) (envelope-from gnats) Date: Wed, 26 Nov 2003 17:40:20 -0800 (PST) Message-Id: <200311270140.hAR1eKrC031247@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Jean-Yves Lefort Subject: Re: kern/35377: process gets unkillable (-9) in "ttywai" state X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Jean-Yves Lefort List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2003 01:40:22 -0000 The following reply was made to PR kern/35377; it has been noted by GNATS. From: Jean-Yves Lefort 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 #include #include #include #include #include #include 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/