mirror of
git://git.openembedded.org/meta-openembedded
synced 2026-09-30 00:32:21 +00:00
uutils-coreutils: add feat_systemd_logind
It allows commands such as "who" to work even when systemd is compiled without "utmp" support. Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
parent
f50cdaea20
commit
3956b3a958
@ -0,0 +1,76 @@
|
|||||||
|
From f5b5a3dec5d77cca53423f21d2a7652f2b432aa6 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Etienne Cordonnier <ecordonnier@snap.com>
|
||||||
|
Date: Tue, 9 Sep 2025 23:36:05 +0200
|
||||||
|
Subject: [PATCH] systemd_logind: replace i8 with libc::c_char
|
||||||
|
|
||||||
|
The C type "char" defaults to unsigned on arm linux, and signed on x86-64 linux. This causes some build errors in the systemd_logind ffi code when compiling for arm.
|
||||||
|
|
||||||
|
Fixes https://github.com/uutils/coreutils/issues/8593
|
||||||
|
|
||||||
|
Signed-off-by: Etienne Cordonnier <ecordonnier@snap.com>
|
||||||
|
Upstream-Status: Backport [https://github.com/uutils/coreutils/commit/f5b5a3dec5d77cca53423f21d2a7652f2b432aa6]
|
||||||
|
---
|
||||||
|
src/uucore/src/lib/features/systemd_logind.rs | 12 ++++++------
|
||||||
|
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/uucore/src/lib/features/systemd_logind.rs b/src/uucore/src/lib/features/systemd_logind.rs
|
||||||
|
index d2727c530..537cb1e3f 100644
|
||||||
|
--- a/src/uucore/src/lib/features/systemd_logind.rs
|
||||||
|
+++ b/src/uucore/src/lib/features/systemd_logind.rs
|
||||||
|
@@ -51,7 +51,7 @@ mod login {
|
||||||
|
|
||||||
|
/// Get all active sessions
|
||||||
|
pub fn get_sessions() -> Result<Vec<String>, Box<dyn std::error::Error>> {
|
||||||
|
- let mut sessions_ptr: *mut *mut i8 = ptr::null_mut();
|
||||||
|
+ let mut sessions_ptr: *mut *mut libc::c_char = ptr::null_mut();
|
||||||
|
|
||||||
|
let result = unsafe { ffi::sd_get_sessions(&mut sessions_ptr) };
|
||||||
|
|
||||||
|
@@ -120,7 +120,7 @@ mod login {
|
||||||
|
/// Get TTY for a session
|
||||||
|
pub fn get_session_tty(session_id: &str) -> Result<Option<String>, Box<dyn std::error::Error>> {
|
||||||
|
let session_cstring = CString::new(session_id)?;
|
||||||
|
- let mut tty_ptr: *mut i8 = ptr::null_mut();
|
||||||
|
+ let mut tty_ptr: *mut libc::c_char = ptr::null_mut();
|
||||||
|
|
||||||
|
let result = unsafe { ffi::sd_session_get_tty(session_cstring.as_ptr(), &mut tty_ptr) };
|
||||||
|
|
||||||
|
@@ -149,7 +149,7 @@ mod login {
|
||||||
|
session_id: &str,
|
||||||
|
) -> Result<Option<String>, Box<dyn std::error::Error>> {
|
||||||
|
let session_cstring = CString::new(session_id)?;
|
||||||
|
- let mut host_ptr: *mut i8 = ptr::null_mut();
|
||||||
|
+ let mut host_ptr: *mut libc::c_char = ptr::null_mut();
|
||||||
|
|
||||||
|
let result =
|
||||||
|
unsafe { ffi::sd_session_get_remote_host(session_cstring.as_ptr(), &mut host_ptr) };
|
||||||
|
@@ -179,7 +179,7 @@ mod login {
|
||||||
|
session_id: &str,
|
||||||
|
) -> Result<Option<String>, Box<dyn std::error::Error>> {
|
||||||
|
let session_cstring = CString::new(session_id)?;
|
||||||
|
- let mut display_ptr: *mut i8 = ptr::null_mut();
|
||||||
|
+ let mut display_ptr: *mut libc::c_char = ptr::null_mut();
|
||||||
|
|
||||||
|
let result =
|
||||||
|
unsafe { ffi::sd_session_get_display(session_cstring.as_ptr(), &mut display_ptr) };
|
||||||
|
@@ -209,7 +209,7 @@ mod login {
|
||||||
|
session_id: &str,
|
||||||
|
) -> Result<Option<String>, Box<dyn std::error::Error>> {
|
||||||
|
let session_cstring = CString::new(session_id)?;
|
||||||
|
- let mut type_ptr: *mut i8 = ptr::null_mut();
|
||||||
|
+ let mut type_ptr: *mut libc::c_char = ptr::null_mut();
|
||||||
|
|
||||||
|
let result = unsafe { ffi::sd_session_get_type(session_cstring.as_ptr(), &mut type_ptr) };
|
||||||
|
|
||||||
|
@@ -238,7 +238,7 @@ mod login {
|
||||||
|
session_id: &str,
|
||||||
|
) -> Result<Option<String>, Box<dyn std::error::Error>> {
|
||||||
|
let session_cstring = CString::new(session_id)?;
|
||||||
|
- let mut seat_ptr: *mut i8 = ptr::null_mut();
|
||||||
|
+ let mut seat_ptr: *mut libc::c_char = ptr::null_mut();
|
||||||
|
|
||||||
|
let result = unsafe { ffi::sd_session_get_seat(session_cstring.as_ptr(), &mut seat_ptr) };
|
||||||
|
|
||||||
|
--
|
||||||
|
2.43.0
|
||||||
|
|
||||||
@ -7,7 +7,10 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=e74349878141b240070458d414ab3b64"
|
|||||||
|
|
||||||
inherit cargo cargo-update-recipe-crates
|
inherit cargo cargo-update-recipe-crates
|
||||||
|
|
||||||
SRC_URI = "git://github.com/uutils/coreutils.git;protocol=https;branch=main"
|
SRC_URI = " \
|
||||||
|
git://github.com/uutils/coreutils.git;protocol=https;branch=main \
|
||||||
|
file://0001-systemd_logind-replace-i8-with-libc-c_char.patch \
|
||||||
|
"
|
||||||
|
|
||||||
SRCREV = "38a248cba6ddf72a453a79365cd919fa40783a44"
|
SRCREV = "38a248cba6ddf72a453a79365cd919fa40783a44"
|
||||||
|
|
||||||
@ -16,8 +19,9 @@ require ${BPN}-crates.inc
|
|||||||
PROVIDES = "coreutils"
|
PROVIDES = "coreutils"
|
||||||
RPROVIDES:${PN} = "coreutils"
|
RPROVIDES:${PN} = "coreutils"
|
||||||
|
|
||||||
PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'selinux', d)}"
|
PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'selinux systemd', d)}"
|
||||||
PACKAGECONFIG[selinux] = "--features feat_selinux,,clang-native libselinux-native libselinux"
|
PACKAGECONFIG[selinux] = "--features feat_selinux,,clang-native libselinux-native libselinux"
|
||||||
|
PACKAGECONFIG[systemd] = "--features feat_systemd_logind,,systemd"
|
||||||
|
|
||||||
CARGO_BUILD_FLAGS += "--features unix --features feat_external_libstdbuf"
|
CARGO_BUILD_FLAGS += "--features unix --features feat_external_libstdbuf"
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user