Lines Matching refs:fd
44 ssize_t os_read(int fd, void *buf, size_t count) in os_read() argument
46 return read(fd, buf, count); in os_read()
49 ssize_t os_write(int fd, const void *buf, size_t count) in os_write() argument
51 return write(fd, buf, count); in os_write()
54 off_t os_lseek(int fd, off_t offset, int whence) in os_lseek() argument
64 return lseek(fd, offset, whence); in os_lseek()
99 int os_close(int fd) in os_close() argument
102 if (fd) in os_close()
103 return close(fd); in os_close()
119 int fd; in os_write_file() local
121 fd = os_open(fname, OS_O_WRONLY | OS_O_CREAT | OS_O_TRUNC); in os_write_file()
122 if (fd < 0) { in os_write_file()
126 if (os_write(fd, buf, size) != size) { in os_write_file()
128 os_close(fd); in os_write_file()
131 os_close(fd); in os_write_file()
140 int fd; in os_read_file() local
142 fd = os_open(fname, OS_O_RDONLY); in os_read_file()
143 if (fd < 0) { in os_read_file()
147 size = os_lseek(fd, 0, OS_SEEK_END); in os_read_file()
152 if (os_lseek(fd, 0, OS_SEEK_SET) < 0) { in os_read_file()
162 if (os_read(fd, *bufp, size) != size) { in os_read_file()
166 os_close(fd); in os_read_file()
171 os_close(fd); in os_read_file()
238 void os_tty_raw(int fd, bool allow_sigs) in os_tty_raw() argument
247 if (tcgetattr(fd, &orig_term)) in os_tty_raw()
255 if (tcsetattr(fd, TCSANOW, &term)) in os_tty_raw()
258 flags = fcntl(fd, F_GETFL, 0); in os_tty_raw()
260 if (fcntl(fd, F_SETFL, flags | O_NONBLOCK)) in os_tty_raw()
555 int fd, ret; in os_write_ram_buf() local
557 fd = open(fname, O_CREAT | O_WRONLY, 0777); in os_write_ram_buf()
558 if (fd < 0) in os_write_ram_buf()
560 ret = write(fd, state->ram_buf, state->ram_size); in os_write_ram_buf()
561 close(fd); in os_write_ram_buf()
571 int fd, ret; in os_read_ram_buf() local
579 fd = open(fname, O_RDONLY); in os_read_ram_buf()
580 if (fd < 0) in os_read_ram_buf()
583 ret = read(fd, state->ram_buf, state->ram_size); in os_read_ram_buf()
584 close(fd); in os_read_ram_buf()
593 int fd; in make_exec() local
596 fd = mkstemp(fname); in make_exec()
597 if (fd < 0) in make_exec()
599 if (write(fd, data, size) < 0) in make_exec()
601 close(fd); in make_exec()
670 int fd, err; in os_jump_to_file() local
679 fd = mkstemp(mem_fname); in os_jump_to_file()
680 if (fd < 0) in os_jump_to_file()
682 close(fd); in os_jump_to_file()
739 int fd; in os_find_u_boot() local
750 fd = os_open(fname, O_RDONLY); in os_find_u_boot()
751 if (fd >= 0) { in os_find_u_boot()
752 close(fd); in os_find_u_boot()
760 fd = os_open(fname, O_RDONLY); in os_find_u_boot()
761 if (fd >= 0) { in os_find_u_boot()
762 close(fd); in os_find_u_boot()
772 fd = os_open(fname, O_RDONLY); in os_find_u_boot()
773 if (fd >= 0) { in os_find_u_boot()
774 close(fd); in os_find_u_boot()
784 fd = os_open(fname, O_RDONLY); in os_find_u_boot()
785 if (fd >= 0) { in os_find_u_boot()
786 close(fd); in os_find_u_boot()
864 int fd; in os_find_text_base() local
876 fd = open("/proc/self/maps", O_RDONLY); in os_find_text_base()
877 if (fd == -1) in os_find_text_base()
879 len = read(fd, line, sizeof(line)); in os_find_text_base()
891 close(fd); in os_find_text_base()