#include <w32api/ntstatus.h>
+/* Special values for Cygwin AF_UNIX socket reparse points. */
+#define IO_REPARSE_TAG_CYGUNIX (0x00006375)
+#define CYGWIN_SOCKET_UUID L"efc1714d-7b19-4407-bab3-c5b1f92cb88c"
/* custom status code: */
#define STATUS_ILLEGAL_DLL_PSEUDO_RELOCATION ((NTSTATUS) 0xe0000269)
return;
}
fileattr = sym.fileattr;
- dev.parse (FH_LOCAL);
+ dev.parse ((sym.pflags & PATH_REP) ? FH_UNIX : FH_LOCAL);
dev.setfs (1);
+ path_flags = sym.pflags;
goto out;
}
rp->SymbolicLinkReparseBuffer.SubstituteNameLength);
if ((rp->SymbolicLinkReparseBuffer.Flags & SYMLINK_FLAG_RELATIVE) ||
check_reparse_point_string (psymbuf))
- return 1;
+ return PATH_SYMLINK | PATH_REP;
}
else if (!remote && rp->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT)
{
return -EPERM;
}
if (check_reparse_point_string (psymbuf))
- return 1;
+ return PATH_SYMLINK | PATH_REP;
+ }
+ else if (rp->ReparseTag == IO_REPARSE_TAG_CYGUNIX)
+ {
+ PREPARSE_GUID_DATA_BUFFER rgp = (PREPARSE_GUID_DATA_BUFFER) rp;
+ UUID uuid;
+
+ uuid_from_string (CYGWIN_SOCKET_UUID, uuid);
+ if (memcmp (&uuid, &rgp->ReparseGuid, sizeof (UUID)) == 0)
+ return PATH_SOCKET | PATH_REP;
}
return 0;
}
fileattr &= ~FILE_ATTRIBUTE_REPARSE_POINT;
return ret;
}
- /* ret is > 0, so it's a reparse point, path in symbuf. */
- sys_wcstombs (srcbuf, SYMLINK_MAX + 7, symbuf.Buffer,
- symbuf.Length / sizeof (WCHAR));
- pflags |= PATH_SYMLINK | PATH_REP;
+ /* ret is > 0, so it's a known reparse point, path in symbuf. */
+ pflags |= ret;
+ if (ret & PATH_SYMLINK)
+ sys_wcstombs (srcbuf, SYMLINK_MAX + 7, symbuf.Buffer,
+ symbuf.Length / sizeof (WCHAR));
/* A symlink is never a directory. */
fileattr &= ~FILE_ATTRIBUTE_DIRECTORY;
return posixify (srcbuf);
int is_fs_device () const {return isdevice () && is_fs_special ();}
int is_fs_special () const {return dev.is_fs_special ();}
int is_lnk_special () const {return is_fs_device () || isfifo () || is_lnk_symlink ();}
- int issocket () const {return dev.is_device (FH_LOCAL);}
+ int issocket () const {return dev.is_device (FH_LOCAL)
+ || dev.is_device (FH_UNIX);}
int iscygexec () const {return path_flags & PATH_CYGWIN_EXEC;}
int isopen () const {return path_flags & PATH_OPEN;}
int isctty_capable () const {return path_flags & PATH_CTTY;}