summaryrefslogtreecommitdiffstats
path: root/sys/kern/tty_pty.c
Commit message (Collapse)AuthorAgeFilesLines
* Don't destroy the slave /dev entry until someone figures out why devfs seemscognet2006-02-021-1/+1
| | | | to behave badly when we do so.
* Allow root in the host environment to open ptys within jailed environments.csjp2006-01-311-1/+1
| | | | | | | | | | | | | | This logic change was introduced in revision 1.74: Correct an oversight in jail() that allowed processes in jail to access ptys in ways that might be unethical, especially towards processes not in jail, or in other jails. It should be fine to allow root in the host environment to do this. This allows for more effective monitoring of prisons from the host environment. Discussed with: rwatson MFC after: 1 week
* Don't attempt to re-create the /dev entry for the slave part if it alreadycognet2006-01-261-1/+2
| | | | | | | exist when opening the master. This can happen if one open the master, then open the slave, then close and re-open the master. Reported by: Peter Holm
* Bring in a sysv-style pts implementation, as found in the rwatson_pts ↵cognet2006-01-261-7/+54
| | | | | | | | | | | | perforce branch. It works the same as its SysV/linux counterpart : You obtain a fd to the master pseudo terminal by opening /dev/ptmx, which craetes a node for the master as /dev/pty[num] and a node for the slave as /dev/pts/[num]. It should play nicely with the existing BSD ptys. By default, the system will use the BSD ptys, one can set the sysctl kern.pts.enable to 1 to make it use the new pts system. The max number of pty that can be allocated on a system can be changed with the sysctl kern.pts.max. It defaults to 1000, and can be increased, but it is not recommanded, as any pty with a number > 999 won't be handled by whatever uses utmp(5).
* Move the old BSD4.3 tty compatibility from (!BURN_BRIDGES && COMPAT_43)phk2006-01-101-9/+3
| | | | | | | | | | | | to COMPAT_43TTY. Add COMPAT_43TTY to NOTES and */conf/GENERIC Compile tty_compat.c only under the new option. Spit out #warning "Old BSD tty API used, please upgrade." if ioctl_compat.h gets #included from userland.
* Use ttyalloc() instead of ttymalloc()phk2006-01-041-1/+1
|
* Merge the dev_clone and dev_clone_cred event handlers into a singlerwatson2005-08-081-1/+1
| | | | | | | | | | | | | 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
* When devfs cloning takes place, provide access to the credential of therwatson2005-07-141-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | process that caused the clone event to take place for the device driver creating the device. This allows cloned device drivers to adapt the device node based on security aspects of the process, such as the uid, gid, and MAC label. - Add a cred reference to struct cdev, so that when a device node is instantiated as a vnode, the cloning credential can be exposed to MAC. - Add make_dev_cred(), a version of make_dev() that additionally accepts the credential to stick in the struct cdev. Implement it and make_dev() in terms of a back-end make_dev_credv(). - Add a new event handler, dev_clone_cred, which can be registered to receive the credential instead of dev_clone, if desired. - Modify the MAC entry point mac_create_devfs_device() to accept an optional credential pointer (may be NULL), so that MAC policies can inspect and act on the label or other elements of the credential when initializing the skeleton device protections. - Modify tty_pty.c to register clone_dev_cred and invoke make_dev_cred(), so that the pty clone credential is exposed to the MAC Framework. While currently primarily focussed on MAC policies, this change is also a prerequisite for changes to allow ptys to be instantiated with the UID of the process looking up the pty. This requires further changes to the pty driver -- in particular, to immediately recycle pty nodes on last close so that the credential-related state can be recreated on next lookup. Submitted by: Andrew Reisse <andrew.reisse@sparta.com> Obtained from: TrustedBSD Project Sponsored by: SPAWAR, SPARTA MFC after: 1 week MFC note: Merge to 6.x, but not 5.x for ABI reasons
* 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-5/+1
|
* /* -> /*- for copyright notices, minor format tweaks as necessaryimp2005-01-061-1/+1
|
* Include uio.hphk2004-12-221-3/+3
| | | | | Check O_NONBLOCK instead if IO_NDELAY Don't include vnode.h
* Add new function ttyinitmode() which sets our systemwide defaultphk2004-10-181-6/+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.
* Make pty's always come up in echo mode.phk2004-10-151-1/+1
|
* Split the ioctl function in control and slave side, this eliminatedphk2004-09-231-68/+78
| | | | a troublesome devsw() call.
* Use the tty->t_sc field to find our softc.phk2004-09-161-3/+4
|
* 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.
* Gah! commit from wrong tree.phk2004-06-251-6/+0
| | | | Remove now unused variables from last commit.
* Retire the TIOC_REMOTE ioctl.phk2004-06-251-95/+3
| | | | | It was added 22 years ago for emacs to use, but emacs gave up on it it 17 years ago.
* Put the pre FreeBSD-2.x tty compat code under BURN_BRIDGES.phk2004-06-211-2/+6
|
* Second half of the dev_t cleanup.phk2004-06-171-2/+2
| | | | | | | | | | | 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-16/+16
| | | | Bump __FreeBSD_version accordingly.
* Deorbit COMPAT_SUNOS.phk2004-06-111-2/+2
| | | | | We inherited this from the sparc32 port of BSD4.4-Lite1. We have neither a sparc32 port nor a SunOS4.x compatibility desire these days.
* Rename struct pt_ioctl to "ptsc" and pointers to it from "pti" to "pt"phk2004-06-091-65/+65
|
* Ditch K&R function stylephk2004-06-091-63/+15
|
* Move PTY private defines into PTY private files.phk2004-06-091-0/+4
|
* Machine generated patch which changes linedisc calls from accessingphk2004-06-041-8/+8
| | | | | | linesw[] directly to using the ttyld...() functions The ttyld...() functions ar inline so there is no performance hit.
* Use ttymalloc() instead of ttyregister(). Use ttyioctl() instead ofphk2004-06-041-8/+6
| | | | direct calls to the linedisc.
* 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.
* Remove advertising clause from University of California Regent's license,imp2004-04-051-4/+0
| | | | | | per letter dated July 22, 1999. Approved by: core
* Device megapatch 4/6:phk2004-02-211-2/+4
| | | | | | | | 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-3/+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.
* Remove excess brackets.rwatson2004-02-151-3/+2
|
* - 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
* Don't use seltrue when that is not really what we mean.phk2003-09-271-1/+2
|
* Use __FBSDID().obrien2003-06-111-1/+3
|
* "break" rather than fall through to a break in the default clause.phk2003-05-311-0/+1
| | | | Found by: FlexeLint
* - Merge struct procsig with struct sigacts.jhb2003-05-131-1/+1
| | | | | | | | | | | | | | | | | - Move struct sigacts out of the u-area and malloc() it using the M_SUBPROC malloc bucket. - Add a small sigacts_*() API for managing sigacts structures: sigacts_alloc(), sigacts_free(), sigacts_copy(), sigacts_share(), and sigacts_shared(). - Remove the p_sigignore, p_sigacts, and p_sigcatch macros. - Add a mutex to struct sigacts that protects all the members of the struct. - Add sigacts locking. - Remove Giant from nosys(), kill(), killpg(), and kern_sigaction() now that sigacts is locked. - Several in-kernel functions such as psignal(), tdsignal(), trapsignal(), and thread_stopped() are now MP safe. Reviewed by: arch@ Approved by: re (rwatson)
* - Move p->p_sigmask to td->td_sigmask. Signal masks will be per thread withjeff2003-03-311-1/+1
| | | | | | | a follow on commit to kern_sig.c - signotify() now operates on a thread since unmasked pending signals are stored in the thread. - PS_NEEDSIGCHK moves to TDF_NEEDSIGCHK.
* Make TTYHOG tunable.das2003-03-051-0/+1
| | | | Reviewed by: mike (mentor)
* Make nokqfilter() return the correct return value.phk2003-03-031-2/+2
| | | | Ditch the D_KQFILTER flag which was used to prevent calling NULL pointers.
* Gigacommit to improve device-driver source compatibility betweenphk2003-03-031-28/+20
| | | | | | | | | | | | | 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)
* Clean up whitespace, s/register //, refrain from strong urge to ANSIfy.des2003-03-021-24/+24
|
* uiomove-related caddr_t -> void * (just the low-hanging fruit)des2003-03-021-4/+3
|
* 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.
* Remove cdevsw_add calls, they are deprecated.phk2002-12-281-2/+1
|
* - Lock proctree_lock instead of pgrpsess_lock.jhb2002-04-161-6/+8
| | | | | | - Use temporary variables to hold a pointer to a pgrp while we dink with it while not holding either the associated proc lock or proctree_lock. It is in theory possible that p->p_pgrp could change out from under us.
* 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@
* Remove __P.alfred2002-03-191-6/+6
|
OpenPOWER on IntegriCloud