chiark / gitweb /
Add some extra __attribute__ ((format)) s
[elogind.git] / src / core / socket.c
index d6d531d377fee5e40954a89caf78e712b5d1759d..c276afe38f185c0e80af720cb3092f6c99b97325 100644 (file)
@@ -46,7 +46,7 @@
 #include "dbus-socket.h"
 #include "missing.h"
 #include "special.h"
-#include "bus-errors.h"
+#include "dbus-common.h"
 #include "label.h"
 #include "exit-status.h"
 #include "def.h"
@@ -1447,7 +1447,7 @@ static void socket_enter_running(Socket *s, int cfd) {
 
         /* We don't take connections anymore if we are supposed to
          * shut down anyway */
-        if (unit_pending_inactive(UNIT(s))) {
+        if (unit_stop_pending(UNIT(s))) {
                 log_debug_unit(UNIT(s)->id,
                                "Suppressing connection request on %s since unit stop is scheduled.",
                                UNIT(s)->id);
@@ -1478,7 +1478,7 @@ static void socket_enter_running(Socket *s, int cfd) {
                 /* If there's already a start pending don't bother to
                  * do anything */
                 SET_FOREACH(u, UNIT(s)->dependencies[UNIT_TRIGGERS], i)
-                        if (unit_pending_active(u)) {
+                        if (unit_active_or_pending(u)) {
                                 pending = true;
                                 break;
                         }
@@ -1969,6 +1969,28 @@ static const char *socket_sub_state_to_string(Unit *u) {
         return socket_state_to_string(SOCKET(u)->state);
 }
 
+const char* socket_port_type_to_string(SocketPort *p) {
+
+        assert(p);
+
+        switch (p->type) {
+                case SOCKET_SOCKET:
+                        switch (p->address.type) {
+                                case SOCK_STREAM: return "Stream";
+                                case SOCK_DGRAM: return "Datagram";
+                                case SOCK_SEQPACKET: return "SequentialPacket";
+                                case SOCK_RAW:
+                                        if (socket_address_family(&p->address) == AF_NETLINK)
+                                                return "Netlink";
+                                default: return "Invalid";
+                        }
+                case SOCKET_SPECIAL: return "Special";
+                case SOCKET_MQUEUE: return "MessageQueue";
+                case SOCKET_FIFO: return "FIFO";
+                default: return NULL;
+        }
+}
+
 static bool socket_check_gc(Unit *u) {
         Socket *s = SOCKET(u);