]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
13 years agoMerge branch 'sys-utils-again' of https://github.com/kerolasa/lelux-utiliteetit
Karel Zak [Mon, 3 Oct 2011 13:40:15 +0000 (15:40 +0200)] 
Merge branch 'sys-utils-again' of https://github.com/kerolasa/lelux-utiliteetit

* 'sys-utils-again' of https://github.com/kerolasa/lelux-utiliteetit:
  cytune: fix printf type warning
  docs: mention long options in cytune.8
  cytune: coding style fixes
  cytune: refactor main(), new function query_tty_stats()
  cytune: use libc error printing facilities
  cytune: check numeric user inputs
  cytune: add long options and usage()
  docs: restructure flock.1 manual page
  flock: simplify strtotimeval()
  lib: [strutils] add strtod_or_err() function
  flock: use strutils.h to check numeric user input
  flock: use sysexit.h for all exit values
  flock: use function attributes
  flock: align with howto-usage-function.txt
  flock: use libc error printing facilities
  flock: move long_options struct to function scope
  flock: fix coding style
  docs: align fallocate.1 with howto-man-page.txt

13 years agolsblk: add udev support
Ilias Mamedov [Mon, 3 Oct 2011 12:22:42 +0000 (14:22 +0200)] 
lsblk: add udev support

[kzak@redhat.com: - enable udev support by default
                  - don't check for libudev.h
                  - minor udev code refactoring in lsblk.c]

Signed-off-by: Ilias Mamedov <arknir@yandex.ru>
Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agodocs: add prlimit to the TODO file
Karel Zak [Fri, 30 Sep 2011 10:40:44 +0000 (12:40 +0200)] 
docs: add prlimit to the TODO file

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoumount: add warning
Karel Zak [Fri, 30 Sep 2011 09:26:07 +0000 (11:26 +0200)] 
umount: add warning

It's better to inform users about reason why their request does not
makes sense :-)

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoumount: use new lib/loopdev.c code
Karel Zak [Fri, 30 Sep 2011 09:09:38 +0000 (11:09 +0200)] 
umount: use new lib/loopdev.c code

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agomount: fix loopdev deinitialization
Karel Zak [Fri, 30 Sep 2011 09:05:37 +0000 (11:05 +0200)] 
mount: fix loopdev deinitialization

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolibmount: support -o loop=<devname>
Karel Zak [Thu, 29 Sep 2011 23:38:38 +0000 (01:38 +0200)] 
libmount: support -o loop=<devname>

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agomount: use new lib/loopdev.c code
Karel Zak [Thu, 29 Sep 2011 23:28:02 +0000 (01:28 +0200)] 
mount: use new lib/loopdev.c code

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoinclude,xalloc: fix whitespace to be consistent
Dave Reisner [Thu, 29 Sep 2011 18:56:42 +0000 (14:56 -0400)] 
include,xalloc: fix whitespace to be consistent

We use spaces for the rest of this file, so the random tabs within
xstrdup stand out.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
13 years agoinclude,xalloc: check for NULL before calling strdup
Dave Reisner [Thu, 29 Sep 2011 18:56:41 +0000 (14:56 -0400)] 
include,xalloc: check for NULL before calling strdup

This fixes a segfault in mount (and possibly elsewhere) when invoked
without a -t parameter.

Broken in 7ef9fd7 when the common xalloc.h libs were introduced.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
13 years agotests: add missing file
Karel Zak [Thu, 29 Sep 2011 22:22:22 +0000 (00:22 +0200)] 
tests: add missing file

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolibmount: use loopdev debug facility
Karel Zak [Thu, 29 Sep 2011 21:29:46 +0000 (23:29 +0200)] 
libmount: use loopdev debug facility

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolib,loopdev: add debugu messages
Karel Zak [Thu, 29 Sep 2011 21:28:36 +0000 (23:28 +0200)] 
lib,loopdev: add debugu messages

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agocytune: fix printf type warning
Sami Kerola [Sun, 25 Sep 2011 20:49:52 +0000 (22:49 +0200)] 
cytune: fix printf type warning

