Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/hotspot/os/posix/include/jvm_md.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
// cause problems if JVM and the rest of JDK are built on different
// Linux releases. Here we define JVM_MAXPATHLEN to be MAXPATHLEN + 1,
// so buffers declared in VM are always >= 4096.
#define JVM_MAXPATHLEN MAXPATHLEN + 1
#define JVM_MAXPATHLEN (MAXPATHLEN + 1)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per the comment immediately preceeding the definition, JVM_MAXPATHLEN exists
to support "JVM and the rest of JDK are built on different Linux releases". We
used to have the JVM and the rest of the JDK separable, and could use
(somewhat) different versions of them together. But that model was elminated
years ago.

All uses of JVM_MAXPATHLEN are in HotSpot. (There are also
unused definitions of that name in
jdk.hotspot.agent/share/native/libsaproc/sadis.c.)

Looking around, there are many uses of MAXPATHLEN in HotSpot. If we really
need JVM_MAXPATHLEN, how sure are we that all of those uses of MAXPATHLEN are
okay?

So maybe it would be better to just remove JVM_MAXPATHLEN and use MAXPATHLEN
everywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for finding that, I was also unsure whether or not the comment above was still valid today. I agree that if JVM_MAXPATHLEN is actually unneeded it can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After further inspection, MAXPATHLEN seems to only be used within the hotspot/os directory and other areas in Hotspot rely on JVM_MAXPATHLEN. Tampering with this could cause some issues since the value of JVM_MAXPATHLEN varies between platforms and does not necessarily rely on MAXPATHLEN. The simple fix in this PR is sufficient.

#endif

#define JVM_R_OK R_OK
Expand Down