Skip to content

Commit

Permalink
Add strace for fchmod, fchown, and select results
Browse files Browse the repository at this point in the history
  • Loading branch information
tbodt committed Apr 22, 2020
1 parent 961140a commit f52386d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kernel/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,7 @@ static int generic_fsetattr(struct fd *fd, struct attr attr) {
}

dword_t sys_fchmod(fd_t f, dword_t mode) {
STRACE("fchmod(%d, %o)", f, mode);
struct fd *fd = f_get(f);
if (fd == NULL)
return _EBADF;
Expand All @@ -838,6 +839,7 @@ dword_t sys_chmod(addr_t path_addr, dword_t mode) {
}

dword_t sys_fchown32(fd_t f, uid_t_ owner, uid_t_ group) {
STRACE("fchown(%d, %d, %d)", f, owner, group);
struct fd *fd = f_get(f);
if (fd == NULL)
return _EBADF;
Expand Down
8 changes: 8 additions & 0 deletions kernel/poll.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ dword_t sys_select(fd_t nfds, addr_t readfds_addr, addr_t writefds_addr, addr_t
struct select_context context = {readfds, writefds, exceptfds};
int err = poll_wait(poll, select_event_callback, &context, timeout_addr == 0 ? NULL : &timeout_ts);
STRACE("%d end select ", current->pid);
for (fd_t i = 0; i < nfds; i++) {
if (bit_test(i, readfds) || bit_test(i, writefds) || bit_test(i, exceptfds)) {
STRACE("%d{%s%s%s} ", i,
bit_test(i, readfds) ? "r" : "",
bit_test(i, writefds) ? "w" : "",
bit_test(i, exceptfds) ? "x" : "");
}
}
poll_destroy(poll);
if (err < 0)
return err;
Expand Down

0 comments on commit f52386d

Please sign in to comment.