summaryrefslogtreecommitdiff
path: root/cleopatre/application/fw_wd
diff options
context:
space:
mode:
Diffstat (limited to 'cleopatre/application/fw_wd')
-rwxr-xr-xcleopatre/application/fw_wd/fwwatchd26
1 files changed, 23 insertions, 3 deletions
diff --git a/cleopatre/application/fw_wd/fwwatchd b/cleopatre/application/fw_wd/fwwatchd
index 0d5e9a37aa..cbc7c19652 100755
--- a/cleopatre/application/fw_wd/fwwatchd
+++ b/cleopatre/application/fw_wd/fwwatchd
@@ -39,6 +39,16 @@ dump_trace () {
IFS=$IFSOLD
}
+# Timeout check on trace dump
+timeout_handler ()
+{
+ sleep $TRACE_TIMEOUT_SECONDS
+ kill -0 $1 2>/dev/null
+ if [ $? -eq 0 ]; then
+ kill -9 $1 2>/dev/null
+ echo "Timeout during trace extraction..." >> $2
+ fi
+}
# Get all trace information and store it on file system.
get_trace () {
test $TRACE_ENABLED = true || return 0
@@ -65,9 +75,19 @@ get_trace () {
# Get trace (uncompressed, then compressed), get files and execute
# commands.
new_trace=${TRACE_FOLDER}/${TRACE_BASENAME}${new_trace_digit}.gz
- echo "Full trace available in $new_trace" > ${TRACE_HEADER_PATH} && \
- head -n ${TRACE_HEADER_LINE} /dev/trace >> ${TRACE_HEADER_PATH} && \
- dump_trace | gzip -c > $TRACE_DUMPING_PATH
+ echo "Full trace available in $new_trace" > ${TRACE_HEADER_PATH}
+ head -n ${TRACE_HEADER_LINE} /dev/trace >> ${TRACE_HEADER_PATH} &
+ if [ $TRACE_TIMEOUT_SECONDS -gt 0 ]; then
+ timeout_handler $! ${TRACE_HEADER_PATH}
+ else
+ wait $!
+ fi
+ dump_trace | gzip -c > $TRACE_DUMPING_PATH &
+ if [ $TRACE_TIMEOUT_SECONDS -gt 0 ]; then
+ timeout_handler $! ${TRACE_HEADER_PATH}
+ else
+ wait $!
+ fi
mv $TRACE_DUMPING_PATH $new_trace
}