Work on file usr/src/libc/gen/ttytest.c
Work on file usr/src/libc/sys/umount.s
Work on file usr/src/libc/sys/unlink.s
Work on file usr/src/libc/sys/wait.s
Work on file usr/src/libc/sys/write.s
Co-Authored-By: John Reiser <jfr@research.uucp>
Synthesized-from: 32v
--- /dev/null
+#include "stdio.h"
+main() {
+printf("\nttyname(fd)=%s\n", ttyname(0));
+printf("\nttyname=%s\n", ttyname(stdin));
+}
--- /dev/null
+# C library -- umount/
+
+ .set umount,22
+.globl _umount
+.globl cerror
+.comm _errno,4
+
+_umount:
+ .word 0x0000
+ chmk $umount
+ bcc noerror
+ jmp cerror
+noerror:
+ clrl r0
+ ret
--- /dev/null
+# C library -- unlink
+
+# error = unlink(string);
+#
+
+ .set unlink,10
+.globl _unlink
+.globl cerror
+
+_unlink:
+ .word 0x0000
+ chmk $unlink
+ bcc noerror
+ jmp cerror
+noerror:
+ clrl r0
+ ret
--- /dev/null
+# C library -- wait
+
+# pid = wait(0);
+# or,
+# pid = wait(&status);
+#
+# pid == -1 if error
+# status indicates fate of process, if given
+
+ .set wait,7
+.globl _wait
+.globl cerror
+
+ .align 1
+_wait:
+ .word 0x0000
+ chmk $wait
+ bcc noerror
+ jmp cerror
+noerror:
+ tstl 4(ap) # status desired?
+ beql nostatus # no
+ movl r1,*4(ap) # store child's status
+nostatus:
+ ret
--- /dev/null
+# C library -- write
+
+# nwritten = write(file, buffer, count);
+#
+# nwritten == -1 means error
+
+ .set write,4
+.globl _write
+.globl cerror
+
+_write:
+ .word 0x0000
+ chmk $write
+ bcc noerror
+ jmp cerror
+noerror:
+ ret