Date: Fri, 15 Dec 2000 15:33:45 +0100 From: Eivind Eklund <eivind@FreeBSD.ORG> To: Martin Blapp <mb@imp.ch> Cc: arch@FreeBSD.ORG Subject: Re: _DIAGASSERT() Message-ID: <20001215153345.A76398@warning.follo.net> In-Reply-To: <Pine.BSF.4.21.0012151505110.10655-100000@levais.imp.ch>; from mb@imp.ch on Fri, Dec 15, 2000 at 03:08:48PM %2B0100 References: <Pine.BSF.4.21.0012151505110.10655-100000@levais.imp.ch>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001215153345.A76398>
