Re: APM power off fails

Matthias Urlichs (smurf@work.smurf.noris.de)
30 May 1997 17:04:37 +0200


yosshy@jedi.seg.kobe-u.ac.jp (Akira Yoshiyama) writes:
>
> I made a patch for sysvinit-2.71 to enable APM poweroff.
>
> + case 'p':
> +#if LINUX_VERSION_CODE > 0x20100
> + do_poweroff = 1;
> +#endif
> + break;
[ et al.]

thus making sure that this program, when compiled with a 2.0 kernel, will
not work correctly if not recompiled.

> +#if LINUX_VERSION_CODE > 0x20100
> + } else if (do_poweroff) {
> + init_reboot(BMAGIC_POWEROFF);
> +#endif

Better solution: Complain+continue if BMAGIC_POWEROFF doesn't work (and
fall back to BMAGIC_HARD).

> +#if LINUX_VERSION_CODE > 0x20100
> +#define BMAGIC_POWEROFF 0x4321FEDC
> +#endif
>
> #if defined(__GLIBC__)

... and why should a non-kernel program know or care about
LINUX_VERSION_CODE in the first place, anyway?

-- 
Bathroom graffiti: "For a good time, call 911."
-- 
Matthias Urlichs         \  noris network GmbH  /  Xlink-POP Nürnberg 
Schleiermacherstraße 12   \   Linux+Internet   /   EMail: urlichs@noris.de
90491 Nürnberg (Germany)   \    Consulting+Programming+Networking+etc'ing
   PGP: 1024/4F578875   1B 89 E2 1C 43 EA 80 44  15 D2 29 CF C6 C7 E0 DE
       Click <A HREF="http://info.noris.de/~smurf/finger">here</A>.    42