xref: /csrg-svn/lib/librpc/rpc/svc_run.c (revision 45092)
1*45092Smckusick /* @(#)svc_run.c	2.1 88/07/29 4.0 RPCSRC */
2*45092Smckusick #if !defined(lint) && defined(SCCSIDS)
3*45092Smckusick static char sccsid[] = "@(#)svc_run.c 1.1 87/10/13 Copyr 1984 Sun Micro";
4*45092Smckusick #endif
5*45092Smckusick 
6*45092Smckusick /*
7*45092Smckusick  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
8*45092Smckusick  * unrestricted use provided that this legend is included on all tape
9*45092Smckusick  * media and as a part of the software program in whole or part.  Users
10*45092Smckusick  * may copy or modify Sun RPC without charge, but are not authorized
11*45092Smckusick  * to license or distribute it to anyone else except as part of a product or
12*45092Smckusick  * program developed by the user.
13*45092Smckusick  *
14*45092Smckusick  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
15*45092Smckusick  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
16*45092Smckusick  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
17*45092Smckusick  *
18*45092Smckusick  * Sun RPC is provided with no support and without any obligation on the
19*45092Smckusick  * part of Sun Microsystems, Inc. to assist in its use, correction,
20*45092Smckusick  * modification or enhancement.
21*45092Smckusick  *
22*45092Smckusick  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
23*45092Smckusick  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
24*45092Smckusick  * OR ANY PART THEREOF.
25*45092Smckusick  *
26*45092Smckusick  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
27*45092Smckusick  * or profits or other special, indirect and consequential damages, even if
28*45092Smckusick  * Sun has been advised of the possibility of such damages.
29*45092Smckusick  *
30*45092Smckusick  * Sun Microsystems, Inc.
31*45092Smckusick  * 2550 Garcia Avenue
32*45092Smckusick  * Mountain View, California  94043
33*45092Smckusick  */
34*45092Smckusick 
35*45092Smckusick /*
36*45092Smckusick  * This is the rpc server side idle loop
37*45092Smckusick  * Wait for input, call server program.
38*45092Smckusick  */
39*45092Smckusick #include <rpc/rpc.h>
40*45092Smckusick #include <sys/errno.h>
41*45092Smckusick 
42*45092Smckusick void
svc_run()43*45092Smckusick svc_run()
44*45092Smckusick {
45*45092Smckusick #ifdef FD_SETSIZE
46*45092Smckusick 	fd_set readfds;
47*45092Smckusick #else
48*45092Smckusick       int readfds;
49*45092Smckusick #endif /* def FD_SETSIZE */
50*45092Smckusick 	extern int errno;
51*45092Smckusick 
52*45092Smckusick 	for (;;) {
53*45092Smckusick #ifdef FD_SETSIZE
54*45092Smckusick 		readfds = svc_fdset;
55*45092Smckusick #else
56*45092Smckusick 		readfds = svc_fds;
57*45092Smckusick #endif /* def FD_SETSIZE */
58*45092Smckusick 		switch (select(_rpc_dtablesize(), &readfds, (int *)0, (int *)0,
59*45092Smckusick 			       (struct timeval *)0)) {
60*45092Smckusick 		case -1:
61*45092Smckusick 			if (errno == EINTR) {
62*45092Smckusick 				continue;
63*45092Smckusick 			}
64*45092Smckusick 			perror("svc_run: - select failed");
65*45092Smckusick 			return;
66*45092Smckusick 		case 0:
67*45092Smckusick 			continue;
68*45092Smckusick 		default:
69*45092Smckusick 			svc_getreqset(&readfds);
70*45092Smckusick 		}
71*45092Smckusick 	}
72*45092Smckusick }
73