1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-06 16:59:03 +03:00
Commit Graph

1770 Commits

Author SHA1 Message Date
Ronny Chevalier
cd977dca10 util: cunescape - fix memleak in error path 2015-04-09 18:47:52 +02:00
Lennart Poettering
019c7fba75 util: add shell_maybe_quote() call for preparing a string for shell cmdline inclusion
If necessary the passed string is enclosed in "", and all special
characters escapes.

This also ports over usage in bus-util.c and job.c to use this, instead
of a incorrect local implementation that forgets to properly escape.
2015-04-09 18:32:21 +02:00
Lennart Poettering
1ed8f8c16d util: merge change_attr_fd() and chattr_fd() 2015-04-08 20:47:35 +02:00
Lennart Poettering
4a280a7e78 util: add minimal OrderedSet type
OrderedSet implements a Set-like structure, but maintains insertion
ordered. It is hence to Set what OrderedHashmap is for Hashmap.

Internally, this is only a wrapper around OrderedHashmap for now, but
this could one day be improved and be added to hashmap.c natively.
2015-04-08 17:22:15 +02:00
Alexander Sverdlin
b06ac35c79 missing.h: Define IFA_F_NOPREFIXROUTE
Fixes second systemd compilation problem against Linux 3.12 uapi
headers.

IFA_F_NOPREFIXROUTE is a usual #define appeared in Linux 3.14, so
AC_CHECK_DECLS is not necessary.
2015-04-08 12:59:40 +02:00
Ronny Chevalier
39505e3c3b remove duplicated includes 2015-04-08 02:42:50 +02:00
Lennart Poettering
34f7b9f98f missing.h: define IFA_FLAGS if it is missing 2015-04-07 21:09:18 +02:00
Jan Janssen
5bdf22430e logind,systemctl: add reboot to EFI firmware support 2015-04-07 18:51:45 +02:00
Lennart Poettering
da00518b3f path-util: fix more path_is_mount e792e890f fallout 2015-04-07 16:03:45 +02:00
Lennart Poettering
527b7a421f util: rework cunescape(), improve error handling
Change cunescape() to return a normal error code, so that we can
distuingish OOM errors from parse errors.

This also adds a flags parameter to control whether "relaxed" or normal
parsing shall be done. If set no parse failures are generated, and the
only reason why cunescape() can fail is OOM.
2015-04-07 15:42:25 +02:00
Hans de Goede
bd1acc9f2f udev: input_id: tag accelerometers as ID_INPUT_ACCELEROMETER
input_id already (tries to) tag accelerometers as such, but this only works
for absolute accelerometers. Recent kernels mark accelerometers through an
input prop. Trust that prop and always tag devices with it with
ID_INPUT_ACCELEROMETER.

Note that detection by the prop bit works the same as the existing detection
and will ensure that no other tags get set on the device.
2015-04-07 11:32:36 +10:00
Peter Hutterer
606df97b6a udev: input_id: tag pointing sticks as ID_INPUT_POINTINGSTICK
Also referred to as trackpoint, trackstick. These are marked by recent kernels
through an input prop. Forward that prop as udev property so userspace can
easily determine whether there is a pointing stick present.

These devices were previously marked as ID_INPUT_MOUSE, for backwards
compatibility we keep that in place, the new property is an addition.
2015-04-07 11:07:32 +10:00
Lennart Poettering
f70a17f8d4 btrfs: add support for recursive btrfs snapshotting 2015-04-06 15:26:59 +02:00
Lennart Poettering
cbf21ecc02 btrfs: missing endian conversion fix 2015-04-06 14:55:45 +02:00
Lennart Poettering
e9bc1871b9 btrfs: make btrfs_subvol_snapshot() parameters a flags field 2015-04-06 14:54:58 +02:00
Lennart Poettering
d9e2daaf3d btrfs: support recursively removing btrfs snapshots 2015-04-06 11:28:16 +02:00
Lennart Poettering
41d1ed059b machined: drop btrfs subvolumes when removing container images 2015-04-06 10:57:53 +02:00
Lennart Poettering
e792e890fe path-util: don't eat up ENOENT in path_is_mount_point()
There's no reason to eat up ENOENT, it should be OK to simply report the
error back.
2015-04-06 10:57:53 +02:00
Lennart Poettering
05d990efd7 path-util: make sure fd_is_mount_point() returns true for root directory 2015-04-06 10:57:53 +02:00
Lennart Poettering
9e9b663aae rm-rf: add support for recursively removing btrfs subvolumes 2015-04-06 10:57:53 +02:00
Lennart Poettering
8f06b239f2 path-util: if parent can do name_to_handle() but relevant dir not, it's a mount point 2015-04-06 10:57:53 +02:00
Lennart Poettering
f25afeb6ab rm-rf: never cross mount points 2015-04-06 10:57:53 +02:00
Lennart Poettering
c687863750 util: rework rm_rf() logic
- Move to its own file rm-rf.c

