* [pupnp-devel] NetBSD & Mac OS X packages and patches.

Rene Hexel's <rh@netbsd.org> patch to compile in NetBSD and Mac OS X.


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@205 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
Marcelo Roberto Jimenez 2007-06-09 13:40:22 +00:00
parent 114389589d
commit 5151d45203
11 changed files with 86 additions and 25 deletions

View File

@ -2,6 +2,10 @@
Version 1.6.0
*******************************************************************************
2007-06-09 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* [pupnp-devel] NetBSD & Mac OS X packages and patches.
Rene Hexel's <rh@netbsd.org> patch to compile in NetBSD and Mac OS X.
2007-05-26 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* Updated the macro files acx_pthread.m4, ax_cflags_gcc_option.m4,
ax_cflags_warn_all.m4, m4/ax_cflags_warn_all_ansi.m4,

1
THANKS
View File

@ -29,6 +29,7 @@ exempt of errors.
- Oskar Liljeblad
- Michael (Oxy)
- Paul Vixie
- Rene Hexel
- Siva Chandran
- Timothy Redaelli
- Titus Winters

View File

@ -354,18 +354,25 @@ tp->stats.totalJobsLQ++; tp->stats.totalTimeLQ += diff; break; default:
* Parameters:
*
*****************************************************************************/
static void SetSeed() {
struct timeb t;
static void SetSeed() {
struct timeb t;
ftime( &t );
ftime( &t );
#if defined(WIN32)
srand( ( unsigned int )t.millitm + (unsigned int)ithread_get_current_thread_id().p );
srand( ( unsigned int )t.millitm + (unsigned int)ithread_get_current_thread_id().p );
#elif defined(__FreeBSD__)
srand( ( unsigned int )t.millitm + (unsigned int)ithread_get_current_thread_id() );
srand( ( unsigned int )t.millitm + (unsigned int)ithread_get_current_thread_id() );
#elif defined(__linux__)
srand( ( unsigned int )t.millitm + ithread_get_current_thread_id() );
#else
srand( ( unsigned int )t.millitm + ithread_get_current_thread_id() );
{
volatile union { volatile pthread_t tid; volatile unsigned i; } idu;
idu.tid = ithread_get_current_thread_id();
srand( ( unsigned int )t.millitm + idu.i );
}
#endif
}
}
/****************************************************************************
* Function: WorkerThread

View File

@ -47,7 +47,8 @@
#include <stdio.h>
#ifdef __FreeBSD__
#include <sys/param.h>
#if (defined(BSD) && BSD >= 199306)
#include <time.h>
#endif
#include "ixml.h"

View File

@ -246,11 +246,15 @@ static UPNP_INLINE int DebugAtThisLevel(
* Returns: void
***************************************************************************/
#ifdef DEBUG
void UpnpPrintf (Upnp_LogLevel DLevel, Dbg_Module Module,
const char* DbgFileName, int DbgLineNo,
const char* FmtStr,
...)
void UpnpPrintf(
Upnp_LogLevel DLevel,
Dbg_Module Module,
const char* DbgFileName,
int DbgLineNo,
const char* FmtStr,
...)
#if (__GNUC__ >= 3)
/* This enables printf like format checking by the compiler */
__attribute__((format (__printf__, 5, 6)))
#endif
;

View File

@ -73,6 +73,8 @@
#include "urlconfig.h"
#endif // INTERNAL_WEB_SERVER
virtualDirList *pVirtualDirList;
// Mutex to synchronize the subscription handling at the client side
CLIENTONLY( ithread_mutex_t GlobalClientSubscribeMutex; )
@ -3287,17 +3289,15 @@ UpnpDownloadXmlDoc( const char *url,
} else {
#ifdef DEBUG
xml_buf = ixmlPrintNode( ( IXML_Node * ) * xmlDoc );
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
"Printing the Parsed xml document \n %s\n",
xml_buf );
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
"****************** END OF Parsed XML Doc *****************\n" );
ixmlFreeDOMString( xml_buf );
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
"Exiting UpnpDownloadXmlDoc\n" );
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
"Printing the Parsed xml document \n %s\n", xml_buf );
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
"****************** END OF Parsed XML Doc *****************\n" );
ixmlFreeDOMString( xml_buf );
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
"Exiting UpnpDownloadXmlDoc\n" );
#endif
return UPNP_E_SUCCESS;
return UPNP_E_SUCCESS;
}
}

View File

@ -173,7 +173,7 @@ int DebugAtThisLevel(
IN Upnp_LogLevel DLevel,
IN Dbg_Module Module)
{
int ret = g_log_level >= DLevel;
int ret = DLevel <= g_log_level;
ret &=
DEBUG_ALL ||
(Module == SSDP && DEBUG_SSDP ) ||

View File

@ -231,6 +231,15 @@ sock_read_write( IN SOCKINFO * info,
}
}
#ifdef SO_NOSIGPIPE
{
int old;
int set = 1;
socklen_t olen = sizeof(old);
getsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, &old, &olen);
setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, &set, sizeof(set));
#endif
if( bRead ) {
// read data
numBytes = recv( sockfd, buffer, bufsize,MSG_NOSIGNAL);
@ -243,6 +252,9 @@ sock_read_write( IN SOCKINFO * info,
send( sockfd, buffer + bytes_sent, byte_left,
MSG_DONTROUTE|MSG_NOSIGNAL);
if( num_written == -1 ) {
#ifdef SO_NOSIGPIPE
setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, &old, olen);
#endif
return num_written;
}
@ -253,6 +265,11 @@ sock_read_write( IN SOCKINFO * info,
numBytes = bytes_sent;
}
#ifdef SO_NOSIGPIPE
setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, &old, olen);
}
#endif
if( numBytes < 0 ) {
return UPNP_E_SOCKET_ERROR;
}

View File

@ -640,11 +640,38 @@ parse_hostport( const char *in,
if ( h == NULL ) {
errCode = 1;
}
#else
#elif defined(__linux__)
errCode = gethostbyname_r( temp_host_name,
&h_buf,
temp_hostbyname_buff,
BUFFER_SIZE, &h, &errcode );
#else
{
struct addrinfo hints, *res, *res0;
h = NULL;
memset(&hints, 0, sizeof(hints));
hints.ai_family = PF_INET;
hints.ai_socktype = SOCK_STREAM;
errCode = getaddrinfo(temp_host_name, "http", &hints, &res0);
if (!errCode) {
for (res = res0; res; res = res->ai_next) {
if (res->ai_family == PF_INET &&
res->ai_addr->sa_family == AF_INET)
{
h = &h_buf;
h->h_addrtype = res->ai_addr->sa_family;
h->h_length = 4;
h->h_addr = (void *) temp_hostbyname_buff;
*(struct in_addr *)h->h_addr =
((struct sockaddr_in *)res->ai_addr)->sin_addr;
break;
}
}
freeaddrinfo(res0);
}
}
#endif
if( errCode == 0 ) {

View File

@ -176,7 +176,6 @@ void UpnpThreadDistribution(struct UpnpNonblockParam * Param);
void AutoAdvertise(void *input);
int getlocalhostname(char *out);
virtualDirList *pVirtualDirList;
extern WebServerState bWebServerState;
#endif

View File

@ -32,6 +32,7 @@
#include "config.h"
#include <assert.h>
#ifndef WIN32
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>