mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-03-11 05:34:41 -04:00
server: add wl_display_remove_socket_fd()
Undoes wl_display_add_socket_fd(). Useful for protocols such as: https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/68 Signed-off-by: Simon Ser <contact@emersion.fr>
This commit is contained in:
parent
56dfdb7614
commit
6c258a7ae5
2 changed files with 34 additions and 0 deletions
|
|
@ -205,6 +205,9 @@ wl_display_add_socket_auto(struct wl_display *display);
|
||||||
int
|
int
|
||||||
wl_display_add_socket_fd(struct wl_display *display, int sock_fd);
|
wl_display_add_socket_fd(struct wl_display *display, int sock_fd);
|
||||||
|
|
||||||
|
int
|
||||||
|
wl_display_remove_socket_fd(struct wl_display *display, int sock_fd);
|
||||||
|
|
||||||
void
|
void
|
||||||
wl_display_terminate(struct wl_display *display);
|
wl_display_terminate(struct wl_display *display);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1777,6 +1777,37 @@ wl_display_add_socket_fd(struct wl_display *display, int sock_fd)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Remove a socket fd from the Wayland display.
|
||||||
|
*
|
||||||
|
* \param display Wayland display to which the socket should be added.
|
||||||
|
* \param sock_fd The socket file descriptor to be removed
|
||||||
|
* \return 0 if success. -1 if failed.
|
||||||
|
*
|
||||||
|
* Remove a socket fd previously added via wl_display_add_socket_fd().
|
||||||
|
*
|
||||||
|
* \memberof wl_display
|
||||||
|
* \since 1.22.90
|
||||||
|
*/
|
||||||
|
WL_EXPORT int
|
||||||
|
wl_display_remove_socket_fd(struct wl_display *display, int sock_fd)
|
||||||
|
{
|
||||||
|
struct wl_socket *s;
|
||||||
|
bool found;
|
||||||
|
|
||||||
|
found = false;
|
||||||
|
wl_list_for_each(s, &display->socket_list, link) {
|
||||||
|
if (s->fd == sock_fd) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
wl_socket_destroy(s);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/** Add a socket to Wayland display for the clients to connect.
|
/** Add a socket to Wayland display for the clients to connect.
|
||||||
*
|
*
|
||||||
* \param display Wayland display to which the socket should be added.
|
* \param display Wayland display to which the socket should be added.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue