Skip to content

Commit ac1cb39

Browse files
committed
Auto merge of #3156 - ribalda:kexec, r=JohnTitor
linux: add kexec flags This adds `KEXEC_ARCH_MASK`, `KEXEC_FILE_NO_INITRAMFS`, `KEXEC_FILE_ON_CRASH`, `KEXEC_FILE_UNLOAD`, `KEXEC_ON_CRASH`, and `KEXEC_PRESERVE_CONTEXT` constants on Linux and Android. Those are used by `kexec` and `kexec_file_load` syscalls.
2 parents 57760b3 + e1f4836 commit ac1cb39

File tree

5 files changed

+31
-0
lines changed

5 files changed

+31
-0
lines changed

libc-test/build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1631,6 +1631,7 @@ fn test_android(target: &str) {
16311631
"linux/if_link.h",
16321632
"linux/rtnetlink.h",
16331633
"linux/if_tun.h",
1634+
"linux/kexec.h",
16341635
"linux/magic.h",
16351636
"linux/membarrier.h",
16361637
"linux/memfd.h",
@@ -3250,6 +3251,7 @@ fn test_linux(target: &str) {
32503251
"linux/if_tun.h",
32513252
"linux/input.h",
32523253
"linux/ipv6.h",
3254+
"linux/kexec.h",
32533255
"linux/keyctl.h",
32543256
"linux/magic.h",
32553257
"linux/memfd.h",
@@ -3464,6 +3466,7 @@ fn test_linux(target: &str) {
34643466
|| name.starts_with("F_")
34653467
|| name.starts_with("FALLOC_FL_")
34663468
|| name.starts_with("IFLA_")
3469+
|| name.starts_with("KEXEC_")
34673470
|| name.starts_with("MS_")
34683471
|| name.starts_with("MSG_")
34693472
|| name.starts_with("OPEN_TREE_")

libc-test/semver/android.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,12 @@ IXANY
10321032
IXOFF
10331033
IXON
10341034
JFFS2_SUPER_MAGIC
1035+
KEXEC_ARCH_MASK
1036+
KEXEC_FILE_NO_INITRAMFS
1037+
KEXEC_FILE_ON_CRASH
1038+
KEXEC_FILE_UNLOAD
1039+
KEXEC_ON_CRASH
1040+
KEXEC_PRESERVE_CONTEXT
10351041
KEY_CNT
10361042
KEY_MAX
10371043
LC_ADDRESS

libc-test/semver/linux.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,6 +1185,12 @@ J1939_PGN_MAX
11851185
J1939_PGN_PDU1_MAX
11861186
J1939_PGN_REQUEST
11871187
KERNEL_VERSION
1188+
KEXEC_ARCH_MASK
1189+
KEXEC_FILE_NO_INITRAMFS
1190+
KEXEC_FILE_ON_CRASH
1191+
KEXEC_FILE_UNLOAD
1192+
KEXEC_ON_CRASH
1193+
KEXEC_PRESERVE_CONTEXT
11881194
KEYCTL_ASSUME_AUTHORITY
11891195
KEYCTL_CHOWN
11901196
KEYCTL_CLEAR

src/unix/linux_like/android/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,6 +1606,14 @@ pub const AI_ADDRCONFIG: ::c_int = 0x00000400;
16061606
pub const AI_V4MAPPED: ::c_int = 0x00000800;
16071607
pub const AI_DEFAULT: ::c_int = AI_V4MAPPED_CFG | AI_ADDRCONFIG;
16081608

1609+
// linux/kexec.h
1610+
pub const KEXEC_ON_CRASH: ::c_int = 0x00000001;
1611+
pub const KEXEC_PRESERVE_CONTEXT: ::c_int = 0x00000002;
1612+
pub const KEXEC_ARCH_MASK: ::c_int = 0xffff0000;
1613+
pub const KEXEC_FILE_UNLOAD: ::c_int = 0x00000001;
1614+
pub const KEXEC_FILE_ON_CRASH: ::c_int = 0x00000002;
1615+
pub const KEXEC_FILE_NO_INITRAMFS: ::c_int = 0x00000004;
1616+
16091617
pub const LINUX_REBOOT_MAGIC1: ::c_int = 0xfee1dead;
16101618
pub const LINUX_REBOOT_MAGIC2: ::c_int = 672274793;
16111619
pub const LINUX_REBOOT_MAGIC2A: ::c_int = 85072278;

src/unix/linux_like/linux/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3550,6 +3550,14 @@ pub fn FUTEX_OP(op: ::c_int, oparg: ::c_int, cmp: ::c_int, cmparg: ::c_int) -> :
35503550
((op & 0xf) << 28) | ((cmp & 0xf) << 24) | ((oparg & 0xfff) << 12) | (cmparg & 0xfff)
35513551
}
35523552

3553+
// linux/kexec.h
3554+
pub const KEXEC_ON_CRASH: ::c_int = 0x00000001;
3555+
pub const KEXEC_PRESERVE_CONTEXT: ::c_int = 0x00000002;
3556+
pub const KEXEC_ARCH_MASK: ::c_int = 0xffff0000;
3557+
pub const KEXEC_FILE_UNLOAD: ::c_int = 0x00000001;
3558+
pub const KEXEC_FILE_ON_CRASH: ::c_int = 0x00000002;
3559+
pub const KEXEC_FILE_NO_INITRAMFS: ::c_int = 0x00000004;
3560+
35533561
// linux/reboot.h
35543562
pub const LINUX_REBOOT_MAGIC1: ::c_int = 0xfee1dead;
35553563
pub const LINUX_REBOOT_MAGIC2: ::c_int = 672274793;

0 commit comments

Comments
 (0)