From owner-freebsd-hackers@freebsd.org Thu Apr 27 13:30:51 2017 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 92612D53873 for ; Thu, 27 Apr 2017 13:30:51 +0000 (UTC) (envelope-from wjw@digiware.nl) Received: from smtp.digiware.nl (smtp.digiware.nl [IPv6:2001:4cb8:90:ffff::3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5253C1D10; Thu, 27 Apr 2017 13:30:51 +0000 (UTC) (envelope-from wjw@digiware.nl) Received: from router.digiware.nl (localhost.digiware.nl [127.0.0.1]) by smtp.digiware.nl (Postfix) with ESMTP id 77782325DB; Thu, 27 Apr 2017 15:30:46 +0200 (CEST) X-Virus-Scanned: amavisd-new at digiware.com Received: from smtp.digiware.nl ([127.0.0.1]) by router.digiware.nl (router.digiware.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Cygub87H-79l; Thu, 27 Apr 2017 15:30:45 +0200 (CEST) Received: from [192.168.10.67] (opteron [192.168.10.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.digiware.nl (Postfix) with ESMTPSA id A24F6325DA; Thu, 27 Apr 2017 15:30:45 +0200 (CEST) Subject: Re: Disabling program core dumps To: Edward Napierala References: <32ac85ed-f0e5-2f80-299a-3bb1166cd5e6@digiware.nl> Cc: "freebsd-hackers@freebsd.org" From: Willem Jan Withagen Message-ID: Date: Thu, 27 Apr 2017 15:30:42 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 13:30:51 -0000 On 27-4-2017 14:48, Edward Napierala wrote: > There's the kern.coredump sysctl, which makes it possible to disable > coredumping globally. Yup, that one I knew. But that is global, where as I'd like to run: setcoreoff(); EXPECT_DEATH(test) setcoreon() And for that I need some micro controls from with in the program. Hence my fiddling with (get|set)_rlimits. --WjW > > 2017-04-27 13:36 GMT+01:00 Willem Jan Withagen >: > > Hi, > > Running (googletest) tests some are expected to die: EXPECT_DEATH(). > This normally dumps a core, but since it is expected that core is rather > useless. > > Thusfar I've found the best way to limit a program to dump core (from > within the program) is to set its RLIMIT_CORE to 0. > > So I can do this before the test, and then set the old size back once > the test is finished. > > Or is there another way, like setting a flag in process state (which I > have not been able to find) > > --WjW > _______________________________________________ > 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 > " > >