Lines Matching refs:fd
85 int fd;
88 if ((fd = open(path, O_RDONLY)) == -1)
92 bp = buf_load_fd(fd);
93 (void)close(fd);
98 buf_load_fd(int fd)
103 if (fstat(fd, &st) == -1)
106 if (lseek(fd, 0, SEEK_SET) == -1)
112 if (atomicio(read, fd, buf->cb_buf, buf->cb_size) != buf->cb_size)
197 * Write the contents of the buffer <b> to the specified <fd>
200 buf_write_fd(BUF *b, int fd)
202 if (atomicio(vwrite, fd, b->cb_buf, b->cb_len) != b->cb_len)
214 int fd;
216 if ((fd = open(path, O_WRONLY|O_CREAT|O_TRUNC, mode)) == -1) {
223 if (buf_write_fd(b, fd) == -1) {
228 if (fchmod(fd, mode) == -1)
231 (void)close(fd);
245 int fd;
247 if ((fd = mkstemp(template)) == -1)
250 if (buf_write_fd(b, fd) == -1) {
256 if (futimes(fd, tv) == -1)
262 if (lseek(fd, 0, SEEK_SET) == -1)
265 return (fd);