}
}
- if (uid_out != NULL) *uid_out = uid;
-
gid = -2;
val = asl_msg_get_val_for_key(msg, ASL_KEY_GID);
if (val == NULL)
break;
}
- case SOURCE_UDP_SOCKET:
case SOURCE_ASL_MESSAGE:
case SOURCE_LAUNCHD:
{
}
}
+ if (uid_out != NULL) *uid_out = uid;
+
/* Sender */
if (sval == NULL) sval = asl_msg_get_val_for_key(msg, ASL_KEY_SENDER);
if (sval == NULL)
asl_msg_set_key_val(msg, ASL_KEY_EXPIRE_TIME, buf);
}
- /* Set DB Expire Time for Filesystem errors */
- if (!strcmp(fac, FSLOG_VAL_FACILITY))
- {
- snprintf(buf, sizeof(buf), "%llu", (unsigned long long) tick + FS_TTL_SEC);
- asl_msg_set_key_val(msg, ASL_KEY_EXPIRE_TIME, buf);
- }
-
/*
* special case handling of kernel disaster messages
*/
process_message(asl_msg_t *msg, uint32_t source)
{
int64_t msize = 0;
+ static bool wq_draining = false;
bool is_control = false;
asl_msg_t *x;
is_control = asl_check_option(msg, ASL_OPT_CONTROL) != 0;
+ if ((!is_control) && wq_draining)
+ {
+ if (global.memory_size >= (global.memory_max / 2))
+ {
+ asldebug("Work queue draining: dropped message.\n");
+ asl_msg_release(msg);
+ return;
+ }
+ else
+ {
+ asldebug("Work queue re-enabled at 1/2 max. size %lld max %lld\n", global.memory_size, global.memory_max);
+ wq_draining = false;
+ }
+ }
+
__block vproc_transaction_t vt = vproc_transaction_begin(NULL);
for (x = msg; x != NULL; x = x->next) msize += x->mem_size;
if ((global.memory_size + msize) >= global.memory_max)
{
char str[256];
+
+ wq_draining = true;
asl_msg_release(msg);
- asldebug("Work queue memory limit - dropped message. msize %lld size %lld max %lld\n", msize, global.memory_size + msize, global.memory_max);
- snprintf(str, sizeof(str), "[Sender syslogd] [Level 2] [PID %u] [Message Received message size %lld overflows work queue limit %lld - dropping message] [UID 0] [UID 0] [Facility syslog]", global.pid, msize, global.memory_max);
+ asldebug("Work queue disabled. msize %lld size %lld max %lld\n", msize, global.memory_size + msize, global.memory_max);
+ snprintf(str, sizeof(str), "[Sender syslogd] [Level 2] [PID %u] [Message Internal memory size limit %lld exceeded - dropping messages] [UID 0] [UID 0] [Facility syslog]", global.pid, global.memory_max);
msg = asl_msg_from_string(str);
- for (x = msg; x != NULL; x = x->next) msize += x->mem_size;
}
OSAtomicAdd64(msize, &global.memory_size);