Commit graph

1718 commits

Author SHA1 Message Date
Shawn Landden 3b1c524154 add REMOTE_ADDR and REMOTE_PORT for Accept=yes 2015-03-10 09:00:27 -04:00
Thomas Hindoe Paaboel Andersen 0c900704e7 Add type specifier for int 2015-03-10 05:37:01 +01:00
Thomas Hindoe Paaboel Andersen 6c767d1e1a logs-show: fix check of loop_read_exact
just a typo fix
2015-03-10 05:37:01 +01:00
Zbigniew Jędrzejewski-Szmek a6dcc7e592 Introduce loop_read_exact helper
Usually when using loop_read(), we want to read the full buffer.
Add a helper that mirrors loop_write(), and returns 0 when full buffer
was read, and an error otherwise.

Use -ENODATA for the short read, to distinguish it from a read error.
2015-03-09 22:10:54 -04:00
Zbigniew Jędrzejewski-Szmek ad7bcf526d efivars: itialize variable
Introduced a few commits ago.
2015-03-09 22:10:54 -04:00
Zbigniew Jędrzejewski-Szmek 6410074b4f Add missing includes
audit.h uses uint32_t and bool.
log.h uses abs.
2015-03-09 22:10:54 -04:00
Zbigniew Jędrzejewski-Szmek 7432b24b83 efivars: use greedy_realloc 2015-03-09 16:45:28 -04:00
Zbigniew Jędrzejewski-Szmek 0797f2329c efivars: use more _cleanup_
Also rename r to buf, since r is customarily reserved for the return value.
2015-03-09 16:45:27 -04:00
Zbigniew Jędrzejewski-Szmek 0aa3b7830f efivars: do binary and before converting to bool
I'm pretty sure that this is what was meant here.
2015-03-09 16:45:27 -04:00
Zbigniew Jędrzejewski-Szmek a8436474fa efivars: rename last remaining err to r 2015-03-09 16:45:27 -04:00
Zbigniew Jędrzejewski-Szmek b7749eb517 efivars: modernization
Fix return value if unlink fails.
2015-03-09 16:45:27 -04:00
Lennart Poettering 587fec427c importd: add API for exporting container/VM images
Also, expose it in machinectl.
2015-03-09 18:02:23 +01:00
Lennart Poettering 885fdebc13 tree-wide: use _packed_ macro instead of raw gcc __attribute__ 2015-03-09 18:02:22 +01:00
Michael Olbrich cf1755bac0 missing.h: add NDA_*
This is necessary to build with older kernel headers. NDA_VLAN was
introduced in v3.9 and NDA_PORT, NDA_VNI and NDA_IFINDEX in v3.10
2015-03-09 14:06:20 +01:00
Zbigniew Jędrzejewski-Szmek 132764a223 shared/machine-pool: remove unnecessary check
CID #128739.
2015-03-07 13:40:48 -05:00
John Paul Adrian Glaubitz 3a867c6a23 Use correct uname identifiers in arch_map for SuperH architecture
https://bugs.freedesktop.org/show_bug.cgi?id=89421
2015-03-04 19:32:11 -05:00
Lennart Poettering b6e676ce41 importd: add new bus calls for importing local tar and raw images
This also adds "machinectl import-raw" and "machinectl import-tar" to
wrap these new bus calls.

THe commands basically do for local files that "machinectl pull-raw" and
friends do for remote files.
2015-03-05 00:59:38 +01:00
Zbigniew Jędrzejewski-Szmek 6d89003462 shared/util: assume ac when /sys/class/power_supply is missing
On s390 (at least) /sys/class/power_supply is not present. We should
treat this like if this directory was empty, and not an error.
2015-03-03 19:12:27 -05:00
Lennart Poettering 26166c88e0 importd: automatically grow /var/lib/machines/ loopback filesystem during downloads
If /var/lib/machines is mounted as btrfs loopback file system in
/var/lib/machines.raw with this change we automatically grow the file
system as it fills up. After each 10M we write to it during imports, we
check the free disk space, and if the fill level grows beyond 66% we
increase the size of the file system to 3x the fill level (thus lowering
it to 33%).
2015-03-03 00:13:12 +01:00
Lennart Poettering 4cee5eede2 machined: also set up /var/lib/machines as btrfs, if "machinectl set-limit" is called 2015-03-02 19:36:21 +01:00
Lennart Poettering 403e5b3230 importd: take a lock while we set up /var/lib/machines/
This way, we can safely set up the directories from two processes at the
same time, including machined and importd simultaneously.
2015-03-02 12:15:25 +01:00
Lennart Poettering 432cea0087 importd: split out setup logic for /var/lib/machines into its own API file 2015-03-02 12:15:25 +01:00
Cristian Rodríguez ba89821c10 shared: AFS is also a network filesystem 2015-03-01 12:40:41 +01:00
Daniel Mack 8a9c6071cb shared/condition: fix gcc5 warning
Fixes the warning below.

