Copyright 2011 Lennart Poettering
systemd is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ 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
- General Public License for more details.
+ Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
+ You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
" <property name=\"Timestamp\" type=\"t\" access=\"read\"/>\n" \
" <property name=\"TimestampMonotonic\" type=\"t\" access=\"read\"/>\n" \
" <property name=\"RuntimePath\" type=\"s\" access=\"read\"/>\n" \
- " <property name=\"ControlGroupPath\" type=\"s\" access=\"read\"/>\n" \
" <property name=\"Service\" type=\"s\" access=\"read\"/>\n" \
+ " <property name=\"Slice\" type=\"s\" access=\"read\"/>\n" \
" <property name=\"Display\" type=\"(so)\" access=\"read\"/>\n" \
" <property name=\"State\" type=\"s\" access=\"read\"/>\n" \
" <property name=\"Sessions\" type=\"a(so)\" access=\"read\"/>\n" \
" <property name=\"IdleHint\" type=\"b\" access=\"read\"/>\n" \
" <property name=\"IdleSinceHint\" type=\"t\" access=\"read\"/>\n" \
" <property name=\"IdleSinceHintMonotonic\" type=\"t\" access=\"read\"/>\n" \
- " </interface>\n" \
+ " </interface>\n"
#define INTROSPECTION \
DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE \
DBusMessageIter sub;
User *u = data;
const char *id, *path;
- char *p = NULL;
+ _cleanup_free_ char *p = NULL;
assert(i);
assert(property);
}
if (!dbus_message_iter_append_basic(&sub, DBUS_TYPE_STRING, &id) ||
- !dbus_message_iter_append_basic(&sub, DBUS_TYPE_OBJECT_PATH, &path)) {
- free(p);
+ !dbus_message_iter_append_basic(&sub, DBUS_TYPE_OBJECT_PATH, &path))
return -ENOMEM;
- }
-
- free(p);
if (!dbus_message_iter_close_container(i, &sub))
return -ENOMEM;
assert(path);
assert(_u);
- if (!startswith(path, "/org/freedesktop/login1/user/"))
+ if (!startswith(path, "/org/freedesktop/login1/user/_"))
return -EINVAL;
- r = safe_atolu(path + 29, &lu);
+ r = safe_atolu(path + 30, &lu);
if (r < 0)
return r;
{ "Timestamp", bus_property_append_usec, "t", offsetof(User, timestamp.realtime) },
{ "TimestampMonotonic", bus_property_append_usec, "t", offsetof(User, timestamp.monotonic) },
{ "RuntimePath", bus_property_append_string, "s", offsetof(User, runtime_path), true },
- { "ControlGroupPath", bus_property_append_string, "s", offsetof(User, cgroup_path), true },
{ "Service", bus_property_append_string, "s", offsetof(User, service), true },
+ { "Slice", bus_property_append_string, "s", offsetof(User, slice), true },
{ "Display", bus_user_append_display, "(so)", 0 },
{ "State", bus_user_append_state, "s", 0 },
{ "Sessions", bus_user_append_sessions, "a(so)", 0 },
DBusMessage *message) {
DBusError error;
- DBusMessage *reply = NULL;
+ _cleanup_dbus_message_unref_ DBusMessage *reply = NULL;
int r;
assert(u);
}
if (reply) {
- if (!dbus_connection_send(connection, reply, NULL))
+ if (!bus_maybe_send_reply(connection, message, reply))
goto oom;
-
- dbus_message_unref(reply);
}
return DBUS_HANDLER_RESULT_HANDLED;
oom:
- if (reply)
- dbus_message_unref(reply);
-
dbus_error_free(&error);
return DBUS_HANDLER_RESULT_NEED_MEMORY;
assert(u);
- if (asprintf(&s, "/org/freedesktop/login1/user/%llu", (unsigned long long) u->uid) < 0)
+ if (asprintf(&s, "/org/freedesktop/login1/user/_%llu", (unsigned long long) u->uid) < 0)
return NULL;
return s;
}
int user_send_signal(User *u, bool new_user) {
- DBusMessage *m;
- int r = -ENOMEM;
- char *p = NULL;
+ _cleanup_dbus_message_unref_ DBusMessage *m = NULL;
+ _cleanup_free_ char *p = NULL;
uint32_t uid;
assert(u);
p = user_bus_path(u);
if (!p)
- goto finish;
+ return -ENOMEM;
uid = u->uid;
DBUS_TYPE_UINT32, &uid,
DBUS_TYPE_OBJECT_PATH, &p,
DBUS_TYPE_INVALID))
- goto finish;
+ return -ENOMEM;
if (!dbus_connection_send(u->manager->bus, m, NULL))
- goto finish;
-
- r = 0;
-
-finish:
- dbus_message_unref(m);
- free(p);
+ return -ENOMEM;
- return r;
+ return 0;
}
int user_send_changed(User *u, const char *properties) {
- DBusMessage *m;
- int r = -ENOMEM;
- char *p = NULL;
+ _cleanup_dbus_message_unref_ DBusMessage *m = NULL;
+ _cleanup_free_ char *p = NULL;
assert(u);
m = bus_properties_changed_new(p, "org.freedesktop.login1.User", properties);
if (!m)
- goto finish;
+ return -ENOMEM;
if (!dbus_connection_send(u->manager->bus, m, NULL))
- goto finish;
-
- r = 0;
-
-finish:
- if (m)
- dbus_message_unref(m);
- free(p);
+ return -ENOMEM;
- return r;
+ return 0;
}