head	1.3;
access;
symbols
	RELEASE_4_3_0:1.2
	RELEASE_4_2_0:1.2
	RELEASE_4_1_1:1.2
	RELEASE_4_1_0:1.2
	RELEASE_3_5_0:1.2
	RELEASE_4_0_0:1.2
	RELEASE_3_4_0:1.2
	RELEASE_3_3_0:1.2
	RELEASE_3_2_0:1.2
	RELEASE_3_1_0:1.2
	RELEASE_2_2_8:1.2
	RELEASE_3_0_0:1.2
	RELEASE_2_2_7:1.2
	RELEASE_2_2_6:1.2
	RELEASE_2_2_5:1.1.1.1
	RELEASE_2_2_1:1.1.1.1
	RELEASE_2_2_2:1.1.1.1
	jdp_1_0:1.1.1.1
	JDP:1.1.1;
locks; strict;
comment	@# @;


1.3
date	2001.07.21.23.41.40;	author jdp;	state dead;
branches;
next	1.2;

1.2
date	98.01.17.21.12.14;	author jdp;	state Exp;
branches;
next	1.1;

1.1
date	96.10.29.23.01.53;	author jdp;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	96.10.29.23.01.53;	author jdp;	state Exp;
branches;
next	;


desc
@@


1.3
log
@Remove the old modula-3 and modula-3-lib ports.  They are superseded
by the pm3-* family of ports, which build a newer and better-maintained
version of Modula-3.  I have converted all ports which depended on
modula-3 to use pm3-* instead.

PR:		ports/27664 is rendered irrelevant
@
text
@New wrapper files for network related functions.  These are separated so
that they can be easily overridden when SOCKS support is desired.

--- m3/m3core/src/runtime/FreeBSD2/accept.c.orig	Thu Oct 24 13:11:22 1996
+++ m3/m3core/src/runtime/FreeBSD2/accept.c	Thu Oct 24 12:47:29 1996
@@@@ -0,0 +1,16 @@@@
+#include "wrap.h"
+#include <sys/types.h>
+#include <sys/socket.h>
+
+int
+m3_accept(int s, struct sockaddr *addr, int *addrlen)
+{
+  int result;
+
+  ENTER_CRITICAL;
+  MAKE_WRITABLE(addr);
+  MAKE_WRITABLE(addrlen);
+  result = accept(s, addr, addrlen);
+  EXIT_CRITICAL;
+  return result;
+}
--- m3/m3core/src/runtime/FreeBSD2/bind.c.orig	Thu Oct 24 13:11:23 1996
+++ m3/m3core/src/runtime/FreeBSD2/bind.c	Thu Oct 24 12:48:12 1996
@@@@ -0,0 +1,15 @@@@
+#include "wrap.h"
+#include <sys/types.h>
+#include <sys/socket.h>
+
+int
+m3_bind(int s, const struct sockaddr *name, int namelen)
+{
+  int result;
+
+  ENTER_CRITICAL;
+  MAKE_READABLE(name);
+  result = bind(s, name, namelen);
+  EXIT_CRITICAL;
+  return result;
+}
--- m3/m3core/src/runtime/FreeBSD2/close.c.orig	Thu Oct 24 13:11:23 1996
+++ m3/m3core/src/runtime/FreeBSD2/close.c	Thu Oct 24 12:48:51 1996
@@@@ -0,0 +1,13 @@@@
+#include "wrap.h"
+#include <unistd.h>
+
+int
+m3_close(int d)
+{
+  int result;
+
+  ENTER_CRITICAL;
+  result = close(d);
+  EXIT_CRITICAL;
+  return result;
+}
--- m3/m3core/src/runtime/FreeBSD2/connect.c.orig	Thu Oct 24 13:11:23 1996
+++ m3/m3core/src/runtime/FreeBSD2/connect.c	Thu Oct 24 12:49:40 1996
@@@@ -0,0 +1,15 @@@@
+#include "wrap.h"
+#include <sys/types.h>
+#include <sys/socket.h>
+
+int
+m3_connect(int s, const struct sockaddr *name, int namelen)
+{
+  int result;
+
+  ENTER_CRITICAL;
+  MAKE_READABLE(name);
+  result = connect(s, name, namelen);
+  EXIT_CRITICAL;
+  return result;
+}
--- m3/m3core/src/runtime/FreeBSD2/dup.c.orig	Thu Oct 24 13:11:23 1996
+++ m3/m3core/src/runtime/FreeBSD2/dup.c	Thu Oct 24 12:50:09 1996
@@@@ -0,0 +1,13 @@@@
+#include "wrap.h"
+#include <unistd.h>
+
+int
+m3_dup(int oldd)
+{
+  int result;
+
+  ENTER_CRITICAL;
+  result = dup(oldd);
+  EXIT_CRITICAL;
+  return result;
+}
--- m3/m3core/src/runtime/FreeBSD2/dup2.c.orig	Thu Oct 24 13:11:23 1996
+++ m3/m3core/src/runtime/FreeBSD2/dup2.c	Thu Oct 24 12:50:28 1996
@@@@ -0,0 +1,13 @@@@
+#include "wrap.h"
+#include <unistd.h>
+
+int
+m3_dup2(int oldd, int newd)
+{
+  int result;
+
+  ENTER_CRITICAL;
+  result = dup2(oldd, newd);
+  EXIT_CRITICAL;
+  return result;
+}
--- m3/m3core/src/runtime/FreeBSD2/gethostbyaddr.c.orig	Thu Oct 24 16:07:10 1996
+++ m3/m3core/src/runtime/FreeBSD2/gethostbyaddr.c	Thu Oct 24 16:10:19 1996
@@@@ -0,0 +1,14 @@@@
+#include "wrap.h"
+#include <netdb.h>
+
+struct hostent *
+m3_gethostbyaddr(const char *addr, int len, int type)
+{
+  struct hostent *result;
+
+  ENTER_CRITICAL;
+  MAKE_READABLE(addr);
+  result = gethostbyaddr(addr, len, type);
+  EXIT_CRITICAL;
+  return result;
+}
--- m3/m3core/src/runtime/FreeBSD2/gethostbyname.c.orig	Thu Oct 24 13:11:23 1996
+++ m3/m3core/src/runtime/FreeBSD2/gethostbyname.c	Thu Oct 24 16:08:41 1996
@@@@ -0,0 +1,14 @@@@
+#include "wrap.h"
+#include <netdb.h>
+
+struct hostent *
+m3_gethostbyname(const char *name)
+{
+  struct hostent *result;
+
+  ENTER_CRITICAL;
+  MAKE_READABLE(name);
+  result = gethostbyname(name);
+  EXIT_CRITICAL;
+  return result;
+}
--- m3/m3core/src/runtime/FreeBSD2/getpeername.c.orig	Thu Oct 24 13:11:23 1996
+++ m3/m3core/src/runtime/FreeBSD2/getpeername.c	Thu Oct 24 12:52:25 1996
@@@@ -0,0 +1,16 @@@@
+#include "wrap.h"
+#include <sys/types.h>
+#include <sys/socket.h>
+
+int
+m3_getpeername(int s, struct sockaddr *name, int *namelen)
+{
+  int result;
+
+  ENTER_CRITICAL;
+  MAKE_WRITABLE(name);
+  MAKE_WRITABLE(namelen);
+  result = getpeername(s, name, namelen);
+  EXIT_CRITICAL;
+  return result;
+}
--- m3/m3core/src/runtime/FreeBSD2/getsockname.c.orig	Thu Oct 24 13:11:23 1996
+++ m3/m3core/src/runtime/FreeBSD2/getsockname.c	Thu Oct 24 12:52:56 1996
@@@@ -0,0 +1,16 @@@@
+#include "wrap.h"
+#include <sys/types.h>
+#include <sys/socket.h>
+
+int
+m3_getsockname(int s, struct sockaddr *name, int *namelen)
+{
+  int result;
+
+  ENTER_CRITICAL;
+  MAKE_WRITABLE(name);
+  MAKE_WRITABLE(namelen);
+  result = getsockname(s, name, namelen);
+  EXIT_CRITICAL;
+  return result;
+}
--- m3/m3core/src/runtime/FreeBSD2/listen.c.orig	Thu Oct 24 13:11:23 1996
+++ m3/m3core/src/runtime/FreeBSD2/listen.c	Thu Oct 24 12:53:42 1996
@@@@ -0,0 +1,14 @@@@
+#include "wrap.h"
+#include <sys/types.h>
+#include <sys/socket.h>
+
+int
+m3_listen(int s, int backlog)
+{
+  int result;
+
+  ENTER_CRITICAL;
+  result = listen(s, backlog);
+  EXIT_CRITICAL;
+  return result;
+}
--- m3/m3core/src/runtime/FreeBSD2/read.c.orig	Thu Oct 24 13:11:23 1996
+++ m3/m3core/src/runtime/FreeBSD2/read.c	Thu Oct 24 12:55:56 1996
@@@@ -0,0 +1,15 @@@@
+#include "wrap.h"
+#include <sys/types.h>
+#include <unistd.h>
+
+ssize_t
+m3_read(int d, void *buf, size_t nbytes)
+{
+  int result;
+
+  ENTER_CRITICAL;
+  MAKE_WRITABLE(buf);
+  result = read(d, buf, nbytes);
+  EXIT_CRITICAL;
+  return result;
+}
--- m3/m3core/src/runtime/FreeBSD2/recv.c.orig	Thu Oct 24 13:11:23 1996
+++ m3/m3core/src/runtime/FreeBSD2/recv.c	Thu Oct 24 12:56:57 1996
@@@@ -0,0 +1,15 @@@@
+#include "wrap.h"
+#include <sys/types.h>
+#include <sys/socket.h>
+
+ssize_t
+m3_recv(int s, void *buf, size_t len, int flags)
+{
+  int result;
+
+  ENTER_CRITICAL;
+  MAKE_WRITABLE(buf);
+  result = recv(s, buf, len, flags);
+  EXIT_CRITICAL;
+  return result;
+}
--- m3/m3core/src/runtime/FreeBSD2/recvfrom.c.orig	Thu Oct 24 13:11:23 1996
+++ m3/m3core/src/runtime/FreeBSD2/recvfrom.c	Thu Oct 24 12:58:10 1996
@@@@ -0,0 +1,18 @@@@
+#include "wrap.h"
+#include <sys/types.h>
+#include <sys/socket.h>
+
+ssize_t
+m3_recvfrom(int s, void *buf, size_t len, int flags,
+  struct sockaddr *from, int *fromlen)
+{
+  int result;
+
+  ENTER_CRITICAL;
+  MAKE_WRITABLE(buf);
+  MAKE_WRITABLE(from);
+  MAKE_WRITABLE(fromlen);
+  result = recvfrom(s, buf, len, flags, from, fromlen);
+  EXIT_CRITICAL;
+  return result;
+}
--- m3/m3core/src/runtime/FreeBSD2/select.c.orig	Thu Oct 24 13:11:23 1996
+++ m3/m3core/src/runtime/FreeBSD2/select.c	Thu Oct 24 12:59:17 1996
@@@@ -0,0 +1,20 @@@@
+#include "wrap.h"
+#include <sys/types.h>
+#include <sys/time.h>
+#include <unistd.h>
+
+int
+m3_select(int nfds, fd_set *readfds, fd_set *writefds,
+  fd_set *exceptfds, struct timeval *timeout)
+{
+  int result;
+
+  ENTER_CRITICAL;
+  MAKE_WRITABLE(readfds);
+  MAKE_WRITABLE(writefds);
+  MAKE_WRITABLE(exceptfds);
+  MAKE_READABLE(timeout);
+  result = select(nfds, readfds, writefds, exceptfds, timeout);
+  EXIT_CRITICAL;
+  return result;
+}
--- m3/m3core/src/runtime/FreeBSD2/send.c.orig	Thu Oct 24 13:11:23 1996
+++ m3/m3core/src/runtime/FreeBSD2/send.c	Thu Oct 24 13:00:25 1996
@@@@ -0,0 +1,15 @@@@
+#include "wrap.h"
+#include <sys/types.h>
+#include <sys/socket.h>
+
+ssize_t
+m3_send(int s, const void *msg, size_t len, int flags)
+{
+  int result;
+
+  ENTER_CRITICAL;
+  MAKE_READABLE(msg);
+  result = send(s, msg, len, flags);
+  EXIT_CRITICAL;
+  return result;
+}
--- m3/m3core/src/runtime/FreeBSD2/sendto.c.orig	Thu Oct 24 13:11:23 1996
+++ m3/m3core/src/runtime/FreeBSD2/sendto.c	Thu Oct 24 13:01:18 1996
@@@@ -0,0 +1,17 @@@@
+#include "wrap.h"
+#include <sys/types.h>
+#include <sys/socket.h>
+
+ssize_t
+m3_sendto(int s, const void *msg, size_t len, int flags,
+  const struct sockaddr *to, int tolen)
+{
+  int result;
+
+  ENTER_CRITICAL;
+  MAKE_READABLE(msg);
+  MAKE_READABLE(to);
+  result = sendto(s, msg, len, flags, to, tolen);
+  EXIT_CRITICAL;
+  return result;
+}
--- m3/m3core/src/runtime/FreeBSD2/shutdown.c.orig	Thu Oct 24 13:11:23 1996
+++ m3/m3core/src/runtime/FreeBSD2/shutdown.c	Thu Oct 24 13:01:40 1996
@@@@ -0,0 +1,14 @@@@
+#include "wrap.h"
+#include <sys/types.h>
+#include <sys/socket.h>
+
+int
+m3_shutdown(int s, int how)
+{
+  int result;
+
+  ENTER_CRITICAL;
+  result = shutdown(s, how);
+  EXIT_CRITICAL;
+  return result;
+}
--- m3/m3core/src/runtime/FreeBSD2/socket.c.orig	Thu Oct 24 16:11:12 1996
+++ m3/m3core/src/runtime/FreeBSD2/socket.c	Thu Oct 24 16:12:22 1996
@@@@ -0,0 +1,14 @@@@
+#include "wrap.h"
+#include <sys/types.h>
+#include <sys/socket.h>
+
+int
+m3_socket(int domain, int type, int protocol)
+{
+  int result;
+
+  ENTER_CRITICAL;
+  result = socket(domain, type, protocol);
+  EXIT_CRITICAL;
+  return result;
+}
--- m3/m3core/src/runtime/FreeBSD2/socksconf.h.orig	Fri Oct 25 14:05:03 1996
+++ m3/m3core/src/runtime/FreeBSD2/socksconf.h	Fri Oct 25 14:05:28 1996
@@@@ -0,0 +1,6 @@@@
+/*
+ * Define 0 or 1 of these, to select the variety of SOCKS support you want.
+ */
+#undef HPSOCKS
+#undef SOCKS4
+#undef SOCKS5
--- m3/m3core/src/runtime/FreeBSD2/wrap.h.orig	Thu Oct 24 20:50:16 1996
+++ m3/m3core/src/runtime/FreeBSD2/wrap.h	Fri Oct 25 14:04:13 1996
@@@@ -0,0 +1,61 @@@@
+#include "socksconf.h"
+
+#if defined(HPSOCKS) /* { */
+  #define accept        Raccept
+  #define bind          Rxbind
+  #define close         Rclose
+  #define connect       Rconnect
+  #define dup           Rdup
+  #define dup2          Rdup2
+  #define gethostbyaddr Rgethostbyaddr
+  #define gethostbyname Rgethostbyname
+  #define getpeername   Rgetpeername
+  #define getsockname   Rgetsockname
+  #define listen        Rlisten
+  #define recv          Rrecv
+  #define recvfrom      Rrecvfrom
+  #define send          Rsend
+  #define sendto        Rsendto
+  #define shutdown      Rshutdown
+  #define socket        Rsocket
+#elif defined(SOCKS4) /* } { */
+  #define accept        Raccept
+  #define bind          Rbind
+  #define connect       Rconnect
+  #define getpeername   Rgetpeername
+  #define getsockname   Rgetsockname
+  #define listen        Rlisten
+  #define select        Rselect
+#elif defined(SOCKS5) /* } { */
+  #define accept        SOCKSaccept
+  #define bind          SOCKSbind
+  #define close         SOCKSclose
+  #define connect       SOCKSconnect
+  #define dup           SOCKSdup
+  #define dup2          SOCKSdup2
+  #define fclose        SOCKSfclose
+  #define gethostbyname SOCKSgethostbyname
+  #define getpeername   SOCKSgetpeername
+  #define getsockname   SOCKSgetsockname
+  #define listen        SOCKSlisten
+  #define read          SOCKSread
+  #define recv          SOCKSrecv
+  #define recvfrom      SOCKSrecvfrom
+  #define rresvport     SOCKSrresvport
+  #define select        SOCKSselect
+  #define send          SOCKSsend
+  #define sendto        SOCKSsendto
+  #define shutdown      SOCKSshutdown
+  #define write         SOCKSwrite
+#endif /* } */
+
+extern int RT0u__inCritical;
+#define ENTER_CRITICAL RT0u__inCritical++
+#define EXIT_CRITICAL  RT0u__inCritical--
+
+static char RTHeapDepC__c;
+#define MAKE_READABLE(x) \
+    if ((int)x) { RTHeapDepC__c = *(char*)(x); }
+
+#define MAKE_WRITABLE(x) \
+    if ((int)x) { *(char*)(x) = RTHeapDepC__c = *(char*)(x); }
--- m3/m3core/src/runtime/FreeBSD2/write.c.orig	Thu Oct 24 13:11:23 1996
+++ m3/m3core/src/runtime/FreeBSD2/write.c	Thu Oct 24 13:02:24 1996
@@@@ -0,0 +1,15 @@@@
+#include "wrap.h"
+#include <sys/types.h>
+#include <unistd.h>
+
+size_t
+m3_write(int fd, const void *buf, int nbytes)
+{
+  int result;
+
+  ENTER_CRITICAL;
+  MAKE_READABLE(buf);
+  result = write(fd, buf, nbytes);
+  EXIT_CRITICAL;
+  return result;
+}
@


