[Ffmpeg-devel] [PATCH] FFserver signal handler
Michel Bardiaux
mbardiaux
Wed Feb 21 12:43:59 CET 2007
Alex Beregszaszi wrote:
> Hi,
>
> If using gprof, the profiling data will be written only if the
> application quits with exit(). In my setup, I was debuggging FFserver
> when it felt into an infinite loop, thus killing was the most
> appropriate thing to do. In this case I had no profiling data.
>
> Attached is a patch which adds a primitive signal handler to FFserver.
> The patch may not apply cleanly, I plan to commit it, just asking if
> anyone is against it.
Isnt it possible to force the dumping of profiling data at regular
intervals? Would have the additional benefit that one could have the
info without terminating the server!
>
> --
> Alex Beregszaszi
>
>
> ------------------------------------------------------------------------
>
> Index: ffserver.c
> ===================================================================
> --- ffserver.c (revision 7991)
> +++ ffserver.c (working copy)
> @@ -4482,12 +4496,22 @@
> need_to_start_children = 1;
> }
>
> +static int signal_handler(int sig) {
> + fprintf(stderr, "Exiting on signal %d\n", sig);
> + exit(1);
> +}
> +
> int main(int argc, char **argv)
> {
> const char *config_filename;
> int c;
> struct sigaction sigact;
>
> + signal(SIGSEGV, signal_handler);
Very risky.
> + signal(SIGINT, signal_handler);
> + signal(SIGKILL, signal_handler);
Useless, you cant override the default hanlder for SIGKILL (fortunately!).
> + signal(SIGTERM, signal_handler);
> +
> av_register_all();
>
> config_filename = "/etc/ffserver.conf";
--
Michel Bardiaux
R&D Director
T +32 [0] 2 790 29 41
F +32 [0] 2 790 29 02
E mailto:mbardiaux at mediaxim.be
Mediaxim NV/SA
Vorstlaan 191 Boulevard du Souverain
Brussel 1160 Bruxelles
http://www.mediaxim.com/
More information about the ffmpeg-devel
mailing list