mirror of
https://codeberg.org/fairyglade/ly.git
synced 2026-08-09 07:09:13 +02:00
Remove use of @cImport()
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
parent
7346b4343d
commit
aea71fee18
4 changed files with 6 additions and 3 deletions
|
|
@ -45,6 +45,7 @@ pub fn build(b: *std.Build) void {
|
|||
} else if (target.result.os.tag == .freebsd) {
|
||||
addCImport(b, mod, translate_c, target, optimize, "kbio", "#include <sys/kbio.h>");
|
||||
addCImport(b, mod, translate_c, target, optimize, "consio", "#include <sys/consio.h>");
|
||||
addCImport(b, mod, translate_c, target, optimize, "sysctl", "#include <sys/sysctl.h>");
|
||||
}
|
||||
|
||||
const mod_tests = b.addTest(.{
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@ pub const utmp = @import("utmp");
|
|||
// Exists for X11 support only
|
||||
pub const xcb = @import("xcb");
|
||||
|
||||
// FreeBSD only
|
||||
pub const sysctl = @import("sysctl");
|
||||
|
||||
pub const TimeOfDay = struct {
|
||||
seconds: i64,
|
||||
microseconds: i64,
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ auth_fails = 10
|
|||
# Identifier for battery whose charge to display at top left
|
||||
# Primary battery is usually BAT0 or BAT1
|
||||
# If set to null, battery status won't be shown
|
||||
# Unused on FreeBSD (a sysctl is used there)
|
||||
battery_id = null
|
||||
|
||||
# Automatic login configuration
|
||||
|
|
|
|||
|
|
@ -43,8 +43,6 @@ const DisplayServer = @import("enums.zig").DisplayServer;
|
|||
const Environment = @import("Environment.zig");
|
||||
const Entry = Environment.Entry;
|
||||
|
||||
const sysctl = if (builtin.os.tag == .freebsd) @cImport(@cInclude("sys/sysctl.h")) else struct {};
|
||||
|
||||
const ly_version_str = "Ly version " ++ build_options.version;
|
||||
|
||||
var session_pid: std.posix.pid_t = -1;
|
||||
|
|
@ -2323,7 +2321,7 @@ fn getBatteryPercentage(io: std.Io, battery_id: []const u8) !u8 {
|
|||
var capacity: c_int = -1;
|
||||
var size: usize = @sizeOf(c_int);
|
||||
|
||||
const ret = sysctl.sysctlbyname("hw.acpi.battery.life", &capacity, &size, null, 0);
|
||||
const ret = interop.sysctl.sysctlbyname("hw.acpi.battery.life", &capacity, &size, null, 0);
|
||||
|
||||
if (ret != 0) return error.SysctlFailed;
|
||||
if (capacity < 0 or capacity > 100) return error.InvalidBatteryCapacity;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue