mapfd = *(int *) CMSG_DATA (cmsg);
get_mapping (request_type type, const char *key,	     struct mapped_database **mappedp){  struct mapped_database *result = NO_MAPPING;#ifdef SCM_RIGHTS  const size_t keylen = strlen (key) + 1;  char resdata[keylen];  int saved_errno = errno;  int mapfd = -1;  /* Send the request.  */  struct iovec iov[2];  request_header req;  int sock = open_socket ();  if (sock < 0)    goto out;  req.version = NSCD_VERSION;  req.type = type;  req.key_len = keylen;  iov[0].iov_base = &req;  iov[0].iov_len = sizeof (req);  iov[1].iov_base = (void *) key;  iov[1].iov_len = keylen;  if (TEMP_FAILURE_RETRY (__writev (sock, iov, 2))      != iov[0].iov_len + iov[1].iov_len)    /* We cannot even write the request.  */    goto out_close2;  /* Room for the data sent along with the file descriptor.  We expect     the key name back.  */  iov[0].iov_base = resdata;  iov[0].iov_len = keylen;  char buf[CMSG_SPACE (sizeof (int))];  struct msghdr msg = { .msg_iov = iov, .msg_iovlen = 1,			.msg_control = buf, .msg_controllen = sizeof (buf) };  struct cmsghdr *cmsg = CMSG_FIRSTHDR (&msg);  cmsg->cmsg_level = SOL_SOCKET;  cmsg->cmsg_type = SCM_RIGHTS;  cmsg->cmsg_len = CMSG_LEN (sizeof (int));  *(int *) CMSG_DATA (cmsg) = -1;  msg.msg_controllen = cmsg->cmsg_len;  struct pollfd fds[1];  fds[0].fd = sock;  fds[0].events = POLLIN | POLLERR | POLLHUP;  if (__poll (fds, 1, 5 * 1000) <= 0)    /* Failure or timeout.  */    goto out_close2;  if (TEMP_FAILURE_RETRY (__recvmsg (sock, &msg, 0)) != keylen)    goto out_close2;  if (CMSG_FIRSTHDR (&msg)->cmsg_len != CMSG_LEN (sizeof (int)))    goto out_close;  mapfd = *(int *) CMSG_DATA (cmsg);  struct stat64 st;  if (strcmp (resdata, key) != 0      || fstat64 (mapfd, &st) != 0      || st.st_size < sizeof (struct database_pers_head))    goto out_close;  struct database_pers_head head;  if (TEMP_FAILURE_RETRY (__pread (mapfd, &head, sizeof (head), 0))      != sizeof (head))    goto out_close;  if (head.version != DB_VERSION || head.header_size != sizeof (head)      /* This really should not happen but who knows, maybe the update	 thread got stuck.  */      || head.timestamp + MAPPING_TIMEOUT < time (NULL))    goto out_close;  size_t size = (sizeof (head) + roundup (head.module * sizeof (ref_t), ALIGN)		 + head.data_size);  if (st.st_size < size)    goto out_close;  /* The file is large enough, map it now.  */  void *mapping = __mmap (NULL, size, PROT_READ, MAP_SHARED, mapfd, 0);  if (mapping != MAP_FAILED)    {      /* Allocate a record for the mapping.  */      struct mapped_database *newp;      newp = malloc (sizeof (*newp));      if (newp == NULL)	{	  /* Ugh, after all we went through the memory allocation failed.  */	  munmap (result, size);	  goto out_close;	}      newp->head = mapping;      newp->data = ((char *) mapping + head.header_size		    + roundup (head.module * sizeof (ref_t), ALIGN));      newp->mapsize = size;      /* Set counter to 1 to show it is usable.  */      newp->counter = 1;      result = newp;    } out_close:  __close (mapfd); out_close2:  __close (sock); out:  __set_errno (saved_errno);#endif	/* SCM_RIGHTS */  struct mapped_database *oldval = *mappedp;  *mappedp = result;  if (oldval != NULL && atomic_decrement_val (&oldval->counter) == 0)    __nscd_unmap (oldval);  return result;}