8218547: Simplify JLI_Open on Windows in native code (libjli) - was : RE: RFR : 8217093: Support extended-length paths in parse_manifest.c on windows

Baesken, Matthias matthias.baesken at sap.com
Thu Mar 21 13:29:34 UTC 2019


Hi Alan + Christoph,   coming back to    https://bugs.openjdk.java.net/browse/JDK-8218547  .

We wanted to check  for  the whole flow   (in JLI_Open  on Windows ) , e.g. checking whether only CreateFileW can be used instead of open.

I think  there is already  a similar solution available in the codebase .

See  the   os::open  +  create_unc_path   functions   in os_windows.cpp   in the hotspot coding .

There  "simple"  open  is used  for shorter  paths  ( <  MAX_PATH) ;  for larger  paths  an elp / unc path is  constructed and _wopen is used on the   elp/unc path :


  if (strlen(path) < MAX_PATH) {
    ret = ::open(pathbuf, oflag | O_BINARY | O_NOINHERIT, mode);
  } else {
    errno_t err = ERROR_SUCCESS;
    wchar_t* wpath = create_unc_path(pathbuf, err);
     ....
    ret = ::_wopen(wpath, oflag | O_BINARY | O_NOINHERIT, mode);


I think we should  do it the same way in JLI_Open .  Is that fine with you?
Unfortunately I think  we  cannot  easily  reuse  the HS coding, so the have to take it over to  jli .

Best regards, Matthias



> -----Original Message-----
> From: Baesken, Matthias
> Sent: Mittwoch, 6. Februar 2019 09:56
> To: Langer, Christoph <christoph.langer at sap.com>
> Cc: Chris Hegarty <chris.hegarty at oracle.com>; core-libs-
> dev at openjdk.java.net; Alan Bateman (Alan.Bateman at oracle.com)
> <Alan.Bateman at oracle.com>
> Subject: RE: RFR : 8217093: Support extended-length paths in
> parse_manifest.c on windows
> 
> Hi  Christoph+Alan,  I opened
> 
> 
> https://bugs.openjdk.java.net/browse/JDK-8218547
> 
> JDK-8218547  :  use CreateFile without open on Windows in jdk native code
> 
> 
> To check for  the usage of  CreateFile  (CreateFileW)   without open .
> 
> 
> Best regards, Matthias
> 
> 
> > -----Original Message-----
> > From: Langer, Christoph
> > Sent: Dienstag, 29. Januar 2019 09:59
> > To: Baesken, Matthias <matthias.baesken at sap.com>
> > Cc: Chris Hegarty <chris.hegarty at oracle.com>; core-libs-
> > dev at openjdk.java.net
> > Subject: RE: RFR : 8217093: Support extended-length paths in
> > parse_manifest.c on windows
> >
> > Hi Matthias,
> >
> > > > New webrev :
> > > >
> > > >
> > > > http://cr.openjdk.java.net/~mbaesken/webrevs/8217093.4/
> > >
> > > This is the one. Looks good ( and clean ).
> >
> > I agree, this version would be ok for me to be pushed. It would be good
> > ,though, if there was a test for this (long paths on Windows).
> >
> > I also like Alan's suggestion to open a follow up bug to explore using
> > CreateFile on Windows right away rather than trying open. Looking at
> > libjava/libnet/libnio, it's all CreateFileW on Windows...
> >
> > Best regards
> > Christoph
> >



More information about the core-libs-dev mailing list