int sys_fcntl(struct tcb *tcp) { if (entering(tcp)) { printfd(tcp, tcp->u_arg[0]); tprints(", "); printxval(fcntlcmds, tcp->u_arg[1], "F_???"); switch (tcp->u_arg[1]) { case F_SETFD: tprints(", "); printflags(fdflags, tcp->u_arg[2], "FD_???"); break; case F_SETOWN: case F_DUPFD: #ifdef F_DUPFD_CLOEXEC case F_DUPFD_CLOEXEC: #endif tprintf(", %ld", tcp->u_arg[2]); break; case F_SETFL: tprints(", "); tprint_open_modes(tcp->u_arg[2]); break; case F_SETLK: case F_SETLKW: tprints(", "); printflock(tcp, tcp->u_arg[2], 0); break; #if USE_PRINTFLOCK64 case F_SETLK64: case F_SETLKW64: tprints(", "); printflock64(tcp, tcp->u_arg[2], 0); break; #endif /* USE_PRINTFLOCK64 */ #ifdef F_NOTIFY case F_NOTIFY: tprints(", "); printflags(notifyflags, tcp->u_arg[2], "DN_???"); break; #endif #ifdef F_SETLEASE case F_SETLEASE: tprints(", "); printxval(lockfcmds, tcp->u_arg[2], "F_???"); break; #endif } } else { switch (tcp->u_arg[1]) { case F_DUPFD: #ifdef F_DUPFD_CLOEXEC case F_DUPFD_CLOEXEC: #endif case F_SETFD: case F_SETFL: case F_SETLK: case F_SETLKW: case F_SETOWN: case F_GETOWN: #ifdef F_NOTIFY case F_NOTIFY: #endif #ifdef F_SETLEASE case F_SETLEASE: #endif break; case F_GETFD: if (syserror(tcp) || tcp->u_rval == 0) return 0; tcp->auxstr = sprintflags("flags ", fdflags, tcp->u_rval); return RVAL_HEX|RVAL_STR; case F_GETFL: if (syserror(tcp)) return 0; tcp->auxstr = sprint_open_modes(tcp->u_rval); return RVAL_HEX|RVAL_STR; case F_GETLK: tprints(", "); printflock(tcp, tcp->u_arg[2], 1); break; #if USE_PRINTFLOCK64 case F_GETLK64: tprints(", "); printflock64(tcp, tcp->u_arg[2], 1); break; #endif #ifdef F_GETLEASE case F_GETLEASE: if (syserror(tcp)) return 0; tcp->auxstr = xlookup(lockfcmds, tcp->u_rval); return RVAL_HEX|RVAL_STR; #endif default: tprintf(", %#lx", tcp->u_arg[2]); break; } } return 0; }
int sys_fcntl(struct tcb *tcp) { if (entering(tcp)) { tprintf("%ld, ", tcp->u_arg[0]); printxval(fcntlcmds, tcp->u_arg[1], "F_???"); switch (tcp->u_arg[1]) { case F_SETFD: tprintf(", "); printflags(fdflags, tcp->u_arg[2], "FD_???"); break; case F_SETOWN: case F_DUPFD: #ifdef F_DUPFD_CLOEXEC case F_DUPFD_CLOEXEC: #endif tprintf(", %ld", tcp->u_arg[2]); break; case F_SETFL: tprintf(", "); tprint_open_modes(tcp->u_arg[2]); break; case F_SETLK: case F_SETLKW: #ifdef F_FREESP case F_FREESP: #endif tprintf(", "); printflock(tcp, tcp->u_arg[2], 0); break; #if _LFS64_LARGEFILE #ifdef F_FREESP64 case F_FREESP64: #endif /* Linux glibc defines SETLK64 as SETLK, even though the kernel has different values - as does Solaris. */ #if defined(F_SETLK64) && F_SETLK64 + 0 != F_SETLK case F_SETLK64: #endif #if defined(F_SETLKW64) && F_SETLKW64 + 0 != F_SETLKW case F_SETLKW64: #endif tprintf(", "); printflock64(tcp, tcp->u_arg[2], 0); break; #endif #ifdef F_NOTIFY case F_NOTIFY: tprintf(", "); printflags(notifyflags, tcp->u_arg[2], "DN_???"); break; #endif #ifdef F_SETLEASE case F_SETLEASE: tprintf(", "); printxval(lockfcmds, tcp->u_arg[2], "F_???"); break; #endif } } else { switch (tcp->u_arg[1]) { case F_DUPFD: #ifdef F_DUPFD_CLOEXEC case F_DUPFD_CLOEXEC: #endif case F_SETFD: case F_SETFL: case F_SETLK: case F_SETLKW: case F_SETOWN: case F_GETOWN: #ifdef F_NOTIFY case F_NOTIFY: #endif #ifdef F_SETLEASE case F_SETLEASE: #endif break; case F_GETFD: if (syserror(tcp) || tcp->u_rval == 0) return 0; tcp->auxstr = sprintflags("flags ", fdflags, tcp->u_rval); return RVAL_HEX|RVAL_STR; case F_GETFL: if (syserror(tcp)) return 0; tcp->auxstr = sprint_open_modes(tcp->u_rval); return RVAL_HEX|RVAL_STR; case F_GETLK: tprintf(", "); printflock(tcp, tcp->u_arg[2], 1); break; #if _LFS64_LARGEFILE #if defined(F_GETLK64) && F_GETLK64+0!=F_GETLK case F_GETLK64: #endif tprintf(", "); printflock64(tcp, tcp->u_arg[2], 1); break; #endif #ifdef F_GETLEASE case F_GETLEASE: if (syserror(tcp)) return 0; tcp->auxstr = xlookup(lockfcmds, tcp->u_rval); return RVAL_HEX|RVAL_STR; #endif default: tprintf(", %#lx", tcp->u_arg[2]); break; } } return 0; }