Remove sicontrol(8)'s "ttystat".

In the FreeBSD base system, there are only two utilities that use struct
tty, namely pstat and sicontrol. The sicontrol utility calls the
TCSI_TTY ioctl(), which copies struct tty back to userspace.

sicontrol should not have this functionality. The same data is already
provided by pstat. If we really want to be able to export these numbers
through a file descriptor to userspace, we can export struct xtty, which
should provide a better abstraction. The ttystat option was only used as
a debugging aid.

This makes sicontrol compile in the mpsafetty branch.

Reviewed by:	peter
Approved by:	philip (mentor)
This commit is contained in:
Ed Schouten 2008-06-09 08:43:27 +00:00
parent 1f1fa917bd
commit 2ae1fdab5a
4 changed files with 1 additions and 73 deletions

View File

@ -682,7 +682,6 @@ si_Sioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *t
#if 1
DPRINT((0, DBG_IOCTL, "TCSI_PORT=%x\n", TCSI_PORT));
DPRINT((0, DBG_IOCTL, "TCSI_CCB=%x\n", TCSI_CCB));
DPRINT((0, DBG_IOCTL, "TCSI_TTY=%x\n", TCSI_TTY));
#endif
oldspl = spltty(); /* better safe than sorry */
@ -788,10 +787,6 @@ si_Sioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *t
SUCHECK;
si_vbcopy(xpp->sp_ccb, &sps->tc_ccb, sizeof(sps->tc_ccb));
break;
case TCSI_TTY:
SUCHECK;
si_bcopy(xpp->sp_tty, &sps->tc_tty, sizeof(sps->tc_tty));
break;
default:
error = EINVAL;
goto out;

View File

@ -385,7 +385,6 @@ struct si_pstat {
/* Various stats and monitoring hooks per tty device */
#define TCSI_PORT _IOWR('S', 125, struct si_pstat) /* get si_port */
#define TCSI_CCB _IOWR('S', 126, struct si_pstat) /* get si_ccb */
#define TCSI_TTY _IOWR('S', 127, struct si_pstat) /* get tty struct */
#define IOCTL_MAX 127

View File

@ -70,9 +70,6 @@ Show the current "ccb" structure for the specified port.
This is not of
much use outside of debugging the driver and determining why a port is
wedged.
.It Cm ttystat
Show the current "tty" structure that the kernel has for the specified port.
This is not much use outside of debugging the driver.
.El
.Sh FILES
.Bl -tag -width /dev/si_control -compact

View File

@ -89,7 +89,6 @@ int opencontrol(void);
void prlevels(int);
void prusage(int, int);
void rxint(int, char **);
void tty_stat(int, char **);
void txint(int, char **);
struct opt {
@ -103,7 +102,6 @@ struct opt {
{"mstate", mstate},
{"ccbstat", ccb_stat},
{"portstat", port_stat},
{"ttystat", tty_stat},
{0, 0}
};
@ -121,9 +119,8 @@ struct stat_list {
#define U_MSTATE 4
#define U_STAT_CCB 5
#define U_STAT_PORT 6
#define U_STAT_TTY 7
#define U_MAX 8
#define U_MAX 7
#define U_ALL -1
char *usage[] = {
"debug [[add|del|set debug_levels] | [off]]\n",
@ -133,7 +130,6 @@ char *usage[] = {
"mstate\n",
"ccbstat\n",
"portstat\n",
"ttystat\n",
0
};
@ -648,65 +644,6 @@ port_stat(int ac, char **av)
printf("\tsp_delta_overflows 0x%d\n", PRT.sp_delta_overflows);
}
const char *pt_state(int ts)
{
static char buf[200];
buf[0] = 0;
if (ts & TS_SO_OLOWAT) strcat(buf, "TS_SO_OLOWAT ");
if (ts & TS_ASYNC) strcat(buf, "TS_ASYNC ");
if (ts & TS_BUSY) strcat(buf, "TS_BUSY ");
if (ts & TS_CARR_ON) strcat(buf, "TS_CARR_ON ");
if (ts & TS_FLUSH) strcat(buf, "TS_FLUSH ");
if (ts & TS_ISOPEN) strcat(buf, "TS_ISOPEN ");
if (ts & TS_TBLOCK) strcat(buf, "TS_TBLOCK ");
if (ts & TS_TIMEOUT) strcat(buf, "TS_TIMEOUT ");
if (ts & TS_TTSTOP) strcat(buf, "TS_TTSTOP ");
if (ts & TS_XCLUDE) strcat(buf, "TS_XCLUDE ");
if (ts & TS_BKSL) strcat(buf, "TS_BKSL ");
if (ts & TS_CNTTB) strcat(buf, "TS_CNTTB ");
if (ts & TS_ERASE) strcat(buf, "TS_ERASE ");
if (ts & TS_TYPEN) strcat(buf, "TS_TYPEN ");
if (ts & TS_CAN_BYPASS_L_RINT) strcat(buf, "TS_CAN_BYPASS_L_RINT ");
if (ts & TS_CONNECTED) strcat(buf, "TS_CONNECTED ");
if (ts & TS_SNOOP) strcat(buf, "TS_SNOOP ");
if (ts & TS_SO_OCOMPLETE) strcat(buf, "TS_OCOMPLETE ");
if (ts & TS_ZOMBIE) strcat(buf, "TS_ZOMBIE ");
if (ts & TS_CAR_OFLOW) strcat(buf, "TS_CAR_OFLOW ");
if (ts & TS_DTR_WAIT) strcat(buf, "TS_DTR_WAIT ");
if (ts & TS_GONE) strcat(buf, "TS_GONE ");
if (ts & TS_CALLOUT) strcat(buf, "TS_CALLOUT ");
return (buf);
}
void
tty_stat(int ac, char **av)
{
struct si_pstat sip;
#define TTY sip.tc_tty
if (ac != 0)
prusage(U_STAT_TTY, 1);
sip.tc_dev = tc.tc_dev;
if (ioctl(ctlfd, TCSI_TTY, &sip) < 0)
err(1, "TCSI_TTY on %s", Devname);
printf("%s: ", Devname);
printf("\tt_outq.c_cc %d\n", TTY.t_outq.c_cc); /* struct clist t_outq */
printf("\tt_flags 0x%x\n", TTY.t_flags); /* int t_flags */
printf("\tt_state 0x%x %s\n", TTY.t_state, pt_state(TTY.t_state)); /* int t_state */
printf("\tt_ihiwat %d\n", TTY.t_ihiwat); /* int t_ihiwat */
printf("\tt_ilowat %d\n", TTY.t_ilowat); /* int t_ilowat */
printf("\tt_ohiwat %d\n", TTY.t_ohiwat); /* int t_ohiwat */
printf("\tt_olowat %d\n", TTY.t_olowat); /* int t_olowat */
printf("\tt_iflag 0x%x\n", TTY.t_iflag); /* t_iflag */
printf("\tt_oflag 0x%x\n", TTY.t_oflag); /* t_oflag */
printf("\tt_cflag 0x%x\n", TTY.t_cflag); /* t_cflag */
printf("\tt_lflag 0x%x\n", TTY.t_lflag); /* t_lflag */
printf("\tt_cc %p\n", (void *)TTY.t_cc); /* t_cc */
printf("\tt_termios.c_ispeed %d\n", TTY.t_termios.c_ispeed); /* t_termios.c_ispeed */
printf("\tt_termios.c_ospeed %d\n", TTY.t_termios.c_ospeed); /* t_termios.c_ospeed */
}
int
islevel(char *tk)
{