このページを編集する際は、[[編集に関する方針]]に従ってください。
*概要 [#rb30092c]
-対象:8.1.4
-言語:C
-[[postgresql-8.1.4/src/include/postgres.h]]にて定義
-同じヘッダーファイルを持つ別々のCファイルに、同じ関数名で以下の2通りが記述されている。(別のバイナリにリンクされる?)
**baclend/port/ipc_test.c 内のコード [#p49bb238]
-エラー情報を標準エラー出力に出力した後、プログラムを停止する。
-エラー情報には、引数で指定された、次の情報が含まれる。
--conditionName(エラー状態)
--errorType(エラー値)
--fileName(ファイル名)
--lineNumber(行番号)
**backend/util/error/assert.c 内のコード [#m0b8c84e]
+エラー情報のうち*conditionName、*errorType、*fileNameのどれかのポインタが無効でないか評価
++どれかが無効であれば、「bad arguments」というメッセージを出力する。
++すべて有効であれば、エラー情報を標準エラー出力に出力する。エラー情報には、引数で指定された、次の情報が含まれる。
+++conditionName(エラー状態)
+++errorType(エラー値)
+++fileName(ファイル名)
+++lineNumber(行番号)
+SLEEP_ON_ASSERTオプションをつけてコンパイルしていた場合、約33分スリープする。
+プログラムを停止する。
*引数 [#pad3c3ac]
+conditionName : エラー状態
+errorType : エラー値
+fileName : ファイル名
+lineNumber : 行番号
*実装 [#ra626fd9]
**baclend/port/ipc_test.c 内のコード [#p49bb238]
int
ExceptionalCondition(char *conditionName,
char *errorType,
char *fileName,
int lineNumber)
{
fprintf(stderr, "TRAP: %s(\"%s\", File: \"%s\", Line: %d)\n",
errorType, conditionName,
fileName, lineNumber);
abort();
return 0;
}
**backend/util/error/assert.c 内のコード [#m0b8c84e]
int
ExceptionalCondition(char *conditionName,
char *errorType,
char *fileName,
int lineNumber)
{
if (!PointerIsValid(conditionName)
|| !PointerIsValid(fileName)
|| !PointerIsValid(errorType))
write_stderr("TRAP: ExceptionalCondition: bad arguments\n");
-[[PointerIsValid()/postgresql-8.1.4]]
-[[write_stderr()/postgresql-8.1.4]]
else
{
write_stderr("TRAP: %s(\"%s\", File: \"%s\", Line: %d)\n",
errorType, conditionName,
fileName, lineNumber);
-[[write_stderr()/postgresql-8.1.4]]
}
#ifdef SLEEP_ON_ASSERT
/*
* It would be nice to use pg_usleep() here, but only does 2000 sec or 33
* minutes, which seems too short.
*/
sleep(1000000);
#endif
abort();
return 0;
}
*呼出元 [#uc62c0c9]
-[[TrapMacro()/postgresql-8.1.4]]
*備考 [#b85718ee]
-[[assert()>一般用語]]で評価式が偽になったときのエラーハンドリング
* ExceptionalCondition - Handles the failure of an Assert()
*履歴 [#h6d0daa1]
-作者:[[testnoda:http://d.hatena.ne.jp/testnoda/about]]
-作者:[[testnoda/ページ作者]]
-日付:2006/8/9
|更新日|更新者|更新内容|
||||
*コメント [#ve0d4b36]
#comment