From 1af096d3e286498e531ecb0542bd26997ab5fe06 Mon Sep 17 00:00:00 2001 From: wolfgang Date: Tue, 8 Oct 2002 08:03:02 +0000 Subject: [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. --- System/Posix/Files.hsc | 7 ++++++- System/Posix/IO.hsc | 1 + System/Posix/Process.hsc | 4 ++++ 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 #include +#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 #endif +#ifdef HAVE_SYS_TIME_H +#include +#endif + #ifdef HAVE_SYS_RESOURCE_H #include #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 #endif +#include + 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 -- cgit v1.2.3