浏览代码

Add trace for select and poll

Jeremy Soller 6 年之前
父节点
当前提交
5690c6dcdf
共有 2 个文件被更改,包括 16 次插入2 次删除
  1. 7 1
      src/header/poll/mod.rs
  2. 9 1
      src/header/sys_select/mod.rs

+ 7 - 1
src/header/poll/mod.rs

@@ -21,5 +21,11 @@ pub struct pollfd {
 
 #[no_mangle]
 pub extern "C" fn poll(fds: *mut pollfd, nfds: nfds_t, timeout: c_int) -> c_int {
-    Sys::poll(fds, nfds, timeout)
+    trace_expr!(
+        Sys::poll(fds, nfds, timeout),
+        "poll({:p}, {}, {})",
+        fds,
+        nfds,
+        timeout
+    )
 }

+ 9 - 1
src/header/sys_select/mod.rs

@@ -22,5 +22,13 @@ pub extern "C" fn select(
     exceptfds: *mut fd_set,
     timeout: *mut timeval,
 ) -> c_int {
-    Sys::select(nfds, readfds, writefds, exceptfds, timeout)
+    trace_expr!(
+        Sys::select(nfds, readfds, writefds, exceptfds, timeout),
+        "select({}, {:p}, {:p}, {:p}, {:p})",
+        nfds,
+        readfds,
+        writefds,
+        exceptfds,
+        timeout
+    )
 }