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

From: Jamie Lokier (lk@tantalophile.demon.co.uk)
Date: Mon Mar 06 2000 - 19:57:06 EST


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?

> > 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. There is no dubious overwriting of argument or
environment string space, and no dubious limits are assumed or broken.

> 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.

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.

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";'.

-- Jamie

-
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