Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F155025016
D23643.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
28 KB
Referenced Files
None
Subscribers
None
D23643.diff
View Options
Index: head/graphics/wayland/Makefile
===================================================================
--- head/graphics/wayland/Makefile
+++ head/graphics/wayland/Makefile
@@ -2,7 +2,7 @@
# $FreeBSD$
PORTNAME= wayland
-PORTVERSION= 1.17.0
+PORTVERSION= 1.18.0
CATEGORIES= graphics wayland
MASTER_SITES= https://wayland.freedesktop.org/releases/
@@ -23,7 +23,7 @@
USE_LDCONFIG= yes
GNU_CONFIGURE= yes
CONFIGURE_ARGS= --disable-documentation
-CONFIGURE_ENV= ac_cv_func_posix_fallocate=no # EINVAL for many FS on 12.0
+CONFIGURE_ENV= ac_cv_func_posix_fallocate=no # EINVAL on ZFS since FreeBSD 12.0
INSTALL_TARGET= install-strip
.include <bsd.port.mk>
Index: head/graphics/wayland/distinfo
===================================================================
--- head/graphics/wayland/distinfo
+++ head/graphics/wayland/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1553129725
-SHA256 (wayland-1.17.0.tar.xz) = 72aa11b8ac6e22f4777302c9251e8fec7655dc22f9d94ee676c6b276f95f91a4
-SIZE (wayland-1.17.0.tar.xz) = 437680
+TIMESTAMP = 1581464763
+SHA256 (wayland-1.18.0.tar.xz) = 4675a79f091020817a98fd0484e7208c8762242266967f55a67776936c2e294d
+SIZE (wayland-1.18.0.tar.xz) = 453968
Index: head/graphics/wayland/files/patch-Makefile.am
===================================================================
--- head/graphics/wayland/files/patch-Makefile.am
+++ head/graphics/wayland/files/patch-Makefile.am
@@ -1,29 +1,29 @@
---- Makefile.am.orig 2019-03-21 00:55:25 UTC
+--- Makefile.am.orig 2020-02-11 23:46:03 UTC
+++ Makefile.am
-@@ -71,7 +71,7 @@ nodist_include_HEADERS = \
+@@ -73,7 +73,7 @@ nodist_include_HEADERS = \
protocol/wayland-client-protocol.h
libwayland_server_la_CFLAGS = $(FFI_CFLAGS) $(AM_CFLAGS) -pthread
--libwayland_server_la_LIBADD = $(FFI_LIBS) libwayland-private.la libwayland-util.la -lrt -lm
-+libwayland_server_la_LIBADD = $(FFI_LIBS) $(EPOLLSHIM_LIBS) libwayland-private.la libwayland-util.la -lrt -lm
+-libwayland_server_la_LIBADD = $(FFI_LIBS) libwayland-private.la libwayland-util.la $(RT_LIBS) -lm
++libwayland_server_la_LIBADD = $(FFI_LIBS) $(EPOLLSHIM_LIBS) libwayland-private.la libwayland-util.la $(RT_LIBS) -lm
libwayland_server_la_LDFLAGS = -version-info 1:0:1
libwayland_server_la_SOURCES = \
src/wayland-server.c \
-@@ -83,7 +83,7 @@ nodist_libwayland_server_la_SOURCES = \
+@@ -85,7 +85,7 @@ nodist_libwayland_server_la_SOURCES = \
protocol/wayland-protocol.c
libwayland_client_la_CFLAGS = $(FFI_CFLAGS) $(AM_CFLAGS) -pthread
--libwayland_client_la_LIBADD = $(FFI_LIBS) libwayland-private.la libwayland-util.la -lrt -lm
-+libwayland_client_la_LIBADD = $(FFI_LIBS) $(EPOLLSHIM_LIBS) libwayland-private.la libwayland-util.la -lrt -lm
+-libwayland_client_la_LIBADD = $(FFI_LIBS) libwayland-private.la libwayland-util.la $(RT_LIBS) -lm
++libwayland_client_la_LIBADD = $(FFI_LIBS) $(EPOLLSHIM_LIBS) libwayland-private.la libwayland-util.la $(RT_LIBS) -lm
libwayland_client_la_LDFLAGS = -version-info 3:0:3
libwayland_client_la_SOURCES = \
src/wayland-client.c
-@@ -227,7 +227,7 @@ libtest_runner_la_LIBADD = \
+@@ -230,7 +230,7 @@ libtest_runner_la_LIBADD = \
libwayland-client.la \
libwayland-server.la \
libtest-helpers.la \
-- -lrt -ldl $(FFI_LIBS)
-+ -lrt $(DL_LIBS) $(FFI_LIBS) $(EPOLLSHIM_LIBS)
+- $(RT_LIBS) $(DL_LIBS) $(FFI_LIBS)
++ $(RT_LIBS) $(DL_LIBS) $(FFI_LIBS) $(EPOLLSHIM_LIBS)
array_test_SOURCES = tests/array-test.c
array_test_LDADD = libtest-runner.la
Index: head/graphics/wayland/files/patch-configure.ac
===================================================================
--- head/graphics/wayland/files/patch-configure.ac
+++ head/graphics/wayland/files/patch-configure.ac
@@ -1,8 +1,8 @@
---- configure.ac.orig 2018-08-24 18:04:36 UTC
+--- configure.ac.orig 2020-02-11 23:46:03 UTC
+++ configure.ac
-@@ -65,6 +65,25 @@ AC_SUBST(GCC_CFLAGS)
- AC_CHECK_HEADERS([sys/prctl.h])
- AC_CHECK_FUNCS([accept4 mkostemp posix_fallocate prctl])
+@@ -71,6 +71,25 @@ WESTON_SEARCH_LIBS([DL], [dl], [dlsym])
+ # OpenBSD doesn't have librt, but it has its functions in libc
+ WESTON_SEARCH_LIBS([RT], [rt], [clock_gettime])
+AC_CHECK_HEADERS([sys/signalfd.h sys/timerfd.h])
+
@@ -26,7 +26,7 @@
AC_ARG_ENABLE([libraries],
[AC_HELP_STRING([--disable-libraries],
[Disable compilation of wayland libraries])],
-@@ -100,16 +119,20 @@ AC_SUBST([ICONDIR])
+@@ -106,16 +125,20 @@ AC_SUBST([ICONDIR])
if test "x$enable_libraries" = "xyes"; then
PKG_CHECK_MODULES(FFI, [libffi])
Index: head/graphics/wayland/files/patch-cursor_os-compatibility.c
===================================================================
--- head/graphics/wayland/files/patch-cursor_os-compatibility.c
+++ head/graphics/wayland/files/patch-cursor_os-compatibility.c
@@ -1,60 +1,21 @@
---- cursor/os-compatibility.c.orig 2019-03-21 00:55:25 UTC
+--- cursor/os-compatibility.c.orig 2020-02-11 23:46:03 UTC
+++ cursor/os-compatibility.c
-@@ -23,6 +23,10 @@
- * SOFTWARE.
- */
+@@ -34,7 +34,7 @@
+ #include <string.h>
+ #include <stdlib.h>
-+#ifdef __FreeBSD__
-+#include <sys/mman.h>
-+#endif
-+
- #define _GNU_SOURCE
-
- #include <sys/types.h>
-@@ -59,6 +63,7 @@ err:
- }
+-#ifdef HAVE_MEMFD_CREATE
++#if defined(HAVE_MEMFD_CREATE) || defined(__FreeBSD__)
+ #include <sys/mman.h>
#endif
-+#ifndef __FreeBSD__
- static int
- create_tmpfile_cloexec(char *tmpname)
- {
-@@ -78,6 +83,7 @@ create_tmpfile_cloexec(char *tmpname)
-
- return fd;
- }
-+#endif
-
- /*
- * Create a new, unique, anonymous file of the given size, and
-@@ -103,11 +109,14 @@ create_tmpfile_cloexec(char *tmpname)
- int
- os_create_anonymous_file(off_t size)
- {
-+ int fd;
-+ int ret;
-+#ifdef __FreeBSD__
+@@ -132,6 +132,9 @@ os_create_anonymous_file(off_t size)
+ */
+ fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK | F_SEAL_SEAL);
+ } else
++#elif defined(__FreeBSD__)
+ fd = shm_open(SHM_ANON, O_CREAT | O_RDWR | O_CLOEXEC, 0600); // shm_open is always CLOEXEC
-+#else
- static const char template[] = "/wayland-cursor-shared-XXXXXX";
- const char *path;
- char *name;
-- int fd;
-- int ret;
-
- path = getenv("XDG_RUNTIME_DIR");
- if (!path) {
-@@ -125,11 +134,12 @@ os_create_anonymous_file(off_t size)
- fd = create_tmpfile_cloexec(name);
-
- free(name);
-+#endif /* __FreeBSD__ */
-
- if (fd < 0)
- return -1;
-
--#ifdef HAVE_POSIX_FALLOCATE
-+#if defined(HAVE_POSIX_FALLOCATE) && !defined(__FreeBSD__)
- ret = posix_fallocate(fd, 0, size);
- if (ret != 0) {
- close(fd);
++ if (fd < 0)
+ #endif
+ {
+ path = getenv("XDG_RUNTIME_DIR");
Index: head/graphics/wayland/files/patch-src_event-loop.c
===================================================================
--- head/graphics/wayland/files/patch-src_event-loop.c
+++ head/graphics/wayland/files/patch-src_event-loop.c
@@ -0,0 +1,562 @@
+Temporarily revert https://gitlab.freedesktop.org/wayland/wayland/commit/60a8d29ad852
+until https://github.com/jiixyj/epoll-shim/issues/15 is fixed
+
+--- src/event-loop.c.orig 2020-02-11 23:46:03 UTC
++++ src/event-loop.c
+@@ -23,7 +23,6 @@
+ * SOFTWARE.
+ */
+
+-#include <assert.h>
+ #include <stddef.h>
+ #include <stdio.h>
+ #include <errno.h>
+@@ -46,27 +45,6 @@
+
+ /** \cond INTERNAL */
+
+-#define TIMER_REMOVED -2
+-
+-struct wl_event_loop;
+-struct wl_event_source_interface;
+-struct wl_event_source_timer;
+-
+-struct wl_event_source {
+- struct wl_event_source_interface *interface;
+- struct wl_event_loop *loop;
+- struct wl_list link;
+- void *data;
+- int fd;
+-};
+-
+-struct wl_timer_heap {
+- struct wl_event_source base;
+- /* pointers to the user-visible event sources */
+- struct wl_event_source_timer **data;
+- int space, active, count;
+-};
+-
+ struct wl_event_loop {
+ int epoll_fd;
+ struct wl_list check_list;
+@@ -74,8 +52,6 @@ struct wl_event_loop {
+ struct wl_list destroy_list;
+
+ struct wl_signal destroy_signal;
+-
+- struct wl_timer_heap timers;
+ };
+
+ struct wl_event_source_interface {
+@@ -83,6 +59,13 @@ struct wl_event_source_interface {
+ struct epoll_event *ep);
+ };
+
++struct wl_event_source {
++ struct wl_event_source_interface *interface;
++ struct wl_event_loop *loop;
++ struct wl_list link;
++ void *data;
++ int fd;
++};
+
+ struct wl_event_source_fd {
+ struct wl_event_source base;
+@@ -232,319 +215,31 @@ wl_event_source_fd_update(struct wl_event_source *sour
+ struct wl_event_source_timer {
+ struct wl_event_source base;
+ wl_event_loop_timer_func_t func;
+- struct wl_event_source_timer *next_due;
+- struct timespec deadline;
+- int heap_idx;
+ };
+
+-static int
+-noop_dispatch(struct wl_event_source *source,
+- struct epoll_event *ep) {
+- return 0;
+-}
++/** \endcond */
+
+-struct wl_event_source_interface timer_heap_source_interface = {
+- noop_dispatch,
+-};
+-
+-static bool
+-time_lt(struct timespec ta, struct timespec tb)
+-{
+- if (ta.tv_sec != tb.tv_sec) {
+- return ta.tv_sec < tb.tv_sec;
+- }
+- return ta.tv_nsec < tb.tv_nsec;
+-}
+-
+ static int
+-set_timer(int timerfd, struct timespec deadline) {
+- struct itimerspec its;
+-
+- its.it_interval.tv_sec = 0;
+- its.it_interval.tv_nsec = 0;
+- its.it_value = deadline;
+- return timerfd_settime(timerfd, TFD_TIMER_ABSTIME, &its, NULL);
+-}
+-
+-static int
+-clear_timer(int timerfd)
+-{
+- struct itimerspec its;
+-
+- its.it_interval.tv_sec = 0;
+- its.it_interval.tv_nsec = 0;
+- its.it_value.tv_sec = 0;
+- its.it_value.tv_nsec = 0;
+- return timerfd_settime(timerfd, 0, &its, NULL);
+-}
+-
+-static void
+-wl_timer_heap_init(struct wl_timer_heap *timers, struct wl_event_loop *loop)
+-{
+- timers->base.fd = -1;
+- timers->base.data = NULL;
+- wl_list_init(&timers->base.link);
+- timers->base.interface = &timer_heap_source_interface;
+- timers->base.loop = loop;
+-
+- loop->timers.data = NULL;
+- loop->timers.active = 0;
+- loop->timers.space = 0;
+- loop->timers.count = 0;
+-}
+-
+-static void
+-wl_timer_heap_release(struct wl_timer_heap *timers)
+-{
+- if (timers->base.fd != -1) {
+- close(timers->base.fd);
+- }
+- free(timers->data);
+-}
+-
+-static int
+-wl_timer_heap_ensure_timerfd(struct wl_timer_heap *timers)
+-{
+- struct epoll_event ep;
+- int timer_fd;
+-
+- if (timers->base.fd != -1)
+- return 0;
+-
+- memset(&ep, 0, sizeof ep);
+- ep.events = EPOLLIN;
+- ep.data.ptr = timers;
+-
+- timer_fd = timerfd_create(CLOCK_MONOTONIC,
+- TFD_CLOEXEC | TFD_NONBLOCK);
+- if (timer_fd < 0)
+- return -1;
+-
+- if (epoll_ctl(timers->base.loop->epoll_fd,
+- EPOLL_CTL_ADD, timer_fd, &ep) < 0) {
+- close(timer_fd);
+- return -1;
+- }
+-
+- timers->base.fd = timer_fd;
+- return 0;
+-}
+-
+-static int
+-wl_timer_heap_reserve(struct wl_timer_heap *timers)
+-{
+- struct wl_event_source_timer **n;
+- int new_space;
+-
+- if (timers->count + 1 > timers->space) {
+- new_space = timers->space >= 8 ? timers->space * 2 : 8;
+- n = realloc(timers->data, (size_t)new_space * sizeof(*n));
+- if (!n) {
+- wl_log("Allocation failure when expanding timer list");
+- return -1;
+- }
+- timers->data = n;
+- timers->space = new_space;
+- }
+-
+- timers->count++;
+- return 0;
+-}
+-
+-static void
+-wl_timer_heap_unreserve(struct wl_timer_heap *timers)
+-{
+- struct wl_event_source_timer **n;
+-
+- timers->count--;
+-
+- if (timers->space >= 16 && timers->space >= 4 * timers->count) {
+- n = realloc(timers->data, (size_t)timers->space / 2 * sizeof(*n));
+- if (!n) {
+- wl_log("Reallocation failure when shrinking timer list");
+- return;
+- }
+- timers->data = n;
+- timers->space = timers->space / 2;
+- }
+-}
+-
+-static int
+-heap_set(struct wl_event_source_timer **data,
+- struct wl_event_source_timer *a,
+- int idx)
+-{
+- int tmp;
+-
+- tmp = a->heap_idx;
+- a->heap_idx = idx;
+- data[a->heap_idx] = a;
+-
+- return tmp;
+-}
+-
+-static void
+-heap_sift_down(struct wl_event_source_timer **data,
+- int num_active,
+- struct wl_event_source_timer *source)
+-{
+- struct wl_event_source_timer *child, *other_child;
+- int cursor_idx;
+- struct timespec key;
+-
+- cursor_idx = source->heap_idx;
+- key = source->deadline;
+- while (1) {
+- int lchild_idx = cursor_idx * 2 + 1;
+-
+- if (lchild_idx >= num_active) {
+- break;
+- }
+-
+- child = data[lchild_idx];
+- if (lchild_idx + 1 < num_active) {
+- other_child = data[lchild_idx + 1];
+- if (time_lt(other_child->deadline, child->deadline))
+- child = other_child;
+- }
+-
+- if (time_lt(child->deadline, key))
+- cursor_idx = heap_set(data, child, cursor_idx);
+- else
+- break;
+- }
+-
+- heap_set(data, source, cursor_idx);
+-}
+-
+-static void
+-heap_sift_up(struct wl_event_source_timer **data,
+- struct wl_event_source_timer *source)
+-{
+- int cursor_idx;
+- struct timespec key;
+-
+- cursor_idx = source->heap_idx;
+- key = source->deadline;
+- while (cursor_idx > 0) {
+- struct wl_event_source_timer *parent =
+- data[(cursor_idx - 1) / 2];
+-
+- if (time_lt(key, parent->deadline))
+- cursor_idx = heap_set(data, parent, cursor_idx);
+- else
+- break;
+- }
+- heap_set(data, source, cursor_idx);
+-}
+-
+-/* requires timer be armed */
+-static void
+-wl_timer_heap_disarm(struct wl_timer_heap *timers,
+- struct wl_event_source_timer *source)
+-{
+- struct wl_event_source_timer *last_end_evt;
+- int old_source_idx;
+-
+- assert(source->heap_idx >= 0);
+-
+- old_source_idx = source->heap_idx;
+- source->heap_idx = -1;
+- source->deadline.tv_sec = 0;
+- source->deadline.tv_nsec = 0;
+-
+- last_end_evt = timers->data[timers->active - 1];
+- timers->data[timers->active - 1] = NULL;
+- timers->active--;
+-
+- if (old_source_idx == timers->active)
+- return;
+-
+- timers->data[old_source_idx] = last_end_evt;
+- last_end_evt->heap_idx = old_source_idx;
+-
+- /* Move the displaced (active) element to its proper place.
+- * Only one of sift-down and sift-up will have any effect */
+- heap_sift_down(timers->data, timers->active, last_end_evt);
+- heap_sift_up(timers->data, last_end_evt);
+-}
+-
+-/* requires timer be disarmed */
+-static void
+-wl_timer_heap_arm(struct wl_timer_heap *timers,
+- struct wl_event_source_timer *source,
+- struct timespec deadline)
+-{
+- assert(source->heap_idx == -1);
+-
+- source->deadline = deadline;
+- timers->data[timers->active] = source;
+- source->heap_idx = timers->active;
+- timers->active++;
+- heap_sift_up(timers->data, source);
+-}
+-
+-
+-static int
+-wl_timer_heap_dispatch(struct wl_timer_heap *timers)
+-{
+- struct timespec now;
+- struct wl_event_source_timer *root;
+- struct wl_event_source_timer *list_cursor = NULL, *list_tail = NULL;
+-
+- clock_gettime(CLOCK_MONOTONIC, &now);
+-
+- while (timers->active > 0) {
+- root = timers->data[0];
+- if (time_lt(now, root->deadline))
+- break;
+-
+- wl_timer_heap_disarm(timers, root);
+-
+- if (list_cursor == NULL)
+- list_cursor = root;
+- else
+- list_tail->next_due = root;
+- list_tail = root;
+- }
+- if (list_tail)
+- list_tail->next_due = NULL;
+-
+- if (timers->active > 0) {
+- if (set_timer(timers->base.fd, timers->data[0]->deadline) < 0)
+- return -1;
+- } else {
+- if (clear_timer(timers->base.fd) < 0)
+- return -1;
+- }
+-
+- /* Execute precisely the functions for events before `now`, in order.
+- * Because wl_event_loop_dispatch ignores return codes, do the same
+- * here as well */
+- for (; list_cursor; list_cursor = list_cursor->next_due) {
+- if (list_cursor->base.fd != TIMER_REMOVED)
+- list_cursor->func(list_cursor->base.data);
+- }
+-
+- return 0;
+-}
+-
+-static int
+ wl_event_source_timer_dispatch(struct wl_event_source *source,
+ struct epoll_event *ep)
+ {
+- struct wl_event_source_timer *timer;
++ struct wl_event_source_timer *timer_source =
++ (struct wl_event_source_timer *) source;
++ uint64_t expires;
++ int len;
+
+- timer = wl_container_of(source, timer, base);
+- return timer->func(timer->base.data);
++ len = read(source->fd, &expires, sizeof expires);
++ if (!(len == -1 && errno == EAGAIN) && len != sizeof expires)
++ /* Is there anything we can do here? Will this ever happen? */
++ wl_log("timerfd read error: %s\n", strerror(errno));
++
++ return timer_source->func(timer_source->base.data);
+ }
+
+ struct wl_event_source_interface timer_source_interface = {
+ wl_event_source_timer_dispatch,
+ };
+
+-/** \endcond */
+-
+ /** Create a timer event source
+ *
+ * \param loop The event loop that will process the new source.
+@@ -565,30 +260,16 @@ wl_event_loop_add_timer(struct wl_event_loop *loop,
+ {
+ struct wl_event_source_timer *source;
+
+- if (wl_timer_heap_ensure_timerfd(&loop->timers) < 0)
+- return NULL;
+-
+ source = malloc(sizeof *source);
+ if (source == NULL)
+ return NULL;
+
+ source->base.interface = &timer_source_interface;
+- source->base.fd = -1;
++ source->base.fd = timerfd_create(CLOCK_MONOTONIC,
++ TFD_CLOEXEC | TFD_NONBLOCK);
+ source->func = func;
+- source->base.loop = loop;
+- source->base.data = data;
+- wl_list_init(&source->base.link);
+- source->next_due = NULL;
+- source->deadline.tv_sec = 0;
+- source->deadline.tv_nsec = 0;
+- source->heap_idx = -1;
+
+- if (wl_timer_heap_reserve(&loop->timers) < 0) {
+- free(source);
+- return NULL;
+- }
+-
+- return &source->base;
++ return add_source(loop, &source->base, WL_EVENT_READABLE, data);
+ }
+
+ /** Arm or disarm a timer
+@@ -610,51 +291,15 @@ wl_event_loop_add_timer(struct wl_event_loop *loop,
+ WL_EXPORT int
+ wl_event_source_timer_update(struct wl_event_source *source, int ms_delay)
+ {
+- struct wl_event_source_timer *tsource =
+- wl_container_of(source, tsource, base);
+- struct wl_timer_heap *timers = &tsource->base.loop->timers;
++ struct itimerspec its;
+
+- if (ms_delay > 0) {
+- struct timespec deadline;
++ its.it_interval.tv_sec = 0;
++ its.it_interval.tv_nsec = 0;
++ its.it_value.tv_sec = ms_delay / 1000;
++ its.it_value.tv_nsec = (ms_delay % 1000) * 1000 * 1000;
++ if (timerfd_settime(source->fd, 0, &its, NULL) < 0)
++ return -1;
+
+- clock_gettime(CLOCK_MONOTONIC, &deadline);
+-
+- deadline.tv_nsec += (ms_delay % 1000) * 1000000L;
+- deadline.tv_sec += ms_delay / 1000;
+- if (deadline.tv_nsec >= 1000000000L) {
+- deadline.tv_nsec -= 1000000000L;
+- deadline.tv_sec += 1;
+- }
+-
+- if (tsource->heap_idx == -1) {
+- wl_timer_heap_arm(timers, tsource, deadline);
+- } else if (time_lt(deadline, tsource->deadline)) {
+- tsource->deadline = deadline;
+- heap_sift_up(timers->data, tsource);
+- } else {
+- tsource->deadline = deadline;
+- heap_sift_down(timers->data, timers->active, tsource);
+- }
+-
+- if (tsource->heap_idx == 0) {
+- /* Only update the timerfd if the new deadline is
+- * the earliest */
+- if (set_timer(timers->base.fd, deadline) < 0)
+- return -1;
+- }
+- } else {
+- if (tsource->heap_idx == -1)
+- return 0;
+- wl_timer_heap_disarm(timers, tsource);
+-
+- if (timers->active == 0) {
+- /* Only update the timerfd if this was the last
+- * active timer */
+- if (clear_timer(timers->base.fd) < 0)
+- return -1;
+- }
+- }
+-
+ return 0;
+ }
+
+@@ -838,17 +483,6 @@ wl_event_source_remove(struct wl_event_source *source)
+ source->fd = -1;
+ }
+
+- if (source->interface == &timer_source_interface &&
+- source->fd != TIMER_REMOVED) {
+- /* Disarm the timer (and the loop's timerfd, if necessary),
+- * before removing its space in the loop timer heap */
+- wl_event_source_timer_update(source, 0);
+- wl_timer_heap_unreserve(&loop->timers);
+- /* Set the fd field to to indicate that the timer should NOT
+- * be dispatched in `wl_event_loop_dispatch` */
+- source->fd = TIMER_REMOVED;
+- }
+-
+ wl_list_remove(&source->link);
+ wl_list_insert(&loop->destroy_list, &source->link);
+
+@@ -900,8 +534,6 @@ wl_event_loop_create(void)
+
+ wl_signal_init(&loop->destroy_signal);
+
+- wl_timer_heap_init(&loop->timers, loop);
+-
+ return loop;
+ }
+
+@@ -924,7 +556,6 @@ wl_event_loop_destroy(struct wl_event_loop *loop)
+ wl_signal_emit(&loop->destroy_signal, loop);
+
+ wl_event_loop_process_destroy_list(loop);
+- wl_timer_heap_release(&loop->timers);
+ close(loop->epoll_fd);
+ free(loop);
+ }
+@@ -975,7 +606,7 @@ wl_event_loop_dispatch_idle(struct wl_event_loop *loop
+ *
+ * \param loop The event loop whose sources to wait for.
+ * \param timeout The polling timeout in milliseconds.
+- * \return 0 for success, -1 for polling (or timer update) error.
++ * \return 0 for success, -1 for polling error.
+ *
+ * All the associated event sources are polled. This function blocks until
+ * any event source delivers an event (idle sources excluded), or the timeout
+@@ -997,29 +628,12 @@ wl_event_loop_dispatch(struct wl_event_loop *loop, int
+ struct epoll_event ep[32];
+ struct wl_event_source *source;
+ int i, count;
+- bool has_timers = false;
+
+ wl_event_loop_dispatch_idle(loop);
+
+ count = epoll_wait(loop->epoll_fd, ep, ARRAY_LENGTH(ep), timeout);
+ if (count < 0)
+ return -1;
+-
+- for (i = 0; i < count; i++) {
+- source = ep[i].data.ptr;
+- if (source == &loop->timers.base)
+- has_timers = true;
+- }
+-
+- if (has_timers) {
+- /* Dispatch timer sources before non-timer sources, so that
+- * the non-timer sources can not cancel (by calling
+- * `wl_event_source_timer_update`) the dispatching of the timers
+- * (Note that timer sources also can't cancel pending non-timer
+- * sources, since epoll_wait has already been called) */
+- if (wl_timer_heap_dispatch(&loop->timers) < 0)
+- return -1;
+- }
+
+ for (i = 0; i < count; i++) {
+ source = ep[i].data.ptr;
Index: head/graphics/wayland/files/patch-src_wayland-server.c
===================================================================
--- head/graphics/wayland/files/patch-src_wayland-server.c
+++ head/graphics/wayland/files/patch-src_wayland-server.c
@@ -1,4 +1,4 @@
---- src/wayland-server.c.orig 2018-04-09 17:19:26 UTC
+--- src/wayland-server.c.orig 2020-02-11 23:46:03 UTC
+++ src/wayland-server.c
@@ -25,6 +25,8 @@
@@ -6,10 +6,10 @@
+#include "../config.h"
+
+ #include <stdbool.h>
#include <stdlib.h>
#include <stdint.h>
- #include <stddef.h>
-@@ -43,6 +45,11 @@
+@@ -44,6 +46,11 @@
#include <sys/file.h>
#include <sys/stat.h>
@@ -20,8 +20,8 @@
+
#include "wayland-util.h"
#include "wayland-private.h"
- #include "wayland-server.h"
-@@ -77,7 +84,13 @@ struct wl_client {
+ #include "wayland-server-private.h"
+@@ -79,7 +86,13 @@ struct wl_client {
struct wl_list link;
struct wl_map objects;
struct wl_priv_signal destroy_signal;
@@ -35,7 +35,7 @@
int error;
struct wl_priv_signal resource_created_signal;
};
-@@ -303,7 +316,13 @@ wl_resource_post_error(struct wl_resource *resource,
+@@ -315,7 +328,13 @@ wl_resource_post_error(struct wl_resource *resource,
static void
destroy_client_with_error(struct wl_client *client, const char *reason)
{
@@ -49,7 +49,7 @@
wl_client_destroy(client);
}
-@@ -517,10 +536,20 @@ wl_client_create(struct wl_display *display, int fd)
+@@ -529,10 +548,20 @@ wl_client_create(struct wl_display *display, int fd)
if (!client->source)
goto err_client;
@@ -70,7 +70,7 @@
client->connection = wl_connection_create(fd);
if (client->connection == NULL)
-@@ -574,12 +603,23 @@ WL_EXPORT void
+@@ -586,12 +615,23 @@ WL_EXPORT void
wl_client_get_credentials(struct wl_client *client,
pid_t *pid, uid_t *uid, gid_t *gid)
{
Index: head/graphics/wayland/files/patch-src_wayland-shm.c
===================================================================
--- head/graphics/wayland/files/patch-src_wayland-shm.c
+++ head/graphics/wayland/files/patch-src_wayland-shm.c
@@ -1,25 +1,25 @@
---- src/wayland-shm.c.orig 2018-04-09 17:19:26 UTC
+--- src/wayland-shm.c.orig 2020-02-11 23:46:03 UTC
+++ src/wayland-shm.c
-@@ -30,6 +30,8 @@
+@@ -32,6 +32,8 @@
- #define _GNU_SOURCE
+ #include "config.h"
+#include "../config.h"
+
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
-@@ -59,6 +61,9 @@ struct wl_shm_pool {
- char *data;
+@@ -64,6 +66,9 @@ struct wl_shm_pool {
int32_t size;
int32_t new_size;
+ bool sigbus_is_impossible;
+#ifdef HAVE_SYS_UCRED_H
+ int fd;
+#endif
};
struct wl_shm_buffer {
-@@ -76,15 +81,24 @@ struct wl_shm_sigbus_data {
+@@ -81,15 +86,24 @@ struct wl_shm_sigbus_data {
int fallback_mapping_used;
};
@@ -45,7 +45,7 @@
if (data == MAP_FAILED) {
wl_resource_post_error(pool->resource,
WL_SHM_ERROR_INVALID_FD,
-@@ -110,6 +124,10 @@ shm_pool_unref(struct wl_shm_pool *pool, bool external
+@@ -115,6 +129,10 @@ shm_pool_unref(struct wl_shm_pool *pool, bool external
if (pool->internal_refcount + pool->external_refcount)
return;
@@ -56,7 +56,7 @@
munmap(pool->data, pool->size);
free(pool);
}
-@@ -223,6 +241,73 @@ shm_pool_destroy(struct wl_client *client, struct wl_r
+@@ -228,6 +246,73 @@ shm_pool_destroy(struct wl_client *client, struct wl_r
wl_resource_destroy(resource);
}
@@ -130,8 +130,8 @@
static void
shm_pool_resize(struct wl_client *client, struct wl_resource *resource,
int32_t size)
-@@ -284,7 +369,14 @@ shm_create_pool(struct wl_client *client, struct wl_re
- "failed mmap fd %d: %m", fd);
+@@ -300,7 +385,14 @@ shm_create_pool(struct wl_client *client, struct wl_re
+ strerror(errno));
goto err_free;
}
+
Index: head/graphics/wayland/files/patch-tests_event-loop-test.c
===================================================================
--- head/graphics/wayland/files/patch-tests_event-loop-test.c
+++ head/graphics/wayland/files/patch-tests_event-loop-test.c
@@ -1,6 +1,6 @@
---- tests/event-loop-test.c.orig 2017-08-08 18:20:52 UTC
+--- tests/event-loop-test.c.orig 2020-02-11 23:46:03 UTC
+++ tests/event-loop-test.c
-@@ -167,10 +167,10 @@ TEST(event_loop_signal)
+@@ -168,10 +168,10 @@ TEST(event_loop_signal)
signal_callback, &got_it);
assert(source);
@@ -14,26 +14,31 @@
assert(got_it == 1);
wl_event_source_remove(source);
-@@ -234,11 +234,19 @@ TEST(event_loop_timer)
+@@ -235,11 +235,11 @@ TEST(event_loop_timer)
- source = wl_event_loop_add_timer(loop, timer_callback, &got_it);
- assert(source);
-- wl_event_source_timer_update(source, 10);
-- wl_event_loop_dispatch(loop, 0);
-+ assert(wl_event_source_timer_update(source, 10) == 0);
-+ assert(wl_event_loop_dispatch(loop, 0) == 0);
- assert(!got_it);
-- wl_event_loop_dispatch(loop, 20);
-+ /* FreeBSD has a bug where it converts ms_timeout to ticks; it always adds 1 to the tick count.
-+ * Consequently, we need to grossly overcompensate here.
-+ * See: http://unix.derkeiler.com/Mailing-Lists/FreeBSD/hackers/2012-07/msg00319.html */
-+ assert(wl_event_loop_dispatch(loop, 50) == 0);
+ source1 = wl_event_loop_add_timer(loop, timer_callback, &got_it);
+ assert(source1);
+- wl_event_source_timer_update(source1, 20);
++ assert(wl_event_source_timer_update(source1, 20) == 0);
+
+ source2 = wl_event_loop_add_timer(loop, timer_callback, &got_it);
+ assert(source2);
+- wl_event_source_timer_update(source2, 100);
++ assert(wl_event_source_timer_update(source2, 100) == 0);
+
+ /* Check that the timer marked for 20 msec from now fires within 30
+ * msec, and that the timer marked for 100 msec is expected to fire
+@@ -248,11 +248,11 @@ TEST(event_loop_timer)
+
+ wl_event_loop_dispatch(loop, 0);
+ assert(got_it == 0);
+- wl_event_loop_dispatch(loop, 30);
++ assert(wl_event_loop_dispatch(loop, 30) == 0);
assert(got_it == 1);
-+
-+ /* Check it doesn't fire again. */
-+ got_it = 0;
-+ assert(wl_event_loop_dispatch(loop, 20) == 0);
-+ assert(!got_it);
+ wl_event_loop_dispatch(loop, 0);
+ assert(got_it == 1);
+- wl_event_loop_dispatch(loop, 90);
++ assert(wl_event_loop_dispatch(loop, 90) == 0);
+ assert(got_it == 2);
- wl_event_source_remove(source);
- wl_event_loop_destroy(loop);
+ wl_event_source_remove(source1);
Index: head/graphics/wayland/files/patch-tests_test-helpers.c
===================================================================
--- head/graphics/wayland/files/patch-tests_test-helpers.c
+++ head/graphics/wayland/files/patch-tests_test-helpers.c
@@ -1,4 +1,4 @@
---- tests/test-helpers.c.orig 2018-08-24 18:04:36 UTC
+--- tests/test-helpers.c.orig 2020-02-11 23:46:03 UTC
+++ tests/test-helpers.c
@@ -25,6 +25,12 @@
@@ -13,7 +13,7 @@
#include <assert.h>
#include <errno.h>
#include <dirent.h>
-@@ -40,6 +46,16 @@
+@@ -41,6 +47,16 @@
#include "test-runner.h"
@@ -30,7 +30,7 @@
int
count_open_fds(void)
{
-@@ -47,8 +63,8 @@ count_open_fds(void)
+@@ -48,8 +64,8 @@ count_open_fds(void)
struct dirent *ent;
int count = 0;
@@ -41,7 +41,7 @@
errno = 0;
while ((ent = readdir(dir))) {
-@@ -57,7 +73,7 @@ count_open_fds(void)
+@@ -58,7 +74,7 @@ count_open_fds(void)
continue;
count++;
}
Index: head/graphics/wayland/files/patch-tests_test-runner.c
===================================================================
--- head/graphics/wayland/files/patch-tests_test-runner.c
+++ head/graphics/wayland/files/patch-tests_test-runner.c
@@ -1,4 +1,4 @@
---- tests/test-runner.c.orig 2019-03-21 00:55:25 UTC
+--- tests/test-runner.c.orig 2020-02-11 23:46:03 UTC
+++ tests/test-runner.c
@@ -25,6 +25,12 @@
@@ -102,9 +102,9 @@
+#ifdef HAVE_WAITID
+ if (waitid(P_PID, 0, &info, WEXITED)) {
stderr_set_color(RED);
- fprintf(stderr, "waitid failed: %m\n");
- stderr_reset_color();
-@@ -367,6 +393,25 @@ int main(int argc, char *argv[])
+ fprintf(stderr, "waitid failed: %s\n",
+ strerror(errno));
+@@ -368,6 +394,25 @@ int main(int argc, char *argv[])
break;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, May 1, 6:32 PM (2 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32592925
Default Alt Text
D23643.diff (28 KB)
Attached To
Mode
D23643: graphics/wayland: Update to 1.18
Attached
Detach File
Event Timeline
Log In to Comment