NetBSD Problem Report #7202

Received: (qmail 12466 invoked from network); 20 Mar 1999 09:16:59 -0000
Message-Id: <199903200916.KAA02692@jdolecek.per4mance.cz>
Date: Sat, 20 Mar 1999 10:16:13 +0100 (MET)
From: Jaromir Dolecek <dolecek@ics.muni.cz>
Reply-To: dolecek@ics.muni.cz
To: gnats-bugs@gnats.netbsd.org
Subject: p{read|write}(2) is not emulated for linux binaries
X-Send-Pr-Version: 3.95

>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
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Mar 20 01:20:00 +0000 1999
>Closed-Date:    Tue Mar 23 03:06:34 +0000 1999
>Last-Modified:  Tue Mar 23 03:06:48 +0000 1999
>Originator:     Jaromir Dolecek
>Release:        NetBSD-19990226 or so
>Organization:
	Per4mance, Brno, Czech Republic
>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); }
>Release-Note:
>Audit-Trail:

From: Giles Lean <giles@nemeton.com.au>
To: dolecek@ics.muni.cz
Cc: gnats-bugs@gnats.netbsd.org
Subject: Re: kern/7202: p{read|write}(2) is not emulated for linux binaries 
Date: Sun, 21 Mar 1999 11:59:30 +1100

 On Sat, 20 Mar 1999 10:16:13 +0100 (MET)  Jaromir Dolecek wrote:

 > 	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.

 I downloaded the 2.2 kernel source and looked.  fs/read_write.c has:

 asmlinkage ssize_t sys_pread(unsigned int fd, char * buf,
 			     size_t count, loff_t pos)
 {
 	...
 }

 Rummaging around the #include files shows that loff_t is 'long long'
 at least on i386, so I think using our native i386 off_t is correct.

 Regards,

 Giles

State-Changed-From-To: open->closed 
State-Changed-By: thorpej 
State-Changed-When: Mon Mar 22 19:06:34 PST 1999 
State-Changed-Why:  
Fixed! 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.