[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT/NEWLIB PATCH 1/2] syslog.c: Bring back setlogmask() from musl


  • To: Costin Lupu <costin.lupu@xxxxxxxxx>, "minios-devel@xxxxxxxxxxxxx" <minios-devel@xxxxxxxxxxxxx>
  • From: Vlad-Andrei BĂDOIU (78692) <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
  • Date: Mon, 2 Sep 2019 20:24:31 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=stud.acs.upb.ro; dmarc=pass action=none header.from=stud.acs.upb.ro; dkim=pass header.d=stud.acs.upb.ro; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+fsFz2939rRMdFNiyWKVtI3fiLNCobEqt/s3uwQF3OU=; b=mTm8nrYzLgS4K+/gb+d3cAk2wGrbPmVUemNcYrJE+BqG21nFozMw+rCq61SEoIKGgvoFciYJgA6o5/DHyYvXX5IVR3Fs8bVl940aYx9nDDv3NBBYbpUFekZab/zLw8nnUJHsvl5KGr/UHQ/z20HNnN/xdbGNUuIPjky++HpWMTulpGGEK1V/om2YzCYXzjgGOFRvAJKD1T/Q9F1+5E6FiOLUTZXEOG5XyGEBmM2TDqz0JjHHj2shsra36mp5/N2mh3PgsbQTFb2/MLZSVHbBWG7o0BEyhafTlxfhxFAV3VZzEK/sdWOz1IqN4OQjFv1WCp1Hndz4A9cInbP3M0CGEw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b79J4wQHZ5ZrREoImEdTT+IaSrt0tcYoKRsxKl8vcoBVgt9syuYCvTYsMPP6ZwLVOKIAS5T6hog83q9gJV5rHtxxpdpQrVdPMZmPvmWrVqM4z/l1bpUXPKAI+JXTHDc2eenvEbLboVYeo6QOdUVvRtoU8ontYh2dP/JFNSEJfmG0ZFTwnwniAWdSm4qcS+QDwcZGRszs+MAmLdW6uZSVXlUihtWlefKZf8Lr+nwTi2xErZFkGrUZnL1Ek716LLcbO+yCZ8DIuiPBkeRKicnjiz1IVeu16kvyeu5gzg3bnt5thk0MwdPYwzdqDK0phFFEORZHPjdkWnMm1LoBUxGX+g==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=vlad_andrei.badoiu@xxxxxxxxxxxxxxx;
  • Delivery-date: Mon, 02 Sep 2019 20:24:39 +0000
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>
  • Thread-index: AQHVYaAQMzr77Lcr90emGFBacIqv8KcY1ZeA
  • Thread-topic: [UNIKRAFT/NEWLIB PATCH 1/2] syslog.c: Bring back setlogmask() from musl

Hi Costin,

I have tested this patch and it works great. Thanks!

Vlad

Reviewed-by: Vlad-Andrei Badoiu<vlad_andrei.badoiu@xxxxxxxxxxxxxxx>

On 02.09.2019 18:06, Costin Lupu wrote:
> 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);
_______________________________________________
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®.