58 lines
1.7 KiB
Diff
58 lines
1.7 KiB
Diff
From ce806df0081cf09344197285e32bd2113d86f554 Mon Sep 17 00:00:00 2001
|
|
From: Kairui Song <kasong@redhat.com>
|
|
Date: Mon, 3 Sep 2018 00:30:14 +0800
|
|
Subject: [PATCH 23/58] Fix irqbalance ui failing to connect to irqbalance
|
|
daemon
|
|
|
|
irqbalance ui is faling due to the changes in commit 19c25dd.
|
|
This patch align irqbalance-ui's socket connecting routine with
|
|
irqbalance.c
|
|
---
|
|
ui/irqbalance-ui.c | 16 +++++++++++-----
|
|
ui/irqbalance-ui.h | 1 +
|
|
2 files changed, 12 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/ui/irqbalance-ui.c b/ui/irqbalance-ui.c
|
|
index 47dd5dc..5a76ddf 100644
|
|
--- a/ui/irqbalance-ui.c
|
|
+++ b/ui/irqbalance-ui.c
|
|
@@ -57,12 +57,18 @@ int init_connection()
|
|
}
|
|
addr.sun_family = AF_UNIX;
|
|
char socket_name[64];
|
|
- snprintf(socket_name, 64, "%s%d.sock", SOCKET_PATH, irqbalance_pid);
|
|
- strncpy(addr.sun_path, socket_name, strlen(addr.sun_path));
|
|
|
|
- if(connect(socket_fd, (struct sockaddr *)&addr,
|
|
- sizeof(sa_family_t) + strlen(socket_name) + 1) < 0) {
|
|
- return 0;
|
|
+ snprintf(socket_name, 64, "%s/%s%d.sock", SOCKET_TMPFS, SOCKET_PATH, irqbalance_pid);
|
|
+ strncpy(addr.sun_path, socket_name, strlen(socket_name));
|
|
+
|
|
+ if(connect(socket_fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
|
|
+ /* Try connect to abstract */
|
|
+ memset(&addr, 0, sizeof(struct sockaddr_un));
|
|
+ addr.sun_family = AF_UNIX;
|
|
+ if (connect(socket_fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
|
|
+ return 0;
|
|
+ }
|
|
+
|
|
}
|
|
|
|
return socket_fd;
|
|
diff --git a/ui/irqbalance-ui.h b/ui/irqbalance-ui.h
|
|
index f97fcb1..b32d58a 100644
|
|
--- a/ui/irqbalance-ui.h
|
|
+++ b/ui/irqbalance-ui.h
|
|
@@ -8,6 +8,7 @@
|
|
#include <glib-unix.h>
|
|
|
|
#define SOCKET_PATH "irqbalance"
|
|
+#define SOCKET_TMPFS "/var/run"
|
|
|
|
#define STATS "stats"
|
|
#define SET_SLEEP "settings sleep "
|
|
--
|
|
1.8.3.1
|
|
|