What is an anonymous inode in Linux?

前端 未结 2 392
挽巷
挽巷 2020-12-05 01:09

I made a google search about \"anonymous inode\" and it seems it\'s related to epoll ... but what actually is it?

2条回答
  •  一生所求
    2020-12-05 01:29

    At least in some contexts, an anonymous inode is an inode without an attached directory entry. The easiest way to create such an inode is as such:

    int fd = open( "/tmp/file", O_CREAT | O_RDWR, 0666 );
    unlink( "/tmp/file" );
    // Note that the descriptor fd now points to an inode that has no filesystem entry; you
    // can still write to it, fstat() it, etc. but you can't find it in the filesystem.
    

提交回复
热议问题