Imported Upstream version 6.8.0.73

Former-commit-id: d18deab1b47cfd3ad8cba82b3f37d00eec2170af
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2019-12-10 18:00:56 +00:00
parent bceda29824
commit 73ee7591e8
1043 changed files with 16271 additions and 22080 deletions

View File

@@ -16,6 +16,8 @@
#cmakedefine01 HAVE_STAT_TIMESPEC
#cmakedefine01 HAVE_STAT_TIM
#cmakedefine01 HAVE_STAT_NSEC
#cmakedefine01 HAVE_STAT_FLAGS
#cmakedefine01 HAVE_LCHFLAGS
#cmakedefine01 HAVE_GNU_STRERROR_R
#cmakedefine01 HAVE_READDIR_R
#cmakedefine01 HAVE_DIRENT_NAME_LEN

View File

@@ -166,6 +166,12 @@ static void ConvertFileStatus(const struct stat_* src, struct FileStatus* dst)
dst->BirthTime = 0;
dst->BirthTimeNsec = 0;
#endif
#if defined(HAVE_STAT_FLAGS) && defined(UF_HIDDEN)
dst->UserFlags = ((src->st_flags & UF_HIDDEN) == UF_HIDDEN) ? PAL_UF_HIDDEN : 0;
#else
dst->UserFlags = 0;
#endif
}
// CoreCLR expects the "2" suffixes on these: they should be cleaned up in our
@@ -1460,6 +1466,28 @@ int32_t SystemNative_LockFileRegion(intptr_t fd, int64_t offset, int64_t length,
return ret;
}
int32_t SystemNative_LChflags(const char* path, uint32_t flags)
{
#if HAVE_LCHFLAGS
int32_t result;
while ((result = lchflags(path, flags)) < 0 && errno == EINTR);
return result;
#else
(void)path, (void)flags;
errno = ENOTSUP;
return -1;
#endif
}
int32_t SystemNative_LChflagsCanSetHiddenFlag(void)
{
#if defined(UF_HIDDEN) && defined(HAVE_STAT_FLAGS) && defined(HAVE_LCHFLAGS)
return true;
#else
return false;
#endif
}
int32_t SystemNative_Symlink(const char* target, const char* linkPath)
{
return symlink(target, linkPath);

View File

@@ -35,6 +35,7 @@ struct FileStatus
int64_t BirthTimeNsec; // nanosecond part
int64_t Dev; // ID of the device containing the file
int64_t Ino; // inode number of the file
uint32_t UserFlags; // user defined flags
};
/* Provide consistent access to nanosecond fields, if they exist. */
@@ -153,6 +154,14 @@ enum
FILESTATUS_FLAGS_HAS_BIRTHTIME = 1,
};
/**
* Constants for interpreting FileStatus.UserFlags.
*/
enum
{
PAL_UF_HIDDEN = 0x8000
};
/**
* Constants from dirent.h for the inode type returned from readdir variants
*/
@@ -750,6 +759,20 @@ DLLEXPORT int32_t SystemNative_GetPeerID(intptr_t socket, uid_t* euid);
*/
DLLEXPORT int32_t SystemNative_LockFileRegion(intptr_t fd, int64_t offset, int64_t length, int16_t lockType);
/**
* Changes the file flags of the file whose location is specified in path
*
* Returns 0 for success, -1 for failure. Sets errno for failure.
*/
DLLEXPORT int32_t SystemNative_LChflags(const char* path, uint32_t flags);
/**
* Determines if the current platform supports setting UF_HIDDEN (0x8000) flag
*
* Returns true (non-zero) if supported, false (zero) if not.
*/
DLLEXPORT int32_t SystemNative_LChflagsCanSetHiddenFlag(void);
/**
* Creates a symbolic link at "linkPath", pointing at "target".
* "target" may or may not exist (dangling symbolic links are valid filesystem objects)