Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Apr 2018 21:01:44 +0000 (UTC)
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r332245 - stable/11/usr.bin/truss
Message-ID:  <201804072101.w37L1iQK006668@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tuexen
Date: Sat Apr  7 21:01:43 2018
New Revision: 332245
URL: https://svnweb.freebsd.org/changeset/base/332245

Log:
  MFC r327967:
  
  Improve support for sctp_generic_recvmsg() and sctp_generic_sendmsg()
  and add support for sctp_generic_sendmsg_iov().
  
  Handle the struct iovec argument and the struct sctp_sndrcvinfo
  arguments.

Modified:
  stable/11/usr.bin/truss/syscall.h
  stable/11/usr.bin/truss/syscalls.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.bin/truss/syscall.h
==============================================================================
--- stable/11/usr.bin/truss/syscall.h	Sat Apr  7 21:00:21 2018	(r332244)
+++ stable/11/usr.bin/truss/syscall.h	Sat Apr  7 21:01:43 2018	(r332245)
@@ -81,7 +81,7 @@ enum Argtype { None = 1, Hex, Octal, Int, UInt, LongHe
 	Sockoptname, Msgflags, CapRights, PUInt, PQuadHex, Acltype,
 	Extattrnamespace, Minherit, Mlockall, Mountflags, Msync, Priowhich,
 	Ptraceop, Quotactlcmd, Reboothowto, Rtpriofunc, Schedpolicy, Schedparam,
-	PSig, Siginfo, Kevent11, Iovec,
+	PSig, Siginfo, Kevent11, Iovec, Sctpsndrcvinfo,
 
 	CloudABIAdvice, CloudABIClockID, ClouduABIFDSFlags,
 	CloudABIFDStat, CloudABIFileStat, CloudABIFileType,

Modified: stable/11/usr.bin/truss/syscalls.c
==============================================================================
--- stable/11/usr.bin/truss/syscalls.c	Sat Apr  7 21:00:21 2018	(r332244)
+++ stable/11/usr.bin/truss/syscalls.c	Sat Apr  7 21:01:43 2018	(r332245)
@@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/un.h>
 #include <sys/wait.h>
 #include <netinet/in.h>
+#include <netinet/sctp.h>
 #include <arpa/inet.h>
 
 #include <assert.h>
@@ -412,13 +413,17 @@ static struct syscall decoded_syscalls[] = {
 	{ .name = "sched_setscheduler", .ret_type = 1, .nargs = 3,
 	  .args = { { Int, 0 }, { Schedpolicy, 1 }, { Schedparam, 2 } } },
 	{ .name = "sctp_generic_recvmsg", .ret_type = 1, .nargs = 7,
-	  .args = { { Int, 0 }, { Ptr | IN, 1 }, { Int, 2 },
-	            { Sockaddr | OUT, 3 }, { Ptr | OUT, 4 }, { Ptr | OUT, 5 },
-	            { Ptr | OUT, 6 } } },
+	  .args = { { Int, 0 }, { Iovec | OUT, 1 }, { Int, 2 },
+	            { Sockaddr | OUT, 3 }, { Ptr | OUT, 4 },
+	            { Sctpsndrcvinfo | OUT, 5 }, { Ptr | OUT, 6 } } },
 	{ .name = "sctp_generic_sendmsg", .ret_type = 1, .nargs = 7,
 	  .args = { { Int, 0 }, { BinString | IN, 1 }, { Int, 2 },
-	            { Sockaddr | IN, 3 }, { Socklent, 4 }, { Ptr | IN, 5 },
-	            { Msgflags, 6 } } },
+	            { Sockaddr | IN, 3 }, { Socklent, 4 },
+	            { Sctpsndrcvinfo | IN, 5 }, { Msgflags, 6 } } },
+	{ .name = "sctp_generic_sendmsg_iov", .ret_type = 1, .nargs = 7,
+	  .args = { { Int, 0 }, { Iovec | IN, 1 }, { Int, 2 },
+	            { Sockaddr | IN, 3 }, { Socklent, 4 },
+	            { Sctpsndrcvinfo | IN, 5 }, { Msgflags, 6 } } },
 	{ .name = "select", .ret_type = 1, .nargs = 5,
 	  .args = { { Int, 0 }, { Fd_set, 1 }, { Fd_set, 2 }, { Fd_set, 3 },
 		    { Timeval, 4 } } },
@@ -2128,6 +2133,33 @@ print_arg(struct syscall_args *sc, unsigned long *args
 			fprintf(fp, ",%zu}", iov[i].iov_len);
 		}
 		fprintf(fp, "%s%s", iov_truncated ? ",..." : "", "]");
+		break;
+	}
+	case Sctpsndrcvinfo: {
+		struct sctp_sndrcvinfo info;
+
+		if (get_struct(pid, (void *)args[sc->offset],
+		    &info, sizeof(struct sctp_sndrcvinfo)) == -1) {
+			fprintf(fp, "0x%lx", args[sc->offset]);
+			break;
+		}
+		fprintf(fp, "{sid=%u,", info.sinfo_stream);
+		if (sc->type & OUT) {
+			fprintf(fp, "ssn=%u,", info.sinfo_ssn);
+		}
+		fputs("flgs=", fp);
+		sysdecode_sctp_sinfo_flags(fp, info.sinfo_flags);
+		fprintf(fp, ",ppid=%u,", ntohl(info.sinfo_ppid));
+		/* Can't use IN here, since IN is 0 */
+		if ((sc->type & OUT) == 0) {
+			fprintf(fp, "ctx=%u,", info.sinfo_context);
+			fprintf(fp, "ttl=%u,", info.sinfo_timetolive);
+		}
+		if (sc->type & OUT) {
+			fprintf(fp, "tsn=%u,", info.sinfo_tsn);
+			fprintf(fp, "cumtsn=%u,", info.sinfo_cumtsn);
+		}
+		fprintf(fp, "id=%u}", info.sinfo_assoc_id);
 		break;
 	}
 



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