mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
selftests/bpf: Move sys_pidfd_open() into task_local_storage_helpers.h
sys_pidfd_open() is defined twice in both test_bprm_opts.c and test_local_storage.c, so move it to a common header file. And it will be used in map_tests as well. Signed-off-by: Hou Tao <houtao1@huawei.com> Acked-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/r/20220901061938.3789460-4-houtao@huaweicloud.com Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
This commit is contained in:
parent
c89e843a11
commit
c710136e87
3 changed files with 20 additions and 18 deletions
|
@ -9,18 +9,10 @@
|
|||
|
||||
#include "bprm_opts.skel.h"
|
||||
#include "network_helpers.h"
|
||||
|
||||
#ifndef __NR_pidfd_open
|
||||
#define __NR_pidfd_open 434
|
||||
#endif
|
||||
#include "task_local_storage_helpers.h"
|
||||
|
||||
static const char * const bash_envp[] = { "TMPDIR=shouldnotbeset", NULL };
|
||||
|
||||
static inline int sys_pidfd_open(pid_t pid, unsigned int flags)
|
||||
{
|
||||
return syscall(__NR_pidfd_open, pid, flags);
|
||||
}
|
||||
|
||||
static int update_storage(int map_fd, int secureexec)
|
||||
{
|
||||
int task_fd, ret = 0;
|
||||
|
|
|
@ -11,15 +11,7 @@
|
|||
|
||||
#include "local_storage.skel.h"
|
||||
#include "network_helpers.h"
|
||||
|
||||
#ifndef __NR_pidfd_open
|
||||
#define __NR_pidfd_open 434
|
||||
#endif
|
||||
|
||||
static inline int sys_pidfd_open(pid_t pid, unsigned int flags)
|
||||
{
|
||||
return syscall(__NR_pidfd_open, pid, flags);
|
||||
}
|
||||
#include "task_local_storage_helpers.h"
|
||||
|
||||
static unsigned int duration;
|
||||
|
||||
|
|
18
tools/testing/selftests/bpf/task_local_storage_helpers.h
Normal file
18
tools/testing/selftests/bpf/task_local_storage_helpers.h
Normal file
|
@ -0,0 +1,18 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef __TASK_LOCAL_STORAGE_HELPER_H
|
||||
#define __TASK_LOCAL_STORAGE_HELPER_H
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifndef __NR_pidfd_open
|
||||
#define __NR_pidfd_open 434
|
||||
#endif
|
||||
|
||||
static inline int sys_pidfd_open(pid_t pid, unsigned int flags)
|
||||
{
|
||||
return syscall(__NR_pidfd_open, pid, flags);
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue