}
static int
-_bsd_send(aslmsg msg, struct config_rule *r, char **out, char **fwd, time_t now)
+_bsd_send(asl_msg_t *msg, struct config_rule *r, char **out, char **fwd, time_t now)
{
char *sf, *outmsg;
const char *vlevel, *vfacility;
if ((*fwd == NULL) && (r->type == DST_TYPE_SOCK))
{
pf = 7;
- vlevel = asl_get(msg, ASL_KEY_LEVEL);
+ vlevel = asl_msg_get_val_for_key(msg, ASL_KEY_LEVEL);
if (vlevel != NULL) pf = atoi(vlevel);
- fc = asl_syslog_faciliy_name_to_num(asl_get(msg, ASL_KEY_FACILITY));
+ fc = asl_syslog_faciliy_name_to_num(asl_msg_get_val_for_key(msg, ASL_KEY_FACILITY));
if (fc > 0) pf |= fc;
sf = NULL;
* The kernel printf routine already sends them to /dev/console
* so writing them here would cause duplicates.
*/
- vfacility = asl_get(msg, ASL_KEY_FACILITY);
+ vfacility = asl_msg_get_val_for_key(msg, ASL_KEY_FACILITY);
if ((vfacility != NULL) && (!strcmp(vfacility, FACILITY_KERNEL)) && (r->type == DST_TYPE_CONS)) do_write = 0;
if ((do_write == 1) && (r->type == DST_TYPE_FILE) && (is_dup == 1))
{
}
static int
-_bsd_rule_match(aslmsg msg, struct config_rule *r)
+_bsd_rule_match(asl_msg_t *msg, struct config_rule *r)
{
uint32_t i, test, f;
int32_t pri;
if ((test == 0) && (r->pri[i] == -2)) continue;
f = 0;
- val = asl_get(msg, ASL_KEY_FACILITY);
+ val = asl_msg_get_val_for_key(msg, ASL_KEY_FACILITY);
if (strcmp(r->facility[i], "*") == 0)
{
continue;
}
- val = asl_get(msg, ASL_KEY_LEVEL);
+ val = asl_msg_get_val_for_key(msg, ASL_KEY_LEVEL);
if (val == NULL) continue;
pri = atoi(val);
}
static int
-_bsd_match_and_send(aslmsg msg)
+_bsd_match_and_send(asl_msg_t *msg)
{
struct config_rule *r;
char *out, *fwd;
}
void
-bsd_out_message(aslmsg msg)
+bsd_out_message(asl_msg_t *msg, int64_t msize)
{
if (msg == NULL) return;
dispatch_async(bsd_out_queue, ^{
_bsd_match_and_send(msg);
asl_msg_release((asl_msg_t *)msg);
+
+ /* end of the output module chain (after asl) - decrement global memory stats */
+ OSAtomicAdd64(-1ll * msize, &global.memory_size);
+
OSAtomicDecrement32(&global.bsd_queue_count);
});
}
/* start a timer to close idle files */
bsd_idle_timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, bsd_out_queue);
- dispatch_source_set_event_handler(bsd_idle_timer, ^{ _bsd_close_idle_files(); });
+ dispatch_source_set_event_handler(bsd_idle_timer, ^{ _bsd_close_idle_files(); });
dispatch_source_set_timer(bsd_idle_timer, dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC * CLOSE_ON_IDLE_SEC), NSEC_PER_SEC * CLOSE_ON_IDLE_SEC, 0);
dispatch_resume(bsd_idle_timer);
});
free(r->facility);
}
-
+
TAILQ_REMOVE(&bsd_out_rule, r, entries);
free(r);
}