The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/watchdog.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
    3  *
    4  * Copyright (c) 2003 Poul-Henning Kamp
    5  * Copyright (c) 2013 iXsystems.com,
    6  *                    author: Alfred Perlstein <alfred@freebsd.org>
    7  *
    8  * All rights reserved.
    9  *
   10  * Redistribution and use in source and binary forms, with or without
   11  * modification, are permitted provided that the following conditions
   12  * are met:
   13  * 1. Redistributions of source code must retain the above copyright
   14  *    notice, this list of conditions and the following disclaimer.
   15  * 2. Redistributions in binary form must reproduce the above copyright
   16  *    notice, this list of conditions and the following disclaimer in the
   17  *    documentation and/or other materials provided with the distribution.
   18  *
   19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   29  * SUCH DAMAGE.
   30  *
   31  * $FreeBSD: releng/12.0/sys/sys/watchdog.h 327505 2018-01-03 00:56:30Z karels $
   32  */
   33 #ifndef _SYS_WATCHDOG_H
   34 #define _SYS_WATCHDOG_H
   35 
   36 #include <sys/ioccom.h>
   37 
   38 #define _PATH_WATCHDOG  "fido"
   39 
   40 #define WDIOCPATPAT     _IOW('W', 42, u_int)    /* pat the watchdog */
   41 #define WDIOC_SETTIMEOUT    _IOW('W', 43, int)  /* set/reset the timer */
   42 #define WDIOC_GETTIMEOUT    _IOR('W', 44, int)  /* get total timeout */
   43 #define WDIOC_GETTIMELEFT   _IOR('W', 45, int)  /* get time left */
   44 #define WDIOC_GETPRETIMEOUT _IOR('W', 46, int)  /* get the pre-timeout */
   45 #define WDIOC_SETPRETIMEOUT _IOW('W', 47, int)  /* set the pre-timeout */
   46 /* set the action when a pre-timeout occurs see: WD_SOFT_* */
   47 #define WDIOC_SETPRETIMEOUTACT _IOW('W', 48, int)
   48 
   49 /* use software watchdog instead of hardware */
   50 #define WDIOC_SETSOFT   _IOW('W', 49, int)
   51 #define WDIOC_SETSOFTTIMEOUTACT _IOW('W', 50, int)
   52 
   53 #define WD_ACTIVE       0x8000000
   54         /* 
   55          * Watchdog reset, timeout set to value in WD_INTERVAL field.
   56          * The kernel will arm the watchdog and unless the userland
   57          * program calls WDIOCPATPAT again before the timer expires
   58          * the system will reinitialize.
   59          */
   60 
   61 #define WD_PASSIVE      0x0400000
   62         /*
   63          * Set the watchdog in passive mode.
   64          * The kernel will chose an appropriate timeout duration and
   65          * periodically reset the timer provided everything looks all
   66          * right to the kernel.
   67          */
   68 
   69 #define WD_LASTVAL      0x0200000
   70         /*
   71          * Use the already last used timeout value.
   72          * The kernel will use as timeout the last valid timeout provided.
   73          */
   74 
   75 #define WD_INTERVAL     0x00000ff
   76         /*
   77          * Mask for duration bits.
   78          * The watchdog will have a nominal patience of 2^N * nanoseconds.
   79          * Example:  N == 30 gives a patience of 2^30 nanoseconds ~= 1 second.
   80          * NB: Expect variance in the +/- 10-20% range.
   81          */
   82 
   83 /* Handy macros for humans not used to power of two nanoseconds */
   84 #define WD_TO_NEVER     0
   85 #define WD_TO_1MS       20
   86 #define WD_TO_125MS     27
   87 #define WD_TO_250MS     28
   88 #define WD_TO_500MS     29
   89 #define WD_TO_1SEC      30
   90 #define WD_TO_2SEC      31
   91 #define WD_TO_4SEC      32
   92 #define WD_TO_8SEC      33
   93 #define WD_TO_16SEC     34
   94 #define WD_TO_32SEC     35
   95 #define WD_TO_64SEC     36
   96 #define WD_TO_128SEC    37
   97 
   98 /* action on pre-timeout trigger */
   99 #define WD_SOFT_PANIC   0x01    /* panic */
  100 #define WD_SOFT_DDB     0x02    /* enter debugger */
  101 #define WD_SOFT_LOG     0x04    /* log(9) */
  102 #define WD_SOFT_PRINTF  0x08    /* printf(9) */
  103 #define WD_SOFT_MASK    0x0f    /* all of the above */
  104 
  105 #ifdef _KERNEL
  106 
  107 #include <sys/eventhandler.h>
  108 
  109 typedef void (*watchdog_fn)(void *, u_int, int *);
  110 
  111 EVENTHANDLER_DECLARE(watchdog_list, watchdog_fn);
  112 
  113 u_int   wdog_kern_last_timeout(void);
  114 int     wdog_kern_pat(u_int utim);
  115 
  116 /*
  117  * The following function pointer is used to attach a software watchdog
  118  * if no hardware watchdog has been attached, and if the software module
  119  * has initialized the function pointer.
  120  */
  121 
  122 extern void (*wdog_software_attach)(void);
  123 #endif
  124 
  125 #endif /* _SYS_WATCHDOG_H */

Cache object: c917b95f78c9af338638e2ee35d8de5b


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.