Bug 52490 - ^T'ing a zombie causes 'calcru: negative time' messages
Summary: ^T'ing a zombie causes 'calcru: negative time' messages
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-05-20 18:50 UTC by Jilles Tjoelker
Modified: 2004-06-22 06:58 UTC (History)
0 users

See Also:


Attachments
negtime.c (828 bytes, text/plain)
2003-05-20 18:50 UTC, Jilles Tjoelker
no flags Details
file.diff (425 bytes, patch)
2003-05-20 18:50 UTC, Jilles Tjoelker
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jilles Tjoelker freebsd_committer freebsd_triage 2003-05-20 18:50:08 UTC
When ^T'ing (ttyinfo) a zombie, calcru() is called and logs a 'negative time'
message. To achieve this, only zombies must be in the foreground process group
of the terminal.

Fix: A patch (against 4-STABLE) is attached which prevents calcru() from being
called on zombies from ttyinfo(). I don't know in what process states calcru()
may be called exactly, but for the rest of /sys/kern it's only used for
accounting, exiting and getrusage() and therefore cannot be called on zombies.
(Perhaps this is or should be documented somewhere.)
How-To-Repeat: Compile and run the negtime program. Pressing ^T after it has printed the
message 'done' causes a log message 'calcru: negative time...'. (It may be
necessary to do stty status ^t beforehand.)
Comment 1 Bruce Evans freebsd_committer freebsd_triage 2004-06-22 06:56:54 UTC
State Changed
From-To: open->closed

Fixed in a different way in rev.1.237 of kern_exit.c in -current.  ^T on 
zombies now gives correct results in -current. 

Worked around in a different way in 1.55.2.7 of kern_resource.c in 
RELENG_4.  ^T on zombies now gives slightly out of date results in RELENG_4. 

The test program in the PR was very useful for investigating the bug. 

ps and friends aren't affected by the main bug, but they display 
completely wrong times for zombies (always 0).  Resource usage is the 
main thing that is not discarded when a process exits, so it should 
be visible for zombies too.