diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc index c37b3a546..e51badb34 100644 --- a/llvm/lib/Support/Unix/Path.inc +++ b/llvm/lib/Support/Unix/Path.inc @@ -109,7 +109,7 @@ typedef uint_t uint; #endif #if defined(__NetBSD__) || defined(__DragonFly__) || defined(__GNU__) || \ - defined(__MVS__) + defined(__MVS__) || defined(__serenity__) #define STATVFS_F_FLAG(vfs) (vfs).f_flag #else #define STATVFS_F_FLAG(vfs) (vfs).f_flags @@ -531,7 +531,7 @@ static bool is_local_impl(struct STATVFS &Vfs) { // vmount entry not found; "remote" is the conservative answer. return false; -#elif defined(__MVS__) +#elif defined(__MVS__) || defined(__serenity__) // The file system can have an arbitrary structure on z/OS; must go with the // conservative answer. return false; diff --git a/llvm/lib/Support/Unix/Program.inc b/llvm/lib/Support/Unix/Program.inc index be59bb023..ff8931308 100644 --- a/llvm/lib/Support/Unix/Program.inc +++ b/llvm/lib/Support/Unix/Program.inc @@ -335,7 +335,7 @@ static bool Execute(ProcessInfo &PI, StringRef Program, namespace llvm { namespace sys { -#ifndef _AIX +#if !defined(_AIX) && !defined(__serenity__) using ::wait4; #else static pid_t (wait4)(pid_t pid, int *status, int options, struct rusage *usage); @@ -344,7 +344,7 @@ static pid_t (wait4)(pid_t pid, int *status, int options, struct rusage *usage); } // namespace sys } // namespace llvm -#ifdef _AIX +#if defined(_AIX) || defined(__serenity__) #ifndef _ALL_SOURCE extern "C" pid_t (wait4)(pid_t pid, int *status, int options, struct rusage *usage); @@ -357,7 +357,7 @@ pid_t (llvm::sys::wait4)(pid_t pid, int *status, int options, // AIX wait4 does not work well with WNOHANG. if (!(options & WNOHANG)) - return ::wait4(pid, status, options, usage); + return ::waitpid(pid, status, options); // For WNOHANG, we use waitid (which supports WNOWAIT) until the child process // has terminated. @@ -374,7 +374,7 @@ pid_t (llvm::sys::wait4)(pid_t pid, int *status, int options, // The child has already terminated, so a blocking wait on it is okay in the // absence of indiscriminate `wait` calls from the current process (which // would cause the call here to fail with ECHILD). - return ::wait4(pid, status, options & ~WNOHANG, usage); + return ::waitpid(pid, status, options & ~WNOHANG); } #endif @@ -534,10 +534,10 @@ llvm::sys::writeFileWithEncoding(StringRef FileName, StringRef Contents, bool llvm::sys::commandLineFitsWithinSystemLimits(StringRef Program, ArrayRef Args) { - static long ArgMax = sysconf(_SC_ARG_MAX); + static long ArgMax = 4096; // POSIX requires that _POSIX_ARG_MAX is 4096, which is the lowest possible // value for ARG_MAX on a POSIX compliant system. - static long ArgMin = _POSIX_ARG_MAX; + static long ArgMin = 4096; // This the same baseline used by xargs. long EffectiveArgMax = 128 * 1024; diff --git a/llvm/tools/llvm-jitlink/llvm-jitlink-executor/llvm-jitlink-executor.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink-executor/llvm-jitlink-executor.cpp index 7f197a50c..03bf029db 100644 --- a/llvm/tools/llvm-jitlink/llvm-jitlink-executor/llvm-jitlink-executor.cpp +++ b/llvm/tools/llvm-jitlink/llvm-jitlink-executor/llvm-jitlink-executor.cpp @@ -50,7 +50,7 @@ void printErrorAndExit(Twine ErrMsg) { } int openListener(std::string Host, std::string PortStr) { -#ifndef LLVM_ON_UNIX +#if !defined(LLVM_ON_UNIX) || defined(__serenity__) // FIXME: Add TCP support for Windows. printErrorAndExit("listen option not supported"); return 0; diff --git a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp index 8bd384ec7..a28e938ec 100644 --- a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp +++ b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp @@ -770,7 +770,7 @@ static Expected connectTCPSocket(std::string Host, std::string PortStr) { Expected> LLVMJITLinkRemoteExecutorProcessControl::ConnectToExecutor() { -#ifndef LLVM_ON_UNIX +#if !defined(LLVM_ON_UNIX) || defined(__serenity__) // FIXME: Add TCP support for Windows. return make_error("-" + OutOfProcessExecutorConnect.ArgStr + " not supported on non-unix platforms", diff -ruN llvm-orig/llvm-project-llvmorg-12.0.0/llvm/include/llvm/Support/SwapByteOrder.h llvm-project-llvmorg-12.0.0/llvm/include/llvm/Support/SwapByteOrder.h --- llvm-orig/llvm-project-llvmorg-12.0.0/llvm/include/llvm/Support/SwapByteOrder.h 2021-04-06 19:38:18.000000000 +0300 +++ llvm-project-llvmorg-12.0.0/llvm/include/llvm/Support/SwapByteOrder.h 2021-06-09 16:00:20.111549941 +0300 @@ -22,7 +22,7 @@ #endif #if defined(__linux__) || defined(__GNU__) || defined(__HAIKU__) || \ - defined(__Fuchsia__) || defined(__EMSCRIPTEN__) + defined(__Fuchsia__) || defined(__EMSCRIPTEN__) || defined(__serenity__) #include #elif defined(_AIX) #include