41 #include <linux/kernel.h> 46 unsigned ps = sysconf(_SC_PAGESIZE);
50 int fd = open(fn, O_RDONLY);
52 if (fd < 0 && verbose > 0 && fn) {
53 pr_err(
"Error opening events file '%s': %s\n", fn,
64 (st.st_size + ps - 1) & ~(ps - 1),
65 PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
66 if (map == MAP_FAILED)
75 unsigned ps = sysconf(_SC_PAGESIZE);
125 for (i = 0; i < end; i++)
144 #define LOOKUP(a, i) ((i) < (sizeof(a)/sizeof(*(a))) ? ((a)[i]) : "?") 161 return len == strlen(s) && !strncasecmp(map + t->
start, s, len);
static void unmapfile(char *map, size_t size)
static char * mapfile(const char *fn, size_t *size)
int json_line(char *map, jsmntok_t *t)
int json_streq(char *map, jsmntok_t *t, const char *s)
jsmnerr_t jsmn_parse(jsmn_parser *parser, const char *js, size_t len, jsmntok_t *tokens, unsigned int num_tokens)
int json_len(jsmntok_t *t)
void jsmn_init(jsmn_parser *parser)
void free_json(char *map, size_t size, jsmntok_t *tokens)
jsmntok_t * parse_json(const char *fn, char **map, size_t *size, int *len)
static const char *const jsmn_types[]
static int countchar(char *map, char c, int end)
const char * json_name(jsmntok_t *t)
const char * jsmn_strerror(jsmnerr_t err)