Commit Graph

193 Commits

Author SHA1 Message Date
Bruce Evans
3ac4d1ef0c Don't #include <sys/fcntl.h> in <sys/file.h> if KERNEL is defined.
Fixed everything that depended on getting fcntl.h stuff from the wrong
place.  Most things don't depend on file.h stuff at all.
1997-03-23 03:37:54 +00:00
Bruce Evans
3c81694426 Fixed some invalid (non-atomic) accesses to `time', mostly ones of the
form `tv = time'.  Use a new function gettime().  The current version
just forces atomicicity without fixing precision or efficiency bugs.
Simplified some related valid accesses by using the central function.
1997-03-22 06:53:45 +00:00
Peter Wemm
6875d25465 Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not
ready for it yet.
1997-02-22 09:48:43 +00:00
John Dyson
996c772f58 This is the kernel Lite/2 commit. There are some requisite userland
changes, so don't expect to be able to run the kernel as-is (very well)
without the appropriate Lite/2 userland changes.

The system boots and can mount UFS filesystems.

Untested: ext2fs, msdosfs, NFS
Known problems: Incorrect Berkeley ID strings in some files.
		Mount_std mounts will not work until the getfsent
		library routine is changed.

Reviewed by:	various people
Submitted by:	Jeffery Hsu <hsu@freebsd.org>
1997-02-10 02:22:35 +00:00
Jordan K. Hubbard
1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
Bruce Evans
63f3c673f6 Help broken d_stop() routines by flushing the output queue before
calling them (as well as after).

Found by:	NIST PCTS
1996-11-29 16:16:47 +00:00
Bruce Evans
8be1cbf1f4 Fixed bugs handling (background) orphaned process groups. tty
writes and tty ioctls by processes in such groups must return
-1/EIO, but they were allowed.  tty reads were handled correctly.

Found by:	NIST PCTS
1996-11-29 15:50:56 +00:00
Bruce Evans
7542ee31b8 Fixed some bugs in BREAK handling. If BRKINT is set, then always flush
the queues and generate a SIGINT.  Previously, this wasn't done if ISIG
was clear or the VINTR character was disabled, and it was done by
converting the BREAK to a VINTR character and sometimes bogusly echoing
this character.

Found by:	NIST-PCTS
1996-11-29 15:23:42 +00:00
Bruce Evans
c02039bc20 Fixed handling of non-POSIX control characters. They must not do
anything special unless IEXTEN is set.

Found by:	NIST-PCTS
1996-11-29 15:06:17 +00:00
Bruce Evans
e0c95ed947 Fixed the easy cases of const poisoning in the kernel. Cosmetic. 1996-08-31 16:52:44 +00:00
Bruce Evans
14c0cc3d51 Fixed a wrong comment. Did tsleep() ever return the networking errno
ETIMEDOUT?
1996-08-28 18:45:09 +00:00
Gary Palmer
c23670e294 Clean up -Wunused warnings.
Reviewed by:		bde
1996-06-12 05:11:41 +00:00
Poul-Henning Kamp
e911eafcba removed:
CLBYTES PD_SHIFT PGSHIFT NBPG PGOFSET CLSIZELOG2 CLSIZE pdei()
        ptei() kvtopte() ptetov() ispt() ptetoav() &c &c
new:
        NPDEPG

Major macro cleanup.
1996-05-02 14:21:14 +00:00
Jeffrey Hsu
b75356e1ac From Lite2: proc LIST changes.
Reviewed by:	david & bde
1996-03-11 06:05:03 +00:00
Peter Wemm
4bd4912865 Add more options into the conf/options and i386/conf/options.i386 files
and the #include hooks so that 'make depend' is more useful.  This
covers most of the options I regularly use (but not all) and some other
easy ones.
1996-03-02 18:24:13 +00:00
Bruce Evans
6a1441a3e6 Oops, the last commit missed one change from 200 to OBUFSIZ + 100. 1995-12-16 21:45:02 +00:00
Bruce Evans
247b53374b Changed the maximum output queue count from (TTMAXHIWAT + 200) to
(TTMAXHIWAT + OBUFSIZ + 100) in case someone changes OBUFSIZ.  200
was to allow 100 above high water for ordinary writes and another
100 for kernel printfs.

Increased the reserved output queue count from 512 to the maximum
output queue count.  This prevents exhaustion of clists and increases
the output throughput for 8 cy lines by almost a factor of 2 (on
a system where there aren't many other open ttys so clists become
exhausted after about 4 active lines (or earlier if TTMAXHIWAT is
increased :-]).

ttwrite() behaves very badly when clists are exhausted:
(1) it sleeps on lbolt instead of on TSA_OLOWAT(tp).
    This could be fixed adequately by sleeping on TSA_OLOWAT(tp).
    The nonzero reserved count guaratees that space will become
    available independent of other ttys, and a reserved count
    of 512 is barely enough for efficiency.
(2) it drops output if space runs out in the middle of special
    output processing.  This is too hard to fix without hardening
    the reserved count.  The watermark processing guarantees that
    space doesn't run out only if the advertised space is guaranteed.

Increasing the reserved output queue count defeats the point of
dynamic allocation of clists.  Previously, about 2K of memory per
tty was reserved (the raw queue was already reserved).  Now, about
3.5K is reserved.  Reserving everything would take a whole 0.5K
more.
1995-12-15 02:18:06 +00:00
Bruce Evans
a59db23b94 Disabled the sleep in ttyflush(). It can't work in general because
ttyflush() might be called from an interrupt handler.  This fixes
panics in IXOFF mode at the cost of more failures to send the START
character to exit from IXOFF mode.
1995-12-15 01:01:00 +00:00
Bruce Evans
947803d7d8 Restored unused function ttrstrt(). It would be used if the low level
drivers supported inter-character delays.
1995-12-14 22:32:52 +00:00
Poul-Henning Kamp
87b6de2b76 A Major staticize sweep. Generates a couple of warnings that I'll deal
with later.
A number of unused vars removed.
A number of unused procs removed or #ifdefed.
1995-12-14 08:32:45 +00:00
Julian Elischer
6ba9ebce28 devsw tables are now arrays of POINTERS to struct [cb]devsw
seems to work hre just fine though  I can't check every file
that changed due to limmited h/w, however I've checked enught to be petty
happy withe hte code..

WARNING... struct lkm[mumble] has changed
so it might be an idea to recompile any lkm related programs
1995-12-13 15:13:57 +00:00
David Greenman
efeaf95a41 Untangled the vm.h include file spaghetti. 1995-12-07 12:48:31 +00:00
Bruce Evans
bb1140a9a5 Fixed initialization of TS_CONNECTED bit in t_state. It wasn't
set in open() when CLOCAL is set unless carrier is present.

Fixed initialization of line discipline.  It lived across opens.
Lines that started with the wrong discipline probably didn't work
at all, because TS_ISOPEN is only set by TTYDISC.
1995-10-31 19:27:50 +00:00
Bruce Evans
e7c89b42c5 Fix wakeups for TIOCDRAINWAIT. The conditional wakeups introduced in rev
1.59 defeated the point of doing the wakeups (having reduced timeouts
take effect immediately).
1995-09-10 11:48:13 +00:00
Andrey A. Chernov
af2a00bbbc Check for valid speed values in pty drive
Check for negative speed values in tty drive
Back out valid speed values checking from tty drive
Suggested by: bde
1995-08-02 06:55:36 +00:00
Andrey A. Chernov
271381b3b8 Optimize a bit valid speed search using fact that speed table sorted
Submitted by:
Obtained from:
1995-08-01 23:38:00 +00:00
Andrey A. Chernov
7a82fc7855 Check for valid speeds in TIOCSET* and return EINVAL for incorrect
values instead of setting garbadge.
1995-08-01 23:27:36 +00:00
Bruce Evans
19829865ca Obtained from: partly from ancient patches of mine via 1.1.5
Change all short variables in `struct tty' to int.  Shorts were only
right on ancient systems with ints optimized for vaxness over
efficiency.
1995-07-31 22:50:08 +00:00
Bruce Evans
35b46c174c Obtained from: partly from ancient patches of mine via 1.1.5
Handle MDMBUF a little better.  Prepare to handle 4 different kinds of
output flow control.
1995-07-31 22:48:46 +00:00
Bruce Evans
f91307e23d Obtained from: an ancient patch of mine via 1.1.5
Clear PENDIN when input is flushed so that the handling of future input
doesn't get pessimized.
1995-07-31 21:43:37 +00:00
Bruce Evans
9fa18570a2 Obtained from: partly from ancient patches of mine via 1.1.5
Introduce TS_CONNECTED and TS_ZOMBIE states.  TS_CONNECTED is set
while a connection is established.  It is set while (TS_CARR_ON or
CLOCAL is set) and TS_ZOMBIE is clear.  TS_ZOMBIE is set for on to
off transitions of TS_CARR_ON that occur when CLOCAL is clear and
is cleared for off to on transitions of CLOCAL.  I/o can only occur
while TS_CONNECTED is set.  TS_ZOMBIE prevents further i/o.

Split the input-event sleep address TSA_CARR_ON(tp) into TSA_CARR_ON(tp)
and TSA_HUP_OR_INPUT(tp).  The former address is now used only for
off to on carrier transitions and equivalent CLOCAL transitions.
The latter is used for all input events, all carrier transitions
and certain CLOCAL transitions.  There are some harmless extra
wakeups for rare connection- related events.  Previously there were
too many extra wakeups for non-rare input events.

Drivers now call l_modem() instead of setting TS_CARR_ON directly
to handle even the initial off to on transition of carrier.  They
should always have done this.  l_modem() now handles TS_CONNECTED
and TS_ZOMBIE as well as TS_CARR_ON.

gnu/isdn/iitty.c:
Set TS_CONNECTED for first open ourself to go with bogusly setting
CLOCAL.

i386/isa/syscons.c, i386/isa/pcvt/pcvt_drv.c:
We fake carrier, so don't also fake CLOCAL.

kern/tty.c:
Testing TS_CONNECTED instead of TS_CARR_ON fixes TIOCCONS forgetting to
test CLOCAL.  TS_ISOPEN was tested instead, but that broke when we disabled
the clearing of TS_ISOPEN for certain transitions of CLOCAL.

Testing TS_CONNECTED fixes ttyselect() returning false success for output
to devices in state !TS_CARR_ON && !CLOCAL.

Optimize the other selwakeup() call (this is not related to the other
changes).

kern/tty_pty.c:
ptcopen() can be declared in traditional C now that dev_t isn't short.
1995-07-31 21:02:00 +00:00
Bruce Evans
177af312cd Assorted cosmetic changes:
Make more functions static.

tty.c:
Use tcflag_t (u_long) and cc_t instead of u_char and int/long.

Don't record values that are only evaluated once.

Compare ints using imin(), not min().  min() is for comparing u_ints.
Old versions of tty.c used the type-safe but multiple-evaluation-unsafe
macro MIN().  The args are apparently never negative; otherwise this
change would be non-cosmetic.

Don't repeat the loop test in ttywait().

tty.h:
Improve English in and formatting of comments.
1995-07-31 19:17:19 +00:00
Bruce Evans
f3b37f91c1 Improve input flow control.
Use input buffer watermarks of TTYHOG-512 (high) and (high)*7/8
(low) instead of TTYHOG/2 (high) and TTYHOG/5 (low) to agree with
some drivers.  512 is magic and some things depended on TTYHOG/2
>= TTYHOG-512 to work; now they depend on the 512 magic not changing
and TTYHOG-512 being significantly larger than 0.  This should be
handled in ttsetwater().

Separate the decision about whether to do input flow control from
doing it.  ttyblock() now just starts input flow control (hardware
and/or software) and there is a new function ttyunblock() to stop
it.  The decisions are the same except for the watermark changes
and allowing for input expansion for PARMRK.

When flushing input, try harder at first to send a start character
if required, but give up if the first attempt fails.

cy.c, rc.c, sio.c:
Simplify: let ttyinput() handle input flow control if it is not
being bypassed.  Use ttyblock() to start flow control otherwise.

rc.c:
Use same input flow control test as elsewhere: test in a more
efficient order and start flow control at >= highwater instead of
at > highwater.
1995-07-31 18:29:51 +00:00
Bruce Evans
79ccb9aff3 Don't swap the queue headers to implement concatenation of the
queues for TIOCSETA[W].  Swapping an even number of times broke
the queue resource limits.  This would have broken CRTSCTS flow
control if the clist slush list was used up.

Don'concatenate the queues for TIOCSETA[W] if one of the queues
has a resource limit of 0.  Concatenation would cause a panic if
one of the queues is nonempty and the other is limited to length
0.  This may have caused panics in PPPDISC.

Wake up readers after all transitions of ICANON.  When ICANON is
turned off it is quite likely that characters will become available
to be read.

Reduce indentation near these changes.
1995-07-30 13:52:56 +00:00
Bruce Evans
d7515ab5cf Split TS_ASLEEP (sleep on output [below low water])into TS_SO_OLOWAT (sleep
on output below low water) and TS_SO_OCOMPLETE (sleep on output complete).
Most of the support for this has already been committed.  Drivers should
call ttwwakeup() to handle wakeups whenever output is below low water
(and some output event causes this condition to be checked) or TS_BUSY is
cleared.

tty.c:
Fix the livelock in ttywait() properly by sleeping on output complete, not
on output below low water.

Use ttwwakeup() instead of separate select and output wakeups for all
wakeups of writers.

Add wakeups of writers for output flushes and carrier/clocal transitions.

Don't go to sleep in ttycheckoutq() if ttstart() reduces the queue to below
low water.

Use the timeout built into tsleep() in ttycheckoutq().

Optimize the select wakeup in ttwwakeup().  It seems reasonable to know
too much about the internals of tp->t_wsel now that the knowledge is
localised in tty.c.
1995-07-30 12:39:42 +00:00
Bruce Evans
267513a942 Obtained from: partly from ancient patches by ache and me via 1.1.5
Remove nullmodem().

It may be useful to have a null modem routine, but nullmodem()
wasn't one.  nullmodem() was identical to ttymodem() except it
didn't implement MDMBUF (carrier) flow control, didn't do any
wakeups for off to on carrier transitions, and didn't flush the
i/o queues for on to off carrier transitions (flushing has the side
effect of waking up readers and writers) although it did generate
SIGHUPs.  The wakeups must normally be done even if nullmodem() is
null in case something is sleeping waiting for a carrier transition.
In any case, the wakeups should be harmless.  They may cause bogus
results for select(), but select() is already bogus for nonstandard
line disciplines.
1995-07-29 13:40:13 +00:00
Bruce Evans
abe8bea470 Obtained from: partly from ancient patches of mine via 1.1.5
Give names to the magic tty i/o sleep addresses and use them.  This makes
it easier to remember what the addresses are for and to keep them unique.
1995-07-22 16:45:22 +00:00
Bruce Evans
a16721a13a Move the inline code for waking up writers to a new function
ttwwakeup().  The conditions for doing the wakeup will soon become
more complicated and I don't want them duplicated in all drivers.

It's probably not worth making ttwwakeup() a macro or an inline
function.  The cost of the function call is relatively small when
there is a process to wake up.  There is usually a process to wake
up for large writes and the system call overhead dwarfs the function
call overhead for small writes.
1995-07-22 01:30:45 +00:00
Bruce Evans
2ce42987d3 Obtained from: partly from ancient patches of mine via 1.1.5
Move static termioschars() from a couple of drivers to tty.c.  Now there
is only one copy of ttydefchars[].
1995-07-21 22:52:01 +00:00
Bruce Evans
6644e30617 Obtained from: partly from ancient patches by ache and me via 1.1.5
Nuke `symbolic sleep message strings'.  Use unique literal messages so that
`ps l' shows unambiguously where processes are sleeping.
1995-07-21 20:57:15 +00:00
Bruce Evans
491cb8cd99 Obtained from: partly from anancient patch of mine via 1.1.5
Fix races for FIONREAD, TIOCSTI and TIOCSTAT.
1995-07-21 17:30:12 +00:00
Bruce Evans
0d1de831ea Obtained from: partly from an ancient patch of mine via 1.1.5
Temporarily nuke TS_WOPEN.  It was only used for the obscure MDMBUF
flow control option in the kernel and for informational purposes
in `pstat -t'.  The latter worked properly only for ptys.  In
general there may be multiple processes sleeping in open() and
multiple processes that successfully opened the tty by opening it
in O_NONBLOCK mode or during a window when CLOCAL was set.  tty.c
doesn't have enough information to maintain the flag but always
cleared it in ttyopen().

