2011/12/1 David Krentzlin<address@hidden>:
Could you please try again the current tip and tell me if it changed?
Also if it didn't change, could you please include your chicken.h in the
probing code and see if it still gets selected?
The chicken header seems to be evil.
This probe disables fadvise:
(define posix-fadvise-test #<<CODE
#define _XOPEN_SOURCE 600
#include<chicken.h>
#include<fcntl.h>
int main(){
int fake_fd = 0;
posix_fadvise(fake_fd,0,0,POSIX_FADV_SEQUENTIAL);
return posix_fadvise(fake_fd,0,0,POSIX_FADV_NOREUSE);
}
CODE
)
Compiles fine but without fadvise.
Switching the order of chicken.h and fcntl.h does not change anything.
If you use gcc -E you can see that the part with the fadvice
definitions gets removed from the bits/fcntl.h header.
But when I write the probe to a single file it compiles fine:
# cat probe.c
#define _XOPEN_SOURCE 600
#include<chicken.h>
#include<fcntl.h>
int main(){
int fake_fd = 0;
posix_fadvise(fake_fd,0,0,POSIX_FADV_SEQUENTIAL);
return posix_fadvise(fake_fd,0,0,POSIX_FADV_NOREUSE);
}
# gcc -c probe.c -fno-strict-aliasing -fwrapv -DHAVE_CHICKEN_CONFIG_H
-DC_ENABLE_PTABLES -Os -fomit-frame-pointer -fPIC -DPIC -DC_SHARED
-I"/usr/local/include/chicken"
# echo $?
0
But when I run the gcc command on sendfile with the _XOPEN_SOURCE
definition it compiles:
# gcc sendfile.c -o sendfile.o -c -fno-strict-aliasing -fwrapv
-DHAVE_CHICKEN_CONFIG_H -DC_ENABLE_PTABLES -Os -fomit-frame-pointer
-fPIC -DPIC -DC_SHARED -I"/usr/local/include/chicken"
-D_XOPEN_SOURCE=600
Without the definition it fails:
# gcc sendfile.c -o sendfile.o -c -fno-strict-aliasing -fwrapv
-DHAVE_CHICKEN_CONFIG_H -DC_ENABLE_PTABLES -Os -fomit-frame-pointer
-fPIC -DPIC -DC_SHARED -I"/usr/local/include/chicken"
sendfile.c: In function `stub205':
sendfile.c:79: error: `POSIX_FADV_SEQUENTIAL' undeclared (first use in
this function)
sendfile.c:79: error: (Each undeclared identifier is reported only once
sendfile.c:79: error: for each function it appears in.)
sendfile.c:79: error: `POSIX_FADV_NOREUSE' undeclared (first use in
this function)
The C file starts with the following lines:
#include "chicken.h"
#define _XOPEN_SOURCE 600
#include<sys/mman.h>
#include<sys/sendfile.h>
#include<fcntl.h>
So the only difference is that the definition is in front of the
chicken header include.
Including chicken.h makes the _XOPEN_SOURCE definition useless if it
is done after the include. Even putting it in the first line of
sendfile.scm does not help, because chicken.h comes always first in
the c file.
The chicken header seems to be broken. If I change my standalone probe
it fails too:
# cat probe.c
#include "chicken.h"
#define _XOPEN_SOURCE 600
#include<fcntl.h>
int main(){
int fake_fd = 0;
posix_fadvise(fake_fd,0,0,POSIX_FADV_SEQUENTIAL);
return posix_fadvise(fake_fd,0,0,POSIX_FADV_NOREUSE);
}
# gcc -c probe.c -fno-strict-aliasing -fwrapv -DHAVE_CHICKEN_CONFIG_H
-DC_ENABLE_PTABLES -Os -fomit-frame-pointer -fPIC -DPIC -DC_SHARED
-I"/usr/local/include/chicken"
probe.c: In function `main':
probe.c:6: error: `POSIX_FADV_SEQUENTIAL' undeclared (first use in
this function)
probe.c:6: error: (Each undeclared identifier is reported only once
probe.c:6: error: for each function it appears in.)
probe.c:7: error: `POSIX_FADV_NOREUSE' undeclared (first use in this function)
Hope this helps.