OSDN Git Service

This patch removes a lot of unused code related to assertions and
[pg-rex/syncrep.git] / src / backend / utils / error / assert.c
1 /*-------------------------------------------------------------------------
2  *
3  * assert.c
4  *        Assert code.
5  *
6  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  *
10  * IDENTIFICATION
11  *        $Header: /cvsroot/pgsql/src/backend/utils/error/assert.c,v 1.22 2002/08/10 20:29:18 momjian Exp $
12  *
13  * NOTE
14  *        This should eventually work with elog()
15  *
16  *-------------------------------------------------------------------------
17  */
18 #include "postgres.h"
19
20 #include <unistd.h>
21
22 /*
23  * ExceptionalCondition - Handles the failure of an Assert()
24  */
25 int
26 ExceptionalCondition(char *conditionName,
27                                          char *errorType,
28                                          char *fileName,
29                                          int lineNumber)
30 {
31         if (!PointerIsValid(conditionName)
32                 || !PointerIsValid(fileName)
33                 || !PointerIsValid(errorType))
34         {
35                 fprintf(stderr, "TRAP: ExceptionalCondition: bad arguments\n");
36         }
37         else
38         {
39                 fprintf(stderr, "TRAP: %s(\"%s\", File: \"%s\", Line: %d)\n",
40                                 errorType, conditionName,
41                                 fileName, lineNumber);
42         }
43
44 #ifdef SLEEP_ON_ASSERT
45         sleep(1000000);
46 #endif
47
48         abort();
49
50         return 0;
51 }