From: Sebastien GODARD Date: Sat, 13 Nov 2021 14:42:08 +0000 (+0100) Subject: sysstest: Add more comments X-Git-Tag: v12.5.5~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=31ac1735a94829ebd24df3b96378bf875fbb79e8;p=sysstat sysstest: Add more comments Signed-off-by: Sebastien GODARD --- diff --git a/systest.c b/systest.c index 4f4c6cf..4ec1caa 100644 --- 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); diff --git a/tests/root.README b/tests/root.README index df82f39..5bc4b7e 100644 --- a/tests/root.README +++ b/tests/root.README @@ -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