public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [Bluez-devel] Bug in compat_ppoll
@ 2008-03-06 16:50 Jose Goncalves
  2008-03-07 14:19 ` Marcel Holtmann
  0 siblings, 1 reply; 3+ messages in thread
From: Jose Goncalves @ 2008-03-06 16:50 UTC (permalink / raw)
  To: bluez-devel

Hi,

When I was cross-compiling Bluez for a system without the ppoll() system
call, I've found a bug on you ppoll() stub, compat_ppoll(), that causes
rfcomm to eat all CPU power when called in this way:

$ rfcomm listen 0 1 <cmd>

After the RFCOMM connection is established and the command is executed
the CPU load reaches 100%.

This patch solved my problem:

diff -Naur bluez-utils-3.27.orig/common/ppoll.h
bluez-utils-3.27/common/ppoll.h
--- bluez-utils-3.27.orig/common/ppoll.h    2007-05-20
09:28:28.000000000 +0100
+++ bluez-utils-3.27/common/ppoll.h 2008-03-06 15:56:02.000000000 +0000
@@ -7,5 +7,10 @@
 static inline int compat_ppoll(struct pollfd *fds, nfds_t nfds,
        const struct timespec *timeout, const sigset_t *sigmask)
 {
-   return poll(fds, nfds, timeout ? timeout->tv_sec * 1000 : 500);
+   if (timeout =3D=3D NULL)
+       return poll(fds, nfds, -1);
+   else if (timeout->tv_sec =3D=3D 0)
+       return poll(fds, nfds, 500);
+   else
+       return poll(fds, nfds, timeout->tv_sec * 1000);
 }

Regards,
Jos=E9 Miguel Gon=E7alves


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-03-07 14:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-06 16:50 [Bluez-devel] Bug in compat_ppoll Jose Goncalves
2008-03-07 14:19 ` Marcel Holtmann
2008-03-07 14:43   ` Jose Goncalves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox