Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 Apr 2007 22:56:37 +0800
From:      "Howard Su" <howard0su@gmail.com>
To:        "Alfred Perlstein" <alfred@freebsd.org>
Cc:        current@freebsd.org
Subject:   Re: [Review] Remove procfs dependency of truss
Message-ID:  <f126fae00704060756r404f5414pb1e111be847c02a6@mail.gmail.com>
In-Reply-To: <20070406125940.GN2382@elvis.mu.org>
References:  <f126fae00704040118w25a7b291xdcf1b6300bab1ceb@mail.gmail.com> <f126fae00704060104w1fd4b060w35f2073eced93f57@mail.gmail.com> <20070406125940.GN2382@elvis.mu.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 4/6/07, Alfred Perlstein <alfred@freebsd.org> 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 <strsize> 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



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