File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -107,6 +107,11 @@ import System.Posix.PosixPath.FilePath
107
107
108
108
import Data.Time.Clock.POSIX (POSIXTime )
109
109
110
+ #if !defined(HAVE_MKNOD)
111
+ import System.IO.Error ( ioeSetLocation )
112
+ import GHC.IO.Exception ( unsupportedOperation )
113
+ #endif
114
+
110
115
-- -----------------------------------------------------------------------------
111
116
-- chmod()
112
117
@@ -205,6 +210,13 @@ createNamedPipe name mode = do
205
210
withFilePath name $ \ s ->
206
211
throwErrnoPathIfMinus1_ " createNamedPipe" name (c_mkfifo s mode)
207
212
213
+ #if !defined(HAVE_MKNOD)
214
+
215
+ {-# WARNING createDevice "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_MKNOD@)" #-}
216
+ createDevice :: PosixPath -> FileMode -> DeviceID -> IO ()
217
+ createDevice _ _ _ = ioError (ioeSetLocation unsupportedOperation " createDevice" )
218
+
219
+ #else
208
220
-- | @createDevice path mode dev@ creates either a regular or a special file
209
221
-- depending on the value of @mode@ (and @dev@). @mode@ will normally be either
210
222
-- 'blockSpecialMode' or 'characterSpecialMode'. May fail with
@@ -221,6 +233,8 @@ createDevice path mode dev =
221
233
foreign import capi unsafe " HsUnix.h mknod"
222
234
c_mknod :: CString -> CMode -> CDev -> IO CInt
223
235
236
+ #endif // HAVE_MKNOD
237
+
224
238
-- -----------------------------------------------------------------------------
225
239
-- Hard links
226
240
Original file line number Diff line number Diff line change @@ -35,6 +35,19 @@ import System.Posix.Directory.PosixPath (createDirectory)
35
35
import System.Posix.IO.PosixString
36
36
import System.Posix.Types
37
37
38
+ #if !defined(HAVE_MKSTEMP)
39
+ import System.IO.Error ( ioeSetLocation )
40
+ import GHC.IO.Exception ( unsupportedOperation )
41
+ #endif
42
+
43
+ #if !defined(HAVE_MKSTEMP)
44
+
45
+ {-# WARNING mkstemp "operation will throw 'IOError' \"unsupported operation\" (CPP guard: @#if HAVE_MKSTEMP@)" #-}
46
+ mkstemp :: PosixString -> IO (PosixPath , Handle )
47
+ mkstemp _ = ioError (ioeSetLocation unsupportedOperation " mkstemp" )
48
+
49
+ #else
50
+
38
51
foreign import capi unsafe " HsUnix.h mkstemp"
39
52
c_mkstemp :: CString -> IO CInt
40
53
@@ -54,6 +67,8 @@ mkstemp (PosixString template') = do
54
67
h <- fdToHandle (Fd fd)
55
68
return (name, h)
56
69
70
+ #endif // HAVE_MKSTEMP
71
+
57
72
#if HAVE_MKSTEMPS
58
73
foreign import capi unsafe " HsUnix.h mkstemps"
59
74
c_mkstemps :: CString -> CInt -> IO CInt
You can’t perform that action at this time.
0 commit comments