#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <sys/socket.h>
#include <bits/socket.h>
#include <sys/un.h>
#include <sys/uio.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
#include <sys/wait.h>
#include <limits.h>
#include <getopt.h>
#include <fcntl.h>
#include "report.h"
#include "protocol.h"
#include "invokelib.h"
#include "search.h"
Go to the source code of this file.
Defines | |
#define | _GNU_SOURCE |
Enumerations | |
enum | APP_TYPE { M_APP, QT_APP, QDECL_APP, EXEC_APP, UNKNOWN_APP } |
Functions | |
static void | sigs_restore (void) |
static void | sigs_init (void) |
static void | sig_forwarder (int sig) |
static void | sigs_set (struct sigaction *sig) |
static void | show_credentials (void) |
static bool | invoke_recv_ack (int fd) |
static int | invoker_init (enum APP_TYPE app_type) |
static uint32_t | invoker_recv_pid (int fd) |
static bool | invoker_recv_exit (int fd, int *status) |
static void | invoker_send_magic (int fd, uint32_t options) |
static void | invoker_send_name (int fd, char *name) |
static void | invoker_send_splash_file (int fd, char *filename) |
static void | invoker_send_landscape_splash_file (int fd, char *filename) |
static void | invoker_send_exec (int fd, char *exec) |
static void | invoker_send_args (int fd, int argc, char **argv) |
static void | invoker_send_prio (int fd, int prio) |
static void | invoker_send_delay (int fd, int delay) |
static void | invoker_send_ids (int fd, int uid, int gid) |
static void | invoker_send_env (int fd) |
static void | invoker_send_io (int fd) |
static void | invoker_send_end (int fd) |
static void | usage (int status) |
static unsigned int | get_delay (char *delay_arg, char *param_name, unsigned int min_value, unsigned int max_value) |
static int | wait_for_launched_process_to_exit (int socket_fd, bool wait_term) |
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) |
static void | invoke_fallback (char **prog_argv, char *prog_name, bool wait_term) |
static int | invoke (int prog_argc, char **prog_argv, char *prog_name, enum APP_TYPE app_type, uint32_t magic_options, bool wait_term, unsigned int respawn_delay, char *splash_file, char *landscape_splash_file) |
int | main (int argc, char *argv[]) |
Variables | |
static const unsigned int | EXIT_DELAY = 0 |
static const unsigned int | MIN_EXIT_DELAY = 1 |
static const unsigned int | MAX_EXIT_DELAY = 86400 |
static const unsigned int | RESPAWN_DELAY = 3 |
static const unsigned int | MIN_RESPAWN_DELAY = 0 |
static const unsigned int | MAX_RESPAWN_DELAY = 10 |
static const unsigned char | EXIT_STATUS_APPLICATION_CONNECTION_LOST = 0xfa |
static const unsigned char | EXIT_STATUS_APPLICATION_NOT_FOUND = 0x7f |
char ** | environ |
static pid_t | g_invoked_pid = -1 |
static int | g_signal_pipe [2] |
Pipe used to safely catch Unix signals. |
enum APP_TYPE |
static unsigned int get_delay | ( | char * | delay_arg, | |
char * | param_name, | |||
unsigned int | min_value, | |||
unsigned int | max_value | |||
) | [static] |
Definition at line 469 of file invoker.c.
References EXIT_DELAY, report(), report_error, and usage().
static int invoke | ( | int | prog_argc, | |
char ** | prog_argv, | |||
char * | prog_name, | |||
enum APP_TYPE | app_type, | |||
uint32_t | magic_options, | |||
bool | wait_term, | |||
unsigned int | respawn_delay, | |||
char * | splash_file, | |||
char * | landscape_splash_file | |||
) | [static] |
Definition at line 654 of file invoker.c.
References invoke_fallback(), invoke_remote(), and invoker_init().
static void invoke_fallback | ( | char ** | prog_argv, | |
char * | prog_name, | |||
bool | wait_term | |||
) | [static] |
static bool invoke_recv_ack | ( | int | fd | ) | [static] |
Definition at line 187 of file invoker.c.
References die(), and invoke_recv_msg().
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 | |||
) | [static] |
Definition at line 585 of file invoker.c.
References invoker_send_args(), invoker_send_delay(), invoker_send_end(), invoker_send_env(), invoker_send_exec(), invoker_send_ids(), invoker_send_io(), invoker_send_landscape_splash_file(), invoker_send_magic(), invoker_send_name(), invoker_send_prio(), invoker_send_splash_file(), and wait_for_launched_process_to_exit().
static int invoker_init | ( | enum APP_TYPE | app_type | ) | [static] |
Definition at line 206 of file invoker.c.
References die(), error, EXEC_APP, INVOKER_EXEC_SOCK, INVOKER_M_SOCK, INVOKER_QDECL_SOCK, INVOKER_QT_SOCK, M_APP, QDECL_APP, and QT_APP.
static bool invoker_recv_exit | ( | int | fd, | |
int * | status | |||
) | [static] |
Definition at line 274 of file invoker.c.
References invoke_recv_msg().
static uint32_t invoker_recv_pid | ( | int | fd | ) | [static] |
Definition at line 256 of file invoker.c.
References die(), and invoke_recv_msg().
static void invoker_send_args | ( | int | fd, | |
int | argc, | |||
char ** | argv | |||
) | [static] |
Definition at line 329 of file invoker.c.
References debug, invoke_send_msg(), and invoke_send_str().
static void invoker_send_delay | ( | int | fd, | |
int | delay | |||
) | [static] |
Definition at line 349 of file invoker.c.
References invoke_send_msg().
static void invoker_send_end | ( | int | fd | ) | [static] |
Definition at line 421 of file invoker.c.
References invoke_recv_ack(), and invoke_send_msg().
static void invoker_send_env | ( | int | fd | ) | [static] |
Definition at line 364 of file invoker.c.
References environ, invoke_send_msg(), and invoke_send_str().
static void invoker_send_exec | ( | int | fd, | |
char * | exec | |||
) | [static] |
Definition at line 323 of file invoker.c.
References invoke_send_msg(), and invoke_send_str().
static void invoker_send_ids | ( | int | fd, | |
int | uid, | |||
int | gid | |||
) | [static] |
Definition at line 356 of file invoker.c.
References invoke_send_msg().
static void invoker_send_io | ( | int | fd | ) | [static] |
Definition at line 383 of file invoker.c.
References invoke_send_msg(), and warning.
static void invoker_send_landscape_splash_file | ( | int | fd, | |
char * | filename | |||
) | [static] |
Definition at line 317 of file invoker.c.
References invoke_send_msg(), and invoke_send_str().
static void invoker_send_magic | ( | int | fd, | |
uint32_t | options | |||
) | [static] |
Definition at line 298 of file invoker.c.
References invoke_send_msg().
static void invoker_send_name | ( | int | fd, | |
char * | name | |||
) | [static] |
Definition at line 305 of file invoker.c.
References invoke_send_msg(), and invoke_send_str().
static void invoker_send_prio | ( | int | fd, | |
int | prio | |||
) | [static] |
Definition at line 342 of file invoker.c.
References invoke_send_msg().
static void invoker_send_splash_file | ( | int | fd, | |
char * | filename | |||
) | [static] |
Definition at line 311 of file invoker.c.
References invoke_send_msg(), and invoke_send_str().
int main | ( | int | argc, | |
char * | argv[] | |||
) |
Definition at line 682 of file invoker.c.
References debug, die(), EXEC_APP, EXIT_DELAY, EXIT_STATUS_APPLICATION_NOT_FOUND, g_signal_pipe, get_delay(), info, invoke(), M_APP, MAX_EXIT_DELAY, MAX_RESPAWN_DELAY, MIN_EXIT_DELAY, MIN_RESPAWN_DELAY, QDECL_APP, QT_APP, report(), report_error, RESPAWN_DELAY, search_program(), show_credentials(), UNKNOWN_APP, and usage().
static void sig_forwarder | ( | int | sig | ) | [static] |
Definition at line 86 of file invoker.c.
References g_invoked_pid, g_signal_pipe, report(), report_error, and sigs_restore().
static void sigs_init | ( | void | ) | [static] |
Definition at line 139 of file invoker.c.
References sigs_set().
static void sigs_restore | ( | void | ) | [static] |
Definition at line 151 of file invoker.c.
References sigs_set().
static void usage | ( | int | status | ) | [static] |
Definition at line 429 of file invoker.c.
References EXIT_DELAY, MAX_RESPAWN_DELAY, and RESPAWN_DELAY.
static int wait_for_launched_process_to_exit | ( | int | socket_fd, | |
bool | wait_term | |||
) | [static] |
Definition at line 492 of file invoker.c.
References debug, g_invoked_pid, g_signal_pipe, invoker_recv_exit(), invoker_recv_pid(), sigs_init(), and sigs_restore().
char** environ |
const unsigned int EXIT_DELAY = 0 [static] |
const unsigned char EXIT_STATUS_APPLICATION_CONNECTION_LOST = 0xfa [static] |
const unsigned char EXIT_STATUS_APPLICATION_NOT_FOUND = 0x7f [static] |
pid_t g_invoked_pid = -1 [static] |
int g_signal_pipe[2] [static] |
const unsigned int MAX_EXIT_DELAY = 86400 [static] |
const unsigned int MAX_RESPAWN_DELAY = 10 [static] |
const unsigned int MIN_EXIT_DELAY = 1 [static] |
const unsigned int MIN_RESPAWN_DELAY = 0 [static] |
const unsigned int RESPAWN_DELAY = 3 [static] |