[ELDK] ELDK 4.1 (ppc-linux-x86): sysctl missing in glibc

Detlev Zundel dzu at denx.de
Mon Dec 3 17:05:50 CET 2007


Hi Wolfgang,

> In message <m24pf0m0nm.fsf at ohwell.denx.de> you wrote:
>> 
>> > I'm unable to compile lm-sensors (2.10.5) due to a undefined
>> > reference to 'sysctl':
> ...
>> Yep, on first sight, this seems to be really missing in 4.1.  I just
>> checked 4.0 and 4.2 Beta and they are ok.  
>
> That's probably indeed first sight only.

Nope.  Nobody said we cannot access sysctl variables by whatever means
available.  The precise problem was the missing c function.

> for example, the "sysctl" application ("/sbin/sysctl") is working fine
> in ELDk 4.1, too:
>
> 	bash-3.00# sysctl -a
> 	sunrpc.nlm_debug = 0
> 	sunrpc.nfsd_debug = 0
> 	sunrpc.nfs_debug = 0
> 	sunrpc.rpc_debug = 0
> 	abi.fake_utsname = 0
> 	abi.trace = 0
> 	abi.defhandler_libcso = 68157441
> 	abi.defhandler_lcall7 = 68157441
> 	abi.defhandler_elf = 0
> 	abi.defhandler_coff = 117440515
> 	dev.cdrom.check_media = 0
> 	dev.cdrom.lock = 1
> 	...

If you check your example, you will see something along the following lines:

bash-3.00# strace -e file sysctl kernel.ostype
execve("/sbin/sysctl", ["sysctl", "kernel.ostype"], [/* 16 vars */]) = 0
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=12744, ...}) = 0
open("/lib/libproc-3.2.5.so", O_RDONLY) = 3
read(3, "\177ELF\1\2\1\0\0\0\0\0\0\0\0\0\0\3\0\24\0\0\0\1\0\000"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=57840, ...}) = 0
open("/lib/libc.so.6", O_RDONLY)        = 3
read(3, "\177ELF\1\2\1\0\0\0\0\0\0\0\0\0\0\3\0\24\0\0\0\1\0\1\313"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1310552, ...}) = 0
open("/etc/mtab", O_RDONLY)             = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=92, ...}) = 0
read(3, "/dev/nfs / nfs rw 0 0\nnone /proc"..., 8192) = 92
open("/proc/stat", O_RDONLY)            = 3
fstat64(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
read(3, "cpu  50556 0 33797 1392073 437 9"..., 1024) = 379
read(3, "", 1024)                       = 0
stat64("/proc/sys/kernel/ostype", {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
open("/proc/sys/kernel/ostype", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
read(3, "Linux\n", 1024)                = 6
fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(5, 1), ...}) = 0
write(1, "kernel.ostype = Linux\n", 22kernel.ostype = Linux) = 22
read(3, "", 1024)                       = 0
bash-3.00#

i.e., the "sysctl" program follows the advise I included:

>> BUGS
>>    The object names vary between kernel versions.  THIS MAKES THIS
>>    SYSTEM CALL WORTHLESS FOR APPLICATIONS.  Use the /proc/sys
                                               ^^^^^^^^^^^^^^^^^
>>    interface instead.  Not all available objects are properly
      ^^^^^^^^^^^^^^^^^
>>    documented.  It is not yet possible to change operating system by
>>    writing to /proc/sys/kernel/ostype.

But that wasn't the original question...

Cheers
  Detlev

PS: Wolfgang can you please fix your mail setup?  Rewriting the
    mailing list address is a nuisance that prevented my first reply
    to reach the list and that I am sure others will fall into soon
    enough also.  Thanks.

-- 
... does Linux have a better [security] track record than MS? Damn right it
does. We've had fewer problems, and I think there are more people out there
standing up for what's right anyway. Less PR people deathly afraid of rocking
the boat. Better technology, and fewer horrid design mistakes. [Linus Torvalds]
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de


More information about the eldk mailing list