1 |
After upgrading my kernel from 2.6.18 -> 2.6.19 I notice that sysctl(2) |
2 |
seems to be - err - returning different (incorrect) data. |
3 |
|
4 |
for instance consider the simple test program to read kernel.shmmax (see |
5 |
end of mail): |
6 |
|
7 |
2.6.18 |
8 |
------ |
9 |
|
10 |
$ cat /proc/sys/kernel/shmmax |
11 |
536870912 |
12 |
|
13 |
$ ./sysctltest |
14 |
sysctl retrieved shmmax=536870912 |
15 |
|
16 |
2.6.19 |
17 |
------ |
18 |
|
19 |
$ cat /proc/sys/kernel/shmmax |
20 |
536870912 |
21 |
|
22 |
$ ./sysctltest |
23 |
sysctl retrieved shmmax=3086684148 |
24 |
^^^^^^^^^^ |
25 |
|
26 |
Doing some diffing between 2.6.18 and 2.6.19 sources reveals: |
27 |
|
28 |
*** linux-2.6.18-gentoo-r3/kernel/sysctl.c Tue Nov 28 19:04:35 2006 |
29 |
--- linux-2.6.19-gentoo-r2/kernel/sysctl.c Tue Dec 26 20:04:30 2006 |
30 |
|
31 |
*** 455,... **** |
32 |
{ |
33 |
.ctl_name = KERN_SHMMAX, |
34 |
.procname = "shmmax", |
35 |
! .data = &shm_ctlmax, |
36 |
.maxlen = sizeof (size_t), |
37 |
.mode = 0644, |
38 |
! .proc_handler = &proc_doulongvec_minmax, |
39 |
}, |
40 |
--- 504,... ---- |
41 |
{ |
42 |
.ctl_name = KERN_SHMMAX, |
43 |
.procname = "shmmax", |
44 |
! .data = NULL, |
45 |
.maxlen = sizeof (size_t), |
46 |
.mode = 0644, |
47 |
! .proc_handler = &proc_do_ipc_string, |
48 |
}, |
49 |
|
50 |
However this is all in the implementation, so I'm thinking it should be |
51 |
"transparent" to userland programs... the various .h headers seem the |
52 |
same with respect to shmmax (particularly numbers for CTL_KERN and |
53 |
KERN_SHMMAX are unchanged!). Any ideas? (Should this be raised as a |
54 |
bug?). FWIW my linux headers are 2.6.17-r2. |
55 |
|
56 |
Cheers |
57 |
|
58 |
Mark |
59 |
|
60 |
|
61 |
-----------------------------test-program--------------------------- |
62 |
/* |
63 |
* sysctltest.c : sample to test sysctl call behaviour change |
64 |
2.6.18->2.6.19 |
65 |
*/ |
66 |
#include <stdio.h> |
67 |
#include <linux/unistd.h> |
68 |
#include <linux/types.h> |
69 |
#include <sys/sysctl.h> |
70 |
|
71 |
#define SIZE(x) sizeof(x)/sizeof(x[0]) /* number of elements */ |
72 |
|
73 |
|
74 |
int |
75 |
main(int argc, char **argv) { |
76 |
|
77 |
size_t len; |
78 |
unsigned long shmmax; |
79 |
int sysctlvect[] = { CTL_KERN, KERN_SHMMAX }; |
80 |
|
81 |
len = sizeof(shmmax); |
82 |
|
83 |
if (sysctl(sysctlvect, SIZE(sysctlvect), &(shmmax), &len, 0, 0)) { |
84 |
printf("sysctl failed getting shmmax\n"); |
85 |
return 1; |
86 |
} else { |
87 |
printf("sysctl retrieved shmmax=%lu\n", shmmax); |
88 |
return 0; |
89 |
} |
90 |
|
91 |
} |
92 |
|
93 |
---------------------------emerge-info--------------------------------- |
94 |
|
95 |
Gentoo Base System version 1.12.6 |
96 |
Portage 2.1.1-r2 (default-linux/x86/2006.0, gcc-4.1.1, glibc-2.4-r4, |
97 |
2.6.19-gentoo-r2 i686) |
98 |
================================================================= |
99 |
System uname: 2.6.19-gentoo-r2 i686 Intel(R) Pentium(R) III CPU family |
100 |
1266MHz |
101 |
Last Sync: Tue, 26 Dec 2006 06:30:02 +0000 |
102 |
app-admin/eselect-compiler: [Not Present] |
103 |
dev-java/java-config: 1.3.7, 2.0.30 |
104 |
dev-lang/python: 2.4.3-r4 |
105 |
dev-python/pycrypto: 2.0.1-r5 |
106 |
dev-util/ccache: [Not Present] |
107 |
dev-util/confcache: [Not Present] |
108 |
sys-apps/sandbox: 1.2.17 |
109 |
sys-devel/autoconf: 2.13, 2.60 |
110 |
sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2 |
111 |
sys-devel/binutils: 2.16.1-r3 |
112 |
sys-devel/gcc-config: 1.3.14 |
113 |
sys-devel/libtool: 1.5.22 |
114 |
virtual/os-headers: 2.6.17-r2 |
115 |
ACCEPT_KEYWORDS="x86" |
116 |
AUTOCLEAN="yes" |
117 |
CBUILD="i686-pc-linux-gnu" |
118 |
CFLAGS="-O2 -march=i686 -pipe" |
119 |
CHOST="i686-pc-linux-gnu" |
120 |
CONFIG_PROTECT="/etc /usr/share/X11/xkb" |
121 |
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf |
122 |
/etc/java-config/vms/ /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c" |
123 |
CXXFLAGS="-O2 -march=i686 -pipe" |
124 |
DISTDIR="/usr/portage/distfiles" |
125 |
FEATURES="autoconfig distlocks metadata-transfer sandbox sfperms strict" |
126 |
GENTOO_MIRRORS="http://public.planetmirror.com/pub/gentoo/ |
127 |
ftp://ftp.planetmirror.com/pub/gentoo/ |
128 |
http://mirror.pacific.net.au/linux/Gentoo |
129 |
ftp://mirror.pacific.net.au/linux/Gentoo " |
130 |
PKGDIR="/usr/portage/packages" |
131 |
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times |
132 |
--compress --force --whole-file --delete --delete-after --stats |
133 |
--timeout=180 --exclude='/distfiles' --exclude='/local' |
134 |
--exclude='/packages'" |
135 |
PORTAGE_TMPDIR="/var/tmp" |
136 |
PORTDIR="/usr/portage" |
137 |
SYNC="rsync://rsync.gentoo.org/gentoo-portage" |
138 |
USE="x86 X alsa alsa_cards_ali5451 alsa_cards_als4000 alsa_cards_atiixp |
139 |
alsa_cards_atiixp-modem alsa_cards_bt87x alsa_cards_ca0106 |
140 |
alsa_cards_cmipci alsa_cards_emu10k1x alsa_cards_ens1370 |
141 |
alsa_cards_ens1371 alsa_cards_es1938 alsa_cards_es1968 alsa_cards_fm801 |
142 |
alsa_cards_hda-intel alsa_cards_intel8x0 alsa_cards_intel8x0m |
143 |
alsa_cards_maestro3 alsa_cards_trident alsa_cards_usb-audio |
144 |
alsa_cards_via82xx alsa_cards_via82xx-modem alsa_cards_ymfpci |
145 |
alsa_pcm_plugins_adpcm alsa_pcm_plugins_alaw alsa_pcm_plugins_asym |
146 |
alsa_pcm_plugins_copy alsa_pcm_plugins_dmix alsa_pcm_plugins_dshare |
147 |
alsa_pcm_plugins_dsnoop alsa_pcm_plugins_empty alsa_pcm_plugins_extplug |
148 |
alsa_pcm_plugins_file alsa_pcm_plugins_hooks alsa_pcm_plugins_iec958 |
149 |
alsa_pcm_plugins_ioplug alsa_pcm_plugins_ladspa alsa_pcm_plugins_lfloat |
150 |
alsa_pcm_plugins_linear alsa_pcm_plugins_meter alsa_pcm_plugins_mulaw |
151 |
alsa_pcm_plugins_multi alsa_pcm_plugins_null alsa_pcm_plugins_plug |
152 |
alsa_pcm_plugins_rate alsa_pcm_plugins_route alsa_pcm_plugins_share |
153 |
alsa_pcm_plugins_shm alsa_pcm_plugins_softvol apache2 apm arts berkdb |
154 |
bitmap-fonts cdr cli cracklib crypt cups dlloader dri dvd eds |
155 |
elibc_glibc emboss encode esd foomaticdb fortran gdbm gif gpm gstreamer |
156 |
gtk2 iconv imlib input_devices_evdev input_devices_keyboard |
157 |
input_devices_mouse ipv6 isdnlog jpeg kde kernel_linux libg++ libwww mad |
158 |
mikmod motif mp3 mpeg ncurses nls nptl nptlonly ogg opengl oss pam pcre |
159 |
perl png pppd python qt qt3 qt4 quicktime readline reflection sdl |
160 |
session spell spl ssl tcpd truetype truetype-fonts type1-fonts udev |
161 |
userland_GNU video_cards_apm video_cards_ark video_cards_ati |
162 |
video_cards_chips video_cards_cirrus video_cards_cyrix video_cards_dummy |
163 |
video_cards_fbdev video_cards_glint video_cards_i128 video_cards_i740 |
164 |
video_cards_i810 video_cards_imstt video_cards_mga video_cards_neomagic |
165 |
video_cards_nsc video_cards_nv video_cards_rendition video_cards_s3 |
166 |
video_cards_s3virge video_cards_savage video_cards_siliconmotion |
167 |
video_cards_sis video_cards_sisusb video_cards_tdfx video_cards_tga |
168 |
video_cards_trident video_cards_tseng video_cards_v4l video_cards_vesa |
169 |
video_cards_vga video_cards_via video_cards_vmware video_cards_voodoo |
170 |
vorbis xml xorg xv zlib" |
171 |
Unset: CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, |
172 |
LDFLAGS, LINGUAS, MAKEOPTS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY |
173 |
|
174 |
-- |
175 |
gentoo-user@g.o mailing list |