diff --git a/libc-test/build.rs b/libc-test/build.rs index 3ad203e27bc79..2f45523187a51 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -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", @@ -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", diff --git a/libc-test/semver/android.txt b/libc-test/semver/android.txt index 5375b80d8a186..3f379a70451a2 100644 --- a/libc-test/semver/android.txt +++ b/libc-test/semver/android.txt @@ -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 @@ -3361,6 +3372,7 @@ itimerval key_t kill killpg +klogctl lastlog lchown lconv diff --git a/libc-test/semver/linux.txt b/libc-test/semver/linux.txt index 89331caf8d344..c93940b82e485 100644 --- a/libc-test/semver/linux.txt +++ b/libc-test/semver/linux.txt @@ -3663,6 +3663,7 @@ j1939_filter jrand48 key_t killpg +klogctl labs lcong48 lgetxattr diff --git a/src/unix/linux_like/android/mod.rs b/src/unix/linux_like/android/mod.rs index 79f06fdf1a33b..b3780f28405db 100644 --- a/src/unix/linux_like/android/mod.rs +++ b/src/unix/linux_like/android/mod.rs @@ -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. @@ -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! { diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index c719df6fdf815..ba68965174c09 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -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