Async_unix.UnixSourceval this_process_became_child_of_init :
?poll_delay:Async_unix__.Import.Time.Span.t ->
unit ->
unit Async_kernel.Deferred.tthis_process_became_child_of_init returns a deferred that becomes determined when the current process becomes a child of init(8). This is useful for determining whether one's parent has died, because in that case init will become one's parent.
See Linux_ext.pr_set_pdeathsig : Signal.t -> unit for a related way to get information about parent death.
?poll_delay controls how often to check.
cores () Returns the number of cores.
type open_flag = [ | `Rdonly| `Wronly| `Rdwr| `Nonblock| `Append| `Creat| `Trunc| `Excl| `Noctty| `Dsync| `Sync| `Rsync ]val openfile :
?info:Core.Info.t ->
?perm:file_perm ->
string ->
mode:open_flag list ->
Fd.t Async_kernel.Deferred.tval with_file :
?lock:Lock.t ->
?perm:file_perm ->
string ->
mode:open_flag list ->
f:(Fd.t -> 'a Async_kernel.Deferred.t) ->
'a Async_kernel.Deferred.twith_file file ~mode ~perm ~f 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 lock is supplied, then the file descriptor is locked before calling f with the specified lock_mechanism. Note that it is not unlocked before close, which might be significant if this file descriptor is held elsewhere (e.g., by fork() or dup()).
fcntl_getfl and fcntl_setf are deferred wrappers around the corresponding functions in Core_unix for accessing the open-file-descriptor table.
include module type of Fd.Closetype file_descriptor_handling = | Close_file_descriptor of socket_handling| Do_not_close_file_descriptorval close :
?file_descriptor_handling:file_descriptor_handling ->
Fd.t ->
unit Async_kernel.Deferred.tclose t prevents further use of t, and makes shutdown() and close() system calls on t's underlying file descriptor according to the file_descriptor_handling argument and whether or not t is a socket, i.e., kind t = Socket `Active:
| file_descriptor_handling | shutdown() | close() | |----------------------------------------------+------------+---------| | Do_not_close_file_descriptor | no | no | | Close_file_descriptor Shutdown_socket | if socket | yes | | Close_file_descriptor Do_not_shutdown_socket | no | yes |
The result of close becomes determined once the system calls complete. It is OK to call close multiple times on the same t; calls subsequent to the initial call will have no effect, but will return the same deferred as the original call.
deregister t causes Async to stop tracking this file descriptor, and prevents further use of t. The file descriptor remains open; it can be used by other libraries.
You should only call this function if you have a file descriptor created by Async and you need to move ownership of that file descriptor to another IO library which expects to be able to close the file descriptor itself. Otherwise, just use close.
This is like calling close with file_descriptor_handling set to Do_not_close_file_descriptor.
It is OK to call deregister multiple times on the same t, like close.
lockf fd lock_mode ?len locks 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.
Warning: lockf locks are held per-process, so taking the lock on the same file multiple times in the same process is going to break in terrible ways.
Note that, despite the name, this function does not call the UNIX lockf() system call; rather it calls fcntl() with F_SETLKW
try_lockf fd lock_mode ?len attempts to lock 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.
Note that, despite the name, this function does not call the UNIX lockf() system call; rather it calls fcntl() with F_SETLK
test_lockf fd ?len checks the lock on section of the open file fd specified by the current file position and len. If the section is unlocked or locked by this process, it returns true, else it returns false. It raises if fd is closed.
Note that, despite the name, this function does not call the UNIX lockf() system call; rather it calls fcntl() with F_GETLK
unlockf fd ?len unlocks the section of the open file fd specified by the current file position and len. It raises if fd is closed.
Note that, despite the name, this function does not call the UNIX lockf() system call; rather it calls fcntl() with F_UNLCK
flock fd lock_mode locks the open file fd (see man 2 flock). It returns when the lock has been acquired. It raises if fd is closed.
try_flock fd lock_mode attempts to lock the open file fd (see man 2 flock). It returns true if it acquired the lock or false if a conflicting lock was already present. It raises if fd is closed.
funlock fd unlocks the open file fd (see man 2 flock). It raises if fd is closed.
val link :
?force:bool ->
target:string ->
link_name:string ->
unit ->
unit Async_kernel.Deferred.tval access :
string ->
[ `Read | `Write | `Exec | `Exists ] list ->
(unit, exn) Core.Result.t Async_kernel.Deferred.tval access_exn :
string ->
[ `Read | `Write | `Exec | `Exists ] list ->
unit Async_kernel.Deferred.treaddir_opt dir_handle returns the next directory member, or None when there are no more directory members to return.
The info supplied to pipe is debugging information that will be included in the returned Fds.
Create a named pipe with the given permissions.
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.
type process_times = Async_unix__.Import.Unix.process_times = {tms_utime : float;User time for the process
*)tms_stime : float;System time for the process
*)tms_cutime : float;User time for the children processes
*)tms_cstime : float;System time for the children processes
*)}Time functions.
type tm = Async_unix__.Import.Unix.tm = {tm_sec : int;Seconds 0..59
*)tm_min : int;Minutes 0..59
*)tm_hour : int;Hours 0..23
*)tm_mday : int;Day of month 1..31
*)tm_mon : int;Month of year 0..11
*)tm_year : int;Year - 1900
*)tm_wday : int;Day of week (Sunday is 0)
*)tm_yday : int;Day of year 0..365
*)tm_isdst : bool;Daylight time savings in effect
*)}val fork_exec :
prog:string ->
argv:string list ->
?use_path:bool ->
?env:[ env | `Replace_raw of string list ] ->
unit ->
Core.Pid.t Async_kernel.Deferred.tfork_exec ~prog ~argv ?path ?env forks and execs prog with argv, 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.
val wait_untraced :
wait_on ->
(Core.Pid.t * Exit_or_signal_or_stop.t) Async_kernel.Deferred.twaitpid 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 in any other way.
Same as waitpid, but guarantees that the resulting Deferred is determined in the same async job as the wait system call, so that it's safe to keep using the pid if the deferred is not determined.
val hash_fold_socket_domain :
Ppx_hash_lib.Std.Hash.state ->
socket_domain ->
Ppx_hash_lib.Std.Hash.stateval hash_fold_socket_type :
Ppx_hash_lib.Std.Hash.state ->
socket_type ->
Ppx_hash_lib.Std.Hash.statetype sockaddr = Async_unix__.Import.Unix.sockaddr = | ADDR_UNIX of string| ADDR_INET of Inet_addr.t * intsockaddr_blocking_sexp is like sockaddr, with of_sexp that performs DNS lookup to resolve Inet_addr.t.
val bin_writer_sockaddr_blocking_sexp :
sockaddr_blocking_sexp Core.Bin_prot.Type_class.writerval __bin_read_sockaddr_blocking_sexp__ :
(int -> sockaddr_blocking_sexp) Core.Bin_prot.Read.readerval bin_reader_sockaddr_blocking_sexp :
sockaddr_blocking_sexp Core.Bin_prot.Type_class.readerThe following functions correspond to the system calls of the same names. They can't block so they don't need to return a deferred.
Gets the information using the socket-based netlink interface, which can block; see https://www.infradead.org/~tgr/libnl/doc/core.html.
Returns the 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). This also means that this function isn't guaranteed to succeed: it may raise instead.
Same as username.
val wordexp :
(?flags:[ `No_cmd | `Show_err | `Undef ] list ->
string ->
string array Async_kernel.Deferred.t)
Core.Or_error.t