SF Patch Tracker [ 2836704 ] Patch for Solaris10 compilation and usage.
Submitted By: zephyrus ( zephyrus00jp ) Obs by Marcelo: The issue with linking with -lsocket -lnsl -lrt is not covered in this changeset beacuse I don't have solaris to test. I will need some help from zephyrus in this regard. The issue will be addressed in a future changeset. Compilation for solaris I have used gcc3.x and gcc4.x under solaris 10 for x86 / 64 bits. A couple of Source file fixes were necessary for successful compilation and runtime behavior. threadutil/src/ThreadPool.c POSIX sched_setschduler() returns non-negative value for success. Without the fix, UpnpInit() fails immediately. upnpp/src/api/upnpai.c There is a typo of a macro name "__sun" in one of the CPP conditional. Without the fix, the compilation aborts due to unknown constant in socket ioctl call. A few structs and an array is not properly initialized. Well, I think it may be safe as is, but when I checked it using purify evaluation version, it was reported that uninitizlied iszBuffer may cause read of uninitialized memory. So play it safe. Configure issue. This has to be more of a configure magic. To link a program successfully using network, we need -lsocket and -lnsl library specifications on the link line. We also need -lrt for programs that use thread scheduling features. The sample program under upnp/sample requires -lsocket -lnsl -lrt for successful linking. I added -lsocket -lnsl -lrt to Makefile.in. configure probably needs to take care of these. I don't know much about configure, automake, etc., so I am just raising a flag here. TIA git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.6.x@505 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
parent
25c908c558
commit
9226dd833b
52
ChangeLog
52
ChangeLog
@ -2,6 +2,58 @@
|
||||
Version 1.6.7
|
||||
*******************************************************************************
|
||||
|
||||
2010-03-21 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* SF Patch Tracker [ 2836704 ] Patch for Solaris10 compilation and usage.
|
||||
Submitted By: zephyrus ( zephyrus00jp )
|
||||
Obs by Marcelo: The issue with linking with -lsocket -lnsl -lrt is not
|
||||
covered in this changeset beacuse I don't have solaris to test. I will
|
||||
need some help from zephyrus in this regard. The issue will be addressed
|
||||
in a future changeset.
|
||||
|
||||
Compilation for solaris
|
||||
|
||||
I have used gcc3.x and gcc4.x under solaris 10 for x86 / 64 bits.
|
||||
|
||||
A couple of Source file fixes were necessary for successful compilation
|
||||
and runtime behavior.
|
||||
|
||||
threadutil/src/ThreadPool.c
|
||||
|
||||
POSIX
|
||||
sched_setschduler() returns non-negative value for success.
|
||||
|
||||
Without the fix, UpnpInit() fails immediately.
|
||||
|
||||
upnpp/src/api/upnpai.c
|
||||
|
||||
There is a typo of a macro name "__sun" in one of the
|
||||
CPP conditional.
|
||||
Without the fix, the compilation aborts due to unknown constant
|
||||
in socket ioctl call.
|
||||
|
||||
A few structs and an array is not properly initialized.
|
||||
Well, I think it may be safe as is, but when I checked it
|
||||
using purify evaluation version, it was reported that
|
||||
uninitizlied iszBuffer may cause read of uninitialized memory.
|
||||
So play it safe.
|
||||
|
||||
Configure issue.
|
||||
This has to be more of a configure magic.
|
||||
To link a program successfully using network, we need
|
||||
-lsocket and -lnsl library specifications on the link line.
|
||||
We also need -lrt for programs that use thread scheduling features.
|
||||
|
||||
The sample program under upnp/sample requires
|
||||
-lsocket -lnsl -lrt
|
||||
for successful linking.
|
||||
I added -lsocket -lnsl -lrt to Makefile.in.
|
||||
configure probably needs to take care of these.
|
||||
|
||||
I don't know much about configure, automake, etc., so
|
||||
I am just raising a flag here.
|
||||
|
||||
TIA
|
||||
|
||||
2010-03-20 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||
* SF Patch Tracker [ 2836704 ] Search for nested serviceList (not
|
||||
stopping at the first lis
|
||||
|
@ -1,40 +1,40 @@
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (c) 2000-2003 Intel Corporation
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
// * Neither name of Intel Corporation nor the names of its contributors
|
||||
// may be used to endorse or promote products derived from this software
|
||||
// without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
/*******************************************************************************
|
||||
*
|
||||
* Copyright (c) 2000-2003 Intel Corporation
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* - Neither name of Intel Corporation nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#include "ThreadPool.h"
|
||||
#include "FreeList.h"
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h> /* for memset()*/
|
||||
|
||||
/****************************************************************************
|
||||
* Function: DiffMillis
|
||||
@ -193,7 +193,7 @@ static int CmpThreadPoolJob( void *jobA, void *jobB )
|
||||
assert(jobA != NULL);
|
||||
assert(jobB != NULL);
|
||||
|
||||
return ( a->jobId == b->jobId );
|
||||
return a->jobId == b->jobId;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -236,10 +236,20 @@ static int SetPolicyType( PolicyType in )
|
||||
return sched_setscheduler(0, in);
|
||||
#elif defined(_POSIX_PRIORITY_SCHEDULING) && _POSIX_PRIORITY_SCHEDULING > 0
|
||||
struct sched_param current;
|
||||
int rc;
|
||||
|
||||
memset(¤t, 0, sizeof(current)); /* purify? */
|
||||
sched_getparam(0, ¤t);
|
||||
current.sched_priority = DEFAULT_SCHED_PARAM;
|
||||
return sched_setscheduler( 0, in, ¤t );
|
||||
|
||||
/* Solaris returns -1 if failure ..., but can return
|
||||
* non-zero values for 0, ..., 5 [former scheduling values.] */
|
||||
rc = sched_setscheduler(0, in, ¤t);
|
||||
if (rc == -1) {
|
||||
return rc;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
@ -317,14 +327,13 @@ static void BumpPriority( ThreadPool *tp )
|
||||
assert(tp != NULL);
|
||||
|
||||
gettimeofday(&now, NULL);
|
||||
|
||||
while (!done) {
|
||||
if (tp->medJobQ.size) {
|
||||
tempJob = (ThreadPoolJob *)tp->medJobQ.head.next->item;
|
||||
diffTime = DiffMillis(&now, &tempJob->requestTime);
|
||||
if( diffTime >= ( tp->attr.starvationTime ) ) {
|
||||
// If job has waited longer than the starvation time
|
||||
// bump priority (add to higher priority Q)
|
||||
if (diffTime >= tp->attr.starvationTime) {
|
||||
/* If job has waited longer than the starvation time
|
||||
* bump priority (add to higher priority Q) */
|
||||
StatsAccountMQ(tp, diffTime);
|
||||
ListDelNode(&tp->medJobQ, tp->medJobQ.head.next, 0);
|
||||
ListAddTail(&tp->highJobQ, tempJob);
|
||||
@ -334,9 +343,9 @@ static void BumpPriority( ThreadPool *tp )
|
||||
if (tp->lowJobQ.size) {
|
||||
tempJob = (ThreadPoolJob *)tp->lowJobQ.head.next->item;
|
||||
diffTime = DiffMillis(&now, &tempJob->requestTime);
|
||||
if( diffTime >= ( tp->attr.maxIdleTime ) ) {
|
||||
// If job has waited longer than the starvation time
|
||||
// bump priority (add to higher priority Q)
|
||||
if (diffTime >= tp->attr.maxIdleTime) {
|
||||
/* If job has waited longer than the starvation time
|
||||
* bump priority (add to higher priority Q) */
|
||||
StatsAccountLQ(tp, diffTime);
|
||||
ListDelNode(&tp->lowJobQ, tp->lowJobQ.head.next, 0);
|
||||
ListAddTail(&tp->medJobQ, tempJob);
|
||||
|
@ -56,7 +56,7 @@
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
#if defined(_sun)
|
||||
#if defined(__sun)
|
||||
#include <sys/sockio.h>
|
||||
#include <fcntl.h>
|
||||
#elif defined(BSD) && BSD >= 199306
|
||||
@ -3594,6 +3594,11 @@ void printNodes( IXML_Node * tmpRoot, int depth )
|
||||
struct sockaddr_in LocalAddr;
|
||||
int j = 0;
|
||||
|
||||
/* purify */
|
||||
memset(&ifConf, 0, sizeof(ifConf));
|
||||
memset(&ifReq, 0, sizeof(ifReq));
|
||||
memset(szBuffer, 0, sizeof(szBuffer));
|
||||
|
||||
// Create an unbound datagram socket to do the SIOCGIFADDR ioctl on.
|
||||
if( ( LocalSock = socket( AF_INET, SOCK_DGRAM, IPPROTO_UDP ) ) < 0 ) {
|
||||
UpnpPrintf( UPNP_ALL, API, __FILE__, __LINE__,
|
||||
|
Loading…
Reference in New Issue
Block a user