TS_WOPEN should be restored someday just so that `pstat -t' can
display it (MDMBUF is already fixed).  Fixing it requires counting
of processes sleeping in open() in too many serial drivers.
1995-07-21 16:30:59 +00:00
Bruce Evans
d83f358fa3 Obtained from: an ancient patch of mine via 1.1.5
Don't put partial PARMRK escape sequences in the input queue.  Use
MAX_INPUT = TTYHOG instead of TTYHOG directly for the maximum input
queue size.  Don't use the bogus MAX_INPUT advertised in
<sys/syslimits.h>.
1995-07-21 14:41:43 +00:00
Bruce Evans
2ef5801909 Add to TODO list and move it to near the top of the file. 1995-07-21 14:15:09 +00:00
Bruce Evans
a2a072b542 Obtained from: ancient usenet posting as applied to 1.1.5
First of many changes required to restore lost stability to the tty
driver.

ECHONL is supposed to enable echoing of NL when ECHO is off, but it
enabled echoing of everything except NL.
1995-07-21 13:56:29 +00:00
Andrey A. Chernov
a526d6bb67 ttywait: convert EWOULDBLOCK to EIO, when t_timeout expired 1995-06-24 16:28:20 +00:00
Andrey A. Chernov
13cf82d487 Replace EWOULDBLOCK to EIO in ttwrite, when t_timeout expired 1995-06-23 21:20:10 +00:00
Rodney W. Grimes
d3628763db Merge RELENG_2_0_5 into HEAD 1995-06-11 19:33:05 +00:00
Rodney W. Grimes
9b2e535452 Remove trailing whitespace. 1995-05-30 08:16:23 +00:00
Andrey A. Chernov
3cfa74c35f Make two "ttyout" ttysleep wmesg unique
Add t_timeout to ttysleep call into ttywrite
1995-05-07 23:53:36 +00:00
Bruce Evans
65e8f11839 Test the correct nonblocking flag in ttylclose(). IO_NDELAY is only valid
in read() and write().  FNONBLOCK is valid in ioctl() and close().

The bug caused hung ptys when a process talked to itself using nonblocking
i/o and exited while the slave pty had output to flush.  ttywait() was
called and hung.  Signals didn't work because the process was exiting.
`comcontrol /dev/ttyp0 drainwait 1' worked to terminate the wait.  This
shows that comcontrol is not limited to hardware control.  It has no i386
or driver dependencies and doesn't belong in src/sbin/i386.

