Lines Matching +full:first +full:- +full:conversion +full:- +full:delay

1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
70 void (*cfunc)(void); /* conversion function */
73 uint64_t ddflags = 0; /* conversion options */
74 size_t cbsz; /* conversion block size */
76 const u_char *ctab; /* conversion table */
106 while (files_cnt--) in main()
116 if (close(out.fd) == -1 && errno != EINTR) in main()
149 if (in.fd == -1) in setup()
156 if (caph_rights_limit(in.fd, &rights) == -1) in setup()
160 errx(1, "files is not supported for non-tape devices"); in setup()
171 if (oflags == -1) in setup()
174 if (fcntl(out.fd, F_SETFL, oflags) == -1) in setup()
193 if (out.fd == -1) { in setup()
200 if (out.fd == -1) in setup()
206 if (caph_rights_limit(out.fd, &rights) == -1) in setup()
208 if (caph_ioctls_limit(out.fd, cmds, nitems(cmds)) == -1) in setup()
212 if (caph_limit_stdin() == -1) in setup()
217 if (caph_limit_stdout() == -1) in setup()
222 if (caph_limit_stderr() == -1) in setup()
231 if ((in.db = malloc((size_t)out.dbsz + in.dbsz - 1)) == NULL) in setup()
238 /* dbp is the first free position in each buffer. */ in setup()
254 if (ftruncate(out.fd, out.offset * out.dbsz) == -1) in setup()
282 * This should strictly speaking be a no-op, but I in setup()
316 if (fstat(io->fd, &sb) == -1) in getfdtype()
317 err(1, "%s", io->name); in getfdtype()
319 io->flags |= ISTRUNC; in getfdtype()
321 if (ioctl(io->fd, FIODTYPE, &type) == -1) { in getfdtype()
322 err(1, "%s", io->name); in getfdtype()
325 io->flags |= ISTAPE; in getfdtype()
327 io->flags |= ISSEEK; in getfdtype()
329 io->flags |= ISCHR; in getfdtype()
334 if (lseek(io->fd, (off_t)0, SEEK_CUR) == -1 && errno == ESPIPE) in getfdtype()
335 io->flags |= ISPIPE; in getfdtype()
337 io->flags |= ISSEEK; in getfdtype()
341 * Limit the speed by adding a delay before every block read.
342 * The delay (t_usleep) is equal to the time computed from block
353 t_io = t_now - t_prev - t_usleep; in speed_limit()
355 t_usleep = t_target - t_io; in speed_limit()
374 len -= 2; in swapbytes()
385 case -1: /* count=0 was specified */ in dd_in()
399 * Zero the buffer first if sync; if doing block operations, in dd_in()
414 n = read(in.fd, in.dbp + in.dbrcnt, in.dbsz - in.dbrcnt); in dd_in()
422 if (n == -1) { in dd_in()
435 * raw disks this section should be modified to re-read in dd_in()
480 --n; in dd_in()
510 memset(out.dbp, fill_char, out.dbsz - out.dbcnt); in dd_close()
512 memset(out.dbp, ' ', out.dbsz - out.dbcnt); in dd_close()
514 memset(out.dbp, 0, out.dbsz - out.dbcnt); in dd_close()
525 if (ftruncate(out.fd, out.seek_offset) == -1) in dd_close()
530 if (fsync(out.fd) == -1) in dd_close()
533 if (fdatasync(out.fd) == -1) in dd_close()
560 * One special case is if we're forced to do the write -- in that case in dd_out()
566 * If force, first try to write all pending data, else try to write in dd_out()
590 if (out.seek_offset == -1) in dd_out()
632 cnt -= nw; in dd_out()
635 if ((out.dbcnt -= n) < out.dbsz) in dd_out()
641 (void)memmove(out.db, out.dbp - out.dbcnt, out.dbcnt); in dd_out()