irqbalance/0004-add-void-to-fix-strict-prototypes.patch

321 lines
8.3 KiB
Diff
Raw Permalink Normal View History

From b6a831d692ed7e12db7748db49b3b39516d151d2 Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Sun, 31 Mar 2024 14:31:22 -0700
Subject: [PATCH 04/44] add void to fix strict-prototypes
This becomes a hard error with C23
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
irqbalance.c | 2 +-
irqbalance.h | 2 +-
procinterrupts.c | 2 +-
ui/helpers.c | 2 +-
ui/helpers.h | 2 +-
ui/irqbalance-ui.c | 6 +++---
ui/irqbalance-ui.h | 5 ++---
ui/ui.c | 26 +++++++++++++-------------
ui/ui.h | 28 ++++++++++++++--------------
9 files changed, 37 insertions(+), 38 deletions(-)
diff --git a/irqbalance.c b/irqbalance.c
index 12302d7..373161f 100644
--- a/irqbalance.c
+++ b/irqbalance.c
@@ -544,7 +544,7 @@ out:
return TRUE;
}
-int init_socket()
+int init_socket(void)
{
struct sockaddr_un addr;
memset(&addr, 0, sizeof(struct sockaddr_un));
diff --git a/irqbalance.h b/irqbalance.h
index 7b47cd1..09daa3d 100644
--- a/irqbalance.h
+++ b/irqbalance.h
@@ -36,7 +36,7 @@ extern char *classes[];
extern void parse_cpu_tree(void);
extern void clear_work_stats(void);
extern void parse_proc_interrupts(void);
-extern GList* collect_full_irq_list();
+extern GList* collect_full_irq_list(void);
extern void parse_proc_stat(void);
extern void set_interrupt_count(int number, uint64_t count);
extern void set_msi_interrupt_numa(int number);
diff --git a/procinterrupts.c b/procinterrupts.c
index dfa95c6..e7ba653 100644
--- a/procinterrupts.c
+++ b/procinterrupts.c
@@ -206,7 +206,7 @@ void init_irq_class_and_type(char *savedline, struct irq_info *info, int irq)
info->name = strdup(irq_fullname);
}
-GList* collect_full_irq_list()
+GList* collect_full_irq_list(void)
{
GList *tmp_list = NULL;
FILE *file;
diff --git a/ui/helpers.c b/ui/helpers.c
index 0e9f76c..247f826 100644
--- a/ui/helpers.c
+++ b/ui/helpers.c
@@ -165,7 +165,7 @@ void dump_node(cpu_node_t *node, void *data __attribute__((unused)))
}
}
-void dump_tree()
+void dump_tree(void)
{
for_each_node(tree, dump_node, NULL);
}
diff --git a/ui/helpers.h b/ui/helpers.h
index b8d9fcc..922914b 100644
--- a/ui/helpers.h
+++ b/ui/helpers.h
@@ -25,7 +25,7 @@ void for_each_node(GList *list, void (*fp)(cpu_node_t *node, void *data), void *
void dump_irq(irq_t *irq, void *data __attribute__((unused)));
void dump_node(cpu_node_t *node, void *data __attribute__((unused)));
-void dump_tree();
+void dump_tree(void);
#endif /* HELPERS_H */
diff --git a/ui/irqbalance-ui.c b/ui/irqbalance-ui.c
index c26eff6..f5122ee 100644
--- a/ui/irqbalance-ui.c
+++ b/ui/irqbalance-ui.c
@@ -28,7 +28,7 @@ setup_t setup;
GMainLoop *main_loop;
static int default_bufsz = 8192;
-struct msghdr * create_credentials_msg()
+struct msghdr * create_credentials_msg(void)
{
struct ucred *credentials = malloc(sizeof(struct ucred));
credentials->pid = getpid();
@@ -51,7 +51,7 @@ struct msghdr * create_credentials_msg()
return msg;
}
-int init_connection()
+int init_connection(void)
{
struct sockaddr_un addr;
memset(&addr, 0, sizeof(struct sockaddr_un));
@@ -378,7 +378,7 @@ gboolean rescan_tree(gpointer data __attribute__((unused)))
free(irqbalance_data);
return TRUE;
}
-void scroll_window() {
+void scroll_window(void) {
switch(state) {
case STATE_TREE:
display_tree();
diff --git a/ui/irqbalance-ui.h b/ui/irqbalance-ui.h
index dc24083..178be4b 100644
--- a/ui/irqbalance-ui.h
+++ b/ui/irqbalance-ui.h
@@ -72,8 +72,8 @@ typedef struct setup {
/* Function prototypes */
-struct msghdr * create_credentials_msg();
-int init_connection();
+struct msghdr * create_credentials_msg(void);
+int init_connection(void);
void send_settings(char *data);
char * get_data(char *string);
void parse_setup(char *setup_data);
@@ -83,7 +83,6 @@ 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 */
diff --git a/ui/ui.c b/ui/ui.c
index 8354fc6..9fa990a 100644
--- a/ui/ui.c
+++ b/ui/ui.c
@@ -21,7 +21,7 @@ char *IRQ_CLASS_TO_STR[] = {
"10-Gigabit Ethernet",
"Virt Event"};
-void show_frame()
+void show_frame(void)
{
int i;
attrset(COLOR_PAIR(4));
@@ -37,7 +37,7 @@ void show_frame()
}
}
-void show_footer()
+void show_footer(void)
{
char footer[COLS];
snprintf(footer, COLS - 1,
@@ -172,7 +172,7 @@ void print_cpu_line(cpu_ban_t *cpu, void *data __attribute__((unused)))
max_offset++;
}
-void print_all_cpus()
+void print_all_cpus(void)
{
max_offset = 0;
if(all_cpus == NULL) {
@@ -193,7 +193,7 @@ void add_banned_cpu(int *banned_cpu, void *data)
snprintf(data + strlen(data), 1024 - strlen(data), "%d, ", *banned_cpu);
}
-void display_banned_cpus()
+void display_banned_cpus(void)
{
char banned_cpus[1024] = "Banned CPU numbers: \0";
if(g_list_length(setup.banned_cpus) > 0) {
@@ -247,7 +247,7 @@ void get_cpu(cpu_node_t *node, void *data __attribute__((unused)))
}
}
-void handle_cpu_banning()
+void handle_cpu_banning(void)
{
GList *tmp = g_list_copy_deep(all_cpus, copy_cpu_ban, NULL);
attrset(COLOR_PAIR(5));
@@ -504,7 +504,7 @@ void print_irq_line(irq_t *irq, void *data __attribute__((unused)))
mvprintw(line, 120, "%s", irq_name[line]);
}
-void print_all_irqs()
+void print_all_irqs(void)
{
max_offset = 0;
attrset(COLOR_PAIR(0));
@@ -555,13 +555,13 @@ void copy_irqs_from_nodes(cpu_node_t *node, void *data __attribute__((unused)))
}
}
-void get_all_irqs()
+void get_all_irqs(void)
{
all_irqs = g_list_copy_deep(setup.banned_irqs, copy_irq, NULL);
for_each_node(tree, copy_irqs_from_nodes, NULL);
}
-void handle_irq_banning()
+void handle_irq_banning(void)
{
GList *tmp = g_list_copy_deep(all_irqs, copy_irq, NULL);
attrset(COLOR_PAIR(5));
@@ -670,7 +670,7 @@ void handle_irq_banning()
}
}
-void handle_sleep_setting()
+void handle_sleep_setting(void)
{
char info[128] = "Current sleep interval between rebalancing: \0";
uint8_t sleep_input_offset = strlen(info) + 3;
@@ -693,7 +693,7 @@ void handle_sleep_setting()
refresh();
}
-void init()
+void init(void)
{
signal(SIGINT, close_window);
initscr();
@@ -732,7 +732,7 @@ void close_window(int sig __attribute__((unused)))
exit(EXIT_SUCCESS);
}
-void settings()
+void settings(void)
{
clear();
char *setup_data = get_data(SETUP);
@@ -751,7 +751,7 @@ void settings()
free(setup_data);
}
-void setup_irqs()
+void setup_irqs(void)
{
clear();
get_all_irqs();
@@ -830,7 +830,7 @@ void display_tree_node(cpu_node_t *node, void *data)
}
}
-void display_tree()
+void display_tree(void)
{
clear();
char *setup_data = get_data(SETUP);
diff --git a/ui/ui.h b/ui/ui.h
index da5b4b9..f3485d4 100644
--- a/ui/ui.h
+++ b/ui/ui.h
@@ -17,40 +17,40 @@ extern setup_t setup;
extern int offset;
extern int max_offset;
-void show_frame();
-void show_footer();
+void show_frame(void);
+void show_footer(void);
char * check_control_in_sleep_input(int max_len, int column_offest, int line_offset);
int get_valid_sleep_input(int column_offest);
void get_banned_cpu(int *cpu, void *data);
void print_cpu_line(cpu_ban_t *cpu, void *data);
-void print_all_cpus();
+void print_all_cpus(void);
void add_banned_cpu(int *banned_cpu, void *data);
-void display_banned_cpus();
+void display_banned_cpus(void);
int toggle_cpu(GList *cpu_list, int cpu_number);
void get_new_cpu_ban_values(cpu_ban_t *cpu, void *data);
-void get_cpu();
-void handle_sleep_setting();
-void handle_cpu_banning();
+void get_cpu(cpu_node_t *node, void *data);
+void handle_sleep_setting(void);
+void handle_cpu_banning(void);
void copy_assigned_obj(int *number, void *data);
void print_assigned_objects_string(irq_t *irq, int *line_offset);
void print_irq_line(irq_t *irq, void *data);
-void print_all_irqs();
+void print_all_irqs(void);
int toggle_irq(GList *irq_list, int position);
void get_new_irq_ban_values(irq_t *irq, void *data);
void copy_irqs_from_nodes(cpu_node_t *node, void *data);
-void get_all_irqs();
-void handle_irq_banning();
+void get_all_irqs(void);
+void handle_irq_banning(void);
-void init();
+void init(void);
void close_window(int sig);
-void settings();
-void setup_irqs();
+void settings(void);
+void setup_irqs(void);
void display_tree_node_irqs(irq_t *irq, void *data);
void display_tree_node(cpu_node_t *node, void *data);
-void display_tree();
+void display_tree(void);
#endif /* UI_H */
--
2.47.0