试试这个:
$ 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, ...)
.