From pa.dec.com!shlump.nac.dec.com!decuac!haven!udel!wuarchive!uunet!sparky!kent Sat Feb 2 14:34:07 PST 1991 Article: 2000 of comp.sources.misc Path: pa.dec.com!shlump.nac.dec.com!decuac!haven!udel!wuarchive!uunet!sparky!kent From: wht@n4hgf.uucp (Warren Tucker) Newsgroups: comp.sources.misc Subject: v16i052: ECU async comm package rev 3.0, Part28/35 Message-ID: <1991Jan6.053921.28800@sparky.IMD.Sterling.COM> Date: 6 Jan 91 05:39:21 GMT Sender: kent@sparky.IMD.Sterling.COM (Kent Landfield) Organization: Sterling Software, IMD Lines: 784 Approved: kent@sparky.imd.sterling.com X-Checksum-Snefru: 8f09a46a 82e03e13 a23f1b9e bd548500 Submitted-by: wht@n4hgf.uucp (Warren Tucker) Posting-number: Volume 16, Issue 52 Archive-name: ecu3/part28 ---- Cut Here and feed the following to sh ---- #!/bin/sh # This is part 28 of ecu3 if touch 2>&1 | fgrep 'amc' > /dev/null then TOUCH=touch else TOUCH=true fi # ============= xsel386/select.txt ============== if test ! -d 'xsel386'; then echo 'x - creating directory xsel386' mkdir 'xsel386' fi echo 'x - extracting xsel386/select.txt (Text)' sed 's/^X//' << 'SHAR_EOF' > 'xsel386/select.txt' && XNOTE from ...!gatech!emory!tridom!wht: Xthe following is the mail message I originally received; with Xa little tinkering, i got the select call to behave as advertised Xin the BSD manual (my xenix is 386 2.3). Added it to /lib/386/Slibx.a Xand all is well for me. Good luck. X X XFrom emory!gatech!hubcap!ncrcae!ncr-sd!crash!elgar!ag Thu Feb 2 13:04:07 EST 1989 XArticle 4851 of comp.unix.xenix: XPath: tridom!emory!gatech!hubcap!ncrcae!ncr-sd!crash!elgar!ag X>From: ag@elgar.UUCP (Keith Gabryelski) XNewsgroups: comp.unix.xenix XSubject: select() on SCO XENIX 2.3. XMessage-ID: <38@elgar.UUCP> XDate: 24 Jan 89 04:54:17 GMT XReply-To: ag@elgar.UUCP (Keith Gabryelski) XOrganization: Elgar Corporation, San Diego, CA XLines: 474 X XA few days ago I was paging through my SCO XENIX 2.3.1 Release Notes Xand found, on page 44 (section 16), a section describing 4BSD Xenhancements to the current release of SCO XENIX. X Xselect(S) was mentioned specifically. X XI checked the rest of the 2.3 manuals to see if there was a clue on Xhow to access select(); no dice. I tried my 2.2 dev sys libraries to Xsee if it had been supported in previous releases and just not Xmentioned; negative. X XI decided to see if I could get select() to work on my system. And Xthat is what this article is about. X XI checked /xenix and found: X X % nm xenix | grep select X nm: xenix: too many symbols to sort # chuckle X 0020:00015bec T _select X XBingo! I also found (which has a comment about Xthe select(2) system call. :-) ). X XWhen a system call is made in a C program on a Unix system (eg Xopen(2)), it actually links in a file from libc.a (/lib/libc.a) (in Xthis case `open.o') written in assembly that loads a register with a Xsystem call number and causes an exception to occur. The `trap' Xinstruction is used on the 68000, on a vax it's `chmk', and on a 370 Xit's `svc'. Control is transfered to the kernel which (in the case of Xthis particular exception) will index the register into a table X(called the sysent table) to get the address of the actual routine in Xkernel memory to call (_open). X XAt least under SCO XENIX this algorithm is modified somewhat. X XWhen a system call is made in a C program on a SCO XENIX system (eg Xopen(S)), it links in a file from libc.a (/lib/386/Slibc.a) (in this Xcase `open.o') written in assembly that loads the register `eax' with Xa system call number and jumps to 7:0 which (a guess) is mapped to an Xinstruction that switches into supervisory mode and jumps to the Xroutine ioint (??) in the kernel address space. The interrupt routine Xhands the system call number (along with the user given arguments) to X_trap with figures out what to sysent table to use (there are a few Xunder SCO XENIX) and does the right thing. X XThe _open routine (in libc.a's open.o) would probably look something Xlike: X X; X; open - open a file for reading or writing X; X X title open X X .386 X XSYSNUM equ 5 ; open's system call number is `5'. Xextrn _errno:dword X Xpublic _open X X_TEXT segment dword use32 public 'CODE' X assume cs: _TEXT X_open proc near X mov eax, SYSNUM ; Get system call number. X X ; X ; I don't even pretend to understand masm syntax. I tried X ; the following line (and variations) without any success. X ; X X; call far 7:0 ; Switch to kernel and call SYSNUM. X X ; X ; Don't laugh, it works. X ; X X db 9ah X dw 0,0 X dw 7 X X jb short _cerror ; below == error. X X xor eax, eax ; zero return value (no error). X ret ; done. X X_cerror: X mov _errno, eax ; Save error code in _errno. X mov eax, -1 ; Return -1 (as error). X ret ; done. X X_open endp X X_TEXT ends X X end X XUnder SCO XENIX the sysent table (struct sysent in ) looks Xsomething like: X Xstruct sysent X{ X unsigned char sy_ret; /* Type of return value (int, void ...) */ X unsigned char sy_arg386; /* Number of 386 words args on stack */ X unsigned char sy_nlarg286; /* # of 286 large model word args on stack */ X unsigned char sy_nmarg286; /* 286 Small Middle: max # of args */ X unsigned sy_argmask; /* Argument types on stack. */ X int (*sy_call)(); /* System call address in kernel */ X} X Xsy_ret is the type return of the value this system call returns. `0' Xseems to be INT and `6' is probably void. X Xsy_arg386 is the number of words the arguments for this system call Xtake on the stack. X Xsy_nlarg286 and sy_nmarg286 are similar to sy_arg386 but used for Xdoing 286 stuff. I don't plan on mentioning the 286 stuff in this Xarticle that much, it just isn't interesting to me. X Xsy_argmask is the type of args on the stack using the following table: X XNUM | SYMBOL | 386 | 286L | EXPLANATION X 0 | | | | Arg not used. X 1 | DATAP | 2 | 1 | Arg is a data pointer; seg + address X 2 | TEXTP | 2 | 1 | Arg is a text pointer; seg + address X 3 | CONST | 1 | 1 | Arg is an int-sized constant X 4 | UCONST | 1 | 1 | Arg is an unsigned int-sized constant X 5 | LCONST | 1 | 1 | Arg is a long-sized constant X 6 | FDATAP | 1 | 1 | Arg is FAR data pointer. X 7 | SODATAP | 2 | | 386: 32-bit offset. X | | | 1 | 286: low word is 16 bit data pointer offset, X | | | | high word is 16 bit selector. X 8 | SOTEXTP | 2 | | 386: 32-bit offset. X | | | 1 | 286: low word is 16 bit text pointer offset, X | | | | high word is 16 bit selector. X XEach nybble in sy_argmask represents one argument passed to the system Xcall. Bits 0-3 represent arg one; 4-7 arg two; 8-12 arg three; etc. XA total of eight arguments (4 bits times 8 args = 32 bits in an int) Xcan be passed to a function (although MASK, a macro used to make Xsysent's sy_argmask field is limited to six arguments). X XNUM is the number (put in each nybble) represented by the SYMBOL (in X) that corresponds to the arg type EXPLANATION and takes X[386|286] (depending on the model you are using) words on the user Xstack. X XSo, for the open() system call: sy_argmask is 0x00000331 and sy_arg386 Xis 0x04. X X open(char *path, int oflag, int mode); X ^^^^^^ ^^^ ^^^ X DATAP CONST CONST X Xsy_call is the pointer to the function in kernel memory that should Xhandle this system call request. X XThe sysent table on my system looks something like: X XSyscal Num | ret| 386| L | SM | Arg Types | System Call Xsysent: X 00 | 00 | 00 | 00 | 03 | 0 0 0 0 0 0 0 0 | _nosys X 01 | 00 | 02 | 01 | 05 | 0 0 0 0 0 0 0 1 | _rexit X 02 | 00 | 00 | 00 | 03 | 0 0 0 0 0 0 0 0 | _fork X 03 | 00 | 04 | 03 | 03 | 0 0 0 0 0 4 1 3 | _read X 04 | 00 | 04 | 03 | 03 | 0 0 0 0 0 4 1 3 | _write X 05 | 00 | 04 | 03 | 03 | 0 0 0 0 0 3 3 1 | _open X 06 | 00 | 01 | 01 | 03 | 0 0 0 0 0 0 0 3 | _close X 07 | 00 | 00 | 00 | 03 | 0 0 0 0 0 0 0 0 | _wait X 08 | 00 | 03 | 02 | 03 | 0 0 0 0 0 0 3 1 | _creat X 09 | 00 | 04 | 02 | 03 | 0 0 0 0 0 0 1 1 | _link X 0a | 00 | 02 | 01 | 03 | 0 0 0 0 0 0 0 1 | _unlink X 0b | 00 | 04 | 02 | 03 | 0 0 0 0 0 0 1 1 | _exec X 0c | 00 | 02 | 01 | 03 | 0 0 0 0 0 0 0 1 | _chdir X 0d | 00 | 00 | 00 | 05 | 0 0 0 0 0 0 0 0 | _gtime X 0e | 00 | 04 | 03 | 03 | 0 0 0 0 0 3 3 1 | _mknod X 0f | 00 | 03 | 02 | 03 | 0 0 0 0 0 0 3 1 | _chmod X 10 | 00 | 04 | 03 | 03 | 0 0 0 0 0 3 3 1 | _chown X 11 | 00 | 02 | 01 | 03 | 0 0 0 0 0 0 0 7 | _brk X 12 | 00 | 04 | 02 | 03 | 0 0 0 0 0 0 1 1 | _stat X 13 | 00 | 04 | 03 | 05 | 0 0 0 0 0 3 5 3 | _seek X 14 | 00 | 00 | 00 | 03 | 0 0 0 0 0 0 0 0 | _getpid X 15 | 00 | 05 | 03 | 03 | 0 0 0 0 0 3 1 1 | _smount X 16 | 00 | 02 | 01 | 03 | 0 0 0 0 0 0 0 1 | _sumount X 17 | 00 | 01 | 01 | 03 | 0 0 0 0 0 0 0 4 | _setuid X 18 | 00 | 00 | 00 | 03 | 0 0 0 0 0 0 0 0 | _getuid X 19 | 00 | 02 | 01 | 03 | 0 0 0 0 0 0 0 5 | _stime X 1a | 00 | 05 | 04 | 03 | 0 0 0 0 3 1 3 3 | _ptrace X 1b | 00 | 01 | 01 | 04 | 0 0 0 0 0 0 0 3 | _alarm X 1c | 00 | 03 | 02 | 03 | 0 0 0 0 0 0 1 3 | _fstat X 1d | 00 | 00 | 00 | 03 | 0 0 0 0 0 0 0 0 | _pause X 1e | 00 | 04 | 02 | 03 | 0 0 0 0 0 0 1 1 | _utime X 1f | 00 | 03 | 02 | 03 | 0 0 0 0 0 0 1 3 | _stty X 20 | 00 | 03 | 02 | 03 | 0 0 0 0 0 0 1 3 | _gtty X 21 | 00 | 03 | 02 | 03 | 0 0 0 0 0 0 3 1 | _saccess X 22 | 00 | 01 | 01 | 03 | 0 0 0 0 0 0 0 3 | _nice X 23 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | X 24 | 00 | 00 | 00 | 03 | 0 0 0 0 0 0 0 0 | _sync X 25 | 00 | 02 | 02 | 03 | 0 0 0 0 0 0 3 3 | _kill X 26 | 00 | 00 | 01 | 00 | 0 0 0 0 0 0 0 0 | X 27 | 00 | 00 | 02 | 00 | 0 0 0 0 0 0 0 0 | X 28 | 00 | 00 | 03 | 00 | 0 0 0 0 0 0 0 0 | X 29 | 00 | 02 | 02 | 03 | 0 0 0 0 0 0 3 3 | _dup X 2a | 00 | 00 | 00 | 03 | 0 0 0 0 0 0 0 0 | _pipe X 2b | 00 | 02 | 01 | 05 | 0 0 0 0 0 0 0 1 | _times X 2c | 06 | 08 | 05 | 03 | 0 0 0 1 4 8 4 1 | _profil X 2d | 00 | 01 | 01 | 03 | 0 0 0 0 0 0 0 3 | _lock X 2e | 00 | 01 | 01 | 03 | 0 0 0 0 0 0 0 4 | _setgid X 2f | 00 | 00 | 00 | 03 | 0 0 0 0 0 0 0 0 | _getgid X 30 | 00 | 03 | 02 | 02 | 0 0 0 0 0 0 2 3 | _ssig X 31 | 00 | 00 | 01 | 03 | 0 0 0 0 0 0 0 3 | _msgsys X 32 | 06 | 07 | 04 | 03 | 0 0 0 0 5 5 1 3 | _sysi86 X 33 | 00 | 02 | 01 | 03 | 0 0 0 0 0 0 0 1 | _sysacct X 34 | 00 | 00 | 01 | 06 | 0 0 0 0 0 0 0 3 | _shmsys X 35 | 00 | 00 | 01 | 03 | 0 0 0 0 0 0 0 3 | _semsys X 36 | 00 | 04 | 03 | 03 | 0 0 0 0 0 7 3 3 | _ioctl X 37 | 00 | 00 | 04 | 00 | 0 0 0 0 0 0 0 0 | X 38 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 39 | 00 | 00 | 05 | 00 | 0 0 0 0 0 0 0 0 | X 3a | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 3b | 00 | 06 | 03 | 03 | 0 0 0 0 0 1 1 1 | _exece X 3c | 00 | 01 | 01 | 03 | 0 0 0 0 0 0 0 3 | _umask X 3d | 00 | 02 | 01 | 03 | 0 0 0 0 0 0 0 1 | _chroot X 3e | 00 | 00 | 06 | 00 | 0 0 0 0 0 0 0 0 | X 3f | 00 | 00 | 07 | 00 | 0 0 0 0 0 0 0 0 | X 40 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 41 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 42 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 43 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 44 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 45 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 46 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 47 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 48 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 49 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 4a | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 4b | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 4c | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 4d | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 4e | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 4f | 00 | 00 | 08 | 00 | 0 0 0 0 0 0 0 0 | X 50 | 00 | 00 | 09 | 00 | 0 0 0 0 0 0 0 0 | X 51 | 00 | 04 | 03 | 03 | 0 0 0 0 0 4 1 3 | _getdents X 52 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 53 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 54 | 00 | 00 | 0a | 00 | 0 0 0 0 0 0 0 0 | X 55 | 00 | 06 | 04 | 03 | 0 0 0 0 3 1 1 3 | _getmsg X 56 | 00 | 06 | 04 | 03 | 0 0 0 0 3 1 1 3 | _putmsg X 57 | 00 | 05 | 03 | 03 | 0 0 0 0 0 3 5 1 | _poll X 58 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 59 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 5a | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 5b | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 5c | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 5d | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 5e | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 5f | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 60 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 61 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 62 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 63 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 64 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 65 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 66 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 67 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 68 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 69 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 6a | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 6b | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 6c | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 6d | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 6e | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 6f | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 70 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 71 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 72 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 73 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 74 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 75 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 76 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 77 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 78 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 79 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 7a | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 7b | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 7c | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 7d | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 7e | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 7f | 00 | 05 | 05 | 0a | 0 0 0 0 0 0 0 0 | _clocal X X_v7sysent: X X 00 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | X 01 | 00 | 02 | 01 | 03 | 0 0 0 0 0 0 0 1 | _ftime X 02 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 03 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nullsys X 04 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 05 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 06 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 07 | 00 | 05 | 05 | 0a | 0 0 0 0 0 0 0 0 | _clocal X 08 | 00 | 00 | 00 | 08 | 0 0 0 0 0 0 0 0 | _cxenix X 09 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 0a | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 0b | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X X_s3sysent: X 01 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | X 02 | 00 | 06 | 04 | 03 | 0 0 0 0 3 3 1 1 | _statfs X 03 | 00 | 05 | 04 | 03 | 0 0 0 0 3 3 1 3 | _fstatfs X 04 | 00 | 01 | 01 | 03 | 0 0 0 0 0 0 0 3 | _setpgrp X 05 | 00 | 00 | 00 | 08 | 0 0 0 0 0 0 0 0 | _cxenix X 06 | 00 | 04 | 03 | 03 | 0 0 0 0 0 1 3 3 | _uadmin X 07 | 00 | 00 | 00 | 09 | 0 0 0 0 0 0 0 0 | _utssys X 08 | 00 | 03 | 03 | 03 | 0 0 0 0 0 3 3 3 | _fcntl X 09 | 00 | 03 | 02 | 05 | 0 0 0 0 0 0 5 3 | _ulimit X 0a | 00 | 00 | 01 | 03 | 0 0 0 0 0 0 0 1 | _rmdir X 0b | 00 | 00 | 02 | 03 | 0 0 0 0 0 0 3 1 | _mkdir X 0c | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X X_svidsysent: X X 01 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | X 02 | 00 | 06 | 04 | 03 | 0 0 0 0 3 3 1 1 | _statfs X 03 | 00 | 05 | 04 | 03 | 0 0 0 0 3 3 1 3 | _fstatfs X 04 | 00 | 00 | 01 | 03 | 0 0 0 0 0 0 0 3 | _setpgrp X 05 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 06 | 00 | 00 | 03 | 03 | 0 0 0 0 0 1 3 3 | _uadmin X 07 | 00 | 00 | 00 | 09 | 0 0 0 0 0 0 0 0 | _utssys X 08 | 00 | 00 | 03 | 03 | 0 0 0 0 0 3 3 3 | _fcntl X 09 | 00 | 00 | 02 | 05 | 0 0 0 0 0 0 5 3 | _ulimit X 0a | 00 | 00 | 01 | 03 | 0 0 0 0 0 0 0 1 | _rmdir X 0b | 00 | 00 | 02 | 03 | 0 0 0 0 0 0 3 1 | _mkdir X 0c | 00 | 00 | 03 | 03 | 0 0 0 0 0 0 0 0 | _nosys X X_clentry: used for oem CLOCAL routines. Empty on my system. X X_cxentry: used for SCO added stuff. X X 00 | 00 | 05 | 03 | 03 | 0 0 0 0 0 4 7 1 | _shutdown X 01 | 00 | 04 | 03 | 03 | 0 0 0 0 0 7 3 3 | _locking X 02 | 00 | 03 | 02 | 03 | 0 0 0 0 0 0 3 1 | _creatsem X 03 | 00 | 02 | 01 | 03 | 0 0 0 0 0 0 0 1 | _opensem X 04 | 00 | 01 | 01 | 03 | 0 0 0 0 0 0 0 3 | _sigsem X 05 | 00 | 01 | 01 | 03 | 0 0 0 0 0 0 0 3 | _waitsem X 06 | 00 | 01 | 01 | 03 | 0 0 0 0 0 0 0 3 | _nbwaitsem X 07 | 00 | 01 | 01 | 03 | 0 0 0 0 0 0 0 3 | _rdchk X 08 | 00 | 01 | 01 | 03 | 0 0 0 0 0 0 0 4 | _stkgrow X 09 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 0a | 00 | 03 | 02 | 03 | 0 0 0 0 0 0 5 3 | _chsize X 0b | 00 | 02 | 01 | 03 | 0 0 0 0 0 0 0 1 | _ftime X 0c | 00 | 02 | 01 | 05 | 0 0 0 0 0 0 0 5 | _nap X 0d | 00 | 05 | 04 | 01 | 0 0 0 0 3 4 3 1 | _sdget X 0e | 00 | 02 | 01 | 03 | 0 0 0 0 0 0 0 7 | _sdfree X 0f | 00 | 03 | 02 | 03 | 0 0 0 0 0 0 3 7 | _sdenter X 10 | 00 | 02 | 01 | 03 | 0 0 0 0 0 0 0 7 | _sdleave X 11 | 00 | 02 | 01 | 03 | 0 0 0 0 0 0 0 7 | _sdgetv X 12 | 00 | 03 | 02 | 03 | 0 0 0 0 0 0 3 7 | _sdwaitv X 13 | 00 | 05 | 03 | 01 | 0 0 0 0 0 7 5 3 | _brkctl X 14 | 00 | 00 | 00 | 00 | 0 0 0 0 0 0 0 0 | _nosys X 15 | 00 | 03 | 02 | 03 | 0 0 0 0 0 0 1 3 | _nfs_sys X 16 | 00 | 04 | 03 | 03 | 0 0 0 0 0 1 3 3 | _msgctl X 17 | 00 | 03 | 02 | 03 | 0 0 0 0 0 0 3 5 | _msgget X 18 | 00 | 05 | 04 | 03 | 0 0 0 0 3 3 1 3 | _msgsnd X 19 | 06 | 07 | 05 | 03 | 0 0 0 3 5 3 1 3 | _msgrcv X 1a | 00 | 05 | 04 | 03 | 0 0 0 0 7 3 4 3 | _semctl X 1b | 00 | 04 | 03 | 03 | 0 0 0 0 0 3 3 5 | _semget X 1c | 00 | 04 | 03 | 03 | 0 0 0 0 0 4 1 3 | _semop X 1d | 00 | 04 | 03 | 03 | 0 0 0 0 0 1 3 3 | _shmctl X 1e | 00 | 04 | 03 | 03 | 0 0 0 0 0 3 4 5 | _shmget X 1f | 00 | 04 | 03 | 06 | 0 0 0 0 0 3 7 3 | _shmat X 20 | 00 | 04 | 03 | 03 | 0 0 0 0 0 1 3 3 | _proctl X 21 | 00 | 03 | 00 | 06 | 0 0 0 0 0 0 3 7 | _execseg X 22 | 00 | 02 | 00 | 03 | 0 0 0 0 0 0 0 7 | _unexecseg X 23 | 00 | 00 | 03 | 03 | 0 0 0 0 0 5 5 1 | _swapon X 24 | 00 | 09 | 05 | 03 | 0 0 0 1 1 1 1 3 | _select X XI couldn't really figure out how uadmin() was accessed. libc's Xuadmin.o links in a routine that calls system call 0x37. Hmmm... X XThe _cxentry is accessed by (documented in the programmer's reference Xunder System Calls) setting a bit in the system call number. It seems Xas though it actually shifts the system call number up half a word and Xputs 0x28 in the low order halfword. X XNow we see that select() exists as a cxenix function (number 0x24), X XThere is also poll(), putmsg(), and getmsg() -- streams stuff. XSince the tty device is not a streams device (actually it looks as if Xthe streams stuff has been nulled out -- look at the master file for Xmore information) it is highly unlikely that these routines will do Xanything useful. Infact, they don't. Change the SYSNUM (and symbols) Xin the example open.s above to their appropriate values to try out the Xstreams routines. X Xselect.s looks something like: X X; select X; X; X; X X title select X X .386 X XSYSNUM equ 2428h X Xextrn _errno:dword X Xpublic _select X X_TEXT segment dword use32 public 'CODE' X assume cs: _TEXT X_select proc near X mov eax, SYSNUM ; Get system call number. X X ; X ; I don't even pretend to understand masm syntax. I tried X ; the following line (and variations) without any success. X ; X X; call far 7:0 ; Switch to kernel and call SYSNUM. X X ; X ; Don't laugh, it works. X ; X X db 9ah X dw 0,0 X dw 7 X X jb short _cerror ; below == error. X X xor eax, eax ; zero return value (no error). X ret ; done. X X_cerror: X mov _errno, eax ; Save error code in _errno. X mov eax, -1 ; Return -1 (as error). X ret ; done. X X_select endp X X_TEXT ends X X end X XThere is a header file you'll need in which has some Xinformation in it. X XA Synopsis of the SCO XENIX implementation: X X #include X X nfds = select(width readfds, writefds, exceptfds, timeout) X int width, *readfds, *writefds, *exceptfds; X struct timeval *timeout; /* timeval is a pointer to a structure */ X XI tested select() and found it to be half way implemented. It seems Xas if there must be some extra field in struct cdevsw . X XSo, I guess I wait 'til 3.2. X XPax, Keith X XPs, FYI. X XPps, if I made a mistake in my description of system call handling on XSCO XENIX or what not, please correct me. X XPpps, `call far 7:0' seems really reasonable to me. X-- Xag@elgar.CTS.COM Keith Gabryelski ...!{ucsd, crash}!elgar!ag X X SHAR_EOF $TOUCH -am 0925141489 'xsel386/select.txt' && chmod 0644 xsel386/select.txt || echo 'restore of xsel386/select.txt failed' Wc_c="`wc -c < 'xsel386/select.txt'`" test 21402 -eq "$Wc_c" || echo 'xsel386/select.txt: original size 21402, current size' "$Wc_c" # ============= xsel386/ttiocom.c ============== echo 'x - extracting xsel386/ttiocom.c (Text)' sed 's/^X//' << 'SHAR_EOF' > 'xsel386/ttiocom.c' && X X#include X#include X#include X Xttiocom(ttyp, com, arg, flag) Xstruct tty *ttyp; Xint com, arg, flag; /* there should be better types for this :-) */ X{ X if (com == IOC_SELECT) X { X ttselect(ttyp, flag); X return(0); /*** THIS IS IMPORTANT ***/ X } X return(Ttiocom(ttyp, com ,arg, flag)); X} X SHAR_EOF $TOUCH -am 0814204290 'xsel386/ttiocom.c' && chmod 0644 xsel386/ttiocom.c || echo 'restore of xsel386/ttiocom.c failed' Wc_c="`wc -c < 'xsel386/ttiocom.c'`" test 391 -eq "$Wc_c" || echo 'xsel386/ttiocom.c: original size 391, current size' "$Wc_c" # ============= shar.fls ============== echo 'x - extracting shar.fls (Text)' sed 's/^X//' << 'SHAR_EOF' > 'shar.fls' && XMake.ecu XREADME Xafterlint.c Xbamboozle.c Xbperr/bperr.c Xckermit/ckutio-orig.c Xckermit/ckutio.c Xckermit/ckutio.diff Xcmdtbl.c Xdialer.h Xdlent.h Xdoc/_basic.txt Xdoc/_end.txt Xdoc/_features.txt Xdoc/_hdb.txt Xdoc/_icmd.txt Xdoc/_intro.txt Xdoc/_p_cmd.txt Xdoc/_p_ifunc.txt Xdoc/_p_param.txt Xdoc/_p_sfunc.txt Xdoc/_proc.txt Xdoc/_startup.txt Xdoc/_tech.txt Xdoc/_top.txt Xdoc/ecu.txt Xdoc/runoff Xdvent.h Xecu.c Xecu.h XecuDCE.c XecuLCK.c Xecuchdir.c Xecucmd.h Xecudump.c Xecuerror.h Xecufinsert.c Xecufkey.c Xecufkey.h Xecufork.c Xecufork.h Xecufriend/Makefile Xecufriend/ecufriend.c Xecuhangup.h Xecuicmaux.c Xecuicmd.c Xecuicmhelp.c Xecuicmhist.c Xecukey.h Xeculine.c Xeculock.c Xecunumrev.c Xecupde.h Xecuphone.c Xecuphrase.c Xecurcvr.c Xecuscrdump.c Xecusetup.c Xecushm.c Xecushm.h Xecusighdl.c Xecutcap.c Xecutime.c Xecutty.c Xecutty.h Xecuuclc.c Xecuungetty.h Xecuungetty/Makefile Xecuungetty/ecuungetty.c Xecuusage.c Xecuutil.c Xecuvmin.h Xecuwinutil.c Xecuxenix.c Xecuxfer.c Xecuxkey.h Xesd.h Xesdutil.c Xexpresp.c Xfeval.c Xfeval.h Xgendial/Makefile Xgendial/dceMC9624.c Xgendial/dceT2500.c Xgendial/dceTBPlus.c Xgendial/dialer.h Xgendial/gendial.c Xgendial/template.c Xgint.c Xgstr.c Xhdbintf.c Xhelp/Makefile Xhelp/ecuhelp.src Xhelp/helpgen.c Xhelp/lint_args.h Xhelp/util.c Xlint_args.h Xlogevent.c Xmapkey/README Xmapkey/keys.usa.ecu.d Xmkoldproto.l Xmodels/bsd_uname.ep Xmodels/colors Xmodels/dir Xmodels/f.ep Xmodels/file_test.ep Xmodels/frame_test.ep Xmodels/gosub.ep Xmodels/goto_test.ep Xmodels/if_test.ep Xmodels/keys Xmodels/lookfortest.ep Xmodels/mhack_test.ep Xmodels/mkdir.ep Xmodels/oneline.ep Xmodels/opuslogin.ep Xmodels/p.ep Xmodels/phone Xmodels/phrases Xmodels/ps.ep Xmodels/put_ecu.ep Xmodels/root.ep Xmodels/rz_update.ep Xmodels/scm.ep Xmodels/senddate.ep Xmodels/sf_test.ep Xmodels/su.ep Xmodels/sysname.ep Xmodels/sz_update.ep Xmodels/szall.ep Xmodels/tty1a.mi Xmodels/tty2d.mi Xmodels/unixlogin.ep Xpatchlevel.h Xpc_scr.h Xpcmd.c Xpcmdfile.c Xpcmdif.c Xpcmdtty.c Xpcmdwhile.c Xpcmdxfer.c Xpoutput.c Xpprintf.c Xproc.c Xproc.h Xproc_error.c Xprocframe.c Xregexp.c Xrelop.h Xsea/Makefile Xsea/ecusea.c Xsea/ecusea.fls Xsea/lint_args.h Xsea/scurses.c Xsea/sealink.doc Xsea/sealink.imp Xshar.fls Xsmap.h Xstdio_lint.h Xsysdep.c Xutmpstat.c Xutmpstatus.h Xvar.c Xvar.h Xxsel386/fixttiocom.c Xxsel386/select-update Xxsel386/select.asm Xxsel386/select.txt Xxsel386/ttiocom.c Xz/Makefile Xz/comsrc.fls Xz/ecurz.c Xz/ecusz.c Xz/zcommon.c Xz/zcurses.c Xz/zdebug.c Xz/zlint.h Xz/zmodem.c Xz/zmodem.h Xzgcc SHAR_EOF $TOUCH -am 0815221090 'shar.fls' && chmod 0644 shar.fls || echo 'restore of shar.fls failed' Wc_c="`wc -c < 'shar.fls'`" test 2354 -eq "$Wc_c" || echo 'shar.fls: original size 2354, current size' "$Wc_c" # ============= sea/ecusea.fls ============== if test ! -d 'sea'; then echo 'x - creating directory sea' mkdir 'sea' fi echo 'x - extracting sea/ecusea.fls (Text)' sed 's/^X//' << 'SHAR_EOF' > 'sea/ecusea.fls' && Xecusea.c Xscurses.c SHAR_EOF $TOUCH -am 0814210390 'sea/ecusea.fls' && chmod 0644 sea/ecusea.fls || echo 'restore of sea/ecusea.fls failed' Wc_c="`wc -c < 'sea/ecusea.fls'`" test 19 -eq "$Wc_c" || echo 'sea/ecusea.fls: original size 19, current size' "$Wc_c" # ============= z/comsrc.fls ============== if test ! -d 'z'; then echo 'x - creating directory z' mkdir 'z' fi echo 'x - extracting z/comsrc.fls (Text)' sed 's/^X//' << 'SHAR_EOF' > 'z/comsrc.fls' && Xzcommon.c Xzcurses.c Xzdebug.c Xzmodem.c SHAR_EOF $TOUCH -am 0919194190 'z/comsrc.fls' && chmod 0644 z/comsrc.fls || echo 'restore of z/comsrc.fls failed' Wc_c="`wc -c < 'z/comsrc.fls'`" test 38 -eq "$Wc_c" || echo 'z/comsrc.fls: original size 38, current size' "$Wc_c" true || echo 'restore of ckermit/ckermit.01 failed' echo End of part 28, continue with part 29 exit 0 -------------------------------------------------------------------- Warren Tucker, TuckerWare emory!n4hgf!wht or wht@n4hgf.Mt-Park.GA.US Hacker Extraordinaire d' async PADs, pods, proteins and protocols exit 0 # Just in case... -- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM Sterling Software, IMD UUCP: uunet!sparky!kent Phone: (402) 291-8300 FAX: (402) 291-4362 Please send comp.sources.misc-related mail to kent@uunet.uu.net.