|
ppc64-diag
|
Routines to update RTAS evetns to the platform log. More...
#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <string.h>#include <fcntl.h>#include <errno.h>#include <sys/types.h>#include <sys/stat.h>#include <sys/mman.h>#include "rtas_errd.h"Macros | |
| #define | BM_ARRAY_SIZE 256 |
| Array size for Boyer-Moore algorithm. More... | |
| #define | RTAS_START "RTAS event begin" |
| #define | RTAS_END "RTAS event end" |
Functions | |
| void | setup_bc (char *str, int strlen, int *bc) |
| Initalize the bad character array for a Boyer-Moore search. More... | |
| char * | find_event (char *str, int strlen, char *text, int textlen, int bad_char[]) |
| Find an RTAS event. More... | |
| char * | find_rtas_start (char *textstart, char *textend) |
| Find the beginning of a RTAS event. More... | |
| char * | find_rtas_end (char *textstart, char *textend) |
| Find the ending of a RTAS event. More... | |
| int | get_rtas_no (char *ptr) |
| Retrieve an RTAS event numnber. More... | |
| void | update_rtas_msgs (void) |
| Update RTAS messages in the platform log. More... | |
Variables | |
| int | bad_char_start [BM_ARRAY_SIZE] = {-1} |
| Boyer-Moore bad character array for finding RTAS event starts. More... | |
| int | bad_char_end [BM_ARRAY_SIZE] = {-1} |
| Boyer-Moore bad character array for finding RTAS event ends. More... | |
| char * | messages_log = NULL |
| static int | msgs_log_fd = -1 |
| File descriptor for messages_log. More... | |
In certain cases, we may need to get RTAS events from syslog and process them to /var/log/platform (i.e. an EPOW event that allows enough time for the RTAS event(s) to be written to syslog but not enough time for rtas_errd to run).
The search implemeted here checks the last RTAS event number in syslog and /var/log/platform. If they are not equal, we process RTAS events from syslog until they are equal.
Copyright (C) 2004 IBM Corporation
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
| #define BM_ARRAY_SIZE 256 |
Referenced by setup_bc().
| #define RTAS_END "RTAS event end" |
Referenced by find_rtas_end().
| #define RTAS_START "RTAS event begin" |
Referenced by find_rtas_start(), and update_rtas_msgs().
| char* find_event | ( | char * | str, |
| int | strlen, | ||
| char * | text, | ||
| int | textlen, | ||
| int | bad_char[] | ||
| ) |
find_event Search for a RTAS event in the given text. This uses a scaled down version of the Boyer-Moore algorithm. Since we know the search strings we also know there really isn't a good suffix worth looking for. Thus we do not use the good suffix rule for this search.
| str | string to search for |
| strlen | length of search string |
| text | text to search for string in |
| textlen | length of text to search |
| bad_char | bad character array for Boyer-Moore search |
References MAX.
Referenced by find_rtas_end(), and find_rtas_start().
| char* find_rtas_end | ( | char * | textstart, |
| char * | textend | ||
| ) |
find_rtas_end
| textstart | pointer to starting point of search |
| textend | pointer to ending point of search |
References bad_char_end, find_event(), RTAS_END, and setup_bc().
Referenced by update_rtas_msgs().
| char* find_rtas_start | ( | char * | textstart, |
| char * | textend | ||
| ) |
find_rtas_start
| textstart | pointer to starting point of search |
| textend | pointer to ending point of search |
References bad_char_start, find_event(), RTAS_START, and setup_bc().
Referenced by update_rtas_msgs().
| int get_rtas_no | ( | char * | ptr | ) |
get_rtas_no Retrieve the RTAS event number from an RTAS event. NOTE: this routine assumes the pointer passed in is the result from a call to find_rtas_start()
| ptr | pointer to RTAS event |
Referenced by update_rtas_msgs().
| void setup_bc | ( | char * | str, |
| int | strlen, | ||
| int * | bc | ||
| ) |
setup_bc
| str | search string to initialize the array with |
| strlen | search string length |
| bc | bad character array to be initialized |
References BM_ARRAY_SIZE.
Referenced by find_rtas_end(), and find_rtas_start().
| void update_rtas_msgs | ( | void | ) |
update_rtas_msgs Update the file /var/log/platform with any RTAS events found in syslog that have not been handled by rtas_errd.
References dbg, event::event_buf, find_rtas_end(), find_rtas_start(), get_rtas_no(), handle_rtas_event(), log_msg(), messages_log, msgs_log_fd, platform_log, platform_log_fd, RTAS_ERROR_LOG_MAX, event::rtas_event, and RTAS_START.
Referenced by main().
| bad_char_end = {-1} |
Referenced by find_rtas_end().
| bad_char_start = {-1} |
Referenced by find_rtas_start().
| char* messages_log = NULL |
Used by update_rtas_msgs() to bring the platform log up to date with current RTAS events.
Referenced by main(), and update_rtas_msgs().
|
static |
Referenced by update_rtas_msgs().
1.8.13