[cups.development] [RFE] STR #2598: Old Linux kernels have no epoll but glibc may have the function...

Jon Peatfield jp107 at cam.ac.uk
Wed Nov 14 15:31:48 PST 2007


DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Not cups fault of course but in case it bites anyone else building
cups-1.3.x on older Linux boxes it might be worth adding a note somewhere.

Currently (well in cups-1.3.4 anyway) config-scripts/cups-poll.m4 checks
for the existance of epoll_create() in libc by linking code using it, but
can't tell if the kernel actually implements the functions or not.

On old Linux systems like RHEL-3 epoll_create() and friends exist in glibc
but attempting to call them results in the calls returning ENOSYS.  e.g.
cups built this way and run under strace shows:

....
epoll_create(1024)                = -1 ENOSYS (Function not implemented)
....
epoll_ctl(-1, EPOLL_CTL_ADD, 3, {EPOLLIN, {u32=138576320,
  u64=41663880149238208}}) = -1 ENOSYS (Function not implemented)
....
(etc - cups tries several other epoll_* things before realizing that it
has failed)

This leads to cups logging:

  X [14/Nov/2007:22:15:07 +0000] cupsdDoSelect() failed - Function not
implemented!

and exiting.

Clearly those few of us with ancient machines (where for whatever reasons
we want to try something newer than cups-1.1.x), can disable the test for
epoll_create() easily enough.

This STR is mainly so anyone else looking for why it doesn't build/work
out-of-the-box can find a quick hack sooner rather than having to
understand autoconf.  Bonus marks if anyone can be bothered to make
autoconf check calling epoll_create after it has linked against it with
AC_CHECK_FUNC().

Obviously this patch should NOT be actually applied except on things where
epoll only half exists!

I suppose that cups scheduler/select.c ought to check the return values
from the epoll_create() etc calls, they could fail even on systems where
the kernel implements them.

>From the epoll_create() man page:

....
RETURN VALUE
       When successful, epoll_create(2) returns a non-negative integer
identifying  the
       descriptor.   When  an error occurs, epoll_create(2) returns -1 and
errno is set
       appropriately.

ERRORS
       EINVAL size is not positive.


       ENFILE The system limit on the  total  number  of  open  files  has
 been
              reached.

       ENOMEM There was insufficient memory to create the kernel object.

CONFORMING TO
       epoll_create(2)  is  a  new  API  introduced in Linux kernel
2.5.44.  The
       interface should be finalized by Linux kernel 2.5.66.
....

(and similar for epoll_wait, epoll_ctl etc).

 -- Jon

Link: http://www.cups.org/str.php?L2598
Version:  -feature





More information about the cups-devel mailing list