Bug in compat_ppoll
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 [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Marcel Holtmann
maintainerHi Jose,
Quoted 10 lines
When I was cross-compiling Bluez for a system without the
ppoll()system call, I've found a bug on youppoll()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:
your patch has been applied. Thanks.
I was actually considering to simply fail compilation on systems that don't support ppoll().
Regards
Marcel
-------------------------------------------------------------------------
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 [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel
Quoted 17 lines · Marcel Holtmann
Hi Jose,
=
Quoted 11 lines
When I was cross-compiling Bluez for a system without the
ppoll()system call, I've found a bug on youppoll()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:
=
Quoted 6 lines
your patch has been applied. Thanks.
I was actually considering to simply fail compilation on systems that don't support
ppoll().=
I don't think that is such a good idea because there are still several embedded systems that use an old Linux kernel or an old Glibc (that's my case, I'm using Glibc 2.3.6 on my board).
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 [email protected]
https://lists.sourceforge.net/lists/listinfo/bluez-devel