#include <grp.h>
#include <pwd.h>
#include <sys/stat.h>
+#include <stdio.h>
#include <libdaemon/dfork.h>
#include <libdaemon/dsignal.h>
g_assert(s);
g_assert(config);
+#ifdef ENABLE_DBUS
+ if (config->enable_dbus)
+ dbus_protocol_server_state_changed(state);
+#endif
+
if (state == AVAHI_SERVER_RUNNING) {
avahi_log_info("Server startup complete. Host name is <%s>", avahi_server_get_host_name_fqdn(s));
static_service_add_to_server();
avahi_server_set_host_name(s, n);
g_free(n);
}
+
+
}
static void help(FILE *f, const gchar *argv0) {
daemon_log(log_level_map[level], "%s", txt);
}
+static void dump(const gchar *text, gpointer userdata) {
+ avahi_log_info("%s", text);
+}
+
static gboolean signal_callback(GIOChannel *source, GIOCondition condition, gpointer data) {
gint sig;
GMainLoop *loop = data;
break;
+ case SIGUSR1:
+ avahi_log_info("Got SIGUSR1, dumping record data.");
+ avahi_server_dump(avahi_server, dump, NULL);
+ break;
+
default:
avahi_log_warn("Got spurious signal, ignoring.");
break;
loop = g_main_loop_new(NULL, FALSE);
- if (daemon_signal_init(SIGINT, SIGQUIT, SIGHUP, SIGTERM, 0) < 0) {
+ if (daemon_signal_init(SIGINT, SIGQUIT, SIGHUP, SIGTERM, SIGUSR1, 0) < 0) {
avahi_log_error("Could not register signal handlers (%s).", strerror(errno));
goto finish;
}
}
static const char* pid_file_proc(void) {
- return AVAHI_RUNTIME_DIR"/avahi-daemon.pid";
+ return AVAHI_DAEMON_RUNTIME_DIR"/pid";
}
static gint make_runtime_dir(void) {
u = umask(0000);
reset_umask = TRUE;
- if (mkdir(AVAHI_RUNTIME_DIR, 0755) < 0 && errno != EEXIST) {
- avahi_log_error("mkdir(\""AVAHI_RUNTIME_DIR"\"): %s", strerror(errno));
+ if (mkdir(AVAHI_DAEMON_RUNTIME_DIR, 0755) < 0 && errno != EEXIST) {
+ avahi_log_error("mkdir(\""AVAHI_DAEMON_RUNTIME_DIR"\"): %s", strerror(errno));
goto fail;
}
- chown(AVAHI_RUNTIME_DIR, pw->pw_uid, gr->gr_gid);
+ chown(AVAHI_DAEMON_RUNTIME_DIR, pw->pw_uid, gr->gr_gid);
- if (stat(AVAHI_RUNTIME_DIR, &st) < 0) {
+ if (stat(AVAHI_DAEMON_RUNTIME_DIR, &st) < 0) {
avahi_log_error("stat(): %s\n", strerror(errno));
goto fail;
}
if (!S_ISDIR(st.st_mode) || st.st_uid != pw->pw_uid || st.st_gid != gr->gr_gid) {
- avahi_log_error("Failed to create runtime directory "AVAHI_RUNTIME_DIR".");
+ avahi_log_error("Failed to create runtime directory "AVAHI_DAEMON_RUNTIME_DIR".");
goto fail;
}