summaryrefslogtreecommitdiffstats
path: root/sys/kern/tty_tty.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove unneeded Giant locking of /dev/tty.ed2008-06-031-3/+0
| | | | | | | | | | | | | | | | The Giant lock is acquired in two places in tty_tty.c. In both places, it is unneeded. There is no reason to specify D_NEEDGIANT on this device node. The device node has only been designed to return ENXIO when opened. It doesn't make any sense to lock/unlock Giant, just to return this error. D_TTY is also unneeded. The unimplemented functions don't need to be patched by devfs. We don't need to lock Giant when we want to lookup the proper TTY vnode. s_ttyvp is already protected by proctree_lock (see devfs_vnops.c). Approved by: philip (mentor)
* In keeping with style(9)'s recommendations on macros, use a ';'rwatson2008-03-161-1/+1
| | | | | | | | | after each SYSINIT() macro invocation. This makes a number of lightweight C parsers much happier with the FreeBSD kernel source, including cflow's prcc and lxr. MFC after: 1 month Discussed with: imp, rink
* Lock Giant and proctree lock around dereferencing p_session->s_ttyvp->v_rdev.kib2007-07-031-1/+13
| | | | | | | | | | Lock cdev mutex too to close the race with tty being freed. Relock clone_drain_lock to prevent the LOR with proctree lock, thus add #include <fs/devfs/devfs_int.h>. Suggested by: tegge Debugging help and testing by: Peter Holm Approved by: re (kensmith)
* Use ctty instead of just returning. ctty just has a simple open thatmbr2006-09-271-1/+1
| | | | | | returns ENXIO. Submitted by: jhb
* If /dev/tty gets opened after your controlling terminal has been revokedmbr2006-09-231-1/+5
| | | | | | | | | | | | | you can't call tty_clone afterwords. OpenBSD and NetBSD both fail the open call in that case, so we should do so as well. This can be done in ctty_clone by returning with *dev==NULL. Admittedly this causes open to return ENOENT, instead of ENXIO as on the other BSDs, but this way requires the least touching of code. Submitted by: Nate Eldredge <nge@cs.hmc.edu> PR: 83375 MFC: 1 week
* 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.
* Use dynamic major number allocation.phk2005-02-271-4/+1
|
* 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-3/+3
| | | | Bump __FreeBSD_version accordingly.
* Device megapatch 4/6:phk2004-02-211-1/+2
| | | | | | | | 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.
* The present defaults for the open and close for device drivers whichphk2003-09-271-1/+0
| | | | | | | | | | | | | | provide no methods does not make any sense, and is not used by any driver. It is a pretty hard to come up with even a theoretical concept of a device driver which would always fail open and close with ENODEV. Change the defaults to be nullopen() and nullclose() which simply does nothing. Remove explicit initializations to these from the drivers which already used them.
* Use __FBSDID().obrien2003-06-111-2/+3
|
* Gigacommit to improve device-driver source compatibility betweenphk2003-03-031-13/+5
| | | | | | | | | | | | | 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)
* NODEVFS cleanup: Unifdef.phk2003-01-301-282/+0
|
* Don't dereference null vnode pointer if controling terminal was revoked.phk2003-01-271-3/+5
| | | | Submitted by: "Peter Edwards" <pmedwards@eircom.net>
* Originally when DEVFS was added, a global variable "devfs_present"phk2003-01-191-6/+1
| | | | | | | | | | | | was used to control code which were conditional on DEVFS' precense since this avoided the need for large-scale source pollution with #include "opt_geom.h" Now that we approach making DEVFS standard, replace these tests with an #ifdef to facilitate mechanical removal once DEVFS becomes non-optional. No functional change by this commit.
* When we use DEVFS, we don't need the /dev/tty pseudo-driver to dophk2003-01-191-0/+89
| | | | | | | | | | | | more than return ENXIO from its open routine, so most of this file is unneeded. A straight #ifdef'ing would look quite messy, and make the file quite unreadable, so instead I have simply added the DEVFS version of the file at the top, protected by #ifndef NODEVFS. Once we have removed NODEVFS option, we can retain 86 the 86 lines at the top and drop the other 287 lines.
* Pass active_cred and file_cred into the MAC framework explicitlyrwatson2002-08-191-5/+6
| | | | | | | | | | | for mac_check_vnode_{poll,read,stat,write}(). Pass in fp->f_cred when calling these checks with a struct file available. Otherwise, pass NOCRED. All currently MAC policies use active_cred, but could now offer the cached credential semantic used for the base system security model. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
* Break out mac_check_vnode_op() into three seperate checks:rwatson2002-08-191-3/+3
| | | | | | | | | | mac_check_vnode_poll(), mac_check_vnode_read(), mac_check_vnode_write(). This improves the consistency with other existing vnode checks, and allows policies to avoid implementing switch statements to determine what operations they do and do not want to authorize. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
* Enforce MAC policy in cttyread() as well as the other operationsrwatson2002-08-121-1/+6
| | | | | | | already instrumented. Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
* Include file cleanup; mac.h and malloc.h at one point had orderingrwatson2002-08-011-1/+1
| | | | | | relationship requirements, and no longer do. Reminded by: bde
* Introduce support for Mandatory Access Control and extensiblerwatson2002-08-011-1/+27
| | | | | | | | | | | | | | kernel access control. Instrument ctty driver invocations of various vnode operations on the terminal controlling tty to perform appropriate MAC framework authorization checks. Note: VOP_IOCTL() on the ctty appears to be authorized using NOCRED in the existing code rather than td->td_ucred. Why? Obtained from: TrustedBSD Project Sponsored by: DARPA, NAI Labs
* Remove __P.alfred2002-03-191-2/+2
|
* Simple p_ucred -> td_ucred changes to start using the per-thread ucredjhb2002-02-271-1/+1
| | | | reference.
* Lock struct pgrp, session and sigio.tanimura2002-02-231-9/+47
| | | | | | | | | | | | | | | | | | | | | | | | | New locks are: - pgrpsess_lock which locks the whole pgrps and sessions, - pg_mtx which protects the pgrp members, and - s_mtx which protects the session members. Please refer to sys/proc.h for the coverage of these locks. Changes on the pgrp/session interface: - pgfind() needs the pgrpsess_lock held. - The caller of enterpgrp() is responsible to allocate a new pgrp and session. - Call enterthispgrp() in order to enter an existing pgrp. - pgsignal() requires a pgrp lock held. Reviewed by: jhb, alfred Tested on: cvsup.jp.FreeBSD.org (which is a quad-CPU machine running -current)
* KSE Milestone 2julian2001-09-121-27/+27
| | | | | | | | | | | | | | 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
* Support /dev/ctty againbrian2001-05-151-3/+8
| | | | Submitted by: peter
* Use the new ability to avoid practically all the gunk in this file.phk2001-05-141-17/+26
| | | | | | | When people access /dev/tty, locate their controlling tty and return the dev_t of it to them. This basically makes /dev/tty act like a variant symlink sort of thing which is much simpler than all the mucking about with vnodes.
* Undo part of the tangle of having sys/lock.h and sys/mutex.h included inmarkm2001-05-011-1/+1
| | | | | | | | | | | other "system" header files. Also help the deprecation of lockmgr.h by making it a sub-include of sys/lock.h and removing sys/lockmgr.h form kernel .c files. Sort sys/*.h includes where possible in affected files. OK'ed by: bde (with reservations)
* Send the remains (such as I have located) of "block major numbers" tophk2001-03-261-1/+0
| | | | the bit-bucket.
* Add snapshots to the fast filesystem. Most of the changes supportmckusick2000-07-111-0/+6
| | | | | | | | | | | | | | | | | | | | the gating of system calls that cause modifications to the underlying filesystem. The gating can be enabled by any filesystem that needs to consistently suspend operations by adding the vop_stdgetwritemount to their set of vnops. Once gating is enabled, the function vfs_write_suspend stops all new write operations to a filesystem, allows any filesystem modifying system calls already in progress to complete, then sync's the filesystem to disk and returns. The function vfs_write_resume allows the suspended write operations to begin again. Gating is not added by default for all filesystems as for SMP systems it adds two extra locks to such critical kernel paths as the write system call. Thus, gating should only be added as needed. Details on the use and current status of snapshots in FFS can be found in /sys/ufs/ffs/README.snapshot so for brevity and timelyness is not included here. Unless and until you create a snapshot file, these changes should have no effect on your system (famous last words).
* Remove five now unused fields from struct cdevsw. They should neverphk1999-09-251-5/+0
| | | | | | | | have been there in the first place. A GENERIC kernel shrinks almost 1k. Add a slightly different safetybelt under nostop for tty drivers. Add some missing FreeBSD tags
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Convert DEVFS hooks in (most) drivers to make_dev().phk1999-08-231-20/+2
| | | | | | | | | | | | | | | | Diskslice/label code not yet handled. Vinum, i4b, alpha, pc98 not dealt with (left to respective Maintainers) Add the correct hook for devfs to kern_conf.c The net result of this excercise is that a lot less files depends on DEVFS, and devtoname() gets more sensible output in many cases. A few drivers had minor additional cleanups performed relating to cdevsw registration. A few drivers don't register a cdevsw{} anymore, but only use make_dev().
* Simplify cdevsw registration.phk1999-05-311-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | The cdevsw_add() function now finds the major number(s) in the struct cdevsw passed to it. cdevsw_add_generic() is no longer needed, cdevsw_add() does the same thing. cdevsw_add() will print an message if the d_maj field looks bogus. Remove nblkdev and nchrdev variables. Most places they were used bogusly. Instead check a dev_t for validity by seeing if devsw() or bdevsw() returns NULL. Move bdevsw() and devsw() functions to kern/kern_conf.c Bump __FreeBSD_version to 400006 This commit removes: 72 bogus makedev() calls 26 bogus SYSINIT functions if_xe.c bogusly accessed cdevsw[], author/maintainer please fix. I4b and vinum not changed. Patches emailed to authors. LINT probably broken until they catch up.
* This commit should be a extensive NO-OP:phk1999-05-301-7/+21
| | | | | | | | | | | | | Reformat and initialize correctly all "struct cdevsw". Initialize the d_maj and d_bmaj fields. The d_reset field was not removed, although it is never used. I used a program to do most of this, so all the files now use the same consistent format. Please keep it that way. Vinum and i4b not modified, patches emailed to respective authors.
* Added D_TTY to the cdevswitch flags for all tty drivers. This is requiredbde1998-08-231-8/+10
| | | | | | | | | for the Lite2 fix for always returning EIO in dead_read(). Cleaned up the cdevswitch initializers for all tty drivers. Removed explicit calls to ttsetwater() from all (tty) drivers. ttsetwater() is now called centrally for opens, not just for parameter changes.
* This commit fixes various 64bit portability problems required fordfr1998-06-071-2/+2
| | | | | | | | | | FreeBSD/alpha. The most significant item is to change the command argument to ioctl functions from int to u_long. This change brings us inline with various other BSD versions. Driver writers may like to use (__FreeBSD_version == 300003) to detect this change. The prototype FreeBSD/alpha machdep will follow in a couple of days time.
* Don't depend on "implicit int" or bloat the data section in thebde1998-02-201-2/+2
| | | | declaration of xxx_devsw_installed.
* Make all file-system (MFS, FFS, NFS, LFS, DEVFS) related option new-style.eivind1998-01-241-1/+4
| | | | | | | | This introduce an xxxFS_BOOT for each of the rootable filesystems. (Presently not required, but encouraged to allow a smooth move of option *FS to opt_dontuse.h later.) LFS is temporarily disabled, and will be re-enabled tomorrow.
* Don't include <sys/lock.h> in headers when only `struct simplelock' isbde1997-12-051-1/+2
| | | | required. Fixed everything that depended on the pollution.
* Get tty ioctl numbers by #including <sys/ttycom.h> instead ofbde1997-11-181-3/+2
| | | | | <sys/tty.h>. Don't #include <sys/fcntl.h> (the select -> poll changes removed all dependencies on it).
* Fixed gratuitous ANSIisms.bde1997-09-161-2/+4
|
* Extend to use poll backend. If memory serves correctly, most of this waspeter1997-09-141-7/+9
| | | | | | | adapted from NetBSD.. However, there are some differences in the tty system that are big enough to cause their code to not fit comfortably. Obtained from: NetBSD (I think)
* Removed unused #includes.bde1997-09-021-2/+1
|
* Don't include <sys/ioctl.h> in the kernel. Stage 1: don't includebde1997-03-241-2/+1
| | | | | it when it is not used. In most cases, the reasons for including it went away when the special ioctl headers became self-sufficient.
* Don't #include <sys/fcntl.h> in <sys/file.h> if KERNEL is defined.bde1997-03-231-2/+2
| | | | | Fixed everything that depended on getting fcntl.h stuff from the wrong place. Most things don't depend on file.h stuff at all.
* Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are notpeter1997-02-221-1/+1
| | | | ready for it yet.
* This is the kernel Lite/2 commit. There are some requisite userlanddyson1997-02-101-10/+10
| | | | | | | | | | | | | | | changes, so don't expect to be able to run the kernel as-is (very well) without the appropriate Lite/2 userland changes. The system boots and can mount UFS filesystems. Untested: ext2fs, msdosfs, NFS Known problems: Incorrect Berkeley ID strings in some files. Mount_std mounts will not work until the getfsent library routine is changed. Reviewed by: various people Submitted by: Jeffery Hsu <hsu@freebsd.org>
OpenPOWER on IntegriCloud