summaryrefslogtreecommitdiff
path: root/lang/modula-3-lib/files/patch-bj
diff options
context:
space:
mode:
Diffstat (limited to 'lang/modula-3-lib/files/patch-bj')
-rw-r--r--lang/modula-3-lib/files/patch-bj460
1 files changed, 460 insertions, 0 deletions
diff --git a/lang/modula-3-lib/files/patch-bj b/lang/modula-3-lib/files/patch-bj
new file mode 100644
index 000000000000..598c235deea2
--- /dev/null
+++ b/lang/modula-3-lib/files/patch-bj
@@ -0,0 +1,460 @@
+New wrapper files for network related functions. These are separated so
+that they can be easily overridden when SOCKS support is desired.
+
+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
+@@ -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;
++}
+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
+@@ -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;
++}
+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
+@@ -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;
++}
+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
+@@ -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;
++}
+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
+@@ -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;
++}
+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
+@@ -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;
++}
+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
+@@ -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;
++}
+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
+@@ -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;
++}
+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
+@@ -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;
++}
+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
+@@ -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;
++}
+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
+@@ -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;
++}
+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
+@@ -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;
++}
+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
+@@ -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;
++}
+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
+@@ -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;
++}
+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
+@@ -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;
++}
+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
+@@ -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;
++}
+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
+@@ -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;
++}
+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
+@@ -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;
++}
+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
+@@ -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;
++}
+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
+@@ -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
+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
+@@ -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); }
+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
+@@ -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;
++}