diff mbox

[uclibc-ng-devel,3/3] arc: clone: Simplify CLONE_THREAD detection

Message ID 1469783840-10472-4-git-send-email-abrodkin@synopsys.com
State Accepted
Headers show

Commit Message

Alexey Brodkin July 29, 2016, 9:17 a.m. UTC
This change was inspired by similar change in glibc:
https://sourceware.org/git/?p=glibc.git;a=commit;h=0cb313f7cb0e418b3d56f3a2ac69790522ab825d

Current Linux kernel requires CLONE_VM to be set with CLONE_THREAD
otherwise returning -EINVAL, see man clone2. This means we don't need
to check for both CLONE_THREAD and CLONE_VM instead we may simplify
code a lot and just check 1 bit (CLONE_THREAD).

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Acked-by: Vineet Gupta <vgupta@synopsys.com>
---
 libc/sysdeps/linux/arc/clone.S | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
diff mbox

Patch

diff --git a/libc/sysdeps/linux/arc/clone.S b/libc/sysdeps/linux/arc/clone.S
index fc8dfcf..3942b88 100644
--- a/libc/sysdeps/linux/arc/clone.S
+++ b/libc/sysdeps/linux/arc/clone.S
@@ -27,10 +27,7 @@ 
 ;		void *tls,
 ;		int __user *child_tidptr)
 
-#define CLONE_VM		0x00000100
-#define CLONE_THREAD		0x00010000
 #define CLONE_SETTLS		0x00080000
-#define CLONE_THREAD_N_VM	(CLONE_THREAD | CLONE_VM)
 
 ENTRY(clone)
 	cmp	r0, 0		; @fn can't be NULL
@@ -68,9 +65,7 @@  ENTRY(clone)
 
 .Lnext_clone_quirk:
 #ifdef RESET_PID
-	mov_s	r2, CLONE_THREAD_N_VM
-	and_s	r12, r12, r2
-	breq	r2, r12, .Lgo_thread
+	bbit1	r12, 16, .Lgo_thread	; CLONE_THREAD = (1 << 16)
 
 	mov	r8, __NR_getpid
 	ARC_TRAP_INSN		; r0 has PID