Home | History | Annotate | Download | only in dev
History log of /src/sys/dev/clockctl.c
RevisionDateAuthorComments
 1.39  28-Mar-2022  riastradh driver(9): devsw_detach never fails. Make it return void.

Prune a whole lotta dead branches as a result of this. (Some logic
calling this is also wrong for other reasons; devsw_detach is final
-- you should never have any reason to decide to roll it back. To be
cleaned up in subsequent commits...)

XXX kernel ABI change to devsw_detach signature requires bump
 1.38  21-Feb-2020  joerg Explicitly cast pointers to uintptr_t before casting to enums. They are
not necessarily the same size. Don't cast pointers to bool, check for
NULL instead.
 1.37  01-Mar-2019  pgoyette branches: 1.37.6;
Rename the MODULE_*_HOOK() macros to MODULE_HOOK_*() as briefly
discussed on irc.

NFCI intended.

Ride the earlier kernel bump - it;s getting crowded.
 1.36  27-Jan-2019  pgoyette Merge the [pgoyette-compat] branch
 1.35  21-Nov-2016  rin branches: 1.35.6; 1.35.14; 1.35.16;
- Return ENOTTY rather than EINVAL for invalid ioctl, suggested by
mlelstv.
- Protect NTP stuff in COMPAT_50 codes by NTP macro.

Approved by mlelstv
 1.34  06-Jan-2016  christos branches: 1.34.2;
Simplify and fix the unload to destroy the mutex. To reproduce, configure
a kernel with LOCKDEBUG make clockctl a module:

/etc/rc.d/ntpd stop
modunload clockctl
/etc/rc.d/ntpd start
boom.
 1.33  07-Dec-2015  pgoyette Modularize the clockctl pseudo-device and link to the build.
 1.32  25-Jul-2014  dholland branches: 1.32.4;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.31  16-Mar-2014  dholland branches: 1.31.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.30  27-Oct-2012  chs branches: 1.30.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.29  04-Jan-2012  apb branches: 1.29.6;
When processing ioctl CLOCKCTL_NTP_ADJTIME, set the return value from
ntp_timestatus instead of leaving it uninitialised, and don't use
copyout(9) because args->retval is in kernel space, not user space.

Previously, running ntpd(8) in unprivileged mode would call
libc ntp_adjtime(), which would open /dev/clockctl and call
ioctl(CLOCKCTL_NTP_ADJTIME), which would fail with EFAULT.
 1.28  03-Oct-2009  elad branches: 1.28.12; 1.28.16;
Move clockctl policy exception back to the subsystem.
 1.27  22-Feb-2009  nakayama - fix copyout size in CLOCKCTL_O?ADJTIME.
- add missing break in CLOCKCTL_NTP_ADJTIME.
 1.26  18-Feb-2009  mrg simply the previous as suggested by enami:
- don't check args->tp, just let copyin() fail.
 1.25  18-Feb-2009  mrg clock_settime1() expects the struct timespec * to be in kernel space.
make it so.

fixes crashes seen on sparc64 systems with clockctl.
 1.24  11-Jan-2009  christos branches: 1.24.2;
merge christos-time_t
 1.23  25-Nov-2007  elad branches: 1.23.14; 1.23.16; 1.23.20; 1.23.28;
Refactor time modification checks and place them in the secmodel code.

okay christos@
 1.22  12-May-2007  dsl branches: 1.22.6; 1.22.8; 1.22.14;
Change interface to settimeofday1() so that it can also be used from
compat code in order to avoid the stackgap.
 1.21  04-Mar-2007  christos branches: 1.21.2; 1.21.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.20  16-Nov-2006  christos branches: 1.20.4;
__unused removal on arguments; approved by core.
 1.19  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.18  29-Aug-2006  christos branches: 1.18.2; 1.18.4;
fix incomplete initializer
 1.17  07-Jun-2006  kardel merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
time.tv_sec -> time_second
- struct timeval mono_time is gone
mono_time.tv_sec -> time_uptime
- access to time via
{get,}{micro,nano,bin}time()
get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html
 1.16  09-Mar-2006  christos branches: 1.16.4;
Do not use SCARG() in userland. Eliminates need for <sys/systm.h>.
 1.15  11-Dec-2005  christos branches: 1.15.4; 1.15.6; 1.15.8; 1.15.10;
merge ktrace-lwp.
 1.14  05-Dec-2005  christos - make settime take timespec.
- avoid wrapping of time in settime.
- pass struct proc down so that we can log a detailed message.
 1.13  27-Feb-2005  perry branches: 1.13.4;
nuke trailing whitespace
 1.12  29-Jun-2003  fvdl branches: 1.12.2; 1.12.10; 1.12.12;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.11  28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.10  10-Feb-2003  perry Fix clockctlattach to take an (ignored) int as its parameter, which is
what the rest of the pseudo-device attach infrastructure expects. It
didn't cause any harm that the function signature was wrong because it
ignored what it was passed.
 1.9  23-Oct-2002  jdolecek merge kqueue branch into -current

kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
 1.8  23-Sep-2002  simonb Remove breaks after returns, unreachable returns and returns after
returns(!).
 1.7  06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.6  01-Mar-2002  manu branches: 1.6.6;
Two more trivial bug fixes:
- copyin() the ntv argument to ntp_adjtime1(), to avoid some panics
- correctly handle the return value
And this still relates to kern/15519
 1.5  25-Feb-2002  manu Fixes a bug in argument passing to ntp_adjtime1. patch submitted by
paul@Plectere.com (see kern/15519)
 1.4  09-Dec-2001  manu branches: 1.4.2;
Changed clocktl interface to use syscallargs structures
 1.3  15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.2  13-Nov-2001  lukem add RCSIDs
 1.1  16-Sep-2001  manu branches: 1.1.2; 1.1.4;
This is the clockctl pseudodevice. It gives non root users access to root-only
time-related system calls through ioctls. For instance, if user daemon is able
to write to /dev/clockctl, then it is able to use the CLOCKCTL_SETTIMEOFDAY
ioctl on it, which will be equivalent to a settimeofday.
Approved by Christos
 1.1.4.3  10-Oct-2001  fvdl Convert all remaining devices.
 1.1.4.2  01-Oct-2001  fvdl Catch up with -current.
 1.1.4.1  16-Sep-2001  fvdl file clockctl.c was added on branch thorpej-devvp on 2001-10-01 12:44:11 +0000
 1.1.2.9  11-Nov-2002  nathanw Catch up to -current
 1.1.2.8  18-Oct-2002  nathanw Catch up to -current.
 1.1.2.7  17-Sep-2002  nathanw Catch up to -current.
 1.1.2.6  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.2.5  28-Feb-2002  nathanw Catch up to -current.
 1.1.2.4  08-Jan-2002  nathanw Catch up to -current.
 1.1.2.3  14-Nov-2001  nathanw Catch up to -current.
 1.1.2.2  21-Sep-2001  nathanw Catch up to -current.
 1.1.2.1  16-Sep-2001  nathanw file clockctl.c was added on branch nathanw_sa on 2001-09-21 22:35:27 +0000
 1.4.2.4  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.4.2.3  16-Mar-2002  jdolecek Catch up with -current.
 1.4.2.2  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.2.1  09-Dec-2001  thorpej file clockctl.c was added on branch kqueue on 2002-01-10 19:52:46 +0000
 1.6.6.2  15-Jul-2002  gehenna make this compile.
 1.6.6.1  16-May-2002  gehenna Add the character device switch.
 1.12.12.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.12.10.1  29-Apr-2005  kent sync with -current
 1.12.2.5  11-Dec-2005  christos Sync with head.
 1.12.2.4  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.12.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.12.2.1  02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.13.4.4  07-Dec-2007  yamt sync with head
 1.13.4.3  03-Sep-2007  yamt sync with head.
 1.13.4.2  30-Dec-2006  yamt sync with head.
 1.13.4.1  21-Jun-2006  yamt sync with head.
 1.15.10.1  19-Apr-2006  elad sync with head.
 1.15.8.3  03-Sep-2006  yamt sync with head.
 1.15.8.2  26-Jun-2006  yamt sync with head.
 1.15.8.1  13-Mar-2006  yamt sync with head.
 1.15.6.3  02-Jun-2006  kardel - simplified interface to ntp_adjtime1
 1.15.6.2  30-Apr-2006  kardel - adjust to new interface form the common
implementation
 1.15.6.1  22-Apr-2006  simonb Sync with head.
 1.15.4.1  09-Sep-2006  rpaulo sync with head
 1.16.4.1  19-Jun-2006  chap Sync with head.
 1.18.4.2  10-Dec-2006  yamt sync with head.
 1.18.4.1  22-Oct-2006  yamt sync with head
 1.18.2.1  18-Nov-2006  ad Sync with head.
 1.20.4.2  17-May-2007  yamt sync with head.
 1.20.4.1  12-Mar-2007  rmind Sync with HEAD.
 1.21.4.1  11-Jul-2007  mjf Sync with head.
 1.21.2.1  27-May-2007  ad Sync with head.
 1.22.14.1  08-Dec-2007  mjf Sync with HEAD.
 1.22.8.1  09-Jan-2008  matt sync with HEAD
 1.22.6.1  27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.23.28.2  03-Mar-2009  skrll Sync with HEAD.
 1.23.28.1  19-Jan-2009  skrll Sync with HEAD.
 1.23.20.2  11-Mar-2010  yamt sync with head
 1.23.20.1  04-May-2009  yamt sync with head.
 1.23.16.1  29-Mar-2008  christos Welcome to the time_t=long long dev_t=uint64_t branch.
 1.23.14.2  17-Jan-2009  mjf Sync with HEAD.
 1.23.14.1  05-Apr-2008  mjf - add "file-system DEVFS" and "pseudo-device devfsctl" to conf/std seeing
as these are always needed.

- convert many, many drivers over to the New Devfs World Order. For a
list of device drivers yet to be converted see,
http://www.netbsd.org/~mjf/devfs-todo.html.

- add a new device_unregister_all(device_t) function to remove all device
names associated with a device_t, which saves us having to construct
device names when the driver is detached.

