Back to index

glibc  2.9
tcsendbrk.c File Reference
#include <errno.h>
#include <stddef.h>
#include <signal.h>
#include <termios.h>
#include <unistd.h>
#include "bsdtty.h"
#include <sys/file.h>
#include <sys/time.h>
#include <sys/types.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 31 of file tcsendbrk.c.

  struct timeval delay;

  /* 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 microseconds to break.  */
  if (duration <= 0)
    duration = 400000;

  delay.tv_sec = 0;
  delay.tv_usec = duration;

  /* Starting sending break.  */
  if (__ioctl (fd, TIOCSBRK, (void *) NULL) < 0)
    return -1;

  /* Wait DURATION microseconds.  */
  (void) __select (0, (fd_set *) NULL, (fd_set *) NULL, (fd_set *) NULL,

  /* Turn off the break.  */
  return __ioctl (fd, TIOCCBRK, (void *) NULL);

Here is the call graph for this function: