summaryrefslogtreecommitdiffstats
path: root/libc/termios
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-09-06 06:09:51 +0000
committerEric Andersen <andersen@codepoet.org>2003-09-06 06:09:51 +0000
commitb9c0292271ea5e4dc583137d6c74dda605d1ae04 (patch)
tree463654b2b2dbb1287d9f3df5677575928f7391cd /libc/termios
parentf763ad5a3646b8b88ad34474b81594e591ee3332 (diff)
downloaduClibc-alpine-b9c0292271ea5e4dc583137d6c74dda605d1ae04.tar.bz2
uClibc-alpine-b9c0292271ea5e4dc583137d6c74dda605d1ae04.tar.xz
Running ltp 20030905 showed that tcsendbreak was broken.
This fixes it.
Diffstat (limited to 'libc/termios')
-rw-r--r--libc/termios/termios.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/libc/termios/termios.c b/libc/termios/termios.c
index c6d74f2b3..cf3bd9bc6 100644
--- a/libc/termios/termios.c
+++ b/libc/termios/termios.c
@@ -70,21 +70,23 @@ int tcflush ( int fd, int queue_selector)
/* Send zero bits on FD. */
int tcsendbreak( int fd, int duration)
{
- /*
- * The break lasts 0.25 to 0.5 seconds if DURATION is zero, and an
- * implementation-defined period if DURATION is nonzero. We define a
- * positive DURATION to be number of milliseconds to break.
- */
+ /* The break lasts 0.25 to 0.5 seconds if DURATION is zero,
+ and an implementation-defined period if DURATION is nonzero.
+ We define a positive DURATION to be number of milliseconds to break. */
if (duration <= 0)
return ioctl(fd, TCSBRK, 0);
- /*
- * ioctl can't send a break of any other duration for us. This could be
- * changed to use trickery (e.g. lower speed and send a '\0') to send
- * the break, but for now just return an error.
- */
- __set_errno(EINVAL);
+#ifdef TCSBRKP
+ /* Probably Linux-specific: a positive third TCSBRKP ioctl argument is
+ defined to be the number of 100ms units to break. */
+ return ioctl(fd, TCSBRKP, (duration + 99) / 100);
+#else
+ /* ioctl can't send a break of any other duration for us.
+ This could be changed to use trickery (e.g. lower speed and
+ send a '\0') to send the break, but for now just return an error. */
+ __set_errno (EINVAL);
return -1;
+#endif
}
#endif