xref: /csrg-svn/lib/libc/vax/sys/cache.lib/getuid.c (revision 61226)
147918Sbostic /*-
2*61226Sbostic  * Copyright (c) 1983, 1993
3*61226Sbostic  *	The Regents of the University of California.  All rights reserved.
447917Sbostic  *
547918Sbostic  * %sccs.include.redist.c%
647917Sbostic  */
747917Sbostic 
847917Sbostic #if defined(LIBC_SCCS) && !defined(lint)
9*61226Sbostic 	.asciz "@(#)getuid.c	8.1 (Berkeley) 06/04/93"
1047917Sbostic #endif /* LIBC_SCCS and not lint */
1147917Sbostic 
1247917Sbostic #include "SYS.h"
1347917Sbostic 
1447917Sbostic 	.data
1547917Sbostic myuid:	.long	-1
1647917Sbostic myeuid:	.long	-1
1747917Sbostic 	.text
1847917Sbostic 
1947917Sbostic ENTRY(getuid)
2047917Sbostic 	movl	myuid,r0	# check cache
2147917Sbostic 	cmpl	$-1,r0
2247917Sbostic 	bneq	doit
2347917Sbostic 	ret
2447917Sbostic doit:
2547917Sbostic 	chmk	$SYS_getuid
2647917Sbostic 	jcs	err
2747917Sbostic 	movl	r0,myuid	# set cache
2847917Sbostic 	movl	r1,myeuid	# set cache
2947917Sbostic 	ret			# uid = getuid();
3047917Sbostic 
3147917Sbostic ENTRY(geteuid)
3247917Sbostic 	movl	myeuid,r0	# check cache
3347917Sbostic 	cmpl	$-1,r0
3447917Sbostic 	bneq	doit
3547917Sbostic 	ret
3647917Sbostic doit:
3747917Sbostic 	chmk	$SYS_getuid
3847917Sbostic 	jcs	err
3947917Sbostic 	movl	r0,myuid	# set cache
4047917Sbostic 	movl	r1,r0
4147917Sbostic 	movl	r0,myeuid	# set cache
4247917Sbostic 	ret			# uid = geteuid();
4347917Sbostic err:
4447917Sbostic 	jmp cerror
4547917Sbostic 
4647917Sbostic ENTRY(setreuid)
4747917Sbostic 	mnegl	$1,myuid
4847917Sbostic 	mnegl	$1,myeuid
4947917Sbostic 	chmk	$SYS_setreuid
5047917Sbostic 	jcs	err
5147917Sbostic 	ret		# setreuid(ruid, euid)
52