public inbox for libc-ports@sourceware.org
 help / color / mirror / Atom feed
* Remove __ASSUME_VFORK_SYSCALL (and some __NR_vfork conditionals)
@ 2012-07-25 22:19 Joseph S. Myers
  2012-07-25 22:45 ` Roland McGrath
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Joseph S. Myers @ 2012-07-25 22:19 UTC (permalink / raw)
  To: libc-alpha, libc-ports; +Cc: Andreas Schwab, Ryan S. Arnold

The __ASSUME_VFORK_SYSCALL macro is only used in architecture-specific
.S sources, and now defined for all kernel versions on the three
architectures with such sources using the macro (i386, powerpc, m68k).
Thus it is redundant and can be removed.  Furthermore, the __NR_vfork
conditionals in those same sources are also redundant relics of old
kernel support, since the __NR_vfork macro is defined for those
architectures as of 2.6.19.1 (the earliest kernel headers version now
supported).

Thus I propose this patch to remove __ASSUME_VFORK_SYSCALL, and the
redundant __NR_vfork conditionals in the files being changed.  Tested
x86.  Could powerpc and m68k maintainers review / test the changes to
their ports?

(The present sequence of patches aims at removing the __ASSUME_* form
of support for kernels before, in the end, 2.6.16, with __NR_*
conditionals being removed only incidentally to the __ASSUME_*
conditionals removal.  But I might look for unnecessary __NR_*
conditionals later and would certainly encourage port maintainers to
clean them up in their ports - I've done so myself for ARM and MIPS.
If the __NR_* macro is present by 2.6.19.1, for all architectures
using a given file (directly or indirectly), then the conditionals on
that macro being defined are not needed in that file.)

2012-07-25  Joseph Myers  <joseph@codesourcery.com>

	* sysdeps/unix/sysv/linux/kernel-features.h
	(__ASSUME_VFORK_SYSCALL): Remove all definitions.
	* sysdeps/unix/sysv/linux/i386/vfork.S (__vfork) [__NR_vfork]:
	Make code unconditional.
	(__vfork) [__ASSUME_VFORK_SYSCALL]: Likewise.
	(__vfork) [!__ASSUME_VFORK_SYSCALL]: Remove conditional code.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S (__vfork)
	[__NR_vfork]: Make code unconditional.
	(__vfork) [__ASSUME_VFORK_SYSCALL]: Likewise.
	(__vfork) [!__ASSUME_VFORK_SYSCALL]: Remove conditional code.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/vfork.S (__vfork)
	[__NR_vfork]: Make code unconditional.
	(__vfork) [__ASSUME_VFORK_SYSCALL]: Likewise.
	(__vfork) [!__ASSUME_VFORK_SYSCALL]: Remove conditional code.

ports/ChangeLog.arm:
2012-07-25  Joseph Myers  <joseph@codesourcery.com>

	* sysdeps/unix/sysv/linux/arm/kernel-features.h
	(__ASSUME_VFORK_SYSCALL: Remove.

ports/ChangeLog.m68k:
2012-07-25  Joseph Myers  <joseph@codesourcery.com>

	* sysdeps/unix/sysv/linux/m68k/kernel-features.h
	(__ASSUME_VFORK_SYSCALL): Remove.
	* sysdeps/unix/sysv/linux/m68k/vfork.S (__vfork) [__NR_vfork]:
	Make code unconditional.
	(__vfork) [__ASSUME_VFORK_SYSCALL]: Likewise.
	(__vfork) [!__ASSUME_VFORK_SYSCALL]: Remove conditional code.

diff --git a/ports/sysdeps/unix/sysv/linux/arm/kernel-features.h b/ports/sysdeps/unix/sysv/linux/arm/kernel-features.h
index 9092df7..0ab5df0 100644
--- a/ports/sysdeps/unix/sysv/linux/arm/kernel-features.h
+++ b/ports/sysdeps/unix/sysv/linux/arm/kernel-features.h
@@ -30,9 +30,6 @@
 /* Arm got fcntl64 in 2.4.4.  */
 #define __ASSUME_FCNTL64		1
 
-/* The vfork syscall on arm was definitely available in 2.4.  */
-#define __ASSUME_VFORK_SYSCALL		1
-
 /* The signal frame layout changed in 2.6.18.  */
 #if __LINUX_KERNEL_VERSION >= 132626
 # define __ASSUME_SIGFRAME_V2	1
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/ports/sysdeps/unix/sysv/linux/m68k/kernel-features.h
index 3b0b441..05d06b2 100644
--- a/ports/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/ports/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -21,7 +21,6 @@
 #define __ASSUME_MMAP2_SYSCALL		1
 #define __ASSUME_STAT64_SYSCALL	1
 #define __ASSUME_FCNTL64		1
-#define __ASSUME_VFORK_SYSCALL		1
 
 /* Many syscalls were added in 2.6.10 for m68k.  */
 #if __LINUX_KERNEL_VERSION >= 132618
diff --git a/ports/sysdeps/unix/sysv/linux/m68k/vfork.S b/ports/sysdeps/unix/sysv/linux/m68k/vfork.S
index 24e0c90..d3e20d4 100644
--- a/ports/sysdeps/unix/sysv/linux/m68k/vfork.S
+++ b/ports/sysdeps/unix/sysv/linux/m68k/vfork.S
@@ -36,8 +36,6 @@
 
 ENTRY (__vfork)
 
-#ifdef __NR_vfork
-
 	/* SAVE_PID clobbers call-clobbered registers and
 	   saves data in D1 and A1.  */
 
@@ -66,27 +64,8 @@ ENTRY (__vfork)
 	cfi_adjust_cfa_offset (4)
 	cfi_rel_offset (%pc, 0)
 
-# ifdef __ASSUME_VFORK_SYSCALL
-#  ifndef PIC
+#ifndef PIC
 	jbra	SYSCALL_ERROR_LABEL
-#  endif
-# else
-	/* Check if vfork syscall is known at all.  */
-	movel	#-ENOSYS,%d1
-	cmpl	%d0,%d1
-	jne	SYSCALL_ERROR_LABEL
-
-# endif
-#endif
-
-#ifndef __ASSUME_VFORK_SYSCALL
-	/* If we don't have vfork, fork is close enough.  */
-
-	movel	#SYS_ify (fork), %d0
-	trap	#0
-	tstl	%d0
-	jmi	SYSCALL_ERROR_LABEL
-	rts
 #endif
 
 PSEUDO_END (__vfork)
diff --git a/sysdeps/unix/sysv/linux/i386/vfork.S b/sysdeps/unix/sysv/linux/i386/vfork.S
index a8a7e45..11c530d 100644
--- a/sysdeps/unix/sysv/linux/i386/vfork.S
+++ b/sysdeps/unix/sysv/linux/i386/vfork.S
@@ -28,8 +28,6 @@
 
 ENTRY (__vfork)
 
-#ifdef __NR_vfork
-
 	/* Pop the return PC value into ECX.  */
 	popl	%ecx
 	cfi_adjust_cfa_offset (-4)
@@ -55,31 +53,10 @@ ENTRY (__vfork)
 
 	cmpl	$-4095, %eax
 	/* Branch forward if it failed.  */
-# ifdef __ASSUME_VFORK_SYSCALL
 	jae	SYSCALL_ERROR_LABEL
-# else
-	jae	.Lerror
-# endif
 
 	ret
 
-# ifndef __ASSUME_VFORK_SYSCALL
-.Lerror:
-	/* Check if vfork syscall is known at all.  */
-	cmpl	$-ENOSYS, %eax
-	jne	SYSCALL_ERROR_LABEL
-# endif
-#endif
-
-#ifndef __ASSUME_VFORK_SYSCALL
-	/* If we don't have vfork, fork is close enough.  */
-
-	movl	$SYS_ify (fork), %eax
-	int	$0x80
-	cmpl	$-4095, %eax
-	jae	SYSCALL_ERROR_LABEL
-	ret
-#endif
 PSEUDO_END (__vfork)
 libc_hidden_def (__vfork)
 
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index cfe335d..7357165 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -100,12 +100,6 @@
    MIPS n32).  */
 #define __ASSUME_GETDENTS64_SYSCALL	1
 
-/* Starting with 2.4.5 kernels the vfork syscall made it into the
-   official kernel for PPC.  */
-#ifdef __powerpc__
-# define __ASSUME_VFORK_SYSCALL		1
-#endif
-
 /* Starting with 2.4.5 kernels the mmap2 syscall made it into the official
    kernel.  But PowerPC64 does not support a separate MMAP2 call.  */
 #if defined __powerpc__ && !defined __powerpc64__
@@ -118,11 +112,6 @@
 # define __ASSUME_SET_THREAD_AREA_SYSCALL	1
 #endif
 
-/* The vfork syscall on x86 and arm was definitely available in 2.4.  */
-#ifdef __i386__
-# define __ASSUME_VFORK_SYSCALL		1
-#endif
-
 /* The late 2.5 kernels saw a lot of new CLONE_* flags.  Summarize
    their availability with one define.  The changes were made first
    for i386 and the have to be done separately for the other archs.
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S b/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S
index 6625e20..ca20f7b 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -26,32 +26,8 @@
    and the process ID of the new process to the old process.  */
 
 ENTRY (__vfork)
-
-#ifdef __NR_vfork
-
 	DO_CALL (SYS_ify (vfork))
-
-# ifdef __ASSUME_VFORK_SYSCALL
 	PSEUDO_RET
-# else
-	bnslr+
-	/* Check if vfork syscall is known at all.  */
-	cmpwi	r3,ENOSYS
-	bne-	.Lsyscall_error
-
-# endif
-#endif
-
-#ifndef __ASSUME_VFORK_SYSCALL
-	/* If we don't have vfork, fork is close enough.  */
-
-	DO_CALL (SYS_ify (fork))
-	bnslr+
-
-.Lsyscall_error:
-	b	__syscall_error@local
-#endif
-
 PSEUDO_END (__vfork)
 libc_hidden_def (__vfork)
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/vfork.S b/sysdeps/unix/sysv/linux/powerpc/powerpc64/vfork.S
index 7baefd0..3ce38be 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/vfork.S
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/vfork.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -27,29 +27,8 @@
 
 ENTRY (__vfork)
 	CALL_MCOUNT 0
-
-#ifdef __NR_vfork
-
 	DO_CALL (SYS_ify (vfork))
-
-# ifdef __ASSUME_VFORK_SYSCALL
-	PSEUDO_RET
-# else
-	bnslr+
-	/* Check if vfork syscall is known at all.  */
-	cmpdi	r3,ENOSYS
-	bne	.Local_syscall_error
-
-# endif
-#endif
-
-#ifndef __ASSUME_VFORK_SYSCALL
-	/* If we don't have vfork, fork is close enough.  */
-
-	DO_CALL (SYS_ify (fork))
 	PSEUDO_RET
-#endif
-
 PSEUDO_END (__vfork)
 libc_hidden_def (__vfork)
 

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Remove __ASSUME_VFORK_SYSCALL (and some __NR_vfork conditionals)
  2012-07-25 22:19 Remove __ASSUME_VFORK_SYSCALL (and some __NR_vfork conditionals) Joseph S. Myers
@ 2012-07-25 22:45 ` Roland McGrath
  2012-07-26  7:09 ` Andreas Schwab
  2012-08-01 20:34 ` Ryan S. Arnold
  2 siblings, 0 replies; 4+ messages in thread
From: Roland McGrath @ 2012-07-25 22:45 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: libc-alpha, libc-ports, Andreas Schwab, Ryan S. Arnold

Looks fine to me.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Remove __ASSUME_VFORK_SYSCALL (and some __NR_vfork conditionals)
  2012-07-25 22:19 Remove __ASSUME_VFORK_SYSCALL (and some __NR_vfork conditionals) Joseph S. Myers
  2012-07-25 22:45 ` Roland McGrath
@ 2012-07-26  7:09 ` Andreas Schwab
  2012-08-01 20:34 ` Ryan S. Arnold
  2 siblings, 0 replies; 4+ messages in thread
From: Andreas Schwab @ 2012-07-26  7:09 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: libc-alpha, libc-ports, Ryan S. Arnold

"Joseph S. Myers" <joseph@codesourcery.com> writes:

> ports/ChangeLog.m68k:
> 2012-07-25  Joseph Myers  <joseph@codesourcery.com>
>
> 	* sysdeps/unix/sysv/linux/m68k/kernel-features.h
> 	(__ASSUME_VFORK_SYSCALL): Remove.
> 	* sysdeps/unix/sysv/linux/m68k/vfork.S (__vfork) [__NR_vfork]:
> 	Make code unconditional.
> 	(__vfork) [__ASSUME_VFORK_SYSCALL]: Likewise.
> 	(__vfork) [!__ASSUME_VFORK_SYSCALL]: Remove conditional code.

OK.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Remove __ASSUME_VFORK_SYSCALL (and some __NR_vfork conditionals)
  2012-07-25 22:19 Remove __ASSUME_VFORK_SYSCALL (and some __NR_vfork conditionals) Joseph S. Myers
  2012-07-25 22:45 ` Roland McGrath
  2012-07-26  7:09 ` Andreas Schwab
@ 2012-08-01 20:34 ` Ryan S. Arnold
  2 siblings, 0 replies; 4+ messages in thread
