* [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 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> 2007-05-26 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* Updated the macro files acx_pthread.m4, ax_cflags_gcc_option.m4, * Updated the macro files acx_pthread.m4, ax_cflags_gcc_option.m4,
ax_cflags_warn_all.m4, m4/ax_cflags_warn_all_ansi.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 - Oskar Liljeblad
- Michael (Oxy) - Michael (Oxy)
- Paul Vixie - Paul Vixie
- Rene Hexel
- Siva Chandran - Siva Chandran
- Timothy Redaelli - Timothy Redaelli
- Titus Winters - Titus Winters

View File

@ -354,18 +354,25 @@ tp->stats.totalJobsLQ++; tp->stats.totalTimeLQ += diff; break; default:
* Parameters: * Parameters:
* *
*****************************************************************************/ *****************************************************************************/
static void SetSeed() { static void SetSeed() {
struct timeb t; struct timeb t;
ftime( &t ); ftime( &t );
#if defined(WIN32) #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__) #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 #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 #endif
} }
/**************************************************************************** /****************************************************************************
* Function: WorkerThread * Function: WorkerThread

View File

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

View File

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

View File

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

View File

@ -173,7 +173,7 @@ int DebugAtThisLevel(
IN Upnp_LogLevel DLevel, IN Upnp_LogLevel DLevel,
IN Dbg_Module Module) IN Dbg_Module Module)
{ {
int ret = g_log_level >= DLevel; int ret = DLevel <= g_log_level;
ret &= ret &=
DEBUG_ALL || DEBUG_ALL ||
(Module == SSDP && DEBUG_SSDP ) || (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 ) { if( bRead ) {
// read data // read data
numBytes = recv( sockfd, buffer, bufsize,MSG_NOSIGNAL); numBytes = recv( sockfd, buffer, bufsize,MSG_NOSIGNAL);
@ -243,6 +252,9 @@ sock_read_write( IN SOCKINFO * info,
send( sockfd, buffer + bytes_sent, byte_left, send( sockfd, buffer + bytes_sent, byte_left,
MSG_DONTROUTE|MSG_NOSIGNAL); MSG_DONTROUTE|MSG_NOSIGNAL);
if( num_written == -1 ) { if( num_written == -1 ) {
#ifdef SO_NOSIGPIPE
setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, &old, olen);
#endif
return num_written; return num_written;
} }
@ -253,6 +265,11 @@ sock_read_write( IN SOCKINFO * info,
numBytes = bytes_sent; numBytes = bytes_sent;
} }
#ifdef SO_NOSIGPIPE
setsockopt(sockfd, SOL_SOCKET, SO_NOSIGPIPE, &old, olen);
}
#endif
if( numBytes < 0 ) { if( numBytes < 0 ) {
return UPNP_E_SOCKET_ERROR; return UPNP_E_SOCKET_ERROR;
} }

View File

@ -640,11 +640,38 @@ parse_hostport( const char *in,
if ( h == NULL ) { if ( h == NULL ) {
errCode = 1; errCode = 1;
} }
#else #elif defined(__linux__)
errCode = gethostbyname_r( temp_host_name, errCode = gethostbyname_r( temp_host_name,
&h_buf, &h_buf,
temp_hostbyname_buff, temp_hostbyname_buff,
BUFFER_SIZE, &h, &errcode ); 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 #endif
if( errCode == 0 ) { if( errCode == 0 ) {

View File

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

View File

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