| 305 | } |
| 306 | |
| 307 | int fcntl(int fd, int cmd, ...) |
| 308 | { |
| 309 | va_list ap; |
| 310 | va_start(ap, cmd); |
| 311 | void* arg = va_arg(ap, void *); |
| 312 | va_end(ap); |
| 313 | |
| 314 | mt_hook_syscall(fcntl); |
| 315 | MtHookFd* hook_fd = mt_hook_find_fd(fd); |
| 316 | if (!mt_hook_active() || !hook_fd || !ff_hook_active()) |
| 317 | { |
| 318 | return mt_real_func(fcntl)(fd, cmd, arg); |
| 319 | } |
| 320 | |
| 321 | if (cmd == F_SETFL) |
| 322 | { |
| 323 | va_start(ap, cmd); |
| 324 | int flags = va_arg(ap, int); |
| 325 | va_end(ap); |
| 326 | |
| 327 | if (flags & O_NONBLOCK) |
| 328 | { |
| 329 | hook_fd->sock_flag |= MT_FD_FLG_UNBLOCK; |
| 330 | } |
| 331 | } |
| 332 | |
| 333 | return ff_hook_fcntl(fd, cmd, arg); |
| 334 | } |
| 335 | |
| 336 | int listen(int sockfd, int backlog) |
| 337 | { |
no test coverage detected