Lines Matching refs:fd
417 kwboot_write(int fd, const char *buf, size_t len) in kwboot_write() argument
422 ssize_t wr = write(fd, buf + tot, len - tot); in kwboot_write()
515 kwboot_tty_recv(int fd, void *buf, size_t len, int timeo) in kwboot_tty_recv() argument
525 FD_SET(fd, &rfds); in kwboot_tty_recv()
535 nfds = select(fd + 1, &rfds, NULL, NULL, &tv); in kwboot_tty_recv()
545 n = read(fd, buf, len); in kwboot_tty_recv()
561 kwboot_tty_send(int fd, const void *buf, size_t len, int nodrain) in kwboot_tty_send() argument
566 if (kwboot_write(fd, buf, len) < 0) in kwboot_tty_send()
572 return tcdrain(fd); in kwboot_tty_send()
576 kwboot_tty_send_char(int fd, unsigned char c) in kwboot_tty_send_char() argument
578 return kwboot_tty_send(fd, &c, 1, 0); in kwboot_tty_send_char()
738 kwboot_tty_change_baudrate(int fd, int baudrate) in kwboot_tty_change_baudrate() argument
744 rc = tcgetattr(fd, &tio); in kwboot_tty_change_baudrate()
767 rc = tcsetattr(fd, TCSANOW, &tio); in kwboot_tty_change_baudrate()
771 rc = tcgetattr(fd, &tio); in kwboot_tty_change_baudrate()
802 int rc, fd, flags; in kwboot_open_tty() local
807 fd = open(path, O_RDWR | O_NOCTTY | O_NDELAY); in kwboot_open_tty()
808 if (fd < 0) in kwboot_open_tty()
811 rc = tcgetattr(fd, &tio); in kwboot_open_tty()
821 rc = tcsetattr(fd, TCSANOW, &tio); in kwboot_open_tty()
825 flags = fcntl(fd, F_GETFL); in kwboot_open_tty()
829 rc = fcntl(fd, F_SETFL, flags & ~O_NDELAY); in kwboot_open_tty()
833 rc = kwboot_tty_change_baudrate(fd, baudrate); in kwboot_open_tty()
837 rc = fd; in kwboot_open_tty()
840 if (fd >= 0) in kwboot_open_tty()
841 close(fd); in kwboot_open_tty()
1213 kwboot_baud_magic_handle(int fd, char c, int baudrate) in kwboot_baud_magic_handle() argument
1232 return kwboot_tty_change_baudrate(fd, baudrate) ? : 1; in kwboot_baud_magic_handle()
1239 kwboot_xm_recv_reply(int fd, char *c, int stop_on_non_xm, in kwboot_xm_recv_reply() argument
1249 rc = kwboot_tty_recv(fd, c, 1, timeout); in kwboot_xm_recv_reply()
1282 rc = kwboot_baud_magic_handle(fd, *c, baudrate); in kwboot_xm_recv_reply()
1309 kwboot_xm_sendblock(int fd, struct kwboot_block *block, int allow_non_xm, in kwboot_xm_sendblock() argument
1322 rc = kwboot_tty_send(fd, block, sizeof(*block), 1); in kwboot_xm_sendblock()
1332 rc = kwboot_xm_recv_reply(fd, &c, retries < 3, in kwboot_xm_sendblock()
1365 kwboot_xm_finish(int fd) in kwboot_xm_finish() argument
1374 rc = kwboot_tty_send_char(fd, EOT); in kwboot_xm_finish()
1378 rc = kwboot_xm_recv_reply(fd, &c, retries < 3, in kwboot_xm_finish()
1689 int rc, fd; in kwboot_read_image() local
1697 fd = open(path, O_RDONLY); in kwboot_read_image()
1698 if (fd < 0) in kwboot_read_image()
1701 len = lseek(fd, 0, SEEK_END); in kwboot_read_image()
1705 if (lseek(fd, 0, SEEK_SET) == (off_t)-1) in kwboot_read_image()
1714 ssize_t rd = read(fd, img + tot, len - tot); in kwboot_read_image()
1734 if (fd >= 0) in kwboot_read_image()
1735 close(fd); in kwboot_read_image()