提交 fab89223 编写于 作者: A Alan Cox 提交者: Linus Torvalds

vt: Add a note on the historical abuse of CLOCK_TICK_RATE

This is one area where we can't just magic away the bizarre use of
CLOCK_TICK_RATE as it leaks to user space APIs. It also means the visible
CLOCK_TICK_RATE is frozen for architectures which is horrible.

We need to fix this somehow
Signed-off-by: NAlan Cox <alan@linux.intel.com>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 413f81eb
...@@ -400,6 +400,9 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, ...@@ -400,6 +400,9 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
case KIOCSOUND: case KIOCSOUND:
if (!perm) if (!perm)
goto eperm; goto eperm;
/* FIXME: This is an old broken API but we need to keep it
supported and somehow separate the historic advertised
tick rate from any real one */
if (arg) if (arg)
arg = CLOCK_TICK_RATE / arg; arg = CLOCK_TICK_RATE / arg;
kd_mksound(arg, 0); kd_mksound(arg, 0);
...@@ -417,6 +420,9 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, ...@@ -417,6 +420,9 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
*/ */
ticks = HZ * ((arg >> 16) & 0xffff) / 1000; ticks = HZ * ((arg >> 16) & 0xffff) / 1000;
count = ticks ? (arg & 0xffff) : 0; count = ticks ? (arg & 0xffff) : 0;
/* FIXME: This is an old broken API but we need to keep it
supported and somehow separate the historic advertised
tick rate from any real one */
if (count) if (count)
count = CLOCK_TICK_RATE / count; count = CLOCK_TICK_RATE / count;
kd_mksound(count, ticks); kd_mksound(count, ticks);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册