uint64_t msgid;
uint32_t status;
+ global.disaster_occurred = 1;
+
msgid = 0;
if ((global.dbtype & DB_TYPE_MINI) == 0)
uint32_t status, ucount;
int32_t dir;
+ /*
+ * Special case: if count is -1, we return ASL_STATUS_OK to indicate that the store is
+ * in memory, and ASL_STATUS_INVALID_STORE to indicate that the file store is in use.
+ */
+ if (count == -1)
+ {
+ if ((global.dbtype & DB_TYPE_MEMORY) || (global.dbtype & DB_TYPE_MINI)) return ASL_STATUS_OK;
+ else return ASL_STATUS_INVALID_STORE;
+ }
+
ucount = count;
dir = SEARCH_FORWARD;
if (flags & QUERY_FLAG_SEARCH_REVERSE) dir = SEARCH_BACKWARD;
status = ASL_STATUS_FAILED;
- if (global.dbtype & DB_TYPE_MEMORY) status = asl_memory_match(global.memory_db, query, res, lastid, startid, ucount, dir, ruid, rgid);
- else status = asl_mini_memory_match(global.mini_db, query, res, lastid, startid, ucount, dir);
+ if (global.dbtype & DB_TYPE_MEMORY)
+ {
+ status = asl_memory_match(global.memory_db, query, res, lastid, startid, ucount, dir, ruid, rgid);
+ }
+ else if (global.dbtype & DB_TYPE_MINI)
+ {
+ status = asl_mini_memory_match(global.mini_db, query, res, lastid, startid, ucount, dir);
+ }
+ else if (global.disaster_occurred != 0)
+ {
+ /* KernelEventAgent calls us to get the kernel disaster messages. */
+ status = asl_mini_memory_match(global.mini_db, query, res, lastid, startid, ucount, dir);
+ }
pthread_mutex_unlock(&db_lock);
*status = db_query(query, &res, startid, count, flags, lastid, token->val[0], token->val[1]);
aslresponse_free(query);
- if (*status != ASL_STATUS_OK)
+ if (*status != ASL_STATUS_INVALID_STORE)
+ {
+ /* ignore */
+ }
+ else if (*status != ASL_STATUS_OK)
{
if (res != NULL) aslresponse_free(res);
return KERN_SUCCESS;
static asl_file_t *legacy = NULL;
static asl_file_t *export = NULL;
-#ifdef CONFIG_IPHONE
-static uint32_t dbselect = DB_SELECT_SYSLOGD;
-#else
static uint32_t dbselect = DB_SELECT_STORE;
-#endif
/* notify SPI */
uint32_t notify_register_plain(const char *name, int *out_token);
cq = NULL;
exportname = NULL;
+ i = asl_store_location();
+ if (i == ASL_STORE_LOCATION_MEMORY) dbselect = DB_SELECT_SYSLOGD;
+
if (getuid() == 0) iamroot = 1;
for (i = 1; i < argc; i++)