Allow AFS to shutdown on Solaris (and subsequently be reloaded
[openafs.git] / src / rx / rx_kcommon.c
index 53a57c5..44438e6 100644 (file)
@@ -343,6 +343,7 @@ register struct rx_peer *pp;
     u_short rxmtu;
     afs_int32 i, mtu;
 
+#ifndef AFS_SUN5_ENV
 #ifdef AFS_USERSPACE_IP_ADDR   
     i = rxi_Findcbi(pp->host);
     if (i == -1) {
@@ -402,6 +403,30 @@ register struct rx_peer *pp;
       pp->ifMTU = RX_REMOTE_PACKET_SIZE;
     }
 #endif/* else AFS_USERSPACE_IP_ADDR */
+#else /* AFS_SUN5_ENV */
+    mtu = rxi_FindIfMTU(pp->host);
+
+    if (mtu <= 0) {
+       pp->timeout.sec = 3;
+       /* pp->timeout.usec = 0; */
+       pp->ifMTU = RX_REMOTE_PACKET_SIZE;
+    } else {
+       pp->timeout.sec = 2;
+       /* pp->timeout.usec = 0; */
+       pp->ifMTU = MIN(RX_MAX_PACKET_SIZE, rx_MyMaxSendSize);
+    }
+
+    if (mtu > 0) {
+       /* Diminish the packet size to one based on the MTU given by
+        * the interface. */
+       if (mtu > (RX_IPUDP_SIZE + RX_HEADER_SIZE)) {
+           rxmtu = mtu - RX_IPUDP_SIZE;
+           if (rxmtu < pp->ifMTU) pp->ifMTU = rxmtu;
+       }
+    } else {   /* couldn't find the interface, so assume the worst */
+       pp->ifMTU = RX_REMOTE_PACKET_SIZE;
+    }
+#endif /* AFS_SUN5_ENV */
 #else /* ADAPT_MTU */
     pp->rateFlag = 2;   /* start timing after two full packets */
     pp->timeout.sec = 2;
@@ -998,7 +1023,7 @@ void rxk_Listener(void)
     rxk_ListenerPid = current->pid;
 #endif
 #ifdef AFS_SUN5_ENV
-    rxk_ListenerPid = ttoproc(curthread)->p_pidp->pid_id;
+    rxk_ListenerPid = curproc->p_pid;
 #endif /* AFS_SUN5_ENV */
 #if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
     rxk_ListenerPid = current_proc()->p_pid;
@@ -1021,9 +1046,6 @@ void rxk_Listener(void)
            rxp = rxi_ReceivePacket(rxp, rx_socket, host, port);
            AFS_RXGUNLOCK();
        }
-       if (afs_termState == AFSOP_STOP_RXK_LISTENER)
-           break;
-
     }
 
 #ifdef RX_ENABLE_LOCKS
@@ -1034,11 +1056,16 @@ void rxk_Listener(void)
        afs_osi_Wakeup(&afs_termState);
     }
     rxk_ListenerPid = 0;
-#ifdef AFS_LINUX24_ENV
+#if defined(AFS_LINUX22_ENV) || defined(AFS_SUN5_ENV)
     afs_osi_Wakeup(&rxk_ListenerPid);
 #endif
 #ifdef AFS_SUN5_ENV
     AFS_GUNLOCK();
+#ifdef AFS_SUN57_ENV
+    if (!curproc->p_corefile)  /* newproc doesn't set it, but exit frees it */
+       curproc->p_corefile = refstr_alloc("core");
+#endif
+    exit(CLD_EXITED, 0);
 #endif /* AFS_SUN5_ENV */
 }