From owner-freebsd-hackers@freebsd.org Thu Jan 21 15:51:55 2016 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B92C2A8AFB9 for ; Thu, 21 Jan 2016 15:51:55 +0000 (UTC) (envelope-from fernando.apesteguia@gmail.com) Received: from mail-wm0-x233.google.com (mail-wm0-x233.google.com [IPv6:2a00:1450:400c:c09::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 59BA41C28 for ; Thu, 21 Jan 2016 15:51:55 +0000 (UTC) (envelope-from fernando.apesteguia@gmail.com) Received: by mail-wm0-x233.google.com with SMTP id l65so225656015wmf.1 for ; Thu, 21 Jan 2016 07:51:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=cy2xe29QRsXTGhgDseAEuCzyEaUrcmp3Ni7IJkx3HIk=; b=bvmG+IxYyuyyZ4TCUqVLu/OzklqVIqduTK9lffF/9BsKm29IdfVcn19BAH4gHELani YoYJYpymQxPOaacax7gkcvShFIY9ZEOLUdlpb61f2wJ7hPJ8X8nk6VSQAc7IP5KQekRF Jmjc7duGOQgitrP5bknr4oVHOp6kqUVcp7P0as9F8oC3TrQDYH5OFwXUmGvDIjsOUh5Y LlYaPPpCNa1S47ynMCP45GofWuCzGi4aCZLE6ibJnTRg98FCyDXo5wcpw3p/3IqY8z1L /GQEipg8xos+g7/iPPwhcFRqTzBOqJ+vVOTnRKiJqsxup8YTOn2qRSy0UDmDkIKy2oDH XuYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=cy2xe29QRsXTGhgDseAEuCzyEaUrcmp3Ni7IJkx3HIk=; b=gT9WxbQ23Pmci+SXqOzzcxs/lxeEq/LzYyEA1myouLETVs3s11GWGunzQ2SN3AMl6a z9El8WEce+2JALkpdxaenAHOuQ/grubwT0/4ZQkI8kqMgKGqwj0WLqeOoRjhzKT8wAn7 RYa64B4oAoc4pme6TkzXdCbly7vccZQIbAxcjNuKPUPg767hi6erRvBqkenpNelAjWe7 VyHxgMPbeUqsU5zhuWzs2z4b6bmfhdpbrzI7mnwwjMgaS3WKmVdwX+WM1tcvd2jGlMRN He7VZgUvsVUWXCn3CifzfejX6LJKGQVCZd4k/N0C8o6tyG8dsKwKO1hYzJ1KAySyoU0j W9xA== X-Gm-Message-State: AG10YOTZNZnEN8LT4qtOz/GlsWI6xwuZ2BsrR1XlZdjzvWNsHkkntXX2M9Q/Prqi6m7F4dUg2sqBCV8IMGnNUg== MIME-Version: 1.0 X-Received: by 10.28.89.69 with SMTP id n66mr11668490wmb.63.1453391513216; Thu, 21 Jan 2016 07:51:53 -0800 (PST) Received: by 10.27.177.223 with HTTP; Thu, 21 Jan 2016 07:51:53 -0800 (PST) In-Reply-To: <20160121153636.GA10961@britannica.bec.de> References: <20160121153636.GA10961@britannica.bec.de> Date: Thu, 21 Jan 2016 16:51:53 +0100 Message-ID: Subject: Re: get number of open files in a process? From: =?UTF-8?Q?Fernando_Apestegu=C3=ADa?= To: "Batutis, Ed" , "freebsd-hackers@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jan 2016 15:51:55 -0000 On Thu, Jan 21, 2016 at 4:36 PM, 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. I don't have a FreeBSD box in front of me right now, but don't we have this information in the sysctl tree? I remember we have the current system-wide open fd's... Cheers. > > 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"