| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: tty.c,v 1.254 2012/09/30 11:49:44 mlelstv Exp $ */ | | 1 | /* $NetBSD: tty.c,v 1.255 2012/10/02 23:10:34 mlelstv Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2008 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2008 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -53,27 +53,27 @@ | | | @@ -53,27 +53,27 @@ |
53 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | | 53 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
54 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 54 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
55 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 55 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
56 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 56 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
57 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 57 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
58 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 58 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
59 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 59 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
60 | * SUCH DAMAGE. | | 60 | * SUCH DAMAGE. |
61 | * | | 61 | * |
62 | * @(#)tty.c 8.13 (Berkeley) 1/9/95 | | 62 | * @(#)tty.c 8.13 (Berkeley) 1/9/95 |
63 | */ | | 63 | */ |
64 | | | 64 | |
65 | #include <sys/cdefs.h> | | 65 | #include <sys/cdefs.h> |
66 | __KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.254 2012/09/30 11:49:44 mlelstv Exp $"); | | 66 | __KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.255 2012/10/02 23:10:34 mlelstv Exp $"); |
67 | | | 67 | |
68 | #include <sys/param.h> | | 68 | #include <sys/param.h> |
69 | #include <sys/systm.h> | | 69 | #include <sys/systm.h> |
70 | #include <sys/ioctl.h> | | 70 | #include <sys/ioctl.h> |
71 | #include <sys/proc.h> | | 71 | #include <sys/proc.h> |
72 | #define TTYDEFCHARS | | 72 | #define TTYDEFCHARS |
73 | #include <sys/tty.h> | | 73 | #include <sys/tty.h> |
74 | #undef TTYDEFCHARS | | 74 | #undef TTYDEFCHARS |
75 | #include <sys/file.h> | | 75 | #include <sys/file.h> |
76 | #include <sys/conf.h> | | 76 | #include <sys/conf.h> |
77 | #include <sys/cpu.h> | | 77 | #include <sys/cpu.h> |
78 | #include <sys/dkstat.h> | | 78 | #include <sys/dkstat.h> |
79 | #include <sys/uio.h> | | 79 | #include <sys/uio.h> |
| @@ -1947,27 +1947,29 @@ ttread(struct tty *tp, struct uio *uio, | | | @@ -1947,27 +1947,29 @@ ttread(struct tty *tp, struct uio *uio, |
1947 | mutex_spin_exit(&tty_lock); | | 1947 | mutex_spin_exit(&tty_lock); |
1948 | goto loop; | | 1948 | goto loop; |
1949 | } | | 1949 | } |
1950 | break; | | 1950 | break; |
1951 | } | | 1951 | } |
1952 | /* | | 1952 | /* |
1953 | * Interpret EOF only in canonical mode. | | 1953 | * Interpret EOF only in canonical mode. |
1954 | */ | | 1954 | */ |
1955 | if (CCEQ(cc[VEOF], c) && ISSET(lflag, ICANON)) | | 1955 | if (CCEQ(cc[VEOF], c) && ISSET(lflag, ICANON)) |
1956 | break; | | 1956 | break; |
1957 | /* | | 1957 | /* |
1958 | * Give user character. | | 1958 | * Give user character. |
1959 | */ | | 1959 | */ |
| | | 1960 | mutex_spin_exit(&tty_lock); |
1960 | error = ureadc(c, uio); | | 1961 | error = ureadc(c, uio); |
| | | 1962 | mutex_spin_enter(&tty_lock); |
1961 | if (error) | | 1963 | if (error) |
1962 | break; | | 1964 | break; |
1963 | if (uio->uio_resid == 0) | | 1965 | if (uio->uio_resid == 0) |
1964 | break; | | 1966 | break; |
1965 | /* | | 1967 | /* |
1966 | * In canonical mode check for a "break character" | | 1968 | * In canonical mode check for a "break character" |
1967 | * marking the end of a "line of input". | | 1969 | * marking the end of a "line of input". |
1968 | */ | | 1970 | */ |
1969 | if (ISSET(lflag, ICANON) && TTBREAKC(c, lflag)) | | 1971 | if (ISSET(lflag, ICANON) && TTBREAKC(c, lflag)) |
1970 | break; | | 1972 | break; |
1971 | first = 0; | | 1973 | first = 0; |
1972 | } | | 1974 | } |
1973 | | | 1975 | |