| 174 | } |
| 175 | |
| 176 | ssize_t read(int fd, void *buf, size_t nbyte) |
| 177 | { |
| 178 | mt_hook_syscall(read); |
| 179 | MtHookFd* hook_fd = mt_hook_find_fd(fd); |
| 180 | if (!mt_hook_active() || !hook_fd || !ff_hook_active()) |
| 181 | { |
| 182 | return mt_real_func(read)(fd, buf, nbyte); |
| 183 | } |
| 184 | |
| 185 | if (hook_fd->sock_flag & MT_FD_FLG_UNBLOCK) |
| 186 | { |
| 187 | return ff_hook_read(fd, buf, nbyte); |
| 188 | } |
| 189 | |
| 190 | return MtFrame::read(fd, buf, nbyte, hook_fd->read_timeout); |
| 191 | } |
| 192 | |
| 193 | ssize_t write(int fd, const void *buf, size_t nbyte) |
| 194 | { |