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

Re: epoll_create1() available in C, not C++ (on alpha)?


By private mail, I got the suggestion that maybe Alpha's epoll.h lacks
"extern C"; I diff'd the two files and that's not the case.  However,
I did find the following:

On Alpha:

/* Same as epoll_create but with an additional FLAGS parameter.  */
extern int epoll_create2 (int __size, int __flags) __THROW;


/* Same as epoll_create but with an FLAGS parameter.  The unused SIZE
   parameter has been dropped.  */
extern int epoll_create1 (int __flags) __THROW;

And, in fact, epoll_create2() does not exist.  I changed the
test code to "... int fd = epoll_create2(0,0);" and the Alpha
machine fails to compile:

gcc try-epoll.c 
/tmp/cckkq2Mc.o: In function `main':
(.text+0x2c): undefined reference to `epoll_create2'

> I've boiled it down to the following test code:
>   #include <sys/epoll.h>
>   int main(int ac, char* av[])
>   {
>       int fd = epoll_create1(0);
>       return 0;
>   }
> This can be successfully compiled using "gcc" on both alpha (tested in sid chroot of albeniz.debian.org) and on my amd64 machine.

It turns out that the only reason it "works" on Alpha is due
to C's rules for implict function definition:

  gcc -Wall try-epoll.c 
  try-epoll.c: In function ~main~:
  try-epoll.c:5: warning: implicit declaration of function ~epoll_create1~

This looks like a bug in glibc, specifically that the following patch
was never applied:


Attachment: signature.asc
Description: Digital signature

Reply to: