From f73ca2304e8762f9510020cedbc301b60b21d8f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Haoran=20S=2E=20Diao=20=28=E5=88=81=E6=B5=A9=E7=84=B6=29?= <0@hairydiode.xyz> Date: Fri, 12 Sep 2025 02:08:50 -0700 Subject: Made pty and stdin reads blocking again for massive performance boost --- ptyim.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'ptyim.c') diff --git a/ptyim.c b/ptyim.c index daf64b7..f4e7c17 100644 --- a/ptyim.c +++ b/ptyim.c @@ -10,6 +10,7 @@ #include #include #include +#include #include "im.h" #define WRITE_BUFFER_LEN 128 //determines if the master process is running @@ -50,8 +51,6 @@ int make_pty() { fprintf(stderr, "errno: %d, failed to create pty master", errno); return errno; } - //make the master pty nonblocking - fcntl(pty_master, F_SETFL,O_NONBLOCK); //unlock the slave pty if ( unlockpt(pty_master) <0) { fprintf(stderr, "errno: %d, failed to unlock pty slave", errno); @@ -72,7 +71,7 @@ int make_pty() { tcsetattr(pty_slave,TCSANOW,&stdin_termio_bk); return 0; } -//makes stdin raw and unblocking, previous state stored in global var +//makes stdin raw previous state stored in global var //stdin_termio_bk void condition_stdin() { struct termios stdin_termio; @@ -82,8 +81,6 @@ void condition_stdin() { //make it raw cfmakeraw(&stdin_termio); tcsetattr(STDIN_FILENO,TCSANOW,&stdin_termio); - //make it nonblocking - fcntl(STDIN_FILENO, F_SETFL,O_NONBLOCK); } void restore_stdin() { tcsetattr(STDIN_FILENO,TCSANOW,&stdin_termio_bk); -- cgit v1.1