From: Ian Jackson Date: Fri, 19 Aug 2022 19:04:49 +0000 (+0100) Subject: prefork-interp: wip socketry etc. X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=33f4167282dc5b9716a23b9d957b955f220370d2;p=chiark-utils.git prefork-interp: wip socketry etc. Signed-off-by: Ian Jackson --- diff --git a/cprogs/prefork-interp.c b/cprogs/prefork-interp.c index 1125601..ec43bcf 100644 --- a/cprogs/prefork-interp.c +++ b/cprogs/prefork-interp.c @@ -404,7 +404,7 @@ void become_watcher(void) { uv_fs_event_t uvhandle_sockpath; int r; - if (fcntl(0, F_SETFL, O_NONBLOCK)) diee("watcher set stdin nonblocking"); + nonblock(0); errno= -uv_loop_init(&loop); if (errno) diee("watcher: uv_loop_init"); @@ -448,6 +448,8 @@ void become_setup(int sfd, int fake_pair[2], if (dup2(null_0, 0)) diee("dup2 /dev/null onto stdin"); if (dup2(2, 1) != 1) die("dup2 stderr onto stdout"); + nonblock(sfd); + // Extension could work like this: // // We advertise a new protocol (perhaps one which is nearly entirely @@ -518,8 +520,7 @@ static void connect_or_spawn(void) { close(watcher_stdin[0]); close(watcher_stderr[1]); - if (fcntl(watcher_stderr[0], F_SETFL, O_NONBLOCK)) - diee("parent set watcher stderr nonblocking"); + nonblock(watcher_stderr[0]); // Fork setup