mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-30 22:26:55 +00:00
[WATCHDOG] doc: Fix use of WDIOC_SETOPTIONS ioctl.
In the watchdog-test program and watchdog-api.txt, pass the values to the WDIOC_SETOPTIONS ioctl as a pointer to an integer containing the values intead of directly in the third ioctl argument. The actual watchdog drivers in drivers/watchdog don't read the options directly from the argument but use get_user and copy_from_user. Signed-off-by: James Hogan <james.hogan@imgtec.com> Signed-off-by: Wim Van Sebroeck <wim@iguana.be> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
cf9cf9aed1
commit
dfc333834c
2 changed files with 8 additions and 5 deletions
|
@ -31,6 +31,8 @@ static void keep_alive(void)
|
||||||
*/
|
*/
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
int flags;
|
||||||
|
|
||||||
fd = open("/dev/watchdog", O_WRONLY);
|
fd = open("/dev/watchdog", O_WRONLY);
|
||||||
|
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
|
@ -41,12 +43,14 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
if (!strncasecmp(argv[1], "-d", 2)) {
|
if (!strncasecmp(argv[1], "-d", 2)) {
|
||||||
ioctl(fd, WDIOC_SETOPTIONS, WDIOS_DISABLECARD);
|
flags = WDIOS_DISABLECARD;
|
||||||
|
ioctl(fd, WDIOC_SETOPTIONS, &flags);
|
||||||
fprintf(stderr, "Watchdog card disabled.\n");
|
fprintf(stderr, "Watchdog card disabled.\n");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
exit(0);
|
exit(0);
|
||||||
} else if (!strncasecmp(argv[1], "-e", 2)) {
|
} else if (!strncasecmp(argv[1], "-e", 2)) {
|
||||||
ioctl(fd, WDIOC_SETOPTIONS, WDIOS_ENABLECARD);
|
flags = WDIOS_ENABLECARD;
|
||||||
|
ioctl(fd, WDIOC_SETOPTIONS, &flags);
|
||||||
fprintf(stderr, "Watchdog card enabled.\n");
|
fprintf(stderr, "Watchdog card enabled.\n");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
|
@ -222,11 +222,10 @@ returned value is the temperature in degrees fahrenheit.
|
||||||
ioctl(fd, WDIOC_GETTEMP, &temperature);
|
ioctl(fd, WDIOC_GETTEMP, &temperature);
|
||||||
|
|
||||||
Finally the SETOPTIONS ioctl can be used to control some aspects of
|
Finally the SETOPTIONS ioctl can be used to control some aspects of
|
||||||
the cards operation; right now the pcwd driver is the only one
|
the cards operation.
|
||||||
supporting this ioctl.
|
|
||||||
|
|
||||||
int options = 0;
|
int options = 0;
|
||||||
ioctl(fd, WDIOC_SETOPTIONS, options);
|
ioctl(fd, WDIOC_SETOPTIONS, &options);
|
||||||
|
|
||||||
The following options are available:
|
The following options are available:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue