/** * @file * @section AUTHORS * * Authors: * Eamon Walsh * Frank Rehberger * * @section LICENSE * * This file is in the public domain. * * @section DESCRIPTION * * This is the main routine for the linpicker-server program. * Nothing much here except initialization, select loop, and teardown. */ #include #include #include #include #include #include #include #include #include "common.h" #include "fd.h" #include "xen_backend.h" #include "sys-queue.h" #include "display.h" #include "input.h" #include "local.h" static int timetodie; /* * Is called in case of process signals. */ static void server_sighandler(int sig) { timetodie = 1; } /* * Main */ int main (int argc, char *argv[]) { struct sigaction sa = { .sa_handler = server_sighandler }; chdir("/"); /* Set up sighandlers */ sigaction(SIGINT, &sa, NULL); sigaction(SIGTERM, &sa, NULL); /* Open logfile */ if (fd_open_logfile(SERVER_LOG) < 0) return 1; /* Initialize subsystems */ if (local_init(argc, argv) < 0) return 1; if (display_initialize(&argc, &argv) < 0) return 2; if (input_initialize(argc, argv) < 0) return 3; if (xen_be_init() < 0) return 4; /* Enter select loop */ while (!timetodie && fd_run_select() == 0); /* Shut down */ input_shutdown(); display_shutdown(); fd_shutdown(); return 0; }