Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Jan 2016 11:16:37 -0500
From:      Diane Bruce <db@db.net>
To:        "Batutis, Ed" <Ed.Batutis@netapp.com>, "freebsd-hackers@freebsd.org" <freebsd-hackers@freebsd.org>
Subject:   Re: get number of open files in a process?
Message-ID:  <20160121161637.GA83843@night.db.net>
In-Reply-To: <20160121153636.GA10961@britannica.bec.de>
References:  <ea9f2ab2d4f543c8ad34fdeb082f8c7a@hioexcmbx08-prd.hq.netapp.com> <20160121153636.GA10961@britannica.bec.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jan 21, 2016 at 04:36:36PM +0100, Joerg Sonnenberger wrote:
> On Thu, Jan 21, 2016 at 01:34:18PM +0000, Batutis, Ed wrote:
> > I need to determine the number of open files in my process - all types of file handles total - sockets, files, everything.
> 
> Use getdtablesize() to get the current largest known fd. If you want,
> you can afterwards loop and use fcntl with F_GETFD to check if the
> descriptor is still open.

Better off using getrlimit(2)

> 
> Joerg
> _______________________________________________
> freebsd-hackers@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
> 

Diane
-- 
- db@FreeBSD.org db@db.net http://www.db.net/~db



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160121161637.GA83843>