summaryrefslogtreecommitdiff
path: root/ptyim.c
diff options
context:
space:
mode:
authorHaoran S. Diao (刁浩然) <0@hairydiode.xyz>2025-09-12 02:08:50 -0700
committerHaoran S. Diao (刁浩然) <0@hairydiode.xyz>2025-09-12 02:08:50 -0700
commitf73ca2304e8762f9510020cedbc301b60b21d8f3 (patch)
tree15dc6aa2501a4aa6220c2ac5668a7ad58faace92 /ptyim.c
parent5dc971ab6211946f8245dbaaa280aa0c8287e7b0 (diff)
Made pty and stdin reads blocking again for massive performance boost
Diffstat (limited to 'ptyim.c')
-rw-r--r--ptyim.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/ptyim.c b/ptyim.c
index daf64b7..f4e7c17 100644
--- a/ptyim.c
+++ b/ptyim.c
@@ -10,6 +10,7 @@
#include <termios.h>
#include <string.h>
#include <signal.h>
+#include <sys/prctl.h>
#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);