Runtime loader: rename compatibilitySubDir to abiSpecificSubDir.

This commit is contained in:
Oliver Tappe
2013-06-05 18:32:47 +02:00
parent 0050b4b452
commit 729c6333ad
2 changed files with 12 additions and 11 deletions
+11 -10
View File
@@ -90,7 +90,7 @@ search_path_for_type(image_type type)
static int static int
try_open_executable(const char *dir, int dirLength, const char *name, try_open_executable(const char *dir, int dirLength, const char *name,
const char *programPath, const char *compatibilitySubDir, char *path, const char *programPath, const char *abiSpecificSubDir, char *path,
size_t pathLength) size_t pathLength)
{ {
size_t nameLength = strlen(name); size_t nameLength = strlen(name);
@@ -123,11 +123,12 @@ try_open_executable(const char *dir, int dirLength, const char *name,
pathLength -= bytesCopied; pathLength -= bytesCopied;
dir += 2; dir += 2;
dirLength -= 2; dirLength -= 2;
} else if (compatibilitySubDir != NULL) { } else if (abiSpecificSubDir != NULL) {
// We're looking for a library or an add-on and the executable has // We're looking for a library or an add-on and the executable has
// not been compiled with a compiler compatible with the one the // not been compiled with a compiler using the same ABI as the one
// OS has been built with. Thus we only look in specific subdirs. // the OS has been built with. Thus we only look in subdirs
subDirLen = strlen(compatibilitySubDir) + 1; // specific to that ABI.
subDirLen = strlen(abiSpecificSubDir) + 1;
} }
if (dirLength + 1 + subDirLen + nameLength >= pathLength) if (dirLength + 1 + subDirLen + nameLength >= pathLength)
@@ -136,7 +137,7 @@ try_open_executable(const char *dir, int dirLength, const char *name,
memcpy(buffer, dir, dirLength); memcpy(buffer, dir, dirLength);
buffer[dirLength] = '/'; buffer[dirLength] = '/';
if (subDirLen > 0) { if (subDirLen > 0) {
memcpy(buffer + dirLength + 1, compatibilitySubDir, subDirLen - 1); memcpy(buffer + dirLength + 1, abiSpecificSubDir, subDirLen - 1);
buffer[dirLength + subDirLen] = '/'; buffer[dirLength + subDirLen] = '/';
} }
strcpy(buffer + dirLength + 1 + subDirLen, name); strcpy(buffer + dirLength + 1 + subDirLen, name);
@@ -180,7 +181,7 @@ try_open_executable(const char *dir, int dirLength, const char *name,
static int static int
search_executable_in_path_list(const char *name, const char *pathList, search_executable_in_path_list(const char *name, const char *pathList,
int pathListLen, const char *programPath, const char *compatibilitySubDir, int pathListLen, const char *programPath, const char *abiSpecificSubDir,
char *pathBuffer, size_t pathBufferLength) char *pathBuffer, size_t pathBufferLength)
{ {
const char *pathListEnd = pathList + pathListLen; const char *pathListEnd = pathList + pathListLen;
@@ -198,7 +199,7 @@ search_executable_in_path_list(const char *name, const char *pathList,
pathEnd++; pathEnd++;
fd = try_open_executable(pathList, pathEnd - pathList, name, fd = try_open_executable(pathList, pathEnd - pathList, name,
programPath, compatibilitySubDir, pathBuffer, pathBufferLength); programPath, abiSpecificSubDir, pathBuffer, pathBufferLength);
if (fd >= 0) { if (fd >= 0) {
// see if it's a dir // see if it's a dir
struct stat stat; struct stat stat;
@@ -221,7 +222,7 @@ search_executable_in_path_list(const char *name, const char *pathList,
int int
open_executable(char *name, image_type type, const char *rpath, open_executable(char *name, image_type type, const char *rpath,
const char *programPath, const char *compatibilitySubDir) const char *programPath, const char *abiSpecificSubDir)
{ {
char buffer[PATH_MAX]; char buffer[PATH_MAX];
int fd = B_ENTRY_NOT_FOUND; int fd = B_ENTRY_NOT_FOUND;
@@ -273,7 +274,7 @@ open_executable(char *name, image_type type, const char *rpath,
if (fd < 0) { if (fd < 0) {
if (const char *paths = search_path_for_type(type)) { if (const char *paths = search_path_for_type(type)) {
fd = search_executable_in_path_list(name, paths, strlen(paths), fd = search_executable_in_path_list(name, paths, strlen(paths),
programPath, compatibilitySubDir, buffer, sizeof(buffer)); programPath, abiSpecificSubDir, buffer, sizeof(buffer));
} }
} }
@@ -56,7 +56,7 @@ extern "C" {
int runtime_loader(void* arg, void* commpage); int runtime_loader(void* arg, void* commpage);
int open_executable(char* name, image_type type, const char* rpath, int open_executable(char* name, image_type type, const char* rpath,
const char* programPath, const char* compatibilitySubDir); const char* programPath, const char* abiSpecificSubDir);
status_t test_executable(const char* path, char* interpreter); status_t test_executable(const char* path, char* interpreter);
void terminate_program(void); void terminate_program(void);