- Change parameters into a single flags parameter

- Remove "honour sticky" logic, it's unused these days
2015-04-06 10:57:53 +02:00
Tom Gundersen
4a9185c438 shared: set - make argument to set_remove() const 2015-04-01 14:45:22 +02:00
Andrew Jones
ce09c71d56 ARM: detect-virt: detect QEMU/KVM
QEMU/KVM guests do not have hypervisor nodes, but they do have
fw-cfg nodes (since qemu v2.3.0-rc0). fw-cfg nodes are documented,
see kernel doc Documentation/devicetree/bindings/arm/fw-cfg.txt,
and therefore we should be able to rely on it in this detection.

Unfortunately, we currently don't have enough information in the
DT, or elsewhere, to determine if we're using KVM acceleration
with QEMU or not, so we can only report 'qemu' at this time, even
if KVM is in use. This shouldn't really matter in practice though,
because if detect-virt is used interactively it will be clear to
the user whether or not KVM acceleration is present by the overall
speed of the guest. If used by a script, then the script's behavior
should not change whether it's 'qemu' or 'kvm'. QEMU emulated
guests and QEMU/KVM guests of the same type should behave
identically, only the speed at which they run should differ.
2015-03-31 15:36:53 +02:00
Andrew Jones
db6a86897e ARM: detect-virt: detect Xen 2015-03-31 15:36:53 +02:00
Andrew Jones
b8f1df8264 detect-virt: use /proc/device-tree
Kernel doc Documentation/ABI/testing/sysfs-firmware-ofw says that
the /proc/device-tree symlink should be used, as opposed to
directly accessing /sys/firmware/devicetree/base. The former is
ABI, but not the later.
2015-03-31 15:36:53 +02:00
Harald Hoyer
a7f7d1bde4 fix gcc warnings about uninitialized variables
like:

src/shared/install.c: In function ‘unit_file_lookup_state’:
src/shared/install.c:1861:16: warning: ‘r’ may be used uninitialized in
this function [-Wmaybe-uninitialized]
         return r < 0 ? r : state;
                ^
src/shared/install.c:1796:13: note: ‘r’ was declared here
         int r;
             ^
2015-03-27 14:57:38 +01:00
Lennart Poettering
4034a06ddb util: rework word parsing and c unescaping code
When parsing words from input files, optionally automatically unescape
the passed strings, controllable via a new flags parameter.

Make use of this in tmpfiles, and port everything else over, too.

This improves parsing quite a bit, since we no longer have to process the
same string multiple times with different calls, where an earlier call
might corrupt the input for a later call.
2015-03-26 11:56:22 +01:00
Tobias Hunger
093c2cfe3b fstab-generator: don't accept missing root=, but accept root=none
And other non-device entries (like fstab does).

Mount whatever the user asked to be mounted on / on the kernel
command line. Do less sanity check and do *not* bail out
when the mount device looks strange or does not exist.

This basically makes the changes for deviceless filesystems
from yesterday unnecessary and is in line with what we do for
filesystems set up in fstab.

Remove some code that is now dead (reverting fb02a2775a and
b0438462).

[tomegun:
  - change patch title/description a bit.
  - don't touch the /usr logic, that would be a separate change and
    we don't currently have a convincing use-case for that.
  - don't bail out on /sys ro. This only makes sense in containers,
    where we would not be doing this anyway. If there is a use-case
    we could consider that as a separate patch.]
2015-03-25 00:00:46 +01:00
Kay Sievers
16c6ea2934 timedate: remove daylight saving time handling and tzfile parser
We planned to support (the conceptually broken) daylight saving
time/local time features in the kernel, SCSI, networking, FAT
filesystem, but it turned out to be a race we cannot win and do
not want to get involved. Systemd should not fiddle with daylight
saving time or parse timezone information itself.

Leave everything to glibc or tools like date(1) and do not make any
promises or raise expectations that systemd should handle anything
like this.
2015-03-24 15:03:36 +01:00
Tobias Hunger
fb02a2775a fstab-generator: Do not check deviceless filesystems
There is no need to check those.
2015-03-24 00:12:03 -04:00
Tobias Hunger
b043846208 fstab-generator: Support root on tmpfs (or other deviceless FS)
This allows for stateless systems.
2015-03-24 00:12:03 -04:00
Michael Olbrich
8e8ba79229 missing.h: add more btrfs types and defines 2015-03-21 15:37:22 -04:00
Zbigniew Jędrzejewski-Szmek
2e6534a9a5 shared/mkdir: do not set errno in addition to return value
All callers look at the return value anyway.
2015-03-21 11:51:42 -04:00
Goffredo Baroncelli
5b9fbd354e Add change_attr_fd()
Add change_attr_fd() function to modify the file/directory attribute.
2015-03-19 22:20:12 -04:00
David Herrmann
33c2ce7b20 strv: return NULL from strv_free()
We always return NULL/invalid-object from destructors, fix strv_free() to
do the same.
2015-03-19 14:12:00 +01:00
Michal Schmidt
2230852bd9 shared: add path_compare(), an ordering path comparison
... and make path_equal() a simple wrapper around it.
2015-03-16 22:01:41 +01:00
Tom Gundersen
a88c8750b3 shared - reinstate plymouth_running()
This will be used by fsckd. This reverts part of
031886edfc.
2015-03-16 18:30:20 +01:00
Jasper St. Pierre
031886edfc core: Remove explicit Plymouth integration
Even if plymouth is running, it might have not displayed the splash yet,
so we'll see a few lines on fbcon when we should have otherwise had
nothing.

Plymouth integration was added to systemd in commit
6faa11140b. That same day, Plymouth got
systemd integration [0]. As such, the Plymouth integration has always
been obsolete, and was probably only for older Plymouth's. But I can't
imagine anybody running a Plymouth from 2011 with a systemd from 2015.

Remove the Plymouth/systemd integration, and let Plymouth's code tell
systemd to print the details.

[0] http://cgit.freedesktop.org/plymouth/commit/?id=537c16422cd49f1beeaab1ad39846a00018faec1

Signed-off-by: Jasper St. Pierre <jstpierre@mecheye.net>
Cc: Daniel Drake <dsd@endlessm.com>
Cc: Ray Strode <rstrode@redhat.com>
2015-03-16 17:47:27 +01:00
Zbigniew Jędrzejewski-Szmek
0daa5666da util: check asprintf return value
CID #1237546.
2015-03-15 17:26:58 -04:00
Zbigniew Jędrzejewski-Szmek
a8ffe6fbcb sysv-generator: initialize LookupPaths just once
With debugging on, sysv-generator would print the full set of
lookup paths for *every* sysv script.

While at it, pass LookupPaths as a pointer in sysv-generator,
and constify it everywhere.
2015-03-14 23:03:21 -04:00
Zbigniew Jędrzejewski-Szmek
7034e9db51 util: remove redundant debug message
mar 14 20:05:34 fedora22 systemd[4058]: /usr/lib/systemd/system-generators/kdump-dep-generator.sh will be executed.
mar 14 20:05:34 fedora22 systemd[4058]: Spawned /usr/lib/systemd/system-generators/kdump-dep-generator.sh as 4059.

The second line already says everything.
2015-03-14 23:03:21 -04:00
Will Woods
f5ce2b4958 selinux: fix SEGV during switch-root if SELinux policy loaded
If you've got SELinux policy loaded, label_hnd is your labeling handle.
When systemd is shutting down, we free that handle via mac_selinux_finish().

But: switch_root() calls mkdir_p_label(), which tries to look up a label
using that freed handle, and so we get a bunch of garbage and eventually
SEGV in libselinux.

(This doesn't happen in the switch-root from initramfs to real root because
there's no SELinux policy loaded in initramfs, so label_hnd is NULL and we
never attempt any lookups.)

So: make sure that mac_selinux_finish() actually sets label_hnd to NULL, so
nobody tries to use it after it becomes invalid.

https://bugzilla.redhat.com/show_bug.cgi?id=1185604
2015-03-13 23:42:18 -04:00
Zbigniew Jędrzejewski-Szmek
dc75168823 Use space after a silencing (void)
We were using a space more often than not, and this way is
codified in CODING_STYLE.
2015-03-13 23:42:17 -04:00
Zbigniew Jędrzejewski-Szmek
012d7b4217 Check that EWOULDBLOCK is the same as EAGAIN
It certainly is everywhere on Linux, but as a courtesy
to people doing some strange cross-compilation, check
that the assumption holds.
2015-03-13 23:42:17 -04:00
David Herrmann
15411c0cb1 tree-wide: there is no ENOTSUP on linux
Replace ENOTSUP by EOPNOTSUPP as this is what linux actually uses.
2015-03-13 14:10:39 +01:00
Zbigniew Jędrzejewski-Szmek
fc25ad25e0 socket-util: refactor error handling in sockaddr_pretty 2015-03-11 10:08:12 -04:00
Kay Sievers
88a60da054 sysctl: move property handling to shared/ 2015-03-11 10:37:45 +01:00
Alban Crequy
f85ef957e6 util: add rename_noreplace
renameat2() exists since Linux 3.15 but btrfs support for the flag
RENAME_NOREPLACE was added later.

This patch implements a fallback when renameat2() returns EINVAL.
EINVAL is the error returned when the filesystem does not support one of
the flags.
2015-03-10 18:23:46 +01:00