src/shared/condition.c: In function ‘condition_new’:
src/shared/condition.c:47:27: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
         assert(!parameter == (type == CONDITION_NULL));
                           ^
src/shared/macro.h:42:44: note: in definition of macro ‘_unlikely_’
 #define _unlikely_(x) (__builtin_expect(!!(x),0))
                                            ^
src/shared/macro.h:226:22: note: in expansion of macro ‘assert_se’
 #define assert(expr) assert_se(expr)
                      ^
src/shared/condition.c:47:9: note: in expansion of macro ‘assert’
         assert(!parameter == (type == CONDITION_NULL));
         ^
2015-02-27 20:12:16 +01:00
Lennart Poettering efe0286285 machined: if /var/lib/machines is backed by a loop file, resize it on "machinectl set-limit"
When the pool size limit is altered with "machinectl set-limit", then
not only set the subvolume quota of the /var/lib/machine subvolume, but
also resize the backing loop file and the btrfs file system on it
dynamically.
2015-02-26 00:43:16 +01:00
Lennart Poettering d6ce17c7f0 machined,machinectl: add calls for changing container/VM quotas 2015-02-25 22:06:54 +01:00
Aaro Koskinen 3bec6d4690 systemd: add getrandom syscall numbers for MIPS
Add getrandom syscall numbers for MIPS. Based on Linux 3.17 kernel
(commit 42944521af97a3b25516f15f3149aec3779656dc, "MIPS: Wire up new
syscalls getrandom and memfd_create").
2015-02-24 23:51:58 -05:00
Thomas Hindoe Paaboel Andersen 76dcbc4992 acl-util: avoid freeing uninitialized pointer
CID#1271344/1271345
2015-02-24 20:42:40 +01:00
Lennart Poettering 754061ce71 importd: enable btrfs quota in /var/lib/machines, if necessary 2015-02-24 18:46:49 +01:00
Cristian Rodríguez 3f7f1fad76 shared: fix wrong assertion in barrier_set_role()
assert(b->pipe[0] >= 0 && b->pipe[0] >= 0);

Test the same condition twice, pretty sure we mean

 assert(b->pipe[0] >= 0 && b->pipe[1] >= 0);
2015-02-24 18:30:59 +01:00
Daniel Mack f9bf3e260c shared/unit-name: fix gcc5 warning
Fix the following gcc5 warning:

  CC       src/shared/libsystemd_shared_la-unit-name.lo
src/shared/unit-name.c: In function 'unit_name_is_valid':
src/shared/unit-name.c:102:34: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
                 if (!template_ok == TEMPLATE_VALID && at+1 == e)
                                  ^
2015-02-24 16:26:30 +01:00
Daniel Mack 8e8933ca0f shared/time-util: fix gcc5 warning
CC       src/shared/libsystemd_shared_la-time-util.lo
src/shared/time-util.c: In function 'parse_nsec':
src/shared/time-util.c:789:25: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
                 if (!*s != 0)
                         ^
2015-02-24 13:26:47 +01:00
Zbigniew Jędrzejewski-Szmek 1c73f3bc29 tmpfiles: avoid creating duplicate acl entries
https://bugs.freedesktop.org/show_bug.cgi?id=89202
https://bugs.debian.org/778656

Status quo ante can be restored with:
  getfacl -p /var/log/journal/`cat /etc/machine-id`|grep -v '^#'|sort -u|sudo setfacl --set-file=- /var/log/journal/`cat /etc/machine-id`
2015-02-23 23:34:06 -05:00
Daniel Mack 2c35d880de sd-bus, shared: fix includes
Include <sys/socket.h> from util.h and bus-message.h in order to
build errors like the ones below on kdbus enabled systems.

./src/shared/util.h:976:32: warning: its scope is only this definition or declaration, which is probably not what you want
In file included from src/libsystemd/sd-bus/bus-kernel.c:37:0:
./src/shared/util.h:1081:28: warning: 'struct msghdr' declared inside parameter list
 void cmsg_close_all(struct msghdr *mh);
                            ^
  CC       src/libsystemd/sd-bus/libsystemd_la-bus-creds.lo
In file included from src/libsystemd/sd-bus/bus-creds.c:25:0:
./src/shared/util.h:976:32: warning: 'struct ucred' declared inside parameter list
 int getpeercred(int fd, struct ucred *ucred);
                                ^
2015-02-24 00:42:13 +01:00
Thomas Hindoe Paaboel Andersen 2eec67acbb remove unused includes
This patch removes includes that are not used. The removals were found with
include-what-you-use which checks if any of the symbols from a header is
in use.
2015-02-23 23:53:42 +01:00
Michal Schmidt 710708a54c shared: handle unnamed sockets in socket_address_equal()
Make sure we don't inspect sun_path of unnamed sockets.
Since we cannot know if two unnamed sockets' adresses refer to the same
socket, just return false.
2015-02-20 03:35:12 +01:00
Michal Schmidt 02233928a5 shared: avoid semi-duplicating socket_address_equal()
Just call socket_address_equal() from socket_address_matches_fd()
instead of implementing similar comparing of addresses.
2015-02-20 03:35:11 +01:00
Michal Schmidt dbafedacba shared: use SocketAddress in socket_address_matches_fd()
Cleanup. No behavior change.
2015-02-20 03:35:11 +01:00
Michal Schmidt c78e47a61f core, shared: in deserializing, match same files reached via different paths
When dbus.socket is updated like this:
-ListenStream=/var/run/dbus/system_bus_socket
+ListenStream=/run/dbus/system_bus_socket
... and daemon-reload is performed, bad things happen.
During deserialization systemd does not recognize that the two paths
refer to the same named socket and replaces the socket file with a new
one. As a result, applications hang when they try talking to dbus.

Fix this by finding a match not only when the path names are equal, but
also when they point to the same inode.
In socket_address_equal() it is necessary to move the address size
comparison into the abstract sockets branch. For path name sockets the
comparison must not be done and for other families it is redundant
(their sizes are constant and checked by socket_address_verify()).

FIFOs and special files can also have multiple pathnames, so compare the
inodes for them as well. Note that previously the pathname checks used
streq_ptr(), but the paths cannot be NULL.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1186018
2015-02-20 03:35:04 +01:00
Lennart Poettering 9c857b9d16 nspawn: when connected to pipes for stdin/stdout, pass them as-is to PID 1
Previously we always invoked the container PID 1 on /dev/console of the
container. With this change we do so only if nspawn was invoked
interactively (i.e. its stdin/stdout was connected to a TTY). In all other
cases we directly pass through the fds unmodified.

This has the benefit that nspawn can be added into shell pipelines.

https://bugs.freedesktop.org/show_bug.cgi?id=87732
2015-02-18 23:36:20 +01:00
Lennart Poettering d5d8429a12 everywhere: remove configurability of sysv runlevel to target mapping
With this change runlevel 2, 3, 4 are mapped to multi-user.target for
good, and 5 to graphical.target. This was already the previous mapping
but is now no longer reconfigurable, but hard-coded into the core.

This should generally simplify things, but also fix one bug: the
sysv-generator previously generated symlinks to runlevel[2-5].target
units, which possibly weren't picked up if these aliases were otherwise
only referenced by the real names "multi-user.target" and
"graphical.target".

We keep compat aliases "runlevel[2345].target" arround for cases where
this target name is explicitly requested.
2015-02-18 20:20:14 +01:00
Lennart Poettering 1c8da04446 shared: introduce cmsg_close_all() call
The call iterates through cmsg list and closes all fds passed via
SCM_RIGHTS.

This patch also ensures the call is used wherever appropriate, where we
might get spurious fds sent and we should better close them, then leave
them lying around.
2015-02-18 19:42:24 +01:00
Lennart Poettering 1cfa9a4cbb systemctl: let's make use of FOREACH_STRING() where we can 2015-02-18 18:56:27 +01:00
Didier Roche 20f56fddcd Add gettext support 2015-02-18 16:33:46 +01:00
Lennart Poettering 70244d1d25 machined: open up most of machined's commands to unprivileged clients via PolicyKit 2015-02-18 11:43:18 +01:00
Kay Sievers 0974a682d1 bootctl: add sd-boot support 2015-02-17 14:36:59 +01:00
Zbigniew Jędrzejewski-Szmek 2404701e67 Transpose args in strv_fnmatch() to be more oo 2015-02-16 14:04:36 -05:00
Zbigniew Jędrzejewski-Szmek bceccd5ecc Add helper for fnmatch over strv 2015-02-16 13:16:45 -05:00
Bruno Bottazzini 9cad100eca util: use a shared lookup function for string tables
Macro DEFINE_STRING_TABLE_LOOKUP expands to a new function for each
of the almost 120 tables throghout the code.
Move the its implementation to a function (guaranteed to never be inlined),
and make the macro expand to an inlined function that calls this function.
This saves a few kilobytes from the systemd binary

(David: - fix coding-style
        - use 'ssize_t' to fix 32bit to 64bit propagation
        - use streq_ptr())
2015-02-14 14:32:27 +01:00
Djalal Harouni 84dd59b51c sd-rtnl: add missing IFLA_INET6_ADDR_GEN_MODE definition
Add missing IFLA_INET6_ADDR_GEN_MODE definition so we can build with
kernel headers < 3.17
2015-02-14 00:17:47 +01:00