]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE12-rx-avoid-using-newproc-on-solaris-20020812
authorNickolai Zeldovich <kolya@mit.edu>
Sat, 11 Jan 2003 07:48:58 +0000 (07:48 +0000)
committerDerrick Brashear <shadow@dementia.org>
Sat, 11 Jan 2003 07:48:58 +0000 (07:48 +0000)
Second attempt at avoiding the use of newproc() on Solaris.
This time, use thread_create to spawn a kernel thread, and
use a dummy packet to wake up the listener during shutdown.

(cherry picked from commit 5d3545610b83905e220d18c948d0fc621db851a5)

src/rx/SOLARIS/rx_knet.c
src/rx/rx_kcommon.c
src/rx/rx_kcommon.h
src/rx/rx_pthread.c
src/rx/rx_rdwr.c

index a2a75ca0c8a54382402731a75d3b2db3786903d0..bd2f1faf5bb621e554c8c7805744b32100b27b9c 100644 (file)
@@ -292,11 +292,21 @@ int osi_FreeSocket(asocket)
 {
     extern int rxk_ListenerPid;
     struct sonode *so = (struct sonode *)asocket;
-    vnode_t *vp = SOTOV(so);
+    struct sockaddr_in taddr;
+    struct iovec dvec;
+    char c;
 
     AFS_STATCNT(osi_FreeSocket);
+
+    taddr.sin_family = AF_INET;
+    taddr.sin_port = htons(rx_port);
+    taddr.sin_addr.s_addr = htonl(0x7f000001);
+
+    dvec.iov_base = &c;
+    dvec.iov_len = 1;
+
     while (rxk_ListenerPid) {
-       kill(rxk_ListenerPid, SIGUSR1);
+       osi_NetSend(rx_socket, &taddr, &dvec, 1, 1, 0);
        afs_osi_Sleep(&rxk_ListenerPid);
     }
 
index eadc1a38e10843b29b0451cfa4ead9ed5ab6c3b1..4105a72fc6c6cb2f900bb29ed951acbaed1e065e 100644 (file)
@@ -1024,14 +1024,15 @@ int rxk_ListenerPid; /* Used to signal process to wakeup at shutdown */
 
 #ifdef AFS_SUN5_ENV
 /*
- * Run the listener as a kernel process.
+ * Run the listener as a kernel thread.
  */
 void rxk_Listener(void)
 {
     extern id_t syscid;
     void rxk_ListenerProc(void);
-    if (newproc(rxk_ListenerProc, syscid, 59))
-       osi_Panic("rxk_Listener: failed to fork listener process!\n");
+    if (thread_create(NULL, DEFAULTSTKSZ, rxk_ListenerProc,
+       0, 0, &p0, TS_RUN, minclsyspri) == NULL)
+       osi_Panic("rxk_Listener: failed to start listener thread!\n");
 }
 
 void rxk_ListenerProc(void)
@@ -1047,7 +1048,7 @@ void rxk_Listener(void)
     rxk_ListenerPid = current->pid;
 #endif
 #ifdef AFS_SUN5_ENV
-    rxk_ListenerPid = ttoproc(curthread)->p_pidp->pid_id;
+    rxk_ListenerPid = 1;      /* No PID, just a flag that we're alive */
 #endif /* AFS_SUN5_ENV */
 #ifdef AFS_FBSD_ENV
     rxk_ListenerPid = curproc->p_pid;
@@ -1091,11 +1092,6 @@ void rxk_Listener(void)
 #endif
 #ifdef AFS_SUN5_ENV
     AFS_GUNLOCK();
-#ifdef HAVE_P_COREFILE
-    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 */
 }
 
index 4ac04c2c470dee286f59d9efc69438a792ae1a8f..0eacd8aaec83d5f03544807d8c3d9bd7e0cd3c6b 100644 (file)
@@ -30,6 +30,7 @@ typedef unsigned short                  etap_event_t;
 #include "../h/vfs.h"          /* stops SUN56 socketvar.h warnings */
 #include "../h/stropts.h"      /* stops SUN56 socketvar.h warnings */
 #include "../h/stream.h"       /* stops SUN56 socketvar.h errors */
+#include "../h/disp.h"
 #endif
 #include "../h/socket.h"
 #ifndef AFS_LINUX22_ENV
index 295913f24dbc742528c005273ffd98ba8bc0dee7..17f88813aaa4e1477ecf93452c4b07acf5ed3c8b 100644 (file)
@@ -53,7 +53,7 @@ static long rx_pthread_n_event_wakeups;
  */
 static int rx_pthread_event_rescheduled = 0;
 
-static void rx_ListenerProc(void *);
+static void *rx_ListenerProc(void *);
 
 /*
  * We supply an event handling thread for Rx's event processing.
@@ -204,7 +204,7 @@ int sock;
 int *tnop;
 struct rx_call **newcallp;
 {
-    u_long host;
+    unsigned int host;
     u_short port;
     register struct rx_packet *p = (struct rx_packet *)0;
 
@@ -245,7 +245,7 @@ struct rx_call **newcallp;
 /* This is the listener process request loop. The listener process loop
  * becomes a server thread when rxi_ListenerProc returns, and stays
  * server thread until rxi_ServerProc returns. */
-static void rx_ListenerProc(void *argp)
+static void *rx_ListenerProc(void *argp)
 {
     int threadID;
     int sock = (int) argp;
index ffadf87e012e99421ffaac05c14e627fbf133830..19d532c0891707e63dcb7cc96307571c08e0894f 100644 (file)
@@ -1065,7 +1065,7 @@ int rx_WritevAlloc(call, iov, nio, maxio, nbytes)
     int maxio;
     int nbytes;
 {
-    int bytes;
+    char bytes;
     SPLVAR;
 
     NETPRI;