Lines Matching refs:fd

57 MtHookFd* mt_hook_find_fd(int fd)   in mt_hook_find_fd()  argument
59 if ((fd < 0) || (fd >= MT_HOOK_MAX_FD)) { in mt_hook_find_fd()
63 MtHookFd* fd_info = &g_mt_hook_fd_tab[fd]; in mt_hook_find_fd()
71 void mt_hook_new_fd(int fd) in mt_hook_new_fd() argument
73 if ((fd < 0) || (fd >= MT_HOOK_MAX_FD)) { in mt_hook_new_fd()
77 MtHookFd* fd_info = &g_mt_hook_fd_tab[fd]; in mt_hook_new_fd()
83 void mt_hook_free_fd(int fd) in mt_hook_free_fd() argument
85 if ((fd < 0) || (fd >= MT_HOOK_MAX_FD)) { in mt_hook_free_fd()
89 MtHookFd* fd_info = &g_mt_hook_fd_tab[fd]; in mt_hook_free_fd()
98 int ioctl(int fd, unsigned long cmd, ...) in ioctl() argument
106 MtHookFd* hook_fd = mt_hook_find_fd(fd); in ioctl()
109 return ff_hook_ioctl(fd, cmd, arg); in ioctl()
120 return ff_hook_ioctl(fd, cmd, arg); in ioctl()
132 int fd = ff_hook_socket(domain, type, protocol); in socket() local
133 if (fd < 0) in socket()
135 return fd; in socket()
138 mt_hook_new_fd(fd); in socket()
142 ff_hook_ioctl(fd, FIONBIO, &nb); in socket()
144 return fd; in socket()
147 int close(int fd) in close() argument
152 return mt_real_func(close)(fd); in close()
155 mt_hook_free_fd(fd); in close()
156 return ff_hook_close(fd); in close()
159 int connect(int fd, const struct sockaddr *address, socklen_t address_len) in connect() argument
162 MtHookFd* hook_fd = mt_hook_find_fd(fd); in connect()
165 return mt_real_func(connect)(fd, address, address_len); in connect()
170 return ff_hook_connect(fd, address, address_len); in connect()
173 return MtFrame::connect(fd, address, (int)address_len, hook_fd->write_timeout); in connect()
176 ssize_t read(int fd, void *buf, size_t nbyte) in read() argument
179 MtHookFd* hook_fd = mt_hook_find_fd(fd); in read()
182 return mt_real_func(read)(fd, buf, nbyte); in read()
187 return ff_hook_read(fd, buf, nbyte); in read()
190 return MtFrame::read(fd, buf, nbyte, hook_fd->read_timeout); in read()
193 ssize_t write(int fd, const void *buf, size_t nbyte) in write() argument
196 MtHookFd* hook_fd = mt_hook_find_fd(fd); in write()
199 return mt_real_func(write)(fd, buf, nbyte); in write()
204 return ff_hook_write(fd, buf, nbyte); in write()
207 return MtFrame::write(fd, buf, nbyte, hook_fd->write_timeout); in write()
210 ssize_t sendto(int fd, const void *message, size_t length, int flags, in sendto() argument
214 MtHookFd* hook_fd = mt_hook_find_fd(fd); in sendto()
217 return mt_real_func(sendto)(fd, message, length, flags, dest_addr, dest_len); in sendto()
222 return ff_hook_sendto(fd, message, length, flags, dest_addr, dest_len); in sendto()
225 return MtFrame::sendto(fd, message, (int)length, flags, in sendto()
229 ssize_t recvfrom(int fd, void *buffer, size_t length, int flags, in recvfrom() argument
233 MtHookFd* hook_fd = mt_hook_find_fd(fd); in recvfrom()
236 return mt_real_func(recvfrom)(fd, buffer, length, flags, address, address_len); in recvfrom()
241 return ff_hook_recvfrom(fd, buffer, length, flags, address, address_len); in recvfrom()
244 … return MtFrame::recvfrom(fd, buffer, length, flags, address, address_len, hook_fd->read_timeout); in recvfrom()
248 ssize_t recv(int fd, void *buffer, size_t length, int flags) in recv() argument
251 MtHookFd* hook_fd = mt_hook_find_fd(fd); in recv()
254 return mt_real_func(recv)(fd, buffer, length, flags); in recv()
259 return ff_hook_recv(fd, buffer, length, flags); in recv()
262 return MtFrame::recv(fd, buffer, length, flags, hook_fd->read_timeout); in recv()
265 ssize_t send(int fd, const void *buf, size_t nbyte, int flags) in send() argument
268 MtHookFd* hook_fd = mt_hook_find_fd(fd); in send()
271 return mt_real_func(send)(fd, buf, nbyte, flags); in send()
276 return ff_hook_send(fd, buf, nbyte, flags); in send()
279 return MtFrame::send(fd, buf, nbyte, flags, hook_fd->write_timeout); in send()
282 int setsockopt(int fd, int level, int option_name, const void *option_value, socklen_t option_len) in setsockopt() argument
285 MtHookFd* hook_fd = mt_hook_find_fd(fd); in setsockopt()
288 return mt_real_func(setsockopt)(fd, level, option_name, option_value, option_len); in setsockopt()
304 return ff_hook_setsockopt(fd, level, option_name, option_value, option_len); in setsockopt()
307 int fcntl(int fd, int cmd, ...) in fcntl() argument
315 MtHookFd* hook_fd = mt_hook_find_fd(fd); in fcntl()
318 return mt_real_func(fcntl)(fd, cmd, arg); in fcntl()
333 return ff_hook_fcntl(fd, cmd, arg); in fcntl()
358 int accept(int fd, struct sockaddr *addr, socklen_t *addrlen) in accept() argument
363 return mt_real_func(accept)(fd, addr, addrlen); in accept()
366 return ff_hook_accept(fd, addr, addrlen); in accept()