]> granicus.if.org Git - strace/commitdiff
Consistently use AF_UNIX over AF_LOCAL
authorDmitry V. Levin <ldv@altlinux.org>
Mon, 20 Jun 2016 22:52:49 +0000 (22:52 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 20 Jun 2016 22:52:49 +0000 (22:52 +0000)
As these constants have the same value 1, let's use and print only one
of them, e.g. AF_UNIX.

* xlat/addrfams.in (AF_LOCAL): Remove.
* tests/net-accept-connect.c (main): Replace AF_LOCAL with AF_UNIX.
* tests/net-y-unix.c: Likewise.
* tests/net-yy-unix.c: Likewise.
* tests/netlink_unix_diag.c: Likewise.

tests/net-accept-connect.c
tests/net-y-unix.c
tests/net-yy-unix.c
tests/netlink_unix_diag.c
xlat/addrfams.in

index b7f7c20a5bddb425d81fd3535f4da3530fcc7e93..04c05a60d52855cfa2d55fdd6a241192151d0be6 100644 (file)
@@ -62,7 +62,7 @@ main(int ac, const char **av)
        close(0);
        close(1);
 
-       if (socket(AF_LOCAL, SOCK_STREAM, 0))
+       if (socket(AF_UNIX, SOCK_STREAM, 0))
                perror_msg_and_skip("socket");
        if (bind(0, (struct sockaddr *) &addr, len))
                perror_msg_and_skip("bind");
@@ -93,7 +93,7 @@ main(int ac, const char **av)
 
                assert(sigprocmask(SIG_BLOCK, &set, NULL) == 0);
                assert(signal(SIGUSR1, handler) != SIG_ERR);
-               assert(socket(AF_LOCAL, SOCK_STREAM, 0) == 1);
+               assert(socket(AF_UNIX, SOCK_STREAM, 0) == 1);
                assert(close(0) == 0);
                assert(connect(1, (struct sockaddr *) &addr, len) == 0);
                assert(sigprocmask(SIG_UNBLOCK, &set, NULL) == 0);
index 28212a3e66790d7480ae70c73df13173def759b8..499ae8ea22d2438b45ae7a8e48c211ef0fc269c9 100644 (file)
@@ -54,17 +54,17 @@ main(int ac, const char **av)
        if (*len > sizeof(addr))
                *len = sizeof(addr);
 
-       int listen_fd = socket(AF_LOCAL, SOCK_STREAM, 0);
+       int listen_fd = socket(AF_UNIX, SOCK_STREAM, 0);
        if (listen_fd < 0)
                perror_msg_and_skip("socket");
        unsigned long listen_inode = inode_of_sockfd(listen_fd);
-       printf("socket(AF_LOCAL, SOCK_STREAM, 0) = %d<socket:[%lu]>\n",
+       printf("socket(AF_UNIX, SOCK_STREAM, 0) = %d<socket:[%lu]>\n",
               listen_fd, listen_inode);
 
        (void) unlink(av[1]);
        if (bind(listen_fd, listen_sa, *len))
                perror_msg_and_skip("bind");
-       printf("bind(%d<socket:[%lu]>, {sa_family=AF_LOCAL, sun_path=\"%s\"}"
+       printf("bind(%d<socket:[%lu]>, {sa_family=AF_UNIX, sun_path=\"%s\"}"
               ", %u) = 0\n", listen_fd, listen_inode, av[1], (unsigned) *len);
 
        if (listen(listen_fd, 1))
@@ -83,20 +83,20 @@ main(int ac, const char **av)
        *len = sizeof(addr);
        if (getsockname(listen_fd, listen_sa, len))
                perror_msg_and_fail("getsockname");
-       printf("getsockname(%d<socket:[%lu]>, {sa_family=AF_LOCAL"
+       printf("getsockname(%d<socket:[%lu]>, {sa_family=AF_UNIX"
               ", sun_path=\"%s\"}, [%u]) = 0\n", listen_fd, listen_inode,
               av[1], (unsigned) *len);
 
-       int connect_fd = socket(AF_LOCAL, SOCK_STREAM, 0);
+       int connect_fd = socket(AF_UNIX, SOCK_STREAM, 0);
        if (connect_fd < 0)
                perror_msg_and_fail("socket");
        unsigned long connect_inode = inode_of_sockfd(connect_fd);
-       printf("socket(AF_LOCAL, SOCK_STREAM, 0) = %d<socket:[%lu]>\n",
+       printf("socket(AF_UNIX, SOCK_STREAM, 0) = %d<socket:[%lu]>\n",
               connect_fd, connect_inode);
 
        if (connect(connect_fd, listen_sa, *len))
                perror_msg_and_fail("connect");
-       printf("connect(%d<socket:[%lu]>, {sa_family=AF_LOCAL"
+       printf("connect(%d<socket:[%lu]>, {sa_family=AF_UNIX"
               ", sun_path=\"%s\"}, %u) = 0\n",
               connect_fd, connect_inode, av[1], (unsigned) *len);
 
@@ -107,7 +107,7 @@ main(int ac, const char **av)
        if (accept_fd < 0)
                perror_msg_and_fail("accept");
        unsigned long accept_inode = inode_of_sockfd(accept_fd);
-       printf("accept(%d<socket:[%lu]>, {sa_family=AF_LOCAL, NULL}"
+       printf("accept(%d<socket:[%lu]>, {sa_family=AF_UNIX, NULL}"
               ", [%u]) = %d<socket:[%lu]>\n",
               listen_fd, listen_inode, (unsigned) *len,
               accept_fd, accept_inode);
@@ -116,7 +116,7 @@ main(int ac, const char **av)
        *len = sizeof(addr);
        if (getpeername(connect_fd, listen_sa, len))
                perror_msg_and_fail("getpeername");
-       printf("getpeername(%d<socket:[%lu]>, {sa_family=AF_LOCAL"
+       printf("getpeername(%d<socket:[%lu]>, {sa_family=AF_UNIX"
               ", sun_path=\"%s\"}, [%u]) = 0\n", connect_fd, connect_inode,
               av[1], (unsigned) *len);
 
@@ -141,11 +141,11 @@ main(int ac, const char **av)
        assert(close(accept_fd) == 0);
        printf("close(%d<socket:[%lu]>) = 0\n", accept_fd, accept_inode);
 
-       connect_fd = socket(AF_LOCAL, SOCK_STREAM, 0);
+       connect_fd = socket(AF_UNIX, SOCK_STREAM, 0);
        if (connect_fd < 0)
                perror_msg_and_fail("socket");
        connect_inode = inode_of_sockfd(connect_fd);
-       printf("socket(AF_LOCAL, SOCK_STREAM, 0) = %d<socket:[%lu]>\n",
+       printf("socket(AF_UNIX, SOCK_STREAM, 0) = %d<socket:[%lu]>\n",
               connect_fd, connect_inode);
 
        *optval = 1;
@@ -160,13 +160,13 @@ main(int ac, const char **av)
        *len = sizeof(addr);
        if (getsockname(listen_fd, listen_sa, len))
                perror_msg_and_fail("getsockname");
-       printf("getsockname(%d<socket:[%lu]>, {sa_family=AF_LOCAL"
+       printf("getsockname(%d<socket:[%lu]>, {sa_family=AF_UNIX"
               ", sun_path=\"%s\"}, [%u]) = 0\n",
               listen_fd, listen_inode, av[1], (unsigned) *len);
 
        if (connect(connect_fd, listen_sa, *len))
                perror_msg_and_fail("connect");
-       printf("connect(%d<socket:[%lu]>, {sa_family=AF_LOCAL"
+       printf("connect(%d<socket:[%lu]>, {sa_family=AF_UNIX"
               ", sun_path=\"%s\"}, %u) = 0\n",
               connect_fd, connect_inode, av[1], (unsigned) *len);
 
@@ -178,7 +178,7 @@ main(int ac, const char **av)
        accept_inode = inode_of_sockfd(accept_fd);
        const char * const sun_path1 =
                ((struct sockaddr_un *) accept_sa) -> sun_path + 1;
-       printf("accept(%d<socket:[%lu]>, {sa_family=AF_LOCAL"
+       printf("accept(%d<socket:[%lu]>, {sa_family=AF_UNIX"
               ", sun_path=@\"%s\"}, [%u]) = %d<socket:[%lu]>\n",
               listen_fd, listen_inode, sun_path1, (unsigned) *len,
               accept_fd, accept_inode);
@@ -187,7 +187,7 @@ main(int ac, const char **av)
        *len = sizeof(addr);
        if (getpeername(connect_fd, listen_sa, len))
                perror_msg_and_fail("getpeername");
-       printf("getpeername(%d<socket:[%lu]>, {sa_family=AF_LOCAL"
+       printf("getpeername(%d<socket:[%lu]>, {sa_family=AF_UNIX"
               ", sun_path=\"%s\"}, [%u]) = 0\n",
               connect_fd, connect_inode, av[1], (unsigned) *len);
 
@@ -195,7 +195,7 @@ main(int ac, const char **av)
        *len = sizeof(addr);
        if (getsockname(connect_fd, accept_sa, len))
                perror_msg_and_fail("getsockname");
-       printf("getsockname(%d<socket:[%lu]>, {sa_family=AF_LOCAL"
+       printf("getsockname(%d<socket:[%lu]>, {sa_family=AF_UNIX"
               ", sun_path=@\"%s\"}, [%u]) = 0\n",
               connect_fd, connect_inode, sun_path1, (unsigned) *len);
 
index 7bad003296d5553b902c1dbc14924550da544b99..78fc876d3ccdc8bddf5ec25b68a5dd9e65fa967a 100644 (file)
@@ -54,17 +54,17 @@ main(int ac, const char **av)
        if (*len > sizeof(addr))
                *len = sizeof(addr);
 
-       int listen_fd = socket(AF_LOCAL, SOCK_STREAM, 0);
+       int listen_fd = socket(AF_UNIX, SOCK_STREAM, 0);
        if (listen_fd < 0)
                perror_msg_and_skip("socket");
        unsigned long listen_inode = inode_of_sockfd(listen_fd);
-       printf("socket(AF_LOCAL, SOCK_STREAM, 0) = %d<UNIX:[%lu]>\n",
+       printf("socket(AF_UNIX, SOCK_STREAM, 0) = %d<UNIX:[%lu]>\n",
               listen_fd, listen_inode);
 
        (void) unlink(av[1]);
        if (bind(listen_fd, listen_sa, *len))
                perror_msg_and_skip("bind");
-       printf("bind(%d<UNIX:[%lu]>, {sa_family=AF_LOCAL, sun_path=\"%s\"}"
+       printf("bind(%d<UNIX:[%lu]>, {sa_family=AF_UNIX, sun_path=\"%s\"}"
               ", %u) = 0\n", listen_fd, listen_inode, av[1], (unsigned) *len);
 
        if (listen(listen_fd, 1))
@@ -84,20 +84,20 @@ main(int ac, const char **av)
        *len = sizeof(addr);
        if (getsockname(listen_fd, listen_sa, len))
                perror_msg_and_fail("getsockname");
-       printf("getsockname(%d<UNIX:[%lu,\"%s\"]>, {sa_family=AF_LOCAL"
+       printf("getsockname(%d<UNIX:[%lu,\"%s\"]>, {sa_family=AF_UNIX"
               ", sun_path=\"%s\"}, [%u]) = 0\n", listen_fd, listen_inode,
               av[1], av[1], (unsigned) *len);
 
-       int connect_fd = socket(AF_LOCAL, SOCK_STREAM, 0);
+       int connect_fd = socket(AF_UNIX, SOCK_STREAM, 0);
        if (connect_fd < 0)
                perror_msg_and_fail("socket");
        unsigned long connect_inode = inode_of_sockfd(connect_fd);
-       printf("socket(AF_LOCAL, SOCK_STREAM, 0) = %d<UNIX:[%lu]>\n",
+       printf("socket(AF_UNIX, SOCK_STREAM, 0) = %d<UNIX:[%lu]>\n",
               connect_fd, connect_inode);
 
        if (connect(connect_fd, listen_sa, *len))
                perror_msg_and_fail("connect");
-       printf("connect(%d<UNIX:[%lu]>, {sa_family=AF_LOCAL"
+       printf("connect(%d<UNIX:[%lu]>, {sa_family=AF_UNIX"
               ", sun_path=\"%s\"}, %u) = 0\n",
               connect_fd, connect_inode, av[1], (unsigned) *len);
 
@@ -108,7 +108,7 @@ main(int ac, const char **av)
        if (accept_fd < 0)
                perror_msg_and_fail("accept");
        unsigned long accept_inode = inode_of_sockfd(accept_fd);
-       printf("accept(%d<UNIX:[%lu,\"%s\"]>, {sa_family=AF_LOCAL, NULL}"
+       printf("accept(%d<UNIX:[%lu,\"%s\"]>, {sa_family=AF_UNIX, NULL}"
               ", [%u]) = %d<UNIX:[%lu->%lu,\"%s\"]>\n",
               listen_fd, listen_inode, av[1], (unsigned) *len,
               accept_fd, accept_inode, connect_inode, av[1]);
@@ -117,7 +117,7 @@ main(int ac, const char **av)
        *len = sizeof(addr);
        if (getpeername(connect_fd, listen_sa, len))
                perror_msg_and_fail("getpeername");
-       printf("getpeername(%d<UNIX:[%lu->%lu]>, {sa_family=AF_LOCAL"
+       printf("getpeername(%d<UNIX:[%lu->%lu]>, {sa_family=AF_UNIX"
               ", sun_path=\"%s\"}, [%u]) = 0\n", connect_fd, connect_inode,
               accept_inode, av[1], (unsigned) *len);
 
@@ -144,11 +144,11 @@ main(int ac, const char **av)
        printf("close(%d<UNIX:[%lu->%lu,\"%s\"]>) = 0\n",
               accept_fd, accept_inode, connect_inode, av[1]);
 
-       connect_fd = socket(AF_LOCAL, SOCK_STREAM, 0);
+       connect_fd = socket(AF_UNIX, SOCK_STREAM, 0);
        if (connect_fd < 0)
                perror_msg_and_fail("socket");
        connect_inode = inode_of_sockfd(connect_fd);
-       printf("socket(AF_LOCAL, SOCK_STREAM, 0) = %d<UNIX:[%lu]>\n",
+       printf("socket(AF_UNIX, SOCK_STREAM, 0) = %d<UNIX:[%lu]>\n",
               connect_fd, connect_inode);
 
        *optval = 1;
@@ -163,13 +163,13 @@ main(int ac, const char **av)
        *len = sizeof(addr);
        if (getsockname(listen_fd, listen_sa, len))
                perror_msg_and_fail("getsockname");
-       printf("getsockname(%d<UNIX:[%lu,\"%s\"]>, {sa_family=AF_LOCAL"
+       printf("getsockname(%d<UNIX:[%lu,\"%s\"]>, {sa_family=AF_UNIX"
               ", sun_path=\"%s\"}, [%u]) = 0\n", listen_fd, listen_inode,
               av[1], av[1], (unsigned) *len);
 
        if (connect(connect_fd, listen_sa, *len))
                perror_msg_and_fail("connect");
-       printf("connect(%d<UNIX:[%lu]>, {sa_family=AF_LOCAL"
+       printf("connect(%d<UNIX:[%lu]>, {sa_family=AF_UNIX"
               ", sun_path=\"%s\"}, %u) = 0\n",
               connect_fd, connect_inode, av[1], (unsigned) *len);
 
@@ -181,7 +181,7 @@ main(int ac, const char **av)
        accept_inode = inode_of_sockfd(accept_fd);
        const char * const sun_path1 =
                ((struct sockaddr_un *) accept_sa) -> sun_path + 1;
-       printf("accept(%d<UNIX:[%lu,\"%s\"]>, {sa_family=AF_LOCAL"
+       printf("accept(%d<UNIX:[%lu,\"%s\"]>, {sa_family=AF_UNIX"
               ", sun_path=@\"%s\"}, [%u]) = %d<UNIX:[%lu->%lu,\"%s\"]>\n",
               listen_fd, listen_inode, av[1], sun_path1, (unsigned) *len,
               accept_fd, accept_inode, connect_inode, av[1]);
@@ -190,7 +190,7 @@ main(int ac, const char **av)
        *len = sizeof(addr);
        if (getpeername(connect_fd, listen_sa, len))
                perror_msg_and_fail("getpeername");
-       printf("getpeername(%d<UNIX:[%lu->%lu,@\"%s\"]>, {sa_family=AF_LOCAL"
+       printf("getpeername(%d<UNIX:[%lu->%lu,@\"%s\"]>, {sa_family=AF_UNIX"
               ", sun_path=\"%s\"}, [%u]) = 0\n", connect_fd, connect_inode,
               accept_inode, sun_path1, av[1], (unsigned) *len);
 
index b91cbbbe2afa392a72bb7c679b016cb95d340ef4..269adc6f9d8c0caac28f9013c070e3b5c70986f6 100644 (file)
@@ -138,8 +138,8 @@ int main(void)
        close(1);
 
        (void) unlink(SUN_PATH);
-       if (socket(AF_LOCAL, SOCK_STREAM, 0))
-               perror_msg_and_skip("socket AF_LOCAL");
+       if (socket(AF_UNIX, SOCK_STREAM, 0))
+               perror_msg_and_skip("socket AF_UNIX");
        if (bind(0, (struct sockaddr *) &addr, len))
                perror_msg_and_skip("bind");
        if (listen(0, 5))
index f8c49d778afcd4b6bfc727bf013c29a8872d4227..ce3a98558bc95d4f78c84bafa7ffee1e73bd8da1 100644 (file)
@@ -1,5 +1,4 @@
 AF_UNSPEC
-AF_LOCAL
 AF_UNIX
 AF_INET
 AF_AX25