| 96 | extern "C" { |
| 97 | #endif |
| 98 | int ioctl(int fd, unsigned long cmd, ...) |
| 99 | { |
| 100 | va_list ap; |
| 101 | va_start(ap, cmd); |
| 102 | void* arg = va_arg(ap, void *); |
| 103 | va_end(ap); |
| 104 | |
| 105 | mt_hook_syscall(ioctl); |
| 106 | MtHookFd* hook_fd = mt_hook_find_fd(fd); |
| 107 | if (!mt_hook_active() || !hook_fd || !ff_hook_active()) |
| 108 | { |
| 109 | return ff_hook_ioctl(fd, cmd, arg); |
| 110 | } |
| 111 | |
| 112 | if (cmd == FIONBIO) |
| 113 | { |
| 114 | int flags = (arg != NULL) ? *((int*)arg) : 0; |
| 115 | if (flags != 0) { |
| 116 | hook_fd->sock_flag |= MT_FD_FLG_UNBLOCK; |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | return ff_hook_ioctl(fd, cmd, arg); |
| 121 | } |
| 122 | |
| 123 | int socket(int domain, int type, int protocol) |
| 124 | { |
no test coverage detected