Age | Commit message (Collapse) | Author |
|
|
|
ok miod@ millert@
|
|
getopt(3) returns '?' when it encounters a flag not present in the in
the optstring or if a flag is missing its option argument. We can
handle this case with the "default" failure case with no loss of
legibility. Hence, remove all the redundant "case '?':" lines.
Prompted by dlg@. With help from dlg@ and millert@.
Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2
ok naddy@ millert@ dlg@
|
|
original diff from jan stary, adjusted according to sthen
|
|
jmc@ dislikes a comma before "then" in a conditional, so leave those
untouched.
ok jmc@
|
|
chmod 600 the file to remove the t-bit that the bootblocks set when
the file is used)
comments from naddy
|
|
to avoid filling up syslog with unnecessary information
ok tb@
|
|
enable support for displaying an estimate recharge time in apm(d)
e.g:
Battery state: charging, 95% remaining, 11 minutes recharge time estimate
Battery state: charging, 97% remaining, 8 minutes recharge time estimate
Battery state: charging, 98% remaining, 6 minutes recharge time estimate
Battery state: charging, 99% remaining, 3 minutes recharge time estimate
Battery state: charging, 99% remaining, 1 minutes recharge time estimate
Battery state: charging, 99% remaining, 0 minutes recharge time estimate
ok jca@
|
|
|
|
fails to report the path that the failure occured on. Suggested by
deraadt@ after some tech discussion.
Work done and verified by Ashton Fagg <ashton@fagg.id.au>
ok deraadt@ semarie@ claudio@
|
|
|
|
Save errno when we get an error so we can pass it to the apm(8) client.
ok kn@
|
|
Its caller doesn't use the return value so zap it. Also zap tentative
error handling in the caller. ok kn@
|
|
|
|
ok kn@
|
|
apm(8) never got the result of the requested power action carried out by
apmd(8), so apm(4) errors got silently discarded; for example, zzz(8)
would merely print "Suspending system..." and exit zero on platforms
lacking suspend/resume support.
Enrich reply messages from apmd to apm with an error field containing the
failed ioctl(2)'s errno if need be.
Hoist apmd's power action dispatch into handle_client() so it can write the
error in the first place before replying.
OK dv
|
|
powerpc64 was lacking manual pages; instead of shipping yet another
identical MD manual, merge them under MI MANPATH as usual.
Input OK deraadt
|
|
Otherwise there is no way to determine why e.g. zzz(8) does not do anything
on certain machines; macppc and arm64 for example have no suspend/resume
suspend at all (for now) and loongson has partial support.
This still does not make `zzz' or `apm -z' report the informative
warning on standar error, but syslog now prints
apmd: system suspending
apmd: battery status: unknown. external power status: not known. estimated battery life 0%
apmd: suspend: Operation not supported
OK benno
|
|
The control socket is not unveiled, therefore accounting would report
unveil violations whenever apmd(8) stopped (normally).
As discussed and done with other daemons such as relayd which also employ
no pledge (due to inherent limitations) but unveil effecting all of /,
simply stop removing the socket upon exit and leave it to the next apmd
which completely sets up its control socket anew at startup.
Violations reported by anton
Feedback OK semarie mestre
|
|
Pledge is not possible due to the ioctls, but as apmd hoists both the
control socket and apm device early at startup and only ever possibly
executes scripts under /etc/apm/, hiding the rest of the filesystem
becomes easy.
Technically, only "x" is required to traverse the directory and run
scripts, but apmd carefully access(2) each script, which requires
the read bit regardless of the permission bits being tested.
OK mestre
|
|
This is better than using hw.perfpolicy="high" for a number of reasons:
- matches the manpage
- apm(8) reporting becomes accurate
- more symmetry with -L ("low")
- lets the user tweak hw.setperf with sysctl(8) later
ok tedu@
|
|
apmd(8) doesn't need to maintain state about the current hw.perfpolicy.
Dropping this weak caching fixes several issues:
- setting hw.perfpolicy can fail, don't report a bogus hw.perfpolicy if
that happens (reported by Miod)
- don't assume that hw.perfpolicy is set to "manual" at apmd(8) startup
- don't assume that hw.perfpolicy can't change behind apmd(8)'s back
"Seems fine" tedu@
|
|
Nowadays "auto" mode is used instead. ok deraadt@
|
|
apmd/apm combo for -L/-H and such. (it gets all the rest of the mess too)
ok kettenis
|
|
This prevents your laptop from immediately going back to sleep after
resume, leaving you some time to look up stuff or even stop apmd in
case you need the machine RIGHT NOW.
Blocking autoaction until the laptop resumes prevents spurious
suspend/resume cycles.
Advices from cheloha@
|
|
Fake an APM_POWER_CHANGE event if we time out waiting for an event.
This allows us to handle autoaction in a single place.
|
|
|
|
Makes -z/-Z just work for me using acpibat(4). Other battery drivers
that provide APM_POWER_CHANGE events: acpisbs(4), apm(4),
ykbec(4/loongson) and stsec(4/loongson).
ok tedu@
|
|
Just check the return value of kevent(2) to detect a timeout.
ok tedu@
|
|
Missed when I changed this in apmd.c rev 1.91.
|
|
ok kn@ mpi@
|
|
That logic is now in the kernel. ok kn@ mpi@
|
|
emergency log message. Then syslogd(8) could select on that and
write a warning to all users.
OK benno@ deraadt@
|
|
Found by bluhm, thanks.
|
|
Typo from r1.84 introducing the logmsg() wrapper.
OK deraadt
|
|
Initialize stack variables directly instead of using global state in
between.
OK tedu deraadt
|
|
value < 0. errno is only updated in this case. Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.
|
|
previous version OK deraadt@ patrick@
OK jsg@
|
|
ok kn
|
|
Base 10 suffices, negative numbers should be invalid (not converted) and
zero not treated specially.
This also unifies error messages and removes unnecessary EINVAL from them
since strtonum()'s errstr is explicit enough already.
Feedback and OK martjin, tb
|
|
interesting to review.
it seems the battery status is sometimes stale, but that's another bug.
ok kn phessler
|
|
|
|
|
|
from Jesper Wallin
|
|
shortly when we use the hardware thread register in userland
|
|
|
|
|
|
|
|
sizeof(struct sockaddr_un), so do the simple, portable thing.
Also convert some strncpy() to strlcpy()
ok deraadt@
|
|
ok deraadt jung phessler
|