home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / UNIX / Connectivity / PPP / Patches / OS-4.0.PPP.patch.Z / OS-4.0.PPP.patch
Encoding:
Internet Message Format  |  1997-12-13  |  25.5 KB

  1. From: Ken Clark <kclark@direct.ca>
  2. To: perkins@netmass.com
  3. Subject: Patches for OPENSTEP 4.x
  4. X-Listprocessor-Version: 6.0 -- ListProcessor by Anastasios Kotsikonas
  5. X-Comment: To unsubscribe send message to listproc@listproc.thoughtport.com
  6. X-Mailer: Mozilla 3.0 (Win95; I)
  7.  
  8. I have ported NeXT-ppp2.3-0.5.0 to Mach OPENSTEP 4.1 for
  9. Intel.  Here are my patches against native ppp-2.3b3 plus
  10. NeXT-ppp2.3-0.5.0.  It works well enough that I can send this mail, but
  11. I have seen at least one panic so far, so caveat emptor.  I tried to
  12. tread lightly on the sources.
  13.  
  14. Cheers
  15.  
  16.  
  17. Ken Clark
  18. diff -r -c -N -d ppp-2.3b3/NeXT/Makefile ppp-2.3b3.ken/NeXT/Makefile
  19. *** ppp-2.3b3/NeXT/Makefile    Wed Oct  9 14:14:44 1996
  20. --- ppp-2.3b3.ken/NeXT/Makefile    Tue Nov 12 15:25:12 1996
  21. ***************
  22. *** 49,61 ****
  23.   #
  24.   #
  25.   
  26. ! DFLAGS = -DINET -DKERNEL -DMACH -DPOSIX_KERN \
  27.       -DNUM_PPP=2 -DVJC -DPPP_COMPRESS \
  28.       -DDEBUG -DNEW_CLOCAL -DNBPFILTER -DOPTIMIZE_PPPREND
  29.   
  30.   IFLAGS = -I. -I.. -I../pppd
  31.   
  32. ! CFLAGS = -pipe -posix $(ARCHFLAGS) $(DFLAGS) $(IFLAGS) 
  33.   
  34.   OBJS = bsd-comp.o if_ppp.o nbq.o ppp_tty.o vjcompress.o
  35.   SRCS = $(OBJS:.o=.c)
  36. --- 49,62 ----
  37.   #
  38.   #
  39.   
  40. ! DFLAGS = -DNS_TARGET=41 -D_POSIX_SOURCE -D__BIT_TYPES_DEFINED__ \
  41. !     -DINET -DKERNEL -DMACH -DPOSIX_KERN \
  42.       -DNUM_PPP=2 -DVJC -DPPP_COMPRESS \
  43.       -DDEBUG -DNEW_CLOCAL -DNBPFILTER -DOPTIMIZE_PPPREND
  44.   
  45.   IFLAGS = -I. -I.. -I../pppd
  46.   
  47. ! CFLAGS = -pipe -static $(ARCHFLAGS) $(DFLAGS) $(IFLAGS) 
  48.   
  49.   OBJS = bsd-comp.o if_ppp.o nbq.o ppp_tty.o vjcompress.o
  50.   SRCS = $(OBJS:.o=.c)
  51. ***************
  52. *** 66,72 ****
  53.   #
  54.   all:    ppp_reloc
  55.       cd bpf; $(MAKE) ARCHFLAGS="$(ARCHFLAGS)" all
  56.   
  57.   install: all
  58.       /bin/mkdirs $(ETCDIR) $(LKS_DIR)
  59. --- 67,72 ----
  60. diff -r -c -N -d ppp-2.3b3/NeXT/Makefile.top ppp-2.3b3.ken/NeXT/Makefile.top
  61. *** ppp-2.3b3/NeXT/Makefile.top    Wed Oct  9 14:38:58 1996
  62. --- ppp-2.3b3.ken/NeXT/Makefile.top    Tue Nov 12 16:53:17 1996
  63. ***************
  64. *** 13,18 ****
  65. --- 13,19 ----
  66.   ARCHFLAGS =
  67.   
  68.   all:
  69. +     cd libposix; $(MAKE) -f Makefile.NeXT ARCHFLAGS="$(ARCHFLAGS)" all
  70.       cd chat; $(MAKE) -f Makefile.NeXT ARCHFLAGS="$(ARCHFLAGS)" all
  71.       cd pppstats; $(MAKE) -f Makefile.NeXT ARCHFLAGS="$(ARCHFLAGS)" all
  72.       cd pppd; $(MAKE) -f Makefile.NeXT ARCHFLAGS="$(ARCHFLAGS)" all
  73. ***************
  74. *** 30,35 ****
  75. --- 31,37 ----
  76.   
  77.   clean: 
  78.       rm -f *~
  79. +     (cd libposix; $(MAKE) -f Makefile.NeXT clean)
  80.       (cd chat; $(MAKE) -f Makefile.NeXT clean)
  81.       (cd pppstats; $(MAKE) -f Makefile.NeXT clean)
  82.       (cd pppd; $(MAKE) -f Makefile.NeXT clean)
  83. diff -r -c -N -d ppp-2.3b3/NeXT/README.4x ppp-2.3b3.ken/NeXT/README.4x
  84. *** ppp-2.3b3/NeXT/README.4x    Wed Dec 31 16:00:00 1969
  85. --- ppp-2.3b3.ken/NeXT/README.4x    Wed Nov 13 13:19:33 1996
  86. ***************
  87. *** 0 ****
  88. --- 1,86 ----
  89. + I have merged the ppp3.2 sources with the ppp-5 port by NeXT for OPENSTEP 4.x.  
  90. + ppp-5 is what NeXT calls ppp2.2b3 plus NeXT-ppp2.2-0.4.5.  I am using
  91. + OPENSTEP 4.1 for Mach GAMMA as a build environment.
  92. + In general I tried to tread lightly on the code (mainly because I don't
  93. + really know what I am doing ‹.
  94. + Here are random notes on the port of ppp3.2 to OPENSTEP 4.1 GAMMA.
  95. + Ken Clark
  96. + kclark@direct.ca
  97. + (0)
  98. + The userland stuff sufferes from NeXT's lack of POSIX support.  I added
  99. + an emulation library "libposix" to that end.  See libposix/libposix.c
  100. + for details.
  101. + (1)
  102. + 4.1 does not seem to have a kern/lock.h, but does have a kernserv/lock.h.  Is
  103. + that what we want?  I have included kernserv/lock.h for now for NS_TARGET
  104. + >= 41 and kern/lock.h for NS_TARGET==40.  
  105. + originally if_ppp.c had:
  106. + #if NS_TARGET >= 40
  107. + #include <kern/lock.h>
  108. + #endif /* NS_TARGET */
  109. + while ppp_tty.c had
  110. + #ifdef NS_TARGET
  111. + #include <kern/lock.h>
  112. + #endif /* NS_TARGET */
  113. + I assume the latter was a type-o.
  114. + (2)
  115. + 4.1 GAMMA does not seem to define NS_TARGET as 41.  Sheesh.
  116. + (3)
  117. + 4.1 complains whenever sys/user.h is included about an undefined type
  118. + lock_data_t.  I can't seem to find lock_data_t anywhere, although there
  119. + is a lock_t and a simple_lock_data_t.  For now, my fix is to
  120. + typedef simple_lock_data_t lock_data_t where needed before sys/user.h
  121. + gets included.  Note that sys/proc includes sys/user.h.
  122. + What is the correct fix for sys/user.h?  What is going on with 
  123. + these structures?
  124. + (4)
  125. + NeXT can't seem to decide whether they define bittypes 
  126. + such as typedef unsigned short u_int16_t.  __BIT_TYPES_DEFINED__ is
  127. + defined in the Makefiles to be consistent with the user-land stuff.  I removed
  128. + the typedef from bsd-comp.c as it seems to be defined in if_pppvar.h 
  129. + anyway.
  130. + (5)
  131. + As usual, the NeXT code is a colorfull combination of hard and soft
  132. + tabs.  I followed the convention in the surrounding (nearest) code.  
  133. + Anyone want to run the code through a beautifier?
  134. + (6)
  135. + NeXT eliminated the global variable "time" in OPENSTEP 4.x.  It is 
  136. + replaced by the call to ns_time_to_timeval(clock_value(System), &tv_time).
  137. + I used tv_time as a variable instead of "time" because that is the
  138. + way NeXT did it in their ppp2.2 4.x port (presumably in case they change their
  139. + mind and pollute the namespace with a "time" variable again).  This
  140. + makes for a lot of #if macros in if_ppp.c.  I don't have a complete
  141. + grasp of how often I need to check the time.  Check comments that say
  142. + /*  I am assuming the time is different here than above. */  It is
  143. + all probably okay, but plan to look into this some more.
  144. + (7)
  145. + NeXT didn't do a port of the bfd stuff to 4.x and I don't use it myself,
  146. + so it is neglected.  I did a couple of hacks to get it to compile under
  147. + 4.1, but nothing more.  It probably doesn't work, but you never know.
  148. diff -r -c -N -d ppp-2.3b3/NeXT/bpf/Makefile ppp-2.3b3.ken/NeXT/bpf/Makefile
  149. *** ppp-2.3b3/NeXT/bpf/Makefile    Wed Oct  9 14:14:50 1996
  150. --- ppp-2.3b3.ken/NeXT/bpf/Makefile    Tue Nov 12 16:41:29 1996
  151. ***************
  152. *** 27,37 ****
  153.   #
  154.   #
  155.   
  156. ! DFLAGS = -DVJC -DPPP_COMPRESS -DNBPFILTER=5 -DPOSIX_KERN \
  157.       -DKERNEL -DMACH_USER_API -DMACH
  158.   
  159.   
  160. ! CFLAGS = -pipe -O -posix $(ARCHFLAGS) $(DFLAGS) $(IFLAGS) 
  161.   
  162.   OBJS = promisc.o bpf_filter.o bpf.o NeXT_Support.o ../nbq.o
  163.   SRCS = $(OBJS:.o=.c)
  164. --- 27,38 ----
  165.   #
  166.   #
  167.   
  168. ! DFLAGS = -DNS_TARGET=41 -D_POSIX_SOURCE -D__BIT_TYPES_DEFINED__ \
  169. !     -DVJC -DPPP_COMPRESS -DNBPFILTER=5 -DPOSIX_KERN \
  170.       -DKERNEL -DMACH_USER_API -DMACH
  171.   
  172.   
  173. ! CFLAGS = -pipe -static -O $(ARCHFLAGS) $(DFLAGS) $(IFLAGS) 
  174.   
  175.   OBJS = promisc.o bpf_filter.o bpf.o NeXT_Support.o ../nbq.o
  176.   SRCS = $(OBJS:.o=.c)
  177. diff -r -c -N -d ppp-2.3b3/NeXT/bpf/NeXT_Support.c ppp-2.3b3.ken/NeXT/bpf/NeXT_Support.c
  178. *** ppp-2.3b3/NeXT/bpf/NeXT_Support.c    Mon Oct  7 17:16:42 1996
  179. --- ppp-2.3b3.ken/NeXT/bpf/NeXT_Support.c    Tue Nov 12 16:48:27 1996
  180. ***************
  181. *** 11,16 ****
  182. --- 11,19 ----
  183.   #include "netbuf.h"
  184.   #include <sys/buf.h>
  185.   #include <sys/time.h>
  186. + #if NS_TARGET >= 41
  187. + typedef simple_lock_data_t lock_data_t;        /* XXX */
  188. + #endif /* NS_TARGET */
  189.   #include <sys/proc.h>
  190.   #include <machine/user.h>
  191.   #include <sys/ioctl.h>
  192. diff -r -c -N -d ppp-2.3b3/NeXT/bpf/bpf.c ppp-2.3b3.ken/NeXT/bpf/bpf.c
  193. *** ppp-2.3b3/NeXT/bpf/bpf.c    Mon Oct  7 17:16:43 1996
  194. --- ppp-2.3b3.ken/NeXT/bpf/bpf.c    Tue Nov 12 16:47:28 1996
  195. ***************
  196. *** 58,63 ****
  197. --- 58,66 ----
  198.   #include "netbuf.h"
  199.   #include <sys/buf.h>
  200.   #include <sys/time.h>
  201. + #if NS_TARGET >= 41
  202. + typedef simple_lock_data_t lock_data_t;        /* XXX */
  203. + #endif /* NS_TARGET */
  204.   #include <sys/proc.h>
  205.   #include <machine/user.h>
  206.   #include <sys/ioctl.h>
  207. ***************
  208. *** 1217,1223 ****
  209.       register struct bpf_hdr *hp;
  210.       register int totlen, curlen;
  211.       register int hdrlen = d->bd_bif->bif_hdrlen;
  212.   
  213.       /*
  214.        * Figure out how many bytes to move.  If the packet is
  215. --- 1220,1228 ----
  216.       register struct bpf_hdr *hp;
  217.       register int totlen, curlen;
  218.       register int hdrlen = d->bd_bif->bif_hdrlen;
  219. ! #if NS_TARGET >= 40
  220. !     struct timeval tv_time;
  221. ! #endif
  222.   
  223.       /*
  224.        * Figure out how many bytes to move.  If the packet is
  225. ***************
  226. *** 1268,1274 ****
  227. --- 1273,1284 ----
  228.   #elif defined(sun)
  229.       uniqtime(&hp->bh_tstamp);
  230.   #else
  231. + #if NS_TARGET >= 40
  232. +     ns_time_to_timeval(clock_value(System), &tv_time);
  233. +     hp->bh_tstamp = tv_time;
  234. + #else
  235.       hp->bh_tstamp = time;
  236. + #endif /* NS_TARGET */
  237.   #endif
  238.   
  239.       hp->bh_datalen = pktlen;
  240. diff -r -c -N -d ppp-2.3b3/NeXT/bpf/promisc.c ppp-2.3b3.ken/NeXT/bpf/promisc.c
  241. *** ppp-2.3b3/NeXT/bpf/promisc.c    Mon Oct  7 17:16:48 1996
  242. --- ppp-2.3b3.ken/NeXT/bpf/promisc.c    Tue Nov 12 16:38:07 1996
  243. ***************
  244. *** 51,56 ****
  245. --- 51,59 ----
  246.   #define INET 1
  247.   
  248.   #include <sys/param.h>
  249. + #if NS_TARGET >= 41
  250. + typedef simple_lock_data_t lock_data_t;        /* XXX */
  251. + #endif /* NS_TARGET */
  252.   #include <sys/proc.h>
  253.   #include <sys/user.h>
  254.   #include "netbuf.h"
  255. diff -r -c -N -d ppp-2.3b3/NeXT/bsd-comp.c ppp-2.3b3.ken/NeXT/bsd-comp.c
  256. *** ppp-2.3b3/NeXT/bsd-comp.c    Wed Oct  9 14:14:46 1996
  257. --- ppp-2.3b3.ken/NeXT/bsd-comp.c    Tue Nov 12 15:32:43 1996
  258. ***************
  259. *** 54,60 ****
  260.   
  261.   #include <sys/types.h>
  262.   #include <sys/param.h>
  263. - #include <sys/types.h>
  264.   #include <sys/socket.h>
  265.   
  266.   #define    KERNEL 1
  267. --- 54,59 ----
  268. ***************
  269. *** 62,67 ****
  270. --- 61,67 ----
  271.   #include <net/if.h>
  272.   
  273.   #include <net/ppp_defs.h>
  274.   #include <net/if_ppp.h>
  275.   
  276.   #include "nbq.h"
  277. ***************
  278. *** 93,99 ****
  279.   #include <netinet/ip.h>
  280.   
  281.   #define    mtod(m,type)    ((type)NB_MAP(m))
  282. - typedef unsigned short u_int16_t;
  283.   
  284.   /*
  285.    * PPP "BSD compress" compression
  286. --- 93,98 ----
  287. diff -r -c -N -d ppp-2.3b3/NeXT/if_ppp.c ppp-2.3b3.ken/NeXT/if_ppp.c
  288. *** ppp-2.3b3/NeXT/if_ppp.c    Wed Oct  9 14:14:47 1996
  289. --- ppp-2.3b3.ken/NeXT/if_ppp.c    Tue Nov 12 16:35:33 1996
  290. ***************
  291. *** 90,97 ****
  292. --- 90,107 ----
  293.   
  294.   /* #include "ppp.h" */
  295.   
  296. + #if NS_TARGET >= 40
  297. + #if NS_TARGET >= 41
  298. + #include <kernserv/lock.h>
  299. + #else
  300. + #include <kern/lock.h>
  301. + #endif /* NS_TARGET */
  302. + #endif /* NS_TARGET */
  303.   
  304.   #include <sys/param.h>
  305. + #if NS_TARGET >= 41
  306. + typedef simple_lock_data_t lock_data_t;        /* XXX */
  307. + #endif /* NS_TARGET */
  308.   #include <sys/proc.h>
  309.   #include "netbuf.h"
  310.   #include <sys/socket.h>
  311. ***************
  312. *** 99,105 ****
  313. --- 109,117 ----
  314.   #include <sys/time.h>
  315.   #include <sys/ioctl.h>
  316.   #include <sys/errno.h>
  317. + #if !(NS_TARGET >= 40)
  318.   #include <kernserv/prototypes.h>
  319. + #endif
  320.   #if defined(m68k)
  321.   #import "spl.h"
  322.   #else
  323. ***************
  324. *** 357,362 ****
  325. --- 369,377 ----
  326.   {
  327.       int nppp, i;
  328.       struct ppp_softc *sc;
  329. + #if NS_TARGET >= 40
  330. +     struct timeval tv_time;
  331. + #endif /* NS_TARGET */
  332.   
  333.       for (nppp = 0, sc = ppp_softc; nppp < NUM_PPP; nppp++, sc++)
  334.       if (sc->sc_xfer == pid) {
  335. ***************
  336. *** 383,389 ****
  337. --- 398,411 ----
  338.       for (i = 0; i < NUM_NP; ++i)
  339.       sc->sc_npmode[i] = NPMODE_ERROR;
  340.       /* XXX - I'm not sure why the npqueue was zapped here... */
  341. + #if NS_TARGET >= 40
  342. +     ns_time_to_timeval(clock_value(System), &tv_time);
  343. +     sc->sc_last_sent = sc->sc_last_recv = tv_time.tv_sec;
  344. + #else
  345.       sc->sc_last_sent = sc->sc_last_recv = time.tv_sec;
  346. + #endif
  347.       sc->sc_compsched = 0;
  348.       sc->sc_decompsched = 0;
  349.   
  350. ***************
  351. *** 446,451 ****
  352. --- 468,477 ----
  353.   #ifdef    HAS_BROKEN_TIOCSPGRP
  354.       struct tty *tp = sc->sc_devp;
  355.   #endif
  356. + #if NS_TARGET >= 40
  357. +     struct timeval tv_time;
  358. + #endif /* NS_TARGET */
  359.   
  360.       switch (cmd) {
  361.       case FIONREAD:
  362. ***************
  363. *** 617,623 ****
  364. --- 643,654 ----
  365.   
  366.       case PPPIOCGIDLE:
  367.       s = splimp();
  368. + #if NS_TARGET >= 40
  369. +     ns_time_to_timeval(clock_value(System), &tv_time);
  370. +     t = tv_time.tv_sec;
  371. + #else
  372.       t = time.tv_sec;
  373. + #endif /* NS_TARGET */
  374.       ((struct ppp_idle *)data)->xmit_idle = t - sc->sc_last_sent;
  375.       ((struct ppp_idle *)data)->recv_idle = t - sc->sc_last_recv;
  376.       splx(s);
  377. ***************
  378. *** 1140,1145 ****
  379. --- 1171,1179 ----
  380.       NETBUF_T m;
  381.       u_char *cp;
  382.       int address, control, protocol;
  383. + #if NS_TARGET >= 40
  384. +     struct timeval tv_time;
  385. + #endif
  386.   
  387.       /*
  388.        * Grab a packet to send: first try the fast queue, then the
  389. ***************
  390. *** 1160,1176 ****
  391.       control = PPP_CONTROL(cp);
  392.       protocol = PPP_PROTOCOL(cp);
  393.   
  394.   #ifdef NETBUF_PROXY
  395.       m->pktinfo.second.tv_sec = time.tv_sec;
  396.       m->pktinfo.second.tv_usec = time.tv_usec;
  397. ! #endif
  398.   
  399.       switch (protocol) {
  400.       case PPP_IP:
  401.       /*
  402.        * Update the time we sent the most recent packet.
  403.        */
  404. !     sc->sc_last_sent = time.tv_sec;
  405.   
  406.   #ifdef VJC
  407.       /*
  408. --- 1194,1223 ----
  409.       control = PPP_CONTROL(cp);
  410.       protocol = PPP_PROTOCOL(cp);
  411.   
  412. + #if NS_TARGET >= 40
  413. +     ns_time_to_timeval(clock_value(System), &tv_time);
  414. + #endif /* NS_TARGET */
  415.   #ifdef NETBUF_PROXY
  416. + #if NS_TARGET >= 40
  417. +     m->pktinfo.second.tv_sec = tv_time.tv_sec;
  418. +     m->pktinfo.second.tv_usec = tv_time.tv_usec;
  419. + #else
  420.       m->pktinfo.second.tv_sec = time.tv_sec;
  421.       m->pktinfo.second.tv_usec = time.tv_usec;
  422. ! #endif /* NS_TARGET */
  423. ! #endif /* NETBUF_PROXY */
  424.   
  425.       switch (protocol) {
  426.       case PPP_IP:
  427.       /*
  428.        * Update the time we sent the most recent packet.
  429.        */
  430. ! #if NS_TARGET >= 40
  431. !     sc->sc_last_sent = tv_time.tv_sec;
  432. ! #else
  433. !         sc->sc_last_sent = time.tv_sec;
  434. ! #endif /* NS_TARGET */
  435.   
  436.   #ifdef VJC
  437.       /*
  438. ***************
  439. *** 1299,1306 ****
  440. --- 1346,1360 ----
  441.       }
  442.   
  443.   #ifdef NETBUF_PROXY
  444. + #if NS_TARGET >= 4.0
  445. +     /*  I am assuming the time is different here than above. */
  446. +     ns_time_to_timeval(clock_value(System), &tv_time);
  447. +     m->pktinfo.third.tv_sec = tv_time.tv_sec;
  448. +     m->pktinfo.third.tv_usec = tv_time.tv_usec;
  449. + #else
  450.       m->pktinfo.third.tv_sec = time.tv_sec;
  451.       m->pktinfo.third.tv_usec = time.tv_usec;
  452. + #endif
  453.   #endif    
  454.   
  455.       s = splimp();
  456. ***************
  457. *** 1469,1479 ****
  458.       NETBUF_T dmp;
  459.       u_char *iphdr;
  460.       u_int hlen;
  461.   
  462.   #ifdef NETBUF_PROXY
  463.       m->pktinfo.third.tv_sec = time.tv_sec;
  464.       m->pktinfo.third.tv_usec = time.tv_usec;
  465. ! #endif        
  466.   
  467.       incr_cnt(sc->sc_if, if_ipackets);
  468.   
  469. --- 1523,1542 ----
  470.       NETBUF_T dmp;
  471.       u_char *iphdr;
  472.       u_int hlen;
  473. + #if NS_TARGET >= 40
  474. +     struct timeval tv_time;
  475. + #endif /* NS_TARGET */
  476.   
  477.   #ifdef NETBUF_PROXY
  478. + #if NS_TARGET >= 40
  479. +     ns_time_to_timeval(clock_value(System), &tv_time);
  480. +     m->pktinfo.third.tv_sec = tv_time.tv_sec;
  481. +     m->pktinfo.third.tv_usec = tv_time.tv_usec;
  482. + #else
  483.       m->pktinfo.third.tv_sec = time.tv_sec;
  484.       m->pktinfo.third.tv_usec = time.tv_usec;
  485. ! #endif /* NS_TARGET */
  486. ! #endif NETBUF_PROXY
  487.   
  488.       incr_cnt(sc->sc_if, if_ipackets);
  489.   
  490. ***************
  491. *** 1666,1674 ****
  492.   
  493.   #ifdef NETBUF_PROXY
  494.       m->pktinfo.size3 = NB_SIZE(m);
  495.       m->pktinfo.fourth.tv_sec = time.tv_sec;
  496.       m->pktinfo.fourth.tv_usec = time.tv_usec;
  497. ! #endif        
  498.   
  499.   #ifdef NBPFILTER
  500.       /*
  501. --- 1729,1744 ----
  502.   
  503.   #ifdef NETBUF_PROXY
  504.       m->pktinfo.size3 = NB_SIZE(m);
  505. + #if NS_TARGET >= 40
  506. +     /*  I am assuming the time is different here than above. */
  507. +     ns_time_to_timeval(clock_value(System), &tv_time);
  508. +     m->pktinfo.fourth.tv_sec = tv_time.tv_sec;
  509. +     m->pktinfo.fourth.tv_usec = tv_time.tv_usec;
  510. + #else
  511.       m->pktinfo.fourth.tv_sec = time.tv_sec;
  512.       m->pktinfo.fourth.tv_usec = time.tv_usec;
  513. ! #endif /* NS_TARGET */
  514. ! #endif /* NETBUF_PROXY */
  515.   
  516.   #ifdef NBPFILTER
  517.       /*
  518. ***************
  519. *** 1699,1705 ****
  520. --- 1769,1781 ----
  521.       }
  522.       NB_SHRINK_TOP(m, PPP_HDRLEN);
  523.       inet_queue(sc->sc_if, NB_TO_nb(m));
  524. + #if NS_TARGET >= 40
  525. +     /*  I am assuming the time is different here than above. */
  526. +     ns_time_to_timeval(clock_value(System), &tv_time);
  527. +     sc->sc_last_recv = tv_time.tv_sec; /* update time of last pkt rcvd */
  528. + #else
  529.       sc->sc_last_recv = time.tv_sec; /* update time of last pkt rcvd */
  530. + #endif
  531.       return;
  532.   #endif
  533.   
  534. diff -r -c -N -d ppp-2.3b3/NeXT/if_pppvar.h ppp-2.3b3.ken/NeXT/if_pppvar.h
  535. *** ppp-2.3b3/NeXT/if_pppvar.h    Mon Oct  7 16:51:30 1996
  536. --- ppp-2.3b3.ken/NeXT/if_pppvar.h    Tue Nov 12 15:35:10 1996
  537. ***************
  538. *** 20,26 ****
  539. --- 20,28 ----
  540.   /* Portions Copyright (C) 1990 Brad K. Clements (streams support)
  541.    */
  542.   
  543. + #if !(NS_TARGET >= 40)
  544.   #import <kernserv/prototypes.h>
  545. + #endif /* NS_TARGET */
  546.   
  547.   /*
  548.    * Supported network protocols.  These values are used for
  549. ***************
  550. *** 34,40 ****
  551. --- 36,44 ----
  552.   
  553.   /* only defined in the posix universe... */
  554.   /*typedef    int pid_t; */
  555. + #ifndef __BIT_TYPES_DEFINED__
  556.   typedef unsigned short u_int16_t;
  557. + #endif /* __BIT_TYPES_DEFINED */
  558.   
  559.   struct ppp_softc {
  560.       netif_t    sc_if;        /* network-visible interface */
  561. diff -r -c -N -d ppp-2.3b3/NeXT/nbq.h ppp-2.3b3.ken/NeXT/nbq.h
  562. *** ppp-2.3b3/NeXT/nbq.h    Mon Oct  7 17:05:50 1996
  563. --- ppp-2.3b3.ken/NeXT/nbq.h    Tue Nov 12 14:46:03 1996
  564. ***************
  565. *** 15,21 ****
  566. --- 15,23 ----
  567.   #define KERNEL 1
  568.   
  569.   #include <sys/types.h>
  570. + #if !(NS_TARGET >= 40)
  571.   #include <kernserv/prototypes.h>
  572. + #endif /* NS_TARGET */
  573.   
  574.   #include "netbuf.h"
  575.   typedef u_int mark_t;
  576. diff -r -c -N -d ppp-2.3b3/NeXT/ppp_tty.c ppp-2.3b3.ken/NeXT/ppp_tty.c
  577. *** ppp-2.3b3/NeXT/ppp_tty.c    Mon Oct  7 16:57:39 1996
  578. --- ppp-2.3b3.ken/NeXT/ppp_tty.c    Wed Nov 13 14:18:40 1996
  579. ***************
  580. *** 91,97 ****
  581. --- 91,108 ----
  582.   #define KERNEL_FEATURES 1
  583.   #define INET 1
  584.   
  585. + #if NS_TARGET >= 40
  586. + #if NS_TARGET >= 41
  587. + #include <kernserv/lock.h>
  588. + #else
  589. + #include <kern/lock.h>
  590. + #endif /* NS_TARGET */
  591. + #endif /* NS_TARGET */
  592.   #include <sys/param.h>
  593. + #if NS_TARGET >= 41
  594. + typedef simple_lock_data_t lock_data_t;        /* XXX */
  595. + #endif /* NS_TARGET */
  596.   #include <sys/proc.h>
  597.   #include <sys/user.h>
  598.   #include "netbuf.h"
  599. ***************
  600. *** 103,110 ****
  601.   #include <sys/dk.h>
  602.   #include <sys/uio.h>
  603.   #include <sys/errno.h>
  604.   #include <machine/param.h>
  605.   
  606.   #include <kernserv/prototypes.h>
  607.   /* NeXT broke spl.h in 3.2/m68k. Thanks EPS! */
  608. --- 114,123 ----
  609.   #include <sys/dk.h>
  610.   #include <sys/uio.h>
  611.   #include <sys/errno.h>
  612. + #if !(NS_TARGET >= 40)
  613. + /*  XXX what happened to this header file? */
  614.   #include <machine/param.h>
  615. ! #endif
  616.   
  617.   #include <kernserv/prototypes.h>
  618.   /* NeXT broke spl.h in 3.2/m68k. Thanks EPS! */
  619. ***************
  620. *** 804,810 ****
  621. --- 817,827 ----
  622.        * drained the t_outq.
  623.        */
  624.       if (!idle && (sc->sc_flags & SC_TIMEOUT) == 0) {
  625. + #if NS_TARGET >= 40
  626. +     timeout(ppp_timeout, (void *) sc, 1);
  627. + #else
  628.       ns_timeout(ppp_timeout, (void *) sc, 1 * (1000000000L / HZ), CALLOUT_PRI_SOFTINT0);
  629. + #endif /*NS_TARGET */
  630.       sc->sc_flags |= SC_TIMEOUT;
  631.       }
  632.   
  633. diff -r -c -N -d ppp-2.3b3/chat/Makefile.NeXT ppp-2.3b3.ken/chat/Makefile.NeXT
  634. *** ppp-2.3b3/chat/Makefile.NeXT    Mon Oct  7 11:27:25 1996
  635. --- ppp-2.3b3.ken/chat/Makefile.NeXT    Tue Nov 12 13:30:29 1996
  636. ***************
  637. *** 12,17 ****
  638. --- 12,18 ----
  639.   
  640.   SRCS =     chat.c
  641.   OBJS =     chat.o
  642. + LIBS =   ../libposix/libposix.o
  643.   
  644.   MANPAGES = chat.8
  645.   
  646. ***************
  647. *** 22,28 ****
  648.   all:    chat
  649.   
  650.   chat:    $(OBJS)
  651. !     $(CC) -o chat $(CFLAGS) $(OBJS)
  652.   
  653.   install:
  654.       /bin/mkdirs $(MANDIR)/man8 $(BINDIR) 
  655. --- 23,29 ----
  656.   all:    chat
  657.   
  658.   chat:    $(OBJS)
  659. !     $(CC) -o chat $(CFLAGS) $(OBJS) $(LIBS)
  660.   
  661.   install:
  662.       /bin/mkdirs $(MANDIR)/man8 $(BINDIR) 
  663. diff -r -c -N -d ppp-2.3b3/libposix/Makefile.NeXT ppp-2.3b3.ken/libposix/Makefile.NeXT
  664. *** ppp-2.3b3/libposix/Makefile.NeXT    Wed Dec 31 16:00:00 1969
  665. --- ppp-2.3b3.ken/libposix/Makefile.NeXT    Tue Nov 12 16:54:15 1996
  666. ***************
  667. *** 0 ****
  668. --- 1,10 ----
  669. + #ARCHFLAGS = -arch i386 -arch m68k
  670. + ARCHFLAGS =
  671. + OBJS = libposix.o
  672. + CFLAGS = -O $(ARCHFLAGS) -posix
  673. + all: $(OBJS)
  674. + clean:
  675. +     rm -f $(OBJS)
  676. diff -r -c -N -d ppp-2.3b3/libposix/libposix.c ppp-2.3b3.ken/libposix/libposix.c
  677. *** ppp-2.3b3/libposix/libposix.c    Wed Dec 31 16:00:00 1969
  678. --- ppp-2.3b3.ken/libposix/libposix.c    Wed Nov 13 13:11:30 1996
  679. ***************
  680. *** 0 ****
  681. --- 1,165 ----
  682. + /*  Yes, that's right:  of all the platforms supported by ppp, 
  683. +     only Mach OpenStep 4.x doesn't support POSIX.  Sheesh.
  684. +     Stranger still, the POSIX declatations are still in the 4.x header files,
  685. +     and the gcc -posix still defines _POSIX_SOURCE.  So... 
  686. +     we emulate (sometimes badly) the missing POSIX functions.  This
  687. +     is by no means a complete or general POSIX emulation.  Just enough 
  688. +     to get us by for ppp, so we don't have to pollute the rest of the 
  689. +     sources of every other (non-braindead) platform.  Much of the
  690. +     code was snarfed from NeXT's 4.0 ppp port, the rest inspired by
  691. +     "POSIX Programmers Guide" by Donald Lewine.
  692. +     
  693. +     Maybe if we complain NeXT will upgrade to BSD4.4 libs like the rest of
  694. +     the free world (and maybe pink elephants will fly out of my...  -KC)
  695. +  */
  696. + #include <signal.h>
  697. + #include <termios.h>
  698. + #include <unistd.h>
  699. + #include <sys/ioctl.h>
  700. + #include <sys/time.h>
  701. + #include <errno.h>
  702. + int sigemptyset(sigset_t *set)
  703. + {
  704. +     *set = 0;
  705. +     return 0;
  706. + }
  707. + int sigaddset(sigset_t *set, int signo)
  708. + {
  709. +     *set |= 1<<signo;
  710. +     return 0;
  711. + }
  712. + int sigprocmask(int how, const sigset_t *set, sigset_t *oset)
  713. + {
  714. +     switch(how) {
  715. +     case SIG_BLOCK:
  716. +         *oset = sigblock(*set);
  717. +         break;
  718. +     case SIG_UNBLOCK:
  719. +         /* XXX How does one emulate this with ancient BSD? (KC) */
  720. +         break;
  721. +     case SIG_SETMASK:
  722. +         *oset = sigsetmask(*set);
  723. +         break;
  724. +     }
  725. +     return 0;
  726. + }
  727. + int sigsuspend(const sigset_t *sigmask)
  728. + {
  729. +     sigpause(*sigmask);
  730. + }
  731. + int sigaction(int sig, const struct sigaction *act, struct sigaction *oact)
  732. + {
  733. +     struct sigvec vec, ovec;
  734. +     int st;
  735. +     vec.sv_handler = act->sa_handler;
  736. +     vec.sv_mask = act->sa_mask;
  737. +     vec.sv_flags = act->sa_flags;
  738. +     
  739. +     st = sigvec(sig, &vec, &ovec);
  740. +     if (oact) {
  741. +         oact->sa_handler = ovec.sv_handler;
  742. +         oact->sa_mask = ovec.sv_mask;
  743. +         oact->sa_flags = ovec.sv_flags;
  744. +     }
  745. +     return st;
  746. + }
  747. + int tcgetattr(int fildes, struct termios *tp)
  748. + {
  749. +     return ioctl(fildes, TIOCGETA, tp);
  750. + }
  751. + int tcsetattr(int fd, int opt, const struct termios *t)
  752. + {
  753. +     int st;
  754. +     switch(opt) {
  755. +      case TCSANOW:
  756. +         st = ioctl(fd, TIOCSETA, t);
  757. +         break;
  758. +     case TCSADRAIN:
  759. +         st = ioctl(fd, TIOCSETAW, t);
  760. +         break;
  761. +     case TCSAFLUSH:
  762. +         st = ioctl(fd, TIOCSETAF, t);
  763. +         break;
  764. +     default:
  765. +         st = -1;
  766. +         errno = EINVAL;
  767. +         break;
  768. +     }
  769. +     return st;
  770. + }
  771. + /*  XXX we ignore duration (which is 0 in chat.c anyway).
  772. +  */
  773. + int tcsendbreak(int fildes, int duration)
  774. + {
  775. +     struct timeval sleepytime;
  776. +     sleepytime.tv_sec = 0;
  777. +     sleepytime.tv_usec = 400000;
  778. +     if (ioctl(fildes, TIOCSBRK, 0) != -1)
  779. +     {
  780. +         select(0, 0, 0, 0, &sleepytime);
  781. +         (void) ioctl(fildes, TIOCCBRK, 0);
  782. +     }
  783. + }
  784. + /*  XXX This is the implementation of cfgetospeed from NeXT's ppp-5
  785. +     pppd/sys-NeXT.c.  I don't know whether returning c_ispeed instead
  786. +     of c_ospeed is deliberate or a type-o.
  787. +  */
  788. + speed_t cfgetospeed(const struct termios *t)
  789. + {
  790. +     return t->c_ispeed;
  791. + }
  792. + int cfsetospeed(struct termios *t, int speed)
  793. + { 
  794. +     t->c_ospeed = speed; 
  795. +     return 0; 
  796. + }
  797. + speed_t cfgetispeed(const struct termios *t)
  798. + {
  799. +     return t->c_ispeed;
  800. + }
  801. + int cfsetispeed(struct termios *t, int speed)
  802. + { 
  803. +     t->c_ispeed = speed; 
  804. +     return 0; 
  805. + }
  806. + int setsid(void)
  807. + {
  808. +     int fd;
  809. +     setpgrp(0, getpid());
  810. +     
  811. +     if ( (fd = open("/dev/tty", O_RDWR | O_NDELAY)) < 0)
  812. +         return -1;
  813. +     ioctl(fd, TIOCNOTTY, NULL);
  814. +     close(fd);
  815. +     return 0;
  816. + }
  817. + int waitpid(pid_t pid, int *stat_loc, int options)
  818. + {
  819. +     if (pid == -1) 
  820. +     pid = 0;
  821. +     return wait4(pid, (union wait *) stat_loc, options, NULL);
  822. + }
  823. diff -r -c -N -d ppp-2.3b3/pppd/Makefile.NeXT ppp-2.3b3.ken/pppd/Makefile.NeXT
  824. *** ppp-2.3b3/pppd/Makefile.NeXT    Wed Oct  9 13:47:00 1996
  825. --- ppp-2.3b3.ken/pppd/Makefile.NeXT    Wed Nov 13 14:41:46 1996
  826. ***************
  827. *** 26,32 ****
  828.   # see the README.MSCHAP80 file at the top level.
  829.   #
  830.   
  831. ! COMPILE_FLAGS = -DNO_DRAND48 \
  832.       -DFIXSIGS -DHAS_BROKEN_IOCTL \
  833.       -DDEBUGUPAP -DDEBUGCHAP -DDEBUGLCP -DDEBUGIPCP
  834.   
  835. --- 26,32 ----
  836.   # see the README.MSCHAP80 file at the top level.
  837.   #
  838.   
  839. ! COMPILE_FLAGS = -D__BIT_TYPES_DEFINED__ -DNO_DRAND48 \
  840.       -DFIXSIGS -DHAS_BROKEN_IOCTL \
  841.       -DDEBUGUPAP -DDEBUGCHAP -DDEBUGLCP -DDEBUGIPCP
  842.   
  843. ***************
  844. *** 36,41 ****
  845. --- 36,43 ----
  846.   # library is installed, uncomment the following.
  847.   
  848.   #LIBS = -ldes
  849. + LIBS = ../libposix/libposix.o
  850.   
  851.   COPTS = $(ARCHFLAGS) -O -posix
  852.   
  853. diff -r -c -N -d ppp-2.3b3/pppd/main.c ppp-2.3b3.ken/pppd/main.c
  854. *** ppp-2.3b3/pppd/main.c    Mon Oct  7 23:43:49 1996
  855. --- ppp-2.3b3.ken/pppd/main.c    Wed Nov 13 13:55:14 1996
  856. ***************
  857. *** 119,125 ****
  858.   extern    char    *ttyname __P((int));
  859.   extern    char    *getlogin __P((void));
  860.   
  861. ! #ifdef ultrix
  862.   #undef    O_NONBLOCK
  863.   #define    O_NONBLOCK    O_NDELAY
  864.   #endif
  865. --- 119,125 ----
  866.   extern    char    *ttyname __P((int));
  867.   extern    char    *getlogin __P((void));
  868.   
  869. ! #if defined(ultrix) 
  870.   #undef    O_NONBLOCK
  871.   #define    O_NONBLOCK    O_NDELAY
  872.   #endif
  873. diff -r -c -N -d ppp-2.3b3/pppd/sys-NeXT.c ppp-2.3b3.ken/pppd/sys-NeXT.c
  874. *** ppp-2.3b3/pppd/sys-NeXT.c    Wed Oct  9 14:15:08 1996
  875. --- ppp-2.3b3.ken/pppd/sys-NeXT.c    Wed Nov 13 14:01:54 1996
  876. ***************
  877. *** 46,52 ****
  878. --- 46,55 ----
  879.   #include <netinet/in.h>
  880.   #include <netinet/in_systm.h>
  881.   #include <netinet/in_var.h>
  882. + #if !(NS_TARGET >= 40)
  883. + /* XXX get an error "duplicate member ip_v under 4.1 GAMMA */
  884.   #include <netinet/ip.h>
  885. + #endif /* NS_TARGET */
  886.   #include <netinet/if_ether.h>
  887.   #include <net/route.h>
  888.   #include <netinet/in.h>
  889. diff -r -c -N -d ppp-2.3b3/pppstats/Makefile.NeXT ppp-2.3b3.ken/pppstats/Makefile.NeXT
  890. *** ppp-2.3b3/pppstats/Makefile.NeXT    Mon Oct  7 19:49:48 1996
  891. --- ppp-2.3b3.ken/pppstats/Makefile.NeXT    Tue Nov 12 16:55:37 1996
  892. ***************
  893. *** 7,16 ****
  894.   BINDIR = /usr/local/ppp/bin
  895.   MANDIR = /usr/local/ppp/man
  896.   
  897. ! CFLAGS = -O -posix $(ARCHFLAGS) -I..
  898.   
  899.   SRCS = pppstats.c
  900. ! OBJS = pppstats.o
  901.   
  902.   MANPAGES = chat.8
  903.   
  904. --- 7,17 ----
  905.   BINDIR = /usr/local/ppp/bin
  906.   MANDIR = /usr/local/ppp/man
  907.   
  908. ! CFLAGS = -O -posix -D__BIT_TYPES_DEFINED__ $(ARCHFLAGS) -I..
  909.   
  910.   SRCS = pppstats.c
  911. ! OBJS = pppstats.o 
  912. ! LIBS = ../libposix/libposix.o
  913.   
  914.   MANPAGES = chat.8
  915.   
  916. ***************
  917. *** 18,24 ****
  918.   all: pppstats
  919.   
  920.   pppstats: $(OBJS)
  921. !     $(CC) -o pppstats $(CFLAGS) $(OBJS)
  922.   
  923.   install:
  924.       /bin/mkdirs $(MANDIR)/man8 $(BINDIR) 
  925. --- 19,25 ----
  926.   all: pppstats
  927.   
  928.   pppstats: $(OBJS)
  929. !     $(CC) -o pppstats $(CFLAGS) $(OBJS) $(LIBS)
  930.   
  931.   install:
  932.       /bin/mkdirs $(MANDIR)/man8 $(BINDIR) 
  933.