Back to index

glibc  2.9
tcsendbrk.c File Reference
#include <errno.h>
#include <stddef.h>
#include <termios.h>
#include <sys/ioctl.h>

Go to the source code of this file.


int tcsendbreak (int fd, int duration)

Function Documentation

int tcsendbreak ( int  fd,
int  duration 

Definition at line 27 of file tcsendbrk.c.

  /* 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);

#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);
  /* 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;