@@ -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
@@ -121,10 +122,12 @@ namespace fs {
121122
122123const file_t kInvalidFile = -1 ;
123124
124- #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
125- defined (__FreeBSD_kernel__) || defined(__linux__) || defined(__CYGWIN__) || \
126- defined(__DragonFly__) || defined(_AIX) || defined(__GNU__) || \
127- (defined (__sun__) && defined(__svr4__) || defined(__HAIKU__))
125+ #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
126+ defined (__FreeBSD_kernel__) || defined(__linux__) || \
127+ defined(__CYGWIN__) || defined(__DragonFly__) || defined(_AIX) || \
128+ defined(__GNU__) || \
129+ (defined (__sun__) && defined(__svr4__) || defined(__HAIKU__)) || \
130+ defined(__managarm__)
128131static int test_dir(char ret[PATH_MAX], const char *dir, const char *bin) {
129132 struct stat sb;
130133 char fullpath[PATH_MAX];
@@ -245,7 +248,8 @@ std::string getMainExecutable(const char *argv0, void *MainAddr) {
245248 // If we don't have procfs mounted, fall back to argv[0]
246249 if (getprogpath (exe_path, argv0) != NULL )
247250 return exe_path;
248- #elif defined(__linux__) || defined(__CYGWIN__) || defined(__gnu_hurd__)
251+ #elif defined(__linux__) || defined(__CYGWIN__) || defined(__gnu_hurd__) || \
252+ defined (__managarm__)
249253 char exe_path[PATH_MAX];
250254 const char *aPath = " /proc/self/exe" ;
251255 if (sys::fs::exists (aPath)) {
@@ -472,7 +476,7 @@ std::error_code remove(const Twine &path, bool IgnoreNonExisting) {
472476}
473477
474478static bool is_local_impl (struct STATVFS &Vfs) {
475- #if defined(__linux__) || defined(__GNU__)
479+ #if defined(__linux__) || defined(__GNU__) || defined(__managarm__)
476480#ifndef NFS_SUPER_MAGIC
477481#define NFS_SUPER_MAGIC 0x6969
478482#endif
0 commit comments