Re: [Review] Remove procfs dependency of truss

From: Howard Su <howard0su_at_gmail.com>
Date: Fri, 6 Apr 2007 22:56:37 +0800
On 4/6/07, Alfred Perlstein <alfred_at_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
Received on Fri Apr 06 2007 - 12:56:39 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:07 UTC