[kzak@redhat.com: - move paths to pathnames.h,
- use static path buffer]
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
This makes it very convenient to use make use of privileged actions
on CONFIG_USER_NS enabled kernels, without having to manually tinker
with uid_map and gid_map to obtain required credentials (as those
given upon unshare() vanish with call to execve() and lot of userspace
checks for euid==0 anyway).
Usage example:
$ unshare --uts
unshare: unshare failed: Operation not permitted
$ unshare --user --uts
[nfsnobody@odvarok ~]$ hostname swag
hostname: you must be root to change the host name
$ unshare -r --uts
[root@odvarok util-linux]# hostname swag
[root@odvarok util-linux]#
[kzak@redhat.com: - move code to map_id()
- use all-io.h
- add paths to pathnames.h]
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Karel Zak <kzak@redhat.com>
This patch allows to use a new \S or \S{VARNAME} sequence in the
/etc/issue file. The sequence prints data from /etc/os-release. The
reason is to keep /etc/issue file distribution and release
independent.
The \S{ANSI_COLOR} is converted to the real terminal escape seq.
For example:
\S
Kernel \r on an \m (\l)
or more complex example:
Welcome to \S{ANSI_COLOR}\S{NAME}0m \S{VERSION}
Report bugs at \S{BUG_REPORT_URL}.
See http://www.freedesktop.org/software/systemd/man/os-release.html
fr more details about /etc/issue.
Based on patch from Bill Nottingham <notting@redhat.com>.
Signed-off-by: Karel Zak <kzak@redhat.com>
Some of the limit values are not dynamic. Like in kernel these values
are #defined.
[kzak@redhat.com: - use better names for functions,
- add ipcutils.{c,h}
- read also shmmax from /proc]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
The necessary proc and sysfs files are tested to be present. When
information files are missing the ipcs will use obsolted system calls,
and data structures, as fallback.
[kzak@redhat.com: - fix #define _PATH_PROC_IPC_MSG "/proc/sys/kernel/sem" typo]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
* eject: (47 commits)
tests: use eject --force
eject: use BUILD_EJECT, move to sys-utils
eject: clean up usage()
eject: clean up man page
eject: add --force option
eject: check for hotplug/removable attribute
eject: remove obsolete code, use EXIT_* macros
tests: add umount-by-eject tests
eject: improve work with partitioned devices
lib/sysfs: improve sysfs_is_partition_dirent()
eject: call umount <mountpoint> rather than <device>
eject: use libmount to detect if cdrom is mounted
eject: make the code robust
eject: use SG_IO ioctl for scsi
eject: support CDIOCEJECT ioctl
eject: new close_tray code from Fedora
eject: new auto_eject code from Fedora
eject: add -X from Fedora
eject: add --manualeject from fedora
eject: clean up devname usage
...
The new logindefs.c file contains /etc/login.defs parser and functions
for searching in the list of the login default variables. The patch
also contains a new regression test for the code.
Based on pam_login-4.0 from Suse.
Signed-off-by: Karel Zak <kzak@redhat.com>
The basic loopdev attributes are available in sysfs since kernel
2.6.37. This patch uses the backing_file attribute from sysfs for very
long filenames (the LOOP_GET_STATUS ioctl uses only 64 bytes for the
filename).
old version:
# losetup -a
/dev/loop0: [0804]:12865322 (/home/images/filesystems/this_is_really_really_long_directory_*)
new version:
# losetup -a
/dev/loop0: [0804]:12865322 (/home/images/filesystems/this_is_really_really_long_directory_name/ext2.img)
Signed-off-by: Karel Zak <kzak@redhat.com>
The libblkid probing is based on devices from /proc/partitions by
default. This file usually does not contain removable devices (e.g.
CDROMs) and this kind of devices are invisible for libblkid.
The blkid_probe_all_removable() function adds removable block devices
to blkid cache. The probing is based on information from the /sys
directory. The devices which were detected by this function won't be
written to blkid.tab cache file.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=533874
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 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>
The original newgrp command doesn't expect group pasword in /etc/gshadow
although almost all distributions use this file (and the gpasswd command).
The newgrp from util-linux is deprecated and better is use shadow-utils only.
Unfortunately, shadow-utils are broken too (see RH version where is bugfix).
In this case it's better fix util-linux version at least...
Signed-off-by: Karel Zak <kzak@redhat.com>