* sysdeps/unix/sysv/linux/i386/vfork.S: Rewrite to use clone.

	* sysdeps/unix/sysv/linux/bits/sched.h: Define CLONE_VFORK.
This commit is contained in:
Ulrich Drepper 1999-01-19 15:34:49 +00:00
parent 3ef4002b3f
commit d53afacb55
3 changed files with 19 additions and 29 deletions

View File

@ -1,5 +1,9 @@
1999-01-19 Ulrich Drepper <drepper@cygnus.com> 1999-01-19 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/i386/vfork.S: Rewrite to use clone.
* sysdeps/unix/sysv/linux/bits/sched.h: Define CLONE_VFORK.
* timezone/zdump.c: Update from tzcode1999a. * timezone/zdump.c: Update from tzcode1999a.
* timezone/zic.c: Likewise. * timezone/zic.c: Likewise.

View File

@ -1,6 +1,6 @@
/* Definitions of constants and data structure for POSIX 1003.1b-1993 /* Definitions of constants and data structure for POSIX 1003.1b-1993
scheduling interface. scheduling interface.
Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -39,6 +39,8 @@
# define CLONE_SIGHAND 0x00000800 /* Set if signal handlers shared. */ # define CLONE_SIGHAND 0x00000800 /* Set if signal handlers shared. */
# define CLONE_PID 0x00001000 /* Set if pid shared. */ # define CLONE_PID 0x00001000 /* Set if pid shared. */
# define CLONE_PTRACE 0x00002000 /* Set if tracing continues on the child. */ # define CLONE_PTRACE 0x00002000 /* Set if tracing continues on the child. */
# define CLONE_VFORK 0x00004000 /* Set if the parent wants the child to
wake it up on mm_release. */
#endif #endif
/* The official definition. */ /* The official definition. */

View File

@ -1,6 +1,6 @@
/* Copyright (C) 1999 Free Software Foundation, Inc. /* Copyright (C) 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Andreas Schwab <schwab@gnu.org>. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as modify it under the terms of the GNU Library General Public License as
@ -28,37 +28,21 @@
ENTRY (__vfork) ENTRY (__vfork)
#ifdef __NR_vfork /* We have to use the clone() system call. The flags to use are
CLONE_VFORK | CLONE_VM
and we send SIGCHLD on termination (i.e., flags = 0x4111). */
/* Pop the return PC value into ECX. */ popl %edx /* Pop return address. */
popl %ecx pushl %ebx
movl %esp, %ecx
/* Stuff the syscall number in EAX and enter into the kernel. */ movl $0x4111, %ebx
movl $SYS_ify (vfork), %eax movl $SYS_ify(clone), %eax
int $0x80
cmpl $-4095, %eax
jae .Lerror /* Branch forward if it failed. */
/* Jump to the return PC. */
jmp *%ecx
.Lerror:
/* Push back the return PC. */
pushl %ecx
/* Check if vfork syscall is known at all. */
cmpl $-ENOSYS, %eax
jne SYSCALL_ERROR_LABEL
#endif
/* If we don't have vfork, fork is close enough. */
movl $SYS_ify (fork), %eax
int $0x80 int $0x80
popl %ebx
pushl %edx
cmpl $-4095, %eax cmpl $-4095, %eax
jae SYSCALL_ERROR_LABEL jae SYSCALL_ERROR_LABEL
.Lpseudo_end: L(pseudo_end):
ret ret
PSEUDO_END (__vfork) PSEUDO_END (__vfork)