extern struct global global;
extern int pid; /* current process id */
extern int relative_pid; /* process id starting at 1 */
+extern unsigned long pid_bit; /* bit corresponding to the process id */
extern int actconn; /* # of active sessions */
extern int listeners;
extern int jobs; /* # of active jobs (listeners, sessions, open devices) */
static struct list cfg_cfgfiles = LIST_HEAD_INIT(cfg_cfgfiles);
int pid; /* current process id */
int relative_pid = 1; /* process id starting at 1 */
+unsigned long pid_bit = 1; /* bit corresponding to the process id */
/* global options */
struct global global = {
shut_your_big_mouth_gcc(write(pidfd, pidstr, strlen(pidstr)));
}
relative_pid++; /* each child will get a different one */
+ pid_bit <<= 1;
}
#ifdef USE_CPU_AFFINITY
if (listener->state == LI_LISTEN) {
if ((global.mode & (MODE_DAEMON | MODE_MWORKER)) &&
listener->bind_conf->bind_proc &&
- !(listener->bind_conf->bind_proc & (1UL << (relative_pid - 1)))) {
+ !(listener->bind_conf->bind_proc & pid_bit)) {
/* we don't want to enable this listener and don't
* want any fd event to reach it.
*/
if ((global.mode & (MODE_DAEMON | MODE_MWORKER)) &&
l->bind_conf->bind_proc &&
- !(l->bind_conf->bind_proc & (1UL << (relative_pid - 1))))
+ !(l->bind_conf->bind_proc & pid_bit))
goto end;
if (l->state == LI_ASSIGNED) {
int bk_f_forced_id, srv_f_forced_id;
/* we don't want to report any state if the backend is not enabled on this process */
- if (px->bind_proc && !(px->bind_proc & (1UL << (relative_pid - 1))))
+ if (px->bind_proc && !(px->bind_proc & pid_bit))
return 1;
if (!appctx->ctx.cli.p1)
continue;
/* we don't want to list a backend which is bound to this process */
- if (curproxy->bind_proc && !(curproxy->bind_proc & (1UL << (relative_pid - 1))))
+ if (curproxy->bind_proc && !(curproxy->bind_proc & pid_bit))
continue;
chunk_appendf(&trash, "%s\n", curproxy->id);