From owner-freebsd-bugs@FreeBSD.ORG Tue May 13 11:40:07 2003 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 163A837B404 for ; Tue, 13 May 2003 11:40:07 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id E82E843FBF for ; Tue, 13 May 2003 11:40:05 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h4DIe5Up022023 for ; Tue, 13 May 2003 11:40:05 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h4DIe5Sx022022; Tue, 13 May 2003 11:40:05 -0700 (PDT) Resent-Date: Tue, 13 May 2003 11:40:05 -0700 (PDT) Resent-Message-Id: <200305131840.h4DIe5Sx022022@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Dan Nelson Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D5B0937B401 for ; Tue, 13 May 2003 11:34:54 -0700 (PDT) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4409F43F75 for ; Tue, 13 May 2003 11:34:54 -0700 (PDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.12.9/8.12.9) id h4DIYreY097942; Tue, 13 May 2003 13:34:53 -0500 (CDT) (envelope-from dan) Message-Id: <200305131834.h4DIYreY097942@dan.emsphone.com> Date: Tue, 13 May 2003 13:34:53 -0500 (CDT) From: Dan Nelson To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/52190: [Patch] decode more syscalls in truss X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 May 2003 18:40:07 -0000 >Number: 52190 >Category: bin >Synopsis: [Patch] decode more syscalls in truss >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue May 13 11:40:05 PDT 2003 >Closed-Date: >Last-Modified: >Originator: Dan Nelson >Release: FreeBSD 5.1-BETA i386 >Organization: The Allant Group >Environment: System: FreeBSD dan.emsphone.com 5.1-BETA FreeBSD 5.1-BETA #269: Tue May 13 09:30:33 CDT 2003 zsh@dan.emsphone.com:/usr/src/sys/i386/compile/DANSMP i386 >Description: >How-To-Repeat: >Fix: This adds the ability to decode struct timespec and timeval, and adds a bunch of syscalls that use them. As a bonus, describe recvfrom to its sockaddr can be printed. Index: syscall.h =================================================================== RCS file: /home/ncvs/src/usr.bin/truss/syscall.h,v retrieving revision 1.10 diff -u -p -r1.10 syscall.h --- syscall.h 4 Aug 2002 02:24:21 -0000 1.10 +++ syscall.h 13 May 2003 17:24:08 -0000 @@ -9,9 +9,14 @@ * write() arguments as such, even though they may *not* be * printable data. * Ptr -- pointer to some specific structure. Just print as hex for now. - * Quad -- a double-word value. e.g., lseek(int, offset_t, int) * Stat -- a pointer to a stat buffer. Currently unused. * 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) + * Sockaddr -- a pointer to a struct sockaddr. Prints symbolic AF, and IP:Port + * StringArray -- a pointer to an array of string pointers. + * Timespec -- a pointer to a struct timespec. Prints both elements. + * Timeval -- a pointer to a struct timeval. Prints both elements. * * In addition, the pointer types (String, Ptr) may have OUT masked in -- * this means that the data is set on *return* from the system call -- or @@ -22,7 +27,7 @@ */ enum Argtype { None = 1, Hex, Octal, Int, String, Ptr, Stat, Ioctl, Quad, - Signal, Sockaddr, StringArray }; + Signal, Sockaddr, StringArray, Timespec, Timeval }; #define ARG_MASK 0xff #define OUT 0x100 Index: syscalls.c =================================================================== RCS file: /home/ncvs/src/usr.bin/truss/syscalls.c,v retrieving revision 1.28 diff -u -p -r1.28 syscalls.c --- syscalls.c 15 Apr 2003 06:12:12 -0000 1.28 +++ syscalls.c 13 May 2003 16:18:16 -0000 @@ -131,6 +131,12 @@ struct syscall syscalls[] = { { "kldnext", 0, 1, { { Int, 0 }}}, { "kldstat", 0, 2, { { Int, 0 }, { Ptr, 1 }}}, { "kldfirstmod", 0, 1, { { Int, 0 }}}, + { "nanosleep", 0, 1, { { Timespec, 0 }}}, + { "select", 1, 5, { { Int, 0 }, { Ptr, 1 }, { Ptr, 2 }, { Ptr, 3 }, { Timeval, 4 }}}, + { "poll", 1, 3, { { Ptr, 0 }, { Int, 1 }, { Int, 2 }}}, + { "gettimeofday", 1, 2, { { Timeval | OUT, 0 }, { Ptr, 1 }}}, + { "clock_gettime", 1, 2, { { Int, 0 }, { Timeval | OUT, 1 }}}, + { "recvfrom", 1, 6, { { Int, 0 }, { Ptr | OUT, 1 }, { Int, 2 }, { Int, 3 }, { Sockaddr | OUT, 4}, {Ptr | OUT, 5}}}, { 0, 0, 0, { { 0, 0 }}}, }; @@ -333,6 +339,24 @@ print_arg(int fd, struct syscall_args *s } } break; + case Timespec: + { + struct timespec ts; + if(get_struct(fd, (void *)args[sc->offset], &ts, sizeof(struct timespec)) != -1) + asprintf(&tmp, "{%d,%d}", ts.tv_sec, ts.tv_nsec); + else + asprintf(&tmp, "0x%lx", args[sc->offset]); + } + break; + case Timeval: + { + struct timeval tv; + if(get_struct(fd, (void *)args[sc->offset], &tv, sizeof(struct timeval)) != -1) + asprintf(&tmp, "{%d,%d}", tv.tv_sec, tv.tv_usec); + else + asprintf(&tmp, "0x%lx", args[sc->offset]); + } + break; case Signal: { long sig; >Release-Note: >Audit-Trail: >Unformatted: