Shouldn't this use MAP_ANON and an fd arg of -1 rather than explicitly opening /dev/zero? One less thing to go wrong, two less statements and syscalls, typically.
Also, why ask for just one byte, since you presumably get a whole page anyway? Why not explicitly ask for enough to hold the largest fundamental type? If people are going to do something stupid like this, they might well be dereferencing _any_ sort of pointer, not just char *. Obviously that could be a pointer to a struct or whatever too, but that's an open-ended situation, wherein trying to anticipate the scope of the foolishness leads to madness. Granted though that passing a NULL to something expecting a string is perhaps the most common, and [EMAIL PROTECTED] at least allows one to work around that. And I remember that SVR2 on e.g. the AT&T 3B15 allowed dereferencing at least a NULL char *, but I don't remember whether that bad precedent was only intended to apply to char * (and presumably, _optional_ backwards compatibility with an existing (if evil) precedent is as much reason as any for this monstrosity). Again, I don't know if it makes any _practical_ difference, esp. if the entire page is zero-filled regardless. But _if_ it is no more unreasonable to allow [EMAIL PROTECTED] to enable dereferencing any a NULL pointer to any fundamental type, that might as well be explicit in the code. This message posted from opensolaris.org _______________________________________________ opensolaris-code mailing list [email protected] http://mail.opensolaris.org/mailman/listinfo/opensolaris-code
