Commit Graph

142 Commits

Author SHA1 Message Date
christos
9e1f6b1ae6 include ioconf.h instead of locally declaring the prototype of the attach
function
2015-08-20 09:45:45 +00:00
snj
f0a7346d21 src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
2014-10-18 08:33:23 +00:00
dholland
f9228f4225 Add d_discard to all struct cdevsw instances I could find.
All have been set to "nodiscard"; some should get a real implementation.
2014-07-25 08:10:31 +00:00
dholland
44a93ea590 Define TTY_ALLOW_PRIVATE in tty.c, tty_pty.c, and tty_conf.c.
These modules are the core of the tty code that in the long term needs
access to struct tty. (It may be that in the future this can be cut
back to just tty.c; we'll see. For now I'll settle for keeping drivers
out of struct tty.)
2014-05-22 16:28:06 +00:00
christos
6accf143de Kernel portion of the multiple ptyfs mount support. Protocol changed
between kernel and module, so bump. (Ilya Zykov)
2014-04-04 18:11:58 +00:00
ozaki-r
6ac95d35b1 Fix unused variable 'mp' 2014-03-28 11:55:09 +00:00
christos
a9253db65e From Ilya Zykov:
- ifdef out some code that is only used for NO_DEV_PTM
- pass the mountpoint instead of the ptm structure to the implementation
  dependent (ptyfs or bsdpty) functions.
- add a function to return the correct ptyfs mountpoint for the current lwp
2014-03-27 17:31:56 +00:00
dholland
a68f9396b6 Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
2014-03-16 05:20:22 +00:00
yamt
57688c9a9e tty_pty: add CTASSERTs to document assumptions 2014-01-29 02:38:48 +00:00
martin
7a86b34811 Remove unused variables 2013-09-15 14:53:03 +00:00
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