Need an internal name for fork().

This commit is contained in:
kleink 2000-06-26 06:32:54 +00:00
parent 2234f31b26
commit b8a4d7adf9
15 changed files with 130 additions and 38 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: fork.S,v 1.2 2000/06/14 06:49:03 cgd Exp $ */
/* $NetBSD: fork.S,v 1.3 2000/06/26 06:32:54 kleink Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
@ -29,7 +29,12 @@
#include "SYS.h"
SYSCALL(fork)
#ifdef WEAK_ALIAS
WEAK_ALIAS(fork, _fork)
#endif
LEAF(_fork, 0)
CALLSYS_ERROR(fork)
cmovne a4, zero, v0 /* a4 (rv[1]) != 0, child */
RET
END(fork)

View File

@ -1,4 +1,4 @@
/* $NetBSD: fork.S,v 1.1 2000/05/09 21:55:51 bjh21 Exp $ */
/* $NetBSD: fork.S,v 1.2 2000/06/26 06:32:56 kleink Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -37,7 +37,11 @@
#include "SYS.h"
SYSCALL(fork)
#ifdef WEAK_ALIAS
WEAK_ALIAS(fork, _fork)
#endif
_SYSCALL(_fork,fork)
sub r1, r1, #0x00000001
and r0, r0, r1
#ifdef __APCS_26__

View File

@ -1,4 +1,4 @@
/* $NetBSD: fork.S,v 1.3 1997/10/06 00:07:13 mark Exp $ */
/* $NetBSD: fork.S,v 1.4 2000/06/26 06:32:56 kleink Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -37,7 +37,11 @@
#include "SYS.h"
SYSCALL(fork)
#ifdef WEAK_ALIAS
WEAK_ALIAS(fork, _fork)
#endif
_SYSCALL(_fork,fork)
sub r1, r1, #0x00000001
and r0, r0, r1
mov r15, r14

View File

@ -1,4 +1,4 @@
/* $NetBSD: fork.S,v 1.6 1997/07/16 14:37:30 christos Exp $ */
/* $NetBSD: fork.S,v 1.7 2000/06/26 06:32:57 kleink Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -40,12 +40,16 @@
#include <machine/asm.h>
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: fork.S,v 1.6 1997/07/16 14:37:30 christos Exp $")
RCSID("$NetBSD: fork.S,v 1.7 2000/06/26 06:32:57 kleink Exp $")
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
SYSCALL(fork)
#ifdef WEAK_ALIAS
WEAK_ALIAS(fork, _fork)
#endif
_SYSCALL(_fork,fork)
decl %edx /* from 1 to 0 in child, 0 to -1 in parent */
andl %edx,%eax
ret /* pid = fork(); */

View File

@ -1,4 +1,4 @@
/* $NetBSD: fork.S,v 1.4 1999/10/25 23:48:17 thorpej Exp $ */
/* $NetBSD: fork.S,v 1.5 2000/06/26 06:32:58 kleink Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -43,11 +43,15 @@
#if 0
RCSID("from: @(#)fork.s 5.1 (Berkeley) 5/12/90")
#else
RCSID("$NetBSD: fork.S,v 1.4 1999/10/25 23:48:17 thorpej Exp $")
RCSID("$NetBSD: fork.S,v 1.5 2000/06/26 06:32:58 kleink Exp $")
#endif
#endif /* LIBC_SCCS and not lint */
SYSCALL(fork)
#ifdef WEAK_ALIAS
WEAK_ALIAS(fork, _fork)
#endif
_SYSCALL(_fork,fork)
subql #1,%d1 /* from 1 to 0 in child, 0 to -1 in parent */
andl %d1,%d0
rts /* pid = fork() */

View File

@ -1,4 +1,4 @@
/* $NetBSD: fork.S,v 1.6 1999/01/14 22:48:21 kleink Exp $ */
/* $NetBSD: fork.S,v 1.7 2000/06/26 06:32:58 kleink Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -40,14 +40,18 @@
#if defined(LIBC_SCCS) && !defined(lint)
ASMSTR("from: @(#)fork.s 8.1 (Berkeley) 6/4/93")
ASMSTR("$NetBSD: fork.S,v 1.6 1999/01/14 22:48:21 kleink Exp $")
ASMSTR("$NetBSD: fork.S,v 1.7 2000/06/26 06:32:58 kleink Exp $")
#endif /* LIBC_SCCS and not lint */
#ifdef ABICALLS
.abicalls
#endif
LEAF(fork)
#ifdef WEAK_ALIAS
WEAK_ALIAS(fork, _fork)
#endif
LEAF(_fork)
#ifdef ABICALLS
.set noreorder
.cpload t9

View File

@ -1,4 +1,4 @@
/* $NetBSD: fork.S,v 1.3 1997/05/08 13:39:04 matthias Exp $ */
/* $NetBSD: fork.S,v 1.4 2000/06/26 06:33:01 kleink Exp $ */
/*
* Copyright (c) 1992 Helsinki University of Technology
@ -24,12 +24,12 @@
#include "SYS.h"
#if defined(LIBC_SCCS)
RCSID("$NetBSD: fork.S,v 1.3 1997/05/08 13:39:04 matthias Exp $")
RCSID("$NetBSD: fork.S,v 1.4 2000/06/26 06:33:01 kleink Exp $")
#endif
/* r0 = pid. r1 = 0 in parent, 1 in child */
SYSCALL(fork)
_SYSCALL(_fork,fork)
cmpqd 0,r1
beq 0f
movqd 0,r0

View File

@ -1,4 +1,4 @@
/* $NetBSD: fork.S,v 1.2 1998/05/25 15:28:03 ws Exp $ */
/* $NetBSD: fork.S,v 1.3 2000/06/26 06:33:01 kleink Exp $ */
/*
* pid = fork();
@ -9,7 +9,11 @@
#include "SYS.h"
SYSCALL(fork)
#ifdef WEAK_ALIAS
WEAK_ALIAS(fork, _fork)
#endif
_SYSCALL(_fork,fork)
addi 4,4,-1 # from 1 to 0 in child, 0 to -1 in parent
and 3,3,4 # return 0 in child, pid in parent
blr

View File

@ -1,4 +1,4 @@
/* $NetBSD: fork.S,v 1.2 2000/03/27 16:27:16 msaitoh Exp $ */
/* $NetBSD: fork.S,v 1.3 2000/06/26 06:33:02 kleink Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -40,17 +40,21 @@
#include <machine/asm.h>
#if defined(SYSLIBC_SCCS) && !defined(lint)
RCSID("$NetBSD: fork.S,v 1.2 2000/03/27 16:27:16 msaitoh Exp $")
RCSID("$NetBSD: fork.S,v 1.3 2000/06/26 06:33:02 kleink Exp $")
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
#ifdef WEAK_ALIAS
WEAK_ALIAS(fork, _fork)
#endif
.text
.align 2
2: mov.l 1f, r3
jmp @r3
nop
_SYSCALL_NOERROR(fork,fork)
_SYSCALL_NOERROR(_fork,fork)
bf 2b
bra 3f
nop
@ -62,7 +66,7 @@
and r1,r0
#if 0
SYSCALL(fork)
_SYSCALL(_fork,fork)
decl %edx /* from 1 to 0 in child, 0 to -1 in parent */
andl %edx,%eax
ret /* pid = fork(); */

View File

@ -1,4 +1,4 @@
/* $NetBSD: fork.S,v 1.2 1997/07/16 14:37:56 christos Exp $ */
/* $NetBSD: fork.S,v 1.3 2000/06/26 06:33:03 kleink Exp $ */
/*
* Copyright (c) 1992, 1993
@ -44,13 +44,17 @@
#if 0
.asciz "@(#)fork.s 8.1 (Berkeley) 6/4/93"
#else
RCSID("$NetBSD: fork.S,v 1.2 1997/07/16 14:37:56 christos Exp $")
RCSID("$NetBSD: fork.S,v 1.3 2000/06/26 06:33:03 kleink Exp $")
#endif
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
SYSCALL(fork)
#ifdef WEAK_ALIAS
WEAK_ALIAS(fork, _fork)
#endif
_SYSCALL(_fork,fork)
dec %o1 ! from 1 to 0 in child, 0 to -1 in parent
retl
and %o0, %o1, %o0 ! return 0 in child, pid in parent

View File

@ -1,4 +1,4 @@
/* $NetBSD: fork.S,v 1.1 1998/09/11 04:56:34 eeh Exp $ */
/* $NetBSD: fork.S,v 1.2 2000/06/26 06:33:03 kleink Exp $ */
/*
* Copyright (c) 1992, 1993
@ -44,13 +44,17 @@
#if 0
.asciz "@(#)fork.s 8.1 (Berkeley) 6/4/93"
#else
RCSID("$NetBSD: fork.S,v 1.1 1998/09/11 04:56:34 eeh Exp $")
RCSID("$NetBSD: fork.S,v 1.2 2000/06/26 06:33:03 kleink Exp $")
#endif
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
SYSCALL(fork)
#ifdef WEAK_ALIAS
WEAK_ALIAS(fork, _fork)
#endif
_SYSCALL(_fork,fork)
dec %o1 ! from 1 to 0 in child, 0 to -1 in parent
retl
and %o0, %o1, %o0 ! return 0 in child, pid in parent

View File

@ -33,12 +33,16 @@
#if defined(SYSLIBC_SCCS) && !defined(lint)
/* .asciz "@(#)fork.s 8.1 (Berkeley) 6/4/93" */
.asciz "$NetBSD: fork.S,v 1.1 1995/04/17 12:24:01 ragge Exp $"
.asciz "$NetBSD: fork.S,v 1.2 2000/06/26 06:33:04 kleink Exp $"
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
SYSCALL(fork)
#ifdef WEAK_ALIAS
WEAK_ALIAS(fork, _fork)
#endif
_SYSCALL(_fork,fork)
jlbc r1,1f # parent, since r1 == 0 in parent, 1 in child
clrl r0
1:

View File

@ -1,4 +1,4 @@
/* $NetBSD: namespace.h,v 1.53 2000/06/23 15:40:40 kleink Exp $ */
/* $NetBSD: namespace.h,v 1.54 2000/06/26 06:33:04 kleink Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -44,6 +44,7 @@
#define catopen _catopen
#define err _err
#define errx _errx
#define fork _fork
#define inet_aton _inet_aton
#define inet_pton _inet_pton
#define sbrk _sbrk

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile.inc,v 1.103 2000/06/23 15:40:40 kleink Exp $
# $NetBSD: Makefile.inc,v 1.104 2000/06/26 06:33:05 kleink Exp $
# @(#)Makefile.inc 8.3 (Berkeley) 10/24/94
# sys sources
@ -35,7 +35,7 @@ SRCS+= timer_create.c timer_delete.c timer_gettime.c timer_settime.c \
timer_getoverrun.c
# namespace purity wrappers
SRCS+= _brk.c _sbrk.c
SRCS+= _brk.c _fork.c _sbrk.c
# modules with default implementations on all architectures:
ASM= accept.o access.o acct.o adjtime.o bind.o chdir.o chflags.o \

46
lib/libc/sys/_fork.c Normal file
View File

@ -0,0 +1,46 @@
/* $NetBSD: _fork.c,v 1.1 2000/06/26 06:33:05 kleink Exp $ */
/*
* Copyright (c) 1996 Christos Zoulas. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Christos Zoulas.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifdef __indr_reference
__indr_reference(_fork, fork)
#else
#include <unistd.h>
pid_t _fork __P((void)); /* XXX */
pid_t
fork()
{
return _fork();
}
#endif