conversion specifies type 'unsigned long' but the argument has type 'unsigned long *'

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agodocs: mention long options in cytune.8
Sami Kerola [Sun, 25 Sep 2011 20:28:51 +0000 (22:28 +0200)] 
docs: mention long options in cytune.8

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agocytune: coding style fixes
Sami Kerola [Sun, 25 Sep 2011 20:16:53 +0000 (22:16 +0200)] 
cytune: coding style fixes

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agocytune: refactor main(), new function query_tty_stats()
Sami Kerola [Sun, 25 Sep 2011 20:13:14 +0000 (22:13 +0200)] 
cytune: refactor main(), new function query_tty_stats()

This commit also moves global variables to the beginning of the
file, or to function scope where they belong.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agocytune: use libc error printing facilities
Sami Kerola [Sun, 25 Sep 2011 20:10:37 +0000 (22:10 +0200)] 
cytune: use libc error printing facilities

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agocytune: check numeric user inputs
Sami Kerola [Sun, 25 Sep 2011 20:09:29 +0000 (22:09 +0200)] 
cytune: check numeric user inputs

Checks use strtol_or_err() from strutils.h

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agocytune: add long options and usage()
Sami Kerola [Sun, 25 Sep 2011 20:08:42 +0000 (22:08 +0200)] 
cytune: add long options and usage()

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agodocs: restructure flock.1 manual page
Sami Kerola [Sun, 25 Sep 2011 11:00:15 +0000 (13:00 +0200)] 
docs: restructure flock.1 manual page

The commit aligns manual page with howto-man-page.txt, and adds example
section which I hope makes usage of this command easier.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoflock: simplify strtotimeval()
Sami Kerola [Sun, 25 Sep 2011 10:03:30 +0000 (12:03 +0200)] 
flock: simplify strtotimeval()

Retire private string to number conversion and use strtod_or_err() instead.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agolib: [strutils] add strtod_or_err() function
Sami Kerola [Sun, 25 Sep 2011 09:03:07 +0000 (11:03 +0200)] 
lib: [strutils] add strtod_or_err() function

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoflock: use strutils.h to check numeric user input
Sami Kerola [Wed, 21 Sep 2011 20:26:05 +0000 (22:26 +0200)] 
flock: use strutils.h to check numeric user input

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoflock: use sysexit.h for all exit values
Sami Kerola [Wed, 21 Sep 2011 19:56:45 +0000 (21:56 +0200)] 
flock: use sysexit.h for all exit values

Additionally enhance readability of complex double "if shorthand's" by
making the segment to be few normal "if's".

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoflock: use function attributes
Sami Kerola [Wed, 21 Sep 2011 19:38:08 +0000 (21:38 +0200)] 
flock: use function attributes

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoflock: align with howto-usage-function.txt
Sami Kerola [Wed, 21 Sep 2011 19:27:42 +0000 (21:27 +0200)] 
flock: align with howto-usage-function.txt

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoflock: use libc error printing facilities
Sami Kerola [Wed, 21 Sep 2011 19:15:53 +0000 (21:15 +0200)] 
flock: use libc error printing facilities

Retire global progname variable and use warn{,x} and err{,x}
functions. As a side effect of using err function the occurences of
err variable had to be converted to referrals to errno variable.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoflock: move long_options struct to function scope
Sami Kerola [Wed, 21 Sep 2011 18:55:50 +0000 (20:55 +0200)] 
flock: move long_options struct to function scope

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoflock: fix coding style
Sami Kerola [Wed, 21 Sep 2011 18:52:31 +0000 (20:52 +0200)] 
flock: fix coding style

Sanitize indentation, spacing, brace positions, comment line lenghts and
positions etc. This commit does not change a thing in code.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agodocs: align fallocate.1 with howto-man-page.txt
Sami Kerola [Mon, 19 Sep 2011 19:19:47 +0000 (21:19 +0200)] 
docs: align fallocate.1 with howto-man-page.txt

Add also earlierly missing --version to the manual.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agotests: add loopdev libmount test
Karel Zak [Thu, 29 Sep 2011 18:50:27 +0000 (20:50 +0200)] 
tests: add loopdev libmount test

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolibmount: support {offset,sizelimit}= foor loopdevs
Karel Zak [Thu, 29 Sep 2011 18:50:08 +0000 (20:50 +0200)] 
libmount: support {offset,sizelimit}= foor loopdevs

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolibmount: add function to parse offsets/sizes
Karel Zak [Thu, 29 Sep 2011 15:48:03 +0000 (17:48 +0200)] 
libmount: add function to parse offsets/sizes

13 years agoipcrm: fix wrong subject in error messages for -m, -q, -s id options
Francesco Cosoleto [Wed, 28 Sep 2011 14:25:31 +0000 (16:25 +0200)] 
ipcrm: fix wrong subject in error messages for -m, -q, -s id options

This makes error messages print 'id' instead of 'key' using id options.

Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
13 years agoipcrm: use ternary operator in "(key|id) failed" message
Francesco Cosoleto [Wed, 28 Sep 2011 14:25:30 +0000 (16:25 +0200)] 
ipcrm: use ternary operator in "(key|id) failed" message

Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
13 years agoipcrm: add static keyword to some functions
Francesco Cosoleto [Wed, 28 Sep 2011 14:25:29 +0000 (16:25 +0200)] 
ipcrm: add static keyword to some functions

Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
13 years agomisc: use %m in format string instead of %s and strerror(errno)
Petr Uzel [Thu, 22 Sep 2011 10:12:37 +0000 (12:12 +0200)] 
misc: use %m in format string instead of %s and strerror(errno)

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
13 years agodocs: update TODO
Petr Uzel [Thu, 22 Sep 2011 10:12:08 +0000 (12:12 +0200)] 
docs: update TODO

TODO items already done by Sami Kerola

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
13 years agosfdisk: warn if partition exceeds partition table limits
Petr Uzel [Mon, 19 Sep 2011 13:29:15 +0000 (15:29 +0200)] 
sfdisk: warn if partition exceeds partition table limits

Warn the user if the partition to be created exceeds limits
imposed by the DOS partition table, which is:
* partition has to start on sector < 2^32
* partition size has to be < 2^32 sectors

For 512-byte logical sector size, these limits are ~2.2 TiB.

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
13 years agosfdisk: use unsigned long long to internally represent sector number
Petr Uzel [Mon, 19 Sep 2011 13:29:14 +0000 (15:29 +0200)] 
sfdisk: use unsigned long long to internally represent sector number

Unsigned long is only 4 bytes long on i586, which is not enough to
represent sector number on todays large disks. Use unsigned long long,
which is 8 bytes long, to store the sector numbers internally, so that
we could later make some sanity checks and warn the user if the sector
numbers exceed the limits imposed by DOS partition table format.

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
13 years agosfdisk: introduce get_ull() function
Petr Uzel [Mon, 19 Sep 2011 13:29:13 +0000 (15:29 +0200)] 
sfdisk: introduce get_ull() function

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
13 years agosfdisk: get_disksize() returns long long
Petr Uzel [Mon, 19 Sep 2011 13:29:12 +0000 (15:29 +0200)] 
sfdisk: get_disksize() returns long long

unsigned long is 4 bytes long on i586, which is not enough for big
HDD's with 512B sectors. Use unsigned long long, which is 8 bytes.

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
13 years agosfdisk: make the cylinder boundary check less fatal
Petr Uzel [Mon, 19 Sep 2011 13:29:11 +0000 (15:29 +0200)] 
sfdisk: make the cylinder boundary check less fatal

If the specified format is not cylinders, make the cylinder boundary
check only print a warning and proceed anyways.

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
13 years agosfdisk: fix weird indentation in msdos_partition()
Petr Uzel [Mon, 19 Sep 2011 13:29:10 +0000 (15:29 +0200)] 
sfdisk: fix weird indentation in msdos_partition()

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
13 years agosfdisk: file descriptor is of int type
Petr Uzel [Mon, 19 Sep 2011 13:29:09 +0000 (15:29 +0200)] 
sfdisk: file descriptor is of int type

Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
13 years agoblkid: fix unfinished sentence for -l option in blkid.8
Dave Reisner [Sat, 17 Sep 2011 21:20:47 +0000 (17:20 -0400)] 
blkid: fix unfinished sentence for -l option in blkid.8

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
13 years agouuidd: Add missing break to option case statement
Eric Sandeen [Sat, 17 Sep 2011 00:53:50 +0000 (19:53 -0500)] 
uuidd: Add missing break to option case statement

Specifying the "-n" option to uuidd would incorrectly
fall through to the "-p" case, and assign that number to
the pidfile_path.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
13 years agolibmount: fix use of logical '&&' with constant operand
Francesco Cosoleto [Thu, 15 Sep 2011 14:17:46 +0000 (16:17 +0200)] 
libmount: fix use of logical '&&' with constant operand

Found by clang.

Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
13 years agolib,loopdev: fix use of logical '&&' with constant operand
Francesco Cosoleto [Thu, 15 Sep 2011 14:17:45 +0000 (16:17 +0200)] 
lib,loopdev: fix use of logical '&&' with constant operand

Found by clang.

Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
13 years agoflock: make flock(1) work on NFSv4
Petr Uzel [Thu, 15 Sep 2011 08:19:17 +0000 (10:19 +0200)] 
flock: make flock(1) work on NFSv4

To pleace an exclusive lock on a file, NFSv4 requires
the file to be opened RW because of the emulation of flock()
by fcntl():

http://www.spinics.net/lists/linux-nfs/msg18502.html

So instead of O_RDONLY, open the file in O_RDWR if access()
indicates it is possible (unless shared lock is requested).

From: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
13 years agobuild-sys: add path.h to Makefile.am
Karel Zak [Tue, 27 Sep 2011 12:59:57 +0000 (14:59 +0200)] 
build-sys: add path.h to Makefile.am

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolscpu: stricter command line parsing
Heiko Carstens [Thu, 15 Sep 2011 06:52:34 +0000 (08:52 +0200)] 
lscpu: stricter command line parsing

Disallow superfluous commands for lscpu like e.g. "lscpu bla" and let it
fail print the help text instead.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
13 years agolscpu: add --offline option
Heiko Carstens [Thu, 15 Sep 2011 06:52:33 +0000 (08:52 +0200)] 
lscpu: add --offline option

Implement "--offline" option which only prints offline cpus. As a side effect
we can get rid of the internal "allcpus" flag, since if we want to print
informations for online and offline cpus we simply set both flags.

When reading sysfs attributes of cpus this is now done for all cpus, since
e.g. the topology informations of the online cpus may influence the
topology informations of the offline cpus. This mainly because online cpus
may contain masks which include offline cpus while offline cpus have a
missing topology directory.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
13 years agolscpu: fix -e output
Heiko Carstens [Thu, 15 Sep 2011 06:52:32 +0000 (08:52 +0200)] 
lscpu: fix -e output

The modifier mod->allcpus must be set earlier and also must be used
earlier. The current code only reads sysfs attributes from online
cpus but skips offline cpus.
So initialize mod->allcpus earlier.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
13 years agochcpu: provide better user feedback
Heiko Carstens [Thu, 15 Sep 2011 06:52:31 +0000 (08:52 +0200)] 
chcpu: provide better user feedback

Instead of printing error messages like "I/O resource busy" which are
supplied by strerror, give better feedback if the reason of failure
is known.
E.g. taking the last cpu offline cannot succeed, therefore print a
message that gives this "hint".

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
13 years agolib,path: use write_all()
Heiko Carstens [Fri, 16 Sep 2011 08:28:43 +0000 (10:28 +0200)] 
lib,path: use write_all()

From: Heiko Carstens <heiko.carstens@de.ibm.com>

Since write() doesn't necessarily write the complete buffer with
one call we better use write_all() which takes care of this.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
13 years agochcpu: convert to use lib/path.c
Heiko Carstens [Thu, 15 Sep 2011 06:52:30 +0000 (08:52 +0200)] 
chcpu: convert to use lib/path.c

Use the common path access functions. In order to simplify chcpu also implement
and use path_writestr() which writes a string to the path specified.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
13 years agolib,path: move path access functions from lscpu into lib/path.c
Heiko Carstens [Thu, 15 Sep 2011 06:52:29 +0000 (08:52 +0200)] 
lib,path: move path access functions from lscpu into lib/path.c

A couple of these functions already have been copied to chcpu.c,
so it makes sense to move these functions into an own file.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
13 years agosetarch: minor changes to usage()
Karel Zak [Tue, 27 Sep 2011 11:26:59 +0000 (13:26 +0200)] 
setarch: minor changes to usage()

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agopivot_root: minor changes to usage()
Karel Zak [Tue, 27 Sep 2011 11:26:45 +0000 (13:26 +0200)] 
pivot_root: minor changes to usage()

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoipcs: minor changes to usage()
Karel Zak [Tue, 27 Sep 2011 11:26:26 +0000 (13:26 +0200)] 
ipcs: minor changes to usage()

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoctrlaltdel: minor changes to usage()
Karel Zak [Tue, 27 Sep 2011 11:26:06 +0000 (13:26 +0200)] 
ctrlaltdel: minor changes to usage()

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoarch: minor changes to usage()
Karel Zak [Tue, 27 Sep 2011 11:25:53 +0000 (13:25 +0200)] 
arch: minor changes to usage()

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoMerge branch 'sys-utils' of https://github.com/kerolasa/lelux-utiliteetit
Karel Zak [Tue, 27 Sep 2011 10:56:48 +0000 (12:56 +0200)] 
Merge branch 'sys-utils' of https://github.com/kerolasa/lelux-utiliteetit

* 'sys-utils' of https://github.com/kerolasa/lelux-utiliteetit: (29 commits)
  docs: add non-return function and if shorthand tips
  build-sys: fixes to USAGE_* macros
  ipcrm: check IPC syscalls
  ipcrm: add --verbose option
  ipcmk: allow high speed ipc creation
  ipcrm: add --all option
  docs: add long options to ipcs.1 man page
  docs: add long options to ipcrm.1 man page
  docs: add long options to ipcmk.1 man page
  docs: add --version to setarch.8
  docs: mention long options in ctrlaltdel.8
  ctrlaltdel: add version & help options
  docs: mention long options in pivot_root.8
  pivot_root: add version & help option
  ipcs: comment & white space clean up
  ipcs: include-what-you-use header check
  ipcs: add long options
  ipcrm: include-what-you-use header check
  ipcrm: refactor new and old main to share code
  ipcrm: exit if unknown error occurs
  ...

13 years agomount: use common libs
Davidlohr Bueso [Wed, 14 Sep 2011 18:07:06 +0000 (15:07 -0300)] 
mount: use common libs

Get rid of the local xmalloc.[c/h] files by using the global xalloc and
strutils libraries.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
13 years agolscpu: add column names to --help
Karel Zak [Tue, 27 Sep 2011 10:45:42 +0000 (12:45 +0200)] 
lscpu: add column names to --help

 * use uppercase by default (only -p uses lowercase)
 * a little cleanup usage()

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolscpu: gettextize two columns
Karel Zak [Tue, 27 Sep 2011 10:26:02 +0000 (12:26 +0200)] 
lscpu: gettextize two columns

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoagetty: test ECHO on c_lflag
Karel Zak [Mon, 26 Sep 2011 10:34:10 +0000 (12:34 +0200)] 
agetty: test ECHO on c_lflag

Reported-by: xinglp <xinglp@gmail.com>
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=739522
Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agodocs: add non-return function and if shorthand tips
Sami Kerola [Sat, 17 Sep 2011 12:35:15 +0000 (14:35 +0200)] 
docs: add non-return function and if shorthand tips

Non-return functions should not be combined with `else' clause.

The if shorthands `var = e ? t : f;' need to fit to single line,
and if that does not look good use normal "if else" syntax.

Both tips are mentioned in email bellow.

http://www.spinics.net/lists/util-linux-ng/msg05152.html

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agobuild-sys: fixes to USAGE_* macros
Sami Kerola [Sat, 17 Sep 2011 10:52:32 +0000 (12:52 +0200)] 
build-sys: fixes to USAGE_* macros

The USAGE_BEGIN_TAIL is removed as unnecessary.

In between command specific options and --help & --version
USAGE_SEPARATOR is inserted. For now the separator is empty line.

