Fix benign type mismatches int console functions. dev_t was assumed

to be `int' or smaller and some functions returned `int' instead
of `void'.  The first bug was detected when console functions were
defined in a place central enough for type checking to actually
work and the second bug was introduced when the interface was
changed to match what the console functions in other drivers actually
return.
This commit is contained in:
bde 1995-04-25 12:18:05 +00:00
parent f844ce2530
commit e565b4e20c
2 changed files with 38 additions and 1 deletions

View File

@ -1081,7 +1081,11 @@ consinit() /* init for kernel messages during boot */
}
#endif /* PCVT_NETBSD */
#if PCVT_FREEBSD > 205
void
#else
int
#endif
pccnprobe(struct consdev *cp)
{
int maj;
@ -1115,17 +1119,29 @@ pccnprobe(struct consdev *cp)
#endif /* !PCVT_NETBSD */
#if PCVT_FREEBSD <= 205
return 1;
#endif
}
#if PCVT_FREEBSD > 205
void
#else
int
#endif
pccninit(struct consdev *cp)
{
pcvt_is_console = 1;
#if PCVT_FREEBSD <= 205
return 0;
#endif
}
#if PCVT_FREEBSD > 205
void
#else
int
#endif
pccnputc(Dev_t dev, U_char c)
{
@ -1151,7 +1167,9 @@ pccnputc(Dev_t dev, U_char c)
async_update(UPDATE_KERN);
#if PCVT_FREEBSD <= 205
return 0;
#endif
}
int

View File

@ -1184,6 +1184,16 @@ extern u_char *saved_charsets[NVGAFONTS];
#define U_short int
#define U_char int
/*
* In FreeBSD >= 2.0, dev_t has type `unsigned long', so promoting it
* doesn't cause any problems in prototypes.
*/
#if PCVT_FREEBSD >= 200
#undef Dev_t
#define Dev_t dev_t
#endif
/* in FreeBSD > 102 arguments for timeout()/untimeout() are a special type */
#if PCVT_FREEBSD > 102
@ -1211,10 +1221,19 @@ struct tty *pcdevtotty ( Dev_t dev );
#endif /* PCVT_FREEBSD > 205 */
int pcrint ( void );
int pcparam ( struct tty *tp, struct termios *t );
/*
* In FreeBSD > 2.0.6, driver console functions are declared in i386/cons.h
* and some return void, so don't declare them here.
*/
#if PCVT_FREEBSD <= 205
int pccnprobe ( struct consdev *cp );
int pccninit ( struct consdev *cp );
int pccnputc ( Dev_t dev, U_char c );
int pccngetc ( Dev_t dev );
int pccncheckc ( Dev_t dev );
int pccnputc ( Dev_t dev, U_char c );
#endif
void pcstart ( struct tty *tp );
void pcstop ( struct tty *tp, int flag );