Would O_APPEND for /dev/null be possible?
Bryan Drewery
bdrewery at FreeBSD.org
Wed Aug 9 20:02:37 UTC 2017
On 8/7/2017 2:36 PM, Steffen Nurpmeso wrote:
> I can open a file with "a+", which, for this software, means
> "O_RDWR | O_APPEND | O_CREAT | n_O_NOFOLLOW" on Linux, Solaris and
> OpenBSD, but FreeBSD complains, i think because O_APPEND. (I
> think only because the VM does not survive resumes and other
> pauses here, which frustrated me over time. It is old VM.)
> I mean, it seems i have to sprinkle more /dev/null string
> comparisons all over the place, but i wonder whether that really
> belongs there.. for /dev/null?
> # cat uh.c
> #include <err.h>
> #include <fcntl.h>
>
> int main() {
> int fd;
>
> fd = open("/dev/null", O_RDWR | O_APPEND | O_CREAT | O_NOFOLLOW);
> if (fd == -1)
> err(1, "open");
> return 0;
> }
> # truss ./uh
...
> openat(AT_FDCWD,"/dev/null",O_RDWR|O_APPEND|O_NOFOLLOW|O_CREAT,037777762520) = 3 (0x3)
Seems to work fine.
--
Regards,
Bryan Drewery
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-current/attachments/20170809/3ae58cea/attachment.sig>
More information about the freebsd-current
mailing list