mem_free (xprt, sizeof (SVCXPRT)); mem_free (su, sizeof (*su)); mem_free (buf, ((MAX (sendsz, recvsz) + 3) / 4) * 4);
svcudp_bufcreate (sock, sendsz, recvsz)     int sock;     u_int sendsz, recvsz;{  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)    {#ifdef USE_IN_LIBIO      if (_IO_fwide (stderr, 0) > 0)	(void) __fwprintf (stderr, L"%s", _("svcudp_create: out of memory\n"));      else#endif	(void) fputs (_("svcudp_create: out of memory\n"), stderr);      return NULL;    }  su->su_iosz = ((MAX (sendsz, recvsz) + 3) / 4) * 4;  rpc_buffer (xprt) = buf;  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))    {# ifdef USE_IN_LIBIO      if (_IO_fwide (stderr, 0) > 0)	(void) __fwprintf (stderr, L"%s",			   _("svcudp_create: xp_pad is too small for IP_PKTINFO\n"));      else# endif	(void) fputs (_("svcudp_create: xp_pad is too small for IP_PKTINFO\n"),		      stderr);      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;}