System call: how many file descriptors left? - Unix

This is a discussion on System call: how many file descriptors left? - Unix ; Is there any system call from C/C++ one can make to see how many file descriptors are left for a given process? If not, a shell call would be of some use too. Thank you very much, JC...

+ Reply to Thread
Results 1 to 2 of 2

Thread: System call: how many file descriptors left?

  1. System call: how many file descriptors left?

    Is there any system call from C/C++ one can make to see how many file
    descriptors are left for a given process? If not, a shell call would be

    of some use too.


    Thank you very much,
    JC


  2. Re: System call: how many file descriptors left?

    In article <1126821737.058208.225120@g49g2000cwa.googlegroups. com>,
    wrote:
    >
    >
    >Is there any system call from C/C++ one can make to see how many file
    >descriptors are left for a given process? If not, a shell call would be
    >
    >of some use too.
    >
    >
    >Thank you very much,
    >JC
    >


    Depends on your OS, but you could check what ulimit() or getrlimit()
    do on your system.

    There's also the empirical method: Keep opening /dev/null until
    it fails (or until you see that you have "enough" for your purposes),
    see what descriptor that was, then close them all.

    Ted

+ Reply to Thread