Hi Davide, > I have encountered a strange behavior while running some pipes (the number > of "do" iterations may require some adjustment to trigger the effect): > (do 10000 (pipe (prin "A string") (make (while (rd 1) (link @))))) > > The execution stops with an error like this (the actual number may vary) > ? 1345 FD too high > > In Termux this happened with something as low as 300. Note also that in > Termux I have a pretty high number of files that can be open at the same > time (~65K). > > I would expect that the file descriptors are closed after the pipe > execution.
This is correct, but it takes a while. After the pipe'd child process terminated, the Linux kernel sends a SIGCHLD signal to the parent process, which then does a waitpid() system call in the signal handler. So it is necessary not to create too many child processes at the same time. The above should work if you add a short delay, e.g. (do 10000 (pipe (prin "A string") (make (while (rd 1) (link @))) ) (wait 10) ) ☺/ A!ex -- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe