1 /*- 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 */ 7 8 #if defined(LIBC_SCCS) && !defined(lint) 9 .asciz "@(#)getuid.c 8.1 (Berkeley) 06/04/93" 10 #endif /* LIBC_SCCS and not lint */ 11 12 #include "SYS.h" 13 14 .data 15 myuid: .long -1 16 myeuid: .long -1 17 .text 18 19 ENTRY(getuid) 20 movl myuid,r0 # check cache 21 cmpl $-1,r0 22 bneq doit 23 ret 24 doit: 25 chmk $SYS_getuid 26 jcs err 27 movl r0,myuid # set cache 28 movl r1,myeuid # set cache 29 ret # uid = getuid(); 30 31 ENTRY(geteuid) 32 movl myeuid,r0 # check cache 33 cmpl $-1,r0 34 bneq doit 35 ret 36 doit: 37 chmk $SYS_getuid 38 jcs err 39 movl r0,myuid # set cache 40 movl r1,r0 41 movl r0,myeuid # set cache 42 ret # uid = geteuid(); 43 err: 44 jmp cerror 45 46 ENTRY(setreuid) 47 mnegl $1,myuid 48 mnegl $1,myeuid 49 chmk $SYS_setreuid 50 jcs err 51 ret # setreuid(ruid, euid) 52