Commit Graph

132 Commits

Author SHA1 Message Date
apb b6366e94c8 Set tp->t_dev to the correct dev_t value in both ptmopen and ptsopen.
Depending on how the pty had been opened, t_dev could previously have
been set to NODEV.  This was probably harmless before, but it caused the
compatibility handler for the COMPAT_60_TIOCPTSNAME ioctl to fail for
ptys that were allocated by screen(1), but only if this was the first
time that the pty had ever been used.
2012-10-20 00:21:10 +00:00
christos 5c43ae241d put back the cc == 0 check, because we can re-enter the loop with cc != 0
if we block.
2011-09-24 04:10:03 +00:00
christos f78cce945e Fix various bogus things:
- Don't use TTYHOG - 1, you can use the last byte in the ring buffer.
- Don't put unnecessary if statements around the code. The loop invariant
  is that if you reach the top of the loop, cc == 0.
- Remove cast to (void *).
- Check result of b_to_q and adjust cc.
- Explain what the TTYHOG - 2 code tried to do, and do it right.
2011-09-23 23:57:06 +00:00
yamt 1adcac88c1 stop using lbolt in tty 2011-07-26 13:14:17 +00:00
rmind 2626d57668 Rename ttymalloc() to tty_alloc(), and ttyfree() to tty_free() for
consistency.  Remove some unnecessary malloc.h inclusions as well.
2011-04-24 16:26:51 +00:00
martin 4aa7a8f48e Add a few KASSERT to verify we do not accidently use minor(NODEV) as an
index into the pt_softc array.
2011-04-09 12:07:06 +00:00
martin 07a55fd03e KNF, add a comment and an assertion. 2011-04-09 07:02:57 +00:00
martin 4dafc2b43a In ttymalloc() explicitly initialize t_dev to NODEV.
In ptcwakeup() do not bother to wake up a client side if it has not been
opened yet.
The old code would spuriously wakeup the client minor(0) [i.e. ttyp0
typically] or crash the kernel if that wasn't open, see PR kern/40688.
(Old names used to match the PR and test case, adjust names for
/dev/ptm[x] resp. /dev/pts/* accordingly)
2011-04-09 06:34:06 +00:00
dyoung 64f588a45a Fix a bug in ptcread() that stopped a pty(4) in TIOCPKT_IOCTL mode from
sending a termios(4) structure like it was supposed to: ptcread() used
to copy pti->pt_send and zero it before testing it for TIOCPKT_IOCTL.
Test for TIOCPKT_IOCTL in the pti->pt_send copy in local variable c
instead of in pti->pt_send itself.
2010-11-16 23:58:11 +00:00
dyoung c3438d26de Cosmetic: remove unnecessary parenthesization in return statements.
Don't "test truth" of ints, but compare with 0, instead.

The generated assembly is the same before & after this change.
2010-09-05 18:03:37 +00:00
yamt e38edea451 use NULL instead of 0 for pointers. 2010-06-13 03:32:47 +00:00
dholland 3c82208a56 Amplify comment about ultrix bits. 2010-01-24 19:56:26 +00:00
pooka f015d3c5a1 Add a pointing to an explanation of why we have #ifdef pmax stuff in here. 2009-12-20 19:06:44 +00:00
dsl 931ac5949a Error out of ptcread() if the uio length supplied is zero before the code
has a chance to panic in ureadc().
2009-10-14 19:25:39 +00:00
dsl 270307174b Fix locking when collecting pt_read and pt_ucntl. 2009-10-11 08:08:32 +00:00
plunky 6e74f4625b Writes on the controlling tty were not being awoken from blocks,
use the correct condvar to make this happen.

this fixes PR/41566
2009-06-12 09:26:50 +00:00
uebayasi 7c002f258b KNF. ANSI'fy. 2009-03-09 16:19:22 +00:00
yamt cb1e92d5d5 malloc -> kmem_alloc 2009-01-22 14:38:34 +00:00
mrg c10479b8ff explicitly include <sys/ioctl_compat.h> since we explicitly use
symbols defined in it.  fixes various build issues.
2008-11-15 05:58:33 +00:00
ad 7cd41bb376 Remove unneeded compat ifdef. 2008-11-14 23:04:42 +00:00
drochner 6d1cbe3695 Make ioctl(FIONREAD) on the master side of a pty return the amount of
data which can be read, as expected. Before, the call fell through a
"case" statement and was forwarded to the slave side, returning the
data which can be read by the slave.
The new behaviour also matches Linux and OSF/1.
2008-09-03 16:47:34 +00:00
ad 45850c3df9 PPWAIT need only be locked by proc_lock, so move it to proc::p_lflag. 2008-06-16 10:15:57 +00:00
ad 5e4b324300 Properly fix the "hanging in tty" bug that was worked around with cv_wakeup()
some time again.
2008-05-25 19:22:21 +00:00
ad 664f91e474 Improve ^T / SIGINFO handling:
- Restore code removed during LWPification.
- Don't touch proc state from a hardware interrupt handler.
- Fix the locking.
2008-04-20 19:22:44 +00:00
rmind c6186face4 Welcome to 4.99.55:
- Add a lot of missing selinit() and seldestroy() calls.

- Merge selwakeup() and selnotify() calls into a single selnotify().

- Add an additional 'events' argument to selnotify() call.  It will
  indicate which event (POLL_IN, POLL_OUT, etc) happen.  If unknown,
  zero may be used.

Note: please pass appropriate value of 'events' where possible.
Proposed on: <tech-kern>
2008-03-01 14:16:49 +00:00
ad f38bbfb0c5 Pull up 1.104.2.3:
Avoid mutex recursion with kqueue. Reported by martin@.
2007-12-30 22:03:01 +00:00
ad 4caeb79017 Restore seperate condvars for clist i/o and clist control activity.
Fixes lockups with concurrent output to ttys. kern/37455
2007-12-22 02:21:29 +00:00
pooka 4e38160d4d Do not "return 1" from kqfilter for errors. That value is passed
directly to the userland caller and results in a mysterious EPERM.
Instead, return EINVAL or something else sensible depending on the
case.
2007-12-05 17:19:46 +00:00
ad 3f269d8907 Tidy up the locking a bit. 2007-11-19 19:47:00 +00:00
ad dc26833bb6 - Factor out too many copies of the same bit of tty code.
- Fix another tty signalling/wakeup problem.
2007-11-19 18:51:36 +00:00
ad d37935697b Merge tty changes from the vmlocking branch. 2007-11-07 15:56:11 +00:00
pooka 052ed1b786 wrap calls to pgsignal() in proclist_mutex 2007-04-17 19:52:56 +00:00
ad 194273271b Use mutexes/condvars. 2007-03-12 21:33:07 +00:00
christos 53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
ad b07ec3fc38 Merge newlock2 to head. 2007-02-09 21:55:00 +00:00
elad b5a8324144 Use KAUTH_DEVICE_TTY_OPEN instead of comparing euid to zero. 2006-12-22 21:56:19 +00:00
yamt 1a7bc55dcc remove some __unused from function parameters. 2006-11-01 10:17:58 +00:00
christos 4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
xtraeme 75d2d9715c Remove duplicated includes, from Jeff Ito -> PR kern/26113. Thanks. 2006-09-23 15:36:12 +00:00
christos 740d87bac5 adjust resid in one more place. 2006-08-03 22:06:55 +00:00
christos 75300d10c2 don't drop characters that we've copied in when we block. 2006-08-03 22:03:18 +00:00
ad f474dceb13 Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
christos 95e13e63bd Introduce SA_NOKERNINFO, a flag for SIGINFO not to print kernel messages. 2006-06-03 18:18:26 +00:00
elad 215bd95ba4 integrate kauth. 2006-05-14 21:15:11 +00:00
christos 5cf38f035b Strip the chrooted portion of the path from the reported pty path. Reported
and tested by Lasse Kliemann. Thanks!
2006-04-13 17:44:24 +00:00
christos 81b9ed737b Move ISSET/SET/CLR macros to sys/types.h 2006-03-05 16:57:16 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
ws 9d78e0cf36 PR-30566: Poll must not return <sys/errno.h> values.
Start with those places I can easily test.
2005-06-21 14:01:11 +00:00
christos efb6943313 - add const.
- remove unnecessary casts.
- add __UNCONST casts and mark them with XXXUNCONST as necessary.
2005-05-29 22:24:14 +00:00
perry da8abec863 nuke trailing whitespace 2005-02-26 21:34:55 +00:00