Bruce
1995-05-07 06:32:28 +00:00
Bruce Evans
e2f03b0df0 Speed up ttnread() in the !(ICANON | ISIG) case by copying to user space
through a temporary buffer instead of one character at a time.  The old
method takes about 6 usec/char on a 486DX2/66.  This is larger than than
the combined interrupt and PIO overhead for a 16550!

This change was first implemented in 1.1.5.  It was rewritten for 2.1.
The clist access functions allow a simpler implementation at some cost
in correctness and speed.  There needs to be an ungetc() function to
recover from EFAULT, and it wastes time to copy through a temporary
buffer.

Don't snoop on single characters that weren't read due to EFAULT.
Rewrite a snoop comment in my approximation to English.

Undo bogus exportation of ttnread().
1995-04-15 21:04:58 +00:00
Andrey A. Chernov
64a49d2d33 Oops, fix typing error in prev. commit 1995-03-29 19:24:46 +00:00
Andrey A. Chernov
668a9ccefc Handle TTY_BI now instead of TTY_FE && c == 0 1995-03-29 19:22:37 +00:00
Andrey A. Chernov
532f5941b0 Move parmark 0377 double code after control chars processing 1995-03-29 18:55:20 +00:00
Andrey A. Chernov
702c5e7e17 ttyinput() fixes:
1) Preserve old buffer contents when input buffer overflows.

Old code clear buffer and rewrite it again, if !MAXBEL
(for MAXBEL it does right thing :-).
F.e. if you type too long string, last chars passed,
not first ones as expected.
Moreover, it flush output queue too in this case without any needs.

2) Don't do IXOFF, if IGNCR and c==\r, ignore completely.

3) If PARMRK is active and !ISTRIP and char == 0377
put yet one 0377 to distinguish it from parity mark sequence.
POSIX standard (thanx Bruce).

