Lines Matching refs:fd
95 int fd, ret; in create_socket() local
101 fd = socket(PF_UNIX, type, 0); in create_socket()
102 if (fd < 0) { in create_socket()
128 ret = bind(fd, (struct sockaddr *) &addr, sizeof (addr)); in create_socket()
143 return fd; in create_socket()
148 close(fd); in create_socket()
155 int fd = TEMP_FAILURE_RETRY(open(path, O_RDONLY|O_NOFOLLOW|O_CLOEXEC)); in read_file() local
156 if (fd == -1) { in read_file()
163 if (fstat(fd, &sb) == -1) { in read_file()
172 bool okay = android::base::ReadFdToString(fd, content); in read_file()
173 close(fd); in read_file()
178 int fd = TEMP_FAILURE_RETRY(open(path, O_WRONLY|O_CREAT|O_NOFOLLOW|O_CLOEXEC, 0600)); in write_file() local
179 if (fd == -1) { in write_file()
183 int result = android::base::WriteStringToFd(content, fd) ? 0 : -1; in write_file()
187 close(fd); in write_file()
202 int fd; in find_mtd_partitions() local
208 fd = open("/proc/mtd", O_RDONLY|O_CLOEXEC); in find_mtd_partitions()
209 if (fd < 0) in find_mtd_partitions()
213 pmtdsize = read(fd, buf, sizeof(buf) - 1); in find_mtd_partitions()
245 close(fd); in find_mtd_partitions()
382 int fd = open("/sys/fs/selinux/null", O_RDWR); in open_devnull_stdio() local
383 if (fd == -1) { in open_devnull_stdio()
388 fd = open(name, O_RDWR); in open_devnull_stdio()
391 if (fd == -1) { in open_devnull_stdio()
396 dup2(fd, 0); in open_devnull_stdio()
397 dup2(fd, 1); in open_devnull_stdio()
398 dup2(fd, 2); in open_devnull_stdio()
399 if (fd > 2) { in open_devnull_stdio()
400 close(fd); in open_devnull_stdio()
408 int fd; in import_kernel_cmdline() local
410 fd = open("/proc/cmdline", O_RDONLY | O_CLOEXEC); in import_kernel_cmdline()
411 if (fd >= 0) { in import_kernel_cmdline()
412 int n = read(fd, cmdline, sizeof(cmdline) - 1); in import_kernel_cmdline()
419 close(fd); in import_kernel_cmdline()