@@ -69,7 +69,8 @@ extern char **environ;
6969
7070#include < sys/types.h>
7171#if !defined(__APPLE__) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && \
72- !defined (__linux__) && !defined (__FreeBSD_kernel__) && !defined (_AIX)
72+ !defined (__linux__) && !defined (__FreeBSD_kernel__) && !defined (_AIX) && \
73+ !defined (__managarm__)
7374#include < sys/statvfs.h>
7475#define STATVFS statvfs
7576#define FSTATVFS fstatvfs
@@ -78,7 +79,7 @@ extern char **environ;
7879#if defined(__OpenBSD__) || defined(__FreeBSD__)
7980#include < sys/mount.h>
8081#include < sys/param.h>
81- #elif defined(__linux__)
82+ #elif defined(__linux__) || defined(__managarm__)
8283#if defined(HAVE_LINUX_MAGIC_H)
8384#include < linux/magic.h>
8485#else
@@ -124,7 +125,8 @@ const file_t kInvalidFile = -1;
124125#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
125126 defined (__FreeBSD_kernel__) || defined(__linux__) || defined(__CYGWIN__) || \
126127 defined(__DragonFly__) || defined(_AIX) || defined(__GNU__) || \
127- (defined (__sun__) && defined(__svr4__) || defined(__HAIKU__))
128+ (defined (__sun__) && defined(__svr4__) || defined(__HAIKU__)) || \
129+ defined(__managarm__)
128130static int test_dir(char ret[PATH_MAX], const char *dir, const char *bin) {
129131 struct stat sb;
130132 char fullpath[PATH_MAX];
@@ -245,7 +247,8 @@ std::string getMainExecutable(const char *argv0, void *MainAddr) {
245247 // If we don't have procfs mounted, fall back to argv[0]
246248 if (getprogpath (exe_path, argv0) != NULL )
247249 return exe_path;
248- #elif defined(__linux__) || defined(__CYGWIN__) || defined(__gnu_hurd__)
250+ #elif defined(__linux__) || defined(__CYGWIN__) || defined(__gnu_hurd__) || \
251+ defined (__managarm__)
249252 char exe_path[PATH_MAX];
250253 const char *aPath = " /proc/self/exe" ;
251254 if (sys::fs::exists (aPath)) {
@@ -472,7 +475,7 @@ std::error_code remove(const Twine &path, bool IgnoreNonExisting) {
472475}
473476
474477static bool is_local_impl (struct STATVFS &Vfs) {
475- #if defined(__linux__) || defined(__GNU__)
478+ #if defined(__linux__) || defined(__GNU__) || defined(__managarm__)
476479#ifndef NFS_SUPER_MAGIC
477480#define NFS_SUPER_MAGIC 0x6969
478481#endif
0 commit comments