public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* RE: argv0 revisited...
@ 2003-01-15 18:22 Perez-Gonzalez, Inaky
  2003-01-15 18:44 ` DervishD
  0 siblings, 1 reply; 14+ messages in thread
From: Perez-Gonzalez, Inaky @ 2003-01-15 18:22 UTC (permalink / raw)
  To: 'DervishD', Linux-kernel


>     How can I know, more or less portably, which is the name of the
> disk binary corresponding to my core image? Since 'proc' is not
> mounted at this time, I cannot consult my mappings not my 'exe'
> link. Since this init is run as root, any that root can do is
> welcome. Although I would like a portable solution, any solution that
> works under *any* Linux kernel is welcome...

What about mounting /proc from inside your program? Not a big deal, easy
sollution ... 

Inaky Perez-Gonzalez -- Not speaking for Intel - opinions are my own [or my
fault]


^ permalink raw reply	[flat|nested] 14+ messages in thread
* RE: argv0 revisited...
@ 2003-01-15 18:51 Perez-Gonzalez, Inaky
  2003-01-15 19:19 ` DervishD
  0 siblings, 1 reply; 14+ messages in thread
From: Perez-Gonzalez, Inaky @ 2003-01-15 18:51 UTC (permalink / raw)
  To: 'DervishD'; +Cc: Linux-kernel

> > > welcome. Although I would like a portable solution, any 
> solution that
> > > works under *any* Linux kernel is welcome...
> > What about mounting /proc from inside your program? Not a 
> big deal, easy
> > sollution ... 
> 
>     I don't like it, because it should happen at the very beginning
> of init. Remember, is not any program, is an init. Should be a more
> clean way, I suppose :??

I don't think is that big a deal ... if you startup the system normally,
sooner or later, /proc is going to be mounted. A [quickie] variation is:

mount()
get the info from /proc/self/whatever
umount()

Is simple, is clean and has no side effects; the code is pretty small, btw

Inaky Perez-Gonzalez -- Not speaking for Intel - opinions are my own [or my
fault]



^ permalink raw reply	[flat|nested] 14+ messages in thread
* argv0 revisited...
@ 2003-01-15 18:17 DervishD
  0 siblings, 0 replies; 14+ messages in thread
From: DervishD @ 2003-01-15 18:17 UTC (permalink / raw)
  To: Linux-kernel

    Hi all :))

    Finally, with a suitable solution at hand, I notice that the
kernel does just what I wanted to do, that is, overwriting the
argv[0]. The matter is that when executing the init process, the
kernel substitutes the program name, the true argv0, with the string
'init' :(( That is, I'm not able to exec'ing myself again, because I
no longer know what is the binary name!

    How can I know, more or less portably, which is the name of the
disk binary corresponding to my core image? Since 'proc' is not
mounted at this time, I cannot consult my mappings not my 'exe'
link. Since this init is run as root, any that root can do is
welcome. Although I would like a portable solution, any solution that
works under *any* Linux kernel is welcome...

    BTW, is the argv0 mangling for 'init' mandatory or POSIX or
standard or...?

    Thanks a lot :)

    Raúl

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2003-01-17 11:12 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-15 18:22 argv0 revisited Perez-Gonzalez, Inaky
2003-01-15 18:44 ` DervishD
2003-01-16 11:04   ` Horst von Brand
2003-01-16 11:27     ` DervishD
2003-01-17 10:51       ` Rogier Wolff
2003-01-17 11:20         ` DervishD
     [not found]       ` <200301161603.h0GG3DX0001895@eeyore.valparaiso.cl>
2003-01-17 10:58         ` DervishD
  -- strict thread matches above, loose matches on Subject: below --
2003-01-15 18:51 Perez-Gonzalez, Inaky
2003-01-15 19:19 ` DervishD
2003-01-15 19:46   ` Miquel van Smoorenburg
2003-01-15 20:22     ` DervishD
2003-01-16 14:59     ` Jakob Oestergaard
2003-01-17 10:55       ` DervishD
2003-01-15 18:17 DervishD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox