]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
8 years agolib/randutils: use getrandom(2) when it is available
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>
8 years agoMerge branch doc_fixes
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)

8 years agodocs: renice(1): Add credentials(7) to SEE ALSO
Michael Kerrisk [Mon, 5 Dec 2016 06:49:42 +0000 (07:49 +0100)] 
docs: renice(1): Add credentials(7) to SEE ALSO

credentials(7) explains concepts such as "process group".

Signed-off-by: Michael Kerrisk <mtk.man-pages@gmail.com>
8 years agodocs: renice(1): Add SEE ALSO entry for sched(7)
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.

Signed-off-by: <mtk.man-pages@gmail.com>
8 years agodocs: mount(8): Wording fix
Michael Kerrisk [Sun, 4 Dec 2016 20:00:34 +0000 (21:00 +0100)] 
docs: mount(8): Wording fix

The correct word here is "practice"; "manner" would not be well
understood by most English speakers.

Signed-off-by: Michael Kerrisk <mtk.man-pages@gmail.com>
8 years agodocs: ionice(1): SEE ALSO: add ioprio_set(2)
Michael Kerrisk [Sat, 3 Dec 2016 19:39:35 +0000 (20:39 +0100)] 
docs: ionice(1): SEE ALSO: add ioprio_set(2)

ioprio_set(2) is the system call that underlies this command.

Signed-off-by: Michael Kerrisk <mtk.man-pages@gmail.com>
8 years agodocs: lsns(8): SEE ALSO: add namespaces(7)
Michael Kerrisk [Sat, 3 Dec 2016 19:38:52 +0000 (20:38 +0100)] 
docs: lsns(8): SEE ALSO: add namespaces(7)

Signed-off-by: Michael Kerrisk <mtk.man-pages@gmail.com>
8 years agodocs: last(1): Eliminate oddball formatting
Michael Kerrisk [Sun, 4 Dec 2016 19:23:54 +0000 (20:23 +0100)] 
docs: last(1): Eliminate oddball formatting

\s-2...\s0 is unused anywhere else. Remove it.

Signed-off-by: Michael Kerrisk <mtk.man-pages@gmail.com>
8 years agodocs: last(1): SEE ALSO: add reference to wtmp(5)
Michael Kerrisk [Sat, 3 Dec 2016 19:37:10 +0000 (20:37 +0100)] 
docs: last(1): SEE ALSO: add reference to wtmp(5)

Signed-off-by: Michael Kerrisk <mtk.man-pages@gmail.com>
8 years agodocs: taskset(1): Wording fix
Michael Kerrisk [Mon, 5 Dec 2016 11:39:22 +0000 (12:39 +0100)] 
docs: taskset(1): Wording fix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
8 years agodocs: namei(1): SEE ALSO: add symlink(7)
Michael Kerrisk [Mon, 5 Dec 2016 11:36:50 +0000 (12:36 +0100)] 
docs: namei(1): SEE ALSO: add symlink(7)

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
8 years agodocs: kill(1): Wording fix
Michael Kerrisk [Wed, 7 Dec 2016 13:04:17 +0000 (14:04 +0100)] 
docs: kill(1): Wording fix

Fix a wording error introduced in one of my recent commits.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
8 years agodocs: various pages: Use 'UID" and "GID", not "uid" and "gid" in man pages
Michael Kerrisk [Sun, 4 Dec 2016 19:51:32 +0000 (20:51 +0100)] 
docs: various pages: Use 'UID" and "GID", not "uid" and "gid" in man pages

Signed-off-by: Michael Kerrisk <mtk.man-pages@gmail.com>
8 years agodocs: various pages: Use "PID" not "pid" in man-pages
Michael Kerrisk [Sun, 4 Dec 2016 19:44:04 +0000 (20:44 +0100)] 
docs: various pages: Use "PID" not "pid" in man-pages

Signed-off-by: Michael Kerrisk <mtk.man-pages@gmail.com>
8 years agodocs: various pages: Use "ID" not "id" in man pages
Michael Kerrisk [Sun, 4 Dec 2016 19:40:01 +0000 (20:40 +0100)] 
docs: various pages: Use "ID" not "id" in man pages

