Re: [systemd-devel] Service on-demand stop.
On 12/03/2014 07:04 AM, Andrey Shinkevich wrote: Please refer me to online documentation, if any, on how to stop systemd and D-Bus services on-demand. Thank you in advance! Take a look at [1] and in addition you can always look at the source code for an existing component that does what you need. JBG 1. http://0pointer.de/blog/projects/socket-activation.html ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Detecting inactive sessions
On Wed, 2014-12-03 at 02:41 +0100, Lennart Poettering wrote: On Wed, 19.11.14 00:46, Bastien Nocera (had...@hadess.net) wrote: On Tue, 2014-11-18 at 19:32 +0100, Bastien Nocera wrote: On Tue, 2014-11-11 at 16:46 +0100, Lennart Poettering wrote: snip I am willing to take a patch for this, but then again, as I own a Yoga I might look into this myself too one day. If you can write the scaffolding for it, I'm happy writing the code that talks to the accelerometer, and that would make it work on your Yoga. I've already written that code once, and I should be able to transform it into something mergeable. Do note that we would have to handle 3 types of accelerometers: - IIO with ring buffer (the type supported by iio-sensor-proxy and in the Yoga) - polling IIO (the type used in cheap tablets such as mine) - input device accelerometers (as present in the WeTab, and Dell Venue 8 tablet, apparently) I'll correct my own mail. We want to handle 4 types of accelerometers: - quaternion sensor IIO with ring buffer (the type present in some Yogas) - accelerometer IIO with ring buffer (the type supported by iio-sensor-proxy and in the Yoga as well) - polling IIO (the type used in cheap tablets such as mine) - input device accelerometers (as present in the WeTab) Given that range of devices, it makes less and less sense to me to put it in systemd. I think that I might start thinking about a D-Bus API, and expect interested desktops to use that instead of adding hardware specific code in systemd. What do you think? Sounds OK to me too. As you prefer, especially if you are doing the work ;-) There's support for items 2 and 3 in iio-sensor-proxy. Would be nice if somebody with access to the quaternion sensor would write a driver for it (probably re-using quite a bit from the accelerometer code), and submit it. The support for the input devices will need to happen at the same time as the D-Bus API, as it replaces the udev accelerometer code. ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] localed: log xkbcommon errors
On Wed, 03.12.14 07:56, Jan Synacek (jsyna...@redhat.com) wrote: The errors are prefixed with libxkbcommon to provide some context, because they are quite confusing without it. With the prefix, we at least know where they come from. --- src/locale/localed.c | 17 + 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/locale/localed.c b/src/locale/localed.c index 654b291..1d2673a 100644 --- a/src/locale/localed.c +++ b/src/locale/localed.c @@ -1009,7 +1009,14 @@ static int method_set_vc_keyboard(sd_bus *bus, sd_bus_message *m, void *userdata #ifdef HAVE_XKBCOMMON static void log_xkb(struct xkb_context *ctx, enum xkb_log_level lvl, const char *format, va_list args) { -/* suppress xkb messages for now */ +_cleanup_free_ char *msg = NULL; +const char *fmt; +char prefix[] = libxkbcommon: ; + +fmt = strappenda(prefix, format); +if (vasprintf(msg, fmt, args) 0) +(void) log_oom(); +log_debug(%s, msg); If vapsrintf() failed, then you output a NULL pointer. And gcc/libc actually take the liberty to crash in some conditions when you ask them to print a NULL string like this. } static int verify_xkb_rmlvo(const char *model, const char *layout, const char *variant, const char *options) { @@ -1092,9 +1099,11 @@ static int method_set_x11_keyboard(sd_bus *bus, sd_bus_message *m, void *userdat return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ r = verify_xkb_rmlvo(model, layout, variant, options); -if (r 0) -log_warning_errno(r, Cannot compile XKB keymap for new x11 keyboard layout ('%s' / '%s' / '%s' / '%s'): %m, - strempty(model), strempty(layout), strempty(variant), strempty(options)); +if (r 0) { +log_error_errno(r, Cannot compile XKB keymap for new x11 keyboard layout ('%s' / '%s' / '%s' / '%s'): %m, +strempty(model), strempty(layout), strempty(variant), strempty(options)); +return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, Cannot compile XKB keymap, refusing); +} if (free_and_strdup(c-x11_layout, layout) 0 || free_and_strdup(c-x11_model, model) 0 || Looks good otherwise. Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH v2] localed: log xkbcommon errors
The errors are prefixed with libxkbcommon to provide some context, because they are quite confusing without it. With the prefix, we at least know where they come from. --- Changes in v2: - don't log a null message if vasprintf() fails src/locale/localed.c | 19 +++ 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/locale/localed.c b/src/locale/localed.c index 654b291..c4e4829 100644 --- a/src/locale/localed.c +++ b/src/locale/localed.c @@ -1009,7 +1009,16 @@ static int method_set_vc_keyboard(sd_bus *bus, sd_bus_message *m, void *userdata #ifdef HAVE_XKBCOMMON static void log_xkb(struct xkb_context *ctx, enum xkb_log_level lvl, const char *format, va_list args) { -/* suppress xkb messages for now */ +_cleanup_free_ char *msg = NULL; +const char *fmt; +char prefix[] = libxkbcommon: ; + +fmt = strappenda(prefix, format); +if (vasprintf(msg, fmt, args) 0) { +(void) log_oom(); +return; +} +log_debug(%s, msg); } static int verify_xkb_rmlvo(const char *model, const char *layout, const char *variant, const char *options) { @@ -1092,9 +1101,11 @@ static int method_set_x11_keyboard(sd_bus *bus, sd_bus_message *m, void *userdat return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ r = verify_xkb_rmlvo(model, layout, variant, options); -if (r 0) -log_warning_errno(r, Cannot compile XKB keymap for new x11 keyboard layout ('%s' / '%s' / '%s' / '%s'): %m, - strempty(model), strempty(layout), strempty(variant), strempty(options)); +if (r 0) { +log_error_errno(r, Cannot compile XKB keymap for new x11 keyboard layout ('%s' / '%s' / '%s' / '%s'): %m, +strempty(model), strempty(layout), strempty(variant), strempty(options)); +return sd_bus_error_set(error, SD_BUS_ERROR_INVALID_ARGS, Cannot compile XKB keymap, refusing); +} if (free_and_strdup(c-x11_layout, layout) 0 || free_and_strdup(c-x11_model, model) 0 || -- 1.9.3 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH v9] tmpfiles, man: Add xattr support to tmpfiles
This patch makes it possible to set extended attributes on files created by tmpfiles. This can be especially used to set SMACK security labels on volatile files and directories. It is done by adding new line of type t. Such line should contain attributes in Argument field, using following format: name=value All other fields are ignored. If value contains spaces, then it must be surrounded by quotation marks. User can also put quotation mark in value by escaping it with backslash. Example: D /var/run/cups - - - - t /var/run/cups - - - - security.SMACK64=printing --- v9: * fully parse xattrs in one place * remove potential double free() v8: * update man v7: * use strv_consume() instead of strv_extend() * use only lsetxattr() * do not label in 'z' option * style fixes and cleanup v6: * rebase * man fixes * use glibc xattr * use unquote_first_word() instead of own parsing logic v5: * fixes for HAVE_XATTR undefined * use cunescape() instead of strreplace() * cache result of strv_length() * fix typo in manpage v4: * grammar fix in man * style fix v3: * may be used instead of should be used in manpage * use strv_isempty() instead of != NULL * rework item_set_xattrs() with split_pair() * remove copy_item_contents() * use hashmap_replace() instead of removed copy_item_contents() * use strv_extend() instead of strv_append() * cleanup --- man/tmpfiles.d.xml | 32 +-- src/tmpfiles/tmpfiles.c | 150 2 files changed, 166 insertions(+), 16 deletions(-) diff --git a/man/tmpfiles.d.xml b/man/tmpfiles.d.xml index 1b14d69..4f2e640 100644 --- a/man/tmpfiles.d.xml +++ b/man/tmpfiles.d.xml @@ -343,6 +343,25 @@ L/tmp/foobar ---- /dev/null/programlisting normal path names./para/listitem /varlistentry + +varlistentry +termvarnamet/varname/term +listitemparaSet extended +attributes on item. It may be +used in conjunction with other +types (only varnamed/varname, +varnameD/varname, varnamef/varname, +varnameF/varname, varnameL/varname, +varnamep/varname, varnamec/varname, +varnameb/varname, makes sense). +If used as a standalone line, then +commandsystemd-tmpfiles/command +will try to set extended +attributes on specified path. +This can be especially used to set +SMACK labels. +/para/listitem +/varlistentry /variablelist paraIf the exclamation mark is used, this @@ -430,7 +449,7 @@ r! /tmp/.X[0-9]*-lock/programlisting will not be modified. This parameter is ignored for varnamex/varname, varnamer/varname, varnameR/varname, -varnameL/varname lines./para +varnameL/varname, varnamet/varname lines./para paraOptionally, if prefixed with literal~/literal, the access mode is masked @@ -462,8 +481,8 @@ r! /tmp/.X[0-9]*-lock/programlisting ownership will not be modified. These parameters are ignored for varnamex/varname, varnamer/varname, -varnameR/varname, varnameL/varname -lines./para +varnameR/varname, varnameL/varname, +varnamet/varname lines./para /refsect2 refsect2 @@ -527,8 +546,8 @@ r! /tmp/.X[0-9]*-lock/programlisting specify a short string that is written to the file, suffixed by a newline. For varnameC/varname, specifies the source file -or directory. Ignored for all other -lines./para +or directory. For varnamet/varname determines +extended attributes to be set. Ignored for all other lines./para /refsect2 /refsect1 @@ -540,7 +559,8 @@ r! /tmp/.X[0-9]*-lock/programlisting paracommandscreen/command needs two directories created at boot with specific modes and ownership./para
Re: [systemd-devel] job_type_lookup_merge assertion failure in systemd
On Tue, Dec 2, 2014 at 5:34 PM, Lennart Poettering lenn...@poettering.net wrote: On Wed, 12.11.14 09:57, Steven Noonan (ste...@uplinklabs.net) wrote: Hi all, I've been seeing this happen every now and then on a couple machines. When I wake up in the morning and go to log in, I find X11 stopped, and when I try to log in to the VT it hangs when trying to create a session. I am forced to reset the box and then dig through logs on the next boot. This is the cause: We fixed a couple of bugs recently in the code involving job handling. Any chance you can check if you can reproduce the issue with current git of systemd? I haven't been able to reproduce it with some quick testing. I suspect this commit fixed it, since job_type_is_conflicting checks whether either job is a NOP before checking if it's mergeable: commit c21b92ffe7ef939dd32502ac912cf8ad1c5638fd Author: Michal Schmidt mschm...@redhat.com Date: Thu Nov 27 15:23:58 2014 +0100 core: fix transaction destructiveness check once more The previous fix e0312f4db core: fix check for transaction destructiveness broke test-engine (noticed by Zbyszek). Apparently I had a wrong idea of the intended semantics of --fail. The manpage says the operation should fail if it conflicts with a pending job (more specifically: causes an already pending start job to be reversed into a stop job or vice versa). So let's check job_type_is_conflicting, instead of !is_superset. This makes both test-engine and TEST-03-JOBS pass again. diff --git a/src/core/transaction.c b/src/core/transaction.c index b992edd..6ad11b2 100644 --- a/src/core/transaction.c +++ b/src/core/transaction.c @@ -511,7 +511,7 @@ static int transaction_is_destructive(Transaction *tr, JobMode mode, sd_bus_erro assert(!j-transaction_next); if (j-unit-job (mode == JOB_FAIL || j-unit-job-irreversible) -!job_type_is_superset(j-unit-job-type, j-type)) +job_type_is_conflicting(j-unit-job-type, j-type)) return sd_bus_error_setf(e, BUS_ERROR_TRANSACTION_IS_DESTRUCTIVE, Transaction is destructive.); } ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH v2] localed: log xkbcommon errors
On Wed, 03.12.14 14:56, Jan Synacek (jsyna...@redhat.com) wrote: The errors are prefixed with libxkbcommon to provide some context, because they are quite confusing without it. With the prefix, we at least know where they come from. Applied the patch bug simplified log_xkb a bit by just passing everything we get into log_internalv(). Thanks! Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH v9] tmpfiles, man: Add xattr support to tmpfiles
On Wed, 03.12.14 15:33, Maciej Wereski (m.were...@partner.samsung.com) wrote: +static int get_xattrs_from_arg(Item *i) { +char *xattr, *name, *value; +const char *p; +int r; Please declare name and value in the inner scope, no need to define them broader than necessary. + +assert(i); + +if (!i-argument) { +log_error(%s: Argument can't be empty!, i-path); +return -EBADMSG; +} +p = i-argument; + +while ((r = unquote_first_word(p, xattr, false)) 0) { +_cleanup_free_ char *tmp = NULL; +r = split_pair(xattr, =, name, value); +if (r 0) { +log_warning(Illegal xattr found: \%s\ - ignoring., xattr); +free(xattr); +continue; +} +free(xattr); +if (streq(name, ) || streq(value, )) { +log_warning(Malformed xattr found: \%s=%s\ - ignoring., name, value); +free(name); +free(value); +continue; +} +tmp = unquote(value, \); +if (!tmp) +return log_oom(); If this OOM path is hit, you don't free name nor value. I'd probably declare them in the inner scope with _cleanup_free_ so that they are automatically freed (which of course means you need to override the vars with NULL explicitly if you want to disable the freeing. +free(value); +value = cunescape(tmp); +if (!value) { +free(name); +return log_oom(); +} +if (strv_consume(i-xattrs, name) 0) { +free(value); +return log_oom(); +} +if (strv_consume(i-xattrs, value) 0){ +free(value); +return log_oom(); +} strv_consume() actually frees the passed string on failure anyway, that's why it is call consume... The code above would hence free value twice on failure. Use strv_push() if you don't want the call to free the string on failure... Hmm, I think it would be a good idea to introduce a new strv_push_pair() and strv_consume_pair() for cases like this, which add two elements at once. I added this now for you, this should make the code a bit simple for you. +} + +r = strv_length(i-xattrs) % 2 != 0 ? -EBADMSG : 0; This check appears unnecessary if the inner error checks work correctly. (Also it should really print a message on failure here...) Otherwise looks good! Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Service on-demand stop.
On Wed, 03.12.14 10:04, Andrey Shinkevich (andys...@mail.ru) wrote: Please refer me to online documentation, if any, on how to stop systemd and D-Bus services on-demand. Thank you in advance! There isn't really any docs. It's mostly a matter of simply making services exit when they decide they are idle, and then relying on socket actviation to start them again on the next request. Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH v4 1/4] bus: StartTransientUnit can have aux unit
On Tue, 02.12.14 23:29, WaLyong Cho (walyong@samsung.com) wrote: --- src/core/dbus-manager.c | 123 +--- 1 file changed, 105 insertions(+), 18 deletions(-) diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index 0994d7b..643aa8b 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -615,6 +615,93 @@ static int method_set_unit_properties(sd_bus *bus, sd_bus_message *message, void return bus_unit_method_set_properties(bus, message, u, error); } +static int transient_unit_from_message( +Manager *m, +sd_bus_message *message, +const char *name, +Unit **unit, +sd_bus_error *error) { + +Unit *u; +int r; + +assert(m); +assert(message); +assert(name); + +r = manager_load_unit(m, name, NULL, error, u); +if (r 0) +return r; + +if (u-load_state != UNIT_NOT_FOUND || +set_size(u-dependencies[UNIT_REFERENCED_BY]) 0) +return sd_bus_error_setf(error, + BUS_ERROR_UNIT_EXISTS, + Unit %s already exists., + name); Please do not line-break so eagerly. See CODING_STYLE, we do no follow a 80ch regime. + +static int try_aux_units_in_message( +Manager *m, +sd_bus_message *message, +sd_bus_error *error) { Why call this try? Maybe invoke it transient_aux_units_from_message() or so? if (r 0) return r; if (r == 0) -return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ +/* No authorization for now, but the async polkit + * stuff will call us again when it has it */ +return 1; Please don't rearrange lines that your patch doesn't really change. Please don't break lines too eagerly. r = sd_bus_message_read(message, ss, name, smode); if (r 0) @@ -639,34 +728,32 @@ static int method_start_transient_unit(sd_bus *bus, sd_bus_message *message, voi t = unit_name_to_type(name); if (t 0) -return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, Invalid unit type.); +return sd_bus_error_setf(error, + SD_BUS_ERROR_INVALID_ARGS, + Invalid unit type.); Same here... if (!unit_vtable[t]-can_transient) -return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, Unit type %s does not support transient units., unit_type_to_string(t)); - -mode = job_mode_from_string(smode); -if (mode 0) -return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, Job mode %s is invalid., smode); +return sd_bus_error_setf(error, + SD_BUS_ERROR_INVALID_ARGS, + Unit type %s does not support transient units., + unit_type_to_string(t)); Same here. r = mac_selinux_access_check(message, start, error); if (r 0) return r; -r = manager_load_unit(m, name, NULL, error, u); -if (r 0) -return r; - -if (u-load_state != UNIT_NOT_FOUND || set_size(u-dependencies[UNIT_REFERENCED_BY]) 0) -return sd_bus_error_setf(error, BUS_ERROR_UNIT_EXISTS, Unit %s already exists., name); +mode = job_mode_from_string(smode); +if (mode 0) +return sd_bus_error_setf(error, + SD_BUS_ERROR_INVALID_ARGS, + Job mode %s is invalid., + smode); Why did you move the parsing of the job mode after the selinux access check? I think we should validate all args before doing any further checks. -/* OK, the unit failed to load and is unreferenced, now let's - * fill in the transient data instead */ -r = unit_make_transient(u); +r = transient_unit_from_message(m, message, name, u, error); if (r 0) return r; -/* Set our properties */ -r = bus_unit_set_properties(u, message, UNIT_RUNTIME, false, error); +r = try_aux_units_in_message(m, message, error); if (r 0) return r; Hmm, the unit_load() invocation, isn't that something that should move into transient_unit_from_message() as well? Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list
Re: [systemd-devel] [PATCH v4 2/4] timer: timer can be a transient unit
On Tue, 02.12.14 23:29, WaLyong Cho (walyong@samsung.com) wrote: --- src/core/dbus-timer.c | 159 ++ src/core/dbus-timer.h | 3 + src/core/timer.c | 4 ++ 3 files changed, 166 insertions(+) diff --git a/src/core/dbus-timer.c b/src/core/dbus-timer.c index f1f8c54..e916f5a 100644 --- a/src/core/dbus-timer.c +++ b/src/core/dbus-timer.c @@ -24,6 +24,8 @@ #include dbus-unit.h #include dbus-timer.h #include bus-util.h +#include errno-list.h +#include strv.h static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_result, timer_result, TimerResult); @@ -183,3 +185,160 @@ const sd_bus_vtable bus_timer_vtable[] = { SD_BUS_PROPERTY(WakeSystem, b, bus_property_get_bool, offsetof(Timer, wake_system), SD_BUS_VTABLE_PROPERTY_CONST), SD_BUS_VTABLE_END }; + +static int bus_timer_set_transient_property( +Timer *t, +const char *name, +sd_bus_message *message, +UnitSetPropertiesMode mode, +sd_bus_error *error) { + +const char *str; +int r; + +assert(t); +assert(name); +assert(message); + +if (STR_IN_SET(name, + OnActiveSec, + OnBootSec, + OnStartupSec, + OnUnitActiveSec, + OnUnitInactiveSec)) { + +TimerValue *v; +TimerBase b = _TIMER_BASE_INVALID; +usec_t u = 0; + +b = timer_base_from_string(name); +if (b 0) +return 0; return 0 indicates success, you should really return b or -EINVAL here. + +r = sd_bus_message_read(message, t, u); +if (r 0) +return r; + +if (mode != UNIT_CHECK) { +unit_write_drop_in_private_format(UNIT(t), + mode, + name, + %s=%lu\n, + name, + u); Too eager line break... + +v = new0(TimerValue, 1); +if (!v) +return -ENOMEM; + +v-base = b; +v-value = u; + +LIST_PREPEND(value, t-values, v); +} + +return 1; + +} else if (streq(name, OnCalendar)) { + +TimerValue *v; +CalendarSpec *c = NULL; + +r = sd_bus_message_read(message, s, str); +if (r 0) +return r; + +if (mode != UNIT_CHECK) { +r = calendar_spec_from_string(str, c); +if (r 0) +return r; + +unit_write_drop_in_private_format(UNIT(t), + mode, + name, + %s=%s\n, + name, + str); Same... + +v = new0(TimerValue, 1); +if (!v) { +if (c) +calendar_spec_free(c); +return -ENOMEM; +} + +v-base = TIMER_CALENDAR; +v-calendar_spec = c; + +LIST_PREPEND(value, t-values, v); +} + +return 1; + +} else if (streq(name, AccuracySec)) { + +usec_t u = 0; + +r = sd_bus_message_read(message, t, u); +if (r 0) +return r; + +if (mode != UNIT_CHECK) { +t-accuracy_usec = u; +unit_write_drop_in_private_format(UNIT(t), + mode, + name, + %s=%lu\n, + name, + u); Same... +} + +return 1; + +} else if (streq(name, WakeSystem)) { + +int b; + +r = sd_bus_message_read(message, b, b); +if (r 0)
[systemd-devel] [HEADSUP] Next systemd Hackfest takes place at FOSDEM 2015, January 30th, Brussels!
Heya, Harald organized a room for our next Hackfest now, on January 30th, 2015, one day before FOSDEM 2015 in Brussels, Belgium. For details please see: https://plus.google.com/events/c56kbn26s6g01n6m4tj2nmdgnfc If you intend to show up it would be nice to sign up on the Google Event, so that we have an idea how many people expect. Thanks! See you in Brussels! Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH v4 3/4] unit: add UnitMask enum and get unit scope(mask) api from property
On Tue, 02.12.14 23:29, WaLyong Cho (walyong@samsung.com) wrote: Hmm, what's the rationale for this? Can you elaborate? --- Makefile.am | 7 ++ src/shared/.gitignore| 1 + src/shared/unit-name.c | 22 src/shared/unit-name.h | 26 + src/shared/unit-property-scope.gperf | 202 +++ 5 files changed, 258 insertions(+) create mode 100644 src/shared/unit-property-scope.gperf diff --git a/Makefile.am b/Makefile.am index 38d320f..3cec5fb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -819,6 +819,7 @@ libsystemd_shared_la_SOURCES = \ src/shared/cgroup-show.h \ src/shared/unit-name.c \ src/shared/unit-name.h \ + src/shared/unit-property-scope.c \ src/shared/utmp-wtmp.h \ src/shared/watchdog.c \ src/shared/watchdog.h \ @@ -907,6 +908,12 @@ libsystemd_shared_la_CFLAGS = \ $(SECCOMP_CFLAGS) \ -pthread +EXTRA_DIST += \ + src/shared/unit-property-scope.gperf + +CLEANFILES += \ + src/shared/unit-property-scope.c + libsystemd_shared_la_LIBADD = \ $(CAP_LIBS) diff --git a/src/shared/.gitignore b/src/shared/.gitignore index 61709e8..e7faa23 100644 --- a/src/shared/.gitignore +++ b/src/shared/.gitignore @@ -10,3 +10,4 @@ /arphrd-from-name.h /arphrd-list.txt /arphrd-to-name.h +/unit-property-scope.c diff --git a/src/shared/unit-name.c b/src/shared/unit-name.c index 21b6691..7cf0160 100644 --- a/src/shared/unit-name.c +++ b/src/shared/unit-name.c @@ -602,3 +602,25 @@ static const char* const unit_dependency_table[_UNIT_DEPENDENCY_MAX] = { }; DEFINE_STRING_TABLE_LOOKUP(unit_dependency, UnitDependency); + +static UnitMask unit_get_mask_from_property(const char *property) { +const unit_property_scope_mapping *m; + +assert(property); + +m = unit_property_scope_mapping_lookup(property, strlen(property)); +if (m) +return m-scope; + +return _UNIT_MASK_MAX; + +} + +bool unit_can_have_property(UnitType t, const char *property) { +UnitMask m; + +assert(property); + +m = unit_get_mask_from_property(property); +return !!((1ULL t) m); +} diff --git a/src/shared/unit-name.h b/src/shared/unit-name.h index 6f139cc..191c930 100644 --- a/src/shared/unit-name.h +++ b/src/shared/unit-name.h @@ -28,6 +28,7 @@ #define UNIT_NAME_MAX 256 typedef enum UnitType UnitType; +typedef enum UnitMask UnitMask; typedef enum UnitLoadState UnitLoadState; typedef enum UnitDependency UnitDependency; @@ -49,6 +50,23 @@ enum UnitType { _UNIT_TYPE_INVALID = -1 }; +enum UnitMask { +UNIT_MASK_SERVICE = 1ULL UNIT_SERVICE, +UNIT_MASK_SOCKET= 1ULL UNIT_SOCKET, +UNIT_MASK_BUSNAME = 1ULL UNIT_BUSNAME, +UNIT_MASK_TARGET= 1ULL UNIT_TARGET, +UNIT_MASK_SNAPSHOT = 1ULL UNIT_SNAPSHOT, +UNIT_MASK_DEVICE= 1ULL UNIT_DEVICE, +UNIT_MASK_MOUNT = 1ULL UNIT_MOUNT, +UNIT_MASK_AUTOMOUNT = 1ULL UNIT_AUTOMOUNT, +UNIT_MASK_SWAP = 1ULL UNIT_SWAP, +UNIT_MASK_TIMER = 1ULL UNIT_TIMER, +UNIT_MASK_PATH = 1ULL UNIT_PATH, +UNIT_MASK_SLICE = 1ULL UNIT_SLICE, +UNIT_MASK_SCOPE = 1ULL UNIT_SCOPE, +_UNIT_MASK_MAX = 1ULL _UNIT_TYPE_MAX, +}; + enum UnitLoadState { UNIT_STUB = 0, UNIT_LOADED, @@ -165,3 +183,11 @@ int build_subslice(const char *slice, const char*name, char **subslice); const char *unit_dependency_to_string(UnitDependency i) _const_; UnitDependency unit_dependency_from_string(const char *s) _pure_; + +struct unit_property_scope_mapping { +const char* property; +UnitMask scope; +}; +typedef struct unit_property_scope_mapping unit_property_scope_mapping; +const unit_property_scope_mapping* unit_property_scope_mapping_lookup (register const char *str, register unsigned int len); +bool unit_can_have_property(UnitType t, const char *property); diff --git a/src/shared/unit-property-scope.gperf b/src/shared/unit-property-scope.gperf new file mode 100644 index 000..bbcfcba --- /dev/null +++ b/src/shared/unit-property-scope.gperf @@ -0,0 +1,202 @@ +%{ +#include unit-name.h +#include bus-util.h +%} +unit_property_scope_mapping; +%null_strings +%language=ANSI-C +%define slot-name property +%define hash-function-name bus_property_scope_mapping_hash +%define lookup-function-name unit_property_scope_mapping_lookup +%readonly-tables +%omit-struct-type +%struct-type +%includes +%% +Description,
Re: [systemd-devel] [PATCH v4] run: introduce timer support option
On Tue, 02.12.14 23:35, WaLyong Cho (walyong@samsung.com) wrote: Supported timer options --on-active=, --on-boot=, --on-startup=, --on-unit-active=, --on-unit-inactive=, --on-calendar=. Each options corresponding with OnActiveSec=, OnBootSec=, OnStartupSec=, OnUnitActiveSec=, OnUnitInactiveSec= of timer respectively. I think a nice way to make both the properties of the service and of the timer unit configurable would be to introduce --timer-property= in addition to --property= as parameter. --property= would then always be applied to the service/scope being created, and --timer-property= would apply to the timer unit instead. Do we need the tables of the 3rd patch which a simple scheme like that? Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Systemd-networkd DHCP Server DNS integration?
On Tue, 18.11.14 12:39, Tom Gundersen (t...@jklm.no) wrote: On Tue, Nov 18, 2014 at 3:30 AM, William Wilhelm w...@wilhelm.com.au wrote: I'm building a router and have been experimenting with DHCPServer=yes for the LAN side of things. It's been working well. I ask if there is any integration between the networkd DHCP server and systemd-resolved? When the server hands out an address does it register a hosts entry for the client's hostname with resolved? It does not. I'd be open to exposing the handed out leases through the sd-network library, which then resolved could pick up (so patches welcome!). But maybe Lennart should comment on the resolved part first. Yes, I'd like some kind of integration of NSS and networkd's dhcp server. But I don't think resolved should be involved. Instead, we should add another NSS module that queries the DHCP lease database via dbus, similar to how nss-resolve talks to resolved or nss-mymachines talks to machined. Of course, we can make that happen only when networkd gets a bus interface, which is not before kdbus, because it needs to run in early boot where dbus1 is not available... Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] networkctl: fix typo
--- src/network/networkctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/network/networkctl.c b/src/network/networkctl.c index 622533053c..a763630061 100644 --- a/src/network/networkctl.c +++ b/src/network/networkctl.c @@ -333,7 +333,7 @@ static int get_gateway_description(sd_rtnl *rtnl, struct udev_hwdb *hwdb, int if r = sd_rtnl_message_neigh_get_ifindex(m, ifi); if (r 0) { -log_error_errno(r, colud not get ifindex: %m); +log_error_errno(r, could not get ifindex: %m); continue; } @@ -427,7 +427,7 @@ static int dump_gateways(sd_rtnl *rtnl, struct udev_hwdb *hwdb, const char *pref r = sd_rtnl_message_read_u32(m, RTA_OIF, ifi); if (r 0) { -log_error_errno(r, colud not get RTA_OIF: %m); +log_error_errno(r, could not get RTA_OIF: %m); continue; } -- 2.2.0 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [HEADSUP] Next systemd Hackfest takes place at FOSDEM 2015, January 30th, Brussels!
On 2014-12-03 19:28, Lennart Poettering wrote: Heya, Harald organized a room for our next Hackfest now, on January 30th, 2015, one day before FOSDEM 2015 in Brussels, Belgium. For details please see: https://plus.google.com/events/c56kbn26s6g01n6m4tj2nmdgnfc If you intend to show up it would be nice to sign up on the Google Event, so that we have an idea how many people expect. Thanks! Have you started collecting list of topics to discuss somewhere? We would be super-happy add few items to agenda (from top of my head - possible usb gadget/functionfs service type handling, need for extensive smack rework, etc.) See you in Brussels! Hope so. :) Thanks! -- Karol Lewandowski, Samsung RD Institute Poland ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH V2] networkd: fix typo
V2: found another one --- src/network/networkctl.c | 4 ++-- src/network/networkd-netdev.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/network/networkctl.c b/src/network/networkctl.c index 622533053c..a763630061 100644 --- a/src/network/networkctl.c +++ b/src/network/networkctl.c @@ -333,7 +333,7 @@ static int get_gateway_description(sd_rtnl *rtnl, struct udev_hwdb *hwdb, int if r = sd_rtnl_message_neigh_get_ifindex(m, ifi); if (r 0) { -log_error_errno(r, colud not get ifindex: %m); +log_error_errno(r, could not get ifindex: %m); continue; } @@ -427,7 +427,7 @@ static int dump_gateways(sd_rtnl *rtnl, struct udev_hwdb *hwdb, const char *pref r = sd_rtnl_message_read_u32(m, RTA_OIF, ifi); if (r 0) { -log_error_errno(r, colud not get RTA_OIF: %m); +log_error_errno(r, could not get RTA_OIF: %m); continue; } diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c index a08236e7c3..b75eab9cd8 100644 --- a/src/network/networkd-netdev.c +++ b/src/network/networkd-netdev.c @@ -503,7 +503,7 @@ static int netdev_create(NetDev *netdev, Link *link, r = sd_rtnl_message_append_u32(m, IFLA_LINK, link-ifindex); if (r 0) { log_netdev_error(netdev, - Colud not append IFLA_LINK attribute: %s, + Could not append IFLA_LINK attribute: %s, strerror(-r)); return r; } -- 2.2.0 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH V2] networkd: fix typo
Applied. Takk! Tom On Wed, Dec 3, 2014 at 8:59 PM, Torstein Husebø torst...@huseboe.net wrote: V2: found another one --- src/network/networkctl.c | 4 ++-- src/network/networkd-netdev.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/network/networkctl.c b/src/network/networkctl.c index 622533053c..a763630061 100644 --- a/src/network/networkctl.c +++ b/src/network/networkctl.c @@ -333,7 +333,7 @@ static int get_gateway_description(sd_rtnl *rtnl, struct udev_hwdb *hwdb, int if r = sd_rtnl_message_neigh_get_ifindex(m, ifi); if (r 0) { -log_error_errno(r, colud not get ifindex: %m); +log_error_errno(r, could not get ifindex: %m); continue; } @@ -427,7 +427,7 @@ static int dump_gateways(sd_rtnl *rtnl, struct udev_hwdb *hwdb, const char *pref r = sd_rtnl_message_read_u32(m, RTA_OIF, ifi); if (r 0) { -log_error_errno(r, colud not get RTA_OIF: %m); +log_error_errno(r, could not get RTA_OIF: %m); continue; } diff --git a/src/network/networkd-netdev.c b/src/network/networkd-netdev.c index a08236e7c3..b75eab9cd8 100644 --- a/src/network/networkd-netdev.c +++ b/src/network/networkd-netdev.c @@ -503,7 +503,7 @@ static int netdev_create(NetDev *netdev, Link *link, r = sd_rtnl_message_append_u32(m, IFLA_LINK, link-ifindex); if (r 0) { log_netdev_error(netdev, - Colud not append IFLA_LINK attribute: %s, + Could not append IFLA_LINK attribute: %s, strerror(-r)); return r; } -- 2.2.0 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH 1/2] libsystemd: add sd-hwdb library
This is libudev-hwdb, but decoupled from libudev and in the libsystemd style. The core code is unchanged, apart from the following minor changes: - hwdb.bin located in /**/systemd/hwdb/ take preference over the ones located in /**/udev/ - properties are stored internally in an OrderedHashmap, rather than a linked list. - a new API call allows individual properties to be queried directly, rather than iterating over them all - the iteration over properties have been moved inside the library, rather than exposing a list directly - the unused 'flags' parameter was dropped --- Makefile.am| 7 +- src/libsystemd/sd-hwdb/Makefile| 1 + src/libsystemd/sd-hwdb/hwdb-internal.h | 70 + src/libsystemd/sd-hwdb/hwdb-util.h | 31 +++ src/libsystemd/sd-hwdb/sd-hwdb.c | 471 + src/systemd/sd-hwdb.h | 46 6 files changed, 625 insertions(+), 1 deletion(-) create mode 12 src/libsystemd/sd-hwdb/Makefile create mode 100644 src/libsystemd/sd-hwdb/hwdb-internal.h create mode 100644 src/libsystemd/sd-hwdb/hwdb-util.h create mode 100644 src/libsystemd/sd-hwdb/sd-hwdb.c create mode 100644 src/systemd/sd-hwdb.h diff --git a/Makefile.am b/Makefile.am index d4d96e1..f3be5fd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -217,6 +217,7 @@ AM_CPPFLAGS = \ -I $(top_srcdir)/src/libsystemd/sd-event \ -I $(top_srcdir)/src/libsystemd/sd-rtnl \ -I $(top_srcdir)/src/libsystemd/sd-network \ + -I $(top_srcdir)/src/libsystemd/sd-hwdb \ -I $(top_srcdir)/src/libsystemd-network \ -I $(top_srcdir)/src/libsystemd-terminal \ $(OUR_CPPFLAGS) @@ -2604,6 +2605,7 @@ libsystemd_internal_la_SOURCES = \ src/systemd/sd-daemon.h \ src/systemd/sd-path.h \ src/systemd/sd-network.h \ + src/systemd/sd-hwdb.h \ src/libsystemd/sd-bus/sd-bus.c \ src/libsystemd/sd-bus/bus-control.c \ src/libsystemd/sd-bus/bus-control.h \ @@ -2662,7 +2664,10 @@ libsystemd_internal_la_SOURCES = \ src/libsystemd/sd-path/sd-path.c \ src/libsystemd/sd-network/sd-network.c \ src/libsystemd/sd-network/network-util.h \ - src/libsystemd/sd-network/network-util.c + src/libsystemd/sd-network/network-util.c \ + src/libsystemd/sd-hwdb/sd-hwdb.c \ + src/libsystemd/sd-hwdb/hwdb-util.h \ + src/libsystemd/sd-hwdb/hwdb-intenal.h nodist_libsystemd_internal_la_SOURCES = \ src/libsystemd/libsystemd.sym diff --git a/src/libsystemd/sd-hwdb/Makefile b/src/libsystemd/sd-hwdb/Makefile new file mode 12 index 000..94aaae2 --- /dev/null +++ b/src/libsystemd/sd-hwdb/Makefile @@ -0,0 +1 @@ +../../Makefile \ No newline at end of file diff --git a/src/libsystemd/sd-hwdb/hwdb-internal.h b/src/libsystemd/sd-hwdb/hwdb-internal.h new file mode 100644 index 000..fedccde --- /dev/null +++ b/src/libsystemd/sd-hwdb/hwdb-internal.h @@ -0,0 +1,70 @@ +/*** + This file is part of systemd. + + Copyright 2012 Kay Sievers k...@vrfy.org + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see http://www.gnu.org/licenses/. +***/ +#pragma once + +#include sparse-endian.h + +#define HWDB_SIG { 'K', 'S', 'L', 'P', 'H', 'H', 'R', 'H' } + +/* on-disk trie objects */ +struct trie_header_f { +uint8_t signature[8]; + +/* version of tool which created the file */ +le64_t tool_version; +le64_t file_size; + +/* size of structures to allow them to grow */ +le64_t header_size; +le64_t node_size; +le64_t child_entry_size; +le64_t value_entry_size; + +/* offset of the root trie node */ +le64_t nodes_root_off; + +/* size of the nodes and string section */ +le64_t nodes_len; +le64_t strings_len; +} _packed_; + +struct trie_node_f { +/* prefix of lookup string, shared by all children */ +le64_t prefix_off; +/* size of children entry array appended to the node */ +uint8_t children_count; +uint8_t padding[7]; +/* size of value entry array appended to the node */ +le64_t values_count; +} _packed_; + +/* array of child entries, follows directly the node record */ +struct trie_child_entry_f { +/* index of the child node */ +uint8_t c; +uint8_t padding[7]; +/* offset of the child node */ +
[systemd-devel] [PATCH 2/2] libudev: make libudev-hwdb a wrapper around sd-hwdb
--- Makefile.am| 3 +- src/libudev/libudev-hwdb-def.h | 74 -- src/libudev/libudev-hwdb.c | 327 - src/udev/udevadm-hwdb.c| 2 +- 4 files changed, 29 insertions(+), 377 deletions(-) delete mode 100644 src/libudev/libudev-hwdb-def.h diff --git a/Makefile.am b/Makefile.am index f3be5fd..44b8c7d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3565,7 +3565,8 @@ test_libudev_SOURCES = \ test_libudev_LDADD = \ libsystemd-label.la \ libudev-internal.la \ - libsystemd-shared.la + libsystemd-shared.la \ + libsystemd-internal.la test_udev_SOURCES = \ src/test/test-udev.c diff --git a/src/libudev/libudev-hwdb-def.h b/src/libudev/libudev-hwdb-def.h deleted file mode 100644 index b76a13f..000 --- a/src/libudev/libudev-hwdb-def.h +++ /dev/null @@ -1,74 +0,0 @@ -/*** - This file is part of systemd. - - Copyright 2012 Kay Sievers k...@vrfy.org - - systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 2.1 of the License, or - (at your option) any later version. - - systemd is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with systemd; If not, see http://www.gnu.org/licenses/. -***/ - -#ifndef _LIBUDEV_HWDB_DEF_H_ -#define _LIBUDEV_HWDB_DEF_H_ - -#include sparse-endian.h - -#define HWDB_SIG { 'K', 'S', 'L', 'P', 'H', 'H', 'R', 'H' } - -/* on-disk trie objects */ -struct trie_header_f { -uint8_t signature[8]; - -/* version of tool which created the file */ -le64_t tool_version; -le64_t file_size; - -/* size of structures to allow them to grow */ -le64_t header_size; -le64_t node_size; -le64_t child_entry_size; -le64_t value_entry_size; - -/* offset of the root trie node */ -le64_t nodes_root_off; - -/* size of the nodes and string section */ -le64_t nodes_len; -le64_t strings_len; -} _packed_; - -struct trie_node_f { -/* prefix of lookup string, shared by all children */ -le64_t prefix_off; -/* size of children entry array appended to the node */ -uint8_t children_count; -uint8_t padding[7]; -/* size of value entry array appended to the node */ -le64_t values_count; -} _packed_; - -/* array of child entries, follows directly the node record */ -struct trie_child_entry_f { -/* index of the child node */ -uint8_t c; -uint8_t padding[7]; -/* offset of the child node */ -le64_t child_off; -} _packed_; - -/* array of value entries, follows directly the node record/child array */ -struct trie_value_entry_f { -le64_t key_off; -le64_t value_off; -} _packed_; - -#endif diff --git a/src/libudev/libudev-hwdb.c b/src/libudev/libudev-hwdb.c index 05a6858..7a21b3d 100644 --- a/src/libudev/libudev-hwdb.c +++ b/src/libudev/libudev-hwdb.c @@ -1,8 +1,7 @@ /*** This file is part of systemd. - Copyright 2012 Kay Sievers k...@vrfy.org - Copyright 2008 Alan Jenkins alan.christopher.jenk...@googlemail.com + Copyright Tom Gundersen t...@jklm.no systemd is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -18,18 +17,9 @@ along with systemd; If not, see http://www.gnu.org/licenses/. ***/ -#include stdio.h -#include errno.h -#include string.h -#include inttypes.h -#include ctype.h -#include stdlib.h -#include fnmatch.h -#include getopt.h -#include sys/mman.h - #include libudev-private.h -#include libudev-hwdb-def.h +#include sd-hwdb.h +#include hwdb-util.h /** * SECTION:libudev-hwdb @@ -47,220 +37,11 @@ struct udev_hwdb { struct udev *udev; int refcount; -FILE *f; -struct stat st; -union { -struct trie_header_f *head; -const char *map; -}; +sd_hwdb *hwdb; struct udev_list properties_list; }; -struct linebuf { -char bytes[LINE_MAX]; -size_t size; -size_t len; -}; - -static void linebuf_init(struct linebuf *buf) { -buf-size = 0; -buf-len = 0; -} - -static const char *linebuf_get(struct linebuf *buf) { -if (buf-len + 1 = sizeof(buf-bytes)) -return NULL; -buf-bytes[buf-len] = '\0'; -return buf-bytes; -} - -static bool linebuf_add(struct linebuf *buf, const char *s, size_t len) { -if (buf-len + len = sizeof(buf-bytes)) -return false; -memcpy(buf-bytes + buf-len, s,
Re: [systemd-devel] set rr scheduler failed with cpushares
Hi, On Tue, Dec 2, 2014 at 7:12 PM, Lennart Poettering lenn...@poettering.net wrote: On Mon, 17.11.14 23:46, WaLyong Cho (walyong@samsung.com) wrote: Hello, I'd made two different services. One has *CPUSchedulingPolicy=rr* and the others has *CPUShares=*. Could anyone help me? If CPUShares= is set this has the effect that the service and all services in the same slice will be have the cpu cgroup controller turned on. Unfortunately this has the effect that RT scheduling will be unavailable then, unless an explicit RT budget is configured for that specific cgroup. This is something systemd cannot be used for nicely however, as we don't expose high-level controls for the RT budget. The RT budget is configured in the cpu.rt_runtime_us and cpu.rt_period_us cgroup attributes. You can write to them from ExecStartPre= for example using the %c specified. Wouldn't it be against the idea of access to control groups should go through systemd? Is this something you are recommending until we start exposing RT parts of the cgroups, or? Umut Another option is to simply disable CONFIG_RT_GROUP_SCHED in the kernel, if you don't need it anyway. Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 1/2] libsystemd: add sd-hwdb library
On Wed, Dec 03, 2014 at 10:11:40PM +0100, Tom Gundersen wrote: This is libudev-hwdb, but decoupled from libudev and in the libsystemd style. The core code is unchanged, apart from the following minor changes: - hwdb.bin located in /**/systemd/hwdb/ take preference over the ones located in /**/udev/ - properties are stored internally in an OrderedHashmap, rather than a linked list. - a new API call allows individual properties to be queried directly, rather than iterating over them all - the iteration over properties have been moved inside the library, rather than exposing a list directly - the unused 'flags' parameter was dropped Why pull this apart? Are other applications wanting to use this? thanks, greg k-h ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [BUG] too many rfkill services
I had the same issue with rfkill as Łukasz did. I have rebuilt including commit 4844262f25a3ff6bd23de05a0a6f84a8e2983d74. I tested by cycling suspend/resume 15 times without reboot, and did not experience any failed phantom rfkill services. I also tested rfkill functionality, and the state of a soft-blocked rfkill switch survived a suspend/resume and a reboot. Hope this helps, ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [HEADSUP] Next systemd Hackfest takes place at FOSDEM 2015, January 30th, Brussels!
On Wed, 03.12.14 20:47, Karol Lewandowski (k.lewando...@samsung.com) wrote: On 2014-12-03 19:28, Lennart Poettering wrote: Heya, Harald organized a room for our next Hackfest now, on January 30th, 2015, one day before FOSDEM 2015 in Brussels, Belgium. For details please see: https://plus.google.com/events/c56kbn26s6g01n6m4tj2nmdgnfc If you intend to show up it would be nice to sign up on the Google Event, so that we have an idea how many people expect. Thanks! Have you started collecting list of topics to discuss somewhere? Nope, not yet. Not sure where to put it up though so that everybody can add stuff. We could add wiki page on fdo, but then only those with fdo accounts can edit it. Maybe just drop it in the Google Event comments under the URL above, and I'll eventually compile a list out of it shortly before the conference? We would be super-happy add few items to agenda (from top of my head - possible usb gadget/functionfs service type handling, need for extensive smack rework, etc.) Plase go ahead and add comments with topic suggestions to the google event! Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 1/2] libsystemd: add sd-hwdb library
On Wed, Dec 3, 2014 at 10:19 PM, Greg KH gre...@linuxfoundation.org wrote: On Wed, Dec 03, 2014 at 10:11:40PM +0100, Tom Gundersen wrote: This is libudev-hwdb, but decoupled from libudev and in the libsystemd style. The core code is unchanged, apart from the following minor changes: - hwdb.bin located in /**/systemd/hwdb/ take preference over the ones located in /**/udev/ - properties are stored internally in an OrderedHashmap, rather than a linked list. - a new API call allows individual properties to be queried directly, rather than iterating over them all - the iteration over properties have been moved inside the library, rather than exposing a list directly - the unused 'flags' parameter was dropped Why pull this apart? We'd like to move the libudev API closer to the libsystemd one, and as the hwdb stuff is actually completely separate from the rest of libudev, it is a nice place to start I thought. The benefit is rather minor (consistency of API and improved error handling), but still worth-while I think. One point though, which I forgot to mention in the patch description, is that one more change is made: I dropped the unused struct udev context and didn't replace it with anything else. I think this fits with how other things are done in libsystemd, but it _is_ nice to have a context around for future extensions... What do you think Kay? Are other applications wanting to use this? A couple applications use hwdb directly yes, and in some cases without using libudev for anything else. If people start using dbus more in place of the userspace-to-userspace udev transport, then I guess we'll have more cases of programs using hwdb directly without otherwise needing libudev, so having these separate (at least their API, if not the actual .so) makes sense I think. There have been requests for splitting out hwdb before [0], but I don't think these patches help much for what they want (and hwdb really does not make sense in a non-Linux setting anyway, so I'm not really convinced by that feature request at all). Thanks for taking a look! Cheers, Tom [0]: https://bugs.freedesktop.org/show_bug.cgi?id=72562 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 1/2] libsystemd: add sd-hwdb library
On Thu, 04.12.14 00:57, Tom Gundersen (t...@jklm.no) wrote: On Wed, Dec 3, 2014 at 10:19 PM, Greg KH gre...@linuxfoundation.org wrote: On Wed, Dec 03, 2014 at 10:11:40PM +0100, Tom Gundersen wrote: This is libudev-hwdb, but decoupled from libudev and in the libsystemd style. The core code is unchanged, apart from the following minor changes: - hwdb.bin located in /**/systemd/hwdb/ take preference over the ones located in /**/udev/ - properties are stored internally in an OrderedHashmap, rather than a linked list. - a new API call allows individual properties to be queried directly, rather than iterating over them all - the iteration over properties have been moved inside the library, rather than exposing a list directly - the unused 'flags' parameter was dropped Why pull this apart? We'd like to move the libudev API closer to the libsystemd one, and as the hwdb stuff is actually completely separate from the rest of libudev, it is a nice place to start I thought. The benefit is rather minor (consistency of API and improved error handling), but still worth-while I think. One point though, which I forgot to mention in the patch description, is that one more change is made: I dropped the unused struct udev context and didn't replace it with anything else. I think this fits with how other things are done in libsystemd, but it _is_ nice to have a context around for future extensions... What do you think Kay? Well, if you have sd_hwdb now as new context object, that should be more than enough. Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] set rr scheduler failed with cpushares
On Wed, 03.12.14 22:13, Umut Tezduyar Lindskog (u...@tezduyar.com) wrote: Hi, On Tue, Dec 2, 2014 at 7:12 PM, Lennart Poettering lenn...@poettering.net wrote: On Mon, 17.11.14 23:46, WaLyong Cho (walyong@samsung.com) wrote: Hello, I'd made two different services. One has *CPUSchedulingPolicy=rr* and the others has *CPUShares=*. Could anyone help me? If CPUShares= is set this has the effect that the service and all services in the same slice will be have the cpu cgroup controller turned on. Unfortunately this has the effect that RT scheduling will be unavailable then, unless an explicit RT budget is configured for that specific cgroup. This is something systemd cannot be used for nicely however, as we don't expose high-level controls for the RT budget. The RT budget is configured in the cpu.rt_runtime_us and cpu.rt_period_us cgroup attributes. You can write to them from ExecStartPre= for example using the %c specified. Wouldn't it be against the idea of access to control groups should go through systemd? Yes, it is against that idea, absolutely. Is this something you are recommending until we start exposing RT parts of the cgroups, or? No. It's more difficult: the kernel API is awful here (since it really shouldn't break RT without explicit initialization), and it will reappear in a very different form in the unified hierarchy. We will however only expose it as soon as we know how it looks in the new hierarchy. Until then things are not pretty: we won't expose firendly options for them, hence there's really no other way than hackishly writing to the attributes directly, even though this is clearly something that will stop working as soon as the unified hierarchy is adopted. Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 1/2] libsystemd: add sd-hwdb library
On Thu, Dec 04, 2014 at 12:57:53AM +0100, Tom Gundersen wrote: On Wed, Dec 3, 2014 at 10:19 PM, Greg KH gre...@linuxfoundation.org wrote: On Wed, Dec 03, 2014 at 10:11:40PM +0100, Tom Gundersen wrote: This is libudev-hwdb, but decoupled from libudev and in the libsystemd style. The core code is unchanged, apart from the following minor changes: - hwdb.bin located in /**/systemd/hwdb/ take preference over the ones located in /**/udev/ - properties are stored internally in an OrderedHashmap, rather than a linked list. - a new API call allows individual properties to be queried directly, rather than iterating over them all - the iteration over properties have been moved inside the library, rather than exposing a list directly - the unused 'flags' parameter was dropped Why pull this apart? We'd like to move the libudev API closer to the libsystemd one, and as the hwdb stuff is actually completely separate from the rest of libudev, it is a nice place to start I thought. The benefit is rather minor (consistency of API and improved error handling), but still worth-while I think. That makes sense. Are other applications wanting to use this? A couple applications use hwdb directly yes, and in some cases without using libudev for anything else. I maintain one such application, usbutils, that only depends on libudev for the database, so this will be a nice change for it to make. If people start using dbus more in place of the userspace-to-userspace udev transport, then I guess we'll have more cases of programs using hwdb directly without otherwise needing libudev, so having these separate (at least their API, if not the actual .so) makes sense I think. There have been requests for splitting out hwdb before [0], but I don't think these patches help much for what they want (and hwdb really does not make sense in a non-Linux setting anyway, so I'm not really convinced by that feature request at all). There have been some requests in Gentoo to split this out as well, so this will make those users happy. thanks for doing this. greg k-h ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH v2 2/2] bootchart: escape non printable process name
On Wed, 12.11.14 19:49, WaLyong Cho (walyong@samsung.com) wrote: Applied both. Made some changes regarding UTF8 escaping, see other mail. --- src/bootchart/svg.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/bootchart/svg.c b/src/bootchart/svg.c index faf377e..e5569e1 100644 --- a/src/bootchart/svg.c +++ b/src/bootchart/svg.c @@ -39,6 +39,7 @@ #include svg.h #include bootchart.h #include list.h +#include utf8.h #define time_to_graph(t) ((t) * arg_scale_x) #define ps_to_graph(n) ((n) * arg_scale_y) @@ -1006,12 +1007,15 @@ static void svg_ps_bars(void) { /* pass 2 - ps boxes */ ps = ps_first; while ((ps = get_next_ps(ps))) { -_cleanup_free_ char *enc_name = NULL; +_cleanup_free_ char *enc_name = NULL, *escaped = NULL; double endtime; double starttime; int t; -enc_name = xml_comment_encode(ps-name); +if (!utf8_is_printable(ps-name, strlen(ps-name))) +escaped = utf8_escape_non_printable(ps-name); + +enc_name = xml_comment_encode(escaped ? escaped : ps-name); if (!enc_name) continue; @@ -1100,7 +1104,7 @@ static void svg_ps_bars(void) { svg( text x=\%.03f\ y=\%.03f\![CDATA[%s]] [%i]tspan class=\run\%.03fs/tspan %s/text\n, time_to_graph(w - graph_start) + 5.0, ps_to_graph(j) + 14.0, -ps-name, +escaped ? escaped : ps-name, ps-pid, (ps-last-runtime - ps-first-runtime) / 10.0, arg_show_cgroup ? ps-cgroup : ); -- 1.9.3 Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH v2 1/2] utf8: intruduce utf8_escape_non_printable
On Wed, 19.11.14 12:35, David Herrmann (dh.herrm...@gmail.com) wrote: +} else { +if ((*str ' ') || (*str = 127)) { +*(s++) = '\\'; +*(s++) = 'x'; +*(s++) = hexchar((int) *str 4); +*(s++) = hexchar((int) *str); +} else +*(s++) = *str; + +str += 1; This part is wrong. You cannot rely on ``*str'' to be the correct Unicode value for the character. utf8_is_printable() returns false also for multi-byte UTF8 characters. By taking it unmodified, it will include the UTF8 management bits, which we really don't want here. If you really want this, I'd prefer if you decode each UTF8 character, and if it is non-printable you print \uABCD or \UABCDWXYZ (like C++ does) as a 6-byte or 10-byte sequence. Other characters are just printed normally. I have now committed the proposed patch but then changed the code to iterate through all bytes of the unichar and escape that individually. This form of escaping should be safe and be compatible with C-style escaping (which \u isn't really...). Hope this makes sense. Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] units: skip mounting /dev/hugepages if we don't have CAP_SYS_ADMIN
On Wed, 12.11.14 15:19, Michal Sekletar (msekl...@redhat.com) wrote: Applied! Thanks! --- units/dev-hugepages.mount | 1 + 1 file changed, 1 insertion(+) diff --git a/units/dev-hugepages.mount b/units/dev-hugepages.mount index d711fae..882adb4 100644 --- a/units/dev-hugepages.mount +++ b/units/dev-hugepages.mount @@ -12,6 +12,7 @@ Documentation=http://www.freedesktop.org/wiki/Software/systemd/APIFileSystems DefaultDependencies=no Before=sysinit.target ConditionPathExists=/sys/kernel/mm/hugepages +ConditionCapability=CAP_SYS_ADMIN [Mount] What=hugetlbfs -- 1.8.3.1 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH 1/3] log: 1237557 Unchecked return value from library
On Mon, 17.11.14 10:58, David Herrmann (dh.herrm...@gmail.com) wrote: Hi On Tue, Nov 11, 2014 at 9:06 AM, Susant Sahani sus...@redhat.com wrote: fix 1237557 Unchecked return value from library --- src/shared/log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/log.c b/src/shared/log.c index 1c589ac..e7237ba 100644 --- a/src/shared/log.c +++ b/src/shared/log.c @@ -122,7 +122,7 @@ static int create_log_socket(int type) { timeval_store(tv, 10 * USEC_PER_MSEC); else timeval_store(tv, 10 * USEC_PER_SEC); -setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, tv, sizeof(tv)); +(void) setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, tv, sizeof(tv)); I don't think we use spaces after casts, but not entirely sure.. I usually put a space there. And I'd recommend doing that, but we don't follow that strictly, and either is acceptable. Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] daemon-reload timestamped: coalesce redundant daemon-reloads
On 2 Dec 2014 22:19, Ken Sedgwick ksedg...@bonsai.com wrote: Systems with many units (~10K) take many seconds to perform a daemon-reload. The process of load-balancing these systems requires multiple daemon-reloads, many issued concurrently. Out of curiosity, how does this work? Is there code we can look at? Currently many of these redundant daemon-reloads timeout and fail. This patch adds a new systemd method ReloadTimestamped which contains the monotonic timestamp of the daemon-reload issuance. When a ReloadTimestamped message is handled it's timestamp is compared to the timestamp of the most recent successful daemon reload. If the message is redundant it is returns with success immediately. The original Reload method is preserved to support compatibility with older systemctl versions. If a new systemctl receives a SD_BUS_ERROR_UNKNOWN_METHOD error in response to ReloadTimestamped it retries with the original Reload method. --- src/core/dbus-manager.c | 47 +++ src/core/manager.c| 8 src/core/manager.h| 3 +++ src/systemctl/systemctl.c | 19 ++- 4 files changed, 76 insertions(+), 1 deletion(-) diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index 0994d7b..6a42456 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -1100,6 +1100,52 @@ static int method_reload(sd_bus *bus, sd_bus_message *message, void *userdata, s return 1; } +static int method_reload_timestamped(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) { +Manager *m = userdata; +int r; +usec_t requested_time; + +assert(bus); +assert(message); +assert(m); + +r = bus_verify_reload_daemon_async(m, message, error); +if (r 0) +return r; +if (r == 0) +return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ + +r = mac_selinux_access_check(message, reload, error); +if (r 0) +return r; + +r = sd_bus_message_read(message, t, requested_time); +if (r 0) +return r; + +/* Is this reload needed? If a completed reload was started + * after this reload was requested we can coalesce it and + * return immediate success. */ + +if (requested_time m-last_reload_time) +return sd_bus_reply_method_return(message, NULL); + +/* Instead of sending the reply back right away, we just + * remember that we need to and then send it after the reload + * is finished. That way the caller knows when the reload + * finished. */ + +assert(!m-queued_message); +r = sd_bus_message_new_method_return(message, m-queued_message); +if (r 0) +return r; + +m-queued_message_bus = sd_bus_ref(bus); +m-exit_code = MANAGER_RELOAD; + +return 1; +} + static int method_reexecute(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) { Manager *m = userdata; int r; @@ -1917,6 +1963,7 @@ const sd_bus_vtable bus_manager_vtable[] = { SD_BUS_METHOD(CreateSnapshot, sb, o, method_create_snapshot, 0), SD_BUS_METHOD(RemoveSnapshot, s, NULL, method_remove_snapshot, 0), SD_BUS_METHOD(Reload, NULL, NULL, method_reload, SD_BUS_VTABLE_UNPRIVILEGED), +SD_BUS_METHOD(ReloadTimestamped, t, NULL, method_reload_timestamped, SD_BUS_VTABLE_UNPRIVILEGED), SD_BUS_METHOD(Reexecute, NULL, NULL, method_reexecute, SD_BUS_VTABLE_UNPRIVILEGED), SD_BUS_METHOD(Exit, NULL, NULL, method_exit, 0), SD_BUS_METHOD(Reboot, NULL, NULL, method_reboot, SD_BUS_VTABLE_CAPABILITY(CAP_SYS_BOOT)), diff --git a/src/core/manager.c b/src/core/manager.c index cff24fa..4619ce3 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -616,6 +616,8 @@ int manager_new(SystemdRunningAs running_as, bool test_run, Manager **_m) { m-taint_usr = dir_is_empty(/usr) 0; +m-last_reload_time = 0ULL; + *_m = m; return 0; @@ -2444,9 +2446,12 @@ int manager_reload(Manager *m) { int r, q; _cleanup_fclose_ FILE *f = NULL; _cleanup_fdset_free_ FDSet *fds = NULL; +usec_t this_reload_time; assert(m); +this_reload_time = now(CLOCK_MONOTONIC); + r = manager_open_serialization(m, f); if (r 0) return r; @@ -2518,6 +2523,9 @@ int manager_reload(Manager *m) { m-send_reloading_done = true; +if (r = 0) +m-last_reload_time = this_reload_time; + return r; } diff --git a/src/core/manager.h b/src/core/manager.h index ab75f90..7790127 100644 --- a/src/core/manager.h +++
Re: [systemd-devel] systemd-networkd DHCPv6 Prefix Delegation
Patrik, do you have any plans for this? I agree, this is likely something we want. Tom On 30 Nov 2014 07:24, Anthony Messina amess...@messinet.com wrote: Does systemd-networkd provide the capability to request prefix delegation via DHCPv6? I haven't been able to find any information on this topic, and I don't see it in the TODO either. I'm thinking this might be a useful feature. Thanks. -A -- Anthony - https://messinet.com/ - https://messinet.com/~amessina/gallery 8F89 5E72 8DF0 BCF0 10BE 9967 92DC 35DC B001 4A4E ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] systemd.netdev: Tunnel should support ANY addresses for Local option
Yes, this makes sense, added to my todo. On 24 Nov 2014 20:38, William Kennington will...@wkennington.com wrote: Currently, networkd netdevs do not support tunnel devices which do not have a local address configured. This breaks the configuration of sit devices on my hosts which run dhcp for ipv4 configuration, which normally have local set to 0.0.0.0. Is there any chance we could remove the any check for the local endpoint address? Best, William ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] networkd: Support setting mtu / mac address by interface name
Yes, we could support a [Link] section in .network files applying such settings per network. Though that this should really be about overriding the link specific settings, so not sure it fits your usecase precisely... On 24 Nov 2014 20:46, William Kennington will...@wkennington.com wrote: I'd like to be able to set the MAC Address and MTU of interfaces, with just the interface name alone. The current method for matching links seems to be heavily tied to udev ATTRs and I understand given the nature of systemd.link that it might not make sense to Match based on name. However, I need this functionality to support mapping the current OS defined network configuration syntax to networkd. Is there any chance this could be supported in systemd.network instead of systemd.link? Regards, William ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH] daemon-reload timestamped: coalesce redundant daemon-reloads
On Tue, 02.12.14 13:19, Ken Sedgwick (ksedg...@bonsai.com) wrote: Systems with many units (~10K) take many seconds to perform a daemon-reload. The process of load-balancing these systems requires multiple daemon-reloads, many issued concurrently. Currently many of these redundant daemon-reloads timeout and fail. This patch adds a new systemd method ReloadTimestamped which contains the monotonic timestamp of the daemon-reload issuance. When a ReloadTimestamped message is handled it's timestamp is compared to the timestamp of the most recent successful daemon reload. If the message is redundant it is returns with success immediately. The original Reload method is preserved to support compatibility with older systemctl versions. If a new systemctl receives a SD_BUS_ERROR_UNKNOWN_METHOD error in response to ReloadTimestamped it retries with the original Reload method. I am quite sympathetic to the idea of this, but there's something that makes me feel uneasy about it: On kdbus the sender timestamp can be implicitly attached to incoming messages. This means that on kdbus systems we could implement this without adding a new bus call, just by relying on the implicit sender timestamp instead. Thus, if we'd apply your change like it is now, then this would be made redundant as soon as we switch to kdbus, which hopefully is within the next half year or so. Not sure what to do about this. I wished we could attach the sender timestamp in a nice way on dbus1 too, without having to actually send it along as message payload. i.e. a header extension on dbus1 or so, that is routed along by the daemon (maybe with some minimal validity verification in dbus-daemon, so that the client cannot fake a sender timestamp that is in the far future). Hmm, anyone has ideas for this? Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] how to properly control the daemons or run advanced cmds
On Tue, 02.12.14 10:30, Flavio Leitner (f...@redhat.com) wrote: Sort of. This special restart is only need on few cases when hot-upgrading, otherwise users expect full restart which is already accomplished by the current service unit. It seems to me that the solution is a mix of making two units and wrap the special upgrade in a separate script which would manage each daemon properly. Does that make sense to you? I am worried with the usability too, because I don't want the admin to worry about each daemon. I would rather have a single unit controlling both at the same time. It might be possible to have this 'front-end' unit to be one of the daemons and make it work as you described in (b) using Requires=. I will do some experiments later on. You can also create a target unit that combines both units into one. Call it openvswitch.target make it pull in your two service units, and then add PartOf= dependencies from them back to the target. Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] networkd: Support setting mtu / mac address by interface name
On Mon, 24.11.14 11:46, William Kennington (will...@wkennington.com) wrote: I'd like to be able to set the MAC Address and MTU of interfaces, with just the interface name alone. The current method for matching links seems to be heavily tied to udev ATTRs and I understand given the nature of systemd.link that it might not make sense to Match based on name. However, I need this functionality to support mapping the current OS defined network configuration syntax to networkd. Is there any chance this could be supported in systemd.network instead of systemd.link? Tom, I think it would make sense to allow Name= matches in the [Match] section of .link files, no? I mean, most of the times .link files are used to choose the name depending on other fields, but I think in all cases where the name is chosen at creation time of an interface (like for example for veth links), it should be Ok to match links based on the name they already have? Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] [PATCH] unit: ignore generated systemd-bootchart.service
--- units/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/units/.gitignore b/units/.gitignore index e12d299..3613cee 100644 --- a/units/.gitignore +++ b/units/.gitignore @@ -21,6 +21,7 @@ /systemd-ask-password-wall.service /systemd-backlight@.service /systemd-binfmt.service +/systemd-bootchart.service /systemd-bus-proxyd@.service /systemd-firstboot.service /systemd-fsck-root.service -- 1.9.3 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] [PATCH v4 1/4] bus: StartTransientUnit can have aux unit
On 12/04/2014 03:00 AM, Lennart Poettering wrote: On Tue, 02.12.14 23:29, WaLyong Cho (walyong@samsung.com) wrote: --- src/core/dbus-manager.c | 123 +--- 1 file changed, 105 insertions(+), 18 deletions(-) diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index 0994d7b..643aa8b 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -615,6 +615,93 @@ static int method_set_unit_properties(sd_bus *bus, sd_bus_message *message, void return bus_unit_method_set_properties(bus, message, u, error); } +static int transient_unit_from_message( +Manager *m, +sd_bus_message *message, +const char *name, +Unit **unit, +sd_bus_error *error) { + +Unit *u; +int r; + +assert(m); +assert(message); +assert(name); + +r = manager_load_unit(m, name, NULL, error, u); +if (r 0) +return r; + +if (u-load_state != UNIT_NOT_FOUND || +set_size(u-dependencies[UNIT_REFERENCED_BY]) 0) +return sd_bus_error_setf(error, + BUS_ERROR_UNIT_EXISTS, + Unit %s already exists., + name); Please do not line-break so eagerly. See CODING_STYLE, we do no follow a 80ch regime. + +static int try_aux_units_in_message( +Manager *m, +sd_bus_message *message, +sd_bus_error *error) { Why call this try? Maybe invoke it transient_aux_units_from_message() or so? if (r 0) return r; if (r == 0) -return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ +/* No authorization for now, but the async polkit + * stuff will call us again when it has it */ +return 1; Please don't rearrange lines that your patch doesn't really change. Please don't break lines too eagerly. r = sd_bus_message_read(message, ss, name, smode); if (r 0) @@ -639,34 +728,32 @@ static int method_start_transient_unit(sd_bus *bus, sd_bus_message *message, voi t = unit_name_to_type(name); if (t 0) -return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, Invalid unit type.); +return sd_bus_error_setf(error, + SD_BUS_ERROR_INVALID_ARGS, + Invalid unit type.); Same here... if (!unit_vtable[t]-can_transient) -return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, Unit type %s does not support transient units., unit_type_to_string(t)); - -mode = job_mode_from_string(smode); -if (mode 0) -return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, Job mode %s is invalid., smode); +return sd_bus_error_setf(error, + SD_BUS_ERROR_INVALID_ARGS, + Unit type %s does not support transient units., + unit_type_to_string(t)); Same here. r = mac_selinux_access_check(message, start, error); if (r 0) return r; -r = manager_load_unit(m, name, NULL, error, u); -if (r 0) -return r; - -if (u-load_state != UNIT_NOT_FOUND || set_size(u-dependencies[UNIT_REFERENCED_BY]) 0) -return sd_bus_error_setf(error, BUS_ERROR_UNIT_EXISTS, Unit %s already exists., name); +mode = job_mode_from_string(smode); +if (mode 0) +return sd_bus_error_setf(error, + SD_BUS_ERROR_INVALID_ARGS, + Job mode %s is invalid., + smode); Why did you move the parsing of the job mode after the selinux access check? I think we should validate all args before doing any further checks. -/* OK, the unit failed to load and is unreferenced, now let's - * fill in the transient data instead */ -r = unit_make_transient(u); +r = transient_unit_from_message(m, message, name, u, error); if (r 0) return r; -/* Set our properties */ -r = bus_unit_set_properties(u, message, UNIT_RUNTIME, false, error); +r = try_aux_units_in_message(m, message, error); if (r 0) return r; Hmm, the unit_load() invocation, isn't that something that should move into transient_unit_from_message() as well? The main transient unit should have