minor changes to compile under both new and old vm systems
authorKeith Sklower <sklower@ucbvax.Berkeley.EDU>
Fri, 28 Jun 1991 13:06:19 +0000 (05:06 -0800)
committerKeith Sklower <sklower@ucbvax.Berkeley.EDU>
Fri, 28 Jun 1991 13:06:19 +0000 (05:06 -0800)
SCCS-vsn: sys/netiso/tp_subr.c 7.9
SCCS-vsn: sys/netiso/tp_usrreq.c 7.17
SCCS-vsn: sys/netiso/tp_output.c 7.10
SCCS-vsn: sys/netiso/tp_stat.h 7.5
SCCS-vsn: sys/netiso/tp_subr2.c 7.9
SCCS-vsn: sys/netiso/tp_param.h 7.8
SCCS-vsn: sys/netiso/tp_trace.h 7.5

usr/src/sys/netiso/tp_output.c
usr/src/sys/netiso/tp_param.h
usr/src/sys/netiso/tp_stat.h
usr/src/sys/netiso/tp_subr.c
usr/src/sys/netiso/tp_subr2.c
usr/src/sys/netiso/tp_trace.h
usr/src/sys/netiso/tp_usrreq.c

index 8fb2ebe..c7cb45a 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)tp_output.c 7.9 (Berkeley) %G%
+ *     @(#)tp_output.c 7.10 (Berkeley) %G%
  */
 
 /***********************************************************
  */
 
 /***********************************************************
@@ -48,8 +48,6 @@ SOFTWARE.
 #include "socket.h"
 #include "socketvar.h"
 #include "protosw.h"
 #include "socket.h"
 #include "socketvar.h"
 #include "protosw.h"
-#include "user.h"
-#include "kernel.h"
 #include "errno.h"
 #include "time.h"
 #include "tp_param.h"
 #include "errno.h"
 #include "time.h"
 #include "tp_param.h"
@@ -61,6 +59,7 @@ SOFTWARE.
 #include "argo_debug.h"
 #include "tp_pcb.h"
 #include "tp_trace.h"
 #include "argo_debug.h"
 #include "tp_pcb.h"
 #include "tp_trace.h"
+#include "kernel.h"
 
 #define USERFLAGSMASK_G 0x0f00643b
 #define USERFLAGSMASK_S 0x0f000432
 
 #define USERFLAGSMASK_G 0x0f00643b
 #define USERFLAGSMASK_S 0x0f000432
@@ -432,9 +431,10 @@ tp_ctloutput(cmd, so, level, optname, mp)
        switch (optname) {
 
        case TPOPT_INTERCEPT:
        switch (optname) {
 
        case TPOPT_INTERCEPT:
-               if (error = suser(u.u_cred, &u.u_acflag))
+               if ((so->so_state & SS_PRIV) == 0) {
+                       error = EPERM;
                        break;
                        break;
-               else if (cmd != PRCO_SETOPT || tpcb->tp_state != TP_LISTENING)
+               else if (cmd != PRCO_SETOPT || tpcb->tp_state != TP_LISTENING)
                        error = EINVAL;
                else {
                        register struct tp_pcb *t = 0;
                        error = EINVAL;
                else {
                        register struct tp_pcb *t = 0;
index 1c3531b..fc5faf7 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)tp_param.h  7.7 (Berkeley) %G%
+ *     @(#)tp_param.h  7.8 (Berkeley) %G%
  */
 
 /***********************************************************
  */
 
 /***********************************************************
@@ -332,6 +332,10 @@ bcopy((caddr_t)&(((struct tp_vbp *)(src))->tpv_val),(caddr_t)&(dst),sizeof(type)
 
 #include "tp_states.h"
 #include "tp_events.h"
 
 #include "tp_states.h"
 #include "tp_events.h"
+#if defined(__STDC__) || defined(__cplusplus)
+#undef ATTR
+#define ATTR(X) ev_union.EV_ ## X
+#endif /* defined(__STDC__) || defined(__cplusplus) */
 
 #endif  tp_NSTATES 
 #endif KERNEL
 
 #endif  tp_NSTATES 
 #endif KERNEL
index 1ffba06..fca6df6 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)tp_stat.h   7.4 (Berkeley) %G%
+ *     @(#)tp_stat.h   7.5 (Berkeley) %G%
  */
 
 /***********************************************************
  */
 
 /***********************************************************
@@ -160,6 +160,7 @@ struct tp_stat {
                 *      ACK_FCC **
                 */
 } tp_stat ;
                 *      ACK_FCC **
                 */
 } tp_stat ;
+#define        TP_PM_MAX                       0xa /* 10 decimal */
 
 #define IncStat(x) tp_stat./**/x/**/++
 
 
 #define IncStat(x) tp_stat./**/x/**/++
 
