mirror of
https://github.com/ruby/ruby.git
synced 2025-09-17 17:43:59 +02:00
NetBSD build update. (#4079)
This commit is contained in:
parent
be1486568a
commit
739f9297c5
Notes:
git
2021-02-02 22:05:52 +09:00
Merged-By: nurse <naruse@airemix.jp>
1 changed files with 6 additions and 2 deletions
|
@ -2101,11 +2101,15 @@ fail:
|
||||||
* and returns strlen(binary_filename).
|
* and returns strlen(binary_filename).
|
||||||
* it is NUL terminated.
|
* it is NUL terminated.
|
||||||
*/
|
*/
|
||||||
#if defined(__linux__)
|
#if defined(__linux__) || defined(__NetBSD__)
|
||||||
static ssize_t
|
static ssize_t
|
||||||
main_exe_path(void)
|
main_exe_path(void)
|
||||||
{
|
{
|
||||||
|
# if defined(__linux__)
|
||||||
# define PROC_SELF_EXE "/proc/self/exe"
|
# define PROC_SELF_EXE "/proc/self/exe"
|
||||||
|
# elif defined(__NetBSD__)
|
||||||
|
# define PROC_SELF_EXE "/proc/curproc/exe"
|
||||||
|
# endif
|
||||||
ssize_t len = readlink(PROC_SELF_EXE, binary_filename, PATH_MAX);
|
ssize_t len = readlink(PROC_SELF_EXE, binary_filename, PATH_MAX);
|
||||||
if (len < 0) return 0;
|
if (len < 0) return 0;
|
||||||
binary_filename[len] = 0;
|
binary_filename[len] = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue