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