A2osX/SYS/KERNEL.S.PWD.txt

175 lines
3.5 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
2020-03-13 07:15:58 +00:00
*/--------------------------------------
* # GetGRGID
* ## C
* `int getgrgid(short int gid, S.GRP *group);`
* ## ASM
* `>PUSHB gid`
* `>PUSHW group`
* `>SYSCALL getpwname`
* ## RETURN VALUE
*\--------------------------------------
2020-02-17 16:55:02 +00:00
K.GetGRGID >PULLW FORPNT
2020-03-13 07:15:58 +00:00
>PULLB ZPPtr1+1 UID/GID
2019-10-11 13:06:33 +00:00
2020-08-02 12:19:43 +00:00
*/--------------------------------------
* # CloseSession
* ## C
* `int closesession(short int hSID);`
* ## ASM
* `>PUSHB hSID`
* `>SYSCALL CloseSession`
* ## RETURN VALUE
*\--------------------------------------
K.CloseSession jmp K.SYSCALL.JMPX
2020-02-14 07:21:56 +00:00
*/--------------------------------------
2020-07-09 15:13:30 +00:00
* # OpenSession
* ## C
* `short int hSID opensession(const char *name, const char *passwd);`
* ## ASM
* `>PUSHW name`
* `>PUSHW passwd`
* `>SYSCALL OpenSession`
* ## RETURN VALUE
*\--------------------------------------
K.OpenSession
* >PULLW FORPNT passwd
* >PULLW TXTPTR name
* jmp K.SYSCALL.JMPX
*/--------------------------------------
2020-02-14 07:21:56 +00:00
* # 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
2020-03-13 07:15:58 +00:00
*/--------------------------------------
* # GetGRName
* ## C
* `int getgrgid(const char* name, S.GRP *group);`
* ## ASM
* `>PUSHW name`
* `>PUSHW group`
* `>SYSCALL getpwname`
* ## RETURN VALUE
*\--------------------------------------
2020-02-17 16:55:02 +00:00
K.GetGRName >PULLW FORPNT
>PULLW TXTPTR
2020-02-14 07:21:56 +00:00
jmp K.SYSCALL.JMPX
*/--------------------------------------
* # PutPW
* ## C
2020-07-09 15:13:30 +00:00
* `int putpw(S.PW* passwd);`
2020-02-14 07:21:56 +00:00
* ## ASM
2020-02-17 16:55:02 +00:00
* `>PUSHW passwd`
2020-02-14 07:21:56 +00:00
* `>SYSCALL putpw`
* ## RETURN VALUE
*\--------------------------------------
2020-07-09 15:13:30 +00:00
K.PutPW
*/--------------------------------------
* # PutGR
* ## C
* `int putgr(S.GRP *group);`
* ## ASM
* `>PUSHW group`
* `>SYSCALL putgr`
* ## RETURN VALUE
*\--------------------------------------
K.PutGR >PULLW TXTPTR
2020-07-08 15:26:23 +00:00
2020-02-17 16:55:02 +00:00
jsr K.SYSCALL.JMPX
2020-07-09 15:13:30 +00:00
bcc PWD.FlushFiles
2020-02-17 16:55:02 +00:00
rts
2020-02-14 07:21:56 +00:00
*--------------------------------------
2020-07-09 15:13:30 +00:00
PWD.FlushFiles
2020-03-12 16:44:11 +00:00
>LDYA PWD.UsrDBSize
ldx PWD.hUsrDB
2020-07-09 15:13:30 +00:00
clc
jsr PWD.Flush
>LDYA PWD.GrpDBSize
ldx PWD.hGrpDB
sec
PWD.Flush >STYA PWD.FileSize
>LDYAI PWD.ETCPASSWD
bcc .10
>LDYAI PWD.ETCGROUP
.10 >STYA PWD.FileName
>LDYA PWD.FileSize
jsr MEM.CopyToMain X = src Aux hMem
2019-10-11 13:06:33 +00:00
bcs .9
stx .8+1
2020-07-09 15:13:30 +00:00
>PUSHW PWD.FileName
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
2020-07-09 15:13:30 +00:00
>PUSHW PWD.FileSize
2019-10-11 13:06:33 +00:00
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-03-12 16:44:11 +00:00
PWD.ETCPASSWD .AZ "${ROOT}etc/passwd"
PWD.hUsrDB .BS 1
PWD.UsrDBSize .BS 2
PWD.ETCGROUP .AZ "${ROOT}etc/group"
PWD.hGrpDB .BS 1
PWD.GrpDBSize .BS 2
2020-07-09 15:13:30 +00:00
PWD.FileSize .BS 2
PWD.FileName .BS 2
2019-10-11 13:06:33 +00:00
*--------------------------------------
MAN
2020-07-08 15:26:23 +00:00
SAVE usr/src/sys/kernel.s.pwd
LOAD usr/src/sys/kernel.s
2019-10-11 13:06:33 +00:00
ASM