]> granicus.if.org Git - sysstat/commitdiff
sysstest: Add more comments
authorSebastien GODARD <sysstat@users.noreply.github.com>
Sat, 13 Nov 2021 14:42:08 +0000 (15:42 +0100)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Sat, 13 Nov 2021 14:42:08 +0000 (15:42 +0100)
Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
systest.c
tests/root.README

index 4f4c6cf1438dce3c68c2b910b8452ffa9b53277d..4ec1caa0bdf266e7bc3c7ed960bab3dc6df1d4bc 100644 (file)
--- a/systest.c
+++ b/systest.c
@@ -149,8 +149,10 @@ void next_time_step(void)
 
        __unix_time += interval;
 
+       /* Get root directory name (root1, root2, etc.) at which the "root" symlink points */
        if ((resolved_name = realpath(ROOTDIR, NULL)) != NULL) {
                if (strlen(resolved_name) > 4) {
+                       /* Set root_nr to the root directory number (1, 2, etc.) */
                        root_nr = atoi(resolved_name + strlen(resolved_name) - 1);
                }
                free(resolved_name);
@@ -160,19 +162,22 @@ void next_time_step(void)
                exit(1);
        }
 
+       /* Set next root directory name (root2, root3, etc.). Directories like root1b are unreachable */
        snprintf(rootf, sizeof(rootf), "%s%d", ROOTFILE, ++root_nr);
        rootf[sizeof(rootf) - 1] = '\0';
        snprintf(testf, sizeof(testf), "%s/%s", TESTDIR, rootf);
        testf[sizeof(testf) - 1] = '\0';
 
+       /* Make sure that new root directory exists */
        if (access(testf, F_OK) < 0) {
                if (errno == ENOENT) {
-                       /* No more kernel directories: Simulate a Ctrl/C */
+                       /* No more root directories: Simulate a Ctrl/C */
                        int_handler(0);
                        return;
                }
        }
 
+       /* Create "root" symlink pointing at the new root directory */
        if (symlink(rootf, ROOTDIR) < 0) {
                perror("link");
                exit(1);
index df82f39bc3fcb4c4e7bcd5097eae958675b3ab74..5bc4b7e77d3e4a23995cefbe4cc3d84ed7b7ab39 100644 (file)
@@ -123,6 +123,9 @@ PID:
 21342[21342 21344 8365]
 8407[8407]
 
+==========root6b:
+Some more statistics, especially for disks and network interfaces.
+
 ==========root7:
 /proc/diskstats
 sda, sda1: discard I/Os