diff --git a/System/Posix/Unistd.hsc b/System/Posix/Unistd.hsc index 3f2d115df4957f208e1a3959451e623bfb430a95..7f791138a5932455d72b266835e802f7594ba5d9 100644 --- a/System/Posix/Unistd.hsc +++ b/System/Posix/Unistd.hsc @@ -181,9 +181,9 @@ nanosleep nsecs = do else throwErrno "nanosleep" loop (fromIntegral tv_sec0 :: CTime) (fromIntegral tv_nsec0 :: CTime) -data CTimeSpec +data {-# CTYPE "struct timespec" #-} CTimeSpec -foreign import ccall safe "__hsunix_nanosleep" +foreign import capi safe "HsUnix.h nanosleep" c_nanosleep :: Ptr CTimeSpec -> Ptr CTimeSpec -> IO CInt #endif diff --git a/cbits/HsUnix.c b/cbits/HsUnix.c index 49f90e822bce22bdb019092ce7e43d4e71876504..e54bccf05f6c1fdfd468fc630e6421b7b058fbbc 100644 --- a/cbits/HsUnix.c +++ b/cbits/HsUnix.c @@ -34,14 +34,6 @@ int __hsunix_getpwuid_r(uid_t uid, struct passwd *pw, char *buffer, } #endif -#ifdef HAVE_NANOSLEEP -// nanosleep is a macro on some platforms, so we need a wrapper: -int __hsunix_nanosleep(const struct timespec *rqtp, struct timespec *rmtp) -{ - return nanosleep(rqtp, rmtp); -} -#endif - #ifdef HAVE_PTSNAME // I cannot figure out how to make the definitions of the following // functions visible in <stdlib.h> on Linux. But these definitions diff --git a/include/HsUnix.h b/include/HsUnix.h index e2767266bf82b8f88fda860694b2649a7425e9b0..7b404fc74e5957f8da3bfd8b36e21b1ab1439882 100644 --- a/include/HsUnix.h +++ b/include/HsUnix.h @@ -125,11 +125,6 @@ int __hsunix_getpwuid_r(uid_t, struct passwd *, char *, size_t, struct passwd **); #endif -#ifdef HAVE_NANOSLEEP -// nanosleep is a macro on some platforms, so we need a wrapper: -int __hsunix_nanosleep(const struct timespec *, struct timespec *); -#endif - #ifdef HAVE_PTSNAME // I cannot figure out how to make the definitions of the following // functions visible in <stdlib.h> on Linux. But these definitions