mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 19:43:32 +00:00
c7a8cd21e9
This change improves copy_file_range(), sendfile(), splice(), openpty(), closefrom(), close_range(), fadvise() and posix_fadvise() in addition to writing tests that confirm things like errno and seeking behavior across platforms. We now less aggressively polyfill behavior with some of these functions when the platform support isn't available. Please see: https://justine.lol/cosmopolitan/functions.html
32 lines
1.6 KiB
C
32 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)
|
|
|
|
void *__termios2host(union metatermios *, const struct termios *);
|
|
|
|
#endif /* COSMOPOLITAN_LIBC_CALLS_TERMIOS_INTERNAL_H_ */
|