[NET] generalise tcp_error, renaming it to sk_stream_error

Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@conectiva.com.br>
parent a47b157e
......@@ -473,6 +473,7 @@ do { if (!(__sk)->sk_backlog.tail) { \
extern int sk_stream_wait_connect(struct sock *sk, long *timeo_p);
extern int sk_stream_wait_memory(struct sock *sk, long *timeo_p);
extern void sk_stream_wait_close(struct sock *sk, long timeo_p);
extern int sk_stream_error(struct sock *sk, int flags, int err);
extern int sk_wait_data(struct sock *sk, long *timeo);
......
......@@ -177,3 +177,14 @@ void sk_stream_rfree(struct sk_buff *skb)
}
EXPORT_SYMBOL(sk_stream_rfree);
int sk_stream_error(struct sock *sk, int flags, int err)
{
if (err == -EPIPE)
err = sock_error(sk) ? : -EPIPE;
if (err == -EPIPE && !(flags & MSG_NOSIGNAL))
send_sig(SIGPIPE, current, 0);
return err;
}
EXPORT_SYMBOL(sk_stream_error);
......@@ -688,15 +688,6 @@ static inline void tcp_push(struct sock *sk, struct tcp_opt *tp, int flags,
}
}
static int tcp_error(struct sock *sk, int flags, int err)
{
if (err == -EPIPE)
err = sock_error(sk) ? : -EPIPE;
if (err == -EPIPE && !(flags & MSG_NOSIGNAL))
send_sig(SIGPIPE, current, 0);
return err;
}
static ssize_t do_tcp_sendpages(struct sock *sk, struct page **pages, int poffset,
size_t psize, int flags)
{
......@@ -800,7 +791,7 @@ static ssize_t do_tcp_sendpages(struct sock *sk, struct page **pages, int poffse
if (copied)
goto out;
out_err:
return tcp_error(sk, flags, err);
return sk_stream_error(sk, flags, err);
}
ssize_t tcp_sendpage(struct socket *sock, struct page *page, int offset,
......@@ -1054,7 +1045,7 @@ int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
if (copied)
goto out;
out_err:
err = tcp_error(sk, flags, err);
err = sk_stream_error(sk, flags, err);
TCP_CHECK_TIMER(sk);
release_sock(sk);
return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment