[crac] RFR: 8353243: [CRaC] Show all options in engine help [v2]
Radim Vansa
rvansa at openjdk.org
Mon Apr 7 11:58:09 UTC 2025
On Mon, 7 Apr 2025 11:20:48 GMT, Timofei Pushkin <tpushkin at openjdk.org> wrote:
> Yes, but just library_path is not enough, engine executable does not always come from there sines the user can provide an arbitrary absolute path. In the first version of the API crexec ended up using args instead of library_path for this.
...
> would be better to rename it to `engine_location`
In the current impl it is telling the `lib` path within JDK installation location, rather than location of the engine (shared library). Anyway this doesn't have to be exhaustive: there might be other option (JVM wouldn't know about) to hint about some other path.
> I've never tried to get a file address of a shared library from within itself but after some googling it doesn't seem too complicated (for a not so commonly needed thing).
Looking into this again I see that it is actually quite simple using `dladdr`. I am not sure why I have resorted to reading `/proc/self/maps` in some of my code... However, if the engine is set using absolute path outside JVM it might be problematic to get the JVM path (`JAVA_HOME` not being set...).
> We could pass exec_location to all engines that accept it ... but I am not sure how useful this would be to other engines
I might have focused too much on this being "handy", but my main objective was to not have any code in JVM that would treat different engines differently.
Btw. there's third option: we could use the `dladdr/GetModuleFileName` in `crexec` and drop `exec_location` completely.
-------------
PR Review Comment: https://git.openjdk.org/crac/pull/220#discussion_r2031081534
More information about the crac-dev
mailing list