You could use readlink
on the descriptor.
If the result is not a file, then its a pipe. You could also further run stat
:
On some Unix systems (such as Linux), the following attributes may also be available:
st_blocks
- number of 512-byte blocks allocated for file
st_blksize
- filesystem blocksize for efficient file system I/O
st_rdev
- type of device if an inode device
st_flags
- user defined flags for file