summaryrefslogtreecommitdiff
path: root/sys/kern/tty_pty.c
AgeCommit message (Collapse)Author
2014-11-18Nuke yet more obvious #include duplications.Kenneth R Westerback
ok miod@
2014-07-13use mallocarray where arguments are multipled. ok deraadtTed Unangst
2014-07-12add a size argument to free. will be used soon, but for now default to 0.Ted Unangst
after discussions with beck deraadt kettenis.
2014-07-09use explicit_bzero for stack and freed variablesTed Unangst
2014-03-30Eliminates struct pcred by moving the real and saved ugids intoPhilip Guenther
struct ucred; struct process then directly links to the ucred Based on a discussion at c2k10 or so before noting that FreeBSD and NetBSD did this too. ok matthew@
2014-03-22Move p_sigacts from struct proc to struct process.Philip Guenther
testing help mpi@
2013-12-13Remove the 4.3BSD tty(4) compatibility shims. RIP. ok millert@Christian Weisgerber
2013-10-11poll(2) on a closed tty should return POLLIN|POLLHUP in reventsTodd C. Miller
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.
2013-10-06Back out POLLHUP change until a problem with xterm hanging on closeTodd C. Miller
is fixed.
2013-10-04poll(2) on a closed tty should return POLLIN|POLLHUP in reventsTodd C. Miller
when events is set to POLLIN and POLLHUP when events is set to POLLOUT. OK deraadt@
2013-01-02Fix a bug in ptcwrite() that could result in up to 100 lost bytesTodd C. Miller
when we block due to hitting the TTYHOG limit. OK miod@
2012-04-22Add struct proc * argument to FRELE() and FILE_SET_MATURE() inPhilip Guenthe
anticipation of further changes to closef(). No binary change. ok krw@ miod@ deraadt@
2011-07-05Recommit the reverted sigacts change now that the NFS use-after-freePhilip Guenthe
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@
2011-07-02kqueue attach functions should return an errno or 0, not a plain 1. FixNicholas Marriott
the obvious cases to return EINVAL and ENXIO. ok tedu deraadt
2011-04-18Revert the sigacts diff: NFS can apparently retain pointers to processesPhilip Guenthe
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
2011-04-15Correct the sharing of the signal handling state: stuff that shouldPhilip Guenthe
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@
2011-04-03Move PPWAIT flag from struct proc to process, so that rthreads inPhilip Guenthe
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@
2010-09-24dead store; found by clangTheo de Raadt
2010-08-06Every time you ignore uiomove() return value, $DEITY kills a littleMiod Vallat
$ADORABLE_FELINE. ok deraadt@ matthew@
2010-07-26Correct the links between threads, processes, pgrps, and sessions,Philip Guenthe
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
2010-07-21ptm needs no read/write, just use enodev.Nicholas Marriott
ok deraadt
2010-07-02remove support for compat_sunos (and m68k4k). ok deraadt guentherTed Unangst
2010-07-02Move common code for waking up writers on a tty into a function.Nicholas Marriott
ok deraadt matthew millert
2010-06-28Allow tty drivers to request larger buffers at attach time using aTheo de Raadt
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
2010-04-12Some of the line disciplines want to check for suser. Better to pass themTed Unangst
a process instead of using curproc. ok deraadt
2010-04-02Add a case so that FIONREAD on the master side of a pty returns the sizeNicholas Marriott
of the output queue (that is, the data coming from the program on the slave side) rather than falling through to ttioctl which returns the size of the input queue (the amount written to the master). ok deraadt
2009-11-09Every selwakeup() should have a matching KNOTE() (even if kqueue isn'tNicholas Marriott
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
2009-10-31Use suser when possible. Suggested by miod@.Federico G. Schwindt
miod@ deraadt@ ok.
2009-10-30Add missing KNOTE() calls after selwakeup() in ptcread() (to wake up writersNicholas Marriott
after the master side of the pty has finished reading) and in ttyflush(). ok tedu millert
2009-10-14Remove a redundant if (maxpty == npty) in check_pty - this is also tested byNicholas Marriott
the two ifs at the start of the function and both variables are only altered under pt_softc_lock so cannot change between the checks. ok guenther@
2009-09-29Having pty_isfree_locked() be inlined may make pty allocation a tinyTheo de Raadt
bit faster, but come on, inlining is supposed to be reserved only for things which *critically* need it. ok millert
2008-08-02Fix integer truncation in pcread() and ptcwrite(). ok miod, otto, deraadt.Stefan Kempf
2008-05-07check TIOCSIG for 0 and do not send that to psignal() and pgsignal()Theo de Raadt
ok fgsch
2008-04-10scrub local stack-based buffers in the tty subsystem. tested by a lot ofTheo de Raadt
developers. if you notice tty weirdnesses in the next few months, talk to me
2007-09-07Use M_ZERO in a few more places to shave bytes from the kernel.Artur Grabowski
eyeballed and ok dlg@
2007-05-29Add a name argument to the RWLOCK_INITIALIZER macro.Thordur I. Bjornsson
Pick reasonble names for the locks involved.. ok tedu@, art@
2006-03-04Typos grab bag of the month, eyeballed by jmc@Miod Vallat
2006-01-18Fix logic botch when checking for COMPAT_SUNOS binary specifics; repairsMiod Vallat
some TIOCGPGRP result fallout. ok deraadt@
2005-12-21ansi/deregister. No binary change.Jonathan Gray
2005-11-21Fix a crash in ptmioctl() in the error path when the master hasTodd C. Miller
been opened but the slave cannot be. We can't do the FILE_SET_MATURE until we are past all possible error paths since it calls FRELE(), resulting in a reference count of 0, which closef() panics on #ifdef DIAGNOSTIC. OK deraadt@
2005-05-26RIP stackable filesystems, ok marius@ tedu@, discussed with deraadt@Pedro Martelletto
2005-01-28When setting kern.tty.maxptys, store the old value in oldp, notTodd C. Miller
random stack garbage. Rename DEFAULT_NPTYS and DEFAULT_MAXPTYS to NPTY_MIN and NPTY_MAX to better match their function and don't allow setting kern.tty.maxptys > NPTY_MAX.
2004-12-19Set atime and mtime when giving out a new pty. With help from tholo@Todd C. Miller
and OK tedu@
2004-12-07* add a missing vput() if VOP_SETATTR() fails.Patrick Latifi
ok tedu pedro millert
2004-07-22remove p arg from fdplockTed Unangst
2004-07-21I was wrong. The assymetry created by the proc argument to rw_enter_writeArtur Grabowski
is horrible and doesn't add anything. Remove it. XXX - the fdplock macro will need a separate cleanup. niklas@ markus@ ok
2004-07-09go away staticsNiklas Hallqvist
2004-04-11Crank max ptys to 992. We now have 62 pty/tty pairs for each letterTodd C. Miller
instead of 16. E.g. it is now /dev/{p,t}typ[0-9a-zA-z] instead of just /dev/{p,t}typ[0-9a-f]. This requires that you update MAKEDEV and run: # cd /dev && ./MAKEDEV pty0 && rm -f [pt]ty[rq]*
2004-04-11Fix calculation of the index into TTY_LETTERS. This only workedTodd C. Miller
because sizeof(TTY_LETTERS) == sizeof(TTY_SUFFIX).
2004-02-23Make sure we allow for the time when check_pty has not yet been calledBob Beck
before we get invoked, by making sure getfree thinks an unused and unallocated pt_softc entry is actually free rather than following NULL. ok cedric@