Subject: setproctitle() and PS_STRINGS
To: None <netbsd-ports@NetBSD.ORG>
From: Mike Hibler <>
List: netbsd-ports
Date: 10/24/1995 21:19:33
With the Lites single-server on top of Mach on an x86 there is a problem
providing compatibility with the NetBSD setproctitle() library routine.
This is because that routine dereferences PS_STRINGS which resolves to an
absolute address (0xf7bfe000) and that address is not mapped into the user
address space in Mach/Lites.  Thus an application like ftpd will crash
with a bad memory reference when it tries to setproctitle().

While technically this is a bug with Mach and Lites I would like to suggest
that using an absolute address here is a Bad Thing.  You lock yourself into
a fixed stack address and create potential binary compatibility problems
between machines of the same architecture (e.g., the 68k machines) which
may not locate thier stacks identically.

I'm not sure what the best alternative is.  One possibility is to compute
the location at startup time based on the initial SP value and store that
in some magic variable (ala "environ").  Urk!

...or you could use a syscall to get the location.  Blech!

...or you could heuristically determine its value based on the current SP
value or some other known value (e.g., environ).  Gag!