RFR: 8238161: use os::fopen in HS code where possible
Baesken, Matthias
matthias.baesken at sap.com
Mon Feb 3 12:35:19 UTC 2020
Hi David, from what I understand it should behave in the same way it does when a file descriptor to a "normal" file is opened .
At least checking for the FD_CLOEXEC flag for such an fd works as expected
/* check that O_CLOEXEC works */
int fd = open64("/proc/cpuinfo", O_CLOEXEC, 0444);
int flags;
flags = ::fcntl(fd, F_GETFD);
if (flags != -1) {
if ((flags & FD_CLOEXEC) != 0) {
printf("setting O_CLOEXEC with open seems to work.\n");
} else {
printf("PROBLEM setting O_CLOEXEC with open !\n");
}
}
... outputs : "setting O_CLOEXEC with open seems to work."
Best regards, Matthias
> Hi Matthias,
>
> Does close-on-exec have any meaning when applied to /proc filesystem ??
>
> Thanks,
> David
>
> On 31/01/2020 1:47 am, Baesken, Matthias wrote:
> > Please review this change which adjusts a number of calls (in HS code)
> from using fopen to os::fopen .
> >
> > There exists for some time a function os::fopen in HS code . This function
> sets "close-on-exec" flags (when possible) to the opened filedescriptor.
> > It might have some benefits to use os::fopen more in HS code, currently
> there are still quite a few calls directly to fopen .
> > (however there are also already a number of calls to os::fopen e.g. some
> calls in os_linux.cpp /os_solaris.cpp should already look up os::fopen , and
> logFileOutput.cpp uses os::fopen directly )
> >
> >
> > see also the thread
> > https://mail.openjdk.java.net/pipermail/hotspot-dev/2020-
> January/040641.html
> > on hotspot-dev about the topic.
> >
> >
> >
> > Bug/webrev :
> >
> > https://bugs.openjdk.java.net/browse/JDK-8238161
> >
> > http://cr.openjdk.java.net/~mbaesken/webrevs/8238161.0/
> >
> >
> > Thanks, Matthias
> >
More information about the hotspot-dev
mailing list