Lines Matching refs:fd
61 int bits = 256, fd; in seed_rng() local
66 fd = open("/dev/random", O_WRONLY); in seed_rng()
67 if (fd < 0) in seed_rng()
69 if (ioctl(fd, RNDADDTOENTCNT, &bits) < 0) in seed_rng()
71 close(fd); in seed_rng()
112 int fd; in enable_logging() local
114 fd = open("/proc/sys/kernel/printk", O_WRONLY); in enable_logging()
115 if (fd >= 0) { in enable_logging()
116 if (write(fd, "9\n", 2) != 2) in enable_logging()
118 close(fd); in enable_logging()
120 fd = open("/proc/sys/debug/exception-trace", O_WRONLY); in enable_logging()
121 if (fd >= 0) { in enable_logging()
122 if (write(fd, "1\n", 2) != 2) in enable_logging()
124 close(fd); in enable_logging()
164 int status, fd; in launch_tests() local
179 fd = open("/proc/cmdline", O_RDONLY); in launch_tests()
180 if (fd < 0) in launch_tests()
182 if (read(fd, cmdline, sizeof(cmdline) - 1) <= 0) in launch_tests()
195 fd = open(success_dev, O_WRONLY); in launch_tests()
196 if (fd < 0) in launch_tests()
198 if (write(fd, "success\n", 8) != 8) in launch_tests()
200 close(fd); in launch_tests()
219 int fd = open("/dev/console", O_RDWR); in ensure_console() local
220 if (fd < 0) { in ensure_console()
224 dup2(fd, 0); in ensure_console()
225 dup2(fd, 1); in ensure_console()
226 dup2(fd, 2); in ensure_console()
227 close(fd); in ensure_console()
236 int fd; in clear_leaks() local
238 fd = open("/sys/kernel/debug/kmemleak", O_WRONLY); in clear_leaks()
239 if (fd < 0) in clear_leaks()
242 write(fd, "clear\n", 5); in clear_leaks()
243 close(fd); in clear_leaks()
248 int fd; in check_leaks() local
250 fd = open("/sys/kernel/debug/kmemleak", O_WRONLY); in check_leaks()
251 if (fd < 0) in check_leaks()
255 write(fd, "scan\n", 5); in check_leaks()
256 close(fd); in check_leaks()
258 fd = open("/sys/kernel/debug/kmemleak", O_RDONLY); in check_leaks()
259 if (fd < 0) in check_leaks()
261 if (sendfile(1, fd, NULL, 0x7ffff000) > 0) in check_leaks()
263 close(fd); in check_leaks()