diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c index 832056e41b6..1b2f1bc15b7 100644 --- a/cli/src/cli-cmd-volume.c +++ b/cli/src/cli-cmd-volume.c @@ -446,6 +446,7 @@ cli_cmd_get_confirmation(struct cli_state *state, const char *question) return GF_ANSWER_YES; printf("%s (y/n) ", question); + fflush(stdout); if (fgets(answer, 4, stdin) == NULL) { cli_out("gluster cli read error"); diff --git a/configure.ac b/configure.ac index ab1b4a7641a..7b0811a14e5 100644 --- a/configure.ac +++ b/configure.ac @@ -1108,6 +1108,9 @@ case $host_os in *netbsd*) ARGP_LDADD=-largp ;; + linux-musl*) + ARGP_LDADD=-largp + ;; esac dnl argp-standalone does not provide a pkg-config file AC_CHECK_HEADER([argp.h], AC_DEFINE(HAVE_ARGP, 1, [have argp])) @@ -1441,6 +1444,14 @@ prefix=$old_prefix GFAPI_EXTRA_LDFLAGS='-Wl,--version-script=$(top_srcdir)/api/src/gfapi.map' case $host_os in + linux-musl*) + GF_HOST_OS="GF_LINUX_HOST_OS" + GF_FUSE_CFLAGS="-DFUSERMOUNT_DIR=\\\"\$(bindir)\\\"" + GLUSTERD_WORKDIR="${LOCALSTATEDIR}/lib/glusterd" + GF_CFLAGS="${GF_CFLAGS} -I/usr/include/arch/common -DREDEFINE_QUAD_T -Doff64_t=int64_t -D__off64_t=int64_t -DF_SETLK64=F_SETLK -DF_SETLKW64=F_SETLKW -DF_GETLK64=F_GETLK -DUSE_LIBUCONTEXT=1" + GF_LDFLAGS="-lbsd -lucontext ${GF_LDFLAGS}" + GF_LDADD="${ARGP_LDADD}" + ;; linux*) GF_HOST_OS="GF_LINUX_HOST_OS" GF_FUSE_CFLAGS="-DFUSERMOUNT_DIR=\\\"\$(bindir)\\\"" diff --git a/contrib/fuse-lib/mount-gluster-compat.h b/contrib/fuse-lib/mount-gluster-compat.h index d3646d08d8e..f3239500b57 100644 --- a/contrib/fuse-lib/mount-gluster-compat.h +++ b/contrib/fuse-lib/mount-gluster-compat.h @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -91,6 +92,7 @@ typedef long long mount_flag_t; #define _PATH_MOUNT "/sbin/mount" #endif +#include "glusterfs/compat.h" #ifdef FUSE_UTIL #define MALLOC(size) malloc (size) #define FREE(ptr) free (ptr) diff --git a/contrib/fuse-util/fusermount.c b/contrib/fuse-util/fusermount.c index ff743f75a21..50fe5ee588c 100644 --- a/contrib/fuse-util/fusermount.c +++ b/contrib/fuse-util/fusermount.c @@ -14,6 +14,7 @@ #ifndef HAVE_UMOUNT2 #include "mount-gluster-compat.h" #endif +#include "glusterfs/compat.h" #include #include diff --git a/extras/quota/xattr_analysis.py b/extras/quota/xattr_analysis.py index 7bd7d96374c..84a9b4d95fc 100755 --- a/extras/quota/xattr_analysis.py +++ b/extras/quota/xattr_analysis.py @@ -21,7 +21,7 @@ LOG_FILE=sys.argv[1] def get_quota_xattr_brick(): - out = subprocess.check_output (["/usr/bin/cat", LOG_FILE]) + out = subprocess.check_output (["/bin/cat", LOG_FILE]) pairs = out.splitlines() xdict = {} diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index 6b5bec6dc9a..49d9dc7de3f 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -15,6 +15,7 @@ #include #include #include +#include #ifdef GF_LINUX_HOST_OS #ifdef HAVE_LINUX_OOM_H diff --git a/libglusterfs/src/glusterfs/compat-errno.h b/libglusterfs/src/glusterfs/compat-errno.h index 1f9926e850a..b90636d864c 100644 --- a/libglusterfs/src/glusterfs/compat-errno.h +++ b/libglusterfs/src/glusterfs/compat-errno.h @@ -12,6 +12,7 @@ #define __COMPAT_ERRNO_H__ #include +#include #define GF_ERROR_CODE_SUCCESS 0 #define GF_ERROR_CODE_UNKNOWN 1024 diff --git a/libglusterfs/src/glusterfs/compat.h b/libglusterfs/src/glusterfs/compat.h index 55bd035ce70..cc83b35bea4 100644 --- a/libglusterfs/src/glusterfs/compat.h +++ b/libglusterfs/src/glusterfs/compat.h @@ -12,13 +12,35 @@ #define __COMPAT_H__ #include +#include #ifndef LLONG_MAX #define LLONG_MAX __LONG_LONG_MAX__ /* compat with old gcc */ #endif /* LLONG_MAX */ +#include +#include + #ifdef GF_LINUX_HOST_OS +#ifndef HAVE_OFF64_T +typedef int64_t off64_t; +#endif + +#ifdef REDEFINE_QUAD_T +#define u_quad_t uint64_t +#define quad_t int64_t +#endif + +#ifndef HAVE_INET_NET_PTON +#include +int +inet_net_pton(int af, const char *src, void *dst, size_t size); +#endif +#ifndef _PATH_MOUNTED +#define _PATH_MOUNTED "/etc/mtab" +#endif + #define UNIX_PATH_MAX 108 #include diff --git a/libglusterfs/src/glusterfs/syscall.h b/libglusterfs/src/glusterfs/syscall.h index f6c904df38d..537868bcd4f 100644 --- a/libglusterfs/src/glusterfs/syscall.h +++ b/libglusterfs/src/glusterfs/syscall.h @@ -19,6 +19,7 @@ #include #include #include +#include "glusterfs/compat.h" /* GF follows the Linux XATTR definition, which differs in Darwin. */ #define GF_XATTR_CREATE 0x1 /* set value, fail if attr already exists */ diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c index f3d2651b673..b9adfcb17c7 100644 --- a/libglusterfs/src/syncop.c +++ b/libglusterfs/src/syncop.c @@ -23,6 +23,14 @@ #include #endif +#ifdef USE_LIBUCONTEXT +#include +#define getcontext libucontext_getcontext +#define makecontext libucontext_makecontext +#define setcontext libucontext_setcontext +#define swapcontext libucontext_swapcontext +#endif + int syncopctx_setfsuid(void *uid) { diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h index 13f1f129022..bf977eec227 100644 --- a/xlators/cluster/afr/src/afr.h +++ b/xlators/cluster/afr/src/afr.h @@ -11,6 +11,7 @@ #ifndef __AFR_H__ #define __AFR_H__ +#include #include #include #include "afr-mem-types.h" diff --git a/xlators/features/changelog/src/changelog-helpers.c b/xlators/features/changelog/src/changelog-helpers.c index 9c8b54b9341..7a820a92298 100644 --- a/xlators/features/changelog/src/changelog-helpers.c +++ b/xlators/features/changelog/src/changelog-helpers.c @@ -20,6 +20,7 @@ #include "changelog-rpc-common.h" #include #include +#include static void changelog_cleanup_free_mutex(void *arg_mutex) diff --git a/xlators/mgmt/glusterd/src/glusterd-quota.c b/xlators/mgmt/glusterd/src/glusterd-quota.c index c8488ce90ad..f6bcbbcb8d1 100644 --- a/xlators/mgmt/glusterd/src/glusterd-quota.c +++ b/xlators/mgmt/glusterd/src/glusterd-quota.c @@ -32,6 +32,10 @@ #endif #endif +#if !defined(STAT_COMMAND) +#define STAT_COMMAND "/usr/bin/stat" +#endif + /* Any negative pid to make it special client */ #define QUOTA_CRAWL_PID "-100" @@ -378,7 +382,7 @@ _glusterd_quota_initiate_fs_crawl(glusterd_conf_t *priv, if (type == GF_QUOTA_OPTION_TYPE_ENABLE || type == GF_QUOTA_OPTION_TYPE_ENABLE_OBJECTS) runner_add_args(&runner, "/usr/bin/find", ".", "-exec", - "/usr/bin/stat", "{}", "\\", ";", NULL); + STAT_COMMAND, "{}", "\\", ";", NULL); else if (type == GF_QUOTA_OPTION_TYPE_DISABLE) { #if defined(GF_DARWIN_HOST_OS) diff --git a/xlators/mgmt/glusterd/src/snapshot/glusterd-zfs-snapshot.c b/xlators/mgmt/glusterd/src/snapshot/glusterd-zfs-snapshot.c old mode 100644 new mode 100755 index 86e51bdfc82..f32ad6ee58a --- a/xlators/mgmt/glusterd/src/snapshot/glusterd-zfs-snapshot.c +++ b/xlators/mgmt/glusterd/src/snapshot/glusterd-zfs-snapshot.c @@ -26,7 +26,9 @@ #include "mntent_compat.h" #endif +#if !defined(ZFS_COMMAND) #define ZFS_COMMAND "/sbin/zfs" +#endif extern char snap_mount_dir[VALID_GLUSTERD_PATHMAX]; @@ -49,7 +51,8 @@ glusterd_zfs_dataset(char *brick_path, char **pool_name) snprintf(msg, sizeof(msg), "running zfs command, " "for getting zfs pool name from brick path"); - runner_add_args(&runner, "zfs", "list", "-Ho", "name", brick_path, NULL); + runner_add_args(&runner, ZFS_COMMAND, "list", "-Ho", "name", brick_path, + NULL); runner_redir(&runner, STDOUT_FILENO, RUN_PIPE); runner_log(&runner, "", GF_LOG_DEBUG, msg); ret = runner_start(&runner);