1*47916Sbostic /*
2*47916Sbostic  * Copyright (c) 1983 The Regents of the University of California.
3*47916Sbostic  * All rights reserved.
4*47916Sbostic  *
5*47916Sbostic  * Redistribution and use in source and binary forms are permitted
6*47916Sbostic  * provided that the above copyright notice and this paragraph are
7*47916Sbostic  * duplicated in all such forms and that any documentation,
8*47916Sbostic  * advertising materials, and other materials related to such
9*47916Sbostic  * distribution and use acknowledge that the software was developed
10*47916Sbostic  * by the University of California, Berkeley.  The name of the
11*47916Sbostic  * University may not be used to endorse or promote products derived
12*47916Sbostic  * from this software without specific prior written permission.
13*47916Sbostic  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14*47916Sbostic  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15*47916Sbostic  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16*47916Sbostic  */
17*47916Sbostic 
18*47916Sbostic #if defined(LIBC_SCCS) && !defined(lint)
19*47916Sbostic 	.asciz "@(#)getppid.c	5.1 (Berkeley) 04/12/91"
20*47916Sbostic #endif /* LIBC_SCCS and not lint */
21*47916Sbostic 
22*47916Sbostic #include "SYS.h"
23*47916Sbostic 
24*47916Sbostic 	.data
25*47916Sbostic 	.globl	mypid, myppid
26*47916Sbostic myppid:
27*47916Sbostic 	.long	0
28*47916Sbostic 	.text
29*47916Sbostic 
30*47916Sbostic ENTRY(getpid)
31*47916Sbostic 	movl	myppid,r0	# check cache
32*47916Sbostic 	beql	doit
33*47916Sbostic 	ret
34*47916Sbostic doit:
35*47916Sbostic 	chmk	$SYS_getpid
36*47916Sbostic 	jcs	err
37*47916Sbostic 	movl	r0,mypid	# cache pid
38*47916Sbostic 	movl	r1,r0
39*47916Sbostic 	movl	r0,myppid	# set cache
40*47916Sbostic 	ret			# ppid = getppid();
41*47916Sbostic err:
42*47916Sbostic 	jmp cerror;
43