Re: Question about libjava/childproc.c

2018-09-11 Thread Thomas Stüfe
Hi Martin, Alan, On Sun, Sep 9, 2018 at 2:34 AM, Martin Buchholz wrote: > > > On Wed, Sep 5, 2018 at 11:43 AM, Thomas Stüfe > wrote: >> >> On Wed, Sep 5, 2018 at 6:43 PM, Martin Buchholz >> wrote: >> >> > So before the readdir loop we should set errno to 0. Then when readdir >> > returns NULL,

Re: Question about libjava/childproc.c

2018-09-09 Thread Martin Buchholz
On Sun, Sep 9, 2018 at 1:04 AM, Alan Bateman wrote: > On 09/09/2018 01:34, Martin Buchholz wrote: > > : > > See discussion in src/java.base/unix/native/libjava/ProcessImpl_md.c > > >> Later Oracle introduced something very similar with the jspawnhelper. >> But I see that jspawnhelper is not used

Re: Question about libjava/childproc.c

2018-09-09 Thread Alan Bateman
On 09/09/2018 01:34, Martin Buchholz wrote: : See discussion in src/java.base/unix/native/libjava/ProcessImpl_md.c Later Oracle introduced something very similar with the jspawnhelper. But I see that jspawnhelper is not used at all for the vfork() case, just for posix_spawn(), yes?

Re: Question about libjava/childproc.c

2018-09-08 Thread Martin Buchholz
On Wed, Sep 5, 2018 at 11:43 AM, Thomas Stüfe wrote: > On Wed, Sep 5, 2018 at 6:43 PM, Martin Buchholz > wrote: > > > So before the readdir loop we should set errno to 0. Then when readdir > > returns NULL, we should check whether errno is non-zero. > > > > Note that if we fix this, we may run

Re: Question about libjava/childproc.c

2018-09-05 Thread Thomas Stüfe
On Wed, Sep 5, 2018 at 6:43 PM, Martin Buchholz wrote: > > > On Wed, Sep 5, 2018 at 9:23 AM, Thomas Stüfe > wrote: >> >> >> Since all this happens between vfork and exec we cannot do any decent >> error handling here. Even what little we do is way outside the allowed >> spec for vfork(). > > > We

Re: Question about libjava/childproc.c

2018-09-05 Thread Martin Buchholz
On Wed, Sep 5, 2018 at 9:23 AM, Thomas Stüfe wrote: > > Since all this happens between vfork and exec we cannot do any decent > error handling here. Even what little we do is way outside the allowed > spec for vfork(). > Well we do have a fallback if closeDescriptors fails. But on closer inspec

Re: Question about libjava/childproc.c

2018-09-05 Thread Thomas Stüfe
On Wed, Sep 5, 2018 at 6:16 PM, Martin Buchholz wrote: > Alan: Thomas seems to be suggesting setting the FD_CLOEXEC flag after fork > but before exec, which is a slightly different idea. > > Thomas: This is an interesting idea. Historically the usual strategy was to > close all the file descripto

Re: Question about libjava/childproc.c

2018-09-05 Thread Martin Buchholz
Alan: Thomas seems to be suggesting setting the FD_CLOEXEC flag after fork but before exec, which is a slightly different idea. Thomas: This is an interesting idea. Historically the usual strategy was to close all the file descriptors explicitly, perhaps before FD_CLOEXEC was something we could r

Re: Question about libjava/childproc.c

2018-09-05 Thread Thomas Stüfe
Hi Alan, On Wed, Sep 5, 2018 at 6:06 PM, Alan Bateman wrote: > On 05/09/2018 16:45, Thomas Stüfe wrote: >> >> : >> >> My question would be, could we not - instead of straight away closing >> the file descriptor - set them all to FD_CLOEXEC instead? >> > This comes up periodically but even if we d

Re: Question about libjava/childproc.c

2018-09-05 Thread Alan Bateman
On 05/09/2018 16:45, Thomas Stüfe wrote: : My question would be, could we not - instead of straight away closing the file descriptor - set them all to FD_CLOEXEC instead? This comes up periodically but even if we do that then we still need this code to catch the places where FD_CLOEXEC isn't s

Question about libjava/childproc.c

2018-09-05 Thread Thomas Stüfe
Hi all, I just saw that in childproc.c, between fork and exec, in the child process, we attempt to close all file descriptors. Which is fine and good practice. See function "closeDecriptors()" in libjava/childproc.c. That function attempts to read /proc/fd to get all open file descriptors and th