From 1bacab8ab9a0bff3b7e43920610b03d5a98b3282 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Fri, 19 Mar 2021 09:31:27 +0000 Subject: [PATCH] mariabackup little FreeBSD update support. In this platform, it s better not to rely on optional proc filesystem presence. Using native API to retrieve binary absolute path instead. --- extra/mariabackup/xtrabackup.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index b7839dc4944..37791d9dca7 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -58,13 +58,17 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA #ifdef __linux__ # include -#include +# include #endif #ifdef __APPLE__ # include "libproc.h" #endif +#ifdef __FreeBSD__ +# include +#endif + #include #include @@ -6718,6 +6722,11 @@ static int get_exepath(char *buf, size_t size, const char *argv0) buf[ret] = 0; return 0; } +#elif defined(__FreeBSD__) + int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1}; + if (sysctl(mib, 4, buf, &size, NULL, 0) == 0) { + return 0; + } #endif return my_realpath(buf, argv0, 0);