示例#1
0
 public static bool TryStatFileAndUpdateIndex(ITracer tracer, string path, MemoryMappedViewAccessor indexView, long offset)
 {
     try
     {
         LinuxNative.StatBuffer st         = LinuxFileSystem.StatFile(path);
         Index.IndexEntry       indexEntry = new Index.IndexEntry(indexView, offset);
         indexEntry.MtimeSeconds            = (uint)st.MTimespec.Sec;
         indexEntry.MtimeNanosecondFraction = (uint)st.MTimespec.Nsec;
         indexEntry.CtimeSeconds            = (uint)st.CTimespec.Sec;
         indexEntry.CtimeNanosecondFraction = (uint)st.CTimespec.Nsec;
         indexEntry.Size = (uint)st.Size;
         indexEntry.Dev  = (uint)st.Dev;
         indexEntry.Ino  = (uint)st.Ino;
         indexEntry.Uid  = st.UID;
         indexEntry.Gid  = st.GID;
         return(true);
     }
     catch (Win32Exception e)
     {
         EventMetadata metadata = new EventMetadata();
         metadata.Add("path", path);
         metadata.Add("exception", e.ToString());
         tracer.RelatedError(metadata, "Error stat-ing file.");
         return(false);
     }
 }
 public override bool IsSocket(string fileName)
 {
     LinuxNative.StatBuffer statBuffer = StatFile(fileName);
     return(LinuxNative.IsSock(statBuffer.Mode));
 }