Skip to content

Commit 11e8d80

Browse files
committed
hook write
1 parent b5b85a0 commit 11e8d80

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

core/src/syscall/unix/write.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ impl<I: WriteSyscall> WriteSyscall for WriteSyscallFacade<I> {
3838
buf: *const c_void,
3939
len: size_t,
4040
) -> ssize_t {
41+
if fd == libc::STDOUT_FILENO || fd == libc::STDERR_FILENO {
42+
return RawWriteSyscall::default().write(fn_ptr, fd, buf, len);
43+
}
4144
let syscall = crate::common::constants::SyscallName::write;
45+
crate::info!("enter syscall {}", syscall);
4246
if let Some(co) = crate::scheduler::SchedulableCoroutine::current() {
4347
let new_state = crate::common::constants::SyscallState::Executing;
4448
if co.syscall((), syscall, new_state).is_err() {
@@ -47,10 +51,6 @@ impl<I: WriteSyscall> WriteSyscall for WriteSyscallFacade<I> {
4751
);
4852
}
4953
}
50-
if fd == libc::STDOUT_FILENO || fd == libc::STDERR_FILENO {
51-
return RawWriteSyscall::default().write(fn_ptr, fd, buf, len);
52-
}
53-
crate::info!("enter syscall {}", syscall);
5454
let r = self.inner.write(fn_ptr, fd, buf, len);
5555
if let Some(co) = crate::scheduler::SchedulableCoroutine::current() {
5656
if co.running().is_err() {

0 commit comments

Comments
 (0)