/home/marcin/applauncher/applauncherd-3.0.3/src/invoker/invoker.c File Reference

#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.


Define Documentation

#define _GNU_SOURCE

Definition at line 20 of file invoker.c.


Enumeration Type Documentation

enum APP_TYPE

Enumerator:
M_APP 
QT_APP 
QDECL_APP 
EXEC_APP 
UNKNOWN_APP 

Definition at line 71 of file invoker.c.


Function Documentation

static unsigned int get_delay ( char *  delay_arg,
char *  param_name,
unsigned int  min_value,
unsigned int  max_value 
) [static]

Definition at line 484 of file invoker.c.

References EXIT_DELAY, 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 657 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]

Definition at line 626 of file invoker.c.

References environ.

static bool invoke_recv_ack ( int  fd  )  [static]

Definition at line 202 of file invoker.c.

References 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]

static int invoker_init ( enum APP_TYPE  app_type  )  [static]

static bool invoker_recv_exit ( int  fd,
int *  status 
) [static]

Definition at line 289 of file invoker.c.

References invoke_recv_msg().

static uint32_t invoker_recv_pid ( int  fd  )  [static]

Definition at line 271 of file invoker.c.

References invoke_recv_msg().

static void invoker_send_args ( int  fd,
int  argc,
char **  argv 
) [static]

Definition at line 344 of file invoker.c.

References invoke_send_msg(), and invoke_send_str().

static void invoker_send_delay ( int  fd,
int  delay 
) [static]

Definition at line 364 of file invoker.c.

References invoke_send_msg().

static void invoker_send_end ( int  fd  )  [static]

Definition at line 436 of file invoker.c.

References invoke_recv_ack(), and invoke_send_msg().

static void invoker_send_env ( int  fd  )  [static]

Definition at line 379 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 338 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 371 of file invoker.c.

References invoke_send_msg().

static void invoker_send_io ( int  fd  )  [static]

Definition at line 398 of file invoker.c.

References invoke_send_msg().

static void invoker_send_landscape_splash_file ( int  fd,
char *  filename 
) [static]

Definition at line 332 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 313 of file invoker.c.

References invoke_send_msg().

static void invoker_send_name ( int  fd,
char *  name 
) [static]

Definition at line 320 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 357 of file invoker.c.

References invoke_send_msg().

static void invoker_send_splash_file ( int  fd,
char *  filename 
) [static]

Definition at line 326 of file invoker.c.

References invoke_send_msg(), and invoke_send_str().

int main ( int  argc,
char *  argv[] 
)

static void show_credentials ( void   )  [static]

Definition at line 178 of file invoker.c.

static void sig_forwarder ( int  sig  )  [static]

Definition at line 86 of file invoker.c.

References g_invoked_pid, g_signal_pipe, and sigs_restore().

static void sigs_init ( void   )  [static]

Definition at line 154 of file invoker.c.

References sig_forwarder(), and sigs_set().

static void sigs_restore ( void   )  [static]

Definition at line 166 of file invoker.c.

References sigs_set().

static void sigs_set ( struct sigaction *  sig  )  [static]

Definition at line 123 of file invoker.c.

static void usage ( int  status  )  [static]

Definition at line 444 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]


Variable Documentation

char** environ

const unsigned int EXIT_DELAY = 0 [static]

Definition at line 52 of file invoker.c.

const unsigned char EXIT_STATUS_APPLICATION_CONNECTION_LOST = 0xfa [static]

Definition at line 62 of file invoker.c.

const unsigned char EXIT_STATUS_APPLICATION_NOT_FOUND = 0x7f [static]

Definition at line 63 of file invoker.c.

pid_t g_invoked_pid = -1 [static]

Definition at line 77 of file invoker.c.

int g_signal_pipe[2] [static]

Pipe used to safely catch Unix signals.

Definition at line 83 of file invoker.c.

const unsigned int MAX_EXIT_DELAY = 86400 [static]

Definition at line 54 of file invoker.c.

const unsigned int MAX_RESPAWN_DELAY = 10 [static]

Definition at line 60 of file invoker.c.

const unsigned int MIN_EXIT_DELAY = 1 [static]

Definition at line 53 of file invoker.c.

const unsigned int MIN_RESPAWN_DELAY = 0 [static]

Definition at line 59 of file invoker.c.

const unsigned int RESPAWN_DELAY = 3 [static]

Definition at line 58 of file invoker.c.


Generated on Wed Jul 25 20:12:40 2012 for applauncherd by  doxygen 1.5.6