cytune: rename threshold and timeout variables

Especially the treshold was difficult to read, as the variable name had
no reference what it was setting.  Effect of the variables
s/get/get_current/ and s/get_def/get_defaults/ seem to documented wrong
way, that became apparent after looking into this name space.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cytune: remove unnecessary variables

Exit immediately at error.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cytune: be consistent with interval data type

The sleep(3) uses unsigned int as input.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cytune: use single loop for setting and getting ioctl() calls

This commit also fixes functional bug.  Documentation gives an idea one
might set current, and default values in one go but as a matter of fact
that did not work earlier.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cytune: kernel still does not have send_count in cyclades_monitor structure

It is unlikely the information about sent data will ever appear to kernel
interface, so stop waiting it.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cytune: prefer sigaction(), and remove unnecessary abstractions

The signal(3) system call is not exactly deprecated, but it should not be
used in new code.  The gettimeofday() does not require timezone to be
real variable, so get rid of it.  The mvtime #define was in use only
which make literal expression more readable.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cytune: add cyg_get_mon() to avoid duplicate code

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cytune: add structure to hold run time configuration

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cytune: pull signal handling and statistic priting apart

Combination of these two functions made the code to rely to global
variables, and cmon_index was seemingly invalid if signal was sent at a
time when query_tty_stats() was half done with a statistics printout.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cytune: remove unnecessary type casts

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cytune: deprecate undescriptive options

The options with 'flush' in the name are not very good.  Use of 'timeout'
instead is much more appropriate.

Reviewed-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cytune: add filename to struct cyclades_control

This allows point to single structure rather than constantly worry if the
index variable to list is referring to correct location.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cytune: add noreturn function attributes

The query_tty_stats() will exit only when it is signaled to stop.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cytune: use matching type in struct cyclades_control with kernel

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cytune: update copyright

Take the blame of bugs I (hopefully did not) introduce.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
cytune: improve messaging

Reviewed-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>