From 95544a17fac7e5fb2b0eabe3d96305813fc96a1b Mon Sep 17 00:00:00 2001 From: netblue30 Date: Mon, 13 Jun 2022 09:26:37 -0400 Subject: more on disable cgroups --- src/firemon/cgroup.c | 63 --------------------------------------------------- src/firemon/firemon.c | 10 +------- src/firemon/firemon.h | 3 --- src/firemon/usage.c | 1 - 4 files changed, 1 insertion(+), 76 deletions(-) delete mode 100644 src/firemon/cgroup.c (limited to 'src/firemon') diff --git a/src/firemon/cgroup.c b/src/firemon/cgroup.c deleted file mode 100644 index 7ef76fa46..000000000 --- a/src/firemon/cgroup.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2014-2022 Firejail Authors - * - * This file is part of firejail project - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ -#include "firemon.h" -#define MAXBUF 4098 - -static void print_cgroup(int pid) { - char *file; - if (asprintf(&file, "/proc/%d/cgroup", pid) == -1) { - errExit("asprintf"); - exit(1); - } - - FILE *fp = fopen(file, "r"); - if (!fp) { - printf(" Error: cannot open %s\n", file); - free(file); - return; - } - - char buf[MAXBUF]; - if (fgets(buf, MAXBUF, fp)) { - printf(" %s", buf); - fflush(0); - } - - fclose(fp); - free(file); -} - -void cgroup(pid_t pid, int print_procs) { - pid_read(pid); - - // print processes - printf(" cgroup: "); - int i; - for (i = 0; i < max_pids; i++) { - if (pids[i].level == 1) { - if (print_procs || pid == 0) - pid_print_list(i, arg_wrap); - int child = find_child(i); - if (child != -1) - print_cgroup(child); - } - } - printf("\n"); -} diff --git a/src/firemon/firemon.c b/src/firemon/firemon.c index 91406d6a7..4ee319a7e 100644 --- a/src/firemon/firemon.c +++ b/src/firemon/firemon.c @@ -34,7 +34,6 @@ static int arg_interface = 0; static int arg_seccomp = 0; static int arg_caps = 0; static int arg_cpu = 0; -static int arg_cgroup = 0; static int arg_x11 = 0; static int arg_top = 0; static int arg_list = 0; @@ -173,8 +172,6 @@ int main(int argc, char **argv) { // cumulative options with or without a pid argument else if (strcmp(argv[i], "--x11") == 0) arg_x11 = 1; - else if (strcmp(argv[i], "--cgroup") == 0) - arg_cgroup = 1; else if (strcmp(argv[i], "--cpu") == 0) arg_cpu = 1; else if (strcmp(argv[i], "--seccomp") == 0) @@ -264,12 +261,11 @@ int main(int argc, char **argv) { // if --name requested without other options, print all data if (pid && !arg_cpu && !arg_seccomp && !arg_caps && !arg_apparmor && - !arg_cgroup && !arg_x11 && !arg_interface && !arg_route && !arg_arp) { + !arg_x11 && !arg_interface && !arg_route && !arg_arp) { arg_tree = 1; arg_cpu = 1; arg_seccomp = 1; arg_caps = 1; - arg_cgroup = 1; arg_x11 = 1; arg_interface = 1; arg_route = 1; @@ -295,10 +291,6 @@ int main(int argc, char **argv) { apparmor((pid_t) pid, print_procs); print_procs = 0; } - if (arg_cgroup) { - cgroup((pid_t) pid, print_procs); - print_procs = 0; - } if (arg_x11) { x11((pid_t) pid, print_procs); print_procs = 0; diff --git a/src/firemon/firemon.h b/src/firemon/firemon.h index 2fa294e8d..d12091217 100644 --- a/src/firemon/firemon.h +++ b/src/firemon/firemon.h @@ -75,9 +75,6 @@ void seccomp(pid_t pid, int print_procs); // cpu.c void cpu(pid_t pid, int print_procs); -// cgroup.c -void cgroup(pid_t pid, int print_procs); - // tree.c void tree(pid_t pid); diff --git a/src/firemon/usage.c b/src/firemon/usage.c index c6a664790..a1b6098ef 100644 --- a/src/firemon/usage.c +++ b/src/firemon/usage.c @@ -29,7 +29,6 @@ static char *help_str = "\t--apparmor - print AppArmor confinement status for each sandbox.\n\n" "\t--arp - print ARP table for each sandbox.\n\n" "\t--caps - print capabilities configuration for each sandbox.\n\n" - "\t--cgroup - print control group information for each sandbox.\n\n" "\t--cpu - print CPU affinity for each sandbox.\n\n" "\t--debug - print debug messages.\n\n" "\t--help, -? - this help screen.\n\n" -- cgit v1.2.3-54-g00ecf