1.2
log
@Fix all the paths in context diff headers and remove the Index
lines, since the WORTHLESS, BROKEN new version of patch ignores
them.
@
text
@@


1.1
log
@Initial revision
@
text
@d4 2
a5 3
Index: m3/m3core/src/runtime/FreeBSD2/accept.c
--- accept.c.orig	Thu Oct 24 13:11:22 1996
+++ accept.c	Thu Oct 24 12:47:29 1996
d23 2
a24 3
Index: m3/m3core/src/runtime/FreeBSD2/bind.c
--- bind.c.orig	Thu Oct 24 13:11:23 1996
+++ bind.c	Thu Oct 24 12:48:12 1996
d41 2
a42 3
Index: m3/m3core/src/runtime/FreeBSD2/close.c
--- close.c.orig	Thu Oct 24 13:11:23 1996
+++ close.c	Thu Oct 24 12:48:51 1996
d57 2
a58 3
Index: m3/m3core/src/runtime/FreeBSD2/connect.c
--- connect.c.orig	Thu Oct 24 13:11:23 1996
+++ connect.c	Thu Oct 24 12:49:40 1996
d75 2
a76 3
Index: m3/m3core/src/runtime/FreeBSD2/dup.c
--- dup.c.orig	Thu Oct 24 13:11:23 1996
+++ dup.c	Thu Oct 24 12:50:09 1996
d91 2
a92 3
Index: m3/m3core/src/runtime/FreeBSD2/dup2.c
--- dup2.c.orig	Thu Oct 24 13:11:23 1996
+++ dup2.c	Thu Oct 24 12:50:28 1996
d107 2
a108 3
Index: m3/m3core/src/runtime/FreeBSD2/gethostbyaddr.c
--- gethostbyaddr.c.orig	Thu Oct 24 16:07:10 1996
+++ gethostbyaddr.c	Thu Oct 24 16:10:19 1996
d124 2
a125 3
Index: m3/m3core/src/runtime/FreeBSD2/gethostbyname.c
--- gethostbyname.c.orig	Thu Oct 24 13:11:23 1996
+++ gethostbyname.c	Thu Oct 24 16:08:41 1996
d141 2
a142 3
Index: m3/m3core/src/runtime/FreeBSD2/getpeername.c
--- getpeername.c.orig	Thu Oct 24 13:11:23 1996
+++ getpeername.c	Thu Oct 24 12:52:25 1996
d160 2
a161 3
Index: m3/m3core/src/runtime/FreeBSD2/getsockname.c
--- getsockname.c.orig	Thu Oct 24 13:11:23 1996
+++ getsockname.c	Thu Oct 24 12:52:56 1996
d179 2
a180 3
Index: m3/m3core/src/runtime/FreeBSD2/listen.c
--- listen.c.orig	Thu Oct 24 13:11:23 1996
+++ listen.c	Thu Oct 24 12:53:42 1996
d196 2
a197 3
Index: m3/m3core/src/runtime/FreeBSD2/read.c
--- read.c.orig	Thu Oct 24 13:11:23 1996
+++ read.c	Thu Oct 24 12:55:56 1996
d214 2
a215 3
Index: m3/m3core/src/runtime/FreeBSD2/recv.c
--- recv.c.orig	Thu Oct 24 13:11:23 1996
+++ recv.c	Thu Oct 24 12:56:57 1996
d232 2
a233 3
Index: m3/m3core/src/runtime/FreeBSD2/recvfrom.c
--- recvfrom.c.orig	Thu Oct 24 13:11:23 1996
+++ recvfrom.c	Thu Oct 24 12:58:10 1996
d253 2
a254 3
Index: m3/m3core/src/runtime/FreeBSD2/select.c
--- select.c.orig	Thu Oct 24 13:11:23 1996
+++ select.c	Thu Oct 24 12:59:17 1996
d276 2
a277 3
Index: m3/m3core/src/runtime/FreeBSD2/send.c
--- send.c.orig	Thu Oct 24 13:11:23 1996
+++ send.c	Thu Oct 24 13:00:25 1996
d294 2
a295 3
Index: m3/m3core/src/runtime/FreeBSD2/sendto.c
--- sendto.c.orig	Thu Oct 24 13:11:23 1996
+++ sendto.c	Thu Oct 24 13:01:18 1996
d314 2
a315 3
Index: m3/m3core/src/runtime/FreeBSD2/shutdown.c
--- shutdown.c.orig	Thu Oct 24 13:11:23 1996
+++ shutdown.c	Thu Oct 24 13:01:40 1996
d331 2
a332 3
Index: m3/m3core/src/runtime/FreeBSD2/socket.c
--- socket.c.orig	Thu Oct 24 16:11:12 1996
+++ socket.c	Thu Oct 24 16:12:22 1996
d348 2
a349 3
Index: m3/m3core/src/runtime/FreeBSD2/socksconf.h
--- socksconf.h.orig	Fri Oct 25 14:05:03 1996
+++ socksconf.h	Fri Oct 25 14:05:28 1996
d357 2
a358 3
Index: m3/m3core/src/runtime/FreeBSD2/wrap.h
--- wrap.h.orig	Thu Oct 24 20:50:16 1996
+++ wrap.h	Fri Oct 25 14:04:13 1996
d421 2
a422 3
Index: m3/m3core/src/runtime/FreeBSD2/write.c
--- write.c.orig	Thu Oct 24 13:11:23 1996
+++ write.c	Thu Oct 24 13:02:24 1996
@


1.1.1.1
log
@Split the Modula-3 port into two pieces, creating a new port
"modula-3-lib".  It installs only the shared libraries needed for
executing Modula-3 programs.  This saves a lot of disk space for
people who need to run Modula-3 programs but don't need to build
them.  The original "modula-3" port now depends on this one, and
uses it to install the compiler and the rest of the development
system.

Also, everything is now built with optimization.  I have been
testing this for at least a month, and haven't seen any problems
from it.  It makes the libraries and executables substantially
smaller.

This new port also includes some hooks that will make SOCKS support
possible in the near future.
@
text
@@
