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

Re: Bug#815495: zeromq3: FTBFS on kFreeBSD: 'xucred cred' has incomplete type



tags 815495 + patch
user debian-bsd@lists.debian.org
usertags 815495 + kfreebsd
thanks

Hello,

Aaron M. Ucko wrote:
> Builds of zeromq3 for kFreeBSD are now failing with
> 
>   src/ipc_listener.cpp: In member function 'bool zmq::ipc_listener_t::filter(zmq::fd_t)':
>   src/ipc_listener.cpp:263:19: error: aggregate 'zmq::ipc_listener_t::filter(zmq::fd_t)::xucred cred' has incomplete type and cannot be defined
>        struct xucred cred;
>                      ^
>   src/ipc_listener.cpp:268:28: error: 'XUCRED_VERSION' was not declared in this scope
>        if (cred.cr_version != XUCRED_VERSION)
>                               ^

It was just a missing #include.  Please find patch attached
(sys_ucred_h.patch).

There were some other issues on kfreebsd at run-time:

| FAIL: test_system
| =================
| 
| Function not implemented (src/thread.cpp:135)
| FAIL test_system (exit status: 134)

most tests were failing that way.  GNU/kFreeBSD doesn't implement
pthread_setschedparam yet, so I think we should gracefully ignore ENOSYS
instead of aborting.

With that fixed, another error was.

| FAIL: test_shutdown_stress
| ==========================
| 
| Connection reset by peer (src/stream_engine.cpp:162)
| FAIL test_shutdown_stress (exit status: 134)

The other patch (kfreebsd-support.patch) fixes all these things, and all
tests pass for me now on kfreebsd-amd64.

Thanks!
Regards,
-- 
Steven Chamberlain
steven@pyro.eu.org
Subject: include sys/ucred.h for struct ucred
From: Steven Chamberlain <steven@pyro.eu.org>
Date: Mon, 22 Feb 2016 02:21:34 +0000

The OSes that have struct ucred, typically declare it in sys/ucred.h

--- a/src/ipc_listener.cpp
+++ b/src/ipc_listener.cpp
@@ -51,6 +51,7 @@
 
 #if defined ZMQ_HAVE_SO_PEERCRED || defined ZMQ_HAVE_LOCAL_PEERCRED
 #   include <sys/types.h>
+#   include <sys/ucred.h>
 #endif
 #ifdef ZMQ_HAVE_SO_PEERCRED
 #   include <pwd.h>
--- a/src/stream_engine.cpp
+++ b/src/stream_engine.cpp
@@ -38,6 +38,11 @@
 #include <netinet/in.h>
 #include <netdb.h>
 #include <fcntl.h>
+
+#if defined ZMQ_HAVE_SO_PEERCRED || defined ZMQ_HAVE_LOCAL_PEERCRED
+#   include <sys/types.h>
+#   include <sys/ucred.h>
+#endif
 #if defined ZMQ_HAVE_OPENBSD
 #define ucred sockpeercred
 #endif
Subject: add support for GNU/kFreeBSD
From: Steven Chamberlain <steven@pyro.eu.org>
Date: Mon, 22 Feb 2016 02:21:34 +0000

The FreeBSD kernel may return ECONNRESET on close() under load but this
is not an error.

Debian GNU/kFreeBSD doesn't currently implement pthread_setschedparam,
so don't abort if it returns ENOSYS.

--- a/src/stream_engine.cpp
+++ b/src/stream_engine.cpp
@@ -159,6 +159,12 @@
         wsa_assert (rc != SOCKET_ERROR);
 #else
         int rc = close (s);
+#ifdef __FreeBSD_kernel__
+        // FreeBSD may return ECONNRESET on close() under load but this is not
+        // an error.
+        if (rc == -1 && errno == ECONNRESET)
+            rc = 0;
+#endif
         errno_assert (rc == 0);
 #endif
         s = retired_fd;
--- a/src/thread.cpp
+++ b/src/thread.cpp
@@ -132,6 +132,10 @@
     }
 
     rc = pthread_setschedparam(descriptor, policy, &param);
+
+    // If this feature is unavailable at run-time, don't abort.
+    if(rc == ENOSYS) return;
+
     posix_assert (rc);
 #endif
 }

Attachment: signature.asc
Description: Digital signature


Reply to: