Back to index

glibc  2.9
Classes | Defines | Typedefs | Enumerations | Functions | Variables
svc.h File Reference
#include <features.h>
#include <rpc/rpc_msg.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  SVCXPRT
struct  SVCXPRT::xp_ops
struct  svc_req

Defines

#define svc_getcaller(x)   (&(x)->xp_raddr)
#define SVC_RECV(xprt, msg)   (*(xprt)->xp_ops->xp_recv)((xprt), (msg))
#define svc_recv(xprt, msg)   (*(xprt)->xp_ops->xp_recv)((xprt), (msg))
#define SVC_STAT(xprt)   (*(xprt)->xp_ops->xp_stat)(xprt)
#define svc_stat(xprt)   (*(xprt)->xp_ops->xp_stat)(xprt)
#define SVC_GETARGS(xprt, xargs, argsp)   (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp))
#define svc_getargs(xprt, xargs, argsp)   (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp))
#define SVC_REPLY(xprt, msg)   (*(xprt)->xp_ops->xp_reply) ((xprt), (msg))
#define svc_reply(xprt, msg)   (*(xprt)->xp_ops->xp_reply) ((xprt), (msg))
#define SVC_FREEARGS(xprt, xargs, argsp)   (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp))
#define svc_freeargs(xprt, xargs, argsp)   (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp))
#define SVC_DESTROY(xprt)   (*(xprt)->xp_ops->xp_destroy)(xprt)
#define svc_destroy(xprt)   (*(xprt)->xp_ops->xp_destroy)(xprt)
#define __DISPATCH_FN_T
#define svc_fds   svc_fdset.fds_bits[0] /* compatibility */
#define RPC_ANYSOCK   -1

Typedefs

typedef struct SVCXPRT
typedef void(* __dispatch_fn_t )(struct svc_req *, SVCXPRT *)

Enumerations

enum  xprt_stat { XPRT_DIED, XPRT_MOREREQS, XPRT_IDLE }

Functions

bool_t svc_register (SVCXPRT *__xprt, rpcprog_t __prog, rpcvers_t __vers, __dispatch_fn_t __dispatch, rpcprot_t __protocol) __THROW
void svc_unregister (rpcprog_t __prog, rpcvers_t __vers) __THROW
void xprt_register (SVCXPRT *__xprt) __THROW
void xprt_unregister (SVCXPRT *__xprt) __THROW
bool_t svc_sendreply (SVCXPRT *xprt, xdrproc_t __xdr_results, caddr_t __xdr_location) __THROW
void svcerr_decode (SVCXPRT *__xprt) __THROW
void svcerr_weakauth (SVCXPRT *__xprt) __THROW
void svcerr_noproc (SVCXPRT *__xprt) __THROW
void svcerr_progvers (SVCXPRT *__xprt, rpcvers_t __low_vers, rpcvers_t __high_vers) __THROW
void svcerr_auth (SVCXPRT *__xprt, enum auth_stat __why) __THROW
void svcerr_noprog (SVCXPRT *__xprt) __THROW
void svcerr_systemerr (SVCXPRT *__xprt) __THROW
void svc_getreq (int __rdfds) __THROW
void svc_getreq_common (const int __fd) __THROW
void svc_getreqset (fd_set *__readfds) __THROW
void svc_getreq_poll (struct pollfd *, const int) __THROW
void svc_exit (void) __THROW
void svc_run (void) __THROW
SVCXPRTsvcraw_create (void) __THROW
SVCXPRTsvcudp_create (int __sock) __THROW
SVCXPRTsvcudp_bufcreate (int __sock, u_int __sendsz, u_int __recvsz) __THROW
SVCXPRTsvctcp_create (int __sock, u_int __sendsize, u_int __recvsize) __THROW
SVCXPRTsvcfd_create (int __sock, u_int __sendsize, u_int __recvsize) __THROW
SVCXPRTsvcunix_create (int __sock, u_int __sendsize, u_int __recvsize, char *__path) __THROW

Variables

struct pollfdsvc_pollfd
int svc_max_pollfd
fd_set svc_fdset

Class Documentation

struct SVCXPRT