@@ -174,7 +175,6 @@ struct tp_stat {
 
 
 /* for perf measurement stuff: maximum window size it can handle */
 
 
 /* for perf measurement stuff: maximum window size it can handle */
-#define        TP_PM_MAX                       0xa /* 10 decimal */
 
 struct tp_pmeas {
                /* the first few are distributions as a fn of window size 
 
 struct tp_pmeas {
                /* the first few are distributions as a fn of window size 
@@ -242,14 +242,13 @@ struct tp_pmeas {
 
 #else
 
 
 #else
 
-#define PStat(tpcb, x)  /* no-op */
+int PStat_Junk;
+#define PStat(tpcb, x)  PStat_Junk
 #define IncPStat(tpcb, x)  /* no-op */
 #define IncPStat(tpcb, x)  /* no-op */
+#define tpmeas(a,b,c,d,e,f) 0
 
 
-#ifndef STAR
-#define STAR *
-#endif STAR
-#define IFPERF //*beginning of comment*/STAR
-#define ENDPERF                 STAR/*end of comment*//
+#define IFPERF(x)      if (0) {
+#define ENDPERF }
 
 #endif TP_PERF_MEAS
 
 
 #endif TP_PERF_MEAS
 
index 9460331..13bb335 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)tp_subr.c   7.8 (Berkeley) %G%
+ *     @(#)tp_subr.c   7.9 (Berkeley) %G%
  */
 
 /***********************************************************
  */
 
 /***********************************************************
@@ -413,7 +413,11 @@ tp_send(tpcb)
        SeqNum                                  lowseq, highseq ;
        SeqNum                                  lowsave; 
 #ifdef TP_PERF_MEAS
        SeqNum                                  lowseq, highseq ;
        SeqNum                                  lowsave; 
 #ifdef TP_PERF_MEAS
+
        struct timeval                  send_start_time;
        struct timeval                  send_start_time;
+       IFPERF(tpcb)
+               GET_CUR_TIME(&send_start_time);
+       ENDPERF
 #endif TP_PERF_MEAS
 
        lowsave =  lowseq = SEQ(tpcb, tpcb->tp_sndhiwat + 1);
 #endif TP_PERF_MEAS
 
        lowsave =  lowseq = SEQ(tpcb, tpcb->tp_sndhiwat + 1);
@@ -447,10 +451,6 @@ tp_send(tpcb)
        if      ( SEQ_GT(tpcb, lowseq, highseq) )
                        return ; /* don't send, don't change hiwat, don't set timers */
 
        if      ( SEQ_GT(tpcb, lowseq, highseq) )
                        return ; /* don't send, don't change hiwat, don't set timers */
 
-       IFPERF(tpcb)
-               GET_CUR_TIME(&send_start_time);
-       ENDPERF
-
        ASSERT( SEQ_LEQ(tpcb, lowseq, highseq) );
        SEQ_DEC(tpcb, lowseq);
 
        ASSERT( SEQ_LEQ(tpcb, lowseq, highseq) );
        SEQ_DEC(tpcb, lowseq);
 
@@ -564,6 +564,7 @@ tp_send(tpcb)
        }
 
 done:
        }
 
 done:
+#ifdef TP_PERF_MEAS
        IFPERF(tpcb)
                {
                        register int npkts;
        IFPERF(tpcb)
                {
                        register int npkts;
@@ -597,6 +598,7 @@ done:
                                        TPsbsend, &send_end_time, lowsave, tpcb->tp_Nwindow, npkts);
                }
        ENDPERF
                                        TPsbsend, &send_end_time, lowsave, tpcb->tp_Nwindow, npkts);
                }
        ENDPERF
+#endif TP_PERF_MEAS
 
        tpcb->tp_sndhiwat = lowseq;
 
 
        tpcb->tp_sndhiwat = lowseq;
 
