svc_run.c 2.0 KB

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