Date: Thu, 12 Apr 2007 18:46:07 GMT From: Peter Wemm <peter@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 117972 for review Message-ID: <200704121846.l3CIk7qi082088@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=117972 Change 117972 by peter@peter_overcee on 2007/04/12 18:45:43 Add pad-free syscall stubs. For now, they just wrap the old syscalls but with the reformatted args. Doing it this way avoids breaking libc. See lib/libc/sys/mmap.c for an example of why the old way sucks. It turns a 6 arg syscall (which is an abi-compliant 6-arg max regparm call) into a bogus 8-arg syscall (which is not abi-compliant for syscalls). Args spill over onto the stack. Affected files ... .. //depot/projects/hammer/sys/compat/freebsd32/freebsd32_misc.c#45 edit .. //depot/projects/hammer/sys/compat/freebsd32/freebsd32_proto.h#45 edit .. //depot/projects/hammer/sys/compat/freebsd32/freebsd32_syscall.h#42 edit .. //depot/projects/hammer/sys/compat/freebsd32/freebsd32_syscalls.c#42 edit .. //depot/projects/hammer/sys/compat/freebsd32/freebsd32_sysent.c#42 edit .. //depot/projects/hammer/sys/compat/freebsd32/syscalls.master#46 edit .. //depot/projects/hammer/sys/kern/init_sysent.c#58 edit .. //depot/projects/hammer/sys/kern/sys_generic.c#30 edit .. //depot/projects/hammer/sys/kern/syscalls.c#56 edit .. //depot/projects/hammer/sys/kern/syscalls.master#57 edit .. //depot/projects/hammer/sys/kern/systrace_args.c#2 edit .. //depot/projects/hammer/sys/kern/vfs_syscalls.c#65 edit .. //depot/projects/hammer/sys/sys/syscall.h#55 edit .. //depot/projects/hammer/sys/sys/syscall.mk#55 edit .. //depot/projects/hammer/sys/sys/sysproto.h#56 edit .. //depot/projects/hammer/sys/vm/vm_mmap.c#40 edit Differences ... ==== //depot/projects/hammer/sys/compat/freebsd32/freebsd32_misc.c#45 (text+ko) ==== @@ -483,6 +483,22 @@ return (mmap(td, &ap)); } +int +freebsd32_new_mmap(struct thread *td, struct freebsd32_new_mmap_args *uap) +{ + struct freebsd32_mmap_args ap; + + ap.addr = uap->addr; + ap.len = uap->len; + ap.prot = uap->prot; + ap.flags = uap->flags; + ap.fd = uap->fd; + ap.poslo = uap->poslo; + ap.poshi = uap->poshi; + + return (freebsd32_mmap(td, &ap)); +} + struct itimerval32 { struct timeval32 it_interval; struct timeval32 it_value; @@ -1624,6 +1640,69 @@ return (ftruncate(td, &ap)); } +/* versions without the 'int pad' argument */ +int +freebsd32_new_pread(struct thread *td, struct freebsd32_new_pread_args *uap) +{ + struct pread_args ap; + + ap.fd = uap->fd; + ap.buf = uap->buf; + ap.nbyte = uap->nbyte; + ap.offset = (uap->offsetlo | ((off_t)uap->offsethi << 32)); + return (pread(td, &ap)); +} + +int +freebsd32_new_pwrite(struct thread *td, struct freebsd32_new_pwrite_args *uap) +{ + struct pwrite_args ap; + + ap.fd = uap->fd; + ap.buf = uap->buf; + ap.nbyte = uap->nbyte; + ap.offset = (uap->offsetlo | ((off_t)uap->offsethi << 32)); + return (pwrite(td, &ap)); +} + +int +freebsd32_new_lseek(struct thread *td, struct freebsd32_new_lseek_args *uap) +{ + int error; + struct lseek_args ap; + off_t pos; + + ap.fd = uap->fd; + ap.offset = (uap->offsetlo | ((off_t)uap->offsethi << 32)); + ap.whence = 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 +freebsd32_new_truncate(struct thread *td, struct freebsd32_new_truncate_args *uap) +{ + struct truncate_args ap; + + ap.path = uap->path; + ap.length = (uap->lengthlo | ((off_t)uap->lengthhi << 32)); + return (truncate(td, &ap)); +} + +int +freebsd32_new_ftruncate(struct thread *td, struct freebsd32_new_ftruncate_args *uap) +{ + struct ftruncate_args ap; + + ap.fd = uap->fd; + ap.length = (uap->lengthlo | ((off_t)uap->lengthhi << 32)); + return (ftruncate(td, &ap)); +} + struct sf_hdtr32 { uint32_t headers; int hdr_cnt; ==== //depot/projects/hammer/sys/compat/freebsd32/freebsd32_proto.h#45 (text+ko) ==== @@ -2,7 +2,7 @@ * System call prototypes. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/compat/freebsd32/freebsd32_proto.h,v 1.76 2006/12/20 19:39:10 jkim Exp $ + * $FreeBSD$ * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.88 2006/12/20 19:36:03 jkim Exp */ @@ -322,6 +322,45 @@ char param_l_[PADL_(struct thr_param32 *)]; struct thr_param32 * param; char param_r_[PADR_(struct thr_param32 *)]; char param_size_l_[PADL_(int)]; int param_size; char param_size_r_[PADR_(int)]; }; +struct freebsd32_new_pread_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char buf_l_[PADL_(void *)]; void * buf; char buf_r_[PADR_(void *)]; + char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)]; + 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)]; +}; +struct freebsd32_new_pwrite_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char buf_l_[PADL_(const void *)]; const void * buf; char buf_r_[PADR_(const void *)]; + char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)]; + 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)]; +}; +struct freebsd32_new_mmap_args { + char addr_l_[PADL_(caddr_t)]; caddr_t addr; char addr_r_[PADR_(caddr_t)]; + char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; + char prot_l_[PADL_(int)]; int prot; char prot_r_[PADR_(int)]; + char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + 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 freebsd32_new_lseek_args { + char fd_l_[PADL_(int)]; int fd; char fd_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 freebsd32_new_truncate_args { + char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; + 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 freebsd32_new_ftruncate_args { + char fd_l_[PADL_(int)]; int fd; char fd_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)]; +}; int freebsd32_wait4(struct thread *, struct freebsd32_wait4_args *); int freebsd32_recvmsg(struct thread *, struct freebsd32_recvmsg_args *); int freebsd32_sendmsg(struct thread *, struct freebsd32_sendmsg_args *); @@ -377,6 +416,12 @@ int freebsd32_thr_suspend(struct thread *, struct freebsd32_thr_suspend_args *); int freebsd32_umtx_op(struct thread *, struct freebsd32_umtx_op_args *); int freebsd32_thr_new(struct thread *, struct freebsd32_thr_new_args *); +int freebsd32_new_pread(struct thread *, struct freebsd32_new_pread_args *); +int freebsd32_new_pwrite(struct thread *, struct freebsd32_new_pwrite_args *); +int freebsd32_new_mmap(struct thread *, struct freebsd32_new_mmap_args *); +int freebsd32_new_lseek(struct thread *, struct freebsd32_new_lseek_args *); +int freebsd32_new_truncate(struct thread *, struct freebsd32_new_truncate_args *); +int freebsd32_new_ftruncate(struct thread *, struct freebsd32_new_ftruncate_args *); #ifdef COMPAT_43 @@ -521,6 +566,12 @@ #define FREEBSD32_SYS_AUE_freebsd32_thr_suspend AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_umtx_op AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_thr_new AUE_NULL +#define FREEBSD32_SYS_AUE_freebsd32_new_pread AUE_PREAD +#define FREEBSD32_SYS_AUE_freebsd32_new_pwrite AUE_PWRITE +#define FREEBSD32_SYS_AUE_freebsd32_new_mmap AUE_MMAP +#define FREEBSD32_SYS_AUE_freebsd32_new_lseek AUE_LSEEK +#define FREEBSD32_SYS_AUE_freebsd32_new_truncate AUE_TRUNCATE +#define FREEBSD32_SYS_AUE_freebsd32_new_ftruncate AUE_FTRUNCATE #undef PAD_ #undef PADL_ ==== //depot/projects/hammer/sys/compat/freebsd32/freebsd32_syscall.h#42 (text+ko) ==== @@ -2,7 +2,7 @@ * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/compat/freebsd32/freebsd32_syscall.h,v 1.74 2006/12/20 19:39:10 jkim Exp $ + * $FreeBSD$ * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.88 2006/12/20 19:36:03 jkim Exp */ @@ -331,4 +331,10 @@ #define FREEBSD32_SYS_sctp_generic_sendmsg 472 #define FREEBSD32_SYS_sctp_generic_sendmsg_iov 473 #define FREEBSD32_SYS_sctp_generic_recvmsg 474 -#define FREEBSD32_SYS_MAXSYSCALL 475 +#define FREEBSD32_SYS_freebsd32_new_pread 475 +#define FREEBSD32_SYS_freebsd32_new_pwrite 476 +#define FREEBSD32_SYS_freebsd32_new_mmap 477 +#define FREEBSD32_SYS_freebsd32_new_lseek 478 +#define FREEBSD32_SYS_freebsd32_new_truncate 479 +#define FREEBSD32_SYS_freebsd32_new_ftruncate 480 +#define FREEBSD32_SYS_MAXSYSCALL 481 ==== //depot/projects/hammer/sys/compat/freebsd32/freebsd32_syscalls.c#42 (text+ko) ==== @@ -2,7 +2,7 @@ * System call names. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/compat/freebsd32/freebsd32_syscalls.c,v 1.65 2006/12/20 19:39:10 jkim Exp $ + * $FreeBSD$ * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.88 2006/12/20 19:36:03 jkim Exp */ @@ -482,4 +482,10 @@ "sctp_generic_sendmsg", /* 472 = sctp_generic_sendmsg */ "sctp_generic_sendmsg_iov", /* 473 = sctp_generic_sendmsg_iov */ "sctp_generic_recvmsg", /* 474 = sctp_generic_recvmsg */ + "freebsd32_new_pread", /* 475 = freebsd32_new_pread */ + "freebsd32_new_pwrite", /* 476 = freebsd32_new_pwrite */ + "freebsd32_new_mmap", /* 477 = freebsd32_new_mmap */ + "freebsd32_new_lseek", /* 478 = freebsd32_new_lseek */ + "freebsd32_new_truncate", /* 479 = freebsd32_new_truncate */ + "freebsd32_new_ftruncate", /* 480 = freebsd32_new_ftruncate */ }; ==== //depot/projects/hammer/sys/compat/freebsd32/freebsd32_sysent.c#42 (text+ko) ==== @@ -2,7 +2,7 @@ * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/compat/freebsd32/freebsd32_sysent.c,v 1.75 2006/12/20 19:39:10 jkim Exp $ + * $FreeBSD$ * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.88 2006/12/20 19:36:03 jkim Exp */ @@ -507,4 +507,10 @@ { AS(sctp_generic_sendmsg_args), (sy_call_t *)sctp_generic_sendmsg, AUE_NULL, NULL, 0, 0 }, /* 472 = sctp_generic_sendmsg */ { AS(sctp_generic_sendmsg_iov_args), (sy_call_t *)sctp_generic_sendmsg_iov, AUE_NULL, NULL, 0, 0 }, /* 473 = sctp_generic_sendmsg_iov */ { AS(sctp_generic_recvmsg_args), (sy_call_t *)sctp_generic_recvmsg, AUE_NULL, NULL, 0, 0 }, /* 474 = sctp_generic_recvmsg */ + { AS(freebsd32_new_pread_args), (sy_call_t *)freebsd32_new_pread, AUE_PREAD, NULL, 0, 0 }, /* 475 = freebsd32_new_pread */ + { AS(freebsd32_new_pwrite_args), (sy_call_t *)freebsd32_new_pwrite, AUE_PWRITE, NULL, 0, 0 }, /* 476 = freebsd32_new_pwrite */ + { AS(freebsd32_new_mmap_args), (sy_call_t *)freebsd32_new_mmap, AUE_MMAP, NULL, 0, 0 }, /* 477 = freebsd32_new_mmap */ + { AS(freebsd32_new_lseek_args), (sy_call_t *)freebsd32_new_lseek, AUE_LSEEK, NULL, 0, 0 }, /* 478 = freebsd32_new_lseek */ + { AS(freebsd32_new_truncate_args), (sy_call_t *)freebsd32_new_truncate, AUE_TRUNCATE, NULL, 0, 0 }, /* 479 = freebsd32_new_truncate */ + { AS(freebsd32_new_ftruncate_args), (sy_call_t *)freebsd32_new_ftruncate, AUE_FTRUNCATE, NULL, 0, 0 }, /* 480 = freebsd32_new_ftruncate */ }; ==== //depot/projects/hammer/sys/compat/freebsd32/syscalls.master#46 (text+ko) ==== @@ -781,3 +781,19 @@ 474 AUE_NULL NOPROTO { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, \ struct sockaddr * from, __socklen_t *fromlenaddr, \ struct sctp_sndrcvinfo *sinfo, int *msg_flags); } +475 AUE_PREAD STD { ssize_t freebsd32_new_pread(int fd, \ + void *buf,size_t nbyte, \ + u_int32_t offsetlo, u_int32_t offsethi); } +476 AUE_PWRITE STD { ssize_t freebsd32_new_pwrite(int fd, \ + const void *buf, size_t nbyte, \ + u_int32_t offsetlo, u_int32_t offsethi); } +477 AUE_MMAP STD { caddr_t freebsd32_new_mmap(caddr_t addr, \ + size_t len, int prot, int flags, int fd, \ + u_int32_t poslo, u_int32_t poshi); } +478 AUE_LSEEK STD { off_t freebsd32_new_lseek(int fd, \ + u_int32_t offsetlo, u_int32_t offsethi, \ + int whence); } +479 AUE_TRUNCATE STD { int freebsd32_new_truncate(char *path, \ + u_int32_t lengthlo, u_int32_t lengthhi); } +480 AUE_FTRUNCATE STD { int freebsd32_new_ftruncate(int fd, \ + u_int32_t lengthlo, u_int32_t lengthhi); } ==== //depot/projects/hammer/sys/kern/init_sysent.c#58 (text+ko) ==== @@ -2,7 +2,7 @@ * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/kern/init_sysent.c,v 1.228 2006/11/11 22:01:25 ru Exp $ + * $FreeBSD$ * created from FreeBSD: src/sys/kern/syscalls.master,v 1.231 2006/11/03 15:23:14 rrs Exp */ @@ -504,4 +504,10 @@ { AS(sctp_generic_sendmsg_args), (sy_call_t *)sctp_generic_sendmsg, AUE_NULL, NULL, 0, 0 }, /* 472 = sctp_generic_sendmsg */ { AS(sctp_generic_sendmsg_iov_args), (sy_call_t *)sctp_generic_sendmsg_iov, AUE_NULL, NULL, 0, 0 }, /* 473 = sctp_generic_sendmsg_iov */ { AS(sctp_generic_recvmsg_args), (sy_call_t *)sctp_generic_recvmsg, AUE_NULL, NULL, 0, 0 }, /* 474 = sctp_generic_recvmsg */ + { AS(_new_pread_args), (sy_call_t *)_new_pread, AUE_PREAD, NULL, 0, 0 }, /* 475 = _new_pread */ + { AS(_new_pwrite_args), (sy_call_t *)_new_pwrite, AUE_PWRITE, NULL, 0, 0 }, /* 476 = _new_pwrite */ + { AS(_new_mmap_args), (sy_call_t *)_new_mmap, AUE_MMAP, NULL, 0, 0 }, /* 477 = _new_mmap */ + { AS(_new_lseek_args), (sy_call_t *)_new_lseek, AUE_LSEEK, NULL, 0, 0 }, /* 478 = _new_lseek */ + { AS(_new_truncate_args), (sy_call_t *)_new_truncate, AUE_TRUNCATE, NULL, 0, 0 }, /* 479 = _new_truncate */ + { AS(_new_ftruncate_args), (sy_call_t *)_new_ftruncate, AUE_FTRUNCATE, NULL, 0, 0 }, /* 480 = _new_ftruncate */ }; ==== //depot/projects/hammer/sys/kern/sys_generic.c#30 (text+ko) ==== @@ -144,6 +144,21 @@ return(error); } +int +_new_pread(td, uap) + struct thread *td; + struct _new_pread_args *uap; +{ + struct pread_args oargs; + + oargs.fd = uap->fd; + oargs.buf = uap->buf; + oargs.nbyte = uap->nbyte; + oargs.pad = 0; + oargs.offset = uap->offset; + return (pread(td, &oargs)); +} + /* * Scatter read system call. */ @@ -339,6 +354,21 @@ return(error); } +int +_new_pwrite(td, uap) + struct thread *td; + struct _new_pwrite_args *uap; +{ + struct pwrite_args oargs; + + oargs.fd = uap->fd; + oargs.buf = uap->buf; + oargs.nbyte = uap->nbyte; + oargs.pad = 0; + oargs.offset = uap->offset; + return (pwrite(td, &oargs)); +} + /* * Gather write system call. */ ==== //depot/projects/hammer/sys/kern/syscalls.c#56 (text+ko) ==== @@ -2,7 +2,7 @@ * System call names. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/kern/syscalls.c,v 1.212 2006/11/11 22:01:25 ru Exp $ + * $FreeBSD$ * created from FreeBSD: src/sys/kern/syscalls.master,v 1.231 2006/11/03 15:23:14 rrs Exp */ @@ -482,4 +482,10 @@ "sctp_generic_sendmsg", /* 472 = sctp_generic_sendmsg */ "sctp_generic_sendmsg_iov", /* 473 = sctp_generic_sendmsg_iov */ "sctp_generic_recvmsg", /* 474 = sctp_generic_recvmsg */ + "_new_pread", /* 475 = _new_pread */ + "_new_pwrite", /* 476 = _new_pwrite */ + "_new_mmap", /* 477 = _new_mmap */ + "_new_lseek", /* 478 = _new_lseek */ + "_new_truncate", /* 479 = _new_truncate */ + "_new_ftruncate", /* 480 = _new_ftruncate */ }; ==== //depot/projects/hammer/sys/kern/syscalls.master#57 (text+ko) ==== @@ -835,5 +835,15 @@ 474 AUE_NULL STD { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, \ struct sockaddr * from, __socklen_t *fromlenaddr, \ struct sctp_sndrcvinfo *sinfo, int *msg_flags); } +475 AUE_PREAD STD { ssize_t _new_pread(int fd, void *buf, \ + size_t nbyte, off_t offset); } +476 AUE_PWRITE STD { ssize_t _new_pwrite(int fd, const void *buf, \ + size_t nbyte, off_t offset); } +477 AUE_MMAP STD { caddr_t _new_mmap(caddr_t addr, size_t len, \ + int prot, int flags, int fd, off_t pos); } +478 AUE_LSEEK STD { off_t _new_lseek(int fd, off_t offset, \ + int whence); } +479 AUE_TRUNCATE STD { int _new_truncate(char *path, off_t length); } +480 AUE_FTRUNCATE STD { int _new_ftruncate(int fd, off_t length); } ; Please copy any additions and changes to the following compatability tables: ; sys/compat/freebsd32/syscalls.master ==== //depot/projects/hammer/sys/kern/systrace_args.c#2 (text+ko) ==== @@ -2,7 +2,7 @@ * System call argument to DTrace register array converstion. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/kern/systrace_args.c,v 1.12 2006/11/11 22:01:25 ru Exp $ + * $FreeBSD$ * This file is part of the DTrace syscall provider. */ @@ -2805,6 +2805,63 @@ *n_args = 7; break; } + /* _new_pread */ + case 475: { + struct _new_pread_args *p = params; + iarg[0] = p->fd; /* int */ + uarg[1] = (intptr_t) p->buf; /* void * */ + uarg[2] = p->nbyte; /* size_t */ + iarg[3] = p->offset; /* off_t */ + *n_args = 4; + break; + } + /* _new_pwrite */ + case 476: { + struct _new_pwrite_args *p = params; + iarg[0] = p->fd; /* int */ + uarg[1] = (intptr_t) p->buf; /* const void * */ + uarg[2] = p->nbyte; /* size_t */ + iarg[3] = p->offset; /* off_t */ + *n_args = 4; + break; + } + /* _new_mmap */ + case 477: { + struct _new_mmap_args *p = params; + uarg[0] = (intptr_t) p->addr; /* caddr_t */ + uarg[1] = p->len; /* size_t */ + iarg[2] = p->prot; /* int */ + iarg[3] = p->flags; /* int */ + iarg[4] = p->fd; /* int */ + iarg[5] = p->pos; /* off_t */ + *n_args = 6; + break; + } + /* _new_lseek */ + case 478: { + struct _new_lseek_args *p = params; + iarg[0] = p->fd; /* int */ + iarg[1] = p->offset; /* off_t */ + iarg[2] = p->whence; /* int */ + *n_args = 3; + break; + } + /* _new_truncate */ + case 479: { + struct _new_truncate_args *p = params; + uarg[0] = (intptr_t) p->path; /* char * */ + iarg[1] = p->length; /* off_t */ + *n_args = 2; + break; + } + /* _new_ftruncate */ + case 480: { + struct _new_ftruncate_args *p = params; + iarg[0] = p->fd; /* int */ + iarg[1] = p->length; /* off_t */ + *n_args = 2; + break; + } default: *n_args = 0; break; ==== //depot/projects/hammer/sys/kern/vfs_syscalls.c#65 (text+ko) ==== @@ -1788,16 +1788,29 @@ off_t offset; int whence; } */ nuap; - int error; nuap.fd = uap->fd; nuap.offset = uap->offset; nuap.whence = uap->whence; - error = lseek(td, &nuap); - return (error); + return (lseek(td, &nuap)); } #endif /* COMPAT_43 */ +/* Skip the 'pad' argument */ +int +_new_lseek(td, uap) + struct thread *td; + register struct _new_lseek_args *uap; +{ + struct lseek_args ouap; + + ouap.fd = uap->fd; + ouap.pad = 0; + ouap.offset = uap->offset; + ouap.whence = uap->whence; + return (lseek(td, &ouap)); +} + /* * Check access permissions using passed credentials. */ @@ -3154,6 +3167,33 @@ } #endif /* COMPAT_43 */ +/* Versions without the pad argument */ +int +_new_truncate(td, uap) + struct thread *td; + register struct _new_truncate_args *uap; +{ + struct truncate_args ouap; + + ouap.path = uap->path; + ouap.pad = 0; + ouap.length = uap->length; + return (truncate(td, &ouap)); +} + +int +_new_ftruncate(td, uap) + struct thread *td; + register struct _new_ftruncate_args *uap; +{ + struct ftruncate_args ouap; + + ouap.fd = uap->fd; + ouap.pad = 0; + ouap.length = uap->length; + return (ftruncate(td, &ouap)); +} + /* * Sync an open file. */ ==== //depot/projects/hammer/sys/sys/syscall.h#55 (text+ko) ==== @@ -2,7 +2,7 @@ * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/sys/syscall.h,v 1.209 2006/11/11 22:01:24 ru Exp $ + * $FreeBSD$ * created from FreeBSD: src/sys/kern/syscalls.master,v 1.231 2006/11/03 15:23:14 rrs Exp */ @@ -394,4 +394,10 @@ #define SYS_sctp_generic_sendmsg 472 #define SYS_sctp_generic_sendmsg_iov 473 #define SYS_sctp_generic_recvmsg 474 -#define SYS_MAXSYSCALL 475 +#define SYS__new_pread 475 +#define SYS__new_pwrite 476 +#define SYS__new_mmap 477 +#define SYS__new_lseek 478 +#define SYS__new_truncate 479 +#define SYS__new_ftruncate 480 +#define SYS_MAXSYSCALL 481 ==== //depot/projects/hammer/sys/sys/syscall.mk#55 (text+ko) ==== @@ -1,6 +1,6 @@ # FreeBSD system call names. # DO NOT EDIT-- this file is automatically generated. -# $FreeBSD: src/sys/sys/syscall.mk,v 1.164 2006/11/11 22:01:24 ru Exp $ +# $FreeBSD$ # created from FreeBSD: src/sys/kern/syscalls.master,v 1.231 2006/11/03 15:23:14 rrs Exp MIASM = \ syscall.o \ @@ -335,4 +335,10 @@ sctp_peeloff.o \ sctp_generic_sendmsg.o \ sctp_generic_sendmsg_iov.o \ - sctp_generic_recvmsg.o + sctp_generic_recvmsg.o \ + _new_pread.o \ + _new_pwrite.o \ + _new_mmap.o \ + _new_lseek.o \ + _new_truncate.o \ + _new_ftruncate.o ==== //depot/projects/hammer/sys/sys/sysproto.h#56 (text+ko) ==== @@ -2,7 +2,7 @@ * System call prototypes. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/sys/sysproto.h,v 1.213 2006/11/11 22:01:24 ru Exp $ + * $FreeBSD$ * created from FreeBSD: src/sys/kern/syscalls.master,v 1.231 2006/11/03 15:23:14 rrs Exp */ @@ -1482,6 +1482,39 @@ char sinfo_l_[PADL_(struct sctp_sndrcvinfo *)]; struct sctp_sndrcvinfo * sinfo; char sinfo_r_[PADR_(struct sctp_sndrcvinfo *)]; char msg_flags_l_[PADL_(int *)]; int * msg_flags; char msg_flags_r_[PADR_(int *)]; }; +struct _new_pread_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char buf_l_[PADL_(void *)]; void * buf; char buf_r_[PADR_(void *)]; + char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)]; + char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)]; +}; +struct _new_pwrite_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char buf_l_[PADL_(const void *)]; const void * buf; char buf_r_[PADR_(const void *)]; + char nbyte_l_[PADL_(size_t)]; size_t nbyte; char nbyte_r_[PADR_(size_t)]; + char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)]; +}; +struct _new_mmap_args { + char addr_l_[PADL_(caddr_t)]; caddr_t addr; char addr_r_[PADR_(caddr_t)]; + char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; + char prot_l_[PADL_(int)]; int prot; char prot_r_[PADR_(int)]; + char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char pos_l_[PADL_(off_t)]; off_t pos; char pos_r_[PADR_(off_t)]; +}; +struct _new_lseek_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)]; + char whence_l_[PADL_(int)]; int whence; char whence_r_[PADR_(int)]; +}; +struct _new_truncate_args { + char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; + char length_l_[PADL_(off_t)]; off_t length; char length_r_[PADR_(off_t)]; +}; +struct _new_ftruncate_args { + char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; + char length_l_[PADL_(off_t)]; off_t length; char length_r_[PADR_(off_t)]; +}; int nosys(struct thread *, struct nosys_args *); void sys_exit(struct thread *, struct sys_exit_args *); int fork(struct thread *, struct fork_args *); @@ -1814,6 +1847,12 @@ int sctp_generic_sendmsg(struct thread *, struct sctp_generic_sendmsg_args *); int sctp_generic_sendmsg_iov(struct thread *, struct sctp_generic_sendmsg_iov_args *); int sctp_generic_recvmsg(struct thread *, struct sctp_generic_recvmsg_args *); +int _new_pread(struct thread *, struct _new_pread_args *); +int _new_pwrite(struct thread *, struct _new_pwrite_args *); +int _new_mmap(struct thread *, struct _new_mmap_args *); +int _new_lseek(struct thread *, struct _new_lseek_args *); +int _new_truncate(struct thread *, struct _new_truncate_args *); +int _new_ftruncate(struct thread *, struct _new_ftruncate_args *); #ifdef COMPAT_43 @@ -2365,6 +2404,12 @@ #define SYS_AUE_sctp_generic_sendmsg AUE_NULL #define SYS_AUE_sctp_generic_sendmsg_iov AUE_NULL #define SYS_AUE_sctp_generic_recvmsg AUE_NULL +#define SYS_AUE__new_pread AUE_PREAD +#define SYS_AUE__new_pwrite AUE_PWRITE +#define SYS_AUE__new_mmap AUE_MMAP +#define SYS_AUE__new_lseek AUE_LSEEK +#define SYS_AUE__new_truncate AUE_TRUNCATE +#define SYS_AUE__new_ftruncate AUE_FTRUNCATE #undef PAD_ #undef PADL_ ==== //depot/projects/hammer/sys/vm/vm_mmap.c#40 (text+ko) ==== @@ -392,6 +392,23 @@ return (error); } +int +_new_mmap(td, uap) + struct thread *td; + struct _new_mmap_args *uap; +{ + struct mmap_args oargs; + + oargs.addr = uap->addr; + oargs.len = uap->len; + oargs.prot = uap->prot; + oargs.flags = uap->flags; + oargs.fd = uap->fd; + oargs.pad = 0; + oargs.pos = uap->pos; + return (mmap(td, &oargs)); +} + #ifdef COMPAT_43 #ifndef _SYS_SYSPROTO_H_ struct ommap_args {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200704121846.l3CIk7qi082088>