[Review] Remove procfs dependency of truss
Howard Su
howard0su at gmail.com
Fri Apr 6 14:56:39 UTC 2007
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
More information about the freebsd-current
mailing list