Definition at line 76 of file svc.h.

Collaboration diagram for SVCXPRT:
Class Members
int xp_addrlen
struct xp_ops * xp_ops
caddr_t xp_p1
caddr_t xp_p2
char xp_pad
u_short xp_port
int xp_sock
struct svc_req

Definition at line 149 of file svc.h.

Collaboration diagram for svc_req:
Class Members
caddr_t rq_clntcred
rpcproc_t rq_proc
rpcprog_t rq_prog
rpcvers_t rq_vers
SVCXPRT * rq_xprt

Define Documentation

#define __DISPATCH_FN_T

Definition at line 159 of file svc.h.

#define RPC_ANYSOCK   -1

Definition at line 282 of file svc.h.

#define SVC_DESTROY (   xprt)    (*(xprt)->xp_ops->xp_destroy)(xprt)

Definition at line 140 of file svc.h.

#define svc_destroy (   xprt)    (*(xprt)->xp_ops->xp_destroy)(xprt)

Definition at line 142 of file svc.h.

#define svc_fds   svc_fdset.fds_bits[0] /* compatibility */

Definition at line 266 of file svc.h.

#define SVC_FREEARGS (   xprt,
  xargs,
  argsp 
)    (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp))

Definition at line 135 of file svc.h.

#define svc_freeargs (   xprt,
  xargs,
  argsp 
)    (*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp))

Definition at line 137 of file svc.h.

#define SVC_GETARGS (   xprt,
  xargs,
  argsp 
)    (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp))

Definition at line 125 of file svc.h.

#define svc_getargs (   xprt,
  xargs,
  argsp 
)    (*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp))

Definition at line 127 of file svc.h.

#define svc_getcaller (   x)    (&(x)->xp_raddr)

Definition at line 105 of file svc.h.

#define SVC_RECV (   xprt,
  msg 
)    (*(xprt)->xp_ops->xp_recv)((xprt), (msg))

Definition at line 115 of file svc.h.

#define svc_recv (   xprt,
  msg 
)    (*(xprt)->xp_ops->xp_recv)((xprt), (msg))

Definition at line 117 of file svc.h.

#define SVC_REPLY (   xprt,
  msg 
)    (*(xprt)->xp_ops->xp_reply) ((xprt), (msg))

Definition at line 130 of file svc.h.

#define svc_reply (   xprt,
  msg 
)    (*(xprt)->xp_ops->xp_reply) ((xprt), (msg))

Definition at line 132 of file svc.h.

#define SVC_STAT (   xprt)    (*(xprt)->xp_ops->xp_stat)(xprt)

Definition at line 120 of file svc.h.

#define svc_stat (   xprt)    (*(xprt)->xp_ops->xp_stat)(xprt)

Definition at line 122 of file svc.h.


Typedef Documentation

typedef void(* __dispatch_fn_t)(struct svc_req *, SVCXPRT *)

Definition at line 160 of file svc.h.

typedef struct SVCXPRT

Definition at line 75 of file svc.h.


Enumeration Type Documentation

enum xprt_stat
Enumerator:
XPRT_DIED 
XPRT_MOREREQS 
XPRT_IDLE 

Definition at line 66 of file svc.h.


Function Documentation

void svc_exit ( void  )

Definition at line 43 of file svc_run.c.

void svc_getreq ( int  __rdfds)

Here is the caller graph for this function:

void svc_getreq_common ( const int  __fd)

Definition at line 427 of file svc.c.

