Mercurial > hg > Members > kono > nitros9-code
diff 3rdparty/packages/cc/sources/id.a @ 867:0198655f2552
Added sources
author | boisy |
---|---|
date | Thu, 16 Jan 2003 19:54:21 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/3rdparty/packages/cc/sources/id.a Thu Jan 16 19:54:21 2003 +0000 @@ -0,0 +1,61 @@ +* +* Identity system calls +* + use ..../defs/os9defs.a + +* +* Equates for level one pointers (sorry!) +* +D.Proc equ $4b +P$User equ $9 + + psect id_a,0,0,1,0,0 + +* getpid() +getpid: pshs y save data pointer + os9 F$ID + puls y + bcc getp10 + lbcs _os9err + +getp10 tfr a,b + clra + rts + +* getuid() +getuid: pshs y + os9 F$ID + bcc getu10 + +errexit puls y + lbra _os9err + +getu10 tfr y,d + puls y,pc + +* setuid() +setuid: + pshs y + bsr getuid get user id + std -2,s superuser? + beq setu10 bra if so + ldb #E$FNA not allowed + bra errexit + +setu10 ldy 4,s get new user id + os9 F$SUSER set user id + bcc setu20 bra if ok + + cmpb #E$UNKSVC illegal code? + bne errexit bra if not + +** Illegal code (sorry) *** + tfr y,d + ldy >D.Proc + std P$User,y + +setu20 clra + clrb + puls y,pc + + endsect