Re: If something is not stated in POSIX we should not bother even if 90%+ of Linux system out there using it ??

From: Khimenko Victor (khim@dell.sch57.msk.ru)
Date: Mon Mar 06 2000 - 20:10:54 EST


On Tue, 7 Mar 2000, Jamie Lokier wrote:

> Khimenko Victor wrote:
> > > Why do you need extra syscalls? What is wrong with procfs simply reading
> > > argv[0] and printing the string that currently points to?
> >
> > What about argvc ?
>
> argvc?
>

Oops... argc :-) argc contains exactly argc pointers. They can point to
NULL string (of course there are no way to get such argv in execve
currently :-)

> > > Then a program can implement setproctitle(3) by simply changing argv[0],
> > > and setting argv[1] to 0.
> > >
> > Yes, we can replace one hack (used in 2.2) with another one (you just
> > described) and change kernel so this second hack will work. My point is
> > simple: if we need to change kernel at all then why not implement proper
> > solution ?
>
> Because reading argv[0] is not a hack at all. The location of argv[0]
> will never change.

Are you sure ?

> There is no dubious overwriting of argument or environment string
> space, and no dubious limits are assumed or broken.
>
There just very strange limitation that program can change it's arguments
but can not change number of arguments...

> > If program want to change argument list or environment list
> > then why notallow to do exactly this ?
>
> I can't think of any reason why a program needs to change its
> environment list.
>
Hmm. Your programs are doing this all the time. sh scripts, etc.
There are even few functions to do so (even POSIX ones!!!). Of course it's
not clear how important is to know if environment is changed. But if we
should not care about environment then why there are /proc/<number>/environ
at all ???

> A clean way, IMO, is to allow a process to write() to
> /proc/self/cmdline. A syscall seems excessive -- the information is
> only visible in /proc/PID/cmdline after all.
>
On other hand if you'll allow to write in /proc/self/cmdline you need to
keep this information somewhere. Yes, this will solve problem with ftpwho.
But /proc/self/environ will still show there not actual information as
it's used by program right now but yesterday's show :-/

> But an equally clean way, one that's convenient and AFAIK actually works
> on some other operating systems is to permit a program to say `argv[0] =
> "my new name";'.
>
AFAIK this way should work with my patch as well. It's just UGLY.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Mar 07 2000 - 21:00:21 EST