Compare commits
No commits in common. "e2b40db616b4e723036f72a726e2f2f31d35ffe1" and "6d95e7d9b263c94e94704e3125cb790840b76ca2" have entirely different histories.
e2b40db616
...
6d95e7d9b2
|
@ -146,10 +146,8 @@
|
||||||
</tgroup>
|
</tgroup>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<para>For types <literal>s</literal> and <literal>g</literal> (unicode string or signature), the pointer
|
<para>For types "s" and "g" (unicode string or signature), the pointer may be
|
||||||
may be <constant>NULL</constant>, which is equivalent to an empty string. For <literal>h</literal> (UNIX
|
<constant>NULL</constant>, which is equivalent to an empty string. See
|
||||||
file descriptor), the descriptor is duplicated by this call and the passed descriptor stays in possession
|
|
||||||
of the caller. See
|
|
||||||
<citerefentry><refentrytitle>sd_bus_message_append_basic</refentrytitle><manvolnum>3</manvolnum></citerefentry>
|
<citerefentry><refentrytitle>sd_bus_message_append_basic</refentrytitle><manvolnum>3</manvolnum></citerefentry>
|
||||||
for the precise interpretation of those and other types.</para>
|
for the precise interpretation of those and other types.</para>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
|
@ -73,10 +73,7 @@
|
||||||
should be read. See the table below for a complete list of allowed arguments and their types. Note that,
|
should be read. See the table below for a complete list of allowed arguments and their types. Note that,
|
||||||
if the basic type is a pointer (e.g., <type>const char *</type> in the case of a string), the argument is
|
if the basic type is a pointer (e.g., <type>const char *</type> in the case of a string), the argument is
|
||||||
a pointer to a pointer, and also the pointer value that is written is only borrowed and the contents must
|
a pointer to a pointer, and also the pointer value that is written is only borrowed and the contents must
|
||||||
be copied if they are to be used after the end of the messages lifetime. If the type is
|
be copied if they are to be used after the end of the messages lifetime.</para>
|
||||||
<literal>h</literal> (UNIX file descriptor), the descriptor is not duplicated by this call and the
|
|
||||||
returned descriptor remains in possession of the message object, and needs to be duplicated by the caller
|
|
||||||
in order to keep an open reference to it after the message object is freed.</para>
|
|
||||||
|
|
||||||
<para>Each argument may also be <constant>NULL</constant>, in which case the value is read and ignored.
|
<para>Each argument may also be <constant>NULL</constant>, in which case the value is read and ignored.
|
||||||
</para>
|
</para>
|
||||||
|
@ -231,15 +228,6 @@ const char *s, *t, *u;
|
||||||
|
|
||||||
sd_bus_message_read(m, "a{is}", 3, &i, &s, &j, &t, &k, &u);
|
sd_bus_message_read(m, "a{is}", 3, &i, &s, &j, &t, &k, &u);
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
|
||||||
<para>Read a single file descriptor, and duplicate it in order to keep it open after the message is
|
|
||||||
freed.</para>
|
|
||||||
|
|
||||||
<programlisting>sd_bus_message *m;
|
|
||||||
int fd, fd_copy;
|
|
||||||
|
|
||||||
sd_bus_message_read(m, "h", &fd);
|
|
||||||
fd_copy = fcntl(fd, FD_DUPFD_CLOEXEC, 3);</programlisting>
|
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
<refsect1>
|
<refsect1>
|
||||||
|
|
|
@ -52,19 +52,17 @@
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
If <parameter>p</parameter> is not <constant>NULL</constant>, it should contain a pointer to an
|
If <parameter>p</parameter> is not <constant>NULL</constant>, it should contain
|
||||||
appropriate object. For example, if <parameter>type</parameter> is <constant>'y'</constant>, the object
|
a pointer to an appropriate object. For example, if <parameter>type</parameter>
|
||||||
passed in <parameter>p</parameter> should have type <type>uint8_t *</type>. If
|
is <constant>'y'</constant>, the object passed in <parameter>p</parameter>
|
||||||
<parameter>type</parameter> is <constant>'s'</constant>, the object passed in <parameter>p</parameter>
|
should have type <type>uint8_t *</type>. If <parameter>type</parameter> is
|
||||||
should have type <type>const char **</type>. Note that, if the basic type is a pointer (e.g.,
|
<constant>'s'</constant>, the object passed in <parameter>p</parameter> should
|
||||||
<type>const char *</type> in the case of a string), the pointer is only borrowed and the contents must
|
have type <type>const char **</type>. Note that, if the basic type is a pointer
|
||||||
be copied if they are to be used after the end of the messages lifetime. Similarly, during the lifetime
|
(e.g., <type>const char *</type> in the case of a string), the pointer is only
|
||||||
of such a pointer, the message must not be modified. If <parameter>type</parameter> is
|
borrowed and the contents must be copied if they are to be used after the end
|
||||||
<constant>'h'</constant> (UNIX file descriptor), the descriptor is not duplicated by this call and the
|
of the messages lifetime. Similarly, during the lifetime of such a pointer, the
|
||||||
returned descriptor remains in possession of the message object, and needs to be duplicated by the caller
|
message must not be modified. See the table below for a complete list of allowed
|
||||||
in order to keep an open reference to it after the message object is freed (for example by calling
|
types.
|
||||||
<literal>fcntl(fd, FD_DUPFD_CLOEXEC, 3)</literal>). See the table below for a complete list of
|
|
||||||
allowed types.
|
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<table id='format-specifiers'>
|
<table id='format-specifiers'>
|
||||||
|
|
|
@ -1045,7 +1045,7 @@ static int home_start_work(Home *h, const char *verb, UserRecord *hr, UserRecord
|
||||||
homework = getenv("SYSTEMD_HOMEWORK_PATH") ?: SYSTEMD_HOMEWORK_PATH;
|
homework = getenv("SYSTEMD_HOMEWORK_PATH") ?: SYSTEMD_HOMEWORK_PATH;
|
||||||
|
|
||||||
execl(homework, homework, verb, NULL);
|
execl(homework, homework, verb, NULL);
|
||||||
log_error_errno(errno, "Failed to invoke %s: %m", homework);
|
log_error_errno(errno, "Failed to invoke " SYSTEMD_HOMEWORK_PATH ": %m");
|
||||||
_exit(EXIT_FAILURE);
|
_exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -364,14 +364,6 @@ void dns_transaction_complete(DnsTransaction *t, DnsTransactionState state) {
|
||||||
dns_transaction_gc(t);
|
dns_transaction_gc(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dns_transaction_complete_errno(DnsTransaction *t, int error) {
|
|
||||||
assert(t);
|
|
||||||
assert(error != 0);
|
|
||||||
|
|
||||||
t->answer_errno = abs(error);
|
|
||||||
dns_transaction_complete(t, DNS_TRANSACTION_ERRNO);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int dns_transaction_pick_server(DnsTransaction *t) {
|
static int dns_transaction_pick_server(DnsTransaction *t) {
|
||||||
DnsServer *server;
|
DnsServer *server;
|
||||||
|
|
||||||
|
@ -423,8 +415,10 @@ static void dns_transaction_retry(DnsTransaction *t, bool next_server) {
|
||||||
dns_scope_next_dns_server(t->scope);
|
dns_scope_next_dns_server(t->scope);
|
||||||
|
|
||||||
r = dns_transaction_go(t);
|
r = dns_transaction_go(t);
|
||||||
if (r < 0)
|
if (r < 0) {
|
||||||
dns_transaction_complete_errno(t, r);
|
t->answer_errno = -r;
|
||||||
|
dns_transaction_complete(t, DNS_TRANSACTION_ERRNO);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dns_transaction_maybe_restart(DnsTransaction *t) {
|
static int dns_transaction_maybe_restart(DnsTransaction *t) {
|
||||||
|
@ -472,8 +466,10 @@ static void on_transaction_stream_error(DnsTransaction *t, int error) {
|
||||||
dns_transaction_retry(t, true);
|
dns_transaction_retry(t, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (error != 0)
|
if (error != 0) {
|
||||||
dns_transaction_complete_errno(t, error);
|
t->answer_errno = error;
|
||||||
|
dns_transaction_complete(t, DNS_TRANSACTION_ERRNO);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dns_transaction_on_stream_packet(DnsTransaction *t, DnsPacket *p) {
|
static int dns_transaction_on_stream_packet(DnsTransaction *t, DnsPacket *p) {
|
||||||
|
@ -840,7 +836,8 @@ static void dns_transaction_process_dnssec(DnsTransaction *t) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
dns_transaction_complete_errno(t, r);
|
t->answer_errno = -r;
|
||||||
|
dns_transaction_complete(t, DNS_TRANSACTION_ERRNO);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int dns_transaction_has_positive_answer(DnsTransaction *t, DnsAnswerFlags *flags) {
|
static int dns_transaction_has_positive_answer(DnsTransaction *t, DnsAnswerFlags *flags) {
|
||||||
|
@ -1172,7 +1169,8 @@ void dns_transaction_process_reply(DnsTransaction *t, DnsPacket *p) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
dns_transaction_complete_errno(t, r);
|
t->answer_errno = -r;
|
||||||
|
dns_transaction_complete(t, DNS_TRANSACTION_ERRNO);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int on_dns_packet(sd_event_source *s, int fd, uint32_t revents, void *userdata) {
|
static int on_dns_packet(sd_event_source *s, int fd, uint32_t revents, void *userdata) {
|
||||||
|
@ -1184,7 +1182,7 @@ static int on_dns_packet(sd_event_source *s, int fd, uint32_t revents, void *use
|
||||||
assert(t->scope);
|
assert(t->scope);
|
||||||
|
|
||||||
r = manager_recv(t->scope->manager, fd, DNS_PROTOCOL_DNS, &p);
|
r = manager_recv(t->scope->manager, fd, DNS_PROTOCOL_DNS, &p);
|
||||||
if (ERRNO_IS_DISCONNECT(r)) {
|
if (ERRNO_IS_DISCONNECT(-r)) {
|
||||||
usec_t usec;
|
usec_t usec;
|
||||||
|
|
||||||
/* UDP connection failures get reported via ICMP and then are possibly delivered to us on the
|
/* UDP connection failures get reported via ICMP and then are possibly delivered to us on the
|
||||||
|
@ -1198,7 +1196,8 @@ static int on_dns_packet(sd_event_source *s, int fd, uint32_t revents, void *use
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
dns_transaction_complete_errno(t, r);
|
dns_transaction_complete(t, DNS_TRANSACTION_ERRNO);
|
||||||
|
t->answer_errno = -r;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (r == 0)
|
if (r == 0)
|
||||||
|
@ -1737,7 +1736,7 @@ int dns_transaction_go(DnsTransaction *t) {
|
||||||
dns_transaction_complete(t, DNS_TRANSACTION_RR_TYPE_UNSUPPORTED);
|
dns_transaction_complete(t, DNS_TRANSACTION_RR_TYPE_UNSUPPORTED);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (t->scope->protocol == DNS_PROTOCOL_LLMNR && ERRNO_IS_DISCONNECT(r)) {
|
if (t->scope->protocol == DNS_PROTOCOL_LLMNR && ERRNO_IS_DISCONNECT(-r)) {
|
||||||
/* On LLMNR, if we cannot connect to a host via TCP when doing reverse lookups. This means we cannot
|
/* On LLMNR, if we cannot connect to a host via TCP when doing reverse lookups. This means we cannot
|
||||||
* answer this request with this protocol. */
|
* answer this request with this protocol. */
|
||||||
dns_transaction_complete(t, DNS_TRANSACTION_NOT_FOUND);
|
dns_transaction_complete(t, DNS_TRANSACTION_NOT_FOUND);
|
||||||
|
@ -1834,7 +1833,7 @@ static int dns_transaction_add_dnssec_transaction(DnsTransaction *t, DnsResource
|
||||||
|
|
||||||
r = set_ensure_put(&t->dnssec_transactions, NULL, aux);
|
r = set_ensure_put(&t->dnssec_transactions, NULL, aux);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;;
|
||||||
|
|
||||||
r = set_ensure_put(&aux->notify_transactions, NULL, t);
|
r = set_ensure_put(&aux->notify_transactions, NULL, t);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
|
|
|
@ -3402,7 +3402,7 @@ static int run(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ERRNO_IS_RESOURCE(r))
|
if (ERRNO_IS_RESOURCE(-r))
|
||||||
return r;
|
return r;
|
||||||
if (invalid_config)
|
if (invalid_config)
|
||||||
return EX_DATAERR;
|
return EX_DATAERR;
|
||||||
|
|
Loading…
Reference in New Issue