Import TBBT (NFS trace replay).
[bluesky.git] / TBBT / trace_play / rpc / svc_run.c
1 #ifndef lint
2 static char sfs_svc_run_id[] = "@(#)svc_run.c     2.1     97/10/23";
3 #endif
4 /* @(#)svc_run.c        2.1 88/07/29 4.0 RPCSRC */
5 #if !defined(lint) && defined(SCCSIDS)
6 static char sccsid[] = "@(#)svc_run.c 1.1 87/10/13 Copyr 1984 Sun Micro";
7 #endif
8
9 /*
10  *   Copyright (c) 1992-1997,2001 by Standard Performance Evaluation Corporation
11  *      All rights reserved.
12  *              Standard Performance Evaluation Corporation (SPEC)
13  *              6585 Merchant Place, Suite 100
14  *              Warrenton, VA 20187
15  *
16  *      This product contains benchmarks acquired from several sources who
17  *      understand and agree with SPEC's goal of creating fair and objective
18  *      benchmarks to measure computer performance.
19  *
20  *      This copyright notice is placed here only to protect SPEC in the
21  *      event the source is misused in any manner that is contrary to the
22  *      spirit, the goals and the intent of SPEC.
23  *
24  *      The source code is provided to the user or company under the license
25  *      agreement for the SPEC Benchmark Suite for this product.
26  */
27 /*
28  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
29  * unrestricted use provided that this legend is included on all tape
30  * media and as a part of the software program in whole or part.  Users
31  * may copy or modify Sun RPC without charge, but are not authorized
32  * to license or distribute it to anyone else except as part of a product or
33  * program developed by the user.
34  * 
35  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
36  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
37  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
38  * 
39  * Sun RPC is provided with no support and without any obligation on the
40  * part of Sun Microsystems, Inc. to assist in its use, correction,
41  * modification or enhancement.
42  * 
43  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
44  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
45  * OR ANY PART THEREOF.
46  * 
47  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
48  * or profits or other special, indirect and consequential damages, even if
49  * Sun has been advised of the possibility of such damages.
50  * 
51  * Sun Microsystems, Inc.
52  * 2550 Garcia Avenue
53  * Mountain View, California  94043
54  */
55
56 /*
57  * This is the rpc server side idle loop
58  * Wait for input, call server program.
59  */
60 #include "rpc/rpc.h"
61 #include <errno.h>
62
63 void
64 svc_run(void)
65 {
66 #ifdef FD_SETSIZE
67         fd_set readfds;
68 #else
69         int readfds;
70 #endif /* def FD_SETSIZE */
71         extern int errno;
72
73         for (;;) {
74 #ifdef FD_SETSIZE
75                 readfds = svc_fdset;
76 #else
77                 readfds = svc_fds;
78 #endif /* def FD_SETSIZE */
79                 switch (select(_rpc_dtablesize(), &readfds, NULL, NULL,
80                                NULL)) {
81                 case -1:
82                         if (errno == EINTR) {
83                                 continue;
84                         }
85                         perror("svc_run: - select failed");
86                         return;
87                 case 0:
88                         continue;
89                 default:
90                         svc_getreqset(&readfds);
91                 }
92         }
93 }