diff --git a/sysutils/mpifileutils/Makefile b/sysutils/mpifileutils/Makefile new file mode 100644 --- /dev/null +++ b/sysutils/mpifileutils/Makefile @@ -0,0 +1,29 @@ +PORTNAME= mpifileutils +DISTVERSIONPREFIX= v +DISTVERSION= 0.12 +CATEGORIES= sysutils parallel + +MAINTAINER= rikka.goering@outlook.de +COMMENT= MPI-based parallel file utilities (dcp, dcmp, ddup, dtar, etc.) +WWW= https://hpc.github.io/mpifileutils/ + +LICENSE= BSD3CLAUSE +LICENSE_FILE= ${WRKSRC}/LICENSE + +LIB_DEPENDS= libcircle.so:devel/libcircle \ + libdtcmp.so:devel/dtcmp + +USES= cmake localbase:ldflags mpi pkgconfig ssl +USE_GITHUB= yes +GH_ACCOUNT= hpc +GH_PROJECT= mpifileutils +GH_TAGNAME= ${DISTVERSIONPREFIX}${DISTVERSION} + +USE_LDCONFIG= yes + +CMAKE_ARGS+= -DCMAKE_C_COMPILER=${MPICC} \ + -DCMAKE_CXX_COMPILER=${MPICXX} +CMAKE_ON= BUILD_SHARED_LIBS +CMAKE_OFF= ENABLE_GPFS ENABLE_LUSTRE ENABLE_XATTRS + +.include diff --git a/sysutils/mpifileutils/distinfo b/sysutils/mpifileutils/distinfo new file mode 100644 --- /dev/null +++ b/sysutils/mpifileutils/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1768082583 +SHA256 (hpc-mpifileutils-v0.12_GH0.tar.gz) = adfcfd2c15ad5ef827bb19def2dd094bff4e2aab7ba47e1efc5d1b0b7ba1bf2f +SIZE (hpc-mpifileutils-v0.12_GH0.tar.gz) = 848048 diff --git a/sysutils/mpifileutils/files/patch-src_common_mfu__bz2.h b/sysutils/mpifileutils/files/patch-src_common_mfu__bz2.h new file mode 100644 --- /dev/null +++ b/sysutils/mpifileutils/files/patch-src_common_mfu__bz2.h @@ -0,0 +1,10 @@ +--- src/common/mfu_bz2.h.orig 2025-12-15 01:37:35 UTC ++++ src/common/mfu_bz2.h +@@ -1,6 +1,7 @@ + #ifndef MFU_BZ2_H + #define MFU_BZ2_H + ++int mfu_compress_bz2_static(const char* src_name, const char* dst_name, int b_size); + int mfu_compress_bz2(const char* src_name, const char* dst_name, int b_size); + int mfu_decompress_bz2(const char* src_name, const char* dst_name); + diff --git a/sysutils/mpifileutils/files/patch-src_common_mfu__bz2.c b/sysutils/mpifileutils/files/patch-src_common_mfu__bz2.c new file mode 100644 --- /dev/null +++ b/sysutils/mpifileutils/files/patch-src_common_mfu__bz2.c @@ -0,0 +1,15 @@ +--- src/common/mfu_bz2.c.orig 2026-01-10 23:26:29 UTC ++++ src/common/mfu_bz2.c +@@ -6,7 +6,12 @@ + #include + + /* for statfs */ ++#if defined(__linux__) + #include ++#else ++#include ++#include ++#endif + + /* for LL_SUPER_MAGIC */ + #if LUSTRE_SUPPORT diff --git a/sysutils/mpifileutils/files/patch-src_common_mfu__bz2__static.c b/sysutils/mpifileutils/files/patch-src_common_mfu__bz2__static.c new file mode 100644 --- /dev/null +++ b/sysutils/mpifileutils/files/patch-src_common_mfu__bz2__static.c @@ -0,0 +1,101 @@ +--- src/common/mfu_bz2_static.c.orig 2025-12-14 21:30:29 UTC ++++ src/common/mfu_bz2_static.c +@@ -5,7 +5,9 @@ + #include + #include + #include ++#if defined(__linux__) + #include ++#endif + #include + #include + #include +@@ -23,6 +25,11 @@ + #include "mfu.h" + #include "mfu_bz2.h" + ++/* FreeBSD does not define O_LARGEFILE; large file support is implicit. */ ++#ifndef O_LARGEFILE ++#define O_LARGEFILE 0 ++#endif ++ + #define FILE_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) + + int mfu_compress_bz2_static(const char* src_name, const char* dst_name, int b_size) +@@ -268,21 +275,6 @@ int mfu_compress_bz2_static(const char* src_name, cons + /* End of all waves */ + MPI_Barrier(MPI_COMM_WORLD); + +-/* +- size_t footer_offset_size = 10 * 1024 * 1024; +- size_t single_pair_size = 16 * ranks; +- if (footer_offset_size < single_pair_size) { +- footer_offset_size = single_pair_size; +- } +- int64_t pairs_per_gather_step = footer_offset_size / single_pair_size; +- for (i = 0; i < pairs_per_gather_step; i++) { +- } +-*/ +- +- /* TODO: gather these in larger blocks to rank 0 for writing, +- * tight interleaving as written will not perform well with +- * byte range locking on lustre */ +- + /* Each process writes the offset of all blocks processed by it at corect location in trailer */ + for (int k = 0; k < my_blocks; k++) { + /* seek to metadata location for this block */ +@@ -543,7 +535,7 @@ int mfu_decompress_bz2_static(const char* src_name, co + rc = MFU_FAILURE; + break; + } +- ++ + /* read offset of block */ + uint64_t net_offset; + ssize_t nread = mfu_read(src_name, fd, &net_offset, 8); +@@ -563,15 +555,15 @@ int mfu_decompress_bz2_static(const char* src_name, co + rc = MFU_FAILURE; + break; + } +- ++ + /* convert values from network to host order */ + int64_t offset = mfu_ntoh64(net_offset); + int64_t length = mfu_ntoh64(net_length); +- ++ + /* compute max size of buffer to hold uncompressed data: + * BZ2 scheme requires block_size + 1% + 600 bytes */ + unsigned int outSize = (unsigned int)block_size; +- ++ + /* seek to start of compressed block in source file */ + lseek_rc = mfu_lseek(src_name, fd, offset, SEEK_SET); + if (lseek_rc == (off_t)-1) { +@@ -589,7 +581,7 @@ int mfu_decompress_bz2_static(const char* src_name, co + rc = MFU_FAILURE; + break; + } +- ++ + /* Perform decompression */ + int ret = BZ2_bzBuffToBuffDecompress(obuf, &outSize, ibuf, inSize, 0, 0); + if (ret != 0) { +@@ -597,10 +589,10 @@ int mfu_decompress_bz2_static(const char* src_name, co + rc = MFU_FAILURE; + break; + } +- ++ + /* compute offset to start of uncompressed block in target file */ + int64_t in_offset = block_no * block_size; +- ++ + /* seek to position to write block in target file */ + lseek_rc = mfu_lseek(dst_name, fd_out, in_offset, SEEK_SET); + if (lseek_rc == (off_t)-1) { +@@ -658,3 +650,4 @@ int mfu_decompress_bz2_static(const char* src_name, co + + return rc; + } ++ diff --git a/sysutils/mpifileutils/files/patch-src_common_mfu__compress__bz2__libcircle.c b/sysutils/mpifileutils/files/patch-src_common_mfu__compress__bz2__libcircle.c new file mode 100644 --- /dev/null +++ b/sysutils/mpifileutils/files/patch-src_common_mfu__compress__bz2__libcircle.c @@ -0,0 +1,28 @@ +--- src/common/mfu_compress_bz2_libcircle.c.orig 2026-01-10 22:23:16 UTC ++++ src/common/mfu_compress_bz2_libcircle.c +@@ -1,3 +1,20 @@ ++#if !defined(__linux__) ++/* ++ * Non-Linux fallback: ++ * The libcircle-based implementation relies on sysinfo(2) / . ++ * FreeBSD doesn't provide that API, so fall back to the portable static path. ++ */ ++#include "mfu.h" ++#include "mfu_bz2.h" ++ ++int mfu_compress_bz2_libcircle(const char* src, const char* dst, int b_size, ssize_t opts_memory) ++{ ++ (void) opts_memory; ++ return mfu_compress_bz2_static(src, dst, b_size); ++} ++ ++#else /* __linux__ */ ++ + #ifndef _GNU_SOURCE + #define _GNU_SOURCE + #endif +@@ -531,3 +548,4 @@ int mfu_compress_bz2_libcircle(const char* src, const + + return rc; + } ++#endif /* __linux__ */ diff --git a/sysutils/mpifileutils/files/patch-src_common_mfu__decompress__bz2__libcircle.c b/sysutils/mpifileutils/files/patch-src_common_mfu__decompress__bz2__libcircle.c new file mode 100644 --- /dev/null +++ b/sysutils/mpifileutils/files/patch-src_common_mfu__decompress__bz2__libcircle.c @@ -0,0 +1,12 @@ +--- src/common/mfu_decompress_bz2_libcircle.c.orig 2025-12-14 21:18:33 UTC ++++ src/common/mfu_decompress_bz2_libcircle.c +@@ -5,7 +5,9 @@ + #include + #include + #include ++#if defined(__linux__) + #include ++#endif + #include + #include + #include diff --git a/sysutils/mpifileutils/files/patch-src_common_mfu__flist.h b/sysutils/mpifileutils/files/patch-src_common_mfu__flist.h new file mode 100644 --- /dev/null +++ b/sysutils/mpifileutils/files/patch-src_common_mfu__flist.h @@ -0,0 +1,11 @@ +--- src/common/mfu_flist.h.orig 2025-12-07 17:14:40 UTC ++++ src/common/mfu_flist.h +@@ -44,7 +44,7 @@ extern "C" { + #include + #include "mpi.h" + +-#if DCOPY_USE_XATTRS ++#if defined(__linux__) && DCOPY_USE_XATTRS + #include + /* + * Newer versions of attr deprecated attr/xattr.h which defines ENOATTR as a diff --git a/sysutils/mpifileutils/files/patch-src_common_mfu__flist.c b/sysutils/mpifileutils/files/patch-src_common_mfu__flist.c new file mode 100644 --- /dev/null +++ b/sysutils/mpifileutils/files/patch-src_common_mfu__flist.c @@ -0,0 +1,53 @@ +--- src/common/mfu_flist.c.orig 2025-02-19 22:20:52 UTC ++++ src/common/mfu_flist.c +@@ -35,8 +35,13 @@ + #include + #include + ++/* Linux-specific file flag ioctls live in ; ++ * not available (and not used) on FreeBSD. ++ */ ++#ifdef __linux__ + #include + #include ++#endif + + #include /* dirname */ + #include "libcircle.h" +@@ -845,7 +850,7 @@ uint64_t mfu_flist_file_get_perm(mfu_flist bflist, uin + return mode & (S_IRWXU | S_IRWXG | S_IRWXO); + } + +-#if DCOPY_USE_XATTRS ++#if defined(__linux__) && DCOPY_USE_XATTRS + void *mfu_flist_file_get_acl(mfu_flist bflist, uint64_t idx, ssize_t *acl_size, char *type) + { + flist_t* flist = (flist_t*) bflist; +@@ -870,7 +875,7 @@ void *mfu_flist_file_get_acl(mfu_flist bflist, uint64_ + /* this is a real error */ + MFU_LOG(MFU_LOG_ERR, "Failed to get value for name=%s on `%s' lgetxattr() (errno=%d %s)", + type, filename, errno, strerror(errno) +- ); ++ ); + break; + } + } else { +@@ -886,7 +891,18 @@ void *mfu_flist_file_get_acl(mfu_flist bflist, uint64_ + + return val; + } ++#else ++void *mfu_flist_file_get_acl(mfu_flist bflist, uint64_t idx, ssize_t *acl_size, char *type) ++{ ++ (void)bflist; ++ (void)idx; ++ (void)type; ++ if (acl_size != NULL) ++ *acl_size = 0; ++ return NULL; ++} + #endif ++ + + uint64_t mfu_flist_file_get_uid(mfu_flist bflist, uint64_t idx) + { diff --git a/sysutils/mpifileutils/files/patch-src_common_mfu__flist__archive.c b/sysutils/mpifileutils/files/patch-src_common_mfu__flist__archive.c new file mode 100644 --- /dev/null +++ b/sysutils/mpifileutils/files/patch-src_common_mfu__flist__archive.c @@ -0,0 +1,34 @@ +--- src/common/mfu_flist_archive.c.orig 2025-02-19 22:20:52 UTC ++++ src/common/mfu_flist_archive.c +@@ -27,6 +27,10 @@ + #include + #include + ++#ifndef O_LARGEFILE ++#define O_LARGEFILE 0 ++#endif ++ + /* gettimeofday */ + #include + +@@ -5255,14 +5259,19 @@ static int extract_xattrs( + r = archive_entry_xattr_next(entry, &xname, &xval, &xsize); + if (r == ARCHIVE_OK) { + /* successfully extracted xattr, now try to set it */ ++#if defined(__linux__) + int set_rc = setxattr(path, xname, xval, xsize, 0); + if (set_rc == -1) { + MFU_LOG(MFU_LOG_ERR, "failed to setxattr '%s' on '%s' errno=%d %s", +- xname, path, errno, strerror(errno) ++ xname, path, errno, strerror(errno) + ); + rc = MFU_FAILURE; + /* don't break in case other xattrs work */ + } ++#else ++ /* FreeBSD uses extattr_* APIs; Linux setxattr() is not available. */ ++ (void)path; (void)xname; (void)xval; (void)xsize; ++#endif + } else { + /* failed to read xattr */ + MFU_LOG(MFU_LOG_ERR, "failed to extract xattr for '%s' of entry %llu at offset %llu", diff --git a/sysutils/mpifileutils/files/patch-src_common_mfu__flist__copy.c b/sysutils/mpifileutils/files/patch-src_common_mfu__flist__copy.c new file mode 100644 --- /dev/null +++ b/sysutils/mpifileutils/files/patch-src_common_mfu__flist__copy.c @@ -0,0 +1,56 @@ +--- src/common/mfu_flist_copy.c.orig 2026-01-10 22:30:42 UTC ++++ src/common/mfu_flist_copy.c +@@ -39,8 +39,10 @@ + #include + #include + ++#ifdef __linux__ + #include + #include ++#endif + + /* define PRI64 */ + #include +@@ -69,8 +71,10 @@ + #endif + + #ifdef HPSS_SUPPORT ++#ifdef __linux__ + #include + #endif ++#endif + + /**************************************** + * Define types +@@ -1864,6 +1868,7 @@ static int mfu_copy_file_normal( + return 0; + } + ++#ifdef __linux__ + static int mfu_copy_file_fiemap( + const char* src, + const char* dest, +@@ -2053,6 +2058,7 @@ fail_normal_copy: + fail_normal_copy: + return -1; + } ++#endif + + static int mfu_copy_file( + const char* src, +@@ -2084,6 +2090,7 @@ static int mfu_copy_file( + return -1; + } + ++#ifdef __linux__ + if (copy_opts->sparse) { + bool normal_copy_required; + ret = mfu_copy_file_fiemap(src, dest, offset, length, file_size, +@@ -2093,6 +2100,7 @@ static int mfu_copy_file( + return ret; + } + } ++#endif + + ret = mfu_copy_file_normal(src, dest, offset, length, file_size, + copy_opts, mfu_src_file, mfu_dst_file); diff --git a/sysutils/mpifileutils/files/patch-src_common_mfu__flist__walk.c b/sysutils/mpifileutils/files/patch-src_common_mfu__flist__walk.c new file mode 100644 --- /dev/null +++ b/sysutils/mpifileutils/files/patch-src_common_mfu__flist__walk.c @@ -0,0 +1,41 @@ +--- src/common/mfu_flist_walk.c.orig 2026-01-10 23:00:45 UTC ++++ src/common/mfu_flist_walk.c +@@ -186,8 +186,10 @@ static void walk_getdents_process_dir(const char* dir, + int flags = O_RDONLY | O_DIRECTORY; + char buf[BUF_SIZE]; + ++#ifdef __linux__ + if (NO_ATIME) + flags |= O_NOATIME; ++#endif + + /* TODO: may need to try these functions multiple times */ + mfu_file_t* mfu_file = *CURRENT_PFILE; +@@ -205,7 +207,17 @@ static void walk_getdents_process_dir(const char* dir, + /* Read all directory entries */ + while (1) { + /* execute system call to get block of directory entries */ +- int nread = syscall(SYS_getdents, mfu_file->fd, buf, (int) BUF_SIZE); ++ int nread; ++#ifdef __linux__ ++ /* On Linux, call the raw getdents syscall as before */ ++ nread = syscall(SYS_getdents, mfu_file->fd, buf, (int) BUF_SIZE); ++#else ++ /* ++ * On FreeBSD and other non-Linux systems, use the getdents(2) ++ * libc wrapper instead of the Linux-specific SYS_getdents. ++ */ ++ nread = getdents(mfu_file->fd, (char *)buf, (size_t)BUF_SIZE); ++#endif + if (nread == -1) { + MFU_LOG(MFU_LOG_ERR, "syscall to getdents failed when reading `%s' (errno=%d %s)", dir, errno, strerror(errno)); + WALK_RESULT = -1; +@@ -767,7 +779,7 @@ void mfu_flist_stat( + /* check whether we should skip this item */ + if (skip_fn != NULL && skip_fn(name, skip_args)) { + /* skip this file, don't include it in new list */ +- MFU_LOG(MFU_LOG_INFO, "skip %s"); ++ MFU_LOG(MFU_LOG_INFO, "skip %s", name); + continue; + } + diff --git a/sysutils/mpifileutils/files/patch-src_common_mfu__io.h b/sysutils/mpifileutils/files/patch-src_common_mfu__io.h new file mode 100644 --- /dev/null +++ b/sysutils/mpifileutils/files/patch-src_common_mfu__io.h @@ -0,0 +1,20 @@ +--- src/common/mfu_io.h.orig 2025-02-19 22:20:52 UTC ++++ src/common/mfu_io.h +@@ -42,12 +42,15 @@ extern "C" { + + #include "mfu_param_path.h" + ++#ifdef __FreeBSD__ ++#define stat64 stat ++#define lstat64 lstat ++#endif ++ + /* Intent is to wrap all POSIX I/O routines used by mfu tools. May + * abort on fatal conditions to avoid checking condition at every call. + * May also automatically retry on things like EINTR. */ + +-/* TODO: fix this */ +-/* do this to avoid warning about undefined stat64 struct */ + struct stat64; + + /***************************** diff --git a/sysutils/mpifileutils/files/patch-src_common_mfu__io.c b/sysutils/mpifileutils/files/patch-src_common_mfu__io.c new file mode 100644 --- /dev/null +++ b/sysutils/mpifileutils/files/patch-src_common_mfu__io.c @@ -0,0 +1,15 @@ +--- src/common/mfu_io.c.orig 2025-02-19 22:20:52 UTC ++++ src/common/mfu_io.c +@@ -21,6 +21,12 @@ + #include "mfu.h" + #include "mfu_errors.h" + ++/* FreeBSD does not provide lstat64, only lstat. Map it accordingly. */ ++#ifdef __FreeBSD__ ++#undef lstat64 ++#define lstat64(path, buf) lstat((path), (struct stat *)(buf)) ++#endif ++ + #define MFU_IO_TRIES (5) + #define MFU_IO_USLEEP (100) + diff --git a/sysutils/mpifileutils/files/patch-src_common_mfu__param__path.c b/sysutils/mpifileutils/files/patch-src_common_mfu__param__path.c new file mode 100644 --- /dev/null +++ b/sysutils/mpifileutils/files/patch-src_common_mfu__param__path.c @@ -0,0 +1,40 @@ +--- src/common/mfu_param_path.c.orig 2025-02-19 22:20:52 UTC ++++ src/common/mfu_param_path.c +@@ -1,5 +1,23 @@ + #define _GNU_SOURCE + ++/* Ensure POSIX faccessat(2) AT_* constants are visible on FreeBSD */ ++#ifndef _POSIX_C_SOURCE ++#define _POSIX_C_SOURCE 200809L ++#endif ++ ++#include ++#include ++#include ++#include ++ ++/* Fallbacks (in case headers hide these behind visibility macros) */ ++#ifndef AT_FDCWD ++#define AT_FDCWD (-100) ++#endif ++#ifndef AT_SYMLINK_NOFOLLOW ++#define AT_SYMLINK_NOFOLLOW 0 ++#endif ++ + #include "mfu.h" + #include "mpi.h" + +@@ -8,6 +26,13 @@ + #include + #include + #include ++ ++#include ++#include ++ ++#ifndef S_ISLNK ++#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) ++#endif + + #include + #include diff --git a/sysutils/mpifileutils/files/patch-src_common_mfu__util.h b/sysutils/mpifileutils/files/patch-src_common_mfu__util.h new file mode 100644 --- /dev/null +++ b/sysutils/mpifileutils/files/patch-src_common_mfu__util.h @@ -0,0 +1,13 @@ +--- src/common/mfu_util.h.orig 2026-01-10 23:35:04 UTC ++++ src/common/mfu_util.h +@@ -9,6 +9,10 @@ extern "C" { + #ifndef MFU_UTIL_H + #define MFU_UTIL_H + ++#ifndef O_NOATIME ++#define O_NOATIME 0 ++#endif ++ + #include + #include + #include diff --git a/sysutils/mpifileutils/files/patch-src_common_mfu__util.c b/sysutils/mpifileutils/files/patch-src_common_mfu__util.c new file mode 100644 --- /dev/null +++ b/sysutils/mpifileutils/files/patch-src_common_mfu__util.c @@ -0,0 +1,57 @@ +--- src/common/mfu_util.c.orig 2025-02-19 22:20:52 UTC ++++ src/common/mfu_util.c +@@ -1,6 +1,11 @@ + /* to get nsec fields in stat structure */ + #define _GNU_SOURCE + ++#if defined(__FreeBSD__) ++#include ++#include ++#endif ++ + #include "mfu.h" + #include "mpi.h" + #include "dtcmp.h" +@@ -14,12 +19,21 @@ + #include + #include + +-#include + #include ++#include + #include + ++#if defined(__linux__) + #include ++#else ++#include ++#include ++#endif + ++#ifndef S_ISLNK ++#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) ++#endif ++ + #ifndef ULLONG_MAX + #define ULLONG_MAX (__LONG_LONG_MAX__ * 2UL + 1UL) + #endif +@@ -779,8 +793,10 @@ int mfu_compare_contents( + + /* hint that we'll read from file sequentially */ + if (mfu_src_file->type != DAOS && mfu_src_file->type != DFS) { ++#if defined(POSIX_FADV_SEQUENTIAL) + posix_fadvise(mfu_src_file->fd, offset, length, POSIX_FADV_SEQUENTIAL); + posix_fadvise(mfu_src_file->fd, offset, length, POSIX_FADV_SEQUENTIAL); ++#endif + } + + /* assume we'll find that file contents are the same */ +@@ -939,7 +955,7 @@ int mfu_compare_contents( + /* check for write error */ + if (bytes_written < 0) { + MFU_LOG(MFU_LOG_ERR, "Failed to write `%s' at offset %llx (errno=%d %s)", +- dst_name, (unsigned long long)off + n, strerror(errno)); ++ dst_name, (unsigned long long)off + n, errno, strerror(errno)); + rc = -1; + break; + } diff --git a/sysutils/mpifileutils/files/patch-src_dbcast_dbcast.c b/sysutils/mpifileutils/files/patch-src_dbcast_dbcast.c new file mode 100644 --- /dev/null +++ b/sysutils/mpifileutils/files/patch-src_dbcast_dbcast.c @@ -0,0 +1,73 @@ +--- src/dbcast/dbcast.c.orig 2020-07-06 23:31:07 UTC ++++ src/dbcast/dbcast.c +@@ -16,7 +16,12 @@ + #include + #include + ++#ifdef __linux__ + #include ++#else ++#include ++#include ++#endif + + // mmap and friends for shared memory + #include +@@ -32,6 +37,14 @@ + * and send data to each other. The writer flow controls these worker + * processes with messages. */ + ++#ifndef HOST_NAME_MAX ++# ifdef MAXHOSTNAMELEN ++# define HOST_NAME_MAX MAXHOSTNAMELEN ++# else ++# define HOST_NAME_MAX 256 ++# endif ++#endif ++ + #define GCS_SUCCESS (0) + + static int gcs_shm_file_key = MPI_KEYVAL_INVALID; +@@ -803,7 +816,7 @@ int main (int argc, char *argv[]) + /* check whether we have space to write the file */ + if (file_size > free_size) { + /* not enough space for file */ +- MFU_LOG(MFU_LOG_ERR, "Insufficient space for file `%s` filesize=%llu free=%llu", out_file_path, file_size, free_size); ++ MFU_LOG(MFU_LOG_ERR, "Insufficient space for file `%s` filesize=%llu free=%llu", out_file_path, (unsigned long long)file_size, (unsigned long long)free_size); + write_error = 1; + } + } +@@ -1118,14 +1131,14 @@ if (node_rank == 0) { + * a file by the same name but of different size than a previous copy */ + errno = 0; + if (mfu_truncate(out_file_path, (off_t) file_size) != 0) { +- MFU_LOG(MFU_LOG_ERR, "Failed to truncate file `%s`", out_file_path, strerror(errno)); ++ MFU_LOG(MFU_LOG_ERR, "Failed to truncate file `%s`: %s", out_file_path, strerror(errno)); + write_error = 1; + } + + /* have every writer update file mode */ + errno = 0; + if (mfu_chmod(out_file_path, (mode_t) mode) != 0) { +- MFU_LOG(MFU_LOG_ERR, "Failed to chmod file `%s`", out_file_path, strerror(errno)); ++ MFU_LOG(MFU_LOG_ERR, "Failed to chmod file `%s`: %s", out_file_path, strerror(errno)); + write_error = 1; + } + +@@ -1133,14 +1146,14 @@ if (node_rank == 0) { + if (write_error) { + errno = 0; + if (mfu_unlink(out_file_path) != 0) { +- MFU_LOG(MFU_LOG_ERR, "Failed to unlink file `%s`", out_file_path, strerror(errno)); ++ MFU_LOG(MFU_LOG_ERR, "Failed to unlink file `%s`: %s", out_file_path, strerror(errno)); + } + } + } else { + /* readers close input file */ + errno = 0; + if (mfu_close(in_file_path, in_file) != 0) { +- MFU_LOG(MFU_LOG_ERR, "Failed to close file `%s`", in_file_path, strerror(errno)); ++ MFU_LOG(MFU_LOG_ERR, "Failed to close file `%s`: %s", in_file_path, strerror(errno)); + } + } + diff --git a/sysutils/mpifileutils/files/patch-src_dbz2_dbz2.c b/sysutils/mpifileutils/files/patch-src_dbz2_dbz2.c new file mode 100644 --- /dev/null +++ b/sysutils/mpifileutils/files/patch-src_dbz2_dbz2.c @@ -0,0 +1,15 @@ +--- src/dbz2/dbz2.c.orig 2025-02-19 22:20:52 UTC ++++ src/dbz2/dbz2.c +@@ -1,7 +1,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -256,3 +255,4 @@ int main(int argc, char** argv) + + return 0; + } ++ diff --git a/sysutils/mpifileutils/files/patch-src_dcmp_dcmp.c b/sysutils/mpifileutils/files/patch-src_dcmp_dcmp.c new file mode 100644 --- /dev/null +++ b/sysutils/mpifileutils/files/patch-src_dcmp_dcmp.c @@ -0,0 +1,15 @@ +--- src/dcmp/dcmp.c.orig 2025-12-08 09:21:51 UTC ++++ src/dcmp/dcmp.c +@@ -4,7 +4,12 @@ + #include + #include + #include ++#ifdef __linux__ + #include ++#else ++#include ++#include ++#endif + #include + #include + #include diff --git a/sysutils/mpifileutils/files/patch-src_dcp1_cleanup.c b/sysutils/mpifileutils/files/patch-src_dcp1_cleanup.c new file mode 100644 --- /dev/null +++ b/sysutils/mpifileutils/files/patch-src_dcp1_cleanup.c @@ -0,0 +1,13 @@ +--- src/dcp1/cleanup.c.orig 2025-12-11 05:20:58 UTC ++++ src/dcp1/cleanup.c +@@ -51,8 +51,8 @@ static void DCOPY_truncate_file(DCOPY_operation_t* op, + * Try the recursive file before file-to-file. The cast below requires us + * to have a maximum file_size of 2^63, not 2^64. + */ +- if(truncate64(dest_path_recursive, op->file_size) < 0) { +- if(truncate64(dest_path_file_to_file, op->file_size) < 0) { ++ if(mfu_truncate(dest_path_recursive, op->file_size) < 0) { ++ if(mfu_truncate(dest_path_file_to_file, op->file_size) < 0) { + MFU_LOG(MFU_LOG_ERR, "Failed to truncate destination file: %s (errno=%d %s)", + dest_path_recursive, errno, strerror(errno)); + diff --git a/sysutils/mpifileutils/files/patch-src_dcp1_common.h b/sysutils/mpifileutils/files/patch-src_dcp1_common.h new file mode 100644 --- /dev/null +++ b/sysutils/mpifileutils/files/patch-src_dcp1_common.h @@ -0,0 +1,28 @@ +--- src/dcp1/common.h.orig 2025-02-19 22:20:52 UTC ++++ src/dcp1/common.h +@@ -44,16 +44,12 @@ + #include + #include + +-#if DCOPY_USE_XATTRS ++#if defined(__linux__) && DCOPY_USE_XATTRS + #include +-/* +- * Newer versions of attr deprecated attr/xattr.h which defines ENOATTR as a +- * ENODATA. Add the definition to keep compatibility. +- */ + #ifndef ENOATTR + #define ENOATTR ENODATA + #endif +-#endif /* DCOPY_USE_XATTRS */ ++#endif + + /* default mode to create new files or directories */ + #define DCOPY_DEF_PERMS_FILE (S_IRUSR | S_IWUSR) +@@ -236,5 +232,4 @@ void DCOPY_exit( + void DCOPY_exit( + int code + ); +- +-#endif /* __COMMON_H_ */ ++#endif diff --git a/sysutils/mpifileutils/files/patch-src_dsync_dsync.c b/sysutils/mpifileutils/files/patch-src_dsync_dsync.c new file mode 100644 --- /dev/null +++ b/sysutils/mpifileutils/files/patch-src_dsync_dsync.c @@ -0,0 +1,22 @@ +--- src/dsync/dsync.c.orig 2025-12-15 01:38:57 UTC ++++ src/dsync/dsync.c +@@ -24,7 +24,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include +@@ -32,6 +32,10 @@ + #define _XOPEN_SOURCE 600 + #include + #include ++ ++#ifndef PATH_MAX ++#define PATH_MAX 4096 ++#endif + + /* for bool type, true/false macros */ + #include diff --git a/sysutils/mpifileutils/pkg-descr b/sysutils/mpifileutils/pkg-descr new file mode 100644 --- /dev/null +++ b/sysutils/mpifileutils/pkg-descr @@ -0,0 +1,6 @@ +mpiFileUtils provides a library (libmfu) and a suite of MPI-parallel file +utilities such as dcp (parallel copy), dcmp (compare), ddup (duplicate finder), +dfind, dtar/dbz2, dchmod, and more. Designed for high scalability on large +filesystems. + +Homepage: https://hpc.github.io/mpifileutils/ diff --git a/sysutils/mpifileutils/pkg-plist b/sysutils/mpifileutils/pkg-plist new file mode 100644 --- /dev/null +++ b/sysutils/mpifileutils/pkg-plist @@ -0,0 +1,44 @@ +bin/dbcast +bin/dbz2 +bin/dchmod +bin/dcmp +bin/dcp +bin/dcp1 +bin/ddup +bin/dfilemaker +bin/dfind +bin/dreln +bin/drm +bin/dstripe +bin/dsync +bin/dtar +bin/dwalk +include/mfu.h +include/mfu_bz2.h +include/mfu_errors.h +include/mfu_flist.h +include/mfu_flist_internal.h +include/mfu_io.h +include/mfu_param_path.h +include/mfu_path.h +include/mfu_pred.h +include/mfu_proc.h +include/mfu_progress.h +include/mfu_util.h +lib/libmfu.a +lib/libmfu.so +lib/libmfu.so.4.0.0 +share/man/man1/dbcast.1.gz +share/man/man1/dbz2.1.gz +share/man/man1/dchmod.1.gz +share/man/man1/dcmp.1.gz +share/man/man1/dcp.1.gz +share/man/man1/ddup.1.gz +share/man/man1/dfilemaker.1.gz +share/man/man1/dfind.1.gz +share/man/man1/dreln.1.gz +share/man/man1/drm.1.gz +share/man/man1/dstripe.1.gz +share/man/man1/dsync.1.gz +share/man/man1/dtar.1.gz +share/man/man1/dwalk.1.gz