Sami Kerola [Sun, 11 Dec 2016 11:43:37 +0000 (11:43 +0000)]
lib/randutils: use getrandom(2) when it is available
System call getrandom(2) is relatively new, available since kernel 3.17 but
not supported by glibc 2.24. That in mind autotools is made to check
availability of this function and keep old code as fallback. It is
reasonable assume it will take years before the syscall(2) and fallback are
unproblematic to remove.
One might ask why bother using getrandom(2). Main reason is to avoid
unnecessary system calls to achieve exactly same end result. That
demonstrated with 'strace -c ./mcookie' showing 36 calls before, and 32
after this change. Secondly the getrandom(2) function got to kernel with
promise it can be used to avoid file descriptor run down, and since uuidd
uses random_get_bytes() it should fulfill it's promise here.
Reference: http://man7.org/linux/man-pages/man2/getrandom.2.html
Reference: https://lwn.net/Articles/606141/ Reviewed-by: Karel Zak <kzak@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Karel Zak [Fri, 9 Dec 2016 12:48:34 +0000 (13:48 +0100)]
Merge branch doc_fixes
Rebase from
http://git.kernel.org/pub/scm/linux/kernel/git/mtk/util-linux.git doc_fixes
docs: renice(1): Add credentials(7) to SEE ALSO
docs: renice(1): Add SEE ALSO entry for sched(7)
docs: mount(8): Wording fix
docs: ionice(1): SEE ALSO: add ioprio_set(2)
docs: lsns(8): SEE ALSO: add namespaces(7)
docs: last(1): Eliminate oddball formatting
docs: last(1): SEE ALSO: add reference to wtmp(5)
docs: taskset(1): Wording fix
docs: namei(1): SEE ALSO: add symlink(7)
docs: kill(1): Wording fix
docs: various pages: Use 'UID" and "GID", not "uid" and "gid" in man pages
docs: various pages: Use "PID" not "pid" in man-pages
docs: various pages: Use "ID" not "id" in man pages
docs: various pages: Use consistent terminology (set-user-ID and set-group-ID)
docs: various pages: Format pathnames as italic (.I)
Michael Kerrisk [Mon, 5 Dec 2016 06:28:09 +0000 (07:28 +0100)]
docs: renice(1): Add SEE ALSO entry for sched(7)
The sched(7) page as of the most recent release contains detailed
information on the 'nice' value, including a discussion of
autogrouping, which has surprising interactions with the process
nice value.
Michael Kerrisk [Sun, 4 Dec 2016 19:34:54 +0000 (20:34 +0100)]
docs: various pages: Use consistent terminology (set-user-ID and set-group-ID)
Use consistent terminology for set-user-ID and set-group-ID bits.
There's much inconsistency in the pages. "suid",
"set-user-identifier", "setuid". Stick with one terminology,
"set-user-ID" and set-grout-ID, as suggested in man-pages(7).
Michael Kerrisk [Sat, 3 Dec 2016 20:13:59 +0000 (21:13 +0100)]
docs: various pages: Format pathnames as italic (.I)
In the majority of pages, pathnames are formatted as Italic,
which is the norm. However, there are several cases where they
are formatted as bold. This patch fixes a number of those
exceptions.
Signed-off-by: Michael Kerrisk <mtk.man-pages@gmail.com>
Michael Kerrisk [Fri, 9 Dec 2016 12:32:34 +0000 (13:32 +0100)]
docs: renice(1): Remove obsolete BUGS text
Already at least as far back as util-linux 2.2, renice uses
getpriority(2) to fetch the process's old nice value. Thus,
the "problem" discussed in this BUGS note disappeared long ago.
This is trivially demonstrable:
$ sleep 100 &
[1] 24322
$ renice -n 5 24322
24322 (process ID) old priority 0, new priority 5
$ renice -n 10 24322
24322 (process ID) old priority 5, new priority 10
Rather than trying to explain the ancient problem (20 years old?),
just kill this text.
Signed-off-by: Michael Kerrisk <mtk.man-pages@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Michael Kerrisk [Fri, 9 Dec 2016 12:25:20 +0000 (13:25 +0100)]
docs: renice(1): Rework discussion of unprivileged users,
The BUGS section describing the limitations on what an unprivileged
user may do to the nice value is outdated, given the kernel changes
that added RLIMIT_NICE in Linux 2.6.12. So, remove that text.
The revised details for modern Linux were partially covered in NOTES,
but there were also inaccuracies there (and the use of the word
"monotonically" was unneeded). In particular, the point is that
unprivileged users can only increase the nice value. There is no
restriction particular to the range 0..+19. So, for example, the
following scenario is possible:
1. Superuser sets the nice value of an unprivileged user's
process to -20.
2. The unprivileged user can now renice that process to (say) -10.
Signed-off-by: Michael Kerrisk <mtk.man-pages@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Fri, 9 Dec 2016 08:47:33 +0000 (09:47 +0100)]
hwclock: don't check for permissions
The right place to verify user permissions is kernel. The current
situation is too strict (due to previous attempts to use hwclock as
suid that has never been supported).
Karel Zak [Thu, 8 Dec 2016 13:29:44 +0000 (14:29 +0100)]
libmount: use x-systemd options as X-*
The previous patch introduces X-* options namespace for options
that have to be maintained in user space.
Unfortunately, systemd users already use mount options that are
necessary by umount or another operations. The conclusion from
discussion with systemd guys is to store all the systemd options
in userspace.
It seems better to add one line exception to libmount than force all
fstab users to rename x-systemd to X-systemd.
Addresses: https://github.com/systemd/systemd/pull/3904 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Thu, 8 Dec 2016 13:55:02 +0000 (14:55 +0100)]
libmount: introduce X-* comments
x-* are fstab only and not stored in userspace (utab). In some cases
it's not optional solution because the option is also necessary for
umount or another operations. The X-* is exactly the same as x-*, but
stored to utab (or mtab on old systems).
It's usually bad idea to store mount options in userspace, but it's
better to provide any solution that force users to bypass mount(8)
(and friends) and implement 3rd-party incompatible solutions.
Karel Zak [Thu, 8 Dec 2016 13:24:41 +0000 (14:24 +0100)]
findmnt: add --tree to allow to enable tree output for --mtab
The --mtab output is merge from kernel and utab on all modern systems
(without classic /etc/mtab). It means we have all necessary information
to generate tree output.
For the backward compatibility --mtab is the list by default, the new
option --tree allows to override the default and enable tree always
when the table contains child-parent relations.
Ruediger Meier [Thu, 1 Dec 2016 08:52:12 +0000 (09:52 +0100)]
build-sys: check for POSIX utmpx usage
We simply check for utmpxname and updwtmpx functions to disable
all programs which are not POSIX utmpx compatible, even though
last(1) and utmpdump(1) does not use them, see below.
utmpx.h is used in:
login agetty write lslogins last runuser su utmpdump wall
Non-Posix utmpx usage:
utmpxname -> login agetty write lslogins
updwtmpx -> login agetty runuser su
_PATH_.TMP -> login agetty write lslogins last runuser su
utmpx.ut_addr_v6 -> login last utmpdump
Ruediger Meier [Thu, 1 Dec 2016 08:52:11 +0000 (09:52 +0100)]
login-utils: switch to utmpx.h
Now the build will fail on many non-Linux systems because
utmpx.h is available everywhere but we still use non-POSIX
features. We'll fix this next commit.
Previously (and as documented in the manpage) the default policy
was SCHED_RR. Now it's implicitly SCHED_OTHER (0) as the value
is not initialized explicitly anymore.
Test-command: chrt 90 echo hello
Reported-by: Patrick Pelissier <patrick.pelissier@gmail.com>
Addresses: http://bugs.debian.org/846572 Signed-off-by: Andreas Henriksson <andreas@fatal.se>
Jim Patterson [Wed, 16 Nov 2016 17:22:14 +0000 (12:22 -0500)]
wall: add --group option
The wall command on AIX supports a "-g" option to limit the message
to a group of users by gid. Add compatibility to the Linux version.
Thanks to Sami Kerola <kerolasa@iki.fi> for an initial skeleton
implementation.
[kzak@redhat.com: - rename max to ngroups
- add free_group_workspace()
- some cosmetic changes]
Reference: http://www.ibm.com/support/knowledgecenter/ssw_aix_61/com.ibm.aix.cmds6/wall.htm Signed-off-by: Jim Patterson <jimp@wegrok.net> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Wed, 30 Nov 2016 11:43:10 +0000 (12:43 +0100)]
sfdisk: support empty label use-case
By default sfdisk creates partition table when a first partition is
specified, otherwise the device is not modified. This force users to
create at least one partition.
This commit allows to create empty label without partitions if "label:
<name>" header line is specified by script.
The commit also modifies "New situation:" output to list label name
and label identifier.
Addresses: https://github.com/karelzak/util-linux/issues/374 Signed-off-by: Karel Zak <kzak@redhat.com>
Provide better cross references for namespace concepts
For each namespace that is discussed, add more explicit
references to the corresponding clone(2) flags and
add references to relevant section 7 namespace pages.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Provide better cross references for namespace concepts
For each namespace that is discussed, add more explicit
references to the corresponding clone(2) flags and
add references to relevant section 7 namespace pages.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
The sigvec(3) (not sigvec(2)) page documents ancient BSD APIs.
The right page to cross reference here is sigaction(2),
which documents the modern POSIX APIs.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Some time back, I moved the discussion of scheduling from
sched_setscheduler(2) to a new sched(7) page. Adjust the cross
reference in the taskset(1) page accordingly.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
* Order SEE ALSO entries first by section name, then alphabetically
within section
* Adds one or two missing commas in SEE ALSO lists
* Removes one or two periods that were (inconsistently) used
at the end of SEE ALSO lists.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Heiko Carstens [Wed, 12 Oct 2016 12:00:47 +0000 (14:00 +0200)]
lsmem: add testcase
Add a single s390 specific test case to verify that the contents of
various output formats do not change in incompatible way if the
lsmem code is changed.
Heiko Carstens [Wed, 12 Oct 2016 12:00:46 +0000 (14:00 +0200)]
chmem: new tool
Move the s390 specific chmem tool to util-linux.
The chmem tool was originally written in perl and is part of the
s390-tools package which can be found here:
https://www.ibm.com/developerworks/linux/linux390/s390-tools.html
Given that the tool is architecture independent, there is no reason to
keep it in an s390 specific repository. It seems to be useful for
other architectures as well.
This patch converts the tool to C and adds it to util-linux, while the
command line options stay compatible. The only exception is the option
"-v" which used to be the short form of "--version". That got changed
to "-V" so it behaves like most other tools contained within
util-linux.
The chmem tool can be used to set memory online or offline. This can
be achieved by specifying a memory range:
Heiko Carstens [Wed, 12 Oct 2016 12:00:45 +0000 (14:00 +0200)]
lsmem: new tool
Move the s390 specific lsmem tool to util-linux.
The lsmem tool was originally written in perl and is part of the
s390-tools package which can be found here:
https://www.ibm.com/developerworks/linux/linux390/s390-tools.html
Given that the tool is architecture independent, there is no reason to
keep it in an s390 specific repository. It seems to be useful for
other architectures as well.
This patch converts the tool to C and adds it to util-linux, while the
command line options stay compatible. The only exception is the option
"-v" which used to be the short form of "--version". That got changed
to "-V" so it behaves like most other tools contained within
util-linux.
The lsmem tool inspect the contents of /sys/devices/system/memory and
prints a summary output similar to what lscpu does:
RANGE SIZE STATE REMOVABLE BLOCK
0x0000000000000000-0x000000005fffffff 1,5G online yes 0-5
0x0000000060000000-0x000000007fffffff 512M online no 6-7
0x0000000080000000-0x000000013fffffff 3G online yes 8-19
0x0000000140000000-0x000000014fffffff 256M offline - 20
0x0000000150000000-0x000000017fffffff 768M online no 21-23
Memory block size : 256M
Total online memory : 5,8G
Total offline memory: 256M
In order to keep the output small the tool merges subsequent address
ranges where the attributes are identical. To avoid merging of line
the "-a" option can be used.
The lsmem tool also has "--extendend" and "--parsable" option which
can be used to customize the output, e.g. limit the output to
specified columns. This is quite similar to what the lscpu tool does.