From: Stefan Jumarea Date: Mon, 27 Nov 2023 13:46:11 +0000 (+0200) Subject: lib/posix-sysinfo: Add code comments X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=70945a4f335d64dcf91d80f50069ef5b40eb91d4;p=unikraft%2Funikraft.git lib/posix-sysinfo: Add code comments Add doxygen-style code comments to the `posix-sysinfo` internal library files. Signed-off-by: Stefan Jumarea --- diff --git a/lib/posix-sysinfo/include/sys/sysinfo.h b/lib/posix-sysinfo/include/sys/sysinfo.h index b5903da52..83af6b5a4 100644 --- a/lib/posix-sysinfo/include/sys/sysinfo.h +++ b/lib/posix-sysinfo/include/sys/sysinfo.h @@ -33,6 +33,10 @@ extern "C" { #define SI_LOAD_SHIFT 16 +/** + * Structure used by the `sysinfo()` system call. + * Follows Linux conventions. + */ struct sysinfo { unsigned long uptime; unsigned long loads[3]; @@ -49,7 +53,14 @@ struct sysinfo { char _f[20-2*sizeof(unsigned long)-sizeof(unsigned int)]; }; +/** + * Follows Linux conventions for the `sysinfo()` system call. + */ int sysinfo (struct sysinfo *); + +/** + * Functions currently not implemented. + */ int get_nprocs_conf (void); int get_nprocs (void); long get_phys_pages (void); diff --git a/lib/posix-sysinfo/include/sys/utsname.h b/lib/posix-sysinfo/include/sys/utsname.h index d3973c3de..4882fadca 100644 --- a/lib/posix-sysinfo/include/sys/utsname.h +++ b/lib/posix-sysinfo/include/sys/utsname.h @@ -40,6 +40,10 @@ extern "C" { #define __UTSNAMELEN 65 /* synchronize with kernel */ +/** + * Structure used by the `uname()` system call. + * Follows Linux conventions. + */ struct utsname { char sysname[__UTSNAMELEN]; char nodename[__UTSNAMELEN]; diff --git a/lib/posix-sysinfo/sysinfo.c b/lib/posix-sysinfo/sysinfo.c index 4a511a358..1fe312ec7 100644 --- a/lib/posix-sysinfo/sysinfo.c +++ b/lib/posix-sysinfo/sysinfo.c @@ -51,6 +51,15 @@ #include #endif +/** + * The Unikraft `struct utsname` structure. + * + * * `sysname` and `nodename` are set to "unikraft". + * * `release` is set to * `5-{Unikraft Release Codename}` for glibc + * compatibility (see the comments below). + * * `version` is set to the Unikraft full version. + * * `machine` is set to the current architecture. + */ static struct utsname utsname = { .sysname = "Unikraft", .nodename = "unikraft",