From owner-freebsd-hackers@FreeBSD.ORG Thu Nov 19 15:12:54 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D758D106566C for ; Thu, 19 Nov 2009 15:12:54 +0000 (UTC) (envelope-from spawk@acm.poly.edu) Received: from acm.poly.edu (acm.poly.edu [128.238.9.200]) by mx1.freebsd.org (Postfix) with ESMTP id 7651D8FC0C for ; Thu, 19 Nov 2009 15:12:54 +0000 (UTC) Received: (qmail 77173 invoked from network); 19 Nov 2009 15:12:53 -0000 Received: from unknown (HELO ?192.168.0.131?) (spawk@66.206.120.2) by acm.poly.edu with AES256-SHA encrypted SMTP; 19 Nov 2009 15:12:53 -0000 Message-ID: <4B056039.4040802@acm.poly.edu> Date: Thu, 19 Nov 2009 10:11:53 -0500 From: Boris Kochergin User-Agent: Thunderbird 2.0.0.23 (X11/20090910) MIME-Version: 1.0 To: Koffie Yahoo References: <9cb658f10911190214j5a6bc17fq200a82ea0b4acaa8@mail.gmail.com> <86ocmy63ww.fsf@ds4.des.no> <9cb658f10911190652j555e4484u2427d2bed87871f8@mail.gmail.com> In-Reply-To: <9cb658f10911190652j555e4484u2427d2bed87871f8@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: Getting running time of child X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Nov 2009 15:12:54 -0000 Koffie Yahoo wrote: >>> I've looked but not found (and I hope I'm in the right group here): Is >>> there a way to get the user time and system time of a /running/ child >>> from its parent (without having to mount procfs)? >>> >> If you have only one child, there's getrusage(2). >> > > Unfortunately, that only works for children that have terminated, not > for active children. I'm interested in active children. > > Jay > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > It's not as portable as getrusage(2), but you could probably get the information you want using libkvm's kvm_getprocs(3) function. The information available is defined in the kinfo_proc structure in /usr/include/sys/user.h. -Boris