- struct sock *next = sk_next(s);
- /* More in this chain? */
- if (next)
- return next;
- /* Look for next non-empty chain. */
- for ((*i)++; *i <= UNIX_HASH_SIZE; (*i)++) {
- if (!hlist_empty(&unix_socket_table[*i]))
- return __sk_head(&unix_socket_table[*i]);
- }
- return NULL;
+ do {
+ if (s)
+ s = sk_next(s);
+ if (!s)
+ s = next_unix_socket_table(i);
+ } while (s && !vx_check(s->sk_xid, VX_IDENT|VX_WATCH));
+ return s;
+}
+
+static inline struct sock *first_unix_socket(int *i)
+{
+ *i = 0;
+ return next_unix_socket(i, NULL);