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

Vladimir Kempik vkempik at azul.com
Fri Aug 23 15:18:49 UTC 2019


Hello

I’m not sure about full version of getline.
getline requires malloced buffer and  may update passed in buffer to a new size (via realloc) so it’s not safe to pass anything from java, (even NativeBuffer i think) to it.
two ways to work it around:
1) minimal version of getline, like I did
2) in jni, allocate new, malloced buffer with same size as incoming buffer. pass it to getline. after getline finished, update incoming buffer with proper data (and increase it if needed). will still need malloc/free

Alan, you really sure you want  it to go second path while there is no consumer of full version of getline ?

Thanks, Vladimir

> 23 авг. 2019 г., в 18:06, Florian Weimer <fweimer at redhat.com> написал(а):
> 
> * Alan Bateman:
> 
>> Can you move rewind to UnixNativeDispatcher so that it's with the
>> other FILE* functions? I'm pretty sure you have to set errno to 0
>> before calling it and it will set it if there is an error.
> 
> You can check for errors using ferror.
> 
>> I think UnixNativeDispatcher should also define getline to wrap the
>> libc function rather that getlinelen.
> 
> That requires defining a new struct, for the internal state (buffer
> pointer and length).
> 
> Thanks,
> Florian



More information about the nio-dev mailing list