Commit Graph

3657 Commits

Author SHA1 Message Date
Karel Zak e9d00e66fb include,c.h: include fcntl.h before check for O_CLOEXEC [smatch scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-12 13:53:10 +02:00
Karel Zak 56a987c998 build-sys: add checksmatch target 2011-09-12 13:52:14 +02:00
Heiko Carstens 7e0f5b592a lscpu: remove unneeded file
As noted by Sami I accidentally added a garbage file.
Just remove it again.

Cc: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-12 12:46:01 +02:00
Francesco Cosoleto 8c40f48195 fdformat: fix uninitialized variable
Spotted by EKOPath compiler.

Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
2011-09-12 12:45:57 +02:00
Karel Zak 2511b248fa Merge branch 'smatch' of https://github.com/kerolasa/lelux-utiliteetit
* 'smatch' of https://github.com/kerolasa/lelux-utiliteetit:
  kill: fix issue warned by smatch
  last: fix smatch warning
  libblkid: fix smatch warning
  column: fix error reported by smatch
  build-sys: ddate typo fixed
  build-sys: add --enable-most-builds
2011-09-12 12:42:46 +02:00
Heiko Carstens e43fc13e76 lscpu: s/Y/Yes/ s/N/No/
However I'd like to see one change if you don't object: printing just "N" or
"Y" instead of "No" and "Yes" in the human readable output looks a bit ugly to
me.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-12 12:39:30 +02:00
Sami Kerola d4dffe7622 kill: fix issue warned by smatch
misc-utils/procs.c +82 get_pids(52) error: potential null derefence 'pids'.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-09-10 16:55:27 +02:00
Sami Kerola 889f1215f6 last: fix smatch warning
login-utils/last.c +447 ttyconv(11) error: buffer overflow '(arg)' 3 <= 3

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-09-10 16:49:58 +02:00
Sami Kerola d6d11fa5c6 libblkid: fix smatch warning
libblkid/src/probe.c +798 blkid_probe_get_idmag(32) error: we previously assumed 'id' could be null.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-09-10 16:49:03 +02:00
Sami Kerola 6a41edfa5b column: fix error reported by smatch
column.c:201:2: error: 'for' loop initial declarations are only allowed in C99 mode

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-09-10 16:48:12 +02:00
Sami Kerola 564cea2b28 build-sys: ddate typo fixed
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-09-10 16:47:15 +02:00
Sami Kerola d17584b635 build-sys: add --enable-most-builds
The --enable-most-builds will build everything else but
experimental code.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-09-10 16:46:53 +02:00
Karel Zak 4e9b3bfda2 lib,cpuset: fix compiler warning [-Wuninitialized]
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-10 00:02:00 +02:00
Heiko Carstens 59fb133a02 chcpu,cpuset: reduce code duplication for cpu list parsing
Reduce code duplication and print better error message if an
unsupported cpu number was passed.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-10 00:00:35 +02:00
Heiko Carstens f27ce0711c lib,cpuset: enforce stricter parsing of cpu lists
The current cpulist_parse() function ignores extra non-parsable characters at
the end of the to be parsed cpu list string.  E.g. it would accept something
like "0bla" and just set bit 0 in the cpu set.  Since such a string is invalid
implement stricter parsing that makes sure that everything of the string has
been succesfully parsed.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-10 00:00:33 +02:00
Heiko Carstens 72232a267a lib,cpuset: fix stride handling in cpulist_parse()
If cpulist_parse() gets passed a cpu list with a stride value of 0 it will be
stuck in an endless loop.  E.g. the following cpu list will cause an endless
loop: "0-2:0".  Fix this by causing a parse error if the stride value is 0.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-10 00:00:24 +02:00
Heiko Carstens 289127f52d lib,cpuset: fix odd placed braces in cpulist_parse()
The opening and closing braces for two following if statements within
cpulist_parse() are placed in an odd manner.
Just fix this to prevent broken code in the future.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-10 00:00:15 +02:00
Heiko Carstens 68845fed01 lib,cpuset: fix comments for cpu mask/list functions
The comments for cpumask_parse() and cpulist_parse() each describe
the wrong function. Just exchange the comments.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-10 00:00:14 +02:00
Frederik \"Freso\" S. Olesen cbdf0a8165 mount: remove superfluous "an" under ext4 mount options in mount.8
Signed-off-by: Frederik "Freso" S. Olesen <freso@freso.dk>
2011-09-09 23:56:58 +02:00
Heiko Carstens 10829cd73c lscpu: add Hypervisor to output
Some vendors have several hypervisors. Therefore it makes sense to not only
print out the hypervisor vendor but also the name of the hypervisor.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-09 23:54:01 +02:00
Heiko Carstens 603e7f10f1 lscpu: add s390 test case
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-09 23:50:55 +02:00
Karel Zak 23e9e95ac3 lscpu: add --online option
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-09 23:50:41 +02:00
Heiko Carstens 0ad29ff6b0 lscpu: add --all option
The parsable output includes only lines of online CPUs. To also include
lines for all offline CPUs the "--all" option can be specified.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-09 23:50:01 +02:00
Heiko Carstens a7e5300c97 lscpu: add online state to output
lscpu only prints lines for online CPUs. At least for the human readable
list the offline CPUs are of interest as well. In order to distinguish
between online and offline CPUs introduce the "Online" column.
By default the human readable output now displays online and offline CPUs.
The parsable output is not changed. It will print only lines for online
CPUs as it used to do.

[kzak@redhat.com: - minor changes]

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-09 23:49:22 +02:00
Heiko Carstens d231eea114 lscpu: add configured state to output
CPUs may be in a configured or deconfigured state depending if the CPU resource
may be used by the guest.  If a CPU is in configured state the guest may use it
(i.e. set it online). It it is in deconfigured state it cannot use it before
changing its state to configured.  Display this CPU attribute as well.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-09 23:41:25 +02:00
Karel Zak ba45d8c1ea lscpu: add human readable extended cpu table output
Based on patch from Heiko Carstens <heiko.carstens@de.ibm.com>:

lscpu currently only supports a parsable output which contains a row for
each cpu and its attributes. This output contains only comas as separators
and is hard to read for humans.

Therefore add a new option "-e | --extended" which outputs the rows in a
much more readable (and non-parsable) form. Just like for the -p option a
list of columns can be specified that shall be included in the output.

By default this option will print all columns that contain data.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-09 23:41:01 +02:00
Karel Zak e3b3a2f3f8 lscpu: use buffer for data and headers
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-09 23:40:28 +02:00
Karel Zak e9d659ea85 lscpu: use function to search in cpu masks arrays
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-09 23:27:40 +02:00
Karel Zak 8005924a89 lscpu: cleanup output modes
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-09 07:25:21 +02:00
Heiko Carstens 44de912cdf lscpu: add --version option
Add a --version option like most other tools have it.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-09 06:34:43 +02:00
Heiko Carstens dcdead4271 lscpu: allow read_cache() to be called for offline cpus
First check path before accessing files to be sure they actually exist. This is
necessary when also informations for offline CPUs will be printed.  Since we do
not necessarily know if "cpu is offline" means the same as "path does not
exist" just check for it.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-09 06:30:06 +02:00
Heiko Carstens f6512068b2 lscpu: simplify cache column output function
Simplify the logic to "always print a ',' for each cache except if it is the
last one.  This is also a preparation patch for printing the cache column for
offline CPUs where it would print one colon too much because of the current
logic.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-09 06:24:26 +02:00
Heiko Carstens 08cd09415a lscpu: fix cache output for extended parsable output
The extended parsable output prints a colon instead of comma between each
item. The case where a CPU doesn't belong to any cache was not converted.
Just fix this.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-09 06:24:14 +02:00
Heiko Carstens c403ae6a1a lscpu: remove comma operator
Fix typo where the comma operator has been introduced.
Use a semicolon instead so we end up with simple assignment expressions.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2011-09-09 06:24:12 +02:00
Karel Zak bb6f91636c mount: fix compiler warning [-Wunused-parameter]
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-08 19:54:22 +02:00
Karel Zak c672220f1c dmesg: add --file option
This new option is mostly for testing (to test raw logs from another
boxes/kernels).

Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-08 19:40:34 +02:00
Karel Zak 4d84fcb4c7 script: libintl.h included in nls.h
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-07 16:29:56 +02:00
Philipp Marek 1e03bc3beb libblkid: DRBD proxy data-log identification.
Signed-off-by: Philipp Marek <philipp.marek@linbit.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-07 08:11:07 +02:00
Philipp Marek 8f2b1e8411 libblkid: new magic for 8.4 style (unclean) activity log.
Signed-off-by: Philipp Marek <philipp.marek@linbit.com>
2011-09-07 07:58:16 +02:00
maximilian attems 8f4bdfaced libuuid: add limits.h include for OPEN_MAX
Needed as definition for usage in close_all_fds().
Noticed on klibc build.

Signed-off-by: maximilian attems <max@stro.at>
2011-09-07 07:45:52 +02:00
Karel Zak 89aed1c950 agetty: double equals sign typo in opentty()
Reported-by: Francesco Cosoleto <cosoleto@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-07 07:37:03 +02:00
Natanael Copa 3c911718df script: fix building with --disable-nls
We should only include the libintl.h when NLS is requested.

This fixes issue when building util-linux with uClibc.

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
2011-09-07 07:30:35 +02:00
Karel Zak b89fdd9c05 write: fix path for freopen()
Reported-by: xinglp <xinglp@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-06 03:18:46 +02:00
Karel Zak 31c9099a81 dmesg: remove extra space only after time stamp
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-09-02 14:42:04 +02:00
Karel Zak 9637c8ac7e build-sys: remove redundant __progname check
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-31 17:10:31 +02:00
Davidlohr Bueso 0e9381133e partx: support loop devices
Add support for loop devices to add partitions. For now we make use of the
max_part parameter from the loop kernel module, otherwise the feature is
disabled.

Below an example output:

root@offbook:~/projects/util-linux/partx# ./partx -a -n 1:5 images-pt/dos+bsd.img
root@offbook:~/projects/util-linux/partx# ls /dev/loop0* -ltr
brw-rw---- 1 root disk 7, 0 2011-08-15 00:07 /dev/loop0
brw-rw---- 1 root disk 7, 5 2011-08-15 00:07 /dev/loop0p5
brw-rw---- 1 root disk 7, 2 2011-08-15 00:07 /dev/loop0p2
brw-rw---- 1 root disk 7, 1 2011-08-15 00:07 /dev/loop0p1

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-31 16:51:48 +02:00
Karel Zak 22f6982577 dmesg: fix for non-CONFIG_PRINTK_TIME kernels
* dmesg(1) incorrectly assumes that lines like "<6>\n"
   are broken.

 * it's more robust to assume the end of the record is "\n<"

 * print \n for empty lines

Reported-by: "Gabor Z. Papp" <gzp@papp.hu>
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-31 12:36:02 +02:00
Karel Zak cc69f339c1 whereis: fix gcc warnings [-Wsign-compare]
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-31 11:58:01 +02:00
Karel Zak b82c15bd19 Merge branch 'chcpu' of git://git.kernel.org/pub/scm/linux/kernel/git/heiko/util-linux
* 'chcpu' of git://git.kernel.org/pub/scm/linux/kernel/git/heiko/util-linux:
  chcpu: new tool
  cpuset: add option to allow cpulist_parse() to fail
2011-08-31 11:49:27 +02:00
Karel Zak da9629917d docs: use .LGPL extension for file with GNU Lesser License
Signed-off-by: Karel Zak <kzak@redhat.com>
2011-08-31 11:12:17 +02:00