Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Nov 1999 00:30:15 +0300
From:      "Oleg V. Volkov" <rover@lglobus.ru>
To:        freebsd-questions@freebsd.org
Subject:   Re: Is there correct way for program to read from itself?
Message-ID:  <19991119003015.C63288@fly.lglobus.ru>
In-Reply-To: <Pine.BSF.4.05.9911181319120.12797-100000@fw.wintelcom.net>
References:  <19991118232846.A63288@fly.lglobus.ru> <Pine.BSF.4.05.9911181319120.12797-100000@fw.wintelcom.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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/<pid>/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




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