This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / net / core / stream.c
1 /*
2  *     SUCS NET3:
3  *
4  *     Generic stream handling routines. These are generic for most
5  *     protocols. Even IP. Tonight 8-).
6  *     This is used because TCP, LLC (others too) layer all have mostly
7  *     identical sendmsg() and recvmsg() code.
8  *     So we (will) share it here.
9  *
10  *     Authors:        Arnaldo Carvalho de Melo <acme@conectiva.com.br>
11  *                     (from old tcp.c code)
12  *                     Alan Cox <alan@redhat.com> (Borrowed comments 8-))
13  */
14
15 #include <linux/module.h>
16 #include <linux/net.h>
17 #include <linux/signal.h>
18 #include <linux/wait.h>
19 #include <net/sock.h>
20
21 /**
22  * sk_stream_write_space - stream socket write_space callback.
23  * sk - socket
24  *
25  * FIXME: write proper description
26  */
27 void sk_stream_write_space(struct sock *sk)
28 {
29         struct socket *sock = sk->sk_socket;
30
31         if (sk_stream_wspace(sk) >= sk_stream_min_wspace(sk) && sock) {
32                 clear_bit(SOCK_NOSPACE, &sock->flags);
33
34                 if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
35                         wake_up_interruptible(sk->sk_sleep);
36                 if (sock->fasync_list && !(sk->sk_shutdown & SEND_SHUTDOWN))
37                         sock_wake_async(sock, 2, POLL_OUT);
38         }
39 }
40
41 EXPORT_SYMBOL(sk_stream_write_space);