sd-rtnl.c revision 98dd77e86e0cc339543cc8711ff908e6929f0636
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2013 Tom Gundersen <teg@jklm.no>
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 <poll.h>
#include "macro.h"
#include "util.h"
#include "sd-rtnl.h"
#include "rtnl-internal.h"
if (!rtnl)
return -ENOMEM;
return 0;
}
int r;
r = sd_rtnl_new(&rtnl);
if (r < 0)
return r;
return -errno;
if (r < 0)
return -errno;
return 0;
}
if (rtnl)
return rtnl;
}
}
return NULL;
}
sd_rtnl_message **ret) {
struct pollfd p[1] = {};
int r, serial;
if (r < 0)
return r;
timeout = 0;
else if (usec == 0)
else
for (;;) {
if (timeout) {
usec_t n;
n = now(CLOCK_MONOTONIC);
if (n >= timeout)
return -ETIMEDOUT;
}
if (r < 0)
return 0;
if (r < 0)
return r;
if (r > 0) {
break;
}
}
for (;;) {
if (timeout) {
usec_t n;
n = now(CLOCK_MONOTONIC);
if (n >= timeout)
return -ETIMEDOUT;
}
if (r < 0)
return r;
if (r < 0)
return r;
if (r > 0) {
if (received_serial == serial) {
r = message_get_errno(reply);
if (r < 0)
return r;
if (ret) {
}
break;;
}
}
}
return 0;
}