View | Details | Raw Unified | Return to bug 258547 | Differences between
and this patch

Collapse All | Expand All

(-)b/devel/sdl20/files/patch-wayland-1.20 (+29 lines)
Added Link Here
1
ld: error: undefined symbol: wl_proxy_marshal_flags
2
>>> referenced by SDL_waylanddatamanager.c
3
>>>               build/.libs/SDL_waylanddatamanager.o:(Wayland_data_source_destroy)
4
>>> referenced by SDL_waylanddatamanager.c
5
>>>               build/.libs/SDL_waylanddatamanager.o:(Wayland_data_offer_receive)
6
>>> referenced by SDL_waylanddatamanager.c
7
>>>               build/.libs/SDL_waylanddatamanager.o:(Wayland_data_offer_destroy)
8
>>> referenced 109 more times
9
10
--- src/video/wayland/SDL_waylanddyn.h.orig	2020-03-11 01:36:18 UTC
11
+++ src/video/wayland/SDL_waylanddyn.h
12
@@ -75,6 +75,7 @@ void SDL_WAYLAND_UnloadSymbols(void);
13
 #define wl_proxy_create (*WAYLAND_wl_proxy_create)
14
 #define wl_proxy_destroy (*WAYLAND_wl_proxy_destroy)
15
 #define wl_proxy_marshal (*WAYLAND_wl_proxy_marshal)
16
+#define wl_proxy_marshal_flags (*WAYLAND_wl_proxy_marshal_flags)
17
 #define wl_proxy_set_user_data (*WAYLAND_wl_proxy_set_user_data)
18
 #define wl_proxy_get_user_data (*WAYLAND_wl_proxy_get_user_data)
19
 #define wl_proxy_get_version (*WAYLAND_wl_proxy_get_version)
20
--- src/video/wayland/SDL_waylandsym.h.orig	2020-03-11 01:36:18 UTC
21
+++ src/video/wayland/SDL_waylandsym.h
22
@@ -35,6 +35,7 @@
23
 
24
 SDL_WAYLAND_MODULE(WAYLAND_CLIENT)
25
 SDL_WAYLAND_SYM(void, wl_proxy_marshal, (struct wl_proxy *, uint32_t, ...))
26
+SDL_WAYLAND_SYM(struct wl_proxy *, wl_proxy_marshal_flags, (struct wl_proxy *, uint32_t, const struct wl_interface *, uint32_t, uint32_t, ...))
27
 SDL_WAYLAND_SYM(struct wl_proxy *, wl_proxy_create, (struct wl_proxy *, const struct wl_interface *))
28
 SDL_WAYLAND_SYM(void, wl_proxy_destroy, (struct wl_proxy *))
29
 SDL_WAYLAND_SYM(int, wl_proxy_add_listener, (struct wl_proxy *, void (**)(void), void *))
(-)b/graphics/wayland/Makefile (-8 / +3 lines)
Lines 1-13 Link Here
1
# Created by: kwm@FreeBSD.org
1
# Created by: kwm@FreeBSD.org
2
2
3
PORTNAME=	wayland
3
PORTNAME=	wayland
4
PORTVERSION=	1.19.0
4
DISTVERSION=	1.19.91
5
PORTREVISION=	1
6
CATEGORIES=	graphics wayland
5
CATEGORIES=	graphics wayland
7
MASTER_SITES=	https://wayland.freedesktop.org/releases/
8
9
PATCH_SITES=	https://gitlab.freedesktop.org/${PORTNAME}/${PORTNAME}/commit/
10
PATCHFILES+=	ed55438366e93d70867e3ba6b80978673e536fc0.patch:-p1 # MR 133
11
6
12
MAINTAINER=	x11@FreeBSD.org
7
MAINTAINER=	x11@FreeBSD.org
13
COMMENT=	Wayland composite "server"
8
COMMENT=	Wayland composite "server"
Lines 19-27 LIB_DEPENDS= libexpat.so:textproc/expat2 \ Link Here
19
		libffi.so:devel/libffi \
14
		libffi.so:devel/libffi \
20
		libepoll-shim.so:devel/libepoll-shim
15
		libepoll-shim.so:devel/libepoll-shim
21
16
22
CFLAGS+=	"-I${LOCALBASE}/include/libepoll-shim"
23
24
USES=		cpe gnome meson pkgconfig tar:xz
17
USES=		cpe gnome meson pkgconfig tar:xz
18
USE_GITHUB=	yes
19
GH_ACCOUNT=	${PORTNAME}-project
25
USE_GNOME=	libxslt:build
20
USE_GNOME=	libxslt:build
26
USE_LDCONFIG=	yes
21
USE_LDCONFIG=	yes
27
MESON_ARGS=	-Ddocumentation=false
22
MESON_ARGS=	-Ddocumentation=false
(-)b/graphics/wayland/distinfo (-5 / +3 lines)
Lines 1-5 Link Here
1
TIMESTAMP = 1622412504
1
TIMESTAMP = 1636054762
2
SHA256 (wayland-1.19.0.tar.xz) = baccd902300d354581cd5ad3cc49daa4921d55fb416a5883e218750fef166d15
2
SHA256 (wayland-project-wayland-1.19.91_GH0.tar.gz) = 3b76d22ff27df618cf08b99e6adf8b1dcb69e5f6046163ebcf9db33cacc8f29e
3
SIZE (wayland-1.19.0.tar.xz) = 456380
3
SIZE (wayland-project-wayland-1.19.91_GH0.tar.gz) = 347941
4
SHA256 (ed55438366e93d70867e3ba6b80978673e536fc0.patch) = cdf90fc3ec9455aad348a5251842f9035484fb49a7d10fd4930192002308c6ea
5
SIZE (ed55438366e93d70867e3ba6b80978673e536fc0.patch) = 927
(-)a/graphics/wayland/files/patch-cursor_os-compatibility.c (-23 lines)
Removed Link Here
1
--- cursor/os-compatibility.c.orig	2020-02-11 23:46:03 UTC
2
+++ cursor/os-compatibility.c
3
@@ -34,7 +34,7 @@
4
 #include <string.h>
5
 #include <stdlib.h>
6
 
