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

Vladimir Kempik vkempik at azul.com
Fri Aug 23 14:41:30 UTC 2019


Hello

please review v3 version of patch

http://cr.openjdk.java.net/~vkempik/8229872/webrev.03/ <http://cr.openjdk.java.net/~vkempik/8229872/webrev.03/>

no locks required now
getline is used in reduced form, to only return linelen, nice comment about that in code included:

+/*
+    getline wants malloc-ed buffer on input, which it might free.
+    Can't let getline to free java allocated array,
+    so can't pass anything on buffer input except NULL,
+    in this case getline will allocate the buffer and return it.
+*/
Thanks, Vladimir

> 21 авг. 2019 г., в 8:39, Alan Bateman <Alan.Bateman at oracle.com> написал(а):
> 
> On 20/08/2019 20:31, Vladimir Kempik wrote:
>> Hello
>> 
>> after reading manpage for getline I think I have found some elegant solution - to let getline manage size of buffer.
>> 
>> Please review v2 of patch here http://cr.openjdk.java.net/~vkempik/8229872/webrev.02/
>> 
>> I’m still worried about syncing maxlinelen and linebuffer between Java_sun_nio_fs_LinuxNativeDispatcher_setmntent0 and Java_sun_nio_fs_LinuxNativeDispatcher_getmntent, if they are run from different threads.
>> 
> Finding the longest line to size the buffer seems a good approach to try. The way to do that is to add a getline and rewind to UnixNativeDispatcher and augment LinuxNativeDispatcher.getmntent to take a buffer size. Once you have those primitives then you can use them in LinuxFileStore.getMountEntries.
> 
> -Alan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20190823/0f5896ca/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20190823/0f5896ca/signature.asc>


More information about the nio-dev mailing list