dbus-job.c revision ac45dec934b0932d03fbd498a3c6e8e90a01813f
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2010 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 "log.h"
#include "sd-bus.h"
#include "selinux-access.h"
#include "job.h"
#include "dbus-job.h"
#include "dbus.h"
int r;
return 0; /* One of the job owners is calling us */
if (r < 0)
return r;
if (r == 0)
/* Root has called us */
return 0;
}
static int property_get_unit(
const char *path,
const char *interface,
const char *property,
void *userdata,
sd_bus_error *error) {
_cleanup_free_ char *p = NULL;
assert(j);
p = unit_dbus_path(j->unit);
if (!p)
return -ENOMEM;
}
int bus_job_method_cancel(sd_bus *bus, sd_bus_message *message, void *userdata, sd_bus_error *error) {
int r;
assert(j);
if (r < 0)
return r;
if (r < 0)
return r;
job_finish_and_invalidate(j, JOB_CANCELED, true);
}
const sd_bus_vtable bus_job_vtable[] = {
SD_BUS_PROPERTY("JobType", "s", property_get_type, offsetof(Job, type), SD_BUS_VTABLE_PROPERTY_CONST),
SD_BUS_PROPERTY("State", "s", property_get_state, offsetof(Job, state), SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
};
_cleanup_free_ char *p = NULL;
int r;
assert(j);
p = job_dbus_path(j);
if (!p)
return -ENOMEM;
bus,
&m,
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
"JobNew");
if (r < 0)
return r;
if (r < 0)
return r;
}
_cleanup_free_ char *p = NULL;
assert(j);
p = job_dbus_path(j);
if (!p)
return -ENOMEM;
}
void bus_job_send_change_signal(Job *j) {
int r;
assert(j);
if (j->in_dbus_queue) {
j->in_dbus_queue = false;
}
r = bus_foreach_bus(j->manager, j->clients, j->sent_dbus_new_signal ? send_changed_signal : send_new_signal, j);
if (r < 0)
j->sent_dbus_new_signal = true;
}
_cleanup_free_ char *p = NULL;
int r;
assert(j);
p = job_dbus_path(j);
if (!p)
return -ENOMEM;
bus,
&m,
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
"JobRemoved");
if (r < 0)
return r;
if (r < 0)
return r;
}
void bus_job_send_removed_signal(Job *j) {
int r;
assert(j);
if (!j->sent_dbus_new_signal)
if (r < 0)
}