MCPcopy Create free account
hub / github.com/F-Stack/f-stack / fcntl

Function fcntl

adapter/micro_thread/mt_sys_hook.cpp:307–334  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

305}
306
307int 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
336int listen(int sockfd, int backlog)
337{

Callers 1

mt_tcp_create_sockFunction · 0.70

Calls 2

mt_hook_find_fdFunction · 0.85
ff_hook_fcntlFunction · 0.70

Tested by

no test coverage detected