svc_run.c 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 svc_run()
  40. {
  41. #ifdef FD_SETSIZE
  42. fd_set readfds;
  43. #else
  44. int readfds;
  45. #endif /* def FD_SETSIZE */
  46. extern int errno;
  47. for (;;) {
  48. #ifdef FD_SETSIZE
  49. readfds = svc_fdset;
  50. #else
  51. readfds = svc_fds;
  52. #endif /* def FD_SETSIZE */
  53. switch (select(_rpc_dtablesize(), &readfds, (int *) 0, (int *) 0,
  54. (struct timeval *) 0)) {
  55. case -1:
  56. if (errno == EINTR) {
  57. continue;
  58. }
  59. perror("svc_run: - select failed");
  60. return;
  61. case 0:
  62. continue;
  63. default:
  64. svc_getreqset(&readfds);
  65. }
  66. }
  67. }