The correct abbreviation of identifier is is "ID" (as used in
many pages), not "id" (as used in a few pages).

Signed-off-by: Michael Kerrisk <mtk.man-pages@gmail.com>
8 years agodocs: various pages: Use consistent terminology (set-user-ID and set-group-ID)
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).

Signed-off-by: <mtk.man-pages@gmail.com>
8 years agodocs: various pages: Format pathnames as italic (.I)
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>
8 years agodocs: renice(1): Remove obsolete BUGS text
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>
8 years agodocs: renice(1): Rework discussion of unprivileged users,
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>
8 years agohwclock: don't check for permissions
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).

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agowall: remove unnecessary include
Karel Zak [Thu, 8 Dec 2016 15:09:15 +0000 (16:09 +0100)] 
wall: remove unnecessary include

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolibmount: use x-systemd options as X-*
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>
8 years agolibmount: introduce X-* comments
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.

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agofindmnt: add --tree to allow to enable tree output for --mtab
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.

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agofindmnt: add note about mount options
Karel Zak [Thu, 8 Dec 2016 13:11:02 +0000 (14:11 +0100)] 
findmnt: add note about mount options

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agosulogin: bail out from getpasswd(...) on timeout
Andreas Henriksson [Mon, 28 Nov 2016 16:24:50 +0000 (17:24 +0100)] 
sulogin: bail out from getpasswd(...) on timeout

If timeout happens while waiting in prompt, bail out instead
of retrying.

Reported-by: Bjørn Mork <bjorn@mork.no>
Addresses: http://bugs.debian.org/846107
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
8 years agosulogin: make getpasswd(...) return NULL on ^D
Andreas Henriksson [Mon, 28 Nov 2016 16:24:49 +0000 (17:24 +0100)] 
sulogin: make getpasswd(...) return NULL on ^D

This makes the caller bail out early instead of evaluating the
input as a password.

Reported-by: Bjørn Mork <bjorn@mork.no>
Addresses: http://bugs.debian.org/846112
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
8 years agobuild-sys: disable tailf by default
Ruediger Meier [Mon, 5 Dec 2016 13:24:55 +0000 (14:24 +0100)] 
build-sys: disable tailf by default

It's deprecated since 3f8478a7, so we shouldn't build it by default.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
8 years agoagetty: re-add utmp.h for Debian GNU/kFreeBSD
Ruediger Meier [Thu, 1 Dec 2016 08:57:51 +0000 (09:57 +0100)] 
agetty: re-add utmp.h for Debian GNU/kFreeBSD

It's needed there to get login_tty(). On normal FreeBSD we would
need libutil.h.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
8 years agotravis: let OSX auto-skip utmpx tools
Ruediger Meier [Thu, 1 Dec 2016 08:57:50 +0000 (09:57 +0100)] 
travis: let OSX auto-skip utmpx tools

It will disable all these programs automatically except wall(1)
which is now non-Linux compatible.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
8 years agobuild-sys: check for POSIX utmpx usage
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

POSIX utmpx usage:
   wall

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
8 years agologin-utils: switch to utmpx.h
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.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
8 years agoagetty: remove obsolete HAVE_UPDWTMP fallback
Ruediger Meier [Thu, 1 Dec 2016 08:52:10 +0000 (09:52 +0100)] 
agetty: remove obsolete HAVE_UPDWTMP fallback

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
8 years agologin: re-add lastlog.h header
Ruediger Meier [Thu, 1 Dec 2016 08:52:09 +0000 (09:52 +0100)] 
login: re-add lastlog.h header

This include was removed in a365953a but we will need it again
when we move from utmp.h to utmpx.h.

