Skip to content

Commit f4719c4

Browse files
committed
Add support for GNU Hurd in Path.inc and other places
Summary: Patch by Svante Signell & myself Reviewers: rnk, JDevlieghere, efriedma Reviewed By: efriedma Subscribers: efriedma, JDevlieghere, krytarowski, llvm-commits, kristina Differential Revision: https://reviews.llvm.org/D53409 llvm-svn: 345007
1 parent e133c78 commit f4719c4

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

llvm/lib/Support/Unix/Path.inc

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
// For GNU Hurd
5050
#if defined(__GNU__) && !defined(PATH_MAX)
5151
# define PATH_MAX 4096
52+
# define MAXPATHLEN 4096
5253
#endif
5354

5455
#include <sys/types.h>
@@ -82,7 +83,7 @@
8283
#define STATVFS_F_FRSIZE(vfs) static_cast<uint64_t>(vfs.f_bsize)
8384
#endif
8485

85-
#if defined(__NetBSD__)
86+
#if defined(__NetBSD__) || defined(__GNU__)
8687
#define STATVFS_F_FLAG(vfs) (vfs).f_flag
8788
#else
8889
#define STATVFS_F_FLAG(vfs) (vfs).f_flags
@@ -98,7 +99,7 @@ const file_t kInvalidFile = -1;
9899

99100
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || \
100101
defined(__minix) || defined(__FreeBSD_kernel__) || defined(__linux__) || \
101-
defined(__CYGWIN__) || defined(__DragonFly__) || defined(_AIX)
102+
defined(__CYGWIN__) || defined(__DragonFly__) || defined(_AIX) || defined(__GNU__)
102103
static int
103104
test_dir(char ret[PATH_MAX], const char *dir, const char *bin)
104105
{
@@ -347,7 +348,7 @@ std::error_code remove(const Twine &path, bool IgnoreNonExisting) {
347348
}
348349

349350
static bool is_local_impl(struct STATVFS &Vfs) {
350-
#if defined(__linux__)
351+
#if defined(__linux__) || defined(__GNU__)
351352
#ifndef NFS_SUPER_MAGIC
352353
#define NFS_SUPER_MAGIC 0x6969
353354
#endif
@@ -357,7 +358,11 @@ static bool is_local_impl(struct STATVFS &Vfs) {
357358
#ifndef CIFS_MAGIC_NUMBER
358359
#define CIFS_MAGIC_NUMBER 0xFF534D42
359360
#endif
361+
#ifdef __GNU__
362+
switch ((uint32_t)Vfs.__f_type) {
363+
#else
360364
switch ((uint32_t)Vfs.f_type) {
365+
#endif
361366
case NFS_SUPER_MAGIC:
362367
case SMB_SUPER_MAGIC:
363368
case CIFS_MAGIC_NUMBER:

0 commit comments

Comments
 (0)