Skip to content

Commit 739c509

Browse files
committed
Merge branch 'dh/runtime-prefix-on-zos'
Support for the RUNTIME_PREFIX feature has been added to z/OS port. * dh/runtime-prefix-on-zos: exec_cmd: RUNTIME_PREFIX on z/OS systems
2 parents 8c1c63d + 987bbcd commit 739c509

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,10 @@ include shared.mak
385385
# supports calling _NSGetExecutablePath to retrieve the path of the running
386386
# executable.
387387
#
388+
# When using RUNTIME_PREFIX, define HAVE_ZOS_GET_EXECUTABLE_PATH if your platform
389+
# supports calling __getprogramdir and getprogname to retrieve the path of the
390+
# running executable.
391+
#
388392
# When using RUNTIME_PREFIX, define HAVE_WPGMPTR if your platform offers
389393
# the global variable _wpgmptr containing the absolute path of the current
390394
# executable (this is the case on Windows).
@@ -2157,6 +2161,10 @@ ifdef HAVE_NS_GET_EXECUTABLE_PATH
21572161
BASIC_CFLAGS += -DHAVE_NS_GET_EXECUTABLE_PATH
21582162
endif
21592163

2164+
ifdef HAVE_ZOS_GET_EXECUTABLE_PATH
2165+
BASIC_CFLAGS += -DHAVE_ZOS_GET_EXECUTABLE_PATH
2166+
endif
2167+
21602168
ifdef HAVE_WPGMPTR
21612169
BASIC_CFLAGS += -DHAVE_WPGMPTR
21622170
endif

config.mak.uname

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,7 @@ ifeq ($(uname_S),OS/390)
648648
NO_GECOS_IN_PWENT = YesPlease
649649
HAVE_STRINGS_H = YesPlease
650650
NEEDS_MODE_TRANSLATION = YesPlease
651+
HAVE_ZOS_GET_EXECUTABLE_PATH = YesPlease
651652
endif
652653
ifeq ($(uname_S),MINGW)
653654
ifeq ($(shell expr "$(uname_R)" : '1\.'),2)

exec-cmd.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,25 @@ static int git_get_exec_path_darwin(struct strbuf *buf)
150150
}
151151
#endif /* HAVE_NS_GET_EXECUTABLE_PATH */
152152

153+
#ifdef HAVE_ZOS_GET_EXECUTABLE_PATH
154+
/*
155+
* Resolves the executable path from current program's directory and name.
156+
*
157+
* Returns 0 on success, -1 on failure.
158+
*/
159+
static int git_get_exec_path_zos(struct strbuf *buf)
160+
{
161+
char *dir = __getprogramdir();
162+
char *exe = getprogname();
163+
if (dir && exe) {
164+
strbuf_addf(buf, "%s/%s", dir, exe);
165+
return 0;
166+
}
167+
return -1;
168+
}
169+
170+
#endif /* HAVE_ZOS_GET_EXECUTABLE_PATH */
171+
153172
#ifdef HAVE_WPGMPTR
154173
/*
155174
* 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)
206225
git_get_exec_path_wpgmptr(buf) &&
207226
#endif /* HAVE_WPGMPTR */
208227

228+
#ifdef HAVE_ZOS_GET_EXECUTABLE_PATH
229+
git_get_exec_path_zos(buf) &&
230+
#endif /*HAVE_ZOS_GET_EXECUTABLE_PATH */
231+
209232
git_get_exec_path_from_argv0(buf, argv0)) {
210233
return -1;
211234
}

0 commit comments

Comments
 (0)