"Not charging" is 12 characters; %12[a-zA-Z ] reads up to 12 chars
plus a NUL terminator (13 bytes) into a 12-byte buffer. Increase
state buffer to 13 in both battery_state and battery_remaining.
ifindex() caches the result of ioctl(SIOCGIFINDEX) and never
retries it, since the interface name strcmp succeeds after the
first call. if the interface does not exist when slstatus starts
(e.g. iwd with default config destroys/recreates interfaces
depending on service state), the ioctl fails and the stale
result is returned on all subsequent calls.
based on a patch by ryhpez, with input from Taha Medhous
more flexible parsing for /proc/meminfo to take shared and reclaimable
memory into account. this matches the output with free(1).
additionally this could fix some corner cases, as the order of fields in
/proc/meminfo is not strictly defined.
slstatus:
percent 81% free 2.5 Gi total 23.4 Gi used 19.0 Gi
free(1):
total used free shared buff/cache available
Mem: 23Gi 19Gi 2.5Gi 1.3Gi 3.2Gi 3.6Gi
The current version displays the remaining time as 'n/a'.
Fixes this regression introduced in 69b2487650782f135db76078c4a7fb841cb936ac
where current_now and power_now were incorrectly replaced with current and
power when they were moved to a macro.
function prototype with unspecified argument is obsolete since c99.
additionally some of these function which don't take any argument were
being called with a `const char *` arg, which is UB.
fix both these issues by declararing ALL the components to accept a
`const char *`, and name the arg "unused" if it's meant to be ignored.
Exists on various ThinkPads. Seems to be both a synonym for "full".
Tested on:
- ThinkPad T500 (Spenser Truex <truex@equwal.com)
- ThinkPad T420 (drkhsh <me@drkhsh.at)
The current implementation uses the wrong type for
given sysctl calls leading to overflow and incorrectly
reported RAM usage. The fix is to use 'unsigned int'
which is what FreeBSD expects.
Starting with OpenBSD 6.7 regular users cannot access raw audio devices
anymore, for improved security.
Instead use the sioctl_open(3) API to access and manipulate audio
controls exposed by sndiod(8). On the first call a permanent connection
is established with the running sndiod daemon, and call-back functions
are registered which are triggered when audio controls are changed
(e.g., a USB headset is attached) or when the volume is modified. On
subsequent calls we poll for changes; if there are no volume changes
this costs virtually nothing.
Joint work with Alexandre Ratchov
On OpenBSD although the formula is correct due to integer division a
temperature of for example 54 celsius appears as 5. this patch first
treats it as a floating point op before retaining the non decimal digits