Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config.h.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
#cmakedefine HAVE_LIBCRYPT 1
#cmakedefine HAVE_LIBMTMALLOC 1
#cmakedefine HAVE_LIBWRAP 1
#cmakedefine HAVE_SYSTEMD 1
/* Does "struct timespec" have a "sec" and "nsec" field? */
#cmakedefine HAVE_TIMESPEC_TS_SEC 1

Expand Down
25 changes: 25 additions & 0 deletions configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,22 @@ IF(UNIX)
SET(LIBWRAP "wrap")
ENDIF()
ENDIF()

OPTION(WITH_SYSTEMD "Compile with systemd notification on ready" ON)
IF(WITH_SYSTEMD)
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} systemd-daemon)
CHECK_C_SOURCE_COMPILES(
"
#include <systemd/sd-daemon.h>
int main()
{
sd_listen_fds(0);
}"
HAVE_SYSTEMD)
IF(HAVE_SYSTEMD)
SET(LIBSYSTEMD "systemd-daemon")
ENDIF()
ENDIF()
ENDIF()

#
Expand Down Expand Up @@ -251,6 +267,9 @@ CHECK_INCLUDE_FILES (wchar.h HAVE_WCHAR_H)
CHECK_INCLUDE_FILES (wctype.h HAVE_WCTYPE_H)
CHECK_INCLUDE_FILES (sys/sockio.h HAVE_SYS_SOCKIO_H)
CHECK_INCLUDE_FILES (sys/utsname.h HAVE_SYS_UTSNAME_H)
IF(WITH_SYSTEMD)
CHECK_INCLUDE_FILES (systemd/sd-daemon.h HAVE_SYSTEMD_SD_DAEMON_H)
ENDIF()

IF(BFD_H_EXISTS)
IF(NOT_FOR_DISTRIBUTION)
Expand Down Expand Up @@ -458,6 +477,12 @@ IF(HAVE_SYS_EVENT_H)
CHECK_FUNCTION_EXISTS (kqueue HAVE_KQUEUE)
ENDIF()

IF(WITH_SYSTEMD)
CHECK_FUNCTION_EXISTS (sd_listen_fds HAVE_SYSTEMD_SD_DAEMON_H)
CHECK_FUNCTION_EXISTS (sd_notify HAVE_SYSTEMD_SD_DAEMON_H)
CHECK_FUNCTION_EXISTS (sd_notifyf HAVE_SYSTEMD_SD_DAEMON_H)
ENDIF()

#--------------------------------------------------------------------
# Support for WL#2373 (Use cycle counter for timing)
#--------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions debian/dist/Debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Priority: optional
Maintainer: MariaDB Developers <maria-developers@lists.launchpad.net>
XSBC-Original-Maintainer: Maria Developers <maria-developers@lists.launchpad.net>
Uploaders: MariaDB Developers <maria-developers@lists.launchpad.net>
Build-Depends: libtool (>= 1.4.2-7), procps | hurd, debhelper, file (>= 3.28), libncurses5-dev (>= 5.0-6), perl (>= 5.6.0), libwrap0-dev (>= 7.6-8.3), zlib1g-dev (>= 1:1.1.3-5), ${LIBREADLINE_DEV}, libssl-dev, libpam0g-dev, psmisc, po-debconf, chrpath, automake1.9, doxygen, texlive-latex-base, ghostscript | gs-gpl, dpatch, gawk, bison, lsb-release, hardening-wrapper, ${CMAKE_DEP}libaio-dev, libjemalloc-dev (>= 3.0.0)
Build-Depends: libtool (>= 1.4.2-7), procps | hurd, debhelper, file (>= 3.28), libncurses5-dev (>= 5.0-6), perl (>= 5.6.0), libwrap0-dev (>= 7.6-8.3), zlib1g-dev (>= 1:1.1.3-5), ${LIBREADLINE_DEV}, libssl-dev, libpam0g-dev, psmisc, po-debconf, chrpath, automake1.9, doxygen, texlive-latex-base, ghostscript | gs-gpl, dpatch, gawk, bison, lsb-release, hardening-wrapper, ${CMAKE_DEP}libaio-dev, libjemalloc-dev (>= 3.0.0), libsystemd-daemon-dev, dh-systemd
Standards-Version: 3.8.3
Homepage: http://mariadb.org/
Vcs-Browser: http://bazaar.launchpad.net/~maria-captains/maria/10.0/files
Expand Down Expand Up @@ -147,7 +147,7 @@ Description: MariaDB database client binaries

Package: mariadb-server-core-10.0
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, libmariadbclient18 (>= ${binary:Version})
Depends: ${shlibs:Depends}, ${misc:Depends}, libmariadbclient18 (>= ${binary:Version}), libsystemd-daemon0
Provides: mysql-server-core, mysql-server-core-5.1, mysql-server-core-5.5
Conflicts: mariadb-server-5.1 (<< 5.1.60),
mariadb-server-5.2 (<< 5.2.10),
Expand Down
2 changes: 2 additions & 0 deletions debian/dist/Debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,9 @@ binary-indep: build install
dh_installexamples -i
dh_installmenu -i
dh_installlogrotate -i
dh_systemd_enable -i support-files/mariadb.service support-files/mariadb.socket
dh_installinit -i
dh_systemd_start -i --restart-after-upgrade mariadb.socket
dh_installcron -i
dh_installman -i
dh_installinfo -i
Expand Down
3 changes: 2 additions & 1 deletion debian/dist/Ubuntu/control
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Priority: optional
Maintainer: MariaDB Developers <maria-developers@lists.launchpad.net>
XSBC-Original-Maintainer: Maria Developers <maria-developers@lists.launchpad.net>
Uploaders: MariaDB Developers <maria-developers@lists.launchpad.net>
Build-Depends: libtool (>= 1.4.2-7), procps | hurd, debhelper, file (>= 3.28), libncurses5-dev (>= 5.0-6), perl (>= 5.6.0), libwrap0-dev (>= 7.6-8.3), zlib1g-dev (>= 1:1.1.3-5), ${LIBREADLINE_DEV}, libssl-dev, libpam0g-dev, psmisc, po-debconf, chrpath, automake1.9, doxygen, texlive-latex-base, ghostscript | gs-gpl, dpatch, gawk, bison, lsb-release, hardening-wrapper, ${CMAKE_DEP}libaio-dev, libjemalloc-dev (>= 3.0.0)
Build-Depends: libtool (>= 1.4.2-7), procps | hurd, debhelper, file (>= 3.28), libncurses5-dev (>= 5.0-6), perl (>= 5.6.0), libwrap0-dev (>= 7.6-8.3), zlib1g-dev (>= 1:1.1.3-5), ${LIBREADLINE_DEV}, libssl-dev, libpam0g-dev, psmisc, po-debconf, chrpath, automake1.9, doxygen, texlive-latex-base, ghostscript | gs-gpl, dpatch, gawk, bison, lsb-release, hardening-wrapper, ${CMAKE_DEP}libaio-dev, libjemalloc-dev (>= 3.0.0), libsystemd-daemon-dev, dh-systemd
Standards-Version: 3.8.2
Homepage: http://mariadb.org/
Vcs-Browser: http://bazaar.launchpad.net/~maria-captains/maria/10.0/files
Expand Down Expand Up @@ -148,6 +148,7 @@ Description: MariaDB database client binaries
Package: mariadb-server-core-10.0
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, libmariadbclient18 (>= ${binary:Version})
libsystemd-daemon0
Provides: mysql-server-core, mysql-server-core-5.1, mysql-server-core-5.5
Conflicts: mysql-server-5.0,
mysql-server-core-5.0, mysql-server-core-5.1, mysql-server-core-5.5,
Expand Down
2 changes: 2 additions & 0 deletions debian/dist/Ubuntu/rules
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ binary-indep: build install
dh_installexamples -i
dh_installmenu -i
dh_installlogrotate -i
dh_systemd_enable -i support-files/mariadb.service support-files/mariadb.socket
dh_installinit -i
dh_systemd_start -i --restart-after-upgrade mariadb.socket
dh_installcron -i
dh_installman -i
dh_installinfo -i
Expand Down
38 changes: 38 additions & 0 deletions include/mysql/psi/mysql_socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,22 @@ inline_mysql_socket_set_state(MYSQL_SOCKET socket, enum PSI_socket_state state)
}
#endif /* HAVE_PSI_SOCKET_INTERFACE */

/**
@def mysql_socket_fd(K, F)
Create a socket.
@c mysql_socket_socket is a replacement for @c socket.
@param K PSI_socket_key for this instrumented socket
@param F File descriptor
*/

#ifdef HAVE_PSI_SOCKET_INTERFACE
#define mysql_socket_fd(K, F) \
inline_mysql_socket_fd(K, F)
#else
#define mysql_socket_fd(K, F) \
inline_mysql_socket_fd(F)
#endif

/**
@def mysql_socket_socket(K, D, T, P)
Create a socket.
Expand Down Expand Up @@ -542,6 +558,28 @@ static inline void inline_mysql_socket_register(
}
#endif

/** mysql_socket_fd */

static inline MYSQL_SOCKET
inline_mysql_socket_fd
(
#ifdef HAVE_PSI_SOCKET_INTERFACE
PSI_socket_key key,
#endif
int fd)
{
MYSQL_SOCKET mysql_socket= MYSQL_INVALID_SOCKET;
mysql_socket.fd= fd;
#ifdef HAVE_PSI_SOCKET_INTERFACE
if (likely(mysql_socket.fd != INVALID_SOCKET))
{
mysql_socket.m_psi= PSI_SOCKET_CALL(init_socket)
(key, (const my_socket*)&mysql_socket.fd, NULL, 0);
}
#endif
return mysql_socket;
}

/** mysql_socket_socket */

static inline MYSQL_SOCKET
Expand Down
9 changes: 8 additions & 1 deletion sql/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ DTRACE_INSTRUMENT(sql)
TARGET_LINK_LIBRARIES(sql ${MYSQLD_STATIC_PLUGIN_LIBS}
mysys mysys_ssl dbug strings vio pcre ${LIBJEMALLOC}
${LIBWRAP} ${LIBCRYPT} ${LIBDL} ${CMAKE_THREAD_LIBS_INIT}
${SSL_LIBRARIES})
${LIBSYSTEMD} ${SSL_LIBRARIES})

IF(WIN32)
SET(MYSQLD_SOURCE main.cc nt_servc.cc nt_servc.h message.rc)
Expand Down Expand Up @@ -180,6 +180,13 @@ IF(INTERFACE_LIBS)
"${INTERFACE_LIBS}")
ENDIF()

IF(WITH_SYSTEMD)
# Used for notify systemd's feature
IF(HAVE_SYSTEMD_SD_DAEMON_H)
TARGET_LINK_LIBRARIES(mysqld systemd-daemon)
ENDIF()
ENDIF()

# On Solaris, some extra effort is required in order to get dtrace probes
# from static libraries
DTRACE_INSTRUMENT_STATIC_LIBS(mysqld
Expand Down
Loading