#include <termios.h> int tcflow(int fileDescriptor, int action);
tcflow
controls the flow of data to and from a terminal
device.
Because
OpenEdition MVS supports only pseudo-terminals, tcflow
affects only
the flow of data between the OMVS TSO command and user programs. It
does not directly affect transmission to and from a user's 3270
terminal.
The arguments to tcflow
are:
fileDescriptor
action
tcflow
.
The values for action
are defined in <termios.h>
and can be any of the following:
TCOOFF
TCOON
TCIOFF
STOP
character to a terminal. This should
stop further transmission of data from the terminal.
TCION
START
character to a terminal. This should
restart the transmission of data from the terminal.
tcflow
is called from a background process, with a
file descriptor that refers to the controlling terminal for the
process, a SIGTTOU
signal may be generated. This will cause
the function call to be unsuccessful, returning a -1
. If SIGTTOU
is blocked, the function call proceeds normally.
tcflow
returns a 0
if successful and a -1
if unsuccessful.
tcflow
to
suspend data transmission:
#include <sys/types.h> #include <termios.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> main() { int ttyDevice = STDOUT_FILENO; /* Make sure file descriptor is for a TTY device, */ if ( ! isatty(ttyDevice) ) { printf("Not a TTY device.n"); return(EXIT_FAILURE); } /* Suspend and resume data transmission, */ else { printf("About to suspend data transmission for 5 seconds.n"); if (tcflow(ttyDevice, TCOOFF) != 0) { perror("tcflow error"); exit(EXIT_FAILURE); } sleep(5); if (tcflow(ttyDevice, TCOON) == 0) printf("Data transmisiion suspended and resumed.n"); else { /* We turned it off, and now we can't turn it back on! */ perror("tcflow error"); /* probably message will be lost */ abort(); } return(EXIT_SUCCESS); }
tcdrain
, tcflush
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.