}
}
}
+
+func TestModeSocket(t *testing.T) {
+ addr := testUnixAddr(t)
+
+ l, err := Listen("unix", addr)
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer l.Close()
+
+ stat, err := os.Stat(addr)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ mode := stat.Mode()
+ if mode&os.ModeSocket == 0 {
+ t.Fatalf("%v should have ModeSocket", mode)
+ }
+}
case syscall.FILE_TYPE_CHAR:
m |= ModeDevice | ModeCharDevice
}
- if fs.FileAttributes&syscall.FILE_ATTRIBUTE_REPARSE_POINT != 0 && m&ModeType == 0 {
- if fs.ReparseTag == windows.IO_REPARSE_TAG_DEDUP {
- // If the Data Deduplication service is enabled on Windows Server, its
- // Optimization job may convert regular files to IO_REPARSE_TAG_DEDUP
- // whenever that job runs.
- //
- // However, DEDUP reparse points remain similar in most respects to
- // regular files: they continue to support random-access reads and writes
- // of persistent data, and they shouldn't add unexpected latency or
- // unavailability in the way that a network filesystem might.
- //
- // Go programs may use ModeIrregular to filter out unusual files (such as
- // raw device files on Linux, POSIX FIFO special files, and so on), so
- // to avoid files changing unpredictably from regular to irregular we will
- // consider DEDUP files to be close enough to regular to treat as such.
- } else {
- m |= ModeIrregular
+ if fs.FileAttributes&syscall.FILE_ATTRIBUTE_REPARSE_POINT != 0 {
+ if fs.ReparseTag == windows.IO_REPARSE_TAG_AF_UNIX {
+ m |= ModeSocket
+ }
+ if m&ModeType == 0 {
+ if fs.ReparseTag == windows.IO_REPARSE_TAG_DEDUP {
+ // If the Data Deduplication service is enabled on Windows Server, its
+ // Optimization job may convert regular files to IO_REPARSE_TAG_DEDUP
+ // whenever that job runs.
+ //
+ // However, DEDUP reparse points remain similar in most respects to
+ // regular files: they continue to support random-access reads and writes
+ // of persistent data, and they shouldn't add unexpected latency or
+ // unavailability in the way that a network filesystem might.
+ //
+ // Go programs may use ModeIrregular to filter out unusual files (such as
+ // raw device files on Linux, POSIX FIFO special files, and so on), so
+ // to avoid files changing unpredictably from regular to irregular we will
+ // consider DEDUP files to be close enough to regular to treat as such.
+ } else {
+ m |= ModeIrregular
+ }
}
}
return m