[uClibc]uClibc + kernel 2.0 + busybox -> poll problem

Ken Staton ken_staton at agilent.com
Tue Oct 21 02:36:41 UTC 2003


Giulio Orsero writes:

>On Fri, 4 Jan 2002 08:12:51 -0700, you (Erik Andersen) wrote:
>
> >I assume you have telnet enabled, since that is the only busybox
> >applet that uses poll().
>Actually, no telnet
>I had problems even compiling mkdep
>
>$ which gcc
>/usr/i386-linux2.0-uclibc/bin/gcc
>$ make
>gcc -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -o scripts/mkdep
>scripts/mkdep.c
>/usr/i386-linux2.0-uclibc/lib/libc.so: undefined reference to `poll'
>collect2: ld returned 1 exit status
>make: *** [scripts/mkdep] Error 1
>$
>
> >Checking linux-2.0.38/include/asm-i386/unistd.h (since I see you
> >are using i386) shows that the poll syscall indeed is present in
>Ah, fine. I was using 2.0.33 and now I see this in patch-2.0.36
>
>--- v2.0.35/linux/include/asm-i386/unistd.h Thu Mar 21 22:34:02 1996
>+++ linux/include/asm-i386/unistd.h Sun Nov 15 10:33:16 1998
>@@ -169,6 +169,9 @@
>  #define __NR_sched_rr_get_interval 161
>  #define __NR_nanosleep     162
>  #define __NR_mremap        163
>+#define __NR_poll      168
>+#define __NR_getpmsg       188
>+#define __NR_putpmsg       189

But this just enables poll in uClibc. It doesn't exist in the 2.0 kernel.

glibc emulates poll for 2.0 kernels.

For uClinux, if you copy glibc/sysdeps/unix/bsd/poll.c to
uClibc/libc/sysdeps/linux/common/poll.c
then apply this patch:



--- poll.c      Mon Oct 20 16:23:55 2003
+++ poll-new.c  Mon Oct 20 16:23:39 2003
@@ -25,6 +25,11 @@
  #include <sys/param.h>
  #include <unistd.h>

+/* kls */
+#define __bzero bzero
+#define __select select
+#define __getdtablesize getdtablesize
+
  /* Poll the file descriptors described by the NFDS structures starting at
     FDS.  If TIMEOUT is nonzero and not -1, allow TIMEOUT milliseconds for
     an event to occur; if TIMEOUT is -1, block until an event occurs.



and also apply this patch to uClibc/libc/sysdeps/linux/common/syscalls.c :



--- syscalls.c  Mon Oct 20 16:28:36 2003
+++ syscalls-new.c      Mon Oct 20 16:28:17 2003
@@ -1660,10 +1660,14 @@
  #endif

  //#define __NR_poll                     168
-#if defined(L_poll) && defined(__NR_poll) /* uClinux 2.0 doesn't have poll */
-#include <sys/poll.h>
-_syscall3(int, poll, struct pollfd *, fds, unsigned long int, nfds, int, 
timeout);
-#endif
+#ifdef L_poll /* kls */
+ #if defined(L_poll) && defined(__NR_poll) /* uClinux 2.0 doesn't have poll */
+  #include <sys/poll.h>
+  _syscall3(int, poll, struct pollfd *, fds, unsigned long int, nfds, int, 
timeout);
+ #else /* kls */
+  #include "poll.c" /* kls */
+ #endif
+#endif /* kls */

  //#define __NR_nfsservctl               169
  //nfsservctl   EXTRA   nfsservctl      i:ipp   nfsservctl




then 2.0 kernels will emulate poll() with select().







More information about the uClibc mailing list