7
-#ifdef HAVE_MEMFD_CREATE
8
+#if defined(HAVE_MEMFD_CREATE) || defined(__FreeBSD__)
9
 #include <sys/mman.h>
10
 #endif
11
 
12
@@ -131,6 +131,11 @@ os_create_anonymous_file(off_t size)
13
 		 */
14
 		fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK | F_SEAL_SEAL);
15
 	} else
16
+#elif defined(__FreeBSD__)
17
+/* posix_fallocate returns ENODEV before https://svnweb.freebsd.org/changeset/base/356512 */
18
+#undef HAVE_POSIX_FALLOCATE
19
+	fd = shm_open(SHM_ANON, O_CREAT | O_RDWR | O_CLOEXEC, 0600); // shm_open is always CLOEXEC
20
+	if (fd < 0)
21
 #endif
22
 	{
23
 		path = getenv("XDG_RUNTIME_DIR");
(-)a/graphics/wayland/files/patch-meson.build (-33 lines)
Removed Link Here
1
--- meson.build.orig	2020-02-11 23:46:03 UTC
2
+++ meson.build
3
@@ -26,7 +26,14 @@ add_project_arguments(
4
 	language: 'c'
5
 )
6
 
7
-foreach h: [ 'sys/prctl.h' ]
8
+have_headers = [
9
+	'signal.h',
10
+	'sys/epoll.h',
11
+	'sys/prctl.h',
12
+	'sys/ucred.h',
13
+]
14
+
15
+foreach h: have_headers
16
 	config_h.set('HAVE_' + h.underscorify().to_upper(), cc.has_header(h))
17
 endforeach
18
 
19
@@ -37,12 +44,14 @@ have_funcs = [
20
 	'prctl',
21
 	'memfd_create',
22
 	'strndup',
23
+	'waitid',
24
 ]
25
 foreach f: have_funcs
26
 	config_h.set('HAVE_' + f.underscorify().to_upper(), cc.has_function(f))
27
 endforeach
28
 
29
 if get_option('libraries')
30
+	epoll_dep = dependency('epoll-shim', required: false)
31
 	ffi_dep = dependency('libffi')
32
 
33
 	decls = [
(-)a/graphics/wayland/files/patch-src_meson.build (-36 lines)
Removed Link Here
1
--- src/meson.build.orig	2021-01-06 19:25:15 UTC
2
+++ src/meson.build
3
@@ -77,7 +77,7 @@ if get_option('libraries')
4
 			'connection.c',
5
 			'wayland-os.c'
6
 		],
7
-		dependencies: [ ffi_dep, rt_dep ]
8
+		dependencies: [ epoll_dep, ffi_dep, rt_dep ]
9
 	)
10
 
11
 	wayland_private_dep = declare_dependency(
12
@@ -151,6 +151,7 @@ if get_option('libraries')
13
 		],
14
 		version: '0.1.0',
