* Patches to dvbv5-zap
@ 2015-12-18 14:28 Jemma Denson
2015-12-18 14:28 ` [v4l-utils PATCH-v2 1/4] dvbv5-zap.c: fix setting signal handlers Jemma Denson
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Jemma Denson @ 2015-12-18 14:28 UTC (permalink / raw)
To: mchehab; +Cc: linux-media
This patch series replaces the single patch sent earlier today. Essentially
it's to allow -t to be used at the same time as -x. We have a requirement
to show signal stats in a web interface and a lack of timeout would cause
issues when there's no signal.
The other patches are fixing bugs I noticed in adding this and then
simplifying the code slightly.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [v4l-utils PATCH-v2 1/4] dvbv5-zap.c: fix setting signal handlers
2015-12-18 14:28 Patches to dvbv5-zap Jemma Denson
@ 2015-12-18 14:28 ` Jemma Denson
2015-12-18 14:28 ` [v4l-utils PATCH-v2 2/4] dvbv5-zap.c: allow timeout with -x Jemma Denson
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Jemma Denson @ 2015-12-18 14:28 UTC (permalink / raw)
To: mchehab; +Cc: linux-media
Signal handlers are currently out of order - SIGALRM is always set, and
SIGINT only set when timeout is set. These should be the other way round.
Signed-off-by: Jemma Denson <jdenson@gmail.com>
---
utils/dvb/dvbv5-zap.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/utils/dvb/dvbv5-zap.c b/utils/dvb/dvbv5-zap.c
index e19d7c2..e927383 100644
--- a/utils/dvb/dvbv5-zap.c
+++ b/utils/dvb/dvbv5-zap.c
@@ -959,10 +959,10 @@ int main(int argc, char **argv)
goto err;
}
- signal(SIGALRM, do_timeout);
signal(SIGTERM, do_timeout);
+ signal(SIGINT, do_timeout);
if (args.timeout > 0) {
- signal(SIGINT, do_timeout);
+ signal(SIGALRM, do_timeout);
alarm(args.timeout);
}
--
2.1.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [v4l-utils PATCH-v2 2/4] dvbv5-zap.c: allow timeout with -x
2015-12-18 14:28 Patches to dvbv5-zap Jemma Denson
2015-12-18 14:28 ` [v4l-utils PATCH-v2 1/4] dvbv5-zap.c: fix setting signal handlers Jemma Denson
@ 2015-12-18 14:28 ` Jemma Denson
2015-12-18 14:28 ` [v4l-utils PATCH-v2 3/4] dvbv5-zap.c: fix wrong signal Jemma Denson
2015-12-18 14:28 ` [v4l-utils PATCH-v2 4/4] dvbv5-zap.c: Move common signals code into function Jemma Denson
3 siblings, 0 replies; 5+ messages in thread
From: Jemma Denson @ 2015-12-18 14:28 UTC (permalink / raw)
To: mchehab; +Cc: linux-media
Timeout handlers aren't set when running with -x (exit after tuning).
This patch adds handlers so -t can be used with -x.
Without a timeout dvbv5-zap will run forever if there's no signal,
preventing it's use by scripts to obtain signal stats.
Signed-off-by: Jemma Denson <jdenson@gmail.com>
---
utils/dvb/dvbv5-zap.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/utils/dvb/dvbv5-zap.c b/utils/dvb/dvbv5-zap.c
index e927383..2d19d45 100644
--- a/utils/dvb/dvbv5-zap.c
+++ b/utils/dvb/dvbv5-zap.c
@@ -855,6 +855,13 @@ int main(int argc, char **argv)
goto err;
if (args.exit_after_tuning) {
+ signal(SIGTERM, do_timeout);
+ signal(SIGINT, do_timeout);
+ if (args.timeout > 0) {
+ signal(SIGALRM, do_timeout);
+ alarm(args.timeout);
+ }
+
err = 0;
check_frontend(&args, parms);
goto err;
--
2.1.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [v4l-utils PATCH-v2 3/4] dvbv5-zap.c: fix wrong signal
2015-12-18 14:28 Patches to dvbv5-zap Jemma Denson
2015-12-18 14:28 ` [v4l-utils PATCH-v2 1/4] dvbv5-zap.c: fix setting signal handlers Jemma Denson
2015-12-18 14:28 ` [v4l-utils PATCH-v2 2/4] dvbv5-zap.c: allow timeout with -x Jemma Denson
@ 2015-12-18 14:28 ` Jemma Denson
2015-12-18 14:28 ` [v4l-utils PATCH-v2 4/4] dvbv5-zap.c: Move common signals code into function Jemma Denson
3 siblings, 0 replies; 5+ messages in thread
From: Jemma Denson @ 2015-12-18 14:28 UTC (permalink / raw)
To: mchehab; +Cc: linux-media
Signal here should be SIGALRM and not SIGINT in order to call do_timeout().
Signed-off-by: Jemma Denson <jdenson@gmail.com>
---
utils/dvb/dvbv5-zap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/utils/dvb/dvbv5-zap.c b/utils/dvb/dvbv5-zap.c
index 2d19d45..2d71307 100644
--- a/utils/dvb/dvbv5-zap.c
+++ b/utils/dvb/dvbv5-zap.c
@@ -871,7 +871,7 @@ int main(int argc, char **argv)
signal(SIGTERM, do_timeout);
signal(SIGINT, do_timeout);
if (args.timeout > 0) {
- signal(SIGINT, do_timeout);
+ signal(SIGALRM, do_timeout);
alarm(args.timeout);
}
--
2.1.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [v4l-utils PATCH-v2 4/4] dvbv5-zap.c: Move common signals code into function
2015-12-18 14:28 Patches to dvbv5-zap Jemma Denson
` (2 preceding siblings ...)
2015-12-18 14:28 ` [v4l-utils PATCH-v2 3/4] dvbv5-zap.c: fix wrong signal Jemma Denson
@ 2015-12-18 14:28 ` Jemma Denson
3 siblings, 0 replies; 5+ messages in thread
From: Jemma Denson @ 2015-12-18 14:28 UTC (permalink / raw)
To: mchehab; +Cc: linux-media
Code repeated 3 times; move to common function.
Signed-off-by: Jemma Denson <jdenson@gmail.com>
---
utils/dvb/dvbv5-zap.c | 33 +++++++++++++--------------------
1 file changed, 13 insertions(+), 20 deletions(-)
diff --git a/utils/dvb/dvbv5-zap.c b/utils/dvb/dvbv5-zap.c
index 2d71307..ef17be9 100644
--- a/utils/dvb/dvbv5-zap.c
+++ b/utils/dvb/dvbv5-zap.c
@@ -737,6 +737,16 @@ int do_traffic_monitor(struct arguments *args,
return 0;
}
+static void set_signals(struct arguments *args)
+{
+ signal(SIGTERM, do_timeout);
+ signal(SIGINT, do_timeout);
+ if (args->timeout > 0) {
+ signal(SIGALRM, do_timeout);
+ alarm(args->timeout);
+ }
+}
+
int main(int argc, char **argv)
{
struct arguments args;
@@ -855,26 +865,14 @@ int main(int argc, char **argv)
goto err;
if (args.exit_after_tuning) {
- signal(SIGTERM, do_timeout);
- signal(SIGINT, do_timeout);
- if (args.timeout > 0) {
- signal(SIGALRM, do_timeout);
- alarm(args.timeout);
- }
-
+ set_signals(&args);
err = 0;
check_frontend(&args, parms);
goto err;
}
if (args.traffic_monitor) {
- signal(SIGTERM, do_timeout);
- signal(SIGINT, do_timeout);
- if (args.timeout > 0) {
- signal(SIGALRM, do_timeout);
- alarm(args.timeout);
- }
-
+ set_signals(&args);
err = do_traffic_monitor(&args, parms);
goto err;
}
@@ -966,12 +964,7 @@ int main(int argc, char **argv)
goto err;
}
- signal(SIGTERM, do_timeout);
- signal(SIGINT, do_timeout);
- if (args.timeout > 0) {
- signal(SIGALRM, do_timeout);
- alarm(args.timeout);
- }
+ set_signals(&args);
if (!check_frontend(&args, parms)) {
err = 1;
--
2.1.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-12-18 14:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-18 14:28 Patches to dvbv5-zap Jemma Denson
2015-12-18 14:28 ` [v4l-utils PATCH-v2 1/4] dvbv5-zap.c: fix setting signal handlers Jemma Denson
2015-12-18 14:28 ` [v4l-utils PATCH-v2 2/4] dvbv5-zap.c: allow timeout with -x Jemma Denson
2015-12-18 14:28 ` [v4l-utils PATCH-v2 3/4] dvbv5-zap.c: fix wrong signal Jemma Denson
2015-12-18 14:28 ` [v4l-utils PATCH-v2 4/4] dvbv5-zap.c: Move common signals code into function Jemma Denson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).