1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

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).
This commit is contained in:
Bruce Evans 1995-07-11 18:34:30 +00:00
parent f2fb20ef41
commit d800e06858
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=9484
6 changed files with 42 additions and 84 deletions

View File

@ -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"
@ -1080,20 +1080,6 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
return(ENOTTY);
}
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)
{
@ -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) {

View File

@ -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_ */

View File

@ -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"
@ -1080,20 +1080,6 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
return(ENOTTY);
}
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)
{
@ -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) {

View File

@ -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_ */

View File

@ -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"
@ -1080,20 +1080,6 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
return(ENOTTY);
}
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)
{
@ -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) {

View File

@ -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_ */