The OSv implementation, where we took this from, dropped the setlogmask()
function. We bring it back from the musl implementation because it is needed by
Python 3.
Signed-off-by: Costin Lupu <costin.lupu@cs.pub.ro>
Reviewed-by: Vlad-Andrei Badoiu<vlad_andrei.badoiu@stud.acs.upb.ro>
static struct uk_mutex lock = UK_MUTEX_INITIALIZER(lock);
static char log_ident[32];
static int log_opt;
+static int log_mask = 0xff;
static int log_facility = LOG_USER;
void openlog(const char *ident, int opt, int facility)
{
}
+int setlogmask(int maskpri)
+{
+ int ret;
+
+ LOCK(lock);
+ ret = log_mask;
+ if (maskpri)
+ log_mask = maskpri;
+ UNLOCK(lock);
+ return ret;
+}
+
void syslog(int priority, const char *message, ...)
{
va_list ap;
int pid;
int l, l2;
+ if (!(log_mask & LOG_MASK(priority & 7)) || (priority & ~0x3ff))
+ return;
+
LOCK(lock);
va_start(ap, message);