From: kremlin Date: Wed, 28 May 2014 01:45:02 +0000 (-0500) Subject: begin hostnamed, clean up X-Git-Tag: hostnamed-copyable~55 X-Git-Url: https://uglyman.kremlin.cc/gitweb/gitweb.cgi?a=commitdiff_plain;h=ea207ed3d155cde4001063c981f7a263c47daf64;p=systembsd.git begin hostnamed, clean up --- diff --git a/Makefile b/Makefile index 4870271..27bff7a 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ DEBUGF=-O0 -v -g SRCDIR=src MODDIR=$(SRCDIR)/modules -GLIBF=`pkg-config --cflags --libs glib-2.0 gobject-2.0` +GLIBF=`pkg-config --cflags --libs glib-2.0 gobject-2.0 gio-2.0` hostnamed: - gcc -o bin/out.bin $(CFLAGS) $(DEBUGF) $(GLIBF) $(SRCDIR)/main.c + gcc -o bin/out.bin $(DEBUGF) $(GLIBF) $(SRCDIR)/main.c diff --git a/src/main.c b/src/main.c index 5238699..2ff00fd 100644 --- a/src/main.c +++ b/src/main.c @@ -1,5 +1,7 @@ #include "modules/hostnamed/hostnamed.c" int main() { + hostnamed_init(); + for(;;) {} return 0; -} +} diff --git a/src/modules/hostnamed/hostnamed.c b/src/modules/hostnamed/hostnamed.c index ee25324..f3632f6 100644 --- a/src/modules/hostnamed/hostnamed.c +++ b/src/modules/hostnamed/hostnamed.c @@ -1,2 +1,35 @@ -#include +/* #include */ +#include + +static void on_bus_acquired(GDBusConnection *conn, const gchar *name, gpointer user_data) { + g_print("got bus, name: %s\n", name); + + /* g_print("at %p, data @ %p\n", (void*)conn, user_data); */ +} + +static void on_name_acquired(GDBusConnection *conn, const gchar *name, gpointer user_data) { + g_print("got name %s\n", name); + + /* g_print("at %p, data @ %p\n", (void*)conn, user_data); */ +} + +static void on_name_lost(GDBusConnection *conn, const gchar *name, gpointer user_data) { + g_print("lost name %s\n", name); + + /* g_print("at %p, data @ %p\n", (void*)conn, user_data); */ +} + +void hostnamed_init() { + guint bus_descriptor; + GError *err = NULL; + + bus_descriptor = g_bus_own_name(G_BUS_TYPE_SYSTEM, + (gchar *)"org.freedesktop.hostname1", + G_BUS_NAME_OWNER_FLAGS_NONE, + on_bus_acquired, + on_name_acquired, + on_name_lost, + NULL, + NULL); +} diff --git a/src/modules/hostnamed/tmp b/src/modules/hostnamed/tmp deleted file mode 100644 index c32d7ff..0000000 --- a/src/modules/hostnamed/tmp +++ /dev/null @@ -1 +0,0 @@ -TODO: delete me diff --git a/src/test.c b/src/test.c deleted file mode 100644 index 7a0d21a..0000000 --- a/src/test.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -#include - -int main() { - return 0; -}