#include #include void fun() { static int ls_pid1 = 0; // 初始化为0 int pid1 = syscall(SYS_gettid); ls_pid1 = pid1; printf("%d\n", ls_pid1); } int main() { int pid = syscall(SYS_gettid); static int ls_pid = 1; // 初始化非0 ls_pid = pid; printf("%d\n", ls_pid); fun(); return 0; }