about summary refs log tree commit diff
path: root/sunrpc
diff options
context:
space:
mode:
Diffstat (limited to 'sunrpc')
-rw-r--r--sunrpc/rpc/svc.h7
-rw-r--r--sunrpc/svc_run.c15
2 files changed, 19 insertions, 3 deletions
diff --git a/sunrpc/rpc/svc.h b/sunrpc/rpc/svc.h
index 6a36900908..6b308f356e 100644
--- a/sunrpc/rpc/svc.h
+++ b/sunrpc/rpc/svc.h
@@ -269,9 +269,10 @@ extern int svc_fds;
  * a small program implemented by the svc_rpc implementation itself;
  * also see clnt.h for protocol numbers.
  */
-extern void	svc_getreq __P ((int __rdfds));
-extern void	svc_getreqset __P ((fd_set *readfds));
-extern void	svc_run __P ((void)); /* __attribute__ ((noreturn)) */
+extern void svc_getreq __P ((int __rdfds));
+extern void svc_getreqset __P ((fd_set *__readfds));
+extern void svc_exit __P ((void));
+extern void svc_run __P ((void));
 
 /*
  * Socket to use on svcxxx_create call to get default socket
diff --git a/sunrpc/svc_run.c b/sunrpc/svc_run.c
index 0f59637fd1..021484d864 100644
--- a/sunrpc/svc_run.c
+++ b/sunrpc/svc_run.c
@@ -39,6 +39,16 @@ static char sccsid[] = "@(#)svc_run.c 1.1 87/10/13 Copyr 1984 Sun Micro";
 #include <errno.h>
 #include <rpc/rpc.h>
 
+static int svc_stop = 0;
+
+/* This function can be used as a signal handler to terminate the
+   server loop.  */
+void
+svc_exit (void)
+{
+  svc_stop = 1;
+}
+
 void
 svc_run (void)
 {
@@ -48,8 +58,13 @@ svc_run (void)
   int readfds;
 #endif /* def FD_SETSIZE */
 
+  svc_stop = 0;
+
   for (;;)
     {
+      if (svc_stop)
+	return;
+
 #ifdef FD_SETSIZE
       readfds = svc_fdset;
 #else