15
 		dependencies: [
16
+			epoll_dep,
17
 			ffi_dep,
18
 			wayland_private_dep,
19
 			wayland_util_dep,
20
@@ -165,7 +166,7 @@ if get_option('libraries')
21
 	wayland_server_dep = declare_dependency(
22
 		link_with: wayland_server,
23
 		include_directories: [ root_inc, include_directories('.') ],
24
-		dependencies: [ ffi_dep, mathlib_dep, threads_dep ],
25
+		dependencies: [ epoll_dep, ffi_dep, mathlib_dep, threads_dep ],
26
 		sources: [
27
 			wayland_server_protocol_core_h,
28
 			wayland_server_protocol_h
29
@@ -194,6 +195,7 @@ if get_option('libraries')
30
 		],
31
 		version: '0.3.0',
32
 		dependencies: [
33
+			epoll_dep,
34
 			ffi_dep,
35
 			wayland_private_dep,
36
 			wayland_util_dep,
(-)a/graphics/wayland/files/patch-src_wayland-os.c (-97 lines)
Removed Link Here
1
--- src/wayland-os.c.orig	2017-08-08 18:20:52 UTC
2
+++ src/wayland-os.c
3
@@ -25,6 +25,8 @@
4
 
5
 #define _GNU_SOURCE
6
 
7
+#include "../config.h"
8
+
9
 #include <sys/types.h>
10
 #include <sys/socket.h>
11
 #include <unistd.h>
12
@@ -32,7 +34,6 @@
13
 #include <errno.h>
14
 #include <sys/epoll.h>
15
 
16
-#include "../config.h"
17
 #include "wayland-os.h"
18
 
19
 static int
20
@@ -62,26 +63,50 @@ wl_os_socket_cloexec(int domain, int type, int protoco
21
 {
22
 	int fd;
23
 
24
+#ifdef SOCK_CLOEXEC
25
 	fd = socket(domain, type | SOCK_CLOEXEC, protocol);
26
 	if (fd >= 0)
27
 		return fd;
28
 	if (errno != EINVAL)
29
 		return -1;
30
+#endif
31
 
32
 	fd = socket(domain, type, protocol);
33
 	return set_cloexec_or_close(fd);
34
 }
35
 
36
 int
37
+wl_os_socketpair_cloexec(int domain, int type, int protocol, int sv[2])
38
+{
39
+       int retval;
40
+
41
+#ifdef SOCK_CLOEXEC
42
+       retval = socketpair(domain, type | SOCK_CLOEXEC, protocol, sv);
43
+       if (retval >= 0)
44
+               return retval;
45
+       if (errno != EINVAL)
46
+               return -1;
47
+#endif
48
+
49
+       retval = socketpair(domain, type, protocol, sv);
50
+       if (set_cloexec_or_close(sv[0]) < 0 || set_cloexec_or_close(sv[1]) < 0)
51
+               retval = -1;
52
+
53
+       return retval;
54
+}
55
+
56
+int
57
 wl_os_dupfd_cloexec(int fd, long minfd)
58
 {
59
 	int newfd;
60
 
61
+#ifdef F_DUPFD_CLOEXEC
62
 	newfd = fcntl(fd, F_DUPFD_CLOEXEC, minfd);
63
 	if (newfd >= 0)
64
 		return newfd;
65
 	if (errno != EINVAL)
66
 		return -1;
67
+#endif
68
 
69
 	newfd = fcntl(fd, F_DUPFD, minfd);
70
 	return set_cloexec_or_close(newfd);
71
@@ -123,15 +148,18 @@ wl_os_recvmsg_cloexec(int sockfd, struct msghdr *msg, 
72
 {
73
 	ssize_t len;
74
 
75
+#ifdef MSG_CMSG_CLOEXEC
76
 	len = recvmsg(sockfd, msg, flags | MSG_CMSG_CLOEXEC);
77
 	if (len >= 0)
78
 		return len;
79
 	if (errno != EINVAL)
80
 		return -1;
81
+#endif
82
 
83
 	return recvmsg_cloexec_fallback(sockfd, msg, flags);
84
 }
85
 
86
+#ifdef HAVE_SYS_EPOLL_H
87
 int
88
 wl_os_epoll_create_cloexec(void)
89
 {
90
@@ -148,6 +176,7 @@ wl_os_epoll_create_cloexec(void)
91
 	fd = epoll_create(1);
92
 	return set_cloexec_or_close(fd);
93
 }
94
+#endif
95
 
96
 int
97
 wl_os_accept_cloexec(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
(-)a/graphics/wayland/files/patch-src_wayland-os.h (-12 lines)
Removed Link Here
1
--- src/wayland-os.h.orig	2017-08-08 18:20:52 UTC
2
+++ src/wayland-os.h
3
@@ -30,6 +30,9 @@ int
4
 wl_os_socket_cloexec(int domain, int type, int protocol);
5
 
6
 int
7
+wl_os_socketpair_cloexec(int domain, int type, int protocol, int sv[2]);
8
+
9
+int
10
 wl_os_dupfd_cloexec(int fd, long minfd);
11
 
12
 ssize_t
(-)a/graphics/wayland/files/patch-src_wayland-server.c (-109 lines)
Removed Link Here
1
--- src/wayland-server.c.orig	2020-12-21 10:17:10 UTC
2
+++ src/wayland-server.c
3
@@ -25,6 +25,8 @@
4
 
5
 #define _GNU_SOURCE
6
 
7
+#include "../config.h"
8
+
9
 #include <stdbool.h>
10
 #include <stdlib.h>
11
 #include <stdint.h>
12
@@ -44,6 +46,15 @@
13
 #include <sys/file.h>
14
 #include <sys/stat.h>
15
 
16
+#ifdef HAVE_SYS_UCRED_H
17
+#include <sys/param.h>
18
+#include <sys/ucred.h>
19
+#ifndef SOL_LOCAL
20
+/* DragonFly or FreeBSD < 12.2 */
21
+#define SOL_LOCAL 0
22
+#endif
23
+#endif
24
+
25
 #include "wayland-util.h"
26
 #include "wayland-private.h"
27
 #include "wayland-server-private.h"
28
@@ -79,7 +86,13 @@ struct wl_client {
29
 	struct wl_list link;
30
 	struct wl_map objects;
31
 	struct wl_priv_signal destroy_signal;
32
+#ifdef HAVE_SYS_UCRED_H
33
+	/* FreeBSD */
34
+	struct xucred xucred;
35
+#else
36
+	/* Linux */
37
 	struct ucred ucred;
38
+#endif
39
 	int error;
40
 	struct wl_priv_signal resource_created_signal;
41
 };
42
@@ -315,7 +328,17 @@ wl_resource_post_error(struct wl_resource *resource,
43
 static void
44
 destroy_client_with_error(struct wl_client *client, const char *reason)
45
 {
46
+#ifdef HAVE_SYS_UCRED_H
47
+	/* FreeBSD */
48
+#if defined(__FreeBSD__) && __FreeBSD_version >= 1300030
49
+	wl_log("%s (pid %u)\n", reason, client->xucred.cr_pid);
50
+#else
51
+	wl_log("%s\n", reason);
52
+#endif
53
+#else
54
+	/* Linux */
55
 	wl_log("%s (pid %u)\n", reason, client->ucred.pid);
56
+#endif
57
 	wl_client_destroy(client);
58
 }
59
 
60
@@ -529,10 +552,20 @@ wl_client_create(struct wl_display *display, int fd)
61
 	if (!client->source)
62
 		goto err_client;
63
 
64
+#if defined(SO_PEERCRED)
65
+	/* Linux */
66
 	len = sizeof client->ucred;
67
 	if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED,
68
 		       &client->ucred, &len) < 0)
69
 		goto err_source;
70
+#elif defined(LOCAL_PEERCRED)
71
+	/* FreeBSD */
72
+	len = sizeof client->xucred;
73
+	if (getsockopt(fd, SOL_LOCAL, LOCAL_PEERCRED,
74
+		       &client->xucred, &len) < 0 ||
75
+		       client->xucred.cr_version != XUCRED_VERSION)
76
+		goto err_source;
77
+#endif
78
 
79
 	client->connection = wl_connection_create(fd);
80
 	if (client->connection == NULL)
81
@@ -586,12 +619,28 @@ WL_EXPORT void
82
 wl_client_get_credentials(struct wl_client *client,
83
 			  pid_t *pid, uid_t *uid, gid_t *gid)
84
 {
85
+#ifdef HAVE_SYS_UCRED_H
86
+	/* DragonFly or FreeBSD */
87
 	if (pid)
88
+#if defined(__FreeBSD__) && __FreeBSD_version >= 1300030
89
+		/* Since https://cgit.freebsd.org/src/commit/?id=c5afec6e895a */
90
+		*pid = client->xucred.cr_pid;
91
+#else
92
+		*pid = 0;
93
+#endif
94
+	if (uid)
95
+		*uid = client->xucred.cr_uid;
96
+	if (gid)
97
+		*gid = client->xucred.cr_gid;
98
+#else
99
+	/* Linux */
100
+	if (pid)
101
 		*pid = client->ucred.pid;
102
 	if (uid)
103
 		*uid = client->ucred.uid;
104
 	if (gid)
105
 		*gid = client->ucred.gid;
106
+#endif
107
 }
108
 
109
 /** Get the file descriptor for the client
(-)a/graphics/wayland/files/patch-src_wayland-shm.c (-147 lines)
Removed Link Here
1
--- src/wayland-shm.c.orig	2020-02-11 23:46:03 UTC
2
+++ src/wayland-shm.c
3
@@ -32,6 +32,8 @@
4
 
5
 #include "config.h"
6
 
7
+#include "../config.h"
8
+
9
 #include <stdbool.h>
10
 #include <stdio.h>
11
 #include <stdlib.h>
12
@@ -64,6 +66,9 @@ struct wl_shm_pool {
13
 	int32_t size;
14
 	int32_t new_size;
15
 	bool sigbus_is_impossible;
16
+#ifdef HAVE_SYS_UCRED_H
17
+	int fd;
18
+#endif
19
 };
20
 
21
 struct wl_shm_buffer {
22
@@ -81,15 +86,24 @@ struct wl_shm_sigbus_data {
23
 	int fallback_mapping_used;
24
 };
25
 
26
+static void *mremap_compat_maymove(void *, size_t, size_t, int, int, int);
27
+
28
 static void
29
 shm_pool_finish_resize(struct wl_shm_pool *pool)
30
 {
31
 	void *data;
32
+	int fd = -1;
33
 
34
 	if (pool->size == pool->new_size)
35
 		return;
36
 
37
-	data = mremap(pool->data, pool->size, pool->new_size, MREMAP_MAYMOVE);
38
+#ifdef HAVE_SYS_UCRED_H
39
+	fd = pool->fd;
40
+#endif
41
+
42
+	data = mremap_compat_maymove(pool->data, pool->size, pool->new_size,
43
+				     PROT_READ | PROT_WRITE, MAP_SHARED, fd);
44
+
45
 	if (data == MAP_FAILED) {
46
 		wl_resource_post_error(pool->resource,
47
 				       WL_SHM_ERROR_INVALID_FD,
48
@@ -115,6 +129,10 @@ shm_pool_unref(struct wl_shm_pool *pool, bool external
49
 	if (pool->internal_refcount + pool->external_refcount)
50
 		return;
51
 
52
+#ifdef HAVE_SYS_UCRED_H
53
+	close(pool->fd);
54
+#endif
55
+
56
 	munmap(pool->data, pool->size);
57
 	free(pool);
58
 }
59
@@ -228,6 +246,73 @@ shm_pool_destroy(struct wl_client *client, struct wl_r
60
 	wl_resource_destroy(resource);
61
 }
62
 
63
+#ifdef HAVE_MREMAP
64
+static void *
65
+mremap_compat_maymove(void *old_address, size_t old_size, size_t new_size,
66
+		      int old_prot, int old_flags, int old_fd)
67
+{
68
+	return mremap(old_address, old_size, new_size, MREMAP_MAYMOVE);
69
+}
70
+#else
71
+static void *
72
+mremap_compat_maymove(void *old_address, size_t old_size, size_t new_size,
73
+		      int old_prot, int old_flags, int old_fd)
74
+{
75
+	/* FreeBSD doesn't support mremap() yet, so we have to emulate it.
76
+	 * This assumes MREMAP_MAYMOVE is the only flag in use. */
77
+	if (new_size == old_size) {
78
+		return old_address;
79
+	} else if (new_size < old_size) {
80
+		/* Shrinking: munmap() the spare region. */
81
+		munmap(old_address + old_size, new_size - old_size);
82
+		return old_address;
83
+	} else {
84
+		void *ret;
85
+
86
+		/* Growing. Try and mmap() the extra region at the end of
87
+		 * our existing allocation. If that gets mapped in the
88
+		 * wrong place, fall back to mmap()ing an entirely new
89
+		 * region of new_size and copying the data across. */
90
+		ret = mmap(old_address + old_size, new_size - old_size,
91
+			   old_prot, old_flags, old_fd, 0);
92
+
93
+/* FIXME TODO: msync() before munmap()? */
94
+		if (ret == MAP_FAILED) {
95
+			/* Total failure! */
96
+			return ret;
97
+		} else if (ret == old_address + old_size) {
98
+			/* Success. */
99
+			return old_address;
100
+		} else if (ret != old_address + old_size) {
101
+			/* Partial failure. Fall back to mapping an
102
+			 * entirely new region. Unmap the region we
103
+			 * just mapped first. */
104
+			munmap(ret, new_size - old_size);
105
+
106
+			/* Map an entirely new region. */
107
+			ret = mmap(NULL, new_size,
108
+				   old_prot, old_flags, old_fd, 0);
109
+			if (ret == MAP_FAILED) {
110
+				/* Total failure! */
111
+				return ret;
112
+			}
113
+
114
+			/* Copy the old data across. Implicit assumption
115
+			 * that the old and new regions don't overlap. */
116
+			memcpy(ret, old_address, old_size);
117
+
118
+			/* Unmap the old region. */
119
+			munmap(old_address, old_size);
120
+
121
+			return ret;
122
+		}
123
+	}
124
+
125
+	/* Unreachable. */
126
+	return MAP_FAILED;
127
+}
128
+#endif
129
+
130
 static void
131
 shm_pool_resize(struct wl_client *client, struct wl_resource *resource,
132
 		int32_t size)
133
@@ -300,7 +385,14 @@ shm_create_pool(struct wl_client *client, struct wl_re
134
 				       strerror(errno));
135
 		goto err_free;
136
 	}
137
+
138
+#ifdef HAVE_SYS_UCRED_H
139
+	/* We need to keep the FD around on FreeBSD so we can implement
140
+	 * mremap(). See: mremap_compat_maymove(). */
141
+	pool->fd = fd;
142
+#else
143
 	close(fd);
144
+#endif
145
 
146
 	pool->resource =
147
 		wl_resource_create(client, &wl_shm_pool_interface, 1, id);
(-)a/graphics/wayland/files/patch-tests_client-test.c (-19 lines)
Removed Link Here
1
--- tests/client-test.c.orig	2015-07-06 19:38:51 UTC
2
+++ tests/client-test.c
3
@@ -34,6 +34,7 @@
4
 #include <sys/types.h>
5
 #include <sys/stat.h>
6
 
7
+#include "wayland-os.h"
8
 #include "wayland-private.h"
9
 #include "wayland-server.h"
10
 #include "test-runner.h"
11
@@ -59,7 +60,7 @@ TEST(client_destroy_listener)
12
 	struct client_destroy_listener a, b;
13
 	int s[2];
14
 
15
-	assert(socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, s) == 0);
16
+	assert(wl_os_socketpair_cloexec(AF_UNIX, SOCK_STREAM, 0, s) == 0);
17
 	display = wl_display_create();
18
 	assert(display);
19
 	client = wl_client_create(display, s[0]);
(-)a/graphics/wayland/files/patch-tests_connection-test.c (-29 lines)
Removed Link Here
1
--- tests/connection-test.c.orig	2017-02-07 22:59:06 UTC
2
+++ tests/connection-test.c
3
@@ -37,6 +37,7 @@
4
 #include <sys/stat.h>
5
 #include <poll.h>
6
 
7
+#include "wayland-os.h"
8
 #include "wayland-private.h"
9
 #include "test-runner.h"
10
 #include "test-compositor.h"
11
@@ -48,7 +49,7 @@ setup(int *s)
12
 {
13
 	struct wl_connection *connection;
14
 
15
-	assert(socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, s) == 0);
16
+	assert(wl_os_socketpair_cloexec(AF_UNIX, SOCK_STREAM, 0, s) == 0);
17
 
18
 	connection = wl_connection_create(s[0]);
19
 	assert(connection);
20
@@ -181,8 +182,7 @@ struct marshal_data {
21
 static void
22
 setup_marshal_data(struct marshal_data *data)
23
 {
24
-	assert(socketpair(AF_UNIX,
25
-			  SOCK_STREAM | SOCK_CLOEXEC, 0, data->s) == 0);
26
+	assert(wl_os_socketpair_cloexec(AF_UNIX, SOCK_STREAM, 0, data->s) == 0);
27
 	data->read_connection = wl_connection_create(data->s[0]);
28
 	assert(data->read_connection);
29
 	data->write_connection = wl_connection_create(data->s[1]);
(-)a/graphics/wayland/files/patch-tests_event-loop-test.c (-44 lines)
Removed Link Here
1
--- tests/event-loop-test.c.orig	2020-02-11 23:46:03 UTC
2
+++ tests/event-loop-test.c
3
@@ -168,10 +168,10 @@ TEST(event_loop_signal)
4
 					  signal_callback, &got_it);
5
 	assert(source);
6
 
7
-	wl_event_loop_dispatch(loop, 0);
8
+	assert(wl_event_loop_dispatch(loop, 0) == 0);
9
 	assert(!got_it);
10
-	kill(getpid(), SIGUSR1);
11
-	wl_event_loop_dispatch(loop, 0);
12
+	assert(kill(getpid(), SIGUSR1) == 0);
13
+	assert(wl_event_loop_dispatch(loop, 0) == 0);
14
 	assert(got_it == 1);
15
 
16
 	wl_event_source_remove(source);
17
@@ -235,11 +235,11 @@ TEST(event_loop_timer)
18
 
19
 	source1 = wl_event_loop_add_timer(loop, timer_callback, &got_it);
20
 	assert(source1);
21
-	wl_event_source_timer_update(source1, 20);
22
+	assert(wl_event_source_timer_update(source1, 20) == 0);
23
 
24
 	source2 = wl_event_loop_add_timer(loop, timer_callback, &got_it);
25
 	assert(source2);
26
-	wl_event_source_timer_update(source2, 100);
27
+	assert(wl_event_source_timer_update(source2, 100) == 0);
28
 
29
 	/* Check that the timer marked for 20 msec from now fires within 30
30
 	 * msec, and that the timer marked for 100 msec is expected to fire
31
@@ -248,11 +248,11 @@ TEST(event_loop_timer)
32
 
33
 	wl_event_loop_dispatch(loop, 0);
34
 	assert(got_it == 0);
35
-	wl_event_loop_dispatch(loop, 30);
36
+	assert(wl_event_loop_dispatch(loop, 30) == 0);
37
 	assert(got_it == 1);
38
 	wl_event_loop_dispatch(loop, 0);
39
 	assert(got_it == 1);
40
-	wl_event_loop_dispatch(loop, 90);
41
+	assert(wl_event_loop_dispatch(loop, 90) == 0);
42
 	assert(got_it == 2);
43
 
44
 	wl_event_source_remove(source1);
(-)a/graphics/wayland/files/patch-tests_os-wrappers-test.c (-122 lines)
Removed Link Here
1
--- tests/os-wrappers-test.c.orig	2017-08-08 18:20:52 UTC
2
+++ tests/os-wrappers-test.c
3
@@ -26,6 +26,8 @@
4
 
5
 #define _GNU_SOURCE
6
 
7
+#include "../config.h"
8
+
9
 #include <stdlib.h>
10
 #include <stdint.h>
11
 #include <assert.h>
12
@@ -73,15 +75,22 @@ socket(int domain, int type, int protocol)
13
 {
14
 	wrapped_calls_socket++;
15
 
16
+#ifdef SOCK_CLOEXEC
17
 	if (fall_back && (type & SOCK_CLOEXEC)) {
18
 		errno = EINVAL;
19
 		return -1;
20
 	}
21
+#endif
22
 
23
 	return real_socket(domain, type, protocol);
24
 }
25
 
26
 __attribute__ ((visibility("default"))) int
27
+#ifdef fcntl
28
+/* Work around #define fcntl in epoll-shim */
29
+#define old_fcntl fcntl
30
+#undef fcntl
31
+#endif
32
 fcntl(int fd, int cmd, ...)
33
 {
34
 	va_list ap;
35
@@ -89,10 +98,12 @@ fcntl(int fd, int cmd, ...)
36
 
37
 	wrapped_calls_fcntl++;
38
 
39
+#ifdef F_DUPFD_CLOEXEC
40
 	if (fall_back && (cmd == F_DUPFD_CLOEXEC)) {
41
 		errno = EINVAL;
42
 		return -1;
43
 	}
44
+#endif
45
 
46
 	va_start(ap, cmd);
47
 	arg = va_arg(ap, void*);
48
@@ -100,16 +111,21 @@ fcntl(int fd, int cmd, ...)
49
 
50
 	return real_fcntl(fd, cmd, arg);
51
 }
52
+#ifdef old_fcntl
53
+#define fcntl old_fcntl 
54
+#endif
55
 
56
 __attribute__ ((visibility("default"))) ssize_t
57
 recvmsg(int sockfd, struct msghdr *msg, int flags)
58
 {
59
 	wrapped_calls_recvmsg++;
60
 
61
+#ifdef MSG_CMSG_CLOEXEC
62
 	if (fall_back && (flags & MSG_CMSG_CLOEXEC)) {
63
 		errno = EINVAL;
64
 		return -1;
65
 	}
66
+#endif
67
 
68
 	return real_recvmsg(sockfd, msg, flags);
69
 }
70
@@ -156,12 +172,14 @@ TEST(os_wrappers_socket_cloexec)
71
 	do_os_wrappers_socket_cloexec(0);
72
 }
73
 
74
+#ifdef SOCK_CLOEXEC
75
 TEST(os_wrappers_socket_cloexec_fallback)
76
 {
77
 	/* forced fallback */
78
 	init_fallbacks(1);
79
 	do_os_wrappers_socket_cloexec(1);
80
 }
81
+#endif
82
 
83
 static void
84
 do_os_wrappers_dupfd_cloexec(int n)
85
@@ -195,11 +213,13 @@ TEST(os_wrappers_dupfd_cloexec)
86
 	do_os_wrappers_dupfd_cloexec(0);
87
 }
88
 
89
+#ifdef F_DUPFD_CLOEXEC
90
 TEST(os_wrappers_dupfd_cloexec_fallback)
91
 {
92
 	init_fallbacks(1);
93
 	do_os_wrappers_dupfd_cloexec(3);
94
 }
95
+#endif
96
 
97
 struct marshal_data {
98
 	struct wl_connection *read_connection;
99
@@ -218,8 +238,7 @@ struct marshal_data {
100
 static void
101
 setup_marshal_data(struct marshal_data *data)
102
 {
103
-	assert(socketpair(AF_UNIX,
104
-			  SOCK_STREAM | SOCK_CLOEXEC, 0, data->s) == 0);
105
+	assert(wl_os_socketpair_cloexec(AF_UNIX, SOCK_STREAM, 0, data->s) == 0);
106
 
107
 	data->read_connection = wl_connection_create(data->s[0]);
108
 	assert(data->read_connection);
109
@@ -328,11 +347,13 @@ TEST(os_wrappers_recvmsg_cloexec)
110
 	do_os_wrappers_recvmsg_cloexec(0);
111
 }
112
 
113
+#ifdef MSG_CMSG_CLOEXEC
114
 TEST(os_wrappers_recvmsg_cloexec_fallback)
115
 {
116
 	init_fallbacks(1);
117
 	do_os_wrappers_recvmsg_cloexec(1);
118
 }
119
+#endif
120
 
121
 static void
122
 do_os_wrappers_epoll_create_cloexec(int n)
(-)a/graphics/wayland/files/patch-tests_queue-test.c (-21 lines)
Removed Link Here
1
--- tests/queue-test.c.orig	2016-10-22 16:23:10 UTC
2
+++ tests/queue-test.c
3
@@ -23,6 +23,8 @@
4
  * SOFTWARE.
5
  */
6
 
7
+#include "../config.h"
8
+
9
 #include <stdlib.h>
10
 #include <stdint.h>
11
 #include <stdio.h>
12
@@ -31,6 +33,9 @@
13
 #include <sys/types.h>
14
 #include <sys/wait.h>
15
 #include <assert.h>
16
+#ifdef HAVE_SIGNAL_H
17
+#include <signal.h>
18
+#endif
19
 
20
 #include "wayland-client.h"
21
 #include "wayland-server.h"
(-)a/graphics/wayland/files/patch-tests_test-helpers.c (-48 lines)
Removed Link Here
1
--- tests/test-helpers.c.orig	2020-02-11 23:46:03 UTC
2
+++ tests/test-helpers.c
3
@@ -25,6 +25,8 @@
4
 
5
 #include "config.h"
6
 
7
+#include "../config.h"
8
+
9
 #include <assert.h>
10
 #include <errno.h>
11
 #include <dirent.h>
12
@@ -41,6 +43,16 @@
13
 
14
 #include "test-runner.h"
15
 
16
+#ifdef __FreeBSD__
17
+/* FreeBSD uses fdescfs (which must be mounted using:
18
+ *    mount -t fdescfs fdescfs /dev/fd
19
+ * before the test suite can be run). */
20
+#define OPEN_FDS_DIR "/dev/fd"
21
+#else
22
+/* Linux. */
23
+#define OPEN_FDS_DIR "/proc/self/fd"
24
+#endif
25
+
26
 int
27
 count_open_fds(void)
28
 {
29
@@ -48,8 +60,8 @@ count_open_fds(void)
30
 	struct dirent *ent;
31
 	int count = 0;
32
 
33
-	dir = opendir("/proc/self/fd");
34
-	assert(dir && "opening /proc/self/fd failed.");
35
+	dir = opendir(OPEN_FDS_DIR);
36
+	assert(dir && "opening " OPEN_FDS_DIR " failed.");
37
 
38
 	errno = 0;
39
 	while ((ent = readdir(dir))) {
40
@@ -58,7 +70,7 @@ count_open_fds(void)
41
 			continue;
42
 		count++;
43
 	}
44
-	assert(errno == 0 && "reading /proc/self/fd failed.");
45
+	assert(errno == 0 && "reading " OPEN_FDS_DIR " failed.");
46
 
47
 	closedir(dir);
48
 
(-)a/graphics/wayland/files/patch-tests_test-runner.c (-128 lines)
Removed Link Here
1
--- tests/test-runner.c.orig	2020-02-11 23:46:03 UTC
2
+++ tests/test-runner.c
3
@@ -25,6 +25,8 @@
4
 
5
 #define _GNU_SOURCE
6
 
7
+#include "../config.h"
8
+
9
 #include <unistd.h>
10
 #include <stdio.h>
11
 #include <stdlib.h>
12
@@ -37,13 +39,23 @@
13
 #include <errno.h>
14
 #include <limits.h>
15
 #include <sys/ptrace.h>
16
+#ifdef HAVE_SYS_PRCTL_H
17
 #include <sys/prctl.h>
18
+#endif
19
 #ifndef PR_SET_PTRACER
20
 # define PR_SET_PTRACER 0x59616d61
21
 #endif
22
+#include <signal.h>
23
 
24
 #include "test-runner.h"
25
 
26
+#ifdef __FreeBSD__
27
+/* XXX review ptrace() usage */
28
+#define PTRACE_ATTACH PT_ATTACH
29
+#define PTRACE_CONT PT_CONTINUE
30
+#define PTRACE_DETACH PT_DETACH
31
+#endif
32
+
33
 /* when set to 1, check if tests are not leaking opened files.
34
  * It is turned on by default. It can be turned off by
35
  * WAYLAND_TEST_NO_LEAK_CHECK environment variable. */
36
@@ -51,7 +63,7 @@ int fd_leak_check_enabled;
37
 
38
 /* when this var is set to 0, every call to test_set_timeout() is
39
  * suppressed - handy when debugging the test. Can be set by
40
- * WAYLAND_TEST_NO_TIMEOUTS environment variable. */
41
+ * WAYLAND_TESTS_NO_TIMEOUTS evnironment var */
42
 static int timeouts_enabled = 1;
43
 
44
 /* set to one if the output goes to the terminal */
45
@@ -239,6 +251,8 @@ is_debugger_attached(void)
46
 		return 0;
47
 	}
48
 
49
+
50
+// xxx start here
51
 	pid = fork();
52
 	if (pid == -1) {
53
 		perror("fork");
54
@@ -259,13 +273,14 @@ is_debugger_attached(void)
55
 			_exit(1);
56
 		if (!waitpid(-1, NULL, 0))
57
 			_exit(1);
58
-		ptrace(PTRACE_CONT, NULL, NULL);
59
+		ptrace(PTRACE_CONT, ppid, NULL, NULL);
60
 		ptrace(PTRACE_DETACH, ppid, NULL, NULL);
61
 		_exit(0);
62
 	} else {
63
 		close(pipefd[0]);
64
 
65
 		/* Enable child to ptrace the parent process */
66
+#if defined(HAVE_PRCTL)
67
 		rc = prctl(PR_SET_PTRACER, pid);
68
 		if (rc != 0 && errno != EINVAL) {
69
 			/* An error prevents us from telling if a debugger is attached.
70
@@ -275,7 +290,9 @@ is_debugger_attached(void)
71
 			 */
72
 			perror("prctl");
73
 			write(pipefd[1], "-", 1);
74
-		} else {
75
+		} else
76
+#endif
77
+		{
78
 			/* Signal to client that parent is ready by passing '+' */
79
 			write(pipefd[1], "+", 1);
80
 		}
81
@@ -293,7 +310,11 @@ int main(int argc, char *argv[])
82
 	const struct test *t;
83
 	pid_t pid;
84
 	int total, pass;
85
+#ifdef HAVE_WAITID
86
 	siginfo_t info;
87
+#else
88
+	int status;
89
+#endif
90
 
91
 	if (isatty(fileno(stderr)))
92
 		is_atty = 1;
93
@@ -336,7 +357,8 @@ int main(int argc, char *argv[])
94
 		if (pid == 0)
95
 			run_test(t); /* never returns */
96
 
97
-		if (waitid(P_PID, pid, &info, WEXITED)) {
98
+#ifdef HAVE_WAITID
99
+		if (waitid(P_PID, 0, &info, WEXITED)) {
100
 			stderr_set_color(RED);
101
 			fprintf(stderr, "waitid failed: %s\n",
102
 				strerror(errno));
103
@@ -368,6 +390,25 @@ int main(int argc, char *argv[])
104
 
105
 			break;
106
 		}
107
+#else
108
+               if (waitpid(-1, &status, 0) == -1) {
109
+                       fprintf(stderr, "waitpid failed: %s\n",
110
+                               strerror(errno));
111
+                       abort();
112
+               }
113
+
114
+               fprintf(stderr, "test \"%s\":\t", t->name);
115
+               if (WIFEXITED(status)) {
116
+                       fprintf(stderr, "exit status %d", WEXITSTATUS(status));
117
+                       if (WEXITSTATUS(status) == EXIT_SUCCESS)
118
+                               success = 1;
119
+               } else if (WIFSIGNALED(status)) {
120
+                       fprintf(stderr, "signal %d", WTERMSIG(status));
121
+               }
122
+#endif
123
+
124
+		if (t->must_fail)
125
+			success = !success;
126
 
127
 		if (success) {
128
 			pass++;
(-)b/graphics/wayland/pkg-plist (-4 / +4 lines)
Lines 13-28 include/wayland-util.h Link Here
13
include/wayland-version.h
13
include/wayland-version.h
14
lib/libwayland-client.so
14
lib/libwayland-client.so
15
lib/libwayland-client.so.0
15
lib/libwayland-client.so.0
16
lib/libwayland-client.so.0.3.0
16
lib/libwayland-client.so.0.19.91
17
lib/libwayland-cursor.so
17
lib/libwayland-cursor.so
18
lib/libwayland-cursor.so.0
18
lib/libwayland-cursor.so.0
19
lib/libwayland-cursor.so.0.0.0
19
lib/libwayland-cursor.so.0.19.91
20
lib/libwayland-egl.so
20
lib/libwayland-egl.so
21
lib/libwayland-egl.so.1
21
lib/libwayland-egl.so.1
22
lib/libwayland-egl.so.1.0.0
22
lib/libwayland-egl.so.1.19.91
23
lib/libwayland-server.so
23
lib/libwayland-server.so
24
lib/libwayland-server.so.0
24
lib/libwayland-server.so.0
25
lib/libwayland-server.so.0.1.0
25
lib/libwayland-server.so.0.19.91
26
libdata/pkgconfig/wayland-client.pc
26
libdata/pkgconfig/wayland-client.pc
27
libdata/pkgconfig/wayland-cursor.pc
27
libdata/pkgconfig/wayland-cursor.pc
28
libdata/pkgconfig/wayland-egl-backend.pc
28
libdata/pkgconfig/wayland-egl-backend.pc
(-)b/mail/thunderbird/files/patch-wayland-1.20 (+25 lines)
Added Link Here
1
ld: warning: undefined symbol: wl_proxy_marshal_flags
2
>>> referenced by Unified_cpp_gfx_gl0.cpp
3
>>>               objdir/gfx/gl/Unified_cpp_gfx_gl0.o:(mozilla::gl::DeleteWaylandGLSurface(void*))
4
>>> referenced by Unified_cpp_gfx_gl0.cpp
5
>>>               objdir/gfx/gl/Unified_cpp_gfx_gl0.o:(mozilla::gl::GLContextEGL::CreateWaylandBufferSurface(mozilla::gl::EglDisplay&, void*, mozilla::gfx::IntSizeTyped<mozilla::gfx::UnknownUnits>&))
6
>>> referenced by Unified_cpp_gfx_layers1.cpp
7
>>>               objdir/gfx/layers/Unified_cpp_gfx_layers1.o:(mozilla::layers::NativeLayerRootWayland::CommitToScreen(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&))
8
>>> referenced 84 more times
9
10
--- widget/gtk/mozwayland/mozwayland.c.orig	2021-09-27 22:47:59 UTC
11
+++ widget/gtk/mozwayland/mozwayland.c
12
@@ -40,6 +40,13 @@ MOZ_EXPORT void wl_event_queue_destroy(struct wl_event
13
 
14
 MOZ_EXPORT void wl_proxy_marshal(struct wl_proxy* p, uint32_t opcode, ...) {}
15
 
16
+MOZ_EXPORT struct wl_proxy* wl_proxy_marshal_flags(
17
+    struct wl_proxy* proxy, uint32_t opcode,
18
+    const struct wl_interface* interface, uint32_t version, uint32_t flags,
19
+    ...) {
20
+  return NULL;
21
+}
22
+
23
 MOZ_EXPORT void wl_proxy_marshal_array(struct wl_proxy* p, uint32_t opcode,
24
                                        union wl_argument* args) {}
25
 
(-)b/www/firefox-esr/files/patch-wayland-1.20 (+25 lines)
Added Link Here
1
ld: warning: undefined symbol: wl_proxy_marshal_flags
2
>>> referenced by Unified_cpp_gfx_gl0.cpp
3
>>>               objdir/gfx/gl/Unified_cpp_gfx_gl0.o:(mozilla::gl::DeleteWaylandGLSurface(void*))
4
>>> referenced by Unified_cpp_gfx_gl0.cpp
5
>>>               objdir/gfx/gl/Unified_cpp_gfx_gl0.o:(mozilla::gl::GLContextEGL::CreateWaylandBufferSurface(mozilla::gl::EglDisplay&, void*, mozilla::gfx::IntSizeTyped<mozilla::gfx::UnknownUnits>&))
6
>>> referenced by Unified_cpp_gfx_layers1.cpp
7
>>>               objdir/gfx/layers/Unified_cpp_gfx_layers1.o:(mozilla::layers::NativeLayerRootWayland::CommitToScreen(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&))
8
>>> referenced 84 more times
9
10
--- widget/gtk/mozwayland/mozwayland.c.orig	2021-09-27 22:47:59 UTC
11
+++ widget/gtk/mozwayland/mozwayland.c
12
@@ -40,6 +40,13 @@ MOZ_EXPORT void wl_event_queue_destroy(struct wl_event
13
 
14
 MOZ_EXPORT void wl_proxy_marshal(struct wl_proxy* p, uint32_t opcode, ...) {}
15
 
16
+MOZ_EXPORT struct wl_proxy* wl_proxy_marshal_flags(
17
+    struct wl_proxy* proxy, uint32_t opcode,
18
+    const struct wl_interface* interface, uint32_t version, uint32_t flags,
19
+    ...) {
20
+  return NULL;
21
+}
22
+
23
 MOZ_EXPORT void wl_proxy_marshal_array(struct wl_proxy* p, uint32_t opcode,
24
                                        union wl_argument* args) {}
25
 
(-)b/www/firefox/files/patch-wayland-1.20 (+25 lines)
Added Link Here
1
ld: warning: undefined symbol: wl_proxy_marshal_flags
2
>>> referenced by Unified_cpp_gfx_gl0.cpp
3
>>>               objdir/gfx/gl/Unified_cpp_gfx_gl0.o:(mozilla::gl::DeleteWaylandGLSurface(void*))
4
>>> referenced by Unified_cpp_gfx_gl0.cpp
5
>>>               objdir/gfx/gl/Unified_cpp_gfx_gl0.o:(mozilla::gl::GLContextEGL::CreateWaylandBufferSurface(mozilla::gl::EglDisplay&, void*, mozilla::gfx::IntSizeTyped<mozilla::gfx::UnknownUnits>&))
6
>>> referenced by Unified_cpp_gfx_layers1.cpp
7
>>>               objdir/gfx/layers/Unified_cpp_gfx_layers1.o:(mozilla::layers::NativeLayerRootWayland::CommitToScreen(mozilla::detail::BaseAutoLock<mozilla::Mutex&> const&))
8
>>> referenced 84 more times
9
10
--- widget/gtk/mozwayland/mozwayland.c.orig	2021-09-27 22:47:59 UTC
11
+++ widget/gtk/mozwayland/mozwayland.c
12
@@ -40,6 +40,13 @@ MOZ_EXPORT void wl_event_queue_destroy(struct wl_event
13
 
14
 MOZ_EXPORT void wl_proxy_marshal(struct wl_proxy* p, uint32_t opcode, ...) {}
15
 
16
+MOZ_EXPORT struct wl_proxy* wl_proxy_marshal_flags(
17
+    struct wl_proxy* proxy, uint32_t opcode,
18
+    const struct wl_interface* interface, uint32_t version, uint32_t flags,
19
+    ...) {
20
+  return NULL;
21
+}
22
+
23
 MOZ_EXPORT void wl_proxy_marshal_array(struct wl_proxy* p, uint32_t opcode,
24
                                        union wl_argument* args) {}
25
 

Return to bug 258547