Patch for FreeBSD, thanks to Markus Strobl.

git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@28 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
Marcelo Roberto Jimenez 2006-07-03 14:02:29 +00:00
parent cf9ae4f6e5
commit 90c3db2a96
7 changed files with 64 additions and 18 deletions

View File

@ -1,3 +1,7 @@
2006-07-03 Marcelo Jimenez <mroberto@users.sourceforge.net>
* Patch for FreeBSD, thanks to Markus Strobl.
2006-06-26 Marcelo Jimenez <mroberto@users.sourceforge.net>
* Fix for missing "else" in httpreadwrite.c. Thanks to npapadop

View File

@ -30,7 +30,11 @@
///////////////////////////////////////////////////////////////////////////
#include "LinkedList.h"
#ifdef __FreeBSD__
#include <stdlib.h>
#else
#include <malloc.h>
#endif
#include <assert.h>
static int

View File

@ -345,10 +345,12 @@ tp->stats.totalJobsLQ++; tp->stats.totalTimeLQ += diff; break; default:
struct timeb t;
ftime( &t );
#ifndef WIN32
srand( ( unsigned int )t.millitm + ithread_get_current_thread_id( ) );
#else
#if defined(WIN32)
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( ) );
#else
srand( ( unsigned int )t.millitm + ithread_get_current_thread_id( ) );
#endif
}
@ -1463,7 +1465,11 @@ tp->stats.totalJobsLQ++; tp->stats.totalTimeLQ += diff; break; default:
assert( stats != NULL ); if( stats == NULL ) {
return;}
#ifdef __FreeBSD__
printf( "ThreadPoolStats at Time: %d\n", time( NULL ) );
#else
printf( "ThreadPoolStats at Time: %ld\n", time( NULL ) );
#endif
printf
( "Average Wait in High Priority Q in milliseconds: %lf\n",
stats->avgWaitHQ );

View File

@ -31,7 +31,11 @@
#include <stdarg.h>
#include <assert.h>
#ifdef __FreeBSD__
#include <stdlib.h>
#else
#include <malloc.h>
#endif
#include <stdio.h>
#include "iasnprintf.h"

View File

@ -37,6 +37,9 @@
//@{
#include <stdio.h>
#ifdef __FreeBSD__
#include <time.h>
#endif
#include "ixml.h"
#include "upnpconfig.h"
#if UPNP_HAVE_DEBUG

View File

@ -33,6 +33,9 @@
* Purpose: This file contains functions for uri, url parsing utility.
************************************************************************/
#ifdef __FreeBSD__
#include <lwres/netdb.h>
#endif
#include "config.h"
#include "uri.h"
@ -608,20 +611,26 @@ parse_hostport( char *in,
int errCode = 0;
//call gethostbyname_r (reentrant form of gethostbyname)
#ifdef WIN32
#if defined(WIN32)
h=gethostbyname(temp_host_name);
#else
#ifndef SPARC_SOLARIS
errCode = gethostbyname_r( temp_host_name,
&h_buf,
temp_hostbyname_buff,
BUFFER_SIZE, &h, &errcode );
#else
#elif defined(SPARC_SOLARIS)
errCode = gethostbyname_r( temp_host_name,
&h,
temp_hostbyname_buff,
BUFFER_SIZE, &errcode );
#endif
#elif defined(__FreeBSD__)
h = lwres_gethostbyname_r( temp_host_name,
&h_buf,
temp_hostbyname_buff,
BUFFER_SIZE, &errcode );
if ( h == NULL ) {
errCode = 1;
}
#else
errCode = gethostbyname_r( temp_host_name,
&h_buf,
temp_hostbyname_buff,
BUFFER_SIZE, &h, &errcode );
#endif
if( errCode == 0 ) {

View File

@ -961,6 +961,22 @@ get_ssdp_sockets( MiniServerSockArray * out )
return UPNP_E_SOCKET_ERROR;
}
#ifdef __FreeBSD__
if( setsockopt( ssdpSock, SOL_SOCKET, SO_REUSEPORT,
( char * )&onOff, sizeof( onOff ) ) != 0 ) {
DBGONLY( UpnpPrintf( UPNP_CRITICAL,
SSDP, __FILE__, __LINE__,
"Error in set reuse port !!!\n" );
)
CLIENTONLY( shutdown( ssdpReqSock, SD_BOTH ) );
CLIENTONLY( UpnpCloseSocket( ssdpReqSock ) );
shutdown( ssdpSock, SD_BOTH );
UpnpCloseSocket( ssdpSock );
return UPNP_E_SOCKET_ERROR;
}
#endif
memset( ( void * )&ssdpAddr, 0, sizeof( struct sockaddr_in ) );
ssdpAddr.sin_family = AF_INET;
// ssdpAddr.sin_addr.s_addr = inet_addr(LOCAL_HOST);