Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F150242149
D21370.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D21370.id.diff
View Options
Index: bin/dd/args.c
===================================================================
--- bin/dd/args.c
+++ bin/dd/args.c
@@ -320,6 +320,7 @@
{ "ascii", C_ASCII, C_EBCDIC, e2a_POSIX },
{ "block", C_BLOCK, C_UNBLOCK, NULL },
{ "ebcdic", C_EBCDIC, C_ASCII, a2e_POSIX },
+ { "fsync", C_FSYNC, 0, NULL },
{ "ibm", C_EBCDIC, C_ASCII, a2ibm_POSIX },
{ "lcase", C_LCASE, C_UCASE, NULL },
{ "noerror", C_NOERROR, 0, NULL },
Index: bin/dd/dd.h
===================================================================
--- bin/dd/dd.h
+++ bin/dd/dd.h
@@ -101,6 +101,7 @@
#define C_NOXFER 0x10000000
#define C_NOINFO 0x20000000
#define C_PROGRESS 0x40000000
+#define C_FSYNC 0x80000000
#define C_PARITY (C_PAREVEN | C_PARODD | C_PARNONE | C_PARSET)
Index: bin/dd/dd.1
===================================================================
--- bin/dd/dd.1
+++ bin/dd/dd.1
@@ -252,6 +252,10 @@
and
.No pre- Ns Bx 4.3 reno
systems.
+.It Cm fsync
+Perform an
+.Xr fsync 2
+on the output file before closing it.
.It Cm lcase
Transform uppercase characters into lowercase characters.
.It Cm pareven , parnone , parodd , parset
Index: bin/dd/dd.c
===================================================================
--- bin/dd/dd.c
+++ bin/dd/dd.c
@@ -164,6 +164,8 @@
errx(1, "files is not supported for non-tape devices");
cap_rights_set(&rights, CAP_FTRUNCATE, CAP_IOCTL, CAP_WRITE);
+ if (ddflags & C_FSYNC)
+ cap_rights_set(&rights, CAP_FSYNC);
if (out.name == NULL) {
/* No way to check for read access here. */
out.fd = STDOUT_FILENO;
@@ -505,6 +507,11 @@
if (ftruncate(out.fd, out.seek_offset) == -1)
err(1, "truncating %s", out.name);
}
+
+ if (ddflags & C_FSYNC) {
+ if (fsync(out.fd) == -1)
+ err(1, "fsyncing %s", out.name);
+ }
}
void
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Mar 31, 1:40 PM (2 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30635340
Default Alt Text
D21370.id.diff (1 KB)
Attached To
Mode
D21370: Add conv=fsync flag to dd
Attached
Detach File
Event Timeline
Log In to Comment