On Oct 28 18:35:27, Jason McIntyre wrote:
> On Wed, Oct 27, 2010 at 03:12:51PM +0200, Jan Stary wrote:
> > I run a -current apmd on a MacBook3,1.
> > It suspends and resumes just fine.
> >
> > There seems to be a slightly unclear detail
> > in the apmd(8) manpage however:
> >
> > /etc/apm/suspend
> > /etc/apm/standby
> > /etc/apm/resume
> > /etc/apm/powerup
> > /etc/apm/powerdown These files contain the host's customized
> > actions.
> > Each file must be an executable binary or shell
> > script. A single program or script can be used to
> > control all transitions by examining its argument
> > list, which is set to one of suspend, standby,
> > resume, powerup, or powerdown.
> >
> >
> > The wording "argument list, which is set to ..." suggests
> > that apmd calls the scripts with an argument ($1) of "suspend",
> > or an argument of "resume" etc; it does not - when apmd suspends,
> > it simply runs /etc/apm/suspend, but does not give it any "argument
> > list". (The script can still examine the name by which it was called,
> > of course.)
> >
> > This is examplified by the following:
> >
> > # ls -li /etc/apm
> > total 20
> > 8089 -rwxr-xr-x 5 root wheel 54 Oct 27 08:43 powerdown
> > 8089 -rwxr-xr-x 5 root wheel 54 Oct 27 08:43 powerup
> > 8089 -rwxr-xr-x 5 root wheel 54 Oct 27 08:43 resume
> > 8089 -rwxr-xr-x 5 root wheel 54 Oct 27 08:43 standby
> > 8089 -rwxr-xr-x 5 root wheel 54 Oct 27 08:43 suspend
> >
> > # cat /etc/apm/suspend
> > #!/bin/sh
> >
> > echo `date` $0 called with $@ >> /tmp/log
> >
> > [suspend now]
> > [resume now]
> >
> > # cat /tmp/log
> > Wed Oct 27 15:04:17 CEST 2010 /etc/apm/suspend called with
> > Wed Oct 27 15:04:28 CEST 2010 /etc/apm/resume called with
> >
> >
>
> ok, this is giving me a sore head and i'm fed up of looking at it. i
> freely admit i do not understand this part of the manpage. so...
>
> > I believe the diff below makes the wording more clear.
> >
>
> if some developer wants to agree that jan is correct we can look at a
> fix. jan, i think your diff is incorrect - isn;t it just repeating what
> we've already said? if what you say is true, isn;t the best fix just to
> remove the text "A single program...powerdown."?
No, it's not repeating what was already said. But I agree
that it is better to simply remove the text. (People editing
/etc/apm/* can be assumed to know about ln(1), right?)
BTW, this is what 4.5 had to say about the scripts
(my point being the difference between examining argv[0] and
examining the nonexistent "argument list"):
These files contain the host's customized actions. Each
file must be an executable binary or shell script suitable
for execution by the execve(2) function. If you wish to
have the same program or script control all transitions,
it may determine which transition is in progress by examining
its argv[0], which is set to one of suspend, standby,
resume, powerup, or powerdown.
Jan
> > --- apmd.8.orig Wed Oct 27 15:09:14 2010
> > +++ apmd.8 Wed Oct 27 15:10:21 2010
> > @@ -182,8 +182,8 @@
> > These files contain the host's customized actions.
> > Each file must be an executable binary or shell script.
> > A single program or script can be used to control all transitions
> > -by examining its argument list,
> > -which is set to one of
> > +by examining the name by which it was called,
> > +which is one of
> > suspend,
> > standby,
> > resume,