synthesize.c revision 4afd3348c7506dd1d36305b7bcb9feb8952b9d6b
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2010 Lennart Poettering
Copyright 2013 Daniel Mack
Copyright 2014 Kay Sievers
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 <stddef.h>
#include "sd-bus.h"
#include "bus-internal.h"
#include "bus-match.h"
#include "bus-message.h"
#include "bus-util.h"
#include "synthesize.h"
#include "util.h"
int r;
assert(b);
assert(m);
r = bus_message_append_sender(m, "org.freedesktop.DBus");
if (r < 0)
return r;
r = bus_seal_synthetic_message(b, m);
if (r < 0)
return r;
return sd_bus_send(b, m, NULL);
}
int r;
return 0;
r = sd_bus_message_new_method_error(call, &m, e);
if (r < 0)
return r;
}
int synthetic_reply_method_errorf(sd_bus_message *call, const char *name, const char *format, ...) {
}
return 0;
if (sd_bus_error_is_set(p))
return synthetic_reply_method_error(call, p);
}
return 0;
}
int r;
return 0;
r = sd_bus_message_new_method_return(call, &m);
if (r < 0)
return r;
if (r < 0)
return r;
}
}
int r;
return 0;
r = sd_bus_message_new_method_return(call, &m);
if (r < 0)
r = sd_bus_message_append_strv(m, l);
if (r < 0)
}
int r;
assert(p);
assert(a);
assert(b);
assert(m);
/* If we get NameOwnerChanged for our own name, we need to
* synthesize NameLost/NameAcquired, since socket clients need
* that, even though it is obsoleted on kdbus */
if (!a->is_kernel)
return 0;
return 0;
if (r < 0)
return r;
r = sd_bus_message_rewind(m, true);
if (r < 0)
return r;
b,
&n,
"/org/freedesktop/DBus",
"org.freedesktop.DBus",
"NameLost");
b,
&n,
"/org/freedesktop/DBus",
"org.freedesktop.DBus",
"NameAcquired");
} else
return 0;
if (r < 0)
return r;
if (r < 0)
return r;
r = bus_message_append_sender(n, "org.freedesktop.DBus");
if (r < 0)
return r;
r = sd_bus_message_set_destination(n, a->unique_name);
if (r < 0)
return r;
r = bus_seal_synthetic_message(b, n);
if (r < 0)
return r;
return sd_bus_send(b, n, NULL);
}