uipc.p2

Bradley Smith bes at holin.ATT.COM
Sun Aug 13 02:36:41 AEST 1989


: This is a shar archive.  Extract with sh, not csh.
: This archive ends with exit, so do not worry about trailing junk.
if test -f 'uipc'
then	rm 'uipc'
fi
if test -d 'uipc'
then	:
else	echo 'Making     uipc/'
	mkdir 'uipc'
fi
chmod 'u=rwx,g=rx,o=rx' 'uipc'
echo 'Extracting uipc/conf.h'
sed 's/^X//' > uipc/conf.h << '+ END-OF-FILE uipc/conf.h'
X/*
X *	@(#)conf.h	1.1	(Alex Crain)	6/20/89
X *
X *  conf.h - 3b1 specifics for the uipc driver.
X *
X *  (C) Copyright 1989 Alex Crain
X *
X */
X
X#ifndef _conf_h_
X#define _conf_h_
X
X/*
X *  Useful spls. 
X */
X
X#define splimp	spl7
X#define splnet	spl5
X
X/*
X *  Useful macros
X */
X
X#define MIN(x, y) ((x) < (y) ? (x) : (y))
X#define MAX(x, y) ((x) > (y) ? (x) : (y))
X
X/*
X *  stdata is a pointer to a streams structure, and is referenced in 
X *  sys/inode.h. We rename it here and use it for a socket pointer.
X */
X
X#define stdata socket
X#define i_sptr i_socket
X
X/*
X *  I never understood why at&t doesn't offer a complete set of these.
X *  ushort and uint are found in types.h, but uchar() is a kernel function,
X *  so we invent a complete set from scratch.
X */
X
Xtypedef unsigned long	u_long;
Xtypedef unsigned int	u_int;
Xtypedef unsigned short	u_short;
Xtypedef unsigned char	u_char;
X
X/*
X *  The number of available mbufs
X */
X
X#define NMBUF 512
X
X/*
X *  New signals. The signal numbers are not the same as BSD.
X */
X
X#define SIGURG		22
X#define SIGIO		23
X
X/*
X *  New flags for (struct file *)->i_flag
X */
X
X#define FMARK		00040
X#define FDEFER		00100
X
X/*
X *  Flags for iomove (addr, len, flag)
X */
X
X#define IO_WRITE	0		/* u.u_base -> addr	*/
X#define IO_READ		1		/* addr -> u.u_base	*/
X
X/*
X *  Flags for useracc (addr, len, flag)
X */
X
X#define UACC_READ	0
X#define UACC_WRITE	1
X
X/*
X *  define the relationship between file structures and sockets
X */
X
X#define filesock(FP)	mtod (ptom ((FP)->f_offset), struct socket *)
X#define sockoffset(SO)	mtop (dtom (SO), off_t)
X
X#endif /* _conf_h_ */
+ END-OF-FILE uipc/conf.h
chmod 'u=rw,g=rw,o=rw' 'uipc/conf.h'
echo '	-rw-rw-rw-   1 bes      HSJ         1561 Jul 18 23:44 uipc/conf.h        (as sent)'
echo '	\c'
/bin/ls -l uipc/conf.h
echo 'Extracting uipc/domain.h'
sed 's/^X//' > uipc/domain.h << '+ END-OF-FILE uipc/domain.h'
X/*
X *	@(#)domain.h	1.1	(Alex Crain)	6/20/89
X *
X *  domain.h - domain stucture definitions.
X *
X *  Written by Alex Crain.
X *
X *  This file is based in the Berkeley header file of the same
X *  name, but is *not* guarenteed to be in any way compatable. It is
X *  close enough to the berkeley code that the following applies...
X *
X *  Copyright (c) 1982, 1986, 1988 Regents of the University of California.
X *  All rights reserved.
X * 
X *  Redistribution and use in source and binary forms are permitted
X *  provided that this notice is preserved and that due credit is given
X *  to the University of California at Berkeley. The name of the University
X *  may not be used to endorse or promote products derived from this
X *  software without specific prior written permission. This software
X *  is provided "as is" without express or implied warranty.
X *
X */
X
X#ifndef _domain_h_
X#define _domain_h_
X
X#include <uipc/conf.h>
X
Xstruct domain {
X   int 		dom_family;
X   char 	* dom_name;
X   int		(* dom_init) ();
X   int		(* dom_externalize) ();
X   int		(* dom_dispose) ();
X   struct	protosw * dom_protosw, * dom_protoswNPROTOSW;
X   struct 	domain * dom_next;
X};
X
X#ifdef KERNEL
Xstruct domain * domains;
X#endif
X
X#endif _domain_h_
+ END-OF-FILE uipc/domain.h
chmod 'u=rw,g=rw,o=rw' 'uipc/domain.h'
echo '	-rw-rw-rw-   1 bes      HSJ         1217 Jul 18 23:44 uipc/domain.h        (as sent)'
echo '	\c'
/bin/ls -l uipc/domain.h
echo 'Extracting uipc/fproto.h'
sed 's/^X//' > uipc/fproto.h << '+ END-OF-FILE uipc/fproto.h'
X/*
X *	@(#)fproto.h	1.1	(Alex Crain)	6/20/89
X *
X *  fproto.h - function prototypes for uipc driver.
X *
X *  Written by Alex Crain.
X *
X *  This file contains ANSI function prototypes for the entire uipc 
X *  package and many of the existing system entry points. The prototypes 
X *  are blocked within a "#ifdef __STDC__" construct, the with an alternate
X *  "#else" block of old-style function declarations.
X */
X
X#ifndef _fproto_h_
X#define _fproto_h_
X
X#ifdef __STDC__
X/*
X *  Declarations from debug.c
X */
X
Xvoid dump_mbuf (struct mbuf *m, char *func);
X
X/*
X *  Declarations from domain.c
X */
X
Xvoid domaininit (void);
Xstruct protosw *pffindtype (int family, int type);
Xstruct protosw *pffindproto (int family, int protocol, int type);
X
X/*
X *  Declarations from interface.c
X */
X
Xvoid uipcinit (void);
Xvoid dosyscall(void);
Xint uipcrelease (void);
Xvoid uipc_write (void);
Xvoid uipc_read (void);
Xvoid uipc_close (off_t sp);
Xvoid bzero (char *s, int n);
Xint ufavail (void);
X
X/*
X *  Declarations from mbuf.c
X */
X
Xvoid mbinit(void);
Xstruct mbuf *m_get (int canwait, int type);
Xstruct mbuf *m_getclr (int canwait, int type);
Xstruct mbuf *m_free (struct mbuf *m);
Xstruct mbuf *m_more (int canwait, int type);
Xvoid m_freem (struct mbuf *m);
Xstruct mbuf *m_copy (struct mbuf *m, int off, int len);
X
X/*
X *  Declarations from socket.c
X */
X
Xint socreate (int domain, struct socket ** sop, int type, int proto);
Xint sobind (struct socket *so, struct mbuf *nam);
Xint solisten (struct socket *so, int backlog);
Xvoid sofree (struct socket *so);
Xint soclose (struct socket *so);
Xint soabort (struct socket *so);
Xint soaccept (struct socket *so, struct mbuf *nam);
Xint soconnect (struct socket *so, struct mbuf *nam);
Xint soconnect2 (struct socket *so1, struct socket *so2);
Xint sodisconnect (struct socket *so);
Xint sosend (struct socket *so, struct mbuf *nam, int flags, struct mbuf *rights);
Xint soreceive (struct socket *so, struct mbuf **nam, int flags, struct mbuf **rights);
Xvoid sorflush (struct socket *so);
Xint sosetopt (struct socket *so, int level, int optname, struct mbuf *m0);
Xint sogetopt (struct socket *so, int level, int optname, struct mbuf **mp);
Xvoid sohasoutofband (struct socket *so);
X
X/*
X *  Declarations from socket2.c
X */
X
X
Xvoid soisconnecting (struct socket *so);
Xvoid soisconnected (struct socket *so);
Xvoid soisdisconnecting (struct socket *so);
Xvoid soisdisconnected (struct socket *so);
Xstruct socket *sonewconn (struct socket *head);
Xvoid soinsque (struct socket *head, struct socket *so, int q);
Xint soqremque (struct socket *so, int q);
Xvoid socantsendmore (struct socket *so);
Xvoid socantrcvmore (struct socket *so);
Xvoid sbselqueue (struct sockbuf *sb);
Xvoid sbwait (struct sockbuf *sb);
Xvoid sbwakeup (struct sockbuf *sb);
Xvoid sowakeup (struct socket *so, struct sockbuf *sb);
Xint soreserve (struct socket *so, int sndcc, int rcvcc);
Xint sbreserve (struct sockbuf *sb, int cc);
Xvoid sbrelease (struct sockbuf *sb);
Xvoid sbappend (struct sockbuf *sb, struct mbuf *m);
Xvoid sbappendrecord (struct sockbuf *sb, struct mbuf *m0);
Xint sbappendaddr (struct sockbuf *sb, struct sockaddr *asa, struct mbuf *m0, struct mbuf *rights0);
Xint sbappendrights (struct sockbuf *sb, struct mbuf *m0, struct mbuf *rights);
Xvoid sbcompress (struct sockbuf *sb, struct mbuf *m, struct mbuf *n);
Xvoid sbflush (struct sockbuf *sb);
Xvoid sbdrop (struct sockbuf *sb, int len);
Xvoid sbdroprecord (struct sockbuf *sb);
X
X/*
X *  Declarations from syscalls.c
X */
X
Xint sosetup(void);	/* setup window stuff needed */
Xint soselect (void);
Xint socket (void);
Xint bind (void);
Xint listen (void);
Xint accept (void);
Xint connect (void);
Xint socketpair (void);
Xint sendto (void);
Xint send (void);
Xint sendmsg (void);
Xvoid sendit (int s, struct msghdr * mp, int flags);
Xint recvfrom (void);
Xint recv (void);
Xint recvmsg (void);
Xvoid recvit (int s, struct msghdr * mp, int flags, caddr_t np, caddr_t rp);
Xint setsockopt (void);
Xint getsockopt (void);
Xint sockpipe (void);
Xvoid getsockname (void);
Xint sockargs (struct mbuf **aname, caddr_t name, int namelen, int type);
Xstruct file *getsock (int fd);
X
X/*
X *  Declarations from usrreq.c
X */
X
Xint uipc_usrreq (struct socket *so, int req, struct mbuf *m, struct mbuf *nam, struct mbuf *rights);
Xint unp_attach (struct socket *so);
Xvoid unp_detach (struct unpcb *unp);
Xint unp_bind (struct unpcb *unp, struct mbuf *nam);
Xint unp_connect (struct socket *so, struct mbuf *nam);
Xint unp_connect2 (struct socket *so1, struct socket *so2);
Xvoid unp_disconnect (struct unpcb *unp);
Xvoid unp_usrclosed (struct unpcb *unp);
Xint unp_externalize (struct mbuf *rights);
Xint unp_internalize (struct mbuf *rights);
Xvoid unp_gc (void);
Xvoid unp_dispose (struct mbuf *m);
Xvoid unp_scan (struct mbuf *m0, int (*op)());
Xvoid unp_mark (struct file *fp);
Xvoid unp_discard (struct file *fp);
Xvoid unp_drop (struct unpcb *unp, int errno);
X
X/*
X * declarations for linesw.c
X */
Xint so_linesw_read(struct tty *tp);
Xint so_linesw_write(struct tty  *tp);
Xint so_linesw_setup(void);
X
X/* Misc stuff from -bes
X */
X
X
X/*
X *  declarations left out of systm.h
X */
X
Xint suser (void);
Xint fuword (int * addr);
Xint useracc (caddr_t address, int length, int flag);
X
Xshort spl7 (void);
Xshort spl6 (void);
Xshort spl5 (void);
Xshort spl4 (void);
Xshort spl3 (void);
Xshort spl2 (void);
Xshort spl1 (void);
Xshort splx (short sp);
X
Xint sleep (caddr_t addr, int p);
Xint wakeup (caddr_t addr);
Xvoid signal (int pgrp, int sig);
Xvoid psignal (struct proc * p, int sig);
Xint setjmp (label_t env);
Xvoid longjmp (label_t env, int val);
X
Xvoid panic (caddr_t msg);
Xvoid printf();
Xvoid eprintf();
X
Xint access (struct inode * ip, int mode);
Xextern struct inode * iget ();
Xvoid iput (struct inode * ip);
Xvoid prele (struct inode * ip);
Xint ufalloc (int fp);
Xvoid closef (struct file * fp);
Xvoid locsys ();
X
X#else ! __STDC__
X
X/*
X *  Declarations from debug.c
X */
X
Xvoid dump_mbuf ();
X
X/*
X *  Declarations from domain.c
X */
X
Xvoid domaininit ();
Xstruct protosw *pffindtype ();
Xstruct protosw *pffindproto ();
X
X/*
X *  Declarations from interface.c
X */
X
Xvoid uipcinit ();
Xvoid dosyscall();
Xint uipcrelease ();
Xvoid uipc_write ();
Xvoid uipc_read ();
Xvoid uipc_close ();
Xvoid bzero ();
Xint ufavail ();
X
X/*
X *  Declarations from mbuf.c
X */
X
Xvoid mbinit();
Xstruct mbuf *m_get ();
Xstruct mbuf *m_getclr ();
Xstruct mbuf *m_free ();
Xstruct mbuf *m_more ();
Xvoid m_freem ();
Xstruct mbuf *m_copy ();
X
X/*
X *  Declarations from socket.c
X */
X
Xint socreate ();
Xint sobind ();
Xint solisten ();
Xvoid sofree ();
Xint soclose ();
Xint soabort ();
Xint soaccept ();
Xint soconnect ();
Xint soconnect2 ();
Xint sodisconnect ();
Xint sosend ();
Xint soreceive ();
Xvoid sorflush ();
Xint sosetopt ();
Xint sogetopt ();
Xvoid sohasoutofband ();
X
X/*
X *  Declarations from socket2.c
X */
X
X
Xvoid soisconnecting ();
Xvoid soisconnected ();
Xvoid soisdisconnecting ();
Xvoid soisdisconnected ();
Xstruct socket *sonewconn ();
Xvoid soinsque ();
Xint soqremque ();
Xvoid socantsendmore ();
Xvoid socantrcvmore ();
Xvoid sbselqueue ();
Xvoid sbwait ();
Xvoid sbwakeup ();
Xvoid sowakeup ();
Xint soreserve ();
Xint sbreserve ();
Xvoid sbrelease ();
Xvoid sbappend ();
Xvoid sbappendrecord ();
Xint sbappendaddr ();
Xint sbappendrights ();
Xvoid sbcompress ();
Xvoid sbflush ();
Xvoid sbdrop ();
Xvoid sbdroprecord ();
X
X/*
X *  Declarations from syscalls.c
X */
X
Xint sosetup();	/* setup window stuff needed */
Xint soselect ();
Xint socket ();
Xint bind ();
Xint listen ();
Xint accept ();
Xint connect ();
Xint socketpair ();
Xint sockpipe ();
Xint sendto();
Xint send();
Xint recvfrom();
Xint recv ();
Xint setsockopt();
Xint getsockopt();
Xvoid sendit ();
Xint sockpipe ();
Xvoid getsockname ();
Xvoid recvit ();
Xint sockargs ();
Xstruct file *getsock ();
X
X/*
X *  Declarations from usrreq.c
X */
X
Xint uipc_usrreq ();
Xint unp_attach ();
Xvoid unp_detach ();
Xint unp_bind ();
Xint unp_connect ();
Xint unp_connect2 ();
Xvoid unp_disconnect ();
Xvoid unp_usrclosed ();
Xvoid unp_drop ();
Xint unp_externalize ();
Xint unp_internalize ();
Xvoid unp_gc ();
Xvoid unp_dispose ();
Xvoid unp_scan ();
Xvoid unp_mark ();
Xvoid unp_discard ();
X
X/*
X * declarations for linesw.c
X */
Xint so_linesw_read();
Xint so_linesw_write();
Xint so_linesw_setup();
X
X/*
X *  declarations left out of systm.h
X */
X
Xshort spl7 ();
Xshort spl6 ();
Xshort spl5 ();
Xshort spl4 ();
Xshort spl3 ();
Xshort spl2 ();
Xshort spl1 ();
Xshort splx ();
X
Xint sleep ();
Xint wakeup ();
X
Xvoid panic ();
Xvoid eprintf();
Xvoid signal ();
Xvoid psignal ();
X
Xint setjmp ();
Xvoid longjmp ();
X
Xint suser ();
X
X#endif __STDC__
X#endif _fproto_h_
+ END-OF-FILE uipc/fproto.h
chmod 'u=rw,g=rw,o=rw' 'uipc/fproto.h'
echo '	-rw-rw-rw-   1 bes      HSJ         8443 Aug 11 22:37 uipc/fproto.h        (as sent)'
echo '	\c'
/bin/ls -l uipc/fproto.h
echo 'Extracting uipc/mbuf.h'
sed 's/^X//' > uipc/mbuf.h << '+ END-OF-FILE uipc/mbuf.h'
X/*
X *	@(#)mbuf.h	1.1	(Alex Crain)	6/20/89
X *
X *  mbuf.h - mbuf description macros
X *
X *  Written by Alex Crain.
X *
X *  This file is loosly based in the Berkeley header file of the 
X *  same name, but is *not* guarenteed to be in any way compatable. It is
X *  close enough to the berkeley code that the following applies...
X *
X *  Copyright (c) 1982, 1986, 1988 Regents of the University of California.
X *  All rights reserved.
X * 
X *  Redistribution and use in source and binary forms are permitted
X *  provided that this notice is preserved and that due credit is given
X *  to the University of California at Berkeley. The name of the University
X *  may not be used to endorse or promote products derived from this
X *  software without specific prior written permission. This software
X *  is provided "as is" without express or implied warranty.
X *
X */
X
X#ifndef _mbuf_h_
X#define _mbuf_h_
X
X#include <uipc/conf.h>
X
X#define MSIZE		128
X
X#define MMINOFF		12
X#define MTAIL		4
X#define MMAXOFF		(MSIZE - MTAIL)
X#define MLEN		(MSIZE - MMINOFF - MTAIL)
X
X#define dtom(x)		((struct mbuf *)((int)(x) & ~(MSIZE - 1)))
X#define mtod(m, t)	((t)((int)(m) + (m)->m_off))
X
X#define ptom(x)		((struct mbuf *)(((int)(x) << 7) | mbmask))
X#define mtop(x, t)	((t)(((int)(x) >> 7) & 0xFFFF))
X
Xstruct mbuf {
X   struct	mbuf * m_next;
X   u_long	m_off;
X   short	m_len;
X   short	m_type;
X   u_char	m_dat[MLEN];
X   struct	mbuf * m_act;
X};
X
X#define MT_FREE		0
X#define MT_DATA		1
X#define MT_HEADER	2
X#define MT_SOCKET	3
X#define MT_PCB		4
X#define MT_SONAME	8
X#define MT_SOOPTS	10
X#define MT_RIGHTS	12
X
X/* flags to mget */
X#define M_DONTWAIT	0
X#define M_WAIT		1
X
X/* length to m_copy to copy all */
X#define M_COPYALL	10000000
X
X#define MGET(m, i, t)	\
X{  int _s = splimp ();		\
X   if ((m) = mfree)	\
X    {  if ((m)->m_type != MT_FREE) panic("mget"); (m)->m_type = t; \
X       mfree = (m)->m_next; (m)->m_next = (struct mbuf *) 0; \
X       (m)->m_off = MMINOFF; } \
X   else \
X       (m) = m_more (i, t); \
X   splx (_s); }
X
X#define MFREE(m, n) \
X{  int _s = splimp (); \
X   if ((m)->m_type == MT_FREE) panic ("mfree"); \
X   (m)->m_type = MT_FREE; \
X   (n) = (m)->m_next; (m)->m_next = mfree; mfree = (m); \
X   (m)->m_off = 0; (m)->m_act = 0;\
X   splx (_s); \
X   if (m_want) \
X    { m_want = 0; \
X      wakeup((caddr_t)&mfree); }}
X
X#ifdef KERNEL
Xstruct mbuf * mfree, * mbmem;
Xunsigned int mbmask;
Xint m_want;
Xstruct mbuf * m_get (), * m_getclr(), *m_free (), * m_more (), * m_copy ();
Xvoid m_freem ();
X#endif
X
X#endif _mbuf_h_
+ END-OF-FILE uipc/mbuf.h
chmod 'u=rw,g=rw,o=rw' 'uipc/mbuf.h'
echo '	-rw-rw-rw-   1 bes      HSJ         2484 Jul 18 23:44 uipc/mbuf.h        (as sent)'
echo '	\c'
/bin/ls -l uipc/mbuf.h
echo 'Extracting uipc/number-ptys.h'
sed 's/^X//' > uipc/number-ptys.h << '+ END-OF-FILE uipc/number-ptys.h'
X/* number-ptys.h - Eric H. Herrin II
X *
X * define the number of ptys here so the actual number only has to be in
X * one place.
X * 
X * Version 2.1
X */
X#define NUMBER_OF_PTYS 8
+ END-OF-FILE uipc/number-ptys.h
chmod 'u=rw,g=r,o=r' 'uipc/number-ptys.h'
echo '	-rw-r--r--   1 bes      HSJ          175 Aug  4 22:39 uipc/number-ptys.h        (as sent)'
echo '	\c'
/bin/ls -l uipc/number-ptys.h
echo 'Extracting uipc/protosw.h'
sed 's/^X//' > uipc/protosw.h << '+ END-OF-FILE uipc/protosw.h'
X/*
X *	@(#)protosw.h	1.1	(Alex Crain)	6/20/89
X *
X *  protosw.h - protocol switch definition
X *
X *  Written by Alex Crain.
X *
X *  This file is based in the Berkeley header file of the 
X *  same name, but is *not* guarenteed to be in any way compatable. It is
X *  close enough to the berkeley code that the following applies...
X *
X *  Copyright (c) 1982, 1986, 1988 Regents of the University of California.
X *  All rights reserved.
X * 
X *  Redistribution and use in source and binary forms are permitted
X *  provided that this notice is preserved and that due credit is given
X *  to the University of California at Berkeley. The name of the University
X *  may not be used to endorse or promote products derived from this
X *  software without specific prior written permission. This software
X *  is provided "as is" without express or implied warranty.
X *
X */
X
X#ifndef _proto_h_
X#define _proto_h_
X
X#include <uipc/conf.h>
X
Xstruct protosw {
X   short	pr_type;
X   struct	domain * pr_domain;
X   short	pr_protocol;
X   short	pr_flags;
X   int 		(* pr_input) ();
X   int		(* pr_output) ();
X   int		(* pr_ctlinput) ();
X   int		(* pr_ctloutput) ();
X   int		(* pr_usrreq) ();
X   int		(* pr_init) ();
X   int		(* pr_fasttimo) ();
X   int		(* pr_slowtimo) ();
X   int		(* pr_drain) ();
X};
X
X#define PR_SLOWHZ	2
X#define PR_FASTHZ	5
X
X/*
X *  values for pr_flags
X */
X
X#define PR_ATOMIC	0x01		/* exchange atomic messages only     */
X#define PR_ADDR		0x02		/* addresses given w/ messages	     */
X#define PR_CONNREQUIRED	0x04		/* connection reuired by protocol    */
X#define PR_WANTRCVD	0x08		/* want PRU_RCVD calls		     */
X#define PR_RIGHTS	0x10		/* passes capabilities		     */
X
X/*
X *  arguments to usrreq
X */
X
X#define PRU_ATTACH	0
X#define PRU_DETACH	1
X#define PRU_BIND	2
X#define PRU_LISTEN	3
X#define PRU_CONNECT	4
X#define PRU_ACCEPT	5
X#define PRU_DISCONNECT	6
X#define PRU_SHUTDOWN	7
X#define PRU_RCVD	8
X#define PRU_SEND	9
X#define PRU_ABORT	10
X#define PRU_CONTROL	11
X#define PRU_SENSE	12
X#define PRU_RCVOOB	13
X#define PRU_SENDOOB	14
X#define PRU_SOCKADDR	15
X#define PRU_PEERADDR	16
X#define PRU_CONNECT2	17
X#define PRU_FASTTIMO	18
X#define PRU_SLOWTIMO	19
X#define PRU_PROTORCV	20
X#define PRU_PROTOSEND	21
X
X#define PRE_NREQ	21
X
X#define PRCO_GETOPT	0
X#define PRCO_SETOPT	1
X
X#endif /* _proto_h_ */
+ END-OF-FILE uipc/protosw.h
chmod 'u=rw,g=rw,o=rw' 'uipc/protosw.h'
echo '	-rw-rw-rw-   1 bes      HSJ         2264 Jul 18 23:44 uipc/protosw.h        (as sent)'
echo '	\c'
/bin/ls -l uipc/protosw.h
echo 'Extracting uipc/pty.h'
sed 's/^X//' > uipc/pty.h << '+ END-OF-FILE uipc/pty.h'
X/* pty.h - Eric H. Herrin II (eric at ms.uky.edu)
X * 
X * some elementary definitions for the pty driver (UnixPC version)
X *
X * Version 2.1
X */
X
Xextern int ptsproc();
Xextern int ptyopen();
X
X#define True  (1 == 1)
X#define False (0 == 1)
X
X/*  This is the total number of ptys.  Note the maximum number here is
X *  currently 64 for the UnixPC (128 minor devices/2 minor devices per pty
X *  yields 64 total ptys).  I really don't see the need for more than 32
X *  on the 3B1, however, if someone does, then (s)he can change it.
X */
X#include <uipc/number-ptys.h>
X#define PTYCNT (dev_t)NUMBER_OF_PTYS
X
X/* some definitions to include kernel info from system header files.
X */
X#define KERNEL 1
X#define defined_io 1
X#define NOSTREAMS 1
X
X#define UNIXPC 1
X
X/* This macro returns True if the parameter is a master minor device number,
X * False otherwise.
X */
X#define Master( dev )	(minor(dev) >= PTYCNT)
X
Xextern struct tty pts_tty[];
Xextern int pts_cnt;
Xextern int ptystate[];
Xextern int pty_major;
+ END-OF-FILE uipc/pty.h
chmod 'u=rw,g=r,o=r' 'uipc/pty.h'
echo '	-rw-r--r--   1 bes      HSJ          983 Aug  6 11:00 uipc/pty.h        (as sent)'
echo '	\c'
/bin/ls -l uipc/pty.h
echo 'Extracting uipc/socket.h'
sed 's/^X//' > uipc/socket.h << '+ END-OF-FILE uipc/socket.h'
X/*
X *	@(#)socket.h	1.1	(Alex Crain)	6/20/89
X *
X *  socket.h - socket related definitions
X *
X *  Written by Alex Crain.
X *
X *  This file is loosly based in the Berkeley header file of the 
X *  same name, but is *not* guarenteed to be in any way compatable. It is
X *  close enough to the berkeley code that the following applies...
X *
X *  Copyright (c) 1982, 1986, 1988 Regents of the University of California.
X *  All rights reserved.
X * 
X *  Redistribution and use in source and binary forms are permitted
X *  provided that this notice is preserved and that due credit is given
X *  to the University of California at Berkeley. The name of the University
X *  may not be used to endorse or promote products derived from this
X *  software without specific prior written permission. This software
X *  is provided "as is" without express or implied warranty.
X *
X */
X
X#ifndef _socket_h_
X#define _socket_h_
X
X#include <uipc/conf.h>
X
X/*
X *  Socket types
X */
X
X#define SOCK_STREAM	1		/* stream socket	*/
X#define SOCK_DGRAM	2		/* datagram socket	*/
X#ifdef notdef
X#define SOCK_RAW	3		/* raw socket		*/
X#endif
X
X/*
X *  Socket option flags
X */
X
X#define SO_DEBUG	0x0001
X#define SO_ACCEPTCONN	0x0002
X#define SO_REUSEADDR	0x0004
X#define SO_KEEPALIVE	0x0008
X#define SO_DONTROUTE	0x0010
X#define SO_BROADCAST	0x0020
X#define SO_USELOOPBACK	0x0040
X#define SO_LINGER	0x0080
X#define SO_OOBINLINE	0x0100
X/*
X *  Extra socket options
X */
X
X#define SO_SNDBUF	0x1001
X#define SO_RCVBUF	0x1002
X#define SO_SNDLOWAT	0x1003
X#define SO_RCVLOWAT	0x1004
X#define SO_SNDTIMEO	0x1005
X#define SO_RCVTIMEO	0x1006
X#define SO_ERROR	0x1007
X#define SO_TYPE		0x1008
X
X/*
X *  Linger structure
X */
X
Xstruct linger {
X   int	l_onoff;
X   int	l_linger;
X};
X
X#define SOL_SOCKET	0xffff
X
X/*
X *  Address families
X */
X
X#define AF_UNSPEC	0
X#define AF_UNIX		1
X#define AF_INIT		2
X
X#define AF_MAX		3
X
X/*
X *  Structure for address specs.
X */
X
Xstruct sockaddr {
X   u_short	sa_family;		/* address family	*/
X   char		sa_data[14];		/* address spec		*/
X};
X
X/*
X *  Protocol families
X */
X
X#define PF_UNSPEC	AF_UNSPEC
X#define PF_UNIX		AF_UNIX
X#define PF_INET		AF_INET
X
X#define PF_MAX		AF_MAX
X
X/*
X *  maximum queue length for listen ()
X */
X
X#define SOMAXCONN	5
X
X
X/*
X *  message header for recvmsg and sendmsg calls.
X */
X
Xstruct msghdr {
X   caddr_t	msg_name;
X   int		msg_namelen;
X   caddr_t	msg_accrights;
X   int		msg_accrightslen;
X};
X
X#define MSG_OOB		0x01		/* flag for out-of-band data	*/
X#define MSG_PEEK	0x02		/* peek at incomming message	*/
X#define MSG_DONTROUTE	0x04		/* send without routing tables	*/
X
X#endif /* _socket_h_ */
+ END-OF-FILE uipc/socket.h
chmod 'u=rw,g=rw,o=rw' 'uipc/socket.h'
echo '	-rw-rw-rw-   1 bes      HSJ         2554 Jul 18 23:44 uipc/socket.h        (as sent)'
echo '	\c'
/bin/ls -l uipc/socket.h
echo 'Extracting uipc/socketvar.h'
sed 's/^X//' > uipc/socketvar.h << '+ END-OF-FILE uipc/socketvar.h'
X/*
X *	@(#)socketvar.h	1.1	(Alex Crain)	6/20/89
X *
X *  socketvar.h - socket related definitions
X *
X *  Written by Alex Crain.
X *
X *  This file is loosly based in the Berkeley header file of the 
X *  same name, but is *not* guarenteed to be in any way compatable. It is
X *  close enough to the berkeley code that the following applies...
X *
X *  Copyright (c) 1982, 1986, 1988 Regents of the University of California.
X *  All rights reserved.
X * 
X *  Redistribution and use in source and binary forms are permitted
X *  provided that this notice is preserved and that due credit is given
X *  to the University of California at Berkeley. The name of the University
X *  may not be used to endorse or promote products derived from this
X *  software without specific prior written permission. This software
X *  is provided "as is" without express or implied warranty.
X *
X */
X
X#ifndef _socketvar_h_
X#define _socketvar_h_
X
X#include <uipc/conf.h>
X
X/*
X *  structure describing a socket.
X */
X
Xtypedef ushort socketptr;
X
Xstruct socket {
X   short	so_type;
X   short	so_options;
X   short	so_linger;
X   short	so_state;
X   caddr_t	so_pcb;
X   struct	protosw * so_proto;
X
X   struct	socket * so_head;
X   struct	socket * so_q0;
X   struct	socket * so_q;
X   short	so_q0len;
X   short	so_qlen;
X   short	so_qlimit;
X   short	so_timeo;
X   ushort	so_error;
X   short	so_pgrp;
X   u_long	so_oobmark;
X
X   struct	sockbuf {
X      u_long	sb_cc;
X      u_long	sb_hiwat;
X      u_long	sb_mbcnt;
X      u_long	sb_mbmax;
X      u_long	sb_lowat;
X      struct	mbuf * sb_mb;
X      struct	proc * sb_sel;
X      short	sb_timeo;
X      short	sb_flags;
X   } so_rcv, so_snd;
X
X#define SB_MAX		(64 * 1024)
X#define SB_LOCK		0x01
X#define SB_WANT		0x02
X#define SB_WAIT		0x04
X#define SB_SEL		0x08
X#ifdef notdef
X#define SB_COLL		0x10
X#endif
X};
X
X/*
X *  Socket states
X */
X#define SS_NOFDREF		0x001
X#define SS_ISCONNECTED		0x002
X#define SS_ISCONNECTING		0x004
X#define SS_ISDISCONNECTING	0x008
X#define SS_CANTSENDMORE		0x010
X#define SS_CANTRCVMORE		0x020
X#define SS_RCVATMARK		0x040
X
X#define SS_PRIV			0x080
X#define SS_NBIO			0x100
X#define SS_ASYNC		0x200
X
X/*
X *  Socket macros
X */
X   
X#define sbspace(sb) \
X (MIN ((long) ((sb)->sb_hiwat - (sb)->sb_cc), \
X       (long) ((sb)->sb_mbmax - (sb)->sb_mbcnt)))
X
X#define sendallatonce(so) \
X ((so)->so_proto->pr_flags & PR_ATOMIC)
X
X#define soreadable(so) \
X ((so)->so_rcv.sb_cc || ((so)->so_state & SS_CANTRCVMORE) || \
X  (so)->so_qlen || (so)->so_error)
X
X#define sowriteable(so) \
X (sbspace (&(so)->so_snd) > 0 && \
X  (((so)->so_state & SS_ISCONNECTED) || \
X   ((so)->so_proto->pr_flags & PR_CONNREQUIRED) == 0) || \
X  ((so)->so_state & SS_CANTSENDMORE) || \
X  (so)->so_error)
X
X#define sballoc(sb, m) \
X{  (sb)->sb_cc += (m)->m_len; \
X   (sb)->sb_mbcnt += MSIZE; }
X
X#define sbfree(sb, m) \
X{  (sb)->sb_cc -= (m)->m_len; \
X   (sb)->sb_mbcnt -= MSIZE; }
X
X#define sblock(sb) \
X{   while ((sb)->sb_flags & SB_LOCK) \
X     {  (sb)->sb_flags |= SB_WANT; \
X	 (void) sleep ((caddr_t) &(sb)->sb_flags, PZERO+1); } \
X    (sb)->sb_flags |= SB_LOCK; }
X
X#define sbunlock(sb) \
X{  (sb)->sb_flags &= ~SB_LOCK; \
X   if ((sb)->sb_flags & SB_WANT) \
X    {  (sb)->sb_flags &= ~SB_WANT; \
X       wakeup ((caddr_t) &(sb)->sb_flags); }}
X
X#define sorwakeup(so)	sowakeup (so, &(so)->so_rcv)
X#define sowwakeup(so)	sowakeup (so, &(so)->so_snd)
X
X#ifdef KERNEL
X#ifdef __STDC__
Xstruct socket * sonewconn (struct socket *);
X#else  /* __STDC__ */
Xstruct socket * sonewconn ();
X#endif /* __STDC__ */
X
Xextern int	select_sleep; /* value to say if we need to wakeup */
Xextern int	select_sleep_addr; /* address we select on if wait in select */
X#endif KERNAL
X
X#endif /* _socketvar_h_ */
+ END-OF-FILE uipc/socketvar.h
chmod 'u=rw,g=rw,o=rw' 'uipc/socketvar.h'
echo '	-rw-rw-rw-   1 bes      HSJ         3629 Aug  2 20:49 uipc/socketvar.h        (as sent)'
echo '	\c'
/bin/ls -l uipc/socketvar.h
echo 'Extracting uipc/un.h'
sed 's/^X//' > uipc/un.h << '+ END-OF-FILE uipc/un.h'
X/*
X *	@(#)un.h	1.1	(Alex Crain)	6/20/89
X *
X *  UNIX Domain definitions
X */
X
X#ifndef _un_h_
X#define _un_h_
X
X#include <uipc/conf.h>
X
Xstruct sockaddr_un {
X   short	sun_family;		/* AF_UNIX		*/
X   char		sun_path[108];		/* path name		*/
X};
X
X#endif /* _un_h_ */
+ END-OF-FILE uipc/un.h
chmod 'u=rw,g=rw,o=rw' 'uipc/un.h'
echo '	-rw-rw-rw-   1 bes      HSJ          255 Jul 18 23:44 uipc/un.h        (as sent)'
echo '	\c'
/bin/ls -l uipc/un.h
echo 'Extracting uipc/unpcb.h'
sed 's/^X//' > uipc/unpcb.h << '+ END-OF-FILE uipc/unpcb.h'
X/*
X *	@(#)unpcb.h	1.1	(Alex Crain)	6/20/89
X *
X *  unpcb.h - unix intern protocol control block.
X *
X *  Written by Alex Crain.
X *
X *  This file is loosly based in the Berkeley file unpcb.h,
X *  but is *not* guarenteed to be in any way compatable. It is
X *  close enough to the Berkeley code that the following applies...
X *
X *  Copyright (c) 1982, 1986, 1988 Regents of the University of California.
X *  All rights reserved.
X * 
X *  Redistribution and use in source and binary forms are permitted
X *  provided that this notice is preserved and that due credit is given
X *  to the University of California at Berkeley. The name of the University
X *  may not be used to endorse or promote products derived from this
X *  software without specific prior written permission. This software
X *  is provided "as is" without express or implied warranty.
X *
X */
X
X#ifndef _unpcb_h_
X#define _unpcb_h_
X
X#include <uipc/conf.h>
X
Xstruct unpcb {
X   struct	socket * unp_socket;	/* backpointer to socket	     */
X   struct	inode * unp_inode;	/* file reference		     */
X   ino_t	unp_ino;		/* fake inode number		     */
X   struct	unpcb * unp_conn;	/* control block of connected socket */
X   struct	unpcb * unp_refs;	/* referencing socket liked list     */
X   struct	unpcb * unp_nextref;	/* link in unp_refs list	     */
X   struct	mbuf * unp_addr;	/* bound address of socket	     */
X   int		unp_cc;			/* copy of rcv.sb_cc		     */
X   int		unp_mbcnt;		/* copy of rcv.sb_mbcnt		     */
X};
X
X#define sotounpcb(so)	((struct unpcb *)((so)->so_pcb))
X
X#endif /* _unpcb_h_ */
+ END-OF-FILE uipc/unpcb.h
chmod 'u=rw,g=rw,o=rw' 'uipc/unpcb.h'
echo '	-rw-rw-rw-   1 bes      HSJ         1543 Jul 18 23:44 uipc/unpcb.h        (as sent)'
echo '	\c'
/bin/ls -l uipc/unpcb.h
if test -f 'lib'
then	rm 'lib'
fi
if test -d 'lib'
then	:
else	echo 'Making     lib/'
	mkdir 'lib'
fi
chmod 'u=rwx,g=rx,o=rx' 'lib'
echo 'Extracting lib/Makefile'
sed 's/^X//' > lib/Makefile << '+ END-OF-FILE lib/Makefile'
X#
X#	@(#)Makefile	1.1	(Alex Crain) 6/20/89
X#
X# Makefile for user interface to the uipc loadable driver.
X#
X# copyright (c) 1989 Alex Crain
X#
X
X# CC=gcc
XRM=/bin/rm
XMV=/bin/mv
XECHO=/bin/echo
XM4=/usr/bin/m4
XSHELL=/bin/sh
XGET=/usr/bin/get
XCFLAGS= -O $(VFLAG)
X
XSCCSDIR=../sccs/lib
X
X#
X# the various file catagories.
X#
XCALLS=xxx
XSSUPPORT=syserr.o __cerror.o 
XCSUPPORT=perror.o  select.o
XCSOURCE=perror.c select.c
XSCCSFILES=Makefile.m4 gencall.m4 generic.m4 sockpipe.m4\
Xsyserr.s __cerror.s perror.c
X
Xall: Makefile.m4
X	make libuipc.a CALLS="`m4 Makefile.m4`"
X
Xlibuipc.a: $(CALLS) $(SSUPPORT) $(CSUPPORT)
X	rm -f libuipc.a
X	ar cq libuipc.a $(CALLS) $(SSUPPORT) $(CSUPPORT)
X
X$(CALLS): ../sysconfig.m4 gencall.m4 generic.m4
X	$(ECHO) "define(MYSELF,$@)" | $(M4) - gencall.m4 > tmp.s
X	$(AS) -o $@ tmp.s
X	$(RM) tmp.s
X
X$(CSUPPORT): $(?:.o=.c)
X	$(CC) $(CFLAGS) -c $(?:.o=.c)
X
X$(SSUPPORT): $(?:.o=.s)
X	$(AS) $(?:.o=.s)
X
X$(SCCSFILES):
X	$(GET) $(GFLAGS) -p $(SCCSDIR)/s.$@ > $@
X
Xdepend:
X	cat Makefile | sed -e "/^### DEPEND LINE/q" > Make.tmp
X	$(CC) -I. -M $(SOURCES) >> Make.tmp
X	$(MV) Make.tmp Makefile
X
Xclean:
X	$(RM) -f libuipc.a *.o \#* *~ core
X
X
X### DEPEND LINE --- do not delete! ###
+ END-OF-FILE lib/Makefile
chmod 'u=rw,g=rw,o=rw' 'lib/Makefile'
echo '	-rw-rw-rw-   1 bes      HSJ         1167 Aug 12 09:24 lib/Makefile        (as sent)'
echo '	\c'
/bin/ls -l lib/Makefile
echo 'Extracting lib/Makefile.m4'
sed 's/^X//' > lib/Makefile.m4 << '+ END-OF-FILE lib/Makefile.m4'
Xdivert(-1)
X#	@(#)Makefile.m4	1.1	(Alex Crain)	6/19/89
X#
X#  This file is used to generate the arguments for Makefile.
X#
Xdefine(concat,$1$2$3$4$5)
Xdefine(RESULT,)
Xdefine(DEFSYSCALL,`define(`RESULT',concat(RESULT,$2,.o,` '))')
Xinclude(../sysconfig.m4)
Xdivert
XRESULT
+ END-OF-FILE lib/Makefile.m4
chmod 'u=rw,g=rw,o=rw' 'lib/Makefile.m4'
echo '	-rw-rw-rw-   1 bes      HSJ          263 Jul 18 23:43 lib/Makefile.m4        (as sent)'
echo '	\c'
/bin/ls -l lib/Makefile.m4
echo 'Extracting lib/__cerror.s'
sed 's/^X//' > lib/__cerror.s << '+ END-OF-FILE lib/__cerror.s'
X#
X	text
X	asciz	"@(#)__cerror.s	1.1	(Alex Crain) 6/19/89"
X#
X#  Error handler for system call stub functions
X#
X	global	__cerror
X__cerror:
X
X	mov.l	%d0,errno
X	mov.l	&-1,%d0
X	mov.l	&0xffffffff,%a0
X	rts
X
X	data
X
+ END-OF-FILE lib/__cerror.s
chmod 'u=rw,g=rw,o=rw' 'lib/__cerror.s'
echo '	-rw-rw-rw-   1 bes      HSJ          205 Jul 18 23:43 lib/__cerror.s        (as sent)'
echo '	\c'
/bin/ls -l lib/__cerror.s
echo 'Extracting lib/gencall.m4'
sed 's/^X//' > lib/gencall.m4 << '+ END-OF-FILE lib/gencall.m4'
Xdivert(-1)
X#
X#	@(#)gencall.m4	1.1	(Alex Crain) 6/20/89
X#
X# gencall.m4 - generate a system call stub function
X#
X# This file is used with the command
X#
X#	echo "define(MYSELF,<syscall>.o)" | m4 - gencall.m4 > <syscall>.s
X#
X# where syscall is the system call function to be generated. The call must
X# be defined in sysconfig.h with a DEFSYSCALL macro.
X#
X# The resulting stub function is patterened after the code in generic.m4, 
X# unless the the file <syscall>.m4 exists, in which case that code will be
X# used instead.
X#
Xdefine(MYNAME,substr(MYSELF,0,eval(len(MYSELF)-2)))
Xdefine(DEFSYSCALL,
X	`ifelse($2,MYNAME,
X		`define(SYSCALL_NUMBER,incr(SYSENT_OFFSET))')
X	 define(`SYSENT_OFFSET',incr(SYSENT_OFFSET))')
Xdefine(CONCAT,$1$2$3$4)
Xinclude(../sysconfig.m4)
Xinclude(generic.m4)
Xsinclude(CONCAT(MYNAME,.m4))
Xdefine(SYSCALL_NAME,MYNAME)
Xdefine(SCCSDEF,`CONCAT(MYSELF,.s,`	(Alex Crain)	6/1/89')')
Xdivert
XPROCEDURE
+ END-OF-FILE lib/gencall.m4
chmod 'u=rw,g=rw,o=rw' 'lib/gencall.m4'
echo '	-rw-rw-rw-   1 bes      HSJ          907 Jul 18 23:43 lib/gencall.m4        (as sent)'
echo '	\c'
/bin/ls -l lib/gencall.m4
echo 'Extracting lib/generic.m4'
sed 's/^X//' > lib/generic.m4 << '+ END-OF-FILE lib/generic.m4'
X#
X#	@(#)generic.m4	1.1	(Alex Crain)	6/19/89
X#
X#	generic form for system calls
X#
X#
Xdefine(PROCEDURE,
X`#
X	text
X	global SYSCALL_NAME
XSYSCALL_NAME:
X	mov.l	(%sp),-(%sp)			# move the return address
X	mov.l	&SYSCALL_NUMBER,4(%sp)			# insert the first argument
X	mov.w	&67,%d0				#
X	trap	&0				# trap to syslocal()
X	bcc	noerror				# return if status = 0
X	jmp	__cerror			# otherwise __cerror()
Xnoerror:					#
X	rts					#
X')
+ END-OF-FILE lib/generic.m4
chmod 'u=rw,g=rw,o=rw' 'lib/generic.m4'
echo '	-rw-rw-rw-   1 bes      HSJ          412 Jul 18 23:43 lib/generic.m4        (as sent)'
echo '	\c'
/bin/ls -l lib/generic.m4
echo 'Extracting lib/perror.c'
sed 's/^X//' > lib/perror.c << '+ END-OF-FILE lib/perror.c'
X#ifndef LINT
Xstatic char * sccsdef = "@(#)perror.c	1.1	(Alex Crain) 6/19/89";
X#endif
X
X/*
X *
X * Replace ment for the perror(3c) subroutine. Note that sys_errlist and
X * sys_nerr have been renamed to uipc_errlist and uipc_lasterr, and that 
X * uipc_firsterr has been added. uipc_firsterr and uipc_lasterr represent
X * the maximum negative and posative offsets to uipc_errlist, respectively.
X *
X * Note also that we don't check for overflow of the print buffer, but 1024
X * should be enough.
X */
X
Xvoid
Xperror(str)
X  char * str;
X{
X   extern int errno;
X   extern int uipc_lasterr;
X   extern int uipc_firsterr;
X   extern char * uipc_errlist[];
X   int offset = (int) ((char) errno);
X   char buffer[1024];
X
X   if (str && strlen (str))
X    {
X       strcpy (buffer, str);
X       strcat (buffer, ": ");
X    }
X   else
X       buffer[0] = '\0';
X
X   if (offset == 0 ||
X       (offset < 0 && offset >= uipc_firsterr) ||
X       (offset > 0 && offset <= uipc_lasterr))
X
X    {
X       strcat (buffer, uipc_errlist[offset]);
X       strcat (buffer, ".\n");
X    }
X   else
X       sprintf (&buffer[strlen (buffer)], "Unknown error # %d.\n", errno);
X
X   write (2, buffer, strlen (buffer));
X   return;
X}
+ END-OF-FILE lib/perror.c
chmod 'u=rw,g=rw,o=rw' 'lib/perror.c'
echo '	-rw-rw-rw-   1 bes      HSJ         1177 Jul 18 23:43 lib/perror.c        (as sent)'
echo '	\c'
/bin/ls -l lib/perror.c
echo 'Extracting lib/select.c'
sed 's/^X//' > lib/select.c << '+ END-OF-FILE lib/select.c'
X#ifndef LINT
Xstatic char * sccsdef = "@(#)select.c	1.1	(Brad Smith) 8/2/89";
X#endif
X
X/*
X * select call
X */
X
X#include	<signal.h>
X#include	<setjmp.h>
X
Xjmp_buf sel_jmp;
X
Xint
Xselect(nfds,readfds,writefds,execptfds,timeout)
Xint nfds, *readfds, *writefds, *execptfds;
Xlong *timeout;
X{
X   int ret;
X   int alrm_time, (*alrm_func)(), select_catch();
X   int rd_save, wr_save, ex_save;
X
X   if(readfds)
X	   rd_save = *readfds;
X   if(writefds)
X	   wr_save = *writefds;	/* NOT SUPPORTED YET*/
X   /* ex_save = *execptfds;	/* NOT SUPPORTED YET*/
X
X   if(timeout && (*timeout == 0)) { /* Poll it just once */
X	   ret = soselect(nfds, readfds, writefds, execptfds);
X	   return(ret);
X   }
X
X   if(timeout) { /* if we want a time to stop then */
X	alrm_time = alarm((int) (*timeout)); /* save old value */
X	alrm_func = signal(SIGALRM, select_catch); /* function */
X	if(setjmp(sel_jmp)) { /* got alarm */
X		/* means we had a timeout */
X		if(alrm_time) {
X			signal(SIGALRM, alrm_func); /* reset signal */
X			alarm(alrm_time);
X		} else
X			signal(SIGALRM, SIG_DFL);
X		return(0); /* tell them no data */
X	}
X   }
X   do {
X	   /* set bitmask incase this is more than first time */
X	   if(readfds) 
X		   *readfds = rd_save;
X	   /* *writefds = wr_save; /* */
X	   /* *execptfds = ex_save; /* */
X	   ret = soselect(nfds, readfds, writefds, execptfds);
X   } while(ret == 0);
X   if(timeout) { /* need to reset things */
X	   if(alrm_time) {
X		signal(SIGALRM, alrm_func); /* reset signal */
X		alarm(alrm_time);
X	   } else {
X		alarm(0);
X		signal(SIGALRM, SIG_DFL);
X	   }
X   }
X   return (ret); /* return value */
X}
Xselect_catch()
X{
X	/* got alarm */
X	longjmp(sel_jmp,1); /* tell them a timeout */
X}
+ END-OF-FILE lib/select.c
chmod 'u=rw,g=r,o=r' 'lib/select.c'
echo '	-rw-r--r--   1 bes      HSJ         1657 Aug 11 20:38 lib/select.c        (as sent)'
echo '	\c'
/bin/ls -l lib/select.c
echo 'Extracting lib/syserr.s'
sed 's/^X//' > lib/syserr.s << '+ END-OF-FILE lib/syserr.s'
X#
X		text
X		asciz	"@(#)syserr.s	1.1	(Alex Crain) 6/19/89"
X
X#
X#  System error messages for uipc perror() function.
X#
X
XERROR0:		asciz	"Error 0"			# 0
X
X#
X#  Standard unix errors
X#
X
XEPERM:		asciz	"Not super-user"		# 1
XENOENT:		asciz	"No such file or directory"	# 2
XESRCH:		asciz	"No such process"		# 3
XEINTR:		asciz	"interrupted system call"	# 4
XEIO:		asciz	"I/O error"			# 5
XENXIO:		asciz	"No such device or address"	# 6
XE2BIG:		asciz	"Arg list too long"		# 7
XENOEXEC:	asciz	"Exec format error"		# 8
XEBADF:		asciz	"Bad file number"		# 9
XECHILD:		asciz	"No children"			# 10
XEAGAIN:		asciz	"No more processes"		# 11
XENOMEM:		asciz	"Not enough core"		# 12
XEACCES:		asciz	"Permission denied"		# 13
XEFAULT:		asciz	"Bad address"			# 14
XENOTBLK:	asciz	"Block device required"		# 15
XEBUSY:		asciz	"Mount device busy"		# 16
XEEXIST:		asciz	"File exists"			# 17
XEXDEV:		asciz	"Cross-device link"		# 18
XENODEV:		asciz	"No such device"		# 19
XENOTDIR:	asciz	"Not a directory"		# 20
XEISDIR:		asciz	"Is a directory"		# 21
XEINVAL:		asciz	"Invalid argument"		# 22
XENFILE:		asciz	"File table overflow"		# 23
XEMFILE:		asciz	"Too many open files"		# 24
XENOTTY:		asciz	"Not a typewriter"		# 25
XETXTBSY:	asciz	"Text file busy"		# 26
XEFBIG:		asciz	"File too large"		# 27
XENOSPC:		asciz	"No space left on device"	# 28
XESPIPE:		asciz	"Illegal seek"			# 29
XEROFS:		asciz	"Read only file system"		# 30
XEMLINK:		asciz	"Too many links"		# 31
XEPIPE:		asciz	"Broken pipe"			# 32
XEDOM:		asciz	"Math arg out of domain of func"# 33
XERANGE:		asciz	"Math result not representable"	# 34
XENOMSG:		asciz	"No message of desired type"	# 35
XEIDRM:		asciz	"Identifier removed"		# 36
XECHRNG:		asciz	"Channel number out of range"	# 37
XEL2NSYNC:	asciz	"Level 2 not synchronized"	# 38
XEL3HLT:		asciz	"Level 3 halted"		# 39
XEL3RST:		asciz	"Level 3 reset"			# 40
XELNRNG:		asciz	"Link number out of range"	# 41
XEUNATCH:	asciz	"Protocol driver not attached"	# 42
XENOCSI:		asciz	"No CSI structure available"	# 43
XEL2HLT:		asciz	"Level 2 halted"		# 44
X
X#
X#  filler messages
X#
X
XERROR45:	asciz	"Error 45"			# 45
XERROR46:	asciz	"Error 46"			# 46
XERROR47:	asciz	"Error 47"			# 47
XERROR48:	asciz	"Error 48"			# 48
XERROR49:	asciz	"Error 49"			# 49
X
X#
X#  Convergent Errors
X#
X
XEBADE:		asciz	"invalid exchange"		# 50
XEBADR:		asciz	"invalid request descriptor"	# 51
XEXFULL:		asciz	"exchange full"			# 52
XENOANO:		asciz	"no anode"			# 53
XEBADRQC:	asciz	"invalid request code"		# 54
XEBADSLT:	asciz	"invalid slot"			# 55
XEDEADLOCK:	asciz	"file locking deadlock error"	# 56
XEBFONT:		asciz	"bad font file fmt"		# 57
X
X# For BASSLOCKING
X
XENOLCK:		asciz	"no more locks available"	# 58
XEDEADLK:	asciz	"file locking deadlock error"	# 59
X
X#
X# Hardware specific errors 
X#
X
XENOHDW:		asciz	"No hardware available for operation"	# -32
XEBADFS:		asciz	"bitmapped filesystem is marked dirty"	# -31
X
X#
X#  4.[23] BSD error numbers & messages
X#
X#  errors for non-blocking I/O.
X#
X
XEWOULDBLOCK:	asciz	"Operation would block"			# -30
XEINPROGRESS:	asciz	"Operation now in progress"		# -29
XEALREADY:	asciz	"Operation already in progress"		# -28
X
X#
X#  Uipc errors
X#
X#  Argument errors
X#
X
XENOTSOCK:	asciz	"Socket operation on non-socket"	# -27
XEDESTADDRREQ:	asciz	"Destination address required"		# -26
XEMSGSIZE:	asciz	"Message too long"			# -25
XEPROTOTYPE:	asciz	"Protocol wrong type for socket"	# -24
XEPROTONOSUPPORT:	asciz	"Protocol not supported"	# -23
XESOCKTNOSUPPORT:	asciz	"Socket type not supported"	# -22
XEOPNOTSUPP:	asciz	"Operation not supported on socket"	# -21
XEPFNOSUPPORT:	asciz	"Protocol family not supported"		# -20
XEAFNOSUPPORT:	asciz	"Address family not supported by protocol family" # -19
XEADDRINUSE:	asciz	"Address already in use"		# -18
XEADDRNOTAVAIL:	asciz	"Can't assign requested address"	# -17
X
X#
X#  Network errors
X#
X
XENETDOWN:	asciz	"Network is down"			# -16
XENETUNREACH:	asciz	"Network is unreachable"		# -15
XENETRESET:	asciz	"Network dropped connection on reset"	# -14
XECONNABORTED:	asciz	"Software caused connection abort"	# -13
XECONNRESET:	asciz	"Connection reset by peer"		# -12
XENOBUFS:	asciz	"No buffer space available"		# -11
XEISCONN:	asciz	"Socket is already connected"		# -10
XENOTCONN:	asciz	"Socket is not connected"		# -9
XESHUTDOWN:	asciz	"Can't send after socket shutdown"	# -8
XETOOMANYREFS:	asciz	"Too many references: can't splice"	# -7
XETIMEDOUT:	asciz	"Connection timed out"			# -6
XECONNREFUSED:	asciz	"Connection refused"			# -5
XEHOSTDOWN:	asciz	"Host is down"				# -4
XEHOSTUNREACH:	asciz	"No route to host"			# -3
XENOPROTOOPT:	asciz	"Protocol not available"		# -2
X
XERROR_1:	asciz	"Error -1"				# -1
X
X#
X#  The system error table
X#
X	data
X	even
X
X	long	ENOHDW
X	long	EBADFS
X	long	EWOULDBLOCK
X	long	EINPROGRESS
X	long	EALREADY
X	long	ENOTSOCK
X	long	EDESTADDRREQ
X	long	EMSGSIZE
X	long	EPROTOTYPE
X	long	EPROTONOSUPPORT
X	long	ESOCKTNOSUPPORT
X	long	EOPNOTSUPP
X	long	EPFNOSUPPORT
X	long	EAFNOSUPPORT
X	long	EADDRINUSE
X	long	EADDRNOTAVAIL
X	long	ENETDOWN
X	long	ENETUNREACH
X	long	ENETRESET
X	long	ECONNABORTED
X	long	ECONNRESET
X	long	ENOBUFS
X	long	EISCONN
X	long	ENOTCONN
X	long	ESHUTDOWN
X	long	ETOOMANYREFS
X	long	ETIMEDOUT
X	long	ECONNREFUSED
X	long	EHOSTDOWN
X	long	EHOSTUNREACH
X	long	ENOPROTOOPT
X	long	ERROR_1
X
X	global uipc_errlist
Xuipc_errlist:
X	long	ERROR0
X	long	EPERM
X	long	ENOENT
X	long	ESRCH
X	long	EINTR
X	long	EIO
X	long	ENXIO
X	long	E2BIG
X	long	ENOEXEC
X	long	EBADF
X	long	ECHILD
X	long	EAGAIN
X	long	ENOMEM
X	long	EACCES
X	long	EFAULT
X	long	ENOTBLK
X	long	EBUSY
X	long	EEXIST
X	long	EXDEV
X	long	ENODEV
X	long	ENOTDIR
X	long	EISDIR
X	long	EINVAL
X	long	ENFILE
X	long	EMFILE
X	long	ENOTTY
X	long	ETXTBSY
X	long	EFBIG
X	long	ENOSPC
X	long	ESPIPE
X	long	EROFS
X	long	EMLINK
X	long	EPIPE
X	long	EDOM
X	long	ERANGE
X	long	ENOMSG
X	long	EIDRM
X	long	ECHRNG
X	long	EL2NSYNC
X	long	EL3HLT
X	long	EL3RST
X	long	ELNRNG
X	long	EUNATCH
X	long	ENOCSI
X	long	EL2HLT
X	long	ERROR45
X	long	ERROR46
X	long	ERROR47
X	long	ERROR48
X	long	ERROR49
X	long	EBADE
X	long	EBADR
X	long	EXFULL
X	long	ENOANO
X	long	EBADRQC
X	long	EBADSLT
X	long	EDEADLOCK
X	long	EBFONT
X	long	ENOLCK
X	long	EDEADLK
X
X	even
X
X	global uipc_firsterr
Xuipc_firsterr:
X	long	-32
X
X	global uipc_lasterr
Xuipc_lasterr:
X	long	59
X
+ END-OF-FILE lib/syserr.s
chmod 'u=rw,g=rw,o=rw' 'lib/syserr.s'
echo '	-rw-rw-rw-   1 bes      HSJ         6051 Jul 18 23:43 lib/syserr.s        (as sent)'
echo '	\c'
/bin/ls -l lib/syserr.s
exit 0
-- 
Bradley Smith
Computer Systems Offer Integration Laboratory
AT&T Bell Labs, Holmdel, NJ 
201-949-0090 att!holin!bes or bes at holin.ATT.COM



More information about the Comp.sys.att mailing list