exec_cmd: RUNTIME_PREFIX on z/OS systems
Enable Git to resolve its own binary location using __getprogramdir and getprogname. Since /proc is not a mandatory filesystem on z/OS, we cannot rely on the git_get_exec_path_procfs method to determine Git's executable path. To address this, we have implemented git_get_exec_path_zos, which resolves the executable path by extracting it from the current program's directory and filename. Signed-off-by: D Harithamma <harithamma.d@ibm.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
3a7362eb9f
commit
987bbcd088
8
Makefile
8
Makefile
|
@ -385,6 +385,10 @@ include shared.mak
|
||||||
# supports calling _NSGetExecutablePath to retrieve the path of the running
|
# supports calling _NSGetExecutablePath to retrieve the path of the running
|
||||||
# executable.
|
# executable.
|
||||||
#
|
#
|
||||||
|
# When using RUNTIME_PREFIX, define HAVE_ZOS_GET_EXECUTABLE_PATH if your platform
|
||||||
|
# supports calling __getprogramdir and getprogname to retrieve the path of the
|
||||||
|
# running executable.
|
||||||
|
#
|
||||||
# When using RUNTIME_PREFIX, define HAVE_WPGMPTR if your platform offers
|
# When using RUNTIME_PREFIX, define HAVE_WPGMPTR if your platform offers
|
||||||
# the global variable _wpgmptr containing the absolute path of the current
|
# the global variable _wpgmptr containing the absolute path of the current
|
||||||
# executable (this is the case on Windows).
|
# executable (this is the case on Windows).
|
||||||
|
@ -2155,6 +2159,10 @@ ifdef HAVE_NS_GET_EXECUTABLE_PATH
|
||||||
BASIC_CFLAGS += -DHAVE_NS_GET_EXECUTABLE_PATH
|
BASIC_CFLAGS += -DHAVE_NS_GET_EXECUTABLE_PATH
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifdef HAVE_ZOS_GET_EXECUTABLE_PATH
|
||||||
|
BASIC_CFLAGS += -DHAVE_ZOS_GET_EXECUTABLE_PATH
|
||||||
|
endif
|
||||||
|
|
||||||
ifdef HAVE_WPGMPTR
|
ifdef HAVE_WPGMPTR
|
||||||
BASIC_CFLAGS += -DHAVE_WPGMPTR
|
BASIC_CFLAGS += -DHAVE_WPGMPTR
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -648,6 +648,7 @@ ifeq ($(uname_S),OS/390)
|
||||||
NO_GECOS_IN_PWENT = YesPlease
|
NO_GECOS_IN_PWENT = YesPlease
|
||||||
HAVE_STRINGS_H = YesPlease
|
HAVE_STRINGS_H = YesPlease
|
||||||
NEEDS_MODE_TRANSLATION = YesPlease
|
NEEDS_MODE_TRANSLATION = YesPlease
|
||||||
|
HAVE_ZOS_GET_EXECUTABLE_PATH = YesPlease
|
||||||
endif
|
endif
|
||||||
ifeq ($(uname_S),MINGW)
|
ifeq ($(uname_S),MINGW)
|
||||||
ifeq ($(shell expr "$(uname_R)" : '1\.'),2)
|
ifeq ($(shell expr "$(uname_R)" : '1\.'),2)
|
||||||
|
|
23
exec-cmd.c
23
exec-cmd.c
|
@ -150,6 +150,25 @@ static int git_get_exec_path_darwin(struct strbuf *buf)
|
||||||
}
|
}
|
||||||
#endif /* HAVE_NS_GET_EXECUTABLE_PATH */
|
#endif /* HAVE_NS_GET_EXECUTABLE_PATH */
|
||||||
|
|
||||||
|
#ifdef HAVE_ZOS_GET_EXECUTABLE_PATH
|
||||||
|
/*
|
||||||
|
* Resolves the executable path from current program's directory and name.
|
||||||
|
*
|
||||||
|
* Returns 0 on success, -1 on failure.
|
||||||
|
*/
|
||||||
|
static int git_get_exec_path_zos(struct strbuf *buf)
|
||||||
|
{
|
||||||
|
char *dir = __getprogramdir();
|
||||||
|
char *exe = getprogname();
|
||||||
|
if (dir && exe) {
|
||||||
|
strbuf_addf(buf, "%s/%s", dir, exe);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* HAVE_ZOS_GET_EXECUTABLE_PATH */
|
||||||
|
|
||||||
#ifdef HAVE_WPGMPTR
|
#ifdef HAVE_WPGMPTR
|
||||||
/*
|
/*
|
||||||
* Resolves the executable path by using the global variable _wpgmptr.
|
* Resolves the executable path by using the global variable _wpgmptr.
|
||||||
|
@ -206,6 +225,10 @@ static int git_get_exec_path(struct strbuf *buf, const char *argv0)
|
||||||
git_get_exec_path_wpgmptr(buf) &&
|
git_get_exec_path_wpgmptr(buf) &&
|
||||||
#endif /* HAVE_WPGMPTR */
|
#endif /* HAVE_WPGMPTR */
|
||||||
|
|
||||||
|
#ifdef HAVE_ZOS_GET_EXECUTABLE_PATH
|
||||||
|
git_get_exec_path_zos(buf) &&
|
||||||
|
#endif /*HAVE_ZOS_GET_EXECUTABLE_PATH */
|
||||||
|
|
||||||
git_get_exec_path_from_argv0(buf, argv0)) {
|
git_get_exec_path_from_argv0(buf, argv0)) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue