A2osX/SYS/KERNEL.S.PWD.txt
2020-02-17 17:55:02 +01:00

138 lines
2.7 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

NEW
AUTO 3,1
*/--------------------------------------
* # GetPWUID
* ## C
* `int getpwuid(short int uid, S.PW *passwd);`
* ## ASM
* `PUSHB uid`
* `>PUSHW passwd`
* `>SYSCALL getpwuid`
* ## RETURN VALUE
*\--------------------------------------
K.GetPWUID
K.GetGRGID >PULLW FORPNT
>PULLB ZPPtr1+1
jmp K.SYSCALL.JMPX
*/--------------------------------------
* # GetPWName
* ## C
* `int getpwname(const char* name, S.PW *passwd);`
* ## ASM
* `>PUSHW name`
* `>PUSHW passwd`
* `>SYSCALL getpwname`
* ## RETURN VALUE
*\--------------------------------------
K.GetPWName
K.GetGRName >PULLW FORPNT
>PULLW TXTPTR
jmp K.SYSCALL.JMPX
*/--------------------------------------
* # PutPW
* ## C
* `int putpw( S.PW* passwd );`
* ## ASM
* `>PUSHW passwd`
* `>SYSCALL putpw`
* ## RETURN VALUE
*\--------------------------------------
K.PutPW >PULLW TXTPTR
jsr K.SYSCALL.JMPX
bcc K.FlushEtcPasswd
rts
*--------------------------------------
K.FlushEtcPasswd
>LDYA PWD.DBSize
ldx PWD.hDB
jsr MEM.CopyToMain
bcs .9
stx .8+1
>PUSHWI PWD.PWFILE
>PUSHBI O.WRONLY+O.CREATE
>PUSHBI S.FI.T.TXT
>PUSHWZ Aux type
>SYSCALL2 FOpen
bcc .1
pha
jsr .8
pla
sec
.9 rts
.1 sta .7+1
>PUSHW PWD.DBSize
lda .8+1
jsr K.getmemptr
>PUSHYA
lda .7+1
>SYSCALL2 FWrite
bcc .7
pha
jsr .7
pla
sec
rts
.7 lda #$ff SELF MODIFIED
>SYSCALL2 fclose
.8 lda #$ff
jmp K.freemem SELF MODIFIED
*/--------------------------------------
* # GetGRGID
* ## C
* `int getgrgid(short int gid, S.GRP *group);`
* ## ASM
* `>PUSHB gid`
* `>PUSHW group`
* `>SYSCALL getpwname`
* ## RETURN VALUE
*\--------------------------------------
*/--------------------------------------
* # GetGRName
* ## C
* `int getgrgid(const char* name, S.GRP *group);`
* ## ASM
* `>PUSHW name`
* `>PUSHW group`
* `>SYSCALL getpwname`
* ## RETURN VALUE
*\--------------------------------------
*/--------------------------------------
* # PutGR
* ## C
* `int putgr(S.GRP *group);`
* ## ASM
* `>PUSHW group`
* `>SYSCALL putgr`
* ## RETURN VALUE
*\--------------------------------------
K.PutGR >PULLW TXTPTR
jsr K.SYSCALL.JMPX
bcc K.FlushEtcGroup
rts
*--------------------------------------
K.FlushEtcGroup rts
*--------------------------------------
PWD.hDB .BS 1
PWD.DBPtr .BS 2
PWD.DBSize .BS 2
PWD.PWFILE .AZ "${ROOT}etc/passwd"
PWD.GRFILE .AZ "${ROOT}etc/group"
*--------------------------------------
MAN
SAVE USR/SRC/SYS/KERNEL.S.PWD
LOAD USR/SRC/SYS/KERNEL.S
ASM