Previous | Table of Contents | Next

Page 1052

tcsetattr() sets the parameters associated with the terminal (unless support is required from the underlying hardware that is not available) from the termios structure referred to by termios_p. optional_actions specifies when the changes take effect:

TCSANOW The change occurs immediately.
TCSADRAIN The change occurs after all output written to fd has been transmitted. This function should be used when changing parameters that affect output.
TCSAFLUSH The change occurs after all output written to the object referred by fd has been transmitted, and all input that has been received but not read will be discarded before the change is made.

tcsendbreak() transmits a continuous stream of zero-valued bits for a specific duration, if the terminal is using asynchronous serial data transmission. If duration is zero, it transmits zero-valued bits for at least 0.25 seconds, and not more that 0.5 seconds. If duration is not zero, it sends zero-valued bits for duration*N seconds, where N is at least 0.25, and not more than 0.5.

If the terminal is not using asynchronous serial data transmission, tcsendbreak() returns without taking any action.

tcdrain()waits until all output written to the object referred to by fd has been transmitted.

tcflush()discards data written to the object referred to by fd but not transmitted, or data received but not read, depending on the value of queue_selector:

TCIFLUSH Flushes data received but not read
TCOFLUSH Flushes data written but not transmitted
TCIOFLUSH Flushes both data received but not read, and data written but not transmitted

tcflow()suspends transmission or reception of data on the object referred to by fd, depending on the value of action:

TCOOFF Suspends output
TCOON Restarts suspended output
TCIOFF Transmits a STOP character, which stops the terminal device from transmitting data to the system
TCION Transmits a START character, which starts the terminal device transmitting data to the system

The default on open of a terminal file is that neither its input nor its output is suspended.

The baud rate functions are provided for getting and setting the values of the input and output baud rates in the termios structure. The new values do not take effect until tcsetattr() is successfully called.

Setting the speed to B0 instructs the modem to hang up. The actual bit rate corresponding to B38400 may be altered with setserial(8).

The input and output baud rates are stored in the termios structure.

cfmakeraw sets the terminal attributes as follows:

termios_p->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
|INLCR|IGNCR|ICRNL|IXON);
termios_p->c_oflag &= ~OPOST;
termios_p->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
termios_p->c_cflag &= ~(CSIZE|PARENB) ;
termios_p->c_cflag |=CS8;

cfgetospeed() returns the output baud rate stored in the termios structure pointed to by termios_p.

cfsetospeed() sets the output baud rate stored in the termios structure pointed to by termios_p to speed, which must be one of these constants:


B0
B50
B75

Page 1053

B110
B134
B150
B200
B300
B600
B1200
B1800
B2400
B4800
B9600
B19200
B38400
B57600
B115200
B230400

The zero baud rate, B0, is used to terminate the connection. If B0 is specified, the modem control lines shall no longer be asserted. Normally, this will disconnect the line. CBAUDEX is a mask for the speeds beyond those defined in POSIX.1 (57600 and above). Thus, B57600 & CBAUDEX is non-zero.

cfgetispeed() returns the input baud rate stored in the termios structure.

cfsetispeed() sets the input baud rate stored in the termios structure to speed. If the input baud rate is set to zero, the input baud rate will be equal to the output baud rate.

tcgetpgrp() returns process group ID of foreground processing group, or -1 on error.

tcsetpgrp() sets process group ID to pgrpid. pgrpid must be the ID of a process group in the same session.

RETURN VALUES

cfgetispeed() returns the input baud rate stored in the termios structure.

cfgetospeed() returns the output baud rate stored in the termios structure.

tcgetpgrp() returns process group ID of foreground processing group, or -1 on error.

All other functions return

0 On success
-1 On failure and set errno to indicate the error

SEE ALSO

setserial(8)

Linux, 2 September 1995

tmpfile

tmpfile—Creates a temporary file

SYNOPSIS

#include <stdio.h>
FILE *tmpfile (void);

DESCRIPTION

The tmpfile() function generates a unique temporary filename using the path prefix P_tmpdir defined in <stdio.h>. The temporary file is then opened in binary read/write (w+b) mode. The file will be automatically deleted when it is closed or the program terminates.

Previous | Table of Contents | Next

1