mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-04-09 18:05:36 +00:00
Revert "[SystemZ][ZOS] Porting the time functions within libc++ to z/OS"
This reverts commit 173b51169b838. That commit was applied incorrectly, and undid previous changes. That was clearly not intended.
This commit is contained in:
parent
4cdf1d2110
commit
777ca48c9f
libcxx
@ -179,29 +179,6 @@ set(files
|
|||||||
wctype.h
|
wctype.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if(LIBCXX_INSTALL_SUPPORT_HEADERS)
|
|
||||||
set(files
|
|
||||||
${files}
|
|
||||||
support/android/locale_bionic.h
|
|
||||||
support/fuchsia/xlocale.h
|
|
||||||
support/ibm/limits.h
|
|
||||||
support/ibm/locale_mgmt_aix.h
|
|
||||||
support/ibm/nanosleep.h
|
|
||||||
support/ibm/support.h
|
|
||||||
support/ibm/xlocale.h
|
|
||||||
support/musl/xlocale.h
|
|
||||||
support/newlib/xlocale.h
|
|
||||||
support/solaris/floatingpoint.h
|
|
||||||
support/solaris/wchar.h
|
|
||||||
support/solaris/xlocale.h
|
|
||||||
support/win32/limits_msvc_win32.h
|
|
||||||
support/win32/locale_win32.h
|
|
||||||
support/xlocale/__nop_locale_mgmt.h
|
|
||||||
support/xlocale/__posix_l_fallback.h
|
|
||||||
support/xlocale/__strtonum_fallback.h
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
configure_file("__config_site.in"
|
configure_file("__config_site.in"
|
||||||
"${LIBCXX_BINARY_DIR}/__config_site"
|
"${LIBCXX_BINARY_DIR}/__config_site"
|
||||||
@ONLY)
|
@ONLY)
|
||||||
|
@ -16,10 +16,6 @@
|
|||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#ifdef __MVS__
|
|
||||||
#include <support/ibm/nanosleep.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
|
#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
|
||||||
#pragma GCC system_header
|
#pragma GCC system_header
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,38 +0,0 @@
|
|||||||
// -*- C++ -*-
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
//
|
|
||||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
||||||
// See https://llvm.org/LICENSE.txt for license information.
|
|
||||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
||||||
//
|
|
||||||
//===----------------------------------------------------------------------===//
|
|
||||||
|
|
||||||
#ifndef _LIBCPP_SUPPORT_IBM_NANOSLEEP_H
|
|
||||||
#define _LIBCPP_SUPPORT_IBM_NANOSLEEP_H
|
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
inline int nanosleep(const struct timespec* req, struct timespec* rem)
|
|
||||||
{
|
|
||||||
// The nanosleep() function is not available on z/OS. Therefore, we will call
|
|
||||||
// sleep() to sleep for whole seconds and usleep() to sleep for any remaining
|
|
||||||
// fraction of a second. Any remaining nanoseconds will round up to the next
|
|
||||||
// microsecond.
|
|
||||||
|
|
||||||
useconds_t __micro_sec = (rem->tv_nsec + 999) / 1000;
|
|
||||||
if (__micro_sec > 999999)
|
|
||||||
{
|
|
||||||
++rem->tv_sec;
|
|
||||||
__micro_sec -= 1000000;
|
|
||||||
}
|
|
||||||
while (rem->tv_sec)
|
|
||||||
rem->tv_sec = sleep(rem->tv_sec);
|
|
||||||
if (__micro_sec) {
|
|
||||||
rem->tv_nsec = __micro_sec * 1000;
|
|
||||||
return usleep(__micro_sec);
|
|
||||||
}
|
|
||||||
rem->tv_nsec = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // _LIBCPP_SUPPORT_IBM_NANOSLEEP_H
|
|
@ -198,8 +198,7 @@ private:
|
|||||||
using chrono::duration;
|
using chrono::duration;
|
||||||
using chrono::duration_cast;
|
using chrono::duration_cast;
|
||||||
|
|
||||||
using TimeSpec = struct timespec;
|
using TimeSpec = timespec;
|
||||||
using TimeVal = struct timeval;
|
|
||||||
using StatT = struct stat;
|
using StatT = struct stat;
|
||||||
|
|
||||||
template <class FileTimeT, class TimeT,
|
template <class FileTimeT, class TimeT,
|
||||||
@ -382,38 +381,26 @@ public:
|
|||||||
using fs_time = time_util<file_time_type, time_t, TimeSpec>;
|
using fs_time = time_util<file_time_type, time_t, TimeSpec>;
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
inline TimeSpec extract_mtime(StatT const& st) { return st.st_mtimespec; }
|
TimeSpec extract_mtime(StatT const& st) { return st.st_mtimespec; }
|
||||||
inline TimeSpec extract_atime(StatT const& st) { return st.st_atimespec; }
|
TimeSpec extract_atime(StatT const& st) { return st.st_atimespec; }
|
||||||
#elif defined(__MVS__)
|
|
||||||
inline TimeSpec extract_mtime(StatT const& st) {
|
|
||||||
TimeSpec TS = {st.st_mtime, 0};
|
|
||||||
return TS;
|
|
||||||
}
|
|
||||||
inline TimeSpec extract_atime(StatT const& st) {
|
|
||||||
TimeSpec TS = {st.st_atime, 0};
|
|
||||||
return TS;
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
inline TimeSpec extract_mtime(StatT const& st) { return st.st_mtim; }
|
TimeSpec extract_mtime(StatT const& st) { return st.st_mtim; }
|
||||||
inline TimeSpec extract_atime(StatT const& st) { return st.st_atim; }
|
TimeSpec extract_atime(StatT const& st) { return st.st_atim; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
inline TimeVal make_timeval(TimeSpec const& ts) {
|
// allow the utimes implementation to compile even it we're not going
|
||||||
|
// to use it.
|
||||||
|
|
||||||
|
bool posix_utimes(const path& p, std::array<TimeSpec, 2> const& TS,
|
||||||
|
error_code& ec) {
|
||||||
using namespace chrono;
|
using namespace chrono;
|
||||||
auto Convert = [](long nsec) {
|
auto Convert = [](long nsec) {
|
||||||
using int_type = decltype(std::declval<TimeVal>().tv_usec);
|
using int_type = decltype(std::declval< ::timeval>().tv_usec);
|
||||||
auto dur = duration_cast<microseconds>(nanoseconds(nsec)).count();
|
auto dur = duration_cast<microseconds>(nanoseconds(nsec)).count();
|
||||||
return static_cast<int_type>(dur);
|
return static_cast<int_type>(dur);
|
||||||
};
|
};
|
||||||
TimeVal TV = {};
|
struct ::timeval ConvertedTS[2] = {{TS[0].tv_sec, Convert(TS[0].tv_nsec)},
|
||||||
TV.tv_sec = ts.tv_sec;
|
{TS[1].tv_sec, Convert(TS[1].tv_nsec)}};
|
||||||
TV.tv_usec = Convert(ts.tv_nsec);
|
|
||||||
return TV;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool posix_utimes(const path& p, std::array<TimeSpec, 2> const& TS,
|
|
||||||
error_code& ec) {
|
|
||||||
TimeVal ConvertedTS[2] = {make_timeval(TS[0]), make_timeval(TS[1])};
|
|
||||||
if (::utimes(p.c_str(), ConvertedTS) == -1) {
|
if (::utimes(p.c_str(), ConvertedTS) == -1) {
|
||||||
ec = capture_errno();
|
ec = capture_errno();
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user