diff options
author | Denis V. Lunev <den@openvz.org> | 2008-02-29 14:18:32 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-02-29 14:18:32 -0500 |
commit | edf0208702007ec1f6a36756fdd005f771a4cf17 (patch) | |
tree | f323141ddde44db532d984ea7bf769a05220aa0c /include/net/sock.h | |
parent | 9dfbec1fb2bedff6b118504055cd9f0485edba45 (diff) |
[NET]: Make netlink_kernel_release publically available as sk_release_kernel.
This staff will be needed for non-netlink kernel sockets, which should
also not pin a namespace like tcp_socket and icmp_socket.
Signed-off-by: Denis V. Lunev <den@openvz.org>
Acked-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/sock.h')
-rw-r--r-- | include/net/sock.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index fd9876087651..39112e75411c 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -850,6 +850,7 @@ extern struct sock *sk_alloc(struct net *net, int family, | |||
850 | gfp_t priority, | 850 | gfp_t priority, |
851 | struct proto *prot); | 851 | struct proto *prot); |
852 | extern void sk_free(struct sock *sk); | 852 | extern void sk_free(struct sock *sk); |
853 | extern void sk_release_kernel(struct sock *sk); | ||
853 | extern struct sock *sk_clone(const struct sock *sk, | 854 | extern struct sock *sk_clone(const struct sock *sk, |
854 | const gfp_t priority); | 855 | const gfp_t priority); |
855 | 856 | ||
@@ -1333,6 +1334,18 @@ static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_e | |||
1333 | } | 1334 | } |
1334 | #endif | 1335 | #endif |
1335 | 1336 | ||
1337 | /* | ||
1338 | * Kernel sockets, f.e. rtnl or icmp_socket, are a part of a namespace. | ||
1339 | * They should not hold a referrence to a namespace in order to allow | ||
1340 | * to stop it. | ||
1341 | * Sockets after sk_change_net should be released using sk_release_kernel | ||
1342 | */ | ||
1343 | static inline void sk_change_net(struct sock *sk, struct net *net) | ||
1344 | { | ||
1345 | put_net(sk->sk_net); | ||
1346 | sk->sk_net = net; | ||
1347 | } | ||
1348 | |||
1336 | extern void sock_enable_timestamp(struct sock *sk); | 1349 | extern void sock_enable_timestamp(struct sock *sk); |
1337 | extern int sock_get_timestamp(struct sock *, struct timeval __user *); | 1350 | extern int sock_get_timestamp(struct sock *, struct timeval __user *); |
1338 | extern int sock_get_timestampns(struct sock *, struct timespec __user *); | 1351 | extern int sock_get_timestampns(struct sock *, struct timespec __user *); |