]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
Merge branch 'patch-18' of https://github.com/mariobl/util-linux
authorKarel Zak <kzak@redhat.com>
Tue, 11 Apr 2023 10:10:36 +0000 (12:10 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 11 Apr 2023 10:10:36 +0000 (12:10 +0200)
* 'patch-18' of https://github.com/mariobl/util-linux:
  setarch: (man) Fix typo

13 files changed:
login-utils/last.1.adoc
misc-utils/hardlink.1.adoc
misc-utils/lsfd.1.adoc
misc-utils/namei.1.adoc
schedutils/taskset.1.adoc
sys-utils/fstab.5.adoc
sys-utils/hwclock-cmos.c
sys-utils/hwclock-rtc.c
sys-utils/hwclock.c
sys-utils/hwclock.h
sys-utils/mount.8.adoc
tests/ts/hwclock/show [new file with mode: 0755]
text-utils/column.1.adoc

index 04d407387f21273472567c8f046a129d442754ab..1d26ae1be369b5b41293887c53229b1979e9f26f 100644 (file)
@@ -117,7 +117,7 @@ The files _wtmp_ and _btmp_ might not be found. The system only logs information
 
 An empty entry is a valid type of wtmp entry. It means that an empty file or file with zeros is not interpreted as an error.
 
-The utmp file format uses fixed sizes of strings, which means that very long strings are impossible to store in the file and impossible to display by last. The usual limits are 32 bytes for a user and line name and 256 bytes for a hostname.
+The utmp file format uses fixed sizes of strings, which means that very long strings are impossible to store in the file and impossible to display by *last*. The usual limits are 32 bytes for a user and line name and 256 bytes for a hostname.
 
 == AUTHORS
 
index a91c627e02a7b05fac7559bd1f5b9c743243b1c7..baa53eb934678d3153dc0790e09b316ddc6b8955 100644 (file)
@@ -55,7 +55,7 @@ way and I/O operation is done in the kernel. The size may be altered on the fly
 to fit a number of cached content checksums.
 
 *-d*, *--respect-dir*::
-Only try to link files with the same directory name. The top-level directory (as specified on the hardlink command line) is ignored. For example, *hardlink --respect-dir /foo /bar* will link /foo/some/file with /bar/some/file, but not /bar/other/file. If combined with *--respect-name*, then entire paths (except the top-level directory) are compared.
+Only try to link files with the same directory name. The top-level directory (as specified on the hardlink command line) is ignored. For example, *hardlink --respect-dir /foo /bar* will link _/foo/some/file_ with _/bar/some/file_, but not _/bar/other/file_. If combined with *--respect-name*, then entire paths (except the top-level directory) are compared.
 
 *-f*, *--respect-name*::
 Only try to link files with the same (base)name. It's strongly recommended to use long options rather than *-f* which is interpreted in a different way by other *hardlink* implementations.
index e0f101e9b3136bac0f142829635dbe78945665fd..cbf50f0dd3c367a3e52ffb9f568db32013c4a778 100644 (file)
@@ -339,7 +339,7 @@ SOCK.LISTENING <``boolean``>::
 Listening socket.
 
 SOCK.NETS <``number``>::
-Inode identifying network namespace where the socket belogs to.
+Inode identifying network namespace where the socket belongs to.
 
 SOCK.PROTONAME <``string``>::
 Protocol name.
@@ -363,7 +363,7 @@ SOURCE <``string``>::
 File system, partition, or device containing the file.
 
 STTYPE <``string``>::
-Raw file types returned from stat(2): BLK, CHR, DIR, FIFO, LINK, REG, SOCK, or UNKN.
+Raw file types returned from *stat*(2): BLK, CHR, DIR, FIFO, LINK, REG, SOCK, or UNKN.
 
 TCP.LADDR <``string``>::
 Local L3 (INET.LADDR or INET6.LADDR) address and local TCP port.
index 181286cee5b868e7bff140b8f04138e160bbbcb5..2cfeac1af518573025197e5d4cb0c0ff9c9b8288 100644 (file)
@@ -58,7 +58,7 @@ Show mountpoint directories with a 'D' rather than a 'd'.
 
 *-Z*, *--context*::
 Show security context of the file or "?" if not available.
-The support for security contexts is optional and does not have to be compiled to the namei.
+The support for security contexts is optional and does not have to be compiled to the *namei* binary.
 
 include::man-common/help-version.adoc[]
 
index 56084fd3c53afa7c71cf094fbb6ff536e4615c79..056b1ca301887c27ef9b9ee09b7fa5ef31eb9a67 100644 (file)
@@ -94,7 +94,7 @@ Or set it{colon}::
 *taskset -p* _mask pid_
 
 //TRANSLATORS: Keep {colon} untranslated.
-When a cpu-list is specified for an existing process, the 'p' and 'c' options must be grouped together{colon}::
+When a cpu-list is specified for an existing process, the *-p* and *-c* options must be grouped together{colon}::
 *taskset -pc* _cpu-list pid_
 
 //TRANSLATORS: Keep {colon} untranslated.
@@ -107,9 +107,9 @@ A user can change the CPU affinity of a process belonging to the same user. A us
 
 == RETURN VALUE
 
-*Taskset* returns 0 in its affinity-getting mode as long as the provided PID exists.
+*taskset* returns 0 in its affinity-getting mode as long as the provided PID exists.
 
-*Taskset* returns 0 in its affinity-setting mode as long as the underlying *sched_setaffinity()* system call does.     The success of the command does not guarantee that the specified thread has actually migrated to the indicated CPU(s), but only that the thread will not migrate to a CPU outside the new affinity mask.   For example, the affinity of the kernel thread kswapd can be set, but the thread may not immediately migrate and is not guaranteed to ever do so:
+*taskset* returns 0 in its affinity-setting mode as long as the underlying *sched_setaffinity*(2) system call does.  The success of the command does not guarantee that the specified thread has actually migrated to the indicated CPU(s), but only that the thread will not migrate to a CPU outside the new affinity mask.  For example, the affinity of the kernel thread kswapd can be set, but the thread may not immediately migrate and is not guaranteed to ever do so:
 
 $ ps ax -o comm,psr,pid | grep kswapd +
 kswapd0           4      82 +
index 1a67dc95cedd60cc95bf9879def403cfe2fe8797..ad1318f4965b2f6ead84fb02f31b37773ea91f25 100644 (file)
@@ -92,14 +92,14 @@ More than one type may be specified in a comma-separated list.
 
 This field describes the mount options associated with the filesystem.
 
-It is formatted as a comma-separated list of options and is optional for mount(8) or swapon(8). The usual convention is to use at least "defaults" keyword there.
+It is formatted as a comma-separated list of options and is optional for *mount*(8) or *swapon*(8). The usual convention is to use at least "defaults" keyword there.
 
 It usually contains the type of mount (*ro* or *rw*, the default is *rw*), plus any additional options appropriate to the filesystem type (including performance-tuning options). For details, see *mount*(8) or *swapon*(8).
 
 Basic filesystem-independent options are:
 
 *defaults*::
-use default options. The default depends on the kernel and the filesystem. mount(8) does not have any hardcoded set of default options. The kernel default is usually rw, suid, dev, exec, auto, nouser, and async.
+use default options. The default depends on the kernel and the filesystem. *mount*(8) does not have any hardcoded set of default options. The kernel default is usually rw, suid, dev, exec, auto, nouser, and async.
 *noauto*::
 do not mount when *mount -a* is given (e.g., at boot time)
 *user*::
index 56ee624736260caf519c4113f415f65b403a6866..d3173fe9f5be786dd20f836ebfb72a5c30ef96de 100644 (file)
@@ -369,7 +369,7 @@ static const char *get_device_path(void)
        return NULL;
 }
 
