Re: How to close rogue file descriptors?

From: Kamal R. Prasad (kamalp_at_acm.org)
Date: 09/28/03

  • Next message: Kamal R. Prasad: "Re: cpp - C language preprocessor"
    Date: 28 Sep 2003 06:15:27 -0700
    
    

    kyndig@unixpowered.org (Kyndig) wrote in message news:<4a8a6f54.0309090634.8e441b7@posting.google.com>...
    > Let's say a program opens a bunch of file handles and then dies
    > non-gracefully, leaving this(on a linux box):
    >
    > bash-2.05$ /sbin/sysctl fs.file-nr
    > fs.file-nr = 65536 64352 65536
    >
    > I was under the impression that when a process dies, all descriptors
    > are freed by the kernel; but I must be wrong. Is there a way to close
    > all those file descriptors without rebooting?

    My knowledge of UNIX is a bit antiquated but AFAIK:-
     When the reference count of a file descriptor becomes 0, the global
    file descriptor table will be pruned appropriately. There is also a
    local file descriptor table -which will definately be deleted when the
    process dies. This happens because the entire process context is
    eliminated (along with the u area).

    regards
    -kamal


  • Next message: Kamal R. Prasad: "Re: cpp - C language preprocessor"