• Pavel Emelyanov's avatar
    packet: Support mmap-ing of packet sockets · d4735a22
    Pavel Emelyanov authored
    Three parts.
    
    Proc: open of map_files' link doesn't work on sockets. We fstatat
    it and check that it's a socket (it will be packet), then save
    the socket inode on vma_area.
    
    Dump: we resolve socket inode to socket id and save it on vma.
    We use id, not inode, since on restore we'll have to mmap some
    opened file, not just abstract socket with inode.
    
    Restore: when reading vma-s we just need to find out on what fd
    the respective packet socket is opened (i.e. -- no map-and-close
    sockets supported by now) and dup() it to let restorer mmap it
    back.
    
    All this make it possible to c/r the tcpdump tool!
    Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
    d4735a22
sk-packet.c 10.8 KB