cm = CMSG_FIRSTHDR (message); while (cm)
if (message->msg_controllen)
__libc_sendmsg (int fd, const struct msghdr *message, int flags){  struct cmsghdr *cm;  struct cmsgcred *cc;  struct __kernel_ucred *u;  pid_t pid;  /* Preprocess the message control block for SCM_CREDS. */  cm = CMSG_FIRSTHDR (message);  while (cm)    {      if (cm->cmsg_type == SCM_CREDS)	{	  if (cm->cmsg_len < CMSG_SPACE (sizeof (struct cmsgcred)))	    {	      __set_errno (EINVAL);	      return -1;	    }	  u = (struct __kernel_ucred *) CMSG_DATA (cm);	  cc = (struct cmsgcred *) CMSG_DATA (cm);	  /* Linux expects the calling process to pass in	     its credentials, and sanity checks them.	     You can send real, effective, or set- uid and gid.	     If the user hasn't filled in the buffer, we default to	     real uid and gid. */	  pid = __getpid ();	  if (cc->cmcred_pid != pid)	  {	      u->pid = pid;	      u->uid = __getuid ();	      u->gid = __getgid ();	  }	  else	  {	      struct __kernel_ucred v;	      v.pid = cc->cmcred_pid;	      v.uid = cc->cmcred_uid;	      v.gid = cc->cmcred_gid;	      u->pid = v.pid;	      u->uid = v.uid;	      u->gid = v.gid;	  }	}      cm = CMSG_NXTHDR ((struct msghdr *) message, cm);    }  return __syscall_sendmsg (fd, message, flags);}