Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!kitty!larry From: larry@kitty.UUCP (Larry Lippman) Newsgroups: net.unix Subject: Re: inodes Message-ID: <1370@kitty.UUCP> Date: Wed, 22-Oct-86 21:40:51 EDT Article-I.D.: kitty.1370 Posted: Wed Oct 22 21:40:51 1986 Date-Received: Thu, 23-Oct-86 04:35:25 EDT References: <47@andromeda.UUCP> Organization: Recognition Research Corp., Clarence, NY Lines: 16 Keywords: Anything like getpwent() for i-nodes ? Summary: Use stat(2) and fstat(2) In article <47@andromeda.UUCP>, marco@andromeda.UUCP (the wharf rat) writes: > Now, my next question: Is there any way to "get" an i-node into a C > program, the way getpwent gets passwd entries ? Do I really have to > open the device file and look for the i-list ? Use stat(2) if you have a pathname for a file, or fstat(2) if you have a file descriptor resulting from another system call which has already opened the file. Both stat(2) and fstat(2) return a pointer to a stucture (found in /usr/include/sys/stat.h), in which the variable st_ino is the inode number. The above applies to System V; but I can't speak for Beserkeley. ==> Larry Lippman @ Recognition Research Corp., Clarence, New York ==> UUCP: {allegra|decvax|rocksanne|rocksvax|watmath}!sunybcs!kitty!larry ==> VOICE: 716/688-1231 {hplabs|ihnp4|seismo|utzoo}!/ ==> FAX: 716/741-9635 {G1,G2,G3} "Have you hugged your cat today?"