From owner-svn-src-all@FreeBSD.ORG Wed Apr 21 19:28:02 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3CF70106566B; Wed, 21 Apr 2010 19:28:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2B89C8FC24; Wed, 21 Apr 2010 19:28:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3LJS2KX046008; Wed, 21 Apr 2010 19:28:02 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3LJS2Tl046005; Wed, 21 Apr 2010 19:28:02 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201004211928.o3LJS2Tl046005@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 21 Apr 2010 19:28:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207007 - head/sys/compat/freebsd32 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2010 19:28:02 -0000 Author: kib Date: Wed Apr 21 19:28:01 2010 New Revision: 207007 URL: http://svn.freebsd.org/changeset/base/207007 Log: Extract the code to copy-out struct rusage32 from struct rusage into the new function. Reviewed by: jhb MFC after: 1 week Modified: head/sys/compat/freebsd32/freebsd32_misc.c head/sys/compat/freebsd32/freebsd32_util.h Modified: head/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_misc.c Wed Apr 21 19:03:34 2010 (r207006) +++ head/sys/compat/freebsd32/freebsd32_misc.c Wed Apr 21 19:28:01 2010 (r207007) @@ -129,6 +129,28 @@ static int freebsd32_kevent_copyin(void #define RETVAL_LO 0 #endif +void +freebsd32_rusage_out(const struct rusage *s, struct rusage32 *s32) +{ + + TV_CP(*s, *s32, ru_utime); + TV_CP(*s, *s32, ru_stime); + CP(*s, *s32, ru_maxrss); + CP(*s, *s32, ru_ixrss); + CP(*s, *s32, ru_idrss); + CP(*s, *s32, ru_isrss); + CP(*s, *s32, ru_minflt); + CP(*s, *s32, ru_majflt); + CP(*s, *s32, ru_nswap); + CP(*s, *s32, ru_inblock); + CP(*s, *s32, ru_oublock); + CP(*s, *s32, ru_msgsnd); + CP(*s, *s32, ru_msgrcv); + CP(*s, *s32, ru_nsignals); + CP(*s, *s32, ru_nvcsw); + CP(*s, *s32, ru_nivcsw); +} + int freebsd32_wait4(struct thread *td, struct freebsd32_wait4_args *uap) { @@ -146,22 +168,7 @@ freebsd32_wait4(struct thread *td, struc if (uap->status != NULL) error = copyout(&status, uap->status, sizeof(status)); if (uap->rusage != NULL && error == 0) { - TV_CP(ru, ru32, ru_utime); - TV_CP(ru, ru32, ru_stime); - CP(ru, ru32, ru_maxrss); - CP(ru, ru32, ru_ixrss); - CP(ru, ru32, ru_idrss); - CP(ru, ru32, ru_isrss); - CP(ru, ru32, ru_minflt); - CP(ru, ru32, ru_majflt); - CP(ru, ru32, ru_nswap); - CP(ru, ru32, ru_inblock); - CP(ru, ru32, ru_oublock); - CP(ru, ru32, ru_msgsnd); - CP(ru, ru32, ru_msgrcv); - CP(ru, ru32, ru_nsignals); - CP(ru, ru32, ru_nvcsw); - CP(ru, ru32, ru_nivcsw); + freebsd32_rusage_out(&ru, &ru32); error = copyout(&ru32, uap->rusage, sizeof(ru32)); } return (error); @@ -755,22 +762,7 @@ freebsd32_getrusage(struct thread *td, s if (error) return (error); if (uap->rusage != NULL) { - TV_CP(s, s32, ru_utime); - TV_CP(s, s32, ru_stime); - CP(s, s32, ru_maxrss); - CP(s, s32, ru_ixrss); - CP(s, s32, ru_idrss); - CP(s, s32, ru_isrss); - CP(s, s32, ru_minflt); - CP(s, s32, ru_majflt); - CP(s, s32, ru_nswap); - CP(s, s32, ru_inblock); - CP(s, s32, ru_oublock); - CP(s, s32, ru_msgsnd); - CP(s, s32, ru_msgrcv); - CP(s, s32, ru_nsignals); - CP(s, s32, ru_nvcsw); - CP(s, s32, ru_nivcsw); + freebsd32_rusage_out(&s, &s32); error = copyout(&s32, uap->rusage, sizeof(s32)); } return (error); Modified: head/sys/compat/freebsd32/freebsd32_util.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_util.h Wed Apr 21 19:03:34 2010 (r207006) +++ head/sys/compat/freebsd32/freebsd32_util.h Wed Apr 21 19:28:01 2010 (r207007) @@ -94,9 +94,12 @@ int syscall32_module_handler(struct m int syscall32_helper_register(struct syscall_helper_data *sd); int syscall32_helper_unregister(struct syscall_helper_data *sd); -register_t *freebsd32_copyout_strings(struct image_params *imgp); struct iovec32; +struct rusage32; +register_t *freebsd32_copyout_strings(struct image_params *imgp); int freebsd32_copyiniov(struct iovec32 *iovp, u_int iovcnt, struct iovec **iov, int error); +void freebsd32_rusage_out(const struct rusage *s, struct rusage32 *s32); + #endif /* !_COMPAT_FREEBSD32_FREEBSD32_UTIL_H_ */