vdr
1.7.27
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <ctype.h>
#include <signal.h>
#include <errno.h>
#include <time.h>
#include <syslog.h>
#include <grp.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <dirent.h>
#include <sys/param.h>
#include <sys/wait.h>
#include <unistd.h>
#include <pwd.h>
Go to the source code of this file.
Classes | |
struct | List |
Defines | |
#define | _GNU_SOURCE |
#define | PIDFILE "/var/run/vdr.pid" |
#define | VDRBIN "/usr/bin/vdr" |
#define | errmsg(reason,...) |
#define | errno_msg(reason,...) |
#define | _errno_msg(reason,...) |
#define | errno_log(reason,...) |
#define | _errno_log(reason,...) |
#define | errexit(fn, reason,...) do { if ((fn) == -1) { errno_msg (reason, ## __VA_ARGS__); } } while (0) |
#define | _errexit(fn, reason,...) do { if ((fn) == -1) { _errno_msg (reason, ## __VA_ARGS__); } } while (0) |
#define | BASEMOD (budget ? mod_budget : mod_dvb) |
#define | NUM_STOPTIMES 5 |
Functions | |
static int | dowait (int which) |
static void | sig_quit (int sig) |
static void | sig_propagate (int sig) |
static void | sig_default (int sig) |
static char * | parse_modules_24 (char *line, int budget) |
static char * | parse_modules_26 (char *line, int budget) |
static const char * | getenv_default (const char *var, const char *dflt) |
static void | list_append (List *list, const char *item) |
static void | list_free (List *list) |
static size_t | list_find (List *list, const char *cmp) |
static void | list_remove (List *list, size_t index) |
static void | scan_plugins (List *args) |
static void | pidfile_write (void) |
static void | pidfile_remove (void) |
int | main (int argc, char *argv[]) |
Variables | |
static const char * | progname |
static const char | mod_dvb [] = "dvb-core\0\0" |
static const char | mod_budget [] = "budget-core\0\0" |
static time_t | stoptimes [NUM_STOPTIMES] |
static size_t | stoptimecount = 0 |
static volatile int | usr1 = 0 |
static pid_t | vdr = 0 |
#define _errexit | ( | fn, | |
reason, | |||
... | |||
) | do { if ((fn) == -1) { _errno_msg (reason, ## __VA_ARGS__); } } while (0) |
Definition at line 88 of file runvdr.c.
Referenced by scan_plugins().
#define _errno_log | ( | reason, | |
... | |||
) |
#define _errno_msg | ( | reason, | |
... | |||
) |
do { \ fprintf (stderr, "%s: " reason ": %s\n", progname, ## __VA_ARGS__, strerror (errno)); \ _exit (2); \ } while (0)
Definition at line 63 of file runvdr.c.
Referenced by scan_plugins().
#define _GNU_SOURCE |
#define BASEMOD (budget ? mod_budget : mod_dvb) |
Definition at line 96 of file runvdr.c.
Referenced by parse_modules_24(), and parse_modules_26().
#define errexit | ( | fn, | |
reason, | |||
... | |||
) | do { if ((fn) == -1) { errno_msg (reason, ## __VA_ARGS__); } } while (0) |
Definition at line 85 of file runvdr.c.
Referenced by main(), parse_modules_24(), parse_modules_26(), and scan_plugins().
#define errmsg | ( | reason, | |
... | |||
) |
do { \ fprintf (stderr, "%s: " reason "\n", progname, ## __VA_ARGS__); \ exit (1); \ } while (0)
Definition at line 51 of file runvdr.c.
Referenced by list_append(), main(), pidfile_write(), and scan_plugins().
#define errno_log | ( | reason, | |
... | |||
) |
#define errno_msg | ( | reason, | |
... | |||
) |
do { \ fprintf (stderr, "%s: " reason ": %s\n", progname, ## __VA_ARGS__, strerror (errno)); \ exit (2); \ } while (0)
Definition at line 57 of file runvdr.c.
Referenced by dowait(), main(), pidfile_write(), and scan_plugins().
#define NUM_STOPTIMES 5 |
#define PIDFILE "/var/run/vdr.pid" |
Definition at line 48 of file runvdr.c.
Referenced by pidfile_remove(), and pidfile_write().
static int dowait | ( | int | which | ) | [static] |
Definition at line 114 of file runvdr.c.
References errno_msg.
Referenced by main(), scan_plugins(), and sig_quit().
static const char* getenv_default | ( | const char * | var, |
const char * | dflt | ||
) | [static] |
Definition at line 217 of file runvdr.c.
Referenced by scan_plugins().
static void list_append | ( | List * | list, |
const char * | item | ||
) | [static] |
Definition at line 225 of file runvdr.c.
References errmsg, List::items, and List::length.
Referenced by main(), and scan_plugins().
Definition at line 256 of file runvdr.c.
References List::items, and List::length.
Referenced by scan_plugins().
Definition at line 238 of file runvdr.c.
References List::items, and List::length.
Referenced by main(), and scan_plugins().
static void list_remove | ( | List * | list, |
size_t | index | ||
) | [static] |
Definition at line 268 of file runvdr.c.
References List::items, and List::length.
Referenced by scan_plugins().
int main | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 550 of file runvdr.c.
References _errno_log, dowait(), errexit, errmsg, errno_log, errno_msg, List::items, list_append(), list_free(), NUM_STOPTIMES, parse_modules_24(), parse_modules_26(), pidfile_remove(), pidfile_write(), progname, scan_plugins(), sig_default(), sig_propagate(), sig_quit(), stoptimecount, stoptimes, usr1, vdr, and VDRBIN.
static char* parse_modules_24 | ( | char * | line, |
int | budget | ||
) | [static] |
static char* parse_modules_26 | ( | char * | line, |
int | budget | ||
) | [static] |
static void pidfile_remove | ( | void | ) | [static] |
static void pidfile_write | ( | void | ) | [static] |
static void scan_plugins | ( | List * | args | ) | [static] |
Definition at line 281 of file runvdr.c.
References _errexit, _errno_msg, dowait(), errexit, errmsg, errno_msg, getenv_default(), List::items, List::length, list_append(), list_find(), list_free(), list_remove(), and VERSION.
Referenced by main().
static void sig_default | ( | int | sig | ) | [static] |
static void sig_propagate | ( | int | sig | ) | [static] |
static void sig_quit | ( | int | sig | ) | [static] |
const char mod_budget[] = "budget-core\0\0" [static] |
const char* progname [static] |
Definition at line 92 of file runvdr.c.
Referenced by main(), and pidfile_remove().
size_t stoptimecount = 0 [static] |
time_t stoptimes[NUM_STOPTIMES] [static] |
volatile int usr1 = 0 [static] |
Definition at line 102 of file runvdr.c.
Referenced by main(), and sig_propagate().
pid_t vdr = 0 [static] |
Definition at line 104 of file runvdr.c.
Referenced by main(), sig_propagate(), and sig_quit().