haskus-system-0.7.0.0: Haskus system programming framework

Safe HaskellNone
LanguageHaskell2010

Haskus.System.Linux.FileSystem

Contents

Synopsis

Documentation

data SeekWhence Source #

Constructors

SeekSet

seek relative to beginning of file

SeekCurrent

seek relative to current file position

SeekEnd

seek relative to end of file

SeekData

seek to the next data

SeekHole

seek to the next hole

sysSeek :: MonadIO m => Handle -> Int64 -> SeekWhence -> Flow m '[Int64, ErrorCode] Source #

Reposition read/write file offset, return the new position

sysSeek' :: MonadIO m => Handle -> Int64 -> SeekWhence -> Flow m '[(), ErrorCode] Source #

Reposition read/write file offset

sysFileStat :: MonadInIO m => FilePath -> Bool -> Flow m '[Stat, ErrorCode] Source #

Stat on a path

If the path targets a symbolic link and followLink is false, then returned information are about the link itself

sysHandleStat :: MonadInIO m => Handle -> Flow m '[Stat, ErrorCode] Source #

Stat on file descriptor

sysCreateSpecialFile :: MonadInIO m => Maybe Handle -> FilePath -> FileType -> FilePermissions -> Maybe DeviceID -> Flow m '[(), ErrorCode] Source #

Create a special file

mknodat syscall.

Open/Close

open :: MonadInIO m => Maybe Handle -> FilePath -> HandleFlags -> FilePermissions -> Flow m (Handle ': OpenErrors) Source #

Open and possibly create a file

close :: MonadIO m => Handle -> Flow m '[(), InvalidHandle, Interrupted, FileSystemIOError] Source #

Close a file descriptor

Synchronization

syncAll :: MonadIO m => m () Source #

Causes all pending modifications to file system metadata and cached file data to be written to the underlying filesystems

syncAllByHandle :: MonadIO m => Handle -> Flow m '[(), InvalidHandle] Source #

Causes all pending modifications to file system metadata and cached file data to be written to the underlying filesystem containg the open handle fd

syncHandle :: MonadIO m => Bool -> Handle -> Flow m '[(), InvalidHandle, FileSystemIOError, InvalidParam] Source #

Flushes all modified in-core of the file referred by the handle to the disk device.

It does not necessarily ensure that the entry in the directory containing the file has also reached disk. For that an explicit syncHandle on a handle for the directory is also needed.

If the flushMetadata is False, only the contents of the file and the metadata required to retrieve it (e.g., the file size) are flushed on disk. Otherwise, all the metadata are flushed.

Rename

rename :: MonadInIO m => Maybe Handle -> FilePath -> Maybe Handle -> FilePath -> [RenameFlag] -> Flow m (() ': RenameErrors) Source #

Change or exchange the name or location of a file

Device

withDeviceID :: DeviceID -> (Word64 -> a) -> a Source #

Use a DeviceID as a Word64 suitable for the kernel