Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Feb 2021 16:29:06 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 90da2c797bfa - main - truss: Decode sendfile(2) arguments
Message-ID:  <202102051629.115GT6sD011082@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=90da2c797bfa7639005ed46ab9173feb8bd85ecd

commit 90da2c797bfa7639005ed46ab9173feb8bd85ecd
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2021-02-05 16:28:09 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-02-05 16:28:29 +0000

    truss: Decode sendfile(2) arguments
    
    MFC after:      2 weeks
---
 usr.bin/truss/syscall.h  |  2 ++
 usr.bin/truss/syscalls.c | 22 ++++++++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/usr.bin/truss/syscall.h b/usr.bin/truss/syscall.h
index 5f8babf4c407..af918fed4f1b 100644
--- a/usr.bin/truss/syscall.h
+++ b/usr.bin/truss/syscall.h
@@ -117,6 +117,8 @@ enum Argtype {
 	Procctl,
 	Priowhich,
 	Ptraceop,
+	Sendfileflags,
+	Sendfilehdtr,
 	Quotactlcmd,
 	Reboothowto,
 	Resource,
diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c
index 319f3d8b0793..f52a82ed97c0 100644
--- a/usr.bin/truss/syscalls.c
+++ b/usr.bin/truss/syscalls.c
@@ -478,6 +478,10 @@ static struct syscall decoded_syscalls[] = {
 	  .args = { { Int, 0 }, { Iovec | IN, 1 }, { Int, 2 },
 	            { Sockaddr | IN, 3 }, { Socklent, 4 },
 	            { Sctpsndrcvinfo | IN, 5 }, { Msgflags, 6 } } },
+	{ .name = "sendfile", .ret_type = 1, .nargs = 7,
+	  .args = { { Int, 0 }, { Int, 1 }, { QuadHex, 2 }, { Sizet, 3 },
+		    { Sendfilehdtr, 4 }, { QuadHex | OUT, 5 },
+		    { Sendfileflags, 6 } } },
 	{ .name = "select", .ret_type = 1, .nargs = 5,
 	  .args = { { Int, 0 }, { Fd_set, 1 }, { Fd_set, 2 }, { Fd_set, 3 },
 		    { Timeval, 4 } } },
@@ -2670,6 +2674,24 @@ print_arg(struct syscall_args *sc, unsigned long *args, register_t *retval,
 		print_integer_arg(sysdecode_ptrace_request, fp,
 		    args[sc->offset]);
 		break;
+	case Sendfileflags:
+		print_mask_arg(sysdecode_sendfile_flags, fp, args[sc->offset]);
+		break;
+	case Sendfilehdtr: {
+		struct sf_hdtr hdtr;
+
+		if (get_struct(pid, args[sc->offset], &hdtr, sizeof(hdtr)) !=
+		    -1) {
+			fprintf(fp, "{");
+			print_iovec(fp, trussinfo, (uintptr_t)hdtr.headers,
+			    hdtr.hdr_cnt);
+			print_iovec(fp, trussinfo, (uintptr_t)hdtr.trailers,
+			    hdtr.trl_cnt);
+			fprintf(fp, "}");
+		} else
+			print_pointer(fp, args[sc->offset]);
+		break;
+	}
 	case Quotactlcmd:
 		if (!sysdecode_quotactl_cmd(fp, args[sc->offset]))
 			fprintf(fp, "%#x", (int)args[sc->offset]);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202102051629.115GT6sD011082>