From geoff@caribbean.sea-incorporated.com  Thu Apr 13 13:20:06 2000
Return-Path: <geoff@caribbean.sea-incorporated.com>
Received: from caribbean.sea-incorporated.com (caribbean.sea-incorporated.com [209.74.10.130])
	by hub.freebsd.org (Postfix) with ESMTP id 3286B37B95B
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 13 Apr 2000 13:20:05 -0700 (PDT)
	(envelope-from geoff@caribbean.sea-incorporated.com)
Received: (from geoff@localhost)
	by caribbean.sea-incorporated.com (8.9.3/8.9.3) id PAA57090;
	Thu, 13 Apr 2000 15:54:02 -0400 (EDT)
	(envelope-from geoff)
Message-Id: <200004131954.PAA57090@caribbean.sea-incorporated.com>
Date: Thu, 13 Apr 2000 15:54:02 -0400 (EDT)
From: "Geoffrey C. Speicher" <geoff@caribbean.sea-incorporated.com>
Reply-To: geoff@caribbean.sea-incorporated.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: linux module doesn't implement pread/pwrite
X-Send-Pr-Version: 3.2

>Number:         17991
>Category:       i386
>Synopsis:       linux module doesn't implement pread/pwrite
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    marcel
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Apr 13 13:30:01 PDT 2000
>Closed-Date:    Sun Jul 16 17:18:21 PDT 2000
>Last-Modified:  Sun Jul 16 17:20:09 PDT 2000
>Originator:     Geoffrey C. Speicher
>Release:        FreeBSD 3.2-RELEASE i386
>Organization:
Software Engineering Associates, Inc.
>Environment:

	FreeBSD baltic.sea-incorporated.com 4.0-STABLE FreeBSD 4.0-STABLE #2: Wed Apr 12 14:22:44 GMT 2000
	geoff@baltic.sea-incorporated.com:/usr/src/sys/compile/GENERIC  i386


>Description:

	The Linux module doesn't implement pread/pwrite syscalls, which are now
	required by glibc and the new InterBase 6.0 beta kit for Linux.

>How-To-Repeat:

	N/A

>Fix:
	
	Apply following patches to files in /usr/src/sys/i386/linux/ then
	make linux_sysent.c and rebuild Linux module:

*** /usr/src/sys/i386/linux/linux_dummy.c.orig	Wed Apr 12 10:00:43 2000
--- /usr/src/sys/i386/linux/linux_dummy.c	Wed Apr 12 10:00:59 2000
***************
*** 98,105 ****
  DUMMY(rt_sigpending);
  DUMMY(rt_sigtimedwait);
  DUMMY(rt_sigqueueinfo);
- DUMMY(pread);
- DUMMY(pwrite);
  DUMMY(capget);
  DUMMY(capset);
  DUMMY(sendfile);
--- 98,103 ----


*** /usr/src/sys/i386/linux/linux_file.c.orig	Wed Apr 12 16:53:09 2000
--- /usr/src/sys/i386/linux/linux_file.c	Wed Apr 12 17:09:44 2000
***************
*** 891,893 ****
--- 891,930 ----
  	bsd.fd = uap->fd;
  	return fsync(p, &bsd);
  }
+ 
+ int
+ linux_pread(struct proc *p, struct linux_pread_args *args)
+ {
+ 	struct pread_args /* {
+ 	    int     fd;
+ 	    void    *buf;
+ 	    size_t  nbyte;
+ 	    int     pad;
+ 	    off_t   offset;
+ 	} */ bsd;
+ 
+ 	bsd.fd = args->d;
+ 	bsd.buf = args->buf;
+ 	bsd.nbyte = args->nbytes;
+ 	bsd.offset = args->offset;
+ 	return pread(p, &bsd);
+ }
+ 
+ int
+ linux_pwrite(struct proc *p, struct linux_pwrite_args *args)
+ {
+ 	struct pwrite_args /* {
+ 	    int     fd;
+ 	    const void *buf;
+ 	    size_t  nbyte;
+ 	    int     pad;
+ 	    off_t   offset;
+ 	} */ bsd;
+ 
+ 	bsd.fd = args->d;
+ 	bsd.buf = args->buf;
+ 	bsd.nbyte = args->nbytes;
+ 	bsd.offset = args->offset;
+ 	return pwrite(p, &bsd);
+ }
+ 



*** /usr/src/sys/i386/linux/syscalls.master.orig	Wed Apr 12 09:58:26 2000
--- /usr/src/sys/i386/linux/syscalls.master	Wed Apr 12 16:52:34 2000
***************
*** 265,272 ****
  178	STD	LINUX	{ int linux_rt_sigqueueinfo(void); }
  179	STD	LINUX	{ int linux_rt_sigsuspend(linux_sigset_t *newset, \
  				size_t sigsetsize); }
! 180	STD	LINUX	{ int linux_pread(void); }
! 181	STD	LINUX	{ int linux_pwrite(void); }
  182	STD	LINUX	{ int linux_chown(char *path, int uid, int gid); }
  183	STD	LINUX	{ int linux_getcwd(char *buf, unsigned long bufsize); }
  184	STD	LINUX	{ int linux_capget(void); }
--- 265,274 ----
  178	STD	LINUX	{ int linux_rt_sigqueueinfo(void); }
  179	STD	LINUX	{ int linux_rt_sigsuspend(linux_sigset_t *newset, \
  				size_t sigsetsize); }
! 180	STD	LINUX	{ int linux_pread(int d, char *buf, \
! 				u_int nbytes, off_t offset); }
! 181	STD	LINUX	{ int linux_pwrite(int d, const char *buf, \
! 				u_int nbytes, off_t offset); }
  182	STD	LINUX	{ int linux_chown(char *path, int uid, int gid); }
  183	STD	LINUX	{ int linux_getcwd(char *buf, unsigned long bufsize); }
  184	STD	LINUX	{ int linux_capget(void); }


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->marcel 
Responsible-Changed-By: wilko 
Responsible-Changed-When: Thu Apr 20 14:58:43 PDT 2000 
Responsible-Changed-Why:  
marcel is mr Linuxulator these days 

State-Changed-From-To: open->closed 
State-Changed-By: marcel 
State-Changed-When: Sun Jul 16 17:18:21 PDT 2000 
State-Changed-Why:  
Implemented. A MFC normally takes a couple of days. Thanks... 

http://www.freebsd.org/cgi/query-pr.cgi?pr=17991 
>Unformatted:
