logind-user-dbus.c revision 927b1649448b812a7620ad013f4752d597b12407
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2011 Lennart Poettering
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/>.
***/
#include <errno.h>
#include <string.h>
#include "strv.h"
#include "bus-util.h"
#include "logind.h"
#include "logind-user.h"
static int property_get_display(
const char *path,
const char *interface,
const char *property,
void *userdata) {
_cleanup_free_ char *p = NULL;
assert(u);
if (!p)
return -ENOMEM;
}
static int property_get_state(
const char *path,
const char *interface,
const char *property,
void *userdata) {
assert(u);
}
static int property_get_sessions(
const char *path,
const char *interface,
const char *property,
void *userdata) {
int r;
assert(u);
if (r < 0)
return r;
_cleanup_free_ char *p = NULL;
p = session_bus_path(session);
if (!p)
return -ENOMEM;
if (r < 0)
return r;
}
if (r < 0)
return r;
return 1;
}
static int property_get_idle_hint(
const char *path,
const char *interface,
const char *property,
void *userdata) {
assert(u);
}
static int property_get_idle_since_hint(
const char *path,
const char *interface,
const char *property,
void *userdata) {
uint64_t k;
assert(u);
user_get_idle_hint(u, &t);
}
static int property_get_linger(
const char *path,
const char *interface,
const char *property,
void *userdata) {
int r;
assert(u);
r = user_check_linger_file(u);
}
int r;
assert(u);
r = user_stop(u);
if (r < 0)
}
int r;
assert(u);
if (r < 0)
return sd_bus_reply_method_errorf(bus, message, SD_BUS_ERROR_INVALID_ARGS, "Invalid signal %i", signo);
if (r < 0)
}
const sd_bus_vtable user_vtable[] = {
SD_BUS_PROPERTY("Sessions", "a(so)", property_get_sessions, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
SD_BUS_PROPERTY("IdleSinceHint", "t", property_get_idle_since_hint, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
SD_BUS_PROPERTY("IdleSinceHintMonotonic", "t", property_get_idle_since_hint, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
};
int user_object_find(sd_bus *bus, const char *path, const char *interface, void **found, void *userdata) {
int r;
assert(m);
if (!message)
return 0;
if (r < 0)
return 0;
if (r <= 0)
return 0;
} else {
unsigned long lu;
const char *p;
if (!p)
return 0;
r = safe_atolu(p, &lu);
if (r < 0)
return 0;
if (!user)
return 0;
}
return 1;
}
char *user_bus_path(User *u) {
char *s;
assert(u);
return NULL;
return s;
}
_cleanup_strv_free_ char **l = NULL;
Iterator i;
int r;
char *p;
p = user_bus_path(user);
if (!p)
return -ENOMEM;
r = strv_push(&l, p);
if (r < 0) {
free(p);
return r;
}
}
*nodes = l;
l = NULL;
return 1;
}
_cleanup_free_ char *p = NULL;
assert(u);
p = user_bus_path(u);
if (!p)
return -ENOMEM;
return sd_bus_emit_signal(
"/org/freedesktop/login1",
"org.freedesktop.login1.Manager",
}
_cleanup_free_ char *p = NULL;
char **l;
assert(u);
if (!u->started)
return 0;
p = user_bus_path(u);
if (!p)
return -ENOMEM;
}