From 689d91008f8073da68920a0168c07f14478f875d Mon Sep 17 00:00:00 2001 From: panne Date: Thu, 25 Sep 2003 15:14:44 +0000 Subject: [PATCH] [project @ 2003-09-25 15:14:44 by panne] To fix dynamic linking issues with Hugs, access saved_termios via getter/setter. --- System/Posix/Internals.hs | 10 +++++++--- include/HsBase.h | 7 +++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/System/Posix/Internals.hs b/System/Posix/Internals.hs index ff07615..d02b02c 100644 --- a/System/Posix/Internals.hs +++ b/System/Posix/Internals.hs @@ -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 diff --git a/include/HsBase.h b/include/HsBase.h index d9ef002..cea5290 100644 --- a/include/HsBase.h +++ b/include/HsBase.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: HsBase.h,v 1.29 2003/09/24 11:06:54 simonmar Exp $ + * $Id: HsBase.h,v 1.30 2003/09/25 15:14:44 panne Exp $ * * (c) The University of Glasgow 2001-2002 * @@ -614,10 +614,9 @@ __hscore_f_setfl( void ) #endif } -#if HAVE_TERMIOS_H // defined in rts/RtsStartup.c. -extern struct termios saved_termios[]; -#endif +extern void* __hscore_get_saved_termios(int fd); +extern void __hscore_set_saved_termios(int fd, void* ts); INLINE int __hscore_hs_fileno (FILE *f) { return fileno (f); } -- 1.7.10.4