How to get device information from a file descriptor ?

Alan's Home for Wayward Notes File. alan at shodha.enet.dec.com
Wed Jun 5 00:12:19 AEST 1991


In article <1991Jun3.104948.20582 at info-sparc1.info.ucl.ac.be>, Ninane at fynu.ucl.ac.be (Alain Ninane - FYNU) writes:
> Dear all of you,
> Given a valid file descriptor [from an open(2) call], is there a
> standard way to know whether or not this fd points to a specific
> special file/device (major number only) ?

	You can use stat(2) on the file descriptor to get more
	information about the file.  Among the information is
	the mode flag that will bits to indicate whether the
	device is a directory, ordinary file, character special
	device or block special device (and maybe others).  There
	is also field with the major and minor device number.

	On ULTRIX you can get more detailed information about the
	device with the ioctl documented in the devio(4) manual
	page.

> Dr. Alain H. Ninane, University of Louvain, Nuclear Physics Dept.


-- 
Alan Rollow				alan at nabeth.cxn.dec.com



More information about the Comp.unix.ultrix mailing list