Chinaunix

标题: 求解man getdents中的例子程序输出问题 [打印本页]

作者: tingyu    时间: 2013-07-03 18:27
标题: 求解man getdents中的例子程序输出问题
man getdents
里面提供的例子,在ext2文件系统下结果如下:
--------------- nread=128 ---------------
i-node#  file type  d_reclen  d_off   d_name
    1257  directory    16         12  .
       2  directory    16         24  ..
    1258  regular      24         44  test.cpp2
    1259  regular      24         64  test.cpp3
    1260  regular      24         84  test.cpp1
    1261  regular      24       1024  test.cpp4

而在ext3/ext4下确实这样:
--------------- nread=128 ---------------
i-node#  file type  d_reclen  d_off   d_name
    1258  directory    16  468705506  .
    1259  regular      24  800285782  test.cpp2
    1261  regular      24 1236909303  test.cpp1
    1260  regular      24 1941497279  test.cpp3
       2  directory    16 2069868563  ..
    1262  regular      24 2147483647  test.cpp4

这个d_off怎么到最后一个文件都是2147483647??
作者: tingyu    时间: 2013-07-03 18:28
再附加一个问题,在ext4文件系统中

        fd = open("/root/",0x0000);
        file_size = lseek(fd, 0 , SEEK_END);

对于任何目录,这个偏移量为什么也是2147483647?
作者: tingyu    时间: 2013-07-04 08:12
莫有大神吗?




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2