summaryrefslogtreecommitdiffstats
path: root/sys/kern/tty.c
Commit message (Collapse)AuthorAgeFilesLines
* - Move p->p_sigmask to td->td_sigmask. Signal masks will be per thread withjeff2003-03-311-13/+19
| | | | | | | 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)
* Change the process flags P_KSES to be P_THREADED.julian2003-02-271-1/+1
| | | | This is just a cosmetic change but I've been meaning to do it for about a year.
* Back out M_* changes, per decision of the TRB.imp2003-02-191-1/+1
| | | | Approved by: trb
* Remove #include <sys/dkstat.h>phk2003-02-161-1/+0
|
* Move the tty related statistics counters to live with the tty code.phk2003-02-161-0/+5
|
* Lock the proc around accessing p_siglist in ttycheckoutq() in thetjr2003-02-101-3/+14
| | | | unused wait != 0 case.
* 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.
* In an SMP environment post-Giant it is no longer safe to blindlytruckman2002-10-031-1/+1
| | | | | | | | | dereference the struct sigio pointer without any locking. Change fgetown() to take a reference to the pointer instead of a copy of the pointer and call SIGIO_LOCK() before copying the pointer and dereferencing it. Reviewed by: rwatson
* Rename the mutex thread and process states to use a more generic 'LOCK'jhb2002-10-021-3/+3
| | | | | | | | | name instead. (e.g., SLOCK instead of SMTX, TD_ON_LOCK() instead of TD_ON_MUTEX()) Eventually a turnstile abstraction will be added that will be shared with mutexes and other types of locks. SLOCK/TDI_LOCK will be used internally by the turnstile code and will not be specific to mutexes. Making the change now ensures that turnstiles can be dropped in at a later date without affecting the ABI of userland applications.
* Back our kernel support for reliable signal queues.jmallett2002-10-011-9/+5
| | | | Requested by: rwatson, phk, and many others
* First half of implementation of ksiginfo, signal queues, and such. Thisjmallett2002-09-301-5/+9
| | | | | | | | | | | | | | | | | | | | | | gets signals operating based on a TailQ, and is good enough to run X11, GNOME, and do job control. There are some intricate parts which could be more refined to match the sigset_t versions, but those require further evaluation of directions in which our signal system can expand and contract to fit our needs. After this has been in the tree for a while, I will make in kernel API changes, most notably to trapsignal(9) and sendsig(9), to use ksiginfo more robustly, such that we can actually pass information with our (queued) signals to the userland. That will also result in using a struct ksiginfo pointer, rather than a signal number, in a lot of kern_sig.c, to refer to an individual pending signal queue member, but right now there is no defined behaviour for such. CODAFS is unfinished in this regard because the logic is unclear in some places. Sponsored by: New Gold Technology Reviewed by: bde, tjr, jake [an older version, logic similar]
* Completely redo thread states.julian2002-09-111-6/+7
| | | | Reviewed by: davidxu@freebsd.org
* Clear up confusion in ugly code. ^T gave wrong results for RSS.julian2002-07-181-4/+9
| | | | | | I misinterpretted this code when changing it to handle threads. (there are still issues here) Submitted by: Ian Dowse <iedowse@maths.tcd.ie>
* Part 1 of KSE-IIIjulian2002-06-291-10/+43
| | | | | | | | | | | | | The ability to schedule multiple threads per process (one one cpu) by making ALL system calls optionally asynchronous. to come: ia64 and power-pc patches, patches for gdb, test program (in tools) Reviewed by: Almost everyone who counts (at various times, peter, jhb, matt, alfred, mini, bernd, and a cast of thousands) NOTE: this is still Beta code, and contains lots of debugging stuff. expect slight instability in signals..
* Display the mutex name in the ^T status line if the selected threadiedowse2002-06-201-2/+3
| | | | | is blocked on a mutex. Prepend a '*' to distinguish this case as is done in top(1).
* Nit: kern.ttys is of type S,xtty, not S,tty.des2002-05-311-1/+1
|
* Add some checks to prevent NULL dereferences.des2002-05-281-3/+6
| | | | Submitted by: jhay
* Add NAI copyright.des2002-05-281-0/+8
|
* Introduce struct xtty, used when exporting tty information to userland.des2002-05-281-5/+30
| | | | | | | Make kern.ttys export a struct xtty rather than struct tty. Since struct tty is no longer exposed to userland, remove the dev_t / udev_t hack. Sponsored by: DARPA, NAI Labs
* ANSIfy (significant portions were already partly ANSIfied)des2002-05-251-115/+42
|
* Remove register.des2002-05-251-51/+51
|
* Automated whitespace cleanup.des2002-05-251-10/+10
|
* Make funsetown() take a 'struct sigio **' so that the locking canalfred2002-05-061-1/+1
| | | | | | | | | | | | | | | | be done internally. Ensure that no one can fsetown() to a dying process/pgrp. We need to check the process for P_WEXIT to see if it's exiting. Process groups are already safe because there is no such thing as a pgrp zombie, therefore the proctree lock completely protects the pgrp from having sigio structures associated with it after it runs funsetownlst. Add sigio lock to witness list under proctree and allproc, but over proc and pgrp. Seigo Tanimura helped with this.
* Redo the sigio locking.alfred2002-05-011-2/+2
| | | | | | | | | | | Turn the sigio sx into a mutex. Sigio lock is really only needed to protect interrupts from dereferencing the sigio pointer in an object when the sigio itself is being destroyed. In order to do this in the most unintrusive manner change pgsigio's sigio * argument into a **, that way we can lock internally to the function.
* - Lock proctree_lock instead of pgrpsess_lock.jhb2002-04-161-33/+34
| | | | | | - 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.
* Dike out a highly insecure UCONSOLE option.ru2002-04-031-4/+14
| | | | | | TIOCCONS must be able to VOP_ACCESS() /dev/console to succeed. Obtained from: OpenBSD
* Fix leakage of p_pgrp lock.tanimura2002-04-021-1/+1
|
* Change the suser() API to take advantage of td_ucred as well as do ajhb2002-04-011-5/+7
| | | | | | | | | | | | 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-14/+14
|
* Fixes to make select/poll mpsafe.alfred2002-03-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: selwakeup required calling pfind which would cause lock order reversals with the allproc_lock and the per-process filedesc lock. Solution: Instead of recording the pid of the select()'ing process into the selinfo structure, actually record a pointer to the thread. To avoid dereferencing a bad address all the selinfo structures that are in use by a thread are kept in a list hung off the thread (protected by sellock). When a selwakeup occurs the selinfo is removed from that threads list, it is also removed on the way out of select or poll where the thread will traverse its list removing all the selinfos from its own list. Problem: Previously the PROC_LOCK was used to provide the mutual exclusion needed to ensure proper locking, this couldn't work because there was a single condvar used for select and poll and condvars can only be used with a single mutex. Solution: Introduce a global mutex 'sellock' which is used to provide mutual exclusion when recording events to wait on as well as performing notification when an event occurs. Interesting note: schedlock is required to manipulate the per-thread TDF_SELECT flag, however if given its own field it would not need schedlock, also because TDF_SELECT is only manipulated under sellock one doesn't actually use schedlock for syncronization, only to protect against corruption. Proc locks are no longer used in select/poll. Portions contributed by: davidc
* Stop abusing the pgrpsess_lock.tanimura2002-03-111-3/+3
|
* Fix lock leakage and late unlock.tanimura2002-03-021-3/+3
| | | | Submitted by: bde
* Fix a typo (?) in previous commit told ttyprintf() to print the integerphk2002-02-241-1/+1
| | | | | part of the user-time as a 64bit quantity. This resulted in weird output from SIGINFO.
* Lock struct pgrp, session and sigio.tanimura2002-02-231-53/+142
| | | | | | | | | | | | | | | | | | | | | | | | | 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)
* Fix a couple of style bugs introduced (or touched by) previous commit.peter2002-02-071-2/+0
|
* Pre-KSE/M3 commit.julian2002-02-071-1/+5
| | | | | | | | | | this is a low-functionality change that changes the kernel to access the main thread of a process via the linked list of threads rather than assuming that it is embedded in the process. It IS still embeded there but remove all teh code that assumes that in preparation for the next commit which will actually move it out. Reviewed by: peter@freebsd.org, gallatin@cs.duke.edu, benno rice,
* utime/stime.tv_sec are elapsed times, not relative to 1970. We canpeter2001-11-171-4/+4
| | | | | safely print them as longs. Even if ^T overflows after a process has accumulated 68 years of user or system time, it is no big deal.
* You cannot cast a time_t to quad_t and printf it with %lld. quad_t ispeter2001-11-161-2/+2
| | | | 64 bits, not long long.
* o Move suser() calls in kern/ to using suser_xxx() with an explicitrwatson2001-11-011-4/+4
| | | | | | | | | 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
* Make ttyprintf() of tv_sec value type agnostic.dillon2001-10-291-4/+4
|
* KSE Milestone 2julian2001-09-121-8/+19
| | | | | | | | | | | | | | 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
* Fix a warning on alpha (real problem) and make pstat -t work as a bonus.peter2001-09-101-1/+1
| | | | | | 'struct tty' was out of sync in user and kernel due to dev_t/udev_t mixups. This takes advantage of the fact that dev_t changes type in userland, so it isn't too pretty.
* Export the tk_nin and tk_nout variables (number of tty input/outputtmm2001-08-041-0/+4
| | | | characters) as sysctls (kern.tty_nin and kern.tty_nout).
* Unifdef DEV_SNP; snp(4) no longer requires these ugly hacks.dd2001-05-221-27/+0
| | | | Silence by: -hackers, -audit
* Undo part of the tangle of having sys/lock.h and sys/mutex.h included inmarkm2001-05-011-1/+2
| | | | | | | | | | | 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)
* Grab the process lock while calling psignal and before calling psignal.jhb2001-03-071-2/+8
|
* implement OCRNL, ONOCR, and ONLRETassar2001-03-041-1/+11
| | | | Obtained from: NetBSD
* Fix tab breakage from last commit.jlemon2001-02-171-2/+2
| | | | Spotted by: bde
* Extend kqueue down to the device layer.jlemon2001-02-151-0/+89
| | | | Backwards compatible approach suggested by: peter
OpenPOWER on IntegriCloud