Linux cannot umount a device whose mount point is hidden by subsequent
mount(s). i.e. We must umount the devices associated to a mount point
in the reverse order of when they were mounted. If umount was called
violating this rule, report error and exit.
Signed-off-by: Guan Xin <guanx.bac@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
The libblkid is always linked with libuuild, so this indirect
dependence in BLKID_LIBS is not a problem. This change helps to people
who compile util-linux-ng with non-standard prefix, ..etc.
Signed-off-by: Karel Zak <kzak@redhat.com>
klibc porting fix, use proper include, nuke redefinition.
solaris.c:8: error: redefinition of typedef ‘daddr_t’
/usr/lib/klibc/include/sys/types.h:29: error: previous declaration of ‘daddr_t’ was here
Signed-off-by: maximilian attems <max@stro.at>
Small patch to create an application that can easily create ad-hoc ipc
resources, along with man page.
[kzak@redhat.com: - rename from ipccreat to ipcmk
- minor coding style changes]
Signed-off-by: Hayden James <hayden.james@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
* cleanup usage() output
* check strtol(); don't ignore wrong command line options
The original ionice design was a little broken, because it was
possible to specify a PID and also a COMMAND:
ionice -c2 -p 123 /bin/foo
but the command /bin/foo was executed without requested scheduling
class. That's stupid behaviour.
Now you have to use "-p PID" **or** COMMAND, but not both. Nothing is
ignored and all options are checked.
Signed-off-by: Karel Zak <kzak@redhat.com>
Makes ionice -p usable like renice, this time backwards compatible
[kzak@redhat.com: - fix coding style
- add ioprio_setpid()]
Signed-off-by: Stephan Maka <stephan@spaceboyz.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
The latest kernel supports partitioned loop devices (kernel commit
476a4813cfddf7cf159956cc0e2d3c830c1507e3). Unfortunately, this change
makes minor numbers useless, because mirror number does not match with
loop device name (loop<N>).
We have to follow loop device names only.
Signed-off-by: Karel Zak <kzak@redhat.com>
Exmaples (-old, +new):
- Disk /dev/mapper/bar: 266.6 GB, 266666666496 bytes
+ Disk /dev/mapper/bar: 266.7 GB, 266666666496 bytes
- WARNING: The size of this disk is 2.1 TB (2199023255552 bytes).
+ WARNING: The size of this disk is 2.2 TB (2199023255552 bytes).
Reported-by: Stepan Kasal <skasal@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
[kzak@redhat.com:
- note that "ipcs -m -t" did not work correctly on
terminal with 80 columns
- the change of output alignment should be mentioned
in the Release Notes]
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
It makes no sense to allow translators to adjust the spacing when
they cannot adjust the spacing of the actual data too. Adjusting
such spacing is not really a translator's task.
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
The "swapon -a" command (without "-e" option) has to complain always
when LABEL or UUID does not exist.
Test:
# grep foo /etc/fstab
LABEL=foo swap swap defaults 0 0
Old version:
# swapon -a; echo $?
0
Fixed version:
# swapon -a; echo $?
swapon: cannot find the device for LABEL=foo
255
# swapon -a -e; echo $?
0
This version also fix two memory leaks.
Signed-off-by: Karel Zak <kzak@redhat.com>
This patch added regression tests for lscpu. It tests lscpu for 3
architecutres, i386, x86_64 and ia64, with data from 3 different
machines each.
Signed-off-by: Cai Qian <qcai@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
This patch added a --sysroot command-line option for testing purpose. It
also sorted cache names, and displayed cache information in a sorted
manner instead of randomly before. In addition, it had some other minor
fixes.
Signed-off-by: Cai Qian <qcai@redhat.com>
Reproduction steps:
1. Run "script -t 2>timing".
2. When the prompt comes up, hit return.
3. New prompt. Wait several seconds, then type "true" and hit return.
4. Repeat (3) as desired, then exit scripted shell.
5. Run "scriptreplay timing".
You'll find on the replay that, rather than waiting several seconds
between the prompt and true, the wait will actually occur after the
first "t" of true.
Reported-by: Micah Cowan <micah@cowan.name>
Signed-off-by: Karel Zak <kzak@redhat.com>
- Avoid delaying 1.5 seconds when 0.5 will do.
- Guard for forward time resets as well.
[kzak@redhat.com: - fix the "Delaying.." debug message
- add comments]
Signed-off-by: Kalev Soikonen <ksop@hot.ee>
Signed-off-by: Karel Zak <kzak@redhat.com>
* It seems that
rtc-isl1208 0-006f: chip found, driver version 0.3
rtc-isl1208 0-006f: rtc core: registered rtc-isl1208 as rtc0
rtc-isl1208 0-006f: rtc power failure detected, please set clock.
causes that hardware clock returns persistent time and synchronization
is impossible. The hwclock(8) has to ignore this problem and allows to
set clock anyway.
* synchronize_to_clock_tick() shouldn't to print the "...got clock tick"
debug message in case of failure.
Signed-off-by: Karel Zak <kzak@redhat.com>
I was puzzled why "hwclock" wrongly reported my x86_64 sytem didn't
support RTC update interrupts. Bogus #ifdef, that's why ... added
by the 2.11y patch (from 2.11t). Probably this whole #ifdef should
just vanish ... if the kernel rejects UIE_ON, the program ought to
just cope with it.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
ncurses library can be build with terminal related functions
landing in separate libtinfo library. Check for ncurses function
when testing ncurses library existence.
Signed-off-by: Arkadiusz Miśkiewicz <arekm@maven.pl>
- Bogus if test means one message is never produced.
- Avoid needless passing of a global variable (debug).
The --test option flag ought to be a global as well (and perhaps -n/--dry-run).
Signed-off-by: Kalev Soikonen <ksop@hot.ee>
rtcwake: Prefer RTC_WKALM_SET over RTC_ALM_SET, fixing bug with not
waking up with new RTCs. Also, return error if unable to set the alarm.
Signed-off-by: Gabriel Burt <gburt@novell.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
script currently flushed the input buffer when starting up. This undocumented
behaviour prevents typeahead when starting up (e.g. as part of .profile).
Rather retain queued input. Don't discard queued output either.
Signed-off-by: Andrew McGill <andrew@lunch.za.net>
This patch replaces scandir-based implementation with readdir(). The
readdir(3) is less expensive and more portable (to non-glibc environment).
The patch also replaces sysfs-based solution with simpler /proc/partitions
parsing. The /proc/partitions includes all used loop devices on all systems
(include 2.4). This solution seems faster than scandir(/sys/block/) too.
Summary, the losetup (with this patch) uses three methods to found a
loop device:
a) parse /proc/partitions to found already used loop devices (for
loserup -a)
b) stat(2) for all loop[0-7] devices (default number of loop devices).
This is classic method from util-linux <= 2.13. This method is good
enough for standard Linux machines with default number of loop
devices.
c) scan all /dev or /dev/loop/ for loop devices. This is useful for
crazy people who need more than 8 loop devices.
Signed-off-by: Karel Zak <kzak@redhat.com>
getpagesize() is said to be more portable than sysconf(_SC_PAGESIZE)
to anything Linux.
this patch helps klibc porting effort as the sysconf
multiplex API is not supported there.
also remove comment of the switch to sysconf in mkswap.c.
Signed-off-by: maximilian attems <max@stro.at>
Due to a change in kernel behaviour when opening CDROM devices,
we need to retry the open/mount call when ENOMEDIUM is returned.
Explanation from Tejun Heo:
Okay, the difference is from the addition of cdrom_get_media_event()
call to both sr_drive_status() and ide_cdrom_drive_status().
Previously, the cdrom driver can't differentiate between tray closed
w/ no media and tray open and always returned tray open, which
triggers close and retry in the open logic which probably have delayed
things enough to get the media recognized.
Now the cdrom driver can discern between tray closed w/o media and
device not ready for other reasons and returns -ENOMEDIUM on the
former. This is all good and dandy but the problem seems that some
drives report no media right after the tray is closed but it hasn't
properly detected the media yet.
It seems the only way to work around the problem is via sensible
retries (e.g. try three times 5 secs apart) and I don't think we can
add that type of retry logic into cdrom open path. Please note that
the previous logic wasn't water proof. Some drives can take longer to
recognize the media is there and could have failed the in-kernel retry
too. Also, reading the media can take quite some time and during that
period the drive reports media present but device not ready. The
driver will retry the command (e.g. READ TOC for open) five times but
all of them can fail w/ EMEDIUMTYPE.
[kzak@redhat.com: - add CRDOM_NOMEDIUM_RETRIES to blkdev.h
- add verbose message to mount.c]
Signed-off-by: Matthias Koenig <mkoenig@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
Reserving uppercase letters for mount operations:
--move | -M
--bind | -B
--rbind | -R
Add lowercase for the most needed mount operation that happen
in initramfs: mount -M /sys /root/sys
Note, we still have shared-subtree operations (--make-{slave,private,...})
without short options.
[kzak@redhat.com: minor change in mount.8]
Signed-off-by: maximilian attems <max@stro.at>
Signed-off-by: Karel Zak <kzak@redhat.com>