unix-2.7.2.2: POSIX functionality

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

- File allocation

Description

POSIX file control support

Since: 2.7.1.0

Synopsis

- data Advice
  - = AdviceNormal
  - | AdviceRandom
  - | AdviceSequential
  - | AdviceWillNeed
  - | AdviceDontNeed
  - | AdviceNoReuse
- fileAdvise :: Fd -> FileOffset -> FileOffset -> Advice -> IO ()
- fileAllocate :: Fd -> FileOffset -> FileOffset -> IO ()

# File allocation

data Advice #

Advice parameter for `fileAdvise` operation.

For more details, see documentation of `posix_fadvise(2)`.

Since: 2.7.1.0

Constructors

AdviceNormal |
AdviceRandom |
AdviceSequential |
AdviceWillNeed |
AdviceDontNeed |
AdviceNoReuse |

Instances

Eq Advice # |
Methods (==) :: Advice -> Advice -> Bool # (/=) :: Advice -> Advice -> Bool #

fileAdvise :: Fd -> FileOffset -> FileOffset -> Advice -> IO () #

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 () #

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