aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Moolenaar <marcel@FreeBSD.org>1999-08-16 11:49:30 +0000
committerMarcel Moolenaar <marcel@FreeBSD.org>1999-08-16 11:49:30 +0000
commit42035021f5556bf0106789d430b3e372ae55bebc (patch)
treede8a191292f0756b6752454e13a07d514d1f3868
parent405f64d439c1629748ee49300d847fa61d4ee4bc (diff)
downloadsrc-42035021f5556bf0106789d430b3e372ae55bebc.tar.gz
src-42035021f5556bf0106789d430b3e372ae55bebc.zip
Implement linux_vfork() syscall by calling vfork(). Analogous to the
linux_fork() implementation.
Notes
Notes: svn path=/head/; revision=49890
-rw-r--r--sys/compat/linux/linux_misc.c19
-rw-r--r--sys/i386/linux/linux_misc.c19
-rw-r--r--sys/i386/linux/linux_proto.h6
-rw-r--r--sys/i386/linux/linux_syscall.h3
-rw-r--r--sys/i386/linux/linux_sysent.c4
5 files changed, 45 insertions, 6 deletions
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 684a9fcdf7b4..6bdadced6a05 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: linux_misc.c,v 1.62 1999/08/15 13:28:35 marcel Exp $
+ * $Id: linux_misc.c,v 1.63 1999/08/15 17:28:39 marcel Exp $
*/
#include "opt_compat.h"
@@ -575,6 +575,23 @@ linux_fork(struct proc *p, struct linux_fork_args *args)
return 0;
}
+int
+linux_vfork(struct proc *p, struct linux_vfork_args *args)
+{
+ int error;
+
+#ifdef DEBUG
+ printf("Linux-emul(%ld): fork()\n", p->p_pid);
+#endif
+
+ if ((error = vfork(p, (struct vfork_args *)args)) != 0)
+ return error;
+ /* Are we the child? */
+ if (p->p_retval[1] == 1)
+ p->p_retval[0] = 0;
+ return 0;
+}
+
#define CLONE_VM 0x100
#define CLONE_FS 0x200
#define CLONE_FILES 0x400
diff --git a/sys/i386/linux/linux_misc.c b/sys/i386/linux/linux_misc.c
index 684a9fcdf7b4..6bdadced6a05 100644
--- a/sys/i386/linux/linux_misc.c
+++ b/sys/i386/linux/linux_misc.c
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: linux_misc.c,v 1.62 1999/08/15 13:28:35 marcel Exp $
+ * $Id: linux_misc.c,v 1.63 1999/08/15 17:28:39 marcel Exp $
*/
#include "opt_compat.h"
@@ -575,6 +575,23 @@ linux_fork(struct proc *p, struct linux_fork_args *args)
return 0;
}
+int
+linux_vfork(struct proc *p, struct linux_vfork_args *args)
+{
+ int error;
+
+#ifdef DEBUG
+ printf("Linux-emul(%ld): fork()\n", p->p_pid);
+#endif
+
+ if ((error = vfork(p, (struct vfork_args *)args)) != 0)
+ return error;
+ /* Are we the child? */
+ if (p->p_retval[1] == 1)
+ p->p_retval[0] = 0;
+ return 0;
+}
+
#define CLONE_VM 0x100
#define CLONE_FS 0x200
#define CLONE_FILES 0x400
diff --git a/sys/i386/linux/linux_proto.h b/sys/i386/linux/linux_proto.h
index e5aefb956188..d3f742c1a2eb 100644
--- a/sys/i386/linux/linux_proto.h
+++ b/sys/i386/linux/linux_proto.h
@@ -2,7 +2,7 @@
* System call prototypes.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from Id: syscalls.master,v 1.21 1999/08/15 17:25:56 marcel Exp
+ * created from Id: syscalls.master,v 1.22 1999/08/16 11:47:21 marcel Exp
*/
#ifndef _LINUX_SYSPROTO_H_
@@ -423,6 +423,9 @@ struct linux_getcwd_args {
char * buf; char buf_[PAD_(char *)];
unsigned long bufsize; char bufsize_[PAD_(unsigned long)];
};
+struct linux_vfork_args {
+ register_t dummy;
+};
int linux_setup __P((struct proc *, struct linux_setup_args *));
int linux_fork __P((struct proc *, struct linux_fork_args *));
int linux_open __P((struct proc *, struct linux_open_args *));
@@ -529,6 +532,7 @@ int linux_rt_sigaction __P((struct proc *, struct linux_rt_sigaction_args *));
int linux_rt_sigprocmask __P((struct proc *, struct linux_rt_sigprocmask_args *));
int linux_chown __P((struct proc *, struct linux_chown_args *));
int linux_getcwd __P((struct proc *, struct linux_getcwd_args *));
+int linux_vfork __P((struct proc *, struct linux_vfork_args *));
#ifdef COMPAT_43
diff --git a/sys/i386/linux/linux_syscall.h b/sys/i386/linux/linux_syscall.h
index 963fab589570..3e750604bad8 100644
--- a/sys/i386/linux/linux_syscall.h
+++ b/sys/i386/linux/linux_syscall.h
@@ -2,7 +2,7 @@
* System call numbers.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from Id: syscalls.master,v 1.21 1999/08/15 17:25:56 marcel Exp
+ * created from Id: syscalls.master,v 1.22 1999/08/16 11:47:21 marcel Exp
*/
#define LINUX_SYS_linux_setup 0
@@ -167,4 +167,5 @@
#define LINUX_SYS_linux_rt_sigprocmask 175
#define LINUX_SYS_linux_chown 182
#define LINUX_SYS_linux_getcwd 183
+#define LINUX_SYS_linux_vfork 190
#define LINUX_SYS_MAXSYSCALL 191
diff --git a/sys/i386/linux/linux_sysent.c b/sys/i386/linux/linux_sysent.c
index 41cce486ee71..a98b32f45e90 100644
--- a/sys/i386/linux/linux_sysent.c
+++ b/sys/i386/linux/linux_sysent.c
@@ -2,7 +2,7 @@
* System call switch table.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from Id: syscalls.master,v 1.21 1999/08/15 17:25:56 marcel Exp
+ * created from Id: syscalls.master,v 1.22 1999/08/16 11:47:21 marcel Exp
*/
#include "opt_compat.h"
@@ -204,5 +204,5 @@ struct sysent linux_sysent[] = {
{ 0, (sy_call_t *)nosys }, /* 187 = sendfile */
{ 0, (sy_call_t *)nosys }, /* 188 = getpmsg */
{ 0, (sy_call_t *)nosys }, /* 189 = putpmsg */
- { 0, (sy_call_t *)nosys }, /* 190 = vfork */
+ { 0, (sy_call_t *)linux_vfork }, /* 190 = linux_vfork */
};