A2osX/SYS/KERNEL.S.PWD.txt

138 lines
2.7 KiB
Plaintext
Raw Normal View History

2019-10-11 13:06:33 +00:00
NEW
AUTO 3,1
2020-02-14 07:21:56 +00:00
*/--------------------------------------
* # GetPWUID
* ## C
2020-02-17 16:55:02 +00:00
* `int getpwuid(short int uid, S.PW *passwd);`
2020-02-14 07:21:56 +00:00
* ## ASM
2020-02-17 16:55:02 +00:00
* `PUSHB uid`
2020-02-14 07:21:56 +00:00
* `>PUSHW passwd`
* `>SYSCALL getpwuid`
* ## RETURN VALUE
*\--------------------------------------
2020-02-17 16:55:02 +00:00
K.GetPWUID
K.GetGRGID >PULLW FORPNT
>PULLB ZPPtr1+1
2019-10-11 13:06:33 +00:00
2020-02-14 07:21:56 +00:00
jmp K.SYSCALL.JMPX
*/--------------------------------------
* # GetPWName
* ## C
2020-02-17 16:55:02 +00:00
* `int getpwname(const char* name, S.PW *passwd);`
2020-02-14 07:21:56 +00:00
* ## ASM
2020-02-17 16:55:02 +00:00
* `>PUSHW name`
2020-02-14 07:21:56 +00:00
* `>PUSHW passwd`
* `>SYSCALL getpwname`
* ## RETURN VALUE
*\--------------------------------------
2020-02-17 16:55:02 +00:00
K.GetPWName
K.GetGRName >PULLW FORPNT
>PULLW TXTPTR
2020-02-14 07:21:56 +00:00
jmp K.SYSCALL.JMPX
*/--------------------------------------
* # PutPW
* ## C
* `int putpw( S.PW* passwd );`
* ## ASM
2020-02-17 16:55:02 +00:00
* `>PUSHW passwd`
2020-02-14 07:21:56 +00:00
* `>SYSCALL putpw`
* ## RETURN VALUE
*\--------------------------------------
2020-02-17 16:55:02 +00:00
K.PutPW >PULLW TXTPTR
2020-02-14 07:21:56 +00:00
2020-02-17 16:55:02 +00:00
jsr K.SYSCALL.JMPX
bcc K.FlushEtcPasswd
rts
2020-02-14 07:21:56 +00:00
*--------------------------------------
K.FlushEtcPasswd
2019-10-11 13:06:33 +00:00
>LDYA PWD.DBSize
2020-02-14 07:21:56 +00:00
ldx PWD.hDB
jsr MEM.CopyToMain
2019-10-11 13:06:33 +00:00
bcs .9
stx .8+1
2020-02-17 16:55:02 +00:00
>PUSHWI PWD.PWFILE
2019-10-11 13:06:33 +00:00
>PUSHBI O.WRONLY+O.CREATE
2020-02-14 07:21:56 +00:00
>PUSHBI S.FI.T.TXT
>PUSHWZ Aux type
>SYSCALL2 FOpen
2019-10-11 13:06:33 +00:00
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
2020-02-14 07:21:56 +00:00
>SYSCALL2 FWrite
2019-10-11 13:06:33 +00:00
bcc .7
pha
jsr .7
pla
sec
rts
.7 lda #$ff SELF MODIFIED
2020-02-14 07:21:56 +00:00
>SYSCALL2 fclose
2019-10-11 13:06:33 +00:00
.8 lda #$ff
jmp K.freemem SELF MODIFIED
2020-02-17 16:55:02 +00:00
*/--------------------------------------
* # 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
2019-10-11 13:06:33 +00:00
*--------------------------------------
PWD.hDB .BS 1
PWD.DBPtr .BS 2
PWD.DBSize .BS 2
2020-02-17 16:55:02 +00:00
PWD.PWFILE .AZ "${ROOT}etc/passwd"
PWD.GRFILE .AZ "${ROOT}etc/group"
2019-10-11 13:06:33 +00:00
*--------------------------------------
MAN
SAVE USR/SRC/SYS/KERNEL.S.PWD
LOAD USR/SRC/SYS/KERNEL.S
ASM