内容简介
#include <linux/futex.h> #include <syscall.h> long get_robust_list(int pid, struct robust_list_head **head_ptr, %uA0%uA0%uA0%uA0%uA0%uA0%uA0%uA0%uA0%uA0%uA0%uA0%uA0%uA0%uA0%uA0%uA0%uA0%uA0%uA0%uA0%uA0%uA0%uA0 size_t * long set_robust_list(struct robust_list_head *head, size_t len) |
描述
The robust futex implementation needs to maintain per-thread lists of robust futexes which are unlocked when the thread exits. These lists are managed in user space, the kernel is only notified about the location of the head of the list.get_robust_list%uA0returns the head of the robust futex list of the thread with TID defined by the%uA0pid%uA0argument. If%uA0pid%uA0is 0, the returned head belongs to the current thread.head_ptr%uA0is the pointer to the head of the list of robust futexes. The%uA0get_robust_listfunction stores the address of the head of the list here.%uA0len_ptr%uA0is the pointer to the length variable.%uA0get_robust_list%uA0stores%uA0sizeof(**head_ptr)%uA0here.
set_robust_list%uA0sets the head of the list of robust futexes owned by the current thread to%uA0head.%uA0len%uA0is the size of%uA0*head.
%uA0
返回值
The%uA0set_robust_list%uA0and%uA0get_robust_list%uA0functions return zero when the operation is successful, an error code otherwise.%uA0
错误
The%uA0set_robust_list%uA0function fails with%uA0EINVAL%uA0if the%uA0len%uA0value does not match the size of structure%uA0struct robust_list_head%uA0expected by kernel.The%uA0get_robust_list%uA0function fails with%uA0EPERM%uA0if the current process does not have permission to see the robust futex list of the thread with the TID%uA0pid,%uA0ESRCH%uA0if a thread with the TID%uA0pid%uA0does not exist, or%uA0EFAULT%uA0if the head of the robust futex list can’t be stored in the space specified by the%uA0head%uA0argument.
%uA0
实际应用信息
一个线程只能有一个强大的 futex 清单,因此希望使用该功能的应用程序应该使用的glibc提供强大的互斥体。系统调用是唯一可用于调试目的,不正常操作所需的。
这两个系统调用是不提供给应用程序的功能,他们可以使用%uA0syscall(3)函数被调用。
%uA0
另请参阅
-
%uA0