 if (sk->sk_shutdown & RCV_SHUTDOWN) { if (!(flags & MSG_NOSIGNAL)) send_sig(SIGPIPE, current, 0); rv = -EPIPE; goto out; } 
static int dn_recvmsg(struct kiocb *iocb, struct socket *sock,	struct msghdr *msg, size_t size, int flags){	struct sock *sk = sock->sk;	struct dn_scp *scp = DN_SK(sk);	struct sk_buff_head *queue = &sk->sk_receive_queue;	size_t target = size > 1 ? 1 : 0;	size_t copied = 0;	int rv = 0;	struct sk_buff *skb, *nskb;	struct dn_skb_cb *cb = NULL;	unsigned char eor = 0;	long timeo = sock_rcvtimeo(sk, flags & MSG_DONTWAIT);	lock_sock(sk);	if (sock_flag(sk, SOCK_ZAPPED)) {		rv = -EADDRNOTAVAIL;		goto out;	}	rv = dn_check_state(sk, NULL, 0, &timeo, flags);	if (rv)		goto out;	if (sk->sk_shutdown & RCV_SHUTDOWN) {		if (!(flags & MSG_NOSIGNAL))			send_sig(SIGPIPE, current, 0);		rv = -EPIPE;		goto out;	}	if (flags & ~(MSG_PEEK|MSG_OOB|MSG_WAITALL|MSG_DONTWAIT|MSG_NOSIGNAL)) {		rv = -EOPNOTSUPP;		goto out;	}	if (flags & MSG_OOB)		queue = &scp->other_receive_queue;	if (flags & MSG_WAITALL)		target = size;	/*	 * See if there is data ready to read, sleep if there isn't	 */	for(;;) {		if (sk->sk_err)			goto out;		if (!skb_queue_empty(&scp->other_receive_queue)) {			if (!(flags & MSG_OOB)) {				msg->msg_flags |= MSG_OOB;				if (!scp->other_report) {					scp->other_report = 1;					goto out;				}			}		}				if (scp->state != DN_RUN)			goto out;		if (signal_pending(current)) {			rv = sock_intr_errno(timeo);			goto out;		}		if (dn_data_ready(sk, queue, flags, target))			break;		if (flags & MSG_DONTWAIT) {			rv = -EWOULDBLOCK;			goto out;		}		set_bit(SOCK_ASYNC_WAITDATA, &sock->flags);		SOCK_SLEEP_PRE(sk)		if (!dn_data_ready(sk, queue, flags, target))			schedule();		SOCK_SLEEP_POST(sk)		clear_bit(SOCK_ASYNC_WAITDATA, &sock->flags);	}	for(skb = queue->next; skb != (struct sk_buff *)queue; skb = nskb) {		unsigned int chunk = skb->len;		cb = DN_SKB_CB(skb);		if ((chunk + copied) > size)			chunk = size - copied;		if (memcpy_toiovec(msg->msg_iov, skb->data, chunk)) {			rv = -EFAULT;			break;		}		copied += chunk;		if (!(flags & MSG_PEEK))			skb_pull(skb, chunk);		eor = cb->nsp_flags & 0x40;		nskb = skb->next;		if (skb->len == 0) {			skb_unlink(skb, queue);			kfree_skb(skb);			/* 			 * N.B. Don't refer to skb or cb after this point			 * in loop.			 */			if ((scp->flowloc_sw == DN_DONTSEND) && !dn_congested(sk)) {				scp->flowloc_sw = DN_SEND;				dn_nsp_send_link(sk, DN_SEND, 0);			}		}		if (eor) { 			if (sk->sk_type == SOCK_SEQPACKET)				break;			if (!(flags & MSG_WAITALL))				break;		}		if (flags & MSG_OOB)			break;		if (copied >= target)			break;	}	rv = copied;	if (eor && (sk->sk_type == SOCK_SEQPACKET))		msg->msg_flags |= MSG_EOR;out:	if (rv == 0)		rv = (flags & MSG_PEEK) ? -sk->sk_err : sock_error(sk);	if ((rv >= 0) && msg->msg_name) {		memcpy(msg->msg_name, &scp->peer, sizeof(struct sockaddr_dn));		msg->msg_namelen = sizeof(struct sockaddr_dn);	}	release_sock(sk);	return rv;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/9eb5c94ef217d61d974f384b29b7298490b0a4d9/af_decnet.c/clean/net/decnet/af_decnet.c