chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Sendfile error on Red Hat 5.5 64 Bit


From: David Krentzlin
Subject: Re: [Chicken-users] Sendfile error on Red Hat 5.5 64 Bit
Date: Thu, 01 Dec 2011 21:38:33 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111124 Thunderbird/8.0

Hello Vok,

thanks for trying this. This really helped. I somehow feared that this would be the case. The problem is that _XOPEN_SOURCE is used to add another define (usally in feature.h) which is then used in bit/fcntl.h to decide if POSIX_FADV_* constants shall be defined.

However the c-file that chicken generates includes chicken.h before any other code so there is no chance for a generated program to add this in front of it, which would fix the problem.

I could set this define directly but i don't know how portable that is.

The code that is affected by all this is not vital for the overall functionality. I've removed that code and released 1.7.14, so that the egg can be installed.

I'll try to find another way to get the feature back later.

Please give 1.7.14 a try and let me know if it works

Cheers David


On 01.12.2011 21:23, Vok Vojwo wrote:
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.







reply via email to

[Prev in Thread] Current Thread [Next in Thread]