strange interaction between open and cwd

Nobody nobody at nowhere.com
Thu May 6 00:24:33 EDT 2010


On Thu, 06 May 2010 10:21:45 +1000, Cameron Simpson wrote:

> Look at the st_rdev field (== the device holding this inode).
> When that changes, you've crossed a mount mount point.

st_dev reports the device on which the inode resides.

st_rdev is only meaningul if the inode type is block device (S_IFBLK) or
character device (S_IFCHR), in which case it identifies the device to
which the inode refers, e.g.:

> os.stat("/").st_dev
2049L
> os.stat("/").st_rdev
0
> os.stat("/dev/sda1").st_dev
2049L
> os.stat("/dev/sda1").st_rdev
2049
> os.stat("/dev/sda2").st_dev
2049L
> os.stat("/dev/sda2").st_rdev
2050

(/dev/sda1 is mounted as the root filesystem).




More information about the Python-list mailing list