From: sof Date: Sat, 8 Aug 1998 00:35:16 +0000 (+0000) Subject: [project @ 1998-08-08 00:35:16 by sof] X-Git-Tag: Approx_2487_patches~473 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=04428e3aa015943bef26ce36fd02c94f20e476ef;p=ghc-hetmet.git [project @ 1998-08-08 00:35:16 by sof] getEnvironment: embedding a global variable inside a lit-lit causes it to be read just once. --- diff --git a/ghc/lib/posix/PosixProcPrim.lhs b/ghc/lib/posix/PosixProcPrim.lhs index d8c1a91..5db43b6 100644 --- a/ghc/lib/posix/PosixProcPrim.lhs +++ b/ghc/lib/posix/PosixProcPrim.lhs @@ -14,7 +14,9 @@ module PosixProcPrim ( ProcessStatus(..), addSignal, +#ifndef cygwin32_TARGET_OS awaitSignal, +#endif backgroundRead, backgroundWrite, blockSignals, @@ -183,7 +185,13 @@ exitImmediately exitcode = do getEnvironment :: IO [(String, String)] getEnvironment = do - env <- unvectorize ``environ'' 0 + --WAS: env <- unvectorize ``environ'' 0 + -- does not work too well, since the lit-lit + -- is turned into an Addr that is only evaluated + -- once (environ is changed to point the most + -- current env. block after the addition of new entries). + envp <- _casm_ `` %r=environ; '' + env <- unvectorize (envp::Addr) 0 return (map (split "") env) where split :: String -> String -> (String, String) @@ -431,6 +439,7 @@ getPendingSignals = do then freeze bytes else syserr "getPendingSignals" +#ifndef cygwin32_TARGET_OS awaitSignal :: Maybe SignalSet -> IO () awaitSignal maybe_sigset = do pause maybe_sigset @@ -438,13 +447,13 @@ awaitSignal maybe_sigset = do if err == interruptedOperation then return () else syserr "awaitSignal" --- where pause :: Maybe SignalSet -> IO () pause maybe_sigset = case maybe_sigset of Nothing -> _casm_ ``(void) pause();'' Just sigset -> _casm_ ``(void) sigsuspend((sigset_t *)%0);'' sigset +#endif scheduleAlarm :: Int -> IO Int scheduleAlarm (I# secs#) =