From owner-freebsd-current@FreeBSD.ORG Fri Apr 6 08:04:25 2007 Return-Path: X-Original-To: current@freebsd.org Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7842B16A401 for ; Fri, 6 Apr 2007 08:04:25 +0000 (UTC) (envelope-from howard0su@gmail.com) Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.233]) by mx1.freebsd.org (Postfix) with ESMTP id 33D2E13C455 for ; Fri, 6 Apr 2007 08:04:25 +0000 (UTC) (envelope-from howard0su@gmail.com) Received: by nz-out-0506.google.com with SMTP id r28so467688nza for ; Fri, 06 Apr 2007 01:04:24 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=apLQlrSLkENSWk8GGeni670qK1ifEaNo8Fn9zHIHosHBqq1WAukOQ4K50xEK5HHI6woueHrcZdmCBcJL2l+7XF+5k3lZwvTsOwVivEDFbQ65rXyvCWH75eaTfMC/930oy2aadqRCZOPZlPVmLvZiR7xM4lkUxrj2V7KiqcW+JOE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=jyT1mCsJX4/b8OovVUKj1Khlzx6ca+pl3iLM4Rqk3/H8ATwlyoLmln9+VVa/MN5x7UCsirVUwZ+lbuIfo6xR6BtDhh1PgpBUbqUXDWyaUa3pagSYUVfZwZn97F9vPg3bUa/OR3ANVN9hOsfO57+ra74bHJ6cCenwfsFjmq68r+M= Received: by 10.115.33.1 with SMTP id l1mr1151612waj.1175846663895; Fri, 06 Apr 2007 01:04:23 -0700 (PDT) Received: by 10.114.241.12 with HTTP; Fri, 6 Apr 2007 01:04:23 -0700 (PDT) Message-ID: Date: Fri, 6 Apr 2007 16:04:23 +0800 From: "Howard Su" To: current@freebsd.org In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_3006_3639545.1175846663809" References: Cc: alfred@freebsd.org, Robert Watson Subject: Re: [Review] Remove procfs dependency of truss X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2007 08:04:25 -0000 ------=_Part_3006_3639545.1175846663809 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Thanks to Robert to point out that my original patch didn't work against a threaded application. I fixed that. Please try the new patch. I tested this patch under i386 box only with libthr and libpthread. Howard On 4/4/07, Howard Su wrote: > Following the suggestion in idea page, I proposed the attached patch. > I didn't change any kernel part because I think PTRACE(2) is > functional although man page didn't document it. > > I tested the patch under i386 and amd64 box. The help on testing and > code review will be appreciated. > > To test, please try the following commands: > 1. truss ps > basic stuff > 2. truss -o output ps > output the result to file > 3. truss -f -o output sh -c "ps" > test follow fork > 4. start TOP(1) in another session, the > truss -p > > -- > -Howard > > -- -Howard ------=_Part_3006_3639545.1175846663809 Content-Type: text/plain; name=truss_patch.diff; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: base64 X-Attachment-Id: f_f06cp13a Content-Disposition: attachment; filename="truss_patch.diff" PT09PSAvL2RlcG90L3ZlbmRvci9mcmVlYnNkL3NyYy91c3IuYmluL3RydXNzL01ha2VmaWxlIzkg KHRleHQra28pIC0gLy9kZXBvdC91c2VyL2hvd2FyZHN1L3RydXNzL3Vzci5iaW4vdHJ1c3MvTWFr ZWZpbGUjMSAodGV4dCtrbykgPT09PSBpZGVudGljYWwKPT09PSAvL2RlcG90L3ZlbmRvci9mcmVl YnNkL3NyYy91c3IuYmluL3RydXNzL2FtZDY0LWZic2QuYyM2ICh0ZXh0K2tvKSAtIC8vZGVwb3Qv dXNlci9ob3dh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