Lines Matching defs:fd

97 	int		fd;
107 retval = open_file(dtpath, flags, &fd);
121 if (write_header(fd, &header) == -1) {
123 (void) close(fd);
133 if (read_header(fd, &header) == -1) {
135 (void) close(fd);
142 (void) close(fd);
148 (void) close(fd);
176 int fd;
185 fd = open(dtpath, O_RDONLY);
186 if (fd == -1)
189 retval = find_dt(fd, partial ? FIND_PARTIAL : 0, query, count, targetp,
192 (void) close(fd);
203 find_dt(int fd, uint_t flags, uint_t query, int count,
215 if (read_header(fd, &header) == -1)
218 if (fstat(fd, &st) == -1)
225 if (read_rec(fd, &rec, recoff) == -1) {
272 if (pnread(fd, recordp->dt_value, rec.rec_dtvalsize,
342 int fd, newfd;
353 fd = open(dtpath, O_RDWR);
354 if (fd == -1)
363 retval = find_dt(fd, 0, query, 1, addp, NULL, &found);
365 (void) close(fd);
369 (void) close(fd);
377 if (fstat(fd, &st) == -1) {
378 (void) close(fd);
390 retval = copy_range(fd, 0, newfd, 0, st.st_size);
411 (void) close(fd);
419 (void) close(fd);
430 int fd, newfd;
443 fd = open(dtpath, O_RDWR);
444 if (fd == -1)
456 retval = find_dt(fd, 0, query, 1, newp, NULL, &found);
458 (void) close(fd);
462 (void) close(fd);
470 retval = find_dt(fd, FIND_POSITION, query, 1, origp, &reclist, &found);
472 (void) close(fd);
476 (void) close(fd);
481 (void) close(fd);
496 if (fstat(fd, &st) == -1) {
497 (void) close(fd);
509 retval = copy_range(fd, 0, newfd, 0, recoff);
513 retval = copy_range(fd, recnext, newfd, recoff, st.st_size - recnext);
531 (void) close(fd);
539 (void) close(fd);
550 int fd, newfd;
562 fd = open(dtpath, O_RDWR);
563 if (fd == -1)
574 retval = find_dt(fd, FIND_POSITION, query, 1, delp, &reclist, &found);
576 (void) close(fd);
580 (void) close(fd);
585 (void) close(fd);
599 if (fstat(fd, &st) == -1) {
600 (void) close(fd);
612 retval = copy_range(fd, 0, newfd, 0, recoff);
616 retval = copy_range(fd, recnext, newfd, recoff, st.st_size - recnext);
623 (void) close(fd);
631 (void) close(fd);
718 * Read the dt_header_t in the container at open file `fd' into the header
723 read_header(int fd, dt_header_t *headerp)
725 if (pnread(fd, headerp, sizeof (dt_header_t), 0) == -1)
734 * file `fd'. Returns 0 on success, -1 on failure (errno is set).
737 write_header(int fd, dt_header_t *headerp)
742 retval = pnwrite(fd, headerp, sizeof (dt_header_t), 0);
750 * container at open file `fd'. Note that this only returns the fixed
755 read_rec(int fd, dt_filerec_t *rec, off_t recoff)
757 if (pnread(fd, rec, sizeof (dt_filerec_t), recoff) == -1)
766 * container at open file `fd'. Returns 0 on success, -1 on failure (errno
770 write_rec(int fd, dt_filerec_t *rec, off_t recoff)
776 retval = pnwrite(fd, rec, recsize, recoff);