Hello, Karel Zak, le lun. 31 janv. 2022 16:14:32 +0100, a ecrit: > The util-linux release v2.38-rc1 is available at > > http://www.kernel.org/pub/linux/utils/util-linux/v2.38/ Thanks, here are a few non-Linux portability fixes With regards, Samuel
diff --git a/libmount/src/utils.c b/libmount/src/utils.c index dc8f7c9eb..e41ced2c3 100644 --- a/libmount/src/utils.c +++ b/libmount/src/utils.c @@ -1141,6 +1141,7 @@ done: */ int mnt_tmptgt_unshare(int *old_ns_fd) { +#ifdef USE_LIBMOUNT_SUPPORT_NAMESPACES int rc = 0, fd = -1; assert(old_ns_fd); @@ -1182,6 +1183,9 @@ fail: mnt_tmptgt_cleanup(fd); DBG(UTILS, ul_debug(MNT_PATH_TMPTGT " unshare failed")); return rc; +#else + return -ENOSYS; +#endif } /* @@ -1189,6 +1193,7 @@ fail: */ int mnt_tmptgt_cleanup(int old_ns_fd) { +#ifdef USE_LIBMOUNT_SUPPORT_NAMESPACES umount(MNT_PATH_TMPTGT); if (old_ns_fd >= 0) { @@ -1198,6 +1203,9 @@ int mnt_tmptgt_cleanup(int old_ns_fd) DBG(UTILS, ul_debug(MNT_PATH_TMPTGT " cleanup done")); return 0; +#else + return -ENOSYS; +#endif } #ifdef TEST_PROGRAM diff --git a/login-utils/su-common.c b/login-utils/su-common.c index f71dbf928..3021b88bc 100644 --- a/login-utils/su-common.c +++ b/login-utils/su-common.c @@ -980,8 +980,12 @@ static void sanitize_prlimits(void) struct rlimit lm = { .rlim_cur = 0, .rlim_max = 0 }; /* reset to zero */ +#ifdef RLIMIT_NICE setrlimit(RLIMIT_NICE, &lm); +#endif +#ifdef RLIMIT_RTPRIO setrlimit(RLIMIT_RTPRIO, &lm); +#endif /* reset to unlimited */ lm.rlim_cur = RLIM_INFINITY; diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c index 97c6ca951..f1b5baf94 100644 --- a/sys-utils/hwclock.c +++ b/sys-utils/hwclock.c @@ -1154,6 +1154,7 @@ manipulate_epoch(const struct hwclock_control *ctl) } #endif /* __linux__ __alpha__ */ +#ifdef __linux__ static int manipulate_rtc_param(const struct hwclock_control *ctl) { @@ -1178,6 +1179,7 @@ manipulate_rtc_param(const struct hwclock_control *ctl) return 1; } +#endif static void out_version(void) { @@ -1187,7 +1189,9 @@ static void out_version(void) static void __attribute__((__noreturn__)) usage(void) { +#ifdef __linux__ const struct hwclock_param *param = get_hwclock_params(); +#endif fputs(USAGE_HEADER, stdout); printf(_(" %s [function] [option...]\n"), program_invocation_short_name); @@ -1207,8 +1211,10 @@ usage(void) puts(_(" --getepoch display the RTC epoch")); puts(_(" --setepoch set the RTC epoch according to --epoch")); #endif +#ifdef __linux__ puts(_(" --param-get <param> display the RTC parameter")); puts(_(" --param-set <param>=<value> set the RTC parameter")); +#endif puts(_(" --predict predict the drifted RTC time according to --date")); fputs(USAGE_OPTIONS, stdout); puts(_(" -u, --utc the RTC timescale is UTC")); @@ -1235,6 +1241,7 @@ usage(void) fputs(USAGE_SEPARATOR, stdout); printf(USAGE_HELP_OPTIONS(33)); +#ifdef __linux__ fputs(USAGE_ARGUMENTS, stdout); puts(_(" <param> is either a numeric RTC parameter value or one of these aliases:")); @@ -1242,6 +1249,7 @@ usage(void) printf(_(" - %1$s: %2$s (0x%3$x)\n"), param->name, param->help, param->id); param++; } +#endif puts(_(" See Kernel's include/uapi/linux/rtc.h for parameters and values.")); fputs(USAGE_ARG_SEPARATOR, stdout); @@ -1419,6 +1427,7 @@ int main(int argc, char **argv) ctl.epoch_option = optarg; /* --epoch */ break; #endif +#ifdef __linux__ case OPT_PARAM_GET: ctl.param_get_option = optarg; ctl.show = 0; @@ -1428,6 +1437,7 @@ int main(int argc, char **argv) ctl.show = 0; ctl.hwaudit_on = 1; break; +#endif case OPT_NOADJFILE: ctl.noadjfile = 1; break; @@ -1521,12 +1531,14 @@ int main(int argc, char **argv) } } +#ifdef __linux__ if (ctl.param_get_option || ctl.param_set_option) { if (manipulate_rtc_param(&ctl)) hwclock_exit(&ctl, EXIT_FAILURE); hwclock_exit(&ctl, EXIT_SUCCESS); } +#endif #if defined(__linux__) && defined(__alpha__) if (ctl.getepoch || ctl.setepoch) { diff --git a/sys-utils/prlimit.c b/sys-utils/prlimit.c index ca69ccf98..34f635b1e 100644 --- a/sys-utils/prlimit.c +++ b/sys-utils/prlimit.c @@ -82,11 +82,15 @@ static struct prlimit_desc prlimit_desc[] = [LOCKS] = { "LOCKS", N_("max number of file locks held"), N_("locks"), RLIMIT_LOCKS }, [MEMLOCK] = { "MEMLOCK", N_("max locked-in-memory address space"), N_("bytes"), RLIMIT_MEMLOCK }, [MSGQUEUE] = { "MSGQUEUE", N_("max bytes in POSIX mqueues"), N_("bytes"), RLIMIT_MSGQUEUE }, +#ifdef RLIMIT_NICE [NICE] = { "NICE", N_("max nice prio allowed to raise"), NULL, RLIMIT_NICE }, +#endif [NOFILE] = { "NOFILE", N_("max number of open files"), N_("files"), RLIMIT_NOFILE }, [NPROC] = { "NPROC", N_("max number of processes"), N_("processes"), RLIMIT_NPROC }, [RSS] = { "RSS", N_("max resident set size"), N_("bytes"), RLIMIT_RSS }, +#ifdef RLIMIT_RTPRIO [RTPRIO] = { "RTPRIO", N_("max real-time priority"), NULL, RLIMIT_RTPRIO }, +#endif [RTTIME] = { "RTTIME", N_("timeout for real-time tasks"), N_("microsecs"), RLIMIT_RTTIME }, [SIGPENDING] = { "SIGPENDING", N_("max number of pending signals"), N_("signals"), RLIMIT_SIGPENDING }, [STACK] = { "STACK", N_("max stack size"), N_("bytes"), RLIMIT_STACK }