alnyan/yggdrasil: implement rename() syscall
This commit is contained in:
parent
97aa48417d
commit
9a21c79df2
@ -1,6 +1,6 @@
|
||||
use yggdrasil_rt::io::{
|
||||
FileAttr as OsFileAttr, FileMetadataUpdate, FileMetadataUpdateMode, FileMode as OsFileMode,
|
||||
FileType as OsFileType, RawFd as OsRawFd,
|
||||
FileType as OsFileType, RawFd as OsRawFd, Rename,
|
||||
};
|
||||
use yggdrasil_rt::time::SystemTime as RtSystemTime;
|
||||
|
||||
@ -139,8 +139,17 @@ pub fn unlink(path: &Path) -> io::Result<()> {
|
||||
run_with_path_str(path, |path_str| cvt_io(unsafe { yggdrasil_rt::sys::remove(None, path_str) }))
|
||||
}
|
||||
|
||||
pub fn rename(_old: &Path, _new: &Path) -> io::Result<()> {
|
||||
todo!()
|
||||
pub fn rename(old: &Path, new: &Path) -> io::Result<()> {
|
||||
let old = old.to_str().unwrap();
|
||||
let new = new.to_str().unwrap();
|
||||
cvt_io(unsafe {
|
||||
yggdrasil_rt::sys::rename(&Rename {
|
||||
source_at: None,
|
||||
destination_at: None,
|
||||
source: old,
|
||||
destination: new,
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
pub fn set_perm(path: &Path, perm: FilePermissions) -> io::Result<()> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user