MEDIUM: global: remove the relative_pid from global and mworker

The relative_pid is always 1. In mworker mode we also have a
child->relative_pid which is always equalt relative_pid, except for a
master (0) or external process (-1), but these types are usually tested
for, except for one place that was amended to carefully check for the
PROC_O_TYPE_WORKER option.

Changes were pretty limited as most usages of relative_pid were for
designating a process in stats output and peers protocol.
diff --git a/include/haproxy/global.h b/include/haproxy/global.h
index 274ec34..460de1f 100644
--- a/include/haproxy/global.h
+++ b/include/haproxy/global.h
@@ -28,7 +28,6 @@
 extern const char *build_features;
 extern struct global global;
 extern int  pid;                /* current process id */
-extern int  relative_pid;       /* process id starting at 1 */
 extern int  actconn;            /* # of active sessions */
 extern int  listeners;
 extern int  jobs;               /* # of active jobs (listeners, sessions, open devices) */
diff --git a/include/haproxy/mworker-t.h b/include/haproxy/mworker-t.h
index a84512b..dabdf81 100644
--- a/include/haproxy/mworker-t.h
+++ b/include/haproxy/mworker-t.h
@@ -39,7 +39,6 @@
 	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 */
diff --git a/src/cli.c b/src/cli.c
index ed2af9c..bc561cf 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -2159,12 +2159,10 @@
 		list_for_each_entry(child, &proc_list, list) {
 			if (!(child->options & PROC_O_TYPE_WORKER))
 				continue;
-			if (child->relative_pid == proc_pid){
-				if (child->reloads == 0)
-					return child->pid;
-				else if (chosen == NULL || child->reloads < chosen->reloads)
-					chosen = child;
-			}
+			if (child->reloads == 0)
+				return child->pid;
+			else if (chosen == NULL || child->reloads < chosen->reloads)
+				chosen = child;
 		}
 		if (chosen)
 			return chosen->pid;
@@ -2721,7 +2719,7 @@
 
 		/* we don't know the new pid yet */
 		if (child->pid == -1)
-			memprintf(&msg, "cur-%d", child->relative_pid);
+			memprintf(&msg, "cur-%d", 1);
 		else
 			memprintf(&msg, "old-%d", child->pid);
 
diff --git a/src/haproxy.c b/src/haproxy.c
index a507ec9..f8fdcc7 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -157,7 +157,6 @@
 /* list of config files */
 static struct list cfg_cfgfiles = LIST_HEAD_INIT(cfg_cfgfiles);
 int  pid;			/* current process id */
-int  relative_pid = 1;		/* process id starting at 1 */
 
 volatile unsigned long sleeping_thread_mask = 0; /* Threads that are about to sleep in poll() */
 volatile unsigned long stopping_thread_mask = 0; /* Threads acknowledged stopping */
@@ -821,7 +820,6 @@
 				     some SIGCHLD were lost */
 
 	global.nbthread = 1;
-	relative_pid = 1;
 
 #ifdef USE_THREAD
 	tid_bit = 1;
@@ -1909,7 +1907,6 @@
 			}
 			tmproc->options |= PROC_O_TYPE_MASTER; /* master */
 			tmproc->reloads = 0;
-			tmproc->relative_pid = 0;
 			tmproc->pid = pid;
 			tmproc->timestamp = start_date.tv_sec;
 			tmproc->ipc_fd[0] = -1;
@@ -1930,7 +1927,6 @@
 		tmproc->pid = -1;
 		tmproc->reloads = 0;
 		tmproc->timestamp = -1;
-		tmproc->relative_pid = 1;
 		tmproc->ipc_fd[0] = -1;
 		tmproc->ipc_fd[1] = -1;
 
@@ -3148,7 +3144,7 @@
 				exit(1); /* there has been an error */
 			}
 			else if (ret == 0) { /* child breaks here */
-				ha_random_jump96(relative_pid);
+				ha_random_jump96(1);
 			}
 			else { /* parent here */
 				in_parent = 1;
@@ -3161,11 +3157,10 @@
 				if (global.mode & MODE_MWORKER) {
 					struct mworker_proc *child;
 
-					ha_notice("New worker #%d (%d) forked\n", relative_pid, ret);
+					ha_notice("New worker #%d (%d) forked\n", 1, ret);
 					/* find the right mworker_proc */
 					list_for_each_entry(child, &proc_list, list) {
-						if (child->relative_pid == relative_pid &&
-						    child->reloads == 0 && child->options & PROC_O_TYPE_WORKER) {
+						if (child->reloads == 0 && child->options & PROC_O_TYPE_WORKER) {
 							child->timestamp = now.tv_sec;
 							child->pid = ret;
 							child->version = strdup(haproxy_version);
@@ -3242,7 +3237,7 @@
 				 * the bind_proc */
 				if (child->ipc_fd[0] >= 0)
 					close(child->ipc_fd[0]);
-				if (child->relative_pid == relative_pid &&
+				if (child->options & PROC_O_TYPE_WORKER &&
 				    child->reloads == 0) {
 					/* keep this struct if this is our pid */
 					proc_self = child;
diff --git a/src/mworker-prog.c b/src/mworker-prog.c
index 8d9ce3a..4a64662 100644
--- a/src/mworker-prog.c
+++ b/src/mworker-prog.c
@@ -156,7 +156,6 @@
 		ext_child->path = NULL;
 		ext_child->id = NULL;
 		ext_child->pid = -1;
-		ext_child->relative_pid = -1;
 		ext_child->reloads = 0;
 		ext_child->timestamp = -1;
 		ext_child->ipc_fd[0] = -1;
diff --git a/src/mworker.c b/src/mworker.c
index 991394c..7842db3 100644
--- a/src/mworker.c
+++ b/src/mworker.c
@@ -122,7 +122,7 @@
 			type = 'w';
 
 		if (child->pid > -1)
-			memprintf(&msg, "%s|type=%c;fd=%d;pid=%d;rpid=%d;reloads=%d;timestamp=%d;id=%s;version=%s", msg ? msg : "", type, child->ipc_fd[0], child->pid, child->relative_pid, child->reloads, child->timestamp, child->id ? child->id : "", child->version);
+			memprintf(&msg, "%s|type=%c;fd=%d;pid=%d;rpid=%d;reloads=%d;timestamp=%d;id=%s;version=%s", msg ? msg : "", type, child->ipc_fd[0], child->pid, 1, child->reloads, child->timestamp, child->id ? child->id : "", child->version);
 	}
 	if (msg)
 		setenv("HAPROXY_PROCESSES", msg, 1);
@@ -173,8 +173,6 @@
 				child->ipc_fd[0] = atoi(subtoken+3);
 			} else if (strncmp(subtoken, "pid=", 4) == 0) {
 				child->pid = atoi(subtoken+4);
-			} else if (strncmp(subtoken, "rpid=", 5) == 0) {
-				child->relative_pid = atoi(subtoken+5);
 			} else if (strncmp(subtoken, "reloads=", 8) == 0) {
 				/* we reloaded this process once more */
 				child->reloads = atoi(subtoken+8) + 1;
@@ -298,9 +296,9 @@
 			if (!(child->options & PROC_O_LEAVING)) {
 				if (child->options & PROC_O_TYPE_WORKER) {
 					if (status < 128)
-						ha_warning("Current worker #%d (%d) exited with code %d (%s)\n", child->relative_pid, exitpid, status, "Exit");
+						ha_warning("Current worker #%d (%d) exited with code %d (%s)\n", 1, exitpid, status, "Exit");
 					else
-						ha_alert("Current worker #%d (%d) exited with code %d (%s)\n", child->relative_pid, exitpid, status, strsignal(status - 128));
+						ha_alert("Current worker #%d (%d) exited with code %d (%s)\n", 1, exitpid, status, strsignal(status - 128));
 				}
 				else if (child->options & PROC_O_TYPE_PROG)
 					ha_alert("Current program '%s' (%d) exited with code %d (%s)\n", child->id, exitpid, status, (status >= 128) ? strsignal(status - 128) : "Exit");
@@ -315,7 +313,7 @@
 					exitcode = status;
 			} else {
 				if (child->options & PROC_O_TYPE_WORKER) {
-					ha_warning("Former worker #%d (%d) exited with code %d (%s)\n", child->relative_pid, exitpid, status, (status >= 128) ? strsignal(status - 128) : "Exit");
+					ha_warning("Former worker #%d (%d) exited with code %d (%s)\n", 1, exitpid, status, (status >= 128) ? strsignal(status - 128) : "Exit");
 					delete_oldpid(exitpid);
 				} else if (child->options & PROC_O_TYPE_PROG) {
 					ha_warning("Former program '%s' (%d) exited with code %d (%s)\n", child->id, exitpid, status, (status >= 128) ? strsignal(status - 128) : "Exit");
@@ -482,7 +480,7 @@
 			continue;
 		}
 		memprintf(&uptime, "%dd%02dh%02dm%02ds", up / 86400, (up % 86400) / 3600, (up % 3600) / 60, (up % 60));
-		chunk_appendf(&trash, "%-15u %-15s %-15u %-15d %-15s %-15s\n", child->pid, "worker", child->relative_pid, child->reloads, uptime, child->version);
+		chunk_appendf(&trash, "%-15u %-15s %-15u %-15d %-15s %-15s\n", child->pid, "worker", 1, child->reloads, uptime, child->version);
 		ha_free(&uptime);
 	}
 
@@ -499,7 +497,7 @@
 				continue;
 
 			if (child->options & PROC_O_LEAVING) {
-				memprintf(&msg, "[was: %u]", child->relative_pid);
+				memprintf(&msg, "[was: %u]", 1);
 				memprintf(&uptime, "%dd%02dh%02dm%02ds", up / 86400, (up % 86400) / 3600, (up % 3600) / 60, (up % 60));
 				chunk_appendf(&trash, "%-15u %-15s %-15s %-15d %-15s %-15s\n", child->pid, "worker", msg, child->reloads, uptime, child->version);
 				ha_free(&uptime);
diff --git a/src/peers.c b/src/peers.c
index 958404c..bb68a8e 100644
--- a/src/peers.c
+++ b/src/peers.c
@@ -567,7 +567,7 @@
 	min_ver = (peer->flags & PEER_F_DWNGRD) ? PEER_DWNGRD_MINOR_VER : PEER_MINOR_VER;
 	/* Prepare headers */
 	ret = snprintf(msg, size, PEER_SESSION_PROTO_NAME " %u.%u\n%s\n%s %d %d\n",
-	              PEER_MAJOR_VER, min_ver, peer->id, localpeer, (int)getpid(), relative_pid);
+	              PEER_MAJOR_VER, min_ver, peer->id, localpeer, (int)getpid(), 1);
 	if (ret >= size)
 		return 0;
 
diff --git a/src/sample.c b/src/sample.c
index 24f9d9d..d02034c 100644
--- a/src/sample.c
+++ b/src/sample.c
@@ -3950,7 +3950,7 @@
 smp_fetch_proc(const struct arg *args, struct sample *smp, const char *kw, void *private)
 {
 	smp->data.type = SMP_T_SINT;
-	smp->data.u.sint = relative_pid;
+	smp->data.u.sint = 1;
 	return 1;
 }
 
diff --git a/src/stats.c b/src/stats.c
index 1c0d45f..a35ef0d 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -87,7 +87,7 @@
 	[INF_RELEASE_DATE]                   = { .name = "Release_date",                .desc = "Date of latest source code update" },
 	[INF_NBTHREAD]                       = { .name = "Nbthread",                    .desc = "Number of started threads (global.nbthread)" },
 	[INF_NBPROC]                         = { .name = "Nbproc",                      .desc = "Number of started worker processes (historical, always 1)" },
-	[INF_PROCESS_NUM]                    = { .name = "Process_num",                 .desc = "Relative worker process number (1..Nbproc)" },
+	[INF_PROCESS_NUM]                    = { .name = "Process_num",                 .desc = "Relative worker process number (1)" },
 	[INF_PID]                            = { .name = "Pid",                         .desc = "This worker process identifier for the system" },
 	[INF_UPTIME]                         = { .name = "Uptime",                      .desc = "How long ago this worker process was started (days+hours+minutes+seconds)" },
 	[INF_UPTIME_SEC]                     = { .name = "Uptime_sec",                  .desc = "How long ago this worker process was started (seconds)" },
@@ -183,7 +183,7 @@
 	[ST_F_LASTCHG]                       = { .name = "lastchg",                     .desc = "How long ago the last server state changed, in seconds" },
 	[ST_F_DOWNTIME]                      = { .name = "downtime",                    .desc = "Total time spent in DOWN state, for server or backend" },
 	[ST_F_QLIMIT]                        = { .name = "qlimit",                      .desc = "Limit on the number of connections in queue, for servers only (maxqueue argument)" },
-	[ST_F_PID]                           = { .name = "pid",                         .desc = "Relative worker process number (1..nbproc)" },
+	[ST_F_PID]                           = { .name = "pid",                         .desc = "Relative worker process number (1)" },
 	[ST_F_IID]                           = { .name = "iid",                         .desc = "Frontend or Backend numeric identifier ('id' setting)" },
 	[ST_F_SID]                           = { .name = "sid",                         .desc = "Server numeric identifier ('id' setting)" },
 	[ST_F_THROTTLE]                      = { .name = "throttle",                    .desc = "Throttling ratio applied to a server's maxconn and weight during the slowstart period (0 to 100%)" },
@@ -1696,7 +1696,7 @@
 				metric = mkf_str(FO_STATUS, px->disabled ? "STOP" : "OPEN");
 				break;
 			case ST_F_PID:
-				metric = mkf_u32(FO_KEY, relative_pid);
+				metric = mkf_u32(FO_KEY, 1);
 				break;
 			case ST_F_IID:
 				metric = mkf_u32(FO_KEY|FS_SERVICE, px->uuid);
@@ -1911,7 +1911,7 @@
 				metric = mkf_str(FO_STATUS, li_status_st[get_li_status(l)]);
 				break;
 			case ST_F_PID:
-				metric = mkf_u32(FO_KEY, relative_pid);
+				metric = mkf_u32(FO_KEY, 1);
 				break;
 			case ST_F_IID:
 				metric = mkf_u32(FO_KEY|FS_SERVICE, px->uuid);
@@ -2259,7 +2259,7 @@
 					metric = mkf_u32(FO_CONFIG|FS_SERVICE, sv->maxqueue);
 				break;
 			case ST_F_PID:
-				metric = mkf_u32(FO_KEY, relative_pid);
+				metric = mkf_u32(FO_KEY, 1);
 				break;
 			case ST_F_IID:
 				metric = mkf_u32(FO_KEY|FS_SERVICE, px->uuid);
@@ -2638,7 +2638,7 @@
 					metric = mkf_u32(FN_COUNTER, be_downtime(px));
 				break;
 			case ST_F_PID:
-				metric = mkf_u32(FO_KEY, relative_pid);
+				metric = mkf_u32(FO_KEY, 1);
 				break;
 			case ST_F_IID:
 				metric = mkf_u32(FO_KEY|FS_SERVICE, px->uuid);
@@ -3339,7 +3339,7 @@
 		      (appctx->ctx.stats.flags & STAT_SHNODE) ? (uri->node ? uri->node : global.node) : "",
 	              (appctx->ctx.stats.flags & STAT_SHDESC) ? ": " : "",
 		      (appctx->ctx.stats.flags & STAT_SHDESC) ? (uri->desc ? uri->desc : global.desc) : "",
-	              pid, relative_pid, 1, global.nbthread,
+	              pid, 1, 1, global.nbthread,
 	              up / 86400, (up % 86400) / 3600,
 	              (up % 3600) / 60, (up % 60),
 	              global.rlimit_memmax ? ultoa(global.rlimit_memmax) : "unlimited",
@@ -4320,7 +4320,7 @@
 
 	info[INF_NBTHREAD]                       = mkf_u32(FO_CONFIG|FS_SERVICE, global.nbthread);
 	info[INF_NBPROC]                         = mkf_u32(FO_CONFIG|FS_SERVICE, 1);
-	info[INF_PROCESS_NUM]                    = mkf_u32(FO_KEY, relative_pid);
+	info[INF_PROCESS_NUM]                    = mkf_u32(FO_KEY, 1);
 	info[INF_PID]                            = mkf_u32(FO_STATUS, pid);
 
 	info[INF_UPTIME]                         = mkf_str(FN_DURATION, chunk_newstr(out));