Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix xm_engine_get_program_file for NetBSD #4508

Merged
merged 1 commit into from
Dec 16, 2023

Conversation

cmeerw
Copy link
Contributor

@cmeerw cmeerw commented Dec 15, 2023

NetBSD defines KERN_PROC_PATHNAME, but the sysctl (that should only be used for OpenBSD) doesn't work with NetBSD. Using /proc/curproc/exe works and is the preferred option.

@waruqi
Copy link
Member

waruqi commented Dec 15, 2023

It does not work for freebsd

@cmeerw
Copy link
Contributor Author

cmeerw commented Dec 15, 2023

It does not work for freebsd

#2948 seemed to suggest that sysctl with KERN_PROC_PATHNAME is only used for OpenBSD, but looks like it's also used for FreeBSD then

But that also means that /proc/curproc/file doesn't work on FreeBSD? So I guess we should set XM_PROC_SELF_FILE only on NetBSD then?

…e used

for FreeBSD and OpenBSD) doesn't work with NetBSD. Using /proc/curproc/exe
works and is the preferred option.
@cmeerw
Copy link
Contributor Author

cmeerw commented Dec 15, 2023

According to https://stackoverflow.com/questions/1023306/finding-current-executables-path-without-proc-self-exe/1024937#1024937 /proc/curproc/file is indeed problematic on FreeBSD, so that makes FreeBSD and OpenBSD for the sysctl option and NetBSD for /proc/curproc/exe' (with Dragonfly BSD for /proc/curproc/file`)

@waruqi waruqi merged commit 229d7c1 into xmake-io:dev Dec 16, 2023
19 checks passed
@waruqi
Copy link
Member

waruqi commented Dec 16, 2023

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants