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