Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Sep 1999 15:25:20 -0500
From:      Dan Nelson <dnelson@emsphone.com>
To:        Don Read <dread@texas.net>
Cc:        "Oleg V. Volkov" <rover@lglobus.ru>, freebsd-questions@FreeBSD.ORG
Subject:   Re: How to find absolute name of running binary?
Message-ID:  <19990921152520.A2400@dan.emsphone.com>
In-Reply-To: <XFMail.990921144020.dread@texas.net>
References:  <19990921020955.C16138@fly.lglobus.ru> <XFMail.990921144020.dread@texas.net>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Sep 21), Don Read said:
> On 20-Sep-99 Oleg V. Volkov wrote:
> > Well subject says it all. How could i find absolute name of my running
> > binary from inside it? References to man or C examples welcome.
> 
> You can't.
> The best you can hope for is to look at args[0]; and hope the calling
> process set it correctly.

You could stat() /proc/curproc/file, and search the entire directory
tree for a file that matches (no guarantees though; the file could have
need deleted).

-- 
	Dan Nelson
	dnelson@emsphone.com


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




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