summaryrefslogtreecommitdiff
path: root/sysutils/strace/patches/patch-ah
blob: 714a2232234d09d1d5ddc75c5c40e66998b59865 (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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
$NetBSD: patch-ah,v 1.3 2007/12/05 16:31:00 christos Exp $

--- file.c.orig	2007-01-15 15:25:52.000000000 -0500
+++ file.c	2007-12-05 11:22:56.000000000 -0500
@@ -1,5 +1,4 @@
 /*
-#ifdef LINUX
  * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
  * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
  * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
@@ -44,6 +43,13 @@
 #else
 #define kernel_dirent dirent
 #endif
+#ifdef NETBSD
+#include <sys/statvfs.h>
+#define statfs statvfs
+#define __val __fsid_val
+#define f_fsid f_fsidx
+#endif
+
 
 #ifdef LINUX
 #  ifdef LINUXSPARC
@@ -162,7 +168,7 @@
 #define XATTR_REPLACE 2
 #endif
 
-#ifdef FREEBSD
+#ifdef ALLBSD
 #include <sys/param.h>
 #include <sys/mount.h>
 #include <sys/stat.h>
@@ -831,16 +837,20 @@
 #endif /* LINUXSPARC */
 
 static const struct xlat fileflags[] = {
-#ifdef FREEBSD
+#ifdef ALLBSD
 	{ UF_NODUMP,	"UF_NODUMP"	},
 	{ UF_IMMUTABLE,	"UF_IMMUTABLE"	},
 	{ UF_APPEND,	"UF_APPEND"	},
 	{ UF_OPAQUE,	"UF_OPAQUE"	},
+#ifdef UF_NOUNLINK
 	{ UF_NOUNLINK,	"UF_NOUNLINK"	},
+#endif
 	{ SF_ARCHIVED,	"SF_ARCHIVED"	},
 	{ SF_IMMUTABLE,	"SF_IMMUTABLE"	},
 	{ SF_APPEND,	"SF_APPEND"	},
+#ifdef SF_NOUNLINK
 	{ SF_NOUNLINK,	"SF_NOUNLINK"	},
+#endif
 #elif UNIXWARE >= 2
 #ifdef 	_S_ISMLD
 	{ _S_ISMLD, 	"_S_ISMLD"	},
@@ -852,7 +862,7 @@
 	{ 0,		NULL		},
 };
 
-#ifdef FREEBSD
+#ifdef ALLBSD
 int
 sys_chflags(tcp)
 struct tcb *tcp;
@@ -1058,7 +1068,7 @@
 #endif /* !HAVE_STRUCT_STAT_ST_RDEV */
 		break;
 	default:
-		tprintf("st_size=%llu, ", statbuf.st_size);
+		tprintf("st_size=%llu, ", (unsigned long long)statbuf.st_size);
 		break;
 	}
 	if (!abbrev(tcp)) {
@@ -1546,6 +1556,7 @@
 #endif /* LINUX */
 
 #ifndef SVR4
+#ifndef NETBSD
 
 static const char *
 sprintfstype(magic)
@@ -1564,6 +1575,7 @@
 	sprintf(buf, "%#x", magic);
 	return buf;
 }
+#endif
 
 static void
 printstatfs(tcp, addr)
@@ -1591,7 +1603,11 @@
 		statbuf.f_namelen);
 #else /* !ALPHA */
 	tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%lu, f_bfree=%lu, ",
+#ifndef NETBSD
 		sprintfstype(statbuf.f_type),
+#else
+		statbuf.f_fstypename,
+#endif
 		(unsigned long)statbuf.f_bsize,
 		(unsigned long)statbuf.f_blocks,
 		(unsigned long)statbuf.f_bfree);
@@ -1846,7 +1862,7 @@
 	return 0;
 }
 
-#if defined(SUNOS4) || defined(SVR4)
+#if defined(SUNOS4) || defined(SVR4) || defined(NETBSD)
 int
 sys_fchroot(tcp)
 struct tcb *tcp;
@@ -1856,7 +1872,7 @@
 	}
 	return 0;
 }
-#endif /* SUNOS4 || SVR4 */
+#endif /* SUNOS4 || SVR4 || NETBSD */
 
 int
 sys_link(tcp)
@@ -2188,7 +2204,7 @@
 }
 #endif
 
-#ifdef FREEBSD
+#ifdef ALLBSD
 int
 sys_mkfifo(tcp)
 struct tcb *tcp;
@@ -2199,7 +2215,7 @@
 	}
 	return 0;
 }
-#endif /* FREEBSD */
+#endif /* ALLBSD */
 
 int
 sys_fsync(tcp)
@@ -2254,7 +2270,7 @@
 
 #endif /* LINUX */
 
-#if defined FREEBSD || defined LINUX
+#if defined ALLBSD || defined LINUX
 static const struct xlat direnttypes[] = {
 	{ DT_UNKNOWN,	"DT_UNKNOWN" 	},
 	{ DT_FIFO,	"DT_FIFO" 	},
@@ -2327,15 +2343,16 @@
 				d->d_namlen, d->d_namlen, d->d_name);
 		}
 #endif /* SUNOS4 */
-#ifdef FREEBSD
+#ifdef ALLBSD
 		if (!abbrev(tcp)) {
-			tprintf("%s{d_fileno=%u, d_reclen=%u, d_type=",
-				i ? " " : "", d->d_fileno, d->d_reclen);
+			tprintf("%s{d_fileno=%llu, d_reclen=%u, d_type=",
+				i ? " " : "", (unsigned long long)d->d_fileno,
+				d->d_reclen);
 			printxval(direnttypes, d->d_type, "DT_???");
 			tprintf(", d_namlen=%u, d_name=\"%.*s\"}",
 				d->d_namlen, d->d_namlen, d->d_name);
 		}
-#endif /* FREEBSD */
+#endif /* ALLBSD */
 		if (!d->d_reclen) {
 			tprintf("/* d_reclen == 0, problem here */");
 			break;
@@ -2421,7 +2438,7 @@
 }
 #endif
 
-#ifdef FREEBSD
+#ifdef ALLBSD
 int
 sys_getdirentries(tcp)
 struct tcb * tcp;
@@ -2454,8 +2471,9 @@
 	for (i = 0; i < len;) {
 		struct kernel_dirent *d = (struct kernel_dirent *) &buf[i];
 		if (!abbrev(tcp)) {
-			tprintf("%s{d_fileno=%u, d_reclen=%u, d_type=",
-				i ? " " : "", d->d_fileno, d->d_reclen);
+			tprintf("%s{d_fileno=%llu, d_reclen=%u, d_type=",
+				i ? " " : "", (unsigned long long)d->d_fileno,
+				d->d_reclen);
 			printxval(direnttypes, d->d_type, "DT_???");
 			tprintf(", d_namlen=%u, d_name=\"%.*s\"}",
 				d->d_namlen, d->d_namlen, d->d_name);
@@ -2493,7 +2511,7 @@
 }
 #endif /* LINUX */
 
-#ifdef FREEBSD
+#ifdef ALLBSD
 int
 sys___getcwd(tcp)
 struct tcb *tcp;