[kzak@redhat.com: - remove unnecessary program name from err(),
- use program_invocation_short_name]
Signed-off-by: Marek Polacek <mmpolacek@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
The example in the man page does not prevent concurrent execution, as it
obtains a shared lock. More useful is taking an exclusive lock, i.e.
remove "-s".
Additionally, IMO most people want the script to exit when the lock
cannot be acquired, so adding "-n".
If linux/falloc.h does not exist, the build system still enables the
fallocate util, but ultimately fails when it tries to include the
header and use a define from it.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
# echo 0 >/sys/devices/system/cpu/cpu3/online
# echo 0 >/sys/devices/system/cpu/cpu2/online
# grep processor /proc/cpuinfo
processor : 0
processor : 1
# lscpu
lscpu: error: cannot open
/sys/devices/system/cpu/cpu2/cache/index0/shared_cpu_map: No such file or directory
This patch also add a new "On-line CPU(s):" line to the lscpu(1)
output.
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=623012
Signed-off-by: Karel Zak <kzak@redhat.com>
Avoid rebuilding the man aliases over and over given that they do not
copy the content but only alias it.
Signed-off-by: Diego Elio 'Flameeyes' Pettenò <flameeyes@gmail.com>
This is backward-compatible with automake 1.10 as the AM_V_GEN macro
is going to be null anyway.
Signed-off-by: Diego Elio 'Flameeyes' Pettenò <flameeyes@gmail.com>
According to a search on the internet, the 200 file number is not a
posix shell feature, since posix shells are only mandated to have 1
through 9. I haven't verified that this claim is right, but, at least
dash doesn't like the 200. So here is a patch for the flock man page
that replaces 200 with 9.
Signed-off-by: Patrice Dumas <pertusus@free.fr>
Signed-off-by: Karel Zak <kzak@redhat.com>
LC_CTYPE is necessary to print correctly some non English characters,
set LC_ALL for the sake of brevity.
Example:
$ LANG=fr_FR lscpu -p | head -n 1
\# La suite est en format analysable, transmissible ? d'autres
instead of:
\# La suite est en format analysable, transmissible à d'autres
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
Shared memory status output format need changes but there are backward
compatibility problems. This is a invite to apply in translations the
same style used for the rest of the summaries as well as for the limits
reported by -l option.
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
Help text old version:
ipcs provides information on ipc facilities for which you have read access.
Resource Specification:
-m : shared_mem
-q : messages
-s : semaphores
-a : all (default)
Output Format:
-t : time
-p : pid
-c : creator
-l : limits
-u : summary
-i id [-s -q -m] : details on resource identified by id
usage : ipcs -asmq -tclup
ipcs [-s -m -q] -i id
ipcs -h for help.
New version:
Usage: ipcs [resource]... [output-format]
ipcs [resource] -i id
Provide information on IPC facilities for which you have read access.
-h display this help
-i id print details on resource identified by id
Resource options:
-m shared memory segments
-q message queues
-s semaphores
-a all (default)
Output format:
-t time
-p pid
-c creator
-l limits
-u summary
Usage text old version:
usage : ipcs -asmq -tclup
ipcs [-s -m -q] -i id
ipcs -h for help.
New version:
Usage: ipcs [-asmq] [-t|-c|-l|-u|-p]
ipcs [-s|-m|-q] -i id
ipcs -h for help
[kzak@redhat.com: - use program_invocation_short_name
- minor cleanups]
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
This changes output of -u, -l, and -c.
Example of non consistent output:
$ ipcs -u | grep ^---
------ Shared Memory Status --------
------ Semaphore Status --------
------ Messages: Status --------
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
[kzak@redhat.com: - cleanup
- add long options
- add note about DM to the man page
- use err.h and nls.h]
Signed-off-by: Hajime Taira <htaira@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
This patch drops potential euid privileges before executing the target
program. This allows to setuid unshare.
The unshare(1) is still distributed as non-setuid program.
Based on patch from Martin Pohlack <mp26@os.inf.tu-dresden.de>.
Signed-off-by: Karel Zak <kzak@redhat.com>
Fixes commit c9239f23ac. The author
didn't care for matching constraints when resorting the register
constraints. The eax register (with the cpuid opcode) is now in
operand 1, not zero anymore.
Signed-off-by: Henne Vogelsang <hvogel@opensuse.org>
Add a command line option '-i' / '--iflag' for setting or clearing
input flags on the serial device before attaching the line discipline.
[kzak@redhat.com: - use generic functions for work with iflags table
- add list of iflags to usage/help output
- move iflags parsing to separate function]
Impact: added functionality
Signed-off-by: Tilman Schmidt <tilman@imap.cc>
Signed-off-by: Karel Zak <kzak@redhat.com>
This patch add "CPU op-mode(s):" field that prints all supported CPU
operation modes. The field is based on CPU flags:
rm (real mode) 16-bit
tm (transparent mode) 32-bit
lm (long mode) 64-bit
Example:
$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
CPU(s): 2
Thread(s) per core: 1
Core(s) per socket: 2
CPU socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 15
Stepping: 11
CPU MHz: 1600.000
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 4096K
Signed-off-by: Karel Zak <kzak@redhat.com>
If flock is executed from a process which has set SIGCHLD to SIG_IGN, then
flock will eat cpu and hang indefinitely if given a command to execute.
So before we fork(), make sure to set SIGCHLD handling back to the default
so that the later waitpid() doesn't freak out on us.
[kzak@redhat.com: - add a check for waitpid() return value]
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
This reverts commit a692a87459.
On Wed, Nov 18, 2009 at 03:33:12PM +0000, Daniel Drake wrote:
> Booting into a system this way just leads to problems because
> you cannot remount the root read-only at shutdown (leading to unclean
> shutdowns).
> Miklos Szeredi pointed out a trick to turn any directory into a
> mount point which avoids this problem. Therefore we can simplify
> switch_root again and simply document that its users should set
requested by dracut developers because:
bash: cannot set terminal process group (-1): Inappropriate ioctl for device
Addresses-Red-Hat-Bug: #519237
Signed-off-by: Karel Zak <kzak@redhat.com>
The latter is obsolete and it's currently defined to 6 for historical
reasons (as per comment in <features.h>) instead of 2 as what would be
expected.
Signed-off-by: Guillem Jover <guillem@hadrons.org>
Older versions of glibc used to declare ‘union semun’ in <sys/sem.h>,
but POSIX.1-2001 requires the caller to declare it instead. Later
versions of glibc started defining _SEM_SEMUN_UNDEFINED to note that
the union was not being declared, but conforming systems are not
required to define that macro (e.g. FreeBSD). As a side effect we get
rid of some obsolete __GNU_LIBRARY__ macro usage.
[kzak@redhat.com: - use #ifndef]
Signed-off-by: Guillem Jover <guillem@hadrons.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
New utility allows to run process with separate mount, UTC, IPC or
network namespaces.
[kzak@redhat.com: - some cosmetic changes in usage() and err() usage
- move "if BUILD_UNSHARE" to separate place in Makefile.am
- add unshare to .gitignore]
Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
The fallocate(1) utility is used to preallocate blocks to a file.
This can be useful for virtual images, database files, testing, etc.
Normally we'd hope that various tools will start using preallocation
internally, but until then such a utility may be useful, and could be
scripted as well.
The original Eric's version is available at:
http://thread.gmane.org/gmane.linux.utilities.util-linux-ng/2490
This version:
- checks for fallocate glibc function and kernel syscall
- does not provide a fallback and does not call posix_fallocate()
- adds long options
- uses err.h for errro messages
- adds NLS support
- cleanups man page
Co-Author: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Based on patch from
Piergiorgio Sartor <piergiorgio.sartor@nexgo.de>
at
https://bugzilla.redhat.com/show_bug.cgi?id=449115
Piergiorgio's note about S5:
> According to the ACPI specifications, chapter 4.7.2.4 "Real Time
> Clock Alarm", the wakeup from RTC, when supported, should work from
> *sleep* state S1-S3 and, optionally, from S4.
>
> Note 3 (same chapter) says that S5 is *not* a sleep state and should
> not be supported. Actually it also says that: "The OS will disable
> the RTC_EN bit prior to entering the G2/S5 or G3 states regardless."
>
> Nevertheless, on all PC supporting the RTC wakeup I tested, all were
> able to wake from S5.
Signed-off-by: Karel Zak <kzak@redhat.com>
This function is marked obsolete in POSIX.1-2001 and removed in
POSIX.1-2008.
Conditionally replaced with nanosleep().
Signed-off-by: Daniel Mierswa <impulze@impulze.org>
This reverts commit 98c7944b52.
Unfortunately, the patch has been committed by "git commit -a" and
includes unwanted changes in configure.ac and sys-utils/Makefile.am...
Sorry.
* use "filesystem" everywhere (currently, the mount.8 man page is inconsistent
and uses "file system" and "filesystem")
* fix "The extN" to "The extN filesystem" (reported by Theodore Tso)
Signed-off-by: Karel Zak <kzak@redhat.com>
On Tue, Aug 04, 2009 at 05:52:38PM +0200, Dalibor Straka wrote:
> while I was reading the source, I've noticed missing option in the
> help message for "-r". So I'm sending one-line patch for dmesg.
Reported-by: Dalibor Straka <dast@panelnet.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
The current switch_root can only switch to a new root that is the root
of a mount point.
This patch adds support for "subroots", where the new root is
somewhere below a mount point. It does this by adding in a few extra
steps to chroot into the subroot after the enclosing partition has
been moved and entered.
This will be used by OLPC, who sort-of have 2 copies of Fedora stored
on a single partition under different directory trees, where the
initramfs decides which one to boot into
[kzak@redhat.com:
- port to the current u-l-ng switch_root code
- don't use static buffer for "dir" in get_parent_mount()]
CC: Peter Jones <pjones@redhat.com>
Signed-off-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
Add support for a line discipline name "PPS" selecting the
Pulse Per Second line discipline N_PPS (18). The number has been
reserved since kernel release 2.6.28, and the implementation is
finally going to be submitted for kernel release 2.6.31.
Signed-off-by: Tilman Schmidt <tilman@imap.cc>
This way there's no race between unlinking the /newroot directory and
the MS_MOVE/chroot() to get away from it.
Signed-off-by: Peter Jones <pjones@redhat.com>
Fork before cleaning up the old filesystem, so it becomes asyncronous,
which results in a faster boot time.
Signed-off-by: Peter Jones <pjones@redhat.com>
This makes recursiveRemove() use fdopendir() instead of taking a path,
so we're always sure about which namespace we're starting from.
Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Copied from Dracut project:
git://dracut.git.sourceforge.net/gitroot/dracut
switch_root history in dracut.git repository:
$ git shortlog switch_root.c
Harald Hoyer (5):
replace switch_root shell script with binary
add \n to switch_root
use switch_root code from http://pjones.fedorapeople.org/mkstart/usr/lib/mkstart/switchroot.c
mount move instead of umount and fix the search for fallback inits
setsid() and set controlling terminal for real /sbin/init
Victor Lowther (2):
Simplify switch_root.c a bit
Remove all files on the initramfs before switching root
Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
If we build lscpu as PIE, we currently get a build failure:
lscpu.c: In function 'main':
lscpu.c:333: error: can't find a register in class 'BREG' while reloading 'asm'
lscpu.c:333: error: 'asm' operand has impossible constraints
make[2]: *** [lscpu.o] Error 1
So we need a little bit of register shuffling to keep gcc happy.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
People usually want to use pm-utils to suspend the system instead of
the raw kernel interface, so I added an option to just exit after
configuring the wakeup time.
Actually I think that all the suspend code should be removed from
rtcwake, since it does not really belong there.
Signed-off-by: Marco d'Itri <md@linux.it>
With this patch, you can lock directory. Additionally,
lockfile opens with O_NOCTTY.
Try to open file with O_CREAT flag first, and without it
if open fails with EISDIR. Suggested by H. Peter Anvin.
Signed-off-by: Alexey Gladkov <legion@altlinux.org>
This patch moves pivot_root.{8,c) from mount/ to sys-utils/ directory.
There is not ant relation between pivot_root source code and the rest of
code in the mount.
Signed-off-by: Karel Zak <kzak@redhat.com>
This patch adds two new fields:
* "Hypervisor vendor" -- based on CPUID and hypervisor specific
PCI devices. lscpu(1) supports KVM, XEN, Microsoft HV now.
* "Virtualization type"
- "none" = Xen dom0
- "full" = full virtualization (KVM, Xen, ...)
- "para" = Xen paravirtualization
Co-Author: Ky Srinivasan <ksrinivasan@novell.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
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>
[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>
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>
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>
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>
dmesg.c:42: error: expected declaration specifiers or ‘...’ before ‘klogctl’
dmesg.c:42: error: expected declaration specifiers or ‘...’ before ‘type’
dmesg.c:42: error: expected declaration specifiers or ‘...’ before ‘b’
dmesg.c:42: error: expected declaration specifiers or ‘...’ before ‘len’
without belows compat section dmesg just compiles fine against klibc.
as bonus reorder the includes.
Signed-off-by: maximilian attems <max@stro.at>
There is just ldattach which doesn't compile because line disciplines are not
implemented that way on the Hurd. Is TIOCSETD any kind of standard? Else I
guess the patch below would be fine.
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Writing "suspend" to /sys/power/state does nothing.
Even "man rtcwake" says that default should be "standby" :)
Signed-off-by: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
Signed-off-by: Karel Zak <kzak@redhat.com>
setarch.c:248: error: 'ADDR_NO_RANDOMIZE' undeclared (first use in this function)
setarch.c:248: error: (Each undeclared identifier is reported only once
setarch.c:248: error: for each function it appears in.)
setarch.c:251: error: 'FDPIC_FUNCPTRS' undeclared (first use in this function)
setarch.c:257: error: 'ADDR_COMPAT_LAYOUT' undeclared (first use in this function)
setarch.c:260: error: 'READ_IMPLIES_EXEC' undeclared (first use in this function)
Linux gzp1 2.4.36.1-gzp1 #1 SMP Tue Feb 19 10:23:48 CET 2008 i686 GNU/Linux
Reported-By: Gabor Z. Papp <gzp@papp.hu>
Signed-off-by: Karel Zak <kzak@redhat.com>
The getopt_long(3) use introduced by commit
8df90dec2b
broke backwards compatibility.
Old behavior:
$ i386 uname -m
i686
New behavior:
$ i386 uname -m
i386: invalid option -- m
Linux
Traditional method to fix it is to disable program arguments reordering
by prefixing getopt_long's optstring with '+' character.
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
Timezone handling is broken in this version since it's always
passing UTC time into the kernel, even on systems where the
RTC uses the local timezone.
I think that bug must come from bugs in how the system used to
to originally develop this code handled the RTC timezone. Both
RTCs should have been kept in UTC ... but only one of them was.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* renice was using atoi(), which does no error detection, meaning
that: "renice +20 blah" was accepted as valid.
* add -h | --help
* add -v | --version
* add long options for -p, -u and -g
* cleanup coding style
Addresses-Debian-Bug: #385245
Co-Author: Karel Zak <kzak@redhat.com>
Signed-off-by: LaMont Jones <lamont@debian.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
At least on Debian, .so commands are relative to the man directory
(e.g., /usr/share/man), not to the subdirectory:
% man i386
man: can't open /usr/share/man/setarch.8: No such file or directory
No manual entry for i386
See also http://bugs.debian.org/453245
Addresses-Debian-Bug: #453245
Signed-off-by: Frédéric Bothamy <frederic.bothamy@free.fr>
Signed-off-by: LaMont Jones <lamont@debian.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
Cleanups for rtcwake:
- Minor doc updates: highlight the framebuffer problem,
give correct history of this code
- Improve debug output
- Fix some linelength bugs
Note that this code predated the sysfs "wakealarm" mechanism, and
works around several now-fixed bugs in the kernel RTC framework.
Nowadays it would make sense to make this program use only the sysfs
interface to the RTC, using "since_epoch" instead of RTC_RD_TIME and
"wakealarm" instead of the four other ioctls. That could simplify
the mess involved in timezone handling.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
Here is a patch that disables linux-specific tools on non-linux targets.
Signed-Off-By: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-Off-By: Karel Zak <kzak@redhat.com>
Add a missing period, a missing space, a comma and a word for clarity,
plus a period and an uppercase letter to match surrounding messages.
Further add a missing call to gettext, and undo an unneeded linewrap.
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
NULL is not 0L. It's (void*)0. Passing that as a parameter to a function
that takes an unsigned long results in a warning about the lack of a cast.
Signed-off-by: LaMont Jones <lamont@debian.org>
Debian had a pre-existing linux{32,64} command which supported only
--3gb and --4gb. Adding support for those options allows setarch to
replace that package.
(Note that long options are expected for all setarch flags in the next
release.)
Signed-off-by: LaMont Jones <lamont@mmjgroup.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Fix inconsistency between kernel profiling and readprofile.
The range of kernel profiling is between _stext and _etext,
and readprofile tries to extract profiling for all the symbols in
/boot/System.map-2.6.16.11-7-ppc64 from /proc/profile, but there
are more symbols in /boot/System.map-2.6.16.11-7-ppc64 than those
between _stext and _etext.
Signed-off-by: Matthias Koenig <mkoenig@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
This patch add arch(1) back to util-linux source code tree, but the
command is not installed by defautl.
For more details see "./configure --help".
The arch command is deprecated in favor of "uname -m" (coreutils). The
latest (6.9+) version of coreutils also supports arch(1) as an alias
to "uname -a". Please, if you need arch(1) use the coreutils
implementation.
Signed-off-by: Karel Zak <kzak@redhat.com>
Some architectures have a single underscore prefix in their ABI, so there will
be no "_stext" symbol, just "__stext".
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
The dmesg, ipcrm, ipcs, renice and setsid are user-accessible commands
and belong in man1 more than to man8.
Signed-off-by: Karel Zak <kzak@redhat.com>
Now all code in util-linux uses sysconf(_SC_PAGESIZE) that is standardized and
preferred way of querying page size. The asm/page.h file is not included to the
code anymore. (This patch doesn't change mount's FS detection code which will
be removed later).
Signed-off-by: Karel Zak <kzak@redhat.com>
The ipcs command has reported "max total shared memory" as a number of pages.
The others IPC limits are reported in (k)bytes, so it doesn't make sense mix
pages and bytes in the same output. Now "max total shared memory" is reported in
kbytes.
[Migration note: type="API change", severity="low"]
Signed-off-by: Karel Zak <kzak@redhat.com>
This patch add all missing headers, man pages and README files to automake
stuff and "make dist-gzip" produces useful tarball now.
Signed-off-by: Karel Zak <kzak@redhat.com>
The generated autotools stuff shouldn't be maintained by SCM. After check out
from git use ./autogen.sh. For more details see README.devel.
Signed-off-by: Karel Zak <kzak@redhat.com>