Loading include/net/af_unix.h +0 −29 Original line number Diff line number Diff line Loading @@ -12,37 +12,8 @@ extern void unix_gc(void); #define UNIX_HASH_SIZE 256 extern struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1]; extern spinlock_t unix_table_lock; extern atomic_t unix_tot_inflight; static inline struct sock *first_unix_socket(int *i) { for (*i = 0; *i <= UNIX_HASH_SIZE; (*i)++) { if (!hlist_empty(&unix_socket_table[*i])) return __sk_head(&unix_socket_table[*i]); } return NULL; } 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; } #define forall_unix_sockets(i, s) \ for (s = first_unix_socket(&(i)); s; s = next_unix_socket(&(i),(s))) struct unix_address { atomic_t refcnt; int len; Loading net/unix/af_unix.c +28 −2 Original line number Diff line number Diff line Loading @@ -118,14 +118,40 @@ int sysctl_unix_max_dgram_qlen __read_mostly = 10; struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1]; DEFINE_SPINLOCK(unix_table_lock); static struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1]; static DEFINE_SPINLOCK(unix_table_lock); static atomic_t unix_nr_socks = ATOMIC_INIT(0); #define unix_sockets_unbound (&unix_socket_table[UNIX_HASH_SIZE]) #define UNIX_ABSTRACT(sk) (unix_sk(sk)->addr->hash != UNIX_HASH_SIZE) static struct sock *first_unix_socket(int *i) { for (*i = 0; *i <= UNIX_HASH_SIZE; (*i)++) { if (!hlist_empty(&unix_socket_table[*i])) return __sk_head(&unix_socket_table[*i]); } return NULL; } static 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; } #define forall_unix_sockets(i, s) \ for (s = first_unix_socket(&(i)); s; s = next_unix_socket(&(i),(s))) #ifdef CONFIG_SECURITY_NETWORK static void unix_get_secdata(struct scm_cookie *scm, struct sk_buff *skb) { Loading Loading
include/net/af_unix.h +0 −29 Original line number Diff line number Diff line Loading @@ -12,37 +12,8 @@ extern void unix_gc(void); #define UNIX_HASH_SIZE 256 extern struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1]; extern spinlock_t unix_table_lock; extern atomic_t unix_tot_inflight; static inline struct sock *first_unix_socket(int *i) { for (*i = 0; *i <= UNIX_HASH_SIZE; (*i)++) { if (!hlist_empty(&unix_socket_table[*i])) return __sk_head(&unix_socket_table[*i]); } return NULL; } 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; } #define forall_unix_sockets(i, s) \ for (s = first_unix_socket(&(i)); s; s = next_unix_socket(&(i),(s))) struct unix_address { atomic_t refcnt; int len; Loading
net/unix/af_unix.c +28 −2 Original line number Diff line number Diff line Loading @@ -118,14 +118,40 @@ int sysctl_unix_max_dgram_qlen __read_mostly = 10; struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1]; DEFINE_SPINLOCK(unix_table_lock); static struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1]; static DEFINE_SPINLOCK(unix_table_lock); static atomic_t unix_nr_socks = ATOMIC_INIT(0); #define unix_sockets_unbound (&unix_socket_table[UNIX_HASH_SIZE]) #define UNIX_ABSTRACT(sk) (unix_sk(sk)->addr->hash != UNIX_HASH_SIZE) static struct sock *first_unix_socket(int *i) { for (*i = 0; *i <= UNIX_HASH_SIZE; (*i)++) { if (!hlist_empty(&unix_socket_table[*i])) return __sk_head(&unix_socket_table[*i]); } return NULL; } static 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; } #define forall_unix_sockets(i, s) \ for (s = first_unix_socket(&(i)); s; s = next_unix_socket(&(i),(s))) #ifdef CONFIG_SECURITY_NETWORK static void unix_get_secdata(struct scm_cookie *scm, struct sk_buff *skb) { Loading