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

Re: [Minios-devel] [UNIKRAFT PATCH 2/2] lib/uksysinfo: Add sysinfo stub


  • To: "minios-devel@xxxxxxxxxxxxxxxxxxxx" <minios-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Vlad-Andrei BĂDOIU (78692) <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
  • Date: Wed, 4 Dec 2019 15:23: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=X2VIGHd3fs9s2ovLNozbakYDyVeLDkGG/XBbUd+N1pc=; b=jSz/JK/PZGu5XU+xgWyhjrIuXcAnIC0FeVv9+CCK1fzYFfBIZJmjf+LNCwus18YglHXX2j5fq6J8vV+iQJV4BWa4BTdYqzl3BXOXg/HVui2syOCEZjYUwnvLIaMni0uR9apwteaSYta9gAbbd5iVNqB3OZKxw/plUqR4uXk24R94kfMis+f2HLIHVjCUpZJs3ED0E9JklY6YXsOgv9LyYzSReeE48Ml//1CQp1/PW3+C89t5DnN4WzHo4e4ia8rv0G0aK6OByeThQcPfkpnC8mptDeF9dbzx9uQsRSAq3pFNlb6faOaZMPmD1Zxe82VndqXquHb0KJfk7JqfVKQjBw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J1UoKxYhdWVs3lhlm6dI91BOuuYuqcdYfXw9v3wzsVh7A5dEyMnTHi+M1oM00oybgObxp/eD31jWdYzEMsOuxbGMpwfFBHqRzKYNyoA23r9YIGTvbxuGag4Hcsz5SPX86OP6spcuOCVsD7XFwe8tCimLX07LApxbM7iOs28mfhJd3gBRNqm6vELidBLl/y4zq5pqyKEEBZKq/eyE8zeaFKutKbaLndE+PPx+4XGp9PxW0G3rKK6vHcdXTzg/d0e/XOfpcNHN3X/a0A3WaFyK/mAemjxRk/NQ09rlhJlBNSv4/TMxvj/K1BWB3HqDSXj+73GASdkldENlwaeF9bRKSg==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=vlad_andrei.badoiu@xxxxxxxxxxxxxxx;
  • Delivery-date: Wed, 04 Dec 2019 15:23:37 +0000
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>
  • Thread-index: AQHVqRAKOhBFMmZ5sE2gE8BNGKxUYqeqG24A
  • Thread-topic: [Minios-devel] [UNIKRAFT PATCH 2/2] lib/uksysinfo: Add sysinfo stub

Hey Felipe,

There is one comment that may be fixed during the upstreaming. Please 
see inline

Thanks,

Vlad

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

On 02.12.2019 14:57, Felipe Huici wrote:
> Add sysinfo stub, needed by lowjs build.
>
> Signed-off-by: Felipe Huici <felipe.huici@xxxxxxxxx>
> ---
>   lib/uksysinfo/exportsyms.uk         |  1 +
>   lib/uksysinfo/include/sys/sysinfo.h | 62 +++++++++++++++++++++++++++++
>   lib/uksysinfo/sysinfo.c             |  5 +++
>   3 files changed, 68 insertions(+)
>   create mode 100644 lib/uksysinfo/include/sys/sysinfo.h
>
> diff --git a/lib/uksysinfo/exportsyms.uk b/lib/uksysinfo/exportsyms.uk
> index 73e1fe99..d5131332 100644
> --- a/lib/uksysinfo/exportsyms.uk
> +++ b/lib/uksysinfo/exportsyms.uk
> @@ -1,5 +1,6 @@
>   fpathconf
>   sysconf
> +sysinfo
>   confstr
>   pathconf
>   getpagesize
> diff --git a/lib/uksysinfo/include/sys/sysinfo.h 
> b/lib/uksysinfo/include/sys/sysinfo.h
> new file mode 100644
> index 00000000..2141f555
> --- /dev/null
> +++ b/lib/uksysinfo/include/sys/sysinfo.h
> @@ -0,0 +1,62 @@
> +/* SPDX-License-Identifier: MIT */
> +/* ----------------------------------------------------------------------
> + * Copyright <C2><A9> 2005-2014 Rich Felker, et al.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining
> + * a copy of this software and associated documentation files (the
> + * "Software"), to deal in the Software without restriction, including
> + * without limitation the rights to use, copy, modify, merge, publish,
> + * distribute, sublicense, and/or sell copies of the Software, and to
> + * permit persons to whom the Software is furnished to do so, subject to
> + * the following conditions:
> + *
> + * The above copyright notice and this permission notice shall be
> + * included in all copies or substantial portions of the Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
> + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
> + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
> + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
> + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
> + * ----------------------------------------------------------------------
> + */
> +/* Taken from musl-1.1.19 */
> +
> +#ifndef _SYS_SYSINFO_H
> +#define _SYS_SYSINFO_H
> +
> +#ifdef __cplusplus
> +extern "C" {
> +#endif
> +
> +#define SI_LOAD_SHIFT 16
> +
> +struct sysinfo {
> +     unsigned long uptime;
> +     unsigned long loads[3];
> +     unsigned long totalram;
> +     unsigned long freeram;
> +     unsigned long sharedram;
> +     unsigned long bufferram;
> +     unsigned long totalswap;
> +     unsigned long freeswap;
> +     unsigned short procs, pad;
> +     unsigned long totalhigh;
> +     unsigned long freehigh;
> +     unsigned mem_unit;
> +     char __reserved[256];
> +};
> +
> +int sysinfo (struct sysinfo *);
> +int get_nprocs_conf (void);
> +int get_nprocs (void);
> +long get_phys_pages (void);
> +long get_avphys_pages (void);
> +
> +#ifdef __cplusplus
> +}
> +#endif
> +
> +#endif
> diff --git a/lib/uksysinfo/sysinfo.c b/lib/uksysinfo/sysinfo.c
> index 6adcf221..ececdea1 100644
> --- a/lib/uksysinfo/sysinfo.c
> +++ b/lib/uksysinfo/sysinfo.c
> @@ -57,6 +57,11 @@ static struct utsname utsname = {
>   #endif
>   };
>   
> +int sysinfo(struct sysinfo *info)

There are two warning here that we should solve.

1. We should use the __unused macro

2. We should have a #include<sys/sysinfo.h>

> +{
> +     return -1;
> +}
> +
>   long fpathconf(int fd __unused, int name __unused)
>   {
>       return 0;
_______________________________________________
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®.