/*
* Copyright (c) 2000-2001 Proofpoint, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
* forth in the LICENSE file which can be found at the top level of
* the sendmail distribution.
*
*/
/*
** Abnormal program termination and assertion checking.
** For documentation, see assert.html.
*/
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
/*
** Debug categories that are used to guard expensive assertion checks.
*/
"@(#)$Debug: sm_check_assert - check assertions $");
"@(#)$Debug: sm_check_require - check function preconditions $");
"@(#)$Debug: sm_check_ensure - check function postconditions $");
/*
** Debug category: send self SIGSTOP on fatal error,
** so that you can run a debugger on the stopped process.
*/
"@(#)$Debug: sm_abort_stop - stop process on fatal error $");
/*
** SM_ABORT_DEFAULTHANDLER -- Default procedure for abnormal program
** termination.
**
** The goal is to display an error message without disturbing the
** process state too much, then dump core.
**
** Parameters:
** filename -- filename (can be NULL).
** lineno -- line number.
** msg -- message.
**
** Returns:
** doesn't return.
*/
static void
const char *filename,
int lineno,
const char *msg));
static void
const char *filename;
int lineno;
const char *msg;
{
else
#ifdef SIGSTOP
#endif /* SIGSTOP */
abort();
}
/*
** This is the action to be taken to cause abnormal program termination.
*/
/*
** SM_ABORT_SETHANDLER -- Set handler for SM_ABORT()
**
** This allows you to set a handler function for causing abnormal
** program termination; it is called when a logic bug is detected.
**
** Parameters:
** f -- handler.
**
** Returns:
** none.
*/
void
{
if (f == NULL)
else
SmAbortHandler = f;
}
/*
** SM_ABORT -- Call it when you have detected a logic bug.
**
** Parameters:
** fmt -- format string.
** ... -- arguments.
**
** Returns:
** doesn't.
*/
void SM_DEAD_D
#if SM_VA_STD
#else /* SM_VA_STD */
char *fmt;
#endif /* SM_VA_STD */
{
}
/*
** SM_ABORT_AT -- Initiate abnormal program termination.
**
** This is the low level function that is called to initiate abnormal
** program termination. It prints an error message and terminates the
** program. It is called by sm_abort and by the assertion macros.
** If filename != NULL then filename and lineno specify the line of source
** code at which the bug was detected.
**
** Parameters:
** filename -- filename (can be NULL).
** lineno -- line number.
** msg -- message.
**
** Returns:
** doesn't.
*/
void SM_DEAD_D
const char *filename;
int lineno;
const char *msg;
{
"exception raised by abort handler:\n");
/*
** SmAbortHandler isn't supposed to return.
** Since it has, let's make sure that the program is terminated.
*/
abort();
}