mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 19:43:32 +00:00
5b60e5a37d
The termios::c_cc field turned out to be incorrectly defined on Linux due to some confusion between the glibc and kernel definitions. We'll be using the kernel definition, since it has the strongest consensus. Fields have been have been added to struct stat for BSD compatibility such as st_birthtim, plus the GLIBC compatibility of isystem/sys/stat has been improved.
30 lines
1.6 KiB
C
30 lines
1.6 KiB
C
#ifndef COSMOPOLITAN_LIBC_CALLS_TERMIOS_INTERNAL_H_
|
|
#define COSMOPOLITAN_LIBC_CALLS_TERMIOS_INTERNAL_H_
|
|
#include "libc/calls/struct/metatermios.internal.h"
|
|
#include "libc/calls/struct/termios.h"
|
|
|
|
#define COPY_TERMIOS(TO, FROM) \
|
|
do { \
|
|
uint32_t Cc3; \
|
|
uint64_t Cc1, Cc2; \
|
|
autotype((TO)->c_iflag) c_iflag = (FROM)->c_iflag; \
|
|
autotype((TO)->c_oflag) c_oflag = (FROM)->c_oflag; \
|
|
autotype((TO)->c_cflag) c_cflag = (FROM)->c_cflag; \
|
|
autotype((TO)->c_lflag) c_lflag = (FROM)->c_lflag; \
|
|
__builtin_memcpy(&Cc1, (FROM)->c_cc + 000, 8); \
|
|
__builtin_memcpy(&Cc2, (FROM)->c_cc + 010, 8); \
|
|
__builtin_memcpy(&Cc3, (FROM)->c_cc + 020, 4); \
|
|
autotype((TO)->c_ispeed) c_ispeed = (FROM)->c_ispeed; \
|
|
autotype((TO)->c_ospeed) c_ospeed = (FROM)->c_ospeed; \
|
|
(TO)->c_iflag = c_iflag; \
|
|
(TO)->c_oflag = c_oflag; \
|
|
(TO)->c_cflag = c_cflag; \
|
|
(TO)->c_lflag = c_lflag; \
|
|
__builtin_memcpy((TO)->c_cc + 000, &Cc1, 8); \
|
|
__builtin_memcpy((TO)->c_cc + 010, &Cc2, 8); \
|
|
__builtin_memcpy((TO)->c_cc + 020, &Cc3, 4); \
|
|
(TO)->c_ispeed = c_ispeed; \
|
|
(TO)->c_ospeed = c_ospeed; \
|
|
} while (0)
|
|
|
|
#endif /* COSMOPOLITAN_LIBC_CALLS_TERMIOS_INTERNAL_H_ */
|