GUAC-1389: Document file descriptor passing functions.

This commit is contained in:
Michael Jumper 2016-03-02 14:50:34 -08:00
parent 1e4a83b3da
commit d595d96304

View File

@ -26,16 +26,35 @@
#include "config.h" #include "config.h"
/** /**
* Sends the given file descriptor along the given socket. The file descriptor * Sends the given file descriptor along the given socket, allowing the
* must have been sent via guacd_recv_fd. Returns non-zero on success, zero on * receiving process to use that file descriptor normally. Returns non-zero on
* error. If an error does occur, errno will be set appropriately. * success, zero on error, just as a normal call to sendmsg() would. If an
* error does occur, errno will be set appropriately.
*
* @param sock
* The file descriptor of an open UNIX domain socket along which the file
* descriptor specified by fd should be sent.
*
* @param fd
* The file descriptor to send along the given UNIX domain socket.
*
* @return
* Non-zero if the send operation succeeded, zero on error.
*/ */
int guacd_send_fd(int sock, int fd); int guacd_send_fd(int sock, int fd);
/** /**
* Waits for a file descriptor on the given socket, returning the received file * Waits for a file descriptor on the given socket, returning the received file
* descriptor. If an error occurs, -1 is returned, and errno will be set * descriptor. The file descriptor must have been sent via guacd_send_fd. If an
* appropriately. * error occurs, -1 is returned, and errno will be set appropriately.
*
* @param sock
* The file descriptor of an open UNIX domain socket along which the file
* descriptor will be sent (by guacd_send_fd()).
*
* @return
* The received file descriptor, or -1 if an error occurs preventing
* receipt of the file descriptor.
*/ */
int guacd_recv_fd(int sock); int guacd_recv_fd(int sock);