From owner-freebsd-questions Thu Nov 18 13:34: 4 1999 Delivered-To: freebsd-questions@freebsd.org Received: from fly.lglobus.ru (fly.lglobus.ru [195.34.224.130]) by hub.freebsd.org (Postfix) with ESMTP id 430BC154D0 for ; Thu, 18 Nov 1999 13:29:10 -0800 (PST) (envelope-from rover@fly.lglobus.ru) Received: (from rover@localhost) by fly.lglobus.ru (8.9.3/8.9.2) id AAA63633 for freebsd-questions@freebsd.org; Fri, 19 Nov 1999 00:30:15 +0300 (MSK) (envelope-from rover) Date: Fri, 19 Nov 1999 00:30:15 +0300 From: "Oleg V. Volkov" To: freebsd-questions@freebsd.org Subject: Re: Is there correct way for program to read from itself? Message-ID: <19991119003015.C63288@fly.lglobus.ru> Reply-To: rover@lglobus.ru References: <19991118232846.A63288@fly.lglobus.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre3i In-Reply-To: Organization: -=/ SR 13 /=- Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu, Nov 18, 1999 at 01:19:52PM -0800, Alfred Perlstein wrote: > On Thu, 18 Nov 1999, Oleg V. Volkov wrote: > > On Thu, Nov 18, 1999 at 03:23:24PM -0500, Greg Lehey wrote: > > > >>> Is there correct way for porgram to read from it's own file? > > > >> I'm not sure I understand. What do you mean by "it's own file"? > > > >> If you mean the object file, sure. Where's the problem? > > > > I mean this situation: > > > > I have some program /usr/local/bin/someprog. Is there a way for it > > > > to read from itself (from /usr/local/bin/someprog). > > > Sure, that's what I said. What do you expect to find? > > Could you give me short example? > man 5 procfs You mean /proc//file? First, i heard this got removed in -CURRENT. And second look at this dump: 481 ktrace RET ktrace 0 481 ktrace CALL execve(0xbfbfdc9f,0xbfbfdbc4,0xbfbfdbcc) 481 ktrace NAMI "./hellow" 481 hellow RET execve 0 481 hellow CALL getpid 481 hellow RET getpid 481/0x1e1 481 hellow CALL open(0xbfbfdb64,0,0) 481 hellow NAMI "/compat/linux/proc/481/exe" 481 hellow NAMI "/proc/481/exe" 481 hellow RET open JUSTRETURN 481 hellow CALL old.lseek(0xfffffffe,0x688,0) 481 hellow RET old.lseek -1 errno -9 Unknown error: -9 481 hellow CALL exit(0x7f) Where's the error? -- Oleg V. Volkov aka Rover EH: LCM Rover Join Elite Imperial Fleet! http://www.emperorshammer.org E-mail redirector: sr-13@mail.ru (always up) -=/ SR 13 /=- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message