Update cstr macro

This commit is contained in:
topjohnwu
2023-05-25 01:03:04 -07:00
parent 18d0cedbe2
commit 533aeadd38
3 changed files with 20 additions and 58 deletions

View File

@@ -16,10 +16,10 @@ static KMSG: OnceLock<File> = OnceLock::new();
pub fn setup_klog() {
// Shut down first 3 fds
unsafe {
let mut fd = open(str_ptr!("/dev/null"), O_RDWR | O_CLOEXEC);
let mut fd = open(raw_cstr!("/dev/null"), O_RDWR | O_CLOEXEC);
if fd < 0 {
mknod(str_ptr!("/null"), S_IFCHR | 0666, makedev(1, 3));
fd = open(str_ptr!("/null"), O_RDWR | O_CLOEXEC);
mknod(raw_cstr!("/null"), S_IFCHR | 0666, makedev(1, 3));
fd = open(raw_cstr!("/null"), O_RDWR | O_CLOEXEC);
fs::remove_file("/null").ok();
}
@@ -35,10 +35,10 @@ pub fn setup_klog() {
KMSG.set(kmsg).ok();
} else {
unsafe {
mknod(str_ptr!("/kmsg"), S_IFCHR | 0666, makedev(1, 11));
mknod(raw_cstr!("/kmsg"), S_IFCHR | 0666, makedev(1, 11));
KMSG.set(File::options().write(true).open("/kmsg").unwrap())
.ok();
unlink(str_ptr!("/kmsg"));
unlink(raw_cstr!("/kmsg"));
}
}