commit 990cb63
chld
·
2026-03-22 20:56:01 +0000 UTC
parent 6ce0b77
fix xwayland ceasing to start in freebsd fix fcntl failing causing xwayland to be ineffective
2 files changed,
+28,
-1
+12,
-1
1@@ -449,6 +449,10 @@ setup_tty(int fd)
2 if (ioctl(fd, KDSKBMODE, K_OFF) == -1) {
3 die("failed to set keyboard mode to K_OFF:");
4 }
5+#elif defined(__FreeBSD__)
6+ if (ioctl(fd, KDSKBMODE, K_RAW) == -1) {
7+ die("failed to set keyboard mode to K_RAW:");
8+ }
9 #endif
10 if (ioctl(fd, KDSETMODE, KD_GRAPHICS) == -1) {
11 perror("KDSETMODE KD_GRAPHICS");
12@@ -569,7 +573,14 @@ main(int argc, char *argv[])
13 usage(argv[0]);
14 }
15
16- if (socketpair(AF_LOCAL, SOCK_SEQPACKET, 0, sock) == -1) {
17+
18+ if (socketpair(AF_LOCAL,
19+ #ifdef __linux__
20+ SOCK_SEQPACKET,
21+ #else
22+ SOCK_STREAM,
23+ #endif
24+ 0, sock) == -1) {
25 die("socketpair:");
26 }
27 if (fcntl(sock[0], F_SETFD, FD_CLOEXEC) == -1) {
+16,
-0
1@@ -155,6 +155,7 @@ begin:
2
3 close(lock_fd);
4
5+ #ifdef __linux__
6 /* Bind to abstract socket */
7 addr.sun_path[0] = '\0';
8 snprintf(addr.sun_path + 1, sizeof(addr.sun_path) - 1, SOCKET_FMT,
9@@ -162,6 +163,9 @@ begin:
10 if ((xserver.abstract_fd = open_socket(&addr)) < 0) {
11 goto retry1;
12 }
13+ #else
14+ xserver.abstract_fd=-1;
15+ #endif
16
17 /* Bind to unix socket */
18 mkdir(SOCKET_DIR, 0777);
19@@ -182,7 +186,9 @@ close_display(void)
20 {
21 char path[64];
22
23+ #ifdef __linux__
24 close(xserver.abstract_fd);
25+ #endif
26 close(xserver.unix_fd);
27
28 snprintf(path, sizeof(path), SOCKET_FMT, xserver.display);
29@@ -268,6 +274,9 @@ xserver_initialize(void)
30 /* Unset the FD_CLOEXEC flag on the FDs that will get passed to
31 * Xwayland. */
32 for (index = 0; index < ARRAY_LENGTH(fds); ++index) {
33+#if defined(__FreeBSD__)
34+ if (fds[index]==-1) continue;
35+#endif
36 if (fcntl(fds[index], F_SETFD, 0) != 0) {
37 ERROR("fcntl() failed: %s\n", strerror(errno));
38 goto fail;
39@@ -290,9 +299,16 @@ xserver_initialize(void)
40 }
41
42 setenv("WAYLAND_SOCKET", strings[0], true);
43+
44+ #ifdef __linux__
45 execlp("Xwayland", "Xwayland", xserver.display_name, "-rootless",
46 "-terminate", "-listen", strings[2], "-listen", strings[3],
47 "-wm", strings[1], NULL);
48+ #else
49+ execlp("Xwayland", "Xwayland", xserver.display_name, "-rootless",
50+ "-terminate", "-listen", strings[3],
51+ "-wm", strings[1], NULL);
52+ #endif
53
54 fail:
55 exit(EXIT_FAILURE);