LINUX 5.3.0: Use send_sig instead of force_sig
[openafs.git] / src / rx / rx_kcommon.c
index a381c50..c2cc187 100644 (file)
 
 #include "rx/rx_kcommon.h"
 #include "rx_atomic.h"
+#include "rx_packet.h"
+#include "rx_internal.h"
 #include "rx_stats.h"
+#include "rx_peer.h"
 
 #ifdef AFS_HPUX110_ENV
 #include "h/tihdr.h"
@@ -362,9 +365,8 @@ rxi_InitPeerParams(struct rx_peer *pp)
 {
     u_short rxmtu;
 
-#ifdef ADAPT_MTU
-# ifndef AFS_SUN5_ENV
-#  ifdef AFS_USERSPACE_IP_ADDR
+#ifndef AFS_SUN5_ENV
+# ifdef AFS_USERSPACE_IP_ADDR
     afs_int32 i;
     afs_int32 mtu;
 
@@ -384,25 +386,25 @@ rxi_InitPeerParams(struct rx_peer *pp)
                pp->ifMTU = rxmtu;
        }
     }
-#  else /* AFS_USERSPACE_IP_ADDR */
+# else /* AFS_USERSPACE_IP_ADDR */
     rx_ifnet_t ifn;
 
-#   if !defined(AFS_SGI62_ENV)
+#  if !defined(AFS_SGI62_ENV)
     if (numMyNetAddrs == 0)
        (void)rxi_GetIFInfo();
-#   endif
+#  endif
 
     ifn = rxi_FindIfnet(pp->host, NULL);
     if (ifn) {
        rx_rto_setPeerTimeoutSecs(pp, 2);
        pp->ifMTU = MIN(RX_MAX_PACKET_SIZE, rx_MyMaxSendSize);
-#   ifdef IFF_POINTOPOINT
+#  ifdef IFF_POINTOPOINT
        if (rx_ifnet_flags(ifn) & IFF_POINTOPOINT) {
            /* wish we knew the bit rate and the chunk size, sigh. */
            rx_rto_setPeerTimeoutSecs(pp, 4);
            pp->ifMTU = RX_PP_PACKET_SIZE;
        }
-#   endif /* IFF_POINTOPOINT */
+#  endif /* IFF_POINTOPOINT */
        /* Diminish the packet size to one based on the MTU given by
         * the interface. */
        if (rx_ifnet_mtu(ifn) > (RX_IPUDP_SIZE + RX_HEADER_SIZE)) {
@@ -414,8 +416,8 @@ rxi_InitPeerParams(struct rx_peer *pp)
        rx_rto_setPeerTimeoutSecs(pp, 3);
        pp->ifMTU = MIN(RX_REMOTE_PACKET_SIZE, rx_MyMaxSendSize);
     }
-#  endif /* else AFS_USERSPACE_IP_ADDR */
-# else /* AFS_SUN5_ENV */
+# endif /* else AFS_USERSPACE_IP_ADDR */
+#else /* AFS_SUN5_ENV */
     afs_int32 mtu;
 
     mtu = rxi_FindIfMTU(pp->host);
@@ -435,12 +437,7 @@ rxi_InitPeerParams(struct rx_peer *pp)
                pp->ifMTU = rxmtu;
        }
     }
-# endif /* AFS_SUN5_ENV */
-#else /* ADAPT_MTU */
-    pp->rateFlag = 2;          /* start timing after two full packets */
-    rx_rto_setPeerTimeoutSecs(pp, 2);
-    pp->ifMTU = OLD_MAX_PACKET_SIZE;
-#endif /* else ADAPT_MTU */
+#endif /* AFS_SUN5_ENV */
     pp->ifMTU = rxi_AdjustIfMTU(pp->ifMTU);
     pp->maxMTU = OLD_MAX_PACKET_SIZE;  /* for compatibility with old guys */
     pp->natMTU = MIN(pp->ifMTU, OLD_MAX_PACKET_SIZE);
@@ -592,7 +589,7 @@ rxi_Findcbi(afs_uint32 addr)
 
 #else /* AFS_USERSPACE_IP_ADDR */
 
-#if !defined(AFS_AIX41_ENV) && !defined(AFS_DUX40_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_XBSD_ENV)
+#if !defined(AFS_AIX41_ENV) && !defined(AFS_DARWIN_ENV) && !defined(AFS_XBSD_ENV)
 #define IFADDR2SA(f) (&((f)->ifa_addr))
 #else /* AFS_AIX41_ENV */
 #define IFADDR2SA(f) ((f)->ifa_addr)
@@ -757,12 +754,7 @@ rxi_FindIfnet(afs_uint32 addr, afs_uint32 * maskp)
 
     addr = ntohl(addr);
 
-#if defined(AFS_DARWIN_ENV)
-    for (ifa = TAILQ_FIRST(&in_ifaddrhead); ifa;
-        ifa = TAILQ_NEXT(ifa, ia_link)) {
-#else
     for (ifa = in_ifaddr; ifa; ifa = ifa->ia_next) {
-#endif
        if ((addr & ifa->ia_netmask) == ifa->ia_net) {
            if ((addr & ifa->ia_subnetmask) == ifa->ia_subnet) {
                if (IA_SIN(ifa)->sin_addr.s_addr == addr) {     /* ie, ME!!!  */
@@ -891,11 +883,7 @@ rxk_NewSocketHost(afs_uint32 ahost, short aport)
     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)
@@ -948,11 +936,7 @@ rxk_NewSocketHost(afs_uint32 ahost, short aport)
        goto bad;
     }
 #else /* defined(AFS_DARWIN_ENV) || defined(AFS_FBSD_ENV) */
-#ifdef  AFS_OSF_ENV
-    nam = m_getclr(M_WAIT, MT_SONAME);
-#else /* AFS_OSF_ENV */
     nam = m_get(M_WAIT, MT_SONAME);
-#endif
     if (nam == NULL) {
 #if defined(KERNEL_HAVE_UERROR)
        setuerror(ENOBUFS);
@@ -1213,6 +1197,7 @@ rxk_Listener(void)
 #ifdef AFS_LINUX20_ENV
     rxk_ListenerPid = current->pid;
     rxk_ListenerTask = current;
+    allow_signal(SIGKILL);    /* Allowed, but blocked until shutdown */
 #endif
 #ifdef AFS_SUN5_ENV
     rxk_ListenerPid = 1;       /* No PID, just a flag that we're alive */
@@ -1307,7 +1292,7 @@ osi_Panic(char *msg, ...)
        icmn_err(CE_PANIC, msg, ap);
        va_end(ap);
     }
-#elif defined(AFS_DARWIN80_ENV) || (defined(AFS_LINUX22_ENV) && !defined(AFS_LINUX_26_ENV))
+#elif defined(AFS_DARWIN80_ENV) || defined(AFS_LINUX22_ENV) || defined(AFS_FBSD_ENV) || defined(UKERNEL)
     char buf[256];
     va_list ap;
     if (!msg)
@@ -1317,7 +1302,7 @@ osi_Panic(char *msg, ...)
     vsnprintf(buf, sizeof(buf), msg, ap);
     va_end(ap);
     printf("%s", buf);
-    panic(buf);
+    panic("%s", buf);
 #else
     va_list ap;
     if (!msg)
@@ -1329,7 +1314,7 @@ osi_Panic(char *msg, ...)
 # ifdef AFS_LINUX20_ENV
     * ((char *) 0) = 0;
 # else
-    panic(msg);
+    panic("%s", msg);
 # endif
 #endif
 }