281
283
struct stat statbuf;
285
#if defined(GLIBC_VERSION_24)
288
if (fileData == NULL) {
289
if (!PosixConvertToCurrent(pathName, &path)) {
292
ret = euidaccess(path, F_OK);
283
299
if (Posix_Stat(pathName, &statbuf) == -1) {
1005
1021
if (statfsbuf.f_type == VMFS_MAGIC_NUMBER) {
1007
1023
FS_FreeSpaceArgs args = { 0 };
1008
Unicode directory = NULL;
1010
File_SplitName(fullPath, NULL, &directory, NULL);
1011
/* Must use an ioctl() to get free space for a VMFS file. */
1024
Unicode specialPath = NULL;
1027
* If the file exists and can be opened we're all set. If the file
1028
* doesn't exist we can use the parent directory for the ioctl.
1029
* However, if the file exists and can't be opened (e.g. permissions
1030
* issues) a correct answer can only be returned if the target isn't a
1031
* directory. If the target is a directory its parent may be a mount
1032
* point - leading across a mount point to a different file system.
1013
fd = Posix_Open(directory, O_RDONLY, 0);
1038
fd = Posix_Open(fullPath, O_RDONLY, 0);
1046
struct stat statbuf;
1048
if (Posix_Stat(fullPath, &statbuf) == -1) {
1053
if (S_ISDIR(statbuf.st_mode)) {
1054
Warning(LGPFX" %s: directory (%s) present but inaccessible\n",
1055
__func__, UTF8(fullPath));
1064
File_SplitName(fullPath, NULL, &specialPath, NULL);
1066
fd = Posix_Open(specialPath, O_RDONLY, 0);
1014
1070
if (fd == -1) {
1015
1071
Warning(LGPFX" %s: open of %s failed with: %s\n", __func__,
1016
UTF8(directory), Msg_ErrString());
1072
(specialPath == NULL) ? UTF8(fullPath) : UTF8(specialPath),
1018
1075
if (ioctl(fd, IOCTLCMD_VMFS_GET_FREE_SPACE, &args) == -1) {
1019
1076
Warning(LGPFX" %s: ioctl on %s failed with: %s\n", __func__,
1020
UTF8(fullPath), Msg_ErrString());
1077
(specialPath == NULL) ? UTF8(fullPath) : UTF8(specialPath),
1022
1080
ret = args.bytesFree;
1027
Unicode_Free(directory);
1086
Unicode_Free(specialPath);
2054
2111
if (strcmp(fsType, "VMFS") == 0) {
2056
maxFileSize = (VMFS2CONST * (uint64) blockSize * 1024);
2057
} else if (version >= 3) {
2058
2113
/* Get ready for VMFS4 and perform sanity check on version */
2059
2114
ASSERT(version == 3 || version == 4);
2061
2116
maxFileSize = (VMFS3CONST * (uint64) blockSize * 1024);
2064
2119
if (fileSize <= maxFileSize && maxFileSize != -1) {
2818
2873
return (FileAttributes(pathName, &fileData) == 0) &&
2819
2874
(fileData.fileType == FILE_TYPE_CHARDEVICE);
2824
*----------------------------------------------------------------------------
2826
* File_SupportsPrealloc --
2830
* TRUE if APPLE or file system type is ext2/ext3/ext4
2831
* FALSE if not supported by default in auto mode
2836
*----------------------------------------------------------------------------
2840
File_SupportsPrealloc(const char *file)
2843
#if (defined( __linux__) && !defined(VMX86_SERVER))
2844
struct statfs statBuf;
2845
if (FileGetStats(file, FALSE, &statBuf) &&
2846
statBuf.f_type == EXT4_SUPER_MAGIC) {