#include "config.h"
#endif
-#define _GNU_SOURCE
#include <assert.h>
#include <errno.h>
#include <getopt.h>
(void)client;
- pb_log("%s: TODO\n", __func__);
+ pb_debug("%s: TODO\n", __func__);
return 0;
}
return NULL;
}
-static int kexec_cb(struct pbt_client *client, struct pb_opt_data *opt_data)
-{
- int result;
-
- assert(opt_data);
-
- pb_log("%s: %s\n", __func__, opt_data->name);
-
- result = pb_run_kexec(opt_data->bd, client->dry_run);
-
- return result;
-}
-
static int run(struct pbt_client *client)
{
while (1) {
int result = waiter_poll(client->waitset);
- if (result < 0 && errno != EINTR) {
- pb_log("%s: poll: %s\n", __func__, strerror(errno));
+ if (result < 0) {
+ pb_log_fn("poll: %s\n", strerror(errno));
break;
}
if (client->signal_data.abort)
break;
- ui_timer_process_sig(&client->signal_data.timer);
-
while (client->signal_data.resize) {
client->signal_data.resize = 0;
pbt_client_resize(client);
return;
switch (signum) {
- case SIGALRM:
- ui_timer_sigalrm(&sd->timer);
- break;
case SIGWINCH:
sd->resize = 1;
break;
int result;
int ui_result;
struct pbt_client *client;
+ FILE *log;
result = pbt_opts_parse(&opts, argc, argv);
return EXIT_SUCCESS;
}
+ log = stderr;
if (strcmp(opts.log_file, "-")) {
FILE *log = fopen(opts.log_file, "a");
-
- assert(log);
- pb_log_set_stream(log);
- } else
- pb_log_set_stream(stderr);
-
-#if defined(DEBUG)
- pb_log_always_flush(1);
-#endif
+ if (!log)
+ log = stderr;
+ }
+ pb_log_init(log);
pb_log("--- petitboot-twin ---\n");
result += sigaction(SIGWINCH, &sa, NULL);
if (result) {
- pb_log("%s sigaction failed.\n", __func__);
+ pb_log_fn("sigaction failed.\n");
return EXIT_FAILURE;
}
- client = pbt_client_init(opts.backend, 1024, 640, kexec_cb,
- opts.start_daemon, opts.dry_run);
+ client = pbt_client_init(opts.backend, 1024, 640, opts.start_daemon);
if (!client) {
ui_result = EXIT_FAILURE;