Linux, FreeBSD: emu killed on exit
Original issue 282 created by inferno-os on 2012-06-17T17:18:00.000Z:
<b>What steps will reproduce the problem?</b> Ubuntu 12.04 $ emu echo ok ok Killed Ubuntu 12.04 $
FreeBSD 8.0 $ emu-g echo ok ok Killed FreeBSD 8.0 $
<b>What is the expected output? What do you see instead?</b> I'm expect to not see "Killed" on emu shutdown. In MacOSX and Win there is no "Killed", it happens only on Linux and FreeBSD.
<b>Which operating system are you using?</b> Tested on Linux, FreeBSD, MacOSX and Win.
<b>Please provide any additional information below.</b> I've found a work around some time ago - wrapper script in ~/bin/emu. Linux version: #!/bin/bash $INFERNO_ROOT/Linux/386/bin/emu "$@" </dev/stdin & wait 2>/dev/null FreeBSD version: #!/usr/local/bin/bash $INFERNO_ROOT/FreeBSD/386/bin/emu "$@" </dev/stdin & wait 2>/dev/null
Comments (5)
-
Account Deleted -
Account Deleted Comment #2 originally posted by inferno-os on 2013-06-07T15:50:43.000Z:
That is the reason for the message, but at the moment the kill is needed to shut down the various processes (eg, running kprocs) without having to enumerate them (which would be fairly involved, and anyway, this is a good use of a process group).
Cleanexit sends the signal to the process group. The cleanexit function is not necessarily called in the process for which the shell is waiting, so that process is hit by the SIGKILL, and the shell prints the diagnostic. Something along those lines.
-
Account Deleted Comment #3 originally posted by inferno-os on 2013-06-07T18:48:18.000Z:
I understand Alex' issue with this, as I too will use emu inside shell scripts and the "Killed" message makes things a bit messy at the console.
It also makes sense to not clutter up the code with kproc tracking details for such a minor issue.
Is the lack of "kill(0, SIGKILL)" in the other *nix platforms an oversight or by design?
I will research if there are any clever ways to suppress the SIGKILL message.
-
Account Deleted Comment #4 originally posted by inferno-os on 2013-06-07T21:04:26.000Z:
Oh, I quite agree with you about the messiness. I was just explaining what it was doing, not suggesting that was the way it ought to be left.
Also, nearly all the Unix platforms (I thought it was all of them) have kill(0, SIGKILL) or an equivalent. Try cd emu; grep SIGKILL */os.c
-
I've experimented a bit with this and changed the offending line to
kill(0, SIGTERM)
. This still ensures a clean exit, but avoids the SIGKILL message. - Log in to comment
Comment #1 originally posted by inferno-os on 2013-06-07T15:44:20.000Z:
In several emu//os.c (most of the nix except MacOSX, Solaris, and Unixware at 1st look), the function "cleanexit" does a "kill(0, SIGKILL)" before calling "exit(0)".
I'm afraid to remove the "kill(0, SIGKILL)" w/o understanding why it's there, but I believe that's the reason why the "Killed" message appears.