This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / net / unix / af_unix.c
index e19475e..71b54ac 100644 (file)
 #include <linux/mount.h>
 #include <net/checksum.h>
 #include <linux/security.h>
+#include <linux/vs_context.h>
+#include <linux/vs_network.h>
 
 int sysctl_unix_max_dgram_qlen = 10;
 
@@ -405,6 +407,8 @@ static int unix_release_sock (struct sock *sk, int embrion)
                mntput(mnt);
        }
 
+       clr_vx_info(&sk->sk_vx_info);
+       clr_nx_info(&sk->sk_nx_info);
        sock_put(sk);
 
        /* ---- Socket is dead now and most probably destroyed ---- */
@@ -559,6 +563,10 @@ static struct sock * unix_create1(struct socket *sock)
        sock_init_data(sock,sk);
        sk_set_owner(sk, THIS_MODULE);
 
+       set_vx_info(&sk->sk_vx_info, current->vx_info);
+       set_nx_info(&sk->sk_nx_info, current->nx_info);
+       sk->sk_xid = vx_current_xid();
+
        sk->sk_write_space      = unix_write_space;
        sk->sk_max_ack_backlog  = sysctl_unix_max_dgram_qlen;
        sk->sk_destruct         = unix_sock_destructor;
@@ -870,7 +878,7 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr,
                        goto out;
                alen = err;
 
-               if (sock->passcred && !unix_sk(sk)->addr &&
+               if (test_bit(SOCK_PASS_CRED, &sock->flags) && !unix_sk(sk)->addr &&
                    (err = unix_autobind(sock)) != 0)
                        goto out;
 
@@ -961,7 +969,8 @@ static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr,
                goto out;
        addr_len = err;
 
-       if (sock->passcred && !u->addr && (err = unix_autobind(sock)) != 0)
+       if (test_bit(SOCK_PASS_CRED, &sock->flags)
+               && !u->addr && (err = unix_autobind(sock)) != 0)
                goto out;
 
        timeo = sock_sndtimeo(sk, flags & O_NONBLOCK);
@@ -1295,7 +1304,8 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock,
                        goto out;
        }
 
-       if (sock->passcred && !u->addr && (err = unix_autobind(sock)) != 0)
+       if (test_bit(SOCK_PASS_CRED, &sock->flags)
+               && !u->addr && (err = unix_autobind(sock)) != 0)
                goto out;
 
        err = -EMSGSIZE;
@@ -2034,7 +2044,7 @@ static int __init af_unix_init(void)
         /* allocate our sock slab cache */
         unix_sk_cachep = kmem_cache_create("unix_sock",
                                           sizeof(struct unix_sock), 0,
-                                          SLAB_HWCACHE_ALIGN, 0, 0);
+                                          SLAB_HWCACHE_ALIGN, NULL, NULL);
         if (!unix_sk_cachep)
                 printk(KERN_CRIT
                         "af_unix_init: Cannot create unix_sock SLAB cache!\n");