svc_run.c 2.0 KB

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