Add printf format checks to rx

Add gcc printf format checks to rxi_DebugPrint() and osi_Panic()
Deal with the small amount of fallout.

Change-Id: Ic356028613087bda02beb9907886421d80a227c3
Reviewed-on: http://gerrit.openafs.org/795
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
Simon Wilkinson 2009-11-07 23:43:25 +00:00 committed by Derrick Brashear
parent d008089a79
commit a150df6107
3 changed files with 17 additions and 13 deletions

View File

@ -800,8 +800,10 @@ rx_NewConnection(afs_uint32 shost, u_short sport, u_short sservice,
SPLVAR;
clock_NewTime();
dpf(("rx_NewConnection(host %x, port %u, service %u, securityObject %x, serviceSecurityIndex %d)\n",
ntohl(shost), ntohs(sport), sservice, securityObject, serviceSecurityIndex));
dpf(("rx_NewConnection(host %x, port %u, service %u, securityObject %p, "
"serviceSecurityIndex %d)\n",
ntohl(shost), ntohs(sport), sservice, securityObject,
serviceSecurityIndex));
/* Vasilsi said: "NETPRI protects Cid and Alloc", but can this be true in
* the case of kmem_alloc? */
@ -1741,7 +1743,7 @@ rx_GetCall(int tno, struct rx_service *cur_service, osi_socket * socketp)
CALL_HOLD(call, RX_CALL_REFCOUNT_BEGIN);
MUTEX_EXIT(&call->lock);
} else {
dpf(("rx_GetCall(socketp=0x%"AFS_PTR_FMT", *socketp=0x%"AFS_PTR_FMT")\n", socketp, *socketp));
dpf(("rx_GetCall(socketp=%p, *socketp=0x%x)\n", socketp, *socketp));
}
return call;
@ -1888,11 +1890,11 @@ rx_GetCall(int tno, struct rx_service *cur_service, osi_socket * socketp)
#endif
rxi_calltrace(RX_CALL_START, call);
dpf(("rx_GetCall(port=%d, service=%d) ==> call %x\n",
dpf(("rx_GetCall(port=%d, service=%d) ==> call %p\n",
call->conn->service->servicePort, call->conn->service->serviceId,
call));
} else {
dpf(("rx_GetCall(socketp=0x%"AFS_PTR_FMT", *socketp=0x%"AFS_PTR_FMT")\n", socketp, *socketp));
dpf(("rx_GetCall(socketp=%p, *socketp=0x%x)\n", socketp, *socketp));
}
USERPRI;
@ -2776,7 +2778,7 @@ rxi_ReceivePacket(struct rx_packet *np, osi_socket socket,
*call->callNumber = np->header.callNumber;
#ifdef RXDEBUG
if (np->header.callNumber == 0)
dpf(("RecPacket call 0 %d %s: %x.%u.%u.%u.%u.%u.%u flags %d, packet %"AFS_PTR_FMT" resend %d.%0.06d len %d",
dpf(("RecPacket call 0 %d %s: %x.%u.%u.%u.%u.%u.%u flags %d, packet %"AFS_PTR_FMT" resend %d.%.06d len %d",
np->header.serial, rx_packetTypes[np->header.type - 1], ntohl(conn->peer->host), ntohs(conn->peer->port),
np->header.serial, np->header.epoch, np->header.cid, np->header.callNumber, np->header.seq,
np->header.flags, np, np->retryTime.sec, np->retryTime.usec / 1000, np->length));
@ -5509,8 +5511,8 @@ rxi_Start(struct rxevent *event,
rx_MutexIncrement(rx_tq_debug.rxi_start_aborted, rx_stats_mutex);
call->flags &= ~RX_CALL_TQ_BUSY;
if (call->tqWaiters || (call->flags & RX_CALL_TQ_WAIT)) {
dpf(("call error %d while xmit %x has %d waiters and flags %d\n",
call, call->error, call->tqWaiters, call->flags));
dpf(("call error %d while xmit %p has %d waiters and flags %d\n",
call->error, call, call->tqWaiters, call->flags));
#ifdef RX_ENABLE_LOCKS
osirx_AssertMine(&call->lock, "rxi_Start middle");
CV_BROADCAST(&call->cv_tq);

View File

@ -2309,7 +2309,7 @@ rxi_SendPacket(struct rx_call *call, struct rx_connection *conn,
#endif
#ifdef RXDEBUG
}
dpf(("%c %d %s: %x.%u.%u.%u.%u.%u.%u flags %d, packet %"AFS_PTR_FMT" resend %d.%0.3d len %d",
dpf(("%c %d %s: %x.%u.%u.%u.%u.%u.%u flags %d, packet %"AFS_PTR_FMT" resend %d.%.3d len %d",
deliveryType, p->header.serial, rx_packetTypes[p->header.type - 1], ntohl(peer->host),
ntohs(peer->port), p->header.serial, p->header.epoch, p->header.cid, p->header.callNumber,
p->header.seq, p->header.flags, p, p->retryTime.sec, p->retryTime.usec / 1000, p->length));
@ -2495,7 +2495,7 @@ rxi_SendPacketList(struct rx_call *call, struct rx_connection *conn,
assert(p != NULL);
dpf(("%c %d %s: %x.%u.%u.%u.%u.%u.%u flags %d, packet %"AFS_PTR_FMT" resend %d.%0.3d len %d",
dpf(("%c %d %s: %x.%u.%u.%u.%u.%u.%u flags %d, packet %"AFS_PTR_FMT" resend %d.%.3d len %d",
deliveryType, p->header.serial, rx_packetTypes[p->header.type - 1], ntohl(peer->host),
ntohs(peer->port), p->header.serial, p->header.epoch, p->header.cid, p->header.callNumber,
p->header.seq, p->header.flags, p, p->retryTime.sec, p->retryTime.usec / 1000, p->length));

View File

@ -268,7 +268,8 @@ extern afs_int32 rx_SetSecurityConfiguration(struct rx_service *service,
void *value);
void rxi_DebugInit(void);
void rxi_DebugPrint(char *format, ...);
void rxi_DebugPrint(char *format, ...)
AFS_ATTRIBUTE_FORMAT(__printf__, 1, 2);
/* rx_clock.c */
#if !defined(clock_Init)
@ -378,8 +379,9 @@ extern void osi_Panic(char *fmt, void *a1, void *a2, void *a3);
# elif defined(AFS_AIX61_ENV)
/* No prototype. Deliberate, since there's no vprintf et al */
# else
extern void osi_Panic(char *fmt, ...);
# endif
extern void osi_Panic(char *fmt, ...)
AFS_ATTRIBUTE_FORMAT(__printf__, 1, 2);
#endif
extern int osi_utoa(char *buf, size_t len, unsigned long val);
extern void rxi_InitPeerParams(struct rx_peer *pp);
extern void shutdown_rxkernel(void);