summaryrefslogtreecommitdiffstats
path: root/sys/kern/tty.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Modify ttystats_init() to tell us about the buffer size, so that wederaadt2015-08-281-5/+7
| | | | can pass the size to free()
* two simple free() sizesderaadt2015-08-261-3/+3
|
* Fix tty hiwat handling a bitsf2015-07-201-14/+5
| | | | | | | | | | | | | - Introduce new defines TTHIWATMINSPACE, TTMINHIWAT for some magic values that are used in tty.c. - Remove hiwat adjustments in ttwrite(). This fixes this codepath not being interrupt safe. - Change ttysetwater() to keep at least TTHIWATMINSPACE space above the high water mark. This makes it consistent with ttycheckoutq(). Without this change, the hiwat adjustment change above causes deadlocks in pty. ok kspillner@ commit it now deraadt@
* First step towards making uiomove() take a size_t size argument:miod2015-02-101-2/+2
| | | | | | | - rename uiomove() to uiomovei() and update all its users. - introduce uiomove(), which is similar to uiomovei() but with a size_t. - rewrite uiomovei() as an uiomove() wrapper. ok kettenis@
* Add dmesg -s support, to view the output of rc(8) system startup messages.mpf2015-01-131-1/+14
| | | | | Help and feedback by Theo and Miod. OK deraadt@, manpage-ok jmc@
* remove lock.h from uvm_extern.h. another holdover from the simpletonlocktedu2014-12-171-1/+2
| | | | | era. fix uvm including c files to include lock.h or atomic.h as necessary. ok deraadt
* primary change: move uvm_vnode out of vnode, keeping only a pointer.tedu2014-12-161-1/+3
| | | | | | objective: vnode.h doesn't include uvm_extern.h anymore. followup changes: include uvm_extern.h or lock.h where necessary. ok and help from deraadt
* convert bcopy to memcpy. ok millerttedu2014-12-101-4/+4
|
* clist's chained, and could get fairly long which is why there was aderaadt2014-12-011-4/+3
| | | | | | | | | | dynamic clamping mechanism. In the (new? has it already been 20 years?) world of tty ring buffers, c_cn is the maximum... There could be some ugly limit elsewhere, which may cause a deadlock (dug as deep as my patience allows), so please report any sort of new console or xterm issues that show up, such as tty lockups or high cpu utilization..
* include unistd.h instead of picking it up accidentally. noted by jsgtedu2014-11-181-1/+2
|
* Remove non-standard <sys/dkstat.h> header. It has not contained anythingmiod2014-09-151-2/+1
| | | | | | | | | | related to disk stastics for almost 17 years, and the remaining userland-visible defines duplicate those found in <sys/sched.h>. Move the remaining _KERNEL defines to <sys/tty.h> where they belong, and update all users to cope with this. ok kettenis@
* use mallocarray where arguments are multipled. ok deraadttedu2014-07-131-2/+2
|
* If the only process in the pgrp is in the middle of exiting, it mightguenther2014-07-131-2/+4
| | | | | | not have any threads left. Treat that the same as an empty pgrp. encountered by and ok deraadt@
* add a size argument to free. will be used soon, but for now default to 0.tedu2014-07-121-4/+4
| | | | after discussions with beck deraadt kettenis.
* decouple struct uvmexp into a new file, so that uvm_extern.h and sysctl.hderaadt2014-07-081-2/+1
| | | | | don't need to be married. ok guenther miod beck jsing kettenis
* Track whether a process is a zombie or not yet fully built via flagsguenther2014-07-041-4/+3
| | | | | | | | | | | PS_{ZOMBIE,EMBRYO} on the process instead of peeking into the process's thread data. This eliminates the need for the thread-level SDEAD state. Change kvm_getprocs() (both the sysctl() and kvm backends) to report the "most active" scheduler state for the process's threads. tweaks kettenis@ feedback and ok matthew@
* Allocate the struct itty array in ttystats_init() with M_ZERO.matthew2014-06-061-2/+2
| | | | ok millert
* explicit_bzero for clearing stack variables.tedu2014-05-301-4/+4
|
* Handle threaded processes correctly when processing kerninfo status requestsguenther2014-05-251-90/+107
| | | | | | (aka ^T), summing CPU and check runnable/running status of all threads. ok deraadt@
* Move p_sigacts from struct proc to struct process.guenther2014-03-221-4/+4
| | | | testing help mpi@
* Restore TIOCGSID ioctl that was removed along with the 4.3BSD tty(4)millert2013-12-161-1/+6
| | | | | compat. This will be used to implement tcgetsid() in the future. OK kettenis@ guenther@
* Remove the 4.3BSD tty(4) compatibility shims. RIP. ok millert@naddy2013-12-131-18/+1
|
* poll(2) on a closed tty should return POLLIN|POLLHUP in reventsmillert2013-10-111-2/+5
| | | | | | | when events is set to POLLIN and POLLHUP when events is set to POLLOUT. In the pty case we need to be careful to only treat the pty as closed if carrier is on. This fixes a hang on close problem seen with ssh and xterm.
* Back out POLLHUP change until a problem with xterm hanging on closemillert2013-10-061-5/+2
| | | | is fixed.
* poll(2) on a closed tty should return POLLIN|POLLHUP in reventsmillert2013-10-041-2/+5
| | | | | when events is set to POLLIN and POLLHUP when events is set to POLLOUT. OK deraadt@
* Switch from timeval to timespec introduced format error; fix by preppingguenther2013-06-101-4/+5
| | | | | | for big time_t and casting to long long ok deraadt@
* Convert some internal APIs to use timespecs instead of timevalsguenther2013-06-031-11/+11
| | | | ok matthew@ deraadt@
* When a ucom(4) is removed, it frees the tty with ttyfree(). However ifnicm2013-04-241-7/+46
| | | | | | | | | | | anyone is waiting with kqueue their knotes may still have a reference to the tty and later try to use it in the filt_tty* functions. To avoid this, walk the knotes in ttyfree(), remove them from the tty's list and invalidate them by setting kn_hook to NODEV. The filter functions can then check for this and safely ignore the knotes. ok tedu matthieu
* Ensure the tty hiwat is less than the size of the ring buffer (sincederaadt2013-01-171-4/+4
| | | | | | | we do not grow space like clist chains). Clamp it a bit more precisely, ensuring a bit of space for kernel ^T handling and such. It was definately wrong, and we can tune this if required later. ok kettenis
* Reset t_column to 0 when initializing a tty.matthew2012-04-221-1/+2
| | | | ok deraadt@
* Make rusage totals, itimers, and profile settings per-process insteadguenther2012-03-231-2/+2
| | | | | | | of per-rthread. Handling of per-thread tick and runtime counters inspired by how FreeBSD does it. ok kettenis@
* Recommit the reverted sigacts change now that the NFS use-after-freeguenther2011-07-051-4/+4
| | | | | | | | problem has been tracked down. This fixes the sharing of the signal handling state: shared bits go in sigacts, per-rthread bits goes in struct proc. ok deraadt@
* kqueue attach functions should return an errno or 0, not a plain 1. Fixnicm2011-07-021-2/+2
| | | | | | the obvious cases to return EINVAL and ENXIO. ok tedu deraadt
* Revert the sigacts diff: NFS can apparently retain pointers to processesguenther2011-04-181-4/+4
| | | | | | until they're zombies and then send them signals (for intr mounts). Until that is untangled, the sigacts change is unsafe. sthen@ was the victim for this one
* Correct the sharing of the signal handling state: stuff that shouldguenther2011-04-151-4/+4
| | | | | | | | | | | | be shared (p_sigignore, p_sigcatch, P_NOCLDSTOP, P_NOCLDWAIT) moves to struct sigacts, wihle stuff that should be per rthread (ps_oldmask, SAS_OLDMASK, ps_sigstk) moves to struct proc. Treat the coredumping state bits (ps_sig, ps_code, ps_type, ps_sigval) as per-rthread until our locking around coredumping is better. Oh, and remove the old SunOS-compat ps_usertramp member. "I like the sound of this" tedu@
* Move PPWAIT flag from struct proc to process, so that rthreads inguenther2011-04-031-4/+4
| | | | | | | | | a vforked child behave correctly. Have the parent in a vfork() wait on a (different) flag in *its* process instead of the child to prevent a possible use-after-free. When ktracing the child return from a fork, call it rfork if an rthread was created. ok blambert@
* Correct the links between threads, processes, pgrps, and sessions,guenther2010-07-261-30/+35
| | | | | | | | | so that the process-level stuff is to/from struct process and not struct proc. This fixes a bunch of problem cases in rthreads. Based on earlier work by blambert and myself, but mostly written at c2k10. Tested by many: deraadt, sthen, krw, ray, and in snapshots
* Move common code for waking up writers on a tty into a function.nicm2010-07-021-1/+17
| | | | ok deraadt matthew millert
* Allow tty drivers to request larger buffers at attach time using aderaadt2010-06-281-10/+13
| | | | | | | | max-baud-rate hint. Adjust TTYHOG (the nearly full logic) to this new situation. The larger buffers are required by the very high speed KDDI devices in Japan (CF com, or USB ucom) so those are the only two drivers which currently ask for a larger buffer size. ok yasuoka miod
* Some of the line disciplines want to check for suser. Better to pass themtedu2010-04-121-6/+6
| | | | a process instead of using curproc. ok deraadt
* typo in documentation; missing full stop.sobrado2009-11-271-2/+2
| | | | from Dawe.
* Every selwakeup() should have a matching KNOTE() (even if kqueue isn'tnicm2009-11-091-3/+1
| | | | | | | | | | supported it doesn't do any harm), so put the KNOTE() in selwakeup() itself and remove it from any occurences where both are used, except one for kqueue itself and one in sys_pipe.c (where the selwakeup is under a PIPE_SEL flag). Based on a diff from tedu. ok deraadt
* Add missing KNOTE() calls after selwakeup() in ptcread() (to wake up writersnicm2009-10-301-1/+2
| | | | | | after the master side of the pty has finished reading) and in ttyflush(). ok tedu millert
* For the TIOCSET* ioctls, validate that the tty speeds are positive (sincederaadt2009-10-281-1/+8
| | | | | they are signed int) ok miod guenther
* clalloc() can't fail, so there's no need to handle failure cases.blambert2009-07-191-12/+11
| | | | | | | | Change to void function. Also, no need to have global tty stats pointer, so just return it from clalloc, as the caller frees it immediately anyway. ok miod@
* EVFILT_WRITE filters should return the amount of space remaining in thekettenis2008-12-241-3/+7
| | | | | | | | | write buffer, not the amount of space used. It is debatable wether the size of the write buffer is set by the size of the buffer or the high water mark. For now, go with the former since that seems to be more consistent with what the pipe and socet code does. It is also what NetBSD does. ok deraadt@
* for ^T support, grab all the information from the process before goingderaadt2008-11-111-17/+17
| | | | into a potentially sleeping function... ok tedu.
* Fix integer truncation in ttwrite(). ok deraadt, miod.stefan2008-07-281-3/+4
|
* tputchar() can put characters on the tty output queue if clocal is set,deraadt2008-05-231-3/+3
| | | | | fixing (status) ^T support on some ttys without carrier ok pyr
* scrub local stack-based buffers in the tty subsystem. tested by a lot ofderaadt2008-04-101-4/+12
| | | | | developers. if you notice tty weirdnesses in the next few months, talk to me