[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT/NEWLIB PATCH 1/2] syslog.c: Bring back setlogmask() from musl
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@xxxxxxxxx> --- musl-imported/src/syslog.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/musl-imported/src/syslog.c b/musl-imported/src/syslog.c index 1792241..ee109f5 100644 --- a/musl-imported/src/syslog.c +++ b/musl-imported/src/syslog.c @@ -70,6 +70,7 @@ 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) @@ -95,6 +96,18 @@ void closelog(void) { } +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; @@ -105,6 +118,9 @@ void syslog(int priority, const char *message, ...) int pid; int l, l2; + if (!(log_mask & LOG_MASK(priority & 7)) || (priority & ~0x3ff)) + return; + LOCK(lock); va_start(ap, message); -- 2.20.1 _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |