pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/devel/wayland wayland: use wl_os_epoll_create_cloexec ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/1fcc26205785
branches:  trunk
changeset: 338726:1fcc26205785
user:      nia <nia%pkgsrc.org@localhost>
date:      Thu Aug 29 12:22:13 2019 +0000

description:
wayland: use wl_os_epoll_create_cloexec in tests when epoll is there.

should help with building tests on systems with epoll.

diffstat:

 devel/wayland/distinfo                               |   4 +-
 devel/wayland/patches/patch-tests_os-wrappers-test.c |  92 +++++++++++--------
 2 files changed, 55 insertions(+), 41 deletions(-)

diffs (220 lines):

diff -r 7a0e2afa8690 -r 1fcc26205785 devel/wayland/distinfo
--- a/devel/wayland/distinfo    Thu Aug 29 12:19:44 2019 +0000
+++ b/devel/wayland/distinfo    Thu Aug 29 12:22:13 2019 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.3 2019/08/28 10:35:40 nia Exp $
+$NetBSD: distinfo,v 1.4 2019/08/29 12:22:13 nia Exp $
 
 SHA1 (wayland-1.17.0.tar.xz) = 4d9e08a7a4a07fa37a25d7aa3ef83f08edec0600
 RMD160 (wayland-1.17.0.tar.xz) = 635494fb0f5d9eb1e782f98e08c3e0e26ff44268
@@ -15,7 +15,7 @@
 SHA1 (patch-tests_client-test.c) = 6ffe18dfd64176a92f6f795eb757c54a3cf0ad10
 SHA1 (patch-tests_connection-test.c) = af53116c99cbb8d6570bcec66bfd895c1ae01700
 SHA1 (patch-tests_event-loop-test.c) = 79909fdce7b73a7b19c58d3711329f6288fe7204
-SHA1 (patch-tests_os-wrappers-test.c) = 0b45e6952d23589e4991149143331fdb9e0386e1
+SHA1 (patch-tests_os-wrappers-test.c) = 9d154702d0b0238cba554df18e5dbdc620bd9ab8
 SHA1 (patch-tests_queue-test.c) = 3ee8433faa50b033ab880d3c5b6a9846063d6bd6
 SHA1 (patch-tests_sanity-test.c) = 80e06834ccf344fda16a6a8f85e062f2b4a744ec
 SHA1 (patch-tests_test-helpers.c) = 1895c0bdadefdaeaa421e7051b71a297b3a5e2c3
diff -r 7a0e2afa8690 -r 1fcc26205785 devel/wayland/patches/patch-tests_os-wrappers-test.c
--- a/devel/wayland/patches/patch-tests_os-wrappers-test.c      Thu Aug 29 12:19:44 2019 +0000
+++ b/devel/wayland/patches/patch-tests_os-wrappers-test.c      Thu Aug 29 12:22:13 2019 +0000
@@ -1,4 +1,4 @@
-$NetBSD: patch-tests_os-wrappers-test.c,v 1.1 2019/08/18 16:05:12 nia Exp $
+$NetBSD: patch-tests_os-wrappers-test.c,v 1.2 2019/08/29 12:22:13 nia Exp $
 
 BSD support from FreeBSD
 
@@ -15,46 +15,49 @@
  #include <stdlib.h>
  #include <stdint.h>
  #include <assert.h>
-@@ -38,7 +40,12 @@
+@@ -38,7 +40,13 @@
  #include <stdarg.h>
  #include <fcntl.h>
  #include <stdio.h>
 +
 +#ifdef HAVE_SYS_EPOLL_H
  #include <sys/epoll.h>
-+#elif defined(HAVE_SYS_EVENT_H)
++#endif
++#ifdef HAVE_SYS_EVENT_H
 +#include <sys/event.h>
 +#endif
  
  #include "wayland-private.h"
  #include "test-runner.h"
-@@ -55,8 +62,13 @@ static int wrapped_calls_fcntl;
+@@ -55,8 +63,14 @@ static int wrapped_calls_fcntl;
  static ssize_t (*real_recvmsg)(int, struct msghdr *, int);
  static int wrapped_calls_recvmsg;
  
 +#ifdef HAVE_SYS_EPOLL_H
  static int (*real_epoll_create1)(int);
  static int wrapped_calls_epoll_create1;
-+#elif defined(HAVE_SYS_EVENT_H)
++#endif
++#ifdef HAVE_SYS_EVENT_H
 +static int (*real_kqueue)(void);
 +static int wrapped_calls_kqueue;
 +#endif
  
  static void
  init_fallbacks(int do_fallbacks)
-@@ -65,7 +77,11 @@ init_fallbacks(int do_fallbacks)
+@@ -65,7 +79,12 @@ init_fallbacks(int do_fallbacks)
        real_socket = dlsym(RTLD_NEXT, "socket");
        real_fcntl = dlsym(RTLD_NEXT, "fcntl");
        real_recvmsg = dlsym(RTLD_NEXT, "recvmsg");
 +#ifdef HAVE_SYS_EPOLL_H
        real_epoll_create1 = dlsym(RTLD_NEXT, "epoll_create1");
-+#elif defined(HAVE_SYS_EVENT_H)
++#endif
++#ifdef HAVE_SYS_EVENT_H
 +      real_kqueue = dlsym(RTLD_NEXT, "kqueue");
 +#endif
  }
  
  __attribute__ ((visibility("default"))) int
-@@ -73,10 +89,12 @@ socket(int domain, int type, int protoco
+@@ -73,10 +92,12 @@ socket(int domain, int type, int protoco
  {
        wrapped_calls_socket++;
  
@@ -67,7 +70,7 @@
  
        return real_socket(domain, type, protocol);
  }
-@@ -89,10 +107,12 @@ fcntl(int fd, int cmd, ...)
+@@ -89,10 +110,12 @@ fcntl(int fd, int cmd, ...)
  
        wrapped_calls_fcntl++;
  
@@ -80,7 +83,7 @@
  
        va_start(ap, cmd);
        arg = va_arg(ap, void*);
-@@ -106,14 +126,17 @@ recvmsg(int sockfd, struct msghdr *msg, 
+@@ -106,14 +129,17 @@ recvmsg(int sockfd, struct msghdr *msg, 
  {
        wrapped_calls_recvmsg++;
  
@@ -98,11 +101,13 @@
  __attribute__ ((visibility("default"))) int
  epoll_create1(int flags)
  {
-@@ -127,6 +150,21 @@ epoll_create1(int flags)
+@@ -127,6 +153,23 @@ epoll_create1(int flags)
  
        return real_epoll_create1(flags);
  }
-+#elif defined(HAVE_SYS_EVENT_H)
++#endif
++
++#ifdef HAVE_SYS_EVENT_H
 +__attribute__ ((visibility("default"))) int
 +kqueue(void)
 +{
@@ -120,7 +125,7 @@
  
  static void
  do_os_wrappers_socket_cloexec(int n)
-@@ -156,12 +194,14 @@ TEST(os_wrappers_socket_cloexec)
+@@ -156,12 +199,14 @@ TEST(os_wrappers_socket_cloexec)
        do_os_wrappers_socket_cloexec(0);
  }
  
@@ -135,7 +140,7 @@
  
  static void
  do_os_wrappers_dupfd_cloexec(int n)
-@@ -195,11 +235,13 @@ TEST(os_wrappers_dupfd_cloexec)
+@@ -195,11 +240,13 @@ TEST(os_wrappers_dupfd_cloexec)
        do_os_wrappers_dupfd_cloexec(0);
  }
  
@@ -149,7 +154,7 @@
  
  struct marshal_data {
        struct wl_connection *read_connection;
-@@ -218,8 +260,7 @@ struct marshal_data {
+@@ -218,8 +265,7 @@ struct marshal_data {
  static void
  setup_marshal_data(struct marshal_data *data)
  {
@@ -159,7 +164,7 @@
  
        data->read_connection = wl_connection_create(data->s[0]);
        assert(data->read_connection);
-@@ -328,21 +369,23 @@ TEST(os_wrappers_recvmsg_cloexec)
+@@ -328,12 +374,15 @@ TEST(os_wrappers_recvmsg_cloexec)
        do_os_wrappers_recvmsg_cloexec(0);
  }
  
@@ -171,33 +176,42 @@
  }
 +#endif
  
++#ifdef HAVE_SYS_EPOLL_H
  static void
--do_os_wrappers_epoll_create_cloexec(int n)
-+do_os_wrappers_queue_create_cloexec(int n)
+ do_os_wrappers_epoll_create_cloexec(int n)
  {
-       int fd;
-       int nr_fds;
- 
-       nr_fds = count_open_fds();
- 
--      fd = wl_os_epoll_create_cloexec();
+@@ -365,5 +414,34 @@ TEST(os_wrappers_epoll_create_cloexec_fa
+       init_fallbacks(1);
+       do_os_wrappers_epoll_create_cloexec(2);
+ }
++#endif
++
++#ifdef HAVE_SYS_EVENT_H
++static void
++do_os_wrappers_queue_create_cloexec(int n)
++{
++      int fd;
++      int nr_fds;
++
++      nr_fds = count_open_fds();
++
 +      fd = wl_os_queue_create_cloexec();
-       assert(fd >= 0);
- 
- #ifdef EPOLL_CLOEXEC
-@@ -357,13 +400,13 @@ do_os_wrappers_epoll_create_cloexec(int 
- TEST(os_wrappers_epoll_create_cloexec)
- {
-       init_fallbacks(0);
--      do_os_wrappers_epoll_create_cloexec(1);
++      assert(fd >= 0);
++
++      exec_fd_leak_check(nr_fds);
++}
++
++TEST(os_wrappers_queue_create_cloexec)
++{
++      init_fallbacks(0);
 +      do_os_wrappers_queue_create_cloexec(1);
- }
- 
- TEST(os_wrappers_epoll_create_cloexec_fallback)
- {
-       init_fallbacks(1);
--      do_os_wrappers_epoll_create_cloexec(2);
++}
++
++TEST(os_wrappers_queue_create_cloexec_fallback)
++{
++      init_fallbacks(1);
 +      do_os_wrappers_queue_create_cloexec(2);
- }
++}
++#endif
  
  /* FIXME: add tests for wl_os_accept_cloexec() */



Home | Main Index | Thread Index | Old Index