@@ -74,7 +74,8 @@ extern char **environ;
7474
7575#include < sys/types.h>
7676#if !defined(__APPLE__) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && \
77- !defined (__linux__) && !defined (__FreeBSD_kernel__) && !defined (_AIX)
77+ !defined (__linux__) && !defined (__FreeBSD_kernel__) && !defined (_AIX) && \
78+ !defined (__managarm__)
7879#include < sys/statvfs.h>
7980#define STATVFS statvfs
8081#define FSTATVFS fstatvfs
@@ -83,7 +84,7 @@ extern char **environ;
8384#if defined(__OpenBSD__) || defined(__FreeBSD__)
8485#include < sys/mount.h>
8586#include < sys/param.h>
86- #elif defined(__linux__)
87+ #elif defined(__linux__) || defined(__managarm__)
8788#if defined(HAVE_LINUX_MAGIC_H)
8889#include < linux/magic.h>
8990#else
@@ -129,7 +130,8 @@ const file_t kInvalidFile = -1;
129130#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
130131 defined (__FreeBSD_kernel__) || defined(__linux__) || defined(__CYGWIN__) || \
131132 defined(__DragonFly__) || defined(_AIX) || defined(__GNU__) || \
132- (defined (__sun__) && defined(__svr4__) || defined(__HAIKU__))
133+ (defined (__sun__) && defined(__svr4__) || defined(__HAIKU__)) || \
134+ defined(__managarm__)
133135static int test_dir(char ret[PATH_MAX], const char *dir, const char *bin) {
134136 struct stat sb;
135137 char fullpath[PATH_MAX];
@@ -250,7 +252,8 @@ std::string getMainExecutable(const char *argv0, void *MainAddr) {
250252 // If we don't have procfs mounted, fall back to argv[0]
251253 if (getprogpath (exe_path, argv0) != NULL )
252254 return exe_path;
253- #elif defined(__linux__) || defined(__CYGWIN__) || defined(__gnu_hurd__)
255+ #elif defined(__linux__) || defined(__CYGWIN__) || defined(__gnu_hurd__) || \
256+ defined (__managarm__)
254257 char exe_path[PATH_MAX];
255258 const char *aPath = " /proc/self/exe" ;
256259 if (sys::fs::exists (aPath)) {
@@ -477,7 +480,7 @@ std::error_code remove(const Twine &path, bool IgnoreNonExisting) {
477480}
478481
479482static bool is_local_impl (struct STATVFS &Vfs) {
480- #if defined(__linux__) || defined(__GNU__)
483+ #if defined(__linux__) || defined(__GNU__) || defined(__managarm__)
481484#ifndef NFS_SUPER_MAGIC
482485#define NFS_SUPER_MAGIC 0x6969
483486#endif
0 commit comments