Back to index

glibc  2.9
Functions
svc_run.c File Reference
#include <errno.h>
#include <unistd.h>
#include <libintl.h>
#include <sys/poll.h>
#include <rpc/rpc.h>

Go to the source code of this file.

Functions

void svc_exit (void)
void svc_run (void)

Function Documentation

void svc_exit ( void  )

Definition at line 43 of file svc_run.c.

void svc_run ( void  )

Definition at line 51 of file svc_run.c.

{
  int i;
  struct pollfd *my_pollfd = NULL;
  int last_max_pollfd = 0;

  for (;;)
    {
      int max_pollfd = svc_max_pollfd;
      if (max_pollfd == 0 && svc_pollfd == NULL)
       break;

      if (last_max_pollfd != max_pollfd)
       {
         struct pollfd *new_pollfd
           = realloc (my_pollfd, sizeof (struct pollfd) * max_pollfd);

         if (new_pollfd == NULL)
           {
             perror (_("svc_run: - out of memory"));
             break;
           }

         my_pollfd = new_pollfd;
         last_max_pollfd = max_pollfd;
       }

      for (i = 0; i < max_pollfd; ++i)
       {
         my_pollfd[i].fd = svc_pollfd[i].fd;
         my_pollfd[i].events = svc_pollfd[i].events;
         my_pollfd[i].revents = 0;
       }

      switch (i = __poll (my_pollfd, max_pollfd, -1))
       {
       case -1:
         if (errno == EINTR)
           continue;
         perror (_("svc_run: - poll failed"));
         break;
       case 0:
         continue;
       default:
         INTUSE(svc_getreq_poll) (my_pollfd, i);
         continue;
       }
      break;
    }

  free (my_pollfd);
}

Here is the call graph for this function:

Here is the caller graph for this function: