paessler-win8开发者预览版
![sigsuspend](/uploads/image/0124.jpg)
2023年4月1日发(作者:如何恢复回收站删除的文件)
linux下syscall函数(pid,tid)
NAME
syscall-间接系统调⽤
SYNOPSIS
#define_GNU_SOURCE
#include
#include/*ForSYS_xxxdefinitions*/
intsyscall(intnumber,...);
DESCRIPTION
syscall()执⾏⼀个系统调⽤,根据指定的参数number和所有系统调⽤的汇编语⾔接⼝来确定调⽤哪个系统调⽤。
系统调⽤所使⽤的符号常量可以在头⽂件⾥⾯找到。
/***************************************************************************************************************************************************/
Linux中,每个进程有⼀个pid,类型pid_t,由getpid()取得。Linux下的POSIX线程也有⼀个id,类型pthread_t,由pthread_self()
取得,该id由线程库维护,其id空间是各个进程独⽴的(即不同进程中的线程可能有相同的id)。Linux中的POSIX线程库实现的线程其实
也是⼀个进程(LWP),只是该进程与主进程(启动线程的进程)共享⼀些资源⽽已,⽐如代码段,数据段等。
有时候我们可能需要知道线程的真实pid。⽐如进程P1要向另外⼀个进程P2中的某个线程发送信号时,既不能使⽤P2的pid,更不能使⽤线
程的pthreadid,⽽只能使⽤该线程的真实pid,称为tid。
有⼀个函数gettid()可以得到tid,但glibc并没有实现该函数,只能通过Linux的系统调⽤syscall来获取。
测试实例:
#include
#include
#include
#include
#include
#include
int
main(intargc,char*argv[])
{
pid_ttid;
tid=syscall(SYS_gettid);
printf("tid:%dn",tid);
tid=syscall(SYS_tgkill,getpid(),tid,SIGHUP);
printf("tid:%d...n",tid);
}
1./*Generatedatlibcbuildtimefromkernelsyscalllist.*/
2.
3.#ifndef_SYSCALL_H
4.#error"Neverusedirectly;includeinstead."
5.#endif
6.
7.#include
8.
9.#defineSYS__sysctl__NR__sysctl
10.#defineSYS_access__NR_access
11.#defineSYS_acct__NR_acct
12.#defineSYS_add_key__NR_add_key
13.#defineSYS_adjtimex__NR_adjtimex
14.#defineSYS_afs_syscall__NR_afs_syscall
15.#defineSYS_alarm__NR_alarm
16.#defineSYS_brk__NR_brk
17.#defineSYS_capget__NR_capget
18.#defineSYS_capset__NR_capset
19.#defineSYS_chdir__NR_chdir
20.#defineSYS_chmod__NR_chmod
21.#defineSYS_chown__NR_chown
22.#defineSYS_chroot__NR_chroot
23.#defineSYS_clock_getres__NR_clock_getres
24.#defineSYS_clock_gettime__NR_clock_gettime
25.#defineSYS_clock_nanosleep__NR_clock_nanosleep
26.#defineSYS_clock_settime__NR_clock_settime
27.#defineSYS_clone__NR_clone
28.#defineSYS_close__NR_close
29.#defineSYS_creat__NR_creat
30.#defineSYS_create_module__NR_create_module
31.#defineSYS_delete_module__NR_delete_module
32.#defineSYS_dup__NR_dup
33.#defineSYS_dup2__NR_dup2
34.#defineSYS_epoll_create__NR_epoll_create
35.#defineSYS_epoll_ctl__NR_epoll_ctl
36.#defineSYS_epoll_wait__NR_epoll_wait
37.#defineSYS_eventfd__NR_eventfd
38.#defineSYS_execve__NR_execve
39.#defineSYS_exit__NR_exit
40.#defineSYS_exit_group__NR_exit_group
41.#defineSYS_faccessat__NR_faccessat
42.#defineSYS_fadvise64__NR_fadvise64
43.#defineSYS_fallocate__NR_fallocate
44.#defineSYS_fchdir__NR_fchdir
45.#defineSYS_fchmod__NR_fchmod
46.#defineSYS_fchmodat__NR_fchmodat
47.#defineSYS_fchown__NR_fchown
48.#defineSYS_fchownat__NR_fchownat
49.#defineSYS_fcntl__NR_fcntl
50.#defineSYS_fdatasync__NR_fdatasync
51.#defineSYS_fgetxattr__NR_fgetxattr
52.#defineSYS_flistxattr__NR_flistxattr
53.#defineSYS_flock__NR_flock
54.#defineSYS_fork__NR_fork
55.#defineSYS_fremovexattr__NR_fremovexattr
56.#defineSYS_fsetxattr__NR_fsetxattr
57.#defineSYS_fstat__NR_fstat
58.#defineSYS_fstatfs__NR_fstatfs
59.#defineSYS_fsync__NR_fsync
60.#defineSYS_ftruncate__NR_ftruncate
61.#defineSYS_futex__NR_futex
62.#defineSYS_futimesat__NR_futimesat
63.#defineSYS_get_kernel_syms__NR_get_kernel_syms
64.#defineSYS_get_mempolicy__NR_get_mempolicy
65.#defineSYS_get_robust_list__NR_get_robust_list
66.#defineSYS_get_thread_area__NR_get_thread_area
67.#defineSYS_getcwd__NR_getcwd
68.#defineSYS_getdents__NR_getdents
69.#defineSYS_getdents64__NR_getdents64
70.#defineSYS_getegid__NR_getegid
71.#defineSYS_geteuid__NR_geteuid
72.#defineSYS_getgid__NR_getgid
73.#defineSYS_getgroups__NR_getgroups
74.#defineSYS_getitimer__NR_getitimer
75.#defineSYS_getpgid__NR_getpgid
76.#defineSYS_getpgrp__NR_getpgrp
77.#defineSYS_getpid__NR_getpid
78.#defineSYS_getpmsg__NR_getpmsg
79.#defineSYS_getppid__NR_getppid
80.#defineSYS_getpriority__NR_getpriority
81.#defineSYS_getresgid__NR_getresgid
82.#defineSYS_getresuid__NR_getresuid
83.#defineSYS_getrlimit__NR_getrlimit
84.#defineSYS_getrusage__NR_getrusage
85.#defineSYS_getsid__NR_getsid
86.#defineSYS_gettid__NR_gettid
87.#defineSYS_gettimeofday__NR_gettimeofday
88.#defineSYS_getuid__NR_getuid
89.#defineSYS_getxattr__NR_getxattr
90.#defineSYS_init_module__NR_init_module
91.#defineSYS_inotify_add_watch__NR_inotify_add_watch
92.#defineSYS_inotify_init__NR_inotify_init
93.#defineSYS_inotify_rm_watch__NR_inotify_rm_watch
94.#defineSYS_io_cancel__NR_io_cancel
95.#defineSYS_io_destroy__NR_io_destroy
96.#defineSYS_io_getevents__NR_io_getevents
97.#defineSYS_io_setup__NR_io_setup
98.#defineSYS_io_submit__NR_io_submit
99.#defineSYS_ioctl__NR_ioctl
100.#defineSYS_ioperm__NR_ioperm
101.#defineSYS_iopl__NR_iopl
102.#defineSYS_ioprio_get__NR_ioprio_get
103.#defineSYS_ioprio_set__NR_ioprio_set
104.#defineSYS_kexec_load__NR_kexec_load
105.#defineSYS_keyctl__NR_keyctl
106.#defineSYS_kill__NR_kill
107.#defineSYS_lchown__NR_lchown
108.#defineSYS_lgetxattr__NR_lgetxattr
109.#defineSYS_link__NR_link
110.#defineSYS_linkat__NR_linkat
111.#defineSYS_listxattr__NR_listxattr
112.#defineSYS_llistxattr__NR_llistxattr
113.#defineSYS_lookup_dcookie__NR_lookup_dcookie
114.#defineSYS_lremovexattr__NR_lremovexattr
115.#defineSYS_lseek__NR_lseek
116.#defineSYS_lsetxattr__NR_lsetxattr
117.#defineSYS_lstat__NR_lstat
118.#defineSYS_madvise__NR_madvise
119.#defineSYS_mbind__NR_mbind
120.#defineSYS_migrate_pages__NR_migrate_pages
121.#defineSYS_mincore__NR_mincore
122.#defineSYS_mkdir__NR_mkdir
123.#defineSYS_mkdirat__NR_mkdirat
124.#defineSYS_mknod__NR_mknod
125.#defineSYS_mknodat__NR_mknodat
126.#defineSYS_mlock__NR_mlock
127.#defineSYS_mlockall__NR_mlockall
128.#defineSYS_mmap__NR_mmap
129.#defineSYS_modify_ldt__NR_modify_ldt
130.#defineSYS_mount__NR_mount
131.#defineSYS_move_pages__NR_move_pages
132.#defineSYS_mprotect__NR_mprotect
133.#defineSYS_mq_getsetattr__NR_mq_getsetattr
134.#defineSYS_mq_notify__NR_mq_notify
135.#defineSYS_mq_open__NR_mq_open
136.#defineSYS_mq_timedreceive__NR_mq_timedreceive
137.#defineSYS_mq_timedsend__NR_mq_timedsend
138.#defineSYS_mq_unlink__NR_mq_unlink
139.#defineSYS_mremap__NR_mremap
140.#defineSYS_msync__NR_msync
141.#defineSYS_munlock__NR_munlock
142.#defineSYS_munlockall__NR_munlockall
143.#defineSYS_munmap__NR_munmap
144.#defineSYS_nanosleep__NR_nanosleep
145.#defineSYS_nfsservctl__NR_nfsservctl
146.#defineSYS_open__NR_open
147.#defineSYS_openat__NR_openat
148.#defineSYS_pause__NR_pause
149.#defineSYS_personality__NR_personality
150.#defineSYS_pipe__NR_pipe
151.#defineSYS_pivot_root__NR_pivot_root
152.#defineSYS_poll__NR_poll
153.#defineSYS_ppoll__NR_ppoll
154.#defineSYS_prctl__NR_prctl
155.#defineSYS_pread64__NR_pread64
156.#defineSYS_pselect6__NR_pselect6
157.#defineSYS_ptrace__NR_ptrace
158.#defineSYS_putpmsg__NR_putpmsg
159.#defineSYS_pwrite64__NR_pwrite64
160.#defineSYS_query_module__NR_query_module
161.#defineSYS_quotactl__NR_quotactl
162.#defineSYS_read__NR_read
163.#defineSYS_readahead__NR_readahead
164.#defineSYS_readlink__NR_readlink
165.#defineSYS_readlinkat__NR_readlinkat
166.#defineSYS_readv__NR_readv
167.#defineSYS_reboot__NR_reboot
168.#defineSYS_remap_file_pages__NR_remap_file_pages
169.#defineSYS_removexattr__NR_removexattr
170.#defineSYS_rename__NR_rename
171.#defineSYS_renameat__NR_renameat
172.#defineSYS_request_key__NR_request_key
173.#defineSYS_restart_syscall__NR_restart_syscall
174.#defineSYS_rmdir__NR_rmdir
175.#defineSYS_rt_sigaction__NR_rt_sigaction
176.#defineSYS_rt_sigpending__NR_rt_sigpending
177.#defineSYS_rt_sigprocmask__NR_rt_sigprocmask
178.#defineSYS_rt_sigqueueinfo__NR_rt_sigqueueinfo
179.#defineSYS_rt_sigreturn__NR_rt_sigreturn
180.#defineSYS_rt_sigsuspend__NR_rt_sigsuspend
181.#defineSYS_rt_sigtimedwait__NR_rt_sigtimedwait
182.#defineSYS_sched_get_priority_max__NR_sched_get_priority_max
183.#defineSYS_sched_get_priority_min__NR_sched_get_priority_min
184.#defineSYS_sched_getaffinity__NR_sched_getaffinity
185.#defineSYS_sched_getparam__NR_sched_getparam
186.#defineSYS_sched_getscheduler__NR_sched_getscheduler
187.#defineSYS_sched_rr_get_interval__NR_sched_rr_get_interval
188.#defineSYS_sched_setaffinity__NR_sched_setaffinity
189.#defineSYS_sched_setparam__NR_sched_setparam
190.#defineSYS_sched_setscheduler__NR_sched_setscheduler
191.#defineSYS_sched_yield__NR_sched_yield
192.#defineSYS_select__NR_select
193.#defineSYS_sendfile__NR_sendfile
194.#defineSYS_set_mempolicy__NR_set_mempolicy
195.#defineSYS_set_robust_list__NR_set_robust_list
196.#defineSYS_set_thread_area__NR_set_thread_area
197.#defineSYS_set_tid_address__NR_set_tid_address
198.#defineSYS_setdomainname__NR_setdomainname
199.#defineSYS_setfsgid__NR_setfsgid
200.#defineSYS_setfsuid__NR_setfsuid
201.#defineSYS_setgid__NR_setgid
202.#defineSYS_setgroups__NR_setgroups
203.#defineSYS_sethostname__NR_sethostname
204.#defineSYS_setitimer__NR_setitimer
205.#defineSYS_setpgid__NR_setpgid
206.#defineSYS_setpriority__NR_setpriority
207.#defineSYS_setregid__NR_setregid
208.#defineSYS_setresgid__NR_setresgid
209.#defineSYS_setresuid__NR_setresuid
210.#defineSYS_setreuid__NR_setreuid
211.#defineSYS_setrlimit__NR_setrlimit
212.#defineSYS_setsid__NR_setsid
213.#defineSYS_settimeofday__NR_settimeofday
214.#defineSYS_setuid__NR_setuid
215.#defineSYS_setxattr__NR_setxattr
216.#defineSYS_sigaltstack__NR_sigaltstack
217.#defineSYS_splice__NR_splice
218.#defineSYS_stat__NR_stat
219.#defineSYS_statfs__NR_statfs
220.#defineSYS_swapoff__NR_swapoff
221.#defineSYS_swapon__NR_swapon
222.#defineSYS_symlink__NR_symlink
223.#defineSYS_symlinkat__NR_symlinkat
224.#defineSYS_sync__NR_sync
225.#defineSYS_sync_file_range__NR_sync_file_range
226.#defineSYS_sysfs__NR_sysfs
227.#defineSYS_sysinfo__NR_sysinfo
228.#defineSYS_syslog__NR_syslog
229.#defineSYS_tee__NR_tee
230.#defineSYS_tgkill__NR_tgkill
231.#defineSYS_time__NR_time
232.#defineSYS_timer_create__NR_timer_create
233.#defineSYS_timer_delete__NR_timer_delete
234.#defineSYS_timer_getoverrun__NR_timer_getoverrun
235.#defineSYS_timer_gettime__NR_timer_gettime
236.#defineSYS_timer_settime__NR_timer_settime
237.#defineSYS_times__NR_times
238.#defineSYS_tkill__NR_tkill
239.#defineSYS_truncate__NR_truncate
240.#defineSYS_umask__NR_umask
241.#defineSYS_umount2__NR_umount2
242.#defineSYS_uname__NR_uname
243.#defineSYS_unlink__NR_unlink
244.#defineSYS_unlinkat__NR_unlinkat
245.#defineSYS_unshare__NR_unshare
246.#defineSYS_uselib__NR_uselib
247.#defineSYS_ustat__NR_ustat
248.#defineSYS_utime__NR_utime
249.#defineSYS_utimes__NR_utimes
250.#defineSYS_vfork__NR_vfork
251.#defineSYS_vhangup__NR_vhangup
252.#defineSYS_vmsplice__NR_vmsplice
253.#defineSYS_vserver__NR_vserver
254.#defineSYS_wait4__NR_wait4
255.#defineSYS_waitid__NR_waitid
256.#defineSYS_write__NR_write
257.#defineSYS_writev__NR_writev
258.#if__WORDSIZE==64
259.#defineSYS_accept__NR_accept
260.#defineSYS_arch_prctl__NR_arch_prctl
261.#defineSYS_bind__NR_bind
262.#defineSYS_connect__NR_connect
263.#defineSYS_epoll_ctl_old__NR_epoll_ctl_old
264.#defineSYS_epoll_pwait__NR_epoll_pwait
265.#defineSYS_epoll_wait_old__NR_epoll_wait_old
266.#defineSYS_getpeername__NR_getpeername
267.#defineSYS_getsockname__NR_getsockname
268.#defineSYS_getsockopt__NR_getsockopt
269.#defineSYS_listen__NR_listen
270.#defineSYS_msgctl__NR_msgctl
271.#defineSYS_msgget__NR_msgget
272.#defineSYS_msgrcv__NR_msgrcv
273.#defineSYS_msgsnd__NR_msgsnd
274.#defineSYS_newfstatat__NR_newfstatat
275.#defineSYS_recvfrom__NR_recvfrom
276.#defineSYS_recvmsg__NR_recvmsg
277.#defineSYS_security__NR_security
278.#defineSYS_semctl__NR_semctl
279.#defineSYS_semget__NR_semget
280.#defineSYS_semop__NR_semop
281.#defineSYS_semtimedop__NR_semtimedop
282.#defineSYS_sendmsg__NR_sendmsg
283.#defineSYS_sendto__NR_sendto
284.#defineSYS_setsockopt__NR_setsockopt
285.#defineSYS_shmat__NR_shmat
286.#defineSYS_shmctl__NR_shmctl
287.#defineSYS_shmdt__NR_shmdt
288.#defineSYS_shmget__NR_shmget
289.#defineSYS_shutdown__NR_shutdown
290.#defineSYS_signalfd__NR_signalfd
291.#defineSYS_socket__NR_socket
292.#defineSYS_socketpair__NR_socketpair
293.#defineSYS_timerfd_create__NR_timerfd_create
294.#defineSYS_tuxcall__NR_tuxcall
295.#defineSYS_utimensat__NR_utimensat
296.#else
297.#defineSYS__llseek__NR__llseek
298.#defineSYS__newselect__NR__newselect
299.#defineSYS_bdflush__NR_bdflush
300.#defineSYS_break__NR_break
301.#defineSYS_chown32__NR_chown32
302.#defineSYS_fadvise64_64__NR_fadvise64_64
303.#defineSYS_fchown32__NR_fchown32
304.#defineSYS_fcntl64__NR_fcntl64
305.#defineSYS_fstat64__NR_fstat64
306.#defineSYS_fstatat64__NR_fstatat64
307.#defineSYS_fstatfs64__NR_fstatfs64
308.#defineSYS_ftime__NR_ftime
309.#defineSYS_ftruncate64__NR_ftruncate64
310.#defineSYS_getcpu__NR_getcpu
311.#defineSYS_getegid32__NR_getegid32
312.#defineSYS_geteuid32__NR_geteuid32
313.#defineSYS_getgid32__NR_getgid32
314.#defineSYS_getgroups32__NR_getgroups32
315.#defineSYS_getresgid32__NR_getresgid32
316.#defineSYS_getresuid32__NR_getresuid32
317.#defineSYS_getuid32__NR_getuid32
318.#defineSYS_gtty__NR_gtty
319.#defineSYS_idle__NR_idle
320.#defineSYS_ipc__NR_ipc
321.#defineSYS_lchown32__NR_lchown32
322.#defineSYS_lock__NR_lock
323.#defineSYS_lstat64__NR_lstat64
324.#defineSYS_madvise1__NR_madvise1
325.#defineSYS_mmap2__NR_mmap2
326.#defineSYS_mpx__NR_mpx
327.#defineSYS_nice__NR_nice
328.#defineSYS_oldfstat__NR_oldfstat
329.#defineSYS_oldlstat__NR_oldlstat
330.#defineSYS_oldolduname__NR_oldolduname
331.#defineSYS_oldstat__NR_oldstat
332.#defineSYS_olduname__NR_olduname
333.#defineSYS_prof__NR_prof
334.#defineSYS_profil__NR_profil
335.#defineSYS_readdir__NR_readdir
336.#defineSYS_sendfile64__NR_sendfile64
337.#defineSYS_setfsgid32__NR_setfsgid32
338.#defineSYS_setfsuid32__NR_setfsuid32
339.#defineSYS_setgid32__NR_setgid32
340.#defineSYS_setgroups32__NR_setgroups32
341.#defineSYS_setregid32__NR_setregid32
342.#defineSYS_setresgid32__NR_setresgid32
343.#defineSYS_setresuid32__NR_setresuid32
344.#defineSYS_setreuid32__NR_setreuid32
345.#defineSYS_setuid32__NR_setuid32
346.#defineSYS_sgetmask__NR_sgetmask
347.#defineSYS_sigaction__NR_sigaction
348.#defineSYS_signal__NR_signal
349.#defineSYS_sigpending__NR_sigpending
350.#defineSYS_sigprocmask__NR_sigprocmask
351.#defineSYS_sigreturn__NR_sigreturn
352.#defineSYS_sigsuspend__NR_sigsuspend
353.#defineSYS_socketcall__NR_socketcall
354.#defineSYS_ssetmask__NR_ssetmask
355.#defineSYS_stat64__NR_stat64
356.#defineSYS_statfs64__NR_statfs64
357.#defineSYS_stime__NR_stime
358.#defineSYS_stty__NR_stty
359.#defineSYS_truncate64__NR_truncate64
360.#defineSYS_ugetrlimit__NR_ugetrlimit
361.#defineSYS_ulimit__NR_ulimit
362.#defineSYS_umount__NR_umount
363.#defineSYS_vm86__NR_vm86
364.#defineSYS_vm86old__NR_vm86old
365.#defineSYS_waitpid__NR_waitpid
366.#endif
更多推荐
sigsuspend
发布评论