xproto: convert patch to patchset and fix struct passwd ops

add special case of struct passwd copy helper for Haiku,
which only has the POSIX-mandated fields.
This commit is contained in:
François Revol
2016-01-16 03:25:01 +01:00
parent 458ffb767b
commit 821dad3eb3
3 changed files with 128 additions and 50 deletions

View File

@@ -1,48 +0,0 @@
diff --git a/Xos_r.h xproto-7.0.23-git/Xos_r.h
index f963b64..f8b727b 100644
--- a/Xos_r.h
+++ xproto-7.0.23-git/Xos_r.h
@@ -88,6 +88,10 @@ in this Software without prior written authorization from The Open Group.
# endif
#endif /* _XOS_R_H */
+#ifdef __HAIKU__
+#define _POSIX_THREAD_SAFE_FUNCTIONS
+#endif
+
#ifndef WIN32
#ifdef __cplusplus
diff --git a/configure.ac xproto-7.0.23-git/configure.ac
index c4acf24..b3c82aa 100644
--- a/configure.ac
+++ xproto-7.0.23-git/configure.ac
@@ -99,6 +99,28 @@ if test "x$fds_bits_found" = xfalse ; then
fi
if test "x$fds_bits_found" = xfalse ; then
+AC_CHECK_MEMBER(fd_set.bits,
+ [
+ fds_bits_found=plain_simple
+ USE_FDS_BITS="bits"
+ ],,
+ [
+ #ifdef HAVE_SYS_PARAM_H
+ #include <sys/param.h>
+ #endif
+ #ifdef HAVE_SYS_TYPES_H
+ #include <sys/types.h>
+ #endif
+ #ifdef HAVE_SYS_TIME_H
+ #include <sys/time.h>
+ #endif
+ #ifdef HAVE_SYS_SELECT_H
+ #include <sys/select.h>
+ #endif
+ ])
+fi
+
+if test "x$fds_bits_found" = xfalse ; then
AC_MSG_ERROR([Could not determine how to access the fds_bits or equivalent
structure in fd_set on your platform.])
fi

View File

@@ -0,0 +1,126 @@
From 8d3782f681ba065c74e863d09c34c5f09079761f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Sat, 16 Jan 2016 03:19:58 +0100
Subject: [PATCH 1/3] configure: add proper check for fd_set.bits
---
configure.ac | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/configure.ac b/configure.ac
index 355fd0b..a405f15 100644
--- a/configure.ac
+++ b/configure.ac
@@ -98,6 +98,28 @@ if test "x$fds_bits_found" = xfalse ; then
fi
if test "x$fds_bits_found" = xfalse ; then
+AC_CHECK_MEMBER(fd_set.bits,
+ [
+ fds_bits_found=plain_simple
+ USE_FDS_BITS="bits"
+ ],,
+ [
+ #ifdef HAVE_SYS_PARAM_H
+ #include <sys/param.h>
+ #endif
+ #ifdef HAVE_SYS_TYPES_H
+ #include <sys/types.h>
+ #endif
+ #ifdef HAVE_SYS_TIME_H
+ #include <sys/time.h>
+ #endif
+ #ifdef HAVE_SYS_SELECT_H
+ #include <sys/select.h>
+ #endif
+ ])
+fi
+
+if test "x$fds_bits_found" = xfalse ; then
AC_MSG_ERROR([Could not determine how to access the fds_bits or equivalent
structure in fd_set on your platform.])
fi
--
2.7.0
From 841916ca1eddd85d810199b1d45124557bbc729d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Sat, 16 Jan 2016 03:20:41 +0100
Subject: [PATCH 2/3] Assume Haiku uses POSIX thread safe functions
---
Xos_r.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/Xos_r.h b/Xos_r.h
index f963b64..f8b727b 100644
--- a/Xos_r.h
+++ b/Xos_r.h
@@ -88,6 +88,10 @@ in this Software without prior written authorization from The Open Group.
# endif
#endif /* _XOS_R_H */
+#ifdef __HAIKU__
+#define _POSIX_THREAD_SAFE_FUNCTIONS
+#endif
+
#ifndef WIN32
#ifdef __cplusplus
--
2.7.0
From 7b9129e4552dd9c4720d466b13a955214becd1be Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Sat, 16 Jan 2016 03:15:19 +0100
Subject: [PATCH 3/3] Haiku only has POSIX-mandated passwd fields
---
Xos_r.h | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/Xos_r.h b/Xos_r.h
index f8b727b..b4a35ef 100644
--- a/Xos_r.h
+++ b/Xos_r.h
@@ -284,6 +284,35 @@ static __inline__ void _Xpw_copyPasswd(_Xgetpwparams p)
(p).pwp = &(p).pws;
}
+#elif defined(__HAIKU__)
+/* Haiku just has what POSIX mandates, who needs more??? */
+static __inline__ void _Xpw_copyPasswd(_Xgetpwparams p)
+{
+ memcpy(&(p).pws, (p).pwp, sizeof(struct passwd));
+
+ (p).pws.pw_name = (p).pwbuf;
+ (p).len = strlen((p).pwp->pw_name);
+ strcpy((p).pws.pw_name, (p).pwp->pw_name);
+
+ (p).pws.pw_passwd = (p).pws.pw_name + (p).len + 1;
+ (p).len = strlen((p).pwp->pw_passwd);
+ strcpy((p).pws.pw_passwd,(p).pwp->pw_passwd);
+
+ (p).pws.pw_gecos = (p).pws.pw_passwd + (p).len + 1;
+ (p).len = strlen((p).pwp->pw_gecos);
+ strcpy((p).pws.pw_gecos, (p).pwp->pw_gecos);
+
+ (p).pws.pw_dir = (p).pws.pw_gecos + (p).len + 1;
+ (p).len = strlen((p).pwp->pw_dir);
+ strcpy((p).pws.pw_dir, (p).pwp->pw_dir);
+
+ (p).pws.pw_shell = (p).pws.pw_dir + (p).len + 1;
+ (p).len = strlen((p).pwp->pw_shell);
+ strcpy((p).pws.pw_shell, (p).pwp->pw_shell);
+
+ (p).pwp = &(p).pws;
+}
+
#else
# define _Xpw_copyPasswd(p) \
(memcpy(&(p).pws, (p).pwp, sizeof(struct passwd)), \
--
2.7.0

View File

@@ -8,10 +8,10 @@ COPYRIGHT="1991, Oracle and/or its affiliates. All rights reserved.
1989 by Hewlett-Packard Company.
1999 The XFree86 Project Inc."
LICENSE="MIT (no promotion)"
REVISION="2"
REVISION="3"
SOURCE_URI="http://cgit.freedesktop.org/xorg/proto/xproto/snapshot/xproto-7.0.26.tar.gz"
CHECKSUM_SHA256="8c9667873a446f34c440d06e37c83144979d1abe6fa3dcd52727e7c6fecb290f"
PATCHES="xproto-7.0.26.patch"
PATCHES="xproto-7.0.26.patchset"
ARCHITECTURES="x86_gcc2 x86 x86_64"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"