-static struct clock_ops cmos_interface = {
+static const struct clock_ops cmos_interface = {
        N_("Using direct ISA access to the clock"),
        get_permissions_cmos,
        read_hardware_clock_cmos,
@@ -381,7 +381,7 @@ static struct clock_ops cmos_interface = {
 /*
  * return &cmos if cmos clock present, NULL otherwise.
  */
-struct clock_ops *probe_for_cmos_clock(void)
+const struct clock_ops *probe_for_cmos_clock(void)
 {
        return &cmos_interface;
 }
index 70c3a2fe7a984766fc5466b4410e4dc469614f79..c8ac627b1eb486b48a294c4a4f22f4410b487cc4 100644 (file)
@@ -5,6 +5,8 @@
  */
 #include <asm/ioctl.h>
 #include <errno.h>
+#include <linux/rtc.h>
+#include <linux/types.h>
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
 
 #include "hwclock.h"
 
-/*
- * Get defines for rtc stuff.
- *
- * Getting the rtc defines is nontrivial. The obvious way is by including
- * <linux/mc146818rtc.h> but that again includes <asm/io.h> which again
- * includes ... and on sparc and alpha this gives compilation errors for
- * many kernel versions. So, we give the defines ourselves here. Moreover,
- * some Sparc person decided to be incompatible, and used a struct rtc_time
- * different from that used in mc146818rtc.h.
- */
-
-/*
- * On Sparcs, there is a <asm/rtc.h> that defines different ioctls (that are
- * required on my machine). However, this include file does not exist on
- * other architectures.
- */
-/* One might do:
-#ifdef __sparc__
-# include <asm/rtc.h>
-#endif
- */
-#ifdef __sparc__
-/* The following is roughly equivalent */
-struct sparc_rtc_time
-{
-       int sec;        /* Seconds              0-59 */
-       int min;        /* Minutes              0-59 */
-       int hour;       /* Hour                 0-23 */
-       int dow;        /* Day of the week      1-7  */
-       int dom;        /* Day of the month     1-31 */
-       int month;      /* Month of year        1-12 */
-       int year;       /* Year                 0-99 */
-};
-#define RTCGET _IOR('p', 20, struct sparc_rtc_time)
-#define RTCSET _IOW('p', 21, struct sparc_rtc_time)
-#endif
-
-/*
- * struct rtc_time is present since 1.3.99.
- * Earlier (since 1.3.89), a struct tm was used.
- */
-struct linux_rtc_time {
-       int tm_sec;
-       int tm_min;
-       int tm_hour;
-       int tm_mday;
-       int tm_mon;
-       int tm_year;
-       int tm_wday;
-       int tm_yday;
-       int tm_isdst;
-};
-
-/* RTC_RD_TIME etc have this definition since 1.99.9 (pre2.0-9) */
-#ifndef RTC_RD_TIME
-# define RTC_RD_TIME   _IOR('p', 0x09, struct linux_rtc_time)
-# define RTC_SET_TIME  _IOW('p', 0x0a, struct linux_rtc_time)
-# define RTC_UIE_ON    _IO('p', 0x03)  /* Update int. enable on */
-# define RTC_UIE_OFF   _IO('p', 0x04)  /* Update int. enable off */
-#endif
-
-/* RTC_EPOCH_READ and RTC_EPOCH_SET are present since 2.0.34 and 2.1.89 */
-#ifndef RTC_EPOCH_READ
-# define RTC_EPOCH_READ        _IOR('p', 0x0d, unsigned long)  /* Read epoch */
-# define RTC_EPOCH_SET _IOW('p', 0x0e, unsigned long)  /* Set epoch */
-#endif
-
 #ifndef RTC_PARAM_GET
 struct rtc_param {
-       uint64_t param;
+       __u64 param;
        union {
-               uint64_t uvalue;
-               int64_t svalue;
-               uint64_t ptr;
+               __u64 uvalue;
+               __s64 svalue;
+               __u64 ptr;
        };
-       uint32_t index;
-       uint32_t __pad;
+       __u32 index;
+       __u32 __pad;
 };
 
 # define RTC_PARAM_GET _IOW('p', 0x13, struct rtc_param)
@@ -142,7 +77,7 @@ static void close_rtc(void)
 
 static int open_rtc(const struct hwclock_control *ctl)
 {
-       static const char *fls[] = {
+       static const char * const fls[] = {
 #ifdef __ia64__
                "/dev/efirtc",
                "/dev/misc/efirtc",
@@ -197,35 +132,12 @@ static int open_rtc_or_exit(const struct hwclock_control *ctl)
 static int do_rtc_read_ioctl(int rtc_fd, struct tm *tm)
 {
        int rc = -1;
-       char *ioctlname;
-#ifdef __sparc__
-       /* some but not all sparcs use a different ioctl and struct */
-       struct sparc_rtc_time stm;
-#endif
 
-       ioctlname = "RTC_RD_TIME";
        rc = ioctl(rtc_fd, RTC_RD_TIME, tm);
 
-#ifdef __sparc__
-       if (rc == -1) {         /* sparc sbus */
-               ioctlname = "RTCGET";
-               rc = ioctl(rtc_fd, RTCGET, &stm);
-               if (rc == 0) {
-                       tm->tm_sec = stm.sec;
-                       tm->tm_min = stm.min;
-                       tm->tm_hour = stm.hour;
-                       tm->tm_mday = stm.dom;
-                       tm->tm_mon = stm.month - 1;
-                       tm->tm_year = stm.year - 1900;
-                       tm->tm_wday = stm.dow - 1;
-                       tm->tm_yday = -1;       /* day in the year */
-               }
-       }
-#endif
-
        if (rc == -1) {
-               warn(_("ioctl(%s) to %s to read the time failed"),
-                       ioctlname, rtc_dev_name);
+               warn(_("ioctl(RTC_RD_NAME) to %s to read the time failed"),
+                       rtc_dev_name);
                return -1;
        }
 
@@ -360,38 +272,19 @@ static int set_hardware_clock_rtc(const struct hwclock_control *ctl,
 {
        int rc = -1;
        int rtc_fd;
-       char *ioctlname;
 
        rtc_fd = open_rtc_or_exit(ctl);
 
-       ioctlname = "RTC_SET_TIME";
        rc = ioctl(rtc_fd, RTC_SET_TIME, new_broken_time);
 
-#ifdef __sparc__
-       if (rc == -1) {         /* sparc sbus */
-               struct sparc_rtc_time stm;
-
-               stm.sec = new_broken_time->tm_sec;
-               stm.min = new_broken_time->tm_min;
-               stm.hour = new_broken_time->tm_hour;
-               stm.dom = new_broken_time->tm_mday;
-               stm.month = new_broken_time->tm_mon + 1;
-               stm.year = new_broken_time->tm_year + 1900;
-               stm.dow = new_broken_time->tm_wday + 1;
-
-               ioctlname = "RTCSET";
-               rc = ioctl(rtc_fd, RTCSET, &stm);
-       }
-#endif
-
        if (rc == -1) {
-               warn(_("ioctl(%s) to %s to set the time failed"),
-                       ioctlname, rtc_dev_name);
+               warn(_("ioctl(RTC_SET_TIME) to %s to set the time failed"),
+                       rtc_dev_name);
                hwclock_exit(ctl, EXIT_FAILURE);
        }
 
        if (ctl->verbose)
-               printf(_("ioctl(%s) was successful.\n"), ioctlname);
+               printf(_("ioctl(RTC_SET_TIME) was successful.\n"));
 
        return 0;
 }
@@ -406,7 +299,7 @@ static const char *get_device_path(void)
        return rtc_dev_name;
 }
 
-static struct clock_ops rtc_interface = {
+static const struct clock_ops rtc_interface = {
        N_("Using the rtc interface to the clock."),
        get_permissions_rtc,
        read_hardware_clock_rtc,
@@ -416,7 +309,7 @@ static struct clock_ops rtc_interface = {
 };
 
 /* return &rtc if /dev/rtc can be opened, NULL otherwise */
-struct clock_ops *probe_for_rtc_clock(const struct hwclock_control *ctl)
+const struct clock_ops *probe_for_rtc_clock(const struct hwclock_control *ctl)
 {
        const int rtc_fd = open_rtc(ctl);
 
@@ -491,7 +384,7 @@ int set_epoch_rtc(const struct hwclock_control *ctl)
 
 
 
-static int resolve_rtc_param_alias(const char *alias, uint64_t *value)
+static int resolve_rtc_param_alias(const char *alias, __u64 *value)
 {
        const struct hwclock_param *param = &hwclock_params[0];
 
@@ -506,6 +399,12 @@ static int resolve_rtc_param_alias(const char *alias, uint64_t *value)
        return 1;
 }
 
+/* kernel uapi __u64 can be defined differently than uint64_t */
+static int strtoku64(const char *str, __u64 *num, int base)
+{
+       return ul_strtou64(str, (uint64_t *) &num, base);
+}
+
 /*
  * Get the Hardware Clock parameter setting from the kernel.
  */
@@ -517,7 +416,7 @@ int get_param_rtc(const struct hwclock_control *ctl,
 
        /* handle name */
        if (resolve_rtc_param_alias(name, &param.param) != 0
-           && ul_strtou64(name, &param.param, 0) != 0) {
+           && strtoku64(name, &param.param, 0) != 0) {
                warnx(_("could not convert parameter name to number"));
                return 1;
        }
@@ -559,7 +458,7 @@ int set_param_rtc(const struct hwclock_control *ctl, const char *opt0)
        /* handle name */
        tok = strtok(opt, "=");
        if (resolve_rtc_param_alias(tok, &param.param) != 0
-           && ul_strtou64(tok, &param.param, 0) != 0) {
+           && strtoku64(tok, &param.param, 0) != 0) {
                warnx(_("could not convert parameter name to number"));
                goto done;
        }
@@ -570,7 +469,7 @@ int set_param_rtc(const struct hwclock_control *ctl, const char *opt0)
                warnx(_("expected <param>=<value>"));
                goto done;
        }
-       if (ul_strtou64(tok, &param.uvalue, 0) != 0) {
+       if (strtoku64(tok, &param.uvalue, 0) != 0) {
                warnx(_("could not convert parameter value to number"));
                goto done;
        }
index ad1eb688e49600e497a385b52f9d26576e2d2e4a..0dfe7f0841b7a6c8bd0b6812de6f295e16a18408 100644 (file)
@@ -99,7 +99,7 @@ UL_DEBUG_DEFINE_MASK(hwclock);
 UL_DEBUG_DEFINE_MASKNAMES(hwclock) = UL_DEBUG_EMPTY_MASKNAMES;
 
 /* The struct that holds our hardware access routines */
-static struct clock_ops *ur;
+static const struct clock_ops *ur;
 
 /* Maximal clock adjustment in seconds per day.
    (adjtime() glibc call has 2145 seconds limit on i386, so it is good enough for us as well,
index 951857c2230f5f1e292f115eb8cd264ae7f633e6..b5b72d45d71080df105b18187ee8a7f2aab4ebcf 100644 (file)
@@ -65,8 +65,8 @@ struct clock_ops {
        const char *(*get_device_path) (void);
 };
 
-extern struct clock_ops *probe_for_cmos_clock(void);
-extern struct clock_ops *probe_for_rtc_clock(const struct hwclock_control *ctl);
+extern const struct clock_ops *probe_for_cmos_clock(void);
+extern const struct clock_ops *probe_for_rtc_clock(const struct hwclock_control *ctl);
 
 /* hwclock.c */
 extern double time_diff(struct timeval subtrahend, struct timeval subtractor);
index ad94cb20862245237fa0390c5cd8df42ccf23696..e39ac766b6ddec9daacc6e31654abaa675d516ae 100644 (file)
@@ -234,7 +234,7 @@ ____
 
 Note that a read-only bind will create a read-only mountpoint (VFS entry), but the original filesystem superblock will still be writable, meaning that the _olddir_ will be writable, but the _newdir_ will be read-only.
 
-It's also possible to change nosuid, nodev, noexec, noatime, nodiratime, relatime and nosymfollow VFS entry flags via a "remount,bind" operation. The other flags (for example filesystem-specific flags) are silently ignored. The classic mount(2) system call does not allow to change mount options recursively (for example with *-o rbind,ro*). The recursive semantic is possible with a new mount_setattr(2) kernel system call and it's supported since libmount from util-linux v2.39 by a new experimental "recursive" option argument (e.g. *-o rbind,ro=recursive*). For more details see the *FILESYSTEM-INDEPENDENT MOUNT OPTIONS* section for more details.
+It's also possible to change nosuid, nodev, noexec, noatime, nodiratime, relatime and nosymfollow VFS entry flags via a "remount,bind" operation. The other flags (for example filesystem-specific flags) are silently ignored. The classic *mount*(2) system call does not allow to change mount options recursively (for example with *-o rbind,ro*). The recursive semantic is possible with a new *mount_setattr*(2) kernel system call and it's supported since libmount from util-linux v2.39 by a new experimental "recursive" option argument (e.g. *-o rbind,ro=recursive*). For more details see the *FILESYSTEM-INDEPENDENT MOUNT OPTIONS* section.
 
 Since util-linux 2.31, *mount* ignores the *bind* flag from _/etc/fstab_ on a *remount* operation (if *-o remount* is specified on command line). This is necessary to fully control mount options on remount by command line. In previous versions the bind flag has been always applied and it was impossible to re-define mount options without interaction with the bind semantic. This *mount* behavior does not affect situations when "remount,bind" is specified in the _/etc/fstab_ file.
 
@@ -465,7 +465,7 @@ ____
 to get a complete overview of filesystems and VFS options.
 
 The read-only setting (*ro* or *rw*) is interpreted by VFS and the filesystem
-and depends on how the option is specified on the mount(8) command line. The
+and depends on how the option is specified on the *mount*(8) command line. The
 default is to interpret it on the filesystem level. The operation "-o bind,remount,ro"
 is applied only to the VFS mountpoint, and operation "-o remount,ro" is applied to
 VFS and filesystem superblock. This semantic allows create a read-only
diff --git a/tests/ts/hwclock/show b/tests/ts/hwclock/show
new file mode 100755 (executable)
index 0000000..228b462
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+#
+# Copyright (C) 2023 Thomas Weißschuh <thomas@t-8ch.de>
+#
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+
+TS_TOPDIR="${0%/*}/../.."
+TS_DESC="show"
+
+. "$TS_TOPDIR"/functions.sh
+ts_init "$*"
+
+ts_check_test_command "$TS_CMD_HWCLOCK"
+
+ts_skip_nonroot
+ts_skip_qemu_user
+
+"$TS_CMD_HWCLOCK" --show > /dev/null 2> "$TS_ERRLOG" || ts_die
+
+ts_finalize
index a940a0536dde854a3de48627f3ede61a62428b9b..17f6eb039fcc226dec2dce4cfbe3736d95b602ff 100644 (file)
@@ -95,7 +95,7 @@ Determine the number of columns the input contains and create a table. Columns a
 *-C, --table-column* _properties_::
 Define one column by comma separated list of column attributes.
 This option can be used more than once, every use defines just one column.
-The properties replace some of --table- options. For example *--table-column
+The properties replace some of *--table-* options. For example *--table-column
 name=FOO,right* define one column where text is aligned to right. The option is
 mutually exclusive to *--table-columns*.
 +