[Python-Dev] Pondering some changes to python.c... (original) (raw)

Sean Reifschneider jafo@tummy.com
Mon, 8 Apr 2002 17:06:57 -0600


On Tue, Apr 09, 2002 at 12🔞18AM +0200, Martin v. Loewis wrote:

That's very hacky, IMO, and something I would not like to see generally available. If you need that feature, embed Python.

Indeed. Setting it in python.c is relatively easy... That's what the patch I included did...

ps manages to find out what the arguments are, so it should be possible to find (and overwrite) them even without getting them as arguments to main().

"ps" parses /proc//cmdline to figure out what the command-line was. AFAIK, /proc//cmdline is read-only:

[root@prospero tmp]# date >/proc/$$/cmdline date: write error: Invalid argument

I'm sure it's not hard to find the memory block that argv resides at if you are a kernel module, but I suspect fewer changes are required by using the mechanism I proposed earlier. ;-)

Sean

You know you're in Canada when: The weather reports starts with "All temperatures are degrees below zero unless otherwise stated." Sean Reifschneider, Inimitably Superfluous <jafo@tummy.com> tummy.com - Linux Consulting since 1995. Qmail, KRUD, Firewalls, Python