Lines Matching refs:fd

159 		in.fd = STDIN_FILENO;
161 in.fd = open(in.name, O_RDONLY, 0);
162 if (in.fd < 0) {
169 /* Ensure in.fd is outside the stdio descriptor range */
170 in.fd = redup_clean_fd(in.fd);
184 out.fd = STDOUT_FILENO;
189 out.fd = open(out.name, O_RDWR | OFLAGS, DEFFILEMODE);
195 if (out.fd < 0) {
196 out.fd = open(out.name, O_WRONLY | OFLAGS, DEFFILEMODE);
199 if (out.fd < 0) {
206 /* Ensure out.fd is outside the stdio descriptor range */
207 out.fd = redup_clean_fd(out.fd);
242 (void)ftruncate(out.fd, (off_t)out.offset * out.dbsz);
253 if (fstat(io->fd, &sb)) {
260 io->flags |= /*ioctl(io->fd, MTIOCGET, &mt) ? ISCHR : ISTAPE; */ ISCHR;
261 else if (lseek(io->fd, (off_t)0, SEEK_CUR) == -1 && errno == ESPIPE)
272 redup_clean_fd(int fd)
276 if (fd != STDIN_FILENO && fd != STDOUT_FILENO &&
277 fd != STDERR_FILENO)
279 return fd;
285 newfd = fcntl(fd, F_DUPFD, 3);
292 close(fd);
321 n = read(in.fd, in.dbp, in.dbsz);
349 lseek(in.fd, (off_t)in.dbsz, SEEK_CUR))
438 if (out.fd == STDOUT_FILENO && fsync(out.fd) == -1 && errno != EINVAL) {
443 if (close(out.fd) == -1) {
493 if (lseek(out.fd, pending, SEEK_CUR) ==
502 nw = bwrite(out.fd, outp, cnt);
566 bwrite(int fd, const void *buf, size_t len)
573 rv = write(fd, buf, len);
593 if (lseek(in.fd,
610 if ((nr = read(in.fd, in.db, bcnt)) > 0) {
664 if (lseek(out.fd,
679 if (ioctl(out.fd, MTIOCTOP, &t_op) < 0)*/
688 if ((n = read(out.fd, out.db, out.dbsz)) > 0)
705 if (ioctl(out.fd, MTIOCTOP, &t_op) == -1) */ {
712 if ((n = bwrite(out.fd, out.db, out.dbsz)) != out.dbsz) {
762 fdatasync(out.fd);