unix 2.3.0.0 → 2.3.1.0
raw patch · 27 files changed
+618/−93 lines, 27 filesdep −directorynew-uploader
Dependencies removed: directory
Files
- System/Posix.hs +5/−5
- System/Posix/Directory.hsc +41/−4
- System/Posix/DynamicLinker.hsc +3/−2
- System/Posix/DynamicLinker/Module.hsc +15/−15
- System/Posix/DynamicLinker/Prim.hsc +1/−1
- System/Posix/Env.hsc +5/−4
- System/Posix/Files.hsc +9/−5
- System/Posix/IO.hsc +11/−10
- System/Posix/Process.hsc +3/−3
- System/Posix/Resource.hsc +3/−3
- System/Posix/Semaphore.hsc +1/−1
- System/Posix/SharedMem.hsc +2/−1
- System/Posix/Signals.hs +5/−3
- System/Posix/Signals/Exts.hsc +1/−1
- System/Posix/Temp.hsc +2/−2
- System/Posix/Terminal.hsc +8/−1
- System/Posix/Time.hsc +1/−1
- System/Posix/Unistd.hsc +7/−6
- System/Posix/User.hsc +17/−11
- cbits/HsUnix.c +1/−0
- cbits/execvpe.c +7/−12
- configure +393/−0
- configure.ac +17/−0
- include/HsUnix.h +39/−0
- include/HsUnixConfig.h +9/−0
- include/HsUnixConfig.h.in +9/−0
- unix.cabal +3/−2
System/Posix.hs view
@@ -70,17 +70,13 @@ Interfaces supported -------------------- -base package:--regex.h Text.Regex.Posix-signal.h System.Posix.Signals- unix package: dirent.h System.Posix.Directory dlfcn.h System.Posix.DynamicLinker errno.h Foreign.C.Error fcntl.h System.Posix.IO+signal.h System.Posix.Signals sys/stat.h System.Posix.Files sys/times.h System.Posix.Process sys/types.h System.Posix.Types (with exceptions...)@@ -94,6 +90,10 @@ stdlib.h: System.Posix.Env (getenv()/setenv()/unsetenv()) System.Posix.Temp (mkstemp()) sys/resource.h: System.Posix.Resource (get/setrlimit() only)++regex-posix package:++regex.h Text.Regex.Posix network package:
System/Posix/Directory.hsc view
@@ -1,4 +1,5 @@-{-# OPTIONS -fffi #-}+{-# LANGUAGE ForeignFunctionInterface #-}+{-# OPTIONS_GHC -fno-warn-unused-imports #-} ----------------------------------------------------------------------------- -- | -- Module : System.Posix.Files@@ -33,10 +34,11 @@ changeWorkingDirectoryFd, ) where +import System.IO.Error import System.Posix.Error import System.Posix.Types import System.Posix.Internals-import System.Directory hiding (createDirectory)+--import System.Directory hiding (createDirectory) import Foreign import Foreign.C @@ -124,12 +126,47 @@ -- | @getWorkingDirectory@ calls @getcwd@ to obtain the name -- of the current working directory. getWorkingDirectory :: IO FilePath-getWorkingDirectory = getCurrentDirectory+getWorkingDirectory = do+ p <- mallocBytes long_path_size+ go p long_path_size+ where go p bytes = do+ p' <- c_getcwd p (fromIntegral bytes)+ if p' /= nullPtr + then do s <- peekCString p'+ free p'+ return s+ else do errno <- getErrno+ if errno == eRANGE+ then do let bytes' = bytes * 2+ p'' <- reallocBytes p bytes'+ go p'' bytes'+ else throwErrno "getCurrentDirectory" +foreign import ccall unsafe "getcwd"+ c_getcwd :: Ptr CChar -> CSize -> IO (Ptr CChar)++foreign import ccall unsafe "__hsunix_long_path_size"+ long_path_size :: Int+ -- | @changeWorkingDirectory dir@ calls @chdir@ to change -- the current working directory to @dir@. changeWorkingDirectory :: FilePath -> IO ()-changeWorkingDirectory name = setCurrentDirectory name+changeWorkingDirectory path =+ modifyIOError (`ioeSetFileName` path) $+ withCString path $ \s -> + throwErrnoIfMinus1Retry_ "changeWorkingDirectory" (c_chdir s)++foreign import ccall unsafe "chdir"+ c_chdir :: CString -> IO CInt++removeDirectory :: FilePath -> IO ()+removeDirectory path =+ modifyIOError (`ioeSetFileName` path) $+ withCString path $ \s ->+ throwErrnoIfMinus1Retry_ "removeDirectory" (c_rmdir s)++foreign import ccall unsafe "rmdir"+ c_rmdir :: CString -> IO CInt changeWorkingDirectoryFd :: Fd -> IO () changeWorkingDirectoryFd (Fd fd) =
System/Posix/DynamicLinker.hsc view
@@ -74,10 +74,10 @@ throwDLErrorIf "dlsym" (== nullFunPtr) $ c_dlsym (packDL source) s withDL :: String -> [RTLDFlags] -> (DL -> IO a) -> IO a-withDL mod flags f = bracket (dlopen mod flags) (dlclose) f+withDL file flags f = bracket (dlopen file flags) (dlclose) f withDL_ :: String -> [RTLDFlags] -> (DL -> IO a) -> IO ()-withDL_ mod flags f = withDL mod flags f >> return ()+withDL_ file flags f = withDL file flags f >> return () -- |'undl' obtains the raw handle. You mustn't do something like -- @withDL mod flags $ liftM undl >>= \ p -> use p@@@ -92,4 +92,5 @@ then dlerror >>= \ err -> ioError (userError ( s ++ ": " ++ err)) else return r +throwDLErrorIf_ :: String -> (a -> Bool) -> IO a -> IO () throwDLErrorIf_ s p f = throwDLErrorIf s p f >> return ()
System/Posix/DynamicLinker/Module.hsc view
@@ -1,4 +1,4 @@-{-# OPTIONS -fffi #-}+{-# LANGUAGE ForeignFunctionInterface #-} ----------------------------------------------------------------------------- -- | -- Module : System.Posix.DynamicLinker.Module@@ -71,8 +71,8 @@ -- moduleOpen :: String -> [RTLDFlags] -> IO Module-moduleOpen mod flags = do- modPtr <- withCString mod $ \ modAddr -> c_dlopen modAddr (packRTLDFlags flags)+moduleOpen file flags = do+ modPtr <- withCString file $ \ modAddr -> c_dlopen modAddr (packRTLDFlags flags) if (modPtr == nullPtr) then moduleError >>= \ err -> ioError (userError ("dlopen: " ++ err)) else return $ Module modPtr@@ -80,12 +80,12 @@ -- Gets a symbol pointer from a module (EXPORTED) -- moduleSymbol :: Module -> String -> IO (FunPtr a)-moduleSymbol mod sym = dlsym (DLHandle (unModule mod)) sym+moduleSymbol file sym = dlsym (DLHandle (unModule file)) sym -- Closes a module (EXPORTED) -- moduleClose :: Module -> IO ()-moduleClose mod = dlclose (DLHandle (unModule mod))+moduleClose file = dlclose (DLHandle (unModule file)) -- Gets a string describing the last module error (EXPORTED) -- @@ -101,15 +101,15 @@ -> [RTLDFlags] -> (Module -> IO a) -> IO a-withModule dir mod flags p = do- let modPath = case dir of- Nothing -> mod- Just p -> p ++ if ((head (reverse p)) == '/')- then mod- else ('/':mod)- mod <- moduleOpen modPath flags- result <- p mod- moduleClose mod+withModule mdir file flags p = do+ let modPath = case mdir of+ Nothing -> file+ Just dir -> dir ++ if ((head (reverse dir)) == '/')+ then file+ else ('/':file)+ modu <- moduleOpen modPath flags+ result <- p modu+ moduleClose modu return result withModule_ :: Maybe String @@ -117,4 +117,4 @@ -> [RTLDFlags] -> (Module -> IO a) -> IO ()-withModule_ dir mod flags p = withModule dir mod flags p >>= \ _ -> return ()+withModule_ dir file flags p = withModule dir file flags p >>= \ _ -> return ()
System/Posix/DynamicLinker/Prim.hsc view
@@ -1,4 +1,4 @@-{-# OPTIONS -fffi #-}+{-# LANGUAGE ForeignFunctionInterface #-} ----------------------------------------------------------------------------- -- | -- Module : System.Posix.DynamicLinker.Prim
System/Posix/Env.hsc view
@@ -1,4 +1,4 @@-{-# OPTIONS -fffi #-}+{-# LANGUAGE ForeignFunctionInterface #-} ----------------------------------------------------------------------------- -- | -- Module : System.Posix.Env@@ -79,10 +79,11 @@ unsetEnv :: String -> IO () #ifdef HAVE_UNSETENV -unsetEnv name = withCString name c_unsetenv+unsetEnv name = withCString name $ \ s ->+ throwErrnoIfMinus1_ "unsetenv" (c_unsetenv s) -foreign import ccall unsafe "unsetenv"- c_unsetenv :: CString -> IO ()+foreign import ccall unsafe "__hsunix_unsetenv"+ c_unsetenv :: CString -> IO CInt #else unsetEnv name = putEnv (name ++ "=") #endif
System/Posix/Files.hsc view
@@ -1,4 +1,5 @@-{-# OPTIONS -fffi #-}+{-# LANGUAGE ForeignFunctionInterface #-}+{-# OPTIONS_GHC -fno-warn-unused-imports #-} ----------------------------------------------------------------------------- -- | -- Module : System.Posix.Files@@ -242,12 +243,12 @@ -- -- Note: calls @access@. fileAccess :: FilePath -> Bool -> Bool -> Bool -> IO Bool-fileAccess name read write exec = access name flags+fileAccess name readOK writeOK execOK = access name flags where flags = read_f .|. write_f .|. exec_f- read_f = if read then (#const R_OK) else 0- write_f = if write then (#const W_OK) else 0- exec_f = if exec then (#const X_OK) else 0+ read_f = if readOK then (#const R_OK) else 0+ write_f = if writeOK then (#const W_OK) else 0+ exec_f = if execOK then (#const X_OK) else 0 -- | Checks for the existence of the file. --@@ -501,6 +502,9 @@ withCString name1 $ \s1 -> withCString name2 $ \s2 -> throwErrnoPathIfMinus1_ "rename" name1 (c_rename s1 s2)++foreign import ccall unsafe "rename"+ c_rename :: CString -> CString -> IO CInt -- ----------------------------------------------------------------------------- -- chown()
System/Posix/IO.hsc view
@@ -1,4 +1,5 @@-{-# OPTIONS -fffi #-}+{-# LANGUAGE ForeignFunctionInterface #-}+{-# OPTIONS_GHC -fno-warn-unused-imports #-} ----------------------------------------------------------------------------- -- | -- Module : System.Posix.IO@@ -154,8 +155,8 @@ -> Maybe FileMode -- ^Just x => creates the file with the given modes, Nothing => the file must exist. -> OpenFileFlags -> IO Fd-openFd name how maybe_mode (OpenFileFlags append exclusive noctty- nonBlock truncate) = do+openFd name how maybe_mode (OpenFileFlags appendFlag exclusiveFlag nocttyFlag+ nonBlockFlag truncateFlag) = do withCString name $ \s -> do fd <- throwErrnoPathIfMinus1 "openFd" name (c_open s all_flags mode_w) return (Fd fd)@@ -163,11 +164,11 @@ all_flags = creat .|. flags .|. open_mode flags =- (if append then (#const O_APPEND) else 0) .|.- (if exclusive then (#const O_EXCL) else 0) .|.- (if noctty then (#const O_NOCTTY) else 0) .|.- (if nonBlock then (#const O_NONBLOCK) else 0) .|.- (if truncate then (#const O_TRUNC) else 0)+ (if appendFlag then (#const O_APPEND) else 0) .|.+ (if exclusiveFlag then (#const O_EXCL) else 0) .|.+ (if nocttyFlag then (#const O_NOCTTY) else 0) .|.+ (if nonBlockFlag then (#const O_NONBLOCK) else 0) .|.+ (if truncateFlag then (#const O_TRUNC) else 0) (creat, mode_w) = case maybe_mode of Nothing -> (0,0)@@ -256,7 +257,7 @@ where flag = case opt of CloseOnExec -> (#const F_GETFD)- other -> (#const F_GETFL)+ _ -> (#const F_GETFL) -- | May throw an exception if this is an invalid descriptor. setFdOption :: Fd -> FdOption -> Bool -> IO ()@@ -269,7 +270,7 @@ where (getflag,setflag)= case opt of CloseOnExec -> ((#const F_GETFD),(#const F_SETFD)) - other -> ((#const F_GETFL),(#const F_SETFL))+ _ -> ((#const F_GETFL),(#const F_SETFL)) opt_val = fdOption2Int opt -- -----------------------------------------------------------------------------
System/Posix/Process.hsc view
@@ -1,4 +1,4 @@-{-# OPTIONS -fffi #-}+{-# LANGUAGE ForeignFunctionInterface #-} ----------------------------------------------------------------------------- -- | -- Module : System.Posix.Process@@ -328,9 +328,9 @@ getProcessStatus :: Bool -> Bool -> ProcessID -> IO (Maybe ProcessStatus) getProcessStatus block stopped pid = alloca $ \wstatp -> do- pid <- throwErrnoIfMinus1Retry "getProcessStatus"+ pid' <- throwErrnoIfMinus1Retry "getProcessStatus" (c_waitpid pid wstatp (waitOptions block stopped))- case pid of+ case pid' of 0 -> return Nothing _ -> do ps <- decipherWaitStatus wstatp return (Just ps)
System/Posix/Resource.hsc view
@@ -1,4 +1,4 @@-{-# OPTIONS -fffi #-}+{-# LANGUAGE ForeignFunctionInterface #-} {-# OPTIONS_GHC -w #-} -- The above warning supression flag is a temporary kludge. -- While working on this module you are encouraged to remove it and fix@@ -59,10 +59,10 @@ type RLimit = () -foreign import ccall unsafe "getrlimit"+foreign import ccall unsafe "HsUnix.h __hscore_getrlimit" c_getrlimit :: CInt -> Ptr RLimit -> IO CInt -foreign import ccall unsafe "setrlimit"+foreign import ccall unsafe "HsUnix.h __hscore_setrlimit" c_setrlimit :: CInt -> Ptr RLimit -> IO CInt getResourceLimit :: Resource -> IO ResourceLimits
System/Posix/Semaphore.hsc view
@@ -1,4 +1,4 @@-{-# OPTIONS -fffi #-}+{-# LANGUAGE ForeignFunctionInterface #-} ----------------------------------------------------------------------------- -- |
@@ -1,4 +1,5 @@-{-# OPTIONS -fffi #-}+{-# LANGUAGE ForeignFunctionInterface #-}+{-# OPTIONS_GHC -fno-warn-unused-imports #-} ----------------------------------------------------------------------------- -- |
System/Posix/Signals.hs view
@@ -152,8 +152,10 @@ sigUSR1 = CONST_SIGUSR1 sigUSR2 :: CInt sigUSR2 = CONST_SIGUSR2+#if CONST_SIGPOLL != -1 sigPOLL :: CInt sigPOLL = CONST_SIGPOLL+#endif sigPROF :: CInt sigPROF = CONST_SIGPROF sigSYS :: CInt@@ -330,8 +332,8 @@ rc <- case handler of Default -> stg_sig_install int STG_SIG_DFL p_sp mask Ignore -> stg_sig_install int STG_SIG_IGN p_sp mask- Catch m -> hinstall m p_sp mask int STG_SIG_HAN- CatchOnce m -> hinstall m p_sp mask int STG_SIG_RST+ Catch m -> hinstall m p_sp mask STG_SIG_HAN+ CatchOnce m -> hinstall m p_sp mask STG_SIG_RST case rc of STG_SIG_DFL -> return Default@@ -346,7 +348,7 @@ _other -> error "internal error: System.Posix.Signals.installHandler" - hinstall m p_sp mask int reset = do+ hinstall m p_sp mask reset = do sptr <- newStablePtr m poke p_sp sptr stg_sig_install int reset p_sp mask
System/Posix/Signals/Exts.hsc view
@@ -1,4 +1,4 @@-{-# OPTIONS -fffi #-}+{-# LANGUAGE ForeignFunctionInterface #-} ----------------------------------------------------------------------------- -- | -- Module : System.Posix.Signals.Exts
System/Posix/Temp.hsc view
@@ -1,4 +1,4 @@-{-# OPTIONS -fffi #-}+{-# LANGUAGE ForeignFunctionInterface #-} ----------------------------------------------------------------------------- -- | -- Module : System.Posix.Temp@@ -61,6 +61,6 @@ c_mktemp :: CString -> IO CString #endif -foreign import ccall unsafe "mkstemp"+foreign import ccall unsafe "HsUnix.h __hscore_mkstemp" c_mkstemp :: CString -> IO CInt
System/Posix/Terminal.hsc view
@@ -1,4 +1,5 @@-{-# OPTIONS -fffi #-}+{-# LANGUAGE ForeignFunctionInterface #-}+{-# OPTIONS_GHC -fno-warn-unused-imports #-} ----------------------------------------------------------------------------- -- | -- Module : System.Posix.Terminal@@ -334,6 +335,8 @@ | B9600 | B19200 | B38400+ | B57600+ | B115200 inputSpeed :: TerminalAttributes -> BaudRate inputSpeed termios = unsafePerformIO $ do@@ -635,6 +638,8 @@ baud2Word B9600 = (#const B9600) baud2Word B19200 = (#const B19200) baud2Word B38400 = (#const B38400)+baud2Word B57600 = (#const B57600)+baud2Word B115200 = (#const B115200) -- And convert a word back to a baud rate -- We really need some cpp macros here.@@ -657,6 +662,8 @@ else if x == (#const B9600) then B9600 else if x == (#const B19200) then B19200 else if x == (#const B38400) then B38400+ else if x == (#const B57600) then B57600+ else if x == (#const B115200) then B115200 else error "unknown baud rate" -- Clear termios i_flag
System/Posix/Time.hsc view
@@ -1,4 +1,4 @@-{-# OPTIONS -fffi #-}+{-# LANGUAGE ForeignFunctionInterface #-} ----------------------------------------------------------------------------- -- | -- Module : System.Posix.Time
System/Posix/Unistd.hsc view
@@ -1,4 +1,5 @@-{-# OPTIONS -fffi #-}+{-# LANGUAGE ForeignFunctionInterface #-}+{-# OPTIONS_GHC -fno-warn-unused-imports -fno-warn-unused-binds #-} ----------------------------------------------------------------------------- -- | -- Module : System.Posix.Unistd@@ -138,7 +139,7 @@ nanosleep nsecs = do allocaBytes (#const sizeof(struct timespec)) $ \pts1 -> do allocaBytes (#const sizeof(struct timespec)) $ \pts2 -> do- let (tv_sec,tv_nsec) = nsecs `divMod` 1000000000+ let (tv_sec0, tv_nsec0) = nsecs `divMod` 1000000000 let loop tv_sec tv_nsec = do (#poke struct timespec, tv_sec) pts1 tv_sec@@ -149,11 +150,11 @@ else do errno <- getErrno if errno == eINTR then do- tv_sec <- (#peek struct timespec, tv_sec) pts2- tv_nsec <- (#peek struct timespec, tv_nsec) pts2- loop tv_sec tv_nsec+ tv_sec' <- (#peek struct timespec, tv_sec) pts2+ tv_nsec' <- (#peek struct timespec, tv_nsec) pts2+ loop tv_sec' tv_nsec' else throwErrno "nanosleep"- loop (fromIntegral tv_sec :: CTime) (fromIntegral tv_nsec :: CTime)+ loop (fromIntegral tv_sec0 :: CTime) (fromIntegral tv_nsec0 :: CTime) newtype CTimeSpec = CTimeSpec CTimeSpec
System/Posix/User.hsc view
@@ -1,4 +1,4 @@-{-# OPTIONS -fffi #-}+{-# LANGUAGE ForeignFunctionInterface #-} ----------------------------------------------------------------------------- -- | -- Module : System.Posix.User@@ -50,12 +50,12 @@ import System.Posix.Internals ( CGroup, CPasswd ) #if !defined(HAVE_GETPWNAM_R) || !defined(HAVE_GETPWUID_R) || defined(HAVE_GETPWENT) || defined(HAVE_GETGRENT)-import Control.Concurrent.MVar ( newMVar, withMVar )+import Control.Concurrent.MVar ( MVar, newMVar, withMVar ) #endif #ifdef HAVE_GETPWENT import Control.Exception #endif-#ifdef HAVE_GETGRNAM_R+#if defined(HAVE_GETGRNAM_R) || defined(HAVE_GETPWNAM_R) import Control.Monad import System.IO.Error #endif@@ -272,6 +272,7 @@ -- Also, getpwent/setpwent require a global lock since they maintain -- an internal file position pointer. #if !defined(HAVE_GETPWNAM_R) || !defined(HAVE_GETPWUID_R) || defined(HAVE_GETPWENT) || defined(HAVE_GETGRENT)+lock :: MVar () lock = unsafePerformIO $ newMVar () {-# NOINLINE lock #-} #endif@@ -314,17 +315,22 @@ getUserEntryForName name = do allocaBytes (#const sizeof(struct passwd)) $ \ppw -> allocaBytes pwBufSize $ \pbuf ->- alloca $ \ pppw -> - withCString name $ \ pstr -> do+ alloca $ \ pppw ->+ withCString name $ \ pstr -> do throwErrorIfNonZero_ "getUserEntryForName" $- c_getpwnam_r pstr ppw pbuf (fromIntegral pwBufSize) pppw- throwErrnoIfNull "getUserEntryForName" $- peekElemOff pppw 0- unpackUserEntry ppw+ c_getpwnam_r pstr ppw pbuf (fromIntegral pwBufSize) pppw+ r <- peekElemOff pppw 0+ when (r == nullPtr) $+ ioError $ flip ioeSetErrorString "no user name"+ $ mkIOError doesNotExistErrorType+ "getUserEntryForName"+ Nothing+ (Just name)+ unpackUserEntry ppw foreign import ccall unsafe "getpwnam_r"- c_getpwnam_r :: CString -> Ptr CPasswd -> - CString -> CSize -> Ptr (Ptr CPasswd) -> IO CInt+ c_getpwnam_r :: CString -> Ptr CPasswd+ -> CString -> CSize -> Ptr (Ptr CPasswd) -> IO CInt #elif HAVE_GETPWNAM getUserEntryForName name = do withCString name $ \ pstr -> do
cbits/HsUnix.c view
@@ -10,3 +10,4 @@ // Out-of-line versions of all the inline functions from HsUnix.h #define INLINE /* nothing */ #include "HsUnix.h"+
cbits/execvpe.c view
@@ -5,6 +5,10 @@ -------------------------------------------------------------------------- */ #include "execvpe.h" +#ifdef __GLASGOW_HASKELL__+#include "Rts.h"+#endif+ #if !(defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32)) /* to the end */ /* Evidently non-Posix. */@@ -158,18 +162,9 @@ /* Copied verbatim from ghc/lib/std/cbits/system.c. */ void pPrPr_disableITimers (void) {-# ifdef HAVE_SETITIMER- /* Reset the itimers in the child, so it doesn't get plagued- * by SIGVTALRM interrupts.- */- struct timeval tv_null = { 0, 0 };- struct itimerval itv;- itv.it_interval = tv_null;- itv.it_value = tv_null;- setitimer(ITIMER_REAL, &itv, NULL);- setitimer(ITIMER_VIRTUAL, &itv, NULL);- setitimer(ITIMER_PROF, &itv, NULL);-# endif+#ifdef __GLASGOW_HASKELL__+ stopTimer();+#endif } #endif
configure view
@@ -1243,6 +1243,11 @@ esac cat <<\_ACEOF +Optional Features:+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]+ --disable-largefile omit support for large files+ Some influential environment variables: CC C compiler command CFLAGS C compiler flags@@ -3494,13 +3499,364 @@ fi +# Check whether --enable-largefile was given.+if test "${enable_largefile+set}" = set; then+ enableval=$enable_largefile;+fi +if test "$enable_largefile" != no; then + { echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5+echo $ECHO_N "checking for special C compiler options needed for large files... $ECHO_C" >&6; }+if test "${ac_cv_sys_largefile_CC+set}" = set; then+ echo $ECHO_N "(cached) $ECHO_C" >&6+else+ ac_cv_sys_largefile_CC=no+ if test "$GCC" != yes; then+ ac_save_CC=$CC+ while :; do+ # IRIX 6.2 and later do not support large files by default,+ # so use the C compiler's -n32 option if that helps.+ cat >conftest.$ac_ext <<_ACEOF+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */+#include <sys/types.h>+ /* Check that off_t can represent 2**63 - 1 correctly.+ We can't simply define LARGE_OFF_T to be 9223372036854775807,+ since some C++ compilers masquerading as C compilers+ incorrectly reject 9223372036854775807. */+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721+ && LARGE_OFF_T % 2147483647 == 1)+ ? 1 : -1];+int+main ()+{ + ;+ return 0;+}+_ACEOF+ rm -f conftest.$ac_objext+if { (ac_try="$ac_compile"+case "(($ac_try" in+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;+ *) ac_try_echo=$ac_try;;+esac+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5+ (eval "$ac_compile") 2>conftest.er1+ ac_status=$?+ grep -v '^ *+' conftest.er1 >conftest.err+ rm -f conftest.er1+ cat conftest.err >&5+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } && {+ test -z "$ac_c_werror_flag" ||+ test ! -s conftest.err+ } && test -s conftest.$ac_objext; then+ break+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5 +fi +rm -f core conftest.err conftest.$ac_objext+ CC="$CC -n32"+ rm -f conftest.$ac_objext+if { (ac_try="$ac_compile"+case "(($ac_try" in+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;+ *) ac_try_echo=$ac_try;;+esac+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5+ (eval "$ac_compile") 2>conftest.er1+ ac_status=$?+ grep -v '^ *+' conftest.er1 >conftest.err+ rm -f conftest.er1+ cat conftest.err >&5+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } && {+ test -z "$ac_c_werror_flag" ||+ test ! -s conftest.err+ } && test -s conftest.$ac_objext; then+ ac_cv_sys_largefile_CC=' -n32'; break+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5 ++fi++rm -f core conftest.err conftest.$ac_objext+ break+ done+ CC=$ac_save_CC+ rm -f conftest.$ac_ext+ fi+fi+{ echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CC" >&5+echo "${ECHO_T}$ac_cv_sys_largefile_CC" >&6; }+ if test "$ac_cv_sys_largefile_CC" != no; then+ CC=$CC$ac_cv_sys_largefile_CC+ fi++ { echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5+echo $ECHO_N "checking for _FILE_OFFSET_BITS value needed for large files... $ECHO_C" >&6; }+if test "${ac_cv_sys_file_offset_bits+set}" = set; then+ echo $ECHO_N "(cached) $ECHO_C" >&6+else+ while :; do+ cat >conftest.$ac_ext <<_ACEOF+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */+#include <sys/types.h>+ /* Check that off_t can represent 2**63 - 1 correctly.+ We can't simply define LARGE_OFF_T to be 9223372036854775807,+ since some C++ compilers masquerading as C compilers+ incorrectly reject 9223372036854775807. */+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721+ && LARGE_OFF_T % 2147483647 == 1)+ ? 1 : -1];+int+main ()+{++ ;+ return 0;+}+_ACEOF+rm -f conftest.$ac_objext+if { (ac_try="$ac_compile"+case "(($ac_try" in+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;+ *) ac_try_echo=$ac_try;;+esac+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5+ (eval "$ac_compile") 2>conftest.er1+ ac_status=$?+ grep -v '^ *+' conftest.er1 >conftest.err+ rm -f conftest.er1+ cat conftest.err >&5+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } && {+ test -z "$ac_c_werror_flag" ||+ test ! -s conftest.err+ } && test -s conftest.$ac_objext; then+ ac_cv_sys_file_offset_bits=no; break+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5+++fi++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext+ cat >conftest.$ac_ext <<_ACEOF+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */+#define _FILE_OFFSET_BITS 64+#include <sys/types.h>+ /* Check that off_t can represent 2**63 - 1 correctly.+ We can't simply define LARGE_OFF_T to be 9223372036854775807,+ since some C++ compilers masquerading as C compilers+ incorrectly reject 9223372036854775807. */+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721+ && LARGE_OFF_T % 2147483647 == 1)+ ? 1 : -1];+int+main ()+{++ ;+ return 0;+}+_ACEOF+rm -f conftest.$ac_objext+if { (ac_try="$ac_compile"+case "(($ac_try" in+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;+ *) ac_try_echo=$ac_try;;+esac+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5+ (eval "$ac_compile") 2>conftest.er1+ ac_status=$?+ grep -v '^ *+' conftest.er1 >conftest.err+ rm -f conftest.er1+ cat conftest.err >&5+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } && {+ test -z "$ac_c_werror_flag" ||+ test ! -s conftest.err+ } && test -s conftest.$ac_objext; then+ ac_cv_sys_file_offset_bits=64; break+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5+++fi++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext+ ac_cv_sys_file_offset_bits=unknown+ break+done+fi+{ echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5+echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6; }+case $ac_cv_sys_file_offset_bits in #(+ no | unknown) ;;+ *)+cat >>confdefs.h <<_ACEOF+#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits+_ACEOF+;;+esac+rm -f conftest*+ if test $ac_cv_sys_file_offset_bits = unknown; then+ { echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5+echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6; }+if test "${ac_cv_sys_large_files+set}" = set; then+ echo $ECHO_N "(cached) $ECHO_C" >&6+else+ while :; do+ cat >conftest.$ac_ext <<_ACEOF+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */+#include <sys/types.h>+ /* Check that off_t can represent 2**63 - 1 correctly.+ We can't simply define LARGE_OFF_T to be 9223372036854775807,+ since some C++ compilers masquerading as C compilers+ incorrectly reject 9223372036854775807. */+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721+ && LARGE_OFF_T % 2147483647 == 1)+ ? 1 : -1];+int+main ()+{++ ;+ return 0;+}+_ACEOF+rm -f conftest.$ac_objext+if { (ac_try="$ac_compile"+case "(($ac_try" in+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;+ *) ac_try_echo=$ac_try;;+esac+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5+ (eval "$ac_compile") 2>conftest.er1+ ac_status=$?+ grep -v '^ *+' conftest.er1 >conftest.err+ rm -f conftest.er1+ cat conftest.err >&5+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } && {+ test -z "$ac_c_werror_flag" ||+ test ! -s conftest.err+ } && test -s conftest.$ac_objext; then+ ac_cv_sys_large_files=no; break+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5+++fi++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext+ cat >conftest.$ac_ext <<_ACEOF+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */+#define _LARGE_FILES 1+#include <sys/types.h>+ /* Check that off_t can represent 2**63 - 1 correctly.+ We can't simply define LARGE_OFF_T to be 9223372036854775807,+ since some C++ compilers masquerading as C compilers+ incorrectly reject 9223372036854775807. */+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721+ && LARGE_OFF_T % 2147483647 == 1)+ ? 1 : -1];+int+main ()+{++ ;+ return 0;+}+_ACEOF+rm -f conftest.$ac_objext+if { (ac_try="$ac_compile"+case "(($ac_try" in+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;+ *) ac_try_echo=$ac_try;;+esac+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5+ (eval "$ac_compile") 2>conftest.er1+ ac_status=$?+ grep -v '^ *+' conftest.er1 >conftest.err+ rm -f conftest.er1+ cat conftest.err >&5+ echo "$as_me:$LINENO: \$? = $ac_status" >&5+ (exit $ac_status); } && {+ test -z "$ac_c_werror_flag" ||+ test ! -s conftest.err+ } && test -s conftest.$ac_objext; then+ ac_cv_sys_large_files=1; break+else+ echo "$as_me: failed program was:" >&5+sed 's/^/| /' conftest.$ac_ext >&5+++fi++rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext+ ac_cv_sys_large_files=unknown+ break+done+fi+{ echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5+echo "${ECHO_T}$ac_cv_sys_large_files" >&6; }+case $ac_cv_sys_large_files in #(+ no | unknown) ;;+ *)+cat >>confdefs.h <<_ACEOF+#define _LARGE_FILES $ac_cv_sys_large_files+_ACEOF+;;+esac+rm -f conftest*+ fi+fi+++++++++ for ac_header in dirent.h fcntl.h grp.h limits.h pwd.h signal.h string.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`@@ -5384,6 +5740,43 @@ cat >>confdefs.h <<\_ACEOF #define USLEEP_RETURNS_VOID 1+_ACEOF++ ;;+esac++### POSIX.1003.1 unsetenv returns 0 or -1 (EINVAL), but older implementations+### in common use return void.+{ echo "$as_me:$LINENO: checking return type of unsetenv" >&5+echo $ECHO_N "checking return type of unsetenv... $ECHO_C" >&6; }+if test "${cv_func_unsetenv_return_type+set}" = set; then+ echo $ECHO_N "(cached) $ECHO_C" >&6+else+ cat >conftest.$ac_ext <<_ACEOF+/* confdefs.h. */+_ACEOF+cat confdefs.h >>conftest.$ac_ext+cat >>conftest.$ac_ext <<_ACEOF+/* end confdefs.h. */+#include </usr/include/stdlib.h>++_ACEOF+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |+ $EGREP "void[ ]+unsetenv" >/dev/null 2>&1; then+ cv_func_unsetenv_return_type=void+else+ cv_func_unsetenv_return_type=int+fi+rm -f conftest*++fi+{ echo "$as_me:$LINENO: result: $cv_func_unsetenv_return_type" >&5+echo "${ECHO_T}$cv_func_unsetenv_return_type" >&6; }+case "$cv_func_unsetenv_return_type" in+ "void" )++cat >>confdefs.h <<\_ACEOF+#define UNSETENV_RETURNS_VOID 1 _ACEOF ;;
configure.ac view
@@ -11,6 +11,10 @@ AC_C_CONST +dnl ** Enable large file support. NB. do this before testing the type of+dnl off_t, because it will affect the result of that test.+AC_SYS_LARGEFILE+ AC_CHECK_HEADERS([dirent.h fcntl.h grp.h limits.h pwd.h signal.h string.h]) AC_CHECK_HEADERS([sys/resource.h sys/stat.h sys/times.h sys/time.h]) AC_CHECK_HEADERS([sys/utsname.h sys/wait.h])@@ -68,6 +72,19 @@ case "$cv_func_usleep_return_type" in "void" ) AC_DEFINE([USLEEP_RETURNS_VOID], [1], [Define if the system headers declare usleep to return void.])+ ;;+esac++### POSIX.1003.1 unsetenv returns 0 or -1 (EINVAL), but older implementations+### in common use return void.+AC_CACHE_CHECK([return type of unsetenv], cv_func_unsetenv_return_type,+ [AC_EGREP_HEADER(changequote(<, >)<void[ ]+unsetenv>changequote([, ]),+ /usr/include/stdlib.h,+ [cv_func_unsetenv_return_type=void],+ [cv_func_unsetenv_return_type=int])])+case "$cv_func_unsetenv_return_type" in+ "void" )+ AC_DEFINE([UNSETENV_RETURNS_VOID], [1], [Define if stdlib.h declares unsetenv to return void.]) ;; esac
include/HsUnix.h view
@@ -10,6 +10,7 @@ #define HSUNIX_H #include "HsUnixConfig.h"+#include "HsFFI.h" /* ultra-evil... */ #undef PACKAGE_BUGREPORT@@ -171,6 +172,44 @@ return ioctl(fd, I_PUSH, module); #else return 0;+#endif+}++#if !defined(__MINGW32__)+INLINE int __hscore_mkstemp(char *filetemplate) {+ return (mkstemp(filetemplate));+}+#endif++#if !defined(__MINGW32__) && !defined(irix_HOST_OS)+INLINE int __hscore_getrlimit(int resource, struct rlimit *rlim) {+ return (getrlimit(resource, rlim));+}++INLINE int __hscore_setrlimit(int resource, struct rlimit *rlim) {+ return (setrlimit(resource, rlim));+}+#endif++INLINE int __hsunix_unsetenv(const char *name)+{+#ifdef UNSETENV_RETURNS_VOID+ unsetenv(name);+ return 0;+#else+ return unsetenv(name);+#endif+}++/* A size that will contain many path names, but not necessarily all+ * (PATH_MAX is not defined on systems with unlimited path length,+ * e.g. the Hurd).+ */+INLINE HsInt __hsunix_long_path_size() {+#ifdef PATH_MAX+ return PATH_MAX;+#else+ return 4096; #endif }
include/HsUnixConfig.h view
@@ -271,8 +271,17 @@ /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 +/* Define if stdlib.h declares unsetenv to return void. */+/* #undef UNSETENV_RETURNS_VOID */+ /* Define if the system headers declare usleep to return void. */ /* #undef USLEEP_RETURNS_VOID */++/* Number of bits in a file offset, on hosts where this is settable. */+/* #undef _FILE_OFFSET_BITS */++/* Define for large files, on AIX-style hosts. */+/* #undef _LARGE_FILES */ /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */
include/HsUnixConfig.h.in view
@@ -270,8 +270,17 @@ /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS +/* Define if stdlib.h declares unsetenv to return void. */+#undef UNSETENV_RETURNS_VOID+ /* Define if the system headers declare usleep to return void. */ #undef USLEEP_RETURNS_VOID++/* Number of bits in a file offset, on hosts where this is settable. */+#undef _FILE_OFFSET_BITS++/* Define for large files, on AIX-style hosts. */+#undef _LARGE_FILES /* Define to empty if `const' does not conform to ANSI C. */ #undef const
unix.cabal view
@@ -1,9 +1,10 @@ name: unix-version: 2.3.0.0+version: 2.3.1.0 license: BSD3 license-file: LICENSE maintainer: libraries@haskell.org synopsis: POSIX functionality+category: System description: This package gives you access to the set of operating system services standardised by POSIX 1003.1b (or the IEEE Portable@@ -41,7 +42,7 @@ extra-tmp-files: config.log config.status autom4te.cache unix.buildinfo include/HsUnixConfig.h-build-depends: base, directory+build-depends: base extensions: CPP, ForeignFunctionInterface include-dirs: include includes: HsUnix.h execvpe.h