Re: Changing argv[0] under Linux.

From: DervishD (raul@pleyades.net)
Date: Wed Jan 15 2003 - 11:22:19 EST


    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/



This archive was generated by hypermail 2b29 : Wed Jan 15 2003 - 22:00:54 EST