Download raw body.
gotwebd: get rid of proc.[ch]
On 2023/11/15 19:46:57 +0100, Omar Polo <op@omarpolo.com> wrote: > On 2023/11/15 18:42:14 +0100, Omar Polo <op@omarpolo.com> wrote: > > proc.c really shines when there's a net of different kinds of processes > > with potentially many instances that needs to talk. gotwebd instead is > > just a main process for the privileged operations plus a bunch of > > unpriviled workers. > > > > using proc.c here only really caused some headaces, so here's a proposal > > to remove it. it needs some testing, but some preliminary testing > > locally promises good :) > > > > There's something regarding the verbose logging that I still need to > > figure out exactly, but otherwise seems to be working just as before. > > Found it. The logging handling in the child was wrong, plus in > log_debug() we log only if verbose > 1. Now, we don't do anything > special for the case verbose == 1 so I just 'lowered' log_debug() to one > -v. > > > There are now two main routines that I expect will be used to send > > messages: > > > > - main_compose_sockets(): send an imsg (with optional fd) to the > > sockets processes. The file descriptor is dup'ed as needed. > > This alone semplifies most of the loops in config.c > > > > - sockets_compose_main(): to send messages the other ways. > > > > There is no iov variant since we don't need them so far, will be easy to > > add eventually. > > > > The imsgev structs now live in the main gotwebd struct. The parent > > allocates enough entries for the children it needs to run, while each > > child only initialize one to talk with the parent. > > > > Maybe my hands slipped and there's more fixing that strictly needed... Another small difference with proc.c is that I'm not calling setsid() anymore, so for e.g. ctrl-c gets delivered to all processes and not only to the parent. No big reasoning behind it, while writing spawn_socket_process() I just thought it wasn't strictly needed and skipped it. Yet, feels like something I should have pointed out. > > I've omitted `got rm proc.[ch]' to keep the diff short, but I intend to > > do so before committing. > > updated diff, this includes the fix to the daemon() call too.
gotwebd: get rid of proc.[ch]