pidfd_open \
pidfd_send_signal \
posix_fadvise \
- posix_fallocate \
prctl \
qsort_r \
reallocarray \
AC_CHECK_FUNCS([ioperm iopl], [have_io=yes])
AC_CHECK_FUNCS([openat fstatat unlinkat], [have_openat=yes], [have_openat=no])
AC_CHECK_FUNCS([open_memstream], [have_open_memstream=yes],[have_open_memstream=no])
+AC_CHECK_FUNCS([posix_fallocate], [have_posix_fallocate=yes], [have_posix_fallocate=no])
AC_CHECK_FUNCS([reboot], [have_reboot=yes],[have_reboot=no])
AC_CHECK_FUNCS([updwtmpx updwtmpx], [have_gnu_utmpx=yes], [have_gnu_utmpx=no])
UL_BUILD_INIT([fallocate])
UL_REQUIRES_LINUX([fallocate])
UL_REQUIRES_HAVE([fallocate], [fallocate], [fallocate functions])
+UL_REQUIRES_HAVE([fallocate], [posix_fallocate], [posix_fallocate functions])
AM_CONDITIONAL([BUILD_FALLOCATE], [test "x$build_fallocate" = xyes])
fputs(_(" -p, --punch-hole replace a range with a hole (implies -n)\n"), out);
fputs(_(" -v, --verbose verbose mode\n"), out);
fputs(_(" -w, --write-zeroes write zeroes and ensure allocation of a range\n"), out);
-#ifdef HAVE_POSIX_FALLOCATE
fputs(_(" -x, --posix use posix_fallocate(3) instead of fallocate(2)\n"), out);
-#endif
fputs(_(" -z, --zero-range zero and ensure allocation of a range\n"), out);
fputs(USAGE_SEPARATOR, out);
}
}
-#ifdef HAVE_POSIX_FALLOCATE
static void xposix_fallocate(int fd, off_t offset, off_t length)
{
errno = posix_fallocate(fd, offset, length);
err(EXIT_FAILURE, _("fallocate failed"));
}
}
-#endif
/* The real buffer size has to be bufsize + sizeof(uintptr_t) */
static int is_nul(void *buf, size_t bufsize)
int fd;
int mode = 0;
int dig = 0;
-#ifdef HAVE_POSIX_FALLOCATE
int posix = 0;
-#endif
loff_t length = -2LL;
loff_t offset = 0;
mode |= FALLOC_FL_WRITE_ZEROES;
break;
case 'x':
-#ifdef HAVE_POSIX_FALLOCATE
posix = 1;
break;
-#else
- errx(EXIT_FAILURE, _("posix_fallocate support is not compiled"));
-#endif
case 'v':
verbose++;
break;
if (dig)
dig_holes(fd, offset, length);
else {
-#ifdef HAVE_POSIX_FALLOCATE
if (posix)
xposix_fallocate(fd, offset, length);
else
-#endif
xfallocate(fd, mode, offset, length);
if (verbose) {