-/* $OpenBSD: engine.c,v 1.16 2020/05/20 10:37:02 claudio Exp $ */
+/* $OpenBSD: engine.c,v 1.17 2021/01/19 16:53:27 florian Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
if (chdir("/") == -1)
fatal("chdir(\"/\")");
- rad_process = PROC_ENGINE;
- setproctitle("%s", log_procnames[rad_process]);
- log_procinit(log_procnames[rad_process]);
+ setproctitle("%s", "engine");
+ log_procinit("engine");
if (setgroups(1, &pw->pw_gid) ||
setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) ||
-/* $OpenBSD: frontend.c,v 1.36 2021/01/18 15:20:28 florian Exp $ */
+/* $OpenBSD: frontend.c,v 1.37 2021/01/19 16:53:27 florian Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
if (chdir("/") == -1)
fatal("chdir(\"/\")");
- rad_process = PROC_FRONTEND;
- setproctitle("%s", log_procnames[rad_process]);
- log_procinit(log_procnames[rad_process]);
+ setproctitle("%s", "frontend");
+ log_procinit("frontend");
if (setgroups(1, &pw->pw_gid) ||
setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) ||
-/* $OpenBSD: rad.c,v 1.24 2020/12/01 17:31:37 florian Exp $ */
+/* $OpenBSD: rad.c,v 1.25 2021/01/19 16:53:27 florian Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
#include "engine.h"
#include "control.h"
+enum rad_process {
+ PROC_MAIN,
+ PROC_ENGINE,
+ PROC_FRONTEND
+};
+
__dead void usage(void);
__dead void main_shutdown(void);
void main_sig_handler(int, short, void *);
-static pid_t start_child(int, char *, int, int, int);
+static pid_t start_child(enum rad_process, char *, int, int, int);
void main_dispatch_frontend(int, short, void *);
void main_dispatch_engine(int, short, void *);
frontend_pid = start_child(PROC_FRONTEND, saved_argv0,
pipe_main2frontend[1], debug, cmd_opts & OPT_VERBOSE);
- rad_process = PROC_MAIN;
- log_procinit(log_procnames[rad_process]);
+ log_procinit("main");
event_init();
}
static pid_t
-start_child(int p, char *argv0, int fd, int debug, int verbose)
+start_child(enum rad_process p, char *argv0, int fd, int debug, int verbose)
{
char *argv[6];
int argc = 0;
-/* $OpenBSD: rad.h,v 1.19 2020/12/01 17:31:37 florian Exp $ */
+/* $OpenBSD: rad.h,v 1.20 2021/01/19 16:53:27 florian Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
#define IMSG_DATA_SIZE(imsg) ((imsg).hdr.len - IMSG_HEADER_SIZE)
-enum {
- PROC_MAIN,
- PROC_ENGINE,
- PROC_FRONTEND
-} rad_process;
-
-static const char * const log_procnames[] = {
- "main",
- "engine",
- "frontend",
-};
-
struct imsgev {
struct imsgbuf ibuf;
void (*handler)(int, short, void *);