feat(libSceLibcInternal): implement guest utime
AI-assisted: yes. Preserves the guest 64-bit time ABI and forwards through the existing utimes path. Registers guest_utime.
This commit is contained in:
parent
9c5d67fbe2
commit
71040b6df5
|
|
@ -1,9 +1,19 @@
|
|||
add_library(libSceLibcInternal SHARED EXCLUDE_FROM_ALL Export.cpp)
|
||||
add_library(libSceLibcInternal SHARED EXCLUDE_FROM_ALL Export.cpp FileTime.cpp)
|
||||
target_include_directories(libSceLibcInternal PRIVATE ${LIBS_INCLUDE_DIR})
|
||||
target_link_libraries(libSceLibcInternal PRIVATE ${CMAKE_DL_LIBS})
|
||||
configure_windows_unwind(libSceLibcInternal)
|
||||
|
||||
if(BUILD_TESTING)
|
||||
add_test_executable(guest_utime_tests ${LIBS_INCLUDE_DIR}/tests/GuestUtime.cpp)
|
||||
target_include_directories(guest_utime_tests PRIVATE ${LIBS_INCLUDE_DIR})
|
||||
target_link_libraries(guest_utime_tests PRIVATE libSceLibcInternal libc)
|
||||
configure_windows_unwind(guest_utime_tests)
|
||||
add_test(NAME guest_utime COMMAND guest_utime_tests)
|
||||
set_tests_properties(guest_utime PROPERTIES TIMEOUT 20)
|
||||
if(WIN32)
|
||||
set_tests_properties(guest_utime PROPERTIES ENVIRONMENT_MODIFICATION
|
||||
"PATH=path_list_prepend:$<TARGET_FILE_DIR:libSceLibcInternal>")
|
||||
endif()
|
||||
add_test_executable(guest_thread_atexit_tests ${LIBS_INCLUDE_DIR}/tests/GuestThreadAtexit.cpp)
|
||||
target_include_directories(guest_thread_atexit_tests PRIVATE ${LIBS_INCLUDE_DIR})
|
||||
target_link_libraries(guest_thread_atexit_tests PRIVATE libSceLibcInternal libkernel libc)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
#include "SceTypes.hpp"
|
||||
#include "prx/libc/include/general/VabiMacros.hpp"
|
||||
#include <cstdint>
|
||||
|
||||
struct LibcUtimbuf {
|
||||
std::int64_t actime;
|
||||
std::int64_t modtime;
|
||||
};
|
||||
static_assert(sizeof(LibcUtimbuf) == 16);
|
||||
|
||||
extern "C" int APS5_VABI utimes_nid_postfix(const char*, const KernelTimeval*);
|
||||
|
||||
extern "C" int APS5_VABI utime_nid_postfix(const char* path, const LibcUtimbuf* times) {
|
||||
if (times == nullptr) return utimes_nid_postfix(path, nullptr);
|
||||
const KernelTimeval values[2] = {{times->actime, 0}, {times->modtime, 0}};
|
||||
return utimes_nid_postfix(path, values);
|
||||
}
|
||||
Loading…
Reference in New Issue