pthread_once_t rx_once_init = PTHREAD_ONCE_INIT;
#define INIT_PTHREAD_LOCKS \
-assert(pthread_once(&rx_once_init, rxi_InitPthread)==0);
+assert(pthread_once(&rx_once_init, rxi_InitPthread)==0)
/*
* The rx_stats_mutex mutex protects the following global variables:
* rxi_dataQuota
* rx_epoch
*/
-#define LOCK_EPOCH assert(pthread_mutex_lock(&epoch_mutex)==0);
-#define UNLOCK_EPOCH assert(pthread_mutex_unlock(&epoch_mutex)==0);
+#define LOCK_EPOCH assert(pthread_mutex_lock(&epoch_mutex)==0)
+#define UNLOCK_EPOCH assert(pthread_mutex_unlock(&epoch_mutex)==0)
#else
#define LOCK_EPOCH
#define UNLOCK_EPOCH
void
rx_SetEpoch(afs_uint32 epoch)
{
- LOCK_EPOCH rx_epoch = epoch;
-UNLOCK_EPOCH}
+ LOCK_EPOCH;
+ rx_epoch = epoch;
+ UNLOCK_EPOCH;
+}
/* Initialize rx. A port number may be mentioned, in which case this
* becomes the default port number for any service installed later.
* rxinit_status
*/
-#define LOCK_RX_INIT assert(pthread_mutex_lock(&rx_init_mutex)==0);
-#define UNLOCK_RX_INIT assert(pthread_mutex_unlock(&rx_init_mutex)==0);
+#define LOCK_RX_INIT assert(pthread_mutex_lock(&rx_init_mutex)==0)
+#define UNLOCK_RX_INIT assert(pthread_mutex_unlock(&rx_init_mutex)==0)
#else
#define LOCK_RX_INIT
#define UNLOCK_RX_INIT
#endif
-int
+int
rx_InitHost(u_int host, u_int port)
{
#ifdef KERNEL
SPLVAR;
- INIT_PTHREAD_LOCKS LOCK_RX_INIT if (rxinit_status == 0) {
+ INIT_PTHREAD_LOCKS;
+ LOCK_RX_INIT;
+ if (rxinit_status == 0) {
tmp_status = rxinit_status;
- UNLOCK_RX_INIT return tmp_status; /* Already started; return previous error code. */
+ UNLOCK_RX_INIT;
+ return tmp_status; /* Already started; return previous error code. */
}
#ifdef AFS_NT40_ENV
if (afs_winsockInit() < 0)
rx_socket = rxi_GetHostUDPSocket(host, (u_short) port);
if (rx_socket == OSI_NULLSOCKET) {
- UNLOCK_RX_INIT return RX_ADDRINUSE;
+ UNLOCK_RX_INIT;
+ return RX_ADDRINUSE;
}
#ifdef RX_ENABLE_LOCKS
#ifdef RX_LOCKS_DB
AFS_RXGUNLOCK();
USERPRI;
tmp_status = rxinit_status = 0;
- UNLOCK_RX_INIT return tmp_status;
+ UNLOCK_RX_INIT;
+ return tmp_status;
}
-int rx_Init(u_int port)
+int
+rx_Init(u_int port)
{
return rx_InitHost(htonl(INADDR_ANY), port);
}
{
register struct rx_connection **conn_ptr, **conn_end;
- INIT_PTHREAD_LOCKS LOCK_RX_INIT if (rxinit_status == 1) {
- UNLOCK_RX_INIT return; /* Already shutdown. */
+ INIT_PTHREAD_LOCKS;
+ LOCK_RX_INIT;
+ if (rxinit_status == 1) {
+ UNLOCK_RX_INIT;
+ return; /* Already shutdown. */
}
rxi_DeleteCachedConnections();
if (rx_connHashTable) {
rxi_flushtrace();
rxinit_status = 1;
-UNLOCK_RX_INIT}
+ UNLOCK_RX_INIT;
+}
#endif
/* if we wakeup packet waiter too often, can get in loop with two
if (type == RX_CLIENT_CONNECTION && pp->port == port)
break;
/* So what happens when it's a callback connection? */
- if (/*type == RX_CLIENT_CONNECTION &&*/ (conn->epoch & 0x80000000))
+ if ( /*type == RX_CLIENT_CONNECTION && */
+ (conn->epoch & 0x80000000))
break;
}
if (!flag) {
* counter
*/
-#define LOCK_RX_DEBUG assert(pthread_mutex_lock(&rx_debug_mutex)==0);
-#define UNLOCK_RX_DEBUG assert(pthread_mutex_unlock(&rx_debug_mutex)==0);
+#define LOCK_RX_DEBUG assert(pthread_mutex_lock(&rx_debug_mutex)==0)
+#define UNLOCK_RX_DEBUG assert(pthread_mutex_unlock(&rx_debug_mutex)==0)
#else
#define LOCK_RX_DEBUG
#define UNLOCK_RX_DEBUG
register char *tp;
endTime = time(0) + 20; /* try for 20 seconds */
- LOCK_RX_DEBUG counter++;
- UNLOCK_RX_DEBUG tp = &tbuffer[sizeof(struct rx_header)];
+ LOCK_RX_DEBUG;
+ counter++;
+ UNLOCK_RX_DEBUG;
+ tp = &tbuffer[sizeof(struct rx_header)];
taddr.sin_family = AF_INET;
taddr.sin_port = remotePort;
taddr.sin_addr.s_addr = remoteAddr;
tv.tv_sec = 1;
tv.tv_usec = 0;
code = select(socket + 1, &imask, 0, 0, &tv);
- if (code == 1 && FD_ISSET(socket,&imask)) {
+ if (code == 1 && FD_ISSET(socket, &imask)) {
/* now receive a packet */
faddrLen = sizeof(struct sockaddr_in);
code =
recvfrom(socket, tbuffer, sizeof(tbuffer), 0,
(struct sockaddr *)&faddr, &faddrLen);
- if (code > 0) {
- memcpy(&theader, tbuffer, sizeof(struct rx_header));
- if (counter == ntohl(theader.callNumber))
- break;
- }
+ if (code > 0) {
+ memcpy(&theader, tbuffer, sizeof(struct rx_header));
+ if (counter == ntohl(theader.callNumber))
+ break;
+ }
}
/* see if we've timed out */
register struct rx_serverQueueEntry *sq;
#endif /* KERNEL */
- LOCK_RX_INIT if (rxinit_status == 1) {
- UNLOCK_RX_INIT return; /* Already shutdown. */
+ LOCK_RX_INIT;
+ if (rxinit_status == 1) {
+ UNLOCK_RX_INIT;
+ return; /* Already shutdown. */
}
#ifndef KERNEL
rx_port = 0;
MUTEX_EXIT(&rx_stats_mutex);
rxinit_status = 1;
-UNLOCK_RX_INIT}
+ UNLOCK_RX_INIT;
+}
#ifdef RX_ENABLE_LOCKS
void