syscalls/set_thread_area01: Refactor into new API
PATCH v5 1/1 syscalls/set_thread_area01: Refactor into new API
From: Ricardo B. Marlière <[email protected]>
---
Changes in v5:
- Rebased now that the prerequisites are merged
- Link to v4: https://lore.kernel.org/r/[email protected]
Changes in v4:
- Added set_thread_area02 to runtest/syscalls
- Added missing static modifiers
- Fixed formatting issue in .bufs
- Removed struct tvariant in set_thread_area02
- Renamed entry -> u_info to follow manpage standard
- Added expected errnos to set_thread_area02 description
- Link to v3: https://lore.kernel.org/r/[email protected]
Changes in v3:
- Moved syscall wrappers to include/lapi/ldt.h
- Split the test into a new set_thread_area02.c file
- Used guarded buffers
- Used .supported_archs instead of #ifdef __i386__
- Used .test_variants and .tcnt+.test in set_thread_area02.c
- Tweaked test decriptions
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- Used tst_test.test_all instead of .test
- Removed VALUE_AND_STRING macro
- Added local wrappers to the syscalls
- Fixed the test description
- Added a comment quote from the set_thread_area manual to add context
- Link to v1: https://lore.kernel.org/all/[email protected]
--- include/lapi/ldt.h | 10 ++ runtest/syscalls | 1 + .../kernel/syscalls/set_thread_area/.gitignore | 3 +- .../syscalls/set_thread_area/set_thread_area.h | 31 ----- .../syscalls/set_thread_area/set_thread_area01.c | 137 +++++++-------------- .../syscalls/set_thread_area/set_thread_area02.c | 57 +++++++++ 6 files changed, 113 insertions(+), 126 deletions(-)
include/lapi/ldt.h +10 -0
@@ -76,4 +76,14 @@ static inline int safe_modify_ldt(const char *file, const int lineno, int func,#define SAFE_MODIFY_LDT (func, ptr, bytecount) \ safe_modify_ldt(__FILE__, __LINE__, (func), (ptr), (bytecount)) +static inline int set_thread_area (const struct user_desc *u_info) +{ +return tst_syscall (__NR_set_thread_area, u_info); +} + +static inline int get_thread_area (const struct user_desc *u_info) +{ +return tst_syscall (__NR_get_thread_area, u_info); +} +#endif /* LAPI_LDT_H__ */
runtest/syscalls +1 -0
@@ -1361,6 +1361,7 @@ set_mempolicy04 set_mempolicy04 set_robust_list01 set_robust_list01 set_thread_area01 set_thread_area01 +set_thread_area02 set_thread_area02 set_tid_address01 set_tid_address01 setdomainname01 setdomainname01
testcases/kernel/syscalls/set_thread_area/.gitignore +2 -1
@@ -1 +1,2 @@ -/set_thread_area01 +set_thread_area01 +set_thread_area02
testcases/kernel/syscalls/set_thread_area/set_thread_area.h deleted +0 -31
@@ -1,31 +0,0 @@ -#include <stdio.h> -#include <errno.h> - -/* Harness Specific Include Files. */ -#include "test.h" -#include "lapi/syscalls.h" -#include "config.h" - -#if definedHAVE_ASM_LDT_H -#include <linux/unistd.h> -#include <asm/ldt.h> - -#if definedHAVE_STRUCT_USER_DESC -typedef struct user_desc thread_area_s ; -#elif definedHAVE_STRUCT_MODIFY_LDT_LDT_S -typedef struct modify_ldt_ldt_s thread_area_s ; -#else -typedef struct user_desc { -unsigned int entry_number; -unsigned long int base_addr; -unsigned int limit; -unsigned int seg_32bit:1 ; -unsigned int contents:2 ; -unsigned int read_exec_only:1 ; -unsigned int limit_in_pages:1 ; -unsigned int seg_not_present:1 ; -unsigned int useable:1 ; -unsigned int empty:25 ; -}thread_area_s ; -#endif /* HAVE_STRUCT_USER_DESC */ -#endif /* HAVE_ASM_LDT_H */
testcases/kernel/syscalls/set_thread_area/set_thread_area01.c +43 -94
154 lines not on this page · raw message
testcases/kernel/syscalls/set_thread_area/set_thread_area02.c new file +57 -0
57 lines not on this page · raw message
---
base-commit: df591113afeb31107bc45bd5ba28a99b556d1028
change-id: 20250623-conversions-set_thread_area-7b82bcf5ee58
Best regards,
Signature · 5 lines
Ricardo B. Marlière <[email protected]> -- Mailing list info: https://lists.linux.it/listinfo/ltp
Hi!
Merged thanks.
- Andrea
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp