[project @ 2003-09-25 15:14:44 by panne]
[haskell-directory.git] / System / Posix / Internals.hs
index ff07615..d02b02c 100644 (file)
@@ -213,11 +213,11 @@ tcSetAttr fd fun = do
        -- Save a copy of termios, if this is a standard file descriptor.
        -- These terminal settings are restored in hs_exit().
        when (fd <= 2) $ do
-         p <- peekElemOff saved_termios fd
+         p <- get_saved_termios fd
          when (p == nullPtr) $ do
             saved_tios <- mallocBytes sizeof_termios
             copyBytes saved_tios p_tios sizeof_termios
-            pokeElemOff saved_termios fd saved_tios
+            set_saved_termios fd saved_tios
 
        -- tcsetattr() when invoked by a background process causes the process
        -- to be sent SIGTTOU regardless of whether the process has TOSTOP set
@@ -235,7 +235,11 @@ tcSetAttr fd fun = do
             c_sigprocmask const_sig_setmask p_old_sigset nullPtr
             return r
 
-foreign import ccall "&saved_termios" saved_termios :: Ptr (Ptr CTermios)
+foreign import ccall unsafe "HsBase.h __hscore_get_saved_termios"
+   get_saved_termios :: Int -> IO (Ptr CTermios)
+
+foreign import ccall unsafe "HsBase.h __hscore_set_saved_termios"
+   set_saved_termios :: Int -> (Ptr CTermios) -> IO ()
 
 #else