Lines Matching refs:filename
65 void printErrno(const char *msg, const char *filename) in printErrno() argument
67 fprintf(stderr, "# %s %s %d %s\n", msg, filename, errno, strerror(errno)); in printErrno()
77 int readStringFromFile(const char *filename, char *const start, size_t size, bool must_exist=true) in readStringFromFile() argument
84 int fd = open(filename, O_RDONLY); in readStringFromFile()
90 printErrno("Failed to open", filename); in readStringFromFile()
112 printErrno("Failed to read", filename); in readStringFromFile()
138 fprintf(stderr, "Buffer too small for %s\n", filename); in readStringFromFile()
146 int writeStringToFile(const char *filename, const char *start, bool must_exist=true) in writeStringToFile() argument
148 int fd = open(filename, O_WRONLY); in writeStringToFile()
155 printErrno("Failed to open", filename); in writeStringToFile()
174 printErrno("Failed to write", filename); in writeStringToFile()
195 filename, size, len); in writeStringToFile()
201 int writeIntToFile(const char *filename, long value) in writeIntToFile() argument
205 return writeStringToFile(filename, buffer); in writeIntToFile()
242 char filename[FILENAME_MAX]; in pidOutOfMemoryAdj() local
244 snprintf(filename, sizeof(filename), "/proc/%d/oom_adj", getpid()); in pidOutOfMemoryAdj()
247 if (readStringFromFile(filename, value, sizeof(value)) == -1) in pidOutOfMemoryAdj()
259 char filename[FILENAME_MAX]; in setPidOutOfMemoryAdj() local
261 snprintf(filename, sizeof(filename), "/proc/%d/oom_adj", getpid()); in setPidOutOfMemoryAdj()
262 writeIntToFile(filename, level); in setPidOutOfMemoryAdj()