summaryrefslogtreecommitdiffstats
path: root/urunlevel/runlevel/boot_time.c
diff options
context:
space:
mode:
Diffstat (limited to 'urunlevel/runlevel/boot_time.c')
-rw-r--r--urunlevel/runlevel/boot_time.c88
1 files changed, 88 insertions, 0 deletions
diff --git a/urunlevel/runlevel/boot_time.c b/urunlevel/runlevel/boot_time.c
new file mode 100644
index 0000000..aa1fde7
--- /dev/null
+++ b/urunlevel/runlevel/boot_time.c
@@ -0,0 +1,88 @@
1/*
2 * Mini time boot implementation for busybox.
3 *
4 * Copyright (C) 2005 by David Seikel won_fang@yahoo.com.au
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 * 02111-1307 USA
20 *
21 */
22
23#include <unistd.h>
24
25#include "busybox.h"
26#include "lib_init_d.h"
27
28
29static int start(struct init_d_handle_s *, int);
30static int status(struct init_d_handle_s *, int);
31static int stop(struct init_d_handle_s *, int);
32
33
34static init_d_handle_t my_commands =
35{
36 &start,
37 &stop,
38 NULL,
39 NULL,
40 &no_reload,
41 NULL,
42 &status,
43 NULL,
44 "boot_time",
45 NULL,
46 NULL,
47 NULL,
48 INIT_D_BEGIN \
49 INIT_D_PROV "$time" \
50 INIT_D_DSTART "1 2 3 4 5" \
51 INIT_D_DSTOP "0 6" \
52 INIT_D_SDESC "Set the system time." \
53 INIT_D_DESC "Set the system time, maybe from the hardware clock," \
54 INIT_D_CONT "maybe from the network via NTP or DATE." \
55 INIT_D_END
56};
57// INIT_D_SSTART "$network" \
58
59
60int boot_time_main(int argc, char **argv)
61{
62 return do_init_from_main(argc, argv, &my_commands);
63}
64
65
66static int start(struct init_d_handle_s *init_d, int just_checking)
67{
68// Should check if we need to NTP or whatever
69// Should check for -l/-u
70 doit(0, "/sbin/hwclock -su");
71// Should check errno and convert into INIT_D_ERROR_?
72 return INIT_D_OK;
73}
74
75
76static int status(struct init_d_handle_s *init_d, int quiet)
77{
78 return print_status(init_d, quiet, INIT_D_STATUS_OK);
79}
80
81
82static int stop(struct init_d_handle_s *init_d, int just_checking)
83{
84// Should check for -l/-u
85 doit(0, "/sbin/hwclock -wu");
86// Should check errno and convert into INIT_D_ERROR_?
87 return INIT_D_OK;
88}