Report the correct number of CPUs and calculate the per-CPU load.
Start implementing a common BSD interface, as all BSD implementations use
*slightly* different functions to achieve the same goal,
and maintaining them in one place would be easier.
Fixes #2097.
Not all systems report current_now through the power supply sysfs
interface, but some do report power_now instead. Add support for these,
too.
The new implementation first tries power_now and then falls back to
computing power as the product of current and voltage. The new
implementation also reduces memory footprint on the stack by some 512k.
Also the old implementation potentially left files open under some
circumstances.
The C language defines long to be at least 32 bit and so on ILP32 data
models like Win32 and 32-bit Unix systems. It therefore will overflow
for values of the order of 1e12, which we obtain as a multiplication
result in get_battery_power_draw().
Fix this by an early conversion to double.
* Implement `-U` for Haiku.
This patch also fixes a compilation error on Haiku.
Compiled with `cmake -DBUILD_X11=FALSE ..`
Tested on Haiku-r1beta5.
Takes part of #2072.
* Revert `common.cc`.
A cross-platform solution is already implemented in #2080.
This PR will be rebased *after* the OpenBSD fix was merged.
* Haiku: Remove `wordexp.h`.
Use the `to_real_path()` used for OpenBSD.
* Haiku: Remove `HAIKU_HOME_DIR`.
It was not used.
- Fix unclosed OBJ in core.cc when target is OpenBSD
- `to_real_path` changes:
- Canonicalize result to mimic `realpath` behavior
- Partially implement `to_real_path` for OpenBSD
- Add more tests for `to_real_path`.
- Build system improvements:
- Use same i18n include/link logic for all platforms
- Replace `HAVE_SOME_SOUNDCARD_H` and `HAVE_LINUX_SOUNDCARD_H` with `HAVE_SOUNDCARD_H`
and use other defines (__linux__) to guard include
- Replace `<XXX>_LIBRARIES` with `<XXX>_LINK_LIBRARIES` for linking.
- Libraries weren't in default linker search path on OpenBSD
- OpenBSD specific:
- Fix bsdapm.cc
- Remove diskio stats stubs
- Stub get_battery_short_status
- Remove `-stdlib=libc++` build flag on OpenBSD
Signed-off-by: Tin Švagelj <tin.svagelj@live.com>
Co-authored-by: gmb <gmb@openbsd76.my.domain>
Co-authored-by: Tin Švagelj <tin.svagelj@live.com>
Fixes #2042
We can't just assume select() exiting before the timeout to be a
success, since connect() can actually tell us there's no route to host
or other errors.
print_audacious_filename() always returns an empty (zero-length) $audacious_filename, due to one of the std::min() operators always being 0. Removing the std::min() construct fixes the problem. Fixes #1175.
* Update nvidia.cc
Made a suggested change in logic from issue #1177
* Update nvidia.cc
Made a suggested change in logic from issue #1178
* Update nvidia.cc
Made a suggested change in logic from issue #1178
The logic for the detection of the battery/AC line was not completely correct
for FreeBSD. Launching conky on console shows the following:
Cannot read sysctl "hw.acpi.battery.time"
Cannot read sysctl "hw.acpi.battery.life"
Cannot read sysctl "hw.acpi.battery.state"
Cannot read sysctl "hw.acpi.acline"
Unknown battery state 8!
In a PC, the hw.acpi.battery MIB does not exist.
Also, the hw.acpi.acline is only present if supported by the hardware.
In addition, some variables were used uninitialized and that causes strange
behavior: in a PC it showed it worked on battery and the % of charge was an
ridiculous big number.
This patch addresses the issue. It fixes the problem in the PC. It has also
being tested in a laptop running FreeBSD current plugin and unplugging the AC
line and also snatching the battery mercilessly to see if something breaks.
With some option combination the code to be compiled has not been updated with
regards to the changes in conky::rec, i.e get_height() becomes height() and
get_width() becomes width().