diff options
author | Daniel Schaeffer <daniel@dschaeffer.localdomain> | 2008-01-30 15:42:41 -0500 |
---|---|---|
committer | Daniel Schaeffer <daniel@dschaeffer.localdomain> | 2008-01-30 15:42:41 -0500 |
commit | 648b932d8cf61f38d08a84e6388036b22766c2df (patch) | |
tree | 3c48859a194482b645b93c1bead3bcc323327fb7 /net/unix/af_unix.c | |
parent | 2506ae0663e660d8dc7624fcdae1814c8ee3d10a (diff) | |
parent | bbf25010f1a6b761914430f5fca081ec8c7accd1 (diff) |
Merge branch '2.6.23' into 2.6.22.6-imx27
Conflicts:
Documentation/kernel-parameters.txt
Makefile
arch/arm/Kconfig
arch/arm/Makefile
arch/arm/mach-mx3/Kconfig
arch/arm/mach-mx3/Makefile
arch/arm/mach-mx3/mm.c
arch/arm/mach-mx3/mx31ads.c
arch/arm/mm/Kconfig
arch/arm/plat-mxc/Kconfig
arch/arm/plat-mxc/Makefile
arch/arm/plat-mxc/irq.c
block/cfq-iosched.c
drivers/ata/ahci.c
drivers/ata/libata-core.c
drivers/char/watchdog/Kconfig
drivers/firewire/fw-sbp2.c
drivers/md/dm-crypt.c
drivers/media/video/pwc/pwc-if.c
drivers/mmc/card/Kconfig
drivers/mmc/card/queue.c
drivers/mmc/core/Makefile
drivers/mmc/core/bus.c
drivers/mmc/core/core.c
drivers/mmc/core/host.c
drivers/mmc/core/mmc.c
drivers/mmc/core/sd.c
drivers/mmc/core/sd_ops.c
drivers/mmc/host/at91_mci.c
drivers/mmc/host/sdhci.c
drivers/net/bonding/bond_main.c
drivers/net/fec.c
drivers/net/forcedeth.c
drivers/net/r8169.c
drivers/net/sky2.c
drivers/rtc/Kconfig
drivers/rtc/Makefile
drivers/spi/Kconfig
drivers/spi/Makefile
drivers/usb/gadget/Makefile
drivers/usb/gadget/gadget_chips.h
drivers/usb/host/ehci.h
drivers/video/logo/logo.c
drivers/w1/slaves/Makefile
fs/9p/conv.c
fs/direct-io.c
fs/exec.c
fs/ocfs2/file.c
fs/signalfd.c
fs/sysfs/file.c
include/asm-arm/arch-mxc/dma.h
include/asm-arm/arch-mxc/entry-macro.S
include/asm-arm/arch-mxc/hardware.h
include/asm-arm/arch-mxc/io.h
include/asm-arm/arch-mxc/irqs.h
include/asm-arm/arch-mxc/memory.h
include/asm-arm/arch-mxc/mx31.h
include/asm-arm/arch-mxc/mxc.h
include/asm-arm/arch-mxc/system.h
include/asm-arm/arch-mxc/timex.h
include/asm-arm/arch-mxc/uncompress.h
include/asm-arm/arch-mxc/vmalloc.h
include/linux/fsl_devices.h
include/linux/ioprio.h
kernel/lockdep_proc.c
kernel/signal.c
mm/hugetlb.c
mm/readahead.c
net/bluetooth/rfcomm/tty.c
net/bridge/br_device.c
net/core/dev.c
net/ieee80211/softmac/ieee80211softmac_assoc.c
net/ieee80211/softmac/ieee80211softmac_wx.c
net/ipv4/netfilter/nf_conntrack_proto_icmp.c
net/ipv4/tcp_input.c
net/netfilter/nf_conntrack_proto_sctp.c
Diffstat (limited to 'net/unix/af_unix.c')
-rw-r--r-- | net/unix/af_unix.c | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index d70fa30d4294..a05c34260e70 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -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) { @@ -592,7 +618,8 @@ static struct sock * unix_create1(struct socket *sock) u->dentry = NULL; u->mnt = NULL; spin_lock_init(&u->lock); - atomic_set(&u->inflight, sock ? 0 : -1); + atomic_set(&u->inflight, 0); + INIT_LIST_HEAD(&u->link); mutex_init(&u->readlock); /* single task reading lock */ init_waitqueue_head(&u->peer_wait); unix_insert_socket(unix_sockets_unbound, sk); @@ -1134,9 +1161,6 @@ restart: /* take ten and and send info to listening sock */ spin_lock(&other->sk_receive_queue.lock); __skb_queue_tail(&other->sk_receive_queue, skb); - /* Undo artificially decreased inflight after embrion - * is installed to listening socket. */ - atomic_inc(&newu->inflight); spin_unlock(&other->sk_receive_queue.lock); unix_state_unlock(other); other->sk_data_ready(other, 0); @@ -2048,7 +2072,7 @@ static int unix_seq_show(struct seq_file *seq, void *v) return 0; } -static struct seq_operations unix_seq_ops = { +static const struct seq_operations unix_seq_ops = { .start = unix_seq_start, .next = unix_seq_next, .stop = unix_seq_stop, |