Hi,
I am a Unix Newbie

.
I want to write a program such a way that:
Whenever number of filedescriptors opened by a process change, it should execute some commands (eg: write total number of FDs at that point of time to a file).
I dont want to poll '/proc/<pid>/fd' at regular intervals (say 1min) because number of FDs change randomly.
If number of FDs change very frequently, then it will lead to inaccurate results if polling interval is large.
If number of FDs change very rarely (couple of changes per hr) , then it is waste to keep on polling.
So is there any other way to achieve my goal?
A psuedocode, sample shell script, C, Java prog, anything is OK for me.
Kindly help me in this..
Thanks in advance..
