Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- uninterruptibleGetDescriptorFlags :: Fd -> IO (Either Errno DescriptorFlags)
- uninterruptibleGetStatusFlags :: Fd -> IO (Either Errno StatusFlags)
- uninterruptibleWriteByteArray :: Fd -> ByteArray -> Int -> CSize -> IO (Either Errno CSize)
- uninterruptibleWriteBytes :: Fd -> Bytes -> IO (Either Errno CSize)
- uninterruptibleWriteBytesCompletely :: Fd -> Bytes -> IO (Either Errno ())
- uninterruptibleWriteBytesCompletelyErrno :: Fd -> Bytes -> IO Errno
- uninterruptibleReadMutableByteArray :: Fd -> MutableByteArray RealWorld -> Int -> CSize -> IO (Either Errno CSize)
- writeBytesCompletelyErrno :: Fd -> Bytes -> IO Errno
- uninterruptibleOpen :: ManagedCString -> AccessMode -> CreationFlags -> StatusFlags -> IO (Either Errno Fd)
- uninterruptibleOpenMode :: ManagedCString -> AccessMode -> CreationFlags -> StatusFlags -> CMode -> IO (Either Errno Fd)
- uninterruptibleOpenUntypedFlags :: ManagedCString -> CInt -> IO (Either Errno Fd)
- uninterruptibleOpenModeUntypedFlags :: ManagedCString -> CInt -> CMode -> IO (Either Errno Fd)
- writeByteArray :: Fd -> ByteArray -> Int -> CSize -> IO (Either Errno CSize)
- writeMutableByteArray :: Fd -> MutableByteArray RealWorld -> Int -> CSize -> IO (Either Errno CSize)
- close :: Fd -> IO (Either Errno ())
- uninterruptibleClose :: Fd -> IO (Either Errno ())
- uninterruptibleErrorlessClose :: Fd -> IO ()
- uninterruptibleUnlink :: ManagedCString -> IO (Either Errno ())
- uninterruptibleLink :: ManagedCString -> ManagedCString -> IO (Either Errno ())
- newtype AccessMode = AccessMode CInt
- newtype CreationFlags = CreationFlags CInt
- newtype DescriptorFlags = DescriptorFlags CInt
- newtype StatusFlags = StatusFlags CInt
- nonblocking :: StatusFlags
- append :: StatusFlags
- isReadOnly :: StatusFlags -> Bool
- isWriteOnly :: StatusFlags -> Bool
- isReadWrite :: StatusFlags -> Bool
- readOnly :: AccessMode
- writeOnly :: AccessMode
- readWrite :: AccessMode
- create :: CreationFlags
- truncate :: CreationFlags
- exclusive :: CreationFlags
Functions
uninterruptibleGetDescriptorFlags :: Fd -> IO (Either Errno DescriptorFlags) Source #
Get file descriptor flags. This uses the unsafe FFI to
perform fcntl(fd,F_GETFD)
.
uninterruptibleGetStatusFlags :: Fd -> IO (Either Errno StatusFlags) Source #
Get file status flags. This uses the unsafe FFI to
perform fcntl(fd,F_GETFL)
.
uninterruptibleWriteByteArray Source #
:: Fd | Socket |
-> ByteArray | Source byte array |
-> Int | Offset into source array |
-> CSize | Length in bytes |
-> IO (Either Errno CSize) | Number of bytes pushed to send buffer |
Wrapper for write(2)
that takes a byte array and an offset.
The byte array does not need to be pinned.
uninterruptibleWriteBytes Source #
Wrapper for write(2)
that takes a slice of bytes and an offset.
The byte array backing the slice does not need to be pinned.
uninterruptibleWriteBytesCompletely Source #
Wrapper for write(2)
that takes a slice of bytes and an offset.
The byte array backing the slice does not need to be pinned.
uninterruptibleWriteBytesCompletelyErrno Source #
Variant of uninterruptibleWriteBytesCompletely
that uses errno 0
to communicate success.
writeBytesCompletelyErrno Source #
Wrapper for write(2)
that takes a slice of bytes and an offset.
The byte array backing the slice must be pinned.
:: ManagedCString | NULL-terminated file name |
-> AccessMode | Access mode |
-> CreationFlags | Creation flags |
-> StatusFlags | Status flags |
-> IO (Either Errno Fd) |
uninterruptibleOpenMode Source #
:: ManagedCString | NULL-terminated file name |
-> AccessMode | Access mode, should include |
-> CreationFlags | Creation flags |
-> StatusFlags | Status flags |
-> CMode | Permissions assigned to newly created file |
-> IO (Either Errno Fd) |
uninterruptibleOpenUntypedFlags Source #
Variant of uninterruptibleOpen
that does not help the caller with
the types of the flags.
uninterruptibleOpenModeUntypedFlags Source #
Variant of uninterruptibleOpenMode
that does not help the caller with
the types of the flags.
:: Fd | File descriptor |
-> ByteArray | Source byte array |
-> Int | Offset into source array |
-> CSize | Length in bytes |
-> IO (Either Errno CSize) | Number of bytes pushed to send buffer |
Wrapper for write(2)
that takes a byte array and an offset.
Uses safe
FFI. The byte array must be pinned.
writeMutableByteArray Source #
:: Fd | File descriptor |
-> MutableByteArray RealWorld | Source byte array |
-> Int | Offset into source array |
-> CSize | Length in bytes |
-> IO (Either Errno CSize) | Number of bytes pushed to send buffer |
Variant of writeByteArray
that operates on mutable byte array.
Uses safe
FFI. The byte array must be pinned.
Close a file descriptor. The POSIX specification includes more details. This uses the safe FFI.
Close a file descriptor. This uses the unsafe FFI. According to the
POSIX specification,
"If fildes
refers to a socket, close()
shall cause the socket to
be destroyed. If the socket is in connection-mode, and the SO_LINGER
option is set for the socket with non-zero linger time, and the socket
has untransmitted data, then close()
shall block for up to the current
linger interval until all data is transmitted."
uninterruptibleErrorlessClose Source #
Close a file descriptor with the unsafe FFI. Do not check for errors.
It is only appropriate to use this when a file descriptor is being
closed to handle an exceptional case. Since the user will want to
propogate the original exception, the exception provided by
uninterruptibleClose
would just be discarded. This function allows us
to potentially avoid an additional FFI call to getErrno
.
uninterruptibleUnlink Source #
:: ManagedCString | File name |
-> IO (Either Errno ()) |
:: ManagedCString | Path to existing file |
-> ManagedCString | Path to new file |
-> IO (Either Errno ()) |
Types
newtype AccessMode Source #
Instances
Eq AccessMode Source # | |
Defined in Posix.File.Types (==) :: AccessMode -> AccessMode -> Bool # (/=) :: AccessMode -> AccessMode -> Bool # |
newtype CreationFlags Source #
File Creation Flags
Instances
newtype DescriptorFlags Source #
File Descriptor Flags
Instances
newtype StatusFlags Source #
File Status Flags
Instances
File Descriptor Flags
nonblocking :: StatusFlags Source #
The O_NONBLOCK
flag
append :: StatusFlags Source #
The O_APPEND
flag
isReadOnly :: StatusFlags -> Bool Source #
isWriteOnly :: StatusFlags -> Bool Source #
isReadWrite :: StatusFlags -> Bool Source #
Open Access Mode
readOnly :: AccessMode Source #
The O_RDONLY
access mode.
writeOnly :: AccessMode Source #
The O_WRONLY
access mode.
readWrite :: AccessMode Source #
The O_RDWR
access mode.
File Creation Flags
create :: CreationFlags Source #
The O_CREAT
flag
truncate :: CreationFlags Source #
The O_TRUNC
flag
exclusive :: CreationFlags Source #
The O_EXCL
flag