- add a DEV_AUDIO type for devices.
 1.24.2.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.28.16.1  18-Feb-2012  mrg merge to -current.
 1.28.12.3  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.28.12.2  30-Oct-2012  yamt sync with head
 1.28.12.1  17-Apr-2012  yamt sync with head
 1.29.6.3  03-Dec-2017  jdolecek update from HEAD
 1.29.6.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.29.6.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.30.2.1  18-May-2014  rmind sync with head
 1.31.2.1  10-Aug-2014  tls Rebase.
 1.32.4.3  05-Dec-2016  skrll Sync with HEAD
 1.32.4.2  19-Mar-2016  skrll Sync with HEAD
 1.32.4.1  27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.34.2.2  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.34.2.1  20-Jul-2016  pgoyette Adapt machine-independant code to the new {b,c}devsw reference-counting
(using localcount(9)). All callers of {b,c}devsw_lookup() now call
{b,c}devsw_lookup_acquire() which retains a reference on the 'struct
{b,c}devsw'. This reference must be released by the caller once it is
finished with the structure's content (or other data that would disappear
if the 'struct {b,c}devsw' were to disappear).
 1.35.16.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.35.16.1  10-Jun-2019  christos Sync with HEAD
 1.35.14.12  22-Jan-2019  pgoyette Convert the MODULE_{,VOID_}HOOK_CALL macros to do everything in-line
rather than defining an intermediate hook##call function. Almost
all of the hooks are called only once, and although we lose the
ability of doing things like

if (MODULE_HOOK_CALL(...) == 0) ...

we simplify things quite a bit. With this change, we no longer need
to have both declaration and definition macros, and the definition
no longer needs to have both prototype argument list and a "real"
argument list.

FWIW, the above if now needs to written as

int ret;

MODULE_HOOK_CALL(..., ret);
if (ret == 0) ...

with appropriate use of braces {}.
 1.35.14.11  18-Jan-2019  pgoyette Don't restrict hooks to having only int or void types. Pass the hook's
type to the various macros, as needed.

Allows us to reduce diffs to original in at least one or two places (we
no longer have to provide an additional parameter to the hook routine
for returning a non-int return value).
 1.35.14.10  14-Jan-2019  pgoyette Create a variant of the HOOK macros that handles hook routines of
type void, and use them where appropriate.
 1.35.14.9  13-Jan-2019  pgoyette Remove the HOOK2 versions of the MODULE_HOOK macros. There were
only a few uses, and using them led to some lack of clarity in the
code. Instead, we now use two separate hooks, with names that
make it clear(er) what we're doing.

This also positions us to start unraveling some of the rtsock_50
mess, which will need (at least) five hooks.
 1.35.14.8  29-Sep-2018  pgoyette In MODULE_HOOK_CALL_DECL we don't need to provide the actual argument
list for calling the hook function, nor do we need to provide the
default value (for when the hook has not been set).
 1.35.14.7  27-Sep-2018  pgoyette Fix some NTP-related function pointers
 1.35.14.6  24-Sep-2018  pgoyette Revert previous. We need a MP-safe way to determine _at_runtime_ if
the NTP option was included or not.
 1.35.14.5  24-Sep-2018  pgoyette Don't compile NTP-related case if NTP is not available.

No HOOK required here since NTP is not modularized.
 1.35.14.4  18-Sep-2018  pgoyette The COMPAT_HOOK macros were renamed to MODULE_HOOK, adjust all callers
 1.35.14.3  18-Sep-2018  pgoyette Split the COMPAT_CALL_HOOK to separate the declaration from the
implementation. Some hooks are called from multiple source files,
and the old method resulted in duplicate implementations.

Implement MP-safe hooks for the usb_subr_30 code. Pass the helper
functions as arguments to the compat code so it does not have to
determine if the kernel contains usb code.
 1.35.14.2  17-Sep-2018  pgoyette Adapt (most of) the indirect function pointers to the new MP-safe
mechanism. Still remaining are the compat_netbsd32 stuff, and
some usb subroutines.
 1.35.14.1  21-Mar-2018  pgoyette Split the compat_50 code out from the dev/clockctl driver and include
it in the compat_50 and compat modules.
 1.35.6.3  29-Apr-2017  pgoyette Revise previous. Rather than explicitly including <sys/localcount.h>
in all the places where {b,c}devsw is initialized, just include it
from <sys/conf.h>. This avoids an include-sequence dependancy.
 1.35.6.2  29-Apr-2017  pgoyette Add DEVSW_MODULE_INIT to existing device-driver modules, so that they
willl have a localcount defined and thus be permitted to load. Without
a localcount, loading the module will return EINVAL.

XXX the dtrace and drm stuff might need to be fed back upstream?
 1.35.6.1  27-Apr-2017  pgoyette Restore all work from the former pgoyette-localcount branch (which is
now abandoned doe to cvs merge botch).

The branch now builds, and installs via anita. There are still some
problems (cgd is non-functional and all atf tests time-out) but they
will get resolved soon.
 1.37.6.1  29-Feb-2020  ad Sync with head.

RSS XML Feed