Date: Thu, 19 Jul 2007 22:00:23 -0400 From: "Michael B Allen" <ioplex@gmail.com> To: freebsd-hackers <freebsd-hackers@freebsd.org> Subject: Re: Path to executable of current process? Message-ID: <78c6bd860707191900g375f98ado8315603feac50247@mail.gmail.com> In-Reply-To: <78c6bd860707191725r14b8bfe3sf15c1f0e30cf82ca@mail.gmail.com> References: <78c6bd860707191725r14b8bfe3sf15c1f0e30cf82ca@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 7/19/07, Michael B Allen <ioplex@gmail.com> wrote: > Hello, > > I'm looking for an example that uses kvm_getargv but from just > googling around I can't seem to find an example. Can someone give me a > pointer? > > Actually what I'm *really* trying to do is port some code that invokes > GDB to do a backtrace and I need to give GDB the path to the > executable of the current process (e.g. on linux this is > /proc/<pid>/exe) and the pid of the process to trace (easy - getpid). > The first argument is trickey since FreeBSD frequently does not have a > /proc filesystem. So it seems kvm_getargv should have this path no? Well I figured out how to get kvm_getargv working. Unfortunately it seems only root can call kvm_open so the faulting process can't backtrace unless it so happens to be running as root (which it's not). Is there any way to get argv[0] for the current process without being root? Mike
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?78c6bd860707191900g375f98ado8315603feac50247>