From owner-p4-projects Wed Jun 19 22:37:51 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 15BDE37B40D; Wed, 19 Jun 2002 22:37:26 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id F24D737B409 for ; Wed, 19 Jun 2002 22:37:24 -0700 (PDT) Received: (from perforce@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g5K5bOr92302 for perforce@freebsd.org; Wed, 19 Jun 2002 22:37:24 -0700 (PDT) (envelope-from peter@freebsd.org) Date: Wed, 19 Jun 2002 22:37:24 -0700 (PDT) Message-Id: <200206200537.g5K5bOr92302@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to peter@freebsd.org using -f From: Peter Wemm Subject: PERFORCE change 13187 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://people.freebsd.org/~peter/p4db/chv.cgi?CH=13187 Change 13187 by peter@peter_ia64 on 2002/06/19 22:37:19 Do the pread/pwrite emulation treatment on lseek/truncate/ ftruncate/sendfile. sendfile isn't complete - it copyin/out's an off_t through a pointer. lseek() requires special treatment to expand the retval since register_t *td_retval is different on x86 and ia64. p4's internal diff now works again. (yay!) Affected files ... ... //depot/projects/ia64/sys/ia64/ia32/ia32_misc.c#4 edit ... //depot/projects/ia64/sys/ia64/ia32/ia32_proto.h#3 edit ... //depot/projects/ia64/sys/ia64/ia32/ia32_syscall.h#4 edit ... //depot/projects/ia64/sys/ia64/ia32/ia32_sysent.c#4 edit ... //depot/projects/ia64/sys/ia64/ia32/syscalls.master#4 edit Differences ... ==== //depot/projects/ia64/sys/ia64/ia32/ia32_misc.c#4 (text+ko) ==== @@ -1039,6 +1039,63 @@ return (pwrite(td, &ap)); } +int +ia32_lseek(struct thread *td, struct ia32_lseek_args *uap) +{ + int error; + struct lseek_args ap; + off_t pos; + + SCARG(&ap, fd) = SCARG(uap, fd); + SCARG(&ap, offset) = (SCARG(uap, offsetlo) + | ((off_t)SCARG(uap, offsethi) << 32)); + SCARG(&ap, whence) = SCARG(uap, whence); + error = lseek(td, &ap); + /* Expand the quad return into two parts for eax and edx */ + pos = *(off_t *)(td->td_retval); + td->td_retval[0] = pos & 0xffffffff; /* %eax */ + td->td_retval[1] = pos >> 32; /* %edx */ + return error; +} + +int +ia32_truncate(struct thread *td, struct ia32_truncate_args *uap) +{ + struct truncate_args ap; + + SCARG(&ap, path) = SCARG(uap, path); + SCARG(&ap, length) = (SCARG(uap, lengthlo) + | ((off_t)SCARG(uap, lengthhi) << 32)); + return (truncate(td, &ap)); +} + +int +ia32_ftruncate(struct thread *td, struct ia32_ftruncate_args *uap) +{ + struct ftruncate_args ap; + + SCARG(&ap, fd) = SCARG(uap, fd); + SCARG(&ap, length) = (SCARG(uap, lengthlo) + | ((off_t)SCARG(uap, lengthhi) << 32)); + return (ftruncate(td, &ap)); +} + +int +ia32_sendfile(struct thread *td, struct ia32_sendfile_args *uap) +{ + struct sendfile_args ap; + + SCARG(&ap, fd) = SCARG(uap, fd); + SCARG(&ap, s) = SCARG(uap, s); + SCARG(&ap, offset) = (SCARG(uap, offsetlo) + | ((off_t)SCARG(uap, offsethi) << 32)); + SCARG(&ap, nbytes) = SCARG(uap, nbytes); /* XXX check */ + SCARG(&ap, hdtr) = SCARG(uap, hdtr); /* XXX check */ + SCARG(&ap, sbytes) = SCARG(uap, sbytes); /* XXX FIXME!! */ + SCARG(&ap, flags) = SCARG(uap, flags); + return (sendfile(td, &ap)); +} + struct stat32 { udev_t st_dev; ino_t st_ino; ==== //depot/projects/ia64/sys/ia64/ia32/ia32_proto.h#3 (text+ko) ==== @@ -170,6 +170,25 @@ char poslo_l_[PADL_(u_int32_t)]; u_int32_t poslo; char poslo_r_[PADR_(u_int32_t)]; char poshi_l_[PADL_(u_int32_t)]; u_int32_t poshi; char poshi_r_[PADR_(u_int32_t)]; }; +struct ia32_lseek_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)]; + char offsetlo_l_[PADL_(u_int32_t)]; u_int32_t offsetlo; char offsetlo_r_[PADR_(u_int32_t)]; + char offsethi_l_[PADL_(u_int32_t)]; u_int32_t offsethi; char offsethi_r_[PADR_(u_int32_t)]; + char whence_l_[PADL_(int)]; int whence; char whence_r_[PADR_(int)]; +}; +struct ia32_truncate_args { + char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; + char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)]; + char lengthlo_l_[PADL_(u_int32_t)]; u_int32_t lengthlo; char lengthlo_r_[PADR_(u_int32_t)]; + char lengthhi_l_[PADL_(u_int32_t)]; u_int32_t lengthhi; char lengthhi_r_[PADR_(u_int32_t)]; +}; +struct ia32_ftruncate_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char pad_l_[PADL_(int)]; int pad; char pad_r_[PADR_(int)]; + char lengthlo_l_[PADL_(u_int32_t)]; u_int32_t lengthlo; char lengthlo_r_[PADR_(u_int32_t)]; + char lengthhi_l_[PADL_(u_int32_t)]; u_int32_t lengthhi; char lengthhi_r_[PADR_(u_int32_t)]; +}; struct ia32_sysctl_args { char name_l_[PADL_(int *)]; int * name; char name_r_[PADR_(int *)]; char namelen_l_[PADL_(u_int)]; u_int namelen; char namelen_r_[PADR_(u_int)]; @@ -178,6 +197,16 @@ char new_l_[PADL_(void *)]; void * new; char new_r_[PADR_(void *)]; char newlen_l_[PADL_(u_int32_t)]; u_int32_t newlen; char newlen_r_[PADR_(u_int32_t)]; }; +struct ia32_sendfile_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)]; + char offsetlo_l_[PADL_(u_int32_t)]; u_int32_t offsetlo; char offsetlo_r_[PADR_(u_int32_t)]; + char offsethi_l_[PADL_(u_int32_t)]; u_int32_t offsethi; char offsethi_r_[PADR_(u_int32_t)]; + char nbytes_l_[PADL_(size_t)]; size_t nbytes; char nbytes_r_[PADR_(size_t)]; + char hdtr_l_[PADL_(struct sf_hdtr *)]; struct sf_hdtr * hdtr; char hdtr_r_[PADR_(struct sf_hdtr *)]; + char sbytes_l_[PADL_(off_t *)]; off_t * sbytes; char sbytes_r_[PADR_(off_t *)]; + char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; +}; struct ia32_sigaction_args { char sig_l_[PADL_(int)]; int sig; char sig_r_[PADR_(int)]; char act_l_[PADL_(struct sigaction32 *)]; struct sigaction32 * act; char act_r_[PADR_(struct sigaction32 *)]; @@ -210,7 +239,11 @@ int ia32_fstat(struct thread *, struct ia32_fstat_args *); int ia32_lstat(struct thread *, struct ia32_lstat_args *); int ia32_mmap(struct thread *, struct ia32_mmap_args *); +int ia32_lseek(struct thread *, struct ia32_lseek_args *); +int ia32_truncate(struct thread *, struct ia32_truncate_args *); +int ia32_ftruncate(struct thread *, struct ia32_ftruncate_args *); int ia32_sysctl(struct thread *, struct ia32_sysctl_args *); +int ia32_sendfile(struct thread *, struct ia32_sendfile_args *); int ia32_sigaction(struct thread *, struct ia32_sigaction_args *); #ifdef COMPAT_43 ==== //depot/projects/ia64/sys/ia64/ia32/ia32_syscall.h#4 (text+ko) ==== @@ -127,8 +127,8 @@ #define IA32_SYS_setreuid 126 #define IA32_SYS_setregid 127 #define IA32_SYS_rename 128 -#define IA32_SYS_truncate 129 -#define IA32_SYS_ftruncate 130 + /* 129 is obsolete otruncate */ + /* 130 is obsolete ftruncate */ #define IA32_SYS_flock 131 #define IA32_SYS_mkfifo 132 #define IA32_SYS_sendto 133 @@ -177,9 +177,9 @@ #define IA32_SYS_getdirentries 196 #define IA32_SYS_ia32_mmap 197 #define IA32_SYS___syscall 198 -#define IA32_SYS_lseek 199 -#define IA32_SYS_truncate 200 -#define IA32_SYS_ftruncate 201 +#define IA32_SYS_ia32_lseek 199 +#define IA32_SYS_ia32_truncate 200 +#define IA32_SYS_ia32_ftruncate 201 #define IA32_SYS_ia32_sysctl 202 #define IA32_SYS_mlock 203 #define IA32_SYS_munlock 204 @@ -247,7 +247,7 @@ #define IA32_SYS_sched_get_priority_min 333 #define IA32_SYS_sched_rr_get_interval 334 #define IA32_SYS_utrace 335 -#define IA32_SYS_sendfile 336 +#define IA32_SYS_ia32_sendfile 336 #define IA32_SYS_kldsym 337 #define IA32_SYS_jail 338 #define IA32_SYS_sigprocmask 340 ==== //depot/projects/ia64/sys/ia64/ia32/ia32_sysent.c#4 (text+ko) ==== @@ -146,8 +146,8 @@ { SYF_MPSAFE | AS(setreuid_args), (sy_call_t *)setreuid }, /* 126 = setreuid */ { SYF_MPSAFE | AS(setregid_args), (sy_call_t *)setregid }, /* 127 = setregid */ { AS(rename_args), (sy_call_t *)rename }, /* 128 = rename */ - { AS(truncate_args), (sy_call_t *)truncate }, /* 129 = truncate */ - { AS(ftruncate_args), (sy_call_t *)ftruncate }, /* 130 = ftruncate */ + { 0, (sy_call_t *)nosys }, /* 129 = obsolete otruncate */ + { 0, (sy_call_t *)nosys }, /* 130 = obsolete ftruncate */ { SYF_MPSAFE | AS(flock_args), (sy_call_t *)flock }, /* 131 = flock */ { AS(mkfifo_args), (sy_call_t *)mkfifo }, /* 132 = mkfifo */ { SYF_MPSAFE | AS(sendto_args), (sy_call_t *)sendto }, /* 133 = sendto */ @@ -216,9 +216,9 @@ { AS(getdirentries_args), (sy_call_t *)getdirentries }, /* 196 = getdirentries */ { AS(ia32_mmap_args), (sy_call_t *)ia32_mmap }, /* 197 = ia32_mmap */ { 0, (sy_call_t *)nosys }, /* 198 = __syscall */ - { AS(lseek_args), (sy_call_t *)lseek }, /* 199 = lseek */ - { AS(truncate_args), (sy_call_t *)truncate }, /* 200 = truncate */ - { AS(ftruncate_args), (sy_call_t *)ftruncate }, /* 201 = ftruncate */ + { AS(ia32_lseek_args), (sy_call_t *)ia32_lseek }, /* 199 = ia32_lseek */ + { AS(ia32_truncate_args), (sy_call_t *)ia32_truncate }, /* 200 = ia32_truncate */ + { AS(ia32_ftruncate_args), (sy_call_t *)ia32_ftruncate }, /* 201 = ia32_ftruncate */ { SYF_MPSAFE | AS(ia32_sysctl_args), (sy_call_t *)ia32_sysctl }, /* 202 = ia32_sysctl */ { SYF_MPSAFE | AS(mlock_args), (sy_call_t *)mlock }, /* 203 = mlock */ { SYF_MPSAFE | AS(munlock_args), (sy_call_t *)munlock }, /* 204 = munlock */ @@ -353,7 +353,7 @@ { SYF_MPSAFE | AS(sched_get_priority_min_args), (sy_call_t *)sched_get_priority_min }, /* 333 = sched_get_priority_min */ { SYF_MPSAFE | AS(sched_rr_get_interval_args), (sy_call_t *)sched_rr_get_interval }, /* 334 = sched_rr_get_interval */ { AS(utrace_args), (sy_call_t *)utrace }, /* 335 = utrace */ - { SYF_MPSAFE | AS(sendfile_args), (sy_call_t *)sendfile }, /* 336 = sendfile */ + { SYF_MPSAFE | AS(ia32_sendfile_args), (sy_call_t *)ia32_sendfile }, /* 336 = ia32_sendfile */ { AS(kldsym_args), (sy_call_t *)kldsym }, /* 337 = kldsym */ { SYF_MPSAFE | AS(jail_args), (sy_call_t *)jail }, /* 338 = jail */ { 0, (sy_call_t *)nosys }, /* 339 = pioctl */ ==== //depot/projects/ia64/sys/ia64/ia32/syscalls.master#4 (text+ko) ==== @@ -202,8 +202,8 @@ 126 MNOPROTO BSD { int setreuid(int ruid, int euid); } 127 MNOPROTO BSD { int setregid(int rgid, int egid); } 128 NOPROTO POSIX { int rename(char *from, char *to); } -129 NOPROTO BSD { int truncate(char *path, long length); } -130 NOPROTO BSD { int ftruncate(int fd, long length); } +129 OBSOL BSD otruncate +130 OBSOL BSD ftruncate 131 MNOPROTO BSD { int flock(int fd, int how); } 132 NOPROTO POSIX { int mkfifo(char *path, int mode); } 133 MNOPROTO BSD { int sendto(int s, caddr_t buf, size_t len, \ @@ -301,10 +301,16 @@ int prot, int flags, int fd, int pad, \ u_int32_t poslo, u_int32_t poshi); } 198 NOPROTO NOHIDE { int nosys(void); } __syscall __syscall_args int -199 NOPROTO POSIX { off_t lseek(int fd, int pad, off_t offset, \ +; XXX note - bigendian is different +199 STD POSIX { off_t ia32_lseek(int fd, int pad, \ + u_int32_t offsetlo, u_int32_t offsethi, \ int whence); } -200 NOPROTO BSD { int truncate(char *path, int pad, off_t length); } -201 NOPROTO BSD { int ftruncate(int fd, int pad, off_t length); } +; XXX note - bigendian is different +200 STD BSD { int ia32_truncate(char *path, int pad, \ + u_int32_t lengthlo, u_int32_t lengthhi); } +; XXX note - bigendian is different +201 STD BSD { int ia32_ftruncate(int fd, int pad, \ + u_int32_t lengthlo, u_int32_t lengthhi); } 202 MSTD BSD { int ia32_sysctl(int *name, u_int namelen, \ void *old, u_int32_t *oldlenp, void *new, \ u_int32_t newlen); } @@ -468,8 +474,10 @@ 333 MNOPROTO POSIX { int sched_get_priority_min (int policy); } 334 MNOPROTO POSIX { int sched_rr_get_interval (pid_t pid, struct timespec *interval); } 335 NOPROTO BSD { int utrace(const void *addr, size_t len); } -336 MNOPROTO BSD { int sendfile(int fd, int s, off_t offset, size_t nbytes, \ - struct sf_hdtr *hdtr, off_t *sbytes, int flags); } +; XXX note - bigendian is different +336 MSTD BSD { int ia32_sendfile(int fd, int s, u_int32_t offsetlo, \ + u_int32_t offsethi, size_t nbytes, \ + struct sf_hdtr *hdtr, off_t *sbytes, int flags); } 337 NOPROTO BSD { int kldsym(int fileid, int cmd, void *data); } 338 MNOPROTO BSD { int jail(struct jail *jail); } 339 UNIMPL BSD pioctl To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message