uti: integrate libuti and redirect to mck/libuti.so

Change-Id: I74e0f677ea8e1cd06e8ab05d92f1d38f9be8fd7a
This commit is contained in:
Masamichi Takagi
2021-02-22 12:11:57 +09:00
parent 0848b64c1d
commit 82056961cd
10 changed files with 356 additions and 15 deletions

View File

@ -9,8 +9,41 @@ if (ENABLE_UTI)
set(SYSCALL_INTERCEPT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/syscall_intercept" CACHE STRINGS "relative path to syscalL_intercept source directory")
endif()
# syscall_intercept
# change cmake options only in this directory
SET(CMAKE_BUILD_TYPE Release CACHE STRING "release build" FORCE)
SET(TREAT_WARNINGS_AS_ERRORS OFF CACHE BOOL "ignore warnings" FORCE)
add_subdirectory(${SYSCALL_INTERCEPT_SOURCE_DIR} syscall_intercept)
# libuti
find_path(LIBCAP_INCLUDE_DIRS
capability.h
PATHS /usr/include/sys
NO_DEFAULT_PATH)
find_library(LIBCAP_LIBRARIES
NAME cap
PATHS /usr/lib64
NO_DEFAULT_PATH)
if (NOT LIBCAP_INCLUDE_DIRS OR NOT LIBCAP_LIBRARIES)
message(FATAL_ERROR "error: couldn't find libcap")
endif()
include(ExternalProject)
# Install libuti.so.* into <prefix>/mck/ so that mcexec can
# redirect ld*.so's access to it. In this way, a.out created
# by Fujitsu MPI and linked to libuti.so in the standard path
# can use the McKernel version when invoked through mcexec.
ExternalProject_Add(libuti
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/uti
BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/uti
INSTALL_DIR ${prefix}
CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/uti/configure --prefix=<INSTALL_DIR> --libdir=<INSTALL_DIR>/lib64 --disable-static --with-rm=mckernel
BUILD_COMMAND ${MAKE}
BUILD_IN_SOURCE FALSE
INSTALL_COMMAND ${MAKE} install && bash -c "rm ${prefix}/include/uti.h ${prefix}/lib64/libuti.la && [[ -d ${prefix}/lib64/mck ]] || mkdir ${prefix}/lib64/mck && mv ${prefix}/lib64/libuti.* ${prefix}/lib64/mck"
)
endif()

1
executer/user/lib/uti Submodule

Submodule executer/user/lib/uti added at 8c5a556814

View File

@ -3395,6 +3395,29 @@ overlay_path(int dirfd, const char *in, char *buf, int *resolvelinks)
if (!strcmp(path, "/dev/xpmem"))
return "/dev/null";
if (enable_uti && strstr(path, "libuti.so")) {
char libdir[PATH_MAX];
char *basename;
basename = strrchr(path, '/');
if (basename == NULL) {
basename = (char *)path;
} else {
basename++;
}
if (find_libdir(libdir, sizeof(libdir)) < 0) {
fprintf(stderr, "error: failed to find library directory\n");
return in;
}
n = snprintf(buf, PATH_MAX, "%s/mck/%s",
libdir, basename);
__dprintf("%s: %s replaced with %s\n",
__func__, path, buf);
goto checkexist;
}
if (!strncmp(path, "/proc/self", 10) &&
(path[10] == '/' || path[10] == '\0')) {
n = snprintf(buf, PATH_MAX, "/proc/mcos%d/%d%s",