diff options
author | Daniel Black <grooverdan@users.sourceforge.net> | 2018-03-25 13:42:48 +1100 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2018-05-10 13:55:28 +0400 |
commit | 08098366d2f115037f0d844d59152b46e3ab19d8 (patch) | |
tree | 33b661c8bc3aaef9d31329f01375c5236da2ebf6 /mysql-test/main/connect-abstract.result | |
parent | eaaf004cc194d1f1fc422ebbd986ae69fc854d1c (diff) | |
download | mariadb-git-08098366d2f115037f0d844d59152b46e3ab19d8.tar.gz |
MDEV-15655: Add Linux abstract socket support
The functionality of the socket system variable is extended
here such that a preciding '@' indicates that the socket
will be an abstract socket. Thie socket name wil be
the remainder of the name after the '@'. This is consistent
with the approached used by systemd in socket activation.
Thanks to Sergey Vojtovich:
On OS X sockaddr_un is defined as:
struct sockaddr_un
{
u_char sun_len;
u_char sun_family;
char sun_path[104];
};
There is a comment in man 7 unix (on linux):
"
On Linux, the above offsetof() expression equates to the same value as sizeof(sa_family_t),
but some other implementations include other fields before sun_path, so the offsetof()
expression more portably describes the size of the address structure.
"
As such, use the offsetof for Linux and use the previous sizeof(UNIXaddr)
for non-unix platforms as that's what worked before and they don't
support abstract sockets so there's no compatibility problem..
strace -fe trace=networking mysqld --skip-networking --socket @abc ...
...
[pid 10578] socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC, 0) = 22
[pid 10578] setsockopt(22, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
[pid 10578] bind(22, {sa_family=AF_UNIX, sun_path=@"abc"}, 6) = 0
[pid 10578] listen(22, 80) = 0
...
Version: '10.3.6-MariaDB-log' socket: '@abc' port: 0 Source distribution
$ lsof -p 10578
mysqld 10578 dan 22u unix 0x00000000087e688c 0t0 4787815 @abc type=STREAM
Diffstat (limited to 'mysql-test/main/connect-abstract.result')
-rw-r--r-- | mysql-test/main/connect-abstract.result | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/mysql-test/main/connect-abstract.result b/mysql-test/main/connect-abstract.result new file mode 100644 index 00000000000..68a9674dfaa --- /dev/null +++ b/mysql-test/main/connect-abstract.result @@ -0,0 +1,5 @@ +connect con1,localhost,root,,test,,$ABSTRACT_SOCKET; +select 1; +1 +1 +disconnect con1; |