darcs-2.18.4: a distributed, interactive, smart revision control system
Copyright2008 David Roundy <droundy@darcs.net>
LicenseGPL
Maintainerdarcs-devel@darcs.net
Stabilityexperimental
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Darcs.Util.Workaround

Description

 
Synopsis

Documentation

getCurrentDirectory :: IO FilePath #

Obtain the current working directory as an absolute path.

In a multithreaded program, the current working directory is a global state shared among all threads of the process. Therefore, when performing filesystem operations from multiple threads, it is highly recommended to use absolute rather than relative paths (see: makeAbsolute).

Note that getCurrentDirectory is not guaranteed to return the same path received by setCurrentDirectory. On POSIX systems, the path returned will always be fully dereferenced (not contain any symbolic links). For more information, refer to the documentation of getcwd.

The operation may fail with:

  • HardwareFault A physical I/O error has occurred. [EIO]
  • isDoesNotExistError There is no path referring to the working directory. [EPERM, ENOENT, ESTALE...]
  • isPermissionError The process has insufficient privileges to perform the operation. [EACCES]
  • isFullError Insufficient resources are available to perform the operation.
  • UnsupportedOperation The operating system has no notion of current working directory.

installHandler #

Arguments

:: Signal 
-> Handler 
-> Maybe SignalSet

other signals to block

-> IO Handler

old handler

installHandler int handler iset calls sigaction to install an interrupt handler for signal int. If handler is Default, SIG_DFL is installed; if handler is Ignore, SIG_IGN is installed; if handler is Catch action, a handler is installed which will invoke action in a new thread when (or shortly after) the signal is received. If iset is Just s, then the sa_mask of the sigaction structure is set to s; otherwise it is cleared. The previously installed signal handler for int is returned

raiseSignal :: Signal -> IO () #

raiseSignal int calls kill to signal the current process with interrupt signal int.

data Handler #

The actions to perform when a signal is received.

Constructors

Default

Sets the disposition of the signal to SIG_DFL, which means we want the default action associated with the signal. For example, the default action for SIGTERM (and various other signals) is to terminate the process.

Ignore

Set the disposition of the signal to SIG_IGN, which means we want to ignore the signal. Ignored signals will not be delivered to the process, and if also blocked will not be added to the pending set for later delivery (if/when unblocked). Some signals (e.g. SIGSTOP and SIGKILL) cannot be caught or ignored. not yet: | Hold

Catch (IO ())

signal handler is not reset

CatchOnce (IO ())

signal handler is automatically reset (via SA_RESETHAND)

CatchInfo (SignalInfo -> IO ())

Since: unix-2.7.0.0

CatchInfoOnce (SignalInfo -> IO ())

Since: unix-2.7.0.0

type Signal = CInt #

sigINT :: CInt #

Terminal interrupt signal.

sigHUP :: CInt #

Hangup.

sigABRT :: CInt #

Process abort signal.

sigALRM :: CInt #

Alarm clock.

sigTERM :: CInt #

Termination signal.

sigPIPE :: CInt #

Write on a pipe with no one to read it.