Re: [PATCH, RFC] Standardize shutdown of the system from enviroment control modules
From: Denis Vlasenko
Date: Sat Aug 27 2005 - 08:17:22 EST
> > > > Currently snsc_event for Altix systems sends SIGPWR to init (and
> > > > abuses tasklist_lock..) while the sbus drivers call execve for
> > > > /sbin/shutdown (which is also ugly, it should at least use
> > > > call_usermodehelper) With normal sysvinit both will end up the same,
> > > > but I suspect the shutdown variant, maybe with a sysctl to chose the
> > > > exact path to call would be cleaner. What do you guys think about
sysctl is indeed would be nice. Paranoid users may insist on having
freedom not to have /sbin at all.
> > > > adding a common function to do this. Could you test such a patch for
> > > > me?
> > >
> > > Okay, here's such a patch, I've also switched the SN and the two sbus
> > > drivers over.
> >
> > ping?
>
> Hi Christoph,
>
> Got your patch and built it into a kernel... Ran into other
> (unrelated) difficulties booting said kernel... I'll see if I
> can get that sorted out today and test drive it.
>
> From inspection I don't see any problem with the patch.
>
> Thanks - Greg
[snip]
> > > +/*
> > > + * envctrl_do_shutdown - shut the system down when overheating
> > > + *
> > > + * Common routine to be called from all enviromental monitoring
> > > + * drivers when a fatal overheating is detected.
> > > + *
> > > + * Returns 0 if /sbin/shutdown has been called sucessfully, 1 if
> > > + * this routine has been called already but the kernel is still
> > > + * running or a negative error value if executing the shutdown
> > > + * command failed.
> > > + */
> > > +int envctrl_do_shutdown(void)
> > > +{
> > > + static int shutting_down = 0;
> > > + int error;
> > > +
> > > + if (shutting_down)
> > > + return 1;
> > > + shutting_down = 1;
> > > +
> > > + printk(KERN_CRIT "envctrl: WARNING: Shutting down the system now.\n");
> > > + error = call_usermodehelper("/sbin/shutdown", argv, envp, 0);
> > > + if (error)
> > > + printk(KERN_CRIT "envctrl: WARNING: system shutdown failed!\n");
> > > + return error;
> > > +}
--
vda
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/