diff options
| -rw-r--r-- | net/unix/af_unix.c | 49 |
1 files changed, 23 insertions, 26 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index eacddb21a9b4..0f1ecbf86d0f 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
| @@ -127,32 +127,6 @@ static atomic_t unix_nr_socks = ATOMIC_INIT(0); | |||
| 127 | 127 | ||
| 128 | #define UNIX_ABSTRACT(sk) (unix_sk(sk)->addr->hash != UNIX_HASH_SIZE) | 128 | #define UNIX_ABSTRACT(sk) (unix_sk(sk)->addr->hash != UNIX_HASH_SIZE) |
| 129 | 129 | ||
| 130 | static struct sock *first_unix_socket(int *i) | ||
| 131 | { | ||
| 132 | for (*i = 0; *i <= UNIX_HASH_SIZE; (*i)++) { | ||
| 133 | if (!hlist_empty(&unix_socket_table[*i])) | ||
| 134 | return __sk_head(&unix_socket_table[*i]); | ||
| 135 | } | ||
| 136 | return NULL; | ||
| 137 | } | ||
| 138 | |||
| 139 | static struct sock *next_unix_socket(int *i, struct sock *s) | ||
| 140 | { | ||
| 141 | struct sock *next = sk_next(s); | ||
| 142 | /* More in this chain? */ | ||
| 143 | if (next) | ||
| 144 | return next; | ||
| 145 | /* Look for next non-empty chain. */ | ||
| 146 | for ((*i)++; *i <= UNIX_HASH_SIZE; (*i)++) { | ||
| 147 | if (!hlist_empty(&unix_socket_table[*i])) | ||
| 148 | return __sk_head(&unix_socket_table[*i]); | ||
| 149 | } | ||
| 150 | return NULL; | ||
| 151 | } | ||
| 152 | |||
| 153 | #define forall_unix_sockets(i, s) \ | ||
| 154 | for (s = first_unix_socket(&(i)); s; s = next_unix_socket(&(i),(s))) | ||
| 155 | |||
| 156 | #ifdef CONFIG_SECURITY_NETWORK | 130 | #ifdef CONFIG_SECURITY_NETWORK |
| 157 | static void unix_get_secdata(struct scm_cookie *scm, struct sk_buff *skb) | 131 | static void unix_get_secdata(struct scm_cookie *scm, struct sk_buff *skb) |
| 158 | { | 132 | { |
| @@ -2017,6 +1991,29 @@ static unsigned int unix_poll(struct file * file, struct socket *sock, poll_tabl | |||
| 2017 | 1991 | ||
| 2018 | 1992 | ||
| 2019 | #ifdef CONFIG_PROC_FS | 1993 | #ifdef CONFIG_PROC_FS |
| 1994 | static struct sock *first_unix_socket(int *i) | ||
| 1995 | { | ||
| 1996 | for (*i = 0; *i <= UNIX_HASH_SIZE; (*i)++) { | ||
| 1997 | if (!hlist_empty(&unix_socket_table[*i])) | ||
| 1998 | return __sk_head(&unix_socket_table[*i]); | ||
| 1999 | } | ||
| 2000 | return NULL; | ||
| 2001 | } | ||
| 2002 | |||
| 2003 | static struct sock *next_unix_socket(int *i, struct sock *s) | ||
| 2004 | { | ||
| 2005 | struct sock *next = sk_next(s); | ||
| 2006 | /* More in this chain? */ | ||
| 2007 | if (next) | ||
| 2008 | return next; | ||
| 2009 | /* Look for next non-empty chain. */ | ||
| 2010 | for ((*i)++; *i <= UNIX_HASH_SIZE; (*i)++) { | ||
| 2011 | if (!hlist_empty(&unix_socket_table[*i])) | ||
| 2012 | return __sk_head(&unix_socket_table[*i]); | ||
| 2013 | } | ||
| 2014 | return NULL; | ||
| 2015 | } | ||
| 2016 | |||
| 2020 | struct unix_iter_state { | 2017 | struct unix_iter_state { |
| 2021 | struct seq_net_private p; | 2018 | struct seq_net_private p; |
| 2022 | int i; | 2019 | int i; |
