github.com/rigado/snapd@v2.42.5-go-mod+incompatible/cmd/libsnap-confine-private/cgroup-pids-support.h (about) 1 /* 2 * Copyright (C) 2019 Canonical Ltd 3 * 4 * This program is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License version 3 as 6 * published by the Free Software Foundation. 7 * 8 * This program is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * GNU General Public License for more details. 12 * 13 * You should have received a copy of the GNU General Public License 14 * along with this program. If not, see <http://www.gnu.org/licenses/>. 15 * 16 */ 17 18 #ifndef SC_CGROUP_PIDS_SUPPORT_H 19 #define SC_CGROUP_PIDS_SUPPORT_H 20 21 #include <sys/types.h> 22 23 /** 24 * Join the pid cgroup for the given snap application. 25 * 26 * This function adds the specified task to the pid cgroup specific to the 27 * given snap. The name of the cgroup is "snap.$snap_name.$app_name" for apps 28 * or "snap.$snap_name.hook.$hook_name" for hooks. 29 * 30 * The "tasks" file belonging to the cgroup contains the set of all the 31 * threads that originate from the given snap app or hook. Examining that 32 * file one can reliably determine if the set is empty or not. 33 * 34 * Similarly the "cgroup.procs" file belonging to the same directory contains 35 * the set of all the processes that originate from the given snap app or 36 * hook. 37 * 38 * For more details please review: 39 * https://www.kernel.org/doc/Documentation/cgroup-v1/pids.txt 40 **/ 41 void sc_cgroup_pids_join(const char *snap_security_tag, pid_t pid); 42 43 #endif