From nobody  Tue Jan 19 07:20:23 1999
Received: (from nobody@localhost)
          by hub.freebsd.org (8.8.8/8.8.8) id HAA15595;
          Tue, 19 Jan 1999 07:20:23 -0800 (PST)
          (envelope-from nobody)
Message-Id: <199901191520.HAA15595@hub.freebsd.org>
Date: Tue, 19 Jan 1999 07:20:23 -0800 (PST)
From: N/A
To: freebsd-gnats-submit@freebsd.org
Subject: top(1) ignores tty EOF condition.
X-Send-Pr-Version: www-1.0

>Number:         9569
>Category:       bin
>Synopsis:       top(1) ignores tty EOF condition.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan 19 07:30:00 PST 1999
>Closed-Date:    Thu Jul 13 07:04:50 PDT 2000
>Last-Modified:  Thu Jul 13 07:05:14 PDT 2000
>Originator:     Juha Nurmela
>Release:        3.0-CURRENT
>Organization:
ACME Inc.
>Environment:
FreeBSD pena.oh5nxo.ampr.org
3.0-CURRENT FreeBSD 3.0-CURRENT #8:
Fri Jan 15 20:38:02 EET 1999
junki@pena.oh5nxo.ampr.org:/usr/src/sys/compile/PENA
i386
>Description:
top(1) stays (hyperventilating) running after
"xterm -e top" is terminated with windowmanager,
as top does not check read(2) for EOF.

There might be problems elsewhere, too, (xterm & pty signals),
but EOF checking should be good to do anyway.
top seems to expect hangup signal.
pty default flags have -clocal set, i'm using pdksh.
>How-To-Repeat:

xterm -e top
delete window with manager
ps shows top still running
>Fix:
/usr/src/contrib/top/top.c
about line 667
     /* wait for either input or the end of the delay period */
!    if (select(32, &readfds, NULL, NULL, &timeout) != 0) /* -1 or 1*/

about line 678
!    if (read(0, &ch, 1) != 1) ch = 'q';
     if ((iptr = strchr(command_chars, ch)) == NULL)

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: nbm 
State-Changed-When: Mon Jun 26 02:11:23 PDT 2000 
State-Changed-Why:  
This no longer seems to be the case, can you verify if you still have a 
problem? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=9569 
State-Changed-From-To: feedback->closed 
State-Changed-By: nbm 
State-Changed-When: Thu Jul 13 07:04:50 PDT 2000 
State-Changed-Why:  
Feedback timeout, and this works correctly for me. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=9569 
>Unformatted:
