Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

62. Terminals > Terminal Line Control

Terminal Line Control

The tcsendbreak(), tcdrain(), tcflush(), and tcflow() functions perform tasks that are usually collectively grouped under the term line control. (These functions are POSIX inventions designed to replace various ioctl() operations.)

#include <termios.h>

int tcsendbreak(int fd, int duration);
int tcdrain(int fd);
int tcflush(int fd, int queue_selector);
int tcflow(int fd, int action);

Note

All return 0 on success, or -1 on error

In each function, fd is a file descriptor that refers to a terminal or other remote device on a serial line.

The tcsendbreak() function generates a BREAK condition, by transmitting a continuous stream of 0 bits. The duration argument specifies the length of the transmission. If duration is 0, 0 bits are transmitted for 0.25 seconds. (SUSv3 specifies at least 0.25 and not more than 0.5 seconds.) If duration is greater than 0, 0 bits are transmitted for duration milliseconds. SUSv3 leaves this case unspecified; the handling of a nonzero duration varies widely on other UNIX implementations (the details described here are for glibc).


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint