| Copyright | (c) The University of Glasgow 2014 |
|---|---|
| License | BSD-style (see the file LICENSE) |
| Maintainer | libraries@haskell.org |
| Stability | provisional |
| Portability | non-portable (requires POSIX) |
| Safe Haskell | Safe |
| Language | Haskell2010 |
System.Posix.Fcntl
Contents
Description
POSIX file control support
Since: 2.7.1.0
Synopsis
- data Advice
- fileAdvise :: Fd -> FileOffset -> FileOffset -> Advice -> IO ()
- fileAllocate :: Fd -> FileOffset -> FileOffset -> IO ()
- fileGetCaching :: Fd -> IO Bool
- fileSetCaching :: Fd -> Bool -> IO ()
File allocation
Advice parameter for fileAdvise operation.
For more details, see documentation of posix_fadvise(2).
Since: 2.7.1.0
fileAdvise :: Fd -> FileOffset -> FileOffset -> Advice -> IO () Source #
Performs posix_fadvise(2) operation on file-descriptor.
If platform does not provide posix_fadvise(2) fileAdvise
becomes a no-op.
(use #if HAVE_POSIX_FADVISE CPP guard to detect availability)
Since: 2.7.1.0
fileAllocate :: Fd -> FileOffset -> FileOffset -> IO () Source #
Performs posix_fallocate(2) operation on file-descriptor.
Throws IOError ("unsupported operation") if platform does not
provide posix_fallocate(2).
(use #if HAVE_POSIX_FALLOCATE CPP guard to detect availability).
Since: 2.7.1.0
File caching
fileGetCaching :: Fd -> IO Bool Source #
Performs the fcntl(2) operation on a file-desciptor to get the cache mode.
If the cache mode is False , then cache effects for file system reads and
writes are minimised or otherwise eliminated. If the cache mode is True ,
then cache effects occur like normal.
On Linux, FreeBSD, and NetBSD this checks whether the O_DIRECT file flag is
set.
Throws IOError ("unsupported operation") if platform does not support
getting the cache mode.
Use #if HAVE_O_DIRECT CPP guard to detect availability. Use #include
"HsUnix.h" to bring HAVE_O_DIRECT into scope.
Since: 2.8.7.0
fileSetCaching :: Fd -> Bool -> IO () Source #
Performs the fcntl(2) operation on a file-desciptor to set the cache
mode.
If the cache mode is False , then cache effects for file system reads and
writes are minimised or otherwise eliminated. If the cache mode is True ,
then cache effects occur like normal.
On Linux, FreeBSD, and NetBSD this sets the O_DIRECT file flag. On OSX,
this sets the F_NOCACHE fcntl flag.
Throws IOError ("unsupported operation") if platform does not support
setting the cache mode.
Use #if HAVE_O_DIRECT || HAVE_F_NOCACHE CPP guard to detect availability.
Use #include "HsUnix.h" to bring HAVE_O_DIRECT and HAVE_F_NOCACHE into
scope.
Since: 2.8.7.0