只是使用先获取系统调用号
点击(此处)折叠或打开
-
#include <stdio.h>
-
#include <sys/syscall.h>
-
-
-
int main(void)
-
{
-
printf("%d\n", SYS_gettid);
-
return 0;
- }
得到 186
点击(此处)折叠或打开
-
#!/usr/bin/env python
-
-
import threading
-
import os
-
import ctypes
-
def cycle_burner():
-
SYS_gettid = 186
-
libc = ctypes.cdll.LoadLibrary('libc.so.6')
-
tid = libc.syscall(SYS_gettid)
-
print tid
-
while True:
-
meh = 84908230489 % 323422
-
-
for i in range(3):
-
thread = threading.Thread(target=cycle_burner)
-
print "Starting a thread"
- thread.start()