From Jim.Pirzyk@disney.com  Fri Oct  6 13:29:38 2000
Return-Path: <Jim.Pirzyk@disney.com>
Received: from mail.disney.com (mail.disney.com [204.128.192.15])
	by hub.freebsd.org (Postfix) with ESMTP id 426E537B503
	for <FreeBSD-gnats-submit@freebsd.org>; Fri,  6 Oct 2000 13:29:38 -0700 (PDT)
Received: from pain10.corp.disney.com (root@pain10.corp.disney.com [153.7.110.100])
	by mail.disney.com (Switch-2.0.1/Switch-2.0.1) with SMTP id e96KTbR00793
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 6 Oct 2000 13:29:37 -0700 (PDT)
Received: from louie.fa.disney.com by pain.corp.disney.com with ESMTP for FreeBSD-gnats-submit@freebsd.org; Fri, 6 Oct 2000 13:30:10 -0700
Received: from plio.fan.fa.disney.com (plio.fan.fa.disney.com [153.7.118.2])
	by louie.fa.disney.com (8.9.2/8.9.2) with ESMTP id NAA23802
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 6 Oct 2000 13:29:36 -0700 (PDT)
	(envelope-from pirzyk@fa.disney.com)
Received: from snoopy.fan.fa.disney.com (snoopy.fan.fa.disney.com [172.30.228.110])
	by plio.fan.fa.disney.com (8.9.2/8.9.2) with ESMTP id NAA00173
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 6 Oct 2000 13:29:35 -0700 (PDT)
	(envelope-from pirzyk@fa.disney.com)
Received: (from pirzyk@localhost)
	by snoopy.fan.fa.disney.com (8.9.3/8.9.3) id NAA09514;
	Fri, 6 Oct 2000 13:29:36 -0700 (PDT)
	(envelope-from pirzyk@fa.disney.com)
Message-Id: <200010062029.NAA09514@snoopy.fan.fa.disney.com>
Date: Fri, 6 Oct 2000 13:29:36 -0700 (PDT)
From: Jim.Pirzyk@disney.com
Reply-To: Jim.Pirzyk@disney.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: fstat64 not in Linux emulation
X-Send-Pr-Version: 3.2

>Number:         21790
>Category:       kern
>Synopsis:       fstat64 does not exist in Linux emulation mode
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    marcel
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 06 13:30:01 PDT 2000
>Closed-Date:    Sat Sep 8 12:11:35 PDT 2001
>Last-Modified:  Sat Sep 08 12:13:15 PDT 2001
>Originator:     Jim Pirzyk
>Release:        FreeBSD 4.1-RELEASE i386
>Organization:
>Environment:

	FreeBSD 4.1 with Linux emulation and Linux LSF binaries

>Description:

	The LSF commands use fstat64 from the linux kernel and the Linux
	emulation mode does not implement fstat64.

Oct  6 08:50:52 <kern.crit> snoopy /kernel: linux: syscall fstat64 is obsoleted or not implemented (pid=272)
Oct  6 08:50:52 <kern.crit> snoopy /kernel: linux: syscall fstat64 is obsoleted or not implemented (pid=276)
Oct  6 08:50:55 <kern.crit> snoopy /kernel: linux: syscall fstat64 is obsoleted or not implemented (pid=295)
Oct  6 08:51:04 <kern.crit> snoopy /kernel: linux: syscall fstat64 is obsoleted or not implemented (pid=332)
Oct  6 12:13:36 <kern.crit> snoopy /kernel: linux: syscall fstat64 is obsoleted or not implemented (pid=4487)


>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->marcel 
Responsible-Changed-By: dwmalone 
Responsible-Changed-When: Sat Oct 7 09:14:11 PDT 2000 
Responsible-Changed-Why:  
Marcel usually looks after linuxulator stuff. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=21790 

From: Jim Pirzyk <Jim.Pirzyk@disney.com>
To: freebsd-gnats-submit@FreeBSD.org, Jim.Pirzyk@disney.com
Cc:  
Subject: Re: kern/21790: fstat64 does not exist in Linux emulation mode
Date: Wed, 11 Oct 2000 10:00:28 -0700

 This is a multi-part message in MIME format.
 --------------FCC9278B6B9B8C4BD3E680F4
 Content-Type: text/plain; charset=us-ascii
 Content-Transfer-Encoding: 7bit
 
 Found a patch for fstat64 on the freebsd-emulation discussion group.
 Cleaned it up for FBSD 4.1 (it was for 4.0) and here it is:
 
 
 -- 
 --- @(#) $Id: dot.signature,v 1.9 2000/07/10 16:43:05 pirzyk Exp $
     __o   Jim.Pirzyk@disney.com -------------------------------------
  _'\<,_   Senior Systems Engineer, Walt Disney Feature Animation 
 (*)/ (*)
 --------------FCC9278B6B9B8C4BD3E680F4
 Content-Type: text/plain; charset=us-ascii;
  name="fstat64.patch"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="fstat64.patch"
 
 *** ./sys/i386/linux/linux_dummy.c.orig	Wed Jul 19 22:31:56 2000
 --- ./sys/i386/linux/linux_dummy.c	Wed Oct 11 09:37:32 2000
 ***************
 *** 25,31 ****
    * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    *
 !  * $FreeBSD: src/sys/i386/linux/linux_dummy.c,v 1.21.2.3 2000/07/20 05:31:56 marcel Exp $
    */
   
   #include <sys/param.h>
 --- 25,31 ----
    * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    *
 !  * $FreeBSD: src/sys/i386/linux/linux_dummy.c,v 1.21 2000/01/29 12:45:35 peter Exp $
    */
   
   #include <sys/param.h>
 ***************
 *** 109,112 ****
   DUMMY(ftruncate64);
   DUMMY(stat64);
   DUMMY(lstat64);
 - DUMMY(fstat64);
 --- 109,111 ----
 *** ./sys/i386/linux/linux_proto.h.orig	Wed Oct 11 09:35:01 2000
 --- ./sys/i386/linux/linux_proto.h	Wed Oct 11 09:36:01 2000
 ***************
 *** 541,547 ****
   	register_t dummy;
   };
   struct	linux_fstat64_args {
 ! 	register_t dummy;
   };
   int	linux_setup __P((struct proc *, struct linux_setup_args *));
   int	linux_fork __P((struct proc *, struct linux_fork_args *));
 --- 541,548 ----
   	register_t dummy;
   };
   struct	linux_fstat64_args {
 ! 	int	fd;	char fd_[PAD_(int)];
 ! 	struct linux_fstat64 *	buf;	char buf_[PAD_(struct linux_fstat64 *)];
   };
   int	linux_setup __P((struct proc *, struct linux_setup_args *));
   int	linux_fork __P((struct proc *, struct linux_fork_args *));
 *** ./sys/i386/linux/linux_stats.c.orig	Thu Jul  6 18:16:52 2000
 --- ./sys/i386/linux/linux_stats.c	Wed Oct 11 09:27:33 2000
 ***************
 *** 25,31 ****
    * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    *
 !  * $FreeBSD: src/sys/i386/linux/linux_stats.c,v 1.20.2.1 2000/07/07 01:16:52 obrien Exp $
    */
   
   #include <sys/param.h>
 --- 25,31 ----
    * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    *
 !  * $FreeBSD: src/sys/i386/linux/linux_stats.c,v 1.20 2000/01/08 21:09:41 marcel Exp $
    */
   
   #include <sys/param.h>
 ***************
 *** 44,49 ****
 --- 44,51 ----
   #include <i386/linux/linux_proto.h>
   #include <i386/linux/linux_util.h>
   
 + #include <vm/vm_zone.h>
 + 
   struct linux_newstat {
   	u_short	stat_dev;
   	u_short	__pad1;
 ***************
 *** 67,72 ****
 --- 69,98 ----
   	u_long	__unused5;
   };
   
 + struct linux_stat64 {
 +         u_short stat_dev;
 +         u_char __pad0[10];
 +         u_long stat_ino;
 +         u_int stat_mode;
 +         u_int stat_nlink;
 +         u_long stat_uid;
 +         u_long stat_gid;
 +         u_short stat_rdev;
 +         u_char __pad3[10];
 +         int64_t stat_size;
 +         u_long stat_blksize;
 +         u_long stat_blocks;
 +         u_long __pad4;
 +         u_long stat_atime;
 +         u_long __pad5;
 +         u_long stat_mtime;
 +         u_long __pad6;
 +         u_long stat_ctime;
 +         u_long __pad7;
 +         u_long __unused1;
 +         u_long __unused2;
 + };
 + 
   struct linux_ustat 
   {
   	int	f_tfree;
 ***************
 *** 97,102 ****
 --- 123,151 ----
   	return (copyout(&tbuf, ubuf, sizeof(tbuf)));
   }
   
 + static int
 + stat64_copyout(struct stat *buf, void *ubuf)
 + {
 +        struct linux_stat64 tbuf;
 + 
 +        bzero(&tbuf, sizeof(tbuf));
 +        tbuf.stat_dev = uminor(buf->st_dev) | (umajor(buf->st_dev) << 8);
 +        tbuf.stat_ino = buf->st_ino;
 +        tbuf.stat_mode = buf->st_mode;
 +        tbuf.stat_nlink = buf->st_nlink;
 +        tbuf.stat_uid = buf->st_uid;
 +        tbuf.stat_gid = buf->st_gid;
 +        tbuf.stat_rdev = buf->st_rdev;
 +        tbuf.stat_size = buf->st_size;
 +        tbuf.stat_atime = buf->st_atime;
 +        tbuf.stat_mtime = buf->st_mtime;
 +        tbuf.stat_ctime = buf->st_ctime;
 +        tbuf.stat_blksize = buf->st_blksize;
 +        tbuf.stat_blocks = buf->st_blocks;
 + 
 +        return (copyout(&tbuf, ubuf, sizeof(tbuf)));
 + }
 + 
   int
   linux_newstat(struct proc *p, struct linux_newstat_args *args)
   {
 ***************
 *** 189,194 ****
 --- 238,268 ----
   		error = newstat_copyout(&buf, args->buf);
   
   	return (error);
 + }
 + 
 + int
 + linux_fstat64(struct proc *p, struct linux_fstat64_args *args)
 + {
 +        struct filedesc *fdp;
 +        struct file *fp;
 +        struct stat buf;
 +        int error;
 + 
 +        fdp = p->p_fd;
 + 
 + #ifdef DEBUG
 +        printf("Linux-emul(%ld): fstat64(%d, *)\n", (long)p->p_pid, args->fd);
 + #endif
 + 
 +        if ((unsigned)args->fd >= fdp->fd_nfiles ||
 +            (fp = fdp->fd_ofiles[args->fd]) == NULL)
 +                return (EBADF);
 + 
 +        error = fo_stat(fp, &buf, p);
 +        if (!error)
 +                error = stat64_copyout(&buf, args->buf);
 + 
 +        return (error);
   }
   
   struct linux_statfs_buf {
 *** ./sys/i386/linux/syscalls.master.orig	Wed Jul 19 14:11:10 2000
 --- ./sys/i386/linux/syscalls.master	Wed Oct 11 09:38:49 2000
 ***************
 *** 1,4 ****
 !  $FreeBSD: src/sys/i386/linux/syscalls.master,v 1.30.2.2 2000/07/19 21:11:10 marcel Exp $
   
   ;	@(#)syscalls.master	8.1 (Berkeley) 7/19/93
   ; System call name/number master file (or rather, slave, from LINUX).
 --- 1,4 ----
 !    $FreeBSD: src/sys/i386/linux/syscalls.master,v 1.30 2000/01/29 12:43:29 peter Exp $
   
   ;	@(#)syscalls.master	8.1 (Berkeley) 7/19/93
   ; System call name/number master file (or rather, slave, from LINUX).
 ***************
 *** 286,289 ****
   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); }
 --- 286,289 ----
   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(int fd, struct stat64 *buf); }
 
 --------------FCC9278B6B9B8C4BD3E680F4--
 
 
State-Changed-From-To: open->closed 
State-Changed-By: marcel 
State-Changed-When: Sat Sep 8 12:11:35 PDT 2001 
State-Changed-Why:  
The stat64 family of syscalls has been implemented in -current and 
will be merged to -stable after a sufficient amount of time. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=21790 
>Unformatted:
