wayland: Update to 1.18.0 Based on a patch from wiz@, thanks! The main change I made was tricking autoconf into thinking NetBSD doesn't have posix_fallocate. The main new features in this release are: - Add support for the Meson build system (autotools is still supported but will be removed in a future release) - Add API to tag proxy objects to allow applications and toolkits to share the same Wayland connection - Track wayland-server timers in user-space to prevent creating too many FDs - Add wl_global_remove, a new function to mitigate race conditions with globalsdiff -r1.7 -r1.8 pkgsrc/devel/wayland/Makefile
(nia)
@@ -1,38 +1,43 @@ | @@ -1,38 +1,43 @@ | |||
1 | # $NetBSD: Makefile,v 1.7 2020/03/08 16:42:26 bsiegert Exp $ | 1 | # $NetBSD: Makefile,v 1.8 2020/03/15 16:03:26 nia Exp $ | |
2 | 2 | |||
3 | DISTNAME= wayland-1.17.0 | 3 | DISTNAME= wayland-1.18.0 | |
4 | PKGREVISION= 5 | |||
5 | CATEGORIES= devel | 4 | CATEGORIES= devel | |
6 | MASTER_SITES= https://wayland.freedesktop.org/releases/ | 5 | MASTER_SITES= https://wayland.freedesktop.org/releases/ | |
7 | EXTRACT_SUFX= .tar.xz | 6 | EXTRACT_SUFX= .tar.xz | |
8 | 7 | |||
9 | MAINTAINER= nia@NetBSD.org | 8 | MAINTAINER= nia@NetBSD.org | |
10 | HOMEPAGE= https://wayland.freedesktop.org/ | 9 | HOMEPAGE= https://wayland.freedesktop.org/ | |
11 | COMMENT= Display server protocol - development libraries | 10 | COMMENT= Display server protocol - development libraries | |
12 | LICENSE= mit | 11 | LICENSE= mit | |
13 | 12 | |||
14 | GNU_CONFIGURE= YES | 13 | GNU_CONFIGURE= YES | |
15 | USE_LIBTOOL= YES | 14 | USE_LIBTOOL= YES | |
16 | 15 | |||
17 | USE_TOOLS+= autoconf automake autoreconf | 16 | USE_TOOLS+= autoconf automake autoreconf | |
18 | USE_TOOLS+= gmake pkg-config | 17 | USE_TOOLS+= gmake pkg-config | |
19 | 18 | |||
20 | USE_LANGUAGES= c c++ | 19 | USE_LANGUAGES= c c++ | |
21 | 20 | |||
22 | CONFIGURE_ARGS+= --disable-documentation | 21 | CONFIGURE_ARGS+= --disable-documentation | |
23 | 22 | |||
23 | # No support in the kernel yet, always fails. | |||
24 | # Make sure wayland falls back to ftruncate. | |||
25 | CONFIGURE_ENV.NetBSD+= ac_cv_func_posix_fallocate=no | |||
26 | ||||
27 | PKGCONFIG_OVERRIDE+= cursor/wayland-cursor.pc.in | |||
28 | PKGCONFIG_OVERRIDE+= egl/wayland-egl-backend.pc.in | |||
29 | PKGCONFIG_OVERRIDE+= egl/wayland-egl.pc.in | |||
24 | PKGCONFIG_OVERRIDE+= src/wayland-client.pc.in | 30 | PKGCONFIG_OVERRIDE+= src/wayland-client.pc.in | |
25 | PKGCONFIG_OVERRIDE+= src/wayland-cursor.pc.in | |||
26 | PKGCONFIG_OVERRIDE+= src/wayland-scanner.pc.in | 31 | PKGCONFIG_OVERRIDE+= src/wayland-scanner.pc.in | |
27 | PKGCONFIG_OVERRIDE+= src/wayland-server.pc.in | 32 | PKGCONFIG_OVERRIDE+= src/wayland-server.pc.in | |
28 | 33 | |||
29 | pre-configure: | 34 | pre-configure: | |
30 | # https://lists.freedesktop.org/archives/wayland-devel/2019-February/040024.html | 35 | # https://lists.freedesktop.org/archives/wayland-devel/2019-February/040024.html | |
31 | ${CP} ${FILESDIR}/event-loop-kqueue.c ${WRKSRC}/src | 36 | ${CP} ${FILESDIR}/event-loop-kqueue.c ${WRKSRC}/src | |
32 | cd ${WRKSRC} && autoreconf -fvi | 37 | cd ${WRKSRC} && autoreconf -fvi | |
33 | 38 | |||
34 | .include "platform.mk" | 39 | .include "platform.mk" | |
35 | .include "../../devel/libffi/buildlink3.mk" | 40 | .include "../../devel/libffi/buildlink3.mk" | |
36 | .include "../../textproc/expat/buildlink3.mk" | 41 | .include "../../textproc/expat/buildlink3.mk" | |
37 | .include "../../textproc/libxslt/buildlink3.mk" | 42 | .include "../../textproc/libxslt/buildlink3.mk" | |
38 | .include "../../mk/bsd.pkg.mk" | 43 | .include "../../mk/bsd.pkg.mk" |
@@ -1,17 +1,15 @@ | @@ -1,17 +1,15 @@ | |||
1 | $NetBSD: distinfo,v 1.7 2020/01/05 19:30:48 nia Exp $ | 1 | $NetBSD: distinfo,v 1.8 2020/03/15 16:03:26 nia Exp $ | |
2 | 2 | |||
3 | SHA1 (wayland-1.17.0.tar.xz) = 4d9e08a7a4a07fa37a25d7aa3ef83f08edec0600 | 3 | SHA1 (wayland-1.18.0.tar.xz) = 33e5292b32a115e829458ea627201ed1e4ad4f45 | |
4 | RMD160 (wayland-1.17.0.tar.xz) = 635494fb0f5d9eb1e782f98e08c3e0e26ff44268 | 4 | RMD160 (wayland-1.18.0.tar.xz) = 0416292a51e3f2ed9c537a94de60ff8e02273d97 | |
5 | SHA512 (wayland-1.17.0.tar.xz) = c5051aab5ff078b368c196ecfedb33ccd961265bb914845d7ed81de361bb86ae18299575baa6c4eceb0d82cf8b495e8293f31b51d1cbc05d84af0a199ab3f946 | 5 | SHA512 (wayland-1.18.0.tar.xz) = e30199e30c2bbd361ee695b4f3f7a4e264f10ed8f46f2c90762b5739fc578ae757dc39aa0258d8fbf0ed418553470bccd4b2730ed9705481cfccdab5de96a8fc | |
6 | Size (wayland-1.17.0.tar.xz) = 437680 bytes | 6 | Size (wayland-1.18.0.tar.xz) = 453968 bytes | |
7 | SHA1 (patch-Makefile.am) = cfdf21bb32743590f88b6ab13ca00335f4e30475 | 7 | SHA1 (patch-Makefile.am) = de9f10054caeb6549187639973418b9039d782ee | |
8 | SHA1 (patch-configure.ac) = 57a86b0f77062d475e92123199ee61c0ac6d2443 | 8 | SHA1 (patch-configure.ac) = 01b226ecaae6ad07ce20de70e36e68990cf1daed | |
9 | SHA1 (patch-cursor_os-compatibility.c) = 04bc63b40ba882dbc6babe8dca9d1619107fafb9 | 9 | SHA1 (patch-src_event-loop.c) = d49eab01c973d9d124867e8ab06c091e63e697f9 | |
10 | SHA1 (patch-cursor_wayland-cursor.c) = 6dcb4bd2d241527e9ee62fb6ddad6447cc379ba8 | |||
11 | SHA1 (patch-src_event-loop.c) = 84128ea7ac073acc65d8ae2e6f4ea93f3c5fe9ec | |||
12 | SHA1 (patch-src_wayland-os.c) = eb51bf1dc539926a14848097d04bb762cf1fe962 | 10 | SHA1 (patch-src_wayland-os.c) = eb51bf1dc539926a14848097d04bb762cf1fe962 | |
13 | SHA1 (patch-src_wayland-os.h) = d07a731f081c1600c3041cc1349120031d28337f | 11 | SHA1 (patch-src_wayland-os.h) = d07a731f081c1600c3041cc1349120031d28337f | |
14 | SHA1 (patch-src_wayland-server.c) = 25c884c08a229f2e5fe56e4b864a68ffcce2eda5 | 12 | SHA1 (patch-src_wayland-server.c) = 5d30f67968b2516f3335fb2da559883a952ed355 | |
15 | SHA1 (patch-src_wayland-shm.c) = 8a2e5ae22bc400cd2c5c9dec421d536229b2943f | 13 | SHA1 (patch-src_wayland-shm.c) = 8a2e5ae22bc400cd2c5c9dec421d536229b2943f | |
16 | SHA1 (patch-tests_os-wrappers-test.c) = a17a2e3cbab039becc8c4cb2f1be379b3bffba0e | 14 | SHA1 (patch-tests_os-wrappers-test.c) = a17a2e3cbab039becc8c4cb2f1be379b3bffba0e | |
17 | SHA1 (patch-tests_test-runner.c) = e97cfc48340b0de1c2642cb7cc48d9acf0a533eb | 15 | SHA1 (patch-tests_test-runner.c) = e97cfc48340b0de1c2642cb7cc48d9acf0a533eb |
@@ -15,26 +15,32 @@ | @@ -15,26 +15,32 @@ | |||
15 | * | 15 | * | |
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | |
20 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 20 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | |
21 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | 21 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | |
22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
23 | * SOFTWARE. | 23 | * SOFTWARE. | |
24 | */ | 24 | */ | |
25 | 25 | |||
26 | #include "config.h" | 26 | #include "config.h" | |
27 | 27 | |||
28 | #ifndef container_of | |||
29 | #define container_of(ptr, type, member) ({ \ | |||
30 | const typeof(((type *)0)->member) * __mptr = (ptr); \ | |||
31 | (type *)((char *)__mptr - offsetof(type, member)); }) | |||
32 | #endif | |||
33 | ||||
28 | #ifdef HAVE_SYS_EVENT_H | 34 | #ifdef HAVE_SYS_EVENT_H | |
29 | #include <stddef.h> | 35 | #include <stddef.h> | |
30 | #include <stdio.h> | 36 | #include <stdio.h> | |
31 | #include <err.h> | 37 | #include <err.h> | |
32 | #include <errno.h> | 38 | #include <errno.h> | |
33 | #include <signal.h> | 39 | #include <signal.h> | |
34 | #include <stdlib.h> | 40 | #include <stdlib.h> | |
35 | #include <stdint.h> | 41 | #include <stdint.h> | |
36 | #include <stdbool.h> | 42 | #include <stdbool.h> | |
37 | #include <string.h> | 43 | #include <string.h> | |
38 | #include <fcntl.h> | 44 | #include <fcntl.h> | |
39 | #include <sys/socket.h> | 45 | #include <sys/socket.h> | |
40 | #include <sys/un.h> | 46 | #include <sys/un.h> | |
@@ -150,27 +156,27 @@ wl_event_loop_add_fd(struct wl_event_loo | @@ -150,27 +156,27 @@ wl_event_loop_add_fd(struct wl_event_loo | |||
150 | unsigned int num_events = 0; | 156 | unsigned int num_events = 0; | |
151 | 157 | |||
152 | source = malloc(sizeof *source); | 158 | source = malloc(sizeof *source); | |
153 | if (source == NULL) | 159 | if (source == NULL) | |
154 | return NULL; | 160 | return NULL; | |
155 | 161 | |||
156 | source->base.interface = &fd_source_interface; | 162 | source->base.interface = &fd_source_interface; | |
157 | source->base.fd = wl_os_dupfd_cloexec(fd, 0); | 163 | source->base.fd = wl_os_dupfd_cloexec(fd, 0); | |
158 | source->func = func; | 164 | source->func = func; | |
159 | source->fd = fd; | 165 | source->fd = fd; | |
160 | add_source(loop, &source->base, mask, data); | 166 | add_source(loop, &source->base, mask, data); | |
161 | 167 | |||
162 | if (source->base.fd < 0) { | 168 | if (source->base.fd < 0) { | |
163 | fprintf(stderr, "could not add source\n: %m"); | 169 | fprintf(stderr, "could not add source\n: %s", strerror(errno)); | |
164 | free(source); | 170 | free(source); | |
165 | return NULL; | 171 | return NULL; | |
166 | } | 172 | } | |
167 | 173 | |||
168 | if (mask & WL_EVENT_READABLE) { | 174 | if (mask & WL_EVENT_READABLE) { | |
169 | EV_SET(&events[num_events], source->base.fd, EVFILT_READ, | 175 | EV_SET(&events[num_events], source->base.fd, EVFILT_READ, | |
170 | EV_ADD | EV_ENABLE, 0, 0, &source->base); | 176 | EV_ADD | EV_ENABLE, 0, 0, &source->base); | |
171 | num_events++; | 177 | num_events++; | |
172 | } | 178 | } | |
173 | 179 | |||
174 | if (mask & WL_EVENT_WRITABLE) { | 180 | if (mask & WL_EVENT_WRITABLE) { | |
175 | EV_SET(&events[num_events], source->base.fd, EVFILT_WRITE, | 181 | EV_SET(&events[num_events], source->base.fd, EVFILT_WRITE, | |
176 | EV_ADD | EV_ENABLE, 0, 0, &source->base); | 182 | EV_ADD | EV_ENABLE, 0, 0, &source->base); | |
@@ -235,29 +241,26 @@ wl_event_source_fd_update(struct wl_even | @@ -235,29 +241,26 @@ wl_event_source_fd_update(struct wl_even | |||
235 | struct wl_event_source_timer { | 241 | struct wl_event_source_timer { | |
236 | struct wl_event_source base; | 242 | struct wl_event_source base; | |
237 | wl_event_loop_timer_func_t func; | 243 | wl_event_loop_timer_func_t func; | |
238 | }; | 244 | }; | |
239 | 245 | |||
240 | /** \endcond */ | 246 | /** \endcond */ | |
241 | 247 | |||
242 | static int | 248 | static int | |
243 | wl_event_source_timer_dispatch(struct wl_event_source *source, | 249 | wl_event_source_timer_dispatch(struct wl_event_source *source, | |
244 | struct kevent *ev) | 250 | struct kevent *ev) | |
245 | { | 251 | { | |
246 | struct wl_event_source_timer *timer_source = | 252 | struct wl_event_source_timer *timer_source = | |
247 | (struct wl_event_source_timer *) source; | 253 | (struct wl_event_source_timer *) source; | |
248 | uint64_t expires; | |||
249 | ||||
250 | expires = ev->data; /* XXX unused?! */ | |||
251 | return timer_source->func(timer_source->base.data); | 254 | return timer_source->func(timer_source->base.data); | |
252 | } | 255 | } | |
253 | 256 | |||
254 | struct wl_event_source_interface timer_source_interface = { | 257 | struct wl_event_source_interface timer_source_interface = { | |
255 | wl_event_source_timer_dispatch, | 258 | wl_event_source_timer_dispatch, | |
256 | }; | 259 | }; | |
257 | 260 | |||
258 | /** Create a timer event source | 261 | /** Create a timer event source | |
259 | * | 262 | * | |
260 | * \param loop The event loop that will process the new source. | 263 | * \param loop The event loop that will process the new source. | |
261 | * \param func The timer dispatch function. | 264 | * \param func The timer dispatch function. | |
262 | * \param data User data. | 265 | * \param data User data. | |
263 | * \return A new timer event source. | 266 | * \return A new timer event source. |
@@ -1,25 +1,16 @@ | @@ -1,25 +1,16 @@ | |||
1 | $NetBSD: patch-Makefile.am,v 1.2 2020/01/05 19:30:48 nia Exp $ | 1 | $NetBSD: patch-Makefile.am,v 1.3 2020/03/15 16:03:26 nia Exp $ | |
2 | 2 | |||
3 | https://lists.freedesktop.org/archives/wayland-devel/2019-February/040024.html | 3 | https://lists.freedesktop.org/archives/wayland-devel/2019-February/040024.html | |
4 | 4 | |||
5 | --- Makefile.am.orig 2019-03-21 00:55:25.000000000 +0000 | 5 | --- Makefile.am.orig 2020-02-11 23:46:03.000000000 +0000 | |
6 | +++ Makefile.am | 6 | +++ Makefile.am | |
7 | @@ -76,7 +76,8 @@ libwayland_server_la_LDFLAGS = -version- | 7 | @@ -78,7 +78,8 @@ libwayland_server_la_LDFLAGS = -version- | |
8 | libwayland_server_la_SOURCES = \ | 8 | libwayland_server_la_SOURCES = \ | |
9 | src/wayland-server.c \ | 9 | src/wayland-server.c \ | |
10 | src/wayland-shm.c \ | 10 | src/wayland-shm.c \ | |
11 | - src/event-loop.c | 11 | - src/event-loop.c | |
12 | + src/event-loop.c \ | 12 | + src/event-loop.c \ | |
13 | + src/event-loop-kqueue.c | 13 | + src/event-loop-kqueue.c | |
14 | 14 | |||
15 | nodist_libwayland_server_la_SOURCES = \ | 15 | nodist_libwayland_server_la_SOURCES = \ | |
16 | protocol/wayland-server-protocol.h \ | 16 | protocol/wayland-server-protocol.h \ | |
17 | @@ -227,7 +228,7 @@ libtest_runner_la_LIBADD = \ | |||
18 | libwayland-client.la \ | |||
19 | libwayland-server.la \ | |||
20 | libtest-helpers.la \ | |||
21 | - -lrt -ldl $(FFI_LIBS) | |||
22 | + -lrt $(DL_LIBS) $(FFI_LIBS) | |||
23 | ||||
24 | array_test_SOURCES = tests/array-test.c | |||
25 | array_test_LDADD = libtest-runner.la |
@@ -1,38 +1,38 @@ | @@ -1,38 +1,38 @@ | |||
1 | $NetBSD: patch-configure.ac,v 1.2 2020/01/05 19:30:48 nia Exp $ | 1 | $NetBSD: patch-configure.ac,v 1.3 2020/03/15 16:03:26 nia Exp $ | |
2 | 2 | |||
3 | https://lists.freedesktop.org/archives/wayland-devel/2019-February/040024.html | 3 | https://lists.freedesktop.org/archives/wayland-devel/2019-February/040024.html | |
4 | 4 | |||
5 | --- configure.ac.orig 2019-03-21 00:55:25.000000000 +0000 | 5 | --- configure.ac.orig 2020-02-11 23:46:03.000000000 +0000 | |
6 | +++ configure.ac | 6 | +++ configure.ac | |
7 | @@ -65,6 +65,17 @@ AC_SUBST(GCC_CFLAGS) | 7 | @@ -71,6 +71,17 @@ WESTON_SEARCH_LIBS([DL], [dl], [dlsym]) | |
8 | AC_CHECK_HEADERS([sys/prctl.h]) | 8 | # OpenBSD doesn't have librt, but it has its functions in libc | |
9 | AC_CHECK_FUNCS([accept4 mkostemp posix_fallocate prctl]) | 9 | WESTON_SEARCH_LIBS([RT], [rt], [clock_gettime]) | |
10 | 10 | |||
11 | +AC_CHECK_HEADERS([sys/epoll.h sys/event.h]) | 11 | +AC_CHECK_HEADERS([sys/epoll.h sys/event.h]) | |
12 | +if test "x$ac_cv_header_sys_epoll_h" != "xyes" && test "x$ac_cv_header_sys_event_h" != "xyes"; then | 12 | +if test "x$ac_cv_header_sys_epoll_h" != "xyes" && test "x$ac_cv_header_sys_event_h" != "xyes"; then | |
13 | + AC_MSG_ERROR([Can't find sys/epoll.h or sys/event.h. Please ensure either epoll or kqueue is available.]) | 13 | + AC_MSG_ERROR([Can't find sys/epoll.h or sys/event.h. Please ensure either epoll or kqueue is available.]) | |
14 | +fi | 14 | +fi | |
15 | + | 15 | + | |
16 | +AC_CHECK_HEADERS([sys/ucred.h]) | 16 | +AC_CHECK_HEADERS([sys/ucred.h]) | |
17 | + | 17 | + | |
18 | +# dlopen() | 18 | +# dlopen() | |
19 | +AC_CHECK_LIB([dl], [dlsym], [DL_LIBS=-ldl]) | 19 | +AC_CHECK_LIB([dl], [dlsym], [DL_LIBS=-ldl]) | |
20 | +AC_SUBST([DL_LIBS]) | 20 | +AC_SUBST([DL_LIBS]) | |
21 | + | 21 | + | |
22 | AC_ARG_ENABLE([libraries], | 22 | AC_ARG_ENABLE([libraries], | |
23 | [AC_HELP_STRING([--disable-libraries], | 23 | [AC_HELP_STRING([--disable-libraries], | |
24 | [Disable compilation of wayland libraries])], | 24 | [Disable compilation of wayland libraries])], | |
25 | @@ -100,12 +111,14 @@ AC_SUBST([ICONDIR]) | 25 | @@ -106,12 +117,14 @@ AC_SUBST([ICONDIR]) | |
26 | 26 | |||
27 | if test "x$enable_libraries" = "xyes"; then | 27 | if test "x$enable_libraries" = "xyes"; then | |
28 | PKG_CHECK_MODULES(FFI, [libffi]) | 28 | PKG_CHECK_MODULES(FFI, [libffi]) | |
29 | - AC_CHECK_DECL(SFD_CLOEXEC,[], | 29 | - AC_CHECK_DECL(SFD_CLOEXEC,[], | |
30 | - [AC_MSG_ERROR("SFD_CLOEXEC is needed to compile wayland libraries")], | 30 | - [AC_MSG_ERROR("SFD_CLOEXEC is needed to compile wayland libraries")], | |
31 | - [[#include <sys/signalfd.h>]]) | 31 | - [[#include <sys/signalfd.h>]]) | |
32 | - AC_CHECK_DECL(TFD_CLOEXEC,[], | 32 | - AC_CHECK_DECL(TFD_CLOEXEC,[], | |
33 | - [AC_MSG_ERROR("TFD_CLOEXEC is needed to compile wayland libraries")], | 33 | - [AC_MSG_ERROR("TFD_CLOEXEC is needed to compile wayland libraries")], | |
34 | - [[#include <sys/timerfd.h>]]) | 34 | - [[#include <sys/timerfd.h>]]) | |
35 | + if test "x$ac_cv_header_sys_epoll_h" = "xyes"; then | 35 | + if test "x$ac_cv_header_sys_epoll_h" = "xyes"; then | |
36 | + AC_CHECK_DECL(SFD_CLOEXEC,[], | 36 | + AC_CHECK_DECL(SFD_CLOEXEC,[], | |
37 | + [AC_MSG_ERROR("SFD_CLOEXEC is needed to compile wayland libraries")], | 37 | + [AC_MSG_ERROR("SFD_CLOEXEC is needed to compile wayland libraries")], | |
38 | + [[#include <sys/signalfd.h>]]) | 38 | + [[#include <sys/signalfd.h>]]) |
@@ -1,20 +1,20 @@ | @@ -1,20 +1,20 @@ | |||
1 | $NetBSD: patch-src_event-loop.c,v 1.2 2020/01/05 19:30:48 nia Exp $ | 1 | $NetBSD: patch-src_event-loop.c,v 1.3 2020/03/15 16:03:26 nia Exp $ | |
2 | 2 | |||
3 | https://lists.freedesktop.org/archives/wayland-devel/2019-February/040024.html | 3 | https://lists.freedesktop.org/archives/wayland-devel/2019-February/040024.html | |
4 | 4 | |||
5 | --- src/event-loop.c.orig 2019-03-21 00:55:25.000000000 +0000 | 5 | --- src/event-loop.c.orig 2020-02-11 23:46:03.000000000 +0000 | |
6 | +++ src/event-loop.c | 6 | +++ src/event-loop.c | |
7 | @@ -23,6 +23,8 @@ | 7 | @@ -23,6 +23,8 @@ | |
8 | * SOFTWARE. | 8 | * SOFTWARE. | |
9 | */ | 9 | */ | |
10 | 10 | |||
11 | +#include "config.h" | 11 | +#include "config.h" | |
12 | +#ifdef HAVE_SYS_EPOLL_H | 12 | +#ifdef HAVE_SYS_EPOLL_H | |
13 | #include <assert.h> | |||
13 | #include <stddef.h> | 14 | #include <stddef.h> | |
14 | #include <stdio.h> | 15 | #include <stdio.h> | |
15 | #include <errno.h> | 16 | @@ -1088,3 +1090,4 @@ wl_event_loop_get_destroy_listener(struc | |
16 | @@ -702,3 +704,4 @@ wl_event_loop_get_destroy_listener(struc | |||
17 | { | 17 | { | |
18 | return wl_signal_get(&loop->destroy_signal, notify); | 18 | return wl_signal_get(&loop->destroy_signal, notify); | |
19 | } | 19 | } | |
20 | +#endif /* HAVE_SYS_EPOLL_H */ | 20 | +#endif /* HAVE_SYS_EPOLL_H */ |
@@ -1,76 +1,76 @@ | @@ -1,76 +1,76 @@ | |||
1 | $NetBSD: patch-src_wayland-server.c,v 1.2 2020/01/05 19:30:48 nia Exp $ | 1 | $NetBSD: patch-src_wayland-server.c,v 1.3 2020/03/15 16:03:26 nia Exp $ | |
2 | 2 | |||
3 | NetBSD support | 3 | NetBSD support | |
4 | 4 | |||
5 | --- src/wayland-server.c.orig 2019-03-21 00:55:25.000000000 +0000 | 5 | --- src/wayland-server.c.orig 2020-02-11 23:46:03.000000000 +0000 | |
6 | +++ src/wayland-server.c | 6 | +++ src/wayland-server.c | |
7 | @@ -43,6 +43,13 @@ | 7 | @@ -44,6 +44,13 @@ | |
8 | #include <sys/file.h> | 8 | #include <sys/file.h> | |
9 | #include <sys/stat.h> | 9 | #include <sys/stat.h> | |
10 | 10 | |||
11 | +#include "../config.h" | 11 | +#include "../config.h" | |
12 | + | 12 | + | |
13 | +#ifdef HAVE_SYS_UCRED_H | 13 | +#ifdef HAVE_SYS_UCRED_H | |
14 | +#include <sys/types.h> | 14 | +#include <sys/types.h> | |
15 | +#include <sys/ucred.h> | 15 | +#include <sys/ucred.h> | |
16 | +#endif | 16 | +#endif | |
17 | + | 17 | + | |
18 | #include "wayland-util.h" | 18 | #include "wayland-util.h" | |
19 | #include "wayland-private.h" | 19 | #include "wayland-private.h" | |
20 | #include "wayland-server.h" | 20 | #include "wayland-server-private.h" | |
21 | @@ -77,7 +84,17 @@ struct wl_client { | 21 | @@ -79,7 +86,17 @@ struct wl_client { | |
22 | struct wl_list link; | 22 | struct wl_list link; | |
23 | struct wl_map objects; | 23 | struct wl_map objects; | |
24 | struct wl_priv_signal destroy_signal; | 24 | struct wl_priv_signal destroy_signal; | |
25 | +#ifdef HAVE_SYS_UCRED_H | 25 | +#ifdef HAVE_SYS_UCRED_H | |
26 | +#ifdef __NetBSD__ | 26 | +#ifdef __NetBSD__ | |
27 | + struct uucred ucred; | 27 | + struct uucred ucred; | |
28 | +#else | 28 | +#else | |
29 | + /* FreeBSD */ | 29 | + /* FreeBSD */ | |
30 | + struct xucred ucred; | 30 | + struct xucred ucred; | |
31 | +#endif | 31 | +#endif | |
32 | +#else | 32 | +#else | |
33 | + /* Linux */ | 33 | + /* Linux */ | |
34 | struct ucred ucred; | 34 | struct ucred ucred; | |
35 | +#endif | 35 | +#endif | |
36 | int error; | 36 | int error; | |
37 | struct wl_priv_signal resource_created_signal; | 37 | struct wl_priv_signal resource_created_signal; | |
38 | }; | 38 | }; | |
39 | @@ -312,7 +329,11 @@ wl_resource_post_error(struct wl_resourc | 39 | @@ -315,7 +332,11 @@ wl_resource_post_error(struct wl_resourc | |
40 | static void | 40 | static void | |
41 | destroy_client_with_error(struct wl_client *client, const char *reason) | 41 | destroy_client_with_error(struct wl_client *client, const char *reason) | |
42 | { | 42 | { | |
43 | +#ifdef __linux__ | 43 | +#ifdef __linux__ | |
44 | wl_log("%s (pid %u)\n", reason, client->ucred.pid); | 44 | wl_log("%s (pid %u)\n", reason, client->ucred.pid); | |
45 | +#else | 45 | +#else | |
46 | + wl_log("Destroying with error: %s\n", reason); | 46 | + wl_log("Destroying with error: %s\n", reason); | |
47 | +#endif | 47 | +#endif | |
48 | wl_client_destroy(client); | 48 | wl_client_destroy(client); | |
49 | } | 49 | } | |
50 | 50 | |||
51 | @@ -527,9 +548,11 @@ wl_client_create(struct wl_display *disp | 51 | @@ -530,9 +551,11 @@ wl_client_create(struct wl_display *disp | |
52 | goto err_client; | 52 | goto err_client; | |
53 | 53 | |||
54 | len = sizeof client->ucred; | 54 | len = sizeof client->ucred; | |
55 | +#ifdef SO_PEERCRED | 55 | +#ifdef SO_PEERCRED | |
56 | if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, | 56 | if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, | |
57 | &client->ucred, &len) < 0) | 57 | &client->ucred, &len) < 0) | |
58 | goto err_source; | 58 | goto err_source; | |
59 | +#endif | 59 | +#endif | |
60 | 60 | |||
61 | client->connection = wl_connection_create(fd); | 61 | client->connection = wl_connection_create(fd); | |
62 | if (client->connection == NULL) | 62 | if (client->connection == NULL) | |
63 | @@ -583,12 +606,23 @@ WL_EXPORT void | 63 | @@ -586,12 +609,23 @@ WL_EXPORT void | |
64 | wl_client_get_credentials(struct wl_client *client, | 64 | wl_client_get_credentials(struct wl_client *client, | |
65 | pid_t *pid, uid_t *uid, gid_t *gid) | 65 | pid_t *pid, uid_t *uid, gid_t *gid) | |
66 | { | 66 | { | |
67 | +#ifdef HAVE_SYS_UCRED_H | 67 | +#ifdef HAVE_SYS_UCRED_H | |
68 | + /* BSD */ | 68 | + /* BSD */ | |
69 | + if (pid) | 69 | + if (pid) | |
70 | + *pid = 0; /* FIXME: should be set*/ | 70 | + *pid = 0; /* FIXME: should be set*/ | |
71 | + if (uid) | 71 | + if (uid) | |
72 | + *uid = client->ucred.cr_uid; | 72 | + *uid = client->ucred.cr_uid; | |
73 | + if (gid) | 73 | + if (gid) | |
74 | + *gid = client->ucred.cr_gid; | 74 | + *gid = client->ucred.cr_gid; | |
75 | +#else | 75 | +#else | |
76 | + /* Linux */ | 76 | + /* Linux */ |