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

Vladimir Kempik vkempik at azul.com
Wed Sep 4 15:56:01 UTC 2019


Hello
After thinking about it, I think it’s better to leave getlinelen as is, and just increase maxLineSize by one in getMountEntries.

here is webrev: http://cr.openjdk.java.net/~vkempik/8229872/webrev.07/

THanks, Vladimir

4 сент. 2019 г., в 18:47, Vladimir Kempik <vkempik at azul.com<mailto:vkempik at azul.com>> написал(а):

I see.
I have dumped both lineSize and res within getlinelen, here is result:

linesize = 120, res = 53
linesize = 120, res = 52
linesize = 120, res = 83
linesize = 120, res = 81
linesize = 120, res = 69
linesize = 120, res = 82
linesize = 120, res = 79
linesize = 120, res = 41
linesize = 120, res = 69
linesize = 120, res = 63
linesize = 240, res = 141
linesize = 120, res = 65
linesize = 120, res = 75
linesize = 120, res = 81
linesize = 120, res = 81
linesize = 120, res = 99
linesize = 120, res = 77
linesize = 120, res = 75
linesize = 120, res = 89
linesize = 120, res = 87
linesize = 120, res = 79
linesize = 120, res = 81
linesize = 120, res = 79
linesize = 240, res = 125
linesize = 120, res = 57
linesize = 120, res = 50
linesize = 120, res = 42
linesize = 120, res = 63
linesize = 120, res = 53
linesize = 120, res = 37
linesize = 120, res = 96
linesize = 120, res = 103
linesize = 120, res = 105
linesize = 1318, res = 1317
linesize = 240, res = 154
linesize = 120, res = 48
linesize = 120, res = -1

What is better to return, lineSize or res+1 ?
Thanks, Vladimir
P.S. currently returning just res seems to works fine.

4 сент. 2019 г., в 18:38, Alan Bateman <Alan.Bateman at oracle.com<mailto:Alan.Bateman at oracle.com>> написал(а):



On 04/09/2019 15:52, Vladimir Kempik wrote:
:
Its no issue since newline character counted, and getmntent_r is looking for newline character. Every line in /proc/mounts ends with newline character.
from man getline:
      getline()  reads an entire line from stream, storing the address of the
      buffer containing the text into *lineptr.  The  buffer  is  null-termi‐
      nated and includes the newline character, if one was found.
It's the return value that I was wondering about as that it's the number of bytes written excluding the NUL.


Have you considered using fseek instead of rewind to avoid the uncertainty as to whether errno is set?
it seems fseek vs rewind&ferror is : with fseek we will know errno while with rewind&ferror we will know the error happened but no errno.

do you thinks its better to introduce fseek (but how do I specify SEEK_SET in java then, some enum?) or just rewrite native part of rewind to actually use fseek?

My only reason for asking is that you've got a FIXME in the comment to say that rewind doesn't specify how it reports errors. I checked the man page on macOS and it does. I also see Florian's mails to say that we don't need to worry about it.

-Alan


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20190904/72590069/attachment-0001.html>


More information about the nio-dev mailing list