diff options
author | wolfgang <unknown> | 2002-10-08 08:03:02 +0000 |
---|---|---|
committer | wolfgang <unknown> | 2002-10-08 08:03:02 +0000 |
commit | 1af096d3e286498e531ecb0542bd26997ab5fe06 (patch) | |
tree | d1e9b3fc0081cc7dceddee091788f8ba0003451d | |
parent | d637529b092d9b81dd5518c11662e7971716f9f8 (diff) |
[project @ 2002-10-08 08:03:02 by wolfgang]
Make the new Posix bindings compile on Mac OS X.
Most notable, Mac OS X lacks
*) lchown
*) SIGPOLL
I don't know of a replacement of either, so they are just left out when
they are not detected by configure.
-rw-r--r-- | System/Posix/Files.hsc | 7 | ||||
-rw-r--r-- | System/Posix/IO.hsc | 1 | ||||
-rw-r--r-- | System/Posix/Process.hsc | 4 | ||||
-rw-r--r-- | include/HsUnix.h | 10 |
4 files changed, 20 insertions, 2 deletions
diff --git a/System/Posix/Files.hsc b/System/Posix/Files.hsc index 69e4924..cc9312b 100644 --- a/System/Posix/Files.hsc +++ b/System/Posix/Files.hsc @@ -55,7 +55,10 @@ module System.Posix.Files ( rename, -- * Changing file ownership - setOwnerAndGroup, setFdOwnerAndGroup, setSymbolicLinkOwnerAndGroup, + setOwnerAndGroup, setFdOwnerAndGroup, +#if HAVE_LCHOWN + setSymbolicLinkOwnerAndGroup, +#endif -- * Changing file timestamps setFileTimes, touchFile, @@ -384,6 +387,7 @@ setFdOwnerAndGroup (Fd fd) uid gid = foreign import ccall unsafe "fchown" c_fchown :: CInt -> CUid -> CGid -> IO CInt +#if HAVE_LCHOWN setSymbolicLinkOwnerAndGroup :: FilePath -> UserID -> GroupID -> IO () setSymbolicLinkOwnerAndGroup name uid gid = do withCString name $ \s -> @@ -391,6 +395,7 @@ setSymbolicLinkOwnerAndGroup name uid gid = do foreign import ccall unsafe "lchown" c_lchown :: CString -> CUid -> CGid -> IO CInt +#endif -- ----------------------------------------------------------------------------- -- utime() diff --git a/System/Posix/IO.hsc b/System/Posix/IO.hsc index 67ddb62..5ef33e0 100644 --- a/System/Posix/IO.hsc +++ b/System/Posix/IO.hsc @@ -72,6 +72,7 @@ import qualified GHC.Handle #include <unistd.h> #include <fcntl.h> +#include "HsUnix.h" -- ----------------------------------------------------------------------------- -- Pipes diff --git a/System/Posix/Process.hsc b/System/Posix/Process.hsc index a8145cd..e20830c 100644 --- a/System/Posix/Process.hsc +++ b/System/Posix/Process.hsc @@ -67,6 +67,10 @@ module System.Posix.Process ( #include <sys/times.h> #endif +#ifdef HAVE_SYS_TIME_H +#include <sys/time.h> +#endif + #ifdef HAVE_SYS_RESOURCE_H #include <sys/resource.h> #endif diff --git a/include/HsUnix.h b/include/HsUnix.h index 46af25a..00cb1bc 100644 --- a/include/HsUnix.h +++ b/include/HsUnix.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: HsUnix.h,v 1.1 2002/09/12 16:38:22 simonmar Exp $ + * $Id: HsUnix.h,v 1.2 2002/10/08 08:03:02 wolfgang Exp $ * * (c) The University of Glasgow 2002 * @@ -16,6 +16,8 @@ #include <sys/wait.h> #endif +#include <fcntl.h> + extern int execvpe(char *name, char **argv, char **envp); #ifndef INLINE @@ -29,4 +31,10 @@ INLINE int __hsunix_wtermsig (int stat) { return WTERMSIG(stat); } INLINE int __hsunix_wifstopped (int stat) { return WIFSTOPPED(stat); } INLINE int __hsunix_wstopsig (int stat) { return WSTOPSIG(stat); } +/* O_SYNC doesn't exist on Mac OS X and (at least some versions of) FreeBSD, +fall back to O_FSYNC, which should be the same */ +#ifndef O_SYNC +#define O_SYNC O_FSYNC +#endif + #endif |