📄 file.c
字号:
}intosf_fstatfs(tcp)struct tcb *tcp;{ if (entering(tcp)) { tprintf("%lu, ", tcp->u_arg[0]); } else { printstatfs(tcp, tcp->u_arg[1]); tprintf(", %lu", tcp->u_arg[2]); } return 0;}#endif /* linux && __alpha */#endif /* !SVR4 */#ifdef SUNOS4intsys_ustat(tcp)struct tcb *tcp;{ struct ustat statbuf; if (entering(tcp)) { tprintf("makedev(%lu, %lu), ", (long) major(tcp->u_arg[0]), (long) minor(tcp->u_arg[0])); } else { if (syserror(tcp) || !verbose(tcp)) tprintf("%#lx", tcp->u_arg[1]); else if (umove(tcp, tcp->u_arg[1], &statbuf) < 0) tprintf("{...}"); else { tprintf("{f_tfree=%lu, f_tinode=%lu, ", statbuf.f_tfree, statbuf.f_tinode); tprintf("f_fname=\"%.*s\", ", (int) sizeof(statbuf.f_fname), statbuf.f_fname); tprintf("f_fpack=\"%.*s\"}", (int) sizeof(statbuf.f_fpack), statbuf.f_fpack); } } return 0;}#endif /* SUNOS4 */intsys_pivotroot(tcp)struct tcb *tcp;{ if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); tprintf(", "); printpath(tcp, tcp->u_arg[1]); } return 0;}/* directory */intsys_chdir(tcp)struct tcb *tcp;{ if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); } return 0;}intsys_mkdir(tcp)struct tcb *tcp;{ if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); tprintf(", %#lo", tcp->u_arg[1]); } return 0;}intsys_rmdir(tcp)struct tcb *tcp;{ if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); } return 0;}intsys_fchdir(tcp)struct tcb *tcp;{ if (entering(tcp)) { tprintf("%ld", tcp->u_arg[0]); } return 0;}intsys_chroot(tcp)struct tcb *tcp;{ if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); } return 0;}intsys_fchroot(tcp)struct tcb *tcp;{ if (entering(tcp)) { tprintf("%ld", tcp->u_arg[0]); } return 0;}intsys_link(tcp)struct tcb *tcp;{ if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); tprintf(", "); printpath(tcp, tcp->u_arg[1]); } return 0;}intsys_unlink(tcp)struct tcb *tcp;{ if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); } return 0;}intsys_symlink(tcp)struct tcb *tcp;{ if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); tprintf(", "); printpath(tcp, tcp->u_arg[1]); } return 0;}intsys_readlink(tcp)struct tcb *tcp;{ if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); tprintf(", "); } else { if (syserror(tcp)) tprintf("%#lx", tcp->u_arg[1]); else printpathn(tcp, tcp->u_arg[1], tcp->u_rval); tprintf(", %lu", tcp->u_arg[2]); } return 0;}intsys_rename(tcp)struct tcb *tcp;{ if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); tprintf(", "); printpath(tcp, tcp->u_arg[1]); } return 0;}intsys_chown(tcp)struct tcb *tcp;{ if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); tprintf(", %lu, %lu", tcp->u_arg[1], tcp->u_arg[2]); } return 0;}intsys_fchown(tcp)struct tcb *tcp;{ if (entering(tcp)) { tprintf("%ld, %lu, %lu", tcp->u_arg[0], tcp->u_arg[1], tcp->u_arg[2]); } return 0;}intsys_chmod(tcp)struct tcb *tcp;{ if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); tprintf(", %#lo", tcp->u_arg[1]); } return 0;}intsys_fchmod(tcp)struct tcb *tcp;{ if (entering(tcp)) { tprintf("%ld, %#lo", tcp->u_arg[0], tcp->u_arg[1]); } return 0;}#ifdef ALPHAintsys_osf_utimes(tcp)struct tcb *tcp;{ if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); tprintf(", "); printtv32(tcp, tcp->u_arg[1]); } return 0;}#endifintsys_utimes(tcp)struct tcb *tcp;{ if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); tprintf(", "); printtv(tcp, tcp->u_arg[1]); } return 0;}intsys_utime(tcp)struct tcb *tcp;{ long ut[2]; if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); tprintf(", "); if (!tcp->u_arg[1]) tprintf("NULL"); else if (!verbose(tcp)) tprintf("%#lx", tcp->u_arg[1]); else if (umoven(tcp, tcp->u_arg[1], sizeof ut, (char *) ut) < 0) tprintf("[?, ?]"); else { tprintf("[%s,", sprinttime(ut[0])); tprintf(" %s]", sprinttime(ut[1])); } } return 0;}intsys_mknod(tcp)struct tcb *tcp;{ int mode = tcp->u_arg[1]; if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); tprintf(", %s", sprintmode(mode)); switch (mode & S_IFMT) { case S_IFCHR: case S_IFBLK:#ifdef LINUXSPARC if (current_personality == 1) tprintf(", makedev(%lu, %lu)", (unsigned long) ((tcp->u_arg[2] >> 18) & 0x3fff), (unsigned long) (tcp->u_arg[2] & 0x3ffff)); else#endif tprintf(", makedev(%lu, %lu)", (unsigned long) major(tcp->u_arg[2]), (unsigned long) minor(tcp->u_arg[2])); break; default: break; } } return 0;}intsys_mkfifo(tcp)struct tcb *tcp;{ if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); tprintf(", %#lo", tcp->u_arg[1]); } return 0;}intsys_fsync(tcp)struct tcb *tcp;{ if (entering(tcp)) { tprintf("%ld", tcp->u_arg[0]); } return 0;}#ifdef linuxstatic voidprintdir(tcp, addr)struct tcb *tcp;long addr;{ struct dirent d; if (!verbose(tcp)) { tprintf("%#lx", addr); return; } if (umove(tcp, addr, &d) < 0) { tprintf("{...}"); return; } tprintf("{d_ino=%ld, ", (unsigned long) d.d_ino); tprintf("d_name="); printpathn(tcp, (long) ((struct dirent *) addr)->d_name, d.d_reclen); tprintf("}");}intsys_readdir(tcp)struct tcb *tcp;{ if (entering(tcp)) { tprintf("%lu, ", tcp->u_arg[0]); } else { if (syserror(tcp) || tcp->u_rval == 0 || !verbose(tcp)) tprintf("%#lx", tcp->u_arg[1]); else printdir(tcp, tcp->u_arg[1]); /* Not much point in printing this out, it is always 1. */ if (tcp->u_arg[2] != 1) tprintf(", %lu", tcp->u_arg[2]); } return 0;}#endif /* linux */#ifdef FREEBSDstruct xlat direnttypes[] = { { DT_FIFO, "DT_FIFO" }, { DT_CHR, "DT_CHR" }, { DT_DIR, "DT_DIR" }, { DT_BLK, "DT_BLK" }, { DT_REG, "DT_REG" }, { DT_LNK, "DT_LNK" }, { DT_SOCK, "DT_SOCK" }, { DT_WHT, "DT_WHT" }, { 0, NULL },};#endifintsys_getdents(tcp)struct tcb *tcp;{ int i, len, dents = 0; char *buf; if (entering(tcp)) { tprintf("%lu, ", tcp->u_arg[0]); return 0; } if (syserror(tcp) || !verbose(tcp)) { tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]); return 0; } len = tcp->u_rval; if ((buf = malloc(len)) == NULL) { tprintf("out of memory\n"); return 0; } if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) { tprintf("{...}, %lu", tcp->u_arg[2]); free(buf); return 0; } if (!abbrev(tcp)) tprintf("{"); for (i = 0; i < len;) { struct kernel_dirent *d = (struct kernel_dirent *) &buf[i];#ifdef linux if (!abbrev(tcp)) { tprintf("%s{d_ino=%lu, d_off=%lu, ", i ? " " : "", d->d_ino, d->d_off); tprintf("d_reclen=%u, d_name=\"%s\"}", d->d_reclen, d->d_name); }#endif /* linux */#ifdef SVR4 if (!abbrev(tcp)) { tprintf("%s{d_ino=%lu, d_off=%lu, ", i ? " " : "", d->d_ino, d->d_off); tprintf("d_reclen=%u, d_name=\"%s\"}", d->d_reclen, d->d_name); }#endif /* SVR4 */#ifdef SUNOS4 if (!abbrev(tcp)) { tprintf("%s{d_off=%lu, d_fileno=%lu, d_reclen=%u, ", i ? " " : "", d->d_off, d->d_fileno, d->d_reclen); tprintf("d_namlen=%u, d_name=\"%.*s\"}", d->d_namlen, d->d_namlen, d->d_name); }#endif /* SUNOS4 */#ifdef FREEBSD if (!abbrev(tcp)) { tprintf("%s{d_fileno=%u, d_reclen=%u, d_type=", i ? " " : "", d->d_fileno, d->d_reclen); printxval(direnttypes, d->d_type, "DT_???"); tprintf(", d_namlen=%u, d_name=\"%.*s\"}", d->d_namlen, d->d_namlen, d->d_name); }#endif /* FREEBSD */ if (!d->d_reclen) { tprintf("/* d_reclen == 0, problem here */"); break; } i += d->d_reclen; dents++; } if (!abbrev(tcp)) tprintf("}"); else tprintf("/* %u entries */", dents); tprintf(", %lu", tcp->u_arg[2]); free(buf); return 0;}#if _LFS64_LARGEFILEintsys_getdents64(tcp)struct tcb *tcp;{ int i, len, dents = 0; char *buf; if (entering(tcp)) { tprintf("%lu, ", tcp->u_arg[0]); return 0; } if (syserror(tcp) || !verbose(tcp)) { tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]); return 0; } len = tcp->u_rval; if ((buf = malloc(len)) == NULL) { tprintf("out of memory\n"); return 0; } if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) { tprintf("{...}, %lu", tcp->u_arg[2]); free(buf); return 0; } if (!abbrev(tcp)) tprintf("{"); for (i = 0; i < len;) { struct dirent64 *d = (struct dirent64 *) &buf[i];#ifdef linux if (!abbrev(tcp)) { tprintf("%s{d_ino=%lu, d_off=%lu, ", i ? " " : "", d->d_ino, d->d_off); tprintf("d_reclen=%u, d_name=\"%s\"}", d->d_reclen, d->d_name); }#endif /* linux */#ifdef SVR4 if (!abbrev(tcp)) { tprintf("%s{d_ino=%llu, d_off=%llu, ", i ? " " : "", d->d_ino, d->d_off); tprintf("d_reclen=%u, d_name=\"%s\"}", d->d_reclen, d->d_name); }#endif /* SVR4 */#ifdef SUNOS4 if (!abbrev(tcp)) { tprintf("%s{d_off=%lu, d_fileno=%lu, d_reclen=%u, ", i ? " " : "", d->d_off, d->d_fileno, d->d_reclen); tprintf("d_namlen=%u, d_name=\"%.*s\"}", d->d_namlen, d->d_namlen, d->d_name); }#endif /* SUNOS4 */ i += d->d_reclen; dents++; } if (!abbrev(tcp)) tprintf("}"); else tprintf("/* %u entries */", dents); tprintf(", %lu", tcp->u_arg[2]); free(buf); return 0;}#endif #ifdef FREEBSDintsys_getdirentries(tcp)struct tcb * tcp;{ int i, len, dents = 0; long basep; char *buf; if (entering(tcp)) { tprintf("%lu, ", tcp->u_arg[0]); return 0; } if (syserror(tcp) || !verbose(tcp)) { tprintf("%#lx, %lu, %#lx", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]); return 0; } len = tcp->u_rval; if ((buf = malloc(len)) == NULL) { tprintf("out of memory\n"); return 0; } if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) { tprintf("{...}, %lu, %#lx", tcp->u_arg[2], tcp->u_arg[3]); free(buf); return 0; } if (!abbrev(tcp)) tprintf("{"); for (i = 0; i < len;) { struct kernel_dirent *d = (struct kernel_dirent *) &buf[i]; if (!abbrev(tcp)) { tprintf("%s{d_fileno=%u, d_reclen=%u, d_type=", i ? " " : "", d->d_fileno, d->d_reclen); printxval(direnttypes, d->d_type, "DT_???"); tprintf(", d_namlen=%u, d_name=\"%.*s\"}", d->d_namlen, d->d_namlen, d->d_name); } i += d->d_reclen; dents++; } if (!abbrev(tcp)) tprintf("}"); else tprintf("/* %u entries */", dents); free(buf); tprintf(", %lu", tcp->u_arg[2]); if (umove(tcp, tcp->u_arg[3], &basep) < 0) tprintf(", %#lx", tcp->u_arg[3]); else tprintf(", [%lu]", basep); return 0;}#endif#ifdef linuxintsys_getcwd(tcp)struct tcb *tcp;{ if (exiting(tcp)) { if (syserror(tcp)) tprintf("%#lx", tcp->u_arg[0]); else printpathn(tcp, tcp->u_arg[0], tcp->u_rval - 1); tprintf(", %lu", tcp->u_arg[1]); } return 0;}#endif /* linux */#ifdef FREEBSDintsys___getcwd(tcp)struct tcb *tcp;{ if (exiting(tcp)) { if (syserror(tcp)) tprintf("%#lx", tcp->u_arg[0]); else printpathn(tcp, tcp->u_arg[0], tcp->u_arg[1]); tprintf(", %lu", tcp->u_arg[1]); } return 0;}#endif#ifdef HAVE_SYS_ASYNCH_Hintsys_aioread(tcp)struct tcb *tcp;{ struct aio_result_t res; if (entering(tcp)) { tprintf("%lu, ", tcp->u_arg[0]); } else { if (syserror(tcp)) tprintf("%#lx", tcp->u_arg[1]); else printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]); tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]); printxval(whence, tcp->u_arg[4], "L_???"); if (syserror(tcp) || tcp->u_arg[5] == 0 || umove(tcp, tcp->u_arg[5], &res) < 0) tprintf(", %#lx", tcp->u_arg[5]); else tprintf(", {aio_return %d aio_errno %d}", res.aio_return, res.aio_errno); } return 0;}intsys_aiowrite(tcp)struct tcb *tcp;{ struct aio_result_t res; if (entering(tcp)) { tprintf("%lu, ", tcp->u_arg[0]); printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]); tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]); printxval(whence, tcp->u_arg[4], "L_???"); } else { if (tcp->u_arg[5] == 0) tprintf(", NULL"); else if (syserror(tcp) || umove(tcp, tcp->u_arg[5], &res) < 0) tprintf(", %#lx", tcp->u_arg[5]); else tprintf(", {aio_return %d aio_errno %d}", res.aio_return, res.aio_errno); } return 0;}intsys_aiowait(tcp)struct tcb *tcp;{ if (entering(tcp)) printtv(tcp, tcp->u_arg[0]); return 0;}intsys_aiocancel(tcp)struct tcb *tcp;{ struct aio_result_t res; if (exiting(tcp)) { if (tcp->u_arg[0] == 0) tprintf("NULL"); else if (syserror(tcp) || umove(tcp, tcp->u_arg[0], &res) < 0) tprintf("%#lx", tcp->u_arg[0]); else tprintf("{aio_return %d aio_errno %d}", res.aio_return, res.aio_errno); } return 0;}#endif /* HAVE_SYS_ASYNCH_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -