Browse Source

Update iso_obtain_msgs() to allow retrieving of imgid.

release-1.5.4.branch
Vreixo Formoso 15 years ago
parent
commit
86072d3b3b
  1. 5
      libisofs/libisofs.h
  2. 9
      libisofs/messages.c

5
libisofs/libisofs.h

@ -1888,14 +1888,15 @@ int iso_set_msgs_severities(char *queue_severity, char *print_severity,
* "NOTE", "UPDATE", "DEBUG", "ALL". To call with minimum_severity "NEVER"
* will discard the whole queue.
*
* @param error_code Will become a unique error code as listed in messages.h
* @param error_code Will become a unique error code as listed in error.h
* @param imgid Id of the image that was issued the message.
* @param msg_text Must provide at least ISO_MSGS_MESSAGE_LEN bytes.
* @param os_errno Will become the eventual errno related to the message
* @param severity Will become the severity related to the message and
* should provide at least 80 bytes.
* @return 1 if a matching item was found, 0 if not, <0 for severe errors
*/
int iso_obtain_msgs(char *minimum_severity, int *error_code,
int iso_obtain_msgs(char *minimum_severity, int *error_code, int *imgid,
char msg_text[], int *os_errno, char severity[]);
/**

9
libisofs/messages.c

@ -257,10 +257,12 @@ int iso_set_msgs_severities(char *queue_severity, char *print_severity,
* should provide at least 80 bytes.
* @return 1 if a matching item was found, 0 if not, <0 for severe errors
*/
int iso_obtain_msgs(char *minimum_severity, int *error_code,
int iso_obtain_msgs(char *minimum_severity, int *error_code, int *imgid,
char msg_text[], int *os_errno, char severity[])
{
int ret, minimum_sevno, sevno, priority;
double timestamp;
pid_t pid;
char *textpt, *sev_name;
struct libiso_msgs_item *item= NULL;
@ -278,6 +280,11 @@ int iso_obtain_msgs(char *minimum_severity, int *error_code,
if (strlen(textpt) >= ISO_MSGS_MESSAGE_LEN)
msg_text[ISO_MSGS_MESSAGE_LEN-1] = 0;
ret = libiso_msgs_item_get_origin(item, &timestamp, &pid, imgid, 0);
if (ret <= 0)
goto ex;
severity[0]= 0;
ret = libiso_msgs_item_get_rank(item, &sevno, &priority, 0);
if (ret <= 0)

Loading…
Cancel
Save