CLEANUP: mworker: remove the type field in mworker_proc
Since the introduction of the options field, we can use it to store the
type of process.
type = 'm' is replaced by PROC_O_TYPE_MASTER
type = 'w' is replaced by PROC_O_TYPE_WORKER
type = 'e' is replaced by PROC_O_TYPE_PROG
The old values are still used in the HAPROXY_PROCESSES environment
variable to pass the information during a reload.
diff --git a/src/haproxy.c b/src/haproxy.c
index 517c62f..935ad32 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -608,7 +608,7 @@
next_argv[next_argc++] = "-sf";
list_for_each_entry(child, &proc_list, list) {
- if (child->type != 'w' && child->type != 'e')
+ if (!(child->options & (PROC_O_TYPE_WORKER|PROC_O_TYPE_PROG)))
continue;
next_argv[next_argc] = memprintf(&msg, "%d", child->pid);
if (next_argv[next_argc] == NULL)
@@ -1601,7 +1601,7 @@
ha_alert("Cannot allocate process structures.\n");
exit(EXIT_FAILURE);
}
- tmproc->type = 'm'; /* master */
+ tmproc->options |= PROC_O_TYPE_MASTER; /* master */
tmproc->reloads = 0;
tmproc->relative_pid = 0;
tmproc->pid = pid;
@@ -1622,7 +1622,7 @@
exit(EXIT_FAILURE);
}
- tmproc->type = 'w'; /* worker */
+ tmproc->options |= PROC_O_TYPE_WORKER; /* worker */
tmproc->pid = -1;
tmproc->reloads = 0;
tmproc->timestamp = -1;
@@ -2864,7 +2864,7 @@
/* find the right mworker_proc */
list_for_each_entry(child, &proc_list, list) {
if (child->relative_pid == relative_pid &&
- child->reloads == 0 && child->type == 'w') {
+ child->reloads == 0 && child->options & PROC_O_TYPE_WORKER) {
child->timestamp = now.tv_sec;
child->pid = ret;
break;