summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorbdrewery <bdrewery@FreeBSD.org>2015-10-03 18:57:15 +0000
committerbdrewery <bdrewery@FreeBSD.org>2015-10-03 18:57:15 +0000
commit60e8720fc68b78dda97d68ba497fd01a8ee8a49e (patch)
tree444463929512cc6012337487cb9be727c560939e /usr.bin
parent204c0e68340c37d93a33ff48b893addfa47680df (diff)
downloadFreeBSD-src-60e8720fc68b78dda97d68ba497fd01a8ee8a49e.zip
FreeBSD-src-60e8720fc68b78dda97d68ba497fd01a8ee8a49e.tar.gz
Add decoding for struct statfs.
Reviewed by: jhb (briefly)
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/truss/syscall.h3
-rw-r--r--usr.bin/truss/syscalls.c28
2 files changed, 30 insertions, 1 deletions
diff --git a/usr.bin/truss/syscall.h b/usr.bin/truss/syscall.h
index ee35214..18dd33f 100644
--- a/usr.bin/truss/syscall.h
+++ b/usr.bin/truss/syscall.h
@@ -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,
diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c
index ab163d8..1af6d35 100644
--- a/usr.bin/truss/syscalls.c
+++ b/usr.bin/truss/syscalls.c
@@ -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;
OpenPOWER on IntegriCloud