Deleted Added
full compact
tty.c (46112) tty.c (46568)
1/*-
2 * Copyright (c) 1982, 1986, 1990, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 22 unchanged lines hidden (view full) ---

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)tty.c 8.8 (Berkeley) 1/21/94
1/*-
2 * Copyright (c) 1982, 1986, 1990, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 22 unchanged lines hidden (view full) ---

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)tty.c 8.8 (Berkeley) 1/21/94
39 * $Id: tty.c,v 1.115 1999/02/19 19:34:49 luoqi Exp $
39 * $Id: tty.c,v 1.116 1999/04/27 11:16:17 phk Exp $
40 */
41
42/*-
43 * TODO:
44 * o Fix races for sending the start char in ttyflush().
45 * o Handle inter-byte timeout for "MIN > 0, TIME > 0" in ttyselect().
46 * With luck, there will be MIN chars before select() returns().
47 * o Handle CLOCAL consistently for ptys. Perhaps disallow setting it.

--- 1016 unchanged lines hidden (view full) ---

1064 int s;
1065 int revents = 0;
1066
1067 if (tp == NULL) /* XXX used to return ENXIO, but that means true! */
1068 return ((events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM))
1069 | POLLHUP);
1070
1071 s = spltty();
40 */
41
42/*-
43 * TODO:
44 * o Fix races for sending the start char in ttyflush().
45 * o Handle inter-byte timeout for "MIN > 0, TIME > 0" in ttyselect().
46 * With luck, there will be MIN chars before select() returns().
47 * o Handle CLOCAL consistently for ptys. Perhaps disallow setting it.

--- 1016 unchanged lines hidden (view full) ---

1064 int s;
1065 int revents = 0;
1066
1067 if (tp == NULL) /* XXX used to return ENXIO, but that means true! */
1068 return ((events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM))
1069 | POLLHUP);
1070
1071 s = spltty();
1072 if (events & (POLLIN | POLLRDNORM))
1072 if (events & (POLLIN | POLLRDNORM)) {
1073 if (ttnread(tp) > 0 || ISSET(tp->t_state, TS_ZOMBIE))
1074 revents |= events & (POLLIN | POLLRDNORM);
1075 else
1076 selrecord(p, &tp->t_rsel);
1073 if (ttnread(tp) > 0 || ISSET(tp->t_state, TS_ZOMBIE))
1074 revents |= events & (POLLIN | POLLRDNORM);
1075 else
1076 selrecord(p, &tp->t_rsel);
1077
1078 if (events & (POLLOUT | POLLWRNORM))
1077 }
1078 if (events & (POLLOUT | POLLWRNORM)) {
1079 if ((tp->t_outq.c_cc <= tp->t_olowat &&
1080 ISSET(tp->t_state, TS_CONNECTED))
1081 || ISSET(tp->t_state, TS_ZOMBIE))
1082 revents |= events & (POLLOUT | POLLWRNORM);
1083 else
1084 selrecord(p, &tp->t_wsel);
1079 if ((tp->t_outq.c_cc <= tp->t_olowat &&
1080 ISSET(tp->t_state, TS_CONNECTED))
1081 || ISSET(tp->t_state, TS_ZOMBIE))
1082 revents |= events & (POLLOUT | POLLWRNORM);
1083 else
1084 selrecord(p, &tp->t_wsel);
1085 }
1085 splx(s);
1086 return (revents);
1087}
1088
1089/*
1090 * This is a wrapper for compatibility with the select vector used by
1091 * cdevsw. It relies on a proper xxxdevtotty routine.
1092 */

--- 1339 unchanged lines hidden ---
1086 splx(s);
1087 return (revents);
1088}
1089
1090/*
1091 * This is a wrapper for compatibility with the select vector used by
1092 * cdevsw. It relies on a proper xxxdevtotty routine.
1093 */

--- 1339 unchanged lines hidden ---