Subject: kern/7202: p{read|write}(2) is not emulated for linux binaries
To: None <gnats-bugs@gnats.netbsd.org>
From: Jaromir Dolecek <dolecek@ics.muni.cz>
List: netbsd-bugs
Date: 03/20/1999 10:16:13
>Number:         7202
>Category:       kern
>Synopsis:       p{read|write}(2) is not emulated for linux binaries
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Mar 20 01:20:00 1999
>Last-Modified:
>Originator:     Jaromir Dolecek
>Organization:
	Per4mance, Brno, Czech Republic
>Release:        NetBSD-19990226 or so
>Environment:
	
System: NetBSD jdolecek.per4mance.cz 1.3I NetBSD 1.3I (JDOLECEK) #7: Thu Mar 11 18:33:22 MET 1999 dolecek@jdolecek.per4mance.cz:/home/dolecek/tmp/src/sys/arch/i386/compile/JDOLECEK i386


>Description:
	pread(2) and pwrite(2) system calls appeared in recent Linux
	systems. They are not supported under NetBSD Linux emulation though,
	they are marked as unimplemented. As we have native
	pread(2), pwrite(2), "implementation" of the Linux counterparts
	is just mastter of calling sys_pread() or sys_pwrite() respectively.
>How-To-Repeat:
	read the source
>Fix:
	Jason Thorpe pointed out it's not sure Linux uses 64bit off_t.
	I can't check if it does, I don't have any machine running
	any recent Linux handy. I recall seeing a message "Linux has
	64bit filesystem" message somewhere some time ago, so I suppose
	they DO have 64 bit off_t.
	Anyway, here is the patch:

--- compat/linux/arch/alpha/syscalls.master.orig	Sat Mar 20 09:35:03 1999
+++ compat/linux/arch/alpha/syscalls.master	Sat Mar 20 09:36:17 1999
@@ -503,8 +503,10 @@
 346	UNIMPL		pciconfig_write
 347	UNIMPL		query_module
 348	UNIMPL		prctl
-349	UNIMPL		pread
-350	UNIMPL		pwrite
+349	NOARGS		{ int sys_pread(int fd, char *buf, size_t nbytes, \
+			    off_t offset); }
+350	NOARGS		{ int sys_pwrite(int fd, char *buf, size_t nbytes, \
+			    off_t offset); }
 351	STD		{ int linux_sys_rt_sigreturn( \
 				struct linux_rt_sigframe *sfp); }
 352	STD		{ int linux_sys_rt_sigaction(int signum, \
--- compat/linux/arch/i386/syscalls.master.orig	Tue Mar 16 18:13:36 1999
+++ compat/linux/arch/i386/syscalls.master	Tue Mar 16 18:17:32 1999
@@ -287,8 +287,10 @@
 			    void *uinfo); }
 179	STD		{ int linux_sys_rt_sigsuspend(linux_sigset_t *unewset, \
 			    size_t sigsetsize); }
-180	UNIMPL		pread
-181	UNIMPL		pwrite
+180	NOARGS		{ int sys_pread(int fd, char *buf, size_t nbytes, \
+			    off_t offset); }
+181	NOARGS		{ int sys_pwrite(int fd, char *buf, size_t nbytes, \
+			    off_t offset); }
 182	STD		{ int linux_sys_chown(const char *path, int uid, \
 			    int gid); }
 183	UNIMPL		getcwd
--- compat/linux/arch/m68k/syscalls.master.orig	Wed Feb 10 13:20:33 1999
+++ compat/linux/arch/m68k/syscalls.master	Sat Mar 20 09:37:34 1999
@@ -312,8 +312,10 @@
 			    void *uinfo); }
 179	STD		{ int linux_sys_rt_sigsuspend(linux_sigset_t *unewset, \
 			    size_t sigsetsize); }
-180	UNIMPL		pread
-181	UNIMPL		pwrite
+180	NOARGS		{ int sys_pread(int fd, char *buf, size_t nbytes, \
+			    off_t offset); }
+181	NOARGS		{ int sys_pwrite(int fd, char *buf, size_t nbytes, \
+			    off_t offset); }
 ;182 chown on i386; lchown on m68k.
 182	STD		{ int linux_sys_lchown(const char *path, int uid, \
 			    int gid); }
>Audit-Trail:
>Unformatted: