summaryrefslogtreecommitdiffstats
path: root/sys/kern/tty.c
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Change and clean the mutex lock interface.bmilekic2001-02-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mtx_enter(lock, type) becomes: mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks) mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized) similarily, for releasing a lock, we now have: mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN. We change the caller interface for the two different types of locks because the semantics are entirely different for each case, and this makes it explicitly clear and, at the same time, it rids us of the extra `type' argument. The enter->lock and exit->unlock change has been made with the idea that we're "locking data" and not "entering locked code" in mind. Further, remove all additional "flags" previously passed to the lock acquire/release routines with the exception of two: MTX_QUIET and MTX_NOSWITCH The functionality of these flags is preserved and they can be passed to the lock/unlock routines by calling the corresponding wrappers: mtx_{lock, unlock}_flags(lock, flag(s)) and mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN locks, respectively. Re-inline some lock acq/rel code; in the sleep lock case, we only inline the _obtain_lock()s in order to ensure that the inlined code fits into a cache line. In the spin lock case, we inline recursion and actually only perform a function call if we need to spin. This change has been made with the idea that we generally tend to avoid spin locks and that also the spin locks that we do have and are heavily used (i.e. sched_lock) do recurse, and therefore in an effort to reduce function call overhead for some architectures (such as alpha), we inline recursion for this case. Create a new malloc type for the witness code and retire from using the M_DEV type. The new type is called M_WITNESS and is only declared if WITNESS is enabled. Begin cleaning up some machdep/mutex.h code - specifically updated the "optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently need those. Finally, caught up to the interface changes in all sys code. Contributors: jake, jhb, jasone (in no particular order)
* Turn '#if NSNP > 0' into an option.peter2001-01-291-6/+6
|
* - Catch up to proc flag changes.jhb2001-01-241-2/+3
| | | | - Assert sched_lock is held in proc_compare.
* - All of proc_compare needs sched_lock, so hold it for the for loop thatjhb2001-01-201-40/+20
| | | | | | | | | | calls it rather than obtaining and releasing it a lot in proc_compare. - Collect all of the data gathering and stick it just after the proc_compare loop. This way, we only have to grab sched_lock once now when handling SIGINFO. All the printf's are done after the values are calculated. Submitted mostly by: bde
* Be more careful with sched_lock in the SIGINFO handler. Specifically, dojhb2001-01-201-10/+21
| | | | | | | | not hold sched_lock while calling ttyprintf(). If we are on a serial console, then ttyprintf() will end up getting the sio lock, resulting in a lock order violation. Noticed by: des
* Convert more malloc+bzero to malloc+M_ZERO.dwmalone2000-12-081-2/+1
| | | | | Submitted by: josh@zipperup.org Submitted by: Robert Drehmel <robd@gmx.net>
* Protect p_stat with sched_lock.jhb2000-12-021-0/+12
|
* Kernel support for erase2 character.jkh2000-11-281-3/+12
| | | | Submitted by: Rui Pedro Mendes Salgueiro <rps@mat.uc.pt>
* Major update to the way synchronization is done in the kernel. Highlightsjasone2000-09-071-1/+2
| | | | | | | | | | | | | | | include: * Mutual exclusion is used instead of spl*(). See mutex(9). (Note: The alpha port is still in transition and currently uses both.) * Per-CPU idle processes. * Interrupts are run in their own separate kernel threads and can be preempted (i386 only). Partially contributed by: BSDi (BSD/OS) Submissions by (at least): cp, dfr, dillon, grog, jake, jhb, sheldonh
* Previous commit changing SYSCTL_HANDLER_ARGS violated KNF.phk2000-07-041-1/+1
| | | | Pointed out by: bde
* Style police catches up with rev 1.26 of src/sys/sys/sysctl.h:phk2000-07-031-1/+1
| | | | | | | | Sanitize SYSCTL_HANDLER_ARGS so that simplistic tools can grog our sources: -sysctl_vm_zone SYSCTL_HANDLER_ARGS +sysctl_vm_zone (SYSCTL_HANDLER_ARGS)
* Back out the previous change to the queue(3) interface.jake2000-05-261-1/+1
| | | | | | It was not discussed and should probably not happen. Requested by: msmith and others
* Change the way that the queue(3) structures are declared; don't assume thatjake2000-05-231-1/+1
| | | | | | | | the type argument to *_HEAD and *_ENTRY is a struct. Suggested by: phk Reviewed by: phk Approved by: mdodd
* Move t_timeout initializing to ttyregisterache2000-05-011-1/+1
| | | | Pointed-by: bde
* Set t_timeout to its default sysctl value only once in ttyopenache2000-05-011-1/+3
| | | | | | Initialize t_timeout to -1 for this reason Pointed-by: bde
OpenPOWER on IntegriCloud