Lines Matching refs:uid
118 bool SetProcessProfiles(uid_t uid, pid_t pid, const std::vector<std::string>& profiles) { in SetProcessProfiles() argument
119 return TaskProfiles::GetInstance().SetProcessProfiles(uid, pid, profiles); in SetProcessProfiles()
126 static std::string ConvertUidToPath(const char* cgroup, uid_t uid) { in ConvertUidToPath() argument
127 return StringPrintf("%s/uid_%d", cgroup, uid); in ConvertUidToPath()
130 static std::string ConvertUidPidToPath(const char* cgroup, uid_t uid, int pid) { in ConvertUidPidToPath() argument
131 return StringPrintf("%s/uid_%d/pid_%d", cgroup, uid, pid); in ConvertUidPidToPath()
134 static int RemoveProcessGroup(const char* cgroup, uid_t uid, int pid) { in RemoveProcessGroup() argument
137 auto uid_pid_path = ConvertUidPidToPath(cgroup, uid, pid); in RemoveProcessGroup()
140 auto uid_path = ConvertUidToPath(cgroup, uid); in RemoveProcessGroup()
147 std::unique_ptr<DIR, decltype(&closedir)> uid(opendir(uid_path.c_str()), closedir); in RemoveUidProcessGroups() local
149 if (uid != NULL) { in RemoveUidProcessGroups()
151 while ((dir = readdir(uid.get())) != nullptr) { in RemoveUidProcessGroups()
215 static bool MkdirAndChown(const std::string& path, mode_t mode, uid_t uid, gid_t gid) { in MkdirAndChown() argument
220 if (chown(path.c_str(), uid, gid) == -1) { in MkdirAndChown()
233 static int DoKillProcessGroupOnce(const char* cgroup, uid_t uid, int initialPid, int signal) { in DoKillProcessGroupOnce() argument
234 auto path = ConvertUidPidToPath(cgroup, uid, initialPid) + PROCESSGROUP_CGROUP_PROCS_FILE; in DoKillProcessGroupOnce()
241 PLOG(WARNING) << "Failed to open process cgroup uid " << uid << " pid " << initialPid; in DoKillProcessGroupOnce()
282 LOG(VERBOSE) << "Killing process group " << -pgid << " in uid " << uid in DoKillProcessGroupOnce()
292 LOG(VERBOSE) << "Killing pid " << pid << " in uid " << uid << " as part of process cgroup " in DoKillProcessGroupOnce()
303 static int KillProcessGroup(uid_t uid, int initialPid, int signal, int retries, in KillProcessGroup() argument
313 (!access(ConvertUidPidToPath(cpuacct_path.c_str(), uid, initialPid).c_str(), F_OK)) in KillProcessGroup()
325 while ((processes = DoKillProcessGroupOnce(cgroup, uid, initialPid, signal)) > 0) { in KillProcessGroup()
339 PLOG(ERROR) << "Error encountered killing process cgroup uid " << uid << " pid " in KillProcessGroup()
355 LOG(INFO) << "Successfully killed process cgroup uid " << uid << " pid " << initialPid in KillProcessGroup()
358 return RemoveProcessGroup(cgroup, uid, initialPid); in KillProcessGroup()
361 LOG(ERROR) << "Failed to kill process cgroup uid " << uid << " pid " << initialPid in KillProcessGroup()
369 int killProcessGroup(uid_t uid, int initialPid, int signal, int* max_processes) { in killProcessGroup() argument
370 return KillProcessGroup(uid, initialPid, signal, 40 /*retries*/, max_processes); in killProcessGroup()
373 int killProcessGroupOnce(uid_t uid, int initialPid, int signal, int* max_processes) { in killProcessGroupOnce() argument
374 return KillProcessGroup(uid, initialPid, signal, 0 /*retries*/, max_processes); in killProcessGroupOnce()
377 int createProcessGroup(uid_t uid, int initialPid, bool memControl) { in createProcessGroup() argument
386 auto uid_path = ConvertUidToPath(cgroup.c_str(), uid); in createProcessGroup()
393 auto uid_pid_path = ConvertUidPidToPath(cgroup.c_str(), uid, initialPid); in createProcessGroup()