From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 22 23:10:58 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 315EA16A4DA for ; Tue, 22 Aug 2006 23:10:58 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3F4A043D67 for ; Tue, 22 Aug 2006 23:10:50 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (localhost.village.org [127.0.0.1] (may be forged)) by harmony.bsdimp.com (8.13.4/8.13.4) with ESMTP id k7MN9UZj045874; Tue, 22 Aug 2006 17:09:31 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Tue, 22 Aug 2006 17:09:37 -0600 (MDT) Message-Id: <20060822.170937.1661909005.imp@bsdimp.com> To: babkin@users.sourceforge.net, babkin@verizon.net From: "M. Warner Losh" In-Reply-To: <16315800.1957801156269547401.JavaMail.root@vms062.mailsrvcs.net> References: <16315800.1957801156269547401.JavaMail.root@vms062.mailsrvcs.net> X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (harmony.bsdimp.com [127.0.0.1]); Tue, 22 Aug 2006 17:09:32 -0600 (MDT) Cc: freebsd-hackers@freebsd.org, lboehne@damogran.de Subject: Re: Aqcuiring full path to running process from outside the kernel X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2006 23:10:58 -0000 In message: <16315800.1957801156269547401.JavaMail.root@vms062.mailsrvcs.net> Sergey Babkin writes: : >From: Lutz Boehne : > : >> but argv[0] is either an absolute path or a path relative to pwd, : >> unless your shell is broken. : > : >One should also consider users breaking argv[0] intentionally, e.g. : >pointing it to other files which could lead to undesired/unpredictable : >behaviour. Even as a fallback it's probably not wise to trust it. : : If we get back to the question of why we need the file, : we might not need it at all. As far as I understand, : the problem is that the Watcom compiler works by : sticking a set of messages into the executable files : and then later reading them out of the file, and the : point is to adapt the compiler to work on FreeBSD. : : So why not just change the compiler to put the contents of : this file into a DATA section, at some special symbol. : (I presume that now it puts the messages into some : kind of a COMMENT section). : Then instead of reading the file manually you would have : the contents of the file already pre-mapped into the memory : for you when the program starts. Saves you lots of trouble. And is the main reason that DOS programs, back in the days that watcom was written, did this editing technique... Warner