예제 #1
0
        public static pollfd Deserialize(ByteBufferRef buf, int offset)
        {
            Contract.Assert(offset >= 0 && offset + Size <= buf.Length);
            pollfd res;

            res.fd      = Deserializer.ReadInt(buf, offset);
            res.events  = Deserializer.ReadShort(buf, offset + sizeof(int));
            res.revents = Deserializer.ReadShort(buf, offset + sizeof(int) + sizeof(short));
            return(res);
        }
예제 #2
0
        public static IOVector Deserialize(byte[] buf, int offset)
        {
            Contract.Requires(offset >= 0);
            Contract.Requires(offset + Size <= buf.Length);

            IOVector r;

            r.iov_base = new UserPtr(Deserializer.ReadUInt(buf, offset)); offset += sizeof(uint);
            r.iov_len  = Deserializer.ReadInt(buf, offset);
            return(r);
        }
예제 #3
0
        public static ELF32ProgramHeader Read(byte[] buf)
        {
            Contract.Requires(buf.Length == Size);
            var r = new ELF32ProgramHeader();

            r.type       = Deserializer.ReadUInt(buf, 0);
            r.offset     = Deserializer.ReadUInt(buf, sizeof(uint));
            r.vaddr      = Deserializer.ReadUInt(buf, sizeof(uint) * 2);
            r.paddr      = Deserializer.ReadUInt(buf, sizeof(uint) * 3);
            r.FileSize   = Deserializer.ReadInt(buf, sizeof(uint) * 4);
            r.MemorySize = Deserializer.ReadInt(buf, sizeof(uint) * 5);
            r.flags      = Deserializer.ReadUInt(buf, sizeof(uint) * 6);
            r.align      = Deserializer.ReadUInt(buf, sizeof(uint) * 7);
            return(r);
        }
예제 #4
0
        public static bool StatIsDir(ByteBufferRef buf)
        {
            var mode = Deserializer.ReadInt(buf, OFFSET_OF_MODE_IN_STAT64);

            return(((mode & S_IFMT) & S_IFDIR) != 0);
        }