diff options
author | Thorsten Lockert <tholo@cvs.openbsd.org> | 2004-07-28 17:15:13 +0000 |
---|---|---|
committer | Thorsten Lockert <tholo@cvs.openbsd.org> | 2004-07-28 17:15:13 +0000 |
commit | c65eb6dac1a01e8aedf3be76a030db86be9264f4 (patch) | |
tree | a775e61964a48db2019d60bb802076883a9b047b /sbin | |
parent | 953666701c83d79c01d0ce862cd14f2120a66b7c (diff) |
This touches only MI code, and adds new time keeping code. The
code is all conditionalized on __HAVE_TIMECOUNTER, and not
enabled on any platforms.
adjtime(2) support exists, courtesy of nordin@, sysctl(2) support
and a concept of quality for each time source attached exists.
High quality time sources exists for PIIX4 ACPI timer as well as
some AMD power management chips. This will have to be redone
once we actually add ACPI support (at that time we need to use
the ACPI interfaces to get at these clocks).
ok art@ ken@ miod@ jmc@ and many more
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/sysctl/sysctl.8 | 6 | ||||
-rw-r--r-- | sbin/sysctl/sysctl.c | 33 |
2 files changed, 36 insertions, 3 deletions
diff --git a/sbin/sysctl/sysctl.8 b/sbin/sysctl/sysctl.8 index 8f210f4bc31..212be088bb3 100644 --- a/sbin/sysctl/sysctl.8 +++ b/sbin/sysctl/sysctl.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: sysctl.8,v 1.122 2004/05/07 21:58:14 millert Exp $ +.\" $OpenBSD: sysctl.8,v 1.123 2004/07/28 17:15:12 tholo Exp $ .\" $NetBSD: sysctl.8,v 1.4 1995/09/30 07:12:49 thorpej Exp $ .\" .\" Copyright (c) 1993 @@ -188,6 +188,10 @@ privilege can change the value. .It kern.emul.nemuls integer no .It kern.emul.other integer yes .It kern.maxclusters integer yes +.It kern.timecounter.tick integer no +.It kern.timecounter.timestepwarnings integer no +.It kern.timecounter.hardware string yes +.It kern.timecounter.choice string no .It vm.vmmeter struct no .It vm.loadavg struct no .It vm.psstrings struct no diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c index 9536913ec71..dd176c9a41d 100644 --- a/sbin/sysctl/sysctl.c +++ b/sbin/sysctl/sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sysctl.c,v 1.113 2004/04/15 00:23:17 tedu Exp $ */ +/* $OpenBSD: sysctl.c,v 1.114 2004/07/28 17:15:12 tholo Exp $ */ /* $NetBSD: sysctl.c,v 1.9 1995/09/30 07:12:50 thorpej Exp $ */ /* @@ -40,7 +40,7 @@ static const char copyright[] = #if 0 static const char sccsid[] = "@(#)sysctl.c 8.5 (Berkeley) 5/9/95"; #else -static const char rcsid[] = "$OpenBSD: sysctl.c,v 1.113 2004/04/15 00:23:17 tedu Exp $"; +static const char rcsid[] = "$OpenBSD: sysctl.c,v 1.114 2004/07/28 17:15:12 tholo Exp $"; #endif #endif /* not lint */ @@ -131,6 +131,7 @@ struct ctlname ttyname[] = CTL_KERN_TTY_NAMES; struct ctlname semname[] = CTL_KERN_SEMINFO_NAMES; struct ctlname shmname[] = CTL_KERN_SHMINFO_NAMES; struct ctlname watchdogname[] = CTL_KERN_WATCHDOG_NAMES; +struct ctlname tcname[] = CTL_KERN_TIMECOUNTER_NAMES; struct ctlname *vfsname; #ifdef CTL_MACHDEP_NAMES struct ctlname machdepname[] = CTL_MACHDEP_NAMES; @@ -207,6 +208,7 @@ int sysctl_malloc(char *, char **, int *, int, int *); int sysctl_seminfo(char *, char **, int *, int, int *); int sysctl_shminfo(char *, char **, int *, int, int *); int sysctl_watchdog(char *, char **, int *, int, int *); +int sysctl_tc(char *, char **, int *, int, int *); int sysctl_sensors(char *, char **, int *, int, int *); int sysctl_emul(char *, char *, int); #ifdef CPU_CHIPSET @@ -434,6 +436,12 @@ parse(char *string, int flags) if (len < 0) return; break; + case KERN_TIMECOUNTER: + len = sysctl_tc(string, &bufp, mib, flags, + &type); + if (len < 0) + return; + break; case KERN_EMUL: sysctl_emul(string, newval, flags); return; @@ -1417,6 +1425,7 @@ struct list ttylist = { ttyname, KERN_TTY_MAXID }; struct list semlist = { semname, KERN_SEMINFO_MAXID }; struct list shmlist = { shmname, KERN_SHMINFO_MAXID }; struct list watchdoglist = { watchdogname, KERN_WATCHDOG_MAXID }; +struct list tclist = { tcname, KERN_TIMECOUNTER_MAXID }; /* * handle vfs namei cache statistics @@ -1975,6 +1984,26 @@ sysctl_watchdog(char *string, char **bufpp, int mib[], int flags, } /* + * Handle timecounter support + */ +int +sysctl_tc(char *string, char **bufpp, int mib[], int flags, + int *typep) +{ + int indx; + + if (*bufpp == NULL) { + listall(string, &tclist); + return (-1); + } + if ((indx = findname(string, "third", bufpp, &tclist)) == -1) + return (-1); + mib[2] = indx; + *typep = tclist.list[indx].ctl_type; + return (3); +} + +/* * Handle hardware monitoring sensors support */ int |