From b5abe5bd5d70ccccac09eed21771bea692e19144 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 4 Jun 2020 14:07:37 +0200 Subject: [PATCH] REORG: include: move mworker.h to haproxy/mworker{,-t}.h One function prototype makes reference to struct mworker_proc which was not defined there but in global.h instead. This definition, along with the PROC_O_* fields were moved to mworker-t.h instead. --- include/haproxy/mworker-t.h | 51 ++++++++++++++++++++++++++++ include/{proto => haproxy}/mworker.h | 10 +++--- include/types/global.h | 30 ---------------- src/cli.c | 1 + src/haproxy.c | 2 +- src/mworker-prog.c | 2 +- src/mworker.c | 2 +- 7 files changed, 61 insertions(+), 37 deletions(-) create mode 100644 include/haproxy/mworker-t.h rename include/{proto => haproxy}/mworker.h (83%) diff --git a/include/haproxy/mworker-t.h b/include/haproxy/mworker-t.h new file mode 100644 index 000000000..7712d285a --- /dev/null +++ b/include/haproxy/mworker-t.h @@ -0,0 +1,51 @@ +/* + * include/haproxy/mworker-t.h + * Master Worker type definitions. + * + * Copyright HAProxy Technologies 2019 - William Lallemand + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + */ + +#ifndef _HAPROXY_MWORKER_T_H_ +#define _HAPROXY_MWORKER_T_H_ + +#include +#include + +/* options for mworker_proc */ + +#define PROC_O_TYPE_MASTER 0x00000001 +#define PROC_O_TYPE_WORKER 0x00000002 +#define PROC_O_TYPE_PROG 0x00000004 +/* 0x00000008 unused */ +#define PROC_O_LEAVING 0x00000010 /* this process should be leaving */ +/* 0x00000020 to 0x00000080 unused */ +#define PROC_O_START_RELOAD 0x00000100 /* Start the process even if the master was re-executed */ + +/* + * Structure used to describe the processes in master worker mode + */ +struct server; +struct mworker_proc { + int pid; + int options; + char *id; + char **command; + char *path; + char *version; + int ipc_fd[2]; /* 0 is master side, 1 is worker side */ + int relative_pid; + int reloads; + int timestamp; + struct server *srv; /* the server entry in the master proxy */ + struct list list; + int uid; + int gid; +}; + +#endif /* _HAPROXY_MWORKER_T_H_ */ diff --git a/include/proto/mworker.h b/include/haproxy/mworker.h similarity index 83% rename from include/proto/mworker.h rename to include/haproxy/mworker.h index 595cc1950..6d115ecf5 100644 --- a/include/proto/mworker.h +++ b/include/haproxy/mworker.h @@ -1,5 +1,6 @@ /* - * Master Worker + * include/haproxy/mworker-t.h + * Master Worker function prototypes. * * Copyright HAProxy Technologies 2019 - William Lallemand * @@ -10,9 +11,10 @@ * */ -#ifndef PROTO_MWORKER_H_ -#define PROTO_MWORKER_H_ +#ifndef _HAPROXY_MWORKER_H_ +#define _HAPROXY_MWORKER_H_ +#include #include void mworker_proc_list_to_env(); @@ -39,4 +41,4 @@ void mworker_kill_max_reloads(int sig); void mworker_free_child(struct mworker_proc *); -#endif /* PROTO_MWORKER_H_ */ +#endif /* _HAPROXY_MWORKER_H_ */ diff --git a/include/types/global.h b/include/types/global.h index a00712c07..9e60851c4 100644 --- a/include/types/global.h +++ b/include/types/global.h @@ -181,36 +181,6 @@ struct global { #endif }; -/* options for mworker_proc */ - -#define PROC_O_TYPE_MASTER 0x00000001 -#define PROC_O_TYPE_WORKER 0x00000002 -#define PROC_O_TYPE_PROG 0x00000004 -/* 0x00000008 unused */ -#define PROC_O_LEAVING 0x00000010 /* this process should be leaving */ -/* 0x00000020 to 0x00000080 unused */ -#define PROC_O_START_RELOAD 0x00000100 /* Start the process even if the master was re-executed */ - -/* - * Structure used to describe the processes in master worker mode - */ -struct mworker_proc { - int pid; - int options; - char *id; - char **command; - char *path; - char *version; - int ipc_fd[2]; /* 0 is master side, 1 is worker side */ - int relative_pid; - int reloads; - int timestamp; - struct server *srv; /* the server entry in the master proxy */ - struct list list; - int uid; - int gid; -}; - extern struct global global; extern int pid; /* current process id */ extern int relative_pid; /* process id starting at 1 */ diff --git a/src/cli.c b/src/cli.c index 71e37f79d..db1900dd3 100644 --- a/src/cli.c +++ b/src/cli.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include diff --git a/src/haproxy.c b/src/haproxy.c index 1b5de8332..a15412396 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -92,6 +92,7 @@ #include #include #include +#include #include #include #include @@ -120,7 +121,6 @@ #include #include #include -#include #include #include #include diff --git a/src/mworker-prog.c b/src/mworker-prog.c index 4951063d5..0a448beab 100644 --- a/src/mworker-prog.c +++ b/src/mworker-prog.c @@ -23,9 +23,9 @@ #include #include #include +#include #include -#include static int use_program = 0; /* do we use the program section ? */ diff --git a/src/mworker.c b/src/mworker.c index 4f5ade24a..fda50527c 100644 --- a/src/mworker.c +++ b/src/mworker.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -31,7 +32,6 @@ #include #include #include -#include #include #include #include