Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Oct 2017 09:30:06 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        Jonathan de Boyne Pollard <J.deBoynePollard-newsgroups@ntlworld.com>
Cc:        FreeBSD Arch <freebsd-arch@freebsd.org>, FreeBSD Hackers <freebsd-hackers@freebsd.org>
Subject:   Re: New reboot flag: -c for 'power cycle'
Message-ID:  <CANCZdfo8wFQh=aia6=HgtawYiV%2BmXYvWLoiJsZf1SqRa3ds36g@mail.gmail.com>
In-Reply-To: <01741ade-cd76-3e7a-2b75-0d9984a6ee90@NTLWorld.COM>
References:  <01741ade-cd76-3e7a-2b75-0d9984a6ee90@NTLWorld.COM>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Oct 28, 2017 at 8:51 AM, Jonathan de Boyne Pollard via freebsd-arch
<freebsd-arch@freebsd.org> wrote:

>
> Warner Losh:
>
> > Since init has no controlling terminal, SIGWINCH is useless to it anyway.
>
> This is untrue for two reasons.  First, for some years now the nosh
> toolset's system manager has been recognizing SIGWINCH on FreeBSD/TrueOS
> for Linux compatibility; as on Linux it is sent to process #1 in response
> to a kernel virtual terminal attention key sequence.  Second, that argument
> is fallacious because it would also apply to controlling-terminal-generated
> signals such as SIGINT and clearly does not given that SIGINT is useful to
> process #1.
>

It's useless for its intended purpose, which is why it can be appropriated.
I was completely unaware of SIGWINCH being used like this on Linux. It
didn't pop up in the quick research I did before implementing this.

But it would have been nice to know this sooner, but I'm OK with later
since it isn't much later..


> So what I am doing in the nosh toolset for the forthcoming version 1.36 is
> this:
>

Might want to hold off on this a smidge... See below...


> * The compatibility shutdown command now sports a new -c/--powercycle
> option.
>
> * The compatibility reboot, halt, and poweroff commands now sport a new
> -c/--powercycle option, for the benefits of cruel system administrators.
>
> * There is a new compatibility fastpowercycle/powercycle command, with all
> of the same options for cruel system administrators.
>

Hmmm, I like this. I'll have to add it to FreeBSD. I should have thought of
it in the first place.


> * system-manager now treats SIGWINCH differently on non-Linux operating
> systems, treading it as a request to invoke a new powercycle service.
>
>   SIGRTMIN+6, unused in the systemd system, is the Linux equivalent.
>
> * system-manager now treats SIGRTMIN+16 as the underlying actual
> powercycle request, which it translates to either RB_POWERCYCLE if it is
> present in the C library headers, or RB_AUTOBOOT if it is not.
>
> * There is now a new system-control powercycle subcommand, which defaults
> to sending SIGWINCH/SIGRTMIN+6 or SIGRTMIN+16.
>

It looks like all the SIGRT* signals are user defined, and can be used for
any purpose by the application. It could easily be SIGRTMIN+6 as it is
SIGWINCH and we could ditch SIGWINCH on FreeBSD in init as well (since it's
only been in -current for a few days).  Would that suffice to address the
compatibility concerns? There's no reason to be gratuitously different here.


> * The system-control init subcommand now sports a new c/C argument, by
> analogy to h/H.
>
>   This is of course thus reflected automatically in the compatibility
> telinit command and the initctl-read server.
>

 Warner



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfo8wFQh=aia6=HgtawYiV%2BmXYvWLoiJsZf1SqRa3ds36g>