From 5ebdb55747c1211875a7bd8a4a7f1c9fb0f7fb66 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net>
Date: Sun, 22 Sep 1996 22:34:56 +0200
Subject: [PATCH] sys/types fixed

Rev: src/backend.c:1.2
Rev: src/compilation.h:1.2
Rev: src/configure.in:1.2
Rev: src/machine.h.in:1.2
Rev: src/modules/files/file.c:1.2
Rev: src/modules/files/socket.c:1.2
Rev: src/opcodes.c:1.2
Rev: src/port.c:1.2
Rev: src/port.h:1.2
Rev: src/rusage.c:1.2
Rev: src/types.h:1.2
---
 src/backend.c              | 2 ++
 src/compilation.h          | 2 +-
 src/configure.in           | 4 ++--
 src/machine.h.in           | 3 +++
 src/modules/files/file.c   | 7 +++++++
 src/modules/files/socket.c | 3 +++
 src/opcodes.c              | 1 +
 src/port.c                 | 2 ++
 src/port.h                 | 2 +-
 src/rusage.c               | 2 ++
 src/types.h                | 6 ++++++
 11 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/src/backend.c b/src/backend.c
index 03fe4536e4..b0017f3489 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -6,7 +6,9 @@
 #include "global.h"
 #include "backend.h"
 #include <errno.h>
+#ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
+#endif
 #include <sys/param.h>
 #include <string.h>
 #include "interpret.h"
diff --git a/src/compilation.h b/src/compilation.h
index 4237e2a744..51cd824095 100644
--- a/src/compilation.h
+++ b/src/compilation.h
@@ -58,7 +58,7 @@
 #define SNAME(X,Y) { \
       struct X *oLd; \
       oLd=Y; Y=oLd->previous;
-#define SEND free(oLd); \
+#define SEND free((char *)oLd); \
     }
 #define PCODE(X) X
 #else
diff --git a/src/configure.in b/src/configure.in
index 31c67ff4e2..b9ac3554a1 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -243,8 +243,8 @@ rm -rf conftest.y y.tab.c y.tab.h conftest.out
 
 AC_HEADER_TIME
 AC_HEADER_STDC
-AC_CHECK_HEADERS(sys/rusage.h time.h sys/time.h unistd.h stdlib.h memory.h \
-values.h string.h fcntl.h sys/filio.h sys/sockio.h crypt.h locale.h \
+AC_CHECK_HEADERS(sys/rusage.h time.h sys/time.h sys/types.h unistd.h stdlib.h \
+memory.h values.h string.h fcntl.h sys/filio.h sys/sockio.h crypt.h locale.h \
 sys/resource.h sys/select.h sys/mman.h setjmp.h)
 
 AC_SIZEOF_TYPE(char *)
diff --git a/src/machine.h.in b/src/machine.h.in
index 4ac151d2ab..97518b9e1d 100644
--- a/src/machine.h.in
+++ b/src/machine.h.in
@@ -40,6 +40,9 @@
 /* Define if you have the <sys/time.h> header file.  */
 #undef HAVE_SYS_TIME_H
 
+/* Define if you have the <sys/types.h> header file.  */
+#undef HAVE_SYS_TYPES_H
+
 /* Define if you have the <time.h> header file.  */
 #undef HAVE_TIME_H
 
diff --git a/src/modules/files/file.c b/src/modules/files/file.c
index ecbb2d7f32..d62ea0c987 100644
--- a/src/modules/files/file.c
+++ b/src/modules/files/file.c
@@ -22,7 +22,10 @@
 #include "signal_handler.h"
 #include "pike_types.h"
 
+#ifdef HAVE_SYS_TYPE_H
 #include <sys/types.h>
+#endif
+
 #include <sys/stat.h>
 #include <sys/param.h>
 #include <errno.h>
@@ -50,6 +53,10 @@
 #define SEEK_SET 0
 #endif
 
+#ifndef SEEK_SET
+#define SEEK_CUR 1
+#endif
+
 #ifndef SEEK_END
 #define SEEK_END 2
 #endif
diff --git a/src/modules/files/socket.c b/src/modules/files/socket.c
index 6e39273feb..803f785b21 100644
--- a/src/modules/files/socket.c
+++ b/src/modules/files/socket.c
@@ -17,7 +17,10 @@
 #include "file_machine.h"
 #include "file.h"
 
+#ifdef HAVE_SYS_TYPE_H
 #include <sys/types.h>
+#endif
+
 #include <sys/param.h>
 #include <errno.h>
 #include <fcntl.h>
diff --git a/src/opcodes.c b/src/opcodes.c
index 17a81447a7..7ab3069737 100644
--- a/src/opcodes.c
+++ b/src/opcodes.c
@@ -16,6 +16,7 @@
 #include "object.h"
 #include "error.h"
 #include "pike_types.h"
+#include "memory.h"
 
 void index_no_free(struct svalue *to,struct svalue *what,struct svalue *ind)
 {
diff --git a/src/port.c b/src/port.c
index caaa44824c..2a5cf63e36 100644
--- a/src/port.c
+++ b/src/port.c
@@ -8,7 +8,9 @@
 #include "time_stuff.h"
 #include <ctype.h>
 #include <math.h>
+#ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
+#endif
 #include <errno.h>
 #include <float.h>
 #include <string.h>
diff --git a/src/port.h b/src/port.h
index 765c4790bc..af8fc0ddbb 100644
--- a/src/port.h
+++ b/src/port.h
@@ -77,7 +77,7 @@ char *MEMMOVE(char *b,const char *a,int s);
 #ifndef HAVE_MEMCMP
 int MEMCMP(const char *b,const char *a,int s);
 #else
-#  define MEMCMP memcmp
+#  define MEMCMP(X,Y,Z) memcmp((char*)(X),(char*)(Y),(char*)(Z))
 #endif
 
 #ifndef HAVE_MEMCHR
diff --git a/src/rusage.c b/src/rusage.c
index ae7b796f51..01b946f810 100644
--- a/src/rusage.c
+++ b/src/rusage.c
@@ -4,7 +4,9 @@
 ||| See the files COPYING and DISCLAIMER for more information.
 \*/
 #include "global.h"
+#ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
+#endif
 #include <sys/stat.h>
 #include "time_stuff.h"
 #include <fcntl.h>
diff --git a/src/types.h b/src/types.h
index 5702bf9643..511d470f0f 100644
--- a/src/types.h
+++ b/src/types.h
@@ -31,4 +31,10 @@
 
 #define FLOAT_TYPE float
 
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#undef HAVE_SYS_TYPES_H
+#endif
+
 #endif
-- 
GitLab