On Linux (glibc, musl) the struct lastlog is defined in utmp.h
and lastlog.h just includes utmp.h.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Conflicts:
login-utils/login.c

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
8 years agologin-utils: avoid using the defined utmp sizes.
Ruediger Meier [Thu, 1 Dec 2016 08:52:08 +0000 (09:52 +0100)] 
login-utils: avoid using the defined utmp sizes.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
8 years agoutmpdump: code formatting for readability
Ruediger Meier [Thu, 1 Dec 2016 08:52:07 +0000 (09:52 +0100)] 
utmpdump: code formatting for readability

BTW avoid using the defined sizes.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
8 years agolslogins: remove useless strlen()
Ruediger Meier [Thu, 1 Dec 2016 08:52:06 +0000 (09:52 +0100)] 
lslogins: remove useless strlen()

strlen() is not smarter than strncpy(). Bytes that follow a null byte
are not compared anyway.

BTW avoid using the defined sizes.

CC: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
8 years agologin-utils: remove _HAVE_UT_TV fallback
Ruediger Meier [Thu, 1 Dec 2016 08:52:05 +0000 (09:52 +0100)] 
login-utils: remove _HAVE_UT_TV fallback

_HAVE_UT_TV is glibc only. Moreover we want to move to utmpx where
timeval is standard.

Now utmp/subsecond (1173d0a6) should work on all supported systems.

CC: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
8 years agolast: include libgen.h for basename(3p)
Ruediger Meier [Thu, 1 Dec 2016 08:52:04 +0000 (09:52 +0100)] 
last: include libgen.h for basename(3p)

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
8 years agodocs: kill(1): Wording fix
Michael Kerrisk [Mon, 5 Dec 2016 09:46:48 +0000 (10:46 +0100)] 
docs: kill(1): Wording fix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
8 years agodocs: kill(1): Formatting fixes
Michael Kerrisk [Mon, 5 Dec 2016 09:43:53 +0000 (10:43 +0100)] 
docs: kill(1): Formatting fixes

Formatting fixes for constants and structure/field names, as
per man-pages(7).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
8 years agodocs: kill(1): Rework notes on thread groups
Michael Kerrisk [Mon, 5 Dec 2016 09:38:53 +0000 (10:38 +0100)] 
docs: kill(1): Rework notes on thread groups

The points in the NOTES can be expressed more compactly
(there is some redundancy in the two existing paragraphs).

Also, add a reference to signal(7), since this provides
much more detail on the topic.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
8 years agodocs: kill(1): Add more detail on use of SIGTERM vs SIGKILL
Michael Kerrisk [Mon, 5 Dec 2016 09:24:54 +0000 (10:24 +0100)] 
docs: kill(1): Add more detail on use of SIGTERM vs SIGKILL

It's worth adding a recommendation here to use SIGTERM
rather than SIGKILL, and explain why.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
8 years agodocs: kill(1): Fix section reference for sigqueue(3) and add to SEE ALSO
Michael Kerrisk [Sat, 3 Dec 2016 19:37:51 +0000 (20:37 +0100)] 
docs: kill(1): Fix section reference for sigqueue(3) and add to SEE ALSO

Signed-off-by: Michael Kerrisk <mtk.man-pages@gmail.com>
8 years agodocs: various pages: Use "system call" not "syscall"
Michael Kerrisk [Sun, 4 Dec 2016 16:44:55 +0000 (17:44 +0100)] 
docs: various pages: Use "system call" not "syscall"

A minor wording fix...

Signed-off-by: Michael Kerrisk <mtk.man-pages@gmail.com>
8 years agochrt: default to SCHED_RR policy
Andreas Henriksson [Fri, 2 Dec 2016 14:10:18 +0000 (15:10 +0100)] 
chrt: default to SCHED_RR policy

This fixes a regression introduced in:

commit 7a4ea5664edba98bff28adec3a9c3cfb5763a495
"chrt: add control struct"

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>
8 years agodocs: nsenter(1): add missing 'see also' for --user
Karel Zak [Mon, 5 Dec 2016 12:05:34 +0000 (13:05 +0100)] 
docs: nsenter(1): add missing 'see also' for --user

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agodocs: nsenter(1): Formatting fix
Michael Kerrisk [Mon, 5 Dec 2016 09:55:41 +0000 (10:55 +0100)] 
docs: nsenter(1): Formatting fix

