FreeBSD uses 64 bit off_t, fix stat&fcntl(flock)
diff --git a/ChangeLog b/ChangeLog
index 725141e..9e99187 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2001-03-07 John Hughes <john@Calva.COM>
+ * desc.c: On FreeBSD flock structure uses 64 bit offsets.
+ * file.c: On FreeBSD use stat64 and pals instead of stat.
+ * freebsd/syscalls.print: use stat64, lstat64 and fstat64.
+ * freebsd/i386/syscall.h: ditto.
+ * freebsd/i386/syscallent.h: ditto.
+
+2001-03-07 John Hughes <john@Calva.COM>
+
* file.c: merge missing part of Harald Böhme's solaris patches,
was only declaring sys_{stat64,lstat64,fstat64} on linux!
diff --git a/desc.c b/desc.c
index e1c43fb..b9d8d35 100644
--- a/desc.c
+++ b/desc.c
@@ -35,6 +35,12 @@
#include <fcntl.h>
#include <sys/file.h>
+#if FREEBSD
+#define flock64 flock /* Horrid hack */
+#define printflock printflock64 /* Horrider hack */
+#endif
+
+
static struct xlat fcntlcmds[] = {
{ F_DUPFD, "F_DUPFD" },
{ F_GETFD, "F_GETFD" },
@@ -172,6 +178,7 @@
{ 0, NULL },
};
+#ifndef FREEBSD
/* fcntl/lockf */
static void
printflock(tcp, addr, getlk)
@@ -195,8 +202,9 @@
else
tprintf("}");
}
+#endif
-#if _LFS64_LARGEFILE
+#if _LFS64_LARGEFILE || FREEBSD
/* fcntl/lockf */
static void
printflock64(tcp, addr, getlk)
diff --git a/file.c b/file.c
index f1c8f3a..ee6bc9e 100644
--- a/file.c
+++ b/file.c
@@ -130,6 +130,9 @@
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/stat.h>
+
+#define stat64 stat
+#define HAVE_STAT64 1 /* Ugly hack */
#endif
#ifdef MAJOR_IN_SYSMACROS
@@ -652,6 +655,7 @@
}
#endif
+#ifndef FREEBSD
static void
realprintstat(tcp, statbuf)
struct tcb *tcp;
@@ -695,17 +699,7 @@
if (!abbrev(tcp)) {
tprintf("st_atime=%s, ", sprinttime(statbuf->st_atime));
tprintf("st_mtime=%s, ", sprinttime(statbuf->st_mtime));
-#ifndef FREEBSD
tprintf("st_ctime=%s}", sprinttime(statbuf->st_ctime));
-#else /* FREEBSD */
- tprintf("st_ctime=%s, ", sprinttime(statbuf->st_ctime));
- tprintf("st_flags=");
- if (statbuf->st_flags) {
- printflags(fileflags, statbuf->st_flags);
- } else
- tprintf("0");
- tprintf(", st_gen=%u}", statbuf->st_gen);
-#endif /* FREEBSD */
}
else
tprintf("...}");
@@ -741,6 +735,7 @@
realprintstat(tcp, &statbuf);
}
+#endif /* !FREEBSD */
#ifdef HAVE_STAT64
static void
@@ -817,7 +812,17 @@
if (!abbrev(tcp)) {
tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
+#ifndef FREEBSD
tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime));
+#else /* FREEBSD */
+ tprintf("st_ctime=%s, ", sprinttime(statbuf.st_ctime));
+ tprintf("st_flags=");
+ if (statbuf.st_flags) {
+ printflags(fileflags, statbuf.st_flags);
+ } else
+ tprintf("0");
+ tprintf(", st_gen=%u}", statbuf.st_gen);
+#endif /* FREEBSD */
}
else
tprintf("...}");
@@ -879,7 +884,7 @@
}
#endif /* linux && !IA64 */
-
+#ifndef FREEBSD
int
sys_stat(tcp)
struct tcb *tcp;
@@ -892,6 +897,7 @@
}
return 0;
}
+#endif
int
sys_stat64(tcp)
@@ -927,6 +933,7 @@
# endif /* !IA64 */
#endif /* linux */
+#ifndef FREEBSD
int
sys_fstat(tcp)
struct tcb *tcp;
@@ -938,6 +945,7 @@
}
return 0;
}
+#endif
int
sys_fstat64(tcp)
@@ -971,6 +979,7 @@
# endif /* !IA64 */
#endif
+#ifndef FREEBSD
int
sys_lstat(tcp)
struct tcb *tcp;
@@ -983,6 +992,7 @@
}
return 0;
}
+#endif
int
sys_lstat64(tcp)
diff --git a/freebsd/i386/syscall.h b/freebsd/i386/syscall.h
index 2d7c50d..c09e5a2 100644
--- a/freebsd/i386/syscall.h
+++ b/freebsd/i386/syscall.h
@@ -1,5 +1,5 @@
/*
- * Automatically generated by ./../syscalls.pl on Wed Mar 7 12:22:58 2001
+ * Automatically generated by ./../syscalls.pl on Wed Mar 7 17:11:33 2001
*/
#define sys_syscall printargs
@@ -39,9 +39,9 @@
int sys_fchflags();
#define sys_sync printargs
int sys_kill();
-int sys_stat();
+int sys_stat64();
#define sys_getppid printargs
-int sys_lstat();
+int sys_lstat64();
int sys_dup();
int sys_pipe();
#define sys_getegid printargs
@@ -63,7 +63,7 @@
int sys_execve();
int sys_umask();
int sys_chroot();
-int sys_fstat();
+int sys_fstat64();
#define sys_getkerninfo printargs
int sys_getpagesize();
int sys_msync();
@@ -161,9 +161,9 @@
#define sys_setgid printargs
#define sys_setegid printargs
#define sys_seteuid printargs
-int sys_stat();
-int sys_fstat();
-int sys_lstat();
+int sys_stat64();
+int sys_fstat64();
+int sys_lstat64();
int sys_pathconf();
int sys_fpathconf();
int sys_getrlimit();
diff --git a/freebsd/i386/syscallent.h b/freebsd/i386/syscallent.h
index f8b1e4e..b45ee36 100644
--- a/freebsd/i386/syscallent.h
+++ b/freebsd/i386/syscallent.h
@@ -1,5 +1,5 @@
/*
- * Automatically generated by ./../syscalls.pl on Wed Mar 7 12:22:58 2001
+ * Automatically generated by ./../syscalls.pl on Wed Mar 7 17:11:33 2001
*/
{ 1, 0, sys_syscall, "syscall" }, /* 0 */
@@ -40,9 +40,9 @@
{ 2, TF, sys_fchflags, "fchflags" }, /* 35 */
{ 1, 0, sys_sync, "sync" }, /* 36 */
{ 2, TS, sys_kill, "kill" }, /* 37 */
- { 2, TF, sys_stat, "stat" }, /* 38 */
+ { 2, TF, sys_stat64, "stat" }, /* 38 */
{ 1, 0, sys_getppid, "getppid" }, /* 39 */
- { 2, TF, sys_lstat, "lstat" }, /* 40 */
+ { 2, TF, sys_lstat64, "lstat" }, /* 40 */
{ 1, 0, sys_dup, "dup" }, /* 41 */
{ 1, 0, sys_pipe, "pipe" }, /* 42 */
{ 1, 0, sys_getegid, "getegid" }, /* 43 */
@@ -64,7 +64,7 @@
{ 3, TF|TP, sys_execve, "execve" }, /* 59 */
{ 1, 0, sys_umask, "umask" }, /* 60 */
{ 1, TF, sys_chroot, "chroot" }, /* 61 */
- { 2, TF, sys_fstat, "fstat" }, /* 62 */
+ { 2, TF, sys_fstat64, "fstat" }, /* 62 */
{ 4, 0, sys_getkerninfo, "getkerninfo" }, /* 63 */
{ 1, 0, sys_getpagesize, "getpagesize" }, /* 64 */
{ 3, 0, sys_msync, "msync" }, /* 65 */
@@ -190,9 +190,9 @@
{ -1, 0, printargs, "SYS_185" }, /* 185 */
{ -1, 0, printargs, "SYS_186" }, /* 186 */
{ -1, 0, printargs, "SYS_187" }, /* 187 */
- { 2, TF, sys_stat, "stat" }, /* 188 */
- { 2, TF, sys_fstat, "fstat" }, /* 189 */
- { 2, TF, sys_lstat, "lstat" }, /* 190 */
+ { 2, TF, sys_stat64, "stat" }, /* 188 */
+ { 2, TF, sys_fstat64, "fstat" }, /* 189 */
+ { 2, TF, sys_lstat64, "lstat" }, /* 190 */
{ 2, TF, sys_pathconf, "pathconf" }, /* 191 */
{ 2, 0, sys_fpathconf, "fpathconf" }, /* 192 */
{ -1, 0, printargs, "SYS_193" }, /* 193 */
diff --git a/freebsd/syscalls.print b/freebsd/syscalls.print
index 3461f43..fe0336d 100644
--- a/freebsd/syscalls.print
+++ b/freebsd/syscalls.print
@@ -64,7 +64,7 @@
flock
fork
fpathconf
-fstat
+fstat sys_fstat64
fstatfs
fsync
ftruncate sys_ftruncate64
@@ -97,7 +97,7 @@
link
listen
lseek sys_lseek64
-lstat
+lstat sys_lstat64
mincore
mkdir
mkfifo
@@ -171,7 +171,7 @@
sigvec
socket
socketpair
-stat
+stat sys_stat64
statfs
stime
symlink