Re: [PATCH 06/24] perf daemon: Add config file support

From: Namhyung Kim
Date: Fri Feb 05 2021 - 07:19:28 EST


On Sun, Jan 31, 2021 at 8:49 AM Jiri Olsa <jolsa@xxxxxxxxxx> wrote:
[SNIP]
> @@ -263,9 +605,16 @@ static int __cmd_start(struct daemon *daemon, struct option parent_options[],
> signal(SIGTERM, sig_handler);
>
> while (!done && !err) {
> - if (fdarray__poll(&fda, -1)) {
> + err = daemon__reconfig(daemon);

I think it's confusing since you put the reconfig function here.
What not split normal and reconfig passes?

I mean something like below

__cmd_start()
{
setup_server_config();
daemon__run();

while (!done && !err) {
...
if (reconfig) {
daemon__kill();
setup_server_config();
daemon__reconfig();
}
}

Thanks,
Namhyung


> +
> + if (!err && fdarray__poll(&fda, -1)) {
> + bool reconfig = false;
> +
> if (fda.entries[sock_pos].revents & POLLIN)
> err = handle_server_socket(daemon, sock_fd);
> +
> + if (reconfig)
> + err = setup_server_config(daemon);
> }
> }
>
> --
> 2.29.2
>