return -1;
}
-#if !TARGET_IPHONE_SIMULATOR
+#if !TARGET_OS_SIMULATOR
if (chown(dstpath, r->dst->uid[0], r->dst->gid[0]) != 0)
{
asldebug("_asl_dir_storedata_open: chown %d %d new %s: %s\n", dstpath, r->dst->uid[0], r->dst->gid[0], strerror(errno));
_act_checkpoint(asl_out_rule_t *r, uint32_t force)
{
char tmpcurrent_name[MAXPATHLEN], *fn;
+ bool size_only = false;
if (r == NULL) return 0;
if (r->dst == NULL) return 0;
fn = tmpcurrent_name;
}
- if ((force == CHECKPOINT_TEST) && (r->dst->file_max == 0)) return 0;
+ if ((force == CHECKPOINT_TEST) || (r->dst->flags & MODULE_FLAG_SIZE_ONLY))
+ {
+ size_only = true;
+ }
+
+ if (size_only && (r->dst->file_max == 0)) return 0;
if ((r->dst->size == 0) || (r->dst->timestamp == 0))
{
r->dst->size = sb.st_size;
}
- if ((force == CHECKPOINT_TEST) && (r->dst->size < r->dst->file_max)) return 0;
+ if (size_only && (r->dst->size < r->dst->file_max)) return 0;
if (r->dst->flags & MODULE_FLAG_BASESTAMP)
{
return -1;
}
-#if TARGET_IPHONE_SIMULATOR
+#if TARGET_OS_SIMULATOR
uid_t uid = -1;
gid_t gid = -1;
#else
if (m == NULL) return 0;
-
for (r = m->ruleset; r != NULL; r = r->next)
{
if ((r->action == ACTION_FILE) || (r->action == ACTION_ASL_FILE))
{
if (_act_file_equal(r->dst->path, path))
{
- if (force & CHECKPOINT_CRASH)
+ if (_act_checkpoint(r, force) > 0)
{
- if (r->dst->flags & MODULE_FLAG_CRASHLOG)
- {
- if (_act_checkpoint(r, CHECKPOINT_FORCE) > 0)
- {
- did_checkpoint = 1;
- _act_dst_close(r, DST_CLOSE_CHECKPOINT);
- }
- }
- }
- else
- {
- if (_act_checkpoint(r, force) > 0)
- {
- did_checkpoint = 1;
- _act_dst_close(r, DST_CLOSE_CHECKPOINT);
- }
+ did_checkpoint = 1;
+ _act_dst_close(r, DST_CLOSE_CHECKPOINT);
}
}
}
if (p != NULL) asl_msg_set_key_val(msg, ASL_KEY_FREE_NOTE, p);
/* chain to the next output module (done this way to make queue size accounting easier */
-#if !TARGET_IPHONE_SIMULATOR
+#if !TARGET_OS_SIMULATOR
if (global.bsd_out_enabled) bsd_out_message(msg, msize);
else OSAtomicAdd64(-1ll * msize, &global.memory_size);
#else
asl_action_control_set_param(const char *s)
{
__block char **l;
- __block char *p;
uint32_t count = 0;
if (s == NULL) return -1;
/* create / modify a module */
if ((!strcasecmp(l[1], "define")) && (strcmp(l[0], "*")))
{
- p = strdup(s);
- if (p == NULL)
+ char *str = strdup(s);
+ if (str == NULL)
{
asldebug("asl_action_control_set_param: memory allocation failed\n");
free_string_list(l);
dispatch_sync(asl_action_queue, ^{
asl_out_module_t *m;
asl_out_rule_t *r;
+ char *p = str;
/* skip name, whitespace, "define" */
while ((*p != ' ') && (*p != '\t')) p++;
}
});
- free(p);
+ free(str);
free_string_list(l);
return 0;
}
return 0;
}
-int
-asl_action_file_checkpoint(const char *module, const char *path)
+void
+asl_action_out_module_query(asl_msg_t *q, asl_msg_t *m, bool all)
{
- /* Note this is synchronous on asl_action queue */
dispatch_sync(asl_action_queue, ^{
- asl_out_module_t *m = _asl_action_module_with_name(module);
- _act_file_checkpoint(m, path, CHECKPOINT_FORCE);
+ asl_out_module_t *om;
+ const char *val;
+ for (om = global.asl_out_module; om != NULL; om = om->next)
+ {
+ if (all || (0 == asl_msg_lookup(q, om->name, NULL, NULL)))
+ {
+ val = om->flags & MODULE_FLAG_ENABLED ? "enabled" : "disabled";
+ if (om->name == NULL) asl_msg_set_key_val(m, "asl.conf", val);
+ else asl_msg_set_key_val(m, om->name, val);
+ }
+ }
});
-
- return 0;
}