Solaris pstack输出:“SYS#0”是什么意思?

时间:2009-02-24 21:29:24

标签: debugging gcc solaris

我在堆栈顶部遇到“SYS#0”,找不到任何关于这意味着什么的文档。

  • 编译器:g ++
  • 操作系统:Solaris 9
  • Arch:SPARC
  • 来自Hoard 3.5.1
  • 的内存管理器libhoard_32.so

我们使用“gcore”来生成核心文件。查看针对核心文件运行“pstack”命令的输出,唯一正在做任何有趣事情的线程在其调用堆栈的最顶端有以下内容:

ff309858 SYS#0    ()
ff309848 void MyHashMap<const void*,unsigned,AlignedMmapInstance<65536U>::SourceHeap>::set(const void*,unsigned) (ff31eed4, 9bf20000, 10000, 40, 9bf1fff0, ff31e738) + 134
...
该LWP的pflags显示:

/8:   flags = PR_STOPPED|PR_ISTOP|PR_ASLEEP
why = PR_REQUESTED
sigmask = 0xfffffeff,0x00003fff

我在Sun文档中找不到任何提及此语法的内容。

编辑:在执行gcore之前,该进程似乎已挂起。 “SYS#0”在某种程度上与进程挂起相关吗?

编辑:添加了下一个堆栈框架并链接到Hoard,pflags输出

修改:接受的答案是正确的。此外,至少在SPARC上,g1注册should contain系统调用号,但在我们的核心文件中似乎并非如此。

主题“什么是间接系统调用?”可能是另一个问题的好材料。

1 个答案:

答案 0 :(得分:2)

试试这个:

$ cat foo.c
#include <stdio.h>

int main(int argc, char *argv[]) {

    char buf[1024];
    proc_sysname(0, buf, 1024);
    printf("%s\n", buf);

}
$ gcc -ofoo -lproc foo.c
$ ./foo
SYS#0
$
因此,

SYS#0是表示系统调用零的字符串。如果查看<sys/syscall.h>(系统调用表),您将找到以下内容:

/* syscall enumeration MUST begin with 1 */

/*
 * SunOS/SPARC uses 0 for the indirect system call SYS_syscall
 * but this doesn't count because it is just another way
 * to specify the real system call number.
 */

#define SYS_syscall 0

间接系统调用syscall(SYS_syscall, foo, bar, ...)等同于直接调用syscall(foo, bar, ...)

相关问题