| 203 | } |
| 204 | |
| 205 | void |
| 206 | cg_create(void) |
| 207 | { |
| 208 | if (!cg_enable) |
| 209 | return; |
| 210 | |
| 211 | struct stat st; |
| 212 | char path[PATH_MAX]; |
| 213 | |
| 214 | cg_makepath(path, sizeof(path), NULL); |
| 215 | if (stat(path, &st) >= 0 || errno != ENOENT) |
| 216 | { |
| 217 | msg("Control group %s already exists, trying to empty it.\n", path); |
| 218 | if (rmdir(path) < 0) |
| 219 | die("Failed to reset control group %s: %m", path); |
| 220 | } |
| 221 | |
| 222 | if (mkdir(path, 0777)) |
| 223 | die("Failed to create control group %s: %m", path); |
| 224 | } |
| 225 | |
| 226 | void |
| 227 | cg_enter(void) |
no test coverage detected
searching dependent graphs…