linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Changing argv[0] under Linux.
@ 2003-01-14 18:59 DervishD
  2003-01-14 19:10 ` Richard B. Johnson
  2003-01-27  7:47 ` Anuradha Ratnaweera
  0 siblings, 2 replies; 43+ messages in thread
From: DervishD @ 2003-01-14 18:59 UTC (permalink / raw)
  To: Linux-kernel

    Hi all :))

    I'm not sure whether this issue belongs to the kernel or to the
libc, but I think that is more on the kernel side, that's why I ask
here.

    Let's go to the matter: I want to change the argv[0] a program
shows, in order to be pretty-printed when issuing 'ps', 'top' or
other commands. What I'm doing now is just writing over the existing
argv[0] string, but then I must use a *shorter-or-equal* string in
order to fit it on the existing space. What if I need to put a
*larger* string on argv[0]? Is this possible at all?

    Thanks in advance :)
    Raúl

^ permalink raw reply	[flat|nested] 43+ messages in thread
[parent not found: <122203493@toto.iv>]
* Re: Changing argv[0] under Linux.
@ 2003-01-16 10:12 Jon Burgess
  2003-01-16 10:32 ` DervishD
  0 siblings, 1 reply; 43+ messages in thread
From: Jon Burgess @ 2003-01-16 10:12 UTC (permalink / raw)
  To: linux-kernel; +Cc: raul



> Any suggestion on how to get the binary name from the core image?

How about:

exec("/proc/self/exe", ...)

I found something like this handy when writing an self extracting compressed
executable a while ago.

     Jon



^ permalink raw reply	[flat|nested] 43+ messages in thread
* Re: Changing argv[0] under Linux.
@ 2003-01-16 11:31 Jon Burgess
  2003-01-16 12:58 ` DervishD
  0 siblings, 1 reply; 43+ messages in thread
From: Jon Burgess @ 2003-01-16 11:31 UTC (permalink / raw)
  To: DervishD; +Cc: linux-kernel



Raúl wrote:
>     That's good, but I would like to avoid to mount procfs:
> what if the mount point '/proc' doesn't exist?
> If you create it, you must mount root rw and remount ro
> again,

Surely that is an admin problem to make sure that /mount
exists on the root fs. When your messing with something as
fundamental as init you should be able to insist on this.

It is easy to do a mount() system call, the rootfs can be ro.

> What if /proc/self/exe is not part form procfs,
> but from some evil user ;))

Would the user not need root privilegdes to mess with /proc?
Is there any good reason why init should not be executable
by root only?

     Jon



^ permalink raw reply	[flat|nested] 43+ messages in thread
[parent not found: <20030116130013.GE1358@DervishD>]

end of thread, other threads:[~2003-01-27  7:38 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-14 18:59 Changing argv[0] under Linux DervishD
2003-01-14 19:10 ` Richard B. Johnson
2003-01-14 19:14   ` DervishD
2003-01-14 19:43     ` Richard B. Johnson
2003-01-14 19:50       ` DervishD
2003-01-14 19:56         ` Richard B. Johnson
2003-01-14 20:23           ` Mark Mielke
2003-01-14 20:28             ` Richard B. Johnson
2003-01-14 21:21               ` Mark Mielke
2003-01-15 14:00                 ` Richard B. Johnson
2003-01-15 16:43                 ` Richard B. Johnson
2003-01-15 16:57                   ` DervishD
2003-01-14 22:00             ` DervishD
2003-01-21 14:16     ` Bill Davidsen
2003-01-21 15:33       ` DervishD
2003-01-14 20:25   ` Philippe Troin
2003-01-14 20:56     ` Richard B. Johnson
2003-01-14 22:04     ` DervishD
2003-01-14 23:04       ` Bob Miller
2003-01-14 23:11         ` Bob Miller
2003-01-15  4:46           ` Mark Mielke
2003-01-15  8:25             ` jw schultz
2003-01-15 11:41               ` DervishD
2003-01-15 13:16                 ` Jakob Oestergaard
2003-01-15 16:22                   ` DervishD
2003-01-15 16:47                     ` Jakob Oestergaard
2003-01-15 17:10                       ` DervishD
2003-01-15 17:36                         ` Changing argv[0] under Linux. This MUST work DervishD
2003-01-15 21:26                       ` Changing argv[0] under Linux Andreas Schwab
2003-01-15 21:36                         ` Jesse Pollard
2003-01-15 22:03                         ` DervishD
2003-01-16  9:19                           ` Dorin Lazar
2003-01-15 11:35         ` DervishD
2003-01-14 21:55   ` Miquel van Smoorenburg
2003-01-14 22:04     ` Valdis.Kletnieks
2003-01-15 11:28     ` DervishD
2003-01-27  7:47 ` Anuradha Ratnaweera
     [not found] <122203493@toto.iv>
2003-01-14 22:55 ` Peter Chubb
2003-01-16 10:12 Jon Burgess
2003-01-16 10:32 ` DervishD
2003-01-16 11:31 Jon Burgess
2003-01-16 12:58 ` DervishD
     [not found] <20030116130013.GE1358@DervishD>
     [not found] ` <200301161315.h0GDFLM27487@isengard.accucard.com>
2003-01-17 10:08   ` DervishD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).