]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
rx don't exit
authorDerrick Brashear <shadow@dementia.org>
Wed, 21 Oct 2009 18:43:26 +0000 (14:43 -0400)
committerJeffrey Altman <jaltman|account-1000011@unknown>
Wed, 21 Oct 2009 23:49:41 +0000 (16:49 -0700)
exiting in library code is antisocial. if rx encounters an error
which cannot be returned and would otherwise indicate a service thread
has gone away, assert.

Reviewed-on: http://gerrit.openafs.org/668
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Tom Keiser <tkeiser@sinenomine.net>
src/rx/rx_clock.c
src/rx/rx_lwp.c
src/rx/rx_pthread.c

index 64fc6bb080d7128e6404c213f58a45440d43385a..08385f91b27496eef78f198b6457d3f5fdb3f7a0 100644 (file)
@@ -41,6 +41,7 @@
 #include <stdio.h>
 #include <errno.h>
 #include <stdlib.h>
+#include <assert.h>
 #include "rx.h"
 #include "rx_clock.h"
 #endif
@@ -76,7 +77,7 @@ clock_Sync(void)
        fprintf(stderr, "clock:  could not set interval timer; \
                                aborted(errno=%d)\n", errno);
        fflush(stderr);
-       exit(1);
+       assert(0);
     }
     if (relclock_epoch.usec + startvalue.usec >= otimer.it_value.tv_usec) {
        relclock_epoch.sec = relclock_epoch.sec +
index 2366cbc113d40bcec39fd9d9e665607a4cd37b3a..a741e232857068bc95e259423b78e456abe7c3a6 100644 (file)
@@ -41,6 +41,7 @@
 # include <net/if.h>
 # include <sys/ioctl.h>
 # include <sys/time.h>
+# include <assert.h>
 #endif
 # include "rx.h"
 # include "rx_globals.h"
@@ -179,7 +180,7 @@ rxi_ListenerProc(fd_set * rfds, int *tnop, struct rx_call **newcallp)
     code = LWP_CurrentProcess(&pid);
     if (code) {
        fprintf(stderr, "rxi_Listener: Can't get my pid.\n");
-       exit(1);
+       assert(0);
     }
     rx_listenerPid = pid;
     if (swapNameProgram)
index 394e14e73e0ca016afe6ec48f8af530759a3dd2f..6496eefaa3abd0744f4fb464556e11aa1f8915a0 100644 (file)
@@ -106,13 +106,13 @@ rxi_StartServerProc(void *(*proc) (void *), int stacksize)
 
     if (pthread_attr_init(&tattr) != 0) {
        dpf(("Unable to Create Rx server thread (pthread_attr_init)\n"));
-       exit(1);
+       assert(0);
     }
 
     if (pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED) != 0) {
        dpf
            (("Unable to Create Rx server thread (pthread_attr_setdetachstate)\n"));
-       exit(1);
+       assert(0);
     }
 
     /*
@@ -121,7 +121,7 @@ rxi_StartServerProc(void *(*proc) (void *), int stacksize)
     AFS_SIGSET_CLEAR();
     if (pthread_create(&thread, &tattr, server_entry, (void *)proc) != 0) {
        dpf(("Unable to Create Rx server thread\n"));
-       exit(1);
+       assert(0);
     }
     AFS_SIGSET_RESTORE();
 }
@@ -223,7 +223,7 @@ rxi_ListenerProc(osi_socket sock, int *tnop, struct rx_call **newcallp)
            if (!(p = rxi_AllocPacket(RX_PACKET_CLASS_RECEIVE))) {
                /* Could this happen with multiple socket listeners? */
                dpf(("rxi_Listener: no packets!"));     /* Shouldn't happen */
-               exit(1);
+               assert(0);
            }
        }
 
@@ -334,20 +334,20 @@ rxi_StartListener(void)
     if (pthread_attr_init(&tattr) != 0) {
        dpf
            (("Unable to create Rx event handling thread (pthread_attr_init)\n"));
-       exit(1);
+       assert(0);
     }
 
     if (pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED) != 0) {
        dpf
            (("Unable to create Rx event handling thread (pthread_attr_setdetachstate)\n"));
-       exit(1);
+       assert(0);
     }
 
     AFS_SIGSET_CLEAR();
     if (pthread_create(&event_handler_thread, &tattr, event_handler, NULL) !=
        0) {
        dpf(("Unable to create Rx event handling thread\n"));
-       exit(1);
+       assert(0);
     }
     MUTEX_ENTER(&rx_pthread_mutex);
     ++rxi_pthread_hinum;
@@ -374,19 +374,19 @@ rxi_Listen(osi_socket sock)
     if (pthread_attr_init(&tattr) != 0) {
        dpf
            (("Unable to create socket listener thread (pthread_attr_init)\n"));
-       exit(1);
+       assert(0);
     }
 
     if (pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED) != 0) {
        dpf
            (("Unable to create socket listener thread (pthread_attr_setdetachstate)\n"));
-       exit(1);
+       assert(0);
     }
 
     AFS_SIGSET_CLEAR();
     if (pthread_create(&thread, &tattr, rx_ListenerProc, (void *)(intptr_t)sock) != 0) {
        dpf(("Unable to create socket listener thread\n"));
-       exit(1);
+       assert(0);
     }
     MUTEX_ENTER(&rx_pthread_mutex);
     ++rxi_pthread_hinum;