Home | History | Annotate | Download | only in dev
History log of /src/sys/dev/cons.c
RevisionDateAuthorComments
 1.95  02-Sep-2023  riastradh heartbeat(9): Move #ifdef HEARTBEAT to sys/heartbeat.h.

Less error-prone this way, and the callers are less cluttered.
 1.94  02-Sep-2023  riastradh cons(9): Suspend heartbeat checks while in polled-input mode.

This goes into a tight loop at high IPL, so it is to be expected that
the heartbeats will stop happening.

Should fix heartbeat panics at root device prompt on boot.
 1.93  02-Sep-2023  riastradh cons(9): Sort includes.

No functional change intended.
 1.92  25-Oct-2022  riastradh console(4), constty(4): Rip off the kernel lock, take three.
 1.91  25-Oct-2022  riastradh constty(4): Make MP-safe, take three.

Access to the global constty variable is coordinated as follows:

1. Setting constty to nonnull, with atomic_store_release, is allowed
only under the new adaptive constty_lock in thread context. This
serializes TIOCCONS operations and ensures unlocked readers can
safely use a constty pointer read with atomic_load_consume.

2. Changing constty from nonnull to null, with atomic_cas_ptr, is
allowed in any context -- printf(9) uses this to disable a broken
constty.

3. Reading constty under constty_lock is allowed with
atomic_load_relaxed, because while constty_lock is held, it can
only be made null by some other thread/CPU, never made nonnull.

4. Reading constty outside constty_lock is allowed with
atomic_load_consume in a pserialize read section -- constty is
only ever made nonnull with atomic_store_release, in (1).
ttyclose will wait for all these pserialize read sections to
complete before flushing the tty.

5. To continue to use a struct tty pointer in (4) after the
pserialize read section has completed, caller must use tty_acquire
during the pserialize read section and then tty_release when done.
ttyclose will wait for all these references to drain before
returning.

These access rules allow us to serialize TIOCCONS, and safely destroy
ttys, without putting any locks on the access paths like printf(9)
that use constty. Once we set D_MPSAFE, operations on /dev/console
will contend only with other users of the same tty as constty, which
will be an improvement over contending with all other kernel lock
users in the system.

Changes second time around:
- Fix initialization of ok in cons.c cn_redirect.
- Fix reversed sense of conditional in subr_prf.c putone.

Changes third time around:
- Initialize ttyref_cv so we don't panic when trying to use it,
leading to infinite loop when panic tries to take tty_lock to print
the panic message while we already hold tty_lock.
 1.90  07-Oct-2022  riastradh Revert "constty(4): Make MP-safe."

Something is still busted and this is interfering with the releng
amd64 testbed.
 1.89  07-Oct-2022  riastradh Revert "console(4), constty(4): Rip off the kernel lock, take two."

Something is still busted and this is interfering with the releng
amd64 testbed.
 1.88  06-Oct-2022  riastradh console(4), constty(4): Rip off the kernel lock, take two.
 1.87  06-Oct-2022  riastradh constty(4): Make MP-safe.

Access to the global constty variable is coordinated as follows:

1. Setting constty to nonnull, with atomic_store_release, is allowed
only under the new adaptive constty_lock in thread context. This
serializes TIOCCONS operations and ensures unlocked readers can
safely use a constty pointer read with atomic_load_consume.

2. Changing constty from nonnull to null, with atomic_cas_ptr, is
allowed in any context -- printf(9) uses this to disable a broken
constty.

3. Reading constty under constty_lock is allowed with
atomic_load_relaxed, because while constty_lock is held, it can
only be made null by some other thread/CPU, never made nonnull.

4. Reading constty outside constty_lock is allowed with
atomic_load_consume in a pserialize read section -- constty is
only ever made nonnull with atomic_store_release, in (1).
ttyclose will wait for all these pserialize read sections to
complete before flushing the tty.

5. To continue to use a struct tty pointer in (4) after the
pserialize read section has completed, caller must use tty_acquire
during the pserialize read section and then tty_release when done.
ttyclose will wait for all these references to drain before
returning.