Reviewed by:
Submitted by:
Obtained from:
CVS:
1995-03-28 15:25:13 +00:00
Andrey A. Chernov
63cadaef19 Bug fixed:
parity/framing/break not completely ignored when IGN* is set
but cause output restarted.
CVS:
1995-03-28 11:09:35 +00:00
Bruce Evans
b5e8ce9f12 Add and move declarations to fix all of the warnings from `gcc -Wimplicit'
(except in netccitt, netiso and netns) and most of the warnings from
`gcc -Wnested-externs'.  Fix all the bugs found.  There were no serious
ones.
1995-03-16 18:17:34 +00:00
Andrey A. Chernov
5d8619d1f2 Workaround IXOFF bug when output queue is full && RTS control is on 1995-02-28 23:21:33 +00:00
Paul Traina
8c5c37cd75 Incorporate bde's code-review comments.
(a) bring back ttselect, now that we have xxxdevtotty() it isn't dangerous.
(b) remove all of the wrappers that have been replaced by ttselect
(c) fix formatting in syscons.c and definition in syscons.h
(d) add cxdevtotty

NOT DONE:
(e) make pcvt work... it was already broken...when someone fixes pcvt to
	link properly, just rename get_pccons to xxxdevtotty and we're done
1995-02-28 00:21:11 +00:00
Ugen J.S. Antsilevich
0739a0dc6e same 1995-02-27 19:47:53 +00:00
Paul Traina
77f77631e7 (a) remove the pointer to each driver's tty structure array from cdevsw
(b) add a function callback vector to tty drivers that will return a pointer
    to a valid tty structure based upon a dev_t
(c) make syscons structures the same size whether or not APM is enabled so
    utilities don't crash if NAPM changes (and make the damn kernel compile!)
(d) rewrite /dev/snp ioctl interface so that it is device driver and i386
    independant
1995-02-25 20:09:44 +00:00
Andrey A. Chernov
81c427da32 Add releasing of input flow control into
ttyflush(FREAD)
1995-02-24 02:36:01 +00:00
Andrey A. Chernov
227b711d8e Add two IXOFF checks to not confuse with CRTS_IFLOW.
Now TS_TBLOCK used as general input flow flag
for both IXOFF and CRTS_IFLOW cases.
1995-02-23 03:02:38 +00:00
Andrey A. Chernov
d8947494e5 Revive hadrware input flow control
Submitted by: iverson@lionheart.com
1995-02-22 23:20:51 +00:00
Andrey A. Chernov
93a56d1fd1 Restore deleted in second time my & bde fixes.
UGEN STOP IT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1995-02-15 22:25:51 +00:00
Ugen J.S. Antsilevich
964587caee More changes to support user calls.
It's 22:00  here,utility still to come(hopefully tomorrow
morning..)
1995-02-15 18:41:57 +00:00
Bruce Evans
23564ff8c3 Remove duplicated code from ttymalloc(). Disable ttyfree().
Restore fixes to flushing that were lost in the previous commit.

Clean up snoop changes.

Add my TODO list from 1.1.5.  The improvements in 1.1.5 should be "obtained"
first.
1995-02-15 16:00:56 +00:00
Ugen J.S. Antsilevich
dde8a05baa Here it came-the all-brand-new snoop device..
Users-beware..
It is tested and working for me but probably have some bugs i
didn't noticed so test it and reply...
It can:
 look at what's sent to the user from tty device
 snoop on pty's,vty's and serial tty's
It (still) can't:
 write to tty
 see what user types in local echo mode
It is probably bad styled and
 very dependant on tty_pty.c,sio.c and syscons.c
