[AIX 진단 서브시스템 13] 진단 라이브러리 (4) 진단 이벤트 로그 함수와 DA 종료 코드
https://archive.horanglab.com/posts/aix-diag-lib-4
핵심 정리
- 진단 이벤트 로그를 직접 다루는 순서:
dlog_open(NULL이면 기본 로그,dl_info할당) →dlog_find_first(조건 문자열을dlSearch로 해석) →dlog_find_next반복 또는dlog_find_sequence·dlog_read→ 항목마다dlog_freeEntry→dlog_close. - 검색 조건 문자열은
-d 장치 -n 순번 -L 위치 -t 유형 -i 식별자 -s 시작 -e 끝(시각은 MMddhhmmyy)입니다. dlog_write는 이벤트를 기록하며 /var가 가득 차면ERROR_FS를 돌려줍니다.dlog_formatElogResults는 errpt에 보일 진단 로그 정보 문자열을 만듭니다.save_davars_ela는 SRN(또는 오류 코드)과 오류 로그 식별자·순번을ErrorLog689-130같은 DAVars 객체로,save_davars_mgoal_ela는 메뉴 목표를ErrorMenu651202같은 객체로 남깁니다.- DA는
DA_SETRC_STATUS/USER/ERROR/TESTS/MORE로 종료 코드 비트 필드를 설정하고DA_EXIT()로 끝냅니다. 기본값은 GOOD, NOKEY, NONE, NOTEST, NOCONT입니다.
| 항목 | 내용 |
|---|---|
| 버전 | AIX 5.3, AIX 6.1 (내용이 같음) |
| 원문 | Understanding the Diagnostic Subsystem for AIX — 5.3판 3장(150162쪽), 6.1판 141153쪽 |
| 라이브러리 | /usr/lib/libdiag.a |
| 헤더 | diag/diag_log.h, diag/diag_exit.h |
dlog_getTestMode
목적
지정한 장치에 대해 CDiagAtt의 dlog_testmode 속성 값을 돌려줍니다.
구문
#include <diag/diag_log.h>
int dlog_getTestMode(char *name)
설명
dlog_getTestMode 서브루틴은 지정한 장치에 대해 속성이 dlog_testmode인 CDiagAtt 객체를 가져와 그 값을 돌려줍니다.
매개변수
| 매개변수 | 설명 |
|---|---|
name |
장치 이름을 가리키는 문자 포인터 |
반환값
성공하면 시험 모드를 돌려줍니다. 객체가 없으면 -1을 돌려줍니다.
영어 원문
dlog_getTestMode
Purpose
Return the value of the dlog_testmode attribute in CDiagAtt for the specified device.
Syntax
#include <diag/diag_log.h>
int dlog_getTestMode(char *name)
Description
The dlog_getTestMode subroutine gets a CDiagAtt object for the specified device with an attribute of dlog_testmode. The value of the dlog_testmode is returned.
Parameters
- name — Character pointer to the name of the device
Return Value
Upon successful completion, the test mode is returned. Otherwise, -1 is returned if the object does not exist.
dlog_close
목적
dlog_open으로 연 진단 이벤트 로그를 닫습니다.
구문
#include <diag/diag_log.h>
int dlog_close(dl_info *info)
설명
dlog_close 서브루틴은 dlog_open으로 연 로그 파일을 닫습니다. dlog_open이 할당한 메모리도 해제합니다.
매개변수
| 매개변수 | 설명 |
|---|---|
info |
dl_info 구조체의 포인터(정의는 dlog_open 절) |
반환값
성공하면 0을, 아니면 -1을 돌려줍니다.
영어 원문
dlog_close
Purpose
Closes the Diagnostic Event Log opened by dlog_open.
Syntax
#include <diag/diag_log.h>
int dlog_close(dl_info *info)
Description
The dlog_close subroutine closes the log file opened with dlog_open. It will also free the memory allocated with dlog_open.
Parameters
- info — Pointer to structure of format:
typedef struct _log_info { int fd; /* File descriptor */ int lockId; /* ODM Lock id */ dl_att *dlAtt; /* Pointer to log attributes */ dl_einfo *dlArray; /* Pointer to log array */ } dl_info; typedef struct _log_einfo { int version; /* Entry Version */ char logType; /* Log Type - I,S,N,E,X */ unsigned int size; /* Entry Size */ unsigned int offset; /* Offset from the file’s beginning */ } dl_einfo; typedef struct _log_att { int version; /* Version */ unsigned int numEntries; /* number of log entried */ unsigned int lastIndex; /* index of latest entry */ unsigned int nextSeqNum; /* sequence number of next log entry */ unsigned int maxLogSize; /* maximum size of log */ unsigned int arrayOffset; /* array offset */ unsigned int wrapCount; /* number of times file has wrapped */ } dl_att;
Return Value
Upon successful completion, 0 is returned. Otherwise, a value of -1 is returned.
dlog_find_first
목적
지정한 조건에 맞는 첫 진단 로그 항목을 찾습니다.
구문
#include <diag/diag_log.h>
int dlog_find_first
(dl_info *dlogInfo,char *criteria,dlSearch *filter,dlEntry **results)
설명
dlog_find_first 서브루틴은 지정한 조건에 맞는 첫 진단 로그 항목을 찾습니다. 검색 조건을 해석해 뒤이은 검색을 위한 dlSearch 구조체도 초기화합니다. 맞는 항목의 메모리를 할당하고 그 항목의 배열 인덱스를 돌려줍니다. dlEntry에 할당한 메모리를 해제하는 것은 호출 응용 프로그램의 책임입니다.
dlog_find_next를 부르기 전에 이 함수를 부릅니다.
매개변수
| 매개변수 | 설명 |
|---|---|
dlogInfo |
dl_info에 든 로그 정보의 포인터 |
criteria |
검색 조건. 아래 옵션을 조합합니다. |
filter |
해석한 검색 조건 |
results |
검색 조건에 맞는 항목의 포인터 |
criteria 옵션
| 옵션 | 뜻 |
|---|---|
-d device_name |
장치 이름 |
-n dlog_sequenceNumber |
진단 로그 순번 |
-L deviceLocation |
장치 위치 |
-t entryType |
항목 유형 |
-i dlog_EntryIdentifier |
진단 로그 항목 식별자 |
-s startTime |
시작 시각(형식 MMddhhmmyy) |
-e endTime |
끝 시각(형식 MMddhhmmyy) |
반환값
성공하면 0 이상의 값을, 아니면 -1을 돌려줍니다.
영어 원문
dlog_find_first
Purpose
Finds the first diagnostic log entry that matches the specified criteria.
Syntax
#include <diag/diag_log.h>
int dlog_find_first
(dl_info *dlogInfo,char *criteria,dlSearch *filter,dlEntry **results)
Description
The dlog_find_first subroutine finds the first diagnostic log entry that matches the specified criteria. It also parses the search criteria and uses this to initialize the dlSearch structure for subsequent searches. It allocates memory for the matching entry, and returns the array index of the matching entry. It is the responsibility of the calling application to free the memory allocated for dlEntry.
Parameters
- dlogInfo — Pointer to log information in
dl_info - criteria — search criteria consisting of any of the following:
-ddevice_name-ndlog_sequenceNumber-LdeviceLocation-tentryType-idlog_EntryIdentifier-sstartTime (format MMddhhmmyy)-eendTime (format MMddhhmmyy) - filter — parsed search criteria
- results — pointer to entry matching the search criteria
Call this function before calling dlog_find_next.
Return Value
Upon successful completion, a value >= 0 is returned. Otherwise, a value of -1 is returned.
dlog_find_next
목적
지정한 조건에 맞는 다음 진단 로그 항목을 찾습니다(원문 목적은 dlog_find_first와 같은 "첫 항목").
구문
#include <diag/diag_log.h>
int dlog_find_next(dl_info *dlogInfo,int index,dlSearch *filter,dlEntry **results)
설명
dlog_find_next 서브루틴은 지정한 검색 필터에 맞는 (시작 인덱스부터) 첫 진단 로그 항목을 찾습니다. 맞는 항목의 메모리를 할당하고 그 항목의 배열 인덱스를 돌려줍니다. dlEntry에 할당한 메모리를 해제하는 것은 호출 응용 프로그램의 책임입니다.
매개변수
| 매개변수 | 설명 |
|---|---|
dlogInfo |
dl_info에 든 로그 정보의 포인터 |
index |
시작 인덱스 |
filter |
해석한 검색 조건 |
results |
검색 조건에 맞는 항목의 포인터 |
반환값
성공하면 0 이상의 값을, 아니면 -1을 돌려줍니다.
영어 원문
dlog_find_next
Purpose
Finds the first diagnostic log entry that matches the specified criteria.
Syntax
#include <diag/diag_log.h>
int dlog_find_next(dl_info *dlogInfo,int index,dlSearch *filter,dlEntry **results)
Description
The dlog_find_next subroutine finds the first diagnostic log entry that matches the specified search filter. It allocates memory for the matching entry, and returns the array index of the matching entry. It is the responsibility of the calling application to free the memory allocated for dlEntry.
Parameters
- dlogInfo — Pointer to log information in
dl_info - index — Starting index
- filter — Parsed search criteria
- results — Pointer to entry matching the search criteria
Return Value
Upon successful completion, a value >= 0 is returned. Otherwise, a value of -1 is returned.
dlog_find_sequence
목적
지정한 순번을 가진 진단 로그 항목을 찾습니다.
구문
#include <diag/diag_log.h>
int dlog_find_sequence(dl_info *dlogInfo,uint seq,dlEntry **results)
설명
dlog_find_sequence 서브루틴은 특정 진단 로그 순번을 가진 진단 로그 항목을 찾습니다. 맞는 항목은 results에 들어가고, 로그 배열에서의 인덱스를 돌려줍니다. dlEntry에 할당한 메모리를 해제하는 것은 호출 응용 프로그램의 책임입니다. 맞는 것이 없으면 results 변수는 NULL입니다.
매개변수
| 매개변수 | 설명 |
|---|---|
dlogInfo |
dl_info에 든 로그 정보의 포인터 |
seq |
순번 |
results |
지정한 순번을 가진 항목의 포인터 |
반환값
성공하면 0 이상의 값을, 아니면 -1을 돌려주고 results는 NULL이 됩니다.
영어 원문
dlog_find_sequence
Purpose
Finds the diagnostic log entry that has the specified sequence number.
Syntax
#include <diag/diag_log.h>
int dlog_find_sequence(dl_info *dlogInfo,uint seq,dlEntry **results)
Description
The dlog_find_sequence subroutine finds the diagnostic log entry with a specific diagnostic log sequence number. The matching entry will be in results and its index in the log array will be returned. It is the responsibility of the calling application to free the memory allocated for dlEntry. The results variable will be NULL if no match is found.
Parameters
- dlogInfo — Pointer to log information in
dl_info - seq — Sequence number
- results — Pointer to entry with the specified sequence number
Return Value
Upon successful completion, a value >= 0 is returned. Otherwise, a value of -1 is returned and results will be NULL.
dlog_formatElogResults
목적
진단 이벤트 로그 정보를 서식화한 문자열을 돌려줍니다.
구문
#include <diag/diag_log.h>
char *dlog_formatElogResults(dlEntry *entry)
설명
dlog_formatElogResults 서브루틴은 진단 로그 항목을 errpt 명령으로 오류 로그에 표시할 수 있게 서식화합니다. 오류 로그의 항목 때문에 SRN이 생기면, 오류 로그에 진단 로그 항목의 순번이 기록됩니다. 오류 로그를 표시할 때 이 서브루틴이 돌려준 서식 문자열이 진단 로그 정보를 보여 줍니다. 돌려준 문자열의 메모리 해제는 호출 응용 프로그램의 몫입니다.
돌려주는 문자열은 다음과 같습니다.
Diagnostic Log sequence number: sequence number
Resource tested: resource name
Resource Description: resource description
Location: resource location
SRN: SRN
Description: Error Description
Possible FRUs: List of possible FRUs
매개변수
| 매개변수 | 설명 |
|---|---|
dlogEntry |
진단 로그 항목의 포인터(구문의 이름은 entry) |
반환값
성공하면 0이 아닌 포인터를, 아니면 NULL 포인터를 돌려줍니다.
영어 원문
dlog_formatElogResults
Purpose
Returns a formatted string of the diagnostic event log information.
Syntax
#include <diag/diag_log.h>
char *dlog_formatElogResults(dlEntry *entry)
Description
The dlog_formatElogResults subroutine formats a diagnostic log entry for display in the error log with the errpt command. When a SRN is caused by an entry in the error log, the error log is updated with the
diagnostic log entry's sequence number. When the error log is displayed the formatted string returned from this subroutine shows the diagnostic log information. It is up to the calling application to free the memory allocated for the return string.
The return string will look like the following:
Diagnostic Log sequence number: sequence number
Resource tested: resource name
Resource Description: resource description
Location: resource location
SRN: SRN
Description: Error Description
Possible FRUs: List of possible FRUs
Parameters
- dlogEntry — Pointer to diagnostic log entry
Return Value
Upon successful completion a NON-ZERO pointer is returned. Otherwise, a pointer to NULL is returned.
dlog_freeEntry
목적
진단 로그 항목에 할당한 메모리를 해제합니다.
구문
#include <diag/diag_log.h>
int dlog_freeEntry(int version, void *dlogEntry)
설명
dlog_freeEntry 서브루틴은 지정한 항목에 할당한 메모리를 모두 해제합니다. version으로 어떤 항목 구조체를 넘겼는지 판단합니다.
매개변수
| 매개변수 | 설명 |
|---|---|
version |
항목 버전(LATEST_ENTRY_VER이 dlEntry 구조체에 해당하는 최신 버전) |
dlogEntry |
진단 로그 항목의 포인터 |
반환값
성공하면 0을, 아니면 -1을 돌려줍니다.
영어 원문
dlog_freeEntry
Purpose
Frees memory allocated for diagnostic log entry.
Syntax
#include <diag/diag_log.h>
int dlog_freeEntry(int version, void *dlogEntry)
Description
The dlog_freeEntry subroutine frees all the memory allocated for the specified entry. The version determines which entry structure is being passed.
Parameters
- version — Entry version (
LATEST_ENTRY_VERis the latest version that corresponds to the dlEntry structure) - dlogEntry — Pointer to diagnostic log entry
Return Value
Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned.
dlog_open
목적
진단 이벤트 로그를 읽기용으로 엽니다(원문 목적은 dlog_read의 것을 그대로 옮긴 "지정한 오프셋에서 항목 읽기").
구문
#include <diag/diag_log.h>
int dlog_open(char *pathname,dl_info **info)
설명
dlog_open 서브루틴은 지정한 로그 파일을 읽기용으로 엽니다. pathname이 NULL이면 기본 진단 로그 파일을 씁니다. dl_info 구조체의 메모리를 할당하고 초기화합니다.
매개변수
| 매개변수 | 설명 |
|---|---|
pathname |
열 로그 이름(NULL이면 기본 로그) |
info |
다음 형식의 구조체 포인터 |
typedef struct _log_info {
int fd; /* File descriptor */
int lockId; /* ODM Lock id */
dl_att *dlAtt; /* Pointer to log attributes */
dl_einfo *dlArray; /* Pointer to log array */
} dl_info;
typedef struct _log_einfo {
int version; /* Entry Version */
char logType; /* Log Type - I,S,N,E,X */
unsigned int size; /* Entry Size */
unsigned int offset; /* Offset from the file's beginning */
} dl_einfo;
typedef struct _log_att {
int version; /* Version */
unsigned int numEntries; /* number of log entried */
unsigned int lastIndex; /* index of latest entry */
unsigned int nextSeqNum; /* sequence number of next log entry */
unsigned int maxLogSize; /* maximum size of log */
unsigned int arrayOffset; /* array offset */
unsigned int wrapCount; /* number of times file has wrapped */
} dl_att;
반환값
성공하면 0을, 아니면 -1을 돌려줍니다.
영어 원문
dlog_open
Purpose
Read an entry from the Diagnostic Event Log at the specified offset.
Syntax
#include <diag/diag_log.h>
int dlog_open(char *pathname,dl_info **info)
Description
The dlog_open subroutine opens the specified log file for reading. If the pathname is NULL, then the default diagnostic log file will be used. This subroutine also allocates memory for the dl_info structure and initializes the structure.
Parameters
- pathname — Name of log to open (if NULL, the default log is used)
- info — Pointer to structure of format:
typedef struct _log_info { int fd; /* File descriptor */ int lockId; /* ODM Lock id */ dl_att *dlAtt; /* Pointer to log attributes */ dl_einfo *dlArray; /* Pointer to log array */ } dl_info; typedef struct _log_einfo { int version; /* Entry Version */ char logType; /* Log Type - I,S,N,E,X */ unsigned int size; /* Entry Size */ unsigned int offset; /* Offset from the file’s beginning */ } dl_einfo; typedef struct _log_att { int version; /* Version */ unsigned int numEntries; /* number of log entried */ unsigned int lastIndex; /* index of latest entry */ unsigned int nextSeqNum; /* sequence number of next log entry */ unsigned int maxLogSize; /* maximum size of log */ unsigned int arrayOffset; /* array offset */ unsigned int wrapCount; /* number of times file has wrapped */ } dl_att;
Return Value
Upon successful completion, 0 is returned. Otherwise, a value of -1 is returned.
dlog_read
목적
지정한 오프셋에서 진단 이벤트 로그 항목을 읽습니다.
구문
#include <diag/diag_log.h>
dlEntry *dlog_read(dl_info *dlogInfo,int index)
설명
dlog_read 서브루틴은 인덱스로 정해지는 지정한 오프셋에서 진단 이벤트 로그 항목을 읽어, 다음 형식의 구조체 포인터를 돌려줍니다.
typedef struct _logEntry {
char type; /* Log Type */
char identifier[5]; /* Diagnostic Log identifier */
unsigned int el_identifier; /* Error log identifier */
int timestamp;
unsigned int seqNum; /* order in which event is logged */
unsigned int el_seqNum; /* Error log sequence number */
unsigned int session; /* Diag Session’s PID */
unsigned int testMode; /* Diagnostics test mode - hex value*/
resource_t *res_p; /* Resource information */
int resSize; /* Size of resource info */
void *errorInfo; /* Error information */
int errorSize; /* Size of error info */
} dlEntry;
typedef struct resource {
char name[NAME_SIZE];
int locSize;
char *location; /* Logical or Physical */
short set;
short msg;
char catName[NAME_SIZE];
} resource_t;
매개변수
| 매개변수 | 설명 |
|---|---|
dlogInfo |
dl_info 구조체의 포인터(정의는 dlog_open 절) |
index |
특정 항목에 대한 진단 이벤트 로그 배열의 인덱스 |
반환값
성공하면 dlEntry 포인터를, 아니면 NULL을 돌려줍니다.
영어 원문
dlog_read
Purpose
Read an entry from the Diagnostic Event Log at the specified offset.
Syntax
#include <diag/diag_log.h>
dlEntry *dlog_read(dl_info *dlogInfo,int index)
Description
The dlog_read subroutine will read a Diagnostic Event Log entry at the specified offset, which is determined from the index. It will return a pointer to a structure of format:
(22줄짜리 예는 위 한글 본문에 그대로 실었습니다.)
Parameters
- dlogInfo — Pointer to structure of format:
typedef struct _log_info { int fd; /* File descriptor */ int lockId; /* ODM Lock id */ dl_att *dlAtt; /* Pointer to log attributes */ dl_einfo *dlArray; /* Pointer to log array */ } dl_info; typedef struct _log_einfo { int version; /* Entry Version */ char logType; /* Log Type - I,S,N,E,X */ unsigned int size; /* Entry Size */ unsigned int offset; /* Offset from the file’s beginning */ } dl_einfo; typedef struct _log_att { int version; /* Version */ unsigned int numEntries; /* number of log entried */ unsigned int lastIndex; /* index of latest entry */ unsigned int nextSeqNum; /* sequence number of next log entry */ unsigned int maxLogSize; /* maximum size of log */ unsigned int arrayOffset; /* array offset */ unsigned int wrapCount; /* number of times file has wrapped */ } dl_att; - index — Index into Diagnostic Event log array for specific entry
Return Value
Upon successful completion, a pointer to dlEntry is returned. Otherwise, a value of NULL is returned.
dlog_same_elogId
목적
진단 로그 항목이 특정 오류 로그 식별자를 가졌는지 판단합니다.
구문
#include <diag/diag_log.h>
int dlog_same_elogId(dlEntry *dlogEntry,uint el_identifier)
설명
dlog_same_elogId 서브루틴은 지정한 항목이 주어진 오류 로그 식별자와 같은 오류 로그 식별자를 가졌는지 판단합니다.
매개변수
| 매개변수 | 설명 |
|---|---|
dlogEntry |
진단 로그 항목의 포인터 |
el_identifier |
오류 로그 식별자 |
반환값
항목이 같은 오류 로그 식별자를 가졌으면 1을, 아니면 0을 돌려줍니다.
영어 원문
dlog_same_elogId
Purpose
Determines if a diagnostic log entry has a specific error log identifier.
Syntax
#include <diag/diag_log.h>
int dlog_same_elogId(dlEntry *dlogEntry,uint el_identifier)
Description
The dlog_same_elogId subroutine determines if the specified entry has the same error log identifier as the given error log identifier.
Parameters
- dlogEntry — Pointer to diagnostic log entry
el_identifier— Error log identifier
Return Value
If the entry has the same error log identifier, a value of 1 is returned. Otherwise, a value of 0 is returned.
dlog_setEntryType
목적
주어진 진단 로그 식별자의 항목 유형을 돌려줍니다.
구문
#include <diag/diag_log.h>
int dlog_setEntryType(char *id)
설명
dlog_setEntryType 서브루틴은 지정한 항목 식별자의 항목 유형을 돌려줍니다. 정의된 항목 유형은 다음과 같습니다.
| 유형 | 뜻 |
|---|---|
| INFO | 정보 유형 |
| NTF | 문제 없음(No Trouble Found) |
| ERR | 오류 |
| SRN | SRN 호출(callout) |
| EXER | 실행기(Exerciser) 오류 |
| SA | 서비스 보조 |
매개변수
| 매개변수 | 설명 |
|---|---|
id |
항목 식별자 |
반환값
성공하면 항목 유형을, 아니면 -1을 돌려줍니다.
영어 원문
dlog_setEntryType
Purpose
Returns the entry type for a given diagnostic log identifier.
Syntax
#include <diag/diag_log.h>
int dlog_setEntryType(char *id)
Description
The dlog_setEntryType subroutine returns an entry type for the specified entry identifier. The following entry types are defined:
- INFO — Informational Type
- NTF — No Trouble Found
- ERR — Error
- SRN — Srn Callout
- EXER — Exerciser Error
- SA — Service Aid
Parameters
- id — entry identifier
Return Value
Upon successful completion, the entry type is returned. Otherwise, a value of -1 is returned.
dlog_write
목적
진단 이벤트를 진단 이벤트 로그에 씁니다.
구문
#include <diag/diag_log.h>
int dlog_write(dlEntry *entry)
설명
dlog_write 서브루틴은 진단 이벤트를 진단 이벤트 로그에 씁니다.
dlEntry 형은 다음과 같이 정의되어 있습니다.
typedef struct _logEntry {
char type; /* Log Type */
char identifier[5]; /* Diagnostic log identifier */
unsigned int el_identifier; /* Error log identifier */
int timestamp;
unsigned int seqNum; /* order in which event is logged */
unsigned int el_seqNum; /* Error log sequence number */
unsigned int session; /* Diag Session's PID */
unsigned int testMode; /* Diagnostics test mode - hex value*/
resource_t *res_p; /* Resource information */
int resSize; /* Size of resource info */
void *errorInfo; /* Error information */
int errorSize; /* Size of error info */
} dlEntry;
typedef struct resource {
char name[NAME_SIZE];
int locSize;
char *location;
short set;
short msg;
char catName[NAME_SIZE];
} resource_t;
매개변수
| 매개변수 | 설명 |
|---|---|
entry |
dlEntry 형 구조체의 포인터(위 정의) |
반환값
| 값 | 뜻 |
|---|---|
| 0 | 성공 |
| -1 | 실패 |
ERROR_FS |
/var 파일 시스템이 가득 참 |
영어 원문
dlog_write
Purpose
Write a diagnostic event to the Diagnostic Event Log.
Syntax
#include <diag/diag_log.h>
int dlog_write(dlEntry *entry)
Description
The dlog_write subroutine writes a diagnostic event to the Diagnostic Event Log.
Parameters
- entry — Pointer to a structure of type dlEntry, which is defined as follows:
typedef struct _logEntry { char type; /* Log Type */ char identifier[5]; /* Diagnostic log identifier */ unsigned int el_identifier; /* Error log identifier */ int timestamp; unsigned int seqNum; /* order in which event is logged */ unsigned int el_seqNum; /* Error log sequence number */ unsigned int session; /* Diag Session’s PID */ unsigned int testMode; /* Diagnostics test mode - hex value*/ resource_t *res_p; /* Resource information */ int resSize; /* Size of resource info */ void *errorInfo; /* Error information */ int errorSize; /* Size of error info */ } dlEntry; typedef struct resource { char name[NAME_SIZE]; int locSize; char *location; short set; short msg; char catName[NAME_SIZE]; }resource_t;
Return Value
The dlog_write subroutine returns one of the following values:
- 0 — Successful
-1— UnsuccessfulERROR_FS— Indicates the /var filesystem is full
save_davars_ela
목적
SRN을 서식화하고 오류 로그 정보가 든 DAVars 객체를 만듭니다.
구문
#include <diag/diag_log.h>
int save_davars_ela(struct fru_bucket *frub,uint el_seq,uint el_id,uint
errorCode)
설명
save_davars_ela 서브루틴은 errorCode가 0이면 SRN을 서식화하고, 오류 로그 정보가 든 DAVars 객체를 만듭니다. DAVars 객체의 형식은 다음과 같습니다.
DAVars:
dname = ResourceName
vname = "ErrorLogSRN_or_ErrorCode"
vtype = 0
vvalue = "ErrorlogIdentifier,ErrorlogSequenceNumber"
ivalue = 0
DAVars 객체의 예입니다.
DAVars:
dname = "hdisk0"
vname = "ErrorLog689-130"
vtype = 0
vvalue = "1581762B,74"
ivalue = 0
매개변수
| 매개변수 | 설명 |
|---|---|
*frub |
FRU 버킷의 포인터 |
el_seq |
오류 로그 순번 |
el_id |
오류 로그 식별자 |
errorCode |
오류 코드(0이면 SRN을 서식화) |
반환값
성공하면 0을, 아니면 -1을 돌려줍니다.
영어 원문
save_davars_ela
Purpose
Formats SRN and create DAVars object with error log information.
Syntax
#include <diag/diag_log.h>
int save_davars_ela(struct fru_bucket *frub,uint el_seq,uint el_id,uint
errorCode)
Description
The save_davars_ela subroutine formats the SRN if the errorCode is 0, and create a DAVars object containing the error log information. The format of the DAVars object is:
DAVars: dname = ResourceName vname = "ErrorLogSRN_or_ErrorCode" vtype = 0 vvalue = "ErrorlogIdentifier,ErrorlogSequenceNumber" ivalue = 0
An example of a DAVars object is:
DAVars: dname = "hdisk0" vname = "ErrorLog689-130" vtype = 0 vvalue = "1581762B,74" ivalue = 0
Parameters
*frub— Pointer to fru bucketel_seq— Error log sequence numberel_id— Error log identifier- errorCode — Error code (if 0, format the SRN)
Return Value
The subroutine returns a value of 0 on success; a value of -1 on failure.
save_davars_mgoal_ela
목적
메뉴 목표(menugoal)에 대한 오류 로그 정보가 든 DAVars 객체를 만듭니다.
구문
#include <diag/diag_log.h>
int save_davars_ela(char *dname,uint el_seq,uint el_id,uint
menu_num)
설명
save_davars_mgoal_ela 서브루틴은 메뉴 목표에 대한 오류 로그 정보가 든 DAVars 객체를 만듭니다. DAVars 객체의 형식은 다음과 같습니다.
DAVars:
dname = "ResourceName"
vname = "ErrorMenuMenugoalNumber"
vtype = 0
vvalue = "ErrorlogIdentifier,ErrorlogSequenceNumber"
ivalue = 0
DAVars 객체의 예입니다.
dname = "sysplanar0"
vname = "ErrorMenu651202"
vtype = 0
vvalue = "56CDC3C8,22"
ivalue = 0
매개변수
| 매개변수 | 설명 |
|---|---|
*dname |
메뉴 목표를 만든 자원 이름이 든 문자열 |
el_seq |
오류 로그 순번 |
el_id |
오류 로그 식별자 |
menu_num |
메뉴 목표 번호 |
반환값
성공하면 0을, 아니면 -1을 돌려줍니다.
영어 원문
save_davars_mgoal_ela
Purpose
Create DAVars object with error log information for a menugoal.
Syntax
#include <diag/diag_log.h>
int save_davars_ela(char *dname,uint el_seq,uint el_id,uint
menu_num)
Description
The save_davars_mgoal_ela subroutine creates a DAVars object containing the error log information for a
menugoal. The format of the DAVars object is
DAVars:
dname = "ResourceName"
vname = "ErrorMenuMenugoalNumber"
vtype = 0
vvalue = "ErrorlogIdentifier,ErrorlogSequenceNumber"
ivalue = 0
An example of a DAVars object is:
dname = "sysplanar0"
vname = "ErrorMenu651202"
vtype = 0
vvalue = "56CDC3C8,22"
ivalue = 0
Parameters
*dname— String containing the resource name that created the menugoal.el_seq— Error log sequence numberel_id— Error log identifiermenu_num— Menugoal number
Return Value
The subroutine returns a value of 0 on success; a value of -1 on failure.
copy_text
목적
텍스트를 길이 74인 줄에 맞게 서식화합니다.
구문
int copy_text( int string_length, char *buffer, char *text )
설명
copy_text 서브루틴은 텍스트 문자열에 줄 바꿈(\n)을 넣어, 문자열이 줄 넘김 없이 표시되도록 합니다.
매개변수
| 매개변수 | 설명 |
|---|---|
string_length |
서식화한 문자열의 시작 열 |
buffer |
서식화한 문자열 |
text |
서식화하지 않은 문자열 |
반환값
늘 0을 돌려줍니다.
영어 원문
copy_text
Purpose
Format text to fit on line with a length of 74
Syntax
int copy_text( int string_length, char *buffer, char *text )
Description
The copy_text subroutine will take the text string and add \n so that the string can be displayed without wrapping.
Parameters
string_length— Starting column for the formatted string- buffer — Formatted string
- text — Unformatted string
Return Value
A value of 0 is returned.
DA_SETRC_XXXXXX, DA_CHECKRC_XXXXXX, DA_EXIT
목적
진단 응용 프로그램(DA)의 종료 상태를 처리합니다.
구문
#include <diag/diag_exit.h>
#define DA_SETRC_STATUS(VAL) da_exit_code.field.status = (VAL)
#define DA_SETRC_USER(VAL) da_exit_code.field.user = (VAL)
#define DA_SETRC_ERROR(VAL) da_exit_code.field.error = (VAL)
#define DA_SETRC_TESTS(VAL) da_exit_code.field.tests = (VAL)
#define DA_SETRC_MORE(VAL) da_exit_code.field.more = (VAL)
#define DA_CHECKRC_STATUS() da_exit_code.status
#define DA_CHECKRC_USER() da_exit_code.user
#define DA_CHECKRC_ERROR() da_exit_code.error
#define DA_CHECKRC_TESTS() da_exit_code.tests
#define DA_CHECKRC_MORE() da_exit_code.more
#define DA_EXIT() exit(*( (char*) &da_exit_code) ) )
enum diag_enum_status {
DA_STATUS_GOOD,
/* No hardware problems were found */
DA_STATUS_BAD,
/* A hardware problem was found */
};
enum diag_enum_user {
DA_USER_NOKEY,
/* No special function keys were entered */
DA_USER_EXIT,
/* The user entered the exit key */
DA_USER_QUIT,
/* The user entered the cancel key */
};
enum diag_enum_error {
DA_ERROR_NONE,
/* No software errors were encountered */
DA_ERROR_OPEN,
/* The Device Driver failed to open */
DA_ERROR_OTHER,
/* Another software error was encountered */
};
enum diag_enum_tests {
DA_TEST_NOTEST,
/* No diagnostic tests were run */
DA_TEST_FULL,
/* The full tests were run */
DA_TEST_SHR,
/* The shared tests were run */
DA_TEST_SUB,
/* The sub tests were run */
};
enum diag_enum_more {
DA_MORE_NOCONT,
/* The problem has been isolated. */
DA_MORE_CONT,
/* The parent or sibling will be tested next */
};
typedef struct {
unsigned status : 1;
/* enum diag_enum_status */
unsigned user : 2;
/* enum diag_enum_user */
unsigned error : 2;
/* enum diag_enum_error */
unsigned tests : 2;
/* enum diag_enum_tests */
unsigned more : 1;
/* enum diag_enum_more */
} da_return_code_t;
extern da_returncode_t da_exit_code;
설명
DA_EXIT 매크로는 DA를 끝내는 데 씁니다. 기본값이 아닌 값을 설정하려면 알맞은 DA_SETRC_XXXXX 매크로를 불러야 합니다. 현재 값을 확인하려면 알맞은 DA_CHECKRC_XXXXXX 매크로를 씁니다.
기본 설정은 다음과 같습니다.
DA_STATUS_GOODDA_USER_NOKEYDA_ERROR_NONEDA_TEST_NOTESTDA_MORE_NOCONT
매개변수
매개변수가 없습니다.
구조 해독
비트 위치를 해독하는 간단한 도표입니다.
Bit position
|128 | 64 32 | 16 8 | 4 2 | 1
DA_MORE_NOCONT 0
DA_MORE_CONT 1
|___________________
DA_TEST_NOTEST 0
DA_TEST_FULL 1
DA_TEST_SUB 2
DA_TEST_SHR 3
|__________________________
DA_ERROR_NONE 0
DA_ERROR_OPEN 1
DA_ERROR_OTHER 2
|__________________________________
DA_USER_NOKEY 0
DA_USER_EXIT 1
DA_USER_QUIT 2
|___________________________________________
DA_STATUS_GOOD 0
DA_STATUS_BAD 1
|________________________________________________
| 필드 | 비트 | 값 |
|---|---|---|
| more | 1 | DA_MORE_NOCONT 0(문제를 격리함), DA_MORE_CONT 1(다음에 부모나 형제를 시험) |
| tests | 2, 4 | DA_TEST_NOTEST 0(시험 안 함), DA_TEST_FULL 1(전체 시험), DA_TEST_SUB 2(하위 시험), DA_TEST_SHR 3(공유 시험) |
| error | 8, 16 | DA_ERROR_NONE 0(소프트웨어 오류 없음), DA_ERROR_OPEN 1(장치 드라이버 열기 실패), DA_ERROR_OTHER 2(다른 소프트웨어 오류) |
| user | 32, 64 | DA_USER_NOKEY 0(특수 기능 키 없음), DA_USER_EXIT 1(Exit 키), DA_USER_QUIT 2(Cancel 키) |
| status | 128 | DA_STATUS_GOOD 0(하드웨어 문제 없음), DA_STATUS_BAD 1(하드웨어 문제 발견) |
반환값
반환 코드가 없습니다.
영어 원문
DA_SETRC_XXXXXX, DA_CHECKRC_XXXXXX, DA_EXIT
Purpose
Processes Exit Status of Diagnostic Application (DA).
Syntax
(63줄짜리 예는 위 한글 본문에 그대로 실었습니다.)
Description
The DA_EXIT macro is used to exit a DA. To set a value other than the default, the appropriate DA_SETRC_XXXXX macro must be called. To check the current value, use the appropriate DA_CHECKRC_XXXXXX macro.
The defaults settings are:
DA_STATUS_GOOD
DA_USER_NOKEY
DA_ERROR_NONE
DA_TEST_NOTEST
DA_MORE_NOCONT
Parameters
Takes no parameters.
Return Value
There is no return code.
Structure Deciphering
Following is a easy chart to use to deciphered the bit positions:
(21줄짜리 예는 위 한글 본문에 그대로 실었습니다.)
관련 글: 진단 라이브러리 (1), 진단 라이브러리 (5), 진단 컨트롤러