\documentclass[11pt]{article} \usepackage[latin1]{inputenc} \usepackage[T1]{fontenc} \usepackage{fullpage} \usepackage{url} \usepackage{ocamldoc} \begin{document} \tableofcontents \section{Module {\tt{Fd}} : This module implements miscellaneous functions related to UNIX file descriptors.} \label{module:Fd}\index{Fd@\verb`Fd`} Currently, the functions listed below are implemented. \begin{itemize} \item {\tt{Fd.send\_fd}}[\ref{val:Fd.send-underscorefd}] and {\tt{Fd.recv\_fd}}[\ref{val:Fd.recv-underscorefd}], which are respectively used to send and receive descriptors. Tipically, this functionality is used to allow a process to perform all the actions needed to acquire a descriptor, which is then sent to another process, which will then handle the data transfer operations on that descriptor. \item {\tt{Fd.fexecve}}[\ref{val:Fd.fexecve}], which is used to execute a program specified via a file descriptor. \end{itemize} \ocamldocvspace{0.5cm} \label{exception:Fd.Fd-underscoreerror}\begin{ocamldoccode} exception Fd_error of string \end{ocamldoccode} \index{Fd-underscoreerror@\verb`Fd_error`} \begin{ocamldocdescription} This exception is raised by {\tt{Fd.send\_fd}}[\ref{val:Fd.send-underscorefd}] and {\tt{Fd.recv\_fd}}[\ref{val:Fd.recv-underscorefd}] when an error is encountered. The string contains the error message. \end{ocamldocdescription} \label{val:Fd.send-underscorefd}\begin{ocamldoccode} val send_fd : conn:Unix.file_descr -> fd:Unix.file_descr -> unit \end{ocamldoccode} \index{send-underscorefd@\verb`send_fd`} \begin{ocamldocdescription} This function sends a descriptor over a Unix socket whose peer may be another process. The peer must receive the file descriptor with the function {\tt{Fd.recv\_fd}}[\ref{val:Fd.recv-underscorefd}] defined in this module. The descriptor is sent as a sized message, so the user application may use the connection to other communication needs. {\bf Raises} {\tt{Fd\_error}} This exception is raised on error. \end{ocamldocdescription} \label{val:Fd.recv-underscorefd}\begin{ocamldoccode} val recv_fd : conn:Unix.file_descr -> Unix.file_descr \end{ocamldoccode} \index{recv-underscorefd@\verb`recv_fd`} \begin{ocamldocdescription} This function receives a descriptor sent by {\tt{Fd.send\_fd}}[\ref{val:Fd.send-underscorefd}]. {\bf Raises} {\tt{Fd\_error}} This exception is raised on error. {\bf Returns }The received file descriptor. \end{ocamldocdescription} \label{val:Fd.fexecve}\begin{ocamldoccode} val fexecve : fd:Unix.file_descr -> args:string array -> env:string array -> 'a \end{ocamldoccode} \index{fexecve@\verb`fexecve`} \begin{ocamldocdescription} This function works like {\tt{Unix.execve}}, but the program to be executed, its first paramenter, is specified via a file descriptor. As is the case with the {\tt{Unix.execv*}} functions, {\tt{Fd.fexecve}}[\ref{val:Fd.fexecve}] never returns. If the call succeeds, the current process is substituted by the new one. {\bf Raises} {\tt{Fd\_error}} This exception is raised on error. \end{ocamldocdescription} \label{val:Fd.read-underscorecred}\begin{ocamldoccode} val read_cred : fd:Unix.file_descr -> int * int * int \end{ocamldoccode} \index{read-underscorecred@\verb`read_cred`} \begin{ocamldocdescription} This function reads sender credentials from a descriptor. The descriptor must be associated to a UNIX socket. Currently only Linux is supported. {\bf Raises} {\tt{Fd\_error}} This exception is raised on error. {\bf Returns }A tuple of integers containing the sender PID, UID and GID. \end{ocamldocdescription} \end{document}