diff options
author | Pavel Emelianov <xemul@openvz.org> | 2007-05-29 16:19:18 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-05-31 04:23:34 -0400 |
commit | e4fd5da39f99d5921dda1fe3d93652fbd925fbfd (patch) | |
tree | 595967b745720653cdc0f7c9e5d61c5433ea143e /include | |
parent | 4e07a91c37c69ec1647c218214591ee4fe3408fe (diff) |
[TCP]: Consolidate checking for tcp orphan count being too big.
tcp_out_of_resources() and tcp_close() perform the
same checking of number of orphan sockets. Move this
code into common place.
Signed-off-by: Pavel Emelianov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/tcp.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index e22b4f0305a3..a8af9ae00177 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -254,6 +254,12 @@ static inline int between(__u32 seq1, __u32 seq2, __u32 seq3) | |||
254 | return seq3 - seq2 >= seq1 - seq2; | 254 | return seq3 - seq2 >= seq1 - seq2; |
255 | } | 255 | } |
256 | 256 | ||
257 | static inline int tcp_too_many_orphans(struct sock *sk, int num) | ||
258 | { | ||
259 | return (num > sysctl_tcp_max_orphans) || | ||
260 | (sk->sk_wmem_queued > SOCK_MIN_SNDBUF && | ||
261 | atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2]); | ||
262 | } | ||
257 | 263 | ||
258 | extern struct proto tcp_prot; | 264 | extern struct proto tcp_prot; |
259 | 265 | ||