home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / comm / tcp / amitcp-sdk / src / rpclib / svc_run.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-29  |  1.1 KB  |  54 lines

  1. /*
  2.  *      $Id: svc_run.c,v 4.2 1994/09/29 23:48:50 jraja Exp $
  3.  *
  4.  *      The rpc server side idle loop: Wait for input, call server program.
  5.  *
  6.  *      Copyright © 1994 AmiTCP/IP Group,
  7.  *                       Network Solutions Development Inc.
  8.  *                       All rights reserved. 
  9.  */
  10.  
  11. /* @(#)svc_run.c    2.1 88/07/29 4.0 RPCSRC */
  12. #if !defined(lint) && defined(SCCSIDS)
  13. static char sccsid[] = "@(#)svc_run.c 1.1 87/10/13 Copyr 1984 Sun Micro";
  14. #endif
  15.  
  16. #include <sys/param.h>
  17. #include <rpc/rpc.h>
  18. #include <errno.h>
  19. #include <sys/socket.h>
  20.  
  21. void
  22. svc_run()
  23. {
  24. #ifdef FD_SETSIZE
  25.     fd_set readfds;
  26. #else
  27.       int readfds;
  28. #endif /* def FD_SETSIZE */
  29.  
  30.     for (;;) {
  31. #ifdef FD_SETSIZE
  32.         readfds = svc_fdset;
  33. #else
  34.         readfds = svc_fds;
  35. #endif /* def FD_SETSIZE */
  36.     
  37.     switch (select(_rpc_dtablesize(), &readfds, NULL, NULL,
  38.                    NULL)) {
  39.         case -1:
  40. #ifndef AMITCP /* EINTR is returned in case of a CTRL-C by default */
  41.             if (errno == EINTR) {
  42.                 continue;
  43.             }
  44. #endif
  45.             perror("svc_run: - select failed");
  46.             return;
  47.         case 0:
  48.             continue;
  49.         default:
  50.             svc_getreqset(&readfds);
  51.         }
  52.     }
  53. }
  54.