static dispatch_source_t checkpoint_timer;
static time_t sweep_time = 0;
-#if TARGET_OS_EMBEDDED
+#if (TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR)
#ifndef CRASH_MOVER_SERVICE
#define CRASH_MOVER_SERVICE "com.apple.crash_mover"
#endif
static void
_act_broadcast(asl_out_module_t *m, asl_out_rule_t *r, asl_msg_t *msg)
{
-#if !TARGET_OS_EMBEDDED
+#if !(TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR)
FILE *pw;
const char *val;
}
}
-#if TARGET_OS_EMBEDDED
+#if (TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR)
static void
_crashlog_queue_check(void)
{
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 (af_data != NULL) af_data->pending++;
}
-#if TARGET_OS_EMBEDDED
+#if (TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR)
if (r->dst->flags & MODULE_FLAG_CRASHLOG)
{
_crashlog_queue_check();
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);
}
}
}
f_data = (asl_action_file_data_t *)r->dst->private;
if (f_data != NULL) f_data->pending++;
-#if TARGET_OS_EMBEDDED
+#if (TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR)
if (r->dst->flags & MODULE_FLAG_CRASHLOG)
{
_crashlog_queue_check();
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
dispatch_once(&once, ^{
asl_action_queue = dispatch_queue_create("ASL Action Queue", NULL);
-#if TARGET_OS_EMBEDDED
+#if (TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR)
crashlog_queue = dispatch_queue_create("iOS CrashLog Queue", NULL);
notify_register_dispatch(CRASH_MOVER_SERVICE, &crashmover_token, asl_action_queue, ^(int unused) {
uint64_t cmstate = 0;
static int
_asl_action_close_internal(void)
{
-#if TARGET_OS_EMBEDDED
+#if (TARGET_OS_IPHONE && !TARGET_OS_SIMULATOR)
if (crashmover_state != 0)
{
dispatch_resume(crashlog_queue);
return 0;
}
-int
-asl_action_file_checkpoint(const char *module, const char *path)
-{
- /* 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);
- });
-
- return 0;
-}
-
void
asl_action_out_module_query(asl_msg_t *q, asl_msg_t *m, bool all)
{