aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/nmdm
Commit message (Collapse)AuthorAgeFilesLines
* Use the actual credentials to create the /dev/nmdm* devices.Poul-Henning Kamp2021-01-041-2/+2
| | | | | This lets plain users create nmdm pairs, which is useful amongst other things for running retro-computing emulators etc.
* Extract eventfilter declarations to sys/_eventfilter.hConrad Meyer2019-05-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | This allows replacing "sys/eventfilter.h" includes with "sys/_eventfilter.h" in other header files (e.g., sys/{bus,conf,cpu}.h) and reduces header pollution substantially. EVENTHANDLER_DECLARE and EVENTHANDLER_LIST_DECLAREs were moved out of .c files into appropriate headers (e.g., sys/proc.h, powernv/opal.h). As a side effect of reduced header pollution, many .c files and headers no longer contain needed definitions. The remainder of the patch addresses adding appropriate includes to fix those files. LOCK_DEBUG and LOCK_FILE_LINE_ARG are moved to sys/_lock.h, as required by sys/mutex.h since r326106 (but silently protected by header pollution prior to this change). No functional change (intended). Of course, any out of tree modules that relied on header pollution for sys/eventhandler.h, sys/lock.h, or sys/mutex.h inclusion need to be fixed. __FreeBSD_version has been bumped. Notes: svn path=/head/; revision=347984
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-201-0/+2
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326022
* Renumber copyright clause 4Warner Losh2017-02-281-1/+1
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* Fix issue with nmdm and leading zeros in device name.Peter Grehan2014-09-101-12/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | The nmdm code enforces a number between the 'nmdm' and 'A|B' portions of the device name. This is then used as a unit number, and sprintf'd back into the tty name. If leading zeros were used in the name, the created device name is different than the string used for the clone-open (e.g. /dev/nmdm0001A will result in /dev/nmdm1A). Since unit numbers are no longer required with the updated tty code, there seems to be no reason to force the string to be a number. The fix is to allow an arbitrary string between 'nmdm' and 'A|B', within the constraints of devfs names. This allows all existing user of numeric strings to continue to work, and also allows more meaningful names to be used, such as bhyve VM names. Tested on amd64, i386 and ppc64. Reported by: Dave Smith PR: 192281 Reviewed by: neel, glebius Phabric: D729 MFC after: 3 days Notes: svn path=/head/; revision=271350
* Make nmdm(4) destroy devices when both sides of a pair are disconnected.Gleb Smirnoff2013-12-181-27/+99
| | | | | | | | | | This makes it possible to kldunload nmdm.ko when there are no users of it. Reviewed by: kib Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=259550
* Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.Ed Schouten2011-11-071-1/+1
| | | | | | | This means that their use is restricted to a single C file. Notes: svn path=/head/; revision=227293
* - Remove an unnecessary memory barrier from an atomic op.John Baldwin2009-06-091-3/+3
| | | | | | | | - Use the per-softc mutex to protect the softc data in the callout routine rather than letting it run without any locks whatsoever. Notes: svn path=/head/; revision=193828
* Last minute TTY API change: remove mutex argument from tty_alloc().Ed Schouten2009-05-291-2/+2
| | | | | | | | | | | | | I don't want people to override the mutex when allocating a TTY. It has to be there, to keep drivers like syscons happy. So I'm creating a tty_alloc_mutex() which can be used in those cases. tty_alloc_mutex() should eventually be removed. The advantage of this approach, is that we can just remove a function, without breaking the regular API in the future. Notes: svn path=/head/; revision=193018
* Make nmdm(4) use MPSAFE callouts.Ed Schouten2008-11-191-2/+2
| | | | | | | | | For some reason the nmdm(4) driver doesn't use CALLOUT_MPSAFE, even though we live in the MPSAFE TTY era. Add the CALLOUT_MPSAFE flags. System survives. Notes: svn path=/head/; revision=185106
* Integrate the new MPSAFE TTY layer to the FreeBSD operating system.Ed Schouten2008-08-201-253/+159
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The last half year I've been working on a replacement TTY layer for the FreeBSD kernel. The new TTY layer was designed to improve the following: - Improved driver model: The old TTY layer has a driver model that is not abstract enough to make it friendly to use. A good example is the output path, where the device drivers directly access the output buffers. This means that an in-kernel PPP implementation must always convert network buffers into TTY buffers. If a PPP implementation would be built on top of the new TTY layer (still needs a hooks layer, though), it would allow the PPP implementation to directly hand the data to the TTY driver. - Improved hotplugging: With the old TTY layer, it isn't entirely safe to destroy TTY's from the system. This implementation has a two-step destructing design, where the driver first abandons the TTY. After all threads have left the TTY, the TTY layer calls a routine in the driver, which can be used to free resources (unit numbers, etc). The pts(4) driver also implements this feature, which means posix_openpt() will now return PTY's that are created on the fly. - Improved performance: One of the major improvements is the per-TTY mutex, which is expected to improve scalability when compared to the old Giant locking. Another change is the unbuffered copying to userspace, which is both used on TTY device nodes and PTY masters. Upgrading should be quite straightforward. Unlike previous versions, existing kernel configuration files do not need to be changed, except when they reference device drivers that are listed in UPDATING. Obtained from: //depot/projects/mpsafetty/... Approved by: philip (ex-mentor) Discussed: on the lists, at BSDCan, at the DevSummit Sponsored by: Snow B.V., the Netherlands dcons(4) fixed by: kan Notes: svn path=/head/; revision=181905
* Don't enforce unique device minor number policy anymore.Ed Schouten2008-06-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Except for the case where we use the cloner library (clone_create() and friends), there is no reason to enforce a unique device minor number policy. There are various drivers in the source tree that allocate unr pools and such to provide minor numbers, without using them themselves. Because we still need to support unique device minor numbers for the cloner library, introduce a new flag called D_NEEDMINOR. All cdevsw's that are used in combination with the cloner library should be marked with this flag to make the cloning work. This means drivers can now freely use si_drv0 to store their own flags and state, making it effectively the same as si_drv1 and si_drv2. We still keep the minor() and dev2unit() routines around to make drivers happy. The NTFS code also used the minor number in its hash table. We should not do this anymore. If the si_drv0 field would be changed, it would no longer end up in the same list. Approved by: philip (mentor) Notes: svn path=/head/; revision=179726
* Call ttyld_close() in nmdmclose() to ensure that nmdm(4)Maksim Yevmenkin2007-08-011-1/+6
| | | | | | | | | | | closes line discipline installed onto /dev/nmdmX device. Reviewed by: julian Approved by: re (hrs) MFC after: 3 days Notes: svn path=/head/; revision=171689
* Sweep kernel replacing suser(9) calls with priv(9) calls, assigningRobert Watson2006-11-061-1/+3
| | | | | | | | | | | | | | | | specific privilege names to a broad range of privileges. These may require some future tweaking. Sponsored by: nCircle Network Security, Inc. Obtained from: TrustedBSD Project Discussed on: arch@ Reviewed (at least in part) by: mlaier, jmg, pjd, bde, ceri, Alex Lyashkov <umka at sevcity dot net>, Skip Ford <skip dot ford at verizon dot net>, Antoine Brodin <antoine dot brodin at laposte dot net> Notes: svn path=/head/; revision=164033
* Use ttyalloc() instead of ttymalloc()Poul-Henning Kamp2006-01-041-5/+2
| | | | Notes: svn path=/head/; revision=154014
* Merge the dev_clone and dev_clone_cred event handlers into a singleRobert Watson2005-08-081-1/+2
| | | | | | | | | | | | | | | | event handler, dev_clone, which accepts a credential argument. Implementors of the event can ignore it if they're not interested, and most do. This avoids having multiple event handler types and fall-back/precedence logic in devfs. This changes the kernel API for /dev cloning, and may affect third party packages containg cloning kernel modules. Requested by: phk MFC after: 3 days Notes: svn path=/head/; revision=148868
* Explicitly hold a reference to the cdev we have just cloned. ThisPoul-Henning Kamp2005-03-311-0/+1
| | | | | | | | closes the race where the cdev was reclaimed before it ever made it back to devfs lookup. Notes: svn path=/head/; revision=144389
* If CDSR_OFLOW (stty dsrflow) is enabled on one or both sides of aPoul-Henning Kamp2005-01-261-14/+128
| | | | | | | | | | | | | | | null-modem tty device emulate the speed settings faithfully. The speed is emulated independently for the two directions, using the slower of the local sides ispeed and the remote sides ospeed. The emulated speed takes settings of bits/char, parity and stopbit into account. Inspired by: The BSD-DK Editor Celebrity Deathmatch Contest Notes: svn path=/head/; revision=140878
* Start each of the license/copyright comments with /*-, minor shuffle of linesWarner Losh2005-01-061-1/+1
| | | | Notes: svn path=/head/; revision=139749
* #include of <sys/vnode.h> not necesary.Poul-Henning Kamp2004-12-221-1/+0
| | | | Notes: svn path=/head/; revision=139192
* Add new function ttyinitmode() which sets our systemwide defaultPoul-Henning Kamp2004-10-181-7/+1
| | | | | | | | | | | | | | | | | modes on a tty structure. Both the ".init" and the current settings are initialized allowing the function to be used both at attach and open time. The function takes an argument to decide if echoing should be enabled. Echoing should not be enabled for regular physical serial ports unless they are consoles, in which case they should be configured by ttyconsolemode() instead. Use the new function throughout. Notes: svn path=/head/; revision=136680
* Preparation commit for the tty cleanups that will follow in the nearPoul-Henning Kamp2004-07-151-1/+1
| | | | | | | | | | | | future: rename ttyopen() -> tty_open() and ttyclose() -> tty_close(). We need the ttyopen() and ttyclose() for the new generic cdevsw functions for tty devices in order to have consistent naming. Notes: svn path=/head/; revision=132226
* Add modemcontrol support for DTR and DCD.Poul-Henning Kamp2004-07-041-6/+37
| | | | | | | Tested by: ambrisko Notes: svn path=/head/; revision=131579
* Second half of the dev_t cleanup.Poul-Henning Kamp2004-06-171-1/+1
| | | | | | | | | | | | | | The big lines are: NODEV -> NULL NOUDEV -> NODEV udev_t -> dev_t udev2dev() -> findcdev() Various minor adjustments including handling of userland access to kernel space struct cdev etc. Notes: svn path=/head/; revision=130640
* Do the dreaded s/dev_t/struct cdev */Poul-Henning Kamp2004-06-161-8/+8
| | | | | | | Bump __FreeBSD_version accordingly. Notes: svn path=/head/; revision=130585
* Machine generated patch which changes linedisc calls from accessingPoul-Henning Kamp2004-06-041-4/+4
| | | | | | | | | linesw[] directly to using the ttyld...() functions The ttyld...() functions ar inline so there is no performance hit. Notes: svn path=/head/; revision=130077
* A major overhaul of the nmdm(4) driver:Poul-Henning Kamp2004-06-011-375/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It was based on the pty(4) driver which as a tty side an a non-tty side. Nmdm(4) seems to have inherited two symmetric sides from pty but unfortunately they are not quite ttys. Running a getty one one side and tip on the other failed to produce NL->CRNL mapping for instance. Rip out the basically bogus cdevsw->{read,write} functions and rely on ttyread() and ttywrite() which does the same thing. Use taskqueue_swi_giant to run a task for either side to do what needs to be done. (Direct calling is not an option as it leads to recursion.) Trigger the task from the t_oproc and t_stop methods. Default the ports to not ECHO. Since we neither rate limiting nor emulation, two ports echoing each other is a really bad idea, which can only be properly mitigated by rate limiting, rate emulation or intelligent detection. Rate emulation would be a neat feature. Ditch the modem-line emulation, if needed for some app, it needs to be thought much more about how it interacts with the open/close logic. Notes: svn path=/head/; revision=129968
* There is no need to explicitly call the stop function. In all likelyhoodPoul-Henning Kamp2004-06-011-1/+0
| | | | | | | ->l_close() did it and ttyclose certainly will. Notes: svn path=/head/; revision=129939
* Add missing <sys/module.h> includesPoul-Henning Kamp2004-05-301-0/+1
| | | | Notes: svn path=/head/; revision=129879
* Remove advertising clause from University of California Regent'sWarner Losh2004-04-071-4/+0
| | | | | | | | | | license, per letter dated July 22, 1999 and email from Peter Wemm, Alan Cox and Robert Watson. Approved by: core, peter, alc, rwatson Notes: svn path=/head/; revision=128019
* Add clone_setup() function rather than rely on lazy initialization.Poul-Henning Kamp2004-03-111-0/+1
| | | | | | | Requested by: rwatson Notes: svn path=/head/; revision=126845
* Device megapatch 4/6:Poul-Henning Kamp2004-02-211-2/+3
| | | | | | | | | | | Introduce d_version field in struct cdevsw, this must always be initialized to D_VERSION. Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing four D_NOGIANT flags and adding 145 D_NEEDGIANT flags. Notes: svn path=/head/; revision=126080
* Device megapatch 3/6:Poul-Henning Kamp2004-02-211-1/+0
| | | | | | | | | | | | | | | Add missing D_TTY flags to various drivers. Complete asserts that dev_t's passed to ttyread(), ttywrite(), ttypoll() and ttykqwrite() have (d_flags & D_TTY) and a struct tty pointer. Make ttyread(), ttywrite(), ttypoll() and ttykqwrite() the default cdevsw methods for D_TTY drivers and remove the explicit initializations in various drivers cdevsw structures. Notes: svn path=/head/; revision=126078
* Device megapatch 2/6:Poul-Henning Kamp2004-02-211-84/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds a couple of functions for pseudodrivers to use for implementing cloning in a manner we will be able to lock down (shortly). Basically what happens is that pseudo drivers get a way to ask for "give me the dev_t with this unit number" or alternatively "give me a dev_t with the lowest guaranteed free unit number" (there is unfortunately a lot of non-POLA in the exact numeric value of this number, just live with it for now) Managing the unit number space this way removes the need to use rman(9) to do so in the drivers this greatly simplifies the code in the drivers because even using rman(9) they still needed to manage their dev_t's anyway. I have taken the if_tun, if_tap, snp and nmdm drivers through the mill, partly because they (ab)used makedev(), but mostly because together they represent three different problems for device-cloning: if_tun and snp is the plain case: just give me a device. if_tap has two kinds of devices, with a flag for device type. nmdm has paired devices (ala pty) can you can clone either of them. Notes: svn path=/head/; revision=126077
* - Implement selwakeuppri() which allows raising the priority of aSeigo Tanimura2003-11-091-2/+2
| | | | | | | | | | | | | | | | thread being waken up. The thread waken up can run at a priority as high as after tsleep(). - Replace selwakeup()s with selwakeuppri()s and pass appropriate priorities. - Add cv_broadcastpri() which raises the priority of the broadcast threads. Used by selwakeuppri() if collision occurs. Not objected in: -arch, -current Notes: svn path=/head/; revision=122352
* I don't know from where the notion that device driver should orPoul-Henning Kamp2003-09-281-2/+2
| | | | | | | | | | | | | | | | | even could call VOP_REVOKE() on vnodes associated with its dev_t's has originated, but it stops right here. If there are things people belive destroy_dev() needs to learn how to do, please tell me about it, preferably with a reproducible test case. Include <sys/uio.h> in bluetooth code rather than rely on <sys/vnode.h> to do so. The fact that some of the USB code needs to include <sys/vnode.h> still disturbs me greatly, but I do not have time to chase that. Notes: svn path=/head/; revision=120559
* Use __FBSDID().David E. O'Brien2003-08-241-1/+3
| | | | | | | Also some minor style cleanups. Notes: svn path=/head/; revision=119418
* Make TTYHOG tunable.David Schultz2003-03-051-0/+2
| | | | | | | Reviewed by: mike (mentor) Notes: svn path=/head/; revision=111899
* Gigacommit to improve device-driver source compatibility betweenPoul-Henning Kamp2003-03-031-13/+9
| | | | | | | | | | | | | | | | branches: Initialize struct cdevsw using C99 sparse initializtion and remove all initializations to default values. This patch is automatically generated and has been tested by compiling LINT with all the fields in struct cdevsw in reverse order on alpha, sparc64 and i386. Approved by: re(scottl) Notes: svn path=/head/; revision=111815
* Back out M_* changes, per decision of the TRB.Warner Losh2003-02-191-1/+1
| | | | | | | Approved by: trb Notes: svn path=/head/; revision=111119
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.Alfred Perlstein2003-01-211-1/+1
| | | | | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT. Notes: svn path=/head/; revision=109623
* Change the suser() API to take advantage of td_ucred as well as do aJohn Baldwin2002-04-011-1/+1
| | | | | | | | | | | | | | | general cleanup of the API. The entire API now consists of two functions similar to the pre-KSE API. The suser() function takes a thread pointer as its only argument. The td_ucred member of this thread must be valid so the only valid thread pointers are curthread and a few kernel threads such as thread0. The suser_cred() function takes a pointer to a struct ucred as its first argument and an integer flag as its second argument. The flag is currently only used for the PRISON_ROOT flag. Discussed on: smp@ Notes: svn path=/head/; revision=93593
* Simple p_ucred -> td_ucred changes to start using the per-thread ucredJohn Baldwin2002-02-271-1/+1
| | | | | | | reference. Notes: svn path=/head/; revision=91406
* Cleanup of nmdm deviceJulian Elischer2002-02-201-61/+100
| | | | Notes: svn path=/head/; revision=90995
* Don't call cdevsw_add().Poul-Henning Kamp2001-11-041-1/+1
| | | | | | | XXX: this driver lacks a proper _clone method. Notes: svn path=/head/; revision=86027
* KSE Milestone 2Julian Elischer2001-09-121-9/+9
| | | | | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha Notes: svn path=/head/; revision=83366
* Remove unused nmdmpoll function.Mark Peek2001-08-111-63/+0
| | | | | | | Approved by: julian Notes: svn path=/head/; revision=81508
* Send the remains (such as I have located) of "block major numbers" toPoul-Henning Kamp2001-03-261-1/+0
| | | | | | | the bit-bucket. Notes: svn path=/head/; revision=74810
* Remove warnings.. seems to compile as a module now too.Julian Elischer2001-02-271-4/+3
| | | | Notes: svn path=/head/; revision=73166
* Catch up with rwatsons ucred changes.Julian Elischer2001-02-271-1/+1
| | | | Notes: svn path=/head/; revision=73165