GNU/Hurd build fixes#1092
Conversation
malloc_usable_size() is a GNU extension in GNU libc; hence, use it every time GNU libc is used, rather than only on Linux. Cherry-pick of bellard/quickjs@3489493.
Strictly speaking, they are available in POSIX.1-2008 [1][2], so they could be used on more platforms/OSes. To be cautious, enable them when using GNU libc, since they have been available with that libc for a very long time. Cherry-pick of bellard/quickjs@8624b5c. [1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/ftell.html [2] https://pubs.opengroup.org/onlinepubs/9699919799/functions/fseek.html
PATH_MAX is optional in POSIX, and it is not available on GNU/Hurd. There is already a fallback definition called JS__PATH_MAX, so switch all the common code (i.e. not the bits specific to a certain OS) to use it.
There is a Linux-like procfs that provides /proc/self/exe, so use the Linux implementation of js_exepath() also on GNU/Hurd.
This makes it possible to detect quickjs is running on GNU/Hurd.
saghul
left a comment
There was a problem hiding this comment.
These changes will break musl. I suggest chaging #if defined(__linux__) || defined(__GLIBC__) to #if defined(__linux__) && !defined(__GNU__)
Not sure why they would.
This is exactly the opposite of what is needed for GNU/Hurd. The current Linux paths for |
saghul
left a comment
There was a problem hiding this comment.
Sorry for the noise, I misread the code! LGTM!
This PR fixes the build of quickjs on GNU/Hurd:
malloc_usable_size()when using glibcftello()&fseeko()when using glibc (they could be used more, I took a conservative approach)JS__PATH_MAXinstead ofPATH_MAXin common codeos.exePathos.platformashurdSee the messages of the various commits for longer explanations.
A couple of changes are cherry-picked (with the needed changes) from bellard/quickjs#316.