1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-08 17:42:12 +03:00
Files
glibc/include/termios.h
H. Peter Anvin (Intel) 5f138519eb termios: add new baud_t interface, defined to be explicitly numeric
Add an explicitly numeric interface for baudrate setting. For glibc,
this only announces what is a fair accompli, but this is a plausible
way forward for standardization, and may be possible to infill on
non-compliant systems. The POSIX committee has stated:

[https://www.austingroupbugs.net/view.php?id=1916#c7135]

	A future version of this standard is expected to add at least
	the following symbolic constants for use as values of objects
	of type speed_t: B57600, B115200, B230400, B460800, and
	B921600.

	Implementations are encouraged to propose additional
	interfaces which will make it possible to set and query a
	wider range of speeds than just those enumerated by the
	constants beginning with B. If a set of common interfaces
	emerges between several implementations, a future version of
	this standard will likely add those interfaces.

This is exactly that interface.

The use of the term "baud" is due to the need to have a term
contrasting "speed", and it is already well established as a legacy
term -- including in the names of the legacy Bxxx
constants. Futhermore, it *is* valid from the point of view that the
termios interface fundamentally emulates an RS-232 serial port as far
as the application software is concerned.

The documentation states that for the current version of glibc,
speed_t == baud_t, but explicitly declares that this may not be the
case in the future.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2025-06-17 09:11:38 -03:00

38 lines
1.3 KiB
C

#ifndef _TERMIOS_H
#include <termios/termios.h>
#ifndef _ISOMAC
extern speed_t __cfgetospeed (const struct termios *__termios_p);
extern speed_t __cfgetispeed (const struct termios *__termios_p);
extern int __cfsetospeed (struct termios *__termios_p, speed_t __speed);
extern int __cfsetispeed (struct termios *__termios_p, speed_t __speed);
extern int __cfsetspeed (struct termios *__termios_p, speed_t __speed);
extern baud_t __cfgetobaud (const struct termios *__termios_p);
extern baud_t __cfgetibaud (const struct termios *__termios_p);
extern int __cfsetobaud (struct termios *__termios_p, baud_t __baud);
extern int __cfsetibaud (struct termios *__termios_p, baud_t __baud);
extern int __cfsetbaud (struct termios *__termios_p, baud_t __baud);
extern int __tcgetattr (int __fd, struct termios *__termios_p);
extern int __tcsetattr (int __fd, int __optional_actions,
const struct termios *__termios_p);
extern int __libc_tcdrain (int __fd);
libc_hidden_proto (__tcgetattr)
libc_hidden_proto (__tcsetattr)
libc_hidden_proto (__cfgetispeed)
libc_hidden_proto (__cfgetospeed)
libc_hidden_proto (__cfsetispeed)
libc_hidden_proto (__cfsetospeed)
libc_hidden_proto (__cfsetspeed)
libc_hidden_proto (__cfgetibaud)
libc_hidden_proto (__cfgetobaud)
libc_hidden_proto (__cfsetibaud)
libc_hidden_proto (__cfsetobaud)
libc_hidden_proto (__cfsetbaud)
#endif
#endif