From owner-freebsd-questions Tue Sep 21 13:28:30 1999 Delivered-To: freebsd-questions@freebsd.org Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by hub.freebsd.org (Postfix) with ESMTP id 30AA615AB1 for ; Tue, 21 Sep 1999 13:25:54 -0700 (PDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.9.3/8.9.3) id PAA02505; Tue, 21 Sep 1999 15:25:20 -0500 (CDT) (envelope-from dan) Date: Tue, 21 Sep 1999 15:25:20 -0500 From: Dan Nelson To: Don Read Cc: "Oleg V. Volkov" , freebsd-questions@FreeBSD.ORG Subject: Re: How to find absolute name of running binary? Message-ID: <19990921152520.A2400@dan.emsphone.com> References: <19990921020955.C16138@fly.lglobus.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre2i In-Reply-To: X-OS: FreeBSD 4.0-CURRENT Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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