The USAGE_MAN_TAIL is changed to take an argument.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoipcrm: check IPC syscalls
Davidlohr Bueso [Wed, 14 Sep 2011 17:02:15 +0000 (14:02 -0300)] 
ipcrm: check IPC syscalls

It's not enough to check errno for errors as the variable is not
reset, we also need to check the last syscall return value to
verify a problem. This addresses bogus msgqueue errors when
deleting keys.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoipcrm: add --verbose option
Sami Kerola [Tue, 13 Sep 2011 20:00:13 +0000 (22:00 +0200)] 
ipcrm: add --verbose option

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoipcmk: allow high speed ipc creation
Sami Kerola [Mon, 12 Sep 2011 20:01:03 +0000 (22:01 +0200)] 
ipcmk: allow high speed ipc creation

This commit will allow user to create quickly plenty of ipc
resources. Earlier the line bellow gave no satisfaction.

for i in $(seq 0 42); do ipcmk -Q; done

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoipcrm: add --all option
Sami Kerola [Mon, 12 Sep 2011 16:56:30 +0000 (18:56 +0200)] 
ipcrm: add --all option

An --all option will remove all ipc entries. The option takes
optional resource argument, which limits the removal to be
applied only the given resource entries.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agodocs: add long options to ipcs.1 man page
Sami Kerola [Mon, 5 Sep 2011 20:05:37 +0000 (22:05 +0200)] 
docs: add long options to ipcs.1 man page

Includes few style fixes from Documentation/howto-man-page.txt
and align information by what is being said by The Open Group.

http://pubs.opengroup.org/onlinepubs/009604599/utilities/ipcs.html

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agodocs: add long options to ipcrm.1 man page
Sami Kerola [Mon, 5 Sep 2011 19:29:54 +0000 (21:29 +0200)] 
docs: add long options to ipcrm.1 man page

Includes few style fixes from Documentation/howto-man-page.txt

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agodocs: add long options to ipcmk.1 man page
Sami Kerola [Mon, 5 Sep 2011 19:16:08 +0000 (21:16 +0200)] 
docs: add long options to ipcmk.1 man page

Includes few style fixes from Documentation/howto-man-page.txt

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agodocs: add --version to setarch.8
Sami Kerola [Mon, 5 Sep 2011 18:56:30 +0000 (20:56 +0200)] 
docs: add --version to setarch.8

Includes few style fixes from Documentation/howto-man-page.txt

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agodocs: mention long options in ctrlaltdel.8
Sami Kerola [Wed, 31 Aug 2011 18:59:48 +0000 (20:59 +0200)] 
docs: mention long options in ctrlaltdel.8

Includes other manual page maintenance fixes.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoctrlaltdel: add version & help options
Sami Kerola [Wed, 31 Aug 2011 18:52:01 +0000 (20:52 +0200)] 
ctrlaltdel: add version & help options

Including other necessary changes to usage().

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agodocs: mention long options in pivot_root.8
Sami Kerola [Wed, 31 Aug 2011 18:37:29 +0000 (20:37 +0200)] 
docs: mention long options in pivot_root.8

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agopivot_root: add version & help option
Sami Kerola [Wed, 31 Aug 2011 18:33:27 +0000 (20:33 +0200)] 
pivot_root: add version & help option

Including other necessary changes to usage().

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoipcs: comment & white space clean up
Sami Kerola [Mon, 29 Aug 2011 19:47:36 +0000 (21:47 +0200)] 
ipcs: comment & white space clean up

Add to multiline comments to have left side stars, convert spaces
to tabs and indent preprocessor directives

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoipcs: include-what-you-use header check
Sami Kerola [Mon, 29 Aug 2011 19:34:48 +0000 (21:34 +0200)] 
ipcs: include-what-you-use header check

Two includes added & a sort to alphabetical order.

ipcs.c should add these lines:
 #include <features.h>                   // for __GLIBC__
 #include <stddef.h>                     // for size_t

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoipcs: add long options
Sami Kerola [Mon, 29 Aug 2011 19:15:36 +0000 (21:15 +0200)] 
ipcs: add long options

Includes necessary usage() changes.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoipcrm: include-what-you-use header check
Sami Kerola [Mon, 29 Aug 2011 18:12:41 +0000 (20:12 +0200)] 
ipcrm: include-what-you-use header check