I would be really happy if another ppl would make their
changes because i am not sure this is the best snoop
we can have..but it is good..:)))))
1995-02-14 21:21:26 +00:00
Andrey A. Chernov
6d50a4a80f Purge queues in ttylclose(), if ttywflush() failed 1995-02-13 02:18:28 +00:00
Andrey A. Chernov
dee8849b8d Replace previous fix with less agressive, just return EIO
if ttywait can't drain queue.
1995-02-13 02:03:57 +00:00
Andrey A. Chernov
911b598f11 1. If some output still present at the end of ttywait, kill it.
2. Even if ttywait() fails, call ttyflush(FREAD) in ttywflush.
This two fixes guarantee that queues are empty after calling ttywflush()
in any case
1995-02-12 23:01:13 +00:00
Jordan K. Hubbard
3663f75c18 >32 PTY support
Submitted by: Heikki Suonsivu <hsu@cs.hut.fi>
1995-02-09 11:13:30 +00:00
Bruce Evans
a2d5fd1975 Disable bogus attempt to switch from the TS_ISOPEN state to the
TS_WOPEN state when CLOCAL is toggled from on to off while there
is no carrier.  There is no way back, and with sio there is no way
forward either (TS_ISOPEN will never be set again for the current
open).  This bug was observed in 1.1 and was fixed in 1.1.5.
1995-02-08 22:02:02 +00:00
Bruce Evans
c9c9e30a03 Increase the reserved clist space for the raw queue from 512 to TTYHOG.
This might help avoid tty buffer overflows on loaded systems.
1995-01-30 06:16:59 +00:00
Bruce Evans
4c5e4b09a7 Fix error handling for new TIOCSDRAINWAIT ioctl. 1995-01-06 14:56:42 +00:00
Andrey A. Chernov
33c38bd574 Fight against hanging modems: add timeout to ttywait.
Reviewed by: Bruce
1995-01-05 00:01:07 +00:00
Andrey A. Chernov
73a361245d Call d_stop in ttyflush not only for WRITE but for READ too
Obtained from: 1.1.5.1
1994-12-04 01:01:45 +00:00
Bruce Evans
d1a795a280 Fix cblock starvation bugs by reserving enough cblocks for minimal
operation of each clist.  Limit the growth of each clist.  Clists
can only grow larger than the reserved minimum if there are free
cblocks in a shared pool.  The size of this pool is now fixed
(this could be improved).  The reserved and maximum sizes are more
carefully allocated for slip and ppp, depending on the mtu.  A maximum
MTU of 16384 is now enforced for ppp.
1994-11-26 19:24:13 +00:00
Bruce Evans
ba77d4e47b Don't block for output in non-blocking mode if clists run out.
Remove an unnecessary test (if the output queue is above high water
then it is nonempty).
1994-11-26 18:54:25 +00:00
Bruce Evans
e8b7f39747 Return immediately from ttwrite() if the ttysleep()s that wait for
a clist return with an error.  There are some clist starvation/deadlock
bugs elsewhere and killing clist hogs didn't help because the breaks
only exited from the inner loops.
1994-11-01 22:23:29 +00:00
David Greenman
26305b211a Round down instead of up in 'kerninfo'/ctrl-T stats code. Incorrect output
can result otherwise.

Submitted by:	John Dyson
1994-10-23 06:18:13 +00:00
Andrey A. Chernov
61181d7df2 ttywait: check conditions again right after oproc
Obtained from: (I know, but can't say :-)
1994-10-15 17:59:02 +00:00
Poul-Henning Kamp
dcd01eb305 Cosmetics: added ()'s and fixed prinf-formats to make gcc silent. 1994-10-08 22:33:43 +00:00
David Greenman
824789192c Use tsleep() rather than sleep so that 'ps' is more informative about
the wait.
1994-10-06 21:07:04 +00:00
Andrey A. Chernov
d32198f15b Add VMIN/VTIME support
Obtained from:  scratch :-)
1994-10-03 01:12:18 +00:00
Poul-Henning Kamp
797f2d22f0 All of this is cosmetic. prototypes, #includes, printfs and so on. Makes
GCC a lot more silent.
1994-10-02 17:35:40 +00:00
David Greenman
9a500b2bcc Added support for TIOCSTAT ioctl. This allows shells that use raw/cbreak
tty modes to process a control-T and do the right thing.
1994-08-18 09:16:37 +00:00
David Greenman
3c4dd3568f Added $Id$ 1994-08-02 07:55:43 +00:00
David Greenman
9b970c5afa Allow for output processing routine to handle entire character buffer
and thus not require a sleep/wakeup.
Reviewed by:
Submitted by:
1994-08-01 10:42:26 +00:00
David Greenman
c16bf37e86 Added code to allocate and deallocate a number of cblocks on open/close of
a tty.
Note that this might  conflict with the collateral use of TS_WOPEN, but
for the moment I can find no problems associated with this. (TS_WOPEN
will likely go away in the future anyway). This should be looked at
again in the future (the potential problem is that the cblock pool
may either run out or accumulate too many cblocks).
1994-07-06 06:42:34 +00:00
Rodney W. Grimes
26f9a76710 The big 4.4BSD Lite to FreeBSD 2.0.0 (Development) patch.
Reviewed by:	Rodney W. Grimes
Submitted by:	John Dyson and David Greenman
1994-05-25 09:21:21 +00:00
Rodney W. Grimes
df8bae1de4 BSD 4.4 Lite Kernel Sources 1994-05-24 10:09:53 +00:00