77193ecd35
split functions into more files.
197 lines
4.2 KiB
Text
197 lines
4.2 KiB
Text
$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;
|