2 * Copyright (C) 1984 Sun Microsystems, Inc.
3 * Modified by Jeffrey A. Uphoff, 1995, 1997-1999.
4 * Modified by Olaf Kirch, 1996.
10 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
11 * unrestricted use provided that this legend is included on all tape
12 * media and as a part of the software program in whole or part. Users
13 * may copy or modify Sun RPC without charge, but are not authorized
14 * to license or distribute it to anyone else except as part of a product or
15 * program developed by the user.
17 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
18 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
21 * Sun RPC is provided with no support and without any obligation on the
22 * part of Sun Microsystems, Inc. to assist in its use, correction,
23 * modification or enhancement.
25 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
26 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
27 * OR ANY PART THEREOF.
29 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
30 * or profits or other special, indirect and consequential damages, even if
31 * Sun has been advised of the possibility of such damages.
33 * Sun Microsystems, Inc.
35 * Mountain View, California 94043
39 * This has been modified for my own evil purposes to prevent deadlocks
40 * when two hosts start NSM's simultaneously and try to notify each
41 * other (which mainly occurs during testing), or to stop and smell the
42 * roses when I have callbacks due.
47 * This is the RPC server side idle loop.
48 * Wait for input, call server program.
55 static int svc_stop = 0;
58 * This is the global notify list onto which all SM_NOTIFY and CALLBACK
61 notify_list * notify = NULL;
74 * The heart of the server. A crib from libc for the most part...
89 /* Ah, there are some notifications to be processed */
90 while (notify && NL_WHEN(notify) <= time(&now)) {
91 process_notify_list();
98 tv.tv_sec = NL_WHEN(notify) - now;
100 dprintf(L_DEBUG, "Waiting for reply... (timeo %d)",
102 selret = select(FD_SETSIZE, &readfds,
103 (void *) 0, (void *) 0, &tv);
105 dprintf(L_DEBUG, "Waiting for client connections.");
106 selret = select(FD_SETSIZE, &readfds,
107 (void *) 0, (void *) 0, (struct timeval *) 0);
112 if (errno == EINTR || errno == ECONNREFUSED
113 || errno == ENETUNREACH || errno == EHOSTUNREACH)
115 log(L_ERROR, "my_svc_run() - select: %m");
119 /* A notify/callback timed out. */
123 selret -= process_reply(&readfds);
125 svc_getreqset(&readfds);