From 7e1b52efc62b9fd6e2fee8f317b6a404a1933a11 Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Fri, 7 Aug 2009 20:06:31 +0000 Subject: [PATCH] Add some more C wrappers; patch from Krister Walfridsson Fixes 21 testsuite errors on NetBSD 5.99. --- GHC/Conc.lhs | 2 +- System/Posix/Internals.hs | 2 +- include/HsBase.h | 9 +++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/GHC/Conc.lhs b/GHC/Conc.lhs index e3f5356..b68cd63 100644 --- a/GHC/Conc.lhs +++ b/GHC/Conc.lhs @@ -1251,7 +1251,7 @@ foreign import ccall unsafe "setTimevalTicks" data CFdSet -foreign import ccall safe "select" +foreign import ccall safe "__hscore_select" c_select :: CInt -> Ptr CFdSet -> Ptr CFdSet -> Ptr CFdSet -> Ptr CTimeVal -> IO CInt diff --git a/System/Posix/Internals.hs b/System/Posix/Internals.hs index ca0253e..126f753 100644 --- a/System/Posix/Internals.hs +++ b/System/Posix/Internals.hs @@ -457,7 +457,7 @@ foreign import ccall unsafe "HsBase.h tcgetattr" foreign import ccall unsafe "HsBase.h tcsetattr" c_tcsetattr :: CInt -> CInt -> Ptr CTermios -> IO CInt -foreign import ccall unsafe "HsBase.h utime" +foreign import ccall unsafe "HsBase.h __hscore_utime" c_utime :: CString -> Ptr CUtimbuf -> IO CInt foreign import ccall unsafe "HsBase.h waitpid" diff --git a/include/HsBase.h b/include/HsBase.h index 56a660e..9bc5f28 100644 --- a/include/HsBase.h +++ b/include/HsBase.h @@ -201,6 +201,10 @@ __hscore_sigdelset( sigset_t * set, int s ) INLINE int __hscore_sigismember( sigset_t * set, int s ) { return sigismember(set,s); } + +INLINE int +__hscore_utime( const char *file, const struct utimbuf *timep ) +{ return utime(file,timep); } #endif // This is used by dph:Data.Array.Parallel.Arr.BUArr, and shouldn't be @@ -620,6 +624,11 @@ INLINE HsInt sizeof_fd_set(void) { return sizeof(fd_set); } extern void hsFD_ZERO(fd_set *fds); #endif +INLINE int __hscore_select(int nfds, fd_set *readfds, fd_set *writefds, + fd_set *exceptfds, struct timeval *timeout) { + return (select(nfds,readfds,writefds,exceptfds,timeout)); +} + // gettimeofday()-related #if !defined(__MINGW32__) -- 1.7.10.4