1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
7 SDESC[standard]= Wayland Display Protocol implementation
8 HOMEPAGE= https://wayland.freedesktop.org/
9 CONTACT= Peeter_Must[karu.pruun@gmail.com]
12 SITES[main]= https://gitlab.freedesktop.org/wayland/wayland/-/releases/1.21.0/downloads/
13 DISTFILE[1]= wayland-1.21.0.tar.xz:main
15 SPKGS[standard]= complete
18 OPTIONS_AVAILABLE= none
19 OPTIONS_STANDARD= none
21 ONLY_FOR_OPSYS= dragonfly
23 BUILD_DEPENDS= libxslt:single:standard
24 BUILDRUN_DEPENDS= libffi:single:standard
26 USES= cpe meson pkgconfig expat
27 GNOME_COMPONENTS= libxml2
30 LICENSE_FILE= MIT:{{WRKSRC}}/COPYING
33 FPC_EQUIVALENT= graphics/wayland
34 MESON_ARGS= -Ddocumentation=false
36 INSTALL_TARGET= install-strip
37 INSTALL_REQ_TOOLCHAIN= yes
39 [FILE:131:descriptions/desc.primary]
40 Wayland is intended as a simpler replacement for X, easier to develop
41 and maintain. GNOME and KDE are expected to be ported to it.
45 6dc64d7fc16837a693a51cfdb2e568db538bfdc9f457d4656285bb9594ef11ac 225936 wayland-1.21.0.tar.xz
48 [FILE:798:manifests/plist.primary]
52 wayland-client-protocol.h
59 wayland-server-protocol.h
65 libwayland-client.so.0
66 libwayland-client.so.0.21.0
68 libwayland-cursor.so.0
69 libwayland-cursor.so.0.21.0
72 libwayland-egl.so.1.21.0
74 libwayland-server.so.0
75 libwayland-server.so.0.21.0
79 wayland-egl-backend.pc
83 share/aclocal/wayland-scanner.m4
90 [FILE:1508:patches/patch-meson.build]
91 --- meson.build.orig 2022-10-22 10:59:58.476779000 +0200
92 +++ meson.build 2022-10-31 16:12:58.994390000 +0100
94 config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
97 -if host_machine.system() != 'freebsd'
98 +if host_machine.system() != 'dragonfly'
99 cc_args += ['-D_POSIX_C_SOURCE=200809L']
101 add_project_arguments(cc_args, language: 'c')
112 config_h.set10('HAVE_XUCRED_CR_PID', cc.has_member('struct xucred', 'cr_pid', prefix : '#include <sys/ucred.h>'))
113 have_broken_msg_cmsg_cloexec = false
114 -if host_machine.system() == 'freebsd'
115 +if host_machine.system() == 'freebsd' or host_machine.system() == 'dragonfly'
116 have_broken_msg_cmsg_cloexec = not cc.compiles('''
117 #include <sys/param.h> /* To get __FreeBSD_version. */
118 #if __FreeBSD_version < 1300502 || \
119 - (__FreeBSD_version >= 1400000 && __FreeBSD_version < 1400006)
120 + (__FreeBSD_version >= 1400000 && __FreeBSD_version < 1400006) || defined(__DragonFly__)
122 * FreeBSD had a broken implementation of MSG_CMSG_CLOEXEC between 2015 and
123 * 2021. Check if we are compiling against a version that includes the fix
125 ffi_dep = dependency('libffi')
128 - { 'header': 'sys/signalfd.h', 'symbol': 'SFD_CLOEXEC' },
129 - { 'header': 'sys/timerfd.h', 'symbol': 'TFD_CLOEXEC' },
130 { 'header': 'time.h', 'symbol': 'CLOCK_MONOTONIC' },
135 [FILE:1350:patches/patch-src_connection.c]
136 --- src/connection.c.orig 2022-10-22 10:58:12.859174000 +0200
137 +++ src/connection.c 2022-11-01 18:50:36.315356000 +0100
139 #include <sys/types.h>
140 #include <sys/socket.h>
145 #include "wayland-util.h"
149 msg.msg_iovlen = count;
150 - msg.msg_control = (clen > 0) ? cmsg : NULL;
152 + msg.msg_control = NULL;
154 + msg.msg_control = cmsg;
155 msg.msg_controllen = clen;
158 @@ -376,11 +380,25 @@
159 wl_connection_write(struct wl_connection *connection,
160 const void *data, size_t count)
162 - if (connection->out.head - connection->out.tail +
165 + while (connection->out.head - connection->out.tail +
166 count > ARRAY_LENGTH(connection->out.data)) {
167 - connection->want_flush = 1;
168 - if (wl_connection_flush(connection) < 0)
170 + if (wl_connection_flush(connection) < 0) {
171 + if (errno == EAGAIN) {
172 + pfd.fd = connection->fd;
173 + pfd.events = POLLWRNORM;
177 + ret = poll(&pfd, 1, -1);
178 + } while (ret == -1 && errno == EINTR);
180 + wl_log("%s: wl_connection_flush failed: %s\n",
181 + __func__, strerror(errno));
187 if (ring_buffer_put(&connection->out, data, count) < 0)
190 [FILE:16870:patches/patch-src_event-loop.c]
191 --- src/event-loop.c.orig 2022-11-01 19:04:03.507533000 +0100
192 +++ src/event-loop.c 2022-11-01 19:04:05.187496000 +0100
196 #include <sys/socket.h>
197 +#include <sys/types.h>
198 +#include <sys/event.h>
200 -#include <sys/epoll.h>
201 -#include <sys/signalfd.h>
202 -#include <sys/timerfd.h>
204 #include "wayland-util.h"
205 #include "wayland-private.h"
209 struct wl_event_loop {
212 struct wl_list check_list;
213 struct wl_list idle_list;
214 struct wl_list destroy_list;
217 struct wl_event_source_interface {
218 int (*dispatch)(struct wl_event_source *source,
219 - struct epoll_event *ep);
220 + struct kevent *kv);
227 wl_event_source_fd_dispatch(struct wl_event_source *source,
228 - struct epoll_event *ep)
231 struct wl_event_source_fd *fd_source = (struct wl_event_source_fd *) source;
235 - if (ep->events & EPOLLIN)
236 + if (ev->filter == EVFILT_READ)
237 mask |= WL_EVENT_READABLE;
238 - if (ep->events & EPOLLOUT)
239 + if (ev->filter == EVFILT_WRITE)
240 mask |= WL_EVENT_WRITABLE;
241 - if (ep->events & EPOLLHUP)
242 + if (ev->flags & EV_EOF)
243 mask |= WL_EVENT_HANGUP;
244 - if (ep->events & EPOLLERR)
245 + if (ev->flags & EV_ERROR)
246 mask |= WL_EVENT_ERROR;
248 - return fd_source->func(fd_source->fd, mask, source->data);
249 + return fd_source->func(source->fd, mask, source->data);
252 struct wl_event_source_interface fd_source_interface = {
253 @@ -120,30 +119,10 @@
254 add_source(struct wl_event_loop *loop,
255 struct wl_event_source *source, uint32_t mask, void *data)
257 - struct epoll_event ep;
259 - if (source->fd < 0) {
266 wl_list_init(&source->link);
268 - memset(&ep, 0, sizeof ep);
269 - if (mask & WL_EVENT_READABLE)
270 - ep.events |= EPOLLIN;
271 - if (mask & WL_EVENT_WRITABLE)
272 - ep.events |= EPOLLOUT;
273 - ep.data.ptr = source;
275 - if (epoll_ctl(loop->epoll_fd, EPOLL_CTL_ADD, source->fd, &ep) < 0) {
286 struct wl_event_source_fd *source;
288 + struct kevent events[2];
289 + unsigned int num_events = 0;
291 source = zalloc(sizeof *source);
295 source->base.fd = wl_os_dupfd_cloexec(fd, 0);
298 + add_source(loop, &source->base, mask, data);
300 + if (source->base.fd < 0) {
301 + fprintf(stderr, "Could not add source\n: %s\n",
307 - return add_source(loop, &source->base, mask, data);
308 + if (mask & WL_EVENT_READABLE) {
309 + EV_SET(&events[num_events], source->base.fd, EVFILT_READ,
310 + EV_ADD | EV_ENABLE, 0, 0, &source->base);
314 + if (mask & WL_EVENT_WRITABLE) {
315 + EV_SET(&events[num_events], source->base.fd, EVFILT_WRITE,
316 + EV_ADD | EV_ENABLE, 0, 0, &source->base);
320 + if (kevent(loop->event_fd, events, num_events, NULL, 0, NULL) < 0) {
321 + fprintf(stderr, "Error adding source %i (%p) to loop %p: %s\n",
322 + source->fd, source, loop, strerror(errno));
323 + close(source->base.fd);
328 + return &source->base;
331 /** Update a file descriptor source's event mask
332 @@ -215,16 +225,22 @@
333 wl_event_source_fd_update(struct wl_event_source *source, uint32_t mask)
335 struct wl_event_loop *loop = source->loop;
336 - struct epoll_event ep;
337 + struct kevent events[2];
338 + unsigned int num_events = 0;
340 + if (mask & WL_EVENT_READABLE) {
341 + EV_SET(&events[num_events], source->fd, EVFILT_READ,
342 + EV_ADD | EV_ENABLE, 0, 0, source);
346 - memset(&ep, 0, sizeof ep);
347 - if (mask & WL_EVENT_READABLE)
348 - ep.events |= EPOLLIN;
349 - if (mask & WL_EVENT_WRITABLE)
350 - ep.events |= EPOLLOUT;
351 - ep.data.ptr = source;
352 + if (mask & WL_EVENT_WRITABLE) {
353 + EV_SET(&events[num_events], source->fd, EVFILT_WRITE,
354 + EV_ADD | EV_ENABLE, 0, 0, source);
358 - return epoll_ctl(loop->epoll_fd, EPOLL_CTL_MOD, source->fd, &ep);
359 + return kevent(loop->event_fd, events, num_events, NULL, 0, NULL);
362 /** \cond INTERNAL */
366 noop_dispatch(struct wl_event_source *source,
367 - struct epoll_event *ep) {
368 + struct kevent *ep) {
372 @@ -257,25 +273,47 @@
376 -set_timer(int timerfd, struct timespec deadline) {
377 - struct itimerspec its;
378 +set_timer(int timerfd,
379 + struct timespec deadline,
380 + struct wl_timer_heap *timers)
383 + struct timespec now;
386 + long rel_deadline; /* msec */
388 + if (clock_gettime(CLOCK_MONOTONIC, &now) == -1)
391 + if (!time_lt(now, deadline))
394 + diff_sec = deadline.tv_sec - now.tv_sec;
395 + diff_nsec = deadline.tv_nsec - now.tv_nsec;
396 + if (diff_nsec < 0) {
398 + diff_nsec += 1000000000L;
401 - its.it_interval.tv_sec = 0;
402 - its.it_interval.tv_nsec = 0;
403 - its.it_value = deadline;
404 - return timerfd_settime(timerfd, TFD_TIMER_ABSTIME, &its, NULL);
405 + rel_deadline = (long) ((diff_sec * 1000) + (diff_nsec / 1000000));
406 + if ((diff_nsec % 1000000) > 499999)
409 + EV_SET(&ev, timerfd, EVFILT_TIMER, EV_ADD | EV_ENABLE | EV_ONESHOT,
410 + 0, rel_deadline, timers);
412 + return kevent(timers->base.loop->event_fd, &ev, 1, NULL, 0, NULL);
416 -clear_timer(int timerfd)
417 +clear_timer(int timerfd, struct wl_timer_heap *timers)
419 - struct itimerspec its;
422 - its.it_interval.tv_sec = 0;
423 - its.it_interval.tv_nsec = 0;
424 - its.it_value.tv_sec = 0;
425 - its.it_value.tv_nsec = 0;
426 - return timerfd_settime(timerfd, 0, &its, NULL);
427 + EV_SET(&ev, timerfd, EVFILT_TIMER, EV_ADD | EV_DISABLE,
429 + return kevent(timers->base.loop->event_fd, &ev, 1, NULL, 0, NULL);
433 @@ -296,37 +334,43 @@
435 wl_timer_heap_release(struct wl_timer_heap *timers)
437 - if (timers->base.fd != -1) {
438 - close(timers->base.fd);
444 + * Timers are now kept in a binary heap. There is only one timer source
445 + * which is used for all timer events. This routine ensures that the single
446 + * kevent timer is created.
449 wl_timer_heap_ensure_timerfd(struct wl_timer_heap *timers)
451 - struct epoll_event ep;
454 - if (timers->base.fd != -1)
457 - memset(&ep, 0, sizeof ep);
458 - ep.events = EPOLLIN;
459 - ep.data.ptr = timers;
461 - timer_fd = timerfd_create(CLOCK_MONOTONIC,
462 - TFD_CLOEXEC | TFD_NONBLOCK);
466 - if (epoll_ctl(timers->base.loop->epoll_fd,
467 - EPOLL_CTL_ADD, timer_fd, &ep) < 0) {
472 + * We don't need a static counter any more, but keep it here for now.
475 + static int timer_id = 1;
478 + * We need to add timer filter already here. This avoids error messages
479 + * when the timer filter is removed before ever updating it.
480 + * Note the timer will not be enabled, this happens only in the update
481 + * routine which arms/disarms the timer.)
483 + EV_SET(&ev, timer_id,
484 + EVFILT_TIMER, EV_ADD | EV_DISABLE | EV_ONESHOT, 0, 0, timers);
485 + if (kevent(timers->base.loop->event_fd, &ev, 1, NULL, 0, NULL) < 0) {
486 + fprintf(stderr, "Could not add timer: %s\n",
491 - timers->base.fd = timer_fd;
492 + timers->base.fd = timer_id;
493 + /* Deprecated, same as above. */
500 heap_sift_up(timers->data, source);
505 wl_timer_heap_dispatch(struct wl_timer_heap *timers)
507 @@ -511,10 +554,10 @@
508 list_tail->next_due = NULL;
510 if (timers->active > 0) {
511 - if (set_timer(timers->base.fd, timers->data[0]->deadline) < 0)
512 + if (set_timer(timers->base.fd, timers->data[0]->deadline, timers) < 0)
515 - if (clear_timer(timers->base.fd) < 0)
516 + if (clear_timer(timers->base.fd, timers) < 0)
523 wl_event_source_timer_dispatch(struct wl_event_source *source,
524 - struct epoll_event *ep)
527 struct wl_event_source_timer *timer;
530 if (tsource->heap_idx == 0) {
531 /* Only update the timerfd if the new deadline is
533 - if (set_timer(timers->base.fd, deadline) < 0)
534 + if (set_timer(timers->base.fd, timers->data[0]->deadline, timers) < 0)
539 if (timers->active == 0) {
540 /* Only update the timerfd if this was the last
542 - if (clear_timer(timers->base.fd) < 0)
543 + if (clear_timer(timers->base.fd, timers) < 0)
547 @@ -670,17 +713,11 @@
550 wl_event_source_signal_dispatch(struct wl_event_source *source,
551 - struct epoll_event *ep)
554 - struct wl_event_source_signal *signal_source =
555 - (struct wl_event_source_signal *) source;
556 - struct signalfd_siginfo signal_info;
559 - len = read(source->fd, &signal_info, sizeof signal_info);
560 - if (!(len == -1 && errno == EAGAIN) && len != sizeof signal_info)
561 - /* Is there anything we can do here? Will this ever happen? */
562 - wl_log("signalfd read error: %s\n", strerror(errno));
563 + struct wl_event_source_signal *signal_source;
565 + signal_source = (struct wl_event_source_signal *) source;
567 return signal_source->func(signal_source->signal_number,
568 signal_source->base.data);
571 struct wl_event_source_signal *source;
575 source = zalloc(sizeof *source);
577 @@ -724,15 +762,26 @@
579 source->base.interface = &signal_source_interface;
580 source->signal_number = signal_number;
581 + source->func = func;
584 sigaddset(&mask, signal_number);
585 - source->base.fd = signalfd(-1, &mask, SFD_CLOEXEC | SFD_NONBLOCK);
586 sigprocmask(SIG_BLOCK, &mask, NULL);
588 - source->func = func;
589 + source->base.fd = 0;
590 + add_source(loop, &source->base, WL_EVENT_READABLE, data);
592 + EV_SET(&ev, signal_number, EVFILT_SIGNAL, EV_ADD | EV_ENABLE, 0, 0,
595 + if (kevent(loop->event_fd, &ev, 1, NULL, 0, NULL) < 0) {
596 + fprintf(stderr, "Error adding signal for %i (%p), %p: %s\n",
597 + signal_number, source, loop, strerror(errno));
602 - return add_source(loop, &source->base, WL_EVENT_READABLE, data);
603 + return &source->base;
606 /** \cond INTERNAL */
607 @@ -829,24 +878,100 @@
608 wl_event_source_remove(struct wl_event_source *source)
610 struct wl_event_loop *loop = source->loop;
611 + int ret = 0, saved_errno = 0;
614 + * Since BSD doesn't treat all event sources as FDs, we need to
615 + * differentiate by source interface.
617 + if (source->interface == &fd_source_interface && source->fd >= 0) {
618 + struct kevent ev[2];
619 + int _ret[2], _saved_errno[2];
622 + * We haven't stored state about the mask used when adding the
623 + * source, so we have to try and remove both READ and WRITE
624 + * filters. One may fail, which is OK. Removal of the source has
625 + * only failed if _both_ kevent() calls fail. We have to do two
626 + * kevent() calls so that we can get independent return values
627 + * for the two kevents.
629 + EV_SET(&ev[0], source->fd, EVFILT_READ, EV_DELETE, 0, 0,
631 + EV_SET(&ev[1], source->fd, EVFILT_WRITE, EV_DELETE, 0, 0,
634 + _ret[0] = kevent(loop->event_fd, &ev[0], 1, NULL, 0, NULL);
635 + _saved_errno[0] = errno;
636 + _ret[1] = kevent(loop->event_fd, &ev[1], 1, NULL, 0, NULL);
637 + _saved_errno[1] = errno;
639 + if (_ret[0] >= _ret[1]) {
641 + saved_errno = _saved_errno[0];
644 + saved_errno = _saved_errno[1];
647 + if ((_ret[0] < 0) && (_ret[1] < 0)) {
649 + "Error removing fd = %i from kqueue: %s\n",
650 + source->fd, strerror(saved_errno));
653 - /* We need to explicitly remove the fd, since closing the fd
654 - * isn't enough in case we've dup'ed the fd. */
655 - if (source->fd >= 0) {
656 - epoll_ctl(loop->epoll_fd, EPOLL_CTL_DEL, source->fd, NULL);
660 + } else if (source->interface == &timer_source_interface) {
663 + * There is only timer event source with fd = 1 which is used
664 + * for all timer events. Generally we do not need to remove
665 + * the event source from kqueue.
667 + if (source->fd >= 0) {
670 + EV_SET(&ev, source->fd, EVFILT_TIMER, EV_DELETE, 0, 0, source);
671 + ret = kevent(loop->event_fd, &ev, 1, NULL, 0, NULL);
672 + saved_errno = errno;
676 + "Error removing timer = %i from kqueue: %s\n",
677 + source->fd, strerror(saved_errno));
681 - if (source->interface == &timer_source_interface &&
682 - source->fd != TIMER_REMOVED) {
683 - /* Disarm the timer (and the loop's timerfd, if necessary),
684 - * before removing its space in the loop timer heap */
685 - wl_event_source_timer_update(source, 0);
686 - wl_timer_heap_unreserve(&loop->timers);
687 - /* Set the fd field to to indicate that the timer should NOT
688 - * be dispatched in `wl_event_loop_dispatch` */
689 - source->fd = TIMER_REMOVED;
690 + if (source->fd != TIMER_REMOVED) {
691 + /* Disarm the timer (and the loop's timerfd, if necessary),
692 + * before removing its space in the loop timer heap */
693 + wl_event_source_timer_update(source, 0);
694 + wl_timer_heap_unreserve(&loop->timers);
695 + /* Set the fd field to to indicate that the timer should NOT
696 + * be dispatched in `wl_event_loop_dispatch` */
697 + source->fd = TIMER_REMOVED;
699 + } else if (source->interface == &signal_source_interface) {
702 + struct wl_event_source_signal *_source;
704 + /* Only one kevent() call needed. */
705 + _source = (struct wl_event_source_signal *) source;
706 + signal_number = _source->signal_number;
708 + EV_SET(&ev, signal_number, EVFILT_SIGNAL, EV_DELETE, 0, 0,
710 + ret = kevent(loop->event_fd, &ev, 1, NULL, 0, NULL);
711 + saved_errno = errno;
715 + "Error removing signal = %i from kqueue: %s\n",
716 + source->fd, strerror(saved_errno));
721 wl_list_remove(&source->link);
726 - loop->epoll_fd = wl_os_epoll_create_cloexec();
727 - if (loop->epoll_fd < 0) {
728 + loop->event_fd = wl_os_kqueue_create_cloexec();
729 + if (loop->event_fd < 0) {
733 @@ -925,22 +1050,21 @@
735 wl_event_loop_process_destroy_list(loop);
736 wl_timer_heap_release(&loop->timers);
737 - close(loop->epoll_fd);
738 + close(loop->event_fd);
743 post_dispatch_check(struct wl_event_loop *loop)
745 - struct epoll_event ep;
747 struct wl_event_source *source, *next;
748 bool needs_recheck = false;
751 wl_list_for_each_safe(source, next, &loop->check_list, link) {
754 - dispatch_result = source->interface->dispatch(source, &ep);
755 + dispatch_result = source->interface->dispatch(source, &ev);
756 if (dispatch_result < 0) {
757 wl_log("Source dispatch function returned negative value!\n");
758 wl_log("This would previously accidentally suppress a follow-up dispatch\n");
759 @@ -994,19 +1118,25 @@
761 wl_event_loop_dispatch(struct wl_event_loop *loop, int timeout)
763 - struct epoll_event ep[32];
764 + struct kevent ev[64];
765 struct wl_event_source *source;
767 + struct timespec timeout_spec;
768 bool has_timers = false;
770 wl_event_loop_dispatch_idle(loop);
772 - count = epoll_wait(loop->epoll_fd, ep, ARRAY_LENGTH(ep), timeout);
773 + /* timeout is provided in milliseconds */
774 + timeout_spec.tv_sec = (time_t) (timeout / 1000);
775 + timeout_spec.tv_nsec = (long) (timeout % 1000) * 1000000L;
777 + count = kevent(loop->event_fd, NULL, 0, ev, ARRAY_LENGTH(ev),
778 + (timeout != -1) ? &timeout_spec : NULL);
782 for (i = 0; i < count; i++) {
783 - source = ep[i].data.ptr;
784 + source = ev[i].udata;
785 if (source == &loop->timers.base)
788 @@ -1022,9 +1152,10 @@
791 for (i = 0; i < count; i++) {
792 - source = ep[i].data.ptr;
793 - if (source->fd != -1)
794 - source->interface->dispatch(source, &ep[i]);
795 + source = ev[i].udata;
796 + if (source->fd != -1) {
797 + source->interface->dispatch(source, &ev[i]);
801 wl_event_loop_process_destroy_list(loop);
802 @@ -1055,7 +1186,7 @@
804 wl_event_loop_get_fd(struct wl_event_loop *loop)
806 - return loop->epoll_fd;
807 + return loop->event_fd;
810 /** Register a destroy listener for an event loop context
813 [FILE:1352:patches/patch-src_wayland-os.c]
814 --- src/wayland-os.c.orig 2022-10-22 10:58:42.178509000 +0200
815 +++ src/wayland-os.c 2022-10-31 16:39:33.763815000 +0100
820 -#include <sys/epoll.h>
821 +#include <sys/event.h>
822 #include <sys/mman.h>
824 #ifdef HAVE_SYS_UCRED_H
830 fd = socket(domain, type | SOCK_CLOEXEC, protocol);
837 fd = socket(domain, type, protocol);
838 return set_cloexec_or_close(fd);
841 -#if defined(__FreeBSD__)
842 +#if defined(__FreeBSD__) || defined(__DragonFly__)
844 wl_os_socket_peercred(int sockfd, uid_t *uid, gid_t *gid, pid_t *pid)
850 - if (getsockopt(sockfd, SOL_LOCAL, LOCAL_PEERCRED, &ucred, &len) < 0 ||
851 + if (getsockopt(sockfd, 0, LOCAL_PEERCRED, &ucred, &len) < 0 ||
852 ucred.cr_version != XUCRED_VERSION)
855 @@ -189,19 +191,11 @@
859 -wl_os_epoll_create_cloexec(void)
860 +wl_os_kqueue_create_cloexec(void)
864 -#ifdef EPOLL_CLOEXEC
865 - fd = epoll_create1(EPOLL_CLOEXEC);
868 - if (errno != EINVAL)
872 - fd = epoll_create(1);
874 return set_cloexec_or_close(fd);
879 [FILE:367:patches/patch-src_wayland-os.h]
880 --- src/wayland-os.h.orig 2022-10-31 16:28:37.828288000 +0100
881 +++ src/wayland-os.h 2022-10-31 16:28:58.707858000 +0100
883 wl_os_recvmsg_cloexec(int sockfd, struct msghdr *msg, int flags);
886 -wl_os_epoll_create_cloexec(void);
887 +wl_os_kqueue_create_cloexec(void);
890 wl_os_accept_cloexec(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
893 [FILE:758:patches/patch-src_wayland-server.c]
894 --- src/wayland-server.c.orig 2022-10-31 16:48:01.102621000 +0100
895 +++ src/wayland-server.c 2022-11-01 14:08:34.644016000 +0100
898 #include <sys/time.h>
900 -#include <sys/eventfd.h>
901 #include <sys/file.h>
902 #include <sys/stat.h>
904 @@ -1075,10 +1074,6 @@
908 - display->terminate_efd = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);
909 - if (display->terminate_efd < 0)
912 display->term_source = wl_event_loop_add_fd(display->loop,
913 display->terminate_efd,
915 @@ -1109,10 +1104,6 @@
918 close(display->terminate_efd);
920 - wl_event_loop_destroy(display->loop);
928 [FILE:915:patches/patch-tests_os-wrappers-test.c]
929 --- tests/os-wrappers-test.c.orig 2022-11-01 14:26:03.250878000 +0100
930 +++ tests/os-wrappers-test.c 2022-11-01 14:28:28.137680000 +0100
935 -#include <sys/epoll.h>
937 #include "wayland-private.h"
938 #include "test-runner.h"
940 __attribute__ ((visibility("default"))) int
941 epoll_create1(int flags)
943 - wrapped_calls_epoll_create1++;
946 - wrapped_calls_epoll_create1++; /* epoll_create() not wrapped */
951 - return real_epoll_create1(flags);
957 do_os_wrappers_recvmsg_cloexec(1);
960 +#if !defined(__DragonFly__)
962 do_os_wrappers_epoll_create_cloexec(int n)
966 do_os_wrappers_epoll_create_cloexec(2);
970 /* FIXME: add tests for wl_os_accept_cloexec() */
973 [FILE:2778:patches/patch-tests_test-runner.c]
974 --- tests/test-runner.c.orig 2022-11-01 14:11:31.710109000 +0100
975 +++ tests/test-runner.c 2022-11-01 14:24:36.312796000 +0100
981 #include <sys/types.h>
982 #include <sys/wait.h>
983 #include <sys/stat.h>
985 #ifdef HAVE_SYS_PROCCTL_H
986 #include <sys/procctl.h>
987 #elif defined(HAVE_SYS_PRCTL_H)
988 +#ifndef __DragonFly__
989 #include <sys/prctl.h>
991 #ifndef PR_SET_PTRACER
992 # define PR_SET_PTRACER 0x59616d61
994 @@ -276,17 +279,22 @@
998 +#ifndef __DragonFly__
999 if (ptrace(PTRACE_ATTACH, ppid, NULL, NULL) != 0)
1002 if (!waitpid(-1, NULL, 0))
1004 +#ifndef __DragonFly__
1005 ptrace(PTRACE_CONT, NULL, NULL);
1006 ptrace(PTRACE_DETACH, ppid, NULL, NULL);
1012 /* Enable child to ptrace the parent process */
1013 +#ifndef __DragonFly__
1014 rc = prctl(PR_SET_PTRACER, pid);
1015 if (rc != 0 && errno != EINVAL) {
1016 /* An error prevents us from telling if a debugger is attached.
1018 /* Signal to client that parent is ready by passing '+' */
1019 write(pipefd[1], "+", 1);
1024 waitpid(pid, &status, 0);
1025 @@ -315,18 +324,16 @@
1026 const struct test *t;
1029 +#ifdef __DragonFly__
1035 if (isatty(fileno(stderr)))
1038 - if (is_debugger_attached()) {
1039 - fd_leak_check_enabled = 0;
1040 - timeouts_enabled = 0;
1042 - fd_leak_check_enabled = !getenv("WAYLAND_TEST_NO_LEAK_CHECK");
1043 - timeouts_enabled = !getenv("WAYLAND_TEST_NO_TIMEOUTS");
1045 + fd_leak_check_enabled = !getenv("WAYLAND_TEST_NO_LEAK_CHECK");
1046 + timeouts_enabled = !getenv("WAYLAND_TEST_NO_TIMEOUTS");
1048 if (argc == 2 && strcmp(argv[1], "--help") == 0)
1049 usage(argv[0], EXIT_SUCCESS);
1050 @@ -358,6 +365,12 @@
1052 run_test(t); /* never returns */
1054 +#ifdef __DragonFly__
1055 + if (wait(&status)) {
1056 + fprintf(stderr, "waitid failed: %m\n");
1060 if (waitid(P_PID, pid, &info, WEXITED)) {
1061 stderr_set_color(RED);
1062 fprintf(stderr, "waitid failed: %s\n",
1063 @@ -366,6 +379,21 @@
1069 + fprintf(stderr, "test \"%s\":\t", t->name);
1070 +#ifdef __DragonFly__
1071 + if (WIFEXITED(status)) {
1072 + fprintf(stderr, "exit status %d", WEXITSTATUS(status));
1073 + if (WEXITSTATUS(status) == EXIT_SUCCESS)
1076 + } else if (WIFSIGNALED(status) || WCOREDUMP(status)) {
1077 + fprintf(stderr, "signal %d", WTERMSIG(status));
1083 switch (info.si_code) {