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
9version 9_beta2:9version 9_beta2:
10- metadata (INFO tag) support in WAV muxer10- metadata (INFO tag) support in WAV muxer
11- support for building DLLs using MSVC11- support for building DLLs using MSVC
12- remove avserver daemon mode
12 13
13 14
14version 9_beta1:15version 9_beta1:
avserver.c+0−38
@@ -301,12 +301,10 @@ static int rtp_new_av_stream(HTTPContext *c, · 300 unmodified lines
301 HTTPContext *rtsp_c);301 HTTPContext *rtsp_c);
302 302
303static const char *my_program_name;303static const char *my_program_name;
304static const char *my_program_dir;
305 304
306static const char *config_filename = "/etc/avserver.conf";305static const char *config_filename = "/etc/avserver.conf";
307 306
308static int avserver_debug;307static int avserver_debug;
309static int avserver_daemon;
310static int no_launch;308static int no_launch;
311static int need_to_start_children;309static int need_to_start_children;
312 310
@@ -524,9 +522,6 @@ static void start_children(FFStream *feed) · 211 unmodified lines
524 }522 }
525 }523 }
526 524
527 /* This is needed to make relative pathnames work */
528 chdir(my_program_dir);
529
530 signal(SIGPIPE, SIG_DFL);525 signal(SIGPIPE, SIG_DFL);
531 526
532 execvp(pathname, feed->child_argv);527 execvp(pathname, feed->child_argv);
@@ -4081,8 +4076,6 @@ static int parse_ffconfig(const char *filename) · 3548 unmodified lines
4081 if (resolve_host(&my_http_addr.sin_addr, arg) != 0) {4076 if (resolve_host(&my_http_addr.sin_addr, arg) != 0) {
4082 ERROR("%s:%d: Invalid host/IP address: %s\n", arg);4077 ERROR("%s:%d: Invalid host/IP address: %s\n", arg);
4083 }4078 }
4084 } else if (!av_strcasecmp(cmd, "NoDaemon")) {
4085 avserver_daemon = 0;
4086 } else if (!av_strcasecmp(cmd, "RTSPPort")) {4079 } else if (!av_strcasecmp(cmd, "RTSPPort")) {
4087 get_arg(arg, sizeof(arg), &p);4080 get_arg(arg, sizeof(arg), &p);
4088 val = atoi(arg);4081 val = atoi(arg);
@@ -4655,7 +4648,6 @@ static void handle_child_exit(int sig) · 566 unmodified lines
4655static void opt_debug(void)4648static void opt_debug(void)
4656{4649{
4657 avserver_debug = 1;4650 avserver_debug = 1;
4658 avserver_daemon = 0;
4659 logfilename[0] = '-';4651 logfilename[0] = '-';
4660}4652}
4661 4653
@@ -4686,8 +4678,6 @@ int main(int argc, char **argv) · 24 unmodified lines
4686 show_banner();4678 show_banner();
4687 4679
4688 my_program_name = argv[0];4680 my_program_name = argv[0];
4689 my_program_dir = getcwd(0, 0);
4690 avserver_daemon = 1;
4691 4681
4692 parse_options(NULL, argc, argv, options, NULL);4682 parse_options(NULL, argc, argv, options, NULL);
4693 4683
@@ -4719,37 +4709,9 @@ int main(int argc, char **argv) · 25 unmodified lines
4719 4709
4720 compute_bandwidth();4710 compute_bandwidth();
4721 4711
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
4747 /* signal init */4712 /* signal init */
4748 signal(SIGPIPE, SIG_IGN);4713 signal(SIGPIPE, SIG_IGN);
4749 4714
4750 if (avserver_daemon)
4751 chdir("/");
4752
4753 if (http_server() < 0) {4715 if (http_server() < 0) {
4754 http_log("Could not start server\n");4716 http_log("Could not start server\n");
4755 exit(1);4717 exit(1);
doc/avserver.conf+0−3
@@ -25,9 +25,6 @@ MaxBandwidth 1000 · 24 unmodified lines
25# '-' is the standard output.25# '-' is the standard output.
26CustomLog -26CustomLog -
27 27
28# Suppress that if you want to launch avserver as a daemon.
29NoDaemon
30
31 28
32##################################################################29##################################################################
33# Definition of the live feeds. Each live feed contains one video30# 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
31(you can seek to positions in the past on each live feed, provided you31(you can seek to positions in the past on each live feed, provided you
32specify a big enough feed storage in avserver.conf).32specify a big enough feed storage in avserver.conf).
33 33
34avserver runs in daemon mode by default; that is, it puts itself in
35the background and detaches from its TTY, unless it is launched in
36debug mode or a NoDaemon option is specified in the configuration
37file.
38
39This documentation covers only the streaming aspects of avserver /34This documentation covers only the streaming aspects of avserver /
40avconv. All questions about parameters for avconv, codec questions,35avconv. All questions about parameters for avconv, codec questions,
41etc. are not covered here. Read @file{avconv.html} for more36etc. 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
257any avconv instances, you will have to launch them manually.252any avconv instances, you will have to launch them manually.
258@item -d253@item -d
259Enable debug mode. This option increases log verbosity, directs log254Enable debug mode. This option increases log verbosity, directs log
260messages to stdout and causes avserver to run in the foreground255messages to stdout.
261rather than as a daemon.
262@end table256@end table
263@c man end257@c man end
264 258

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