Read-only literal strings (was Re: Problem with xstr)

Eric Krohn krohn at u1100a.UUCP
Tue Sep 27 05:07:02 AEST 1988


In article <870 at yabbie.rmit.oz> rcodi at yabbie.rmit.oz (Ian Donaldson) writes:
] Many programs run quite happily with read-only strings, but a few
] as I have discovered, don't eg: ucb sendmail.  This is because
] it passes a literal string to a routine that expects a buffer it
] can write in. 

On Unisys' flavor of SVR2 (called SX 1100), I tried the readonly strings
option when building ksh, and found that ksh got very upset.  It turned out
that one of the strings placed into the text segment was "." and when ksh
passed that to stat(2) in determining the current directory, the SX kernel
said EFAULT.  Namei checked to make sure the string was a legal *data* address.
Since SX 1100 only (!) provides 500KBytes of data space, I was quite interested
in conserving data space.

Moral: It's not just ill-behaved user programs that dislike this method of
obtaining readonly strings.
-- 
--
Eric J. Krohn
krohn at ctt.ctt.bellcore.com  or  {bcr,bellcore}!u1100a!krohn
Bell Communications Research,	444 Hoes Ln,    Piscataway, NJ 08854



More information about the Comp.unix.wizards mailing list