RFR: 8286212: Cgroup v1 initialization causes NPE on some systems [v3]

Severin Gehwolf sgehwolf at openjdk.java.net
Thu May 19 09:49:07 UTC 2022


On Thu, 19 May 2022 05:58:31 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> Severin Gehwolf has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - Refactor hotspot gtest
>>  - Separate into function. Fix comment.
>
> src/hotspot/os/linux/cgroupV1Subsystem_linux.cpp line 102:
> 
>> 100:   for (int i = 0; *s1 == *s2 && *s1 != 0; i++) {
>> 101:     if (*s1 == '/') {
>> 102:       last_matching_slash_pos = i;
> 
> I found the behavior a little hard to understand. Is it intentional?
> 
> 
> "/cat/cow", "/cat/dog"    -> "/cat/"
> "/cat/",    "/cat/dog"    -> "/cat/"
> "/cat",     "/cat/dog"    -> "/"
> 
> 
> The name `find_last_slash_pos` doesn't properly describe the behavior. I thought about `find_common_path_prefix`, but that doesn't match the current behavior (for the 3rd case, the common path prefix is `"/cat"`).

It's supposed to find the common path prefix as you say. I'll fix it. Open to suggestions to make it easier to understand.

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

PR: https://git.openjdk.java.net/jdk/pull/8629


More information about the core-libs-dev mailing list