Add formatting for 'file' argument used by various options.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
8 years agodocs: nsenter(1): Describe the 'file' argument used by namespace options
Michael Kerrisk [Mon, 5 Dec 2016 09:52:09 +0000 (10:52 +0100)] 
docs: nsenter(1): Describe the 'file' argument used by namespace options

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
8 years agowall: check -g GID
Karel Zak [Fri, 2 Dec 2016 13:11:20 +0000 (14:11 +0100)] 
wall: check -g GID

Based on comments from Sami Kerola.

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agofallocate: add insert range support
Fabian Frederick [Tue, 15 Nov 2016 18:52:26 +0000 (19:52 +0100)] 
fallocate: add insert range support

Based on patch 83cc932d7412
("fallocate: introduce an option -c to support COLLAPSE_RANGE")

This patch includes FALLOC_FL_INSERT_RANGE flag
added to Linux kernel v4.1

Thanks to Pádraig Brady for insert range definition

Signed-off-by: Fabian Frederick <fabf@skynet.be>
8 years agowall: add --group option
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>
8 years agolsns: Fix parser for /proc/<pid>/stat which is including space in comm
OGAWA Hirofumi [Wed, 23 Nov 2016 05:13:34 +0000 (14:13 +0900)] 
lsns: Fix parser for /proc/<pid>/stat which is including space in comm

For example, child process of spamd has

    32031 (spamd child) S 32026 32026 32026 0 -1 4210752 338 0 0 0 ...

fscanf("%d %*s %c %d*[^\n]") in read_process() can't parse above as we
expected, because %s only skips non-whitespace. I.e. it parses like
following,

    32031 (spamd child) S 32026 32026 32026 0 -1 4210752 338 0 0 0 ...
    +---+ +----+ +
      %d    %*s  %c

and returns 2 (pid=32031, state=c).

This fixes it by skipping task->comm part manually.

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
8 years agomisc: fix typos using codespell
Ruediger Meier [Wed, 30 Nov 2016 14:16:45 +0000 (15:16 +0100)] 
misc: fix typos using codespell

 # command used was:
 $ ~/src/codespell/codespell \
   -w -D /home/rudi/src/codespell/build/lib/codespell_lib/data/dictionary.txt \
   $(git ls-files | grep -v "^po/\|\.xz$\|\.gz$\|\.bz2$\|\.img$\|^Documentation/releases/")

 BTW some manually grammer fixes:
   s/uses/used/
   s/begin/beginning/

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
8 years agomisc: spelling, always use "cannot" instead of "can not"
Ruediger Meier [Tue, 1 Nov 2016 18:40:33 +0000 (19:40 +0100)] 
misc: spelling, always use "cannot" instead of "can not"

Just to be consistent ...

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
8 years agotests: update sfdisk output
Karel Zak [Wed, 30 Nov 2016 12:02:01 +0000 (13:02 +0100)] 
tests: update sfdisk output

The output of the "New situation:" contains

 Disklabel type: <name>
 Disk identifier: <removed>

lines now.

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agosfdisk: support empty label use-case
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>
8 years agosfdisk: cleanup --dump error messages
Karel Zak [Wed, 30 Nov 2016 09:53:56 +0000 (10:53 +0100)] 
sfdisk: cleanup --dump error messages

old:
  # truncate -s 1G empty && ./sfdisk --dump empty
  sfdisk: failed to dump partition table: Success

new:
  # truncate -s 1G empty && ./sfdisk --dump empty
  sfdisk: empty: does not contain a recognized partition table.

Addresses: https://github.com/karelzak/util-linux/issues/375
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agotests: update lsmem tests
Karel Zak [Wed, 30 Nov 2016 09:47:41 +0000 (10:47 +0100)] 
tests: update lsmem tests

The commit 4c0e1eaf34fe604118afcd792291419e1d4ff661 modifies the
alignment of the STATE column.

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agoMerge branch 'master' of https://github.com/rudimeier/util-linux
Karel Zak [Tue, 29 Nov 2016 16:08:23 +0000 (17:08 +0100)] 
Merge branch 'master' of https://github.com/rudimeier/util-linux

8 years agosfdisk: don't be silent when list non-existing device
Karel Zak [Tue, 29 Nov 2016 14:58:18 +0000 (15:58 +0100)] 
sfdisk: don't be silent when list non-existing device

Addresses: https://github.com/karelzak/util-linux/issues/376
Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agobuild-sys: use sed to substitute
Karel Zak [Tue, 29 Nov 2016 13:25:12 +0000 (14:25 +0100)] 
build-sys: use sed to substitute

Travis CI:
tools/git-version-gen: 116: tools/git-version-gen: Bad substitution

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agobuild-sys: cosmetics, avoid useless m4 quotes
Ruediger Meier [Tue, 29 Nov 2016 11:34:33 +0000 (12:34 +0100)] 
build-sys: cosmetics, avoid useless m4 quotes

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
8 years agobuild-sys: fix bashism, introduced in 85004b14
Ruediger Meier [Tue, 29 Nov 2016 11:24:19 +0000 (12:24 +0100)] 
build-sys: fix bashism, introduced in 85004b14

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
8 years agobuild-sys: fix "remove the g in git describe"
Ruediger Meier [Thu, 17 Nov 2016 02:10:02 +0000 (03:10 +0100)] 
build-sys: fix "remove the g in git describe"

The "g" was not always removed and "-rc*" follow-ups were handled
incorrectly.

So now after last commits we have these versions:

 git describe            -> blkid -V
 --------------------------------------------------------------
 v2.29-rc4               -> 2.29-rc4          (libblkid 2.29.0)
 v2.29-rc4-3-g4c8928d    -> 2.29-rc4-3-4c89   (libblkid 2.29.0)

 v2.29                   -> 2.29              (libblkid 2.29.0)
 v2.29-78-g4c8928d       -> 2.29.78-4c89      (libblkid 2.29.78)

 v2.29.1                 -> 2.29.1            (libblkid 2.29.1)
 v2.29.1-4-g4c8928d      -> 2.29.1.4-4c89     (libblkid 2.29.1)

 v2.29.1-rc2             -> 2.29.1-rc2        (libblkid 2.29.1)
 v2.29.1-rc2-3-g4c8928d  -> 2.29.1-rc2-3-4c89 (libblkid 2.29.1)

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
8 years agobuild-sys: remove old git fallback from git-version-gen
Ruediger Meier [Thu, 17 Nov 2016 02:10:01 +0000 (03:10 +0100)] 
build-sys: remove old git fallback from git-version-gen

Just make the script more readable. Nobody is using 10 years old
git.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
8 years agobuild-sys: cosmetics PACKAGE_VERSION_MINOR
Ruediger Meier [Thu, 17 Nov 2016 02:10:00 +0000 (03:10 +0100)] 
build-sys: cosmetics PACKAGE_VERSION_MINOR

This should changes nothing.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
8 years agobuild-sys: update package release number during development
Ruediger Meier [Thu, 17 Nov 2016 02:09:59 +0000 (03:09 +0100)] 
build-sys: update package release number during development

Now we use
   v2.29-5-g8ffab30  -> 2.29.5-8ffa   (libblkid 2.29.5)
instead of
   v2.29-5-g8ffab30  -> 2.29.5-8ffa   (libblkid 2.29.0)

otherwise the bugfix releases (2.29.1) would look newer that latest HEAD.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
8 years agobuild-sys: fix empty package release number
Ruediger Meier [Thu, 17 Nov 2016 02:09:58 +0000 (03:09 +0100)] 
build-sys: fix empty package release number

Was broken for major releases since b0e6b25e:
  $ blkid -V
  blkid from util-linux 2.28  (libblkid 2.28., 12-Apr-2016)

Now we also set 0 in this case, like:
  $ blkid -V
  blkid from util-linux 2.30  (libblkid 2.30.0, 12-Apr-2016)

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
8 years agoIPC namespaces also isolate POSIX message queues
Michael Kerrisk (man-pages) [Thu, 10 Nov 2016 11:00:09 +0000 (12:00 +0100)] 
IPC namespaces also isolate POSIX message queues

