** Improvements
+ On macOS, cp creates a copy-on-write clone if source and destination
+ are regular files on the same APFS file system, the destination does
+ not already exist, and cp is preserving mode and timestamps (e.g.,
+ 'cp -p', 'cp -a').
+
sort --debug now diagnoses issues with --field-separator characters
that conflict with characters possibly used in numbers.
AC_DEFINE([LOCALTIME_CACHE], [1], [FIXME])
fi
+# macOS >= 10.12
+AC_CHECK_FUNCS([fclonefileat])
+
# Assume that if getattrat exists, it's compatible with Solaris 11.
AC_CHECK_FUNCS([getattrat])
if test $ac_cv_func_getattrat = yes; then
# define FICLONE _IOW (0x94, 9, int)
#endif
+#if HAVE_FCLONEFILEAT && !USE_XATTR
+# include <sys/clonefile.h>
+#endif
+
#ifndef HAVE_FCHOWN
# define HAVE_FCHOWN false
# define fchown(fd, uid, gid) (-1)
if (*new_dst)
{
+#if HAVE_FCLONEFILEAT && !USE_XATTR
+ int clone_flags = x->preserve_ownership ? 0 : CLONE_NOOWNERCOPY;
+ if (data_copy_required && x->reflink_mode
+ && x->preserve_mode && x->preserve_timestamps
+ && fclonefileat (source_desc, AT_FDCWD, dst_name, clone_flags) == 0)
+ goto close_src_desc;
+#endif
+
/* To allow copying xattrs on read-only files, create with u+w.
This satisfies an inode permission check done by
xattr_permission in fs/xattr.c of the GNU/Linux kernel. */