Summary:ASTERISK-05401: [patch] getloadavg() not available on uclibc systems
Reporter:capouch (capouch)Labels:
Date Opened:2005-10-30 09:09:53.000-0600Date Closed:2008-01-15 15:53:20.000-0600
Versions:Frequency of
Environment:Attachments:( 0) 20051030__fix_getloadavg.diff.txt
( 1) 20051101__fix_utils_getloadavg.diff.txt
( 2) test_defined.c
Description:FYI I can't find getloadavg in the ulibc libraries on any of my
MIPSEL-based embedded distros.

That causes pbx.c to break in the code for the new option_maxload code. . .

I hotwired the return value for now as a workaround.
Comments:By: Olle Johansson (oej) 2005-10-30 14:23:21.000-0600

Do we have a #define for UCLIB?

By: Mark Spencer (markster) 2005-10-30 14:27:46.000-0600

Does defined(foo) return 1 if foo is a function?

By: Tilghman Lesher (tilghman) 2005-10-31 00:13:46.000-0600

You're right; we'll need to do this with some other define.

By: Mark Spencer (markster) 2005-10-31 00:35:53.000-0600

check dns.c, i think it's used there.

By: hwstar (hwstar) 2005-10-31 12:29:21.000-0600


There is no longer a define for __UCLIBC__ it was removed in a change from 1.6 to 1.7 in DNS.C.

The latest version of dns.c I have access to from where I am at the moment is version 1.19. There is no reference to a UCLIBC or __UCLIBC__ define int that version. There is this instead:

#if defined(res_ninit)
#if 0
#warning "Warning, res_ninit is missing...  Could have reentrancy issues"

I would really like to see a UCLIBC in the makefile to address the missing functions in UCLIBC. What do others think about this? Is there anything I can do to help i.e. come up with a patch, test code, etc?


By: Kevin P. Fleming (kpfleming) 2005-10-31 16:33:42.000-0600

Committed to CVS HEAD with minor mods. Thanks!

By: Tilghman Lesher (tilghman) 2005-11-01 12:17:39.000-0600

Let's make a tiny change to this patch, and change the check to _BSD_SOURCE, since that's always defined when we use getloadavg().  We'll still need a check on the various fringe platforms to make sure they don't also define this.

By: Michael Jerris (mikej) 2005-11-01 12:46:45.000-0600

What is the benefit to that change?  It would seem that would make this less likely to work on diff platforms wouldn't it?

By: Tilghman Lesher (tilghman) 2005-11-01 12:54:25.000-0600

As pointed out in earlier bug notes, "#ifdef getloadavg" doesn't work.

By: Kevin P. Fleming (kpfleming) 2005-11-01 15:34:52.000-0600

Committed to CVS HEAD, seems a much safer way to determine the presence of the function. Thanks!

By: Digium Subversion (svnbot) 2008-01-15 15:52:55.000-0600

Repository: asterisk
Revision: 6903

U   trunk/asterisk.c
U   trunk/utils.c

r6903 | kpfleming | 2008-01-15 15:52:55 -0600 (Tue, 15 Jan 2008) | 2 lines

provide an alternate getloadavg implementation and a fallback for systems that don't have it at all (issue ASTERISK-5401 with minor mods)



By: Digium Subversion (svnbot) 2008-01-15 15:53:20.000-0600

Repository: asterisk
Revision: 6930

U   trunk/ChangeLog
U   trunk/utils.c

r6930 | kpfleming | 2008-01-15 15:53:20 -0600 (Tue, 15 Jan 2008) | 2 lines

issue ASTERISK-5401