Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 May 2017 12:18:09 +0000 (UTC)
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r317736 - head/usr.bin/truss
Message-ID:  <201705031218.v43CI99v042792@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tuexen
Date: Wed May  3 12:18:09 2017
New Revision: 317736
URL: https://svnweb.freebsd.org/changeset/base/317736

Log:
  Add support for [gs]etsockopt().

Modified:
  head/usr.bin/truss/syscall.h
  head/usr.bin/truss/syscalls.c

Modified: head/usr.bin/truss/syscall.h
==============================================================================
--- head/usr.bin/truss/syscall.h	Wed May  3 09:54:37 2017	(r317735)
+++ head/usr.bin/truss/syscall.h	Wed May  3 12:18:09 2017	(r317736)
@@ -46,7 +46,8 @@ enum Argtype { None = 1, Hex, Octal, Int
 	LinuxSockArgs, Umtxop, Atfd, Atflags, Timespec2, Accessmode, Long,
 	Sysarch, ExecArgs, ExecEnv, PipeFds, QuadHex, Utrace, IntArray, Pipe2,
 	CapFcntlRights, Fadvice, FileFlags, Flockop, Getfsstatmode, Kldsymcmd,
-	Kldunloadflags, Sizet, Madvice, Socklent, Sockprotocol,
+	Kldunloadflags, Sizet, Madvice, Socklent, Sockprotocol, Sockoptlevel,
+	Sockoptname,
 
 	CloudABIAdvice, CloudABIClockID, ClouduABIFDSFlags,
 	CloudABIFDStat, CloudABIFileStat, CloudABIFileType,

Modified: head/usr.bin/truss/syscalls.c
==============================================================================
--- head/usr.bin/truss/syscalls.c	Wed May  3 09:54:37 2017	(r317735)
+++ head/usr.bin/truss/syscalls.c	Wed May  3 12:18:09 2017	(r317736)
@@ -174,6 +174,9 @@ static struct syscall decoded_syscalls[]
 	  .args = { { Int, 0 } } },
 	{ .name = "getsockname", .ret_type = 1, .nargs = 3,
 	  .args = { { Int, 0 }, { Sockaddr | OUT, 1 }, { Ptr | OUT, 2 } } },
+	{ .name = "getsockopt", .ret_type = 1, .nargs = 5,
+	  .args = { { Int, 0 }, { Sockoptlevel, 1 }, { Sockoptname, 2 },
+		    { Ptr | OUT, 3 }, { Ptr | OUT, 4 } } },
 	{ .name = "gettimeofday", .ret_type = 1, .nargs = 2,
 	  .args = { { Timeval | OUT, 0 }, { Ptr, 1 } } },
 	{ .name = "ioctl", .ret_type = 1, .nargs = 3,
@@ -295,6 +298,9 @@ static struct syscall decoded_syscalls[]
 	  .args = { { Int, 0 }, { Itimerval, 1 }, { Itimerval | OUT, 2 } } },
 	{ .name = "setrlimit", .ret_type = 1, .nargs = 2,
 	  .args = { { Resource, 0 }, { Rlimit | IN, 1 } } },
+	{ .name = "setsockopt", .ret_type = 1, .nargs = 5,
+	  .args = { { Int, 0 }, { Sockoptlevel, 1 }, { Sockoptname, 2 },
+		    { Ptr | IN, 3 }, { Socklent, 4 } } },
 	{ .name = "shutdown", .ret_type = 1, .nargs = 2,
 	  .args = { { Int, 0 }, { Shutdown, 1 } } },
 	{ .name = "sigaction", .ret_type = 1, .nargs = 3,
@@ -1928,6 +1934,24 @@ print_arg(struct syscall_args *sc, unsig
 		}
 		break;
 	}
+	case Sockoptlevel:
+		print_integer_arg(sysdecode_sockopt_level, fp,
+		    args[sc->offset]);
+		break;
+	case Sockoptname: {
+		const char *temp;
+		int level, name;
+
+		level = args[sc->offset - 1];
+		name = args[sc->offset];
+		temp = sysdecode_sockopt_name(level, name);
+		if (temp) {
+			fputs(temp, fp);
+		} else {
+			fprintf(fp, "%d", name);
+		}
+		break;
+	}
 
 	case CloudABIAdvice:
 		fputs(xlookup(cloudabi_advice, args[sc->offset]), fp);



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