diff options
author | bde <bde@FreeBSD.org> | 1995-07-11 18:34:30 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1995-07-11 18:34:30 +0000 |
commit | e97bb42ff7b5af23eb85cbb418b988c32ae93df6 (patch) | |
tree | 90c1ab81c3a7b2e195b91d77433a32da5aea21f7 /sys/i386 | |
parent | 5312a5c2187ffb0fb972b9c4d221a0cb228b34d2 (diff) | |
download | FreeBSD-src-e97bb42ff7b5af23eb85cbb418b988c32ae93df6.zip FreeBSD-src-e97bb42ff7b5af23eb85cbb418b988c32ae93df6.tar.gz |
Fix races in scstart(). q_to_b() wasn't called at spltty(), so there
were two races:
- q_to_b() might unexpectedly return 0 (e.g, after a keyboard signal
flushes the output queue and isn't echoed). ansi_put() interprets
0 bytes as 4GB...
- more output (e.g. for echoes) might arrive afer q_to_b() returns 0.
Then scstart() returns presumably and the new output might not be
handled for a long time.
Remove unused function scxint().
Fix prototypes (foo() isn't a prototype).
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/isa/syscons.c | 23 | ||||
-rw-r--r-- | sys/i386/isa/syscons.h | 19 |
2 files changed, 14 insertions, 28 deletions
diff --git a/sys/i386/isa/syscons.c b/sys/i386/isa/syscons.c index 28e5433..c48d470 100644 --- a/sys/i386/isa/syscons.c +++ b/sys/i386/isa/syscons.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.c,v 1.118 1995/06/14 05:16:12 bde Exp $ + * $Id: syscons.c,v 1.119 1995/07/11 17:59:22 bde Exp $ */ #include "sc.h" @@ -1081,20 +1081,6 @@ set_mouse_pos: } void -scxint(dev_t dev) -{ - struct tty *tp = scdevtotty(dev); - - if (!tp) - return; - tp->t_state &= ~TS_BUSY; - if (tp->t_line) - (*linesw[tp->t_line].l_start)(tp); - else - scstart(tp); -} - -void scstart(struct tty *tp) { struct clist *rbp; @@ -1102,18 +1088,19 @@ scstart(struct tty *tp) u_char buf[PCBURST]; scr_stat *scp = get_scr_stat(tp->t_dev); + /* XXX who repeats the call when the above flags are cleared? */ if (scp->status & SLKED || blink_in_progress) return; s = spltty(); - if (!(tp->t_state & (TS_TIMEOUT|TS_BUSY|TS_TTSTOP))) { + if (!(tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP))) { tp->t_state |= TS_BUSY; - splx(s); rbp = &tp->t_outq; while (rbp->c_cc) { len = q_to_b(rbp, buf, PCBURST); + splx(s); ansi_put(scp, buf, len); + s = spltty(); } - s = spltty(); tp->t_state &= ~TS_BUSY; if (rbp->c_cc <= tp->t_lowat) { if (tp->t_state & TS_ASLEEP) { diff --git a/sys/i386/isa/syscons.h b/sys/i386/isa/syscons.h index 4b22de6..b09c57e 100644 --- a/sys/i386/isa/syscons.h +++ b/sys/i386/isa/syscons.h @@ -25,11 +25,11 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.h,v 1.8 1995/04/23 10:15:38 bde Exp $ + * $Id: syscons.h,v 1.9 1995/05/30 08:03:15 rgrimes Exp $ */ -#ifndef SYSCONS_H -#define SYSCONS_H +#ifndef _I386_ISA_SYSCONS_H_ +#define _I386_ISA_SYSCONS_H_ /* vm things */ #define ISMAPPED(pa, width) \ @@ -174,7 +174,6 @@ int scread(dev_t dev, struct uio *uio, int flag); int scwrite(dev_t dev, struct uio *uio, int flag); int scparam(struct tty *tp, struct termios *t); int scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p); -void scxint(dev_t dev); void scstart(struct tty *tp); void scintr(int unit); int pcmmap(dev_t dev, int offset, int nprot); @@ -182,10 +181,10 @@ static void scinit(void); static u_int scgetc(int noblock); struct tty *scdevtotty(dev_t dev); static scr_stat *get_scr_stat(dev_t dev); -static scr_stat *alloc_scp(); +static scr_stat *alloc_scp(void); static void init_scp(scr_stat *scp); -static int get_scr_num(); -static void scrn_timer(); +static int get_scr_num(void); +static void scrn_timer(void); static void clear_screen(scr_stat *scp); static int switch_scr(scr_stat *scp, u_int next_scr); static void exchange_scr(void); @@ -203,8 +202,8 @@ static void kbd_cmd(u_char command); static void set_mode(scr_stat *scp); void set_border(int color); static void set_vgaregs(char *modetable); -static void set_font_mode(); -static void set_normal_mode(); +static void set_font_mode(void); +static void set_normal_mode(void); static void copy_font(int operation, int font_type, char* font_image); static void set_destructive_cursor(scr_stat *scp, int force); static void draw_mouse_image(scr_stat *scp); @@ -213,4 +212,4 @@ static void save_palette(void); static void do_bell(scr_stat *scp, int pitch, int duration); static void blink_screen(scr_stat *scp); -#endif /* SYSCONS_H */ +#endif /* !_I386_ISA_SYSCONS_H_ */ |