On Thu, Aug 13, 2020 at 08:02:59PM -0700, Bart Van Assche wrote: > On 2020-08-08 16:16, Magnus Fromreide wrote: > > That file is a mess. > > > > Have anyone heard from Alexander Prömel regarding those temporary hard coded > > pathnames that should be fixed soon? I think 14 years cover any reasonable > > definition of the word 'soon'. > > > > Why are both the file descriptor and the FILE* stored in the first place? > > It seems the read part of the code is using buffered I/O (fIn) while the > > write part of the code is using unbuffered I/O (fdOut) so I think fdIn and > > fOut should be removed completley. > > I propose to delete the uClinux code from agent/mibgroup/util_funcs.c. > get_exec_pipes() is only used to open persistent pipes. So it is essential > to use fork(). Using vfork() in the implementation of get_exec_pipes() is > wrong because vfork() blocks the caller until the child process has > finished.
The vfork child only blocks the parent until it have performed an successful exec so that part looks ok but the fifo setup in the uClinux part looks very magical, the only way I can see that code working is if /flash/cp_<pid> and /flash/pc_<pid> somehow refer to the child processes stdin and stdout, and even then it gives me an uneasy feeling of there beeing a race condition. It is also worth noting that the argument splitting is missign from the uClinux parts. Given this I would agree with getting rid of the uClinux parts in get_exec_pipes and pass_persist. I suppose we should issue a deprecation notice on the -annonce list rather soon even if I don't expect that anyone interested will read it. If we decide to try to support pass_persist on uClinux in the future then I think the right way forward would be to mark all internal file descriptors as CLOEXEC and use posix_spawn. /MF _______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders