basic: turn off stdio locking for a couple of helper calls

These helper calls are potentially called often, and allocate FILE*
objects internally for a very short period of time, let's turn off
locking for them too.
This commit is contained in:
Lennart Poettering
2017-12-14 10:46:19 +01:00
parent 0d53667334
commit 35bbbf85e0
4 changed files with 33 additions and 1 deletions
+5
View File
@@ -24,6 +24,7 @@
#include <limits.h>
#include <signal.h>
#include <stddef.h>
#include <stdio_ext.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
@@ -1032,6 +1033,8 @@ int cg_pid_get_path(const char *controller, pid_t pid, char **path) {
if (!f)
return errno == ENOENT ? -ESRCH : -errno;
(void) __fsetlocking(f, FSETLOCKING_BYCALLER);
FOREACH_LINE(line, f, return -errno) {
char *e, *p;
@@ -2371,6 +2374,8 @@ int cg_kernel_controllers(Set **ret) {
return -errno;
}
(void) __fsetlocking(f, FSETLOCKING_BYCALLER);
/* Ignore the header line */
(void) read_line(f, (size_t) -1, NULL);