Date: Fri, 6 Jul 2001 14:38:11 -0500 From: "Michael C . Wu" <keichii@iteration.net> To: emulation@freebsd.org Subject: Reviews please:linux *stat64 functions Message-ID: <20010706143811.A14859@peorth.iteration.net>
next in thread | raw e-mail | index | archive | help
--HcAYCG3uE/tztfnV
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi,
I've merged someone's patches for linux_*stat*. Could people
please test this? I will commit this in 4 days if no one objects.
Thanks,
--
Michael C. Wu +1-512-7757700
keichii@{iteration.net|freebsd.org}
--HcAYCG3uE/tztfnV
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="linux_stats.patch"
? linux_stats.patch
? usr.sbin/config/y.tab.h
? usr.sbin/config/y.tab.c
? usr.sbin/config/config.c
? usr.sbin/config/lang.c
? usr.sbin/config/config
? usr.sbin/config/config.8.gz
Index: sys/compat/linux/linux_file.c
===================================================================
RCS file: /home/ncvs/src/sys/compat/linux/linux_file.c,v
retrieving revision 1.53
diff -u -r1.53 linux_file.c
--- sys/compat/linux/linux_file.c 2001/05/01 08:11:51 1.53
+++ sys/compat/linux/linux_file.c 2001/07/06 19:27:00
@@ -37,6 +37,7 @@
#include <sys/fcntl.h>
#include <sys/file.h>
#include <sys/filedesc.h>
+#include <sys/stat.h>
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mount.h>
@@ -898,6 +899,97 @@
bsd.offset = uap->offset;
return pwrite(p, &bsd);
}
+
+int
+linux_stat64(p, uap)
+ struct proc *p;
+ struct linux_stat64_args *uap;
+{
+ struct stat_args bsd;
+ struct stat st;
+ int error;
+
+ bsd.path = uap->path;
+ bsd.ub = &st;
+ error = stat(p, &bsd);
+ if (!error) {
+ uap->up->st_dev = st.st_dev;
+ uap->up->st_mode = st.st_mode;
+ uap->up->st_nlink = st.st_nlink;
+ uap->up->st_uid = st.st_uid;
+ uap->up->st_gid = st.st_gid;
+ uap->up->st_rdev = st.st_rdev;
+ uap->up->st_size = st.st_size;
+ uap->up->st_blksize = st.st_blksize;
+ uap->up->st_blocks = st.st_blocks;
+ uap->up->st_latime = st.st_atime;
+ uap->up->st_lmtime = st.st_mtime;
+ uap->up->st_lctime = st.st_ctime;
+ uap->up->st_ino = st.st_ino;
+ }
+ return (error);
+}
+
+int
+linux_lstat64(p, uap)
+ struct proc *p;
+ struct linux_lstat64_args *uap;
+{
+ struct lstat_args bsd;
+ struct stat st;
+ int error;
+
+ bsd.path = uap->path;
+ bsd.ub = &st;
+ error = lstat(p, &bsd);
+ if (!error) {
+ uap->up->st_dev = st.st_dev;
+ uap->up->st_mode = st.st_mode;
+ uap->up->st_nlink = st.st_nlink;
+ uap->up->st_uid = st.st_uid;
+ uap->up->st_gid = st.st_gid;
+ uap->up->st_rdev = st.st_rdev;
+ uap->up->st_size = st.st_size;
+ uap->up->st_blksize = st.st_blksize;
+ uap->up->st_blocks = st.st_blocks;
+ uap->up->st_latime = st.st_atime;
+ uap->up->st_lmtime = st.st_mtime;
+ uap->up->st_lctime = st.st_ctime;
+ uap->up->st_ino = st.st_ino;
+ }
+ return (error);
+}
+
+int
+linux_fstat64(p, uap)
+ struct proc *p;
+ struct linux_fstat64_args *uap;
+{
+ struct fstat_args bsd;
+ struct stat st;
+ int error;
+
+ bsd.fd = uap->fd;
+ bsd.sb = &st;
+ error = fstat(p, &bsd);
+ if (!error) {
+ uap->up->st_dev = st.st_dev;
+ uap->up->st_mode = st.st_mode;
+ uap->up->st_nlink = st.st_nlink;
+ uap->up->st_uid = st.st_uid;
+ uap->up->st_gid = st.st_gid;
+ uap->up->st_rdev = st.st_rdev;
+ uap->up->st_size = st.st_size;
+ uap->up->st_blksize = st.st_blksize;
+ uap->up->st_blocks = st.st_blocks;
+ uap->up->st_latime = st.st_atime;
+ uap->up->st_lmtime = st.st_mtime;
+ uap->up->st_lctime = st.st_ctime;
+ uap->up->st_ino = st.st_ino;
+ }
+ return (error);
+}
+
int
linux_mount(struct proc *p, struct linux_mount_args *args)
Index: sys/i386/linux/linux.h
===================================================================
RCS file: /home/ncvs/src/sys/i386/linux/linux.h,v
retrieving revision 1.54
diff -u -r1.54 linux.h
--- sys/i386/linux/linux.h 2001/06/13 10:58:35 1.54
+++ sys/i386/linux/linux.h 2001/07/06 19:27:18
@@ -557,4 +557,30 @@
#define ifr_name ifr_ifrn.ifrn_name /* interface name */
#define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */
+struct linux_stat64 {
+ linux_dev_t st_dev;
+ u_char __pad0[10];
+ linux_ino_t __st_ino;
+ u_int st_mode;
+ u_int st_nlink;
+
+ u_long st_uid;
+ u_long st_gid;
+
+ linux_dev_t st_rdev;
+ u_char __pad3[10];
+ int64_t st_size;
+ u_long st_blksize;
+ u_long st_blocks;
+ u_long __pad4;
+
+ linux_time_t st_latime;
+ u_long __pad5;
+ linux_time_t st_lmtime;
+ u_long __pad6;
+ linux_time_t st_lctime;
+ u_long __pad7;
+ u_int64_t st_ino;
+};
+
#endif /* !_I386_LINUX_LINUX_H_ */
Index: sys/i386/linux/linux_dummy.c
===================================================================
RCS file: /home/ncvs/src/sys/i386/linux/linux_dummy.c,v
retrieving revision 1.28
diff -u -r1.28 linux_dummy.c
--- sys/i386/linux/linux_dummy.c 2001/02/16 14:46:14 1.28
+++ sys/i386/linux/linux_dummy.c 2001/07/06 19:27:18
@@ -103,6 +103,3 @@
DUMMY(mmap2);
DUMMY(truncate64);
DUMMY(ftruncate64);
-DUMMY(stat64);
-DUMMY(lstat64);
-DUMMY(fstat64);
Index: sys/i386/linux/linux_proto.h
===================================================================
RCS file: /home/ncvs/src/sys/i386/linux/linux_proto.h,v
retrieving revision 1.42
diff -u -r1.42 linux_proto.h
--- sys/i386/linux/linux_proto.h 2001/04/01 06:43:09 1.42
+++ sys/i386/linux/linux_proto.h 2001/07/06 19:27:18
@@ -551,13 +551,16 @@
register_t dummy;
};
struct linux_stat64_args {
- register_t dummy;
+ char * path; char path_[PAD_(char *)];
+ struct linux_stat64 * up; char up_[PAD_(struct linux_stat64 *)];
};
struct linux_lstat64_args {
- register_t dummy;
+ char * path; char path_[PAD_(char *)];
+ struct linux_stat64 * up; char up_[PAD_(struct linux_stat64 *)];
};
struct linux_fstat64_args {
- register_t dummy;
+ int fd; char fd_[PAD_(int)];
+ struct linux_stat64 * up; char up_[PAD_(struct linux_stat64 *)];
};
int linux_setup __P((struct proc *, struct linux_setup_args *));
int linux_fork __P((struct proc *, struct linux_fork_args *));
Index: sys/i386/linux/syscalls.master
===================================================================
RCS file: /home/ncvs/src/sys/i386/linux/syscalls.master,v
retrieving revision 1.40
diff -u -r1.40 syscalls.master
--- sys/i386/linux/syscalls.master 2001/04/01 06:37:40 1.40
+++ sys/i386/linux/syscalls.master 2001/07/06 19:27:18
@@ -286,6 +286,6 @@
192 STD LINUX { int linux_mmap2(void); }
193 STD LINUX { int linux_truncate64(void); }
194 STD LINUX { int linux_ftruncate64(void); }
-195 STD LINUX { int linux_stat64(void); }
-196 STD LINUX { int linux_lstat64(void); }
-197 STD LINUX { int linux_fstat64(void); }
+195 STD LINUX { int linux_stat64(char *path, struct linux_stat64 *up); }
+196 STD LINUX { int linux_lstat64(char *path, struct linux_stat64 *up); }
+197 STD LINUX { int linux_fstat64(int fd, struct linux_stat64 *up); }
--HcAYCG3uE/tztfnV--
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-emulation" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010706143811.A14859>
