Lack of system_utsname in recent kernels may prevent some systemtap programs from compiling

Marcin Krol admin@domeny.pl
Sat Dec 1 10:34:00 GMT 2007


Hello everyone,

I think systemtap developers should be notified about this.

I found this note in
http://www.kernel.org/pub/linux/kernel/v2.6/testing/ChangeLog-2.6.19-rc1

commit bf47fdcda65b44dbd674eeedcaa06e0aa28a5a00
Author: Serge E. Hallyn <serue@us.ibm.com>
Date:   Mon Oct 2 02:18:16 2006 -0700

    [PATCH] namespaces: utsname: remove system_utsname

    The system_utsname isn't needed now that kernel/sysctl.c is fixed.
    Nuke it.

    Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
    Cc: Kirill Korotaev <dev@openvz.org>
    Cc: "Eric W. Biederman" <ebiederm@xmission.com>
    Cc: Herbert Poetzl <herbert@13thfloor.at>
    Cc: Andrey Savochkin <saw@sw.ru>
    Signed-off-by: Andrew Morton <akpm@osdl.org>
    Signed-off-by: Linus Torvalds <torvalds@osdl.org>

So it seems system_utsname has been deleted, while when I try to compile
this program (using recent stap compiled from CVS):

% cat embed-C.stp
%{
#include <linux/utsname.h>
%}
function utsname:string (field:long)
%{
  if (down_read_trylock (& uts_sem))
    {
      const char *f =
         (THIS->field == 0 ? system_utsname.sysname :
          THIS->field == 1 ? system_utsname.nodename :
          THIS->field == 2 ? system_utsname.release :
          THIS->field == 3 ? system_utsname.version :
          THIS->field == 4 ? system_utsname.machine :
          THIS->field == 5 ? system_utsname.domainname : "");
      strlcpy (THIS->__retvalue, f, MAXSTRINGLEN);
      up_read (& uts_sem);
    }
%}

probe begin
{
  printf ("%s %s\n", utsname(0), utsname(2))
  exit ()
}


..I get this error:


  gcc -m32
-Wp,-MD,/tmp/stapGhLYIS/.stap_ed44800f988c18de0cf988f48d31c144_853.o.d
-nostdinc -isystem /usr/lib/gcc/i486-linux-gnu/4.1.2/include
-D__KERNEL__ -Iinclude  -include include/linux/autoconf.h -Wall -Wundef
-Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Os
-pipe -msoft-float -mregparm=3 -freg-struct-return
-mpreferred-stack-boundary=2  -march=i686  -mtune=i686 -ffreestanding
-maccumulate-outgoing-args -DCONFIG_AS_CFI=1
-DCONFIG_AS_CFI_SIGNAL_FRAME=1 -Iinclude/asm-i386/mach-default
-fomit-frame-pointer -g  -fno-stack-protector
-Wdeclaration-after-statement -Wno-pointer-sign -freorder-blocks
-Wno-unused -Werror -I"/usr/share/systemtap/runtime"
-DSTAPCONF_INODE_PRIVATE  -DSTAPCONF_CONSTANT_TSC
-DSTAPCONF_KTIME_GET_REAL -DMODULE -D"KBUILD_STR(s)=#s"
-D"KBUILD_BASENAME=KBUILD_STR(stap_ed44800f988c18de0cf988f48d31c144_853)"
-D"KBUILD_MODNAME=KBUILD_STR(stap_ed44800f988c18de0cf988f48d31c144_853)"
-c -o /tmp/stapGhLYIS/.tmp_stap_ed44800f988c18de0cf988f48d31c144_853.o
/tmp/stapGhLYIS/stap_ed44800f988c18de0cf988f48d31c144_853.c
/tmp/stapGhLYIS/stap_ed44800f988c18de0cf988f48d31c144_853.c: In function
'function_utsname':
/tmp/stapGhLYIS/stap_ed44800f988c18de0cf988f48d31c144_853.c:145: error:
'system_utsname' undeclared (first use in this function)
/tmp/stapGhLYIS/stap_ed44800f988c18de0cf988f48d31c144_853.c:145: error:
(Each undeclared identifier is reported only once
/tmp/stapGhLYIS/stap_ed44800f988c18de0cf988f48d31c144_853.c:145: error:
for each function it appears in.)
make[1]: ***
[/tmp/stapGhLYIS/stap_ed44800f988c18de0cf988f48d31c144_853.o] Error 1
make: *** [_module_/tmp/stapGhLYIS] Error 2



--
Marcin Krol






More information about the Systemtap mailing list