Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add klogctl to linux and android #3777

Merged
merged 1 commit into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1563,6 +1563,7 @@ fn test_android(target: &str) {
"sys/fsuid.h",
"sys/inotify.h",
"sys/ioctl.h",
"sys/klog.h",
"sys/mman.h",
"sys/mount.h",
"sys/personality.h",
Expand Down Expand Up @@ -3351,6 +3352,7 @@ fn test_linux(target: &str) {
"sys/eventfd.h",
"sys/file.h",
"sys/fsuid.h",
"sys/klog.h",
"sys/inotify.h",
"sys/ioctl.h",
"sys/ipc.h",
Expand Down
12 changes: 12 additions & 0 deletions libc-test/semver/android.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,17 @@ KEXEC_ON_CRASH
KEXEC_PRESERVE_CONTEXT
KEY_CNT
KEY_MAX
KLOG_CLOSE
KLOG_OPEN
KLOG_READ
KLOG_READ_ALL
KLOG_READ_CLEAR
KLOG_CLEAR
KLOG_CONSOLE_OFF
KLOG_CONSOLE_ON
KLOG_CONSOLE_LEVEL
KLOG_SIZE_UNREAD
KLOG_SIZE_BUFFER
LC_ADDRESS
LC_ADDRESS_MASK
LC_ALL
Expand Down Expand Up @@ -3361,6 +3372,7 @@ itimerval
key_t
kill
killpg
klogctl
lastlog
lchown
lconv
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3663,6 +3663,7 @@ j1939_filter
jrand48
key_t
killpg
klogctl
labs
lcong48
lgetxattr
Expand Down
14 changes: 14 additions & 0 deletions src/unix/linux_like/android/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3508,6 +3508,18 @@ pub const PF_MEMALLOC_PIN: ::c_int = 0x10000000;

pub const PF_SUSPEND_TASK: ::c_int = 0x80000000;

pub const KLOG_CLOSE: ::c_int = 0;
pub const KLOG_OPEN: ::c_int = 1;
pub const KLOG_READ: ::c_int = 2;
pub const KLOG_READ_ALL: ::c_int = 3;
pub const KLOG_READ_CLEAR: ::c_int = 4;
pub const KLOG_CLEAR: ::c_int = 5;
pub const KLOG_CONSOLE_OFF: ::c_int = 6;
pub const KLOG_CONSOLE_ON: ::c_int = 7;
pub const KLOG_CONSOLE_LEVEL: ::c_int = 8;
pub const KLOG_SIZE_UNREAD: ::c_int = 9;
pub const KLOG_SIZE_BUFFER: ::c_int = 10;

// Most `*_SUPER_MAGIC` constants are defined at the `linux_like` level; the
// following are only available on newer Linux versions than the versions
// currently used in CI in some configurations, so we define them here.
Expand Down Expand Up @@ -4096,6 +4108,8 @@ extern "C" {
mask: ::c_uint,
statxbuf: *mut statx,
) -> ::c_int;

pub fn klogctl(syslog_type: ::c_int, bufp: *mut ::c_char, len: ::c_int) -> ::c_int;
}

cfg_if! {
Expand Down
2 changes: 2 additions & 0 deletions src/unix/linux_like/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6123,6 +6123,8 @@ extern "C" {
len: ::size_t,
flags: ::c_uint,
) -> ::ssize_t;

pub fn klogctl(syslog_type: ::c_int, bufp: *mut ::c_char, len: ::c_int) -> ::c_int;
}

// LFS64 extensions
Expand Down