These access rules allow us to serialize TIOCCONS, and safely destroy
ttys, without putting any locks on the access paths like printf(9)
that use constty. Once we set D_MPSAFE, operations on /dev/console
will contend only with other users of the same tty as constty, which
will be an improvement over contending with all other kernel lock
users in the system.

Changes second time around:
- Fix initialization of ok in cons.c cn_redirect.
- Fix reversed sense of conditional in subr_prf.c putone.
 1.86  04-Oct-2022  riastradh Revert "constty(4): Make MP-safe."

Something appears to be wrong with this.
 1.85  04-Oct-2022  riastradh Revert "console(4), constty(4): Rip off the kernel lock."

Needs more testing.
 1.84  03-Oct-2022  riastradh console(4), constty(4): Rip off the kernel lock.
 1.83  03-Oct-2022  riastradh constty(4): Make MP-safe.

Access to the global constty variable is coordinated as follows:

1. Setting constty to nonnull, with atomic_store_release, is allowed
only under the new adaptive constty_lock in thread context. This
serializes TIOCCONS operations and ensures unlocked readers can
safely use a constty pointer read with atomic_load_consume.

2. Changing constty from nonnull to null, with atomic_cas_ptr, is
allowed in any context -- printf(9) uses this to disable a broken
constty.

3. Reading constty under constty_lock is allowed with
atomic_load_relaxed, because while constty_lock is held, it can
only be made null by some other thread/CPU, never made nonnull.

4. Reading constty outside constty_lock is allowed with
atomic_load_consume in a pserialize read section -- constty is
only ever made nonnull with atomic_store_release, in (1).
ttyclose will wait for all these pserialize read sections to
complete before flushing the tty.

5. To continue to use a struct tty pointer in (4) after the
pserialize read section has completed, caller must use tty_acquire
during the pserialize read section and then tty_release when done.
ttyclose will wait for all these references to drain before
returning.

These access rules allow us to serialize TIOCCONS, and safely destroy
ttys, without putting any locks on the access paths like printf(9)
that use constty. Once we set D_MPSAFE, operations on /dev/console
will contend only with other users of the same tty as constty, which
will be an improvement over contending with all other kernel lock
users in the system.
 1.82  03-Oct-2022  riastradh cons(9): Check the unit number on close too.

Races between multiple opens, some of which fail, might lead to
closing a bad unit number -- not clear there's a good way to prevent
this.
 1.81  03-Oct-2022  riastradh cons(9): Serialize open and close.

Kernel lock wasn't enough for this -- cdevvp, vn_lock, or VOP_OPEN
could block, allowing another thread to re-enter open.
 1.80  03-Oct-2022  riastradh cons(9): New function cn_set_tab.

Increment of progress toward eliminating bare access to cn_tab so we
can make more things MP-safe without the kernel lock (and maybe some
day better formalize console detection and switching).
 1.79  22-Aug-2022  riastradh cons(4): Don't barge ahead if cdevvp has failed -- return error now.
 1.78  22-Aug-2022  riastradh cons(4): Ignore error from vn_lock(vp, LK_EXCUSIVE|LK_RETRY).

This never fails, as is asserted in vn_lock whenever LK_RETRY is set
and LK_NOWAIT is not.
 1.77  06-Dec-2019  riastradh Restore historical $Hdr$ tag after git cvsexportcommit nixed it.
 1.76  06-Dec-2019  riastradh Fix reference count leak in cons(4).

Don't forget to vrele after you're done, folks!

XXX pullup-9
XXX pullup-8
XXX pullup-7
XXX pullup-6... 5... 4 might not have had this bug!
 1.75  29-May-2015  macallan branches: 1.75.10; 1.75.18; 1.75.24;
for some reason the previous commit causes ARCS firmware on sgimips64 to
spew an endless stream of white ( or rather, blue ) spaces. So revert to
the old code for sgimips only until I can figure out why.
Now sgimips64 n32 kernels boot again.
 1.74  05-Mar-2015  nakayama Fix strange kernel output sequence "\n\r" observed in serial
