Commit abfdd83d authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

[PATCH] serial proc gives info on keycounts which can sometiems be abused

For 2.4.x we made the file r-------- but for 2.6 we can do a nicer job
parent 01ea7c89
...@@ -1667,23 +1667,25 @@ static int uart_line_info(char *buf, struct uart_driver *drv, int i) ...@@ -1667,23 +1667,25 @@ static int uart_line_info(char *buf, struct uart_driver *drv, int i)
return ret + 1; return ret + 1;
} }
status = port->ops->get_mctrl(port); if(capable(CAP_SYS_ADMIN))
{
ret += sprintf(buf + ret, " tx:%d rx:%d", status = port->ops->get_mctrl(port);
port->icount.tx, port->icount.rx);
if (port->icount.frame) ret += sprintf(buf + ret, " tx:%d rx:%d",
ret += sprintf(buf + ret, " fe:%d", port->icount.tx, port->icount.rx);
port->icount.frame); if (port->icount.frame)
if (port->icount.parity) ret += sprintf(buf + ret, " fe:%d",
ret += sprintf(buf + ret, " pe:%d", port->icount.frame);
port->icount.parity); if (port->icount.parity)
if (port->icount.brk) ret += sprintf(buf + ret, " pe:%d",
ret += sprintf(buf + ret, " brk:%d", port->icount.parity);
port->icount.brk); if (port->icount.brk)
if (port->icount.overrun) ret += sprintf(buf + ret, " brk:%d",
ret += sprintf(buf + ret, " oe:%d", port->icount.brk);
port->icount.overrun); if (port->icount.overrun)
ret += sprintf(buf + ret, " oe:%d",
port->icount.overrun);
#define INFOBIT(bit,str) \ #define INFOBIT(bit,str) \
if (port->mctrl & (bit)) \ if (port->mctrl & (bit)) \
strncat(stat_buf, (str), sizeof(stat_buf) - \ strncat(stat_buf, (str), sizeof(stat_buf) - \
...@@ -1693,19 +1695,22 @@ static int uart_line_info(char *buf, struct uart_driver *drv, int i) ...@@ -1693,19 +1695,22 @@ static int uart_line_info(char *buf, struct uart_driver *drv, int i)
strncat(stat_buf, (str), sizeof(stat_buf) - \ strncat(stat_buf, (str), sizeof(stat_buf) - \
strlen(stat_buf) - 2) strlen(stat_buf) - 2)
stat_buf[0] = '\0'; stat_buf[0] = '\0';
stat_buf[1] = '\0'; stat_buf[1] = '\0';
INFOBIT(TIOCM_RTS, "|RTS"); INFOBIT(TIOCM_RTS, "|RTS");
STATBIT(TIOCM_CTS, "|CTS"); STATBIT(TIOCM_CTS, "|CTS");
INFOBIT(TIOCM_DTR, "|DTR"); INFOBIT(TIOCM_DTR, "|DTR");
STATBIT(TIOCM_DSR, "|DSR"); STATBIT(TIOCM_DSR, "|DSR");
STATBIT(TIOCM_CAR, "|CD"); STATBIT(TIOCM_CAR, "|CD");
STATBIT(TIOCM_RNG, "|RI"); STATBIT(TIOCM_RNG, "|RI");
if (stat_buf[0]) if (stat_buf[0])
stat_buf[0] = ' '; stat_buf[0] = ' ';
strcat(stat_buf, "\n"); strcat(stat_buf, "\n");
ret += sprintf(buf + ret, stat_buf); ret += sprintf(buf + ret, stat_buf);
}
#undef STATBIT
#undef INFOBIT
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment