summaryrefslogtreecommitdiff
path: root/sysutils/strace/patches/patch-an
blob: b63d2ae56be1c3b89961ca2d15e45f2af0c04db7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
$NetBSD: patch-an,v 1.4 2007/12/05 16:31:00 christos Exp $

--- net.c.orig	2006-12-13 14:57:23.000000000 -0500
+++ net.c	2007-12-05 11:19:06.000000000 -0500
@@ -35,7 +35,6 @@
 #include <sys/stat.h>
 #include <sys/socket.h>
 #include <sys/un.h>
-
 #if defined(HAVE_SIN6_SCOPE_ID_LINUX)
 #define in6_addr in6_addr_libc
 #define ipv6_mreq ipv6_mreq_libc
@@ -43,12 +42,19 @@
 #endif
 
 #include <netinet/in.h>
-#ifdef HAVE_NETINET_TCP_H
+#if defined(HAVE_NETINET_TCP_H) || defined(NETBSD)
 #include <netinet/tcp.h>
 #endif
-#ifdef HAVE_NETINET_UDP_H
+#if defined(HAVE_NETINET_UDP_H) || defined(NETBSD)
 #include <netinet/udp.h>
 #endif
+#ifdef NETBSD
+#include <sys/param.h>
+#include <sys/ucred.h>
+#ifdef NETBSD
+#define ucred uucred
+#endif
+#endif
 #include <arpa/inet.h>
 #include <net/if.h>
 #if defined(LINUX)
@@ -1099,7 +1105,7 @@
 		return;
 	}
 
-	tprintf(", {cmsg_len=%zu, cmsg_level=", cmsg->cmsg_len);
+	tprintf(", {cmsg_len=%zu, cmsg_level=", (size_t)cmsg->cmsg_len);
 	printxval(socketlayers, cmsg->cmsg_level, "SOL_???");
 	tprintf(", cmsg_type=");
 
@@ -1125,12 +1131,21 @@
 			free(cmsg);
 			return;
 		}
+#if !defined(SCM_CREDENTIALS) && defined(SCM_CREDS)
+#define SCM_CREDENTIALS SCM_CREDS
+#endif
+
 		if (cmsg->cmsg_type == SCM_CREDENTIALS
 		    && CMSG_LEN(sizeof(struct ucred)) <= cmsg_len) {
 			struct ucred *uc = (struct ucred *) CMSG_DATA (cmsg);
 
+#ifdef NETBSD
+			tprintf("{uid=%ld, gid=%ld}}",
+				(long)uc->cr_uid, (long)uc->cr_gid);
+#else
 			tprintf("{pid=%ld, uid=%ld, gid=%ld}}",
 				(long)uc->pid, (long)uc->uid, (long)uc->gid);
+#endif
 			free(cmsg);
 			return;
 		}
@@ -1472,7 +1487,7 @@
 		else
 			tprintf("[%u, %u]", fds[0], fds[1]);
 	}
-#elif defined(SPARC) || defined(SPARC64) || defined(SH) || defined(SVR4) || defined(FREEBSD) || defined(IA64)
+#elif defined(SPARC) || defined(SPARC64) || defined(SH) || defined(SVR4) || defined(ALLBSD) || defined(IA64)
 	if (exiting(tcp))
 		tprintf("[%lu, %lu]", tcp->u_rval, getrval2(tcp));
 #endif
@@ -1519,9 +1534,9 @@
 		else
 			tprintf(", [%u, %u]", fds[0], fds[1]);
 #endif /* LINUX */
-#if defined(SUNOS4) || defined(SVR4) || defined(FREEBSD)
+#if defined(SUNOS4) || defined(SVR4) || defined(ALLBSD)
 		tprintf(", [%lu, %lu]", tcp->u_rval, getrval2(tcp));
-#endif /* SUNOS4 || SVR4 || FREEBSD */
+#endif /* SUNOS4 || SVR4 || ALLBSD */
 	}
 	return 0;
 }