Lines Matching refs:fd

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