[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


  • To: minios-devel@xxxxxxxxxxxxx
  • From: Costin Lupu <costin.lupu@xxxxxxxxx>
  • Date: Mon, 2 Sep 2019 18:06:45 +0300
  • Cc: vlad_andrei.badoiu@xxxxxxxxxxxxxxx
  • Delivery-date: Mon, 02 Sep 2019 15:07:01 +0000
  • Ironport-phdr: 9a23:HLESCR8hDd8ifv9uRHKM819IXTAuvvDOBiVQ1KB31+ocTK2v8tzYMVDF4r011RmVBN+dsq0cwLqP+4nbGkU4qa6bt34DdJEeHzQksu4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2aFLduGC94iAPERvjKwV1Ov71GonPhMiryuy+4ZLebxhWiDanfL9/Lgm6oQrSu8ULnIBvNrs/xhzVr3VSZu9Y33loJVWdnxb94se/4ptu+DlOtvwi6sBNT7z0c7w3QrJEAjsmNXs15NDwuhnYUQSP/HocXX4InRdOHgPI8Qv1Xpb1siv9q+p9xCyXNtD4QLwoRTiv6bpgRRn1gykFKjE56nnahMxugqxGrhyvpBtxzIzaYIyOKPZyYrnQcc8ASGZdQspcUTFKDIOmb4sICuoMJfhVr47mp1sSrBu+AxSnCuXyyj9Qm3/9wKo33PgmEQHdwAwgHtQOvG7QrNXoLKcSTPu4w7XTzTnZd/NWxCzy5JLSchAmuPyBW697f8nJyUQ3Cg/IgUicpZbmMj6VzOgBrXaX4uh6We+hk2Irtg58riW1ysovioTFnJwZx17K+Clj3Yo4KsO0RUhmatC+CpRQrTuVN45uT8MnRGFnpTg1x6UduZ6+YCgK0JMnxwPDa/Cfc4iH/BbjVOGJLDdmgXJqYrO/hxKo/Ue80e3wTNG00EtRoSZfiNnMsWgB1x3V6seZVvtw5lqt1DmS2wzJ6exJIVo4mbTFJ5Mj2LI9mIIfsUHZES/3nEX2grWWdkIh+uWw9+vnZa7mpoOdN49ykA3+NrkumtSiAekjLgcORHKX+fyh1LL450H5WrJKguUskqbFqJDaOdgbpqmhDg9Q04Yj7Re/DzC90NgBgHYIMkxFdwyDj4XyP1HOIev4Deukg1i2nzZk2fbGMqfmApXXIXjJiK3hcqpl605A1AozyshS54xQCr4bPf38QlX+tNrFAR8jLQO0wvzrB85n2YwDXmKPA7KZPbjJsV+U++IgPvOAa5UJtzbmMfQl+ubugmQjlV8Heqn6lacQPXW5GPVhOACVbGThhv8FEHwWpUwuQeqsj0eNAhBJYHPndKUn+jA9QKa7FZqLEouqm6CA2mG/A4VLTmtdTEiRGzHycNPXCL83dCuOL5o5wXQ/Xr+7Rtp52A==
  • Ironport-sdr: TnrJqegWpQEnnyLqeaJBl16T+b1UCenbSRg6QFJ5HWWkQSzuPY86UO/JwoTbd/WICmPy/qordw uYOtonOiHp8g==
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.