AttachListener bsd differences
David Holmes
david.holmes at oracle.com
Tue Mar 5 05:38:06 UTC 2024
Hi Sonia,
Adding serviceability and Alan Bateman ...
On 5/03/2024 2:35 am, Sonia Zaldana Calles wrote:
> Hi folks,
>
>
> I’m working on JDK-8324683 [0].
>
>
> I’m hoping to unify the code for attachListener_<os>.cpp for posix
> platforms.
>
>
> While reviewing linux against bsd, I noted a difference in
> AttachListener::is_init_trigger().
>
>
> Both linux and AIX implementations, first try “<current
> dir>/.attach<pid>” and failing that, attempt “/tmp/.attach<pid>”. [1][2]
>
>
> On the other hand, bsd doesn’t attempt “/tmp/.attach<pid>” [3].
I think you meant it doesn't attempt <current dir>/.attach<pid>
>
> I have been trying to do a bit of digging to see if this disparity was
> intentional but I have found that this change precedes the MacOS port,
> so I’m having trouble coming to a conclusion.
Looking at the history here:
https://hg.openjdk.org/macosx-port/macosx-port/hotspot/log/407770c31c18/src/os/bsd/vm/attachListener_bsd.cpp
The very first load of the file did check the current directory too:
https://hg.openjdk.org/macosx-port/macosx-port/hotspot/rev/be94a5de4d32
but that was removed in the very next upload (though they never fixed
the comment preceding the code):
https://hg.openjdk.org/macosx-port/macosx-port/hotspot/rev/9f1dd0b1d28c
To know why you would have to ask the person that did it I'm afraid.
> I was wondering if perhaps anyone on this list could shed some light on
> this matter and whether it would be acceptable to do the alternate path
> on BSD too.
The init trigger mechanism was added by Alan under:
https://bugs.openjdk.org/browse/JDK-6272307
I get the sense that having the well-known file in the working directory
was actually a bit of an anachronism. That may be why the macOS folk
didn't bother with it (speculation on my part). AIX simply copied the
Linux code.
Whether it would be okay/harmless/safe to have macOS/BSD also check
there I really can't say. I'm not sure if we have code that would ever
write the file to the target cwd these days? Hopefully Alan or current
serviceability folk can say more.
Cheers,
David
-----
>
> Thanks for your help,
>
> Sonia
>
>
>
> [0] https://bugs.openjdk.org/browse/JDK-8324683
> <https://bugs.openjdk.org/browse/JDK-8324683>
>
> [1]
> https://github.com/openjdk/jdk/blob/master/src/hotspot/os/linux/attachListener_linux.cpp#L521C3-L529C4 <https://github.com/openjdk/jdk/blob/master/src/hotspot/os/linux/attachListener_linux.cpp#L521C3-L529C4>
>
> [2]
> https://github.com/openjdk/jdk/blob/master/src/hotspot/os/aix/attachListener_aix.cpp#L551C2-L559C4 <https://github.com/openjdk/jdk/blob/master/src/hotspot/os/aix/attachListener_aix.cpp#L551C2-L559C4>
>
> [3]
> https://github.com/openjdk/jdk/blob/master/src/hotspot/os/bsd/attachListener_bsd.cpp#L520C2-L522C4 <https://github.com/openjdk/jdk/blob/master/src/hotspot/os/bsd/attachListener_bsd.cpp#L520C2-L522C4>
>
> --
> Sonia Zaldaña Calles
> Software Engineer, OpenJDK
> Red Hat
More information about the hotspot-runtime-dev
mailing list