return syscall(SYS_listmount, &req, list, num, flags);
}
+
+static inline int has_listmount(void)
+{
+ uint64_t dummy;
+
+ errno = 0;
+
+ if (ul_listmount(LSMT_ROOT, 0, 0, &dummy, 1, LISTMOUNT_REVERSE) != 1)
+ return 0;
+ return 1;
+}
#endif
#endif /* HAVE_STATMOUNT_API */
ls = tb->lsmnt;
/* check if supported by current kernel */
- if (!ls) {
- uint64_t dummy;
-
- errno = 0;
- if (ul_listmount(LSMT_ROOT, 0, 0, &dummy, 1, LISTMOUNT_REVERSE) != 1) {
- if (errno == ENOSYS)
- DBG(TAB, ul_debugobj(tb, "listmount: unsuppported"));
- if (errno == EINVAL)
- DBG(TAB, ul_debugobj(tb, "listmount: reverse unsuppported"));
- errno = ENOSYS;
- return -ENOSYS;
- }
+ if (!ls && !has_listmount()) {
+ if (errno == ENOSYS)
+ DBG(TAB, ul_debugobj(tb, "listmount: unsuppported"));
+ if (errno == EINVAL)
+ DBG(TAB, ul_debugobj(tb, "listmount: reverse unsuppported"));
+ errno = ENOSYS;
+ return -ENOSYS;
}
/* reset if allocated for a different size */
static int hlp_listmount_ok(void)
{
+ printf("%d\n",
#ifdef HAVE_STATMOUNT_API
- uint64_t dummy;
- errno = 0;
- ul_listmount(LSMT_ROOT, 0, 0, &dummy, 1, LISTMOUNT_REVERSE);
+ has_listmount()
#else
- errno = ENOSYS;
+ 0
#endif
- printf("%d\n", !(errno == ENOSYS || errno == EINVAL));
+ );
return 0;
}