X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=include%2Fnet%2Faf_unix.h;h=621c64fea3bc9f648953040e71dcd2c2dc433551;hb=87fc8d1bb10cd459024a742c6a10961fefcef18f;hp=be877d75cfeb9d2ec88bc18589f3af38648fce1b;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/include/net/af_unix.h b/include/net/af_unix.h index be877d75c..621c64fea 100644 --- a/include/net/af_unix.h +++ b/include/net/af_unix.h @@ -1,5 +1,8 @@ #ifndef __LINUX_NET_AFUNIX_H #define __LINUX_NET_AFUNIX_H + +#include + extern void unix_inflight(struct file *fp); extern void unix_notinflight(struct file *fp); extern void unix_gc(void); @@ -11,9 +14,9 @@ extern rwlock_t unix_table_lock; extern atomic_t unix_tot_inflight; -static inline struct sock *first_unix_socket(int *i) +static inline struct sock *next_unix_socket_table(int *i) { - for (*i = 0; *i <= UNIX_HASH_SIZE; (*i)++) { + for ((*i)++; *i <= UNIX_HASH_SIZE; (*i)++) { if (!hlist_empty(&unix_socket_table[*i])) return __sk_head(&unix_socket_table[*i]); } @@ -22,31 +25,32 @@ static inline struct sock *first_unix_socket(int *i) static inline struct sock *next_unix_socket(int *i, struct sock *s) { - 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); } #define forall_unix_sockets(i, s) \ for (s = first_unix_socket(&(i)); s; s = next_unix_socket(&(i),(s))) -struct unix_address -{ +struct unix_address { atomic_t refcnt; int len; unsigned hash; struct sockaddr_un name[0]; }; -struct unix_skb_parms -{ +struct unix_skb_parms { struct ucred creds; /* Skb credentials */ struct scm_fp_list *fp; /* Passed files */ }; @@ -68,6 +72,7 @@ struct unix_sock { struct dentry *dentry; struct vfsmount *mnt; struct semaphore readsem; + struct sock *peer; struct sock *other; struct sock *gc_tree; atomic_t inflight;