Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!bellcore!u1100a!krohn From: krohn@u1100a.UUCP (Eric Krohn) Newsgroups: comp.unix.wizards Subject: Re: Read-only literal strings (was Re: Problem with xstr) Message-ID: <2127@u1100a.UUCP> Date: 26 Sep 88 19:07:02 GMT References: <145@taux02.UUCP> <870@yabbie.rmit.oz> Reply-To: krohn@u1100a.UUCP (Eric Krohn) Organization: Bell Communications Research, Piscataway, NJ Lines: 21 In article <870@yabbie.rmit.oz> rcodi@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@ctt.ctt.bellcore.com or {bcr,bellcore}!u1100a!krohn Bell Communications Research, 444 Hoes Ln, Piscataway, NJ 08854