aboutsummaryrefslogtreecommitdiff
path: root/miscutils/update.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-07-22 10:11:27 +0000
committerEric Andersen <andersen@codepoet.org>2003-07-22 10:11:27 +0000
commita501d0f01fa9e5ec10809c5a150250b0d24cc4d6 (patch)
tree8ed0ef2f3ceccde3391bfc63c947d1511961c65a /miscutils/update.c
parent9c3c38da5575b1eca8690855a2e4894d4cab34e2 (diff)
downloadbusybox-w32-a501d0f01fa9e5ec10809c5a150250b0d24cc4d6.tar.gz
busybox-w32-a501d0f01fa9e5ec10809c5a150250b0d24cc4d6.tar.bz2
busybox-w32-a501d0f01fa9e5ec10809c5a150250b0d24cc4d6.zip
Remove the update utility, that is only relevant to older 2.0.x kernels
that are no longer supported.
Diffstat (limited to 'miscutils/update.c')
-rw-r--r--miscutils/update.c107
1 files changed, 0 insertions, 107 deletions
diff --git a/miscutils/update.c b/miscutils/update.c
deleted file mode 100644
index c51f42183..000000000
--- a/miscutils/update.c
+++ /dev/null
@@ -1,107 +0,0 @@
1/* vi: set sw=4 ts=4: */
2/*
3 * Mini update implementation for busybox; much pasted from update-2.11
4 *
5 *
6 * Copyright (C) 1995, 1996 by Bruce Perens <bruce@pixar.com>.
7 * Copyright (c) 1996, 1997, 1999 Torsten Poulin.
8 * Copyright (c) 2000 by Karl M. Hegbloom <karlheg@debian.org>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 */
25
26/*
27 * Note: This program is only necessary if you are running a 2.0.x (or
28 * earlier) kernel. 2.2.x and higher flush filesystem buffers automatically.
29 */
30
31#include <sys/param.h>
32#include <sys/syslog.h>
33#include <unistd.h> /* for getopt() */
34#include <stdlib.h>
35#include <sys/kdaemon.h>
36
37#include "busybox.h"
38
39static unsigned int sync_duration = 30;
40static unsigned int flush_duration = 5;
41static int use_sync = 0;
42
43extern int update_main(int argc, char **argv)
44{
45 int pid;
46 int opt;
47
48 while ((opt = getopt(argc, argv, "Ss:f:")) > 0) {
49 switch (opt) {
50 case 'S':
51 use_sync = 1;
52 break;
53 case 's':
54 sync_duration = atoi(optarg);
55 break;
56 case 'f':
57 flush_duration = atoi(optarg);
58 break;
59 default:
60 bb_show_usage();
61 }
62 }
63
64 if (daemon(0, 1) < 0)
65 bb_perror_msg_and_die("daemon");
66
67#ifdef OPEN_MAX
68 for (pid = 0; pid < OPEN_MAX; pid++) close(pid);
69#else
70 /* glibc 2.1.92 requires using sysconf(_SC_OPEN_MAX) */
71 for (pid = 0; pid < sysconf(_SC_OPEN_MAX); pid++) close(pid);
72#endif
73
74 /* This is no longer necessary since 1.3.5x, but it will harmlessly
75 * exit if that is the case.
76 */
77
78 /* set the program name that will show up in a 'ps' listing */
79 argv[0] = "bdflush (update)";
80 argv[1] = NULL;
81 argv[2] = NULL;
82 for (;;) {
83 if (use_sync) {
84 sleep(sync_duration);
85 sync();
86 } else {
87 sleep(flush_duration);
88 if (bdflush(1, 0) < 0) {
89 openlog("update", LOG_CONS, LOG_DAEMON);
90 syslog(LOG_INFO,
91 "This kernel does not need update(8). Exiting.");
92 closelog();
93 return EXIT_SUCCESS;
94 }
95 }
96 }
97
98 return EXIT_SUCCESS;
99}
100
101/*
102Local Variables:
103c-file-style: "linux"
104c-basic-offset: 4
105tab-width: 4
106End:
107*/