#include #include #include #include #include #include #include #include #include #include using namespace std; void print_usage() { fprintf(stderr, "usage: cgattach \n"); } bool exist(string path) { struct stat st; if (stat(path.c_str(), &st) != -1) { return S_ISDIR(st.st_mode); } return false; } bool validate(string pid, string cgroup) { bool pid_v = regex_match(pid, regex("^[0-9]+$")); bool cg_v = regex_match(cgroup, regex("^\\/[a-zA-Z0-9\\-_./@]*$")); if (pid_v && cg_v) return true; // cout<