Xref: utzoo comp.unix.wizards:23101 comp.unix.questions:24083 Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!snorkelwacker!bloom-beacon!athena.mit.edu!jik From: jik@athena.mit.edu (Jonathan I. Kamens) Newsgroups: comp.unix.wizards,comp.unix.questions Subject: Re: How do I read an inode? Keywords: unix,inodes Message-ID: <1990Jul27.010549.2567@athena.mit.edu> Date: 27 Jul 90 01:05:49 GMT References: <114837@linus.mitre.org> Sender: daemon@athena.mit.edu (Mr Background) Reply-To: jik@athena.mit.edu (Jonathan I. Kamens) Followup-To: comp.unix.questions Organization: Massachusetts Institute of Technology Lines: 32 (Note the Followup-To and cross-post on this; I don't really think it's a wizard-level question.) In article <114837@linus.mitre.org>, oking@smiley.arpa (Osborne I King) writes: |> How do I read inode information associated with |> a special file for example: a block special file. Your subject line says, "How do I read an inode?" and your message says, "How do I read inode information associated with a special file..." but I'm still not sure what you're asking. What "inode information" are you asking about? Since you mention special files in particular, my best guess is that you're talking about the major and minor device numbers and the device type. To obtain both of these, you use the stat() system call, the same way you would to obtain file information about any regular file. In particular, the st_mode field of the stat structure tells you whether it's a character or block special device (S_IFCHR and S_IFBLK on BSD, I don't know what it is on others), and the st_rdev field tells you the major and minor device numbers (the first two bytes are the major number, and the second two bytes are the minor number). If that isn't what you're talking about, please explain a little bit more clearly what you *are* talking about, so we can help you :-). Jonathan Kamens USnail: MIT Project Athena 11 Ashford Terrace jik@Athena.MIT.EDU Allston, MA 02134 Office: 617-253-8495 Home: 617-782-0710