Less known Solaris features: pfiles

This is not a tutorial, just a hint from my toolbox. On customer systems i see the lsof tool quite often. But for a quick check for open files you dont need it.  
There is a small, but extremly useful tool in the collection of the p*-tools. pfiles prints all open files of a process. It takes the PID of the process to specify the process.

<b># pfiles 214</b><br />
214:	/usr/lib/inet/in.iked<br />
  Current rlimit: 256 file descriptors<br />
   0: S_IFDIR mode:0755 dev:102,0 ino:2 uid:0 gid:0 size:512<br />
      O_RDONLY|O_LARGEFILE<br />
      /<br />
   1: S_IFDIR mode:0755 dev:102,0 ino:2 uid:0 gid:0 size:512<br />
      O_RDONLY|O_LARGEFILE<br />
      /<br />
   2: S_IFDIR mode:0755 dev:102,0 ino:2 uid:0 gid:0 size:512<br />
      O_RDONLY|O_LARGEFILE<br />
      /<br />
   3: S_IFREG mode:0600 dev:102,0 ino:28994 uid:0 gid:0 size:47372<br />
      O_RDWR|O_APPEND|O_CREAT|O_LARGEFILE<br />
      /var/log/in.iked.log<br />
   4: S_IFSOCK mode:0666 dev:304,0 ino:48934 uid:0 gid:0 size:0<br />
      O_RDWR|O_NONBLOCK<br />
	SOCK_RAW<br />
	SO_SNDBUF(8192),SO_RCVBUF(8192)<br />
	sockname: AF_INET 10.211.55.200  port: 4500<br />
	peername: AF_INET 10.211.55.200  port: 4500<br />
 [..]<br />
  10: S_IFDOOR mode:0777 dev:306,0 ino:0 uid:0 gid:0 size:0<br />
      O_RDWR FD_CLOEXEC  door to in.iked[214]

And with the xarg tool there is an easy way to print out all open files on the system.

<b># ps -ef -o pid | sort | xargs pfiles  | more</b><br />
0:	sched<br />
  [system process]<br />
1:	/sbin/init<br />
  Current rlimit: 256 file descriptors<br />
   0: S_IFIFO mode:0600 dev:301,3 ino:448255748 uid:0 gid:0 size:0<br />
      O_RDWR|O_NDELAY<br />
      /var/run/initpipe<br />
 253: S_IFREG mode:0444 dev:298,1 ino:65538 uid:0 gid:0 size:0<br />
      O_RDONLY|O_LARGEFILE FD_CLOEXEC<br />
      /system/contract/process/pbundle<br />
 254: S_IFREG mode:0666 dev:298,1 ino:65539 uid:0 gid:0 size:0<br />
      O_RDWR|O_LARGEFILE FD_CLOEXEC<br />
      /system/contract/process/template<br />
 255: S_IFREG mode:0666 dev:298,1 ino:65539 uid:0 gid:0 size:0<br />
      O_RDWR|O_LARGEFILE FD_CLOEXEC<br />
      /system/contract/process/template<br />
[...]