GHC.Internal.System.Posix.Internals

ghc-internal-9.1001.0: Basic libraries

Copyright | (c) The University of Glasgow 1992-2002
License | see libraries/base/LICENSE
Maintainer | ghc-devs@haskell.org
Stability | internal
Portability | non-portable (requires POSIX)
Safe Haskell | Trustworthy
Language | Haskell2010

GHC.Internal.System.Posix.Internals

Description

POSIX support layer for the standard libraries.

The API of this module is unstable and not meant to be consumed by the general public. If you absolutely must depend on it, make sure to use a tight upper bound, e.g., `base < 4.X` rather than `base < 5`, because the interface can change rapidly without much warning.

This library is built on *every* platform, including Win32.

Non-POSIX compliant in order to support the following features: * S_ISSOCK (no sockets in POSIX)

Synopsis

- puts :: String -> IO ()
- data CFLock
- data CGroup
- data CLconv
- data CPasswd
- data CSigaction
- data CSigset
- data CStat
- data CTermios
- data CTm
- data CTms
- data CUtimbuf
- data CUtsname
- type FD = CInt
- fdFileSize :: FD -> IO Integer
- fileType :: FilePath -> IO IODeviceType
- fdStat :: FD -> IO (IODeviceType, CDev, CIno)
- fdType :: FD -> IO IODeviceType
- statGetType :: Ptr CStat -> IO IODeviceType
- ioe_unknownfiletype :: IOException
- fdGetMode :: FD -> IO IOMode
- withFilePath :: FilePath -> (CString -> IO a) -> IO a
- newFilePath :: FilePath -> IO CString
- peekFilePath :: CString -> IO FilePath
- peekFilePathLen :: CStringLen -> IO FilePath
- checkForInteriorNuls :: FilePath -> CStringLen -> IO ()
- throwInternalNulError :: FilePath -> IO a
- setEcho :: FD -> Bool -> IO ()
- getEcho :: FD -> IO Bool
- setCooked :: FD -> Bool -> IO ()
- tcSetAttr :: FD -> (Ptr CTermios -> IO a) -> IO a
- get_saved_termios :: CInt -> IO (Ptr CTermios)
- set_saved_termios :: CInt -> Ptr CTermios -> IO ()
- setNonBlockingFD :: FD -> Bool -> IO ()
- setCloseOnExec :: FD -> IO ()
- type CFilePath = CString
- c_interruptible_open :: CFilePath -> CInt -> CMode -> IO CInt
- c_safe_open :: CFilePath -> CInt -> CMode -> IO CInt
- hostIsThreaded :: Bool
- c_open :: CFilePath -> CInt -> CMode -> IO CInt
- c_interruptible_open_ :: CFilePath -> CInt -> CMode -> IO CInt
- rtsIsThreaded_ :: Int
- c_safe_open_ :: CFilePath -> CInt -> CMode -> IO CInt
- c_fstat :: CInt -> Ptr CStat -> IO CInt
- lstat :: CFilePath -> Ptr CStat -> IO CInt
- c_read :: CInt -> Ptr Word8 -> CSize -> IO CSsize
- c_safe_read :: CInt -> Ptr Word8 -> CSize -> IO CSsize
- c_umask :: CMode -> IO CMode
- c_write :: CInt -> Ptr Word8 -> CSize -> IO CSsize
- c_safe_write :: CInt -> Ptr Word8 -> CSize -> IO CSsize
- c_pipe :: Ptr CInt -> IO CInt
- c_lseek :: CInt -> COff -> CInt -> IO COff
- c_access :: CString -> CInt -> IO CInt
- c_chmod :: CString -> CMode -> IO CInt
- c_close :: CInt -> IO CInt
- c_creat :: CString -> CMode -> IO CInt
- c_dup :: CInt -> IO CInt
- c_dup2 :: CInt -> CInt -> IO CInt
- c_isatty :: CInt -> IO CInt
- c_unlink :: CString -> IO CInt
- c_utime :: CString -> Ptr CUtimbuf -> IO CInt
- c_getpid :: IO CPid
- c_stat :: CFilePath -> Ptr CStat -> IO CInt
- c_ftruncate :: CInt -> COff -> IO CInt
- c_fcntl_read :: CInt -> CInt -> IO CInt
- c_fcntl_write :: CInt -> CInt -> CLong -> IO CInt
- c_fcntl_lock :: CInt -> CInt -> Ptr CFLock -> IO CInt
- c_fork :: IO CPid
- c_link :: CString -> CString -> IO CInt
- c_mkfifo :: CString -> CMode -> IO CInt
- c_sigemptyset :: Ptr CSigset -> IO CInt
- c_sigaddset :: Ptr CSigset -> CInt -> IO CInt
- c_sigprocmask :: CInt -> Ptr CSigset -> Ptr CSigset -> IO CInt
- c_tcgetattr :: CInt -> Ptr CTermios -> IO CInt
- c_tcsetattr :: CInt -> CInt -> Ptr CTermios -> IO CInt
- c_waitpid :: CPid -> Ptr CInt -> CInt -> IO CPid
- o_RDONLY :: CInt
- o_WRONLY :: CInt
- o_RDWR :: CInt
- o_APPEND :: CInt
- o_CREAT :: CInt
- o_EXCL :: CInt
- o_TRUNC :: CInt
- o_NOCTTY :: CInt
- o_NONBLOCK :: CInt
- o_BINARY :: CInt
- c_s_isreg :: CMode -> CInt
- c_s_ischr :: CMode -> CInt
- c_s_isblk :: CMode -> CInt
- c_s_isdir :: CMode -> CInt
- c_s_isfifo :: CMode -> CInt
- s_isreg :: CMode -> Bool
- s_ischr :: CMode -> Bool
- s_isblk :: CMode -> Bool
- s_isdir :: CMode -> Bool
- s_isfifo :: CMode -> Bool
- sizeof_stat :: Int
- st_mtime :: Ptr CStat -> IO CTime
- st_size :: Ptr CStat -> IO COff
- st_mode :: Ptr CStat -> IO CMode
- st_dev :: Ptr CStat -> IO CDev
- st_ino :: Ptr CStat -> IO CIno
- const_echo :: CInt
- const_tcsanow :: CInt
- const_icanon :: CInt
- const_vmin :: CInt
- const_vtime :: CInt
- const_sigttou :: CInt
- const_sig_block :: CInt
- const_sig_setmask :: CInt
- const_f_getfl :: CInt
- const_f_setfl :: CInt
- const_f_setfd :: CInt
- const_fd_cloexec :: CLong
- sizeof_termios :: Int
- sizeof_sigset_t :: Int
- c_lflag :: Ptr CTermios -> IO CTcflag
- poke_c_lflag :: Ptr CTermios -> CTcflag -> IO ()
- ptr_c_cc :: Ptr CTermios -> IO (Ptr Word8)
- s_issock :: CMode -> Bool
- c_s_issock :: CMode -> CInt
- dEFAULT_BUFFER_SIZE :: Int
- sEEK_CUR :: CInt
- sEEK_SET :: CInt
- sEEK_END :: CInt

