comparison vd_watchdog/vd_watchdog.c @ 3:60a234c9c03f

Add 2-clause BSD license
author Thinker K.F. Li <thinker@branda.to>
date Tue, 08 Jul 2008 12:13:58 +0800
parents 89e9d591748d
children 5fa5e5199d1a
comparison
equal deleted inserted replaced
2:89e9d591748d 3:60a234c9c03f
1 /*-
2 * Copyright (c) 2008 Kueifong Li <thinker@branda.to>.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
15 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
16 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
18 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 * POSSIBILITY OF SUCH DAMAGE.
25 */
1 #include <stdio.h> 26 #include <stdio.h>
2 #include <stdlib.h> 27 #include <stdlib.h>
3 #include <unistd.h> 28 #include <unistd.h>
4 #include <fcntl.h> 29 #include <fcntl.h>
5 #include <sys/ioctl.h> 30 #include <sys/ioctl.h>
99 timeout = 30; /* default: 30s */ 124 timeout = 30; /* default: 30s */
100 unit = VDT_1S; 125 unit = VDT_1S;
101 126
102 while((ch = getopt(argc, argv, "")) != -1) { 127 while((ch = getopt(argc, argv, "")) != -1) {
103 switch(ch) { 128 switch(ch) {
129 /* 4ms unit is not used for too short to sleep. */
104 case 's': 130 case 's':
105 unit = VDT_1S; 131 unit = VDT_1S;
106 break; 132 break;
107 case 'M': 133 case 'M':
108 unit = VDT_1M; 134 unit = VDT_1M;