From owner-freebsd-current@FreeBSD.ORG Fri Apr 6 14:56:39 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 6432316A403 for ; Fri, 6 Apr 2007 14:56:39 +0000 (UTC) (envelope-from howard0su@gmail.com) Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.236]) by mx1.freebsd.org (Postfix) with ESMTP id 10FB413C45E for ; Fri, 6 Apr 2007 14:56:38 +0000 (UTC) (envelope-from howard0su@gmail.com) Received: by nz-out-0506.google.com with SMTP id r28so526721nza for ; Fri, 06 Apr 2007 07:56:38 -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:content-transfer-encoding:content-disposition:references; b=WQvGEcxMnVSwNVGP3eTjEkQLN4aqGCNVljdS8SPNxL/w10kDWCrqIvJaP6LkKis4W4duDIdwrMRYT7+PrBdPdtHzCFivxZCBmyW/WsNHdsxdY4ogKMqCGMTvCjoxcmc64pOMAzks0vU9Kzn/8ZqPe/jKlFhvJkYPEDn1wbgCbsE= 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:content-transfer-encoding:content-disposition:references; b=o4ieAMsRyns4AyHa4jqEnE/8AtDAt8+Cb0XQPQOQ6qYjlLGPsXWQaDV3nrrVOMbxOQDJ+2q29t8Ve0g+rsdb7Zwfm3oy504sf/ZA2teU0j12xqcHRx1Mzv0KaTB6jDUdnYnVWMvmFGdLyEEH9A96gI5yNfbQarmvgm5mp/mdLeE= Received: by 10.115.93.16 with SMTP id v16mr1242283wal.1175871397869; Fri, 06 Apr 2007 07:56:37 -0700 (PDT) Received: by 10.114.241.12 with HTTP; Fri, 6 Apr 2007 07:56:37 -0700 (PDT) Message-ID: Date: Fri, 6 Apr 2007 22:56:37 +0800 From: "Howard Su" To: "Alfred Perlstein" In-Reply-To: <20070406125940.GN2382@elvis.mu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20070406125940.GN2382@elvis.mu.org> Cc: current@freebsd.org 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 14:56:39 -0000 On 4/6/07, Alfred Perlstein wrote: > > nit: you have new functions like this "void fun(args)", they should > be in the form of "void\nfun(args)" (newline after return type) I will do a style cleanup. > > possible issue: is get_string equivelant to the procfs version? > meaning, if there's a string that ends at a strange place in the > address space will it work any differently? I uses a different way. I preallocate a buf to use ptrace to fill it once. I limit the size to 1024 as a magic number. if the actual string length is smaller than 1024 and has a NUL teminate character, we will ignore the left chars. (little performance issue). if the actual length is larger than 1024, i place a NUL at 1024. so it will be also safe. I think this is not a perfect solution. I willing to change it to respect -s args. -s strsize Display strings using at most strsize characters. If the buffer is larger, "..." will be displayed at the end of the string. The default strsize is 32. > > note how the procfs version does a fgetc(3) over and over and > stops reading if it hits \0, while the version you have tried > to read the entire buf. Can that cause issues? > Thanks, Howard