/* rx_user.c contains routines specific to the user space UNIX implementation of rx */
+/* rxi_syscall is currently not prototyped */
+
#include <afsconfig.h>
#include <afs/param.h>
-RCSID
- ("$Header$");
# include <sys/types.h>
# include <errno.h>
# include <sys/time.h>
# include <net/if.h>
# include <sys/ioctl.h>
+# include <unistd.h>
#endif
# include <fcntl.h>
#if !defined(AFS_AIX_ENV) && !defined(AFS_NT40_ENV)
#define IPPORT_USERRESERVED 5000
# endif
+#if defined(HAVE_LINUX_ERRQUEUE_H) && defined(ADAPT_PMTU)
+#include <linux/types.h>
+#include <linux/errqueue.h>
+#ifndef IP_MTU
+#define IP_MTU 14
+#endif
+#endif
+
#ifndef AFS_NT40_ENV
# include <sys/time.h>
#endif
-# include "rx_internal.h"
# include "rx.h"
# include "rx_globals.h"
* Inited
*/
-pthread_mutex_t rx_if_init_mutex;
-#define LOCK_IF_INIT assert(pthread_mutex_lock(&rx_if_init_mutex)==0)
-#define UNLOCK_IF_INIT assert(pthread_mutex_unlock(&rx_if_init_mutex)==0)
+afs_kmutex_t rx_if_init_mutex;
+#define LOCK_IF_INIT MUTEX_ENTER(&rx_if_init_mutex)
+#define UNLOCK_IF_INIT MUTEX_EXIT(&rx_if_init_mutex)
/*
* The rx_if_mutex mutex protects the following global variables:
* myNetMasks
*/
-pthread_mutex_t rx_if_mutex;
-#define LOCK_IF assert(pthread_mutex_lock(&rx_if_mutex)==0)
-#define UNLOCK_IF assert(pthread_mutex_unlock(&rx_if_mutex)==0)
+afs_kmutex_t rx_if_mutex;
+#define LOCK_IF MUTEX_ENTER(&rx_if_mutex)
+#define UNLOCK_IF MUTEX_EXIT(&rx_if_mutex)
#else
#define LOCK_IF_INIT
#define UNLOCK_IF_INIT
int pmtu=IP_PMTUDISC_DONT;
#endif
#endif
-#if defined(HAVE_LINUX_ERRQUEUE_H) && defined(ADAPT_PMTU)
-#include <linux/types.h>
-#include <linux/errqueue.h>
-#ifndef IP_MTU
-#define IP_MTU 14
-#endif
-#endif
#if !defined(AFS_NT40_ENV)
if (ntohs(port) >= IPPORT_RESERVED && ntohs(port) < IPPORT_USERRESERVED) {
goto error;
}
+#ifdef AFS_NT40_ENV
+ rxi_xmit_init(socketFd);
+#endif /* AFS_NT40_ENV */
+
taddr.sin_addr.s_addr = ahost;
taddr.sin_family = AF_INET;
taddr.sin_port = (u_short) port;
if (!greedy)
(osi_Msg "%s*WARNING* Unable to increase buffering on socket\n",
name);
- MUTEX_ENTER(&rx_stats_mutex);
- rx_stats.socketGreedy = greedy;
- MUTEX_EXIT(&rx_stats_mutex);
+ if (rx_stats_active) {
+ MUTEX_ENTER(&rx_stats_mutex);
+ rx_stats.socketGreedy = greedy;
+ MUTEX_EXIT(&rx_stats_mutex);
+ }
}
#ifdef AFS_LINUX22_ENV
#if !defined(AFS_AIX_ENV) && !defined(AFS_NT40_ENV) && !defined(AFS_LINUX20_ENV)
int
-rxi_syscall(a3, a4, a5)
- afs_uint32 a3, a4;
- void *a5;
+rxi_syscall(afs_uint32 a3, afs_uint32 a4, void *a5)
{
afs_uint32 rcode;
- void (*old) ();
+ void (*old) (int);
- old = (void (*)())signal(SIGSYS, SIG_IGN);
+ old = signal(SIGSYS, SIG_IGN);
#if defined(AFS_SGI_ENV)
rcode = afs_syscall(a3, a4, a5);
struct sockaddr_in addr;
#endif
+
+
LOCK_IF_INIT;
if (!Inited) {
UNLOCK_IF_INIT;
/* try to second-guess IP, and identify which link is most likely to
* be used for traffic to/from this host. */
ppaddr = ntohl(pp->host);
-
+
pp->ifMTU = 0;
pp->timeout.sec = 2;
- pp->rateFlag = 2; /* start timing after two full packets */
+ pp->rateFlag = 2; /* start timing after two full packets */
/* I don't initialize these, because I presume they are bzero'd...
* pp->burstSize pp->burst pp->burstWait.sec pp->burstWait.usec
* pp->timeout.usec */
-
+
LOCK_IF;
for (ix = 0; ix < rxi_numNetAddrs; ++ix) {
if ((rxi_NetAddrs[ix] & myNetMasks[ix]) == (ppaddr & myNetMasks[ix])) {
}
}
UNLOCK_IF;
- if (!pp->ifMTU) { /* not local */
+ if (!pp->ifMTU) { /* not local */
pp->timeout.sec = 3;
pp->ifMTU = MIN(rx_MyMaxSendSize, RX_REMOTE_PACKET_SIZE);
}