consoles. Output '\r' before '\n' in conversion.
 1.73  23-Feb-2015  mlelstv Fall back to nullcons if configured.
 1.72  25-Jul-2014  dholland branches: 1.72.2; 1.72.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.71  16-Mar-2014  dholland branches: 1.71.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.70  22-Dec-2013  matt raise spl to IPL_HIGH when calling cngetc. Make sure to call
do_critpollhooks() when outputing and getting input.
 1.69  13-Mar-2012  elad branches: 1.69.2; 1.69.4;
Replace the remaining KAUTH_GENERIC_ISSUSER authorization calls with
something meaningful. All relevant documentation has been updated or
written.

Most of these changes were brought up in the following messages:

http://mail-index.netbsd.org/tech-kern/2012/01/18/msg012490.html
http://mail-index.netbsd.org/tech-kern/2012/01/19/msg012502.html
http://mail-index.netbsd.org/tech-kern/2012/02/17/msg012728.html

Thanks to christos, manu, njoly, and jmmv for input.

Huge thanks to pgoyette for spinning these changes through some build
cycles and ATF.
 1.68  08-Feb-2011  rmind branches: 1.68.4; 1.68.8; 1.68.10;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.67  24-Jun-2010  hannken branches: 1.67.2; 1.67.4;
Clean up vnode lock operations pass 2:

VOP_UNLOCK(vp, flags) -> VOP_UNLOCK(vp): Remove the unneeded flags argument.

Welcome to 5.99.32.

Discussed on tech-kern.
 1.66  23-Nov-2009  rmind branches: 1.66.2; 1.66.4;
Remove some unecessary includes sys/user.h header.
 1.65  24-Jan-2008  ad branches: 1.65.10; 1.65.20; 1.65.32;
specfs changes for PR kern/37717 (raidclose() is no longer called on
shutdown). There are still problems with device access and a PR will be
filed.

- Kill checkalias(). Allow multiple vnodes to reference a single device.

- Don't play dangerous tricks with block vnodes to ensure that only one
vnode can describe a block device. Instead, prohibit concurrent opens of
block devices. As a bonus remove the unreliable code that prevents
multiple file system mounts on the same device. It's no longer needed.

- Track opens by vnode and by device. Issue cdev_close() when the last open
goes away, instead of abusing vnode::v_usecount to tell if the device is
open.
 1.64  09-Jul-2007  ad branches: 1.64.8; 1.64.14;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.63  04-Mar-2007  christos branches: 1.63.2; 1.63.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.62  09-Feb-2007  ad branches: 1.62.2;
Merge newlock2 to head.
 1.61  16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.60  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.59  21-Jul-2006  ad branches: 1.59.4; 1.59.6;
- Use the LWP cached credentials where sane.
- Minor cosmetic changes.
 1.58  14-May-2006  elad integrate kauth.
 1.57  11-Dec-2005  christos branches: 1.57.4; 1.57.6; 1.57.8; 1.57.10; 1.57.12;
merge ktrace-lwp.
 1.56  21-Jun-2005  ws branches: 1.56.2;
PR-30566: Poll must not return <sys/errno.h> values.
Start with those places I can easily test.
 1.55  28-Apr-2005  martin White space police.
 1.54  27-Feb-2005  perry nuke trailing whitespace
 1.53  16-May-2004  wiz branches: 1.53.4; 1.53.6;
"panicking" needs a k.
 1.52  18-Oct-2003  cdi Revert previous change as it breaks the build on a number of ports.
 1.51  17-Oct-2003  cdi Introduce null console. This pseudo device acts as a normal console with the
exception that it discards any output, and is useful for booting the kernel
on headless boxes.
 1.50  03-Oct-2003  dsl Make 'minor(dev) == 1' a device that isn't affected by TIOCCONS.
For /dev/constty so that you can grab kernel messages when logged in
on the 'console'.
 1.49  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.48  29-Jun-2003  fvdl branches: 1.48.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.47  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.46  06-Mar-2003  matt Add cn_halt and cn_flush entries to consdevs. (needed for dma-only console
devices).
 1.45  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.44  27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.43  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.42  02-Aug-2002  soren As in PR kern/10999 from Matthew Orgass, make the panic message more
helpful in the case where no console device has registered.
 1.41  13-Nov-2001  lukem branches: 1.41.8;
add RCSIDs
 1.40  04-Jun-2001  jdolecek branches: 1.40.2; 1.40.4;
Use back the 'u'&037 form - since it's CTRL-u, it's more readable that way
Use \007 instead of symbolic constant, since that's what is more often used.
Pointed out by Robert Elz.
 1.39  03-Jun-2001  jdolecek cngetsn(): cosmetic only - use '\025' instead 'u'&037, and '\b' instead '\007'
 1.38  03-Jun-2001  lukem fix comment
 1.37  12-Jun-2000  mrg branches: 1.37.4;
check for when cnopen() will call itself recursively, and panic instead of losing badly.
 1.36  08-May-2000  itojun branches: 1.36.2;
move static function getstr() to cons.c, make it publically available
as cngetsn(). there will be other consumer.
 1.35  30-Mar-2000  augustss Remove register declarations.
 1.34  06-Mar-2000  thorpej - Implement cnbell() -- ring the console bell. The cn_bell entrypoint
is optional.
- Add cn_bell to statically allocated consdevs as appropriate.
 1.33  04-Aug-1999  leo branches: 1.33.2;
Catch a console configuration error. Instead of jumping through cdevsw indexed
on major(NODEV), call panic...
 1.32  07-Sep-1996  mycroft branches: 1.32.22;
Implement poll(2).
 1.31  02-Sep-1996  mycroft tty stop functions really should return void, not int, and certainly not both.
 1.30  08-Apr-1996  jonathan fixes for -Wall -Wmissing-prototypes:
add "return (0);" to cnstop()'s emtpy body.
 1.29  04-Feb-1996  christos cnputc returns void
 1.28  25-Nov-1995  cgd fix definition of nullcnpollc, and add a prototype for it.
 1.27  11-Apr-1995  pk Remove duplicate definition of `constty'.
 1.26  11-Apr-1995  mellon Split cninit from cons so ports that can't use it don't have to include it.
 1.25  10-Apr-1995  mycroft Add a dummy cnstop().
 1.24  24-Mar-1995  cgd don't let args default, return values, add protos
 1.23  14-Dec-1994  mycroft Remove extra arg to d_open and vn_open().
 1.22  14-Nov-1994  christos added extra argument to vn_open
 1.21  30-Oct-1994  mycroft Add a nullcnpollc(), for people who don't want to deal.
 1.20  30-Oct-1994  cgd be more careful with types, also pull in headers where necessary.
 1.19  26-Oct-1994  mycroft Implement cnpollc().
 1.18  29-Jun-1994  cgd New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'
 1.17  27-Jun-1994  cgd new standard, minimally intrusive ID format
 1.16  08-Jun-1994  mycroft Reverse sense of vfinddev().
 1.15  11-Apr-1994  cgd undo that last
 1.14  11-Apr-1994  cgd don't cdevvp() if a vnode for the dev already exists. Note that that's
conceptually icky; you end up ref'ing a 'real' vnode, and hence perhaps
tying down a file system; should be able to reference a 'fake' one,
but i doesn't appear save to cdevvp() if vnode for same dev is already
around... also, mark vfinddev()s XXX (for later).
 1.13  10-Apr-1994  cgd and fix the other case. ugly fix, but it works
 1.12  16-Feb-1994  cgd get sense of two comparisons right. from Chris Hopps <chopps@lamp>
 1.11  01-Feb-1994  cgd new location of cons.h
 1.10  27-Jan-1994  cgd make behaviour with constty consistent, deal properly with the case
where there's no console, and set things up so that this can be made
'shared' eventually. look at diffs for exact changes.
 1.9  27-Jan-1994  cgd if CN_REMOTE, don't redirect output. this file needs some help,
but now at least i'm thinking about it again.
 1.8  07-Jul-1993  deraadt branches: 1.8.2; 1.8.4;
pccons.c now dynamically allocates it's "struct tty"
cons.c's "struct tty *cn_tty" wasn't used by any of the kernel, and goes away.
 1.7  27-Jun-1993  andrew ANSIfications - removed all implicit function return types and argument
definitions. Ensured that all files include "systm.h" to gain access to
general prototypes. Casts where necessary.
 1.6  28-May-1993  deraadt 1. It is now possible to build a kernel that does not have a pc0 device driver.
2. "press any key to reboot" reads the key from the console.
3. wddump() still needs a non-blocking getc() routine (or flush)
 1.5  22-May-1993  cgd add include of select.h if necessary for protos, or delete if extraneous
 1.4  18-May-1993  cgd make kernel select interface be one-stop shopping & clean it all up.
 1.3  04-May-1993  cgd add pg_wait, which must be set if you want pg() to actually wait for keybd
input. this one is way useful...
 1.2  21-Mar-1993  cgd after 0.2.2 "stable" patches applied
 1.1  21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1  21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.8.4.3  27-Oct-1993  mycroft Don't compile com console stuff, for now.
 1.8.4.2  17-Oct-1993  mycroft Rename cninit() to consinit(), and junk the old, empty consinit().
 1.8.4.1  06-Oct-1993  mycroft cn_init --> cn_attach
 1.8.2.2  20-Aug-1993  cgd decommit that last one; it's not nearly that easy to fix right...
see also: vnode aliases!
 1.8.2.1  20-Aug-1993  cgd fix from Christoph Robitschko to keep 'kill -HUP' of syslogd
from spamming the console. arguably less-than-elegant, but it works
and i don't want to see a slew of bug reports come 0.9...
 1.32.22.1  26-Oct-1999  he Pull up revision 1.33 (requested by he):
Catch a console configuration error. Instead of jumping through
cdevsw indexed on major(NODEV), call panic, fixing PR#8690.
 1.33.2.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.36.2.1  22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.37.4.6  11-Nov-2002  nathanw Catch up to -current
 1.37.4.5  18-Oct-2002  nathanw Catch up to -current.
 1.37.4.4  17-Sep-2002  nathanw Catch up to -current.
 1.37.4.3  13-Aug-2002  nathanw Catch up to -current.
 1.37.4.2  14-Nov-2001  nathanw Catch up to -current.
 1.37.4.1  21-Jun-2001  nathanw Catch up to -current.
 1.40.4.5  13-Oct-2001  fvdl Revert the t_dev -> t_devvp change in struct tty. The way that tty
structs are currently used (especially by console ttys) aren't
ready for it, and this will require quite a few changes.
 1.40.4.4  26-Sep-2001  fvdl * add a VCLONED vnode flag that indicates a vnode representing a cloned
device.
* rename REVOKEALL to REVOKEALIAS, and add a REVOKECLONE flag, to pass
to VOP_REVOKE
* the revoke system call will revoke all aliases, as before, but not the
clones
* vdevgone is called when detaching a device, so make it use REVOKECLONE
to get rid of all clones as well
* clean up all uses of VOP_OPEN wrt. locking.
* add a few VOPS to spec_vnops that need to do something when it's a
clone vnode (access and getattr)
* add a copy of the vnode vattr structure of the original 'master' vnode
to the specinfo of a cloned vnode. could possibly redirect getattr to
the 'master' vnode, but this has issues with revoke
* add a vdev_reassignvp function that disassociates a vnode from its
original device, and reassociates it with the specified dev_t. to be
used by cloning devices only, in case a new minor is allocated.
* change all direct references in drivers to v_devcookie and v_rdev
to vdev_privdata(vp) and vdev_rdev(vp). for diagnostic purposes
when debugging race conditions that still exist wrt. locking and
revoking vnodes.
* make the locking state of a vnode consistent when passed to
d_open and d_close (unlocked). locked would be better, but has
some deadlock issues
 1.40.4.3  20-Sep-2001  fvdl Use vget, not vref, when acquiring an already existing console device vnode.
 1.40.4.2  18-Sep-2001  fvdl Various changes to make cloning devices possible:

* Add an extra argument (struct vnode **) to VOP_OPEN. If it is
not NULL, specfs will create a cloned (aliased) vnode during
the call, and return it there. The caller should release and
unlock the original vnode if a new vnode was returned. The
new vnode is returned locked.

* Add a flag field to the cdevsw and bdevsw structures.
DF_CLONING indicates that it wants a new vnode for each
open (XXX is there a better way? devprop?)

* If a device is cloning, always call the close entry
point for a VOP_CLOSE.


Also, rewrite cons.c to do the right thing with vnodes. Use VOPs
rather then direct device entry calls. Suggested by mycroft@

Light to moderate testing done an i386 system (arch doesn't matter
though, these are MI changes).
 1.40.4.1  07-Sep-2001  thorpej Commit my "devvp" changes to the thorpej-devvp branch. This
replaces the use of dev_t in most places with a struct vnode *.

This will form the basic infrastructure for real cloning device
support (besides being architecurally cleaner -- it'll be good
to get away from using numbers to represent objects).
 1.40.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.40.2.3  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.40.2.2  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.40.2.1  10-Jul-2001  lukem implement cnkqfilter()
 1.41.8.2  29-Aug-2002  gehenna catch up with -current.
 1.41.8.1  16-May-2002  gehenna Add the character device switch.
Replace the direct-access to devsw table with calling devsw API.
 1.48.2.6  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.48.2.5  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.48.2.4  21-Sep-2004  skrll Fix the sync with head I botched.
 1.48.2.3  18-Sep-2004  skrll Sync with HEAD.
 1.48.2.2  03-Aug-2004  skrll Sync with HEAD
 1.48.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.53.6.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.53.4.1  29-Apr-2005  kent sync with -current
 1.56.2.5  04-Feb-2008  yamt sync with head.
 1.56.2.4  03-Sep-2007  yamt sync with head.
 1.56.2.3  26-Feb-2007  yamt sync with head.
 1.56.2.2  30-Dec-2006  yamt sync with head.
 1.56.2.1  21-Jun-2006  yamt sync with head.
 1.57.12.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.57.10.3  06-May-2006  christos - Move kauth_cred_t declaration to <sys/types.h>
- Cleanup struct ucred; forward declarations that are unused.
- Don't include <sys/kauth.h> in any header, but include it in the c files
that need it.

Approved by core.
 1.57.10.2  10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.57.10.1  08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.57.8.2  11-Aug-2006  yamt sync with head
 1.57.8.1  24-May-2006  yamt sync with head.
 1.57.6.1  01-Jun-2006  kardel Sync with head.
 1.57.4.1  09-Sep-2006  rpaulo sync with head
 1.59.6.2  10-Dec-2006  yamt sync with head.
 1.59.6.1  22-Oct-2006  yamt sync with head
 1.59.4.1  21-Oct-2006  ad Add #ifdef'd out locking around constty.
 1.62.2.1  12-Mar-2007  rmind Sync with HEAD.
 1.63.4.1  11-Jul-2007  mjf Sync with head.
 1.63.2.1  13-Apr-2007  ad - Make the devsw interface MP safe, and add some comments.
- Allow individual block/character drivers to be marked MP safe.
- Provide wrappers around the device methods that look up the
device, returning ENXIO if it's not found, and acquire the
kernel lock if needed.
 1.64.14.1  18-Feb-2008  mjf Sync with HEAD.
 1.64.8.1  23-Mar-2008  matt sync with HEAD
 1.65.32.1  07-Jan-2011  matt Add critpollhooks.
 1.65.20.1  18-Mar-2015  snj Pull up following revision(s) (requested by nakayama in ticket #1952):
sys/dev/cons.c: revision 1.74
Fix strange kernel output sequence "\n\r" observed in serial
consoles. Output '\r' before '\n' in conversion.
 1.65.10.2  11-Aug-2010  yamt sync with head.
 1.65.10.1  11-Mar-2010  yamt sync with head
 1.66.4.2  05-Mar-2011  rmind sync with head
 1.66.4.1  03-Jul-2010  rmind sync with head
 1.66.2.1  17-Aug-2010  uebayasi Sync with HEAD.
 1.67.4.1  17-Feb-2011  bouyer Sync with HEAD
 1.67.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.68.10.1  24-Mar-2015  snj Pull up following revision(s) (requested by nakayama in ticket #1267):
sys/dev/cons.c: revision 1.74 via patch
Fix strange kernel output sequence "\n\r" observed in serial
consoles. Output '\r' before '\n' in conversion.
 1.68.8.1  05-Apr-2012  mrg sync to latest -current.
 1.68.4.2  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.68.4.1  17-Apr-2012  yamt sync with head
 1.69.4.1  18-May-2014  rmind sync with head
 1.69.2.2  03-Dec-2017  jdolecek update from HEAD
 1.69.2.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.71.2.1  10-Aug-2014  tls Rebase.
 1.72.4.2  06-Jun-2015  skrll Sync with HEAD
 1.72.4.1  06-Apr-2015  skrll Sync with HEAD
 1.72.2.2  08-Dec-2019  martin Pull up following revision(s) (requested by riastradh in ticket #1717):

sys/dev/cons.c: revision 1.76
sys/dev/cons.c: revision 1.77

Fix reference count leak in cons(4).
Don't forget to vrele after you're done, folks!
Restore historical $Hdr$ tag after git cvsexportcommit nixed it.
 1.72.2.1  09-Mar-2015  snj branches: 1.72.2.1.2; 1.72.2.1.6;
Pull up following revision(s) (requested by nakayama in ticket #574):
sys/dev/cons.c: revision 1.74
Fix strange kernel output sequence "\n\r" observed in serial
consoles. Output '\r' before '\n' in conversion.
 1.72.2.1.6.1  08-Dec-2019  martin Pull up following revision(s) (requested by riastradh in ticket #1717):

sys/dev/cons.c: revision 1.76
sys/dev/cons.c: revision 1.77

Fix reference count leak in cons(4).
Don't forget to vrele after you're done, folks!
Restore historical $Hdr$ tag after git cvsexportcommit nixed it.
 1.72.2.1.2.1  08-Dec-2019  martin Pull up following revision(s) (requested by riastradh in ticket #1717):

sys/dev/cons.c: revision 1.76
sys/dev/cons.c: revision 1.77

Fix reference count leak in cons(4).
Don't forget to vrele after you're done, folks!
Restore historical $Hdr$ tag after git cvsexportcommit nixed it.
 1.75.24.1  09-Dec-2019  martin Pull up following revision(s) (requested by riastradh in ticket #528):

sys/dev/cons.c: revision 1.76
sys/dev/cons.c: revision 1.77

Fix reference count leak in cons(4).

Don't forget to vrele after you're done, folks!
XXX pullup-9
XXX pullup-8
XXX pullup-7
XXX pullup-6... 5... 4 might not have had this bug!

Restore historical $Hdr$ tag after git cvsexportcommit nixed it.
 1.75.18.1  08-Apr-2020  martin Merge changes from current as of 20200406
 1.75.10.1  08-Dec-2019  martin Pull up following revision(s) (requested by riastradh in ticket #1469):

sys/dev/cons.c: revision 1.76
sys/dev/cons.c: revision 1.77

Fix reference count leak in cons(4).
Don't forget to vrele after you're done, folks!
Restore historical $Hdr$ tag after git cvsexportcommit nixed it.

RSS XML Feed