Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Alpine Linux 3.21 / linux-musl #4450

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from
Open
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 cli/src/cli-cmd-volume.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
11 changes: 11 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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]))
Expand Down Expand Up @@ -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)\\\""
Expand Down
2 changes: 2 additions & 0 deletions contrib/fuse-lib/mount-gluster-compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <stddef.h>
#include <limits.h>
#include <fcntl.h>
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions contrib/fuse-util/fusermount.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#ifndef HAVE_UMOUNT2
#include "mount-gluster-compat.h"
#endif
#include "glusterfs/compat.h"

#include <stdio.h>
#include <stdlib.h>
Expand Down
2 changes: 1 addition & 1 deletion extras/quota/xattr_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand Down
1 change: 1 addition & 0 deletions glusterfsd/src/glusterfsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <pthread.h>
#include <errno.h>
#include <pwd.h>
#include <libgen.h>

#ifdef GF_LINUX_HOST_OS
#ifdef HAVE_LINUX_OOM_H
Expand Down
1 change: 1 addition & 0 deletions libglusterfs/src/glusterfs/compat-errno.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#define __COMPAT_ERRNO_H__

#include <errno.h>
#include <stdint.h>

#define GF_ERROR_CODE_SUCCESS 0
#define GF_ERROR_CODE_UNKNOWN 1024
Expand Down
22 changes: 22 additions & 0 deletions libglusterfs/src/glusterfs/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,35 @@
#define __COMPAT_H__

#include <stdint.h>
#include <sys/types.h>

#ifndef LLONG_MAX
#define LLONG_MAX __LONG_LONG_MAX__ /* compat with old gcc */
#endif /* LLONG_MAX */

#include <libgen.h>
#include <string.h>

#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 <stddef.h>
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 <sys/un.h>
Expand Down
1 change: 1 addition & 0 deletions libglusterfs/src/glusterfs/syscall.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <sys/socket.h>
#include <sys/types.h>
#include <stdio.h>
#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 */
Expand Down
8 changes: 8 additions & 0 deletions libglusterfs/src/syncop.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@
#include <valgrind/valgrind.h>
#endif

#ifdef USE_LIBUCONTEXT
#include <libucontext/libucontext.h>
#define getcontext libucontext_getcontext
#define makecontext libucontext_makecontext
#define setcontext libucontext_setcontext
#define swapcontext libucontext_swapcontext
#endif

int
syncopctx_setfsuid(void *uid)
{
Expand Down
1 change: 1 addition & 0 deletions xlators/cluster/afr/src/afr.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#ifndef __AFR_H__
#define __AFR_H__

#include <libgen.h>
#include <glusterfs/call-stub.h>
#include <glusterfs/compat-errno.h>
#include "afr-mem-types.h"
Expand Down
1 change: 1 addition & 0 deletions xlators/features/changelog/src/changelog-helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "changelog-rpc-common.h"
#include <pthread.h>
#include <time.h>
#include <libgen.h>

static void
changelog_cleanup_free_mutex(void *arg_mutex)
Expand Down
6 changes: 5 additions & 1 deletion xlators/mgmt/glusterd/src/glusterd-quota.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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)
Expand Down
5 changes: 4 additions & 1 deletion xlators/mgmt/glusterd/src/snapshot/glusterd-zfs-snapshot.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand All @@ -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);
Expand Down