mirror of
https://github.com/livingcomputermuseum/pdp7-unix.git
synced 2026-02-13 19:44:55 +00:00
I've got mkdir working in the alt system. I had to allow the dir bit
in the permissions mask in creat, through.
This commit is contained in:
@@ -85,7 +85,7 @@ cmd: dirs $(BINDIR)/as $(BINDIR)/cat $(BINDIR)/check $(BINDIR)/chmod \
|
||||
# Alternate commands: no dd, but . and ..
|
||||
altcmd: dirs $(BINDIR)/as $(BINDIR)/cat $(BINDIR)/check $(BINDIR)/chmod \
|
||||
$(BINDIR)/chown $(BINDIR)/altchrm $(BINDIR)/cp $(BINDIR)/ds \
|
||||
$(BINDIR)/ed $(BINDIR)/altinit
|
||||
$(BINDIR)/ed $(BINDIR)/altinit $(BINDIR)/altmkdir
|
||||
|
||||
$(BINDIR)/as: $(CMDSRC)/as.s
|
||||
$(AS) $(ASARGS) -o $(BINDIR)/as $(CMDSRC)/as.s
|
||||
@@ -130,6 +130,10 @@ $(BINDIR)/init: $(CMDSRC)/init.s
|
||||
$(BINDIR)/altinit: $(ALTSRC)/init.s
|
||||
$(AS) $(ASARGS) -o $(BINDIR)/altinit $(ALTSRC)/init.s
|
||||
|
||||
$(BINDIR)/altmkdir: $(ALTSRC)/wktmkdir.s
|
||||
$(AS) $(ASARGS) -o $(BINDIR)/altmkdir $(ALTSRC)/wktmkdir.s
|
||||
|
||||
|
||||
# The commands that did not come from the scans
|
||||
others: dirs $(BINDIR)/sh $(BINDIR)/wktcat $(BINDIR)/wktcp $(BINDIR)/date \
|
||||
$(BINDIR)/ln $(BINDIR)/ls $(BINDIR)/mv $(BINDIR)/stat
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
init frwr- -1 bin/altinit
|
||||
ln frwr- -1 bin/ln
|
||||
ls frwr- -1 bin/altls
|
||||
mkdir frwr- -1 bin/altmkdir
|
||||
mv frwr- -1 bin/mv
|
||||
password frw-- -1 fs/password
|
||||
sh frwr- -1 bin/sh
|
||||
|
||||
@@ -257,13 +257,15 @@
|
||||
1:
|
||||
jms access " here if not found
|
||||
lac u.ac " get access bits from user AC (zero for lock!)
|
||||
and o17 " mask to permissions
|
||||
and o37 " mask the permissions, but allow the dir bit
|
||||
jms icreat
|
||||
open1: " common exit for open/creat
|
||||
jms fassign " assign fd slot
|
||||
jms error " none free, return -1
|
||||
jmp sysexit
|
||||
|
||||
o37: 037 " drwrw bitmask
|
||||
|
||||
"** 01-s1.pdf page 11
|
||||
.close:
|
||||
jms finac " get fnode (open file) for fd in user AC
|
||||
|
||||
107
src/alt/wktmkdir.s
Normal file
107
src/alt/wktmkdir.s
Normal file
@@ -0,0 +1,107 @@
|
||||
" Warren's alternative mkdir command: mkdir newdir
|
||||
|
||||
main:
|
||||
lac 017777 i " Do we have any arguments?
|
||||
sad d4
|
||||
jmp noarg
|
||||
|
||||
lac 017777 " Move five words past the argument word count
|
||||
tad d5 " so that AC points at the first argument
|
||||
dac 017777
|
||||
dac 6f " Save this as the argument name in
|
||||
dac 7f " several system calls
|
||||
dac 8f
|
||||
dac 9f
|
||||
|
||||
" Get the status of the argument so that we can
|
||||
" see if it exists. Apparently creat (below) works
|
||||
" on an existing file
|
||||
lac statbufptr
|
||||
sys status; 6:0
|
||||
sna
|
||||
jmp badfile
|
||||
|
||||
" Try to create a new file but with the isdir bit set
|
||||
lac o34
|
||||
sys creat; 7:0
|
||||
spa
|
||||
jmp badfile
|
||||
dac fd
|
||||
|
||||
" Get the status of the current directory so that we can
|
||||
" get its i-num
|
||||
lac statbufptr
|
||||
sys status; dot
|
||||
|
||||
" Write a dummy entry into the new directory that is
|
||||
" equivalent to .., just so we can refer to the parent
|
||||
lac fd
|
||||
sys write; s.inum; 8
|
||||
|
||||
" Move into the new directory
|
||||
sys chdir; 8:0
|
||||
|
||||
" Create a . link to us
|
||||
sys link; up; 9:0; dot
|
||||
|
||||
" Create a .. link to the parent
|
||||
sys link; up; dot; dotdot
|
||||
|
||||
" Try to make a system link; this may fail
|
||||
sys link; up; system; system
|
||||
|
||||
" Now zero the i-num of the dummy entry
|
||||
lac fd
|
||||
sys seek; 0; 0
|
||||
lac fd
|
||||
sys write; zero; 1
|
||||
|
||||
" Close the file and exit
|
||||
lac fd
|
||||
sys close
|
||||
sys exit
|
||||
|
||||
noarg:
|
||||
" Print a "no arg" error and exit
|
||||
lac d1
|
||||
sys write; noargstr; 4
|
||||
sys exit
|
||||
noargstr: <no>; < a>; <rg>; 012
|
||||
|
||||
badfile:
|
||||
lac lac 017777 " Get the pointer to the new dirname
|
||||
dac 1f " Store it in 1f below
|
||||
lac d1
|
||||
sys write; 1:0; 4 " Write the name, max 4 words
|
||||
lac d1 " Then write " ?\n"
|
||||
sys write; 1f; 2
|
||||
sys exit " and exit
|
||||
1: 040; 077012 " String literal: " ?\n"
|
||||
|
||||
fd: 0 " File descriptor of the new directory
|
||||
zero: 0
|
||||
d1: 1
|
||||
d4: 4
|
||||
d5: 5
|
||||
o34: 034 " drw-- permission bits
|
||||
|
||||
statbufptr: statbuf " Pointer to the statbuf
|
||||
statbuf: " Status buffer fields below
|
||||
s.perm: 0
|
||||
s.blk1: 0
|
||||
s.blk2: 0
|
||||
s.blk3: 0
|
||||
s.blk4: 0
|
||||
s.blk5: 0
|
||||
s.blk6: 0
|
||||
s.blk7: 0
|
||||
s.uid: 0
|
||||
s.nlinks: 0
|
||||
s.size: 0
|
||||
s.uniq: 0
|
||||
s.inum: 0
|
||||
up: <up>; 040040; 040040; 040040
|
||||
pad: 0; 0; 0
|
||||
dotdot: <..>; 040040; 040040; 040040
|
||||
dot: 056040; 040040; 040040; 040040
|
||||
system: <sy>; <st>; <em>; 040040
|
||||
Reference in New Issue
Block a user