aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/platform.h17
-rw-r--r--miscutils/adjtimex.c61
2 files changed, 20 insertions, 58 deletions
diff --git a/include/platform.h b/include/platform.h
index 23adc7b47..b77d815f8 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -210,4 +210,21 @@ typedef unsigned long long int uintmax_t;
210#else 210#else
211#define bb_setpgrp setpgrp() 211#define bb_setpgrp setpgrp()
212#endif 212#endif
213
214// I have no idea what platform this was for since aldot didn't say, but
215// it belongs here since Linux doesn't need it.
216
217#if !defined ADJ_OFFSET_SINGLESHOT && defined MOD_CLKA && defined MOD_OFFSET
218#define ADJ_OFFSET_SINGLESHOT (MOD_CLKA | MOD_OFFSET)
219#endif
220#if !defined ADJ_FREQUENCY && defined MOD_FREQUENCY
221#define ADJ_FREQUENCY MOD_FREQUENCY
222#endif
223#if !defined ADJ_TIMECONST && defined MOD_TIMECONST
224#define ADJ_TIMECONST MOD_TIMECONST
225#endif
226#if !defined ADJ_TICK && defined MOD_CLKB
227#define ADJ_TICK MOD_CLKB
228#endif
229
213#endif /* platform.h */ 230#endif /* platform.h */
diff --git a/miscutils/adjtimex.c b/miscutils/adjtimex.c
index b5e87ba6e..905b80f47 100644
--- a/miscutils/adjtimex.c
+++ b/miscutils/adjtimex.c
@@ -5,39 +5,9 @@
5 * Last hack: March 2001 5 * Last hack: March 2001
6 * Copyright 1997, 2000, 2001 Larry Doolittle <LRDoolittle@lbl.gov> 6 * Copyright 1997, 2000, 2001 Larry Doolittle <LRDoolittle@lbl.gov>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License (Version 2,
10 * June 1991) as published by the Free Software Foundation. At the
11 * time of writing, that license was published by the FSF with the URL
12 * http://www.gnu.org/copyleft/gpl.html, and is incorporated herein by
13 * reference.
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
18 * GNU General Public License for more details.
19 *
20 * This adjtimex(1) is very similar in intent to adjtimex(8) by Steven
21 * Dick <ssd@nevets.oau.org> and Jim Van Zandt <jrv@vanzandt.mv.com>
22 * (see http://metalab.unc.edu/pub/Linux/system/admin/time/adjtimex*).
23 * That version predates this one, and is _much_ bigger and more
24 * featureful. My independently written version was very similar to
25 * Steven's from the start, because they both follow the kernel timex
26 * structure. I further tweaked this version to be equivalent to Steven's
27 * where possible, but I don't like getopt_long, so the actual usage
28 * syntax is incompatible.
29 *
30 * Amazingly enough, my Red Hat 5.2 sys/timex (and sub-includes)
31 * don't actually give a prototype for adjtimex(2), so building
32 * this code (with -Wall) gives a warning. Later versions of
33 * glibc fix this issue.
34 *
35 * This program is too simple for a Makefile, just build with:
36 * gcc -Wall -O adjtimex.c -o adjtimex
37 *
38 * busyboxed 20 March 2001, Larry Doolittle <ldoolitt@recycle.lbl.gov> 8 * busyboxed 20 March 2001, Larry Doolittle <ldoolitt@recycle.lbl.gov>
39 * It will autosense if it is built in a busybox environment, based 9 *
40 * on the BB_VER preprocessor macro. 10 * Licensed under GPLv2 or later, see file License in this tarball for details.
41 */ 11 */
42 12
43#include <stdio.h> 13#include <stdio.h>
@@ -47,19 +17,6 @@
47#include <sys/timex.h> 17#include <sys/timex.h>
48#include "busybox.h" 18#include "busybox.h"
49 19
50#if !defined ADJ_OFFSET_SINGLESHOT && defined MOD_CLKA && defined MOD_OFFSET
51#define ADJ_OFFSET_SINGLESHOT (MOD_CLKA | MOD_OFFSET)
52#endif
53#if !defined ADJ_FREQUENCY && defined MOD_FREQUENCY
54#define ADJ_FREQUENCY MOD_FREQUENCY
55#endif
56#if !defined ADJ_TIMECONST && defined MOD_TIMECONST
57#define ADJ_TIMECONST MOD_TIMECONST
58#endif
59#if !defined ADJ_TICK && defined MOD_CLKB
60#define ADJ_TICK MOD_CLKB
61#endif
62
63static const struct {int bit; const char *name;} statlist[] = { 20static const struct {int bit; const char *name;} statlist[] = {
64 { STA_PLL, "PLL" }, 21 { STA_PLL, "PLL" },
65 { STA_PPSFREQ, "PPSFREQ" }, 22 { STA_PPSFREQ, "PPSFREQ" },
@@ -84,19 +41,7 @@ static const char * const ret_code_descript[] = {
84 "leap second has occurred", 41 "leap second has occurred",
85 "clock not synchronized" }; 42 "clock not synchronized" };
86 43
87#ifdef BB_VER 44int adjtimex_main(int argc, char **argv)
88#define main adjtimex_main
89#else
90void usage(char *prog)
91{
92 fprintf(stderr,
93 "Usage: %s [ -q ] [ -o offset ] [ -f frequency ] [ -p timeconstant ] [ -t tick ]\n",
94 prog);
95}
96#define bb_show_usage() usage(argv[0])
97#endif
98
99int main(int argc, char ** argv)
100{ 45{
101 struct timex txc; 46 struct timex txc;
102 int quiet=0; 47 int quiet=0;