Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Re: •Re: open file descriptors

by exussum0 (Vicar)
on Dec 13, 2003 at 22:03 UTC ( #314559=note: print w/ replies, xml ) Need Help??


in reply to Re: •Re: open file descriptors
in thread open file descriptors

Having something, a system call, that could count all open file handles would be in the same class of functions like flock: only compatable to a point. I've never heard of a function in unix to do that, but I know that procfs hints you in on what's going on w/ a process.


Play that funky music white boy..


Comment on Re: Re: •Re: open file descriptors
Re: Re: Re: •Re: open file descriptors
by etcshadow (Priest) on Dec 13, 2003 at 22:28 UTC
    Yeah, you're right... it's not a system call issue (with the flush on fork), but an issue with the fact that perl doesn't have a fflush() builtin which emulates the fflush() in unix... that is: having the ability to flush all fd's (not just individual named fd's).

    Anyway, because I remembered that issue wrong, I made the incorrect leap that there must be an unimplemented-in-perl system call to get all open fd's.

    Anyway, my bad. Thanks. Still, it seems like there ought to be a faster way to find all open fd's than iterating through all *possible* fileno's looking for ones that are open fd's. Oh, well.


    ------------
    :Wq
    Not an editor command: Wq
      Well, in linux, you can do something like find

      /proc/123/fd/ -type f | wc -l

      FreeBSD doesn't have fd and osx doesn't even have /proc :(


      Play that funky music white boy..
        Yeah I'm familiar with linux's proc filesystem (I love it, in fact), but this question is about writing a portable application. Also, I reallize that system calls are not necessarily portable from one O/S to another... that's why psuedo system calls as perl builtins are so nice. Like: I don't have to know what each O/S's system call is for deleting a file, but I know that in perl, unlink does the trick.

        ------------
        :Wq
        Not an editor command: Wq

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://314559]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2014-07-25 08:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (170 votes), past polls