Skip to content

Commit 1ffe0bd

Browse files
authored
Merge pull request #3777 from sgasse/sgasse/feature/klog_on_linux_like
Add `klogctl` to linux and android
2 parents f5d998e + ece907b commit 1ffe0bd

File tree

5 files changed

+31
-0
lines changed

5 files changed

+31
-0
lines changed

libc-test/build.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,6 +1563,7 @@ fn test_android(target: &str) {
15631563
"sys/fsuid.h",
15641564
"sys/inotify.h",
15651565
"sys/ioctl.h",
1566+
"sys/klog.h",
15661567
"sys/mman.h",
15671568
"sys/mount.h",
15681569
"sys/personality.h",
@@ -3351,6 +3352,7 @@ fn test_linux(target: &str) {
33513352
"sys/eventfd.h",
33523353
"sys/file.h",
33533354
"sys/fsuid.h",
3355+
"sys/klog.h",
33543356
"sys/inotify.h",
33553357
"sys/ioctl.h",
33563358
"sys/ipc.h",

libc-test/semver/android.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,6 +1072,17 @@ KEXEC_ON_CRASH
10721072
KEXEC_PRESERVE_CONTEXT
10731073
KEY_CNT
10741074
KEY_MAX
1075+
KLOG_CLOSE
1076+
KLOG_OPEN
1077+
KLOG_READ
1078+
KLOG_READ_ALL
1079+
KLOG_READ_CLEAR
1080+
KLOG_CLEAR
1081+
KLOG_CONSOLE_OFF
1082+
KLOG_CONSOLE_ON
1083+
KLOG_CONSOLE_LEVEL
1084+
KLOG_SIZE_UNREAD
1085+
KLOG_SIZE_BUFFER
10751086
LC_ADDRESS
10761087
LC_ADDRESS_MASK
10771088
LC_ALL
@@ -3361,6 +3372,7 @@ itimerval
33613372
key_t
33623373
kill
33633374
killpg
3375+
klogctl
33643376
lastlog
33653377
lchown
33663378
lconv

libc-test/semver/linux.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3663,6 +3663,7 @@ j1939_filter
36633663
jrand48
36643664
key_t
36653665
killpg
3666+
klogctl
36663667
labs
36673668
lcong48
36683669
lgetxattr

src/unix/linux_like/android/mod.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3508,6 +3508,18 @@ pub const PF_MEMALLOC_PIN: ::c_int = 0x10000000;
35083508

35093509
pub const PF_SUSPEND_TASK: ::c_int = 0x80000000;
35103510

3511+
pub const KLOG_CLOSE: ::c_int = 0;
3512+
pub const KLOG_OPEN: ::c_int = 1;
3513+
pub const KLOG_READ: ::c_int = 2;
3514+
pub const KLOG_READ_ALL: ::c_int = 3;
3515+
pub const KLOG_READ_CLEAR: ::c_int = 4;
3516+
pub const KLOG_CLEAR: ::c_int = 5;
3517+
pub const KLOG_CONSOLE_OFF: ::c_int = 6;
3518+
pub const KLOG_CONSOLE_ON: ::c_int = 7;
3519+
pub const KLOG_CONSOLE_LEVEL: ::c_int = 8;
3520+
pub const KLOG_SIZE_UNREAD: ::c_int = 9;
3521+
pub const KLOG_SIZE_BUFFER: ::c_int = 10;
3522+
35113523
// Most `*_SUPER_MAGIC` constants are defined at the `linux_like` level; the
35123524
// following are only available on newer Linux versions than the versions
35133525
// currently used in CI in some configurations, so we define them here.
@@ -4096,6 +4108,8 @@ extern "C" {
40964108
mask: ::c_uint,
40974109
statxbuf: *mut statx,
40984110
) -> ::c_int;
4111+
4112+
pub fn klogctl(syslog_type: ::c_int, bufp: *mut ::c_char, len: ::c_int) -> ::c_int;
40994113
}
41004114

41014115
cfg_if! {

src/unix/linux_like/linux/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6123,6 +6123,8 @@ extern "C" {
61236123
len: ::size_t,
61246124
flags: ::c_uint,
61256125
) -> ::ssize_t;
6126+
6127+
pub fn klogctl(syslog_type: ::c_int, bufp: *mut ::c_char, len: ::c_int) -> ::c_int;
61266128
}
61276129

61286130
// LFS64 extensions

0 commit comments

Comments
 (0)