Deleted Added
full compact
tty.c (293349) tty.c (294362)
1/*-
2 * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Portions of this software were developed under sponsorship from Snow
6 * B.V., the Netherlands.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Portions of this software were developed under sponsorship from Snow
6 * B.V., the Netherlands.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: head/sys/kern/tty.c 293349 2016-01-07 20:15:09Z kib $");
31__FBSDID("$FreeBSD: head/sys/kern/tty.c 294362 2016-01-19 23:34:27Z marius $");
32
33#include "opt_capsicum.h"
34#include "opt_compat.h"
35
36#include <sys/param.h>
37#include <sys/capsicum.h>
38#include <sys/conf.h>
39#include <sys/cons.h>

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

127{
128 size_t bytesused;
129 int error, revokecnt;
130
131 if (ttyhook_hashook(tp, getc_inject))
132 /* buffer is inaccessible */
133 return (0);
134
32
33#include "opt_capsicum.h"
34#include "opt_compat.h"
35
36#include <sys/param.h>
37#include <sys/capsicum.h>
38#include <sys/conf.h>
39#include <sys/cons.h>

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

127{
128 size_t bytesused;
129 int error, revokecnt;
130
131 if (ttyhook_hashook(tp, getc_inject))
132 /* buffer is inaccessible */
133 return (0);
134
135 while (ttyoutq_bytesused(&tp->t_outq) > 0) {
135 while (ttyoutq_bytesused(&tp->t_outq) > 0 || ttydevsw_busy(tp)) {
136 ttydevsw_outwakeup(tp);
137 /* Could be handled synchronously. */
138 bytesused = ttyoutq_bytesused(&tp->t_outq);
136 ttydevsw_outwakeup(tp);
137 /* Could be handled synchronously. */
138 bytesused = ttyoutq_bytesused(&tp->t_outq);
139 if (bytesused == 0)
139 if (bytesused == 0 && !ttydevsw_busy(tp))
140 return (0);
141
142 /* Wait for data to be drained. */
143 if (leaving) {
144 revokecnt = tp->t_revokecnt;
145 error = tty_timedwait(tp, &tp->t_outwait, hz);
146 switch (error) {
147 case ERESTART:

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

950
951static void
952ttydevsw_deffree(void *softc)
953{
954
955 panic("Terminal device freed without a free-handler");
956}
957
140 return (0);
141
142 /* Wait for data to be drained. */
143 if (leaving) {
144 revokecnt = tp->t_revokecnt;
145 error = tty_timedwait(tp, &tp->t_outwait, hz);
146 switch (error) {
147 case ERESTART:

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

950
951static void
952ttydevsw_deffree(void *softc)
953{
954
955 panic("Terminal device freed without a free-handler");
956}
957
958static bool
959ttydevsw_defbusy(struct tty *tp __unused)
960{
961
962 return (FALSE);
963}
964
958/*
959 * TTY allocation and deallocation. TTY devices can be deallocated when
960 * the driver doesn't use it anymore, when the TTY isn't a session's
961 * controlling TTY and when the device node isn't opened through devfs.
962 */
963
964struct tty *
965tty_alloc(struct ttydevsw *tsw, void *sc)

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

984 PATCH_FUNC(inwakeup);
985 PATCH_FUNC(ioctl);
986 PATCH_FUNC(cioctl);
987 PATCH_FUNC(param);
988 PATCH_FUNC(modem);
989 PATCH_FUNC(mmap);
990 PATCH_FUNC(pktnotify);
991 PATCH_FUNC(free);
965/*
966 * TTY allocation and deallocation. TTY devices can be deallocated when
967 * the driver doesn't use it anymore, when the TTY isn't a session's
968 * controlling TTY and when the device node isn't opened through devfs.
969 */
970
971struct tty *
972tty_alloc(struct ttydevsw *tsw, void *sc)

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

991 PATCH_FUNC(inwakeup);
992 PATCH_FUNC(ioctl);
993 PATCH_FUNC(cioctl);
994 PATCH_FUNC(param);
995 PATCH_FUNC(modem);
996 PATCH_FUNC(mmap);
997 PATCH_FUNC(pktnotify);
998 PATCH_FUNC(free);
999 PATCH_FUNC(busy);
992#undef PATCH_FUNC
993
994 tp = malloc(sizeof(struct tty), M_TTY, M_WAITOK|M_ZERO);
995 tp->t_devsw = tsw;
996 tp->t_devswsoftc = sc;
997 tp->t_flags = tsw->tsw_flags;
998
999 tty_init_termios(tp);

--- 1259 unchanged lines hidden ---
1000#undef PATCH_FUNC
1001
1002 tp = malloc(sizeof(struct tty), M_TTY, M_WAITOK|M_ZERO);
1003 tp->t_devsw = tsw;
1004 tp->t_devswsoftc = sc;
1005 tp->t_flags = tsw->tsw_flags;
1006
1007 tty_init_termios(tp);

--- 1259 unchanged lines hidden ---