# Documentation

puts :: String -> IO () Source #

data CFLock Source #

data CGroup Source #

data CLconv Source #

data CPasswd Source #

data CSigaction Source #

data CSigset Source #

data CStat Source #

data CTermios Source #

data CTm Source #

data CTms Source #

data CUtimbuf Source #

data CUtsname Source #

type FD = CInt Source #

fdFileSize :: FD -> IO Integer Source #

fileType :: FilePath -> IO IODeviceType Source #

fdStat :: FD -> IO (IODeviceType, CDev, CIno) Source #

fdType :: FD -> IO IODeviceType Source #

statGetType :: Ptr CStat -> IO IODeviceType Source #

ioe_unknownfiletype :: IOException Source #

fdGetMode :: FD -> IO IOMode Source #

withFilePath :: FilePath -> (CString -> IO a) -> IO a Source #

newFilePath :: FilePath -> IO CString Source #

peekFilePath :: CString -> IO FilePath Source #

peekFilePathLen :: CStringLen -> IO FilePath Source #

checkForInteriorNuls :: FilePath -> CStringLen -> IO () Source #

Check an encoded `FilePath` for internal NUL octets as these are disallowed in POSIX filepaths. See #13660.

throwInternalNulError :: FilePath -> IO a Source #

setEcho :: FD -> Bool -> IO () Source #

getEcho :: FD -> IO Bool Source #

setCooked :: FD -> Bool -> IO () Source #

tcSetAttr :: FD -> (Ptr CTermios -> IO a) -> IO a Source #

get_saved_termios :: CInt -> IO (Ptr CTermios) Source #

set_saved_termios :: CInt -> Ptr CTermios -> IO () Source #

setNonBlockingFD :: FD -> Bool -> IO () Source #

setCloseOnExec :: FD -> IO () Source #

type CFilePath = CString Source #

c_interruptible_open :: CFilePath -> CInt -> CMode -> IO CInt Source #

The same as `c_safe_open`, but an interruptible operation as described in Control.Exception—it respects `uninterruptibleMask` but not `mask`.

We want to be able to interrupt an openFile call if it's expensive (NFS, FUSE, etc.), and we especially need to be able to interrupt a blocking open call. See #17912.

@since base-4.16.0.0

c_safe_open :: CFilePath -> CInt -> CMode -> IO CInt Source #

hostIsThreaded :: Bool Source #

Consult the RTS to find whether it is threaded.

@since base-4.16.0.0

c_open :: CFilePath -> CInt -> CMode -> IO CInt Source #

c_interruptible_open_ :: CFilePath -> CInt -> CMode -> IO CInt Source #

