|
From: | Emmet Ford |
Subject: | [Pgubook-readers] .equ O_CREAT_WRONLY_TRUNC, 03101 |
Date: | Sun, 22 Feb 2004 17:21:22 -0500 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040119 |
In toupper.c in chapter 5, we have: .equ O_CREAT_WRONLY_TRUNC, 03101This is preceded by a comment inviting the reader to see /usr/include/asm/fcntl.h for other options to the open system call. I went and looked at /usr/include/asm/fcntl.h, using the opportunity to OR together O_CREAT, O_WRONLY and O_TRUNC. But I did not get 03101. Instead, I came up with 01101. The only way I was able to arrive at 03101 was to OR in O_APPEND on top of O_CREAT, O_WRONLY and O_TRUNC.
I gather that tossing in an extraneous O_APPEND doesn't do any harm, as it appears to get trumped by O_TRUNC, but it doesn't seem like a good thing to be doing on general principle. One could conceive of an implementation of the open system call that takes exception to such a combination. Unless, of course, I've totally missed the boat on this one.
I am enjoying this book. It's very interesting that the author has managed to put off the obligatory discussion of number systems to chapter 10.
--Emmet Ford
[Prev in Thread] | Current Thread | [Next in Thread] |