nyitott file leírója kié?

Fórumok

Kerestem de nem igazán találtam rá megoldást, hogy hogyan tudom megnézni, hogy egy adott file (elérési út alapján) már megnyitotta az programom vagy még nem.
Tehát mivel/hogyan tudom megmondani, hogy mi egy adott file leírója, vagy egy adott leíró melyik file-lé?

Hozzászólások

Ennek egyezőségét is vizsgáld:

dev_t     st_dev;     /* ID of device containing file */

Az inode-szám csak file-rendszeren belül kötelezően egyedi.

Mindenesetre töltsd le ezt: ftp://ftp.gnu.org/gnu/diffutils/diffutils-2.8.1.tar.gz, és nézd meg a

diffutils-2.8.1/src/system.h

-ban a

same_file

makró definícióját (meg a környező kommenteket). Érdekes megfigyelni a

same_special_file

makrót is. (A char/block device-oknál ugye van még egy indirekció.)

Továbbá (idézve a Single UNIX(R) Specification v3-ból,

sys/stat.h

, RATIONALE szakasz):

Note that

st_dev

must be unique within a Local Area Network (LAN) in a ``system'' made up of multiple computers' file systems connected by a LAN.

Networked implementations of a POSIX-conforming system must guarantee that all files visible within the file tree (including parts of the tree that may be remotely mounted from other machines on the network) on each individual processor are uniquely identified by the combination of the

st_ino

and

st_dev

fields.