Re: [suse-programming-e] glibc curiosity
On Fri, Nov 15, Jesse Marlin wrote:
Michael Fischer writes:
I am developing an app under SuSE 7.1 at work, and discovered that in order to get mmap(2) with MAP_ANON, I had to #define __USE_MISC. (I peeked in <bits/types.h>)
I compiled this program fine on a SuSE 7.2 box. The sys/mman.h header looks like it pulls in bits/mman.h where it is defined on my box. They appear to be mapped like any of the other flags. Maybe the headers have been fixed/changed since then.
#include <unistd.h> #include <sys/mman.h>
int main (int argc, char **argv) { void *start; mmap (start, 512, PROT_READ, MAP_ANON, 2, 0); return 0; }
Interesting, I tried it at home (SuSE 8.0) and it does indeed do just fine... hmm. I suppose I'll have to take Phillip Thomas' advice, and test for defined'ness of certain values, and #define _{BSD,SVID}_SOURCE accordingly. Thanks. Michael -- Michael Fischer Happiness is a config option. michael@visv.net Recompile and be happy.
Michael Fischer <michael@visv.net> [Fri, 15 Nov 2002 13:51:59 -0500]:
do just fine... hmm. I suppose I'll have to take Phillip Thomas' advice, and test for defined'ness of certain values, and #define _{BSD,SVID}_SOURCE accordingly.
Those tests would have to be done in something like configure because you have to define those _*_SOURCE before you include the first system header. So in most cases they will be defined either via the -D compiler switch or in a configuration header that gets included before everything else. Philipp -- Philipp Thomas work: pthomas@suse.de Development SuSE Linux AG private: pth@t-link.de
participants (2)
-
Michael Fischer
-
Philipp Thomas