]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Second attempt at avoiding the use of newproc() on Solaris.
authorNickolai Zeldovich <kolya@mit.edu>
Mon, 12 Aug 2002 22:31:03 +0000 (22:31 +0000)
committerNickolai Zeldovich <kolya@mit.edu>
Mon, 12 Aug 2002 22:31:03 +0000 (22:31 +0000)
This time, use thread_create to spawn a kernel thread, and
use a dummy packet to wake up the listener during shutdown.

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 42bee20912641bdffa9f0a7a43ba0eaf5dd32ebd..318e72b75809fa6154d04e17fddf5b88f33e5421 100644 (file)
@@ -1001,14 +1001,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)
@@ -1024,11 +1025,11 @@ void rxk_Listener(void)
     rxk_ListenerPid = current->pid;
 #endif
 #ifdef AFS_SUN5_ENV
-    rxk_ListenerPid = curproc->p_pid;
+    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;
-#endif /* AFS_SUN5_ENV */
+#endif /* AFS_FBSD_ENV */
 #if defined(AFS_DARWIN_ENV)
     rxk_ListenerPid = current_proc()->p_pid;
 #endif
@@ -1065,11 +1066,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 c83c88f5b1f85fa0f58afa1e17737fa5264fe826..0a758aaea03fc8aa6f34e660c85cb2210896479b 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;