summaryrefslogtreecommitdiff
path: root/systemd/_daemon.c
diff options
context:
space:
mode:
Diffstat (limited to 'systemd/_daemon.c')
-rw-r--r--systemd/_daemon.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/systemd/_daemon.c b/systemd/_daemon.c
index 90cf205..fe6d890 100644
--- a/systemd/_daemon.c
+++ b/systemd/_daemon.c
@@ -317,14 +317,17 @@ static PyObject* is_socket_inet(PyObject *self, PyObject *args) {
return PyBool_FromLong(r);
}
-#ifdef HAVE_IS_SOCKET_SOCKADDR
PyDoc_STRVAR(is_socket_sockaddr__doc__,
"_is_socket_sockaddr(fd, address, type=0, flowinfo=0, listening=-1) -> bool\n\n"
"Wraps sd_is_socket_inet_sockaddr(3).\n"
+#ifdef HAVE_IS_SOCKET_SOCKADDR
"`address` is a systemd-style numerical IPv4 or IPv6 address as used in\n"
"ListenStream=. A port may be included after a colon (\":\"). See\n"
"systemd.socket(5) for details.\n\n"
"Constants for `family` are defined in the socket module."
+#else
+ "NOT SUPPORTED: compiled without support sd_socket_sockaddr"
+#endif
);
static PyObject* is_socket_sockaddr(PyObject *self, PyObject *args) {
@@ -357,13 +360,17 @@ static PyObject* is_socket_sockaddr(PyObject *self, PyObject *args) {
addr.in6.sin6_flowinfo = flowinfo;
}
+#ifdef HAVE_IS_SOCKET_SOCKADDR
r = sd_is_socket_sockaddr(fd, type, &addr.sa, addr_len, listening);
if (set_error(r, NULL, NULL) < 0)
return NULL;
return PyBool_FromLong(r);
-}
+#else
+ set_error(-ENOSYS, NULL, "Compiled without support for sd_is_socket_sockaddr");
+ return NULL;
#endif
+}
PyDoc_STRVAR(is_socket_unix__doc__,
"_is_socket_unix(fd, type, listening, path) -> bool\n\n"
@@ -408,9 +415,7 @@ static PyMethodDef methods[] = {
{ "_is_mq", is_mq, METH_VARARGS, is_mq__doc__},
{ "_is_socket", is_socket, METH_VARARGS, is_socket__doc__},
{ "_is_socket_inet", is_socket_inet, METH_VARARGS, is_socket_inet__doc__},
-#ifdef HAVE_IS_SOCKET_SOCKADDR
{ "_is_socket_sockaddr", is_socket_sockaddr, METH_VARARGS, is_socket_sockaddr__doc__},
-#endif
{ "_is_socket_unix", is_socket_unix, METH_VARARGS, is_socket_unix__doc__},
{} /* Sentinel */
};