Files
haikuports/net-libs/libtirpc/patches/libtirpc-1.3.2.patchset
2022-07-31 00:41:00 +03:00

228 lines
5.6 KiB
Plaintext

From 25987ef9a0633ac4d025d5ba25039d005b36c166 Mon Sep 17 00:00:00 2001
From: Sergei Reznikov <diver@gelios.net>
Date: Sun, 31 Jul 2022 00:25:59 +0300
Subject: Haiku fixes
diff --git a/autogen.sh b/autogen.sh
old mode 100644
new mode 100755
diff --git a/src/auth_none.c b/src/auth_none.c
index 0b0bbd1..9cecc9c 100644
--- a/src/auth_none.c
+++ b/src/auth_none.c
@@ -46,6 +46,9 @@ __FBSDID("$FreeBSD: src/lib/libc/rpc/auth_none.c,v 1.12 2002/03/22 23:18:35 obri
#include <reentrant.h>
#include <assert.h>
#include <stdlib.h>
+#include <pthread.h>
+
+#include <sys/types.h>
#include <rpc/types.h>
#include <rpc/xdr.h>
#include <rpc/auth.h>
diff --git a/src/bindresvport.c b/src/bindresvport.c
index ef9b345..6fec0b3 100644
--- a/src/bindresvport.c
+++ b/src/bindresvport.c
@@ -51,6 +51,8 @@
#include <string.h>
#include <reentrant.h>
+#undef INET6
+
extern pthread_mutex_t port_lock;
/*
diff --git a/src/clnt_vc.c b/src/clnt_vc.c
index a07e297..338611e 100644
--- a/src/clnt_vc.c
+++ b/src/clnt_vc.c
@@ -49,7 +49,7 @@
#include <reentrant.h>
#include <sys/types.h>
#include <poll.h>
-#include <sys/syslog.h>
+#include <syslog.h>
#include <sys/un.h>
#include <sys/uio.h>
#include <sys/socket.h>
diff --git a/src/rpc_generic.c b/src/rpc_generic.c
index aabbe4b..9c1104d 100644
--- a/src/rpc_generic.c
+++ b/src/rpc_generic.c
@@ -56,6 +56,8 @@
#include <rpc/nettype.h>
#include "rpc_com.h"
+#undef INET6
+
struct handle {
NCONF_HANDLE *nhandle;
int nflag; /* Whether NETPATH or NETCONFIG */
@@ -745,7 +747,7 @@ __rpc_uaddr2taddr_af(int af, const char *uaddr)
memset(sun, 0, sizeof *sun);
sun->sun_family = AF_LOCAL;
strncpy(sun->sun_path, addrstr, sizeof(sun->sun_path) - 1);
- ret->len = SUN_LEN(sun);
+ ret->len = sizeof(sun);
ret->maxlen = sizeof(struct sockaddr_un);
ret->buf = sun;
break;
diff --git a/src/rpc_soc.c b/src/rpc_soc.c
index fde121d..fa01529 100644
--- a/src/rpc_soc.c
+++ b/src/rpc_soc.c
@@ -647,7 +647,7 @@ clntunix_create(raddr, prog, vers, sockp, sendsz, recvsz)
}
if (*sockp < 0) {
*sockp = socket(AF_LOCAL, SOCK_STREAM, 0);
- len = SUN_LEN(raddr);
+ len = sizeof(raddr);
if ((*sockp < 0) || (connect(*sockp,
(struct sockaddr *)raddr, len) < 0)) {
rpc_createerr.cf_stat = RPC_SYSTEMERROR;
diff --git a/src/rpcb_clnt.c b/src/rpcb_clnt.c
index 0c34cb7..3454b27 100644
--- a/src/rpcb_clnt.c
+++ b/src/rpcb_clnt.c
@@ -486,7 +486,7 @@ local_rpcb()
goto try_nconf;
sun.sun_family = AF_LOCAL;
strcpy(sun.sun_path, _PATH_RPCBINDSOCK);
- nbuf.len = SUN_LEN(&sun);
+ nbuf.len = sizeof(&sun);
nbuf.maxlen = sizeof (struct sockaddr_un);
nbuf.buf = &sun;
diff --git a/src/rpcdname.c b/src/rpcdname.c
index 3e6a988..b2752b4 100644
--- a/src/rpcdname.c
+++ b/src/rpcdname.c
@@ -44,8 +44,8 @@ get_default_domain()
if (default_domain)
return (default_domain);
- if (getdomainname(temp, sizeof(temp)) < 0)
- return (0);
+// if (getdomainname(temp, sizeof(temp)) < 0)
+// return (0);
if ((int) strlen(temp) > 0) {
default_domain = (char *)malloc((strlen(temp)+(unsigned)1));
if (default_domain == 0)
diff --git a/src/svc.c b/src/svc.c
index 6db164b..533a45c 100644
--- a/src/svc.c
+++ b/src/svc.c
@@ -626,7 +626,7 @@ svc_getreq (rdfds)
fd_set readfds;
FD_ZERO (&readfds);
- readfds.fds_bits[0] = rdfds;
+ readfds.bits[0] = rdfds;
svc_getreqset (&readfds);
}
@@ -644,7 +644,7 @@ svc_getreqset (readfds)
setsize = _rpc_dtablesize ();
if (setsize > FD_SETSIZE)
setsize = FD_SETSIZE;
- maskp = readfds->fds_bits;
+ maskp = readfds->bits;
for (sock = 0; sock < setsize; sock += NFDBITS)
{
for (mask = *maskp++; (bit = ffsl(mask)) != 0; mask ^= (1L << (bit - 1)))
diff --git a/src/svc_dg.c b/src/svc_dg.c
index a9f63ff..89e4b6e 100644
--- a/src/svc_dg.c
+++ b/src/svc_dg.c
@@ -650,6 +650,7 @@ cache_get(xprt, msg, replyp, replylenp)
void
svc_dg_enable_pktinfo(int fd, const struct __rpc_sockinfo *si)
{
+#ifndef __HAIKU__
int val = 1;
switch (si->si_af) {
@@ -662,6 +663,7 @@ svc_dg_enable_pktinfo(int fd, const struct __rpc_sockinfo *si)
break;
#endif
}
+#endif
}
/*
@@ -672,6 +674,9 @@ svc_dg_enable_pktinfo(int fd, const struct __rpc_sockinfo *si)
int
svc_dg_valid_pktinfo(struct msghdr *msg)
{
+#ifdef __HAIKU__
+ return 0;
+#else
struct cmsghdr *cmsg;
if (!msg->msg_name)
@@ -718,4 +723,5 @@ svc_dg_valid_pktinfo(struct msghdr *msg)
}
return 1;
+#endif
}
diff --git a/tirpc/reentrant.h b/tirpc/reentrant.h
index 5bb581a..80ce76c 100644
--- a/tirpc/reentrant.h
+++ b/tirpc/reentrant.h
@@ -36,7 +36,7 @@
* These definitions are only guaranteed to be valid on Linux.
*/
-#if defined(__linux__)
+#if defined(__linux__) || defined(__HAIKU__)
#include <pthread.h>
diff --git a/tirpc/rpc/types.h b/tirpc/rpc/types.h
index 0153a5c..ebb6ca9 100644
--- a/tirpc/rpc/types.h
+++ b/tirpc/rpc/types.h
@@ -39,6 +39,7 @@
#define _TIRPC_TYPES_H
#include <sys/types.h>
+#include <stdint.h>
typedef int32_t bool_t;
typedef int32_t enum_t;
@@ -66,11 +67,14 @@ typedef int32_t rpc_inline_t;
#define mem_free(ptr, bsize) free(ptr)
-#if defined __APPLE_CC__ || defined __FreeBSD__ || !defined (__GLIBC__)
+#if defined __APPLE_CC__ || defined __FreeBSD__ || defined __HAIKU__ || !defined (__GLIBC__)
# define __u_char_defined
# define __daddr_t_defined
#endif
+typedef long int quad_t;
+typedef unsigned long int u_quad_t;
+
#ifndef __u_char_defined
typedef __u_char u_char;
typedef __u_short u_short;
diff --git a/tirpc/rpc/xdr.h b/tirpc/rpc/xdr.h
index 80b35ce..d052ae1 100644
--- a/tirpc/rpc/xdr.h
+++ b/tirpc/rpc/xdr.h
@@ -42,7 +42,7 @@
#define _TIRPC_XDR_H
#include <stdio.h>
#include <netinet/in.h>
-
+#include <sys/types.h>
#include <rpc/types.h>
/*
--
2.36.1