Add decoding for struct statfs.

Reviewed by:	jhb (briefly)
This commit is contained in:
Bryan Drewery 2015-10-03 18:57:15 +00:00
parent b780f86455
commit a776866b44
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=288625
2 changed files with 30 additions and 1 deletions

View File

@ -10,6 +10,7 @@
* BinString -- pointer to an array of chars, printed via strvisx().
* Ptr -- pointer to some unspecified structure. Just print as hex for now.
* Stat -- a pointer to a stat buffer. Prints a couple fields.
* StatFs -- a pointer to a statfs buffer. Prints a few fields.
* Ioctl -- an ioctl command. Woefully limited.
* Quad -- a double-word value. e.g., lseek(int, offset_t, int)
* Signal -- a signal number. Prints the signal name (SIGxxx)
@ -38,7 +39,7 @@
enum Argtype { None = 1, Hex, Octal, Int, LongHex, Name, Ptr, Stat, Ioctl, Quad,
Signal, Sockaddr, StringArray, Timespec, Timeval, Itimerval, Pollfd,
Fd_set, Sigaction, Fcntl, Mprot, Mmapflags, Whence, Readlinkres,
Sigset, Sigprocmask, Kevent, Sockdomain, Socktype, Open,
Sigset, Sigprocmask, StatFs, Kevent, Sockdomain, Socktype, Open,
Fcntlflag, Rusage, BinString, Shutdown, Resource, Rlimit, Timeval2,
Pathconf, Rforkflags, ExitStatus, Waitoptions, Idtype, Procctl,
LinuxSockArgs, Umtxop, Atfd, Atflags, Timespec2, Accessmode, Long,

View File

@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
#include <sys/event.h>
#include <sys/ioccom.h>
#include <sys/mman.h>
#include <sys/mount.h>
#include <sys/procctl.h>
#include <sys/ptrace.h>
#include <sys/resource.h>
@ -182,6 +183,10 @@ static struct syscall syscalls[] = {
{ Atflags, 3 } } },
{ .name = "stat", .ret_type = 1, .nargs = 2,
.args = { { Name | IN, 0 }, { Stat | OUT, 1 } } },
{ .name = "statfs", .ret_type = 1, .nargs = 2,
.args = { { Name | IN, 0 }, { StatFs | OUT, 1 } } },
{ .name = "fstatfs", .ret_type = 1, .nargs = 2,
.args = { { Int, 0 }, { StatFs | OUT, 1 } } },
{ .name = "lstat", .ret_type = 1, .nargs = 2,
.args = { { Name | IN, 0 }, { Stat | OUT, 1 } } },
{ .name = "linux_newstat", .ret_type = 1, .nargs = 2,
@ -1444,6 +1449,29 @@ print_arg(struct syscall_args *sc, unsigned long *args, long *retval,
}
break;
}
case StatFs: {
unsigned int i;
struct statfs buf;
if (get_struct(pid, (void *)args[sc->offset], &buf,
sizeof(buf)) != -1) {
char fsid[17];
bzero(fsid, sizeof(fsid));
if (buf.f_fsid.val[0] != 0 || buf.f_fsid.val[1] != 0) {
for (i = 0; i < sizeof(buf.f_fsid); i++)
snprintf(&fsid[i*2],
sizeof(fsid) - (i*2), "%02x",
((u_char *)&buf.f_fsid)[i]);
}
fprintf(fp,
"{ fstypename=%s,mntonname=%s,mntfromname=%s,"
"fsid=%s }", buf.f_fstypename, buf.f_mntonname,
buf.f_mntfromname, fsid);
} else
fprintf(fp, "0x%lx", args[sc->offset]);
break;
}
case Rusage: {
struct rusage ru;