summaryrefslogtreecommitdiffstats
path: root/sys/dev/nmdm
Commit message (Collapse)AuthorAgeFilesLines
* Make nmdm(4) use MPSAFE callouts.ed2008-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.
* Integrate the new MPSAFE TTY layer to the FreeBSD operating system.ed2008-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
* Don't enforce unique device minor number policy anymore.ed2008-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)
* Call ttyld_close() in nmdmclose() to ensure that nmdm(4)emax2007-08-011-1/+6
| | | | | | | | closes line discipline installed onto /dev/nmdmX device. Reviewed by: julian Approved by: re (hrs) MFC after: 3 days
* Sweep kernel replacing suser(9) calls with priv(9) calls, assigningrwatson2006-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>
* Use ttyalloc() instead of ttymalloc()phk2006-01-041-5/+2
|
* Merge the dev_clone and dev_clone_cred event handlers into a singlerwatson2005-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
* Explicitly hold a reference to the cdev we have just cloned. Thisphk2005-03-311-0/+1
| | | | | closes the race where the cdev was reclaimed before it ever made it back to devfs lookup.
* If CDSR_OFLOW (stty dsrflow) is enabled on one or both sides of aphk2005-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
* Start each of the license/copyright comments with /*-, minor shuffle of linesimp2005-01-061-1/+1
|
* #include of <sys/vnode.h> not necesary.phk2004-12-221-1/+0
|
* Add new function ttyinitmode() which sets our systemwide defaultphk2004-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.
* Preparation commit for the tty cleanups that will follow in the nearphk2004-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.
* Add modemcontrol support for DTR and DCD.phk2004-07-041-6/+37
| | | | Tested by: ambrisko
* Second half of the dev_t cleanup.phk2004-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.
* Do the dreaded s/dev_t/struct cdev */phk2004-06-161-8/+8
| | | | Bump __FreeBSD_version accordingly.
* Machine generated patch which changes linedisc calls from accessingphk2004-06-041-4/+4
| | | | | | linesw[] directly to using the ttyld...() functions The ttyld...() functions ar inline so there is no performance hit.
* A major overhaul of the nmdm(4) driver:phk2004-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.
* There is no need to explicitly call the stop function. In all likelyhoodphk2004-06-011-1/+0
| | | | ->l_close() did it and ttyclose certainly will.
* Add missing <sys/module.h> includesphk2004-05-301-0/+1
|
* Remove advertising clause from University of California Regent'simp2004-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
* Add clone_setup() function rather than rely on lazy initialization.phk2004-03-111-0/+1
| | | | Requested by: rwatson
* Device megapatch 4/6:phk2004-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.
* Device megapatch 3/6:phk2004-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.
* Device megapatch 2/6:phk2004-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.
* - Implement selwakeuppri() which allows raising the priority of atanimura2003-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
* I don't know from where the notion that device driver should orphk2003-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.
* Use __FBSDID().obrien2003-08-241-1/+3
| | | | Also some minor style cleanups.
* Make TTYHOG tunable.das2003-03-051-0/+2
| | | | Reviewed by: mike (mentor)
* Gigacommit to improve device-driver source compatibility betweenphk2003-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)
* Back out M_* changes, per decision of the TRB.imp2003-02-191-1/+1
| | | | Approved by: trb
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-1/+1
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* Change the suser() API to take advantage of td_ucred as well as do ajhb2002-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@
* Simple p_ucred -> td_ucred changes to start using the per-thread ucredjhb2002-02-271-1/+1
| | | | reference.
* Cleanup of nmdm devicejulian2002-02-201-61/+100
|
* Don't call cdevsw_add().phk2001-11-041-1/+1
| | | | XXX: this driver lacks a proper _clone method.
* KSE Milestone 2julian2001-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
* Remove unused nmdmpoll function.mp2001-08-111-63/+0
| | | | Approved by: julian
* Send the remains (such as I have located) of "block major numbers" tophk2001-03-261-1/+0
| | | | the bit-bucket.
* Remove warnings.. seems to compile as a module now too.julian2001-02-271-4/+3
|
* Catch up with rwatsons ucred changes.julian2001-02-271-1/+1
|
* Do it right this time. Give it a better name and placejulian2001-02-271-0/+644
CVSrepo deletion of the previous attempt will be requested: --original message-- Add the 'virtual nulmodem driver' Particularly useful for debuging kernels using vmware. If your name is Bruce evans and you are a WIZ at tty interfaces, then you should probably rip this to shreds and offer lots of suggestions and patches. I've been using this since 4.0-CURRENT and it's never caused problems but I'm sure I got something wrong. This is similar to the pty/cty device driver except that both sides are ttys. Even minor numbers are side A and odd minor numbers are side B. Work needs to be done regarding what happens to the other side when you close a node. to use with vmware, configure vmware to redirect COM2 out to side A of one of these and boot a kernel with teh gdb remote port set to sio1. AFTER dropping into the gdb kernel debugger in your test kernel, fire up gdb with it's remote port pointing at the appropriate side B. To catch all console output, you can boot the vmware kernel with a serial console, (COM1) similarly redirected to a nulmodem, and use 'tip' to observe it. This is practically unaltered since pre 4.0 days except for changes made along the way needed to make it compile, so any suggestions or offers of total rewrites will be listenned to :-)
OpenPOWER on IntegriCloud