diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2010-04-23 11:43:00 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2010-04-23 11:43:00 +0100 |
commit | c4b0f6bcae4761cc7c41a2b07043a1bec00ad6e6 (patch) | |
tree | 48d9110b63e34c59c1648df3ff8a7049327bc487 | |
parent | 236c96ffb124074d6efe3382b4d1b77da9a2986a (diff) | |
parent | 3a12d05433153d5c7c84f85af6b5039fbcdd1d09 (diff) | |
download | rsyslog-c4b0f6bcae4761cc7c41a2b07043a1bec00ad6e6.tar.gz rsyslog-c4b0f6bcae4761cc7c41a2b07043a1bec00ad6e6.tar.xz rsyslog-c4b0f6bcae4761cc7c41a2b07043a1bec00ad6e6.zip |
Merge branch 'v4-devel' into master
Conflicts:
runtime/rsyslog.h
runtime/wtp.c
-rw-r--r-- | action.c | 22 | ||||
-rw-r--r-- | action.h | 3 | ||||
-rw-r--r-- | plugins/omstdout/omstdout.c | 2 | ||||
-rw-r--r-- | runtime/msg.c | 2 | ||||
-rw-r--r-- | runtime/net.c | 8 | ||||
-rw-r--r-- | runtime/rsyslog.h | 27 |
6 files changed, 37 insertions, 27 deletions
@@ -208,7 +208,7 @@ rsRetVal actionDestruct(action_t *pThis) /* message ptr cleanup */ for(i = 0 ; i < pThis->iNumTpls ; ++i) { - if(pThis->ppMsgs[i] != NULL) { + if(((uchar**)pThis->ppMsgs)[i] != NULL) { switch(pThis->eParamPassing) { case ACT_ARRAY_PASSING: #if 0 /* later, as an optimization. So far, we do the cleanup after each message */ @@ -222,7 +222,7 @@ rsRetVal actionDestruct(action_t *pThis) #endif break; case ACT_STRING_PASSING: - d_free(pThis->ppMsgs[i]); + d_free(((uchar**)pThis->ppMsgs)[i]); break; case ACT_MSG_PASSING: /* No cleanup needed in this case */ @@ -633,16 +633,16 @@ static rsRetVal prepareDoActionParams(action_t *pAction, msg_t *pMsg) for(i = 0 ; i < pAction->iNumTpls ; ++i) { switch(pAction->eParamPassing) { case ACT_STRING_PASSING: - CHKiRet(tplToString(pAction->ppTpl[i], pMsg, &(pAction->ppMsgs[i]), &(pAction->lenMsgs[i]))); + CHKiRet(tplToString(pAction->ppTpl[i], pMsg, &(((uchar**)pAction->ppMsgs)[i]), &(pAction->lenMsgs[i]))); break; case ACT_ARRAY_PASSING: - CHKiRet(tplToArray(pAction->ppTpl[i], pMsg, (uchar***) &(pAction->ppMsgs[i]))); + CHKiRet(tplToArray(pAction->ppTpl[i], pMsg, (uchar***) &(((uchar**)pAction->ppMsgs)[i]))); break; case ACT_MSG_PASSING: /* we abuse the uchar* ptr, it now actually is a void*, but we can not * change that other than by chaning the interface, what we don't like... */ - pAction->ppMsgs[i] = (uchar*) pMsg; + ((uchar**)pAction->ppMsgs)[i] = (uchar*) pMsg; break; default:assert(0); /* software bug if this happens! */ } @@ -664,16 +664,16 @@ static rsRetVal cleanupDoActionParams(action_t *pAction) ASSERT(pAction != NULL); for(i = 0 ; i < pAction->iNumTpls ; ++i) { - if(pAction->ppMsgs[i] != NULL) { + if(((uchar**)pAction->ppMsgs)[i] != NULL) { switch(pAction->eParamPassing) { case ACT_ARRAY_PASSING: iArr = 0; - while(((char **)pAction->ppMsgs[i])[iArr] != NULL) { - d_free(((char **)pAction->ppMsgs[i])[iArr++]); - ((char **)pAction->ppMsgs[i])[iArr++] = NULL; + while((((uchar***)pAction->ppMsgs)[i][iArr]) != NULL) { + d_free(((uchar ***)pAction->ppMsgs)[i][iArr++]); + ((uchar ***)pAction->ppMsgs)[i][iArr++] = NULL; } - d_free(pAction->ppMsgs[i]); - pAction->ppMsgs[i] = NULL; + d_free(((uchar**)pAction->ppMsgs)[i]); + ((uchar**)pAction->ppMsgs)[i] = NULL; break; case ACT_MSG_PASSING: case ACT_STRING_PASSING: @@ -84,7 +84,8 @@ struct action_s { SYNC_OBJ_TOOL; /* required for mutex support */ pthread_mutex_t mutActExec; /* mutex to guard actual execution of doAction for single-threaded modules */ uchar *pszName; /* action name (for documentation) */ - uchar **ppMsgs; /* pointer to action-calling parameters (kept in structure to save alloc() time!) */ + //uchar **ppMsgs; /* pointer to action-calling parameters (kept in structure to save alloc() time!) */ + void *ppMsgs; /* pointer to action-calling parameters (kept in structure to save alloc() time!) */ size_t *lenMsgs; /* length of message in ppMsgs */ }; typedef struct action_s action_t; diff --git a/plugins/omstdout/omstdout.c b/plugins/omstdout/omstdout.c index b3ec6287..929de703 100644 --- a/plugins/omstdout/omstdout.c +++ b/plugins/omstdout/omstdout.c @@ -103,7 +103,7 @@ CODESTARTdoAction * So this code here is also more or less an example of how to do that. * rgerhards, 2009-04-03 */ - szParams = (char**) (ppString[0]); + szParams = (char**)(void*) (ppString[0]); /* In array-passing mode, ppString[] contains a NULL-terminated array * of char *pointers. */ diff --git a/runtime/msg.c b/runtime/msg.c index 215189ce..5885cada 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -3141,7 +3141,7 @@ static rsRetVal msgConstructFinalizer(msg_t *pThis) * rgerhards, 2008-01-14 */ static rsRetVal -MsgGetSeverity(obj_t *pThis, int *piSeverity) +MsgGetSeverity(obj_t_ptr pThis, int *piSeverity) { ISOBJ_TYPE_assert(pThis, msg); assert(piSeverity != NULL); diff --git a/runtime/net.c b/runtime/net.c index 04ba5d91..7653ea1d 100644 --- a/runtime/net.c +++ b/runtime/net.c @@ -502,8 +502,8 @@ static inline void MaskIP4 (struct in_addr *addr, uint8_t bits) { addr->s_addr &= htonl(0xffffffff << (32 - bits)); } -#define SIN(sa) ((struct sockaddr_in *)(sa)) -#define SIN6(sa) ((struct sockaddr_in6 *)(sa)) +#define SIN(sa) ((struct sockaddr_in *)(void*)(sa)) +#define SIN6(sa) ((struct sockaddr_in6 *)(void*)(sa)) /* This is a cancel-safe getnameinfo() version, because we learned @@ -1182,12 +1182,12 @@ void debugListenInfo(int fd, char *type) switch(sa.sa_family) { case PF_INET: szFamily = "IPv4"; - ipv4 = (struct sockaddr_in*) &sa; + ipv4 = (struct sockaddr_in*)(void*) &sa; port = ntohs(ipv4->sin_port); break; case PF_INET6: szFamily = "IPv6"; - ipv6 = (struct sockaddr_in6*) &sa; + ipv6 = (struct sockaddr_in6*)(void*) &sa; port = ntohs(ipv6->sin6_port); break; default: diff --git a/runtime/rsyslog.h b/runtime/rsyslog.h index bdbc0648..cc5c845e 100644 --- a/runtime/rsyslog.h +++ b/runtime/rsyslog.h @@ -91,6 +91,7 @@ typedef char intTiny; /* 0..127! */ typedef unsigned char uintTiny; /* 0..255! */ /* define some base data types */ + typedef unsigned char uchar;/* get rid of the unhandy "unsigned char" */ typedef struct aUsrp_s aUsrp_t; typedef struct thrdInfo thrdInfo_t; @@ -112,15 +113,6 @@ typedef struct nsdsel_ptcp_s nsdsel_ptcp_t; typedef struct nsdsel_gtls_s nsdsel_gtls_t; typedef struct nsdpoll_ptcp_s nsdpoll_ptcp_t; typedef struct wti_s wti_t; -#ifdef OS_SOLARIS - typedef void nsd_t; - typedef void nsdsel_t; - typedef void nsdpoll_t; -#else - typedef obj_t nsd_t; - typedef obj_t nsdsel_t; - typedef obj_t nsdpoll_t; -#endif typedef struct msg msg_t; typedef struct queue_s qqueue_t; typedef struct prop_s prop_t; @@ -147,6 +139,23 @@ typedef uint64 qDeqID; /* queue Dequeue order ID. 32 bits is considered dangerou typedef struct tcpLstnPortList_s tcpLstnPortList_t; // TODO: rename? typedef struct strmLstnPortList_s strmLstnPortList_t; // TODO: rename? +/* under Solaris (actually only SPARC), we need to redefine some types + * to be void, so that we get void* pointers. Otherwise, we will see + * alignment errors. + */ +#ifdef OS_SOLARIS + typedef void * obj_t_ptr; + typedef void nsd_t; + typedef void nsdsel_t; + typedef void nsdpoll_t; +#else + typedef obj_t obj_t_ptr; + typedef obj_t nsd_t; + typedef obj_t nsdsel_t; + typedef obj_t nsdpoll_t; +#endif + + #ifdef __hpux typedef unsigned int u_int32_t; /* TODO: is this correct? */ typedef int socklen_t; |