このページを編集する際は、編集に関する方針に従ってください。

概要

baclend/port/ipc_test.c 内のコード

backend/util/error/assert.c 内のコード

  1. エラー情報のうち*conditionName、*errorType、*fileNameのどれかのポインタが無効でないか評価
    1. どれかが無効であれば、「bad arguments」というメッセージを出力する。
    2. すべて有効であれば、エラー情報を標準エラー出力に出力する。エラー情報には、引数で指定された、次の情報が含まれる。
      1. conditionName(エラー状態)
      2. errorType(エラー値)
      3. fileName(ファイル名)
      4. lineNumber(行番号)
  2. SLEEP_ON_ASSERTオプションをつけてコンパイルしていた場合、約33分スリープする。
  3. プログラムを停止する。

引数

  1. conditionName : エラー状態
  2. errorType : エラー値
  3. fileName : ファイル名
  4. lineNumber : 行番号

実装

baclend/port/ipc_test.c 内のコード

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 内のコード

int ExceptionalCondition(char *conditionName,

					 char *errorType,
					 char *fileName,
					 int lineNumber)

{

	if (!PointerIsValid(conditionName)
		|| !PointerIsValid(fileName)
		|| !PointerIsValid(errorType))
		write_stderr("TRAP: ExceptionalCondition: bad arguments\n");
	else
	{
		write_stderr("TRAP: %s(\"%s\", File: \"%s\", Line: %d)\n",
					 errorType, conditionName,
					 fileName, lineNumber);
	}
	

#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;

}

呼出元

備考

* ExceptionalCondition - Handles the failure of an Assert()

履歴

コメント



トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS