Commit 569e3ad1 authored by Sergey Vojtovich's avatar Sergey Vojtovich

MDEV-15655: Add Linux abstract socket support

Less ifdefs, disable main.connect-abstract until libmariadb is updated.
parent 08098366
...@@ -21,3 +21,4 @@ innodb-wl5522-debug-zip : broken upstream ...@@ -21,3 +21,4 @@ innodb-wl5522-debug-zip : broken upstream
innodb_bug12902967 : broken upstream innodb_bug12902967 : broken upstream
file_contents : MDEV-6526 these files are not installed anymore file_contents : MDEV-6526 these files are not installed anymore
max_statement_time : cannot possibly work, depends on timing max_statement_time : cannot possibly work, depends on timing
connect-abstract : waiting for libmariadb update
...@@ -2787,7 +2787,7 @@ static void network_init(void) ...@@ -2787,7 +2787,7 @@ static void network_init(void)
size_t port_len; size_t port_len;
DBUG_PRINT("general",("UNIX Socket is %s",mysqld_unix_port)); DBUG_PRINT("general",("UNIX Socket is %s",mysqld_unix_port));
if ((port_len=strlen(mysqld_unix_port)) > (sizeof(UNIXaddr.sun_path) - 1)) if ((port_len= strlen(mysqld_unix_port)) > sizeof(UNIXaddr.sun_path) - 1)
{ {
sql_print_error("The socket file path is too long (> %u): %s", sql_print_error("The socket file path is too long (> %u): %s",
(uint) sizeof(UNIXaddr.sun_path) - 1, mysqld_unix_port); (uint) sizeof(UNIXaddr.sun_path) - 1, mysqld_unix_port);
...@@ -2808,22 +2808,23 @@ static void network_init(void) ...@@ -2808,22 +2808,23 @@ static void network_init(void)
#if defined(__linux__) #if defined(__linux__)
/* Abstract socket */ /* Abstract socket */
if (mysqld_unix_port[0] == '@') if (mysqld_unix_port[0] == '@')
{
UNIXaddr.sun_path[0]= '\0'; UNIXaddr.sun_path[0]= '\0';
port_len+= offsetof(struct sockaddr_un, sun_path);
}
else else
#endif #endif
{
(void) unlink(mysqld_unix_port); (void) unlink(mysqld_unix_port);
port_len= sizeof(UNIXaddr);
}
arg= 1; arg= 1;
(void) mysql_socket_setsockopt(unix_sock,SOL_SOCKET,SO_REUSEADDR, (void) mysql_socket_setsockopt(unix_sock,SOL_SOCKET,SO_REUSEADDR,
(char*)&arg, sizeof(arg)); (char*)&arg, sizeof(arg));
umask(0); umask(0);
if (mysql_socket_bind(unix_sock, if (mysql_socket_bind(unix_sock,
reinterpret_cast<struct sockaddr *>(&UNIXaddr), reinterpret_cast<struct sockaddr *>(&UNIXaddr),
#if defined(__linux__) port_len) < 0)
offsetof(struct sockaddr_un, sun_path) + port_len
#else
sizeof(UNIXaddr)
#endif
) < 0)
{ {
sql_perror("Can't start server : Bind on unix socket"); /* purecov: tested */ sql_perror("Can't start server : Bind on unix socket"); /* purecov: tested */
sql_print_error("Do you already have another mysqld server running on socket: %s ?",mysqld_unix_port); sql_print_error("Do you already have another mysqld server running on socket: %s ?",mysqld_unix_port);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment