<div dir="ltr"><div>I don't see any reason for the  wl_display_add_socket_fd_auto and wl_display_add_socket_auto functions, as they are the same as passing NULL for the name to wl_display_add_socket_fd, right?<br><br></div>Also (on the patch) it looks like if there is an error it destroys the wl_socket object, could this do the wrong thing if the fd was supplied from outside?<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 19, 2015 at 1:36 AM, Bryce Harrington <span dir="ltr"><<a href="mailto:bryce@osg.samsung.com" target="_blank">bryce@osg.samsung.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Signed-off-by: Bryce Harrington <<a href="mailto:bryce@osg.samsung.com">bryce@osg.samsung.com</a>><br>
---<br>
 src/wayland-server.c | 67 +++++++++++++++++++++++++++++++++++++++++-----------<br>
 1 file changed, 53 insertions(+), 14 deletions(-)<br>
<br>
diff --git a/src/wayland-server.c b/src/wayland-server.c<br>
index bac98bf..e84858d 100644<br>
--- a/src/wayland-server.c<br>
+++ b/src/wayland-server.c<br>
@@ -1164,6 +1164,17 @@ _wl_display_add_socket(struct wl_display *display, struct wl_socket *s)<br>
        return 0;<br>
 }<br>
<br>
+/** Create a socket for clients with a specified file descriptor<br>
+ * \param display Wayland display<br>
+ * \param sock_fd The socket's file descriptor<br>
+ * \return The socket name or NULL if failed.<br>
+ *<br>
+ * Adds a new socket with a specified file descriptor but an<br>
+ * automatically determined socket name, in the form "wayland-N"<br>
+ * where N is a display number.<br>
+ *<br>
+ * \memberof wl_display<br>
+ */<br>
 WL_EXPORT const char *<br>
 wl_display_add_socket_fd_auto(struct wl_display *display, int sock_fd)<br>
 {<br>
@@ -1205,12 +1216,50 @@ wl_display_add_socket_fd_auto(struct wl_display *display, int sock_fd)<br>
        return NULL;<br>
 }<br>
<br>
+/** Create a socket for clients using default settings<br>
+ * \param display The Wayland display to which the socket should be added<br>
+ * \return The name of the created socket, or NULL if failed.<br>
+ *<br>
+ * This helper routine establishes a socket connection for Wayland clients<br>
+ * using an automatically socket address and file descriptor.<br>
+ *<br>
+ * See wl_display_add_socket_fd_auto.<br>
+ *<br>
+ * \memberof wl_display<br>
+ */<br>
 WL_EXPORT const char *<br>
 wl_display_add_socket_auto(struct wl_display *display)<br>
 {<br>
        return wl_display_add_socket_fd_auto(display, -1);<br>
 }<br>
<br>
+/** Add a socket with a defined file descriptor to the Wayland display for clients to connect.<br>
+ * \param display Wayland display to which the socket should be added.<br>
+ * \param name Name of the Unix socket.<br>
+ * \param sock_fd File descriptor of the Unix socket.<br>
+ * \return 0 if success. -1 if failed.<br>
+ *<br>
+ * This adds a Unix socket to Wayland display which can be used by clients to<br>
+ * connect to Wayland display.<br>
+ *<br>
+ * If NULL is passed as name, then it would look for WAYLAND_DISPLAY env<br>
+ * variable for the socket name. If WAYLAND_DISPLAY is not set, then default<br>
+ * wayland-0 is used.<br>
+ *<br>
+ * If -1 is passed for sock_id, a new local socket will be created.  A link to<br>
+ * this socket will be made available in display->socket_list.<br>
+ *<br>
+ * This Unix socket will be created in the directory pointed to by environment<br>
+ * variable XDG_RUNTIME_DIR. If XDG_RUNTIME_DIR is not set, then this function<br>
+ * fails and returns -1.<br>
+ *<br>
+ * The length of socket path, i.e., the path set in XDG_RUNTIME_DIR and the<br>
+ * socket name, must not exceed the maxium length of a Unix socket path.<br>
+ * The function also fails if the user do not have write permission in the<br>
+ * XDG_RUNTIME_DIR path or if the socket name is already in use.<br>
+ *<br>
+ * \memberof wl_display<br>
+ */<br>
 WL_EXPORT int<br>
 wl_display_add_socket_fd(struct wl_display *display, const char *name, int sock_fd)<br>
 {<br>
@@ -1251,21 +1300,11 @@ wl_display_add_socket_fd(struct wl_display *display, const char *name, int sock_<br>
  * \param name Name of the Unix socket.<br>
  * \return 0 if success. -1 if failed.<br>
  *<br>
- * This adds a Unix socket to Wayland display which can be used by clients to<br>
- * connect to Wayland display.<br>
- *<br>
- * If NULL is passed as name, then it would look for WAYLAND_DISPLAY env<br>
- * variable for the socket name. If WAYLAND_DISPLAY is not set, then default<br>
- * wayland-0 is used.<br>
+ * This adds a Unix socket to Wayland display with an automatically<br>
+ * created file descriptor, which can be used by clients to connect to<br>
+ * the Wayland display.<br>
  *<br>
- * The Unix socket will be created in the directory pointed to by environment<br>
- * variable XDG_RUNTIME_DIR. If XDG_RUNTIME_DIR is not set, then this function<br>
- * fails and returns -1.<br>
- *<br>
- * The length of socket path, i.e., the path set in XDG_RUNTIME_DIR and the<br>
- * socket name, must not exceed the maxium length of a Unix socket path.<br>
- * The function also fails if the user do not have write permission in the<br>
- * XDG_RUNTIME_DIR path or if the socket name is already in use.<br>
+ * See wl_display_add_socket_fd for more details.<br>
  *<br>
  * \memberof wl_display<br>
  */<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.9.1<br>
<br>
_______________________________________________<br>
wayland-devel mailing list<br>
<a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
</font></span></blockquote></div><br></div>