Date: Sun, 23 Jan 2005 01:16:46 -0800 From: Pascal Hofstee <caelian@gmail.com> To: "Christian S.J. Peron" <csjp@sqrt.ca> Cc: freebsd-hackers@freebsd.org Subject: Re: GNUstep and libkvm Message-ID: <d8a0b76205012301164040fdd2@mail.gmail.com> In-Reply-To: <d8a0b762050106220559f630a6@mail.gmail.com> References: <d8a0b76205010618212e484cf4@mail.gmail.com> <20050107051952.A61748@stf01.seccuris.com> <d8a0b762050106220559f630a6@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 6 Jan 2005 22:05:31 -0800, Pascal Hofstee <caelian@gmail.com> wrote: > Well .. i noticed that kvm_getargv indeed only seems to use /proc in > case that apparently the commandline argument list grows beyond a > certain size, as i have been able to establish by trial and error. OK .. i created a small "kvmtest" program that mimics the behaviour of what GNUstep is trying to do ... and managed to trigger the exact same problem. So i'm at least certain now that it's not related to the use of the GCC-extension GNUstep uses to run this code before the actual "main()". Further more detailed looking into the libkvm-code revealed that the "certain limit" that triggers the /proc groveling is in fact "sysctl kern.ps_arg_cache_limit" I have tried to run my kvmtest in gdb but i am running into problems there. a standard non-debugging built libkvm doesn't allow me to step through the entire kvm_getargv function ... (only the entry point and as soon as i try to step, i end up at kvm_uread which is at least several function calls further along). I also tried building a "g -O0" version of libkvm .. but as soon as i try to step inside kvm_getargv, gdb seems to just "hang" and has to be killed to terminate. I am fairly certain by now that kvm_getargv apparently calls kvm_uread whenever the size of commandname + argumentlength exceeds the sysctl kern.ps_arg_cache_limit value, and at that point obviously tries to read its argument list from /proc. If this in intended behaviour (and cannot be circumvented in any other way) .. at the very least the manpage for kvm_getargv should be updated to reflect this conditional dependency on /proc. i have attached my "kvmtest" for those that would be interested in having a look at this .. a potential side-note .. GNUstep doesn't actually kvm_open /dev/kmem but fakes a kvm_open call using /dev/null instead .. i am not sure if this may be relevant though. Any potential insight or assistence in helping me properly debug libkvm would be appreciated. -- With kind regards, Pascal Hofstee
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d8a0b76205012301164040fdd2>