Three removes & a sort to alphabetical order.

ipcrm.c should remove these lines:
- #include <ctype.h>  // lines 29-29
- #include <sys/types.h>  // lines 18-18
- #include <unistd.h>  // lines 27-27

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoipcrm: refactor new and old main to share code
Sami Kerola [Sun, 28 Aug 2011 18:24:07 +0000 (20:24 +0200)] 
ipcrm: refactor new and old main to share code

The code is now much more tidy, and as a bonus old main has
shares error printing with the `new' code.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoipcrm: exit if unknown error occurs
Sami Kerola [Sun, 28 Aug 2011 17:01:56 +0000 (19:01 +0200)] 
ipcrm: exit if unknown error occurs

Previously for instance lack of memory space caused unknown
reason to be printed, and ipcrm tried to continue.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agomount: check for target before source on remount
Karel Zak [Tue, 13 Sep 2011 20:59:39 +0000 (22:59 +0200)] 
mount: check for target before source on remount

Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=737091
Reported-by: Eric Paris <eparis@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agolib: do not attempt to close(0) in sysfs_deinit()
Petr Uzel [Tue, 13 Sep 2011 09:08:46 +0000 (11:08 +0200)] 
lib: do not attempt to close(0) in sysfs_deinit()

If the 'open' fails we 'goto err' which runs 'sysfs_deinit()' on a 'cxt'
which hasn't been fully initialised. The 'dir_fd' is still 0, so
sysfs_deinit calls "close(0)".

Addresses: https://bugzilla.novell.com/show_bug.cgi?id=714151
Reported-by: Diego Ercolani <diego.ercolani@gmail.com>
Analysed-by: Neil Brown <nfbrown@suse.com>
Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
13 years agochfn: remove non-ANSI definitions [smatch scan]
Karel Zak [Tue, 13 Sep 2011 09:21:47 +0000 (11:21 +0200)] 
chfn: remove non-ANSI definitions [smatch scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agobuild-sys: add err and errx to smatch no_return_funcs
Karel Zak [Tue, 13 Sep 2011 09:15:43 +0000 (11:15 +0200)] 
build-sys: add err and errx to smatch no_return_funcs

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agobuild-sys: add smatch data
Karel Zak [Tue, 13 Sep 2011 09:10:18 +0000 (11:10 +0200)] 
build-sys: add smatch data

Signed-off-by: Karel Zak <kzak@redhat.com>
13 years agoipcrm: add long options
Sami Kerola [Sun, 28 Aug 2011 16:30:23 +0000 (18:30 +0200)] 
ipcrm: add long options

With long options usage function had to be changed. The change
also takes libc error printing facilities to use, primarily to
get rid of execname & progname variables.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoipcmk: include-what-you-use header check
Sami Kerola [Sun, 28 Aug 2011 11:30:36 +0000 (13:30 +0200)] 
ipcmk: include-what-you-use header check

Three removes & a sort to alphabetical order.

ipcmk.c should remove these lines:
- #include <string.h>  // lines 24-24
- #include <sys/types.h>  // lines 30-30
- #include <unistd.h>  // lines 29-29

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoipcmk: remove camel casing
Sami Kerola [Sun, 28 Aug 2011 11:24:32 +0000 (13:24 +0200)] 
ipcmk: remove camel casing

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoipcmk: validate numeric option arguments
Sami Kerola [Sun, 28 Aug 2011 11:16:23 +0000 (13:16 +0200)] 
ipcmk: validate numeric option arguments

Use strtoul_or_err() instead of atoi().

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoipcmk: remove useless code
Sami Kerola [Sun, 28 Aug 2011 11:09:03 +0000 (13:09 +0200)] 
ipcmk: remove useless code

Checking same return value twice does not make command any
better. Secondly the program_invocation_short_name is known to
work, so global progname variable does not add anything extra.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
13 years agoipcmk: add long options & fix usage()
Sami Kerola [Sun, 28 Aug 2011 10:39:59 +0000 (12:39 +0200)] 
ipcmk: add long options & fix usage()

Signed-off-by: Sami Kerola <kerolasa@iki.fi>