This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] vfork for s390*


Hi,
Jakub found another bug for s390. The vfork system isn't used at all.
Since the s390 linux kernels always had the vfork system call we
don't need a fallback to fork and can just add vfork to the syscalls.list
We do need a vfork.S for the linuxthreads though to check for
the SINGLE_THREAD_P special case.

blue skies,
  Martin.

libc/ChangeLog:
2003-01-10  Martin Schwidefsky  <schwidefsky@de.ibm.com>

	* sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list: Add vfork.
	* sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list: Add vfork.

linuxthreads/ChangeLog:
2003-01-10  Martin Schwidefsky  <schwidefsky@de.ibm.com>

	* sysdeps/unix/sysv/linux/s390/s390-32/vfork.S: New file.
	* sysdeps/unix/sysv/linux/s390/s390-64/vfork.S: New file.

diff -urN libc/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-32/vfork.S libc-s390/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-32/vfork.S
--- libc/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-32/vfork.S	Thu Jan  1 01:00:00 1970
+++ libc-s390/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-32/vfork.S	Fri Jan 10 15:57:22 2003
@@ -0,0 +1,54 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep-cancel.h>
+#define _ERRNO_H	1
+#include <bits/errno.h>
+
+/* Clone the calling process, but without copying the whole address space.
+   The calling process is suspended until the new process exits or is
+   replaced by a call to `execve'.  Return -1 for errors, 0 to the new process,
+   and the process ID of the new process to the old process.  */
+
+ENTRY (__vfork)
+	SINGLE_THREAD_P
+	jne	0f
+
+	/* Do vfork system call.  */
+	svc	SYS_ify (vfork)
+
+	/* Check for error.  */
+	lhi	%r4,-4095
+	clr	%r2,%r4
+	jnl	SYSCALL_ERROR_LABEL
+
+	/* Normal return.  */
+	br	%r14
+0:
+	basr	%r1,0
+1:
+	l	%r1,2f-1b(%r1)
+	br	%r1
+2:
+	.long	HIDDEN_JUMPTARGET(__fork)
+PSEUDO_END(__vfork)
+
+libc_hidden_def (__vfork)
+
+weak_alias (__vfork, vfork)
diff -urN libc/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/vfork.S libc-s390/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/vfork.S
--- libc/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/vfork.S	Thu Jan  1 01:00:00 1970
+++ libc-s390/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/vfork.S	Fri Jan 10 15:58:16 2003
@@ -0,0 +1,47 @@
+/* Copyright (C) 2003 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Martin Schwidefsky <schwidefsky@de.ibm.com>
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <sysdep-cancel.h>
+#define _ERRNO_H	1
+#include <bits/errno.h>
+
+/* Clone the calling process, but without copying the whole address space.
+   The calling process is suspended until the new process exits or is
+   replaced by a call to `execve'.  Return -1 for errors, 0 to the new process,
+   and the process ID of the new process to the old process.  */
+
+ENTRY (__vfork)
+	SINGLE_THREAD_P
+	jgne	HIDDEN_JUMPTARGET(__fork)
+
+	/* Do vfork system call.  */
+	svc	SYS_ify (vfork)
+
+	/* Check for error.  */
+	lghi	%r4,-4095
+	clgr	%r2,%r4
+	jnl	SYSCALL_ERROR_LABEL
+
+	/* Normal return.  */
+	br	%r14
+PSEUDO_END(__vfork)
+
+libc_hidden_def (__vfork)
+
+weak_alias (__vfork, vfork)
diff -urN libc/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list libc-s390/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list
--- libc/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list	Fri Mar 16 10:42:15 2001
+++ libc-s390/sysdeps/unix/sysv/linux/s390/s390-32/syscalls.list	Fri Jan 10 15:59:52 2003
@@ -2,3 +2,4 @@
 
 oldgetrlimit	EXTRA	getrlimit	i:ip	__old_getrlimit	getrlimit@GLIBC_2.0
 oldsetrlimit	EXTRA	setrlimit	i:ip	__old_setrlimit	setrlimit@GLIBC_2.0
+vfork		-	vfork		0	__vfork		vfork
diff -urN libc/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list libc-s390/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list
--- libc/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list	Tue Dec 31 21:44:39 2002
+++ libc-s390/sysdeps/unix/sysv/linux/s390/s390-64/syscalls.list	Fri Jan 10 15:59:52 2003
@@ -11,6 +11,7 @@
 truncate	-	truncate	2	truncate	truncate64
 getrlimit	-	getrlimit	2	__getrlimit	getrlimit getrlimit64
 setrlimit	-	setrlimit	2	__setrlimit	setrlimit setrlimit64
+vfork		-	vfork		0	__vfork		vfork
 
 # semaphore and shm system calls
 msgctl		-	msgctl		i:iip	__msgctl	msgctl


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]