[alt.sources] ecu - SCO XENIX V/{2,3}86 Extended CU part 33/47

wht@tridom.uucp (Warren Tucker) (10/12/89)

---- Cut Here and unpack ----
#!/bin/sh
# this is part 33 of a multipart archive
# do not concatenate these parts, unpack them in order with /bin/sh
# file uucp/dialhclone.c continued
#
CurArch=33
if test ! -r s2_seq_.tmp
then echo "Please unpack part 1 first!"
     exit 1; fi
( read Scheck
  if test "$Scheck" != $CurArch
  then echo "Please unpack part $Scheck next!"
       exit 1;
  else exit 0; fi
) < s2_seq_.tmp || exit 1
echo "x - Continuing file uucp/dialhclone.c"
sed 's/^X//' << 'SHAR_EOF' >> uucp/dialhclone.c
X	matchbaud(cbaud,low,high) -	determine dialer return code
X			based on connect, high, and low baud rates
X
X  Returns:	0			if connected baud == high baud
X			Bxxxx		if low baud <= connected baud <= high baud
X			RCE_NOCARR	if connected baud rate is out of range
X			(actually, bad carrier not 'no carrier'
X			but its a remote problem so RCE_SPEED is clearly wrong)
X--------------------------------------------------------------------------*/
Xmatchbaud(cbaud,low,high)
Xint cbaud,low,high;
X{
X	if(cbaud == high)
X		return(0);	      /* uucp/cu assume highest baud */
X	if(low <= cbaud  &&  cbaud <= high)
X		return(cbaud);
X	return(RC_FAIL | RCE_SPEED);
X}	/* end of matchbaud */
X
X/*+-------------------------------------------------------------------------
X	main(argc,argv,envp)
X--------------------------------------------------------------------------*/
Xmain(argc,argv,envp)
Xint argc;
Xchar **argv;
Xchar **envp;
X{
Xint itmp;
Xchar *phone;					/* phone number to dial */
Xchar command[MAXLINE];			/* modem command buffer */
Xint timeout;					/* how long to wait for alarm */
Xint dial_retry = DIAL_RETRY;	/* dial retry count */
Xchar *cptr;
X
Xextern int optind;
Xextern char *optarg;
X
X	/* reenable all those signals we want to know about */
X	signal(SIGILL,SIG_DFL);
X	signal(SIGIOT,SIG_DFL);
X	signal(SIGEMT,SIG_DFL);
X	signal(SIGFPE,SIG_DFL);
X	signal(SIGBUS,SIG_DFL);
X	signal(SIGSEGV,SIG_DFL);
X	signal(SIGSYS,SIG_DFL);
X	signal(SIGTERM,SIG_DFL);
X
X	while((itmp = getopt(argc,argv,"hx:")) != EOF)
X	{
X		switch(itmp)
X		{
X		case 'h':
X			hangup_flag++;
X			break;
X		case 'x':
X			Debug = atoi(optarg);
X			break;
X		case '?':
X			errflag++;
X			break;
X		}
X	}
X
X	if(Debug)
X	{
X		fprintf(stderr,"dialer args ");
X		for(itmp=0; itmp<argc; itmp++)  fprintf(stderr,":%s",argv[itmp]);
X		fprintf(stderr," (optind = %d)\r\n",optind);
X	}
X
X	if(hangup_flag)
X	{
X		if(argc - optind != 2)
X			errflag++;
X	}
X	else 
X	{
X		if(argc - optind != 3)
X			errflag++;
X	}
X
X	if(errflag)
X	{
X		if(hangup_flag)
X			fprintf(stderr,"Usage: %s -h devicename speed\r\n",argv[0]);
X		else
X			fprintf(stderr,"Usage: %s devicename number speed\r\n",argv[0]);
X		exit(RC_FAIL | RCE_ARGS);
X	}
X
X	acu = argv[optind++];
X
X	if(!hangup_flag)
X	{
X		phone = argv[optind++];
X		translate("=,-,",phone);
X		if(strlen(phone) != strspn(phone,mdvalid))
X		{
X			fprintf(stderr,"dial: Bad phone number %s\r\n",phone);
X			exit(RC_FAIL | RCE_PHNO);
X		}
X	}
X
X	/* get baud rates */
X	lowbaud = highbaud = checkbaud(atoi(argv[optind]));
X	if((cptr = strchr(argv[optind],'-')) != NULL)
X		highbaud = checkbaud(atoi(++cptr));
X
X#if !defined(HDUU)
X	if(!hangup_flag)
X	{
X		errflag = call_ungetty('a');
X		switch((errflag>>8) & 0xff)
X		{
X		case UG_NOTENAB:	/* line acquired: not enabled */
X			retcode = SUCCESS;
X			break;
X		case UG_ENAB:		/* line acquired: need ungetty -r when done */
X			retcode = RC_ENABLED;
X			break;
X		case UG_FAIL:		/* could not acquire line */
X			exit(RC_FAIL | RCE_INUSE);
X		case 255:
X			exit(RC_FAIL);
X		}
X	}
X#else
X	retcode = SUCCESS;	/* HDB UUCP does not require ungetty */
X#endif
X
X	fd = open_acu();	/* open the line */
X
X/* timeout after 10 seconds if no response */
X	timeout = 10;
X	signal(SIGALRM,alrmint);
X
X/*   H A N G U P     R E Q U E S T   */
X
X	if(hangup_flag)
X	{
X		close(fd);		/* toggle DTR */
X#if defined(MCOM9624C)
X		nap(6000L);		/* Microcom in reliable mode takes a LOOOONG time */
X#else
X		nap(300L);
X#endif
X		fd = open_acu();
X
X#if !defined(HDUU)
X		/* call ungetty to see if we need to switch to dialin */
X		errflag = call_ungetty('t');
X		if(((errflag>>8) & 0xff) != UG_RESTART)
X			cleanup(SUCCESS);
X#endif
X		/* setup modem for dialin */
X		mdwrite(mdreset);	/* reset ATZ */
X		nap(500L);
X		mdwrite(mddsblesc);		/* disable escape */
X		itmp = 5;
X		while(itmp--)
X		{
X			mdwrite(mddialin);	/* return to dial in mode */
X			nap(500L);
X			mdflush();
X			mdwrite("ATS0?\r");
X			if(mdread(3) > 128)	/* if S0 > 0, auto answer enabled */
X				break;
X			close(fd);			/* toggle DTR */
X			nap(300L);
X			fd = open_acu();
X		}
X
X		if(!itmp)
X		{
X			if(Debug >= 5)
X				fprintf(stderr,"cannot set modem for autoanswert\n");
X			cleanup(RC_FAIL | RCE_TIMOUT);
X		}
X
X#if !defined(HDUU)
X		errflag = call_ungetty('r');
X		cleanup( ((errflag>>8) & 0xff) ? RC_FAIL : SUCCESS );
X#else
X		cleanup(SUCCESS);
X#endif
X	}
X
X/*   D I A L    R E Q U E S T    */
X
X	/*  Initialize the modem */
X	while(1)
X	{
X#if defined(MCOM9624C)
X		mdsetup = (highbaud > B2400) ? mdsetup_REL : mdsetup_NORM;
X#endif
X		if(mdwrite(mdsetup) == -1)
X		{
X			if(dial_retry--)
X				continue;
X			cleanup(RC_FAIL | retcode);
X		}
X		if(mdread(timeout) != OK)
X		{
X			if(dial_retry--)
X				continue;
X			cleanup(RC_FAIL | retcode);
X		}
X		break;
X	}
X
X	/* command string can only be 40 characters excluding "AT" */
X	if(strlen(phone) > 38)	/* we'll add "DT" */
X		cleanup(RC_FAIL | RCE_PHNO | retcode);
X
X	/*  Build the dialing string */
X	sprintf(command,"ATDT%s\r",phone);
X
X	timeout = 6 * strlen(phone) + 30;	/* assumes S7=30 */
X
Xredial:
X	if(mdwrite(command) == -1)
X		cleanup(RC_FAIL | retcode);
X
X	dialing = 1;
X	DEBUG(6,"wait for connect - timeout %d\r\n",timeout);
X
X	switch(mdread(timeout))
X	{
X	case OK:
X	case ERROR:
X		if(dial_retry--) goto redial;
X		cleanup(RC_FAIL | RCE_NULL | retcode);
X	case CONNECT:	/* could be 110 or 300 ... next call is really a nop */
X		itmp = matchbaud(acu_termio.c_cflag & CBAUD,lowbaud,highbaud);
X		cleanup(retcode | itmp);
X	case CONNECT600:
X		itmp = matchbaud(B600,lowbaud,highbaud);
X		cleanup(retcode | itmp);
X	case CONNECT1200:
X		itmp = matchbaud(B1200,lowbaud,highbaud);
X		cleanup(retcode | itmp);
X	case CONNECT2400:
X		itmp = matchbaud(B2400,lowbaud,highbaud);
X		cleanup(retcode | itmp);
X	case CONNECT4800:
X		itmp = matchbaud(B4800,lowbaud,highbaud);
X		cleanup(retcode | itmp);
X	case CONNECT9600:
X		itmp = matchbaud(EXTA,lowbaud,highbaud);
X		cleanup(retcode | itmp);
X	case CONNECT19200:
X		itmp = matchbaud(EXTB,lowbaud,highbaud);
X		cleanup(retcode | itmp);
X	case NOANSWER:
X		cleanup(RC_FAIL | RCE_ANSWER | retcode);
X	case NODIALTONE:
X		cleanup(RC_FAIL | RCE_NOTONE | retcode);
X	case NOCARRIER:
X		cleanup(RC_FAIL | RCE_NOCARR | retcode);
X	case BUSY:
X		cleanup(RC_FAIL | RCE_BUSY | retcode);
X	default:
X		cleanup(RC_FAIL | retcode);
X	}
X}	/* end of main */
X
X/* end of dialUSR2400.c */
SHAR_EOF
echo "File uucp/dialhclone.c is complete"
chmod 0644 uucp/dialhclone.c || echo "restore of uucp/dialhclone.c fails"
echo "x - extracting xsel386/fixttiocom.c (Text)"
sed 's/^X//' << 'SHAR_EOF' > xsel386/fixttiocom.c &&
X/* CHK=0xCE9E */
X/*+-------------------------------------------------------------------------
X	fixttiocom.c - change ttiocom to Ttiocom calls in /usr/sys/sys/libsys.a
XThis program patched my Xenix 386 2.3.1 system library (a copy of which
Xhad been named libfix.a, fixed, verified, then moved to libsys.a)
X--------------------------------------------------------------------------*/
X/*+:EDITS:*/
X/*:07-17-1989-01:51-wht-creation */
X
X#include <stdio.h>
X#include <sys/types.h>
X#include <fcntl.h>
X
Xchar *lib = "libfix.a";
X
X/* file positions where names needed changing */
X#define PLACE1 0xdcaL
X#define PLACE2 0x1b1cbL
X#define PLACE3 0x1c41bL
X
X/*+-------------------------------------------------------------------------
X	main(argc,argv,envp)
X--------------------------------------------------------------------------*/
Xmain(argc,argv,envp)
Xint argc;
Xchar **argv;
Xchar **envp;
X{
Xint fd = open(lib,O_RDWR,0);
Xunsigned char ch1,ch2,ch3;
Xlong lseek();
X
X	if(fd < 0)
X	{
X		perror(lib);
X		exit(9);
X	}
X
X	if(lseek(fd,PLACE1,0) != PLACE1)
X	{
X		perror("seek1");
X		exit(1);
X	}
X	if(read(fd,&ch1,1) != 1)
X	{
X		perror("read1");
X		exit(1);
X	}
X	printf("char 1 = %02x\n",ch1);
X
X	if(lseek(fd,PLACE2,0) != PLACE2)
X	{
X		perror("seek2");
X		exit(2);
X	}
X	if(read(fd,&ch2,2) != 2)
X	{
X		perror("read2");
X		exit(2);
X	}
X	printf("char 2 = %02x\n",ch2);
X
X
X	if(lseek(fd,PLACE3,0) != PLACE3)
X	{
X		perror("seek3");
X		exit(3);
X	}
X	if(read(fd,&ch3,1) != 1)
X	{
X		perror("read3");
X		exit(3);
X	}
X	printf("char 3 = %02x\n",ch3);
X
X	if((ch1 != 't') || (ch2 != 't') || (ch3 != 't'))
X		exit(8);
X	if(lseek(fd,PLACE1,0) != PLACE1)
X	{
X		perror("seek1");
X		exit(1);
X	}
X	write(fd,"T",1);
X	if(lseek(fd,PLACE2,0) != PLACE2)
X	{
X		perror("seek1");
X		exit(1);
X	}
X	write(fd,"T",1);
X	if(lseek(fd,PLACE3,0) != PLACE3)
X	{
X		perror("seek1");
X		exit(1);
X	}
X	write(fd,"T",1);
X	printf("done\n");
X	close(fd);
X
X	exit(0);
X}	/* end of main */
X
X/* vi: set tabstop=4 shiftwidth=4: */
X/* end of fixttiocom.c */
SHAR_EOF
chmod 0644 xsel386/fixttiocom.c || echo "restore of xsel386/fixttiocom.c fails"
echo "x - extracting xsel386/select-update (Text)"
sed 's/^X//' << 'SHAR_EOF' > xsel386/select-update &&
XSubject: Re: Select(S) in Xenix 386 2.3.2
XNewsgroups: comp.unix.xenix
XKeywords: select, serial, pipes
XReferences: <117@accsys.acc.uu.no> <172@prmmbx.UUCP>
X
XIn article <172@prmmbx.UUCP>, csch@netcs.UUCP (Clemens Schrimpe) writes:
X> ivar@acc.uu.no (Ivar Hosteng) writes:
X> <> I have experienced some problems using the select call in Xenix 386 V2.3.2.
X> <> It does not seems to detect when a pipe gets ready to been read from.
X> This is, because there is no provision to select on pipes!
X> Why? The stuff is almost totally ported 1:1 from the Berkeley code and
X> in BSD pipes should consist of AF_UNIX sockets, on which you can naturally
X> select.
X> I was very angry, when I found this out after hours of digging with adb in
X> the kernel. But I also tried the same on a SUN under SunOS 4.0 and it doesn't
X> work either ... seems to be a common illness ???
X> (I wonder, because the code for that is very simple ... ??? ...)
X> 
X> <> I also 
X> <> have trouble using select on a serial port.  When I do that the input
X> <> turns into garbage.  This does not occur when I use select on the
X> <> multiscreen ttys (tty01-tty12).
X> Hehe - we had just the same!
X> Here is the solution (thanks to my colleague Stefan Koehler, who took one
X> look at my screen, into which I had starred for hours, to find it ...)
X> 
X> Select is implemented by an undocumented ioctl
X> 	(0xFFFF == IOC_SELECT -> [sys/slect.h])
X> which is handled by ttiocom() for all devices using the standard
X> SYS-V linediscipline!
X> 
X> The ioctl-routine for the serial devices [sioioctl()] just calls 
X> ttiocom() [after some undefinable VPIX stuff ???] and
X> if it returns NON-ZERO it calls sioparam(), which adjusts certain
X> parameters and garbles the output!
X> OK so far. Now: The Bug lies in the ttiocom-code within the check
X> for IOC_SELECT. After detecting the IOC_SELECT, the ttiocom calls
X> the select-code and returns NOTHING, which means that if EAX is
X> non-zero (randomly) sioparam() is called and garbles the output.
X> 
X> The Fix: (quick and dirty)
X> Write a routine called "ttiocom", which might look like this:
X> 
X> ttiocom(ttyp, com, arg, flag)
X> struct tty *ttyp;
X> int 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> 
X> Compile something like this, then use whatever you have (GNU-Emacs is
X> great in patching strings in binaries) to patch /usr/sys/sys/libsys.a
X> to change the original ttiocom into Ttiocom !
X> Link in your code and -by some magic reason- experience a full blown
X> select on your System V / Xenix machine!!!
X> 
X> Have fun playing around with it -
X> 
X> 	Clemens Schrimpe, netCS Informationstechnik GmbH Berlin
X> --
X> UUCP:		csch@netcs		BITNET:	csch@db0tui6.BITNET
X> ARPA/NSF:	csch@garp.mit.edu	PSI: PSI%45300033047::CSCH
X> PHONE:		+49-30-24 42 37		FAX: +49-30-24 38 00
X> BTX:		0303325016-0003		TELEX: 186672 net d
X
X
SHAR_EOF
chmod 0644 xsel386/select-update || echo "restore of xsel386/select-update fails"
echo "x - extracting xsel386/select.asm (Text)"
sed 's/^X//' << 'SHAR_EOF' > xsel386/select.asm &&
X** CHK=0xFE96
X;  CHK=0x1E37
X;+----------------------------------------------------------
X; select(S)
X;
X;#include <stdio.h>
X;#include <sys/select.h>
X;#include <fcntl.h>
X;
X;main(argc,argv,envp)
X;int argc;
X;char **argv;
X;char **envp;
X;{
X;struct timeval t;
X;int readfds;
X;int fd = open("/dev/null",O_RDONLY,0);
X;
X;	readfds = 1<<fd | 1<<0;
X;
X;	t.tv_sec = 5;
X;	t.tv_usec = 0;
X;
X;	printf("%d\n",select(32,&readfds,0,0,&t));
X;	printf("%08x\n",readfds);
X;	exit(0);
X;}	/* end of main */
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; vi: set tabstop=8 :
SHAR_EOF
chmod 0644 xsel386/select.asm || echo "restore of xsel386/select.asm fails"
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 <sys/select.h> (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 <sys/systm.h>) 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<sys/systm.h>) 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  
SHAR_EOF
echo "End of part 33"
echo "File xsel386/select.txt is continued in part 34"
echo "34" > s2_seq_.tmp
exit 0
-- 
-------------------------------------------------------------------
Warren Tucker, Tridom Corporation       ...!gatech!emory!tridom!wht 
Ker-au'-lo-phon.  An 8-foot partial flue-stop, having metal pipes
surmounted by adjustable rings, and with a hole bored near the top
of each pipe, producing a soft and "reedy" tone.