CVS commit: src/bin/dd
Module Name:src Committed By: mlelstv Date: Fri Jan 26 07:10:04 UTC 2024 Modified Files: src/bin/dd: args.c Log Message: Don't use the signal handler to terminate when nothing is to do (count=0, files=0). The signal handler tries to raise the signal again, so that a parent can retrieve the signal from the exit code. Calling the terminate handler with signal code 0 doesn't raise a signal and dd continues with exit(127) making this case an error. To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/bin/dd/args.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/dd
Module Name:src Committed By: mlelstv Date: Fri Jan 26 07:10:04 UTC 2024 Modified Files: src/bin/dd: args.c Log Message: Don't use the signal handler to terminate when nothing is to do (count=0, files=0). The signal handler tries to raise the signal again, so that a parent can retrieve the signal from the exit code. Calling the terminate handler with signal code 0 doesn't raise a signal and dd continues with exit(127) making this case an error. To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/bin/dd/args.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/args.c diff -u src/bin/dd/args.c:1.42 src/bin/dd/args.c:1.43 --- src/bin/dd/args.c:1.42 Fri Jan 14 23:55:16 2022 +++ src/bin/dd/args.c Fri Jan 26 07:10:04 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: args.c,v 1.42 2022/01/14 23:55:16 christos Exp $ */ +/* $NetBSD: args.c,v 1.43 2024/01/26 07:10:04 mlelstv Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)args.c 8.3 (Berkeley) 4/2/94"; #else -__RCSID("$NetBSD: args.c,v 1.42 2022/01/14 23:55:16 christos Exp $"); +__RCSID("$NetBSD: args.c,v 1.43 2024/01/26 07:10:04 mlelstv Exp $"); #endif #endif /* not lint */ @@ -248,8 +248,10 @@ f_count(char *arg) { cpy_cnt = strsuftoll("block count", arg, 0, LLONG_MAX); - if (!cpy_cnt) - terminate(0); + if (!cpy_cnt) { + summary(); + exit(0); + } } static void @@ -257,8 +259,10 @@ f_files(char *arg) { files_cnt = (u_int)strsuftoll("file count", arg, 0, UINT_MAX); - if (!files_cnt) - terminate(0); + if (!files_cnt) { + summary(); + exit(0); + } } static void
CVS commit: src/bin/dd
Module Name:src Committed By: christos Date: Fri Jan 14 23:56:35 UTC 2022 Modified Files: src/bin/dd: extern.h Log Message: update header too. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/bin/dd/extern.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/extern.h diff -u src/bin/dd/extern.h:1.24 src/bin/dd/extern.h:1.25 --- src/bin/dd/extern.h:1.24 Fri Oct 4 04:57:38 2019 +++ src/bin/dd/extern.h Fri Jan 14 18:56:35 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.24 2019/10/04 08:57:38 mrg Exp $ */ +/* $NetBSD: extern.h,v 1.25 2022/01/14 23:56:35 christos Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -81,7 +81,7 @@ extern uint64_t progress; extern const u_char *ctab; extern const u_char a2e_32V[], a2e_POSIX[]; extern const u_char e2a_32V[], e2a_POSIX[]; -extern const u_char a2ibm_32V[], a2ibm_POSIX[]; +extern const u_char a2ibm[]; extern u_char casetab[]; extern const char *msgfmt;
CVS commit: src/bin/dd
Module Name:src Committed By: christos Date: Fri Jan 14 23:56:35 UTC 2022 Modified Files: src/bin/dd: extern.h Log Message: update header too. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/bin/dd/extern.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/dd
Module Name:src Committed By: christos Date: Fri Jan 14 23:55:16 UTC 2022 Modified Files: src/bin/dd: args.c conv_tab.c dd.1 Log Message: The "ibm" and "oldibm" tables are identical, because POSIX just standardised the table from V7. Nobody, including the original authors, seems to have noticed this. Merge them and update the documentation. Also fix the odd, inconsistent, spelling of "pre-4.3BSD-Reno"). (From nabijaczleweli) To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/bin/dd/args.c cvs rdiff -u -r1.9 -r1.10 src/bin/dd/conv_tab.c cvs rdiff -u -r1.37 -r1.38 src/bin/dd/dd.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/args.c diff -u src/bin/dd/args.c:1.41 src/bin/dd/args.c:1.42 --- src/bin/dd/args.c:1.41 Sat Oct 9 17:31:36 2021 +++ src/bin/dd/args.c Fri Jan 14 18:55:16 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: args.c,v 1.41 2021/10/09 21:31:36 rillig Exp $ */ +/* $NetBSD: args.c,v 1.42 2022/01/14 23:55:16 christos Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)args.c 8.3 (Berkeley) 4/2/94"; #else -__RCSID("$NetBSD: args.c,v 1.41 2021/10/09 21:31:36 rillig Exp $"); +__RCSID("$NetBSD: args.c,v 1.42 2022/01/14 23:55:16 christos Exp $"); #endif #endif /* not lint */ @@ -355,13 +355,13 @@ static const struct conv { { "ascii", C_ASCII, C_EBCDIC, e2a_POSIX }, { "block", C_BLOCK, C_UNBLOCK, NULL }, { "ebcdic", C_EBCDIC, C_ASCII, a2e_POSIX }, - { "ibm", C_EBCDIC, C_ASCII, a2ibm_POSIX }, + { "ibm", C_EBCDIC, C_ASCII, a2ibm }, { "lcase", C_LCASE, C_UCASE, NULL }, { "noerror", C_NOERROR, 0, NULL }, { "notrunc", C_NOTRUNC, 0, NULL }, { "oldascii", C_ASCII, C_EBCDIC, e2a_32V }, { "oldebcdic", C_EBCDIC, C_ASCII, a2e_32V }, - { "oldibm", C_EBCDIC, C_ASCII, a2ibm_32V }, + { "oldibm", C_EBCDIC, C_ASCII, a2ibm }, { "osync", C_OSYNC, C_BS, NULL }, { "sparse", C_SPARSE, 0, NULL }, { "swab", C_SWAB, 0, NULL }, Index: src/bin/dd/conv_tab.c diff -u src/bin/dd/conv_tab.c:1.9 src/bin/dd/conv_tab.c:1.10 --- src/bin/dd/conv_tab.c:1.9 Thu Aug 7 05:05:10 2003 +++ src/bin/dd/conv_tab.c Fri Jan 14 18:55:16 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: conv_tab.c,v 1.9 2003/08/07 09:05:10 agc Exp $ */ +/* $NetBSD: conv_tab.c,v 1.10 2022/01/14 23:55:16 christos Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)conv_tab.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: conv_tab.c,v 1.9 2003/08/07 09:05:10 agc Exp $"); +__RCSID("$NetBSD: conv_tab.c,v 1.10 2022/01/14 23:55:16 christos Exp $"); #endif #endif /* not lint */ @@ -142,42 +142,6 @@ const u_char a2e_32V[] = { 0356, 0357, 0372, 0373, 0374, 0375, 0376, 0377, /* 0370 */ }; -/* ASCII to IBM EBCDIC -- 32V compatible. */ -const u_char a2ibm_32V[] = { - , 0001, 0002, 0003, 0067, 0055, 0056, 0057, /* */ - 0026, 0005, 0045, 0013, 0014, 0015, 0016, 0017, /* 0010 */ - 0020, 0021, 0022, 0023, 0074, 0075, 0062, 0046, /* 0020 */ - 0030, 0031, 0077, 0047, 0034, 0035, 0036, 0037, /* 0030 */ - 0100, 0132, 0177, 0173, 0133, 0154, 0120, 0175, /* 0040 */ - 0115, 0135, 0134, 0116, 0153, 0140, 0113, 0141, /* 0050 */ - 0360, 0361, 0362, 0363, 0364, 0365, 0366, 0367, /* 0060 */ - 0370, 0371, 0172, 0136, 0114, 0176, 0156, 0157, /* 0070 */ - 0174, 0301, 0302, 0303, 0304, 0305, 0306, 0307, /* 0100 */ - 0310, 0311, 0321, 0322, 0323, 0324, 0325, 0326, /* 0110 */ - 0327, 0330, 0331, 0342, 0343, 0344, 0345, 0346, /* 0120 */ - 0347, 0350, 0351, 0255, 0340, 0275, 0137, 0155, /* 0130 */ - 0171, 0201, 0202, 0203, 0204, 0205, 0206, 0207, /* 0140 */ - 0210, 0211, 0221, 0222, 0223, 0224, 0225, 0226, /* 0150 */ - 0227, 0230, 0231, 0242, 0243, 0244, 0245, 0246, /* 0160 */ - 0247, 0250, 0251, 0300, 0117, 0320, 0241, 0007, /* 0170 */ - 0040, 0041, 0042, 0043, 0044, 0025, 0006, 0027, /* 0200 */ - 0050, 0051, 0052, 0053, 0054, 0011, 0012, 0033, /* 0210 */ - 0060, 0061, 0032, 0063, 0064, 0065, 0066, 0010, /* 0220 */ - 0070, 0071, 0072, 0073, 0004, 0024, 0076, 0341, /* 0230 */ - 0101, 0102, 0103, 0104, 0105, 0106, 0107, 0110, /* 0240 */ - 0111, 0121, 0122, 0123, 0124, 0125, 0126, 0127, /* 0250 */ - 0130, 0131, 0142, 0143, 0144, 0145, 0146, 0147, /* 0260 */ - 0150, 0151, 0160, 0161, 0162, 0163, 0164, 0165, /* 0270 */ - 0166, 0167, 0170, 0200, 0212, 0213, 0214, 0215, /* 0300 */ - 0216, 0217, 0220, 0232, 0233, 0234, 0235, 0236, /* 0310 */ - 0237, 0240, 0252, 0253, 0254, 0255, 0256, 0257, /* 0320 */ - 0260, 0261, 0262, 0263, 0264, 0265, 0266, 0267, /* 0330 */ - 0270, 0271, 0272, 0273, 0274, 0275, 0276, 0277, /* 0340 */ - 0312, 0313, 0314, 0315, 0316, 0317, 0332, 0333, /* 0350 */ - 0334, 0335, 0336, 0337, 0352, 0353, 0354, 0355, /* 0360 */ - 0356, 0357, 0372, 0373, 0374, 0375, 0376, 0377, /* 0370 */ -}; - /* EBCDIC to ASCII -- POSIX and System V compatible. */ const u_char e2a_POSIX[] = { , 0001, 0002,
CVS commit: src/bin/dd
Module Name:src Committed By: christos Date: Fri Jan 14 23:55:16 UTC 2022 Modified Files: src/bin/dd: args.c conv_tab.c dd.1 Log Message: The "ibm" and "oldibm" tables are identical, because POSIX just standardised the table from V7. Nobody, including the original authors, seems to have noticed this. Merge them and update the documentation. Also fix the odd, inconsistent, spelling of "pre-4.3BSD-Reno"). (From nabijaczleweli) To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/bin/dd/args.c cvs rdiff -u -r1.9 -r1.10 src/bin/dd/conv_tab.c cvs rdiff -u -r1.37 -r1.38 src/bin/dd/dd.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/dd
Module Name:src Committed By: rillig Date: Sat Oct 9 21:31:36 UTC 2021 Modified Files: src/bin/dd: args.c Log Message: dd: fix lint warnings about effectively discarding 'const' args.c(153): warning: call to 'bsearch' effectively discards 'const' from argument [346] args.c(383): dito args.c(475): dito No functional change. To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/bin/dd/args.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/args.c diff -u src/bin/dd/args.c:1.40 src/bin/dd/args.c:1.41 --- src/bin/dd/args.c:1.40 Wed Jan 30 01:40:02 2019 +++ src/bin/dd/args.c Sat Oct 9 21:31:36 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: args.c,v 1.40 2019/01/30 01:40:02 mrg Exp $ */ +/* $NetBSD: args.c,v 1.41 2021/10/09 21:31:36 rillig Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)args.c 8.3 (Berkeley) 4/2/94"; #else -__RCSID("$NetBSD: args.c,v 1.40 2019/01/30 01:40:02 mrg Exp $"); +__RCSID("$NetBSD: args.c,v 1.41 2021/10/09 21:31:36 rillig Exp $"); #endif #endif /* not lint */ @@ -127,7 +127,8 @@ static const struct arg { void jcl(char **argv) { - struct arg *ap, tmp; + const struct arg *ap; + struct arg tmp; char *oper, *arg; in.dbsz = out.dbsz = 512; @@ -375,7 +376,8 @@ static const struct conv { static void f_conv(char *arg) { - struct conv *cp, tmp; + const struct conv *cp; + struct conv tmp; while (arg != NULL) { tmp.name = strsep(, ","); @@ -466,7 +468,8 @@ static u_int f_ioflag(char *arg, u_int flagtype) { u_int ioflag = 0; - struct ioflag *cp, tmp; + const struct ioflag *cp; + struct ioflag tmp; const char *flagstr = (flagtype == C_IFLAG) ? "iflag" : "oflag"; while (arg != NULL) {
CVS commit: src/bin/dd
Module Name:src Committed By: rillig Date: Sat Oct 9 21:31:36 UTC 2021 Modified Files: src/bin/dd: args.c Log Message: dd: fix lint warnings about effectively discarding 'const' args.c(153): warning: call to 'bsearch' effectively discards 'const' from argument [346] args.c(383): dito args.c(475): dito No functional change. To generate a diff of this commit: cvs rdiff -u -r1.40 -r1.41 src/bin/dd/args.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/dd
Module Name:src Committed By: rillig Date: Sat Oct 9 20:44:55 UTC 2021 Modified Files: src/bin/dd: misc.c Log Message: dd: clean up function summary No functional change. Ideally the binary would have stayed the same, but GCC 10.3.0 inserts a nop and reorders the code. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/bin/dd/misc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/misc.c diff -u src/bin/dd/misc.c:1.25 src/bin/dd/misc.c:1.26 --- src/bin/dd/misc.c:1.25 Sat Oct 9 20:29:23 2021 +++ src/bin/dd/misc.c Sat Oct 9 20:44:55 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: misc.c,v 1.25 2021/10/09 20:29:23 rillig Exp $ */ +/* $NetBSD: misc.c,v 1.26 2021/10/09 20:44:55 rillig Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)misc.c 8.3 (Berkeley) 4/2/94"; #else -__RCSID("$NetBSD: misc.c,v 1.25 2021/10/09 20:29:23 rillig Exp $"); +__RCSID("$NetBSD: misc.c,v 1.26 2021/10/09 20:44:55 rillig Exp $"); #endif #endif /* not lint */ @@ -78,13 +78,11 @@ summary(void) #ifdef NO_MSGFMT posix_summary(); #else /* NO_MSGFMT */ - if (strcmp(msgfmt, "human") == 0) { + if (strcmp(msgfmt, "human") == 0) human_summary(); - return; - } else if (strcmp(msgfmt, "posix") == 0) { + else if (strcmp(msgfmt, "posix") == 0) posix_summary(); - return; - } else if (strcmp(msgfmt, "quiet") == 0) + else if (strcmp(msgfmt, "quiet") == 0) quiet_summary(); else custom_summary();
CVS commit: src/bin/dd
Module Name:src Committed By: rillig Date: Sat Oct 9 20:44:55 UTC 2021 Modified Files: src/bin/dd: misc.c Log Message: dd: clean up function summary No functional change. Ideally the binary would have stayed the same, but GCC 10.3.0 inserts a nop and reorders the code. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/bin/dd/misc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/dd
Module Name:src Committed By: rillig Date: Sat Oct 9 20:29:23 UTC 2021 Modified Files: src/bin/dd: misc.c Log Message: dd: fix lint error about 'return expr' from void function No change to the resulting binary. The 'return' statements are necessary for GCC to generate the exact same object code, even though they can be removed without affecting the functionality, as seen before the 'else'. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/bin/dd/misc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/misc.c diff -u src/bin/dd/misc.c:1.24 src/bin/dd/misc.c:1.25 --- src/bin/dd/misc.c:1.24 Fri Sep 10 22:11:03 2021 +++ src/bin/dd/misc.c Sat Oct 9 20:29:23 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: misc.c,v 1.24 2021/09/10 22:11:03 rillig Exp $ */ +/* $NetBSD: misc.c,v 1.25 2021/10/09 20:29:23 rillig Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)misc.c 8.3 (Berkeley) 4/2/94"; #else -__RCSID("$NetBSD: misc.c,v 1.24 2021/09/10 22:11:03 rillig Exp $"); +__RCSID("$NetBSD: misc.c,v 1.25 2021/10/09 20:29:23 rillig Exp $"); #endif #endif /* not lint */ @@ -76,18 +76,18 @@ summary(void) (void)write(STDERR_FILENO, "\n", 1); #ifdef NO_MSGFMT - return posix_summary(); + posix_summary(); #else /* NO_MSGFMT */ - if (strncmp(msgfmt, "human", sizeof("human")) == 0) - return human_summary(); - - if (strncmp(msgfmt, "posix", sizeof("posix")) == 0) - return posix_summary(); - - if (strncmp(msgfmt, "quiet", sizeof("quiet")) == 0) - return quiet_summary(); - - return custom_summary(); + if (strcmp(msgfmt, "human") == 0) { + human_summary(); + return; + } else if (strcmp(msgfmt, "posix") == 0) { + posix_summary(); + return; + } else if (strcmp(msgfmt, "quiet") == 0) + quiet_summary(); + else + custom_summary(); #endif /* NO_MSGFMT */ }
CVS commit: src/bin/dd
Module Name:src Committed By: rillig Date: Sat Oct 9 20:29:23 UTC 2021 Modified Files: src/bin/dd: misc.c Log Message: dd: fix lint error about 'return expr' from void function No change to the resulting binary. The 'return' statements are necessary for GCC to generate the exact same object code, even though they can be removed without affecting the functionality, as seen before the 'else'. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/bin/dd/misc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/dd
Module Name:src Committed By: christos Date: Fri Oct 8 14:44:49 UTC 2021 Modified Files: src/bin/dd: dd_swab.c Log Message: PR/56443: RVP: dd conv=swab doesn't always work To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/bin/dd/dd_swab.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/dd_swab.c diff -u src/bin/dd/dd_swab.c:1.1 src/bin/dd/dd_swab.c:1.2 --- src/bin/dd/dd_swab.c:1.1 Fri Oct 4 04:57:38 2019 +++ src/bin/dd/dd_swab.c Fri Oct 8 10:44:48 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dd_swab.c,v 1.1 2019/10/04 08:57:38 mrg Exp $ */ +/* $NetBSD: dd_swab.c,v 1.2 2021/10/08 14:44:48 christos Exp $ */ /* * Copyright (c) 1988, 1993 @@ -41,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)swab.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: dd_swab.c,v 1.1 2019/10/04 08:57:38 mrg Exp $"); +__RCSID("$NetBSD: dd_swab.c,v 1.2 2021/10/08 14:44:48 christos Exp $"); #endif #endif /* LIBC_SCCS and not lint */ @@ -71,7 +71,7 @@ dd_swab(const void * from, void * to, ss } /* round to multiple of 8 */ - while ((--len % 8) != 0) + for (; (len % 8) != 0; --len) STEP; len /= 8; if (len == 0)
CVS commit: src/bin/dd
Module Name:src Committed By: christos Date: Fri Oct 8 14:44:49 UTC 2021 Modified Files: src/bin/dd: dd_swab.c Log Message: PR/56443: RVP: dd conv=swab doesn't always work To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/bin/dd/dd_swab.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/dd
Module Name:src Committed By: nia Date: Tue May 18 07:17:09 UTC 2021 Modified Files: src/bin/dd: dd.1 Log Message: dd.1: add an example of writing a NetBSD image To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/bin/dd/dd.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/dd.1 diff -u src/bin/dd/dd.1:1.36 src/bin/dd/dd.1:1.37 --- src/bin/dd/dd.1:1.36 Wed Jan 30 10:28:50 2019 +++ src/bin/dd/dd.1 Tue May 18 07:17:09 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: dd.1,v 1.36 2019/01/30 10:28:50 wiz Exp $ +.\" $NetBSD: dd.1,v 1.37 2021/05/18 07:17:09 nia Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -32,7 +32,7 @@ .\" .\" @(#)dd.1 8.2 (Berkeley) 1/13/94 .\" -.Dd January 29, 2019 +.Dd May 18, 2021 .Dt DD 1 .Os .Sh NAME @@ -546,6 +546,18 @@ for more details. .Sh EXIT STATUS .Ex -std dd .Sh EXAMPLES +To write a +.Xr gzip 1 +compressed +.Nx +image to a removable drive, with +.Xr progress 1 +output: +.Bd -literal -unfilled -offset indent +zcat NetBSD-9.2-amd64-install.img.gz | \\ +progress dd of=/dev/rsd0 bs=1m +.Ed +.Pp To print summary information in human-readable form: .Pp .Dl dd if=/dev/zero of=/dev/null count=1 msgfmt=human
CVS commit: src/bin/dd
Module Name:src Committed By: nia Date: Tue May 18 07:17:09 UTC 2021 Modified Files: src/bin/dd: dd.1 Log Message: dd.1: add an example of writing a NetBSD image To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/bin/dd/dd.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/dd
Module Name:src Committed By: mrg Date: Fri Oct 4 08:57:38 UTC 2019 Modified Files: src/bin/dd: Makefile dd.c extern.h Added Files: src/bin/dd: dd_swab.c Log Message: copy libc's swab.c into dd as dd_swab(), and remove the restrict. our implementation was fine, but the restrict marker is problematic as gcc 8 is now more strict about checking for restrict issues. this is the only actual consumer of swab(3) in our tree, though, besides the test for it. oh well. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/bin/dd/Makefile cvs rdiff -u -r1.52 -r1.53 src/bin/dd/dd.c cvs rdiff -u -r0 -r1.1 src/bin/dd/dd_swab.c cvs rdiff -u -r1.23 -r1.24 src/bin/dd/extern.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/dd
Module Name:src Committed By: kamil Date: Sun Sep 15 23:58:31 UTC 2019 Modified Files: src/bin/dd: Makefile Log Message: Drop -D_INCOMPLETE_XOPEN_C063 from dd(1) To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/bin/dd/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/dd
Module Name:src Committed By: kamil Date: Sun Sep 15 23:58:31 UTC 2019 Modified Files: src/bin/dd: Makefile Log Message: Drop -D_INCOMPLETE_XOPEN_C063 from dd(1) To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/bin/dd/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/Makefile diff -u src/bin/dd/Makefile:1.18 src/bin/dd/Makefile:1.19 --- src/bin/dd/Makefile:1.18 Wed Mar 18 13:23:49 2015 +++ src/bin/dd/Makefile Sun Sep 15 23:58:31 2019 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.18 2015/03/18 13:23:49 manu Exp $ +# $NetBSD: Makefile,v 1.19 2019/09/15 23:58:31 kamil Exp $ # @(#)Makefile 8.1 (Berkeley) 5/31/93 .include @@ -12,7 +12,7 @@ LDADD+= -lutil .ifdef SMALLPROG CPPFLAGS+= -DNO_CONV -DNO_MSGFMT -DNO_IOFLAG -DSMALL .else -CPPFLAGS+= -D_NETBSD_SOURCE -D_INCOMPLETE_XOPEN_C063 +CPPFLAGS+= -D_NETBSD_SOURCE SRCS+= conv_tab.c .ifdef CRUNCHEDPROG CPPFLAGS+= -DSMALL
CVS commit: src/bin/dd
Module Name:src Committed By: mlelstv Date: Sat Mar 23 09:33:16 UTC 2019 Modified Files: src/bin/dd: dd.c Log Message: When buffers are at least page sized, explicitely request page alignment. To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/bin/dd/dd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/dd
Module Name:src Committed By: mlelstv Date: Sat Mar 23 09:33:16 UTC 2019 Modified Files: src/bin/dd: dd.c Log Message: When buffers are at least page sized, explicitely request page alignment. To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/bin/dd/dd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/dd.c diff -u src/bin/dd/dd.c:1.51 src/bin/dd/dd.c:1.52 --- src/bin/dd/dd.c:1.51 Mon Sep 5 01:00:07 2016 +++ src/bin/dd/dd.c Sat Mar 23 09:33:16 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: dd.c,v 1.51 2016/09/05 01:00:07 sevan Exp $ */ +/* $NetBSD: dd.c,v 1.52 2019/03/23 09:33:16 mlelstv Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 19 #if 0 static char sccsid[] = "@(#)dd.c 8.5 (Berkeley) 4/2/94"; #else -__RCSID("$NetBSD: dd.c,v 1.51 2016/09/05 01:00:07 sevan Exp $"); +__RCSID("$NetBSD: dd.c,v 1.52 2019/03/23 09:33:16 mlelstv Exp $"); #endif #endif /* not lint */ @@ -72,6 +72,7 @@ static void dd_in(void); static void getfdtype(IO *); static void redup_clean_fd(IO *); static void setup(void); +static void *buffer_alloc(size_t); IO in, out; /* input/output state */ STAT st; /* statistics */ @@ -150,6 +151,20 @@ main(int argc, char *argv[]) /* NOTREACHED */ } +static void * +buffer_alloc(size_t sz) +{ + size_t align = getpagesize(); + void *res; + + if (sz < align) + res = malloc(sz); + else if (posix_memalign(, align, sz) != 0) + res = NULL; + + return res; +} + static void setup(void) { @@ -233,14 +248,14 @@ setup(void) size_t dbsz = out.dbsz; if (!(ddflags & C_BS)) dbsz += in.dbsz - 1; - if ((in.db = malloc(dbsz)) == NULL) { + if ((in.db = buffer_alloc(dbsz)) == NULL) { err(EXIT_FAILURE, NULL); /* NOTREACHED */ } out.db = in.db; } else if ((in.db = - malloc((u_int)(MAX(in.dbsz, cbsz) + cbsz))) == NULL || - (out.db = malloc((u_int)(out.dbsz + cbsz))) == NULL) { + buffer_alloc((u_int)(MAX(in.dbsz, cbsz) + cbsz))) == NULL || + (out.db = buffer_alloc((u_int)(out.dbsz + cbsz))) == NULL) { err(EXIT_FAILURE, NULL); /* NOTREACHED */ }
CVS commit: src/bin/dd
Module Name:src Committed By: wiz Date: Wed Jan 30 10:28:50 UTC 2019 Modified Files: src/bin/dd: dd.1 Log Message: Fix typos; use American spelling consistently. Remove an unnecessary macro. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/bin/dd/dd.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/dd.1 diff -u src/bin/dd/dd.1:1.35 src/bin/dd/dd.1:1.36 --- src/bin/dd/dd.1:1.35 Wed Jan 30 01:40:02 2019 +++ src/bin/dd/dd.1 Wed Jan 30 10:28:50 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: dd.1,v 1.35 2019/01/30 01:40:02 mrg Exp $ +.\" $NetBSD: dd.1,v 1.36 2019/01/30 10:28:50 wiz Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -484,13 +484,13 @@ Use Alternative I/O. .It Cm async Use .Dv SIGIO -signalling for I/O. +signaling for I/O. .It Cm cloexec Set the close-on-exec flag. .It Cm direct Directly access the data, skipping any caches. .It Cm directory -Not avaiable for +Not available for .Nm . .It Cm exlock Atomically obtain an exclusive lock. @@ -508,7 +508,7 @@ instead of raising .It Cm shlock Atomically obtain a shared lock. .It Cm sync -All I/O will be performed with full synchronisation. +All I/O will be performed with full synchronization. .El .Pp The flags that apply to only input are: @@ -518,7 +518,7 @@ Set the read-only flag. .It Cm rdwr Set the read and write flags. .It Cm rsync -Enable read synchronisation, if the +Enable read synchronization, if the .Cm sync option is also set. .El @@ -530,14 +530,13 @@ Append to the output by default. .It Cm creat Create the output file. .It Cm dsync -Wait for all data to be syncronously written. +Wait for all data to be synchronously written. .It Cm excl Ensure that output is to a new file. .It Cm trunc Truncate the output file before writing. .It Cm wronly Set the write-only flag. -.Pp .El See .Xr open 2
CVS commit: src/bin/dd
Module Name:src Committed By: wiz Date: Wed Jan 30 10:28:50 UTC 2019 Modified Files: src/bin/dd: dd.1 Log Message: Fix typos; use American spelling consistently. Remove an unnecessary macro. To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/bin/dd/dd.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/dd
Module Name:src Committed By: mrg Date: Wed Jan 30 01:40:02 UTC 2019 Modified Files: src/bin/dd: args.c dd.1 Log Message: adjust the open flags available for dd to match actual reality of what matters. remove "search" for now, since O_SEARCH has no backend. document them all. To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/bin/dd/args.c cvs rdiff -u -r1.34 -r1.35 src/bin/dd/dd.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/args.c diff -u src/bin/dd/args.c:1.39 src/bin/dd/args.c:1.40 --- src/bin/dd/args.c:1.39 Wed Mar 18 13:23:49 2015 +++ src/bin/dd/args.c Wed Jan 30 01:40:02 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: args.c,v 1.39 2015/03/18 13:23:49 manu Exp $ */ +/* $NetBSD: args.c,v 1.40 2019/01/30 01:40:02 mrg Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)args.c 8.3 (Berkeley) 4/2/94"; #else -__RCSID("$NetBSD: args.c,v 1.39 2015/03/18 13:23:49 manu Exp $"); +__RCSID("$NetBSD: args.c,v 1.40 2019/01/30 01:40:02 mrg Exp $"); #endif #endif /* not lint */ @@ -447,7 +447,7 @@ static const struct ioflag { { "direct", O_DIRECT, C_IFLAG|C_OFLAG }, { "directory", O_DIRECTORY, C_NONE }, { "dsync", O_DSYNC, C_OFLAG }, - { "excl", O_EXCL, C_IFLAG|C_OFLAG }, + { "excl", O_EXCL, C_OFLAG }, { "exlock", O_EXLOCK, C_IFLAG|C_OFLAG }, { "noctty", O_NOCTTY, C_IFLAG|C_OFLAG }, { "nofollow", O_NOFOLLOW, C_IFLAG|C_OFLAG }, @@ -456,11 +456,10 @@ static const struct ioflag { { "rdonly", O_RDONLY, C_IFLAG }, { "rdwr", O_RDWR, C_IFLAG }, { "rsync", O_RSYNC, C_IFLAG }, - { "search", O_SEARCH, C_IFLAG|C_OFLAG }, { "shlock", O_SHLOCK, C_IFLAG|C_OFLAG }, { "sync", O_SYNC, C_IFLAG|C_OFLAG }, - { "trunc", O_TRUNC, C_IFLAG|C_OFLAG }, - { "wronly", O_WRONLY, C_NONE }, + { "trunc", O_TRUNC, C_OFLAG }, + { "wronly", O_WRONLY, C_OFLAG }, }; static u_int Index: src/bin/dd/dd.1 diff -u src/bin/dd/dd.1:1.34 src/bin/dd/dd.1:1.35 --- src/bin/dd/dd.1:1.34 Tue Jul 4 06:48:15 2017 +++ src/bin/dd/dd.1 Wed Jan 30 01:40:02 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: dd.1,v 1.34 2017/07/04 06:48:15 wiz Exp $ +.\" $NetBSD: dd.1,v 1.35 2019/01/30 01:40:02 mrg Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -32,7 +32,7 @@ .\" .\" @(#)dd.1 8.2 (Berkeley) 1/13/94 .\" -.Dd August 18, 2016 +.Dd January 29, 2019 .Dt DD 1 .Os .Sh NAME @@ -97,13 +97,9 @@ Use comma-separated when calling .Xr open 2 for the input file. -The possible values are -.Va O_ -flags documented in -.Xr open 2 , -specified as lowercase and with the leading -.Va O_ -removed. +See the +.Sx INPUT AND OUTPUT FLAGS +section for details. Default value is .Va rdonly . .It Cm iseek= Ns Ar n @@ -203,9 +199,9 @@ but for the call to on the output file. The default value is .Va creat , -which should be explicitly added in +which must be explicitly added in .Cm oflag -in order to output to a nonexistent file. +if this option is used in order to output to a nonexistent file. The default or specified value is or'ed with .Va rdwr for a first @@ -220,7 +216,10 @@ is automatically added if none of .Cm seek , or .Cm conv=notrunc -operands are used, +operands are used. +See the +.Sx INPUT AND OUTPUT FLAGS +section for details. .It Cm oseek= Ns Ar n Seek on the output file .Ar n @@ -475,6 +474,76 @@ be written to the standard error output in the same format as the standard completion message and .Nm will exit. +.Sh INPUT AND OUTPUT FLAGS +There are flags valid for input only, for output only, or for either. +.Pp +The flags that apply to both input and output are: +.Bl -tag -width directory +.It Cm alt_io +Use Alternative I/O. +.It Cm async +Use +.Dv SIGIO +signalling for I/O. +.It Cm cloexec +Set the close-on-exec flag. +.It Cm direct +Directly access the data, skipping any caches. +.It Cm directory +Not avaiable for +.Nm . +.It Cm exlock +Atomically obtain an exclusive lock. +.It Cm noctty +Do not consider the file as a potential controlling tty. +.It Cm nofollow +Do not follow symbolic links. +.It Cm nonblock +Do not block on open or I/O requests. +.It Cm nosigpipe +Return +.Er EPIPE +instead of raising +.Dv SIGPIPE . +.It Cm shlock +Atomically obtain a shared lock. +.It Cm sync +All I/O will be performed with full synchronisation. +.El +.Pp +The flags that apply to only input are: +.Bl -tag -width directory +.It Cm rdonly +Set the read-only flag. +.It Cm rdwr +Set the read and write flags. +.It Cm rsync +Enable read synchronisation, if the +.Cm sync +option is also set. +.El +.Pp +The flags that apply to only output are: +.Bl -tag -width directory +.It Cm append +Append to the output by default. +.It Cm creat +Create the output file. +.It Cm dsync +Wait for all data to be syncronously written. +.It Cm excl +Ensure that output is to a new file. +.It Cm trunc +Truncate the output
CVS commit: src/bin/dd
Module Name:src Committed By: mrg Date: Wed Jan 30 01:40:02 UTC 2019 Modified Files: src/bin/dd: args.c dd.1 Log Message: adjust the open flags available for dd to match actual reality of what matters. remove "search" for now, since O_SEARCH has no backend. document them all. To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/bin/dd/args.c cvs rdiff -u -r1.34 -r1.35 src/bin/dd/dd.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/dd
Module Name:src Committed By: wiz Date: Tue Jul 4 06:48:15 UTC 2017 Modified Files: src/bin/dd: dd.1 Log Message: Use Ex. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/bin/dd/dd.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/dd.1 diff -u src/bin/dd/dd.1:1.33 src/bin/dd/dd.1:1.34 --- src/bin/dd/dd.1:1.33 Mon Jul 3 21:33:22 2017 +++ src/bin/dd/dd.1 Tue Jul 4 06:48:15 2017 @@ -1,4 +1,4 @@ -.\" $NetBSD: dd.1,v 1.33 2017/07/03 21:33:22 wiz Exp $ +.\" $NetBSD: dd.1,v 1.34 2017/07/04 06:48:15 wiz Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -476,9 +476,7 @@ in the same format as the standard compl .Nm will exit. .Sh EXIT STATUS -The -.Nm -utility exits 0 on success and >0 if an error occurred. +.Ex -std dd .Sh EXAMPLES To print summary information in human-readable form: .Pp
CVS commit: src/bin/dd
Module Name:src Committed By: wiz Date: Tue Jul 4 06:48:15 UTC 2017 Modified Files: src/bin/dd: dd.1 Log Message: Use Ex. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/bin/dd/dd.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/dd
Module Name:src Committed By: sevan Date: Thu Aug 18 22:43:49 UTC 2016 Modified Files: src/bin/dd: dd.1 Log Message: bump date To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/bin/dd/dd.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/dd
Module Name:src Committed By: sevan Date: Thu Aug 18 22:43:49 UTC 2016 Modified Files: src/bin/dd: dd.1 Log Message: bump date To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/bin/dd/dd.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/dd.1 diff -u src/bin/dd/dd.1:1.31 src/bin/dd/dd.1:1.32 --- src/bin/dd/dd.1:1.31 Thu Aug 18 22:42:28 2016 +++ src/bin/dd/dd.1 Thu Aug 18 22:43:49 2016 @@ -1,4 +1,4 @@ -.\" $NetBSD: dd.1,v 1.31 2016/08/18 22:42:28 sevan Exp $ +.\" $NetBSD: dd.1,v 1.32 2016/08/18 22:43:49 sevan Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -32,7 +32,7 @@ .\" .\" @(#)dd.1 8.2 (Berkeley) 1/13/94 .\" -.Dd August 11, 2016 +.Dd August 18, 2016 .Dt DD 1 .Os .Sh NAME
CVS commit: src/bin/dd
Module Name:src Committed By: sevan Date: Thu Aug 18 22:42:28 UTC 2016 Modified Files: src/bin/dd: dd.1 Log Message: dd first appeared in V5, not V1 Heads up by Ingo Schwarze http://www.tuhs.org/cgi-bin/utree.pl?file=V5/usr/source/s1/dd.c To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/bin/dd/dd.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/dd.1 diff -u src/bin/dd/dd.1:1.30 src/bin/dd/dd.1:1.31 --- src/bin/dd/dd.1:1.30 Thu Aug 11 01:23:03 2016 +++ src/bin/dd/dd.1 Thu Aug 18 22:42:28 2016 @@ -1,4 +1,4 @@ -.\" $NetBSD: dd.1,v 1.30 2016/08/11 01:23:03 sevan Exp $ +.\" $NetBSD: dd.1,v 1.31 2016/08/18 22:42:28 sevan Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -519,4 +519,4 @@ standard. A .Nm utility appeared in -.At v1 . +.At v5 .
CVS commit: src/bin/dd
Module Name:src Committed By: sevan Date: Thu Aug 18 22:42:28 UTC 2016 Modified Files: src/bin/dd: dd.1 Log Message: dd first appeared in V5, not V1 Heads up by Ingo Schwarze http://www.tuhs.org/cgi-bin/utree.pl?file=V5/usr/source/s1/dd.c To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/bin/dd/dd.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/dd
Module Name:src Committed By: sevan Date: Thu Aug 11 01:23:03 UTC 2016 Modified Files: src/bin/dd: dd.1 Log Message: Document the version dd first appeared. Bump date. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/bin/dd/dd.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/dd
Module Name:src Committed By: sevan Date: Thu Aug 11 01:23:03 UTC 2016 Modified Files: src/bin/dd: dd.1 Log Message: Document the version dd first appeared. Bump date. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/bin/dd/dd.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/dd.1 diff -u src/bin/dd/dd.1:1.29 src/bin/dd/dd.1:1.30 --- src/bin/dd/dd.1:1.29 Thu Aug 11 01:20:51 2016 +++ src/bin/dd/dd.1 Thu Aug 11 01:23:03 2016 @@ -1,4 +1,4 @@ -.\" $NetBSD: dd.1,v 1.29 2016/08/11 01:20:51 sevan Exp $ +.\" $NetBSD: dd.1,v 1.30 2016/08/11 01:23:03 sevan Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -32,7 +32,7 @@ .\" .\" @(#)dd.1 8.2 (Berkeley) 1/13/94 .\" -.Dd March 18, 2015 +.Dd August 11, 2016 .Dt DD 1 .Os .Sh NAME @@ -515,3 +515,8 @@ and values are extensions to the .Tn POSIX standard. +.Sh HISTORY +A +.Nm +utility appeared in +.At v1 .
CVS commit: src/bin/dd
Module Name:src Committed By: sevan Date: Thu Aug 11 01:20:51 UTC 2016 Modified Files: src/bin/dd: dd.1 Log Message: Pp not required before Bd, picked up by mandoc lint To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/bin/dd/dd.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/dd.1 diff -u src/bin/dd/dd.1:1.28 src/bin/dd/dd.1:1.29 --- src/bin/dd/dd.1:1.28 Thu Aug 11 01:14:01 2016 +++ src/bin/dd/dd.1 Thu Aug 11 01:20:51 2016 @@ -1,4 +1,4 @@ -.\" $NetBSD: dd.1,v 1.28 2016/08/11 01:14:01 sevan Exp $ +.\" $NetBSD: dd.1,v 1.29 2016/08/11 01:20:51 sevan Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -486,7 +486,6 @@ To print summary information in human-re .Pp To customize the information summary output and print it through .Xr unvis 3 : -.Pp .Bd -literal -offset indent dd if=/dev/zero of=/dev/null count=1 \e msgfmt='speed:%E, in %s seconds\en' 2\*[Gt]\*[Am]1 | unvis
CVS commit: src/bin/dd
Module Name:src Committed By: sevan Date: Thu Aug 11 01:20:51 UTC 2016 Modified Files: src/bin/dd: dd.1 Log Message: Pp not required before Bd, picked up by mandoc lint To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/bin/dd/dd.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/dd
Module Name:src Committed By: sevan Date: Thu Aug 11 01:14:01 UTC 2016 Modified Files: src/bin/dd: dd.1 Log Message: The macro to cross-reference is Xr, not Xt. Fix typo error picked up by mandoc lint. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/bin/dd/dd.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/dd
Module Name:src Committed By: sevan Date: Thu Aug 11 01:14:01 UTC 2016 Modified Files: src/bin/dd: dd.1 Log Message: The macro to cross-reference is Xr, not Xt. Fix typo error picked up by mandoc lint. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/bin/dd/dd.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/dd.1 diff -u src/bin/dd/dd.1:1.27 src/bin/dd/dd.1:1.28 --- src/bin/dd/dd.1:1.27 Wed Mar 18 13:30:13 2015 +++ src/bin/dd/dd.1 Thu Aug 11 01:14:01 2016 @@ -1,4 +1,4 @@ -.\" $NetBSD: dd.1,v 1.27 2015/03/18 13:30:13 wiz Exp $ +.\" $NetBSD: dd.1,v 1.28 2016/08/11 01:14:01 sevan Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -209,7 +209,7 @@ in order to output to a nonexistent file The default or specified value is or'ed with .Va rdwr for a first -.Xt open 2 +.Xr open 2 attempt, then on failure with .Va wronly on a second attempt.
CVS commit: src/bin/dd
Module Name:src Committed By: manu Date: Wed Mar 18 13:23:49 UTC 2015 Modified Files: src/bin/dd: Makefile args.c dd.1 dd.c dd.h extern.h Log Message: Add iflag and oflag operands to dd(1) Like GNU dd(1) similar operands, iflag and oflag allow specifying the O_* flags given to open(2) for the input and the output file. The values are comma-sepratated, lower-case, O_ prefix-stripped constants documented in open(2). Since iflag and oflag override default values, specifying oflag means O_CREATE is not set by default and must be specified explicitely. Some values do not make sense (e.g.: iflag=directory) but are still used and will raise a warning. For oflag, values rdonly, rdwr and wronly are filtered out with a warning (dd(1) attempts open(2) with O_RDWR and then O_WRONLY on failure). Specifying oflag=trunc along with (seek, oseek or conv=notrunc) is contradictory and will raise an error. iflag and oflag are disabled if building with -DMALLPROG To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/bin/dd/Makefile cvs rdiff -u -r1.38 -r1.39 src/bin/dd/args.c cvs rdiff -u -r1.25 -r1.26 src/bin/dd/dd.1 cvs rdiff -u -r1.49 -r1.50 src/bin/dd/dd.c cvs rdiff -u -r1.15 -r1.16 src/bin/dd/dd.h cvs rdiff -u -r1.22 -r1.23 src/bin/dd/extern.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/Makefile diff -u src/bin/dd/Makefile:1.17 src/bin/dd/Makefile:1.18 --- src/bin/dd/Makefile:1.17 Wed Aug 8 14:09:14 2012 +++ src/bin/dd/Makefile Wed Mar 18 13:23:49 2015 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.17 2012/08/08 14:09:14 christos Exp $ +# $NetBSD: Makefile,v 1.18 2015/03/18 13:23:49 manu Exp $ # @(#)Makefile 8.1 (Berkeley) 5/31/93 .include bsd.own.mk @@ -10,8 +10,9 @@ DPADD+= ${LIBUTIL} LDADD+= -lutil .ifdef SMALLPROG -CPPFLAGS+= -DNO_CONV -DNO_MSGFMT -DSMALL +CPPFLAGS+= -DNO_CONV -DNO_MSGFMT -DNO_IOFLAG -DSMALL .else +CPPFLAGS+= -D_NETBSD_SOURCE -D_INCOMPLETE_XOPEN_C063 SRCS+= conv_tab.c .ifdef CRUNCHEDPROG CPPFLAGS+= -DSMALL Index: src/bin/dd/args.c diff -u src/bin/dd/args.c:1.38 src/bin/dd/args.c:1.39 --- src/bin/dd/args.c:1.38 Wed Jul 17 12:55:48 2013 +++ src/bin/dd/args.c Wed Mar 18 13:23:49 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: args.c,v 1.38 2013/07/17 12:55:48 christos Exp $ */ +/* $NetBSD: args.c,v 1.39 2015/03/18 13:23:49 manu Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -38,13 +38,16 @@ #if 0 static char sccsid[] = @(#)args.c 8.3 (Berkeley) 4/2/94; #else -__RCSID($NetBSD: args.c,v 1.38 2013/07/17 12:55:48 christos Exp $); +__RCSID($NetBSD: args.c,v 1.39 2015/03/18 13:23:49 manu Exp $); #endif #endif /* not lint */ #include sys/types.h #include sys/time.h +#ifndef NO_IOFLAG +#include fcntl.h +#endif /* NO_IOFLAG */ #include err.h #include errno.h #include limits.h @@ -70,6 +73,16 @@ static void f_conv(char *); static int c_conv(const void *, const void *); #endif /* NO_CONV */ +#ifdef NO_IOFLAG +static void f_iflag(char *) __dead; +static void f_oflag(char *) __dead; +#else +static void f_iflag(char *); +static void f_oflag(char *); +static u_int f_ioflag(char *, u_int); +static int c_ioflag(const void *, const void *); +#endif /* NO_IOFLAG */ + static void f_bs(char *); static void f_cbs(char *); static void f_count(char *); @@ -96,10 +109,12 @@ static const struct arg { { files, f_files, C_FILES, C_FILES }, { ibs, f_ibs, C_IBS, C_BS|C_IBS }, { if, f_if, C_IF, C_IF }, + { iflag, f_iflag, C_IFLAG, C_IFLAG }, { iseek, f_skip, C_SKIP, C_SKIP }, { msgfmt, f_msgfmt, 0, 0 }, { obs, f_obs, C_OBS, C_BS|C_OBS }, { of, f_of, C_OF, C_OF }, + { oflag, f_oflag, C_OFLAG, C_OFLAG }, { oseek, f_seek, C_SEEK, C_SEEK }, { progress, f_progress, 0, 0 }, { seek, f_seek, C_SEEK, C_SEEK }, @@ -389,3 +404,102 @@ c_conv(const void *a, const void *b) } #endif /* NO_CONV */ + +static void +f_iflag(char *arg) +{ +/* Build a small version (i.e. for a ramdisk root) */ +#ifdef NO_IOFLAG + errx(EXIT_FAILURE, iflag option disabled); + /* NOTREACHED */ +#else + iflag = f_ioflag(arg, C_IFLAG); + return; +#endif +} + +static void +f_oflag(char *arg) +{ +/* Build a small version (i.e. for a ramdisk root) */ +#ifdef NO_IOFLAG + errx(EXIT_FAILURE, oflag option disabled); + /* NOTREACHED */ +#else + oflag = f_ioflag(arg, C_OFLAG); + return; +#endif +} + +#ifndef NO_IOFLAG +static const struct ioflag { + const char *name; + u_int set; + u_int allowed; +} olist[] = { + /* the array needs to be sorted by the first column so + bsearch() can be used to find commands quickly */ + { alt_io, O_ALT_IO, C_IFLAG|C_OFLAG }, + { append, O_APPEND, C_OFLAG }, + { async, O_ASYNC, C_IFLAG|C_OFLAG }, + { cloexec, O_CLOEXEC, C_IFLAG|C_OFLAG }, + { creat, O_CREAT, C_OFLAG }, + { direct, O_DIRECT, C_IFLAG|C_OFLAG }, + { directory, O_DIRECTORY, C_NONE }, + { dsync, O_DSYNC, C_OFLAG }, + { excl, O_EXCL, C_IFLAG|C_OFLAG }, + { exlock,
CVS commit: src/bin/dd
Module Name:src Committed By: wiz Date: Wed Mar 18 13:30:13 UTC 2015 Modified Files: src/bin/dd: dd.1 Log Message: New sentence, new line. Fix typos. Bump date for previous. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/bin/dd/dd.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/dd.1 diff -u src/bin/dd/dd.1:1.26 src/bin/dd/dd.1:1.27 --- src/bin/dd/dd.1:1.26 Wed Mar 18 13:23:49 2015 +++ src/bin/dd/dd.1 Wed Mar 18 13:30:13 2015 @@ -1,4 +1,4 @@ -.\ $NetBSD: dd.1,v 1.26 2015/03/18 13:23:49 manu Exp $ +.\ $NetBSD: dd.1,v 1.27 2015/03/18 13:30:13 wiz Exp $ .\ .\ Copyright (c) 1990, 1993 .\ The Regents of the University of California. All rights reserved. @@ -32,7 +32,7 @@ .\ .\ @(#)dd.1 8.2 (Berkeley) 1/13/94 .\ -.Dd November 6, 2011 +.Dd March 18, 2015 .Dt DD 1 .Os .Sh NAME @@ -200,18 +200,20 @@ Same as .Cm iflag but for the call to .Xr open 2 -on the output file. The default value is +on the output file. +The default value is .Va creat , -which should be explictely added in +which should be explicitly added in .Cm oflag -in order to output to a nonexistant file. +in order to output to a nonexistent file. The default or specified value is or'ed with .Va rdwr for a first .Xt open 2 attempt, then on failure with .Va wronly -on a second attempt. In both cases, +on a second attempt. +In both cases, .Va trunc is automatically added if none of .Cm oseek ,
CVS commit: src/bin/dd
Module Name:src Committed By: wiz Date: Wed Mar 18 13:30:13 UTC 2015 Modified Files: src/bin/dd: dd.1 Log Message: New sentence, new line. Fix typos. Bump date for previous. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/bin/dd/dd.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/dd
Module Name:src Committed By: manu Date: Wed Mar 18 13:23:49 UTC 2015 Modified Files: src/bin/dd: Makefile args.c dd.1 dd.c dd.h extern.h Log Message: Add iflag and oflag operands to dd(1) Like GNU dd(1) similar operands, iflag and oflag allow specifying the O_* flags given to open(2) for the input and the output file. The values are comma-sepratated, lower-case, O_ prefix-stripped constants documented in open(2). Since iflag and oflag override default values, specifying oflag means O_CREATE is not set by default and must be specified explicitely. Some values do not make sense (e.g.: iflag=directory) but are still used and will raise a warning. For oflag, values rdonly, rdwr and wronly are filtered out with a warning (dd(1) attempts open(2) with O_RDWR and then O_WRONLY on failure). Specifying oflag=trunc along with (seek, oseek or conv=notrunc) is contradictory and will raise an error. iflag and oflag are disabled if building with -DMALLPROG To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/bin/dd/Makefile cvs rdiff -u -r1.38 -r1.39 src/bin/dd/args.c cvs rdiff -u -r1.25 -r1.26 src/bin/dd/dd.1 cvs rdiff -u -r1.49 -r1.50 src/bin/dd/dd.c cvs rdiff -u -r1.15 -r1.16 src/bin/dd/dd.h cvs rdiff -u -r1.22 -r1.23 src/bin/dd/extern.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/dd
Module Name:src Committed By: christos Date: Wed Jul 17 12:55:48 UTC 2013 Modified Files: src/bin/dd: args.c Log Message: PR/48057: psi: skip and msgfmt cannot be used together. Looks like a pasto; fixed. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/bin/dd/args.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/args.c diff -u src/bin/dd/args.c:1.37 src/bin/dd/args.c:1.38 --- src/bin/dd/args.c:1.37 Mon Nov 7 17:24:23 2011 +++ src/bin/dd/args.c Wed Jul 17 08:55:48 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: args.c,v 1.37 2011/11/07 22:24:23 jym Exp $ */ +/* $NetBSD: args.c,v 1.38 2013/07/17 12:55:48 christos Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = @(#)args.c 8.3 (Berkeley) 4/2/94; #else -__RCSID($NetBSD: args.c,v 1.37 2011/11/07 22:24:23 jym Exp $); +__RCSID($NetBSD: args.c,v 1.38 2013/07/17 12:55:48 christos Exp $); #endif #endif /* not lint */ @@ -97,7 +97,7 @@ static const struct arg { { ibs, f_ibs, C_IBS, C_BS|C_IBS }, { if, f_if, C_IF, C_IF }, { iseek, f_skip, C_SKIP, C_SKIP }, - { msgfmt, f_msgfmt, C_SKIP, C_SKIP }, + { msgfmt, f_msgfmt, 0, 0 }, { obs, f_obs, C_OBS, C_BS|C_OBS }, { of, f_of, C_OF, C_OF }, { oseek, f_seek, C_SEEK, C_SEEK },
CVS commit: src/bin/dd
Module Name:src Committed By: christos Date: Wed Jul 17 12:55:48 UTC 2013 Modified Files: src/bin/dd: args.c Log Message: PR/48057: psi: skip and msgfmt cannot be used together. Looks like a pasto; fixed. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/bin/dd/args.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/dd
Module Name:src Committed By: christos Date: Wed Aug 8 14:09:14 UTC 2012 Modified Files: src/bin/dd: Makefile Log Message: let the standard rules deal with librumpclient To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/bin/dd/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/Makefile diff -u src/bin/dd/Makefile:1.16 src/bin/dd/Makefile:1.17 --- src/bin/dd/Makefile:1.16 Sun Nov 6 16:22:23 2011 +++ src/bin/dd/Makefile Wed Aug 8 10:09:14 2012 @@ -1,6 +1,8 @@ -# $NetBSD: Makefile,v 1.16 2011/11/06 21:22:23 jym Exp $ +# $NetBSD: Makefile,v 1.17 2012/08/08 14:09:14 christos Exp $ # @(#)Makefile 8.1 (Berkeley) 5/31/93 +.include bsd.own.mk + RUMPPRG=dd SRCS= args.c conv.c dd.c misc.c position.c @@ -11,10 +13,7 @@ LDADD+= -lutil CPPFLAGS+= -DNO_CONV -DNO_MSGFMT -DSMALL .else SRCS+= conv_tab.c -.ifndef CRUNCHEDPROG -DPADD+= ${LIBRUMPCLIENT} -LDADD+= -lrumpclient -.else +.ifdef CRUNCHEDPROG CPPFLAGS+= -DSMALL .endif .endif
CVS commit: src/bin/dd
Module Name:src Committed By: christos Date: Wed Aug 8 14:09:14 UTC 2012 Modified Files: src/bin/dd: Makefile Log Message: let the standard rules deal with librumpclient To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/bin/dd/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/dd
Module Name:src Committed By: wiz Date: Wed Jun 20 17:54:17 UTC 2012 Modified Files: src/bin/dd: dd.1 Log Message: - sync `SYNOPSIS' with dd.c's `usage' line; - correct spelling (prepositions). From Bug Hunting. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/bin/dd/dd.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/dd.1 diff -u src/bin/dd/dd.1:1.24 src/bin/dd/dd.1:1.25 --- src/bin/dd/dd.1:1.24 Sun Nov 6 21:22:23 2011 +++ src/bin/dd/dd.1 Wed Jun 20 17:54:16 2012 @@ -1,4 +1,4 @@ -.\ $NetBSD: dd.1,v 1.24 2011/11/06 21:22:23 jym Exp $ +.\ $NetBSD: dd.1,v 1.25 2012/06/20 17:54:16 wiz Exp $ .\ .\ Copyright (c) 1990, 1993 .\ The Regents of the University of California. All rights reserved. @@ -40,7 +40,7 @@ .Nd convert and copy a file .Sh SYNOPSIS .Nm -.Op operands ... +.Op operand ... .Sh DESCRIPTION The .Nm @@ -190,7 +190,7 @@ This is synonymous with Seek .Va n blocks from the beginning of the output before copying. -On non-tape devices, a +On non-tape devices, an .Xr lseek 2 operation is used. Otherwise, existing blocks are read and the data discarded. @@ -206,7 +206,7 @@ bytes. Skip .Va n blocks from the beginning of the input before copying. -On input which supports seeks, a +On input which supports seeks, an .Xr lseek 2 operation is used. Otherwise, input data is read and discarded.
CVS commit: src/bin/dd
Module Name:src Committed By: wiz Date: Wed Jun 20 17:54:17 UTC 2012 Modified Files: src/bin/dd: dd.1 Log Message: - sync `SYNOPSIS' with dd.c's `usage' line; - correct spelling (prepositions). From Bug Hunting. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/bin/dd/dd.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/dd
Module Name:src Committed By: matt Date: Tue Feb 21 01:49:02 UTC 2012 Modified Files: src/bin/dd: dd.c Log Message: Fix a very old bug. When allocating the buffer and doing just a bs= transfer, hen we only need a single buffer equal to that blocksize in length. To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/bin/dd/dd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/dd.c diff -u src/bin/dd/dd.c:1.48 src/bin/dd/dd.c:1.49 --- src/bin/dd/dd.c:1.48 Sun Nov 6 21:22:23 2011 +++ src/bin/dd/dd.c Tue Feb 21 01:49:01 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: dd.c,v 1.48 2011/11/06 21:22:23 jym Exp $ */ +/* $NetBSD: dd.c,v 1.49 2012/02/21 01:49:01 matt Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -43,7 +43,7 @@ __COPYRIGHT(@(#) Copyright (c) 1991, 19 #if 0 static char sccsid[] = @(#)dd.c 8.5 (Berkeley) 4/2/94; #else -__RCSID($NetBSD: dd.c,v 1.48 2011/11/06 21:22:23 jym Exp $); +__RCSID($NetBSD: dd.c,v 1.49 2012/02/21 01:49:01 matt Exp $); #endif #endif /* not lint */ @@ -212,7 +212,10 @@ setup(void) * record oriented I/O, only need a single buffer. */ if (!(ddflags (C_BLOCK|C_UNBLOCK))) { - if ((in.db = malloc(out.dbsz + in.dbsz - 1)) == NULL) { + size_t dbsz = out.dbsz; + if (!(ddflags C_BS)) + dbsz += in.dbsz - 1; + if ((in.db = malloc(dbsz)) == NULL) { err(EXIT_FAILURE, NULL); /* NOTREACHED */ }
CVS commit: src/bin/dd
Module Name:src Committed By: matt Date: Tue Feb 21 01:49:02 UTC 2012 Modified Files: src/bin/dd: dd.c Log Message: Fix a very old bug. When allocating the buffer and doing just a bs= transfer, hen we only need a single buffer equal to that blocksize in length. To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/bin/dd/dd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/dd
Module Name:src Committed By: jym Date: Mon Nov 7 22:24:23 UTC 2011 Modified Files: src/bin/dd: args.c extern.h misc.c Log Message: As suggested by Enami, rework the msgfmt logic a bit: - error out when an unknown specifier is used. Do this in f_msgfmt(), before dd(1) starts operation. - allow buffer_write() to flush the internal buffer even when NULL is passed as parameter. Some whitespace fixes too. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/bin/dd/args.c cvs rdiff -u -r1.21 -r1.22 src/bin/dd/extern.h cvs rdiff -u -r1.22 -r1.23 src/bin/dd/misc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/args.c diff -u src/bin/dd/args.c:1.36 src/bin/dd/args.c:1.37 --- src/bin/dd/args.c:1.36 Sun Nov 6 21:22:23 2011 +++ src/bin/dd/args.c Mon Nov 7 22:24:23 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: args.c,v 1.36 2011/11/06 21:22:23 jym Exp $ */ +/* $NetBSD: args.c,v 1.37 2011/11/07 22:24:23 jym Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = @(#)args.c 8.3 (Berkeley) 4/2/94; #else -__RCSID($NetBSD: args.c,v 1.36 2011/11/06 21:22:23 jym Exp $); +__RCSID($NetBSD: args.c,v 1.37 2011/11/07 22:24:23 jym Exp $); #endif #endif /* not lint */ @@ -274,6 +274,12 @@ static void f_msgfmt(char *arg) { + /* + * If the format string is not valid, dd_write_msg() will print + * an error and exit. + */ + dd_write_msg(arg, 0); + msgfmt = arg; } #endif /* NO_MSGFMT */ Index: src/bin/dd/extern.h diff -u src/bin/dd/extern.h:1.21 src/bin/dd/extern.h:1.22 --- src/bin/dd/extern.h:1.21 Sun Nov 6 21:22:23 2011 +++ src/bin/dd/extern.h Mon Nov 7 22:24:23 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.21 2011/11/06 21:22:23 jym Exp $ */ +/* $NetBSD: extern.h,v 1.22 2011/11/07 22:24:23 jym Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -48,6 +48,11 @@ void block_close(void); void unblock(void); void unblock_close(void); #endif + +#ifndef NO_MSGFMT +int dd_write_msg(const char *, int); +#endif + void dd_out(int); void def(void); void def_close(void); Index: src/bin/dd/misc.c diff -u src/bin/dd/misc.c:1.22 src/bin/dd/misc.c:1.23 --- src/bin/dd/misc.c:1.22 Sun Nov 6 21:22:23 2011 +++ src/bin/dd/misc.c Mon Nov 7 22:24:23 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: misc.c,v 1.22 2011/11/06 21:22:23 jym Exp $ */ +/* $NetBSD: misc.c,v 1.23 2011/11/07 22:24:23 jym Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = @(#)misc.c 8.3 (Berkeley) 4/2/94; #else -__RCSID($NetBSD: misc.c,v 1.22 2011/11/06 21:22:23 jym Exp $); +__RCSID($NetBSD: misc.c,v 1.23 2011/11/07 22:24:23 jym Exp $); #endif #endif /* not lint */ @@ -66,7 +66,6 @@ static void human_summary(void); static void quiet_summary(void); static void buffer_write(const char *, size_t, int); -static int dd_write_msg(const char *); #endif /* NO_MSGFMT */ void @@ -171,30 +170,42 @@ buffer_write(const char *str, size_t siz unsigned int i; for (i = 0; i size; i++) { - wbuf[cnt++] = str[i]; - if (cnt = sizeof(wbuf) || flush == 1) { + if (str != NULL) { + wbuf[cnt++] = str[i]; + } + if (cnt = sizeof(wbuf)) { (void)write(STDERR_FILENO, wbuf, cnt); cnt = 0; } } + + if (flush != 0) { + (void)write(STDERR_FILENO, wbuf, cnt); + cnt = 0; + } } -static int -dd_write_msg(const char *fmt) +/* + * Write summary to stderr according to format 'fmt'. If 'enable' is 0, it + * will not attempt to write anything. Can be used to validate the + * correctness of the 'fmt' string. + */ +int +dd_write_msg(const char *fmt, int enable) { char hbuf[7], nbuf[32]; const char *ptr; int64_t mS; -struct timeval tv; + struct timeval tv; (void)gettimeofday(tv, NULL); mS = tv2mS(tv) - tv2mS(st.start); if (mS == 0) mS = 1; -#define ADDC(c) do { buffer_write(c, 1, 0); } \ +#define ADDC(c) do { if (enable != 0) buffer_write(c, 1, 0); } \ while (/*CONSTCOND*/0) -#define ADDS(p) do { buffer_write(p, strlen(p), 0); } \ +#define ADDS(p) do { if (enable != 0) buffer_write(p, strlen(p), 0); } \ while (/*CONSTCOND*/0) for (ptr = fmt; *ptr; ptr++) { @@ -280,20 +291,21 @@ dd_write_msg(const char *fmt) ADDS(block); if (st.swab != 1) ADDS(s); break; - default: - ADDS(%); - if (*ptr == '\0') -goto done; - /*FALLTHROUGH*/ case '%': ADDC(*ptr); break; + default: + if (*ptr == '\0') +goto done; + errx(EXIT_FAILURE, unknown specifier '%c' in + msgfmt string, *ptr); + /* NOTREACHED */ } } done: /* flush buffer */ - buffer_write(\0, 1, 1); + buffer_write(NULL, 0, 1); return 0; } @@ -301,24 +313,24 @@ static void custom_summary(void) { - dd_write_msg(msgfmt); + dd_write_msg(msgfmt, 1); } static void human_summary(void) { - (void)dd_write_msg(%I+%i records in\n%O+%o records out\n); + (void)dd_write_msg(%I+%i records in\n%O+%o records out\n,
CVS commit: src/bin/dd
Module Name:src Committed By: jym Date: Sun Nov 6 21:22:23 UTC 2011 Modified Files: src/bin/dd: Makefile args.c dd.1 dd.c extern.h misc.c Log Message: Add a new command to dd(1): msgfmt. The command modifies the output of the information summary returned by dd(1). This can be used to specify messages in a more usable (or parseable) format like human-readable values. My intent is to re-use this for building image files and quick I/O benchmarking. Reviewed by tsutsui@ on tech-userlevel. See also http://mail-index.netbsd.org/tech-userlevel/2010/12/03/msg004179.html Some examples: $ dd if=/dev/zero of=/dev/null bs=1m count=1 msgfmt=human 1+0 records in 1+0 records out 1048576 bytes (1,0 MB) transferred in 0.001 secs (1048576000 bytes/sec - 1,0 GB/sec) $ dd if=/dev/zero of=/dev/null count=1 msgfmt=' speed%E/speed time%s/time bytes%b/bytes ' speed500 KB/sec/speed time0.001/time bytes512/bytes To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/bin/dd/Makefile cvs rdiff -u -r1.35 -r1.36 src/bin/dd/args.c cvs rdiff -u -r1.23 -r1.24 src/bin/dd/dd.1 cvs rdiff -u -r1.47 -r1.48 src/bin/dd/dd.c cvs rdiff -u -r1.20 -r1.21 src/bin/dd/extern.h cvs rdiff -u -r1.21 -r1.22 src/bin/dd/misc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/Makefile diff -u src/bin/dd/Makefile:1.15 src/bin/dd/Makefile:1.16 --- src/bin/dd/Makefile:1.15 Fri Feb 4 19:42:12 2011 +++ src/bin/dd/Makefile Sun Nov 6 21:22:23 2011 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.15 2011/02/04 19:42:12 pooka Exp $ +# $NetBSD: Makefile,v 1.16 2011/11/06 21:22:23 jym Exp $ # @(#)Makefile 8.1 (Berkeley) 5/31/93 RUMPPRG=dd @@ -8,7 +8,7 @@ DPADD+= ${LIBUTIL} LDADD+= -lutil .ifdef SMALLPROG -CPPFLAGS+= -DNO_CONV -DSMALL +CPPFLAGS+= -DNO_CONV -DNO_MSGFMT -DSMALL .else SRCS+= conv_tab.c .ifndef CRUNCHEDPROG Index: src/bin/dd/args.c diff -u src/bin/dd/args.c:1.35 src/bin/dd/args.c:1.36 --- src/bin/dd/args.c:1.35 Fri Sep 16 16:06:23 2011 +++ src/bin/dd/args.c Sun Nov 6 21:22:23 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: args.c,v 1.35 2011/09/16 16:06:23 joerg Exp $ */ +/* $NetBSD: args.c,v 1.36 2011/11/06 21:22:23 jym Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = @(#)args.c 8.3 (Berkeley) 4/2/94; #else -__RCSID($NetBSD: args.c,v 1.35 2011/09/16 16:06:23 joerg Exp $); +__RCSID($NetBSD: args.c,v 1.36 2011/11/06 21:22:23 jym Exp $); #endif #endif /* not lint */ @@ -56,15 +56,22 @@ __RCSID($NetBSD: args.c,v 1.35 2011/09/ #include extern.h static int c_arg(const void *, const void *); -#ifndef NO_CONV + +#ifdef NO_MSGFMT +static void f_msgfmt(char *) __dead; +#else +static void f_msgfmt(char *); +#endif /* NO_MSGFMT */ + +#ifdef NO_CONV +static void f_conv(char *) __dead; +#else +static void f_conv(char *); static int c_conv(const void *, const void *); -#endif +#endif /* NO_CONV */ + static void f_bs(char *); static void f_cbs(char *); -#ifdef NO_CONV -__dead -#endif -static void f_conv(char *); static void f_count(char *); static void f_files(char *); static void f_ibs(char *); @@ -90,6 +97,7 @@ static const struct arg { { ibs, f_ibs, C_IBS, C_BS|C_IBS }, { if, f_if, C_IF, C_IF }, { iseek, f_skip, C_SKIP, C_SKIP }, + { msgfmt, f_msgfmt, C_SKIP, C_SKIP }, { obs, f_obs, C_OBS, C_BS|C_OBS }, { of, f_of, C_OF, C_OF }, { oseek, f_seek, C_SEEK, C_SEEK }, @@ -252,6 +260,24 @@ f_if(char *arg) in.name = arg; } +#ifdef NO_MSGFMT +/* Build a small version (i.e. for a ramdisk root) */ +static void +f_msgfmt(char *arg) +{ + + errx(EXIT_FAILURE, msgfmt option disabled); + /* NOTREACHED */ +} +#else /* NO_MSGFMT */ +static void +f_msgfmt(char *arg) +{ + + msgfmt = arg; +} +#endif /* NO_MSGFMT */ + static void f_obs(char *arg) { Index: src/bin/dd/dd.1 diff -u src/bin/dd/dd.1:1.23 src/bin/dd/dd.1:1.24 --- src/bin/dd/dd.1:1.23 Wed Dec 22 09:42:53 2010 +++ src/bin/dd/dd.1 Sun Nov 6 21:22:23 2011 @@ -1,4 +1,4 @@ -.\ $NetBSD: dd.1,v 1.23 2010/12/22 09:42:53 enami Exp $ +.\ $NetBSD: dd.1,v 1.24 2011/11/06 21:22:23 jym Exp $ .\ .\ Copyright (c) 1990, 1993 .\ The Regents of the University of California. All rights reserved. @@ -32,7 +32,7 @@ .\ .\ @(#)dd.1 8.2 (Berkeley) 1/13/94 .\ -.Dd December 22, 2010 +.Dd November 6, 2011 .Dt DD 1 .Os .Sh NAME @@ -97,6 +97,74 @@ Seek on the input file blocks. This is synonymous with .Cm skip= Ns Ar n . +.It Cm msgfmt= Ns Ar fmt +Specify the message format +.Ar fmt +to be used when writing information to standard output. +Possible values are: +.Bl -tag -width x -offset indent -compact +.It quiet +turns off information summary report except for errors and +.Cm progress . +.It posix +default information summary report as specified by POSIX. +.It human +default information summary report extended with human-readable +values. +.El +.Pp +When +.Ar fmt +does not correspond to any
CVS commit: src/bin/dd
Module Name:src Committed By: jym Date: Sun Nov 6 21:22:23 UTC 2011 Modified Files: src/bin/dd: Makefile args.c dd.1 dd.c extern.h misc.c Log Message: Add a new command to dd(1): msgfmt. The command modifies the output of the information summary returned by dd(1). This can be used to specify messages in a more usable (or parseable) format like human-readable values. My intent is to re-use this for building image files and quick I/O benchmarking. Reviewed by tsutsui@ on tech-userlevel. See also http://mail-index.netbsd.org/tech-userlevel/2010/12/03/msg004179.html Some examples: $ dd if=/dev/zero of=/dev/null bs=1m count=1 msgfmt=human 1+0 records in 1+0 records out 1048576 bytes (1,0 MB) transferred in 0.001 secs (1048576000 bytes/sec - 1,0 GB/sec) $ dd if=/dev/zero of=/dev/null count=1 msgfmt=' speed%E/speed time%s/time bytes%b/bytes ' speed500 KB/sec/speed time0.001/time bytes512/bytes To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/bin/dd/Makefile cvs rdiff -u -r1.35 -r1.36 src/bin/dd/args.c cvs rdiff -u -r1.23 -r1.24 src/bin/dd/dd.1 cvs rdiff -u -r1.47 -r1.48 src/bin/dd/dd.c cvs rdiff -u -r1.20 -r1.21 src/bin/dd/extern.h cvs rdiff -u -r1.21 -r1.22 src/bin/dd/misc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/dd
Module Name:src Committed By: joerg Date: Fri Sep 16 16:06:23 UTC 2011 Modified Files: src/bin/dd: args.c extern.h Log Message: Use __dead for the small build too To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/bin/dd/args.c cvs rdiff -u -r1.19 -r1.20 src/bin/dd/extern.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/args.c diff -u src/bin/dd/args.c:1.34 src/bin/dd/args.c:1.35 --- src/bin/dd/args.c:1.34 Fri Feb 4 19:42:12 2011 +++ src/bin/dd/args.c Fri Sep 16 16:06:23 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: args.c,v 1.34 2011/02/04 19:42:12 pooka Exp $ */ +/* $NetBSD: args.c,v 1.35 2011/09/16 16:06:23 joerg Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = @(#)args.c 8.3 (Berkeley) 4/2/94; #else -__RCSID($NetBSD: args.c,v 1.34 2011/02/04 19:42:12 pooka Exp $); +__RCSID($NetBSD: args.c,v 1.35 2011/09/16 16:06:23 joerg Exp $); #endif #endif /* not lint */ @@ -61,6 +61,9 @@ #endif static void f_bs(char *); static void f_cbs(char *); +#ifdef NO_CONV +__dead +#endif static void f_conv(char *); static void f_count(char *); static void f_files(char *); Index: src/bin/dd/extern.h diff -u src/bin/dd/extern.h:1.19 src/bin/dd/extern.h:1.20 --- src/bin/dd/extern.h:1.19 Mon Aug 29 14:51:18 2011 +++ src/bin/dd/extern.h Fri Sep 16 16:06:23 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.19 2011/08/29 14:51:18 joerg Exp $ */ +/* $NetBSD: extern.h,v 1.20 2011/09/16 16:06:23 joerg Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -37,8 +37,17 @@ #include sys/cdefs.h +#ifdef NO_CONV +__dead void block(void); +__dead void block_close(void); +__dead void unblock(void); +__dead void unblock_close(void); +#else void block(void); void block_close(void); +void unblock(void); +void unblock_close(void); +#endif void dd_out(int); void def(void); void def_close(void);
CVS commit: src/bin/dd
Module Name:src Committed By: joerg Date: Fri Sep 16 16:06:23 UTC 2011 Modified Files: src/bin/dd: args.c extern.h Log Message: Use __dead for the small build too To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/bin/dd/args.c cvs rdiff -u -r1.19 -r1.20 src/bin/dd/extern.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/dd
Module Name:src Committed By: jym Date: Thu Jan 13 23:45:14 UTC 2011 Modified Files: src/bin/dd: args.c Log Message: No need to cast with bsearch(), it returns a void *. Use __arraycount(). To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/bin/dd/args.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/args.c diff -u src/bin/dd/args.c:1.32 src/bin/dd/args.c:1.33 --- src/bin/dd/args.c:1.32 Wed Dec 22 09:42:53 2010 +++ src/bin/dd/args.c Thu Jan 13 23:45:13 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: args.c,v 1.32 2010/12/22 09:42:53 enami Exp $ */ +/* $NetBSD: args.c,v 1.33 2011/01/13 23:45:13 jym Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = @(#)args.c 8.3 (Berkeley) 4/2/94; #else -__RCSID($NetBSD: args.c,v 1.32 2010/12/22 09:42:53 enami Exp $); +__RCSID($NetBSD: args.c,v 1.33 2011/01/13 23:45:13 jym Exp $); #endif #endif /* not lint */ @@ -138,9 +138,8 @@ /* NOTREACHED */ } tmp.name = oper; - if (!(ap = (struct arg *)bsearch(tmp, args, - sizeof(args)/sizeof(struct arg), sizeof(struct arg), - c_arg))) { + if (!(ap = bsearch(tmp, args, + __arraycount(args), sizeof(*args), c_arg))) { errx(EXIT_FAILURE, unknown operand %s, tmp.name); /* NOTREACHED */ } @@ -385,9 +384,8 @@ while (arg != NULL) { tmp.name = strsep(arg, ,); - if (!(cp = (struct conv *)bsearch(tmp, clist, - sizeof(clist)/sizeof(struct conv), sizeof(struct conv), - c_conv))) { + if (!(cp = bsearch(tmp, clist, + __arraycount(clist), sizeof(*clist), c_conv))) { errx(EXIT_FAILURE, unknown conversion %s, tmp.name); /* NOTREACHED */ }
CVS commit: src/bin/dd
Module Name:src Committed By: jym Date: Thu Jan 13 23:45:14 UTC 2011 Modified Files: src/bin/dd: args.c Log Message: No need to cast with bsearch(), it returns a void *. Use __arraycount(). To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/bin/dd/args.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/dd
Module Name:src Committed By: riz Date: Thu Dec 23 21:55:40 UTC 2010 Modified Files: src/bin/dd: dd.c Log Message: Fix speling (deferred, not defered) as reported in #netbsd-code on freenode IRC. While I'm here, clean up the wording later in the comment. To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.46 src/bin/dd/dd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/dd.c diff -u src/bin/dd/dd.c:1.45 src/bin/dd/dd.c:1.46 --- src/bin/dd/dd.c:1.45 Tue Dec 14 19:04:05 2010 +++ src/bin/dd/dd.c Thu Dec 23 21:55:40 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: dd.c,v 1.45 2010/12/14 19:04:05 pooka Exp $ */ +/* $NetBSD: dd.c,v 1.46 2010/12/23 21:55:40 riz Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -43,7 +43,7 @@ #if 0 static char sccsid[] = @(#)dd.c 8.5 (Berkeley) 4/2/94; #else -__RCSID($NetBSD: dd.c,v 1.45 2010/12/14 19:04:05 pooka Exp $); +__RCSID($NetBSD: dd.c,v 1.46 2010/12/23 21:55:40 riz Exp $); #endif #endif /* not lint */ @@ -445,10 +445,10 @@ dd_out(1); /* - * Reporting nfs write error may be defered until next + * Reporting nfs write error may be deferred until next * write(2) or close(2) system call. So, we need to do an * extra check. If an output is stdout, the file structure - * may be shared among with other processes and close(2) just + * may be shared with other processes and close(2) just * decreases the reference count. */ if (out.fd == STDOUT_FILENO ddop_fsync(out, out.fd) == -1
CVS commit: src/bin/dd
Module Name:src Committed By: enami Date: Wed Dec 22 09:39:06 UTC 2010 Modified Files: src/bin/dd: args.c Log Message: Copy argument before modifying it so that ps shows entire argument. From OpenBSD via FreeBSD. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/bin/dd/args.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/args.c diff -u src/bin/dd/args.c:1.30 src/bin/dd/args.c:1.31 --- src/bin/dd/args.c:1.30 Tue Dec 14 19:03:21 2010 +++ src/bin/dd/args.c Wed Dec 22 09:39:06 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: args.c,v 1.30 2010/12/14 19:03:21 pooka Exp $ */ +/* $NetBSD: args.c,v 1.31 2010/12/22 09:39:06 enami Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = @(#)args.c 8.3 (Berkeley) 4/2/94; #else -__RCSID($NetBSD: args.c,v 1.30 2010/12/14 19:03:21 pooka Exp $); +__RCSID($NetBSD: args.c,v 1.31 2010/12/22 09:39:06 enami Exp $); #endif #endif /* not lint */ @@ -120,6 +120,12 @@ in.dbsz = out.dbsz = 512; while ((oper = *++argv) != NULL) { + if ((oper = strdup(oper)) == NULL) { + errx(EXIT_FAILURE, + unable to allocate space for the argument %s, + *argv); + /* NOTREACHED */ + } if ((arg = strchr(oper, '=')) == NULL) { errx(EXIT_FAILURE, unknown operand %s, oper); /* NOTREACHED */
CVS commit: src/bin/dd
Module Name:src Committed By: enami Date: Wed Dec 22 09:42:53 UTC 2010 Modified Files: src/bin/dd: args.c dd.1 Log Message: Add iseek and oseek option as aliases for skip and seek respectively. These options exist in dd of solaris or svr3. From FreeBSD. To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/bin/dd/args.c cvs rdiff -u -r1.22 -r1.23 src/bin/dd/dd.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/args.c diff -u src/bin/dd/args.c:1.31 src/bin/dd/args.c:1.32 --- src/bin/dd/args.c:1.31 Wed Dec 22 09:39:06 2010 +++ src/bin/dd/args.c Wed Dec 22 09:42:53 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: args.c,v 1.31 2010/12/22 09:39:06 enami Exp $ */ +/* $NetBSD: args.c,v 1.32 2010/12/22 09:42:53 enami Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = @(#)args.c 8.3 (Berkeley) 4/2/94; #else -__RCSID($NetBSD: args.c,v 1.31 2010/12/22 09:39:06 enami Exp $); +__RCSID($NetBSD: args.c,v 1.32 2010/12/22 09:42:53 enami Exp $); #endif #endif /* not lint */ @@ -97,8 +97,10 @@ { files, f_files, C_FILES, C_FILES }, { ibs, f_ibs, C_IBS, C_BS|C_IBS }, { if, f_if, C_IF, C_IF|C_RIF }, + { iseek, f_skip, C_SKIP, C_SKIP }, { obs, f_obs, C_OBS, C_BS|C_OBS }, { of, f_of, C_OF, C_OF|C_ROF }, + { oseek, f_seek, C_SEEK, C_SEEK }, { progress, f_progress, 0, 0 }, #ifdef _HAVE_RUMPOPS { rif, f_rif, C_RIF|C_RUMP, C_RIF|C_IF }, Index: src/bin/dd/dd.1 diff -u src/bin/dd/dd.1:1.22 src/bin/dd/dd.1:1.23 --- src/bin/dd/dd.1:1.22 Wed Mar 11 12:43:58 2009 +++ src/bin/dd/dd.1 Wed Dec 22 09:42:53 2010 @@ -1,4 +1,4 @@ -.\ $NetBSD: dd.1,v 1.22 2009/03/11 12:43:58 joerg Exp $ +.\ $NetBSD: dd.1,v 1.23 2010/12/22 09:42:53 enami Exp $ .\ .\ Copyright (c) 1990, 1993 .\ The Regents of the University of California. All rights reserved. @@ -32,7 +32,7 @@ .\ .\ @(#)dd.1 8.2 (Berkeley) 1/13/94 .\ -.Dd April 13, 2007 +.Dd December 22, 2010 .Dt DD 1 .Os .Sh NAME @@ -91,6 +91,12 @@ Read input from .Ar file instead of the standard input. +.It Cm iseek= Ns Ar n +Seek on the input file +.Ar n +blocks. +This is synonymous with +.Cm skip= Ns Ar n . .It Cm obs= Ns Ar n Set the output block size to .Va n @@ -106,6 +112,12 @@ .Cm seek operand) the output file is truncated at that point. +.It Cm oseek= Ns Ar n +Seek on the output file +.Ar n +blocks. +This is synonymous with +.Cm seek= Ns Ar n . .It Cm seek= Ns Ar n Seek .Va n
CVS commit: src/bin/dd
Module Name:src Committed By: enami Date: Wed Dec 22 09:39:06 UTC 2010 Modified Files: src/bin/dd: args.c Log Message: Copy argument before modifying it so that ps shows entire argument. From OpenBSD via FreeBSD. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/bin/dd/args.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/dd
Module Name:src Committed By: pooka Date: Tue Dec 14 19:03:21 UTC 2010 Modified Files: src/bin/dd: args.c Log Message: Make compile on non-NetBSD. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/bin/dd/args.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/args.c diff -u src/bin/dd/args.c:1.29 src/bin/dd/args.c:1.30 --- src/bin/dd/args.c:1.29 Thu Dec 9 10:24:56 2010 +++ src/bin/dd/args.c Tue Dec 14 19:03:21 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: args.c,v 1.29 2010/12/09 10:24:56 enami Exp $ */ +/* $NetBSD: args.c,v 1.30 2010/12/14 19:03:21 pooka Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = @(#)args.c 8.3 (Berkeley) 4/2/94; #else -__RCSID($NetBSD: args.c,v 1.29 2010/12/09 10:24:56 enami Exp $); +__RCSID($NetBSD: args.c,v 1.30 2010/12/14 19:03:21 pooka Exp $); #endif #endif /* not lint */ @@ -55,7 +55,9 @@ #include dd.h #include extern.h -#ifndef SMALL +#if !defined(SMALL) defined(__NetBSD__) +#define _HAVE_RUMPOPS + #include rump/rumpclient.h #endif @@ -76,7 +78,7 @@ static void f_skip(char *); static void f_progress(char *); -#ifndef SMALL +#ifdef _HAVE_RUMPOPS static void f_rif(char *); static void f_rof(char *); #endif @@ -98,7 +100,7 @@ { obs, f_obs, C_OBS, C_BS|C_OBS }, { of, f_of, C_OF, C_OF|C_ROF }, { progress, f_progress, 0, 0 }, -#ifndef SMALL +#ifdef _HAVE_RUMPOPS { rif, f_rif, C_RIF|C_RUMP, C_RIF|C_IF }, { rof, f_rof, C_ROF|C_RUMP, C_ROF|C_OF }, #endif @@ -199,7 +201,7 @@ * errx(1, seek offsets cannot be larger than %d, INT_MAX); */ -#ifndef SMALL +#ifdef _HAVE_RUMPOPS if (ddflags C_RUMP) if (rumpclient_init() == -1) err(1, rumpclient init failed); @@ -276,7 +278,7 @@ out.name = arg; } -#ifndef SMALL +#ifdef _HAVE_RUMPOPS #include rump/rump.h #include rump/rump_syscalls.h
CVS commit: src/bin/dd
Module Name:src Committed By: pooka Date: Tue Dec 14 19:04:05 UTC 2010 Modified Files: src/bin/dd: dd.c Log Message: remove some leftover development garbage To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 src/bin/dd/dd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/dd.c diff -u src/bin/dd/dd.c:1.44 src/bin/dd/dd.c:1.45 --- src/bin/dd/dd.c:1.44 Mon Nov 22 21:04:27 2010 +++ src/bin/dd/dd.c Tue Dec 14 19:04:05 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: dd.c,v 1.44 2010/11/22 21:04:27 pooka Exp $ */ +/* $NetBSD: dd.c,v 1.45 2010/12/14 19:04:05 pooka Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -43,7 +43,7 @@ #if 0 static char sccsid[] = @(#)dd.c 8.5 (Berkeley) 4/2/94; #else -__RCSID($NetBSD: dd.c,v 1.44 2010/11/22 21:04:27 pooka Exp $); +__RCSID($NetBSD: dd.c,v 1.45 2010/12/14 19:04:05 pooka Exp $); #endif #endif /* not lint */ @@ -100,8 +100,6 @@ .op_write = write, }; -#include rump/rumpclient.h - int main(int argc, char *argv[]) {
CVS commit: src/bin/dd
Module Name:src Committed By: pooka Date: Tue Dec 14 19:04:05 UTC 2010 Modified Files: src/bin/dd: dd.c Log Message: remove some leftover development garbage To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 src/bin/dd/dd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/dd
Module Name:src Committed By: enami Date: Thu Dec 9 10:24:56 UTC 2010 Modified Files: src/bin/dd: args.c Log Message: Wrap long line. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/bin/dd/args.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/args.c diff -u src/bin/dd/args.c:1.28 src/bin/dd/args.c:1.29 --- src/bin/dd/args.c:1.28 Sun Dec 5 23:35:59 2010 +++ src/bin/dd/args.c Thu Dec 9 10:24:56 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: args.c,v 1.28 2010/12/05 23:35:59 jym Exp $ */ +/* $NetBSD: args.c,v 1.29 2010/12/09 10:24:56 enami Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = @(#)args.c 8.3 (Berkeley) 4/2/94; #else -__RCSID($NetBSD: args.c,v 1.28 2010/12/05 23:35:59 jym Exp $); +__RCSID($NetBSD: args.c,v 1.29 2010/12/09 10:24:56 enami Exp $); #endif #endif /* not lint */ @@ -382,7 +382,8 @@ /* NOTREACHED */ } if (ddflags cp-noset) { - errx(EXIT_FAILURE, %s: illegal conversion combination, tmp.name); + errx(EXIT_FAILURE, + %s: illegal conversion combination, tmp.name); /* NOTREACHED */ } ddflags |= cp-set;
CVS commit: src/bin/dd
Module Name:src Committed By: enami Date: Thu Dec 9 10:24:56 UTC 2010 Modified Files: src/bin/dd: args.c Log Message: Wrap long line. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/bin/dd/args.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/dd
Module Name:src Committed By: pooka Date: Mon Dec 6 15:23:30 UTC 2010 Modified Files: src/bin/dd: dd.h Log Message: Fix most inopportune typo. from gson jmmv. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/bin/dd/dd.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/dd.h diff -u src/bin/dd/dd.h:1.13 src/bin/dd/dd.h:1.14 --- src/bin/dd/dd.h:1.13 Mon Nov 22 21:04:27 2010 +++ src/bin/dd/dd.h Mon Dec 6 15:23:29 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: dd.h,v 1.13 2010/11/22 21:04:27 pooka Exp $ */ +/* $NetBSD: dd.h,v 1.14 2010/12/06 15:23:29 pooka Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -59,7 +59,7 @@ #define ddop_fcntl(dir, a1, a2, ...) dir.ops-op_fcntl(a1, a2, __VA_ARGS__) #define ddop_ioctl(dir, a1, a2, ...) dir.ops-op_ioctl(a1, a2, __VA_ARGS__) #define ddop_fsync(dir, a1) dir.ops-op_fsync(a1) -#define ddop_ftruncate(dir, a1, a2) dir.ops-op_ftruncate(a1, 2) +#define ddop_ftruncate(dir, a1, a2) dir.ops-op_ftruncate(a1, a2) #define ddop_lseek(dir, a1, a2, a3) dir.ops-op_lseek(a1, a2, a3) #define ddop_read(dir, a1, a2, a3) dir.ops-op_read(a1, a2, a3) #define ddop_write(dir, a1, a2, a3) dir.ops-op_write(a1, a2, a3)
CVS commit: src/bin/dd
Module Name:src Committed By: pooka Date: Mon Dec 6 15:23:30 UTC 2010 Modified Files: src/bin/dd: dd.h Log Message: Fix most inopportune typo. from gson jmmv. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/bin/dd/dd.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/dd
Module Name:src Committed By: jym Date: Sun Dec 5 23:35:59 UTC 2010 Modified Files: src/bin/dd: args.c Log Message: Hmm, for 'rof', I believe that C_ROF|C_OF is invalid rather than C_ROF|C_ROF. Hi pooka :) To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/bin/dd/args.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/args.c diff -u src/bin/dd/args.c:1.27 src/bin/dd/args.c:1.28 --- src/bin/dd/args.c:1.27 Mon Nov 22 21:04:27 2010 +++ src/bin/dd/args.c Sun Dec 5 23:35:59 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: args.c,v 1.27 2010/11/22 21:04:27 pooka Exp $ */ +/* $NetBSD: args.c,v 1.28 2010/12/05 23:35:59 jym Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = @(#)args.c 8.3 (Berkeley) 4/2/94; #else -__RCSID($NetBSD: args.c,v 1.27 2010/11/22 21:04:27 pooka Exp $); +__RCSID($NetBSD: args.c,v 1.28 2010/12/05 23:35:59 jym Exp $); #endif #endif /* not lint */ @@ -100,7 +100,7 @@ { progress, f_progress, 0, 0 }, #ifndef SMALL { rif, f_rif, C_RIF|C_RUMP, C_RIF|C_IF }, - { rof, f_rof, C_ROF|C_RUMP, C_ROF|C_ROF }, + { rof, f_rof, C_ROF|C_RUMP, C_ROF|C_OF }, #endif { seek, f_seek, C_SEEK, C_SEEK }, { skip, f_skip, C_SKIP, C_SKIP },
CVS commit: src/bin/dd
Module Name:src Committed By: jym Date: Sun Dec 5 23:35:59 UTC 2010 Modified Files: src/bin/dd: args.c Log Message: Hmm, for 'rof', I believe that C_ROF|C_OF is invalid rather than C_ROF|C_ROF. Hi pooka :) To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/bin/dd/args.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/bin/dd
David Holland dholland-sourcechan...@netbsd.org writes: Adding weird special case remote access hacks to dd (of all random tools) is also poor design. Why not for the next round add support for dd ifurl=http://www.netbsd.org/index.html of=mycopy or dd ifurl=http://www.netbsd.org/ recurse=true of=mytree/ After all, all you have to do to implement this is open a pipe to ftp or wget. Actually, neat idea (at least the first one)... -- Jim Wise jw...@draga.com pgpTopM5vOIzq.pgp Description: PGP signature
Re: CVS commit: src/bin/dd
On Tue Nov 23 2010 at 12:28:48 +, Matthias Scheler wrote: On Mon, Nov 22, 2010 at 09:04:28PM +, Antti Kantee wrote: Module Name:src Committed By: pooka Date: Mon Nov 22 21:04:28 UTC 2010 Modified Files: src/bin/dd: Makefile args.c dd.c dd.h extern.h position.c Log Message: Add two new operands: rif and rof. They operate exactly like if and of with the exception that the communicate with a rump kernel instead of the host kernel. This makes dd unusable if only / but not /usr is mounted because it now depends on /usr/lib/librumpclient.so.0. Utilities in /bin and /sbin are supposed to work without /usr mounted. Good catch. Fixed. Sorry 'bout that oversight. (on a slight tangent, wasn't getting rid of /usr vs. / on the roadmap?)
Re: CVS commit: src/bin/dd
On Tue, Nov 23, 2010 at 02:42:04PM +0200, Antti Kantee wrote: (on a slight tangent, wasn't getting rid of /usr vs. / on the roadmap?) I don't know that. I personally don't create /usr partitions on my NetBSD systems anymore. But they usually have hard disks with multiple gigabytes of storage space. /usr over NFS is useful for a system with a shortage of local disk space. Kind regards -- Matthias Scheler http://zhadum.org.uk/
Re: CVS commit: src/bin/dd
On Tue, Nov 23, 2010 at 02:42:04PM +0200, Antti Kantee wrote: On Tue Nov 23 2010 at 12:28:48 +, Matthias Scheler wrote: On Mon, Nov 22, 2010 at 09:04:28PM +, Antti Kantee wrote: Module Name: src Committed By: pooka Date: Mon Nov 22 21:04:28 UTC 2010 Modified Files: src/bin/dd: Makefile args.c dd.c dd.h extern.h position.c Log Message: Add two new operands: rif and rof. They operate exactly like if and of with the exception that the communicate with a rump kernel instead of the host kernel. This makes dd unusable if only / but not /usr is mounted because it now depends on /usr/lib/librumpclient.so.0. Utilities in /bin and /sbin are supposed to work without /usr mounted. Good catch. Fixed. Sorry 'bout that oversight. That doesn't resolve the concerns why this non standard options were added to dd. Can we go back to the previous versions for the moment and discuss it and then do further changes? Bernd
Re: CVS commit: src/bin/dd
On Tue, Nov 23, 2010 at 12:19:36AM +0200, Antti Kantee wrote: Surely it would be more appropriate to make thye rump kernel directly forward some paths to the real kernel? Can you explain how that could work? First thoughts are something like the way /../ is used to 'escape' from the emulation root. But maybe just mount the real filesystem within the rump kernel? Making something work well enough to copy files is probably not that hard! David -- David Laight: da...@l8s.co.uk
Re: CVS commit: src/bin/dd
On Tue Nov 23 2010 at 18:41:21 +, David Laight wrote: On Tue, Nov 23, 2010 at 12:19:36AM +0200, Antti Kantee wrote: Surely it would be more appropriate to make thye rump kernel directly forward some paths to the real kernel? Can you explain how that could work? First thoughts are something like the way /../ is used to 'escape' from the emulation root. But maybe just mount the real filesystem within the rump kernel? The client may be on a different machine, so you'd have to, if not invent a completely new protocol, at least include server side functionality on the client and add some weird pingpong/adjust logic into the server. Making something work well enough to copy files is probably not that hard! Adding a ton of special case code to copy files is extremely poor design! Doubly so since the only reason is because you don't happen to like some flags which bring 0 cost when not used. If you don't like them, don't use them. Unless someone can actually name a *problem*, move along.
Re: CVS commit: src/bin/dd
On Tue, Nov 23, 2010 at 02:42:04PM +0200, Antti Kantee wrote: (on a slight tangent, wasn't getting rid of /usr vs. / on the roadmap?) No. -- David A. Holland dholl...@netbsd.org
Re: CVS commit: src/bin/dd
On Tue, Nov 23, 2010 at 08:50:54PM +0200, Antti Kantee wrote: Surely it would be more appropriate to make thye rump kernel directly forward some paths to the real kernel? Can you explain how that could work? First thoughts are something like the way /../ is used to 'escape' from the emulation root. But maybe just mount the real filesystem within the rump kernel? The client may be on a different machine, so you'd have to, if not invent a completely new protocol, at least include server side functionality on the client and add some weird pingpong/adjust logic into the server. But you must already have this protocol in order to be able to reach the client, no? But if not, we already have nfs, there's no need to reinvent it. Making something work well enough to copy files is probably not that hard! Adding a ton of special case code to copy files is extremely poor design! Adding weird special case remote access hacks to dd (of all random tools) is also poor design. Why not for the next round add support for dd ifurl=http://www.netbsd.org/index.html of=mycopy or dd ifurl=http://www.netbsd.org/ recurse=true of=mytree/ After all, all you have to do to implement this is open a pipe to ftp or wget. Doubly so since the only reason is because you don't happen to like some flags which bring 0 cost when not used. If you don't like them, don't use them. Poorly thought-out features cause a lot of long-term overhead. Unless someone can actually name a *problem*, move along. I'd say the first problem is that this wasn't discussed anywhere. -- David A. Holland dholl...@netbsd.org
Re: CVS commit: src/bin/dd
On Mon Nov 22 2010 at 22:09:24 +, David Laight wrote: On Mon, Nov 22, 2010 at 09:04:28PM +, Antti Kantee wrote: Module Name:src Committed By: pooka Date: Mon Nov 22 21:04:28 UTC 2010 Modified Files: src/bin/dd: Makefile args.c dd.c dd.h extern.h position.c Log Message: Add two new operands: rif and rof. They operate exactly like if and of with the exception that the communicate with a rump kernel instead of the host kernel. H this seems like polluting a standard utility to support a very specific use. Surely it would be more appropriate to make thye rump kernel directly forward some paths to the real kernel? Can you explain how that could work?
Re: CVS commit: src/bin/dd
On Mon, Nov 22, 2010 at 10:09:24PM +, David Laight wrote: Add two new operands: rif and rof. They operate exactly like if and of with the exception that the communicate with a rump kernel instead of the host kernel. H this seems like polluting a standard utility to support a very specific use. (Was this discussed anywhere?) Surely it would be more appropriate to make thye rump kernel directly forward some paths to the real kernel? Yeah, that... -- David A. Holland dholl...@netbsd.org
CVS commit: src/bin/dd
Module Name:src Committed By: pooka Date: Mon Nov 22 21:04:28 UTC 2010 Modified Files: src/bin/dd: Makefile args.c dd.c dd.h extern.h position.c Log Message: Add two new operands: rif and rof. They operate exactly like if and of with the exception that the communicate with a rump kernel instead of the host kernel. For example, to write stdout to /tmp/file.txt in a rump kernel namespace: dd rof=/tmp/file.txt copy /file1 to /file2 inside a rump kernel: dd rif=/file1 rof=/file2 copy a snippet from /dev/rmd0d on the rump kernel to the host fs: dd rif=/dev/rmd0d of=save seek=1000 count=3 Eat that, usermode OS. (I'll document the operands one I have some manpage to refer to for rump client use). To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/bin/dd/Makefile src/bin/dd/dd.h cvs rdiff -u -r1.26 -r1.27 src/bin/dd/args.c cvs rdiff -u -r1.43 -r1.44 src/bin/dd/dd.c cvs rdiff -u -r1.17 -r1.18 src/bin/dd/extern.h src/bin/dd/position.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/Makefile diff -u src/bin/dd/Makefile:1.12 src/bin/dd/Makefile:1.13 --- src/bin/dd/Makefile:1.12 Fri Oct 5 07:23:09 2007 +++ src/bin/dd/Makefile Mon Nov 22 21:04:27 2010 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.12 2007/10/05 07:23:09 lukem Exp $ +# $NetBSD: Makefile,v 1.13 2010/11/22 21:04:27 pooka Exp $ # @(#)Makefile 8.1 (Berkeley) 5/31/93 PROG= dd @@ -8,9 +8,11 @@ LDADD+= -lutil .ifdef SMALLPROG -CPPFLAGS+= -DNO_CONV +CPPFLAGS+= -DNO_CONV -DSMALL .else SRCS+= conv_tab.c +DPADD+= ${LIBRUMPCLIENT} +LDADD+= -lrumpclient .endif .include bsd.prog.mk Index: src/bin/dd/dd.h diff -u src/bin/dd/dd.h:1.12 src/bin/dd/dd.h:1.13 --- src/bin/dd/dd.h:1.12 Sat Jan 17 20:48:57 2004 +++ src/bin/dd/dd.h Mon Nov 22 21:04:27 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: dd.h,v 1.12 2004/01/17 20:48:57 dbj Exp $ */ +/* $NetBSD: dd.h,v 1.13 2010/11/22 21:04:27 pooka Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -35,6 +35,35 @@ * @(#)dd.h 8.3 (Berkeley) 4/2/94 */ +#include sys/stat.h + +struct ddfops { + int (*op_open)(const char *, int, ...); + int (*op_close)(int); + + int (*op_fcntl)(int, int, ...); + int (*op_ioctl)(int, unsigned long, ...); + + int (*op_fstat)(int, struct stat *); + int (*op_fsync)(int); + int (*op_ftruncate)(int, off_t); + + off_t (*op_lseek)(int, off_t, int); + + ssize_t (*op_read)(int, void *, size_t); + ssize_t (*op_write)(int, const void *, size_t); +}; + +#define ddop_open(dir, a1, a2, ...) dir.ops-op_open(a1, a2, __VA_ARGS__) +#define ddop_close(dir, a1) dir.ops-op_close(a1) +#define ddop_fcntl(dir, a1, a2, ...) dir.ops-op_fcntl(a1, a2, __VA_ARGS__) +#define ddop_ioctl(dir, a1, a2, ...) dir.ops-op_ioctl(a1, a2, __VA_ARGS__) +#define ddop_fsync(dir, a1) dir.ops-op_fsync(a1) +#define ddop_ftruncate(dir, a1, a2) dir.ops-op_ftruncate(a1, 2) +#define ddop_lseek(dir, a1, a2, a3) dir.ops-op_lseek(a1, a2, a3) +#define ddop_read(dir, a1, a2, a3) dir.ops-op_read(a1, a2, a3) +#define ddop_write(dir, a1, a2, a3) dir.ops-op_write(a1, a2, a3) + /* Input/output stream state. */ typedef struct { u_char *db; /* buffer address */ @@ -52,6 +81,7 @@ const char *name; /* name */ int fd; /* file descriptor */ uint64_t offset; /* # of blocks to skip */ + struct ddfops const *ops; /* ops to use with fd */ } IO; typedef struct { @@ -89,3 +119,6 @@ #define C_UNBLOCK 0x8 #define C_OSYNC 0x10 #define C_SPARSE 0x20 +#define C_RIF 0x40 +#define C_ROF 0x80 +#define C_RUMP 0x100 Index: src/bin/dd/args.c diff -u src/bin/dd/args.c:1.26 src/bin/dd/args.c:1.27 --- src/bin/dd/args.c:1.26 Mon Jan 9 10:17:05 2006 +++ src/bin/dd/args.c Mon Nov 22 21:04:27 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: args.c,v 1.26 2006/01/09 10:17:05 apb Exp $ */ +/* $NetBSD: args.c,v 1.27 2010/11/22 21:04:27 pooka Exp $ */ /*- * Copyright (c) 1991, 1993, 1994 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = @(#)args.c 8.3 (Berkeley) 4/2/94; #else -__RCSID($NetBSD: args.c,v 1.26 2006/01/09 10:17:05 apb Exp $); +__RCSID($NetBSD: args.c,v 1.27 2010/11/22 21:04:27 pooka Exp $); #endif #endif /* not lint */ @@ -55,6 +55,10 @@ #include dd.h #include extern.h +#ifndef SMALL +#include rump/rumpclient.h +#endif + static int c_arg(const void *, const void *); #ifndef NO_CONV static int c_conv(const void *, const void *); @@ -72,6 +76,11 @@ static void f_skip(char *); static void f_progress(char *); +#ifndef SMALL +static void f_rif(char *); +static void f_rof(char *); +#endif + static const struct arg { const char *name; void (*f)(char *); @@ -85,10 +94,14 @@ { count, f_count, C_COUNT, C_COUNT }, { files, f_files, C_FILES, C_FILES }, { ibs, f_ibs, C_IBS, C_BS|C_IBS }, - { if, f_if, C_IF, C_IF }, + { if, f_if, C_IF, C_IF|C_RIF }, { obs, f_obs, C_OBS, C_BS|C_OBS }, - { of, f_of, C_OF, C_OF }, + { of, f_of, C_OF,
CVS commit: src/bin/dd
Module Name:src Committed By: pooka Date: Mon Nov 22 21:59:09 UTC 2010 Modified Files: src/bin/dd: Makefile Log Message: extra crunchgen hoops To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/bin/dd/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/Makefile diff -u src/bin/dd/Makefile:1.13 src/bin/dd/Makefile:1.14 --- src/bin/dd/Makefile:1.13 Mon Nov 22 21:04:27 2010 +++ src/bin/dd/Makefile Mon Nov 22 21:59:09 2010 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.13 2010/11/22 21:04:27 pooka Exp $ +# $NetBSD: Makefile,v 1.14 2010/11/22 21:59:09 pooka Exp $ # @(#)Makefile 8.1 (Berkeley) 5/31/93 PROG= dd @@ -11,8 +11,12 @@ CPPFLAGS+= -DNO_CONV -DSMALL .else SRCS+= conv_tab.c +.ifndef CRUNCHEDPROG DPADD+= ${LIBRUMPCLIENT} LDADD+= -lrumpclient +.else +CPPFLAGS+= -DSMALL +.endif .endif .include bsd.prog.mk
CVS commit: src/bin/dd
Module Name:src Committed By: pooka Date: Mon Nov 22 21:04:28 UTC 2010 Modified Files: src/bin/dd: Makefile args.c dd.c dd.h extern.h position.c Log Message: Add two new operands: rif and rof. They operate exactly like if and of with the exception that the communicate with a rump kernel instead of the host kernel. For example, to write stdout to /tmp/file.txt in a rump kernel namespace: dd rof=/tmp/file.txt copy /file1 to /file2 inside a rump kernel: dd rif=/file1 rof=/file2 copy a snippet from /dev/rmd0d on the rump kernel to the host fs: dd rif=/dev/rmd0d of=save seek=1000 count=3 Eat that, usermode OS. (I'll document the operands one I have some manpage to refer to for rump client use). To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/bin/dd/Makefile src/bin/dd/dd.h cvs rdiff -u -r1.26 -r1.27 src/bin/dd/args.c cvs rdiff -u -r1.43 -r1.44 src/bin/dd/dd.c cvs rdiff -u -r1.17 -r1.18 src/bin/dd/extern.h src/bin/dd/position.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/bin/dd
Module Name:src Committed By: pooka Date: Mon Nov 22 21:59:09 UTC 2010 Modified Files: src/bin/dd: Makefile Log Message: extra crunchgen hoops To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/bin/dd/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.