Exemple #1
0
// "normal" invoke through a socket connection
static int invoke_remote(int socket_fd, int prog_argc, char **prog_argv, char *prog_name,
                         uint32_t magic_options, bool wait_term, unsigned int respawn_delay)
{
    // Get process priority
    errno = 0;
    int prog_prio = getpriority(PRIO_PROCESS, 0);
    if (errno && prog_prio < 0)
    {
        prog_prio = 0;
    }

    // Connection with launcher process is established,
    // send the data.
    invoker_send_magic(socket_fd, magic_options);
    invoker_send_name(socket_fd, prog_name);
    invoker_send_exec(socket_fd, prog_argv[0]);
    invoker_send_args(socket_fd, prog_argc, prog_argv);
    invoker_send_prio(socket_fd, prog_prio);
    invoker_send_delay(socket_fd, respawn_delay);
    invoker_send_ids(socket_fd, getuid(), getgid());
    invoker_send_io(socket_fd);
    invoker_send_env(socket_fd);
    invoker_send_end(socket_fd);

    if (prog_name)
    {
        free(prog_name);
    }

    int exit_status = wait_for_launched_process_to_exit(socket_fd, wait_term);
    return exit_status;
}
// "normal" invoke through a socket connection
int invoke_remote(int fd, int prog_argc, char **prog_argv, char *prog_name,
                  uint32_t magic_options, bool wait_term, unsigned int respawn_delay)
{
    int status = 0;

    // Get process priority
    errno = 0;
    int prog_prio = getpriority(PRIO_PROCESS, 0);
    if (errno && prog_prio < 0)
    {
        prog_prio = 0;
    }

    // Connection with launcher process is established,
    // send the data.
    invoker_send_magic(fd, magic_options);
    invoker_send_name(fd, prog_argv[0]);
    invoker_send_exec(fd, prog_name);
    invoker_send_args(fd, prog_argc, prog_argv);
    invoker_send_prio(fd, prog_prio);
    invoker_send_delay(fd, respawn_delay);
    invoker_send_ids(fd, getuid(), getgid());
    invoker_send_io(fd);
    invoker_send_env(fd);
    invoker_send_end(fd);

    if (prog_name)
    {
        free(prog_name);
    }

    // Wait for launched process to exit
    if (wait_term)
    {
        g_invoked_pid = invoker_recv_pid(fd);
        debug("Booster's pid is %d \n ", g_invoked_pid);

        // Forward signals to the invoked process
        sigs_init();

        // Wait for exit status from the invoked application
        status = invoker_recv_exit(fd);

        // Restore default signal handlers
        sigs_restore();
    }

    return status;
}
Exemple #3
0
// "normal" invoke through a socket connection
static int invoke_remote(int socket_fd, int prog_argc, char **prog_argv, char *prog_name,
                         uint32_t magic_options, bool wait_term, unsigned int respawn_delay,
                         char *splash_file, char *landscape_splash_file)
{
    // Get process priority
    errno = 0;
    int prog_prio = getpriority(PRIO_PROCESS, 0);
    if (errno && prog_prio < 0)
    {
        prog_prio = 0;
    }

    // Connection with launcher process is established,
    // send the data.
    invoker_send_magic(socket_fd, magic_options);
    invoker_send_name(socket_fd, prog_argv[0]);
    invoker_send_exec(socket_fd, prog_name);
    invoker_send_args(socket_fd, prog_argc, prog_argv);
    invoker_send_prio(socket_fd, prog_prio);
    invoker_send_delay(socket_fd, respawn_delay);
    invoker_send_ids(socket_fd, getuid(), getgid());
    if (( magic_options & INVOKER_MSG_MAGIC_OPTION_SPLASH_SCREEN ) != 0)
        invoker_send_splash_file(socket_fd, splash_file);
    if (( magic_options & INVOKER_MSG_MAGIC_OPTION_LANDSCAPE_SPLASH_SCREEN ) != 0)
        invoker_send_landscape_splash_file(socket_fd, landscape_splash_file);
    invoker_send_io(socket_fd);
    invoker_send_env(socket_fd);
    invoker_send_end(socket_fd);

    if (prog_name)
    {
        free(prog_name);
    }

    int exit_status = wait_for_launched_process_to_exit(socket_fd, wait_term);
    return exit_status;
}