@since base-4.16.0.0

rtsIsThreaded_ :: Int Source #

@since base-4.16.0.0

c_safe_open_ :: CFilePath -> CInt -> CMode -> IO CInt Source #

c_fstat :: CInt -> Ptr CStat -> IO CInt Source #

lstat :: CFilePath -> Ptr CStat -> IO CInt Source #

c_read :: CInt -> Ptr Word8 -> CSize -> IO CSsize Source #

c_safe_read :: CInt -> Ptr Word8 -> CSize -> IO CSsize Source #

c_umask :: CMode -> IO CMode Source #

c_write :: CInt -> Ptr Word8 -> CSize -> IO CSsize Source #

c_safe_write :: CInt -> Ptr Word8 -> CSize -> IO CSsize Source #

c_pipe :: Ptr CInt -> IO CInt Source #

c_lseek :: CInt -> COff -> CInt -> IO COff Source #

c_access :: CString -> CInt -> IO CInt Source #

c_chmod :: CString -> CMode -> IO CInt Source #

c_close :: CInt -> IO CInt Source #

c_creat :: CString -> CMode -> IO CInt Source #

c_dup :: CInt -> IO CInt Source #

c_dup2 :: CInt -> CInt -> IO CInt Source #

c_isatty :: CInt -> IO CInt Source #

c_unlink :: CString -> IO CInt Source #

c_utime :: CString -> Ptr CUtimbuf -> IO CInt Source #

c_getpid :: IO CPid Source #

c_stat :: CFilePath -> Ptr CStat -> IO CInt Source #

c_ftruncate :: CInt -> COff -> IO CInt Source #

c_fcntl_read :: CInt -> CInt -> IO CInt Source #

c_fcntl_write :: CInt -> CInt -> CLong -> IO CInt Source #

c_fcntl_lock :: CInt -> CInt -> Ptr CFLock -> IO CInt Source #

c_fork :: IO CPid Source #

c_link :: CString -> CString -> IO CInt Source #

c_mkfifo :: CString -> CMode -> IO CInt Source #

c_sigemptyset :: Ptr CSigset -> IO CInt Source #

c_sigaddset :: Ptr CSigset -> CInt -> IO CInt Source #

c_sigprocmask :: CInt -> Ptr CSigset -> Ptr CSigset -> IO CInt Source #

c_tcgetattr :: CInt -> Ptr CTermios -> IO CInt Source #

c_tcsetattr :: CInt -> CInt -> Ptr CTermios -> IO CInt Source #

c_waitpid :: CPid -> Ptr CInt -> CInt -> IO CPid Source #

o_RDONLY :: CInt Source #

o_WRONLY :: CInt Source #

o_RDWR :: CInt Source #

o_APPEND :: CInt Source #

o_CREAT :: CInt Source #

o_EXCL :: CInt Source #

o_TRUNC :: CInt Source #

o_NOCTTY :: CInt Source #

o_NONBLOCK :: CInt Source #

o_BINARY :: CInt Source #

c_s_isreg :: CMode -> CInt Source #

c_s_ischr :: CMode -> CInt Source #

c_s_isblk :: CMode -> CInt Source #

c_s_isdir :: CMode -> CInt Source #

c_s_isfifo :: CMode -> CInt Source #

s_isreg :: CMode -> Bool Source #

s_ischr :: CMode -> Bool Source #

s_isblk :: CMode -> Bool Source #

s_isdir :: CMode -> Bool Source #

s_isfifo :: CMode -> Bool Source #

sizeof_stat :: Int Source #

st_mtime :: Ptr CStat -> IO CTime Source #

st_size :: Ptr CStat -> IO COff Source #

st_mode :: Ptr CStat -> IO CMode Source #

st_dev :: Ptr CStat -> IO CDev Source #

st_ino :: Ptr CStat -> IO CIno Source #

const_echo :: CInt Source #

const_tcsanow :: CInt Source #

const_icanon :: CInt Source #

const_vmin :: CInt Source #

const_vtime :: CInt Source #

const_sigttou :: CInt Source #

const_sig_block :: CInt Source #

const_sig_setmask :: CInt Source #

const_f_getfl :: CInt Source #

const_f_setfl :: CInt Source #

const_f_setfd :: CInt Source #

const_fd_cloexec :: CLong Source #

sizeof_termios :: Int Source #

sizeof_sigset_t :: Int Source #

c_lflag :: Ptr CTermios -> IO CTcflag Source #

poke_c_lflag :: Ptr CTermios -> CTcflag -> IO () Source #

ptr_c_cc :: Ptr CTermios -> IO (Ptr Word8) Source #

s_issock :: CMode -> Bool Source #

c_s_issock :: CMode -> CInt Source #

dEFAULT_BUFFER_SIZE :: Int Source #

sEEK_CUR :: CInt Source #

sEEK_SET :: CInt Source #

sEEK_END :: CInt Source #