Index: lib/libc/Makefile =================================================================== RCS file: /home/ncvs/src/lib/libc/Makefile,v retrieving revision 1.52 diff -u -r1.52 Makefile --- lib/libc/Makefile 14 May 2004 12:04:29 -0000 1.52 +++ lib/libc/Makefile 5 Jul 2004 07:28:41 -0000 @@ -36,6 +36,7 @@ .include "${.CURDIR}/db/Makefile.inc" .include "${.CURDIR}/compat-43/Makefile.inc" +.include "${.CURDIR}/freebsd4/Makefile.inc" .include "${.CURDIR}/gdtoa/Makefile.inc" .include "${.CURDIR}/gen/Makefile.inc" .if ${MACHINE_ARCH} != "powerpc" Index: lib/libc/freebsd4/Makefile.inc =================================================================== RCS file: lib/libc/freebsd4/Makefile.inc diff -N lib/libc/freebsd4/Makefile.inc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lib/libc/freebsd4/Makefile.inc 5 Jul 2004 07:28:41 -0000 @@ -0,0 +1,9 @@ +# $FreeBSD: src/lib/libc/ia64/Makefile.inc,v 1.2 2001/03/05 10:00:57 obrien Exp $ +# +# FreeBSD 4.x/5.x compatability helpers to help avoid libc bumps +# This is a bit of a kludge, and can go away after a while. +# + +.PATH: ${.CURDIR}/freebsd4 + +SRCS+= stat.c lstat.c fstat.c cvtstat44.c Index: lib/libc/freebsd4/cvtstat44.c =================================================================== RCS file: lib/libc/freebsd4/cvtstat44.c diff -N lib/libc/freebsd4/cvtstat44.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lib/libc/freebsd4/cvtstat44.c 5 Jul 2004 07:28:41 -0000 @@ -0,0 +1,37 @@ +#define __LIBC_COMPAT__ +#include +#include +#include +#include +#include "cvtstat44.h" + +/* + * Convert from an old to a new stat structure. + */ +void +cvtstat44(st, ost) + struct stat *st; + struct stat44 *ost; +{ + + memset(ost, 0, sizeof *ost); + ost->st_dev = st->st_dev; + ost->st_ino = st->st_ino; + ost->st_mode = st->st_mode; + if (st->st_nlink > USHRT_MAX) + ost->st_nlink = USHRT_MAX; + else + ost->st_nlink = st->st_nlink; + ost->st_uid = st->st_uid; + ost->st_gid = st->st_gid; + ost->st_rdev = st->st_rdev; + ost->st_atimespec = st->st_atimespec; + ost->st_mtimespec = st->st_mtimespec; + ost->st_ctimespec = st->st_ctimespec; + ost->st_size = st->st_size; + ost->st_blocks = st->st_blocks; + ost->st_blksize = st->st_blksize; + ost->st_flags = st->st_flags; + ost->st_gen = st->st_gen; + ost->st_birthtimespec = st->st_birthtimespec; +} Index: lib/libc/freebsd4/cvtstat44.h =================================================================== RCS file: lib/libc/freebsd4/cvtstat44.h diff -N lib/libc/freebsd4/cvtstat44.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lib/libc/freebsd4/cvtstat44.h 5 Jul 2004 07:28:41 -0000 @@ -0,0 +1 @@ +void cvtstat44(struct stat *st, struct stat44 *ost); Index: lib/libc/freebsd4/fstat.c =================================================================== RCS file: lib/libc/freebsd4/fstat.c diff -N lib/libc/freebsd4/fstat.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lib/libc/freebsd4/fstat.c 5 Jul 2004 07:28:41 -0000 @@ -0,0 +1,17 @@ +#define __LIBC_COMPAT__ +#include +#include +#include "cvtstat44.h" + +int +fstat(int fd, struct stat44 *osb) +{ + int error; + struct stat sb; + + error = __xfstat(__STATVER, fd, &sb); + if (error) + return (error); + cvtstat44(&sb, osb); + return (0); +} Index: lib/libc/freebsd4/lstat.c =================================================================== RCS file: lib/libc/freebsd4/lstat.c diff -N lib/libc/freebsd4/lstat.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lib/libc/freebsd4/lstat.c 5 Jul 2004 07:28:41 -0000 @@ -0,0 +1,17 @@ +#define __LIBC_COMPAT__ +#include +#include +#include "cvtstat44.h" + +int +lstat(const char *path, struct stat44 *osb) +{ + int error; + struct stat sb; + + error = __xlstat(__STATVER, path, &sb); + if (error) + return (error); + cvtstat44(&sb, osb); + return (0); +} Index: lib/libc/freebsd4/stat.c =================================================================== RCS file: lib/libc/freebsd4/stat.c diff -N lib/libc/freebsd4/stat.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lib/libc/freebsd4/stat.c 5 Jul 2004 07:28:41 -0000 @@ -0,0 +1,17 @@ +#define __LIBC_COMPAT__ +#include +#include +#include "cvtstat44.h" + +int +stat(const char *path, struct stat44 *osb) +{ + int error; + struct stat sb; + + error = __xstat(__STATVER, path, &sb); + if (error) + return (error); + cvtstat44(&sb, osb); + return (0); +} Index: lib/libc/string/strmode.c =================================================================== RCS file: /home/ncvs/src/lib/libc/string/strmode.c,v retrieving revision 1.4 diff -u -r1.4 strmode.c --- lib/libc/string/strmode.c 21 Mar 2002 18:44:54 -0000 1.4 +++ lib/libc/string/strmode.c 5 Jul 2004 07:28:41 -0000 @@ -43,7 +43,7 @@ void strmode(mode, p) - mode_t mode; + int mode; /* XXX mode_t */ char *p; { /* print type */ Index: lib/libstand/bzipfs.c =================================================================== RCS file: /home/ncvs/src/lib/libstand/bzipfs.c,v retrieving revision 1.6 diff -u -r1.6 bzipfs.c --- lib/libstand/bzipfs.c 21 Jan 2004 20:12:23 -0000 1.6 +++ lib/libstand/bzipfs.c 5 Jul 2004 07:28:41 -0000 @@ -30,7 +30,6 @@ #include "stand.h" -#include #include #include <_bzlib.h> Index: lib/libstand/gzipfs.c =================================================================== RCS file: /home/ncvs/src/lib/libstand/gzipfs.c,v retrieving revision 1.13 diff -u -r1.13 gzipfs.c --- lib/libstand/gzipfs.c 21 Jan 2004 20:12:23 -0000 1.13 +++ lib/libstand/gzipfs.c 5 Jul 2004 07:28:41 -0000 @@ -29,7 +29,6 @@ #include "stand.h" -#include #include #include Index: lib/libstand/nfs.c =================================================================== RCS file: /home/ncvs/src/lib/libstand/nfs.c,v retrieving revision 1.12 diff -u -r1.12 nfs.c --- lib/libstand/nfs.c 21 Jan 2004 20:12:23 -0000 1.12 +++ lib/libstand/nfs.c 5 Jul 2004 07:28:41 -0000 @@ -34,7 +34,6 @@ #include #include #include -#include #include #include Index: lib/libstand/stand.h =================================================================== RCS file: /home/ncvs/src/lib/libstand/stand.h,v retrieving revision 1.39 diff -u -r1.39 stand.h --- lib/libstand/stand.h 15 Jan 2004 18:35:32 -0000 1.39 +++ lib/libstand/stand.h 5 Jul 2004 07:28:42 -0000 @@ -64,7 +64,6 @@ #include #include -#include #include #include @@ -92,6 +91,7 @@ #define ESALAST (ELAST+8) /* */ struct open_file; +struct stat; /* * This structure is used to define file system operations in a file system @@ -408,3 +408,44 @@ #define free(x) Free(x, NULL, 0) #define realloc(x, y) Realloc(x, y, NULL, 0) #endif + +struct stat { + mode_t st_mode; /* inode protection mode */ + nlink_t st_nlink; /* number of hard links */ + uid_t st_uid; /* user ID of the file's owner */ + gid_t st_gid; /* group ID of the file's group */ + off_t st_size; /* file size, in bytes */ +}; + +#define S_IRWXU 0000700 /* RWX mask for owner */ +#define S_IRUSR 0000400 /* R for owner */ +#define S_IWUSR 0000200 /* W for owner */ +#define S_IXUSR 0000100 /* X for owner */ + +#define S_IRWXG 0000070 /* RWX mask for group */ +#define S_IRGRP 0000040 /* R for group */ +#define S_IWGRP 0000020 /* W for group */ +#define S_IXGRP 0000010 /* X for group */ + +#define S_IRWXO 0000007 /* RWX mask for other */ +#define S_IROTH 0000004 /* R for other */ +#define S_IWOTH 0000002 /* W for other */ +#define S_IXOTH 0000001 /* X for other */ + +#define S_IFMT 0170000 /* type of file mask */ +#define S_IFIFO 0010000 /* named pipe (fifo) */ +#define S_IFCHR 0020000 /* character special */ +#define S_IFDIR 0040000 /* directory */ +#define S_IFBLK 0060000 /* block special */ +#define S_IFREG 0100000 /* regular */ +#define S_IFLNK 0120000 /* symbolic link */ + +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) /* directory */ +#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) /* char special */ +#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) /* block special */ +#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) /* regular file */ +#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) /* fifo or socket */ +#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) /* symbolic link */ + +int fstat(int, struct stat *); +int stat(const char *, struct stat *); Index: lib/libstand/tftp.c =================================================================== RCS file: /home/ncvs/src/lib/libstand/tftp.c,v retrieving revision 1.11 diff -u -r1.11 tftp.c --- lib/libstand/tftp.c 3 Mar 2003 00:58:47 -0000 1.11 +++ lib/libstand/tftp.c 5 Jul 2004 07:28:42 -0000 @@ -46,7 +46,6 @@ */ #include -#include #include #include #include Index: sbin/devfs/rule.c =================================================================== RCS file: /home/ncvs/src/sbin/devfs/rule.c,v retrieving revision 1.5 diff -u -r1.5 rule.c --- sbin/devfs/rule.c 22 Jan 2004 07:23:35 -0000 1.5 +++ sbin/devfs/rule.c 5 Jul 2004 07:28:43 -0000 @@ -403,7 +403,7 @@ errx(1, "expecting argument for mode"); dr->dr_iacts |= DRA_MODE; l = strtol(av[1], &cp, 8); - if (l > (1 << (sizeof(dr->dr_mode) * 8)) - 1 || + if (l > (1LL << (sizeof(dr->dr_mode) * 8)) - 1 || *cp != '\0') errx(1, "invalid mode: %s", av[1]); dr->dr_mode = l; Index: sbin/fsck_ffs/main.c =================================================================== RCS file: /home/ncvs/src/sbin/fsck_ffs/main.c,v retrieving revision 1.41 diff -u -r1.41 main.c --- sbin/fsck_ffs/main.c 9 Apr 2004 19:58:28 -0000 1.41 +++ sbin/fsck_ffs/main.c 5 Jul 2004 07:28:43 -0000 @@ -415,9 +415,9 @@ n_ffree * 100.0 / sblock.fs_dsize); if (debug) { if (files < 0) - printf("%d inodes missing\n", -files); + printf("%jd inodes missing\n", -(intmax_t)files); if (blks < 0) - printf("%lld blocks missing\n", -(long long)blks); + printf("%jd blocks missing\n", -(intmax_t)blks); if (duplist != NULL) { printf("The following duplicate blocks remain:"); for (dp = duplist; dp; dp = dp->next) @@ -427,7 +427,7 @@ if (zlnhead != NULL) { printf("The following zero link count inodes remain:"); for (zlnp = zlnhead; zlnp; zlnp = zlnp->next) - printf(" %u,", zlnp->zlncnt); + printf(" %ju,", (uintmax_t)zlnp->zlncnt); printf("\n"); } } Index: sbin/newfs/mkfs.c =================================================================== RCS file: /home/ncvs/src/sbin/newfs/mkfs.c,v retrieving revision 1.85 diff -u -r1.85 mkfs.c --- sbin/newfs/mkfs.c 9 Apr 2004 19:58:33 -0000 1.85 +++ sbin/newfs/mkfs.c 5 Jul 2004 07:28:43 -0000 @@ -902,7 +902,8 @@ sblock.fs_cstotal.cs_nifree--; fscs[0].cs_nifree--; if (ino >= (unsigned long)sblock.fs_ipg * sblock.fs_ncg) { - printf("fsinit: inode value out of range (%d).\n", ino); + printf("fsinit: inode value out of range (%jd).\n", + (intmax_t)ino); exit(32); } d = fsbtodb(&sblock, ino_to_fsba(&sblock, ino)); Index: sys/boot/common/ls.c =================================================================== RCS file: /home/ncvs/src/sys/boot/common/ls.c,v retrieving revision 1.11 diff -u -r1.11 ls.c --- sys/boot/common/ls.c 25 Aug 2003 23:30:41 -0000 1.11 +++ sys/boot/common/ls.c 5 Jul 2004 07:28:44 -0000 @@ -40,11 +40,12 @@ #include __FBSDID("$FreeBSD: src/sys/boot/common/ls.c,v 1.11 2003/08/25 23:30:41 obrien Exp $"); +#include + #include #include #include -#include #include #include "bootstrap.h" Index: sys/boot/ficl/fileaccess.c =================================================================== RCS file: /home/ncvs/src/sys/boot/ficl/fileaccess.c,v retrieving revision 1.1 diff -u -r1.1 fileaccess.c --- sys/boot/ficl/fileaccess.c 9 Apr 2002 17:45:11 -0000 1.1 +++ sys/boot/ficl/fileaccess.c 5 Jul 2004 07:28:44 -0000 @@ -1,11 +1,14 @@ /* $FreeBSD: src/sys/boot/ficl/fileaccess.c,v 1.1 2002/04/09 17:45:11 dcs Exp $ */ -#include +#include +#ifdef TESTMAIN #include +#include #include -#include #include -#include +#else +#include +#endif #include "ficl.h" #if FICL_WANT_FILE Index: sys/boot/ficl/testmain.c =================================================================== RCS file: /home/ncvs/src/sys/boot/ficl/testmain.c,v retrieving revision 1.8 diff -u -r1.8 testmain.c --- sys/boot/ficl/testmain.c 9 Apr 2002 17:45:11 -0000 1.8 +++ sys/boot/ficl/testmain.c 5 Jul 2004 07:28:44 -0000 @@ -40,11 +40,14 @@ /* $FreeBSD: src/sys/boot/ficl/testmain.c,v 1.8 2002/04/09 17:45:11 dcs Exp $ */ #include +#ifdef TESTMAIN #include +#else +#include +#endif #include #include #include -#include #include #include "ficl.h" Index: sys/compat/freebsd32/freebsd32_misc.c =================================================================== RCS file: /home/ncvs/src/sys/compat/freebsd32/freebsd32_misc.c,v retrieving revision 1.23 diff -u -r1.23 freebsd32_misc.c --- sys/compat/freebsd32/freebsd32_misc.c 17 Jun 2004 17:16:41 -0000 1.23 +++ sys/compat/freebsd32/freebsd32_misc.c 5 Jul 2004 07:28:44 -0000 @@ -124,6 +124,8 @@ static void copy_statfs(struct statfs *in, struct statfs32 *out) { + + bzero(out, sizeof(*out)); CP(*in, *out, f_bsize); CP(*in, *out, f_iosize); CP(*in, *out, f_blocks); @@ -1082,32 +1084,169 @@ return (sendfile(td, &ap)); } + +struct stat44_32 { + udev_t st_dev; + u_int32_t st_ino; + u_int16_t st_mode; + u_int16_t st_nlink; + uid_t st_uid; + gid_t st_gid; + udev_t st_rdev; + struct timespec32 st_atimespec; + struct timespec32 st_mtimespec; + struct timespec32 st_ctimespec; + off_t st_size; + int64_t st_blocks; + u_int32_t st_blksize; + u_int32_t st_flags; + u_int32_t st_gen; + struct timespec32 st_birthtimespec; +}; + +static void +copy_stat44(struct stat *in, struct stat44_32 *out) +{ + + bzero(out, sizeof(*out)); + CP(*in, *out, st_dev); + CP(*in, *out, st_ino); + CP(*in, *out, st_mode); + CP(*in, *out, st_nlink); + CP(*in, *out, st_uid); + CP(*in, *out, st_gid); + CP(*in, *out, st_rdev); + TS_CP(*in, *out, st_atimespec); + TS_CP(*in, *out, st_mtimespec); + TS_CP(*in, *out, st_ctimespec); + TS_CP(*in, *out, st_birthtimespec); + CP(*in, *out, st_size); + CP(*in, *out, st_blocks); + CP(*in, *out, st_blksize); + CP(*in, *out, st_flags); + CP(*in, *out, st_gen); + TS_CP(*in, *out, st_birthtimespec); +} + +int +freebsd32_stat44(struct thread *td, struct freebsd32_stat44_args *uap) +{ + int error; + caddr_t sg; + struct stat44_32 *p32, s32; + struct stat *p = NULL, s; + struct __xstat_args ap; + + p32 = SCARG(uap, ub); + if (p32) { + sg = stackgap_init(); + p = stackgap_alloc(&sg, sizeof(struct stat)); + } + ap.ver = __STATVER; + ap.path = uap->path; + ap.ub = p; + error = __xstat(td, &ap); + if (error) + return (error); + if (p32) { + error = copyin(p, &s, sizeof(s)); + if (error) + return (error); + copy_stat44(&s, &s32); + error = copyout(&s32, p32, sizeof(s32)); + } + return (error); +} + +int +freebsd32_fstat44(struct thread *td, struct freebsd32_fstat44_args *uap) +{ + int error; + caddr_t sg; + struct stat44_32 *p32, s32; + struct stat *p = NULL, s; + struct __xfstat_args ap; + + p32 = SCARG(uap, ub); + if (p32) { + sg = stackgap_init(); + p = stackgap_alloc(&sg, sizeof(struct stat)); + } + ap.ver = __STATVER; + ap.fd = uap->fd; + ap.sb = p; + error = __xfstat(td, &ap); + if (error) + return (error); + if (p32) { + error = copyin(p, &s, sizeof(s)); + if (error) + return (error); + copy_stat44(&s, &s32); + error = copyout(&s32, p32, sizeof(s32)); + } + return (error); +} + +int +freebsd32_lstat44(struct thread *td, struct freebsd32_lstat44_args *uap) +{ + int error; + caddr_t sg; + struct stat44_32 *p32, s32; + struct stat *p = NULL, s; + struct __xlstat_args ap; + + p32 = SCARG(uap, ub); + if (p32) { + sg = stackgap_init(); + p = stackgap_alloc(&sg, sizeof(struct stat)); + } + ap.ver = __STATVER; + ap.path = uap->path; + ap.ub = p; + error = __xlstat(td, &ap); + if (error) + return (error); + if (p32) { + error = copyin(p, &s, sizeof(s)); + if (error) + return (error); + copy_stat44(&s, &s32); + error = copyout(&s32, p32, sizeof(s32)); + } + return (error); +} + struct stat32 { dev_t st_dev; + u_int32_t __pad0; ino_t st_ino; mode_t st_mode; nlink_t st_nlink; uid_t st_uid; gid_t st_gid; dev_t st_rdev; + u_int32_t __pad1; struct timespec32 st_atimespec; struct timespec32 st_mtimespec; struct timespec32 st_ctimespec; + struct timespec32 st_birthtimespec; off_t st_size; int64_t st_blocks; u_int32_t st_blksize; u_int32_t st_flags; u_int32_t st_gen; - struct timespec32 st_birthtimespec; - unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32)); - unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec32)); + u_int32_t __pad2; + u_int64_t __pad3; + u_int64_t __pad4; }; CTASSERT(sizeof(struct stat32) == 96); static void -copy_stat( struct stat *in, struct stat32 *out) +copy_stat(struct stat *in, struct stat32 *out) { CP(*in, *out, st_dev); CP(*in, *out, st_ino); @@ -1119,6 +1258,7 @@ TS_CP(*in, *out, st_atimespec); TS_CP(*in, *out, st_mtimespec); TS_CP(*in, *out, st_ctimespec); + TS_CP(*in, *out, st_birthtimespec); CP(*in, *out, st_size); CP(*in, *out, st_blocks); CP(*in, *out, st_blksize); @@ -1133,7 +1273,9 @@ struct stat32 sb32; int error; struct nameidata nd; - + + if (uap->ver != __STATVER) + return (EOPNOTSUPP); #ifdef LOOKUP_SHARED NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | NOOBJ, UIO_USERSPACE, uap->path, td); @@ -1160,7 +1302,9 @@ struct stat ub; struct stat32 ub32; int error; - + + if (uap->ver != __STATVER) + return (EOPNOTSUPP); if ((error = fget(td, uap->fd, &fp)) != 0) return (error); mtx_lock(&Giant); @@ -1182,7 +1326,9 @@ struct stat sb; struct stat32 sb32; struct nameidata nd; - + + if (uap->ver != __STATVER) + return (EOPNOTSUPP); NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF | NOOBJ, UIO_USERSPACE, uap->path, td); if ((error = namei(&nd)) != 0) Index: sys/compat/freebsd32/syscalls.master =================================================================== RCS file: /home/ncvs/src/sys/compat/freebsd32/syscalls.master,v retrieving revision 1.38 diff -u -r1.38 syscalls.master --- sys/compat/freebsd32/syscalls.master 2 Jul 2004 00:35:52 -0000 1.38 +++ sys/compat/freebsd32/syscalls.master 5 Jul 2004 07:28:44 -0000 @@ -274,9 +274,9 @@ 185 UNIMPL lfs_markv 186 UNIMPL lfs_segclean 187 UNIMPL lfs_segwait -188 STD { int freebsd32_stat(char *path, struct stat32 *ub); } -189 MSTD { int freebsd32_fstat(int fd, struct stat32 *ub); } -190 STD { int freebsd32_lstat(char *path, struct stat32 *ub); } +188 STD { int freebsd32_stat44(char *path, struct stat44_32 *ub); } +189 STD { int freebsd32_fstat44(int fd, struct stat44_32 *ub); } +190 STD { int freebsd32_lstat44(char *path, struct stat44_32 *ub); } 191 NOPROTO { int pathconf(char *path, int name); } 192 MNOPROTO { int fpathconf(int fd, int name); } 193 UNIMPL nosys @@ -609,3 +609,6 @@ 441 UNIMPL ksem_timedwait 442 MNOPROTO { int thr_suspend(const struct timespec *timeout); } 443 MNOPROTO { int thr_wake(long id); } +444 STD { int freebsd32_stat(int ver, char *path, struct stat32 *ub); } +445 STD { int freebsd32_fstat(int ver, int fd, struct stat32 *ub); } +446 STD { int freebsd32_lstat(int ver, char *path, struct stat32 *ub); } Index: sys/isofs/cd9660/cd9660_vnops.c =================================================================== RCS file: /home/ncvs/src/sys/isofs/cd9660/cd9660_vnops.c,v retrieving revision 1.98 diff -u -r1.98 cd9660_vnops.c --- sys/isofs/cd9660/cd9660_vnops.c 7 Apr 2004 20:46:09 -0000 1.98 +++ sys/isofs/cd9660/cd9660_vnops.c 5 Jul 2004 07:28:45 -0000 @@ -438,6 +438,7 @@ struct iso_directory_record *ep; int entryoffsetinblock; doff_t endsearch; + ino_t ino; u_long bmask; int error = 0; int reclen; @@ -540,7 +541,8 @@ switch (imp->iso_ftype) { case ISO_FTYPE_RRIP: cd9660_rrip_getname(ep,idp->current.d_name, &namelen, - &idp->current.d_fileno,imp); + &ino, imp); + idp->current.d_fileno = ino; idp->current.d_namlen = (u_char)namelen; if (idp->current.d_namlen) error = iso_uiodir(idp,&idp->current,idp->curroff); Index: sys/kern/init_sysent.c =================================================================== RCS file: /home/ncvs/src/sys/kern/init_sysent.c,v retrieving revision 1.173 diff -u -r1.173 init_sysent.c --- sys/kern/init_sysent.c 2 Jul 2004 00:38:55 -0000 1.173 +++ sys/kern/init_sysent.c 5 Jul 2004 07:28:45 -0000 @@ -2,7 +2,7 @@ * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/kern/init_sysent.c,v 1.173 2004/07/02 00:38:55 marcel Exp $ + * $FreeBSD$ * created from FreeBSD: src/sys/kern/syscalls.master,v 1.174 2004/07/02 00:35:52 marcel Exp */ @@ -216,9 +216,9 @@ { 0, (sy_call_t *)nosys }, /* 185 = lfs_markv */ { 0, (sy_call_t *)nosys }, /* 186 = lfs_segclean */ { 0, (sy_call_t *)nosys }, /* 187 = lfs_segwait */ - { AS(stat_args), (sy_call_t *)stat }, /* 188 = stat */ - { SYF_MPSAFE | AS(fstat_args), (sy_call_t *)fstat }, /* 189 = fstat */ - { AS(lstat_args), (sy_call_t *)lstat }, /* 190 = lstat */ + { compat4(AS(freebsd4_stat44_args),stat44) }, /* 188 = old stat44 */ + { compat4(SYF_MPSAFE | AS(freebsd4_fstat44_args),fstat44) }, /* 189 = old fstat44 */ + { compat4(AS(freebsd4_lstat44_args),lstat44) }, /* 190 = old lstat44 */ { AS(pathconf_args), (sy_call_t *)pathconf }, /* 191 = pathconf */ { SYF_MPSAFE | AS(fpathconf_args), (sy_call_t *)fpathconf }, /* 192 = fpathconf */ { 0, (sy_call_t *)nosys }, /* 193 = nosys */ @@ -472,4 +472,7 @@ { SYF_MPSAFE | AS(ksem_timedwait_args), (sy_call_t *)lkmressys }, /* 441 = ksem_timedwait */ { SYF_MPSAFE | AS(thr_suspend_args), (sy_call_t *)thr_suspend }, /* 442 = thr_suspend */ { SYF_MPSAFE | AS(thr_wake_args), (sy_call_t *)thr_wake }, /* 443 = thr_wake */ + { AS(__xstat_args), (sy_call_t *)__xstat }, /* 444 = __xstat */ + { SYF_MPSAFE | AS(__xfstat_args), (sy_call_t *)__xfstat }, /* 445 = __xfstat */ + { AS(__xlstat_args), (sy_call_t *)__xlstat }, /* 446 = __xlstat */ }; Index: sys/kern/kern_descrip.c =================================================================== RCS file: /home/ncvs/src/sys/kern/kern_descrip.c,v retrieving revision 1.235 diff -u -r1.235 kern_descrip.c --- sys/kern/kern_descrip.c 19 Jun 2004 11:40:08 -0000 1.235 +++ sys/kern/kern_descrip.c 5 Jul 2004 07:28:45 -0000 @@ -985,7 +985,7 @@ #ifndef _SYS_SYSPROTO_H_ struct ofstat_args { int fd; - struct ostat *sb; + struct stat43 *sb; }; #endif /* @@ -999,7 +999,7 @@ { struct file *fp; struct stat ub; - struct ostat oub; + struct stat43 oub; int error; if ((error = fget(td, uap->fd, &fp)) != 0) @@ -1008,7 +1008,7 @@ error = fo_stat(fp, &ub, td->td_ucred, td); mtx_unlock(&Giant); if (error == 0) { - cvtstat(&ub, &oub); + cvtstat43(&ub, &oub); error = copyout(&oub, uap->sb, sizeof(oub)); } fdrop(fp, td); @@ -1017,11 +1017,46 @@ } #endif /* COMPAT_43 */ +#ifdef COMPAT_FREEBSD4 +/* + * Return status information about a file descriptor. + */ +/* + * MPSAFE + */ +/* ARGSUSED */ +int +freebsd4_fstat44(td, uap) + struct thread *td; + register struct freebsd4_fstat44_args *uap; +{ + struct file *fp; + struct stat ub; + struct stat44 oub; + int error; + + mtx_lock(&Giant); + if ((error = fget(td, uap->fd, &fp)) != 0) + goto done2; + error = fo_stat(fp, &ub, td->td_ucred, td); + if (error == 0) { + cvtstat44(&ub, &oub); + error = copyout(&oub, uap->sb, sizeof (oub)); + } + fdrop(fp, td); +done2: + mtx_unlock(&Giant); + return (error); +} +#endif /* COMPAT_FREEBSD4 */ + + /* * Return status information about a file descriptor. */ #ifndef _SYS_SYSPROTO_H_ -struct fstat_args { +struct __xfstat_args { + int ver; int fd; struct stat *sb; }; @@ -1031,14 +1066,16 @@ */ /* ARGSUSED */ int -fstat(td, uap) +__xfstat(td, uap) struct thread *td; - struct fstat_args *uap; + struct __xfstat_args *uap; { struct file *fp; struct stat ub; int error; + if (uap->ver != __STATVER) + return (EOPNOTSUPP); if ((error = fget(td, uap->fd, &fp)) != 0) goto done2; mtx_lock(&Giant); Index: sys/kern/syscalls.c =================================================================== RCS file: /home/ncvs/src/sys/kern/syscalls.c,v retrieving revision 1.159 diff -u -r1.159 syscalls.c --- sys/kern/syscalls.c 2 Jul 2004 00:38:55 -0000 1.159 +++ sys/kern/syscalls.c 5 Jul 2004 07:28:45 -0000 @@ -2,7 +2,7 @@ * System call names. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/kern/syscalls.c,v 1.159 2004/07/02 00:38:55 marcel Exp $ + * $FreeBSD$ * created from FreeBSD: src/sys/kern/syscalls.master,v 1.174 2004/07/02 00:35:52 marcel Exp */ @@ -195,9 +195,9 @@ "#185", /* 185 = lfs_markv */ "#186", /* 186 = lfs_segclean */ "#187", /* 187 = lfs_segwait */ - "stat", /* 188 = stat */ - "fstat", /* 189 = fstat */ - "lstat", /* 190 = lstat */ + "old.stat44", /* 188 = old stat44 */ + "old.fstat44", /* 189 = old fstat44 */ + "old.lstat44", /* 190 = old lstat44 */ "pathconf", /* 191 = pathconf */ "fpathconf", /* 192 = fpathconf */ "#193", /* 193 = nosys */ @@ -451,4 +451,7 @@ "ksem_timedwait", /* 441 = ksem_timedwait */ "thr_suspend", /* 442 = thr_suspend */ "thr_wake", /* 443 = thr_wake */ + "__xstat", /* 444 = __xstat */ + "__xfstat", /* 445 = __xfstat */ + "__xlstat", /* 446 = __xlstat */ }; Index: sys/kern/syscalls.master =================================================================== RCS file: /home/ncvs/src/sys/kern/syscalls.master,v retrieving revision 1.174 diff -u -r1.174 syscalls.master --- sys/kern/syscalls.master 2 Jul 2004 00:35:52 -0000 1.174 +++ sys/kern/syscalls.master 5 Jul 2004 07:28:45 -0000 @@ -286,9 +286,9 @@ 185 UNIMPL lfs_markv 186 UNIMPL lfs_segclean 187 UNIMPL lfs_segwait -188 STD { int stat(char *path, struct stat *ub); } -189 MSTD { int fstat(int fd, struct stat *sb); } -190 STD { int lstat(char *path, struct stat *ub); } +188 COMPAT4 { int stat44(char *path, struct stat44 *ub); } +189 MCOMPAT4 { int fstat44(int fd, struct stat44 *sb); } +190 COMPAT4 { int lstat44(char *path, struct stat44 *ub); } 191 STD { int pathconf(char *path, int name); } 192 MSTD { int fpathconf(int fd, int name); } 193 UNIMPL nosys @@ -631,5 +631,8 @@ 441 MNOSTD { int ksem_timedwait(semid_t id, struct timespec *abstime); } 442 MSTD { int thr_suspend(const struct timespec *timeout); } 443 MSTD { int thr_wake(long id); } +444 STD { int __xstat(int ver, char *path, struct stat *ub); } +445 MSTD { int __xfstat(int ver, int fd, struct stat *sb); } +446 STD { int __xlstat(int ver, char *path, struct stat *ub); } ; Please copy any additions and changes to the following compatability tables: ; sys/compat/freebsd32/syscalls.master Index: sys/kern/vfs_syscalls.c =================================================================== RCS file: /home/ncvs/src/sys/kern/vfs_syscalls.c,v retrieving revision 1.354 diff -u -r1.354 vfs_syscalls.c --- sys/kern/vfs_syscalls.c 24 Jun 2004 17:22:29 -0000 1.354 +++ sys/kern/vfs_syscalls.c 5 Jul 2004 07:28:45 -0000 @@ -1905,7 +1905,7 @@ #ifndef _SYS_SYSPROTO_H_ struct ostat_args { char *path; - struct ostat *ub; + struct stat43 *ub; }; #endif int @@ -1913,11 +1913,11 @@ struct thread *td; register struct ostat_args /* { char *path; - struct ostat *ub; + struct stat43 *ub; } */ *uap; { struct stat sb; - struct ostat osb; + struct stat43 osb; int error; struct nameidata nd; @@ -1930,7 +1930,7 @@ vput(nd.ni_vp); if (error) return (error); - cvtstat(&sb, &osb); + cvtstat43(&sb, &osb); error = copyout(&osb, uap->ub, sizeof (osb)); return (error); } @@ -1941,7 +1941,7 @@ #ifndef _SYS_SYSPROTO_H_ struct olstat_args { char *path; - struct ostat *ub; + struct stat43 *ub; }; #endif int @@ -1949,12 +1949,12 @@ struct thread *td; register struct olstat_args /* { char *path; - struct ostat *ub; + struct stat43 *ub; } */ *uap; { struct vnode *vp; struct stat sb; - struct ostat osb; + struct stat43 osb; int error; struct nameidata nd; @@ -1968,7 +1968,7 @@ vput(vp); if (error) return (error); - cvtstat(&sb, &osb); + cvtstat43(&sb, &osb); error = copyout(&osb, uap->ub, sizeof (osb)); return (error); } @@ -1977,9 +1977,9 @@ * Convert from an old to a new stat structure. */ void -cvtstat(st, ost) +cvtstat43(st, ost) struct stat *st; - struct ostat *ost; + struct stat43 *ost; { ost->st_dev = st->st_dev; @@ -2003,19 +2003,111 @@ } #endif /* COMPAT_43 */ +#ifdef COMPAT_FREEBSD4 +/* + * Get file status; this version follows links. + */ +/* ARGSUSED */ +int +freebsd4_stat44(td, uap) + struct thread *td; + register struct freebsd4_stat44_args *uap; +{ + struct stat sb; + struct stat44 osb; + int error; + struct nameidata nd; + + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | NOOBJ, UIO_USERSPACE, + uap->path, td); + if ((error = namei(&nd)) != 0) + return (error); + NDFREE(&nd, NDF_ONLY_PNBUF); + error = vn_stat(nd.ni_vp, &sb, td->td_ucred, NOCRED, td); + vput(nd.ni_vp); + if (error) + return (error); + cvtstat44(&sb, &osb); + error = copyout(&osb, uap->ub, sizeof (osb)); + return (error); +} + +/* + * Get file status; this version does not follow links. + */ +/* ARGSUSED */ +int +freebsd4_lstat44(td, uap) + struct thread *td; + register struct freebsd4_lstat44_args *uap; +{ + struct vnode *vp; + struct stat sb; + struct stat44 osb; + int error; + struct nameidata nd; + + NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF | NOOBJ, UIO_USERSPACE, + uap->path, td); + if ((error = namei(&nd)) != 0) + return (error); + vp = nd.ni_vp; + error = vn_stat(vp, &sb, td->td_ucred, NOCRED, td); + NDFREE(&nd, NDF_ONLY_PNBUF); + vput(vp); + if (error) + return (error); + cvtstat44(&sb, &osb); + error = copyout(&osb, uap->ub, sizeof (osb)); + return (error); +} + +/* + * Convert from an old to a new stat structure. + */ +void +cvtstat44(st, ost) + struct stat *st; + struct stat44 *ost; +{ + + bzero(ost, sizeof *ost); + ost->st_dev = st->st_dev; + ost->st_ino = st->st_ino; + ost->st_mode = st->st_mode; + if (st->st_nlink > USHRT_MAX) + ost->st_nlink = USHRT_MAX; + else + ost->st_nlink = st->st_nlink; + ost->st_uid = st->st_uid; + ost->st_gid = st->st_gid; + ost->st_rdev = st->st_rdev; + ost->st_atimespec = st->st_atimespec; + ost->st_mtimespec = st->st_mtimespec; + ost->st_ctimespec = st->st_ctimespec; + ost->st_size = st->st_size; + ost->st_blocks = st->st_blocks; + ost->st_blksize = st->st_blksize; + ost->st_flags = st->st_flags; + ost->st_gen = st->st_gen; + ost->st_birthtimespec = st->st_birthtimespec; +} +#endif + /* * Get file status; this version follows links. */ #ifndef _SYS_SYSPROTO_H_ -struct stat_args { +struct __xstat_args { + int ver; char *path; struct stat *ub; }; #endif int -stat(td, uap) +__xstat(td, uap) struct thread *td; - register struct stat_args /* { + register struct __xstat_args /* { char *path; struct stat *ub; } */ *uap; @@ -2024,6 +2116,8 @@ int error; struct nameidata nd; + if (uap->ver != __STATVER) + return (EOPNOTSUPP); #ifdef LOOKUP_SHARED NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | NOOBJ, UIO_USERSPACE, uap->path, td); @@ -2046,15 +2140,16 @@ * Get file status; this version does not follow links. */ #ifndef _SYS_SYSPROTO_H_ -struct lstat_args { +struct __xlstat_args { + int ver; char *path; struct stat *ub; }; #endif int -lstat(td, uap) +__xlstat(td, uap) struct thread *td; - register struct lstat_args /* { + register struct __xlstat_args /* { char *path; struct stat *ub; } */ *uap; @@ -2064,6 +2159,8 @@ struct stat sb; struct nameidata nd; + if (uap->ver != __STATVER) + return (EOPNOTSUPP); NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF | NOOBJ, UIO_USERSPACE, uap->path, td); if ((error = namei(&nd)) != 0) @@ -2080,10 +2177,6 @@ /* * Implementation of the NetBSD stat() function. - * XXX This should probably be collapsed with the FreeBSD version, - * as the differences are only due to vn_stat() clearing spares at - * the end of the structures. vn_stat could be split to avoid this, - * and thus collapse the following to close to zero code. */ void cvtnstat(sb, nsb) @@ -2106,7 +2199,6 @@ nsb->st_blksize = sb->st_blksize; nsb->st_flags = sb->st_flags; nsb->st_gen = sb->st_gen; - nsb->st_birthtimespec = sb->st_birthtimespec; } #ifndef _SYS_SYSPROTO_H_ Index: sys/nfsclient/nfs_subs.c =================================================================== RCS file: /home/ncvs/src/sys/nfsclient/nfs_subs.c,v retrieving revision 1.130 diff -u -r1.130 nfs_subs.c --- sys/nfsclient/nfs_subs.c 4 Jul 2004 08:52:34 -0000 1.130 +++ sys/nfsclient/nfs_subs.c 5 Jul 2004 07:28:46 -0000 @@ -566,8 +566,7 @@ vap->va_size = fxdr_hyper(&fp->fa3_size); vap->va_blocksize = NFS_FABLKSIZE; vap->va_bytes = fxdr_hyper(&fp->fa3_used); - vap->va_fileid = fxdr_unsigned(int32_t, - fp->fa3_fileid.nfsuquad[1]); + vap->va_fileid = fxdr_hyper(&fp->fa3_fileid); fxdr_nfsv3time(&fp->fa3_atime, &vap->va_atime); fxdr_nfsv3time(&fp->fa3_ctime, &vap->va_ctime); vap->va_flags = 0; Index: sys/nfsserver/nfs_srvsubs.c =================================================================== RCS file: /home/ncvs/src/sys/nfsserver/nfs_srvsubs.c,v retrieving revision 1.129 diff -u -r1.129 nfs_srvsubs.c --- sys/nfsserver/nfs_srvsubs.c 31 May 2004 20:21:06 -0000 1.129 +++ sys/nfsserver/nfs_srvsubs.c 5 Jul 2004 07:28:46 -0000 @@ -1021,8 +1021,7 @@ fp->fa3_rdev.specdata2 = txdr_unsigned(uminor(vap->va_rdev)); fp->fa3_fsid.nfsuquad[0] = 0; fp->fa3_fsid.nfsuquad[1] = txdr_unsigned(vap->va_fsid); - fp->fa3_fileid.nfsuquad[0] = 0; - fp->fa3_fileid.nfsuquad[1] = txdr_unsigned(vap->va_fileid); + fp->fa3_fileid = txdr_hyper(vap->va_fileid); txdr_nfsv3time(&vap->va_atime, &fp->fa3_atime); txdr_nfsv3time(&vap->va_mtime, &fp->fa3_mtime); txdr_nfsv3time(&vap->va_ctime, &fp->fa3_ctime); Index: sys/sys/_types.h =================================================================== RCS file: /home/ncvs/src/sys/sys/_types.h,v retrieving revision 1.19 diff -u -r1.19 _types.h --- sys/sys/_types.h 19 Jun 2004 17:58:32 -0000 1.19 +++ sys/sys/_types.h 5 Jul 2004 07:28:46 -0000 @@ -41,12 +41,12 @@ typedef __uint64_t __fsfilcnt_t; typedef __uint32_t __gid_t; typedef __int64_t __id_t; /* can hold a gid_t, pid_t, or uid_t */ -typedef __uint32_t __ino_t; /* inode number */ +typedef __uint64_t __ino_t; /* inode number */ typedef long __key_t; /* IPC key (for Sys V IPC) */ typedef __int32_t __lwpid_t; /* Thread ID (a.k.a. LWP) */ -typedef __uint16_t __mode_t; /* permissions */ +typedef __uint32_t __mode_t; /* permissions */ typedef int __nl_item; -typedef __uint16_t __nlink_t; /* link count */ +typedef __uint32_t __nlink_t; /* link count */ typedef __int64_t __off_t; /* file offset */ typedef __int32_t __pid_t; /* process [group] */ typedef __int64_t __rlim_t; /* resource limit (XXX not unsigned) */ Index: sys/sys/cdefs.h =================================================================== RCS file: /home/ncvs/src/sys/sys/cdefs.h,v retrieving revision 1.81 diff -u -r1.81 cdefs.h --- sys/sys/cdefs.h 7 Apr 2004 04:19:49 -0000 1.81 +++ sys/sys/cdefs.h 5 Jul 2004 07:28:46 -0000 @@ -178,6 +178,20 @@ #define __LONG_LONG_SUPPORTED #endif +#ifdef _KERNEL +#define __RENAME(x) no renaming in kernel, get it right +#else +#if __GNUC__ +#define __RENAME(x) __asm__(__STRING(x)) +#else +#ifdef lint +#define __RENAME(x) __symbolrename(x) +#else +#error "No function renaming possible" +#endif /* lint */ +#endif /* __GNUC__ */ +#endif /* _KERNEL */ + /* * GCC 2.95 provides `__restrict' as an extension to C90 to support the * C99-specific `restrict' type qualifier. We happen to use `__restrict' as Index: sys/sys/stat.h =================================================================== RCS file: /home/ncvs/src/sys/sys/stat.h,v retrieving revision 1.40 diff -u -r1.40 stat.h --- sys/sys/stat.h 17 Jun 2004 17:16:52 -0000 1.40 +++ sys/sys/stat.h 5 Jul 2004 07:28:46 -0000 @@ -100,12 +100,13 @@ #include #endif -#if __BSD_VISIBLE -struct ostat { +#ifdef _KERNEL +/* 4.3BSD, FreeBSD-1.x */ +struct stat43 { __uint16_t st_dev; /* inode's device */ - ino_t st_ino; /* inode's number */ - mode_t st_mode; /* inode protection mode */ - nlink_t st_nlink; /* number of hard links */ + __uint32_t st_ino; /* inode's number */ + __uint16_t st_mode; /* inode protection mode */ + __uint16_t st_nlink; /* number of hard links */ __uint16_t st_uid; /* user ID of the file's owner */ __uint16_t st_gid; /* group ID of the file's group */ __uint16_t st_rdev; /* device type */ @@ -120,33 +121,25 @@ }; #endif /* __BSD_VISIBLE */ -struct stat { - __dev_t st_dev; /* inode's device */ - ino_t st_ino; /* inode's number */ - mode_t st_mode; /* inode protection mode */ - nlink_t st_nlink; /* number of hard links */ +#if defined(_KERNEL) || defined(__LIBC_COMPAT__) +/* 4.4BSD, FreeBSD-2.x through 4.x */ +struct stat44 { + __dev_t st_dev; /* inode's device */ + __uint32_t st_ino; /* inode's number */ + __uint16_t st_mode; /* inode protection mode */ + __uint16_t st_nlink; /* number of hard links */ uid_t st_uid; /* user ID of the file's owner */ gid_t st_gid; /* group ID of the file's group */ - __dev_t st_rdev; /* device type */ -#if __BSD_VISIBLE + __dev_t st_rdev; /* device type */ struct timespec st_atimespec; /* time of last access */ struct timespec st_mtimespec; /* time of last data modification */ struct timespec st_ctimespec; /* time of last file status change */ -#else - time_t st_atime; /* time of last access */ - long st_atimensec; /* nsec of last access */ - time_t st_mtime; /* time of last data modification */ - long st_mtimensec; /* nsec of last data modification */ - time_t st_ctime; /* time of last file status change */ - long st_ctimensec; /* nsec of last file status change */ -#endif off_t st_size; /* file size, in bytes */ __int64_t st_blocks; /* blocks allocated for file */ __uint32_t st_blksize; /* optimal blocksize for I/O */ fflags_t st_flags; /* user defined flags for file */ __uint32_t st_gen; /* file generation number */ __int32_t st_lspare; -#if __BSD_VISIBLE struct timespec st_birthtimespec; /* time of file creation */ /* * Explicitly pad st_birthtimespec to 16 bytes so that the size of @@ -156,20 +149,51 @@ * to cover up to 64 bits on 32-bit machines. We assume that * CHAR_BIT is 8... */ - unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec)); - unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec)); + int :(8 / 2) * (16 - (int)sizeof(struct timespec)); + int :(8 / 2) * (16 - (int)sizeof(struct timespec)); +}; +#endif + +struct stat { + __dev_t st_dev; /* inode's device */ + __dev_t st_rdev; /* device type */ + mode_t st_mode; /* inode protection mode */ + nlink_t st_nlink; /* number of hard links */ + uid_t st_uid; /* user ID of the file's owner */ + gid_t st_gid; /* group ID of the file's group */ + ino_t st_ino; /* inode's number */ +#ifndef _POSIX_SOURCE + struct timespec st_atimespec; /* time of last access */ + struct timespec st_mtimespec; /* time of last data modification */ + struct timespec st_ctimespec; /* time of last file status change */ + struct timespec st_birthtimespec; /* time of file creation */ #else + time_t st_atime; /* time of last access */ + long st_atimensec; /* nsec of last access */ + time_t st_mtime; /* time of last data modification */ + long st_mtimensec; /* nsec of last data modification */ + time_t st_ctime; /* time of last file status change */ + long st_ctimensec; /* nsec of last file status change */ time_t st_birthtime; /* time of file creation */ long st_birthtimensec; /* nsec of file creation */ unsigned int :(8 / 2) * (16 - (int)sizeof(struct __timespec)); unsigned int :(8 / 2) * (16 - (int)sizeof(struct __timespec)); #endif + off_t st_size; /* file size, in bytes */ + int64_t st_blocks; /* blocks allocated for file */ + u_int32_t st_blksize; /* optimal blocksize for I/O */ + fflags_t st_flags; /* user defined flags for file */ + u_int32_t st_gen; /* file generation number */ + int32_t __pad2; /* pad to 64 bit alignment */ + int64_t __pad3; /* spare */ + int64_t __pad4; /* spare */ }; +#define __STATVER 50 /* FreeBSD 5.0 */ #if __BSD_VISIBLE struct nstat { __dev_t st_dev; /* inode's device */ - ino_t st_ino; /* inode's number */ + __uint32_t st_ino; /* inode's number */ __uint32_t st_mode; /* inode protection mode */ __uint32_t st_nlink; /* number of hard links */ uid_t st_uid; /* user ID of the file's owner */ @@ -183,12 +207,7 @@ __uint32_t st_blksize; /* optimal blocksize for I/O */ fflags_t st_flags; /* user defined flags for file */ __uint32_t st_gen; /* file generation number */ - struct timespec st_birthtimespec; /* time of file creation */ - /* - * See above about the following padding. - */ - unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec)); - unsigned int :(8 / 2) * (16 - (int)sizeof(struct timespec)); + __uint64_t st_qspare[2]; }; #endif @@ -305,19 +324,40 @@ #if __BSD_VISIBLE int fchflags(int, unsigned long); int fchmod(int, mode_t); -#endif -int fstat(int, struct stat *); -#if __BSD_VISIBLE int lchflags(const char *, int); int lchmod(const char *, mode_t); #endif -#if __POSIX_VISIBLE >= 200112 -int lstat(const char *, struct stat *); -#endif int mkdir(const char *, mode_t); int mkfifo(const char *, mode_t); -int stat(const char *, struct stat *); mode_t umask(mode_t); +int __xfstat(int, int, struct stat *); +int __xstat(int, const char *, struct stat *); + +#ifndef __LIBC_COMPAT__ +static __inline int +fstat(int _fd, struct stat *_stat) +{ + return __xfstat(__STATVER, _fd, _stat); +} + +static __inline int +stat(const char * _path, struct stat *_stat) +{ + return __xstat(__STATVER, _path, _stat); +} +#endif + +int __xlstat(int, const char *, struct stat *); + +#ifndef __LIBC_COMPAT__ +#if __POSIX_VISIBLE >= 200112 +static __inline int +lstat(const char * _path, struct stat *_stat) +{ + return __xlstat(__STATVER, _path, _stat); +} +#endif +#endif __END_DECLS #endif /* !_KERNEL */ Index: sys/sys/syscall.h =================================================================== RCS file: /home/ncvs/src/sys/sys/syscall.h,v retrieving revision 1.157 diff -u -r1.157 syscall.h --- sys/sys/syscall.h 2 Jul 2004 00:38:55 -0000 1.157 +++ sys/sys/syscall.h 5 Jul 2004 07:28:46 -0000 @@ -2,7 +2,7 @@ * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/sys/syscall.h,v 1.157 2004/07/02 00:38:55 marcel Exp $ + * $FreeBSD$ * created from FreeBSD: src/sys/kern/syscalls.master,v 1.174 2004/07/02 00:35:52 marcel Exp */ @@ -174,9 +174,9 @@ #define SYS_setgid 181 #define SYS_setegid 182 #define SYS_seteuid 183 -#define SYS_stat 188 -#define SYS_fstat 189 -#define SYS_lstat 190 + /* 188 is old stat44 */ + /* 189 is old fstat44 */ + /* 190 is old lstat44 */ #define SYS_pathconf 191 #define SYS_fpathconf 192 #define SYS_getrlimit 194 @@ -356,4 +356,7 @@ #define SYS_ksem_timedwait 441 #define SYS_thr_suspend 442 #define SYS_thr_wake 443 -#define SYS_MAXSYSCALL 444 +#define SYS___xstat 444 +#define SYS___xfstat 445 +#define SYS___xlstat 446 +#define SYS_MAXSYSCALL 447 Index: sys/sys/syscall.mk =================================================================== RCS file: /home/ncvs/src/sys/sys/syscall.mk,v retrieving revision 1.112 diff -u -r1.112 syscall.mk --- sys/sys/syscall.mk 2 Jul 2004 00:38:55 -0000 1.112 +++ sys/sys/syscall.mk 5 Jul 2004 07:28:46 -0000 @@ -1,6 +1,6 @@ # FreeBSD system call names. # DO NOT EDIT-- this file is automatically generated. -# $FreeBSD: src/sys/sys/syscall.mk,v 1.112 2004/07/02 00:38:55 marcel Exp $ +# $FreeBSD$ # created from FreeBSD: src/sys/kern/syscalls.master,v 1.174 2004/07/02 00:35:52 marcel Exp MIASM = \ syscall.o \ @@ -123,9 +123,6 @@ setgid.o \ setegid.o \ seteuid.o \ - stat.o \ - fstat.o \ - lstat.o \ pathconf.o \ fpathconf.o \ getrlimit.o \ @@ -297,4 +294,7 @@ kse_switchin.o \ ksem_timedwait.o \ thr_suspend.o \ - thr_wake.o + thr_wake.o \ + __xstat.o \ + __xfstat.o \ + __xlstat.o Index: sys/sys/sysproto.h =================================================================== RCS file: /home/ncvs/src/sys/sys/sysproto.h,v retrieving revision 1.156 diff -u -r1.156 sysproto.h --- sys/sys/sysproto.h 2 Jul 2004 00:38:55 -0000 1.156 +++ sys/sys/sysproto.h 5 Jul 2004 07:28:46 -0000 @@ -2,7 +2,7 @@ * System call prototypes. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/sys/sysproto.h,v 1.156 2004/07/02 00:38:55 marcel Exp $ + * $FreeBSD$ * created from FreeBSD: src/sys/kern/syscalls.master,v 1.174 2004/07/02 00:35:52 marcel Exp */ @@ -561,18 +561,6 @@ struct seteuid_args { char euid_l_[PADL_(uid_t)]; uid_t euid; char euid_r_[PADR_(uid_t)]; }; -struct stat_args { - char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; - char ub_l_[PADL_(struct stat *)]; struct stat * ub; char ub_r_[PADR_(struct stat *)]; -}; -struct fstat_args { - char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; - char sb_l_[PADL_(struct stat *)]; struct stat * sb; char sb_r_[PADR_(struct stat *)]; -}; -struct lstat_args { - char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; - char ub_l_[PADL_(struct stat *)]; struct stat * ub; char ub_r_[PADR_(struct stat *)]; -}; struct pathconf_args { char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; char name_l_[PADL_(int)]; int name; char name_r_[PADR_(int)]; @@ -1303,6 +1291,21 @@ struct thr_wake_args { char id_l_[PADL_(long)]; long id; char id_r_[PADR_(long)]; }; +struct __xstat_args { + char ver_l_[PADL_(int)]; int ver; char ver_r_[PADR_(int)]; + char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; + char ub_l_[PADL_(struct stat *)]; struct stat * ub; char ub_r_[PADR_(struct stat *)]; +}; +struct __xfstat_args { + char ver_l_[PADL_(int)]; int ver; char ver_r_[PADR_(int)]; + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char sb_l_[PADL_(struct stat *)]; struct stat * sb; char sb_r_[PADR_(struct stat *)]; +}; +struct __xlstat_args { + char ver_l_[PADL_(int)]; int ver; char ver_r_[PADR_(int)]; + char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; + char ub_l_[PADL_(struct stat *)]; struct stat * ub; char ub_r_[PADR_(struct stat *)]; +}; int nosys(struct thread *, struct nosys_args *); void sys_exit(struct thread *, struct sys_exit_args *); int fork(struct thread *, struct fork_args *); @@ -1423,9 +1426,6 @@ int setgid(struct thread *, struct setgid_args *); int setegid(struct thread *, struct setegid_args *); int seteuid(struct thread *, struct seteuid_args *); -int stat(struct thread *, struct stat_args *); -int fstat(struct thread *, struct fstat_args *); -int lstat(struct thread *, struct lstat_args *); int pathconf(struct thread *, struct pathconf_args *); int fpathconf(struct thread *, struct fpathconf_args *); int getrlimit(struct thread *, struct __getrlimit_args *); @@ -1597,6 +1597,9 @@ int ksem_timedwait(struct thread *, struct ksem_timedwait_args *); int thr_suspend(struct thread *, struct thr_suspend_args *); int thr_wake(struct thread *, struct thr_wake_args *); +int __xstat(struct thread *, struct __xstat_args *); +int __xfstat(struct thread *, struct __xfstat_args *); +int __xlstat(struct thread *, struct __xlstat_args *); #ifdef COMPAT_43 @@ -1785,6 +1788,18 @@ char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; char buf_l_[PADL_(struct ostatfs *)]; struct ostatfs * buf; char buf_r_[PADR_(struct ostatfs *)]; }; +struct freebsd4_stat44_args { + char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; + char ub_l_[PADL_(struct stat44 *)]; struct stat44 * ub; char ub_r_[PADR_(struct stat44 *)]; +}; +struct freebsd4_fstat44_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char sb_l_[PADL_(struct stat44 *)]; struct stat44 * sb; char sb_r_[PADR_(struct stat44 *)]; +}; +struct freebsd4_lstat44_args { + char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; + char ub_l_[PADL_(struct stat44 *)]; struct stat44 * ub; char ub_r_[PADR_(struct stat44 *)]; +}; struct freebsd4_fhstatfs_args { char u_fhp_l_[PADL_(const struct fhandle *)]; const struct fhandle * u_fhp; char u_fhp_r_[PADR_(const struct fhandle *)]; char buf_l_[PADL_(struct ostatfs *)]; struct ostatfs * buf; char buf_r_[PADR_(struct ostatfs *)]; @@ -1809,6 +1824,9 @@ int freebsd4_getfsstat(struct thread *, struct freebsd4_getfsstat_args *); int freebsd4_statfs(struct thread *, struct freebsd4_statfs_args *); int freebsd4_fstatfs(struct thread *, struct freebsd4_fstatfs_args *); +int freebsd4_stat44(struct thread *, struct freebsd4_stat44_args *); +int freebsd4_fstat44(struct thread *, struct freebsd4_fstat44_args *); +int freebsd4_lstat44(struct thread *, struct freebsd4_lstat44_args *); int freebsd4_fhstatfs(struct thread *, struct freebsd4_fhstatfs_args *); int freebsd4_sendfile(struct thread *, struct freebsd4_sendfile_args *); int freebsd4_sigaction(struct thread *, struct freebsd4_sigaction_args *); Index: sys/sys/vnode.h =================================================================== RCS file: /home/ncvs/src/sys/sys/vnode.h,v retrieving revision 1.240 diff -u -r1.240 vnode.h --- sys/sys/vnode.h 4 Jul 2004 12:49:04 -0000 1.240 +++ sys/sys/vnode.h 5 Jul 2004 07:28:46 -0000 @@ -244,14 +244,13 @@ */ struct vattr { enum vtype va_type; /* vnode type (for create) */ - u_short va_mode; /* files access mode and type */ - short va_nlink; /* number of references to file */ + u_int va_mode; /* files access mode and type */ + int va_nlink; /* number of references to file */ uid_t va_uid; /* owner user id */ gid_t va_gid; /* owner group id */ dev_t va_fsid; /* filesystem id */ - long va_fileid; /* file id */ + quad_t va_fileid; /* file id */ u_quad_t va_size; /* file size in bytes */ - long va_blocksize; /* blocksize preferred for i/o */ struct timespec va_atime; /* time of last access */ struct timespec va_mtime; /* time of last modification */ struct timespec va_ctime; /* time file changed */ @@ -259,6 +258,7 @@ u_long va_gen; /* generation number of file */ u_long va_flags; /* flags defined for file */ dev_t va_rdev; /* device the special file represents */ + long va_blocksize; /* blocksize preferred for i/o */ u_quad_t va_bytes; /* bytes of disk space held by file */ u_quad_t va_filerev; /* file modification number */ u_int va_vaflags; /* operations flags, see below */ @@ -580,7 +580,8 @@ struct file; struct mount; struct nameidata; -struct ostat; +struct stat43; +struct stat44; struct thread; struct proc; struct stat; @@ -606,7 +607,8 @@ int cache_leaf_test(struct vnode *vp); int change_dir(struct vnode *vp, struct thread *td); int change_root(struct vnode *vp, struct thread *td); -void cvtstat(struct stat *st, struct ostat *ost); +void cvtstat43(struct stat *st, struct stat43 *ost); +void cvtstat44(struct stat *st, struct stat44 *ost); void cvtnstat(struct stat *sb, struct nstat *nsb); int getnewvnode(const char *tag, struct mount *mp, vop_t **vops, struct vnode **vpp); Index: sys/ufs/ffs/ffs_alloc.c =================================================================== RCS file: /home/ncvs/src/sys/ufs/ffs/ffs_alloc.c,v retrieving revision 1.121 diff -u -r1.121 ffs_alloc.c --- sys/ufs/ffs/ffs_alloc.c 16 Jun 2004 09:47:25 -0000 1.121 +++ sys/ufs/ffs/ffs_alloc.c 5 Jul 2004 07:28:46 -0000 @@ -1899,8 +1899,8 @@ cgbno = fsbtodb(fs, cgtod(fs, cg)); } if ((u_int)ino >= fs->fs_ipg * fs->fs_ncg) - panic("ffs_freefile: range: dev = %s, ino = %lu, fs = %s", - devtoname(dev), (u_long)ino, fs->fs_fsmnt); + panic("ffs_freefile: range: dev = %s, ino = %jd, fs = %s", + devtoname(dev), (intmax_t)ino, fs->fs_fsmnt); if ((error = bread(devvp, cgbno, (int)fs->fs_cgsize, NOCRED, &bp))) { brelse(bp); return (error); @@ -2153,8 +2153,9 @@ struct thread *td = curthread; /* XXX */ struct proc *p = td->td_proc; - log(LOG_ERR, "pid %d (%s), uid %d inumber %d on %s: %s\n", - p->p_pid, p->p_comm, td->td_ucred->cr_uid, inum, fs->fs_fsmnt, cp); + log(LOG_ERR, "pid %d (%s), uid %d inumber %jd on %s: %s\n", + p->p_pid, p->p_comm, td->td_ucred->cr_uid, (intmax_t)inum, + fs->fs_fsmnt, cp); } /* Index: sys/ufs/ffs/ffs_snapshot.c =================================================================== RCS file: /home/ncvs/src/sys/ufs/ffs/ffs_snapshot.c,v retrieving revision 1.83 diff -u -r1.83 ffs_snapshot.c --- sys/ufs/ffs/ffs_snapshot.c 4 Jul 2004 08:52:35 -0000 1.83 +++ sys/ufs/ffs/ffs_snapshot.c 5 Jul 2004 07:28:46 -0000 @@ -547,7 +547,8 @@ VI_LOCK(devvp); fs->fs_snapinum[snaploc] = ip->i_number; if (ip->i_nextsnap.tqe_prev != 0) - panic("ffs_snapshot: %d already on list", ip->i_number); + panic("ffs_snapshot: %jd already on list", + (intmax_t)ip->i_number); TAILQ_INSERT_TAIL(snaphead, ip, i_nextsnap); devvp->v_rdev->si_copyonwrite = ffs_copyonwrite; devvp->v_vflag |= VV_COPYONWRITE; @@ -1375,8 +1376,8 @@ if (xp != NULL) vrele(ITOV(ip)); else if (snapdebug) - printf("ffs_snapgone: lost snapshot vnode %d\n", - ip->i_number); + printf("ffs_snapgone: lost snapshot vnode %jd\n", + (intmax_t)ip->i_number); /* * Delete snapshot inode from superblock. Keep list dense. */ @@ -1639,9 +1640,9 @@ if (size == fs->fs_bsize) { #ifdef DEBUG if (snapdebug) - printf("%s %d lbn %jd from inum %d\n", - "Grabonremove: snapino", ip->i_number, - (intmax_t)lbn, inum); + printf("%s %jd lbn %jd from inum %jd\n", + "Grabonremove: snapino", (intmax_t)ip->i_number, + (intmax_t)lbn, (intmax_t)inum); #endif if (lbn < NDADDR) { DIP(ip, i_db[lbn]) = bno; @@ -1672,9 +1673,9 @@ break; #ifdef DEBUG if (snapdebug) - printf("%s%d lbn %jd %s %d size %ld to blkno %jd\n", - "Copyonremove: snapino ", ip->i_number, - (intmax_t)lbn, "for inum", inum, size, + printf("%s%jd lbn %jd %s %jd size %ld to blkno %jd\n", + "Copyonremove: snapino ", (intmax_t)ip->i_number, + (intmax_t)lbn, "for inum", (intmax_t)inum, size, (intmax_t)cbp->b_blkno); #endif /* @@ -1823,8 +1824,8 @@ */ VI_LOCK(devvp); if (ip->i_nextsnap.tqe_prev != 0) - panic("ffs_snapshot_mount: %d already on list", - ip->i_number); + panic("ffs_snapshot_mount: %jd already on list", + (intmax_t)ip->i_number); else TAILQ_INSERT_TAIL(snaphead, ip, i_nextsnap); vp->v_vflag |= VV_SYSTEM; @@ -2041,12 +2042,12 @@ break; #ifdef DEBUG if (snapdebug) { - printf("Copyonwrite: snapino %d lbn %jd for ", - ip->i_number, (intmax_t)lbn); + printf("Copyonwrite: snapino %jd lbn %jd for ", + (intmax_t)ip->i_number, (intmax_t)lbn); if (bp->b_vp == devvp) printf("fs metadata"); else - printf("inum %d", VTOI(bp->b_vp)->i_number); + printf("inum %jd", (intmax_t)VTOI(bp->b_vp)->i_number); printf(" lblkno %jd to blkno %jd\n", (intmax_t)bp->b_lblkno, (intmax_t)cbp->b_blkno); } Index: sys/ufs/ffs/ffs_softdep.c =================================================================== RCS file: /home/ncvs/src/sys/ufs/ffs/ffs_softdep.c,v retrieving revision 1.153 diff -u -r1.153 ffs_softdep.c --- sys/ufs/ffs/ffs_softdep.c 6 Apr 2004 19:20:24 -0000 1.153 +++ sys/ufs/ffs/ffs_softdep.c 5 Jul 2004 07:28:46 -0000 @@ -3066,8 +3066,8 @@ } if (dap->da_newinum != ip->i_number) { FREE_LOCK(&lk); - panic("newdirrem: inum %d should be %d", - ip->i_number, dap->da_newinum); + panic("newdirrem: inum %jd should be %jd", + (intmax_t)ip->i_number, (intmax_t)dap->da_newinum); } /* * If we are deleting a changed name that never made it to disk, @@ -3577,9 +3577,9 @@ ((char *)bp->b_data + dap->da_offset); if (ep->d_ino != dap->da_newinum) { FREE_LOCK(&lk); - panic("%s: dir inum %d != new %d", + panic("%s: dir inum %d != new %jd", "initiate_write_filepage", - ep->d_ino, dap->da_newinum); + ep->d_ino, (intmax_t)dap->da_newinum); } if (dap->da_state & DIRCHG) ep->d_ino = dap->da_previous->dm_oldinum; Index: usr.sbin/quot/quot.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/quot/quot.c,v retrieving revision 1.22 diff -u -r1.22 quot.c --- usr.sbin/quot/quot.c 3 May 2003 21:06:38 -0000 1.22 +++ usr.sbin/quot/quot.c 5 Jul 2004 07:28:48 -0000 @@ -479,6 +479,7 @@ int c; ino_t inode, inode1; ino_t maxino; + uintmax_t ino; union dinode *dp; maxino = super->fs_ncg * super->fs_ipg - 1; @@ -487,9 +488,10 @@ while ((c = getchar()) != EOF && c != '\n'); ungetc(c,stdin); inode1 = -1; - while (scanf("%u",&inode) == 1) { + while (scanf("%ju",&ino) == 1) { + inode = ino; if (inode > maxino) { - warnx("illegal inode %d",inode); + warnx("illegal inode %jd", (intmax_t)inode); return; } errno = 0;