irqbalance/ui/irqbalance-ui.h
Neil Horman f5ca2eb481 fix socket path creation
based on this bug:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=915834

It seems that setting the Temp file system to ro overly restricts access
to it such that other applications (like ssh), can't function properly.
That seems like a error to fix in systemd to me, but regardless we
obviously cant use TempDirectory=/path:ro if its going to impact other
applications like that.

Instead specify a specific RuntimeDirectory that systemd can clean up
for us, and modify irqbalance and irqbalance-ui to create the comms
socket there.

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
2019-01-14 09:58:52 -05:00

88 lines
1.7 KiB
C

#ifndef IRQBALANCE_UI_H
#define IRQBALANCE_UI_H
#include <stdio.h>
#include <stdint.h>
#include <glib.h>
#include <glib-unix.h>
#define SOCKET_PATH "irqbalance"
#define SOCKET_TMPFS "/run/irqbalance"
#define STATS "stats"
#define SET_SLEEP "settings sleep "
#define BAN_IRQS "settings ban irqs "
#define SETUP "setup"
/* IRQ CLASSES (same as irqbalance uses) */
#define IRQ_NODEF -1
#define IRQ_OTHER 0
#define IRQ_LEGACY 1
#define IRQ_SCSI 2
#define IRQ_VIDEO 3
#define IRQ_ETH 4
#define IRQ_GBETH 5
#define IRQ_10GBETH 6
#define IRQ_VIRT_EVENT 7
/* Typedefs */
typedef enum node_type {
OBJ_TYPE_CPU,
OBJ_TYPE_CACHE,
OBJ_TYPE_PACKAGE,
OBJ_TYPE_NODE
} node_type_e;
typedef struct irq {
int vector;
uint64_t load;
uint64_t diff;
char is_banned;
GList *assigned_to;
int class;
} irq_t;
typedef struct cpu_node {
node_type_e type;
int number;
uint64_t load;
int is_powersave;
struct cpu_node *parent;
GList *children;
GList *irqs;
GList *cpu_list;
char *cpu_mask;
} cpu_node_t;
typedef struct cpu_ban {
int number;
char is_banned;
} cpu_ban_t;
typedef struct setup {
uint64_t sleep;
GList *banned_irqs;
GList *banned_cpus;
} setup_t;
/* Function prototypes */
struct msghdr * create_credentials_msg();
int init_connection();
void send_settings(char *data);
char * get_data(char *string);
void parse_setup(char *setup_data);
GList * concat_child_lists(cpu_node_t *node);
void copy_cpu_list_to_irq(irq_t *irq, void *data);
void assign_cpu_lists(cpu_node_t *node, void *data);
void assign_cpu_mask(cpu_node_t *node, void *data);
void parse_into_tree(char *data);
gboolean rescan_tree(gpointer data);
int main();
#endif /* IRQBALANCE_UI_H */