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 JW :)

> > > right after your envp. So, writing more info there would blow away
> > > your stack.
> > I can smell the next hack... memmove() the stack down to make room... :-)
> No need. You can memcpy the environment. See setenv(3),
> putenv(3) and related library routines.

I'm afraid that the best solution, well, the one which involves
less code and less problems (no need to relocate the environment or
things like that) is to write to argv[0] a shorter string that the
existing one, and overwrite with nulls the rest of arguments, just in
case the stack layout is not what expected.

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 :((

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.063 / U:1.712 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site