summaryrefslogtreecommitdiff
path: root/sys/kern/tty_pty.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove cdevsw_add calls, they are deprecated.Poul-Henning Kamp2002-12-281-2/+1
| | | | Notes: svn path=/head/; revision=108363
* - Lock proctree_lock instead of pgrpsess_lock.John Baldwin2002-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. Notes: svn path=/head/; revision=94860
* 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
* Remove __P.Alfred Perlstein2002-03-191-6/+6
| | | | Notes: svn path=/head/; revision=92723
* Fix lock leakage and late unlock.Seigo Tanimura2002-03-021-0/+1
| | | | | | | Submitted by: bde Notes: svn path=/head/; revision=91565
* Simple p_ucred -> td_ucred changes to start using the per-thread ucredJohn Baldwin2002-02-271-5/+3
| | | | | | | reference. Notes: svn path=/head/; revision=91406
* Lock struct pgrp, session and sigio.Seigo Tanimura2002-02-231-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=91140
* The ICANON flag is an lflag, not an iflag.Matthew Dillon2002-02-181-2/+2
| | | | | | | | Submitted by: Neelkanth Natu <neelnatu@yahoo.com> MFC after: 3 days Notes: svn path=/head/; revision=90831
* o Move suser() calls in kern/ to using suser_xxx() with an explicitRobert Watson2001-11-011-1/+1
| | | | | | | | | | | | credential selection, rather than reference via a thread or process pointer. This is part of a gradual migration to suser() accepting a struct ucred instead of a struct proc, simplifying the reference and locking semantics of suser(). Obtained from: TrustedBSD Project Notes: svn path=/head/; revision=85844
* Use the passed in thread pointer instead of curthread in calls toJohn Baldwin2001-09-211-2/+2
| | | | | | | | | selrecord() in ptcpoll(). The pre-KSE code used the passed in proc pointer rather than curproc, and an earlier seltrue() call uses the passed in thread and not curthread. Notes: svn path=/head/; revision=83803
* KSE Milestone 2Julian Elischer2001-09-121-17/+20
| | | | | | | | | | | | | | | | | 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
* Don't remove the SI_CHEAPCLONE for unsupported minorsBrian Somers2001-06-181-1/+2
| | | | Notes: svn path=/head/; revision=78405
* With the new kernel dev_t conversions done at release 4.X,Poul-Henning Kamp2001-05-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | it becomes possible to trap in ptsstop() in kern/tty_pty.c if the slave side has never been opened during the life of a kernel. What happens is that calls to ttyflush() done from ptyioctl() for the controlling side end up calling ptsstop() [via (*tp->t_stop)(tp, <X>)] which evaluates the following: struct pt_ioctl *pti = tp->t_dev->si_drv1; In order for tp->t_dev to be set, the slave device must first be opened in ttyopen() [kern/tty.c]. It appears that the only problem is calls to (*tp->t_stop)(tp, <n>), so this could also happen with other ioctls initiated by the controlling side before the slave has been opened. PR: 27698 Submitted by: David Bein bein@netapp.com MFC after: 6 days Notes: svn path=/head/; revision=77360
* Make the PTY drivers cloning algorithm create "CHEAPCLONE" dev_t,Poul-Henning Kamp2001-05-251-11/+12
| | | | | | | so that some twit cannot allocate all 256 PTY's with "ls -l". Notes: svn path=/head/; revision=77176
* Send the remains (such as I have located) of "block major numbers" toPoul-Henning Kamp2001-03-261-2/+0
| | | | | | | the bit-bucket. Notes: svn path=/head/; revision=74810
* o Move per-process jail pointer (p->pr_prison) to inside of the subjectRobert Watson2001-02-211-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | credential structure, ucred (cr->cr_prison). o Allow jail inheritence to be a function of credential inheritence. o Abstract prison structure reference counting behind pr_hold() and pr_free(), invoked by the similarly named credential reference management functions, removing this code from per-ABI fork/exit code. o Modify various jail() functions to use struct ucred arguments instead of struct proc arguments. o Introduce jailed() function to determine if a credential is jailed, rather than directly checking pointers all over the place. o Convert PRISON_CHECK() macro to prison_check() function. o Move jail() function prototypes to jail.h. o Emulate the P_JAILED flag in fill_kinfo_proc() and no longer set the flag in the process flags field itself. o Eliminate that "const" qualifier from suser/p_can/etc to reflect mutex use. Notes: o Some further cleanup of the linux/jail code is still required. o It's now possible to consider resolving some of the process vs credential based permission checking confusion in the socket code. o Mutex protection of struct prison is still not present, and is required to protect the reference count plus some fields in the structure. Reviewed by: freebsd-arch Obtained from: TrustedBSD Project Notes: svn path=/head/; revision=72786
* Extend kqueue down to the device layer.Jonathan Lemon2001-02-151-4/+6
| | | | | | | Backwards compatible approach suggested by: peter Notes: svn path=/head/; revision=72521
* Convert more malloc+bzero to malloc+M_ZERO.David Malone2000-12-081-2/+1
| | | | | | | | Submitted by: josh@zipperup.org Submitted by: Robert Drehmel <robd@gmx.net> Notes: svn path=/head/; revision=69781
* Staticize some malloc M_ instances.Poul-Henning Kamp2000-12-081-1/+1
| | | | Notes: svn path=/head/; revision=69774
* Rename lminor() to dev2unit(). This function gives a linear unit numberPoul-Henning Kamp2000-09-191-2/+2
| | | | | | | | | | | | | | | which hides the 'hole' in the minor bits. Introduce unit2minor() to do the reverse operation. Fix some some make_dev() calls which didn't use UID_* or GID_* macros. Kill the v_hashchain alias macro, it hides the real relationship. Introduce experimental SI_CHEAPCLONE flag set it on cloned bpfs. Notes: svn path=/head/; revision=66067
* Avoid the modules madness I inadvertently introduced by making thePoul-Henning Kamp2000-09-021-32/+1
| | | | | | | | | | | | | | | | | | | | | cloning infrastructure standard in kern_conf. Modules are now the same with or without devfs support. If you need to detect if devfs is present, in modules or elsewhere, check the integer variable "devfs_present". This happily removes an ugly hack from kern/vfs_conf.c. This forces a rename of the eventhandler and the standard clone helper function. Include <sys/eventhandler.h> in <sys/conf.h>: it's a helper #include like <sys/queue.h> Remove all #includes of opt_devfs.h they no longer matter. Notes: svn path=/head/; revision=65374
* Remove all traces of Julians DEVFS (incl from kern/subr_diskslice.c)Poul-Henning Kamp2000-08-201-9/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove old DEVFS support fields from dev_t. Make uid, gid & mode members of dev_t and set them in make_dev(). Use correct uid, gid & mode in make_dev in disk minilayer. Add support for registering alias names for a dev_t using the new function make_dev_alias(). These will show up as symlinks in DEVFS. Use makedev() rather than make_dev() for MFSs magic devices to prevent DEVFS from noticing this abuse. Add a field for DEVFS inode number in dev_t. Add new DEVFS in fs/devfs. Add devfs cloning to: disk minilayer (ie: ad(4), sd(4), cd(4) etc etc) md(4), tun(4), bpf(4), fd(4) If DEVFS add -d flag to /sbin/inits args to make it mount devfs. Add commented out DEVFS to GENERIC Notes: svn path=/head/; revision=64880
* Unused include: #include "pty.h"Peter Wemm2000-06-101-1/+0
| | | | Notes: svn path=/head/; revision=61473
* Since ptys are allocated dynamically, there is no needs to keep theirAndrey A. Chernov2000-05-011-1/+1
| | | | | | | t_timeout across close, so move t_timeout initializing to ptcopen Notes: svn path=/head/; revision=59818
* Set t_timeout to its default sysctl value only once in ttyopenAndrey A. Chernov2000-05-011-0/+1
| | | | | | | | | Initialize t_timeout to -1 for this reason Pointed-by: bde Notes: svn path=/head/; revision=59815
* Correct an oversight in jail() that allowed processes in jail to accessRobert Watson2000-02-091-1/+8
| | | | | | | | | | | | ptys in ways that might be unethical, especially towards processes not in jail, or in other jails. Submitted by: phk Reviewed by: rwatson Approved by: jkh Notes: svn path=/head/; revision=57070
* Revert peter's commit to remove cdevsw_add() - it was a bit prematureJordan K. Hubbard1999-11-211-0/+2
| | | | | | | | since things fail to function properly without it (pty allocation becomes somewhat haphazard). Notes: svn path=/head/; revision=53483
* Remove cdevsw_add() as the make_dev()'s are done in a clone-like fashion.Peter Wemm1999-11-181-2/+0
| | | | | | | | (ie: the next device is created with make_dev as the first is opened and so on) Notes: svn path=/head/; revision=53336
* sigset_t change (part 2 of 5)Marcel Moolenaar1999-09-291-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ----------------------------- The core of the signalling code has been rewritten to operate on the new sigset_t. No methodological changes have been made. Most references to a sigset_t object are through macros (see signalvar.h) to create a level of abstraction and to provide a basis for further improvements. The NSIG constant has not been changed to reflect the maximum number of signals possible. The reason is that it breaks programs (especially shells) which assume that all signals have a non-null name in sys_signame. See src/bin/sh/trap.c for an example. Instead _SIG_MAXSIG has been introduced to hold the maximum signal possible with the new sigset_t. struct sigprop has been moved from signalvar.h to kern_sig.c because a) it is only used there, and b) access must be done though function sigprop(). The latter because the table doesn't holds properties for all signals, but only for the first NSIG signals. signal.h has been reorganized to make reading easier and to add the new and/or modified structures. The "old" structures are moved to signalvar.h to prevent namespace polution. Especially the coda filesystem suffers from the change, because it contained lines like (p->p_sigmask == SIGIO), which is easy to do for integral types, but not for compound types. NOTE: kdump (and port linux_kdump) must be recompiled. Thanks to Garrett Wollman and Daniel Eischen for pressing the importance of changing sigreturn as well. Notes: svn path=/head/; revision=51791
* Remove five now unused fields from struct cdevsw. They should neverPoul-Henning Kamp1999-09-251-10/+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 Notes: svn path=/head/; revision=51658
* This patch clears the way for removing a number of tty relatedPoul-Henning Kamp1999-09-251-16/+6
| | | | | | | | | | | | | | | | | | | | | | | | fields in struct cdevsw: d_stop moved to struct tty. d_reset already unused. d_devtotty linkage now provided by dev_t->si_tty. These fields will be removed from struct cdevsw together with d_params and d_maxio Real Soon Now. The changes in this patch consist of: initialize dev->si_tty in *_open() initialize tty->t_stop remove devtotty functions rename ttpoll to ttypoll a few adjustments to these changes in the generic code a bump of __FreeBSD_version add a couple of FreeBSD tags Notes: svn path=/head/; revision=51654
* s/si_tty_tty/si_tty/gPoul-Henning Kamp1999-08-301-12/+12
| | | | Notes: svn path=/head/; revision=50652
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50477
* Convert DEVFS hooks in (most) drivers to make_dev().Poul-Henning Kamp1999-08-231-14/+7
| | | | | | | | | | | | | | | | | | | 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(). Notes: svn path=/head/; revision=50254
* First small steps at merging DEVFS and PHK's Dev_t stuff.Julian Elischer1999-08-201-25/+8
| | | | Notes: svn path=/head/; revision=50092
* Devfs isn't quite dead yet... Add back devfs support to ptys..Julian Elischer1999-08-171-1/+36
| | | | | | | | | When you use pty(N) it creates pty(N+1) ready for your use in the DEVFS, so DEVFS is not cluttered up with hundreds of ptys you are never going to use. Notes: svn path=/head/; revision=49992
* Add new sysctl "kern.ttys" which return all the struct tty's which havePoul-Henning Kamp1999-08-081-1/+2
| | | | | | | | | been registered with ttyregister(). register ptys with ttyregister(). Notes: svn path=/head/; revision=49540
* Make the pty driver as close to a cloning device as we can get for now,Poul-Henning Kamp1999-08-081-99/+62
| | | | | | | | | | | | we create the pty on the fly when it is first opened. If you run out of ptys now, just MAKEDEV some more. This also demonstrate the use of dev_t->si_tty_tty and dev_t->si_drv1 in a device driver. Notes: svn path=/head/; revision=49536
* Simplify cdevsw registration.Poul-Henning Kamp1999-05-311-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=47640
* This commit should be a extensive NO-OP:Poul-Henning Kamp1999-05-301-13/+41
| | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=47625
* TIOCEXT is also inapproriate before the slave is open, return EAGAIN whenLuoqi Chen1999-05-181-29/+31
| | | | | | | | | these ioctls are attempted. Move a misplaced comment. Pointed out by: Bruce Notes: svn path=/head/; revision=47301
* Ignore some ioctls on the master until the slave is open.Luoqi Chen1999-05-141-3/+12
| | | | Notes: svn path=/head/; revision=47203
* I got tired of seeing all the cdevsw[major(foo)] all over the place.Poul-Henning Kamp1999-05-081-2/+2
| | | | | | | | | | | Made a new (inline) function devsw(dev_t dev) and substituted it. Changed to the BDEV variant to this format as well: bdevsw(dev_t dev) DEVFS will eventually benefit from this change too. Notes: svn path=/head/; revision=46676
* Suser() simplification:Poul-Henning Kamp1999-04-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | 1: s/suser/suser_xxx/ 2: Add new function: suser(struct proc *), prototyped in <sys/proc.h>. 3: s/suser_xxx(\([a-zA-Z0-9_]*\)->p_ucred, \&\1->p_acflag)/suser(\1)/ The remaining suser_xxx() calls will be scrutinized and dealt with later. There may be some unneeded #include <sys/cred.h>, but they are left as an exercise for Bruce. More changes to the suser() API will come along with the "jail" code. Notes: svn path=/head/; revision=46112
* Use suser() to check for super user rather than examining cr_uid directly.Poul-Henning Kamp1999-01-301-2/+2
| | | | | | | | | Use TTYDEF_SPEED rather than 9600 a couple of places. Reviewed by: bde, with a few grumbles. Notes: svn path=/head/; revision=43425
* Added D_TTY to the cdevswitch flags for all tty drivers. This is requiredBruce Evans1998-08-231-14/+18
| | | | | | | | | | | | 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. Notes: svn path=/head/; revision=38485
* Changed %n to %r in devfs name format strings. %n has almost gone away.Bruce Evans1998-07-151-3/+3
| | | | Notes: svn path=/head/; revision=37683
* This commit fixes various 64bit portability problems required forDoug Rabson1998-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. Notes: svn path=/head/; revision=36735
* Don't depend on "implicit int" or bloat the data section in theBruce Evans1998-02-251-3/+3
| | | | | | | | | declaration of ptc_devsw_installed. Fixed a spelling error. Notes: svn path=/head/; revision=33826
* Make all file-system (MFS, FFS, NFS, LFS, DEVFS) related option new-style.Eivind Eklund1998-01-241-1/+2
| | | | | | | | | | | 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. Notes: svn path=/head/; revision=32726