On Tue, 16 Apr 2024 18:10:08 GMT, Thomas Stuefe <stu...@openjdk.org> wrote:

>> src/hotspot/os/linux/cgroupSubsystem_linux.cpp line 351:
>> 
>>> 349:     //
>>> 350:     // We collect the read only mount option in the cgroup infos so as 
>>> to have that
>>> 351:     // info ready when determining is_containerized().
>> 
>> Here, and in other places: a comment indicating the line format we scan 
>> would be appreciated, possibly with argument numbers. Saves the casual code 
>> reader from looking into proc man page. Even just pasting the example line 
>> for proc manpage would be fine 
>> (https://man7.org/linux/man-pages/man5/proc.5.html) (but with order adapted 
>> to your scanf call, they count major:minor as one)
>
> Trying to parse the `%s%*[^-]-`
> 
> So, %s parses the mount options, until we encounter whitespace. Then %*[^-]- 
> parses everything that is not a dash, until we encounter the dash? Then we 
> eat the dash? This is to skip the optionals?

Correct. Note that `%s %*[^-]` doesn't work for files without optionals. Since 
`%*[^-]` requires a non-empty match and the optionals are, well, optional :-) 
I've added more verbose comments to clarify this.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/18201#discussion_r1589390841

Reply via email to