From: Ryan S. Arnold @ 2012-08-01 20:34 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: libc-alpha, libc-ports

On Wed, Jul 25, 2012 at 5:19 PM, Joseph S. Myers
<joseph@codesourcery.com> wrote:
> The __ASSUME_VFORK_SYSCALL macro is only used in architecture-specific
> .S sources, and now defined for all kernel versions on the three
> architectures with such sources using the macro (i386, powerpc, m68k).
> Thus it is redundant and can be removed.  Furthermore, the __NR_vfork
> conditionals in those same sources are also redundant relics of old
> kernel support, since the __NR_vfork macro is defined for those
> architectures as of 2.6.19.1 (the earliest kernel headers version now
> supported).
>
> Thus I propose this patch to remove __ASSUME_VFORK_SYSCALL, and the
> redundant __NR_vfork conditionals in the files being changed.  Tested
> x86.  Could powerpc and m68k maintainers review / test the changes to
> their ports?
>
> (The present sequence of patches aims at removing the __ASSUME_* form
> of support for kernels before, in the end, 2.6.16, with __NR_*
> conditionals being removed only incidentally to the __ASSUME_*
> conditionals removal.  But I might look for unnecessary __NR_*
> conditionals later and would certainly encourage port maintainers to
> clean them up in their ports - I've done so myself for ARM and MIPS.
> If the __NR_* macro is present by 2.6.19.1, for all architectures
> using a given file (directly or indirectly), then the conditionals on
> that macro being defined are not needed in that file.)
>
> 2012-07-25  Joseph Myers  <joseph@codesourcery.com>
>
>         * sysdeps/unix/sysv/linux/kernel-features.h
>         (__ASSUME_VFORK_SYSCALL): Remove all definitions.
>         * sysdeps/unix/sysv/linux/i386/vfork.S (__vfork) [__NR_vfork]:
>         Make code unconditional.
>         (__vfork) [__ASSUME_VFORK_SYSCALL]: Likewise.
>         (__vfork) [!__ASSUME_VFORK_SYSCALL]: Remove conditional code.
>         * sysdeps/unix/sysv/linux/powerpc/powerpc32/vfork.S (__vfork)
>         [__NR_vfork]: Make code unconditional.
>         (__vfork) [__ASSUME_VFORK_SYSCALL]: Likewise.
>         (__vfork) [!__ASSUME_VFORK_SYSCALL]: Remove conditional code.
>         * sysdeps/unix/sysv/linux/powerpc/powerpc64/vfork.S (__vfork)
>         [__NR_vfork]: Make code unconditional.
>         (__vfork) [__ASSUME_VFORK_SYSCALL]: Likewise.
>         (__vfork) [!__ASSUME_VFORK_SYSCALL]: Remove conditional code.
>
> ports/ChangeLog.arm:
> 2012-07-25  Joseph Myers  <joseph@codesourcery.com>
>
>         * sysdeps/unix/sysv/linux/arm/kernel-features.h
>         (__ASSUME_VFORK_SYSCALL: Remove.
>
> ports/ChangeLog.m68k:
> 2012-07-25  Joseph Myers  <joseph@codesourcery.com>
>
>         * sysdeps/unix/sysv/linux/m68k/kernel-features.h
>         (__ASSUME_VFORK_SYSCALL): Remove.
>         * sysdeps/unix/sysv/linux/m68k/vfork.S (__vfork) [__NR_vfork]:
>         Make code unconditional.
>         (__vfork) [__ASSUME_VFORK_SYSCALL]: Likewise.
>         (__vfork) [!__ASSUME_VFORK_SYSCALL]: Remove conditional code.

Tested on powerpc32 and powerpc64 and no new regressions were identified.

Ryan S. Arnold

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-08-01 20:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-25 22:19 Remove __ASSUME_VFORK_SYSCALL (and some __NR_vfork conditionals) Joseph S. Myers
2012-07-25 22:45 ` Roland McGrath
2012-07-26  7:09 ` Andreas Schwab
2012-08-01 20:34 ` Ryan S. Arnold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).