this_process_became_child_of_init
returns a deferred that becomes determined when
the current process becomes a child of init(8). This is useful to determine if one's
parent has died, because in that case init will becomes one's parent.
See Linux_ext.pr_set_pdeathsig : Signal.t -> unit
for related way to get information
about parent death.
with_file file ~mode ~perm ~f ?exclusive
opens file
, and applies f
to the
resulting file descriptor. When the result of f
becomes determined, it closes the
descriptor and returns the result of f
. If exclusive
is supplied, then the file
descriptor is locked before calling f
and unlocked after calling f
.
fcntl_getfl
and fcntl_setf
are deferred wrappers around the corresponding
functions in Core.Unix
for accessing the open-file-descriptor table.
close fd
closes the file descriptor fd
, and raises an exception if fd
has
already been closed.
In some situations, one may need to cause Async to release an fd that it is managing
without closing the underlying file descriptor. In that case, one should supply
~should_close_file_descriptor:false
, which will skip the underlying close() system
call.
lockf fd read_or_write ?len
exclusively locks for reading/writing the section of the
open file fd
specified by the current file position and len
(see man lockf). It
returns when the lock has been acquired. It raises if fd
is closed.
try_lockf fd read_or_write ?len
attempts to exclusively lock for reading/writing the
section of the open file fd
specified by the current file position and len
(see
man lockf). It returns true
if it acquired the lock. It raises if fd
is
closed.
lockf_is_locked fd ?len
checks the lock on section of the open file fd
specified
by the current file position and len
(see man lockf). If the section is unlocked or
locked by this process, it returns true, else it returns false. It raises if fd
is
closed.
unlockf fd ?len
unlocks the section of the open file fd
specified by the current
file position and len
(see man lockf). It raises if fd
is closed.
The info
supplied to pipe is debugging information that will be included in the
returned Fd
s.
mkstemp prefix
creates and opens a unique temporary file with prefix
,
automatically appending a suffix of six random characters to make the name unique.
Unlike C's mkstemp
, prefix
should not include six X's at the end.
: float | ; | (* | User time for the process | *) | |
: float | ; | (* | System time for the process | *) | |
: float | ; | (* | User time for the children processes | *) | |
: float | ; | (* | System time for the children processes | *) |
Time functions.
: int | ; | (* | Seconds 0..59 | *) | |
: int | ; | (* | Minutes 0..59 | *) | |
: int | ; | (* | Hours 0..23 | *) | |
: int | ; | (* | Day of month 1..31 | *) | |
: int | ; | (* | Month of year 0..11 | *) | |
: int | ; | (* | Year - 1900 | *) | |
: int | ; | (* | Day of week (Sunday is 0) | *) | |
: int | ; | (* | Day of year 0..365 | *) | |
: bool | ; | (* | Daylight time savings in effect | *) |
fork_exec ~prog ~args ?path ?env
forks and execs prog
with args
, and returns the
child pid. If use_path = true
(the default) and prog
doesn't contain a slash,
then fork_exec
searches the PATH environment variable for prog
. If env
is
supplied, it specifies the environment when prog
is executed.
If env
contains multiple bindings for the same variable, the last takes precedence.
In the case of `Extend
, bindings in env
take precedence over the existing
environment. See Unix.exec.
waitpid pid
returns a deferred that becomes determined with the child's exit
status, when the child process with process id pid
exits. waitpid_exn
is like
waitpid
, except the result only becomes determined if the child exits with status
zero; it raises if the child terminates win any other way.
sockaddr_blocking_sexp
is like sockaddr
, with of_sexp
that performs DNS lookup
to resolve Inet_addr.t
.
passwd
database.
groups
database.
Return the login name of the user executing the process.
This returns a deferred because the username may need to be looked up in what is essentially a database elsewhere on the network (winbound user, or NIS).