|
|
1.1 ! root 1: Date: Fri, 17 May 85 18:53:43 CDT ! 2: From: Gregg Wonderly <[email protected]> ! 3: Subject: Additional C-Kermit Implementation Notes for Version 7 UNIX ! 4: ! 5: The Version 7 implementation takes advantage of some information present ! 6: in the UNIX kernal to obtain the count of characters available for input from ! 7: a particular file descriptor. The function initrawq() is used to obtain the ! 8: kernal address of this value. It is a structure value that is associated with ! 9: the clist for the file descriptor passed. The struture member is the "rawq" ! 10: count of characters available. The include file <sys/clist.h> on our system ! 11: shows this value as the first "int" in the structure. The operations in ! 12: initrawq() cause the child process to "block", trying to read from the "tty" ! 13: file descriptor. Then, by looking through the "proc" structures, we find the ! 14: proper process, and get its "wchan" pointer. This is a pointer to the clist ! 15: in question, in the kernal memory. ! 16: ! 17: The "wchan" address can then be used as an offset by lseek to select the ! 18: proper address in the kernal (/dev/kmem) to read from. By reading the first ! 19: "int" at this address, we obtain a count of the characters available on the ! 20: raw input queue. ! 21: ! 22: The MAKE variables PROC, NPROCNAME, BOOTNAME, are necessary to get around ! 23: different naming conventions across systems. The variable PROC is the name ! 24: given to the process structure array on your system. The include file <sys/ ! 25: proc.h> (or some facsimile) should contain a declaration of the form: ! 26: ! 27: extern struct proc *proc; ! 28: or ! 29: extern struct proc proc[]; ! 30: ! 31: The name of the pointer/array, is what you are concerned with. It may be ! 32: something like "_proc", "proc", or some deriviation. You should define ! 33: the MAKE variable PROC to this string, whatever it may be. On our system, ! 34: I use "PROC=proc". If your definition is for an array, then you should define ! 35: the MAKE variable DIRECT to be "-DDIRECT", as it is in the MAKEFILE. If your ! 36: definition is for a pointer to the array, then you should remove the definition ! 37: of DIRECT, so the the line reads "DIRECT=" (no value here). This is necessary ! 38: for the routine to properly locate the "proc" array. If you have an array ! 39: declaration, then the call to nlist() will return the address of the array. ! 40: However, if you have a pointer, then nlist() returns the address of the ! 41: pointer. This requires one extra level of dereference to obtain the address of ! 42: the array. ! 43: ! 44: The same thing applies to the variable NPROCNAME. On our system, this is ! 45: defined as "NPROCNAME=nproc". This should also be declared in <sys/proc.h> ! 46: something like: ! 47: ! 48: extern int nproc; ! 49: ! 50: This value is the number (Maximum that is) of process entries in the "proc" ! 51: array. ! 52: ! 53: BOOTNAME is the name of the kernal image on your system. On our system, ! 54: it is "/edition7". On others, it is probably "/unix", or something close. ! 55: The nlist() function uses this file to look for the addresses of the kernal ! 56: variables "proc", and "nproc".
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.