[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 14/43: procfs: Provide 'hostinfo'.
From: |
Samuel Thibault |
Subject: |
[hurd] 14/43: procfs: Provide 'hostinfo'. |
Date: |
Mon, 11 Sep 2017 07:10:09 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit dc0b5a43224999223a246870912b0f292b1980e9
Author: Justus Winter <address@hidden>
Date: Sat Apr 1 02:58:16 2017 +0200
procfs: Provide 'hostinfo'.
* procfs/rootdir.c (rootdir_gc_hostinfo): New function.
(rootdir_entries): New entry 'hostinfo'.
---
procfs/rootdir.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 59 insertions(+), 1 deletion(-)
diff --git a/procfs/rootdir.c b/procfs/rootdir.c
index 50923f5..b654fa2 100644
--- a/procfs/rootdir.c
+++ b/procfs/rootdir.c
@@ -1,5 +1,5 @@
/* Hurd /proc filesystem, permanent files of the root directory.
- Copyright (C) 2010,13,14 Free Software Foundation, Inc.
+ Copyright (C) 2010,13,14,17 Free Software Foundation, Inc.
This file is part of the GNU Hurd.
@@ -473,6 +473,57 @@ rootdir_gc_slabinfo (void *hook, char **contents, ssize_t
*contents_len)
}
static error_t
+rootdir_gc_hostinfo (void *hook, char **contents, ssize_t *contents_len)
+{
+ error_t err;
+ FILE *m;
+ host_basic_info_t basic;
+ host_sched_info_t sched;
+ host_load_info_t load;
+
+ m = open_memstream (contents, (size_t *) contents_len);
+ if (m == NULL)
+ return ENOMEM;
+
+ err = ps_host_basic_info (&basic);
+ if (! err)
+ fprintf (m, "Basic info:\n"
+ "max_cpus = %10u /* max number of cpus possible */\n"
+ "avail_cpus = %10u /* number of cpus now available */\n"
+ "memory_size = %10u /* size of memory in bytes */\n"
+ "cpu_type = %10u /* cpu type */\n"
+ "cpu_subtype = %10u /* cpu subtype */\n",
+ basic->max_cpus,
+ basic->avail_cpus,
+ basic->memory_size,
+ basic->cpu_type,
+ basic->cpu_subtype);
+
+ err = ps_host_sched_info (&sched);
+ if (! err)
+ fprintf (m, "\nScheduling info:\n"
+ "min_timeout = %10u /* minimum timeout in milliseconds */\n"
+ "min_quantum = %10u /* minimum quantum in milliseconds
*/\n",
+ sched->min_timeout,
+ sched->min_quantum);
+
+ err = ps_host_load_info (&load);
+ if (! err)
+ fprintf (m, "\nLoad info:\n"
+ "avenrun[3] = { %.2f, %.2f, %.2f }\n"
+ "mach_factor[3] = { %.2f, %.2f, %.2f }\n",
+ load->avenrun[0] / (double) LOAD_SCALE,
+ load->avenrun[1] / (double) LOAD_SCALE,
+ load->avenrun[2] / (double) LOAD_SCALE,
+ load->mach_factor[0] / (double) LOAD_SCALE,
+ load->mach_factor[1] / (double) LOAD_SCALE,
+ load->mach_factor[2] / (double) LOAD_SCALE);
+
+ fclose (m);
+ return 0;
+}
+
+static error_t
rootdir_gc_filesystems (void *hook, char **contents, ssize_t *contents_len)
{
error_t err = 0;
@@ -745,6 +796,13 @@ static const struct procfs_dir_entry rootdir_entries[] = {
},
},
{
+ .name = "hostinfo",
+ .hook = & (struct procfs_node_ops) {
+ .get_contents = rootdir_gc_hostinfo,
+ .cleanup_contents = procfs_cleanup_contents_with_free,
+ },
+ },
+ {
.name = "filesystems",
.hook = & (struct procfs_node_ops) {
.get_contents = rootdir_gc_filesystems,
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 27/43: eth-multiplexer: Generalize function and improve error handling., (continued)
- [hurd] 27/43: eth-multiplexer: Generalize function and improve error handling., Samuel Thibault, 2017/09/11
- [hurd] 32/43: eth-multiplexer: Fix type check., Samuel Thibault, 2017/09/11
- [hurd] 38/43: trans/mtab: Fix warnings., Samuel Thibault, 2017/09/11
- [hurd] 41/43: exec: Avoid calling mmap with zero size, Samuel Thibault, 2017/09/11
- [hurd] 24/43: eth-multiplexer: Fix error handling., Samuel Thibault, 2017/09/11
- [hurd] 12/43: Fix typo., Samuel Thibault, 2017/09/11
- [hurd] 21/43: startup: Fix retrieving the privileged ports., Samuel Thibault, 2017/09/11
- [hurd] 25/43: eth-multiplexer: Implement getting the devices flags., Samuel Thibault, 2017/09/11
- [hurd] 20/43: ext2fs: Fix warning., Samuel Thibault, 2017/09/11
- [hurd] 18/43: Make build system more robust., Samuel Thibault, 2017/09/11
- [hurd] 14/43: procfs: Provide 'hostinfo'.,
Samuel Thibault <=
- [hurd] 23/43: startup: Improve error handling., Samuel Thibault, 2017/09/11
- [hurd] 28/43: eth-multiplexer: Allow setting of flags., Samuel Thibault, 2017/09/11
- [hurd] 33/43: libdiskfs: Use control class for the singleton 'bootinfo'., Samuel Thibault, 2017/09/11
- [hurd] 31/43: ext2fs: Improve inlining., Samuel Thibault, 2017/09/11
- [hurd] 08/43: trans/fakeroot: Obey O_NOFOLLOW., Samuel Thibault, 2017/09/11
- [hurd] 35/43: libnetfs: Remove redundant type checks., Samuel Thibault, 2017/09/11
- [hurd] 26/43: eth-multiplexer: Remove local definiton., Samuel Thibault, 2017/09/11
- [hurd] 34/43: libdiskfs: Simplify type checks., Samuel Thibault, 2017/09/11
- [hurd] 16/43: Simplify deallocations., Samuel Thibault, 2017/09/11
- [hurd] 29/43: eth-multiplexer: Respect interfaces up flags., Samuel Thibault, 2017/09/11