As described in pid_namespaces(7), IPC namespaces also
isolate POSIX message queues. Update the unshare(1)
and nsenter(1) pages to clarify that.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
8 years agoProvide better cross references for namespace concepts
Michael Kerrisk (man-pages) [Thu, 10 Nov 2016 11:00:05 +0000 (12:00 +0100)] 
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>
8 years agoProvide better cross references for namespace concepts
Michael Kerrisk (man-pages) [Thu, 10 Nov 2016 11:00:00 +0000 (12:00 +0100)] 
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>
8 years agoSEE ALSO: add cross reference to namespaces(7)
Michael Kerrisk (man-pages) [Thu, 10 Nov 2016 10:59:57 +0000 (11:59 +0100)] 
SEE ALSO: add cross reference to namespaces(7)

Rationale: both of these pages are about namespaces.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
8 years agoReplace reference to sigvec(2) with sigaction(2)
Michael Kerrisk (man-pages) [Thu, 10 Nov 2016 10:59:53 +0000 (11:59 +0100)] 
Replace reference to sigvec(2) with sigaction(2)

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>
8 years agoFix formatting errors in page cross references
Michael Kerrisk (man-pages) [Thu, 10 Nov 2016 10:59:49 +0000 (11:59 +0100)] 
Fix formatting errors in page cross references

These pages had errors such as

    .BR page (x) .

which should be

    .BR page (x).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
8 years agoFix reference for scheduling discussion
Michael Kerrisk (man-pages) [Thu, 10 Nov 2016 10:59:45 +0000 (11:59 +0100)] 
Fix reference for scheduling discussion

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>
8 years agoFix section number in lockf() page xref
Michael Kerrisk (man-pages) [Thu, 10 Nov 2016 10:59:40 +0000 (11:59 +0100)] 
Fix section number in lockf() page xref

lockf() is in section 3, not 2.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
8 years agoFix page cross references
Michael Kerrisk (man-pages) [Thu, 10 Nov 2016 10:59:37 +0000 (11:59 +0100)] 
Fix page cross references

* Add a section number to page cross reference
* Format cross references in bold

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
8 years agoCorrectly format page cross references
Michael Kerrisk (man-pages) [Thu, 10 Nov 2016 10:59:30 +0000 (11:59 +0100)] 
Correctly format page cross references

Most pages in util-linux follow the standard convention
of formatting page cross references in bold. Fix the
few exceptions that use italic.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
8 years agoPlace SEE ALSO entries in order
Michael Kerrisk (man-pages) [Thu, 10 Nov 2016 10:59:27 +0000 (11:59 +0100)] 
Place SEE ALSO entries in order

This patch does only the following:

* 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>
8 years agoFix typo in page cross reference (capabilities(7), not, capability(7))
Michael Kerrisk (man-pages) [Thu, 10 Nov 2016 10:59:14 +0000 (11:59 +0100)] 
Fix typo in page cross reference (capabilities(7), not, capability(7))

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
8 years agolsmem: improve node lookup
Heiko Carstens [Fri, 4 Nov 2016 12:10:06 +0000 (13:10 +0100)] 
lsmem: improve node lookup

Break the loop as soon as we found the node a memory block belongs to,
it doesn't make sense to continue scanning.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
8 years agolsmem: (man page) recommend use --output
Karel Zak [Wed, 9 Nov 2016 08:58:21 +0000 (09:58 +0100)] 
lsmem: (man page) recommend use --output

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolsmem: align STATE to the right
Karel Zak [Wed, 9 Nov 2016 08:58:14 +0000 (09:58 +0100)] 
lsmem: align STATE to the right

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolsmem: add Copyright
Karel Zak [Mon, 7 Nov 2016 10:43:12 +0000 (11:43 +0100)] 
lsmem: add Copyright

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agotests: add x86_64-16g lsmem test
Karel Zak [Fri, 4 Nov 2016 10:32:51 +0000 (11:32 +0100)] 
tests: add x86_64-16g lsmem test

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agotests: cleanup and update lsmem
Karel Zak [Fri, 4 Nov 2016 10:23:39 +0000 (11:23 +0100)] 
tests: cleanup and update lsmem

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolsmem: add missing placeholders
Karel Zak [Fri, 4 Nov 2016 09:55:50 +0000 (10:55 +0100)] 
lsmem: add missing placeholders

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolsmem: cleanup for --summary=only
Karel Zak [Fri, 4 Nov 2016 09:50:06 +0000 (10:50 +0100)] 
lsmem: cleanup for --summary=only

* don't fill scols table
* check for collision with raw,pairs and json options

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolsmem: cleanup man page
Karel Zak [Fri, 4 Nov 2016 09:36:25 +0000 (10:36 +0100)] 
lsmem: cleanup man page

* add missing new options
* remove columns description (for ls-like utils we maintains columns
  description only in the --help output)

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolsmem: disable summary for JSONm, raw and export output
Karel Zak [Thu, 3 Nov 2016 16:24:18 +0000 (17:24 +0100)] 
lsmem: disable summary for JSONm, raw and export output

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolsmem: add --summary[=<when>] option
Karel Zak [Thu, 3 Nov 2016 16:20:37 +0000 (17:20 +0100)] 
lsmem: add --summary[=<when>] option

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolsmem: rename control struct
Karel Zak [Thu, 3 Nov 2016 15:53:53 +0000 (16:53 +0100)] 
lsmem: rename control struct

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolsmem: cleanup, use libsmartcols for all output
Karel Zak [Thu, 3 Nov 2016 15:47:07 +0000 (16:47 +0100)] 
lsmem: cleanup, use libsmartcols for all output

* add --pairs, --raw a --json outputs
* add --noheadings to disable header
* add --bytes
* add --output <list>

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agobuild-sys: mark lsmem and chmem as Linux only
Karel Zak [Thu, 3 Nov 2016 12:09:19 +0000 (13:09 +0100)] 
build-sys: mark lsmem and chmem as Linux only

Signed-off-by: Karel Zak <kzak@redhat.com>
8 years agolsmem: add testcase
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.

This is based on a patch from Clemens von Mann.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
8 years agochmem: new tool
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:

Memory Block 19 (0x0000000130000000-0x000000013fffffff) disabled

or by specifying a size where chmem will automatically select memory
blocks:

Memory Block 21 (0x0000000150000000-0x000000015fffffff) disable failed
Memory Block 18 (0x0000000120000000-0x000000012fffffff) disabled
Memory Block 17 (0x0000000110000000-0x000000011fffffff) disabled
Memory Block 16 (0x0000000100000000-0x000000010fffffff) disabled
Memory Block 15 (0x00000000f0000000-0x00000000ffffffff) disabled

or by specifying memory block numbers instead of address ranges:

Memory Block 15 (0x00000000f0000000-0x00000000ffffffff) disabled
Memory Block 16 (0x0000000100000000-0x000000010fffffff) disabled
Memory Block 17 (0x0000000110000000-0x000000011fffffff) disabled
Memory Block 18 (0x0000000120000000-0x000000012fffffff) disabled

This is based on a patch from Clemens von Mann.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
8 years agolsmem: new tool
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.

This is based on a patch from Clemens von Mann.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
8 years agolib,strutils: add strtoux[16|32|64]_or_err functions
Heiko Carstens [Wed, 12 Oct 2016 12:00:44 +0000 (14:00 +0200)] 
lib,strutils: add strtoux[16|32|64]_or_err functions

Add helper functions which allow to parse hexadecimal numbers.
Based on a patch from Clemens von Mann.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
8 years agobuild-sys: release++ (v2.29) v2.29
Karel Zak [Tue, 8 Nov 2016 10:35:40 +0000 (11:35 +0100)] 
build-sys: release++ (v2.29)

Signed-off-by: Karel Zak <kzak@redhat.com>