Bug 139110 - Fails to build on NetBSD (missing MSG_NOSIGNAL)
Summary: Fails to build on NetBSD (missing MSG_NOSIGNAL)
Status: RESOLVED FIXED
Alias: None
Product: ktorrent
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: NetBSD pkgsrc NetBSD
: NOR normal
Target Milestone: ---
Assignee: Joris Guisson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-12-21 21:00 UTC by shattered
Modified: 2008-01-10 19:52 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description shattered 2006-12-21 21:00:22 UTC
Version:           2.1beta1 (using KDE KDE 3.5.4)
Installed from:    NetBSD pkgsrc
Compiler:          gcc version 3.3.3 (NetBSD nb3 20040520) 
OS:                NetBSD

NetBSD doesn't support MSG_NOSIGNAL; maybe it's not needed at all? (since SIGPIPE is ignored anyway)

--- libktorrent/net/socket.cpp.orig	2006-12-16 11:58:10.000000000 +0000
+++ libktorrent/net/socket.cpp
@@ -160,7 +160,11 @@ namespace net
 	
 	int Socket::send(const bt::Uint8* buf,int len)
 	{
+#ifdef MSG_NOSIGNAL
 		int ret = ::send(m_fd,buf,len,MSG_NOSIGNAL);
+#else
+		int ret = ::send(m_fd,buf,len,0);
+#endif
 		if (ret < 0)
 		{
 			if (errno != EAGAIN && errno != EWOULDBLOCK)
Comment 1 Joris Guisson 2006-12-22 12:36:48 UTC
Do you know if NetBSD supports SO_NOSIGPIPE as a socket option ? So that we can just add NetBSD to the following if statements :

#if defined(Q_OS_MACX) || defined(Q_OS_DARWIN) || (defined(Q_OS_FREEBSD) && __FreeBSD_version < 600020) || defined (Q_OS_SOLARIS)
#define MSG_NOSIGNAL 0
#endif


#if defined(Q_OS_MACX) || defined(Q_OS_DARWIN) || (defined(Q_OS_FREEBSD) && __FreeBSD_version < 600020)
		int val = 1;
		if (setsockopt(m_fd,SOL_SOCKET,SO_NOSIGPIPE,&val,sizeof(int)) < 0)
		{
			Out(SYS_CON|LOG_NOTICE) << QString("Failed to set the NOSIGPIPE option : %1").arg(strerror(errno)) << endl;
		}
#endif	
Comment 2 shattered 2006-12-23 09:43:49 UTC
Nope, no SO_NOSIGPIPE either...
Comment 3 Joris Guisson 2006-12-23 16:21:59 UTC
SVN commit 616060 by guisson:

NetBSD does not have MSG_NOSIGNAL, so just define it as 0

BUG: 139110



 M  +1 -1      socket.cpp  


--- trunk/extragear/network/ktorrent/libktorrent/net/socket.cpp #616059:616060
@@ -38,7 +38,7 @@
 #include <sys/filio.h>
 #endif
 
-#if defined(Q_OS_MACX) || defined(Q_OS_DARWIN) || (defined(Q_OS_FREEBSD) && __FreeBSD_version < 600020) || defined (Q_OS_SOLARIS)
+#if defined(Q_OS_MACX) || defined(Q_OS_DARWIN) || (defined(Q_OS_FREEBSD) && __FreeBSD_version < 600020) || defined (Q_OS_SOLARIS) || defined(Q_OS_NETBSD) 
 #define MSG_NOSIGNAL 0
 #endif
 
Comment 4 shattered 2008-01-08 18:57:52 UTC
The patch in pkgsrc uses "#ifdef MSG_NOSIGNAL" instead, see http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/net/ktorrent/patches/patch-aa
Comment 5 Joris Guisson 2008-01-10 19:52:33 UTC
SVN commit 759489 by guisson:

Fix socket.cpp for Dragonfly BSD

BUG: 139081
BUG: 139110



 M  +3 -3      socket.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=759489