History

avserver: remove daemon mode

This code spews a multitude of warnings with glibc (unchecked return values), some of them possibly warranted. Furthermore, the deamonisation is not suitable for use with typical startup scripts as it does not provide the PID of the daemon in any way. Users wishing to run avserver as a daemon can still do so using start-stop-daemon or equivalent tools.

Mans Rullgard committed 14 years ago

Commit ada51a31 parent 9eded0f4 files · +2 −48Browse files

Unified · Split

4 files
  1. Changelog +1 −0
  2. avserver.c +0 −38
  3. doc/avserver.conf +0 −3
  4. doc/avserver.texi +1 −7
Changelog+1−0
@@ -9,6 +9,7 @@ version <next>: · 8 unmodified lines
99 version 9_beta2:
1010 - metadata (INFO tag) support in WAV muxer
1111 - support for building DLLs using MSVC
12+- remove avserver daemon mode
1213
1314
1415 version 9_beta1:
avserver.c+0−38
@@ -301,12 +301,10 @@ static int rtp_new_av_stream(HTTPContext *c, · 300 unmodified lines
301301 HTTPContext *rtsp_c);
302302
303303 static const char *my_program_name;
304−static const char *my_program_dir;
305304
306305 static const char *config_filename = "/etc/avserver.conf";
307306
308307 static int avserver_debug;
309−static int avserver_daemon;
310308 static int no_launch;
311309 static int need_to_start_children;
312310
@@ -524,9 +522,6 @@ static void start_children(FFStream *feed) · 211 unmodified lines
524522 }
525523 }
526524
527− /* This is needed to make relative pathnames work */
528− chdir(my_program_dir);
529−
530525 signal(SIGPIPE, SIG_DFL);
531526
532527 execvp(pathname, feed->child_argv);
@@ -4081,8 +4076,6 @@ static int parse_ffconfig(const char *filename) · 3548 unmodified lines
40814076 if (resolve_host(&my_http_addr.sin_addr, arg) != 0) {
40824077 ERROR("%s:%d: Invalid host/IP address: %s\n", arg);
40834078 }
4084− } else if (!av_strcasecmp(cmd, "NoDaemon")) {
4085− avserver_daemon = 0;
40864079 } else if (!av_strcasecmp(cmd, "RTSPPort")) {
40874080 get_arg(arg, sizeof(arg), &p);
40884081 val = atoi(arg);
@@ -4655,7 +4648,6 @@ static void handle_child_exit(int sig) · 566 unmodified lines
46554648 static void opt_debug(void)
46564649 {
46574650 avserver_debug = 1;
4658− avserver_daemon = 0;
46594651 logfilename[0] = '-';
46604652 }
46614653
@@ -4686,8 +4678,6 @@ int main(int argc, char **argv) · 24 unmodified lines
46864678 show_banner();
46874679
46884680 my_program_name = argv[0];
4689− my_program_dir = getcwd(0, 0);
4690− avserver_daemon = 1;
46914681
46924682 parse_options(NULL, argc, argv, options, NULL);
46934683
@@ -4719,37 +4709,9 @@ int main(int argc, char **argv) · 25 unmodified lines
47194709
47204710 compute_bandwidth();
47214711
4722− /* put the process in background and detach it from its TTY */
4723− if (avserver_daemon) {
4724− int pid;
4725−
4726− pid = fork();
4727− if (pid < 0) {
4728− perror("fork");
4729− exit(1);
4730− } else if (pid > 0) {
4731− /* parent : exit */
4732− exit(0);
4733− } else {
4734− /* child */
4735− setsid();
4736− close(0);
4737− open("/dev/null", O_RDWR);
4738− if (strcmp(logfilename, "-") != 0) {
4739− close(1);
4740− dup(0);
4741− }
4742− close(2);
4743− dup(0);
4744− }
4745− }
4746−
47474712 /* signal init */
47484713 signal(SIGPIPE, SIG_IGN);
47494714
4750− if (avserver_daemon)
4751− chdir("/");
4752−
47534715 if (http_server() < 0) {
47544716 http_log("Could not start server\n");
47554717 exit(1);
doc/avserver.conf+0−3
@@ -25,9 +25,6 @@ MaxBandwidth 1000 · 24 unmodified lines
2525 # '-' is the standard output.
2626 CustomLog -
2727
28−# Suppress that if you want to launch avserver as a daemon.
29−NoDaemon
30−
3128
3229 ##################################################################
3330 # Definition of the live feeds. Each live feed contains one video
doc/avserver.texi+1−7
@@ -31,11 +31,6 @@ several live feeds, streaming from files and time shifting on live feeds · 30 unmodified lines
3131 (you can seek to positions in the past on each live feed, provided you
3232 specify a big enough feed storage in avserver.conf).
3333
34−avserver runs in daemon mode by default; that is, it puts itself in
35−the background and detaches from its TTY, unless it is launched in
36−debug mode or a NoDaemon option is specified in the configuration
37−file.
38−
3934 This documentation covers only the streaming aspects of avserver /
4035 avconv. All questions about parameters for avconv, codec questions,
4136 etc. are not covered here. Read @file{avconv.html} for more
@@ -257,8 +252,7 @@ within the various <Stream> sections. Since avserver will not launch · 215 unmodified lines
257252 any avconv instances, you will have to launch them manually.
258253 @item -d
259254 Enable debug mode. This option increases log verbosity, directs log
260−messages to stdout and causes avserver to run in the foreground
261−rather than as a daemon.
255+messages to stdout.
262256 @end table
263257 @c man end
264258

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t