tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

iflag/oflag for dd(1)


Linux's dd(1) has iflag and oflag operands to specify the O_* flags that
should be given to open(2) for the input and output file. It works like

dd if=in.txt of=out.txt oflag=direct,sync

That tells out.txt should be open with O_RW|O_DIRECT|O_SYNC

There is the question on how to cope with existing behavior. IMO it
should behave like this:

1) iflag should completely override default O_RDONLY for input open

2) oflag should only overring O_CREAT in default output open flags:
O_RW | O_CREAT | (ddflags & (C_SEEK | C_NOTRUNC) ? 0 : O_TRUNC))
it should become:
O_RW | oflag | (ddflags & (C_SEEK | C_NOTRUNC) ? 0 : O_TRUNC))
with unspecifield oflag being set to O_CREAT

Anyone against adding the feature? I can craft a patch if it is

Emmanuel Dreyfus

Home | Main Index | Thread Index | Old Index