{
  enum xprt_stat stat;
  struct rpc_msg msg;
  register SVCXPRT *xprt;
  char cred_area[2 * MAX_AUTH_BYTES + RQCRED_SIZE];
  msg.rm_call.cb_cred.oa_base = cred_area;
  msg.rm_call.cb_verf.oa_base = &(cred_area[MAX_AUTH_BYTES]);

  xprt = xports[fd];
  /* Do we control fd? */
  if (xprt == NULL)
     return;

  /* now receive msgs from xprtprt (support batch calls) */
  do
    {
      if (SVC_RECV (xprt, &msg))
       {
         /* now find the exported program and call it */
         struct svc_callout *s;
         struct svc_req r;
         enum auth_stat why;
         rpcvers_t low_vers;
         rpcvers_t high_vers;
         int prog_found;

         r.rq_clntcred = &(cred_area[2 * MAX_AUTH_BYTES]);
         r.rq_xprt = xprt;
         r.rq_prog = msg.rm_call.cb_prog;
         r.rq_vers = msg.rm_call.cb_vers;
         r.rq_proc = msg.rm_call.cb_proc;
         r.rq_cred = msg.rm_call.cb_cred;

         /* first authenticate the message */
         /* Check for null flavor and bypass these calls if possible */

         if (msg.rm_call.cb_cred.oa_flavor == AUTH_NULL)
           {
             r.rq_xprt->xp_verf.oa_flavor = _null_auth.oa_flavor;
             r.rq_xprt->xp_verf.oa_length = 0;
           }
         else if ((why = INTUSE(_authenticate) (&r, &msg)) != AUTH_OK)
           {
             svcerr_auth (xprt, why);
             goto call_done;
           }

         /* now match message with a registered service */
         prog_found = FALSE;
         low_vers = 0 - 1;
         high_vers = 0;

         for (s = svc_head; s != NULL_SVC; s = s->sc_next)
           {
             if (s->sc_prog == r.rq_prog)
              {
                if (s->sc_vers == r.rq_vers)
                  {
                    (*s->sc_dispatch) (&r, xprt);
                    goto call_done;
                  }
                /* found correct version */
                prog_found = TRUE;
                if (s->sc_vers < low_vers)
                  low_vers = s->sc_vers;
                if (s->sc_vers > high_vers)
                  high_vers = s->sc_vers;
              }
             /* found correct program */
           }
         /* if we got here, the program or version
            is not served ... */
         if (prog_found)
           svcerr_progvers (xprt, low_vers, high_vers);
         else
           svcerr_noprog (xprt);
         /* Fall through to ... */
       }
    call_done:
      if ((stat = SVC_STAT (xprt)) == XPRT_DIED)
       {
         SVC_DESTROY (xprt);
         break;
       }
    }
  while (stat == XPRT_MOREREQS);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void svc_getreq_poll ( struct pollfd ,
const int   
)

Definition at line 400 of file svc.c.

{
  if (pollretval == 0)
    return;

  register int fds_found;
  for (int i = fds_found = 0; i < svc_max_pollfd; ++i)
    {
      register struct pollfd *p = &pfdp[i];

      if (p->fd != -1 && p->revents)
       {
         /* fd has input waiting */
         if (p->revents & POLLNVAL)
           xprt_unregister (xports[p->fd]);
         else
           INTUSE(svc_getreq_common) (p->fd);

         if (++fds_found >= pollretval)
           break;
       }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void svc_getreqset ( fd_set __readfds)

Definition at line 381 of file svc.c.

{
  register fd_mask mask;
  register fd_mask *maskp;
  register int setsize;
  register int sock;
  register int bit;

  setsize = _rpc_dtablesize ();
  if (setsize > FD_SETSIZE)
    setsize = FD_SETSIZE;
  maskp = readfds->fds_bits;
  for (sock = 0; sock < setsize; sock += NFDBITS)
    for (mask = *maskp++; (bit = ffsl (mask)); mask ^= (1L << (bit - 1)))
      INTUSE(svc_getreq_common) (sock + bit - 1);
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool_t svc_register ( SVCXPRT __xprt,
rpcprog_t  __prog,
rpcvers_t  __vers,
__dispatch_fn_t  __dispatch,
rpcprot_t  __protocol 
)

Definition at line 179 of file svc.c.

{
  struct svc_callout *prev;
  register struct svc_callout *s;

  if ((s = svc_find (prog, vers, &prev)) != NULL_SVC)
    {
      if (s->sc_dispatch == dispatch)
       goto pmap_it;        /* he is registering another xptr */
      return FALSE;
    }
  s = (struct svc_callout *) mem_alloc (sizeof (struct svc_callout));
  if (s == (struct svc_callout *) 0)
    return FALSE;

  s->sc_prog = prog;
  s->sc_vers = vers;
  s->sc_dispatch = dispatch;
  s->sc_next = svc_head;
  s->sc_mapped = FALSE;
  svc_head = s;

pmap_it:
  /* now register the information with the local binder service */
  if (protocol)
    {
      if (! pmap_set (prog, vers, protocol, xprt->xp_port))
       return FALSE;

      s->sc_mapped = TRUE;
    }

  return TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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:

bool_t svc_sendreply ( SVCXPRT xprt,
xdrproc_t  __xdr_results,
caddr_t  __xdr_location 
)

Here is the caller graph for this function:

void svc_unregister ( rpcprog_t  __prog,
rpcvers_t  __vers 
)
void svcerr_auth ( SVCXPRT __xprt,
enum auth_stat  __why 
)

Definition at line 301 of file svc.c.

{
  struct rpc_msg rply;

  rply.rm_direction = REPLY;
  rply.rm_reply.rp_stat = MSG_DENIED;
  rply.rjcted_rply.rj_stat = AUTH_ERROR;
  rply.rjcted_rply.rj_why = why;
  SVC_REPLY (xprt, &rply);
}

Here is the caller graph for this function:

void svcerr_decode ( SVCXPRT __xprt)

Here is the caller graph for this function:

void svcerr_noproc ( SVCXPRT __xprt)
void svcerr_noprog ( SVCXPRT __xprt)

Here is the caller graph for this function:

void svcerr_progvers ( SVCXPRT __xprt,
rpcvers_t  __low_vers,
rpcvers_t  __high_vers 
)

Here is the caller graph for this function:

void svcerr_systemerr ( SVCXPRT __xprt)
void svcerr_weakauth ( SVCXPRT __xprt)
SVCXPRT* svcfd_create ( int  __sock,
u_int  __sendsize,
u_int  __recvsize 
)

Definition at line 201 of file svc_tcp.c.

{
  return makefd_xprt (fd, sendsize, recvsize);
}

Here is the call graph for this function:

SVCXPRT* svcraw_create ( void  )

Definition at line 80 of file svc_raw.c.

{
  struct svcraw_private_s *srp = svcraw_private;

  if (srp == 0)
    {
      srp = (struct svcraw_private_s *) calloc (1, sizeof (*srp));
      if (srp == 0)
       return NULL;
    }
  srp->server.xp_sock = 0;
  srp->server.xp_port = 0;
  srp->server.xp_ops = (struct xp_ops *) &server_ops;
  srp->server.xp_verf.oa_base = srp->verf_body;
  INTUSE(xdrmem_create) (&srp->xdr_stream, srp->_raw_buf, UDPMSGSIZE,
                      XDR_FREE);
  return &srp->server;
}

Here is the call graph for this function:

SVCXPRT* svctcp_create ( int  __sock,
u_int  __sendsize,
u_int  __recvsize 
)

Definition at line 143 of file svc_tcp.c.

{
  bool_t madesock = FALSE;
  SVCXPRT *xprt;
  struct tcp_rendezvous *r;
  struct sockaddr_in addr;
  socklen_t len = sizeof (struct sockaddr_in);

  if (sock == RPC_ANYSOCK)
    {
      if ((sock = __socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
       {
         perror (_("svc_tcp.c - tcp socket creation problem"));
         return (SVCXPRT *) NULL;
       }
      madesock = TRUE;
    }
  __bzero ((char *) &addr, sizeof (addr));
  addr.sin_family = AF_INET;
  if (bindresvport (sock, &addr))
    {
      addr.sin_port = 0;
      (void) __bind (sock, (struct sockaddr *) &addr, len);
    }
  if ((__getsockname (sock, (struct sockaddr *) &addr, &len) != 0) ||
      (__listen (sock, SOMAXCONN) != 0))
    {
      perror (_("svc_tcp.c - cannot getsockname or listen"));
      if (madesock)
       (void) __close (sock);
      return (SVCXPRT *) NULL;
    }
  r = (struct tcp_rendezvous *) mem_alloc (sizeof (*r));
  xprt = (SVCXPRT *) mem_alloc (sizeof (SVCXPRT));
  if (r == NULL || xprt == NULL)
    {
      (void) __fxprintf (NULL, "%s: %s", __func__, _("out of memory\n"));
      mem_free (r, sizeof (*r));
      mem_free (xprt, sizeof (SVCXPRT));
      return NULL;
    }
  r->sendsize = sendsize;
  r->recvsize = recvsize;
  xprt->xp_p2 = NULL;
  xprt->xp_p1 = (caddr_t) r;
  xprt->xp_verf = _null_auth;
  xprt->xp_ops = &svctcp_rendezvous_op;
  xprt->xp_port = ntohs (addr.sin_port);
  xprt->xp_sock = sock;
  xprt_register (xprt);
  return xprt;
}

Here is the call graph for this function:

Here is the caller graph for this function:

SVCXPRT* svcudp_bufcreate ( int  __sock,
u_int  __sendsz,
u_int  __recvsz 
)

Definition at line 112 of file svc_udp.c.

{
  bool_t madesock = FALSE;
  SVCXPRT *xprt;
  struct svcudp_data *su;
  struct sockaddr_in addr;
  socklen_t len = sizeof (struct sockaddr_in);
  int pad;
  void *buf;

  if (sock == RPC_ANYSOCK)
    {
      if ((sock = __socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
       {
         perror (_("svcudp_create: socket creation problem"));
         return (SVCXPRT *) NULL;
       }
      madesock = TRUE;
    }
  __bzero ((char *) &addr, sizeof (addr));
  addr.sin_family = AF_INET;
  if (bindresvport (sock, &addr))
    {
      addr.sin_port = 0;
      (void) __bind (sock, (struct sockaddr *) &addr, len);
    }
  if (__getsockname (sock, (struct sockaddr *) &addr, &len) != 0)
    {
      perror (_("svcudp_create - cannot getsockname"));
      if (madesock)
       (void) __close (sock);
      return (SVCXPRT *) NULL;
    }
  xprt = (SVCXPRT *) mem_alloc (sizeof (SVCXPRT));
  su = (struct svcudp_data *) mem_alloc (sizeof (*su));
  buf = mem_alloc (((MAX (sendsz, recvsz) + 3) / 4) * 4);
  if (xprt == NULL || su == NULL || buf == NULL)
    {
      (void) __fxprintf (NULL, "%s: %s",
                      "svcudp_create",  _("out of memory\n"));
      mem_free (xprt, sizeof (SVCXPRT));
      mem_free (su, sizeof (*su));
      mem_free (buf, ((MAX (sendsz, recvsz) + 3) / 4) * 4);
      return NULL;
    }
  su->su_iosz = ((MAX (sendsz, recvsz) + 3) / 4) * 4;
  rpc_buffer (xprt) = buf;
  INTUSE(xdrmem_create) (&(su->su_xdrs), rpc_buffer (xprt), su->su_iosz,
                      XDR_DECODE);
  su->su_cache = NULL;
  xprt->xp_p2 = (caddr_t) su;
  xprt->xp_verf.oa_base = su->su_verfbody;
  xprt->xp_ops = &svcudp_op;
  xprt->xp_port = ntohs (addr.sin_port);
  xprt->xp_sock = sock;

#ifdef IP_PKTINFO
  if ((sizeof (struct iovec) + sizeof (struct msghdr)
       + sizeof(struct cmsghdr) + sizeof (struct in_pktinfo))
      > sizeof (xprt->xp_pad))
    {
      (void) __fxprintf (NULL,"%s", _("\
svcudp_create: xp_pad is too small for IP_PKTINFO\n"));
      return NULL;
    }
  pad = 1;
  if (__setsockopt (sock, SOL_IP, IP_PKTINFO, (void *) &pad,
                  sizeof (pad)) == 0)
    /* Set the padding to all 1s. */
    pad = 0xff;
  else
#endif
    /* Clear the padding. */
    pad = 0;
  memset (&xprt->xp_pad [0], pad, sizeof (xprt->xp_pad));

  xprt_register (xprt);
  return xprt;
}

Here is the call graph for this function:

Here is the caller graph for this function:

SVCXPRT* svcudp_create ( int  __sock)

Definition at line 196 of file svc_udp.c.

Here is the call graph for this function:

Here is the caller graph for this function:

SVCXPRT* svcunix_create ( int  __sock,
u_int  __sendsize,
u_int  __recvsize,
char *  __path 
)

Definition at line 138 of file svc_unix.c.

{
  bool_t madesock = FALSE;
  SVCXPRT *xprt;
  struct unix_rendezvous *r;
  struct sockaddr_un addr;
  socklen_t len = sizeof (struct sockaddr_in);

  if (sock == RPC_ANYSOCK)
    {
      if ((sock = __socket (AF_UNIX, SOCK_STREAM, 0)) < 0)
       {
         perror (_("svc_unix.c - AF_UNIX socket creation problem"));
         return (SVCXPRT *) NULL;
       }
      madesock = TRUE;
    }
  memset (&addr, '\0', sizeof (addr));
  addr.sun_family = AF_UNIX;
  len = strlen (path) + 1;
  memcpy (addr.sun_path, path, len);
  len += sizeof (addr.sun_family);

  __bind (sock, (struct sockaddr *) &addr, len);

  if (__getsockname (sock, (struct sockaddr *) &addr, &len) != 0
      || __listen (sock, SOMAXCONN) != 0)
    {
      perror (_("svc_unix.c - cannot getsockname or listen"));
      if (madesock)
       __close (sock);
      return (SVCXPRT *) NULL;
    }

  r = (struct unix_rendezvous *) mem_alloc (sizeof (*r));
  xprt = (SVCXPRT *) mem_alloc (sizeof (SVCXPRT));
  if (r == NULL || xprt == NULL)
    {
      __fxprintf (NULL, "%s: %s", __func__, _("out of memory\n"));
      mem_free (r, sizeof (*r));
      mem_free (xprt, sizeof (SVCXPRT));
      return NULL;
    }
  r->sendsize = sendsize;
  r->recvsize = recvsize;
  xprt->xp_p2 = NULL;
  xprt->xp_p1 = (caddr_t) r;
  xprt->xp_verf = _null_auth;
  xprt->xp_ops = &svcunix_rendezvous_op;
  xprt->xp_port = -1;
  xprt->xp_sock = sock;
  xprt_register (xprt);
  return xprt;
}

Here is the call graph for this function:

void xprt_register ( SVCXPRT __xprt)

Definition at line 76 of file svc.c.

{
  register int sock = xprt->xp_sock;
  register int i;

  if (xports == NULL)
    {
      xports = (SVCXPRT **) malloc (_rpc_dtablesize () * sizeof (SVCXPRT *));
      if (xports == NULL) /* Donīt add handle */
       return;
    }

  if (sock < _rpc_dtablesize ())
    {
      struct pollfd *new_svc_pollfd;

      xports[sock] = xprt;
      if (sock < FD_SETSIZE)
       FD_SET (sock, &svc_fdset);

      /* Check if we have an empty slot */
      for (i = 0; i < svc_max_pollfd; ++i)
       if (svc_pollfd[i].fd == -1)
         {
           svc_pollfd[i].fd = sock;
           svc_pollfd[i].events = (POLLIN | POLLPRI |
                                POLLRDNORM | POLLRDBAND);
           return;
         }

      new_svc_pollfd = (struct pollfd *) realloc (svc_pollfd,
                                            sizeof (struct pollfd)
                                            * (svc_max_pollfd + 1));
      if (new_svc_pollfd == NULL) /* Out of memory */
       return;
      svc_pollfd = new_svc_pollfd;
      ++svc_max_pollfd;

      svc_pollfd[svc_max_pollfd - 1].fd = sock;
      svc_pollfd[svc_max_pollfd - 1].events = (POLLIN | POLLPRI |
                                          POLLRDNORM | POLLRDBAND);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void xprt_unregister ( SVCXPRT __xprt)

Here is the caller graph for this function:


Variable Documentation

Definition at line 43 of file rpc_common.c.

Definition at line 46 of file rpc_common.c.

struct pollfd* svc_pollfd

Definition at line 45 of file rpc_common.c.