return rxi_GetHostUDPSocket(htonl(INADDR_ANY), port);
}
-#if !defined(AFS_LINUX26_ENV)
-void
-#ifdef AFS_AIX_ENV
-osi_Panic(char *msg, void *a1, void *a2, void *a3)
-#else
-osi_Panic(char *msg, ...)
-#endif
-{
-#ifdef AFS_AIX_ENV
- if (!msg)
- msg = "Unknown AFS panic";
- printf(msg, a1, a2, a3);
- panic(msg);
-#elif (defined(AFS_DARWIN80_ENV) && !defined(AFS_DARWIN90_ENV)) || (defined(AFS_LINUX22_ENV) && !defined(AFS_LINUX_26_ENV))
- char buf[256];
- va_list ap;
- if (!msg)
- msg = "Unknown AFS panic";
-
- va_start(ap, msg);
- vsnprintf(buf, sizeof(buf), msg, ap);
- va_end(ap);
- printf(buf);
- panic(buf);
-#else
- va_list ap;
- if (!msg)
- msg = "Unknown AFS panic";
-
- va_start(ap, msg);
- vprintf(msg, ap);
- va_end(ap);
-# ifdef AFS_LINUX20_ENV
- * ((char *) 0) = 0;
-# else
- panic(msg);
-# endif
-#endif
-}
-
/*
* osi_utoa() - write the NUL-terminated ASCII decimal form of the given
* unsigned long value into the given buffer. Returns 0 on success,
return 0;
}
+#ifndef AFS_LINUX26_ENV
/*
* osi_AssertFailK() -- used by the osi_Assert() macro.
*
#undef ADDBUF
- osi_Panic(buf);
+ osi_Panic("%s", buf);
}
#else
void
{
int threadID;
-/* jaltman - rxi_dataQuota is protected by a mutex everywhere else */
rxi_MorePackets(rx_maxReceiveWindow + 2); /* alloc more packets */
+ MUTEX_ENTER(&rx_quota_mutex);
rxi_dataQuota += rx_initSendWindow; /* Reserve some pkts for hard times */
/* threadID is used for making decisions in GetCall. Get it by bumping
* number of threads handling incoming calls */
threadID = rxi_availProcs++;
+ MUTEX_EXIT(&rx_quota_mutex);
#ifdef RX_ENABLE_LOCKS
AFS_GUNLOCK();
memset(mtus, 0, sizeof(mtus));
#if defined(AFS_DARWIN80_ENV)
- if (!ifnet_list_get(AF_INET, ifns, &count)) {
+ if (!ifnet_list_get(AF_INET, &ifns, &count)) {
for (m = 0; m < count; m++) {
if (!ifnet_get_address_list(ifns[m], &ifads)) {
for (j = 0; ifads[j] != NULL && cnt < ADDRSPERSITE; j++) {
TAILQ_FOREACH(ifn, &ifnet, if_link) {
if (i >= ADDRSPERSITE)
break;
-#elif defined(AFS_OBSD_ENV)
+#elif defined(AFS_OBSD_ENV) || defined(AFS_NBSD_ENV)
for (ifn = ifnet.tqh_first; i < ADDRSPERSITE && ifn != NULL;
ifn = ifn->if_list.tqe_next) {
#else
TAILQ_FOREACH(ifad, &ifn->if_addrhead, ifa_link) {
if (i >= ADDRSPERSITE)
break;
-#elif defined(AFS_OBSD_ENV)
+#elif defined(AFS_OBSD_ENV) || defined(AFS_NBSD_ENV)
for (ifad = ifn->if_addrlist.tqh_first;
ifad != NULL && i < ADDRSPERSITE;
ifad = ifad->ifa_list.tqe_next) {
return different;
}
-#if defined(AFS_DARWIN60_ENV) || defined(AFS_XBSD_ENV)
+#if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
/* Returns ifnet which best matches address */
rx_ifnet_t
rxi_FindIfnet(afs_uint32 addr, afs_uint32 * maskp)
return (ifad ? rx_ifaddr_ifnet(ifad) : NULL);
}
-#else /* DARWIN60 || XBSD */
+#else /* DARWIN || XBSD */
/* Returns ifnet which best matches address */
rx_ifnet_t
*maskp = ifad->ia_subnetmask;
return (ifad ? ifad->ia_ifp : NULL);
}
-#endif /* else DARWIN60 || XBSD */
+#endif /* else DARWIN || XBSD */
#endif /* else AFS_USERSPACE_IP_ADDR */
#endif /* !SUN5 && !SGI62 */
#else
struct socket *newSocket;
#endif
-#if (!defined(AFS_HPUX1122_ENV) && !defined(AFS_FBSD50_ENV))
+#if (!defined(AFS_HPUX1122_ENV) && !defined(AFS_FBSD_ENV))
struct mbuf *nam;
#endif
struct sockaddr_in myaddr;
#endif /* else AFS_HPUX110_ENV */
#elif defined(AFS_SGI65_ENV) || defined(AFS_OBSD_ENV)
code = socreate(AF_INET, &newSocket, SOCK_DGRAM, IPPROTO_UDP);
-#elif defined(AFS_FBSD50_ENV)
+#elif defined(AFS_FBSD_ENV)
code = socreate(AF_INET, &newSocket, SOCK_DGRAM, IPPROTO_UDP,
afs_osi_credp, curthread);
-#elif defined(AFS_FBSD40_ENV)
- code = socreate(AF_INET, &newSocket, SOCK_DGRAM, IPPROTO_UDP, curproc);
#elif defined(AFS_DARWIN80_ENV)
code = sock_socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP, NULL, NULL, &newSocket);
+#elif defined(AFS_NBSD40_ENV)
+ code = socreate(AF_INET, &newSocket, SOCK_DGRAM, 0, osi_curproc());
#else
code = socreate(AF_INET, &newSocket, SOCK_DGRAM, 0);
#endif /* AFS_HPUX102_ENV */
memcpy((caddr_t) bindnam->b_rptr + SO_MSGOFFSET, (caddr_t) & myaddr,
addrsize);
bindnam->b_wptr = bindnam->b_rptr + (addrsize + SO_MSGOFFSET + 1);
-
+#if defined(AFS_NBSD40_ENV)
+ code = sobind(newSocket, bindnam, addrsize, osi_curproc());
+#else
code = sobind(newSocket, bindnam, addrsize);
+#endif
if (code) {
soclose(newSocket);
#if !defined(AFS_HPUX1122_ENV)
}
#endif
#if defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV)
-#if defined(AFS_FBSD50_ENV)
+#if defined(AFS_FBSD_ENV)
code = sobind(newSocket, (struct sockaddr *)&myaddr, curthread);
-#elif defined(AFS_FBSD40_ENV)
- code = sobind(newSocket, (struct sockaddr *)&myaddr, curproc);
#else
code = sobind(newSocket, (struct sockaddr *)&myaddr);
#endif
if (code) {
dpf(("sobind fails (%d)\n", (int)code));
soclose(newSocket);
- AFS_GLOCK();
goto bad;
}
#else /* defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV) */
BHV_PDATA(&bhv) = (void *)newSocket;
code = sobind(&bhv, nam);
m_freem(nam);
-#elif defined(AFS_OBSD44_ENV)
+#elif defined(AFS_OBSD44_ENV) || defined(AFS_NBSD40_ENV)
code = sobind(newSocket, nam, osi_curproc());
#else
code = sobind(newSocket, nam);
#endif /* !SUN5 && !LINUX20 */
#if defined(RXK_LISTENER_ENV) || defined(AFS_SUN5_ENV)
+#ifdef AFS_DARWIN80_ENV
+/* Shutting down should wake us up, as should an earlier event. */
+void
+rxi_ReScheduleEvents(void)
+{
+ /* needed to allow startup */
+ int glock = ISAFS_GLOCK();
+ if (!glock)
+ AFS_GLOCK();
+ osi_rxWakeup(&afs_termState);
+ if (!glock)
+ AFS_GUNLOCK();
+}
+#endif
/*
* Run RX event daemon every second (5 times faster than rest of systems)
*/
afs_Trace1(afs_iclSetp, CM_TRACE_TIMESTAMP, ICL_TYPE_STRING,
"before afs_osi_Wait()");
#endif
+#ifdef AFS_DARWIN80_ENV
+ afs_osi_TimedSleep(&afs_termState, MAX(500, ((temp.sec * 1000) +
+ (temp.usec / 1000))), 0);
+#else
afs_osi_Wait(500, NULL, 0);
+#endif
#ifdef RX_KERNEL_TRACE
afs_Trace1(afs_iclSetp, CM_TRACE_TIMESTAMP, ICL_TYPE_STRING,
"after afs_osi_Wait()");
AFS_GUNLOCK();
#endif /* RX_ENABLE_LOCKS && !AFS_SUN5_ENV */
while (afs_termState != AFSOP_STOP_RXK_LISTENER) {
+ /* See if a check for additional packets was issued */
+ rx_CheckPackets();
+
if (rxp) {
rxi_RestoreDataBufs(rxp);
} else {
}
#endif
#endif /* RXK_LISTENER_ENV */
-
#endif /* !NCR && !UKERNEL */
+
+#if !defined(AFS_LINUX26_ENV)
+void
+#if defined(AFS_AIX_ENV)
+osi_Panic(char *msg, void *a1, void *a2, void *a3)
+#else
+osi_Panic(char *msg, ...)
+#endif
+{
+#ifdef AFS_AIX_ENV
+ if (!msg)
+ msg = "Unknown AFS panic";
+ /*
+ * we should probably use the errsave facility here. it is not
+ * varargs-aware
+ */
+
+ printf(msg, a1, a2, a3);
+ panic(msg);
+#elif defined(AFS_SGI_ENV)
+ va_list ap;
+
+ /* Solaris has vcmn_err, Sol10 01/06 may have issues. Beware. */
+ if (!msg) {
+ cmn_err(CE_PANIC, "Unknown AFS panic");
+ } else {
+ va_start(ap, msg);
+ icmn_err(CE_PANIC, msg, ap);
+ va_end(ap);
+ }
+#elif defined(AFS_DARWIN80_ENV) || (defined(AFS_LINUX22_ENV) && !defined(AFS_LINUX_26_ENV))
+ char buf[256];
+ va_list ap;
+ if (!msg)
+ msg = "Unknown AFS panic";
+
+ va_start(ap, msg);
+ vsnprintf(buf, sizeof(buf), msg, ap);
+ va_end(ap);
+ printf("%s", buf);
+ panic(buf);
+#else
+ va_list ap;
+ if (!msg)
+ msg = "Unknown AFS panic";
+
+ va_start(ap, msg);
+ vprintf(msg, ap);
+ va_end(ap);
+# ifdef AFS_LINUX20_ENV
+ * ((char *) 0) = 0;
+# else
+ panic(msg);
+# endif
+#endif
+}
+#endif