RFR: 8229872: (fs) Increase buffer size used with getmntent

Alan Bateman Alan.Bateman at oracle.com
Wed Sep 11 19:42:34 UTC 2019


On 11/09/2019 12:27, Vladimir Kempik wrote:
> Hello
>
> Please take a look at v9 of webrev 
> http://cr.openjdk.java.net/~vkempik/8229872/webrev.09/
>
> changes:
>  - getlinelen returns int and all linelens in java are ints now
>  - integer overflow check at the end of getlinelen
>  - getmntent_r now uses nativebuffer instead of malloc/free
>
The getmnent method doesn't look right, this is what you want:

static int getmntent(long fp, UnixMountEntry entry, buflen) throws 
UnixException {
     NativeBuffer buffer = NativeBuffers.getNativeBuffer(buflen);
     try {
         return getmntent0(fp, UnixMountEntry, buffer.address(), buflen);
     } finally {
         buffer.release();
     }
}

This will simplify getMountEntries as you will call it with 
getmntent(fp, entry, maxLineSize+1).

-Alan




More information about the nio-dev mailing list