Path: utzoo!censor!geac!torsqnt!lethe!yunexus!ists!helios.physics.utoronto.ca!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!spool.mu.edu!uunet!mcsun!ukc!edcastle!eonu24 From: eonu24@castle.ed.ac.uk (I Reid) Newsgroups: comp.unix.questions Subject: Re: File descriptors open info Message-ID: <8800@castle.ed.ac.uk> Date: 28 Feb 91 23:06:19 GMT References: <1991Feb26.213145.26540@batcomputer.tn.cornell.edu> <487@bria> Organization: Edinburgh University Lines: 24 In article <487@bria>: >In an article, theory.tn.cornell.edu!hurf (Hurf Sheldon) writes: >>is there a Unix system call (or some other method) for >>finding out how many file descriptors a process has >>open? >Well, the *real* way to do this is to go munging through the kernel's >process table. :-) Why go to all this trouble when there is a system call to do it (at least in BSD... don't know about anywhere else). Here's a bit of code showing it. _____________________________________________________________________________ #include main () { int nds,mds,a; mds = getdtablemax (); nds = getdtablesize (); printf ("There are %d descriptors (%d maximum) in use at the moment.\n",mds,nds); } _____________________________________________________________________________