####################### ####################### WARNING WARNING WARNING ####################### ####################### This patch is incomplete and will break things like linux and osf1 compat layers until the corresponding minor changes are made there too. ? ino64.diff Index: lib/libc/Makefile =================================================================== RCS file: /home/ncvs/src/lib/libc/Makefile,v retrieving revision 1.56 diff -u -3 -r1.56 Makefile --- lib/libc/Makefile 15 Jan 2005 05:23:56 -0000 1.56 +++ lib/libc/Makefile 14 Jun 2005 23:36:03 -0000 @@ -30,6 +30,7 @@ .include "${.CURDIR}/${MACHINE_ARCH}/Makefile.inc" .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 14 Jun 2005 23:36:03 -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 14 Jun 2005 23:36:03 -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 14 Jun 2005 23:36:03 -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 14 Jun 2005 23:36:03 -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 14 Jun 2005 23:36:03 -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 14 Jun 2005 23:36:03 -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 -3 -r1.4 strmode.c --- lib/libc/string/strmode.c 21 Mar 2002 18:44:54 -0000 1.4 +++ lib/libc/string/strmode.c 14 Jun 2005 23:36:03 -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.7 diff -u -3 -r1.7 bzipfs.c --- lib/libstand/bzipfs.c 17 May 2005 16:22:54 -0000 1.7 +++ lib/libstand/bzipfs.c 14 Jun 2005 23:36:03 -0000 @@ -30,7 +30,6 @@ #include "stand.h" -#include #include #include Index: lib/libstand/gzipfs.c =================================================================== RCS file: /home/ncvs/src/lib/libstand/gzipfs.c,v retrieving revision 1.13 diff -u -3 -r1.13 gzipfs.c --- lib/libstand/gzipfs.c 21 Jan 2004 20:12:23 -0000 1.13 +++ lib/libstand/gzipfs.c 14 Jun 2005 23:36:03 -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 -3 -r1.12 nfs.c --- lib/libstand/nfs.c 21 Jan 2004 20:12:23 -0000 1.12 +++ lib/libstand/nfs.c 14 Jun 2005 23:36:03 -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.41 diff -u -3 -r1.41 stand.h --- lib/libstand/stand.h 17 May 2005 17:46:29 -0000 1.41 +++ lib/libstand/stand.h 14 Jun 2005 23:36:03 -0000 @@ -67,7 +67,6 @@ #include #include -#include #include #include @@ -95,6 +94,7 @@ #define ESALAST (ELAST+8) /* */ struct open_file; +struct stat; /* * This structure is used to define file system operations in a file system @@ -411,5 +411,46 @@ #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 *); #endif /* STAND_H */ Index: lib/libstand/tftp.c =================================================================== RCS file: /home/ncvs/src/lib/libstand/tftp.c,v retrieving revision 1.12 diff -u -3 -r1.12 tftp.c --- lib/libstand/tftp.c 3 Oct 2004 15:58:20 -0000 1.12 +++ lib/libstand/tftp.c 14 Jun 2005 23:36:03 -0000 @@ -46,7 +46,6 @@ */ #include -#include #include #include #include Index: sbin/fsck_ffs/main.c =================================================================== RCS file: /home/ncvs/src/sbin/fsck_ffs/main.c,v retrieving revision 1.44 diff -u -3 -r1.44 main.c --- sbin/fsck_ffs/main.c 10 Feb 2005 09:19:29 -0000 1.44 +++ sbin/fsck_ffs/main.c 14 Jun 2005 23:36:03 -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) Index: sbin/newfs/mkfs.c =================================================================== RCS file: /home/ncvs/src/sbin/newfs/mkfs.c,v retrieving revision 1.89 diff -u -3 -r1.89 mkfs.c --- sbin/newfs/mkfs.c 20 Feb 2005 11:32:49 -0000 1.89 +++ sbin/newfs/mkfs.c 14 Jun 2005 23:36:04 -0000 @@ -925,7 +925,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 -3 -r1.11 ls.c --- sys/boot/common/ls.c 25 Aug 2003 23:30:41 -0000 1.11 +++ sys/boot/common/ls.c 14 Jun 2005 23:36:04 -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 -3 -r1.1 fileaccess.c --- sys/boot/ficl/fileaccess.c 9 Apr 2002 17:45:11 -0000 1.1 +++ sys/boot/ficl/fileaccess.c 14 Jun 2005 23:36:04 -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 -3 -r1.8 testmain.c --- sys/boot/ficl/testmain.c 9 Apr 2002 17:45:11 -0000 1.8 +++ sys/boot/ficl/testmain.c 14 Jun 2005 23:36:04 -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.35 diff -u -3 -r1.35 freebsd32_misc.c --- sys/compat/freebsd32/freebsd32_misc.c 11 Jun 2005 14:58:20 -0000 1.35 +++ sys/compat/freebsd32/freebsd32_misc.c 14 Jun 2005 23:36:04 -0000 @@ -127,6 +127,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); @@ -1009,32 +1011,124 @@ 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) +{ + struct stat sb; + struct stat44_32 sb32; + int error; + + error = kern_stat(td, uap->path, UIO_USERSPACE, &sb); + if (error) + return (error); + copy_stat44(&sb, &sb32); + error = copyout(&sb32, uap->ub, sizeof (sb32)); + return (error); +} + +int +freebsd32_fstat44(struct thread *td, struct freebsd32_fstat44_args *uap) +{ + struct stat sb; + struct stat44_32 sb32; + int error; + + error = kern_fstat(td, uap->fd, &sb); + if (error) + return (error); + copy_stat44(&sb, &sb32); + error = copyout(&sb32, uap->ub, sizeof(sb32)); + return (error); +} + +int +freebsd32_lstat44(struct thread *td, struct freebsd32_lstat44_args *uap) +{ + struct stat sb; + struct stat44_32 sb32; + int error; + + error = kern_lstat(td, uap->path, UIO_USERSPACE, &sb); + if (error) + return (error); + copy_stat44(&sb, &sb32); + error = copyout(&sb32, uap->ub, sizeof (sb32)); + 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); @@ -1046,6 +1140,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); @@ -1054,12 +1149,14 @@ } int -freebsd32_stat(struct thread *td, struct freebsd32_stat_args *uap) +freebsd32_xstat(struct thread *td, struct freebsd32_stat_args *uap) { struct stat sb; struct stat32 sb32; int error; + if (uap->ver != __STATVER) + return (EOPNOTSUPP); error = kern_stat(td, uap->path, UIO_USERSPACE, &sb); if (error) return (error); @@ -1069,27 +1166,31 @@ } int -freebsd32_fstat(struct thread *td, struct freebsd32_fstat_args *uap) +freebsd32_xfstat(struct thread *td, struct freebsd32_fstat_args *uap) { - struct stat ub; - struct stat32 ub32; + struct stat sb; + struct stat32 sb32; int error; - error = kern_fstat(td, uap->fd, &ub); + if (uap->ver != __STATVER) + return (EOPNOTSUPP); + error = kern_fstat(td, uap->fd, &sb); if (error) return (error); - copy_stat(&ub, &ub32); - error = copyout(&ub32, uap->ub, sizeof(ub32)); + copy_stat(&sb, &sb32); + error = copyout(&sb32, uap->ub, sizeof(sb32)); return (error); } int -freebsd32_lstat(struct thread *td, struct freebsd32_lstat_args *uap) +freebsd32_xlstat(struct thread *td, struct freebsd32_lstat_args *uap) { struct stat sb; struct stat32 sb32; int error; + if (uap->ver != __STATVER) + return (EOPNOTSUPP); error = kern_lstat(td, uap->path, UIO_USERSPACE, &sb); if (error) return (error); Index: sys/compat/freebsd32/syscalls.master =================================================================== RCS file: /home/ncvs/src/sys/compat/freebsd32/syscalls.master,v retrieving revision 1.49 diff -u -3 -r1.49 syscalls.master --- sys/compat/freebsd32/syscalls.master 30 May 2005 15:09:17 -0000 1.49 +++ sys/compat/freebsd32/syscalls.master 14 Jun 2005 23:36:04 -0000 @@ -323,12 +323,12 @@ 185 AUE_NULL UNIMPL lfs_markv 186 AUE_NULL UNIMPL lfs_segclean 187 AUE_NULL UNIMPL lfs_segwait -188 AUE_NULL STD { int freebsd32_stat(char *path, \ - struct stat32 *ub); } -189 AUE_NULL MSTD { int freebsd32_fstat(int fd, \ - struct stat32 *ub); } -190 AUE_NULL STD { int freebsd32_lstat(char *path, \ - struct stat32 *ub); } +188 AUE_NULL MSTD { int freebsd32_stat44(char *path, \ + struct stat44_32 *ub); } +189 AUE_NULL MSTD { int freebsd32_fstat44(int fd, \ + struct stat44_32 *ub); } +190 AUE_NULL MSTD { int freebsd32_lstat44(char *path, \ + struct stat44_32 *ub); } 191 AUE_NULL NOPROTO { int pathconf(char *path, int name); } 192 AUE_NULL MNOPROTO { int fpathconf(int fd, int name); } 193 AUE_NULL UNIMPL nosys @@ -683,9 +683,12 @@ struct sigaction32 *oact); } 417 AUE_NULL MSTD { int freebsd32_sigreturn( \ const struct freebsd32_ucontext *sigcntxp); } -418 AUE_NULL UNIMPL __xstat -419 AUE_NULL UNIMPL __xfstat -420 AUE_NULL UNIMPL __xlstat +418 AUE_NULL MSTD { int freebsd32_xstat(int ver, char *path, \ + struct stat32 *ub); } +419 AUE_NULL MSTD { int freebsd32_xfstat(int ver, int fd, \ + struct stat32 *ub); } +420 AUE_NULL MSTD { int freebsd32_xlstat(int ver, char *path, \ + struct stat32 *ub); } ; XXX implement 421 AUE_NULL UNIMPL getcontext ; XXX implement Index: sys/isofs/cd9660/cd9660_vnops.c =================================================================== RCS file: /home/ncvs/src/sys/isofs/cd9660/cd9660_vnops.c,v retrieving revision 1.110 diff -u -3 -r1.110 cd9660_vnops.c --- sys/isofs/cd9660/cd9660_vnops.c 17 Mar 2005 14:43:40 -0000 1.110 +++ sys/isofs/cd9660/cd9660_vnops.c 14 Jun 2005 23:36:04 -0000 @@ -459,6 +459,7 @@ struct iso_directory_record *ep; int entryoffsetinblock; doff_t endsearch; + ino_t ino; u_long bmask; int error = 0; int reclen; @@ -560,7 +561,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.193 diff -u -3 -r1.193 init_sysent.c --- sys/kern/init_sysent.c 30 May 2005 15:20:20 -0000 1.193 +++ sys/kern/init_sysent.c 14 Jun 2005 23:36:04 -0000 @@ -217,9 +217,9 @@ { 0, (sy_call_t *)nosys, AUE_NULL }, /* 185 = lfs_markv */ { 0, (sy_call_t *)nosys, AUE_NULL }, /* 186 = lfs_segclean */ { 0, (sy_call_t *)nosys, AUE_NULL }, /* 187 = lfs_segwait */ - { SYF_MPSAFE | AS(stat_args), (sy_call_t *)stat, AUE_NULL }, /* 188 = stat */ - { SYF_MPSAFE | AS(fstat_args), (sy_call_t *)fstat, AUE_NULL }, /* 189 = fstat */ - { SYF_MPSAFE | AS(lstat_args), (sy_call_t *)lstat, AUE_NULL }, /* 190 = lstat */ + { SYF_MPSAFE | AS(stat44_args), (sy_call_t *)stat44, AUE_NULL }, /* 188 = stat44 */ + { SYF_MPSAFE | AS(fstat44_args), (sy_call_t *)fstat44, AUE_NULL }, /* 189 = fstat44 */ + { SYF_MPSAFE | AS(lstat44_args), (sy_call_t *)lstat44, AUE_NULL }, /* 190 = lstat44 */ { SYF_MPSAFE | AS(pathconf_args), (sy_call_t *)pathconf, AUE_NULL }, /* 191 = pathconf */ { SYF_MPSAFE | AS(fpathconf_args), (sy_call_t *)fpathconf, AUE_NULL }, /* 192 = fpathconf */ { 0, (sy_call_t *)nosys, AUE_NULL }, /* 193 = nosys */ @@ -447,9 +447,9 @@ { SYF_MPSAFE | AS(__mac_execve_args), (sy_call_t *)__mac_execve, AUE_NULL }, /* 415 = __mac_execve */ { SYF_MPSAFE | AS(sigaction_args), (sy_call_t *)sigaction, AUE_NULL }, /* 416 = sigaction */ { SYF_MPSAFE | AS(sigreturn_args), (sy_call_t *)sigreturn, AUE_NULL }, /* 417 = sigreturn */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 418 = __xstat */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 419 = __xfstat */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 420 = __xlstat */ + { SYF_MPSAFE | AS(__xstat_args), (sy_call_t *)__xstat, AUE_NULL }, /* 418 = __xstat */ + { SYF_MPSAFE | AS(__xfstat_args), (sy_call_t *)__xfstat, AUE_NULL }, /* 419 = __xfstat */ + { SYF_MPSAFE | AS(__xlstat_args), (sy_call_t *)__xlstat, AUE_NULL }, /* 420 = __xlstat */ { SYF_MPSAFE | AS(getcontext_args), (sy_call_t *)getcontext, AUE_NULL }, /* 421 = getcontext */ { SYF_MPSAFE | AS(setcontext_args), (sy_call_t *)setcontext, AUE_NULL }, /* 422 = setcontext */ { SYF_MPSAFE | AS(swapcontext_args), (sy_call_t *)swapcontext, AUE_NULL }, /* 423 = swapcontext */ Index: sys/kern/kern_descrip.c =================================================================== RCS file: /home/ncvs/src/sys/kern/kern_descrip.c,v retrieving revision 1.278 diff -u -3 -r1.278 kern_descrip.c --- sys/kern/kern_descrip.c 3 May 2005 10:52:22 -0000 1.278 +++ sys/kern/kern_descrip.c 14 Jun 2005 23:36:04 -0000 @@ -1022,7 +1022,7 @@ #ifndef _SYS_SYSPROTO_H_ struct ofstat_args { int fd; - struct ostat *sb; + struct stat43 *sb; }; #endif /* @@ -1032,24 +1032,52 @@ int ofstat(struct thread *td, struct ofstat_args *uap) { - struct ostat oub; struct stat ub; + struct stat43 oub; int error; error = kern_fstat(td, uap->fd, &ub); if (error == 0) { - cvtstat(&ub, &oub); + cvtstat43(&ub, &oub); error = copyout(&oub, uap->sb, sizeof(oub)); } return (error); } #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 stat ub; + struct stat44 oub; + int error; + + error = kern_fstat(td, uap->fd, &ub); + if (error == 0) { + cvtstat44(&ub, &oub); + error = copyout(&ub, uap->sb, sizeof(ub)); + } + 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; }; @@ -1059,11 +1087,13 @@ */ /* ARGSUSED */ int -fstat(struct thread *td, struct fstat_args *uap) +__xfstat(struct thread *td, struct __xfstat_args *uap) { struct stat ub; int error; + if (uap->ver != __STATVER) + return (EOPNOTSUPP); error = kern_fstat(td, uap->fd, &ub); if (error == 0) error = copyout(&ub, uap->sb, sizeof(ub)); Index: sys/kern/syscalls.c =================================================================== RCS file: /home/ncvs/src/sys/kern/syscalls.c,v retrieving revision 1.179 diff -u -3 -r1.179 syscalls.c --- sys/kern/syscalls.c 30 May 2005 15:20:20 -0000 1.179 +++ sys/kern/syscalls.c 14 Jun 2005 23:36:04 -0000 @@ -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 */ + "stat44", /* 188 = stat44 */ + "fstat44", /* 189 = fstat44 */ + "lstat44", /* 190 = lstat44 */ "pathconf", /* 191 = pathconf */ "fpathconf", /* 192 = fpathconf */ "#193", /* 193 = nosys */ @@ -425,9 +425,9 @@ "__mac_execve", /* 415 = __mac_execve */ "sigaction", /* 416 = sigaction */ "sigreturn", /* 417 = sigreturn */ - "#418", /* 418 = __xstat */ - "#419", /* 419 = __xfstat */ - "#420", /* 420 = __xlstat */ + "__xstat", /* 418 = __xstat */ + "__xfstat", /* 419 = __xfstat */ + "__xlstat", /* 420 = __xlstat */ "getcontext", /* 421 = getcontext */ "setcontext", /* 422 = setcontext */ "swapcontext", /* 423 = swapcontext */ Index: sys/kern/syscalls.master =================================================================== RCS file: /home/ncvs/src/sys/kern/syscalls.master,v retrieving revision 1.196 diff -u -3 -r1.196 syscalls.master --- sys/kern/syscalls.master 30 May 2005 15:09:18 -0000 1.196 +++ sys/kern/syscalls.master 14 Jun 2005 23:36:04 -0000 @@ -357,9 +357,9 @@ 185 AUE_NULL UNIMPL lfs_markv 186 AUE_NULL UNIMPL lfs_segclean 187 AUE_NULL UNIMPL lfs_segwait -188 AUE_NULL MSTD { int stat(char *path, struct stat *ub); } -189 AUE_NULL MSTD { int fstat(int fd, struct stat *sb); } -190 AUE_NULL MSTD { int lstat(char *path, struct stat *ub); } +188 AUE_NULL MSTD { int stat44(char *path, struct stat44 *ub); } +189 AUE_NULL MSTD { int fstat44(int fd, struct stat44 *sb); } +190 AUE_NULL MSTD { int lstat44(char *path, struct stat44 *ub); } 191 AUE_NULL MSTD { int pathconf(char *path, int name); } 192 AUE_NULL MSTD { int fpathconf(int fd, int name); } 193 AUE_NULL UNIMPL nosys @@ -726,9 +726,9 @@ struct sigaction *oact); } 417 AUE_NULL MSTD { int sigreturn( \ const struct __ucontext *sigcntxp); } -418 AUE_NULL UNIMPL __xstat -419 AUE_NULL UNIMPL __xfstat -420 AUE_NULL UNIMPL __xlstat +418 AUE_NULL MSTD { int __xstat(int ver, char *path, struct stat *ub); } +419 AUE_NULL MSTD { int __xfstat(int ver, int fd, struct stat *sb); } +420 AUE_NULL MSTD { int __xlstat(int ver, char *path, struct stat *ub); } 421 AUE_NULL MSTD { int getcontext(struct __ucontext *ucp); } 422 AUE_NULL MSTD { int setcontext( \ const struct __ucontext *ucp); } Index: sys/kern/vfs_syscalls.c =================================================================== RCS file: /home/ncvs/src/sys/kern/vfs_syscalls.c,v retrieving revision 1.391 diff -u -3 -r1.391 vfs_syscalls.c --- sys/kern/vfs_syscalls.c 14 Jun 2005 01:14:40 -0000 1.391 +++ sys/kern/vfs_syscalls.c 14 Jun 2005 23:36:05 -0000 @@ -1943,7 +1943,7 @@ #ifndef _SYS_SYSPROTO_H_ struct ostat_args { char *path; - struct ostat *ub; + struct stat43 *ub; }; #endif int @@ -1951,18 +1951,18 @@ 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; error = kern_stat(td, uap->path, UIO_USERSPACE, &sb); - if (error) - return (error); - cvtstat(&sb, &osb); - error = copyout(&osb, uap->ub, sizeof (osb)); + if (error == 0) { + cvtstat43(&sb, &osb); + error = copyout(&osb, uap->ub, sizeof (osb)); + } return (error); } @@ -1972,7 +1972,7 @@ #ifndef _SYS_SYSPROTO_H_ struct olstat_args { char *path; - struct ostat *ub; + struct stat43 *ub; }; #endif int @@ -1980,18 +1980,18 @@ struct thread *td; register struct olstat_args /* { char *path; - struct ostat *ub; + struct stat43 *ub; } */ *uap; { struct stat sb; - struct ostat osb; + struct stat43 osb; int error; error = kern_lstat(td, uap->path, UIO_USERSPACE, &sb); - if (error) - return (error); - cvtstat(&sb, &osb); - error = copyout(&osb, uap->ub, sizeof (osb)); + if (error == 0) { + cvtstat43(&sb, &osb); + error = copyout(&osb, uap->ub, sizeof (osb)); + } return (error); } @@ -1999,9 +1999,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; @@ -2025,19 +2025,95 @@ } #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; + + error = kern_stat(td, uap->path, UIO_USERSPACE, &sb); + if (error == 0) { + cvtstat44(&sb, &osb); + error = copyout(&sb, uap->ub, sizeof (sb)); + } + 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 stat sb; + struct stat44 osb; + int error; + + error = kern_lstat(td, uap->path, UIO_USERSPACE, &sb); + if (error == 0) { + 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; @@ -2045,6 +2121,8 @@ struct stat sb; int error; + if (uap->ver != __STATVER) + return (EOPNOTSUPP); error = kern_stat(td, uap->path, UIO_USERSPACE, &sb); if (error == 0) error = copyout(&sb, uap->ub, sizeof (sb)); @@ -2077,15 +2155,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; @@ -2093,6 +2172,8 @@ struct stat sb; int error; + if (uap->ver != __STATVER) + return (EOPNOTSUPP); error = kern_lstat(td, uap->path, UIO_USERSPACE, &sb); if (error == 0) error = copyout(&sb, uap->ub, sizeof (sb)); @@ -2147,7 +2228,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.140 diff -u -3 -r1.140 nfs_subs.c --- sys/nfsclient/nfs_subs.c 13 Mar 2005 12:14:56 -0000 1.140 +++ sys/nfsclient/nfs_subs.c 14 Jun 2005 23:36:05 -0000 @@ -553,8 +553,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.136 diff -u -3 -r1.136 nfs_srvsubs.c --- sys/nfsserver/nfs_srvsubs.c 28 Mar 2005 18:51:58 -0000 1.136 +++ sys/nfsserver/nfs_srvsubs.c 14 Jun 2005 23:36:05 -0000 @@ -1028,8 +1028,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.21 diff -u -3 -r1.21 _types.h --- sys/sys/_types.h 22 Mar 2005 01:19:17 -0000 1.21 +++ sys/sys/_types.h 14 Jun 2005 23:36:05 -0000 @@ -43,12 +43,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 - intentionally */ Index: sys/sys/cdefs.h =================================================================== RCS file: /home/ncvs/src/sys/sys/cdefs.h,v retrieving revision 1.88 diff -u -3 -r1.88 cdefs.h --- sys/sys/cdefs.h 3 Jun 2005 17:53:36 -0000 1.88 +++ sys/sys/cdefs.h 14 Jun 2005 23:36:05 -0000 @@ -253,6 +253,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.41 diff -u -3 -r1.41 stat.h --- sys/sys/stat.h 22 Mar 2005 01:19:18 -0000 1.41 +++ sys/sys/stat.h 14 Jun 2005 23:36:05 -0000 @@ -108,12 +108,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 */ @@ -128,33 +129,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 */ blkcnt_t st_blocks; /* blocks allocated for file */ blksize_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 @@ -164,20 +157,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 */ @@ -191,12 +215,7 @@ blksize_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 @@ -313,23 +332,41 @@ #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 * __restrict, struct stat * __restrict); -#endif int mkdir(const char *, mode_t); int mkfifo(const char *, mode_t); #if !defined(_MKNOD_DECLARED) && __XSI_VISIBLE int mknod(const char *, mode_t, dev_t); #define _MKNOD_DECLARED #endif -int stat(const char * __restrict, struct stat * __restrict); mode_t umask(mode_t); +int __xfstat(int, int, struct stat *); +int __xstat(int, const char *, struct stat *); +int __xlstat(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); +} + +#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.176 diff -u -3 -r1.176 syscall.h --- sys/sys/syscall.h 30 May 2005 15:20:21 -0000 1.176 +++ sys/sys/syscall.h 14 Jun 2005 23:36:05 -0000 @@ -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 +#define SYS_stat44 188 +#define SYS_fstat44 189 +#define SYS_lstat44 190 #define SYS_pathconf 191 #define SYS_fpathconf 192 #define SYS_getrlimit 194 @@ -334,6 +334,9 @@ #define SYS___mac_execve 415 #define SYS_sigaction 416 #define SYS_sigreturn 417 +#define SYS___xstat 418 +#define SYS___xfstat 419 +#define SYS___xlstat 420 #define SYS_getcontext 421 #define SYS_setcontext 422 #define SYS_swapcontext 423 Index: sys/sys/syscall.mk =================================================================== RCS file: /home/ncvs/src/sys/sys/syscall.mk,v retrieving revision 1.131 diff -u -3 -r1.131 syscall.mk --- sys/sys/syscall.mk 30 May 2005 15:20:21 -0000 1.131 +++ sys/sys/syscall.mk 14 Jun 2005 23:36:05 -0000 @@ -123,9 +123,9 @@ setgid.o \ setegid.o \ seteuid.o \ - stat.o \ - fstat.o \ - lstat.o \ + stat44.o \ + fstat44.o \ + lstat44.o \ pathconf.o \ fpathconf.o \ getrlimit.o \ @@ -276,6 +276,9 @@ __mac_execve.o \ sigaction.o \ sigreturn.o \ + __xstat.o \ + __xfstat.o \ + __xlstat.o \ getcontext.o \ setcontext.o \ swapcontext.o \ Index: sys/sys/sysproto.h =================================================================== RCS file: /home/ncvs/src/sys/sys/sysproto.h,v retrieving revision 1.175 diff -u -3 -r1.175 sysproto.h --- sys/sys/sysproto.h 30 May 2005 15:20:21 -0000 1.175 +++ sys/sys/sysproto.h 14 Jun 2005 23:36:05 -0000 @@ -561,17 +561,17 @@ struct seteuid_args { char euid_l_[PADL_(uid_t)]; uid_t euid; char euid_r_[PADR_(uid_t)]; }; -struct stat_args { +struct stat44_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 *)]; + char ub_l_[PADL_(struct stat44 *)]; struct stat44 * ub; char ub_r_[PADR_(struct stat44 *)]; }; -struct fstat_args { +struct fstat44_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 *)]; + char sb_l_[PADL_(struct stat44 *)]; struct stat44 * sb; char sb_r_[PADR_(struct stat44 *)]; }; -struct lstat_args { +struct lstat44_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 *)]; + char ub_l_[PADL_(struct stat44 *)]; struct stat44 * ub; char ub_r_[PADR_(struct stat44 *)]; }; struct pathconf_args { char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; @@ -1213,6 +1213,21 @@ struct sigreturn_args { char sigcntxp_l_[PADL_(const struct __ucontext *)]; const struct __ucontext * sigcntxp; char sigcntxp_r_[PADR_(const struct __ucontext *)]; }; +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 *)]; +}; struct getcontext_args { char ucp_l_[PADL_(struct __ucontext *)]; struct __ucontext * ucp; char ucp_r_[PADR_(struct __ucontext *)]; }; @@ -1473,9 +1488,9 @@ 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 stat44(struct thread *, struct stat44_args *); +int fstat44(struct thread *, struct fstat44_args *); +int lstat44(struct thread *, struct lstat44_args *); int pathconf(struct thread *, struct pathconf_args *); int fpathconf(struct thread *, struct fpathconf_args *); int getrlimit(struct thread *, struct __getrlimit_args *); @@ -1625,6 +1640,9 @@ int __mac_execve(struct thread *, struct __mac_execve_args *); int sigaction(struct thread *, struct sigaction_args *); int sigreturn(struct thread *, struct sigreturn_args *); +int __xstat(struct thread *, struct __xstat_args *); +int __xfstat(struct thread *, struct __xfstat_args *); +int __xlstat(struct thread *, struct __xlstat_args *); int getcontext(struct thread *, struct getcontext_args *); int setcontext(struct thread *, struct setcontext_args *); int swapcontext(struct thread *, struct swapcontext_args *); Index: sys/sys/vnode.h =================================================================== RCS file: /home/ncvs/src/sys/sys/vnode.h,v retrieving revision 1.302 diff -u -3 -r1.302 vnode.h --- sys/sys/vnode.h 13 Jun 2005 06:26:54 -0000 1.302 +++ sys/sys/vnode.h 14 Jun 2005 23:36:05 -0000 @@ -262,14 +262,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 */ @@ -277,6 +276,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 */ @@ -552,7 +552,8 @@ struct file; struct mount; struct nameidata; -struct ostat; +struct stat43; +struct stat44; struct thread; struct proc; struct stat; @@ -575,7 +576,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, struct vop_vector *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.132 diff -u -3 -r1.132 ffs_alloc.c --- sys/ufs/ffs/ffs_alloc.c 20 Feb 2005 08:02:15 -0000 1.132 +++ sys/ufs/ffs/ffs_alloc.c 14 Jun 2005 23:36:05 -0000 @@ -1999,8 +1999,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); @@ -2257,8 +2257,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.103 diff -u -3 -r1.103 ffs_snapshot.c --- sys/ufs/ffs/ffs_snapshot.c 3 Apr 2005 12:03:44 -0000 1.103 +++ sys/ufs/ffs/ffs_snapshot.c 14 Jun 2005 23:36:05 -0000 @@ -569,7 +569,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(&sn->sn_head, ip, i_nextsnap); devvp->v_vflag |= VV_COPYONWRITE; VI_UNLOCK(devvp); @@ -1405,8 +1406,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. */ @@ -1677,9 +1678,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_SET(ip, i_db[lbn], bno); @@ -1710,9 +1711,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 /* @@ -1859,8 +1860,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(&sn->sn_head, ip, i_nextsnap); vp->v_vflag |= VV_SYSTEM; @@ -2073,12 +2074,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.181 diff -u -3 -r1.181 ffs_softdep.c --- sys/ufs/ffs/ffs_softdep.c 3 May 2005 11:03:29 -0000 1.181 +++ sys/ufs/ffs/ffs_softdep.c 14 Jun 2005 23:36:05 -0000 @@ -3150,8 +3150,8 @@ if ((dap->da_state & ATTACHED) == 0) panic("newdirrem: not ATTACHED"); if (dap->da_newinum != ip->i_number) - 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, * then return the dirrem describing the previous inode (which @@ -3634,9 +3634,9 @@ ep = (struct direct *) ((char *)bp->b_data + dap->da_offset); if (ep->d_ino != dap->da_newinum) - panic("%s: dir inum %d != new %d", + panic("%s: dir inum %u != 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; else Index: usr.sbin/quot/quot.c =================================================================== RCS file: /home/ncvs/src/usr.sbin/quot/quot.c,v retrieving revision 1.23 diff -u -3 -r1.23 quot.c --- usr.sbin/quot/quot.c 9 Apr 2005 14:59:10 -0000 1.23 +++ usr.sbin/quot/quot.c 14 Jun 2005 23:36:07 -0000 @@ -479,6 +479,7 @@ int c; ino_t inode; ino_t maxino; + uintmax_t ino; union dinode *dp; maxino = super->fs_ncg * super->fs_ipg - 1; @@ -486,9 +487,10 @@ while ((c = getchar()) != EOF && (c < '0' || c > '9')) while ((c = getchar()) != EOF && c != '\n'); ungetc(c,stdin); - 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;