📄 file.c
字号:
switch (statbuf->st_mode & S_IFMT) { case S_IFCHR: case S_IFBLK:#ifdef HAVE_ST_RDEV tprintf("st_rdev=makedev(%lu, %lu), ", (unsigned long) major(statbuf->st_rdev), (unsigned long) minor(statbuf->st_rdev));#else /* !HAVE_ST_RDEV */ tprintf("st_size=makedev(%lu, %lu), ", (unsigned long) major(statbuf->st_size), (unsigned long) minor(statbuf->st_size));#endif /* !HAVE_ST_RDEV */ break; default: tprintf("st_size=%lu, ", statbuf->st_size); break; } if (!abbrev(tcp)) { tprintf("st_atime=%s, ", sprinttime(statbuf->st_atime)); tprintf("st_mtime=%s, ", sprinttime(statbuf->st_mtime)); tprintf("st_ctime=%s", sprinttime(statbuf->st_ctime));#if HAVE_ST_FLAGS tprintf(", st_flags="); if (statbuf->st_flags) { printflags(fileflags, statbuf->st_flags); } else tprintf("0");#endif#if HAVE_ST_ACLCNT tprintf(", st_aclcnt=%d", statbuf->st_aclcnt);#endif#if HAVE_ST_LEVEL tprintf(", st_level=%ld", statbuf->st_level);#endif#if HAVE_ST_FSTYPE tprintf(", st_fstype=%.*s", (int) sizeof statbuf->st_fstype, statbuf->st_fstype);#endif#if HAVE_ST_GEN tprintf(", st_gen=%u", statbuf->st_gen);#endif tprintf("}"); } else tprintf("...}");}static voidprintstat(tcp, addr)struct tcb *tcp;long addr;{ struct stat statbuf;#ifdef LINUXSPARC if (current_personality == 1) { printstatsol(tcp, addr); return; }#endif /* LINUXSPARC */ if (!addr) { tprintf("NULL"); return; } if (syserror(tcp) || !verbose(tcp)) { tprintf("%#lx", addr); return; } if (umove(tcp, addr, &statbuf) < 0) { tprintf("{...}"); return; } realprintstat(tcp, &statbuf);}#endif /* !HAVE_LONG_LONG_OFF_T */#ifdef HAVE_STAT64static voidprintstat64(tcp, addr)struct tcb *tcp;long addr;{ struct stat64 statbuf;#ifdef LINUXSPARC if (current_personality == 1) { printstatsol(tcp, addr); return; }#endif /* LINUXSPARC */ if (!addr) { tprintf("NULL"); return; } if (syserror(tcp) || !verbose(tcp)) { tprintf("%#lx", addr); return; } if (umove(tcp, addr, &statbuf) < 0) { tprintf("{...}"); return; } if (!abbrev(tcp)) {#ifdef HAVE_LONG_LONG tprintf("{st_dev=makedev(%lu, %lu), st_ino=%llu, st_mode=%s, ",#else tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",#endif (unsigned long) major(statbuf.st_dev), (unsigned long) minor(statbuf.st_dev),#ifdef HAVE_LONG_LONG (unsigned long long) statbuf.st_ino,#else (unsigned long) statbuf.st_ino,#endif sprintmode(statbuf.st_mode)); tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ", (unsigned long) statbuf.st_nlink, (unsigned long) statbuf.st_uid, (unsigned long) statbuf.st_gid);#ifdef HAVE_ST_BLKSIZE tprintf("st_blksize=%lu, ", (unsigned long) statbuf.st_blksize);#endif /* HAVE_ST_BLKSIZE */#ifdef HAVE_ST_BLOCKS tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);#endif /* HAVE_ST_BLOCKS */ } else tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode)); switch (statbuf.st_mode & S_IFMT) { case S_IFCHR: case S_IFBLK:#ifdef HAVE_ST_RDEV tprintf("st_rdev=makedev(%lu, %lu), ", (unsigned long) major(statbuf.st_rdev), (unsigned long) minor(statbuf.st_rdev));#else /* !HAVE_ST_RDEV */ tprintf("st_size=makedev(%lu, %lu), ", (unsigned long) major(statbuf.st_size), (unsigned long) minor(statbuf.st_size));#endif /* !HAVE_ST_RDEV */ break; default: tprintf("st_size=%llu, ", statbuf.st_size); break; } if (!abbrev(tcp)) { tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime)); tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime)); tprintf("st_ctime=%s", sprinttime(statbuf.st_ctime));#if HAVE_ST_FLAGS tprintf(", st_flags="); if (statbuf.st_flags) { printflags(fileflags, statbuf.st_flags); } else tprintf("0");#endif#if HAVE_ST_ACLCNT tprintf(", st_aclcnt=%d", statbuf.st_aclcnt);#endif#if HAVE_ST_LEVEL tprintf(", st_level=%ld", statbuf.st_level);#endif#if HAVE_ST_FSTYPE tprintf(", st_fstype=%.*s", (int) sizeof statbuf.st_fstype, statbuf.st_fstype);#endif#if HAVE_ST_GEN tprintf(", st_gen=%u", statbuf.st_gen);#endif tprintf("}"); } else tprintf("...}");}#endif /* HAVE_STAT64 */#if defined(linux) && !defined(IA64) && !defined(HPPA)static voidconvertoldstat(oldbuf, newbuf)const struct __old_kernel_stat *oldbuf;struct stat *newbuf;{ newbuf->st_dev=oldbuf->st_dev; newbuf->st_ino=oldbuf->st_ino; newbuf->st_mode=oldbuf->st_mode; newbuf->st_nlink=oldbuf->st_nlink; newbuf->st_uid=oldbuf->st_uid; newbuf->st_gid=oldbuf->st_gid; newbuf->st_rdev=oldbuf->st_rdev; newbuf->st_size=oldbuf->st_size; newbuf->st_atime=oldbuf->st_atime; newbuf->st_mtime=oldbuf->st_mtime; newbuf->st_ctime=oldbuf->st_ctime; newbuf->st_blksize=0; /* not supported in old_stat */ newbuf->st_blocks=0; /* not supported in old_stat */}static voidprintoldstat(tcp, addr)struct tcb *tcp;long addr;{ struct __old_kernel_stat statbuf; struct stat newstatbuf;#ifdef LINUXSPARC if (current_personality == 1) { printstatsol(tcp, addr); return; }#endif /* LINUXSPARC */ if (!addr) { tprintf("NULL"); return; } if (syserror(tcp) || !verbose(tcp)) { tprintf("%#lx", addr); return; } if (umove(tcp, addr, &statbuf) < 0) { tprintf("{...}"); return; } convertoldstat(&statbuf, &newstatbuf); realprintstat(tcp, &newstatbuf);}#endif /* linux && !IA64 */#ifndef HAVE_LONG_LONG_OFF_Tintsys_stat(tcp)struct tcb *tcp;{ if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); tprintf(", "); } else { printstat(tcp, tcp->u_arg[1]); } return 0;}#endifintsys_stat64(tcp)struct tcb *tcp;{#ifdef HAVE_STAT64 if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); tprintf(", "); } else { printstat64(tcp, tcp->u_arg[1]); } return 0;#else return printargs(tcp);#endif}#ifdef linux# if !defined(IA64) && !defined(HPPA)intsys_oldstat(tcp)struct tcb *tcp;{ if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); tprintf(", "); } else { printoldstat(tcp, tcp->u_arg[1]); } return 0;}# endif /* !IA64 */#endif /* linux */#ifndef HAVE_LONG_LONG_OFF_Tintsys_fstat(tcp)struct tcb *tcp;{ if (entering(tcp)) tprintf("%ld, ", tcp->u_arg[0]); else { printstat(tcp, tcp->u_arg[1]); } return 0;}#endifintsys_fstat64(tcp)struct tcb *tcp;{#ifdef HAVE_STAT64 if (entering(tcp)) tprintf("%ld, ", tcp->u_arg[0]); else { printstat64(tcp, tcp->u_arg[1]); } return 0;#else return printargs(tcp);#endif}#ifdef linux# if !defined(IA64) && !defined(HPPA)intsys_oldfstat(tcp)struct tcb *tcp;{ if (entering(tcp)) tprintf("%ld, ", tcp->u_arg[0]); else { printoldstat(tcp, tcp->u_arg[1]); } return 0;}# endif /* !IA64 */#endif#ifndef HAVE_LONG_LONG_OFF_Tintsys_lstat(tcp)struct tcb *tcp;{ if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); tprintf(", "); } else { printstat(tcp, tcp->u_arg[1]); } return 0;}#endifintsys_lstat64(tcp)struct tcb *tcp;{#ifdef HAVE_STAT64 if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); tprintf(", "); } else { printstat64(tcp, tcp->u_arg[1]); } return 0;#else return printargs(tcp);#endif}#ifdef linux# if !defined(IA64) && !defined(HPPA)intsys_oldlstat(tcp)struct tcb *tcp;{ if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); tprintf(", "); } else { printoldstat(tcp, tcp->u_arg[1]); } return 0;}# endif /* !IA64 */#endif#if defined(SVR4) || defined(LINUXSPARC)intsys_xstat(tcp)struct tcb *tcp;{ if (entering(tcp)) { tprintf("%ld, ", tcp->u_arg[0]); printpath(tcp, tcp->u_arg[1]); tprintf(", "); } else {#ifdef _STAT64_VER if (tcp->u_arg[0] == _STAT64_VER) printstat64 (tcp, tcp->u_arg[2]); else#endif printstat(tcp, tcp->u_arg[2]); } return 0;}intsys_fxstat(tcp)struct tcb *tcp;{ if (entering(tcp)) tprintf("%ld, %ld, ", tcp->u_arg[0], tcp->u_arg[1]); else {#ifdef _STAT64_VER if (tcp->u_arg[0] == _STAT64_VER) printstat64 (tcp, tcp->u_arg[2]); else#endif printstat(tcp, tcp->u_arg[2]); } return 0;}intsys_lxstat(tcp)struct tcb *tcp;{ if (entering(tcp)) { tprintf("%ld, ", tcp->u_arg[0]); printpath(tcp, tcp->u_arg[1]); tprintf(", "); } else {#ifdef _STAT64_VER if (tcp->u_arg[0] == _STAT64_VER) printstat64 (tcp, tcp->u_arg[2]); else#endif printstat(tcp, tcp->u_arg[2]); } return 0;}intsys_xmknod(tcp)struct tcb *tcp;{ int mode = tcp->u_arg[2]; if (entering(tcp)) { tprintf("%ld, ", tcp->u_arg[0]); printpath(tcp, tcp->u_arg[1]); tprintf(", %s", sprintmode(mode)); switch (mode & S_IFMT) { case S_IFCHR: case S_IFBLK:#ifdef LINUXSPARC tprintf(", makedev(%lu, %lu)", (unsigned long) ((tcp->u_arg[3] >> 18) & 0x3fff), (unsigned long) (tcp->u_arg[3] & 0x3ffff));#else tprintf(", makedev(%lu, %lu)", (unsigned long) major(tcp->u_arg[3]), (unsigned long) minor(tcp->u_arg[3]));#endif break; default: break; } } return 0;}#ifdef HAVE_SYS_ACL_H#include <sys/acl.h>struct xlat aclcmds[] = {#ifdef SETACL { SETACL, "SETACL" },#endif#ifdef GETACL { GETACL, "GETACL" },#endif#ifdef GETACLCNT { GETACLCNT, "GETACLCNT" },#endif#ifdef ACL_GET { ACL_GET, "ACL_GET" },#endif #ifdef ACL_SET { ACL_SET, "ACL_SET" },#endif #ifdef ACL_CNT { ACL_CNT, "ACL_CNT" },#endif { 0, NULL },};intsys_acl(tcp)struct tcb *tcp;{ if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); tprintf(", "); printxval(aclcmds, tcp->u_arg[1], "???ACL???"); tprintf(", %ld", tcp->u_arg[2]); /* * FIXME - dump out the list of aclent_t's pointed to * by "tcp->u_arg[3]" if it's not NULL. */ if (tcp->u_arg[3]) tprintf(", %#lx", tcp->u_arg[3]); else tprintf(", NULL"); } return 0;}intsys_facl(tcp)struct tcb *tcp;{ if (entering(tcp)) { tprintf("%ld, ", tcp->u_arg[0]); printxval(aclcmds, tcp->u_arg[1], "???ACL???"); tprintf(", %ld", tcp->u_arg[2]); /* * FIXME - dump out the list of aclent_t's pointed to * by "tcp->u_arg[3]" if it's not NULL. */ if (tcp->u_arg[3]) tprintf(", %#lx", tcp->u_arg[3]); else tprintf(", NULL"); } return 0;}struct xlat aclipc[] = {#ifdef IPC_SHM { IPC_SHM, "IPC_SHM" },#endif #ifdef IPC_SEM { IPC_SEM, "IPC_SEM" },#endif #ifdef IPC_MSG { IPC_MSG, "IPC_MSG" },#endif { 0, NULL },};intsys_aclipc(tcp)struct tcb *tcp;{ if (entering(tcp)) { printxval(aclipc, tcp->u_arg[0], "???IPC???"); tprintf(", %#lx, ", tcp->u_arg[1]); printxval(aclcmds, tcp->u_arg[2], "???ACL???"); tprintf(", %ld", tcp->u_arg[3]); /* * FIXME - dump out the list of aclent_t's pointed to * by "tcp->u_arg[4]" if it's not NULL. */ if (tcp->u_arg[4]) tprintf(", %#lx", tcp->u_arg[4]); else tprintf(", NULL"); } return 0;}#endif /* HAVE_SYS_ACL_H */#endif /* SVR4 || LINUXSPARC */#ifdef linuxstatic struct xlat fsmagic[] = { { 0x73757245, "CODA_SUPER_MAGIC" }, { 0x012ff7b7, "COH_SUPER_MAGIC" }, { 0x1373, "DEVFS_SUPER_MAGIC" }, { 0x1cd1, "DEVPTS_SUPER_MAGIC" }, { 0x414A53, "EFS_SUPER_MAGIC" }, { 0xef51, "EXT2_OLD_SUPER_MAGIC" }, { 0xef53, "EXT2_SUPER_MAGIC" }, { 0x137d, "EXT_SUPER_MAGIC" }, { 0xf995e849, "HPFS_SUPER_MAGIC" }, { 0x9660, "ISOFS_SUPER_MAGIC" }, { 0x137f, "MINIX_SUPER_MAGIC" }, { 0x138f, "MINIX_SUPER_MAGIC2" }, { 0x2468, "MINIX2_SUPER_MAGIC" }, { 0x2478, "MINIX2_SUPER_MAGIC2" }, { 0x4d44, "MSDOS_SUPER_MAGIC" }, { 0x564c, "NCP_SUPER_MAGIC" }, { 0x6969, "NFS_SUPER_MAGIC" }, { 0x9fa0, "PROC_SUPER_MAGIC" }, { 0x002f, "QNX4_SUPER_MAGIC" }, { 0x52654973, "REISERFS_SUPER_MAGIC" }, { 0x02011994, "SHMFS_SUPER_MAGIC" }, { 0x517b, "SMB_SUPER_MAGIC" }, { 0x012ff7b6, "SYSV2_SUPER_MAGIC" }, { 0x012ff7b5, "SYSV4_SUPER_MAGIC" }, { 0x00011954, "UFS_MAGIC" }, { 0x54190100, "UFS_CIGAM" }, { 0x012ff7b4, "XENIX_SUPER_MAGIC" }, { 0x012fd16d, "XIAFS_SUPER_MAGIC" }, { 0, NULL },};#endif /* linux */#ifndef SVR4static char *sprintfstype(magic)int magic;{ static char buf[32];#ifdef linux char *s; s = xlookup(fsmagic, magic); if (s) { sprintf(buf, "\"%s\"", s); return buf; }#endif /* linux */ sprintf(buf, "%#x", magic); return buf;}static voidprintstatfs(tcp, addr)struct tcb *tcp;long addr;{ struct statfs statbuf; if (syserror(tcp) || !verbose(tcp)) { tprintf("%#lx", addr); return; } if (umove(tcp, addr, &statbuf) < 0) { tprintf("{...}"); return; }#ifdef ALPHA tprintf("{f_type=%s, f_fbsize=%u, f_blocks=%u, f_bfree=%u, ", sprintfstype(statbuf.f_type), statbuf.f_bsize, statbuf.f_blocks, statbuf.f_bfree); tprintf("f_bavail=%u, f_files=%u, f_ffree=%u, f_namelen=%u", statbuf.f_bavail,statbuf.f_files, statbuf.f_ffree, statbuf.f_namelen);#else /* !ALPHA */ tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%lu, f_bfree=%lu, ", sprintfstype(statbuf.f_type), (unsigned long)statbuf.f_bsize, (unsigned long)statbuf.f_blocks, (unsigned long)statbuf.f_bfree); tprintf("f_files=%lu, f_ffree=%lu", (unsigned long)statbuf.f_files, (unsigned long)statbuf.f_ffree);#ifdef linux tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);#endif /* linux */#endif /* !ALPHA */ tprintf("}");}intsys_statfs(tcp)struct tcb *tcp;{ if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); tprintf(", "); } else { printstatfs(tcp, tcp->u_arg[1]); } return 0;}intsys_fstatfs(tcp)struct tcb *tcp;{ if (entering(tcp)) { tprintf("%lu, ", tcp->u_arg[0]); } else { printstatfs(tcp, tcp->u_arg[1]); } return 0;}#if defined(linux) && defined(__alpha)intosf_statfs(tcp)struct tcb *tcp;{ if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); tprintf(", "); } else { printstatfs(tcp, tcp->u_arg[1]); tprintf(", %lu", tcp->u_arg[2]); } return 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -