summaryrefslogtreecommitdiffstats
path: root/sys-utils/wdctl.c
Commit message (Collapse)AuthorAgeFilesLines
* wdctl: remove duplicate include of <unistd.h>Patrick Steinhardt2019-08-191-1/+0Star
| | | | | | | The <unistd.h> header is included twice in "wdctl.c". Remove one of these includes to keep "make checkincludes" happy. Signed-off-by: Patrick Steinhardt <ps@pks.im>
* wdctl; read from /sys if necessaryKarel Zak2019-06-171-9/+72
| | | | | | | | | | | | The device can be inaccessible for non-root user or busy (already used by another process). In this case it seems better to read information from /sys. Note that /sys does not provide struct watchdog_info.options, so we cannot print list of supported watchdog features. Addresses: https://github.com/karelzak/util-linux/issues/804 Signed-off-by: Karel Zak <kzak@redhat.com>
* wdctl: default to /dev/watchdog0Karel Zak2019-06-171-7/+36
| | | | | | | Let's use miscdev /dev/watchdog as fallback only. We need (if possible) cdev /dev/watchdog0 as this device has entry in /sys/class/watchdog. Signed-off-by: Karel Zak <kzak@redhat.com>
* wdctl: remove printing from main()Karel Zak2019-06-171-27/+35
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* wdctl: add control structKarel Zak2019-06-171-27/+31
| | | | | | | * remove global variables * keep all together Signed-off-by: Karel Zak <kzak@redhat.com>
* wdctl: rename watch dog info structKarel Zak2019-06-171-27/+27
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: consolidate version printing and close_stdout()Karel Zak2019-04-161-6/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* wdctl: do not call fsync(2) when closing watchdog deviceSami Kerola2017-07-311-2/+2
| | | | | | | | | | | This removes bogus write failed warning. $ wdctl wdctl: write failed: Invalid argument Device: /dev/watchdog [...] Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: consolidate macro style USAGE_HELP_OPTIONSRuediger Meier2017-06-291-2/+2
| | | | | | | | | changed in include/c.h and applied via sed: sed -i 's/fprintf.*\(USAGE_MAN_TAIL.*\)/printf(\1/' $(git ls-files -- "*.c") sed -i 's/print_usage_help_options\(.*\);/printf(USAGE_HELP_OPTIONS\1);/' $(git ls-files -- "*.c") Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: introduce print_usage_help_options()Ruediger Meier2017-06-271-2/+1Star
| | | | | | | | | | | | Consolidate --help and --version descriptions. We are now able to align them to the other options. We changed include/c.h. The rest of this patch was generated by sed, plus manually setting the right alignment numbers. We do not change anything but white spaces in the --help output. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: cosmetics, remove argument from usage(FILE*)Ruediger Meier2017-06-261-3/+4
| | | | | | | | | | | | | | This patch is trivial and changes nothing, because we were always using usage(stdout) Now all our usage() functions look very similar. If wanted we could auto-generate another big cosmetical patch to remove all the useless "FILE *out" constants and use printf and puts rather than their f* friends. Such patch could be automatically synchronized with the translation project (newlines!) to not make the translators sick. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* include/c.h: add USAGE_COMMANDS and USAGE_COLUMNSJ William Piggott2017-06-241-2/+1Star
| | | | | | | | | | | | * login-utils/lslogins.c: all uses changed * misc-utils/findmnt.c: likewise * sys-utils/blkzone.c: likewise * disk-utils/sfdisk.c: likewise * sys-utils/lscpu.c: likewise * sys-utils/lsmem.c: likewise * sys-utils/wdctl.c: likewise Signed-off-by: J William Piggott <elseifthen@gmx.com>
* misc: consolidate smartcols error messagesKarel Zak2017-05-181-5/+7
| | | | | | ... just to keep translators happy Signed-off-by: Karel Zak <kzak@redhat.com>
* docs: Fix word repetitionsYuri Chornoivan2017-02-131-1/+1
|
* Use --help suggestion on invalid optionKarel Zak2016-12-191-3/+1Star
| | | | | | | | The current default is to print all usage() output. This is overkill in many case. Addresses: https://github.com/karelzak/util-linux/issues/338 Signed-off-by: Karel Zak <kzak@redhat.com>
* wdct: mark usage() as noreturn [coverity scan]Karel Zak2016-10-051-1/+1
|
* textual: add a docstring to most of the utilitiesBenno Schulenberg2015-01-061-1/+3
| | | | | | | | | This adds a concise description of a tool to its usage text. A first form of this patch was proposed by Steven Honeyman (see http://www.spinics.net/lists/util-linux-ng/msg09994.html). Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* wdctl: clean up columns[] usageKarel Zak2014-07-181-5/+4Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: add debug messagesKarel Zak2014-06-061-0/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: clean up flags usageKarel Zak2014-04-031-3/+3
| | | | | | | | | * rename flags functions to scols_table_enable_* * rename *_no_foo() functions to _nofoo() * output formats are mutually exclusive, so don't use flags there * don't assume symbols in scols_new_table(), use scols_table_set_symbols() Signed-off-by: Karel Zak <kzak@redhat.com>
* wdctl: clean up scols usageKarel Zak2014-04-031-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* wdctl: use libsmartcolsOndrej Oprala2014-04-031-22/+30
| | | | Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
* wdctl: pluralize one thrice-repeated messageBenno Schulenberg2013-10-081-3/+6
| | | | | | | Also put in one hard space, to keep text and number separated when the translated string should be too long. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* wdctl: gettextize and pluralize one forgotten messageBenno Schulenberg2013-10-081-1/+2
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* wdctl: use TT_FL_FREEDATA for tt tableKarel Zak2013-09-161-2/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* wdctl: check writing to a file descriptor was successfulSami Kerola2013-04-261-2/+4
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* wdctl: add fallbacks for old kernel headersKarel Zak2012-09-071-1/+24
| | | | | Reported-by: Moritz Barsnick <barsnick@gmx.net> Signed-off-by: Karel Zak <kzak@redhat.com>
* wdctl: treat aligned translatable strings in a uniform mannerBenno Schulenberg2012-09-041-1/+2
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* wdctl: gettextize one forgotten wordBenno Schulenberg2012-09-041-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* wdctl: add "--settimeout" to set the timeoutHarald Hoyer2012-08-021-10/+77
| | | | | | | [kzak@redhat.com: - fix usage() and man page] Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: Harald Hoyer <harald@redhat.com>
* wdctl: fix conflicting types on old systemsSami Kerola2012-07-261-1/+1
| | | | | | | | | | | | | | | The program wants the userland version of declaration(s), not the kernel one. Problem occured with glibc-devel-2.5-34. /usr/include/stdint.h:41: error: conflicting types for 'int64_t' /usr/include/linux/types.h:98: error: previous declaration of 'int64_t' was here /usr/include/stdint.h:56: error: conflicting types for 'uint64_t' /usr/include/linux/types.h:96: error: previous declaration of 'uint64_t' was here In file included from /usr/include/stdlib.h:438, from ./include/c.h:13, from sys-utils/wdctl.c:30: Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* wdctl: use err_exclusive_options()Karel Zak2012-07-261-9/+9
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* translation: unify file open error messagesSami Kerola2012-07-161-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* wdctl: correct manual section referenceSami Kerola2012-06-171-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* wdctl: use exclusive_option()Sami Kerola2012-06-171-3/+10
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* wdctl: add --onelineKarel Zak2012-05-221-10/+60
| | | | | | | | | | | | | * remove --pairs, it was usable for flags table only * one line for each watchdog device For example: # wdctl --noident --noflags --oneline /dev/watchdog: TIMEOUT="30" TIMELEFT="2" Signed-off-by: Karel Zak <kzak@redhat.com>
* wdctl: allow to specify more than one deviceKarel Zak2012-05-221-37/+45
| | | | | | | | * remove -d <device> option * support wdctl [options] [<device> ...] usage Signed-off-by: Karel Zak <kzak@redhat.com>
* wdctl: add --flags-only and optional column DEVICEKarel Zak2012-05-181-4/+17
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* wdctl: make timeouts output more parsableKarel Zak2012-05-041-33/+7Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* wdctl: rewrite to use lib/ttKarel Zak2012-05-031-91/+365
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* wdctl: align with other util-linux commandsSami Kerola2012-05-031-3/+7
| | | | | | | | | * Add watchdog device path to pathnames.h * Check output stream status at exit. * Adjust usage() notation to follow howto file. * Retire numeric return value. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* wdctl: add watchdog status toolLennart Poettering2012-04-161-0/+180
For: util-linux This patch adds a tiny tool "wdctl" which may be used to query the status of Linux watchdog devices (/dev/watchdog). This will simply query all fields that may be queried from the device and print them nicely formatted. Signed-off-by: Lennart Poettering <lennart@poettering.net>