From owner-freebsd-arch Fri Dec 15 6:34: 1 2000 From owner-freebsd-arch@FreeBSD.ORG Fri Dec 15 06:33:58 2000 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from warning.follo.net (warning.follo.net [195.204.136.30]) by hub.freebsd.org (Postfix) with ESMTP id C320037B400 for ; Fri, 15 Dec 2000 06:33:48 -0800 (PST) Received: (from eivind@localhost) by warning.follo.net (8.9.3/8.9.3) id PAA77514; Fri, 15 Dec 2000 15:33:45 +0100 (CET) Date: Fri, 15 Dec 2000 15:33:45 +0100 From: Eivind Eklund To: Martin Blapp Cc: arch@FreeBSD.ORG Subject: Re: _DIAGASSERT() Message-ID: <20001215153345.A76398@warning.follo.net> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.4i In-Reply-To: ; from mb@imp.ch on Fri, Dec 15, 2000 at 03:08:48PM +0100 Sender: eivind@warning.follo.net Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Fri, Dec 15, 2000 at 03:08:48PM +0100, Martin Blapp wrote: > > Hi, > > I'm porting code from NetBSD and ask myself if I should remove > some userland-code _DIAGASSERT()'s ... > > There is nothing appropriate in FreeBSD like diagassert() ... > > In NetBSD this is defined therefore : > > include/assert.h:# define _DIAGASSERT(e) ((e) ? (void)0 > : __diagassert(__FILE__, __LINE__, "e")) > > and in libc/gen/assert.c : > > void > __diagassert(file, line, failedexpr) > const char *file, *failedexpr; > int line; > { > /* > * XXX: check $DIAGASSERT here, and do user-defined > actions > */ > (void)fprintf(stderr, > "%s: assertion \"%s\" failed: file \"%s\", line %d\n", > __progname, failedexpr, file, line); > syslog(LOG_DEBUG|LOG_USER, > "assertion \"%s\" failed: file \"%s\", line %d", > failedexpr, file, line); > return; > } The relevant question is really "Should we add this, and if so in what exact form - or should we just drop the internal rigidity tests NetBSD has added?" I think the right answer is to add it, but with LOG_ERR instead of LOG_DEBUG - failure of the internal invariants in the code is something we want the user to see, not syslogd to discard. Eivind. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message