Implement linux_vfork() syscall by calling vfork(). Analogous to the

linux_fork() implementation.
This commit is contained in:
Marcel Moolenaar 1999-08-16 11:49:30 +00:00
parent 405f64d439
commit 42035021f5
5 changed files with 45 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 */
};