mirror of
https://github.com/systemd/systemd.git
synced 2025-01-10 05:18:17 +03:00
sd-netlink: add a read function
Will be used by nftables nfnetlink backend. It sends a series of netlink messages that form a nftables update transaction. The transaction will then generate a series of ack messages (or an error). This function will be used to read these acks.
This commit is contained in:
parent
99c41c0de4
commit
4df42cd99d
@ -621,21 +621,15 @@ int sd_netlink_call_async(
|
||||
return k;
|
||||
}
|
||||
|
||||
int sd_netlink_call(sd_netlink *rtnl,
|
||||
sd_netlink_message *message,
|
||||
uint64_t usec,
|
||||
sd_netlink_message **ret) {
|
||||
int sd_netlink_read(sd_netlink *rtnl,
|
||||
uint32_t serial,
|
||||
uint64_t usec,
|
||||
sd_netlink_message **ret) {
|
||||
usec_t timeout;
|
||||
uint32_t serial;
|
||||
int r;
|
||||
|
||||
assert_return(rtnl, -EINVAL);
|
||||
assert_return(!rtnl_pid_changed(rtnl), -ECHILD);
|
||||
assert_return(message, -EINVAL);
|
||||
|
||||
r = sd_netlink_send(rtnl, message, &serial);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
timeout = calc_elapse(usec);
|
||||
|
||||
@ -705,6 +699,24 @@ int sd_netlink_call(sd_netlink *rtnl,
|
||||
}
|
||||
}
|
||||
|
||||
int sd_netlink_call(sd_netlink *rtnl,
|
||||
sd_netlink_message *message,
|
||||
uint64_t usec,
|
||||
sd_netlink_message **ret) {
|
||||
uint32_t serial;
|
||||
int r;
|
||||
|
||||
assert_return(rtnl, -EINVAL);
|
||||
assert_return(!rtnl_pid_changed(rtnl), -ECHILD);
|
||||
assert_return(message, -EINVAL);
|
||||
|
||||
r = sd_netlink_send(rtnl, message, &serial);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
return sd_netlink_read(rtnl, serial, usec, ret);
|
||||
}
|
||||
|
||||
int sd_netlink_get_events(const sd_netlink *rtnl) {
|
||||
assert_return(rtnl, -EINVAL);
|
||||
assert_return(!rtnl_pid_changed(rtnl), -ECHILD);
|
||||
|
@ -66,6 +66,7 @@ int sd_netlink_call_async(sd_netlink *nl, sd_netlink_slot **ret_slot, sd_netlink
|
||||
void *userdata, uint64_t usec, const char *description);
|
||||
int sd_netlink_call(sd_netlink *nl, sd_netlink_message *message, uint64_t timeout,
|
||||
sd_netlink_message **reply);
|
||||
int sd_netlink_read(sd_netlink *nl, uint32_t serial, uint64_t timeout, sd_netlink_message **reply);
|
||||
|
||||
int sd_netlink_get_events(const sd_netlink *nl);
|
||||
int sd_netlink_get_timeout(const sd_netlink *nl, uint64_t *timeout);
|
||||
|
Loading…
Reference in New Issue
Block a user