#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.
|
#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 |
|
◆ _errexit
#define _errexit |
( |
|
fn, |
|
|
|
reason, |
|
|
|
... |
|
) |
| do { if ((fn) == -1) { _errno_msg (reason, ## __VA_ARGS__); } } while (0) |
◆ _errno_log
#define _errno_log |
( |
|
reason, |
|
|
|
... |
|
) |
| |
Value: do { \
int err = errno; \
fprintf (stderr,
"%s: " reason
": %s\n",
progname, ## __VA_ARGS__, strerror (err)); \
syslog (LOG_ERR, reason ": %s", ## __VA_ARGS__, strerror (err)); \
_exit (2); \
} while (0)
Definition at line 77 of file runvdr.c.
◆ _errno_msg
#define _errno_msg |
( |
|
reason, |
|
|
|
... |
|
) |
| |
Value: do { \
fprintf (stderr,
"%s: " reason
": %s\n",
progname, ## __VA_ARGS__, strerror (errno)); \
_exit (2); \
} while (0)
Definition at line 63 of file runvdr.c.
◆ _GNU_SOURCE
◆ BASEMOD
◆ errexit
#define errexit |
( |
|
fn, |
|
|
|
reason, |
|
|
|
... |
|
) |
| do { if ((fn) == -1) { errno_msg (reason, ## __VA_ARGS__); } } while (0) |
◆ errmsg
#define errmsg |
( |
|
reason, |
|
|
|
... |
|
) |
| |
Value: do { \
fprintf (stderr,
"%s: " reason
"\n",
progname, ## __VA_ARGS__); \
exit (1); \
} while (0)
Definition at line 51 of file runvdr.c.
◆ errno_log
#define errno_log |
( |
|
reason, |
|
|
|
... |
|
) |
| |
Value: do { \
int err = errno; \
fprintf (stderr,
"%s: " reason
": %s\n",
progname, ## __VA_ARGS__, strerror (err)); \
syslog (LOG_ERR, reason ": %s", ## __VA_ARGS__, strerror (err)); \
exit (2); \
} while (0)
Definition at line 69 of file runvdr.c.
◆ errno_msg
#define errno_msg |
( |
|
reason, |
|
|
|
... |
|
) |
| |
Value: do { \
fprintf (stderr,
"%s: " reason
": %s\n",
progname, ## __VA_ARGS__, strerror (errno)); \
exit (2); \
} while (0)
Definition at line 57 of file runvdr.c.
◆ NUM_STOPTIMES
◆ PIDFILE
#define PIDFILE "/var/run/vdr.pid" |
◆ VDRBIN
#define VDRBIN "/usr/bin/vdr" |
◆ dowait()
static int dowait |
( |
int |
which | ) |
|
|
static |
◆ getenv_default()
static const char* getenv_default |
( |
const char * |
var, |
|
|
const char * |
dflt |
|
) |
| |
|
static |
◆ list_append()
static void list_append |
( |
List * |
list, |
|
|
const char * |
item |
|
) |
| |
|
static |
◆ list_find()
static size_t list_find |
( |
List * |
list, |
|
|
const char * |
cmp |
|
) |
| |
|
static |
◆ list_free()
static void list_free |
( |
List * |
list | ) |
|
|
static |
◆ list_remove()
static void list_remove |
( |
List * |
list, |
|
|
size_t |
index |
|
) |
| |
|
static |
◆ main()
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.
◆ parse_modules_24()
static char* parse_modules_24 |
( |
char * |
line, |
|
|
int |
budget |
|
) |
| |
|
static |
◆ parse_modules_26()
static char* parse_modules_26 |
( |
char * |
line, |
|
|
int |
budget |
|
) |
| |
|
static |
◆ pidfile_remove()
static void pidfile_remove |
( |
void |
| ) |
|
|
static |
◆ pidfile_write()
static void pidfile_write |
( |
void |
| ) |
|
|
static |
◆ scan_plugins()
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().
◆ sig_default()
static void sig_default |
( |
int |
sig | ) |
|
|
static |
◆ sig_propagate()
static void sig_propagate |
( |
int |
sig | ) |
|
|
static |
◆ sig_quit()
static void sig_quit |
( |
int |
sig | ) |
|
|
static |
◆ mod_budget
const char mod_budget[] = "budget-core\0\0" |
|
static |
◆ mod_dvb
const char mod_dvb[] = "dvb-core\0\0" |
|
static |
◆ progname
◆ stoptimecount
◆ stoptimes
◆ usr1
◆ vdr