lkml.org 
[lkml]   [2003]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Changing argv[0] under Linux.
    Hi Jakob :)

> > Really, I'm thinking seriously about not rewritting argv[0] at
> > all. The problem is that may confuse the user when issuing 'ps' or
> > looking at /proc :((
> What about
[...]

Mmm, interesting idea. A simpler solution is just copy the needed
argv0. In your example, about 500 bytes are wasted ;))) By using the
needed size at argv0, we have the space needed.

If execv doesn't do any magic with the supplied argv array, then
this should work.

> For the same effect without the --very-magic argument, you could simply
> do an "if (argc != 2 || strlen(argv[0]) != 511)" instead.

No, because the len of argv[0] being 'my proggy' is 9, that is not
511 ;)) We cannot tell the allocated space, I'm afraid O:)

> Am I smoking crack, or could the above work?

I should smoke crack, definitely. That way I would not mess with
that argv thing XDDDD

Thanks :)
Raúl
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:32    [W:0.069 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site