index e26aa10..696c73e 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)tp_subr2.c  7.8 (Berkeley) %G%
+ *     @(#)tp_subr2.c  7.9 (Berkeley) %G%
  */
 
 /***********************************************************
  */
 
 /***********************************************************
@@ -752,13 +752,13 @@ caddr_t   buf;
 int            len;
 {
        int             i,j;
 int            len;
 {
        int             i,j;
-
+#define Buf ((u_char *)buf)
        printf("Dump buf 0x%x len 0x%x\n", buf, len);
        for (i = 0; i < len; i += MAX_COLUMNS) {
                printf("+%d:\t", i);
                for (j = 0; j < MAX_COLUMNS; j++) {
                        if (i + j < len) {
        printf("Dump buf 0x%x len 0x%x\n", buf, len);
        for (i = 0; i < len; i += MAX_COLUMNS) {
                printf("+%d:\t", i);
                for (j = 0; j < MAX_COLUMNS; j++) {
                        if (i + j < len) {
-                               printf("%x/%d\t", buf[i+j]&0xff, buf[i+j]);
+                               printf("%x/%d\t", Buf[i+j], Buf[i+j]);
                        } else {
                                printf("        ");
                        }
                        } else {
                                printf("        ");
                        }
@@ -766,8 +766,8 @@ int         len;
 
                for (j = 0; j < MAX_COLUMNS; j++) {
                        if (i + j < len) {
 
                for (j = 0; j < MAX_COLUMNS; j++) {
                        if (i + j < len) {
-                               if (((buf[i+j]) > 31) && ((buf[i+j]) < 128))
-                                       printf("%c", buf[i+j]&0xff);
+                               if (((Buf[i+j]) > 31) && ((Buf[i+j]) < 128))
+                                       printf("%c", Buf[i+j]);
                                else
                                        printf(".");
                        }
                                else
                                        printf(".");
                        }
index 073c6d7..494e4a9 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)tp_trace.h  7.4 (Berkeley) %G%
+ *     @(#)tp_trace.h  7.5 (Berkeley) %G%
  */
 
 /***********************************************************
  */
 
 /***********************************************************
@@ -46,7 +46,6 @@ SOFTWARE.
 #ifndef __TP_TRACE__
 #define __TP_TRACE__
 
 #ifndef __TP_TRACE__
 #define __TP_TRACE__
 
-#ifdef TPPT
 
 #define TPPTsendack    1
 #define TPPTgotack     2
 
 #define TPPTsendack    1
 #define TPPTgotack     2
@@ -124,23 +123,12 @@ struct    tp_Trace {
 #define tpt_window tpt_stuff.tpt_Time.tptv_window
 #define tpt_size tpt_stuff.tpt_Time.tptv_size
 
 #define tpt_window tpt_stuff.tpt_Time.tptv_window
 #define tpt_size tpt_stuff.tpt_Time.tptv_size
 
-#define TPTRACEN 300
-int tp_Tracen = 0;
-struct tp_Trace tp_Trace[TPTRACEN];
-
 #endif defined(TP_TRACEFILE)||!defined(KERNEL)
 
 #endif defined(TP_TRACEFILE)||!defined(KERNEL)
 
-extern u_char  tp_traceflags[];
-
-#define IFTRACE(ascii)\
-       if(tp_traceflags[ascii]) {
-/* 
- * for some reason lint complains about tp_param being undefined no
- * matter where or how many times I define it.
- */
 
 
+#ifdef TPPT
 
 
-#define ENDTRACE  }
+#define TPTRACEN 300
 
 #define tptrace(A,B,C,D,E,F) \
        tpTrace((struct tp_pcb *)0,\
 
 #define tptrace(A,B,C,D,E,F) \
        tpTrace((struct tp_pcb *)0,\
@@ -151,19 +139,34 @@ extern u_char     tp_traceflags[];
        (u_int)(A),(u_int)(B),(u_int)(C),(u_int)(D),(u_int)(E),(u_int)(F))
 
 extern void tpTrace();
        (u_int)(A),(u_int)(B),(u_int)(C),(u_int)(D),(u_int)(E),(u_int)(F))
 
 extern void tpTrace();
+extern struct tp_Trace tp_Trace[];
+extern u_char  tp_traceflags[];
+int tp_Tracen = 0;
+
+#define IFTRACE(ascii)\
+       if(tp_traceflags[ascii]) {
+/* 
+ * for some reason lint complains about tp_param being undefined no
+ * matter where or how many times I define it.
+ */
+#define ENDTRACE  }
+
 
 #else  TPPT
 
 /***********************************************
  * NO TPPT TRACE STUFF
  **********************************************/
 
 #else  TPPT
 
 /***********************************************
  * NO TPPT TRACE STUFF
  **********************************************/
+#define TPTRACEN 1
 
 
-#ifndef STAR
-#define STAR *
-#endif STAR
-#define IFTRACE(ascii)  //*beginning of comment*/STAR
-#define ENDTRACE        STAR/*end of comment*//
+#define tptrace(A,B,C,D,E,F) 0
+#define tptraceTPCB(A,B,C,D,E,F) 0
+
+#define IFTRACE(ascii)  if (0) {
+#define ENDTRACE        }
 
 #endif TPPT
 
 
 #endif TPPT
 
+
+
 #endif __TP_TRACE__
 #endif __TP_TRACE__
index dee3b71..ab20115 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)tp_usrreq.c 7.16 (Berkeley) %G%
+ *     @(#)tp_usrreq.c 7.17 (Berkeley) %G%
  */
 
 /***********************************************************
  */
 
 /***********************************************************
@@ -48,13 +48,13 @@ SOFTWARE.
 
 #include "param.h"
 #include "systm.h"
 
 #include "param.h"
 #include "systm.h"
-#include "user.h"
 #include "mbuf.h"
 #include "socket.h"
 #include "socketvar.h"
 #include "domain.h"
 #include "protosw.h"
 #include "errno.h"
 #include "mbuf.h"
 #include "socket.h"
 #include "socketvar.h"
 #include "domain.h"
 #include "protosw.h"
 #include "errno.h"
+#include "time.h"
 
 #include "tp_param.h"
 #include "tp_timer.h"
 
 #include "tp_param.h"
 #include "tp_timer.h"