MCPcopy Create free account
hub / github.com/ioi/isolate / cg_init

Function cg_init

cg.c:171–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169}
170
171void
172cg_init(void)
173{
174 if (!cg_enable)
175 return;
176
177 if (strlen(cf_cg_root) > 5 && !memcmp(cf_cg_root, "auto:", 5))
178 {
179 char *filename = cf_cg_root + 5;
180 FILE *f = fopen(filename, "r");
181 if (!f)
182 die("Cannot open %s: %m", filename);
183
184 char *line = NULL;
185 size_t len;
186 if (getline(&line, &len, f) < 0)
187 die("Cannot read from %s: %m", filename);
188
189 char *sep = strchr(line, '\n');
190 if (sep)
191 *sep = 0;
192
193 fclose(f);
194 cf_cg_root = line;
195 }
196
197 if (!dir_exists(cf_cg_root))
198 die("Control group root %s does not exist", cf_cg_root);
199
200 snprintf(cg_name, sizeof(cg_name), "box-%d", box_id);
201
202 msg("Using control group %s under parent %s\n", cg_name, cf_cg_root);
203}
204
205void
206cg_create(void)

Callers 1

mainFunction · 0.85

Calls 2

dir_existsFunction · 0.85
msgFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…