mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-04 18:28:30 +00:00
Fix BSD regressions
The recent change to crt.S that aggressively aligns the system-provided
stack has been rolled back on non-Linux until we can find a better way,
since it can cause a segfault early in execution on several platforms.
This change fixes a regression in tcgetattr() and tcsetattr() on OpenBSD
and NetBSD caused by 4778cd4d27
.
This change has been tested across the runitd test fleet which is green.
This commit is contained in:
parent
5a77db2cd5
commit
053681cb97
9 changed files with 34 additions and 37 deletions
|
@ -34,7 +34,6 @@
|
|||
#define kNtPurgeRxabort 2
|
||||
|
||||
#define TCXONC 0x0000540A // linux
|
||||
#define TIOCGETA 0x40487413 // bsd
|
||||
#define TIOCSTOP 0x2000746f // bsd
|
||||
#define TIOCSTART 0x2000746e // bsd
|
||||
#define TIOCIXON 0x20007481 // xnu
|
||||
|
@ -52,7 +51,7 @@ static const char *DescribeFlow(char buf[12], int action) {
|
|||
static int sys_tcflow_bsd_write(int fd, int cc) {
|
||||
unsigned char c;
|
||||
struct termios_bsd term;
|
||||
if (sys_ioctl(fd, TIOCGETA, &term) == -1) {
|
||||
if (sys_ioctl(fd, TCGETS, &term) == -1) {
|
||||
return -1;
|
||||
}
|
||||
if ((c = term.c_cc[cc]) != _POSIX_VDISABLE &&
|
||||
|
|
|
@ -28,9 +28,6 @@
|
|||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/errfuns.h"
|
||||
|
||||
#define TCGETS 0x00005401 // linux
|
||||
#define TIOCGETA 0x40487413 // bsd
|
||||
|
||||
int tcgetattr_nt(int, struct termios *);
|
||||
|
||||
static int tcgetattr_metal(int fd, struct termios *tio) {
|
||||
|
@ -45,7 +42,7 @@ static int tcgetattr_metal(int fd, struct termios *tio) {
|
|||
static int tcgetattr_bsd(int fd, struct termios *tio) {
|
||||
int rc;
|
||||
union metatermios mt;
|
||||
if ((rc = sys_ioctl(fd, TIOCGETA, &mt)) != -1) {
|
||||
if ((rc = sys_ioctl(fd, TCGETS, &mt)) != -1) {
|
||||
if (IsXnu()) {
|
||||
COPY_TERMIOS(tio, &mt.xnu);
|
||||
} else {
|
||||
|
|
|
@ -31,13 +31,6 @@
|
|||
#include "libc/sysv/consts/termios.h"
|
||||
#include "libc/sysv/errfuns.h"
|
||||
|
||||
#define TCSETS 0x5402
|
||||
#define TCSETSW 0x5403
|
||||
#define TCSETSF 0x5404
|
||||
#define TIOCSETA 0x80487414
|
||||
#define TIOCSETAW 0x80487415
|
||||
#define TIOCSETAF 0x80487416
|
||||
|
||||
void __on_tcsetattr(int);
|
||||
int tcsetattr_nt(int, int, const struct termios *);
|
||||
|
||||
|
@ -80,8 +73,7 @@ static int tcsetattr_impl(int fd, int opt, const struct termios *tio) {
|
|||
|
||||
if (IsLinux() || IsBsd()) {
|
||||
union metatermios mt;
|
||||
return sys_ioctl(fd, (IsLinux() ? TCSETS : TIOCSETA) + opt,
|
||||
__termios2host(&mt, tio));
|
||||
return sys_ioctl(fd, TCSETS + opt, __termios2host(&mt, tio));
|
||||
}
|
||||
|
||||
return enosys();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue